@agile-team/mach-table 0.34.0 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- 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-CfZinb9Q.d.cts → api-CUQtfQR4.d.cts} +2 -2
- package/dist/{api-CfZinb9Q.d.ts → api-CUQtfQR4.d.ts} +2 -2
- package/dist/business.d.cts +1 -1
- package/dist/business.d.ts +1 -1
- package/dist/{configuration-D2lEYcli.d.cts → configuration-BNK9jzn2.d.cts} +1 -1
- package/dist/{configuration-WTbQcWck.d.ts → configuration-D4gQ2s21.d.ts} +1 -1
- package/dist/import.d.cts +1 -1
- package/dist/import.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- 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.d.cts +1 -1
- package/dist/server-side.d.ts +1 -1
- package/dist/{shared-D-DnodkE.d.cts → shared-BgBZ4-2C.d.cts} +1 -1
- package/dist/{shared-buw2Rj4E.d.ts → shared-h73PMB5p.d.ts} +1 -1
- package/dist/workbench.d.cts +3 -3
- package/dist/workbench.d.ts +3 -3
- package/dist/worker.d.cts +2 -2
- package/dist/worker.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var He="0.34.0";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 P(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 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=`${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 zr=0;function _r(n="rg"){return zr++,`${n}-${zr}`}var Kr='<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>',Wr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',$r='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',Ur='<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 Ve=class{constructor(e){this.ld=e;this.It=new Map}on(e,t){let r=this.It.get(e);return r||(r=new Set,this.It.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}Af(e,t){let r=this.It.get(e);r&&(r.delete(t),r.size===0&&this.It.delete(e))}emit(e,t){let r=this.It.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.ld?.(o,e)}}clear(){this.It.clear()}};var zn=new Set(["__proto__","prototype","constructor"]),ge=new Map;function _t(n){if(typeof n!="string"||n.length===0)return null;let e=ge.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!zn.has(i))?t:null;return n.length<=1024&&(ge.size>=256&&ge.delete(ge.keys().next().value),ge.set(n,r)),r}function Kt(n){return _t(n)!==null}function K(n,e){if(n==null)return;let t=_t(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ye(n,e,t){if(n==null)return!1;let r=_t(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 ae={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 _n=16,Kn=512,Wn=20,$n=2e3,Un=2e3,qn={text:new Set(ae.text),number:new Set(ae.number),date:new Set(ae.date)};function jn(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Yn(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,...Xn(r,e)}}function Xn(n,e){let t=e==="number"?qr(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?qr(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function qr(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Jn(n,e){let t=[],r=qn[e];for(let i of n.slice(0,Wn)){let o=Yn(i,e,r);o&&t.push(o)}return t}function Wt(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(jn).slice(0,$n)}: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:Jn(e.conditions,e.type)}}function Zn(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=Wt(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function Qn(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=jr(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 eo(n,e,t){return e<=_n&&t.nodes<Kn&&n!=null&&typeof n=="object"}function jr(n,e,t){if(!eo(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?Zn(r,t):r.kind==="group"?Qn(r,e,t):null;return t.ancestors.delete(n),i}function z(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=jr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function to(n,e){return{kind:"condition",colId:n,filter:e}}function Q(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,Un)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=Wt(i);s&&(t[o]=s)}return t}function ro(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}function F(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function Be(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:F(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 $t={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ve={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}},be={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},io=Object.keys(be);function no(n){let e={};for(let t of io)e[t]=n[t]??be[t];return e}function I(n,e,t,r=!1){return F(n,t,r)??e}function oo(n){return n&&Object.prototype.hasOwnProperty.call(ve,n)?n:"normal"}function so(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function ao(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 Ut(n,e){let t=typeof n=="function"?n(e):K(e,n);return t==null?"":String(t)}function lo(n){let e=n.rowKey,t=e?({data:r})=>Ut(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function co(n,e){let t=ve[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...$t,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...lo(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 uo(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:so(n)}}function ho(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 po(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function fo(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:ao(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function qt(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 mo(n){return{advancedFilterModel:z(n.advancedFilterModel),persistence:Be(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 go(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 vo(n,e){for(let t of yo)n[t]&&Reflect.set(e,t,n[t])}function bo(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function Yr(n){let e=oo(n.size),t={...no(n),...co(n,e),...uo(n),...ho(n),...po(n),...fo(n),...qt(n),...mo(n),...go(n),features:Array.isArray(n.features)?n.features:[]};return vo(n,t),bo(n,t),t}function Xr(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function le(n,e){return Xr(n.type).includes(e)}function Jr(n,e,t={}){let r={};for(let i of Xr(n.type)){let o=t[i];o&&Object.assign(r,o)}return{...e,...r,...n}}var $=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=typeof this.colDef.flex=="number"&&Number.isFinite(this.colDef.flex)&&this.colDef.flex>0?this.colDef.flex:null}};var ee=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 we(n){return Array.isArray(n.children)}function ze(n,e){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:e}function Zr(n){let e=ze(n.minWidth,80);return{min:e,max:Math.max(e,ze(n.maxWidth,Number.MAX_SAFE_INTEGER))}}function V(n,e){let{min:t,max:r}=Zr(e),i=ze(n,ze(e.width,150));return Math.max(t,Math.min(r,i))}function Qr(n,e){let t=n.map(s=>V(s.width??150,s)),r=[],i=0;n.forEach((s,a)=>{let l=s.flex??0;l>0&&(r.push(a),i+=l)});let o=0;for(let s of t)o+=s;if(i>0&&e>o){let s=e-o;for(let a=0;a<4&&s>.5&&r.length>0;a++){let l=[],d=0;for(let p of r){let m=n[p].flex??0;l.push(p),d+=m}let c=[];for(let p=0;p<l.length;p++){let m=l[p],v=n[m].flex??0,w=s*v/d,C=t[m];t[m]=V(C+w,n[m]),c.push(t[m]-C)}let u=0;for(let p of c)u+=p;s-=u;let h=l.filter((p,m)=>c[m]>.001);if(h.length===l.length)break;r.length=0;for(let p of h)r.push(p)}}return t}function wo(n,e,t){let r=new Set(n.map((o,s)=>s)),i=t;for(let o=0;o<n.length+1&&r.size>0;o++){let s=0;for(let l of r)s+=Math.max(1,e[l]);if(s<=0)break;let a=!1;for(let l of[...r]){let d=i*(Math.max(1,e[l])/s),c=V(d,n[l]),{min:u,max:h}=Zr(n[l]);(d<u||d>h)&&(e[l]=c,i-=c,r.delete(l),a=!0)}if(!a){for(let l of r)e[l]=V(i*(Math.max(1,e[l])/s),n[l]);break}i=Math.max(0,i)}}function Co(n,e,t){let r=t-e.reduce((i,o)=>i+o,0);if(!(Math.abs(r)<=.01))for(let i=e.length-1;i>=0;i--){let o=V(e[i]+r,n[i]);if(Math.abs(o-e[i])>.01){e[i]=o;return}}}function _e(n,e){let t=n.map(r=>V(r.width??150,r));return!Number.isFinite(e)||e<=0||n.length===0||(wo(n,t,e),Co(n,t,e)),t}var jt="__rg_detail_toggle__";function de(n){return typeof n=="number"&&Number.isFinite(n)&&n>0}var Ke=class{constructor(e){this.e=e;this.columns=[];this.Ss=new Map;this.ye=[];this.left=[];this.center=[];this.right=[];this.sortModel=[];this.defs=[];this.At=1;this.vn=new Map;this.dd=0}ar(e){this.defs=e?[...e]:[];let t=new Map(this.columns.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[jt]:[]),o=(s,a,l)=>s.map((d,c)=>{if(we(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new ee(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 v=new $(p,Jr(u,r,this.e.r.columnTypes));v.parentGroup=a,v.level=l;let w=t.get(p);return w&&(v.manualWidth=w.manualWidth,v.contentWidth=w.contentWidth,v.flex=w.flex,v.hide=w.hide,v.pinned=w.pinned),v});if(this.ye=o(this.defs,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new $(jt,{colId:jt,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.ye.unshift(s)}if(this.columns=this.Yr(this.ye),this.Ss=new Map(this.columns.map(s=>[s.id,s])),this.At=this.columns.reduce((s,a)=>Math.max(s,a.level+1),1),this.sortModel=this.sortModel.filter(s=>this.columns.some(a=>a.id===s.colId)),this.sortModel.length===0){let s=[];for(let a of this.columns)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.sortModel=s}this.Lt()}Yr(e,t=[]){for(let r of e)r instanceof ee?this.Yr(r.children,t):t.push(r);return t}Lt(){let e=this.columns.filter(t=>!t.hide);this.left=e.filter(t=>t.pinned==="left"),this.right=e.filter(t=>t.pinned==="right"),this.center=e.filter(t=>t.pinned===null),this.vn.clear(),this.c().forEach((t,r)=>this.vn.set(t.id,r))}Me(e){return this.vn.get(e)??-1}X(){return this.columns}Xr(){return this.defs}cd(){return this.ye}ud(){return this.At}L(e){return this.Ss.get(e)}C(e){return e==="left"?this.left:e==="right"?this.right:this.center}c(){return[...this.left,...this.center,...this.right]}ze(){return this.c().filter(e=>e.colDef.rowGroup===!0)}hd(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}bn(){return this.center.some(e=>e.colDef.colSpan!=null)}Ms(){let e=this.c();return this.center.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}lr(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}Is(e){this.dd=e;let t=0;for(let c of[...this.left,...this.right])c.currentWidth=V(c.manualWidth??c.contentWidth??c.colDef.width??150,this.ct(c)),t+=c.currentWidth;let r=Math.max(0,e-t),i=[],o=[];for(let c of this.center)(c.colDef.suppressSizeToFit||c.manualWidth!=null?o:i).push(c);let s=0;for(let c of o)c.currentWidth=V(c.manualWidth??c.contentWidth??c.colDef.width??150,this.ct(c)),s+=c.currentWidth;let a=i.map(c=>this.ct(c)),l=Math.max(0,r-s),d=this.e.r.columnLayout==="fit"?_e(a,l):Qr(a,l);i.forEach((c,u)=>{c.currentWidth=d[u]})}ct(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Ie(e,t){return de(t)?(e.manualWidth=V(t,this.ct(e)),e.flex=null,!0):!1}As(e,t){return de(t)?(e.resetWidth(),e.contentWidth=V(t,this.ct(e)),!0):!1}wn(e,t){let r=this.L(e);!r||r.hide===!t||(r.hide=!t,this.Lt())}ut(e,t){let r=this.L(e);if(!r)return!1;let i=this.lr(r),o=u=>r.parentGroup?!0:this.lr(u)===i,s=r.parentGroup?r.parentGroup.children:this.ye,a=s.filter(u=>u instanceof $&&!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 $&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.columns=this.Yr(this.ye),this.Lt(),!0)}Cn(e,t){let r=this.L(e);!r||!r.movable||(r.pinned=t,this.Lt())}Jr(){return this.columns.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}))}Ls(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.columns){let i=t.get(r.id);i&&this.pd(r,i)}this.fd(e),this.Lt()}pd(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),de(t.flex)&&(e.flex=t.flex)):de(t.flex)?(e.flex=t.flex,e.manualWidth=null):de(t.width)&&(e.manualWidth=V(t.width,this.ct(e)),e.flex=null),de(t.contentWidth)&&(e.contentWidth=V(t.contentWidth,this.ct(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}fd(e){let t=new Map;e.forEach((i,o)=>t.set(i.colId,o));let r=i=>i.pinned==="left"?"left":i.pinned==="right"?"right":"center";for(let i of["left","center","right"]){let o=this.ye.filter(d=>d instanceof $&&!d.hide&&d.parentGroup===null&&r(d)===i);if(o.length<2)continue;let s=o.filter(d=>d.movable),a=s.slice().sort((d,c)=>(t.get(d.id)??Number.MAX_SAFE_INTEGER)-(t.get(c.id)??Number.MAX_SAFE_INTEGER));if(a.every((d,c)=>d===s[c]))continue;let l=[];this.ye.forEach((d,c)=>{d instanceof $&&!d.hide&&d.parentGroup===null&&r(d)===i&&d.movable&&l.push(c)}),l.forEach((d,c)=>{this.ye[d]=a[c]})}this.columns=this.Yr(this.ye)}Tn(){for(let e of this.columns){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.Lt()}U(){return this.sortModel.map(e=>({...e}))}dr(e){if(!e||e.length===0){this.sortModel=[];return}this.sortModel=e.filter(t=>this.columns.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Zr(e,t){let r=[...this.sortModel],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.sortModel=r}};function te(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var To=()=>te(void 0,"[MachTable] Operation cancelled.");function We(n,e,t=To){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 ti(n){return n==null?"":String(n).toLowerCase()}function Do(n,e,t){let r=ti(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 Eo(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 xo(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:Eo(r,i,e)}function Ro(n,e,t){let r=i=>xo(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function Yt(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 So(n,e,t){let r=Yt(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?Yt(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?Yt(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 Mo(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function ri(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Do(n,e.conditions,t);case"number":return Ro(n,e.conditions,t);case"date":return So(n,e.conditions,t);case"set":return Mo(n,e.values);default:return!0}}function ii(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>ri(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>ii(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 Xt(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?ii(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>ri(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>ti(i(d,u)).includes(c)))}var ni=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Io(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function Ao(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function Lo(n,e){return n===e?0:n?1:-1}function $e(n,e){let t=Io(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Ao(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Lo(n,e);let r=String(n),i=String(e);return ni?ni.compare(r,i):r.localeCompare(i)}function Jt(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??$e,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 oi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function si(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 ai(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 Ue(n,e){let t=oi();for(let r of n)si(t,r);return ai(t,e)}var qe={sum:n=>Ue(n,"sum"),avg:n=>Ue(n,"avg"),count:n=>n.length,min:n=>Ue(n,"min"),max:n=>Ue(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function li(n,e,t){if(e===qe.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===qe[o]);if(!r)return e(n.map(t));let i=oi();for(let o of n)si(i,t(o));return ai(i,r)}function Zt(n){let e={...qe,...n??{}};return t=>e[t]}var je="group:";function di(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Qt(n)])}function Qt(n){return n==null?"(\u7A7A)":String(n)}function ci(n){return je+JSON.stringify(n)}function ko(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=di(o),a=r.get(s);a||(a={key:s,label:Qt(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 ui(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 ko(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=ci(p);o.push(m);let v=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:v.leaves,aggValues:r(v.leaves)}),i.has(m))for(let w of v.display)c.push(w);if(l>0)for(let w of v.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function hi(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,di(h)]),c+=`/g${u}:${Qt(h)}`,!i.has(c))continue;let p=ci(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 Po(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));Po(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 fi(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function mi(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>K(r.data,o));i.some(fi)||t.set(r,i)}return t}function gi(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=K(e,i);return fi(s)||!Object.is(r[o],s)}):!1}function re(n){return te(n.reason,"Block request aborted")}function Ye(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var Xe=class{constructor(e,t,r=4){this.maxBlocks=e;this.En=t;this.maxConcurrentRequests=r;this.J=new Map;this.q=new Map;this.ks=0;this.generation=0;this.hitCount=0;this.missCount=0;this.evictionCount=0;this.Qr=0;this.ei=new Set;this.maxBlocks=Ye(e),this.maxConcurrentRequests=Ye(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=Ye(e),this.maxConcurrentRequests=Ye(t),this.Dn(),this.ti()}md(e){this.ei=e,this.Dn()}peek(e){let t=this.J.get(e);if(t)return t.touchedAt=++this.ks,t}has(e){return this.J.has(e)}invalidate(e){let t=this.q.get(e);t&&(this.q.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(re(t.controller.signal)));let r=this.J.get(e);r&&(this.J.delete(e),this.En?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(re(r));let o=this.peek(e);if(o)return this.hitCount++,Promise.resolve(o);let s=this.q.get(e);if(s)return this.hitCount++,s.priority=Math.max(s.priority,i),this.ti(),this.Ps(e,s,r);this.missCount++;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.q.set(e,u);let h=this.Ps(e,u,r);return this.ti(),h}gd(){this.generation++,this.ei.clear();for(let e of this.q.values())e.controller.abort(),e.state==="queued"&&e.reject(re(e.controller.signal));this.q.clear();for(let[e,t]of this.J)this.En?.(e,t);this.J.clear()}snapshot(){let e=0,t=0;for(let r of this.J.values())e+=r.rows.length;for(let r of this.q.values())r.state==="active"&&t++;return{cachedBlockCount:this.J.size,loadingBlockCount:this.q.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.q.size-t),cachedRowCount:e,hitCount:this.hitCount,missCount:this.missCount,evictionCount:this.evictionCount}}ti(){for(;this.Qr<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.q)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.yd(e,t)}}yd(e,t){t.state="active",this.Qr++;let r=this.generation;this.vd(t).then(i=>{r===this.generation&&!t.controller.signal.aborted&&(this.J.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.ks}),this.Dn()),t.resolve(i)},t.reject).finally(()=>{this.Qr=Math.max(0,this.Qr-1),this.q.get(e)===t&&this.q.delete(e),this.ti()})}vd(e){let{signal:t}=e.controller;return We(Promise.resolve().then(()=>{if(t.aborted)throw re(t);return e.loader(t)}),t,()=>re(t))}Ps(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.q.get(e)===t&&(this.q.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(re(t.controller.signal))),o(re(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")))))})}Dn(){let e=Math.max(this.maxBlocks,this.ei.size+1);for(;this.J.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.J)this.ei.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.J.get(t);this.J.delete(t),this.evictionCount++,i&&this.En?.(t,i)}}};function Ce(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var Je=class{constructor(e){this.e=e;this.all=[];this.H=[];this.Z=new Map;this.displayed=[];this.h=new Map;this.filterModel={};this.advancedFilterModel=null;this.quickFilter=null;this.k=new Set;this.K=new Set;this.kt=[];this.cr=new Map;this.Gs=[];this.P=null;this.Pt=!1;this.Ns=!1;this._e=0;this.ri=null;this.ii=null;this.ni=new WeakMap;this.ur=new WeakMap;this.Ke=new Map;this.hr=new Map;this.pr=0;this.oi=0;this.We=null;this.$e=new Map;this.ht=new Map;this.si=new Set;this.pt=new Map;this.Ue=new Xe(12,e=>this.Fs(e));this.fr=0;this.ai=null;this.xn=!1;this.Os=0;this.te=[];this.page=1;this.pageSize=20;this.advancedFilterModel=z(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 N(){return this.e.r.treeData}get p(){return this.e.r.datasource!=null}get ue(){return this.p&&this.e.r.datasourceMode==="block"}Gt(){if(this.p){if(this.ue)return this.Nt();let e=Math.max(0,this.displayed.length-this.all.length);return(this.P??this.all.length)+e}return this.displayed.length}Rn(){return this.pr}mr(){return this.oi}bd(){return this.Ns}li(e){return!this.p||e?.aborted?Promise.resolve():(this.oi++,this.e.ve(),this.e.api.editing.stop({cancel:!0}),this.e.V.clear(),this.di(),this.P=null,this.Pt=!1,this.all=[],this.H=[],this.h.clear(),this.k.clear(),this.e.O.clear(),this.b(),this.e.u({data:!0}),this.ue?(this.Ue.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.ci(0,e)):this.Hs(0,void 0,e))}ft(e){this.Ns=e,this.e.o.ft(e,this.e.g("loading"))}Hs(e,t,r){if(!this.p||this.Pt||this.P!=null&&e>=this.P)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this._e,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ri=a,this.Pt=!0,this.ft(!0),new Promise(d=>{let c=!1;this.ii=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this._e&&(this.Pt=!1,this.ri=null,this.ii=null,this.ft(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.Vs(e,o,a.signal,(h,p)=>{if(s!==this._e||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.P=p:h.length<o-e&&(this.P=e+h.length);let m=this.all.length===0;this.wd(h),u(),this.b(),this.e.u({data:!0}),m&&this.e.he(),this.e.B.ui()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}di(){this._e++,this.ri?.abort(),this.ri=null,this.Pt=!1,this.ft(!1),this.ii?.(),this.ii=null,this.Ue.gd(),this.$e.clear(),this.ht.clear(),this.si.clear();for(let[e,t]of this.pt)this.h.get(e)===t&&this.h.delete(e);this.pt.clear()}wd(e){for(let t of e){if(t==null)continue;let r=this.all.length,i=this.resolveRowId(t,r,`inf-${this.e.Ft()}`);if(this.h.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.m.Sn(i)};this.all.push(o),this.h.set(i,o),this.H.push(o)}}ci(e,t,r=0){if(!this.ue||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Bs(t.reason));let i=this.e.r.blockSize,o=this._e,s=e*i;if(s>=this.Nt())return Promise.resolve();let a=this.P==null?s+i:Math.min(this.P,s+i),l=this.Ue.load(e,d=>this.Cd(s,a,d),t,r);return this.ft(this.all.length===0&&this.Ue.snapshot().loadingBlockCount>0),l.then(d=>{o!==this._e||t?.aborted||this.e.s()||!this.ue||!this.Ue.has(e)||this.si.has(e)||(this.Td(e,d),this.b(),this.e.u({data:!0}),this.e.B.ui(),o===this._e&&!this.e.s()&&this.zs(this.e.a.Mn().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this._e&&this.ft(this.all.length===0&&this.Ue.snapshot().loadingBlockCount>0)})}Cd(e,t,r){return new Promise((i,o)=>{this.Vs(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")))})}Vs(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.Bs(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=v=>{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(v))}};try{let v=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.U(),filterModel:this.j(),advancedFilterModel:this.be(),quickFilterText:this.quickFilter,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});v&&typeof v.catch=="function"&&v.catch(m)}catch(v){m(v)}};h()}Td(e,t){let r=this.e.r.blockSize,i=e*r;this.Fs(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.P=t.lastRow:t.rows.length<r&&(this.P=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.P!=null&&a>=this.P)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.pt.get(l),c=this.h.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.m.Sn(l)};u.rowIndex=a,u.selected=this.e.m.Sn(l),this.pt.delete(l),this.$e.set(a,u),this.ht.delete(a),this.h.set(l,u),this.ur.set(u,a+1)}),this._s(),this.si.add(e)}Fs(e){this.si.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.$e.get(o);s&&(i??(i=new Set(this.e.V.getDirtyRowIds())),this.$e.delete(o),i.has(s.id)?this.pt.set(s.id,s):this.h.get(s.id)===s&&this.h.delete(s.id))}this._s()}_s(){this.all=[...this.$e.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.H=this.all}Nt(){if(this.P!=null)return this.P;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.$e.size===0)return this.e.r.blockSize;let e=0;for(let t of this.$e.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}Dd(e){let t=this.ht.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.ht.set(e,t),this.ht.size>2e3)){let r=this.ht.keys().next().value;r!=null&&this.ht.delete(r)}return t}Bs(e){return te(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)))}Ed(e){if(this.ue){this.zs(e);return}if(!this.p||this.Pt)return;let t=this.all.length;if(this.P!=null&&t>=this.P)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.P==null?t+i:Math.min(this.P,t+i);this.Hs(t,o)}zs(e){if(e<0)return;this.Ks();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.Mn().first/t),o=this.e.r.blockPrefetch,s=r<this.Os?-1:1;this.Os=r;for(let a=i;a<r;a++)this.ci(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.Nt()||this.ci(d,void 0,o-a+1).catch(()=>{})}}Ae(){return this.li().catch(()=>{})}xd(){return this.di(),this.p?this.li().catch(()=>{}):(this.P=null,this.qe(this.e.r.rowData),this.e.u({data:!0}),Promise.resolve())}destroy(){this.We=null,this.di(),this.Ws(),this.In(),this.all=this.H=this.displayed=this.te=[],this.h.clear(),this.Z.clear(),this.cr.clear(),this.Gs=[],this.k.clear(),this.K.clear(),this.kt=[]}An(e,t,r){if(!this.ue)return Promise.resolve();this.Ks();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Nt(),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.ci(c,r,100));return Promise.all(d).then(()=>{})}Ln(){this.ue&&(this.oi++,this.e.ve(),this.e.api.editing.stop({cancel:!0}),this.e.V.clear(),this.di(),this.e.O.clear(),this.all=[],this.H=[],this.h.clear(),this.b(),this.e.u({data:!0}))}kn(){return this.Ue.snapshot()}Ks(){let e=new Set(this.e.V.getDirtyRowIds());for(let[l,d]of this.pt)e.has(l)||(this.pt.delete(l),this.h.get(l)===d&&this.h.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.Mn();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.T;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Rd();a!=null&&r.add(Math.floor(a/t)),this.Ue.md(r)}qe(e){this.oi++,this.e.ve(),this.e.api.editing.stop({cancel:!0}),this.Ws(),this.e.V.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 v=this.N?Ce(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(v)};if(this.ni.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.N&&Array.isArray(v))for(let C of v)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.all=i,this.H=o,this.Z=a,this.h=s,this.e.O.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.$s(c.id)>0&&this.k.add(c.id);this.e.m.Us(t!=null),this.b()}gr(e){return this.Z.get(e)??[]}$s(e){return this.Z.get(e)?.length??0}Pn(e){return this.$s(e)>0}isTreeRowLoading(e){return this.h.get(e)?.treeLoading===!0}Ws(){for(let e of this.Ke.values())e.abort();this.Ke.clear(),this.hr.clear()}loadTreeChildren(e,t=!1){let r=this.h.get(e),i=this.e.r.loadTreeChildren;if(!this.N||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this.gr(e).flatMap(l=>{let d=this.h.get(l)?.data;return d==null?[]:[d]}));let o=this.hr.get(e);if(o&&!t)return o;this.Ke.get(e)?.abort();let s=new AbortController;this.Ke.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.u({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.Sd(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.Ke.get(e)===s&&(this.Ke.delete(e),this.hr.delete(e),r.treeLoading=!1,this.e.u({data:!0}))});return this.hr.set(e,a),a}Sd(e,t){let r=new Set,i=[...this.gr(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this.gr(s)))}this.Md(t,r);for(let s of r)this.Ke.get(s)?.abort(),this.Ke.delete(s),this.hr.delete(s),this.Z.delete(s),this.h.delete(s),this.k.delete(s);this.Z.delete(e.id);let o=this.Gn(e)+1;for(let s of t)s!=null&&this.Nn(e,s,o);this.qs(),this.e.m.Us(this.e.r.resolveRowId!=null),this.b(),this.e.u({data:!0})}Md(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.h.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=Ce(l,this.e.r.childrenKey);d&&s.push(...d)}}yr(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.Ft()}`)];for(;m.length>0;){let v=m.pop();if(!l.has(v)){l.add(v);for(let w of this.Z.get(v)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let v=this.N?Ce(m,this.e.r.childrenKey):void 0;if(v)for(let w of v)p.push(w)}}};e.remove.forEach(c),this.all=this.all.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.h.delete(h.id),this.Z.delete(h.id)),!p});let u=new Set(this.all);this.H=this.H.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.h.get(this.resolveRowId(l,-1,`__missing_update_${this.e.Ft()}`)):d=this.all.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.hi(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.H.length)):this.H.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.Ft()}`);if(this.h.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.h.set(h,p),this.ni.set(p,0);let m=this.N?Ce(c,this.e.r.childrenKey):void 0;if(m)for(let v of m)v!=null&&this.Nn(p,v,1);d.push(p)}),this.H=this.H.slice(0,l).concat(d,this.H.slice(l)),this.qs()}let a={pipelineChanged:this.Id(e,o),updatedRowIds:i.map(l=>l.id)};return this.Ad(a,t),this.e.V.Ld(s),a}Ad(e,t){e.pipelineChanged&&(this.We=null),t&&(e.pipelineChanged?this.b():e.updatedRowIds.length&&this.js())}kd(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.yr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.b():r.size>0&&this.js(),{pipelineChanged:t,updatedRowIds:[...r]}}Id(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.Ys();if(r===null)return!0;if(!r.length)return!1;let i=this.We;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>gi(s,a,r,i.values.get(o)))}Ys(){if(this.N||this.e.r.masterDetail||this.e.r.getRowHeight||this.Xs())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.U(),filterModel:t?this.filterModel:{},advancedFilter:t?this.advancedFilterModel:null,quickFilter:t?this.quickFilter:null})}Pd(){let e=this.Ys();this.We=e?.length?{fields:e,values:mi(this.all,e)}:null}js(){this.e.emit("modelUpdated",{rowCount:this.te.length})}Nn(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.Ft()}`);if(this.h.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Ce(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.h.set(i,s),this.ni.set(s,r);let a=this.Z.get(e.id)??[];if(a.push(s.id),this.Z.set(e.id,a),!!o)for(let l of o)l!=null&&this.Nn(s,l,r+1)}qs(){this.all=[];let e=t=>{this.all.push(t),this.h.has(t.id)||this.h.set(t.id,t);for(let r of this.Z.get(t.id)??[]){let i=this.h.get(r);i&&e(i)}};for(let t of this.H)e(t)}vr(e){let t=JSON.stringify(this.filterModel),r=new Set(this.e.n.X().map(o=>o.id));this.filterModel=Q(e,r);let i=JSON.stringify(this.filterModel)!==t;return i&&(this.We=null),i}j(){return{...this.filterModel}}Ot(e){let t=new Set(this.e.n.X().map(s=>s.id)),r=z(e,t),i=JSON.stringify(this.advancedFilterModel);this.advancedFilterModel=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.We=null),o}be(){return z(this.advancedFilterModel)}Ht(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.quickFilter?!1:(this.quickFilter=t,this.We=null,!0)}br(){return this.quickFilter}Fn(){return Object.keys(this.filterModel).length>0||this.advancedFilterModel!=null||this.quickFilter!=null}b(){this.We=null;let e=this.e.re.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.p){this.Gd(e);return}if(this.Nd(e))return;let i,o=[];if(this.N)i=this.Fd(t,r);else{i=this.all,this.Fn()&&!this.e.r.manualFiltering&&(i=i.filter(Xt(t,this.filterModel,this.advancedFilterModel,this.quickFilter,r)));let l=this.e.n.U();if(l.length>0&&!this.e.r.manualSorting)try{i=Jt(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.ze();if(d.length>0){let c=this.Od(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.all)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.ur.set(a,s))}),this.te=i,this.Vt(),this.Pd(),this.Js(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.re.On(e),this.Hd(o)}Gd(e){this.all.forEach((t,r)=>{this.ue||(t.rowIndex=r),this.ur.set(t,this.ue?t.rowIndex+1:r+1)}),this.displayed=this.all,this.te=this.all,this.cr.clear(),this.pr++,this.e.emit("modelUpdated",{rowCount:this.all.length}),this.e.re.On(e)}Nd(e){let t=this.xn;return this.xn=!1,!t&&this.Xs()?(this.Vd(e),!0):(this.In(),!1)}Xs(){if(!this.e.r.dataProcessor||this.all.length<this.e.r.dataProcessorMinRows||this.N||this.e.r.masterDetail||this.e.n.ze().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Fn(),t=!this.e.r.manualSorting&&this.e.n.U().length>0;return e||t}Vd(e){this.In();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.fr,i=new AbortController;this.ai=i;let o=this.e.n.c(),s=this.all.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.U():[],filterModel:a?this.j():{},advancedFilterModel:a?this.be():null,quickFilterText:a?this.quickFilter:null,signal:i.signal})).then(d=>{if(r!==this.fr||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.h.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.all)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.ur.set(p,m+1)}),this.te=u,this.Vt();let h=(p,m)=>this.e.d(p,m);this.Js(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.re.On(e),this.e.u({data:!0})}).catch(d=>{r!==this.fr||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.xn=!0,this.b(),this.e.u({data:!0}))}).finally(()=>{r===this.fr&&(this.ai=null)})}In(){this.fr++,this.ai?.abort(),this.ai=null}get we(){return this.e.r.paginationEnabled&&!this.p}Vt(){if(!this.we){this.displayed=this.te,this.pr++;return}let e=this.wr(),t=this.getPageCount();if(this.page>t&&(this.page=t),this.page<1&&(this.page=1),this.e.r.paginationPage=this.page,this.e.r.paginationMode==="server"){this.te.forEach((o,s)=>{o.rowIndex=s}),this.displayed=this.te,this.pr++;return}let r=(this.page-1)*e,i=this.te.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.displayed=i,this.pr++}wr(){return this.pageSize=this.e.r.paginationPageSize,Math.max(1,this.pageSize)}Cr(){return this.we?this.page:1}getTotalRowCount(){return this.p?this.Gt():this.we&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.te.length}getPageCount(){return this.we?Math.max(1,Math.ceil(this.getTotalRowCount()/this.wr())):1}Zs(){return this.te}setPage(e,t=!1){if(!this.we)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.page&&(this.page=i,this.e.r.paginationPage=i,this.Vt(),this.e.u({data:!0}),this.e.a.Bt(0,"top"),t||this.pi())}setPageSize(e){if(!this.we)return;let t=Math.max(1,Math.round(e)||this.wr()),r=(this.page-1)*this.wr();this.e.r.paginationPageSize=t,this.pageSize=t,this.page=Math.floor(r/t)+1,this.e.r.paginationPage=this.page,this.Vt(),this.e.u({data:!0}),this.pi()}Qs(e,t){this.pageSize=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.pageSize,this.page=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.page}fi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.p,this.e.r.paginationEnabled&&(this.page=1),this.Vt(),this.e.u({data:!0}),this.pi())}Bd(){this.we&&(this.page=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.Vt(),this.e.u({data:!0}),this.pi())}pi(){this.e.emit("paginationChanged",{page:this.Cr(),pageSize:this.wr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Fd(e,t){let r=this.e.r.manualSorting?[]:this.e.n.U(),i=new Map,o=this.Fn()&&!this.e.r.manualFiltering,s=Xt(e,this.filterModel,this.advancedFilterModel,this.quickFilter,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.Z.get(c.id)??[]){let m=this.h.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=Jt(c,r,e,t));for(let h of u)if(a(h)&&(l.push(h),this.k.has(h.id))){let p=(this.Z.get(h.id)??[]).map(m=>this.h.get(m)).filter(m=>m!=null);d(p)}};return d(this.H),l}zd(){let e=this.Gs,t=0;for(let r of this.displayed)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}_d(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}}Kd(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&$e(i,o(e[t+s],r))===0;)s++;return s}Wd(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._d(s,t,a,e.length-o):this.Kd(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Js(e){if(this.cr.clear(),this.N||this.e.r.masterDetail||this.e.n.ze().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.zd();if(r.length!==0)for(let i of t)this.cr.set(i.id,this.Wd(r,i,e))}$d(e){return this.cr.get(e)}ea(e){return this.ur.get(e)??0}Gn(e){return this.ni.get(e)??0}Od(e,t){let r=Zt(this.e.r.aggFuncs),i=this.e.n.hd();this.kt=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=li(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=hi(this.K,this.all,t,(l,d)=>this.e.d(l,d));this.K=s.expanded;let a=ui(e,t,(l,d)=>this.e.d(l,d),o,this.K);return this.kt=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Hd(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.N){if(this.Pn(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)}Ud(){return[...this.k]}qd(){return[...this.K]}jd(e,t){this.k=new Set(e.filter(r=>this.h.has(r))),this.K=new Set(t)}Hn(e){return this.Vn(e,!0)}Bn(e){return this.Vn(e,!1)}mi(e){return this.Vn(e,!this.k.has(e))}Vn(e,t){let r=this.h.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.k.has(e)||(t?this.k.add(e):this.k.delete(e),this.b(),this.e.u({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.N&&!this.Pn(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}zn(){let e=!1;for(let t of this.all)!this.k.has(t.id)&&this.isRowExpandable(t)&&(this.k.add(t.id),e=!0);e&&(this.b(),this.e.u({data:!0}))}_n(){this.k.size!==0&&(this.k.clear(),this.b(),this.e.u({data:!0}))}Kn(e){return this.setGroupExpanded(e,!this.K.has(e))}isGroupExpanded(e){return this.K.has(e)}Wn(){if(this.kt.length===0)return;let e=!1;for(let t of this.kt)this.K.has(t)||(this.K.add(t),e=!0);e&&(this.b(),this.e.u({data:!0}))}$n(){this.K.size!==0&&(this.K.clear(),this.b(),this.e.u({data:!0}))}setGroupExpanded(e,t){return!this.kt.includes(e)||t===this.K.has(e)||(t?this.K.add(e):this.K.delete(e),this.b(),this.e.u({data:!0})),t}ta(){return!this.N&&!this.p&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.U().length===0&&this.e.n.ze().length===0}ra(e,t){if(!this.ta()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.f(e),i=this.f(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.all.indexOf(r),s=this.all.indexOf(i);return o<0||s<0||o===s?!1:(this.all.splice(o,1),this.all.splice(s,0,r),this.b(),this.e.u({data:!0}),!0)}pe(){return this.all}Yd(){return this.H}je(){return this.displayed}I(){return this.ue?this.Nt():this.displayed.length}f(e){return this.ue?e<0||e>=this.Nt()?void 0:this.$e.get(e)??this.Dd(e):this.displayed[e]}z(e){return this.h.get(e)}Un(e){this.all.forEach(e)}qn(e){let t=0;for(let r of this.te)r.isDetail||r.isGroup||e(r,t++)}};var Ze=class{constructor(e){this.e=e;this.R=new Set;this.Le=null;this.Tr=new Set}Sn(e){return this.R.has(e)}Xd(e){return this.Tr.has(e)}ke(e){if(e.loading)return!1;let t=this.Jd(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}}Jd(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}Pe(){return this.e.i.pe().filter(e=>this.R.has(e.id))}gi(){return this.Pe().filter(e=>e.data!=null).map(e=>e.data)}yi(){return[...this.R]}Zd(e){let t=new Set(e),r=this.e.i.pe().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.fe(r,!0)}Us(e){if(!e)this.R.clear(),this.Le=null;else{let t=new Set(this.e.i.pe().map(r=>r.id));for(let r of[...this.R])t.has(r)||this.R.delete(r);this.Le!=null&&!t.has(this.Le)&&(this.Le=null)}for(let t of this.e.i.pe())t.selected=this.R.has(t.id);this.ia()}na(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.ke(o)&&(r++,this.R.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}Qd(e,t){let r=(e.leafNodes??[]).filter(i=>this.ke(i));r.length!==0&&this.fe(r.map(i=>({node:i,selected:t})))}oa(e,t,r=!1){this.fe([{node:e,selected:t,clearOthers:r}])}jn(e,t=!0,r=!0){let i=this.e.i.z(e);i&&this.oa(i,t,r)}ec(e,t){let r=t==="single";this.fe([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.Le=e.id}tc(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.fe([{node:e,selected:!e.selected}]),this.Le=e.id,!0)}rc(e,t,r){if(!r||!t.shiftKey||this.Le==null)return!1;let i=this.e.i.z(this.Le);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.f(l);d&&!d.isDetail&&!d.isGroup&&this.ke(d)&&a.push({node:d,selected:!0})}return this.fe(a),!0}sa(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.ke(e))return;if(r){this.ec(e,i);return}let o=i==="multiple";this.tc(e,t,o)||this.rc(e,t,o)||(this.fe([{node:e,selected:!0,clearOthers:!0}]),this.Le=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.je():this.e.i.pe()).filter(o=>!o.isDetail&&!o.isGroup&&this.ke(o));if(i.length!==0){if(t==="single"){this.fe([{node:i[0],selected:!0,clearOthers:!0}]);return}this.fe(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.fe([],!0)}ic(){let t=this.e.i.je().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.ke(r));if(t.length===0)return!1;if(this.e.i.p){let r=this.e.i.Gt();if(t.length<r)return!1}return t.every(r=>this.R.has(r.id))}nc(){let t=this.e.i.je().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.ke(i)),r=t.reduce((i,o)=>i+(this.R.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.p){let i=this.e.i.Gt();if(t.length<i)return!0}return r>0&&r<t.length}oc(e,t=!1){this.fe(e,t)}sc(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.R=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.aa(i.node):[i.node.id])))}ac(e,t){for(let r of e){if(!this.ke(r.node))continue;let i=t?this.aa(r.node):[r.node.id];for(let o of i)r.selected?this.R.add(o):this.R.delete(o)}}lc(e){let t=new Set;for(let r of new Set([...e,...this.R]))e.has(r)!==this.R.has(r)&&t.add(r);return t}dc(e,t,r){let i=[],o=new Set([...e,...r,...this.Tr]);for(let s of this.e.i.pe()){let a=this.R.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}fe(e,t=!1){let r=new Set(this.R),i=this.e.i.N&&this.e.r.autoCheckedChildren;this.sc(e,t,i),this.ac(e,i);let o=this.lc(r),s=new Map;for(let d of this.e.i.pe())s.set(d.id,d.selected);let a=new Set(this.Tr);this.ia();let l=this.dc(o,s,a);o.size>0&&(this.e.a.Ye(l),this.e.B.ui(),this.e.emit("selectionChanged",{selectedNodes:this.Pe(),selectedRows:this.gi()}))}aa(e){let t=[e.id],r=i=>{for(let o of this.e.i.gr(i))t.push(o),r(o)};return r(e.id),t}ia(){if(this.Tr.clear(),!this.e.i.N)return;let e=t=>{let r=this.e.i.gr(t);if(r.length===0)return{all:this.R.has(t),some:this.R.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.Tr.add(t),i?this.R.add(t):this.R.delete(t),{all:i,some:o}};for(let t of this.e.i.Yd())e(t.id);for(let t of this.e.i.pe())t.selected=this.R.has(t.id)}};var Qe=class{constructor(e){this.e=e;this.active=null;this.Q=0;this.Xe=0;this.Ce=null;this.mt=null;this.Je=e=>{let t=this.Xn(e);t&&(this.Xe=this.ua(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.Xe-t.startWidth)>=.5),!this.Q&&(this.Q=requestAnimationFrame(()=>{this.Q=0,this.hc()})))};this.Te=e=>{let t=this.Xn(e);t&&(this.Xe=this.ua(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.Xe-t.startWidth)>=.5),this.pc(t))};this.yt=e=>{this.Xn(e)&&this.gt()};this.la=()=>{this.gt()}}cc(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.gt();let r=e.currentTarget,i=t.currentWidth;this.Xe=i,this.active={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.Je),window.addEventListener("pointerup",this.Te,!0),window.addEventListener("pointercancel",this.yt,!0),r.addEventListener("lostpointercapture",this.la);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.uc(this.active)}gt(e=!0){let t=this.active;t&&(this.active=null,this.Yn(),this.da(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.Ze()),this.e.o.root.classList.remove("mach-root--resizing"),this.ca(t))}pc(e){this.active=null,this.Yn(),e.didResize&&(Math.abs(this.Xe-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Ie(e.column,this.Xe),this.e.Ze()),this.da(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.ca(e),e.didResize&&this.e.zt([e.column])}hc(){let e=this.active;!e||!this.e.n.Ie(e.column,this.Xe)||(this.e.Ze(),this.Dr(e),this.e.ha(e.column,!1))}uc(e){this.Ce=document.createElement("div"),this.Ce.className="mach-column-resize-guide",this.Ce.setAttribute("aria-hidden","true"),this.mt=document.createElement("span"),this.mt.className="mach-column-resize-label",this.Ce.appendChild(this.mt),this.e.o.root.appendChild(this.Ce),this.Dr(e)}Dr(e){if(!this.Ce||!this.mt)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.Ce.style.left=`${o}px`,this.Ce.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.mt.style.left=`${s-o}px`,this.mt.textContent=`${Math.round(e.column.currentWidth)} px`}ca(e){e.handle.classList.remove("mach-header-resize--active"),this.Ce?.remove(),this.Ce=null,this.mt=null}ua(e,t){let r=Number.isFinite(t)?t:e.startX;return e.startWidth+r-e.startX}Xn(e){let t=this.active;return t&&e.pointerId===t.pointerId?t:null}Yn(){this.Q&&cancelAnimationFrame(this.Q),this.Q=0}da(e){window.removeEventListener("pointermove",this.Je),window.removeEventListener("pointerup",this.Te,!0),window.removeEventListener("pointercancel",this.yt,!0),e.handle.removeEventListener("lostpointercapture",this.la)}destroy(){this.gt(!1),this.Yn(),this.e.o.root?.classList.remove("mach-root--resizing")}};var yi=6,et=class{constructor(e){this.e=e;this.pending=null;this._t=null;this.Jn=!1;this.ie=0;this.vi=null;this.Je=e=>{if(this._t){this.gc(e);return}let t=this.pending;t&&(Math.abs(e.clientX-t.startX)<yi&&Math.abs(e.clientY-t.startY)<yi||this.yc(e))};this.Te=e=>{this.pending=null,e.type!=="pointercancel"&&this._t&&this.eo(e.clientX,e.clientY),this.Zn();let t=this.pa();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.ut(t.column.id,t.targetIndex)}}fc(e,t){e.button===0&&t.movable&&(this.pending={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.Je),window.addEventListener("pointerup",this.Te),window.addEventListener("pointercancel",this.Te))}mc(){let e=this.Jn;return this.Jn=!1,e}yc(e){let t=this.pending;if(!t)return;let r=this.vc(t.column);if(!r||!r.parentElement){this.Zn();return}this.Jn=!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",P(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.Qn(t.column),a=this.e.o.Kt[s],l=this.e.n.C(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._t={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.S.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.eo(e.clientX,e.clientY)}vc(e){let t=this.e.a.Qn(e);return this.e.o.Kt[t].querySelector(`.mach-header-cell[data-col-id="${Go(e.id)}"]`)}gc(e){this.vi={clientX:e.clientX,clientY:e.clientY},!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0;let t=this.vi;this.vi=null,t&&this.eo(t.clientX,t.clientY)}))}eo(e,t){let r=this._t;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.S.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)`}pa(){let e=this._t;return e?(this._t=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}Zn(){window.removeEventListener("pointermove",this.Je),window.removeEventListener("pointerup",this.Te),window.removeEventListener("pointercancel",this.Te),this.ie&&cancelAnimationFrame(this.ie),this.ie=0,this.vi=null}destroy(){this.Zn(),this.pa(),this.pending=null}};function Go(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var er=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function tt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!er.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 No(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
1
|
+
var He="0.34.1";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 P(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 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=`${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 zr=0;function _r(n="rg"){return zr++,`${n}-${zr}`}var Kr='<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>',Wr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',$r='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',Ur='<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 Ve=class{constructor(e){this.ld=e;this.It=new Map}on(e,t){let r=this.It.get(e);return r||(r=new Set,this.It.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}Af(e,t){let r=this.It.get(e);r&&(r.delete(t),r.size===0&&this.It.delete(e))}emit(e,t){let r=this.It.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.ld?.(o,e)}}clear(){this.It.clear()}};var zn=new Set(["__proto__","prototype","constructor"]),ge=new Map;function _t(n){if(typeof n!="string"||n.length===0)return null;let e=ge.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!zn.has(i))?t:null;return n.length<=1024&&(ge.size>=256&&ge.delete(ge.keys().next().value),ge.set(n,r)),r}function Kt(n){return _t(n)!==null}function K(n,e){if(n==null)return;let t=_t(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ye(n,e,t){if(n==null)return!1;let r=_t(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 ae={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 _n=16,Kn=512,Wn=20,$n=2e3,Un=2e3,qn={text:new Set(ae.text),number:new Set(ae.number),date:new Set(ae.date)};function jn(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Yn(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,...Xn(r,e)}}function Xn(n,e){let t=e==="number"?qr(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?qr(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function qr(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Jn(n,e){let t=[],r=qn[e];for(let i of n.slice(0,Wn)){let o=Yn(i,e,r);o&&t.push(o)}return t}function Wt(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(jn).slice(0,$n)}: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:Jn(e.conditions,e.type)}}function Zn(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=Wt(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function Qn(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=jr(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 eo(n,e,t){return e<=_n&&t.nodes<Kn&&n!=null&&typeof n=="object"}function jr(n,e,t){if(!eo(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?Zn(r,t):r.kind==="group"?Qn(r,e,t):null;return t.ancestors.delete(n),i}function z(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=jr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function to(n,e){return{kind:"condition",colId:n,filter:e}}function Q(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,Un)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=Wt(i);s&&(t[o]=s)}return t}function ro(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}function F(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function Be(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:F(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 $t={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ve={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}},be={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},io=Object.keys(be);function no(n){let e={};for(let t of io)e[t]=n[t]??be[t];return e}function I(n,e,t,r=!1){return F(n,t,r)??e}function oo(n){return n&&Object.prototype.hasOwnProperty.call(ve,n)?n:"normal"}function so(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function ao(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 Ut(n,e){let t=typeof n=="function"?n(e):K(e,n);return t==null?"":String(t)}function lo(n){let e=n.rowKey,t=e?({data:r})=>Ut(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function co(n,e){let t=ve[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...$t,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...lo(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 uo(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:so(n)}}function ho(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 po(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function fo(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:ao(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function qt(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 mo(n){return{advancedFilterModel:z(n.advancedFilterModel),persistence:Be(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 go(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 vo(n,e){for(let t of yo)n[t]&&Reflect.set(e,t,n[t])}function bo(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function Yr(n){let e=oo(n.size),t={...no(n),...co(n,e),...uo(n),...ho(n),...po(n),...fo(n),...qt(n),...mo(n),...go(n),features:Array.isArray(n.features)?n.features:[]};return vo(n,t),bo(n,t),t}function Xr(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function le(n,e){return Xr(n.type).includes(e)}function Jr(n,e,t={}){let r={};for(let i of Xr(n.type)){let o=t[i];o&&Object.assign(r,o)}return{...e,...r,...n}}var $=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=typeof this.colDef.flex=="number"&&Number.isFinite(this.colDef.flex)&&this.colDef.flex>0?this.colDef.flex:null}};var ee=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 we(n){return Array.isArray(n.children)}function ze(n,e){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:e}function Zr(n){let e=ze(n.minWidth,80);return{min:e,max:Math.max(e,ze(n.maxWidth,Number.MAX_SAFE_INTEGER))}}function V(n,e){let{min:t,max:r}=Zr(e),i=ze(n,ze(e.width,150));return Math.max(t,Math.min(r,i))}function Qr(n,e){let t=n.map(s=>V(s.width??150,s)),r=[],i=0;n.forEach((s,a)=>{let l=s.flex??0;l>0&&(r.push(a),i+=l)});let o=0;for(let s of t)o+=s;if(i>0&&e>o){let s=e-o;for(let a=0;a<4&&s>.5&&r.length>0;a++){let l=[],d=0;for(let p of r){let m=n[p].flex??0;l.push(p),d+=m}let c=[];for(let p=0;p<l.length;p++){let m=l[p],v=n[m].flex??0,w=s*v/d,C=t[m];t[m]=V(C+w,n[m]),c.push(t[m]-C)}let u=0;for(let p of c)u+=p;s-=u;let h=l.filter((p,m)=>c[m]>.001);if(h.length===l.length)break;r.length=0;for(let p of h)r.push(p)}}return t}function wo(n,e,t){let r=new Set(n.map((o,s)=>s)),i=t;for(let o=0;o<n.length+1&&r.size>0;o++){let s=0;for(let l of r)s+=Math.max(1,e[l]);if(s<=0)break;let a=!1;for(let l of[...r]){let d=i*(Math.max(1,e[l])/s),c=V(d,n[l]),{min:u,max:h}=Zr(n[l]);(d<u||d>h)&&(e[l]=c,i-=c,r.delete(l),a=!0)}if(!a){for(let l of r)e[l]=V(i*(Math.max(1,e[l])/s),n[l]);break}i=Math.max(0,i)}}function Co(n,e,t){let r=t-e.reduce((i,o)=>i+o,0);if(!(Math.abs(r)<=.01))for(let i=e.length-1;i>=0;i--){let o=V(e[i]+r,n[i]);if(Math.abs(o-e[i])>.01){e[i]=o;return}}}function _e(n,e){let t=n.map(r=>V(r.width??150,r));return!Number.isFinite(e)||e<=0||n.length===0||(wo(n,t,e),Co(n,t,e)),t}var jt="__rg_detail_toggle__";function de(n){return typeof n=="number"&&Number.isFinite(n)&&n>0}var Ke=class{constructor(e){this.e=e;this.columns=[];this.Ss=new Map;this.ye=[];this.left=[];this.center=[];this.right=[];this.sortModel=[];this.defs=[];this.At=1;this.vn=new Map;this.dd=0}ar(e){this.defs=e?[...e]:[];let t=new Map(this.columns.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[jt]:[]),o=(s,a,l)=>s.map((d,c)=>{if(we(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new ee(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 v=new $(p,Jr(u,r,this.e.r.columnTypes));v.parentGroup=a,v.level=l;let w=t.get(p);return w&&(v.manualWidth=w.manualWidth,v.contentWidth=w.contentWidth,v.flex=w.flex,v.hide=w.hide,v.pinned=w.pinned),v});if(this.ye=o(this.defs,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new $(jt,{colId:jt,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.ye.unshift(s)}if(this.columns=this.Yr(this.ye),this.Ss=new Map(this.columns.map(s=>[s.id,s])),this.At=this.columns.reduce((s,a)=>Math.max(s,a.level+1),1),this.sortModel=this.sortModel.filter(s=>this.columns.some(a=>a.id===s.colId)),this.sortModel.length===0){let s=[];for(let a of this.columns)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.sortModel=s}this.Lt()}Yr(e,t=[]){for(let r of e)r instanceof ee?this.Yr(r.children,t):t.push(r);return t}Lt(){let e=this.columns.filter(t=>!t.hide);this.left=e.filter(t=>t.pinned==="left"),this.right=e.filter(t=>t.pinned==="right"),this.center=e.filter(t=>t.pinned===null),this.vn.clear(),this.c().forEach((t,r)=>this.vn.set(t.id,r))}Me(e){return this.vn.get(e)??-1}X(){return this.columns}Xr(){return this.defs}cd(){return this.ye}ud(){return this.At}L(e){return this.Ss.get(e)}C(e){return e==="left"?this.left:e==="right"?this.right:this.center}c(){return[...this.left,...this.center,...this.right]}ze(){return this.c().filter(e=>e.colDef.rowGroup===!0)}hd(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}bn(){return this.center.some(e=>e.colDef.colSpan!=null)}Ms(){let e=this.c();return this.center.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}lr(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}Is(e){this.dd=e;let t=0;for(let c of[...this.left,...this.right])c.currentWidth=V(c.manualWidth??c.contentWidth??c.colDef.width??150,this.ct(c)),t+=c.currentWidth;let r=Math.max(0,e-t),i=[],o=[];for(let c of this.center)(c.colDef.suppressSizeToFit||c.manualWidth!=null?o:i).push(c);let s=0;for(let c of o)c.currentWidth=V(c.manualWidth??c.contentWidth??c.colDef.width??150,this.ct(c)),s+=c.currentWidth;let a=i.map(c=>this.ct(c)),l=Math.max(0,r-s),d=this.e.r.columnLayout==="fit"?_e(a,l):Qr(a,l);i.forEach((c,u)=>{c.currentWidth=d[u]})}ct(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Ie(e,t){return de(t)?(e.manualWidth=V(t,this.ct(e)),e.flex=null,!0):!1}As(e,t){return de(t)?(e.resetWidth(),e.contentWidth=V(t,this.ct(e)),!0):!1}wn(e,t){let r=this.L(e);!r||r.hide===!t||(r.hide=!t,this.Lt())}ut(e,t){let r=this.L(e);if(!r)return!1;let i=this.lr(r),o=u=>r.parentGroup?!0:this.lr(u)===i,s=r.parentGroup?r.parentGroup.children:this.ye,a=s.filter(u=>u instanceof $&&!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 $&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.columns=this.Yr(this.ye),this.Lt(),!0)}Cn(e,t){let r=this.L(e);!r||!r.movable||(r.pinned=t,this.Lt())}Jr(){return this.columns.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}))}Ls(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.columns){let i=t.get(r.id);i&&this.pd(r,i)}this.fd(e),this.Lt()}pd(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),de(t.flex)&&(e.flex=t.flex)):de(t.flex)?(e.flex=t.flex,e.manualWidth=null):de(t.width)&&(e.manualWidth=V(t.width,this.ct(e)),e.flex=null),de(t.contentWidth)&&(e.contentWidth=V(t.contentWidth,this.ct(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}fd(e){let t=new Map;e.forEach((i,o)=>t.set(i.colId,o));let r=i=>i.pinned==="left"?"left":i.pinned==="right"?"right":"center";for(let i of["left","center","right"]){let o=this.ye.filter(d=>d instanceof $&&!d.hide&&d.parentGroup===null&&r(d)===i);if(o.length<2)continue;let s=o.filter(d=>d.movable),a=s.slice().sort((d,c)=>(t.get(d.id)??Number.MAX_SAFE_INTEGER)-(t.get(c.id)??Number.MAX_SAFE_INTEGER));if(a.every((d,c)=>d===s[c]))continue;let l=[];this.ye.forEach((d,c)=>{d instanceof $&&!d.hide&&d.parentGroup===null&&r(d)===i&&d.movable&&l.push(c)}),l.forEach((d,c)=>{this.ye[d]=a[c]})}this.columns=this.Yr(this.ye)}Tn(){for(let e of this.columns){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.Lt()}U(){return this.sortModel.map(e=>({...e}))}dr(e){if(!e||e.length===0){this.sortModel=[];return}this.sortModel=e.filter(t=>this.columns.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Zr(e,t){let r=[...this.sortModel],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.sortModel=r}};function te(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var To=()=>te(void 0,"[MachTable] Operation cancelled.");function We(n,e,t=To){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 ti(n){return n==null?"":String(n).toLowerCase()}function Do(n,e,t){let r=ti(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 Eo(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 xo(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:Eo(r,i,e)}function Ro(n,e,t){let r=i=>xo(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function Yt(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 So(n,e,t){let r=Yt(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?Yt(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?Yt(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 Mo(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function ri(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Do(n,e.conditions,t);case"number":return Ro(n,e.conditions,t);case"date":return So(n,e.conditions,t);case"set":return Mo(n,e.values);default:return!0}}function ii(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>ri(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>ii(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 Xt(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?ii(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>ri(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>ti(i(d,u)).includes(c)))}var ni=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Io(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function Ao(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function Lo(n,e){return n===e?0:n?1:-1}function $e(n,e){let t=Io(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Ao(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Lo(n,e);let r=String(n),i=String(e);return ni?ni.compare(r,i):r.localeCompare(i)}function Jt(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??$e,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 oi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function si(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 ai(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 Ue(n,e){let t=oi();for(let r of n)si(t,r);return ai(t,e)}var qe={sum:n=>Ue(n,"sum"),avg:n=>Ue(n,"avg"),count:n=>n.length,min:n=>Ue(n,"min"),max:n=>Ue(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function li(n,e,t){if(e===qe.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===qe[o]);if(!r)return e(n.map(t));let i=oi();for(let o of n)si(i,t(o));return ai(i,r)}function Zt(n){let e={...qe,...n??{}};return t=>e[t]}var je="group:";function di(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Qt(n)])}function Qt(n){return n==null?"(\u7A7A)":String(n)}function ci(n){return je+JSON.stringify(n)}function ko(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=di(o),a=r.get(s);a||(a={key:s,label:Qt(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 ui(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 ko(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=ci(p);o.push(m);let v=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:v.leaves,aggValues:r(v.leaves)}),i.has(m))for(let w of v.display)c.push(w);if(l>0)for(let w of v.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function hi(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,di(h)]),c+=`/g${u}:${Qt(h)}`,!i.has(c))continue;let p=ci(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 Po(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));Po(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 fi(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function mi(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>K(r.data,o));i.some(fi)||t.set(r,i)}return t}function gi(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=K(e,i);return fi(s)||!Object.is(r[o],s)}):!1}function re(n){return te(n.reason,"Block request aborted")}function Ye(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var Xe=class{constructor(e,t,r=4){this.maxBlocks=e;this.En=t;this.maxConcurrentRequests=r;this.J=new Map;this.q=new Map;this.ks=0;this.generation=0;this.hitCount=0;this.missCount=0;this.evictionCount=0;this.Qr=0;this.ei=new Set;this.maxBlocks=Ye(e),this.maxConcurrentRequests=Ye(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=Ye(e),this.maxConcurrentRequests=Ye(t),this.Dn(),this.ti()}md(e){this.ei=e,this.Dn()}peek(e){let t=this.J.get(e);if(t)return t.touchedAt=++this.ks,t}has(e){return this.J.has(e)}invalidate(e){let t=this.q.get(e);t&&(this.q.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(re(t.controller.signal)));let r=this.J.get(e);r&&(this.J.delete(e),this.En?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(re(r));let o=this.peek(e);if(o)return this.hitCount++,Promise.resolve(o);let s=this.q.get(e);if(s)return this.hitCount++,s.priority=Math.max(s.priority,i),this.ti(),this.Ps(e,s,r);this.missCount++;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.q.set(e,u);let h=this.Ps(e,u,r);return this.ti(),h}gd(){this.generation++,this.ei.clear();for(let e of this.q.values())e.controller.abort(),e.state==="queued"&&e.reject(re(e.controller.signal));this.q.clear();for(let[e,t]of this.J)this.En?.(e,t);this.J.clear()}snapshot(){let e=0,t=0;for(let r of this.J.values())e+=r.rows.length;for(let r of this.q.values())r.state==="active"&&t++;return{cachedBlockCount:this.J.size,loadingBlockCount:this.q.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.q.size-t),cachedRowCount:e,hitCount:this.hitCount,missCount:this.missCount,evictionCount:this.evictionCount}}ti(){for(;this.Qr<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.q)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.yd(e,t)}}yd(e,t){t.state="active",this.Qr++;let r=this.generation;this.vd(t).then(i=>{r===this.generation&&!t.controller.signal.aborted&&(this.J.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.ks}),this.Dn()),t.resolve(i)},t.reject).finally(()=>{this.Qr=Math.max(0,this.Qr-1),this.q.get(e)===t&&this.q.delete(e),this.ti()})}vd(e){let{signal:t}=e.controller;return We(Promise.resolve().then(()=>{if(t.aborted)throw re(t);return e.loader(t)}),t,()=>re(t))}Ps(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.q.get(e)===t&&(this.q.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(re(t.controller.signal))),o(re(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")))))})}Dn(){let e=Math.max(this.maxBlocks,this.ei.size+1);for(;this.J.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.J)this.ei.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.J.get(t);this.J.delete(t),this.evictionCount++,i&&this.En?.(t,i)}}};function Ce(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var Je=class{constructor(e){this.e=e;this.all=[];this.H=[];this.Z=new Map;this.displayed=[];this.h=new Map;this.filterModel={};this.advancedFilterModel=null;this.quickFilter=null;this.k=new Set;this.K=new Set;this.kt=[];this.cr=new Map;this.Gs=[];this.P=null;this.Pt=!1;this.Ns=!1;this._e=0;this.ri=null;this.ii=null;this.ni=new WeakMap;this.ur=new WeakMap;this.Ke=new Map;this.hr=new Map;this.pr=0;this.oi=0;this.We=null;this.$e=new Map;this.ht=new Map;this.si=new Set;this.pt=new Map;this.Ue=new Xe(12,e=>this.Fs(e));this.fr=0;this.ai=null;this.xn=!1;this.Os=0;this.te=[];this.page=1;this.pageSize=20;this.advancedFilterModel=z(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 N(){return this.e.r.treeData}get p(){return this.e.r.datasource!=null}get ue(){return this.p&&this.e.r.datasourceMode==="block"}Gt(){if(this.p){if(this.ue)return this.Nt();let e=Math.max(0,this.displayed.length-this.all.length);return(this.P??this.all.length)+e}return this.displayed.length}Rn(){return this.pr}mr(){return this.oi}bd(){return this.Ns}li(e){return!this.p||e?.aborted?Promise.resolve():(this.oi++,this.e.ve(),this.e.api.editing.stop({cancel:!0}),this.e.V.clear(),this.di(),this.P=null,this.Pt=!1,this.all=[],this.H=[],this.h.clear(),this.k.clear(),this.e.O.clear(),this.b(),this.e.u({data:!0}),this.ue?(this.Ue.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.ci(0,e)):this.Hs(0,void 0,e))}ft(e){this.Ns=e,this.e.o.ft(e,this.e.g("loading"))}Hs(e,t,r){if(!this.p||this.Pt||this.P!=null&&e>=this.P)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this._e,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ri=a,this.Pt=!0,this.ft(!0),new Promise(d=>{let c=!1;this.ii=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this._e&&(this.Pt=!1,this.ri=null,this.ii=null,this.ft(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.Vs(e,o,a.signal,(h,p)=>{if(s!==this._e||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.P=p:h.length<o-e&&(this.P=e+h.length);let m=this.all.length===0;this.wd(h),u(),this.b(),this.e.u({data:!0}),m&&this.e.he(),this.e.B.ui()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}di(){this._e++,this.ri?.abort(),this.ri=null,this.Pt=!1,this.ft(!1),this.ii?.(),this.ii=null,this.Ue.gd(),this.$e.clear(),this.ht.clear(),this.si.clear();for(let[e,t]of this.pt)this.h.get(e)===t&&this.h.delete(e);this.pt.clear()}wd(e){for(let t of e){if(t==null)continue;let r=this.all.length,i=this.resolveRowId(t,r,`inf-${this.e.Ft()}`);if(this.h.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.m.Sn(i)};this.all.push(o),this.h.set(i,o),this.H.push(o)}}ci(e,t,r=0){if(!this.ue||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Bs(t.reason));let i=this.e.r.blockSize,o=this._e,s=e*i;if(s>=this.Nt())return Promise.resolve();let a=this.P==null?s+i:Math.min(this.P,s+i),l=this.Ue.load(e,d=>this.Cd(s,a,d),t,r);return this.ft(this.all.length===0&&this.Ue.snapshot().loadingBlockCount>0),l.then(d=>{o!==this._e||t?.aborted||this.e.s()||!this.ue||!this.Ue.has(e)||this.si.has(e)||(this.Td(e,d),this.b(),this.e.u({data:!0}),this.e.B.ui(),o===this._e&&!this.e.s()&&this.zs(this.e.a.Mn().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this._e&&this.ft(this.all.length===0&&this.Ue.snapshot().loadingBlockCount>0)})}Cd(e,t,r){return new Promise((i,o)=>{this.Vs(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")))})}Vs(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.Bs(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=v=>{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(v))}};try{let v=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.U(),filterModel:this.j(),advancedFilterModel:this.be(),quickFilterText:this.quickFilter,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});v&&typeof v.catch=="function"&&v.catch(m)}catch(v){m(v)}};h()}Td(e,t){let r=this.e.r.blockSize,i=e*r;this.Fs(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.P=t.lastRow:t.rows.length<r&&(this.P=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.P!=null&&a>=this.P)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.pt.get(l),c=this.h.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.m.Sn(l)};u.rowIndex=a,u.selected=this.e.m.Sn(l),this.pt.delete(l),this.$e.set(a,u),this.ht.delete(a),this.h.set(l,u),this.ur.set(u,a+1)}),this._s(),this.si.add(e)}Fs(e){this.si.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.$e.get(o);s&&(i??(i=new Set(this.e.V.getDirtyRowIds())),this.$e.delete(o),i.has(s.id)?this.pt.set(s.id,s):this.h.get(s.id)===s&&this.h.delete(s.id))}this._s()}_s(){this.all=[...this.$e.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.H=this.all}Nt(){if(this.P!=null)return this.P;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.$e.size===0)return this.e.r.blockSize;let e=0;for(let t of this.$e.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}Dd(e){let t=this.ht.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.ht.set(e,t),this.ht.size>2e3)){let r=this.ht.keys().next().value;r!=null&&this.ht.delete(r)}return t}Bs(e){return te(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)))}Ed(e){if(this.ue){this.zs(e);return}if(!this.p||this.Pt)return;let t=this.all.length;if(this.P!=null&&t>=this.P)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.P==null?t+i:Math.min(this.P,t+i);this.Hs(t,o)}zs(e){if(e<0)return;this.Ks();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.Mn().first/t),o=this.e.r.blockPrefetch,s=r<this.Os?-1:1;this.Os=r;for(let a=i;a<r;a++)this.ci(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.Nt()||this.ci(d,void 0,o-a+1).catch(()=>{})}}Ae(){return this.li().catch(()=>{})}xd(){return this.di(),this.p?this.li().catch(()=>{}):(this.P=null,this.qe(this.e.r.rowData),this.e.u({data:!0}),Promise.resolve())}destroy(){this.We=null,this.di(),this.Ws(),this.In(),this.all=this.H=this.displayed=this.te=[],this.h.clear(),this.Z.clear(),this.cr.clear(),this.Gs=[],this.k.clear(),this.K.clear(),this.kt=[]}An(e,t,r){if(!this.ue)return Promise.resolve();this.Ks();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Nt(),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.ci(c,r,100));return Promise.all(d).then(()=>{})}Ln(){this.ue&&(this.oi++,this.e.ve(),this.e.api.editing.stop({cancel:!0}),this.e.V.clear(),this.di(),this.e.O.clear(),this.all=[],this.H=[],this.h.clear(),this.b(),this.e.u({data:!0}))}kn(){return this.Ue.snapshot()}Ks(){let e=new Set(this.e.V.getDirtyRowIds());for(let[l,d]of this.pt)e.has(l)||(this.pt.delete(l),this.h.get(l)===d&&this.h.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.Mn();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.T;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Rd();a!=null&&r.add(Math.floor(a/t)),this.Ue.md(r)}qe(e){this.oi++,this.e.ve(),this.e.api.editing.stop({cancel:!0}),this.Ws(),this.e.V.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 v=this.N?Ce(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(v)};if(this.ni.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.N&&Array.isArray(v))for(let C of v)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.all=i,this.H=o,this.Z=a,this.h=s,this.e.O.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.$s(c.id)>0&&this.k.add(c.id);this.e.m.Us(t!=null),this.b()}gr(e){return this.Z.get(e)??[]}$s(e){return this.Z.get(e)?.length??0}Pn(e){return this.$s(e)>0}isTreeRowLoading(e){return this.h.get(e)?.treeLoading===!0}Ws(){for(let e of this.Ke.values())e.abort();this.Ke.clear(),this.hr.clear()}loadTreeChildren(e,t=!1){let r=this.h.get(e),i=this.e.r.loadTreeChildren;if(!this.N||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this.gr(e).flatMap(l=>{let d=this.h.get(l)?.data;return d==null?[]:[d]}));let o=this.hr.get(e);if(o&&!t)return o;this.Ke.get(e)?.abort();let s=new AbortController;this.Ke.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.u({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.Sd(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.Ke.get(e)===s&&(this.Ke.delete(e),this.hr.delete(e),r.treeLoading=!1,this.e.u({data:!0}))});return this.hr.set(e,a),a}Sd(e,t){let r=new Set,i=[...this.gr(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this.gr(s)))}this.Md(t,r);for(let s of r)this.Ke.get(s)?.abort(),this.Ke.delete(s),this.hr.delete(s),this.Z.delete(s),this.h.delete(s),this.k.delete(s);this.Z.delete(e.id);let o=this.Gn(e)+1;for(let s of t)s!=null&&this.Nn(e,s,o);this.qs(),this.e.m.Us(this.e.r.resolveRowId!=null),this.b(),this.e.u({data:!0})}Md(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.h.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=Ce(l,this.e.r.childrenKey);d&&s.push(...d)}}yr(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.Ft()}`)];for(;m.length>0;){let v=m.pop();if(!l.has(v)){l.add(v);for(let w of this.Z.get(v)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let v=this.N?Ce(m,this.e.r.childrenKey):void 0;if(v)for(let w of v)p.push(w)}}};e.remove.forEach(c),this.all=this.all.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.h.delete(h.id),this.Z.delete(h.id)),!p});let u=new Set(this.all);this.H=this.H.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.h.get(this.resolveRowId(l,-1,`__missing_update_${this.e.Ft()}`)):d=this.all.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.hi(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.H.length)):this.H.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.Ft()}`);if(this.h.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.h.set(h,p),this.ni.set(p,0);let m=this.N?Ce(c,this.e.r.childrenKey):void 0;if(m)for(let v of m)v!=null&&this.Nn(p,v,1);d.push(p)}),this.H=this.H.slice(0,l).concat(d,this.H.slice(l)),this.qs()}let a={pipelineChanged:this.Id(e,o),updatedRowIds:i.map(l=>l.id)};return this.Ad(a,t),this.e.V.Ld(s),a}Ad(e,t){e.pipelineChanged&&(this.We=null),t&&(e.pipelineChanged?this.b():e.updatedRowIds.length&&this.js())}kd(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.yr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.b():r.size>0&&this.js(),{pipelineChanged:t,updatedRowIds:[...r]}}Id(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.Ys();if(r===null)return!0;if(!r.length)return!1;let i=this.We;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>gi(s,a,r,i.values.get(o)))}Ys(){if(this.N||this.e.r.masterDetail||this.e.r.getRowHeight||this.Xs())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.U(),filterModel:t?this.filterModel:{},advancedFilter:t?this.advancedFilterModel:null,quickFilter:t?this.quickFilter:null})}Pd(){let e=this.Ys();this.We=e?.length?{fields:e,values:mi(this.all,e)}:null}js(){this.e.emit("modelUpdated",{rowCount:this.te.length})}Nn(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.Ft()}`);if(this.h.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Ce(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.h.set(i,s),this.ni.set(s,r);let a=this.Z.get(e.id)??[];if(a.push(s.id),this.Z.set(e.id,a),!!o)for(let l of o)l!=null&&this.Nn(s,l,r+1)}qs(){this.all=[];let e=t=>{this.all.push(t),this.h.has(t.id)||this.h.set(t.id,t);for(let r of this.Z.get(t.id)??[]){let i=this.h.get(r);i&&e(i)}};for(let t of this.H)e(t)}vr(e){let t=JSON.stringify(this.filterModel),r=new Set(this.e.n.X().map(o=>o.id));this.filterModel=Q(e,r);let i=JSON.stringify(this.filterModel)!==t;return i&&(this.We=null),i}j(){return{...this.filterModel}}Ot(e){let t=new Set(this.e.n.X().map(s=>s.id)),r=z(e,t),i=JSON.stringify(this.advancedFilterModel);this.advancedFilterModel=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.We=null),o}be(){return z(this.advancedFilterModel)}Ht(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.quickFilter?!1:(this.quickFilter=t,this.We=null,!0)}br(){return this.quickFilter}Fn(){return Object.keys(this.filterModel).length>0||this.advancedFilterModel!=null||this.quickFilter!=null}b(){this.We=null;let e=this.e.re.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.p){this.Gd(e);return}if(this.Nd(e))return;let i,o=[];if(this.N)i=this.Fd(t,r);else{i=this.all,this.Fn()&&!this.e.r.manualFiltering&&(i=i.filter(Xt(t,this.filterModel,this.advancedFilterModel,this.quickFilter,r)));let l=this.e.n.U();if(l.length>0&&!this.e.r.manualSorting)try{i=Jt(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.ze();if(d.length>0){let c=this.Od(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.all)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.ur.set(a,s))}),this.te=i,this.Vt(),this.Pd(),this.Js(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.re.On(e),this.Hd(o)}Gd(e){this.all.forEach((t,r)=>{this.ue||(t.rowIndex=r),this.ur.set(t,this.ue?t.rowIndex+1:r+1)}),this.displayed=this.all,this.te=this.all,this.cr.clear(),this.pr++,this.e.emit("modelUpdated",{rowCount:this.all.length}),this.e.re.On(e)}Nd(e){let t=this.xn;return this.xn=!1,!t&&this.Xs()?(this.Vd(e),!0):(this.In(),!1)}Xs(){if(!this.e.r.dataProcessor||this.all.length<this.e.r.dataProcessorMinRows||this.N||this.e.r.masterDetail||this.e.n.ze().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Fn(),t=!this.e.r.manualSorting&&this.e.n.U().length>0;return e||t}Vd(e){this.In();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.fr,i=new AbortController;this.ai=i;let o=this.e.n.c(),s=this.all.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.U():[],filterModel:a?this.j():{},advancedFilterModel:a?this.be():null,quickFilterText:a?this.quickFilter:null,signal:i.signal})).then(d=>{if(r!==this.fr||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.h.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.all)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.ur.set(p,m+1)}),this.te=u,this.Vt();let h=(p,m)=>this.e.d(p,m);this.Js(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.re.On(e),this.e.u({data:!0})}).catch(d=>{r!==this.fr||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.xn=!0,this.b(),this.e.u({data:!0}))}).finally(()=>{r===this.fr&&(this.ai=null)})}In(){this.fr++,this.ai?.abort(),this.ai=null}get we(){return this.e.r.paginationEnabled&&!this.p}Vt(){if(!this.we){this.displayed=this.te,this.pr++;return}let e=this.wr(),t=this.getPageCount();if(this.page>t&&(this.page=t),this.page<1&&(this.page=1),this.e.r.paginationPage=this.page,this.e.r.paginationMode==="server"){this.te.forEach((o,s)=>{o.rowIndex=s}),this.displayed=this.te,this.pr++;return}let r=(this.page-1)*e,i=this.te.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.displayed=i,this.pr++}wr(){return this.pageSize=this.e.r.paginationPageSize,Math.max(1,this.pageSize)}Cr(){return this.we?this.page:1}getTotalRowCount(){return this.p?this.Gt():this.we&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.te.length}getPageCount(){return this.we?Math.max(1,Math.ceil(this.getTotalRowCount()/this.wr())):1}Zs(){return this.te}setPage(e,t=!1){if(!this.we)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.page&&(this.page=i,this.e.r.paginationPage=i,this.Vt(),this.e.u({data:!0}),this.e.a.Bt(0,"top"),t||this.pi())}setPageSize(e){if(!this.we)return;let t=Math.max(1,Math.round(e)||this.wr()),r=(this.page-1)*this.wr();this.e.r.paginationPageSize=t,this.pageSize=t,this.page=Math.floor(r/t)+1,this.e.r.paginationPage=this.page,this.Vt(),this.e.u({data:!0}),this.pi()}Qs(e,t){this.pageSize=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.pageSize,this.page=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.page}fi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.p,this.e.r.paginationEnabled&&(this.page=1),this.Vt(),this.e.u({data:!0}),this.pi())}Bd(){this.we&&(this.page=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.Vt(),this.e.u({data:!0}),this.pi())}pi(){this.e.emit("paginationChanged",{page:this.Cr(),pageSize:this.wr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Fd(e,t){let r=this.e.r.manualSorting?[]:this.e.n.U(),i=new Map,o=this.Fn()&&!this.e.r.manualFiltering,s=Xt(e,this.filterModel,this.advancedFilterModel,this.quickFilter,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.Z.get(c.id)??[]){let m=this.h.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=Jt(c,r,e,t));for(let h of u)if(a(h)&&(l.push(h),this.k.has(h.id))){let p=(this.Z.get(h.id)??[]).map(m=>this.h.get(m)).filter(m=>m!=null);d(p)}};return d(this.H),l}zd(){let e=this.Gs,t=0;for(let r of this.displayed)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}_d(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}}Kd(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&$e(i,o(e[t+s],r))===0;)s++;return s}Wd(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._d(s,t,a,e.length-o):this.Kd(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Js(e){if(this.cr.clear(),this.N||this.e.r.masterDetail||this.e.n.ze().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.zd();if(r.length!==0)for(let i of t)this.cr.set(i.id,this.Wd(r,i,e))}$d(e){return this.cr.get(e)}ea(e){return this.ur.get(e)??0}Gn(e){return this.ni.get(e)??0}Od(e,t){let r=Zt(this.e.r.aggFuncs),i=this.e.n.hd();this.kt=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=li(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=hi(this.K,this.all,t,(l,d)=>this.e.d(l,d));this.K=s.expanded;let a=ui(e,t,(l,d)=>this.e.d(l,d),o,this.K);return this.kt=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Hd(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.N){if(this.Pn(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)}Ud(){return[...this.k]}qd(){return[...this.K]}jd(e,t){this.k=new Set(e.filter(r=>this.h.has(r))),this.K=new Set(t)}Hn(e){return this.Vn(e,!0)}Bn(e){return this.Vn(e,!1)}mi(e){return this.Vn(e,!this.k.has(e))}Vn(e,t){let r=this.h.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.k.has(e)||(t?this.k.add(e):this.k.delete(e),this.b(),this.e.u({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.N&&!this.Pn(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}zn(){let e=!1;for(let t of this.all)!this.k.has(t.id)&&this.isRowExpandable(t)&&(this.k.add(t.id),e=!0);e&&(this.b(),this.e.u({data:!0}))}_n(){this.k.size!==0&&(this.k.clear(),this.b(),this.e.u({data:!0}))}Kn(e){return this.setGroupExpanded(e,!this.K.has(e))}isGroupExpanded(e){return this.K.has(e)}Wn(){if(this.kt.length===0)return;let e=!1;for(let t of this.kt)this.K.has(t)||(this.K.add(t),e=!0);e&&(this.b(),this.e.u({data:!0}))}$n(){this.K.size!==0&&(this.K.clear(),this.b(),this.e.u({data:!0}))}setGroupExpanded(e,t){return!this.kt.includes(e)||t===this.K.has(e)||(t?this.K.add(e):this.K.delete(e),this.b(),this.e.u({data:!0})),t}ta(){return!this.N&&!this.p&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.U().length===0&&this.e.n.ze().length===0}ra(e,t){if(!this.ta()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.f(e),i=this.f(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.all.indexOf(r),s=this.all.indexOf(i);return o<0||s<0||o===s?!1:(this.all.splice(o,1),this.all.splice(s,0,r),this.b(),this.e.u({data:!0}),!0)}pe(){return this.all}Yd(){return this.H}je(){return this.displayed}I(){return this.ue?this.Nt():this.displayed.length}f(e){return this.ue?e<0||e>=this.Nt()?void 0:this.$e.get(e)??this.Dd(e):this.displayed[e]}z(e){return this.h.get(e)}Un(e){this.all.forEach(e)}qn(e){let t=0;for(let r of this.te)r.isDetail||r.isGroup||e(r,t++)}};var Ze=class{constructor(e){this.e=e;this.R=new Set;this.Le=null;this.Tr=new Set}Sn(e){return this.R.has(e)}Xd(e){return this.Tr.has(e)}ke(e){if(e.loading)return!1;let t=this.Jd(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}}Jd(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}Pe(){return this.e.i.pe().filter(e=>this.R.has(e.id))}gi(){return this.Pe().filter(e=>e.data!=null).map(e=>e.data)}yi(){return[...this.R]}Zd(e){let t=new Set(e),r=this.e.i.pe().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.fe(r,!0)}Us(e){if(!e)this.R.clear(),this.Le=null;else{let t=new Set(this.e.i.pe().map(r=>r.id));for(let r of[...this.R])t.has(r)||this.R.delete(r);this.Le!=null&&!t.has(this.Le)&&(this.Le=null)}for(let t of this.e.i.pe())t.selected=this.R.has(t.id);this.ia()}na(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.ke(o)&&(r++,this.R.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}Qd(e,t){let r=(e.leafNodes??[]).filter(i=>this.ke(i));r.length!==0&&this.fe(r.map(i=>({node:i,selected:t})))}oa(e,t,r=!1){this.fe([{node:e,selected:t,clearOthers:r}])}jn(e,t=!0,r=!0){let i=this.e.i.z(e);i&&this.oa(i,t,r)}ec(e,t){let r=t==="single";this.fe([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.Le=e.id}tc(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.fe([{node:e,selected:!e.selected}]),this.Le=e.id,!0)}rc(e,t,r){if(!r||!t.shiftKey||this.Le==null)return!1;let i=this.e.i.z(this.Le);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.f(l);d&&!d.isDetail&&!d.isGroup&&this.ke(d)&&a.push({node:d,selected:!0})}return this.fe(a),!0}sa(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.ke(e))return;if(r){this.ec(e,i);return}let o=i==="multiple";this.tc(e,t,o)||this.rc(e,t,o)||(this.fe([{node:e,selected:!0,clearOthers:!0}]),this.Le=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.je():this.e.i.pe()).filter(o=>!o.isDetail&&!o.isGroup&&this.ke(o));if(i.length!==0){if(t==="single"){this.fe([{node:i[0],selected:!0,clearOthers:!0}]);return}this.fe(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.fe([],!0)}ic(){let t=this.e.i.je().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.ke(r));if(t.length===0)return!1;if(this.e.i.p){let r=this.e.i.Gt();if(t.length<r)return!1}return t.every(r=>this.R.has(r.id))}nc(){let t=this.e.i.je().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.ke(i)),r=t.reduce((i,o)=>i+(this.R.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.p){let i=this.e.i.Gt();if(t.length<i)return!0}return r>0&&r<t.length}oc(e,t=!1){this.fe(e,t)}sc(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.R=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.aa(i.node):[i.node.id])))}ac(e,t){for(let r of e){if(!this.ke(r.node))continue;let i=t?this.aa(r.node):[r.node.id];for(let o of i)r.selected?this.R.add(o):this.R.delete(o)}}lc(e){let t=new Set;for(let r of new Set([...e,...this.R]))e.has(r)!==this.R.has(r)&&t.add(r);return t}dc(e,t,r){let i=[],o=new Set([...e,...r,...this.Tr]);for(let s of this.e.i.pe()){let a=this.R.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}fe(e,t=!1){let r=new Set(this.R),i=this.e.i.N&&this.e.r.autoCheckedChildren;this.sc(e,t,i),this.ac(e,i);let o=this.lc(r),s=new Map;for(let d of this.e.i.pe())s.set(d.id,d.selected);let a=new Set(this.Tr);this.ia();let l=this.dc(o,s,a);o.size>0&&(this.e.a.Ye(l),this.e.B.ui(),this.e.emit("selectionChanged",{selectedNodes:this.Pe(),selectedRows:this.gi()}))}aa(e){let t=[e.id],r=i=>{for(let o of this.e.i.gr(i))t.push(o),r(o)};return r(e.id),t}ia(){if(this.Tr.clear(),!this.e.i.N)return;let e=t=>{let r=this.e.i.gr(t);if(r.length===0)return{all:this.R.has(t),some:this.R.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.Tr.add(t),i?this.R.add(t):this.R.delete(t),{all:i,some:o}};for(let t of this.e.i.Yd())e(t.id);for(let t of this.e.i.pe())t.selected=this.R.has(t.id)}};var Qe=class{constructor(e){this.e=e;this.active=null;this.Q=0;this.Xe=0;this.Ce=null;this.mt=null;this.Je=e=>{let t=this.Xn(e);t&&(this.Xe=this.ua(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.Xe-t.startWidth)>=.5),!this.Q&&(this.Q=requestAnimationFrame(()=>{this.Q=0,this.hc()})))};this.Te=e=>{let t=this.Xn(e);t&&(this.Xe=this.ua(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.Xe-t.startWidth)>=.5),this.pc(t))};this.yt=e=>{this.Xn(e)&&this.gt()};this.la=()=>{this.gt()}}cc(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.gt();let r=e.currentTarget,i=t.currentWidth;this.Xe=i,this.active={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.Je),window.addEventListener("pointerup",this.Te,!0),window.addEventListener("pointercancel",this.yt,!0),r.addEventListener("lostpointercapture",this.la);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.uc(this.active)}gt(e=!0){let t=this.active;t&&(this.active=null,this.Yn(),this.da(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.Ze()),this.e.o.root.classList.remove("mach-root--resizing"),this.ca(t))}pc(e){this.active=null,this.Yn(),e.didResize&&(Math.abs(this.Xe-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Ie(e.column,this.Xe),this.e.Ze()),this.da(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.ca(e),e.didResize&&this.e.zt([e.column])}hc(){let e=this.active;!e||!this.e.n.Ie(e.column,this.Xe)||(this.e.Ze(),this.Dr(e),this.e.ha(e.column,!1))}uc(e){this.Ce=document.createElement("div"),this.Ce.className="mach-column-resize-guide",this.Ce.setAttribute("aria-hidden","true"),this.mt=document.createElement("span"),this.mt.className="mach-column-resize-label",this.Ce.appendChild(this.mt),this.e.o.root.appendChild(this.Ce),this.Dr(e)}Dr(e){if(!this.Ce||!this.mt)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.Ce.style.left=`${o}px`,this.Ce.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.mt.style.left=`${s-o}px`,this.mt.textContent=`${Math.round(e.column.currentWidth)} px`}ca(e){e.handle.classList.remove("mach-header-resize--active"),this.Ce?.remove(),this.Ce=null,this.mt=null}ua(e,t){let r=Number.isFinite(t)?t:e.startX;return e.startWidth+r-e.startX}Xn(e){let t=this.active;return t&&e.pointerId===t.pointerId?t:null}Yn(){this.Q&&cancelAnimationFrame(this.Q),this.Q=0}da(e){window.removeEventListener("pointermove",this.Je),window.removeEventListener("pointerup",this.Te,!0),window.removeEventListener("pointercancel",this.yt,!0),e.handle.removeEventListener("lostpointercapture",this.la)}destroy(){this.gt(!1),this.Yn(),this.e.o.root?.classList.remove("mach-root--resizing")}};var yi=6,et=class{constructor(e){this.e=e;this.pending=null;this._t=null;this.Jn=!1;this.ie=0;this.vi=null;this.Je=e=>{if(this._t){this.gc(e);return}let t=this.pending;t&&(Math.abs(e.clientX-t.startX)<yi&&Math.abs(e.clientY-t.startY)<yi||this.yc(e))};this.Te=e=>{this.pending=null,e.type!=="pointercancel"&&this._t&&this.eo(e.clientX,e.clientY),this.Zn();let t=this.pa();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.ut(t.column.id,t.targetIndex)}}fc(e,t){e.button===0&&t.movable&&(this.pending={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.Je),window.addEventListener("pointerup",this.Te),window.addEventListener("pointercancel",this.Te))}mc(){let e=this.Jn;return this.Jn=!1,e}yc(e){let t=this.pending;if(!t)return;let r=this.vc(t.column);if(!r||!r.parentElement){this.Zn();return}this.Jn=!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",P(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.Qn(t.column),a=this.e.o.Kt[s],l=this.e.n.C(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._t={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.S.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.eo(e.clientX,e.clientY)}vc(e){let t=this.e.a.Qn(e);return this.e.o.Kt[t].querySelector(`.mach-header-cell[data-col-id="${Go(e.id)}"]`)}gc(e){this.vi={clientX:e.clientX,clientY:e.clientY},!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0;let t=this.vi;this.vi=null,t&&this.eo(t.clientX,t.clientY)}))}eo(e,t){let r=this._t;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.S.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)`}pa(){let e=this._t;return e?(this._t=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}Zn(){window.removeEventListener("pointermove",this.Je),window.removeEventListener("pointerup",this.Te),window.removeEventListener("pointercancel",this.Te),this.ie&&cancelAnimationFrame(this.ie),this.ie=0,this.vi=null}destroy(){this.Zn(),this.pa(),this.pending=null}};function Go(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var er=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function tt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!er.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 No(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
2
|
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function ce(n){return typeof n!="string"||n===""||er.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function vi(n,e={}){let t=e.columnSeparator??",",r=e.protectFormulas??!0,i=n.map(o=>o.map(s=>No(r?ce(s):s,t)).join(t)).join(`\r
|
|
3
3
|
`);return e.prependBOM?"\uFEFF"+i:i}function tr(n){return n==null?"":String(n)}function Fo(n,e){let t=e?ce(n):n,r=tr(t);return/["\t\n\r]/.test(r)?'"'+r.replace(/"/g,'""')+'"':r}function rr(n,e=!0){return n.map(t=>t.map(r=>Fo(r,e)).join(" ")).join(`
|
|
4
4
|
`)}function ir(n){return or(n," ")}function nr(n,e=","){return or(n,e)}function or(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 Oo(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 Te(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return Oo(n)}var Ho=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","F2","Home","End","PageUp","PageDown","Tab"," ","Escape","Delete","Backspace"]),Vo=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),rt=class{constructor(e){this.e=e;this.fa=e=>{if(this.e.r.suppressClipboard||this.e.l.isEditing())return;let t=this.e.a.Wt();if(!t)return;let r=this.e.to(t),i=e.clipboardData;i&&typeof i.setData=="function"?i.setData("text/plain",r):Te(r),e.preventDefault()};this.ma=e=>{if(this.e.r.suppressClipboard||this.e.l.isEditing())return;let t=this.e.a.Wt();if(!t)return;let r=this.e.to(t),i=e.clipboardData;i&&typeof i.setData=="function"?i.setData("text/plain",r):Te(r),this.e.ro(t),e.preventDefault()};this.ga=e=>{if(this.e.r.suppressClipboard||this.e.l.isEditing())return;let t=this.e.a.no();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.va(i,t.row,t.colIdx))};this.Er=e=>{this.e.s()||this.e.l.isEditing()||this.bc(e)||this.wc(e)||Ho.has(e.key)&&(this.Cc(e)||this.Tc(e)||this.Dc(e))}}init(){this.e.o.root.addEventListener("keydown",this.Er),this.e.o.root.addEventListener("copy",this.fa),this.e.o.root.addEventListener("cut",this.ma),this.e.o.root.addEventListener("paste",this.ga)}destroy(){this.e.o.root.removeEventListener("keydown",this.Er),this.e.o.root.removeEventListener("copy",this.fa),this.e.o.root.removeEventListener("cut",this.ma),this.e.o.root.removeEventListener("paste",this.ga)}ya(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.I(),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.vt(l+1,1)}else if(a<0){if(l<=0)return null;a=i.length-1,l=this.vt(l-1,-1)}if(l<0||l>=s)return null;let c=this.e.i.f(l);if(c&&!c.isDetail&&this.e.l.W(c,i[a]))return{rowIndex:l,column:i[a]}}return null}vt(e,t){let r=this.e.i.I(),i=0;for(;e>=0&&e<r;){let o=this.e.i.f(e);if(!o||!o.isDetail)return e;if(e+=t,i++,i>r+2)break}return-1}bc(e){return!(e.ctrlKey||e.metaKey)||e.key.toLowerCase()!=="a"?!1:(this.e.r.rowSelection==="multiple"&&(e.preventDefault(),this.e.m.selectAll(!0)),!0)}wc(e){if(!e.ctrlKey&&!e.metaKey||e.altKey)return!1;let t=e.key.toLowerCase();return t==="z"?(e.preventDefault(),e.shiftKey?this.e.O.redo():this.e.O.undo(),!0):t!=="y"?!1:(e.preventDefault(),this.e.O.redo(),!0)}Cc(e){let t=this.e.a;if(e.key==="Escape")return this.e.ve(),this.e.r.enableRangeSelection&&t.De()&&(e.preventDefault(),t.$t()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;if(!this.e.r.enableRangeSelection)return!0;let r=t.De();return r&&!(r.r1===r.r2&&r.c1===r.c2)&&(e.preventDefault(),this.e.ro(r)),!0}Tc(e){if(this.e.a.T)return!1;let t=this.e.n.c();return this.e.i.I()>0&&t.length>0&&(e.preventDefault(),this.e.a.Ee(0,t[0].id)),!0}Dc(e){let t=this.e.a,r=t.T;if(!r)return;let i=this.e.n.c(),o=i.findIndex(c=>c.id===r.colId),s=this.e.i.I();if(o<0||s===0)return;let a={row:r.rowIndex,colIdx:o},l=this.Ec(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.xc(l.row,l.colIdx);return}d&&t.Ee(l.row,i[l.colIdx].id)}Ec(e,t,r,i){return Vo.has(e.key)?this.Rc(e,t,r.length,i):e.key==="Enter"||e.key==="F2"?this.Sc(e,t,r,i):e.key===" "?(this.Mc(t.row),t):e.key==="Tab"?this.Ic(e,t,r):null}Rc(e,t,r,i){let{row:o,colIdx:s}=t;switch(e.key){case"ArrowUp":o=this.bi(o,this.vt(o-1,-1),i);break;case"ArrowDown":o=this.bi(o,this.vt(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.vt(i-1,-1)));break;case"PageUp":case"PageDown":o=this.Ac(e.key,o,i);break}return{row:o,colIdx:s}}bi(e,t,r){return t>=0&&t<r?t:e}Ac(e,t,r){let i=this.e.o.S.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.bi(t,this.vt(a,s),r)}Sc(e,t,r,i){let o=this.e.i.f(t.row),s=r[t.colIdx];if(o&&!o.isDetail&&s&&this.e.l.W(o,s))return this.e.l.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.vt(t.row+1,1);return{...t,row:this.bi(t.row,a,i)}}Mc(e){let t=this.e.i.f(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Kn(t.id);return}this.e.r.rowSelection!=="none"&&this.e.m.oa(t,!t.selected,this.e.r.rowSelection==="single")}}Ic(e,t,r){let i=this.ya(t.row,r[t.colIdx].id,e.shiftKey?-1:1);return i?(this.e.a.Ee(i.rowIndex,i.column.id),this.e.l.start(i.rowIndex,i.column),t):null}};var G=null;function wi(n){G?.owner&&(n===G.owner||n.contains(G.owner))&&G.close()}function Ci(n){let e=n.target;G?.contains(e)||G?.close()}function ot(){G?.reposition()}function Ti(n){n.key!=="Escape"||!G||(n.preventDefault(),n.stopImmediatePropagation(),G.close(!0))}function Bo(n){G?.close!==n.close&&G?.close(),!G&&(G=n,document.addEventListener("mousedown",Ci,!0),document.addEventListener("keydown",Ti,!0),window.addEventListener("resize",ot),window.addEventListener("scroll",ot,!0))}function zo(n){G?.close===n&&(G=null,document.removeEventListener("mousedown",Ci,!0),document.removeEventListener("keydown",Ti,!0),window.removeEventListener("resize",ot),window.removeEventListener("scroll",ot,!0))}function ie(n,e){return e?`${n} ${e}`:n}function nt(n){let e=[];return n.forEach((t,r)=>{t.disabled||e.push(r)}),e}function bi(n,e,t){let r=nt(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 it(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function Y(n){let e=f("div",ie("mach-select-control",n.classNames?.root)),t=f("select",ie("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let r=f("button",ie("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",ie("mach-select-value",n.classNames?.value)),o=f("span",ie("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),r.append(i,o);let s=f("div",ie("mach-select-listbox",n.classNames?.listbox));s.id=_r("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)),N=window.innerHeight-g.bottom-8,_=N<Math.min(y.height,240)&&g.top>N,L=_?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",_)},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(),zo(m),g&&!c&&r.focus({preventScroll:!0}),!0):!1,v=(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")||(Bo({owner:u(),close:m,contains:g=>e.contains(g)||s.contains(g),reposition:p}),d=it(a,t.value),d<0&&(d=nt(a)[0]??-1),P(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,N)=>{let _=document.createElement("option");_.value=T.value,_.textContent=T.label,_.disabled=T.disabled===!0,t.appendChild(_);let L=f("button",ie("mach-select-option",n.classNames?.option));return L.id=`${s.id}-option-${N}`,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",zt=>zt.preventDefault()),L.addEventListener("click",()=>C(N)),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=it(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=nt(a)[0]??-1;else if(g.key==="End"){let D=nt(a);y=D[D.length-1]??-1}else return;g.preventDefault(),g.stopPropagation(),s.classList.contains("mach-select-listbox--open")||w(),v(y)},b=()=>{d=it(a,t.value),h(),n.onChange?.(t.value)};return r.addEventListener("click",()=>{m()||w()}),r.addEventListener("keydown",M),t.addEventListener("change",b),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=it(a,g),h()},setOptions:R,destroy:()=>{c||(c=!0,m(),r.removeEventListener("keydown",M),t.removeEventListener("change",b),e.remove())}}}function Di(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 _o(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function Ko(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 sr(n,e,t){let r=n.colDef,i=typeof r.cellEditor=="string"?r.cellEditor:Ko(e,r.cellEditorParams);if(i==="date"){let a=Di("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=_o(r.cellEditorParams),l=Y({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=Di(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()}}}var ar=new WeakMap,st=new WeakMap,at=new WeakMap;function De(n){let e=ar.get(n);return e||(e={},ar.set(n,e)),e}function lr(n){return ar.get(n)}function Ei(n,e){e?st.set(n,e):st.delete(n)}function xi(n){let e=st.get(n);return st.delete(n),e}function Ri(n,e){e?at.set(n,e):at.delete(n)}function dr(n){let e=at.get(n);return at.delete(n),e}function cr(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=lr(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 Si(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 Wo(n,e,t,r,i,o){let s=lr(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 X(n,e,t){return ue(n,e,t,n.d(e,t))}function ue(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 cr(r)}function lt(n,e,t,r){let i=r.colDef.cellStyle,o=De(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 dt(n,e,t,r){let i=n.d(t,r),o=X(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(Wo(n,e,t,r,a,l)){Si(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=De(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;Si(n,e,t,r,i,o)}function $o(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}(le(e.colDef,"rightAligned")||le(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function Uo(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 qo(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 Ee(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];$o(o,r,i),Uo(n,o,t,r,i),qo(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function ne(n){return n!=null&&typeof n.then=="function"}var ct=class{constructor(e){this.e=e;this.generation=0}kc(){this.generation++}oo(){let e=++this.generation;return()=>e===this.generation&&!this.e.s()}wi(e){let t=e[0].node,r=this.e.n.X(),i=r.map(a=>this.e.d(t,a)),o=this.xr(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]))}xr(e){let t=e[0].node,r=t.data,i=this.e.n.X(),o=new Set(i),s=e.every(a=>a.node===t&&o.has(a.column));return()=>s&&!this.e.s()&&this.e.i.z(t.id)===t&&t.data===r&&this.e.n.X()===i}Ci(e,t){let r=e.map(o=>this.Pc(o,t)),i=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.Gc(e,t)};return r.some(ne)?Promise.all(r.map(o=>Promise.resolve(o))).then(i):i(r)}Pc(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 ne(d)?d.then(l,a):l(d)}catch(d){return a(d)}}Gc(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.X())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 ne(l)?l.then(s,a):s(l)}catch(l){return a(l)}}so(e,t){let r=[],i=this.xr(e);for(let o of e){if(!t()||!i()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.l.W(o.node,o.column)||!this.e.Ti(o.node,o.column,o.newValue,o.oldValue)){for(let s of r.reverse()){if(!t()||!i())break;this.e.Ti(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"}}Nc(e){let t=this.oo();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.W(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.wi(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Ci(a,d)}}),o=a=>{this.ba(i,a,t)},s=i.map(a=>a.validation);s.some(ne)?Promise.all(s.map(a=>Promise.resolve(a))).then(o):o(s)}ba(e,t,r){let i=e.map(()=>({applied:!1,errors:[]}));if(!r())return i;let o=new Set;this.e.O.wa();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.so(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.xr(s);d.applied=!0;for(let h of s){if(!r()||!u()){d.applied=!1;break}this.e.ao(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.O.Ca()}return o.size&&r()&&(this.e.a.Ye([...o]),this.e.ne.refresh(),this.e.Ge.refresh()),i}};function oe(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 xe(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:ue(n,e,t,i)}var jo='<path d="M3 8.5 6.4 12 13.5 4"/>',Yo='<path d="m4 4 8 8m0-8-8 8"/>';function Mi(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"?jo:Yo}</svg>`,t.addEventListener("mousedown",r=>{r.preventDefault(),r.stopPropagation()}),t}var ut=class{constructor(e){this.e=e;this.v=null;this.D=null;this.oe=null;this.Qe=0;this.Fc=e=>{if(this.v&&!(e.isComposing||e.keyCode===229)){if(e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.se(!1);else if(e.key==="Escape")e.preventDefault(),e.stopPropagation(),this.se(!0);else if(e.key==="Tab"){e.preventDefault(),e.stopPropagation();let t=this.v,r=this.e.yo.ya(t.rowIndex,t.column.id,e.shiftKey?-1:1);this.se(!1).then(i=>{i&&r&&(this.e.a.Bt(r.rowIndex,"nearest"),this.e.a.Ee(r.rowIndex,r.column.id),this.start(r.rowIndex,r.column))})}}}}isEditing(e,t){return this.v?e==null&&t==null?!0:this.v.rowIndex===e&&this.v.column.id===t:this.D?e==null&&t==null?!0:this.Rr(this.D)!==e?!1:t==null||this.D.drafts.has(t):!1}Di(){return this.v!=null}Rd(){return this.v?.node.rowIndex??(this.D?this.Rr(this.D):null)}Ei(e){return this.D?e==null||this.Rr(this.D)===e:!1}W(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.v)return this.v.rowIndex===e&&this.v.column.id===t.id||this.se(!1).then(p=>{p&&!this.v&&!this.D&&this.start(e,t,r)}),!0;let i=this.e.i.f(e);if(!i||i.data==null||!this.W(i,t))return!1;let o=this.e.a.xi(e,t.id);if(!o)return!1;this.e.ve();let s=this.e.d(i,t),a=this.Ta(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=Mi("confirm","Confirm edit"),u=Mi("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.Fc;return a.el.addEventListener("keydown",h),c.addEventListener("click",p=>{p.stopPropagation(),this.se(!1)}),u.addEventListener("click",p=>{p.stopPropagation(),this.se(!0)}),this.v={node:i,column:t,editor:a,rowIndex:e,oldValue:s,cell:o,shell:l,keydown:h,confirmButton:c,cancelButton:u},this.lo(a,t,i),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:i}),!0}startRow(e,t){if(this.v||this.D)return!1;let r=this.e.i.f(e);if(!r||r.data==null||r.isDetail||r.isGroup)return!1;this.e.ve();let i=new Map;for(let l of this.e.n.c()){if(!this.W(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.Ye([e]),i.size===0)return this.D=null,this.e.a.Ye([e]),!1;let s=i.values().next().value,a=(t?i.get(t):void 0)??s;return a?.mounted&&this.lo(a.mounted.editor,a.column,r),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:r,data:r.data}),!0}Da(e,t,r,i){if(this.v)return this.v.node===t&&this.v.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.Ea(s),!this.Oc(e,o,s,i))?(o.drafts.delete(r.id),!1):!0:!1}co(e,t,r){let i=this.D;if(i&&this.Rr(i)===e){let o=i.drafts.get(t);o?.mounted?.cell===r&&this.Ea(o);return}if(this.v?.cell===r){let o=this.v;this.se(!1),this.v===o&&this.se(!0)}}stop(e=!1){this.se(e)}se(e=!1){if(this.D)return this.uo(e);let t=this.v;if(!t)return Promise.resolve(!1);if(e)return this.Qe++,this.oe=null,Promise.resolve(this.Ut(t,!0,t.oldValue));if(this.oe)return this.oe;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.Ut(t,!0,t.oldValue))}try{Object.is(r,t.oldValue)||(r=oe(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.Sr(t.editor,u instanceof Error?u.message:String(u)),Promise.resolve(!1)}try{if(t.editor.isCancelAfterEnd?.(r))return Promise.resolve(this.Ut(t,!0,t.oldValue))}catch(u){return this.e.reportError(u,"cellEditor.isCancelAfterEnd",{colId:t.column.id,rowId:t.node.id}),Promise.resolve(this.Ut(t,!0,t.oldValue))}let i=[{node:t.node,column:t.column,oldValue:t.oldValue,newValue:r}],o=this.e._.wi(i),s=++this.Qe,a=()=>s===this.Qe&&this.v===t&&o(),l=u=>a()?u.length?(this.ho(t,!1),this.Sr(t.editor,u[0].message),!1):this.Ut(t,!1,r):(s===this.Qe&&this.v===t&&this.Ut(t,!0,t.oldValue),!1),d=this.e._.Ci(i,a);if(!ne(d))return Promise.resolve(l(d));this.ho(t,!0);let c=d.then(l).finally(()=>{this.oe===c&&(this.oe=null)});return this.oe=c,c}uo(e=!1){let t=this.D;if(!t)return Promise.resolve(!1);if(e)return this.Qe++,this.oe=null,Promise.resolve(this.Ri(t,!0));if(this.oe)return this.oe;for(let h of t.drafts.values())this.po(h);let r=[];for(let h of t.drafts.values())if(!Object.is(h.oldValue,h.value))try{let p=oe(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.fo(t,[{draft:h,message:p instanceof Error?p.message:String(p)}]),Promise.resolve(!1)}if(r.length===0)return Promise.resolve(this.Ri(t,!1,r));let i=r.map(h=>t.drafts.get(h.column.id)),o=i.map(h=>h.value),s=this.e._.wi(r),a=++this.Qe,l=()=>a===this.Qe&&this.D===t&&s();for(let h of i)h.error=void 0;let d=h=>l()?h.length?(this.fo(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.mo(t,!1),!1):this.Ri(t,!1,r):(a===this.Qe&&this.D===t&&this.Ri(t,!0),!1),c=this.e._.Ci(r,l);if(!ne(c))return Promise.resolve(d(c));t.validating=!0,this.mo(t,!0);let u=c.then(d).finally(()=>{this.oe===u&&(this.oe=null)});return this.oe=u,u}Ut(e,t,r){if(this.v!==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._.so([i],()=>!this.e.s());if(s)return this.ho(e,!1),this.Sr(e.editor,s.message),!1}return this.v=null,o&&this.e.ao(e.node,e.column,e.oldValue,r),this.go(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.Ye([e.node.rowIndex]),this.e.ne.refresh(),this.e.Ge.refresh()),!0}Ri(e,t,r=[]){if(this.D!==e)return!1;let i=t?[]:this.Hc(e,r);if(i==null)return!1;for(let s of e.drafts.values())s.mounted&&this.go(s.mounted,!0),s.mounted=null;if(this.D=null,this.e.s())return!0;let o=this.Rr(e);return this.e.emit("rowEditingStopped",{rowIndex:o,rowNode:e.node,data:e.node.data,cancelled:t,changes:i}),o>=0&&this.e.a.Ye([o]),this.e.ne.refresh(),this.e.Ge.refresh(),!0}Hc(e,t){if(t.length===0)return[];let r=this.e._.so(t,()=>!this.e.s());if(r)return this.fo(e,[{draft:e.drafts.get(r.colId)??e.drafts.get(t[0].column.id),message:r.message}]),null;let i=this.e._.xr(t);this.e.O.wa();try{for(let o of t){if(!i())break;this.e.ao(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.O.Ca()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}Oc(e,t,r,i){let o=this.Ta(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.Vc(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.Sr(o,r.error),t.validating&&(o.el.classList.add("mach-editor-validating"),o.el.setAttribute("aria-busy","true"),o.el.inert=!0),!0}Ea(e){e.mounted&&(this.po(e),this.go(e.mounted,!0),e.mounted=null)}po(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})}}Ta(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.Bc(s.cellEditor)?.(l)??sr(t,i,o):a=sr(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}fo(e,t){e.validating=!1,this.mo(e,!1);for(let{draft:r,message:i}of t)r.error=i,r.mounted&&this.Sr(r.mounted.editor,i);t[0].draft.mounted?.editor.focus?.()}Sr(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})}ho(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)}mo(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)}}lo(e,t,r){try{e.focus?.()}catch(i){this.e.reportError(i,"cellEditor.focus",{colId:t.id,rowId:r.id})}}go(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")}Rr(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}Vc(e,t,r){if(this.D!==t)return;if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.uo(!0);return}if(e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.uo(!1);return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.po(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.lo(l.mounted.editor,l.column,t.node);break}}}destroy(){(this.v||this.D)&&this.se(!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:"\u6682\u65E0\u6570\u636E",emptyRowsHint:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",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"},Xo={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 Data",emptyRowsHint:"No rows to display",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"},Jo={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 ur(n){return Jo[n]??"matchEquals"}function W(n,e){return n.replace("{n}",String(e))}function Re(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}function hr(n){return n==="blank"||n==="notBlank"}function ht(n){return n===null?"null:":`${typeof n}:${String(n)}`}var pt=class{constructor(e){this.e=e;this.y=null;this.et=null;this.qt=null;this.tt=e=>{if(!this.y)return;let t=e.target;if(!this.y.contains(t)&&!this.qt?.contains(t)){this.close();return}this.qt?.contains(t)||(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.xa()};this.rt=e=>{if(e.key==="Escape"){if(this.xa(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.et===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let r=this.e.i.j()[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.zc(o,e,r):this._c(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.g("reset"),a.addEventListener("click",()=>{this.e.vo(e,null),this.close()});let l=f("button","mach-filter-btn-apply");l.type="button",l.textContent=this.e.g("apply"),l.addEventListener("click",()=>{let c=this.Ra(o);this.e.vo(e,c),this.close()}),s.append(a,l),o.appendChild(s),P(o,this.e.o.root),document.body.appendChild(o),this.y=o,this.et=e.id,j(o,t),document.addEventListener("mousedown",this.tt,!0),document.addEventListener("keydown",this.rt,!0),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.y&&(this.qt?.destroy(),this.qt=null,this.y.remove(),this.y=null,this.et=null,document.removeEventListener("mousedown",this.tt,!0),document.removeEventListener("keydown",this.rt,!0))}destroy(){this.close()}_c(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.Kc(r,s),d=this.Sa(r),c=this.Sa(r,!0);this.Wc(r,s,o,d,c),this.Ma(s,d,c),l.addEventListener("change",()=>{this.Ma(l.value,d,c)}),this.$c(t,e,d,c);let u=f("div","mach-filter-body");u.append(a,d,c),e.appendChild(u),e.dataset.filterType=r}Kc(e,t){let r=Y({ariaLabel:"Filter condition",options:ae[e].map(i=>({value:i,label:this.e.g(ur(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.qt=r,{root:r.el,select:r.native}}xa(e=!1){return this.qt?.close(e)??!1}Sa(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}Wc(e,t,r,i,o){r?.value!=null&&!hr(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))}Ma(e,t,r){t.style.display=hr(e)?"none":"",r.style.display=e==="inRange"?"":"none"}$c(e,t,r,i){let o=s=>{s.key==="Enter"&&(this.e.vo(e,this.Ra(t)),this.close())};r.addEventListener("keydown",o),i.addEventListener("keydown",o)}zc(e,t,r){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let v=new Set;s=[];let w=this.e.i.pe(),C=Math.min(w.length,o?.maxValues??500);for(let R=0;R<C;R++){let M=this.e.d(w[R],t),b=ht(M??null);v.has(b)||(v.add(b),s.push(M))}}let a=new Set(r?.type==="set"?r.values.map(ht):s.map(ht)),l=f("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.g("search");let d=f("div","mach-filter-set-list"),c=[],u=new Map,h=v=>{d.textContent="",c.length=0;let w=v.trim().toLowerCase();for(let C of s){let R=C==null?this.e.g("emptySetLabel"):String(C);if(w&&!R.toLowerCase().includes(w))continue;let M=ht(C);u.set(M,C);let b=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,b.append(g,y),d.appendChild(b),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 v=[...u.entries()];e.dataset.setValues=JSON.stringify(v)})();let m=f("div","mach-filter-body mach-filter-body--set");m.append(l,d),e.appendChild(m)}Ra(e){let t=e.dataset.filterType;if(t==="set")return this.Uc(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(hr(a))return{type:t,conditions:[{match:a}]};let l=o.value;return l===""&&a!=="inRange"?null:t==="number"?this.qc(a,l,s):t==="date"?this.jc(a,l,s):{type:"text",conditions:[{match:a,value:l}]}}Uc(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}}qc(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}]}}jc(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 ft=class{constructor(e){this.e=e;this.y=null;this.et=null;this.Si=null;this.Mi="";this.Mr=new Set;this.tt=e=>{let t=e.target;this.y&&!this.y.contains(t)&&!this.Xc(t)&&this.close()};this.rt=e=>{if(e.key!=="Escape")return;if([...this.Mr].find(r=>r.isOpen())?.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}toggle(e,t){if(this.et===e.id){this.close();return}this.close(),this.open(e,t)}Yc(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.Si=o,o})();this.open(null,t)}close(){this.Ia(),this.Si&&(this.Si.remove(),this.Si=null),this.y?.remove(),this.y=null,this.et=null,document.removeEventListener("mousedown",this.tt,!0),document.removeEventListener("keydown",this.rt,!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.g("columnSettings")));let o=f("div","mach-column-panel-title");if(o.textContent=e?e.colDef.headerName??e.colDef.field??e.id:this.e.g("columnSettings"),i.appendChild(o),e&&e.sortable){let C=f("div","mach-column-panel-actions"),R=(M,b)=>{let g=f("button","mach-column-panel-btn");return g.type="button",g.textContent=this.e.g(M),g.addEventListener("click",()=>{r.sorting.setModel(b?[{colId:e.id,direction:b}]:[]),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.g(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.g("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.g("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.g("columnVisibility"),i.appendChild(h),!e){let C=document.createElement("input");C.type="search",C.className="mach-column-workbench-search",C.placeholder=this.e.g("search"),C.setAttribute("aria-label",this.e.g("search")),C.value=this.Mi,C.addEventListener("input",()=>{this.Mi=C.value.trim().toLocaleLowerCase(),this.bo(p,!0)}),i.appendChild(C)}let p=f("div","mach-column-panel-list");this.bo(p,!e),i.appendChild(p);let m=f("div","mach-filter-footer"),v=f("button","mach-filter-btn-reset");v.type="button",v.textContent=this.e.g("resetAll"),v.addEventListener("click",()=>{r.columns.resetState(),this.close()});let w=f("button","mach-filter-btn-apply");w.type="button",w.textContent=this.e.g("autoSizeAll"),w.addEventListener("click",()=>{r.columns.autoSizeAll(),this.close()}),m.append(v,w),i.appendChild(m),P(i,this.e.o.root),document.body.appendChild(i),this.y=i,this.et=e?e.id:"__standalone__",j(i,t),document.addEventListener("mousedown",this.tt,!0),document.addEventListener("keydown",this.rt,!0)}wo(){if(!this.y)return;let e=this.y.querySelector(".mach-column-panel-list");e&&this.bo(e,this.et==="__standalone__")}bo(e,t){let r=this.e.api;this.Ia(e),e.replaceChildren();let i=this.e.n.X().filter(o=>o.isDetailToggle?!1:!t||!this.Mi?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.Mi));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.wo()});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=Y({ariaLabel:`${d.textContent} ${this.e.g("clearPin")}`,options:[{value:"",label:this.e.g("clearPin")},{value:"left",label:this.e.g("pinLeft")},{value:"right",label:this.e.g("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.wo()}});c.trigger.disabled=!o.movable,c.native.disabled=!o.movable,this.Mr.add(c),s.appendChild(c.el);let u=this.e.n.X().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=u.indexOf(o),p=(m,v,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,v),this.wo()}),C};s.append(p("\u2191",h-1,h<=0),p("\u2193",h+1,h<0||h>=u.length-1))}e.appendChild(s)}}Xc(e){return[...this.Mr].some(t=>t.contains(e))}Ia(e){for(let t of[...this.Mr])e&&!e.contains(t.el)||(t.destroy(),this.Mr.delete(t))}};var mt=class{constructor(e){this.e=e;this.y=null;this.tt=e=>{this.y&&!this.y.contains(e.target)&&this.close()};this.rt=e=>{e.key==="Escape"&&this.close()}}Jc(e){if(e){let o=this.e.i.f(e.rowIndex),s=this.e.n.L(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.a.Wt();if(!t)return null;let r=this.e.i.f(t.r1),i=this.e.n.c()[t.c1];return r&&i?{node:r,column:i}:null}Zc(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}}Qc(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.eu(s,r,i))),e.appendChild(a)}return o}eu(e,t,r){this.close();try{e.action?.()}catch(i){this.e.reportError(i,"contextMenu.action",{colId:r.id,rowId:t.id})}}Co(e,t,r){let i=f("button","mach-context-menu-item");i.type="button",i.textContent=t,i.addEventListener("click",r),e.appendChild(i)}tu(e){let t=this.e;this.Co(e,t.g("menuCopy"),()=>{t.Aa(),this.close()}),!t.r.suppressClipboard&&(this.Co(e,t.g("menuPaste"),()=>{t.ru(),this.close()}),this.Co(e,t.g("menuClearContents"),()=>{let r=t.a.Wt();r&&t.ro(r),this.close()}))}open(e,t,r){this.close();let i=this.Jc(r);if(!i)return;let o=f("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.r.getContextMenuItems){let s=this.Zc(i.node,i.column);if(!s||!this.Qc(o,s,i.node,i.column))return;this.La(o,e,t);return}this.tu(o),this.La(o,e,t)}La(e,t,r){P(e,this.e.o.root),document.body.appendChild(e),this.y=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.tt,!0),document.addEventListener("keydown",this.rt,!0)}close(){this.y&&(this.y.remove(),this.y=null,document.removeEventListener("mousedown",this.tt,!0),document.removeEventListener("keydown",this.rt,!0))}destroy(){this.close()}};var gt=class{constructor(e){this.e=e;this.y=null;this.Ii=0;this.To=0;this.Ir=null;this.Ar=e=>{if(this.e.s()||!this.e.r.tooltipComponent)return;let r=e.target.closest(".mach-cell");if(!r||r===this.Ir)return;this.Do(),this.Ai(),this.Ir=r;let i=this.iu(r);if(!i||r.classList.contains("mach-cell--editing"))return;let o=this.nu(i.node,i.column,i.index);this.ou(o,i.column)&&(this.Ii=window.setTimeout(()=>{this.e.s()||this.Ir!==r||this.su(r,o)},Math.max(0,this.e.r.tooltipShowDelay)))};this.ka=()=>{this.hide()}}init(){let e=this.e.o.me;e.addEventListener("mouseover",this.Ar),e.addEventListener("mouseleave",this.ka)}destroy(){this.Do(),this.Ai();let e=this.e.o.me;e.removeEventListener("mouseover",this.Ar),e.removeEventListener("mouseleave",this.ka),this.Ir=null}hide(){this.Do(),this.Ai(),this.Ir=null}Do(){this.Ii&&(clearTimeout(this.Ii),this.Ii=0),this.To&&(clearTimeout(this.To),this.To=0)}Ai(){this.y&&(this.y.remove(),this.y=null)}iu(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.f(r),o=t?this.e.n.L(t):void 0;return!i||!o||i.isDetail||i.isGroup?null:{node:i,column:o,index:r}}nu(e,t,r){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:X(this.e,e,t),rowIndex:r}}ou(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}su(e,t){this.Ai();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),P(i,this.e.o.root),document.body.appendChild(i),this.y=i,j(i,e,6)}};var yt=class{constructor(e){this.e=e;this.Y=null}init(){this.Y=document.createElement("div"),this.Y.className="mach-watermark",this.Y.setAttribute("aria-hidden","true"),this.Y.style.pointerEvents="none",this.e.o.root.appendChild(this.Y),this.apply()}apply(){if(!this.Y||this.e.s())return;let e=this.e.r.watermarkEnabled?this.e.r.watermarkConfig:null;if(!e||!e.text){this.Y.style.display="none",this.Y.style.backgroundImage="";return}let t=this.au(e);this.Y.style.display="",t?(this.Y.style.backgroundImage=`url(${t})`,this.Y.style.backgroundColor=""):this.Y.style.backgroundImage=""}au(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.lu()?"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}}lu(){return this.e.o.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.Y?.remove(),this.Y=null}};var vt=class{constructor(e){this.e=e;this.stack=[];this.ae=-1;this.pending=null}wa(){this.pending||(this.pending=[])}Ca(){if(!this.pending)return;let e=this.pending;this.pending=null,e.length>0&&this.push(e)}Eo(e){if(this.pending){this.pending.push(e);return}this.push([e])}push(e){let t=Math.max(0,this.e.r.undoStackSize);if(t!==0){for(this.stack.length=this.ae+1,this.stack.push(e);this.stack.length>t;)this.stack.shift();this.ae=this.stack.length-1}}du(){let e=Math.max(0,this.e.r.undoStackSize);if(e===0){this.clear();return}for(;this.stack.length>e;)this.stack.shift(),this.ae--;this.ae<-1&&(this.ae=-1)}canUndo(){return this.ae>=0}canRedo(){return this.ae<this.stack.length-1}undo(){return this.e.ve(),this.canUndo()?(this.apply(this.stack[this.ae],!1),this.ae--,!0):!1}redo(){return this.e.ve(),this.canRedo()?(this.ae++,this.apply(this.stack[this.ae],!0),!0):!1}apply(e,t){let r=this.e,i=[];for(let o of e){let s=r.i.z(o.nodeId),a=r.n.L(o.columnId);if(!s||!a||s.data==null)continue;let l=t?o.newValue:o.oldValue,d=t?o.oldValue:o.newValue;r.Ti(s,a,l,d)&&(r.a.hi(s),r.a.Pa([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.Ye(i),r.ne.refresh(),r.Ge.refresh()}clear(){this.stack=[],this.ae=-1,this.pending=null}};var bt=class{constructor(e){this.e=e;this.changes=new Map;this.xo=!1;this.unsubscribe=null}init(){this.unsubscribe=this.e.le.on("cellValueChanged",e=>{this.xo||this.Eo(e)})}Eo(e){let t=`${e.rowNode.id}\0${e.column.id}`,i=this.changes.get(t)?.originalValue??e.oldValue;Object.is(e.newValue,i)?this.changes.delete(t):this.changes.set(t,{rowId:e.rowNode.id,colId:e.column.id,originalValue:i,value:e.newValue}),this.jt()}getDirtyRowIds(){return[...new Set([...this.changes.values()].map(e=>e.rowId))]}getChanges(){let e=new Map;for(let t of this.changes.values()){let r=this.e.i.z(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.changes.clear();else{let t=new Set(e);for(let[r,i]of this.changes)t.has(i.rowId)&&this.changes.delete(r)}this.jt()}cu(e){for(let t of e)for(let r of t.cells){let i=`${t.rowId}\0${r.colId}`,o=this.changes.get(i);if(o){Object.is(o.value,r.value)?this.changes.delete(i):o.originalValue=r.value;continue}let s=this.e.i.z(t.rowId),a=this.e.n.L(r.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,r.value)||this.changes.set(i,{rowId:t.rowId,colId:r.colId,originalValue:r.value,value:l})}this.jt()}rollback(e){let t=e?new Set(e):null,r=[...this.changes.entries()].filter(([,s])=>!t||t.has(s.rowId));if(r.length===0)return!1;let i=new Set,o=new Set;this.xo=!0;try{for(let[s,a]of r){let l=this.e.i.z(a.rowId),d=this.e.n.L(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.Ti(l,d,a.originalValue,c)&&(o.add(s),this.e.a.hi(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.xo=!1}for(let s of o)this.changes.delete(s);return i.size>0&&this.e.a.Ye([...i]),this.e.ne.refresh(),this.e.Ge.refresh(),this.jt(),o.size>0}Ld(e){if(e.length===0)return;let t=new Set(e);for(let[r,i]of this.changes)t.has(i.rowId)&&this.changes.delete(r);this.jt()}clear(){this.changes.size!==0&&(this.changes.clear(),this.jt())}destroy(){this.unsubscribe?.(),this.unsubscribe=null,this.changes.clear()}jt(){this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var fr=class{constructor(){this.Lr=null;this.Li=0;this.count=0;this.totalMs=0}acquire(){this.Li++,this.uu();let e=!1;return()=>{e||(e=!0,this.Li=Math.max(0,this.Li-1),this.Li===0&&this.disconnect())}}snapshot(){return{count:this.count,totalMs:this.totalMs}}uu(){if(!(this.Lr||typeof PerformanceObserver>"u"))try{this.Lr=new PerformanceObserver(e=>{for(let t of e.getEntries())this.count++,this.totalMs+=t.duration}),this.Lr.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.Lr;this.Lr=null;try{e?.disconnect()}catch{}}},wt=new fr;function pr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var Ct=class{constructor(){this.bt=[];this.ki=[];this.Pi=[];this.Ro=wt.acquire(),this.Gi=wt.snapshot()}start(){return pr()}hu(e,t,r){this.bt.push({duration:Math.max(0,pr()-e),rows:t,columns:r}),this.bt.length>120&&this.bt.shift()}pu(e){this.Ga(this.ki,e)}On(e){this.Ga(this.Pi,e)}snapshot(){let e=this.bt.map(o=>o.duration),t=this.bt[this.bt.length-1],r=[...e].sort((o,s)=>o-s),i=wt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.fu(e),maxRenderMs:r[r.length-1]??0,p95RenderMs:this.So(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.ki.length,p95LayoutMs:this.So(this.ki),modelSampleCount:this.Pi.length,p95ModelMs:this.So(this.Pi),longTaskCount:Math.max(0,i.count-this.Gi.count),longTaskTotalMs:Math.max(0,i.totalMs-this.Gi.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.bt=[],this.ki=[],this.Pi=[],this.Gi=wt.snapshot()}destroy(){this.Ro?.(),this.Ro=null}Ga(e,t){e.push(Math.max(0,pr()-t)),e.length>120&&e.shift()}fu(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}So(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 Ii(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Zo(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Ii(n.rowIds,e.rowIds),rowIndexes:n.rowIndexes==null||e.rowIndexes==null?void 0:[...new Set([...n.rowIndexes,...e.rowIndexes])],columns:Ii(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}function Qo(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:Zo(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 Tt=class{constructor(e){this.apply=e;this.depth=0;this.pending=null;this.flushCount=0;this.requestCount=0;this.coalescedRequestCount=0;this.destroyed=!1}batch(e){if(this.destroyed)return e();this.depth++;try{return e()}finally{this.depth--,this.depth===0&&this.flush()}}Na(e){this.destroyed||(this.requestCount++,this.pending&&this.coalescedRequestCount++,this.pending=Qo(this.pending??{},e),this.depth===0&&this.flush())}flush(){if(this.destroyed||this.depth>0||!this.pending)return;let e=this.pending;this.pending=null,this.flushCount++,this.apply(e)}snapshot(){return{batchDepth:this.depth,flushCount:this.flushCount,requestCount:this.requestCount,coalescedRequestCount:this.coalescedRequestCount,pending:this.pending!=null}}destroy(){this.destroyed=!0,this.pending=null,this.depth=0}};var Ai=Symbol.for("mach-table.adapter.lifecycle.v1");function Li(n,e){Object.defineProperty(n,Ai,{value:e})}function mr(n){let e=n[Ai]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var ki=Symbol.for("mach-table.import.v1");function Pi(n,e){Object.defineProperty(n,ki,{value:{begin:()=>e._.oo(),revision:()=>e.i.mr(),isEditing:()=>e.l.isEditing(),columns:()=>e.n.X(),visibleColumns:()=>e.n.c(),read:(r,i)=>e.d(r,i),editable:(r,i)=>e.l.W(r,i),parse:(r,i,o,s)=>oe(e,r,i,o,"import",s),pasteRows:r=>{let i=[];for(let o of e.i.je())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._.Ci(r,i),guard:r=>e._.wi(r),commitRows:(r,i,o)=>e._.ba(r,i,o)}})}function Gi(n){let e=n[ki];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}var Se=["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 es(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 ts(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):tt(i,o.coerceNumbers!==!1);if(l!=null&&typeof l.then=="function")throw new TypeError("Import parsers must return synchronous values");if(!ye(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function is(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 Ni(n,e,t={},r,i=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);ts(e,s);let a=es(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)&&is(n,c,d-s-1,a,t,l,r,o)}return l}function he(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function gr(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 Me={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 yr=Object.freeze(Object.keys(Me));var vr=new Set(Se.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function br(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 Fi(n){let e={};for(let[t,r]of Object.entries(n)){if(vr.has(t)){(r==null||typeof r=="function")&&(e[t]=r);continue}let i=Me[t];!i||!br(r,i)||(e[t]=r)}return e}var Bi=2e3,wr=1e5,Ie=512,os=1e4;function Oi(n){return Array.isArray(n)?[...new Set(n.slice(0,wr).filter(e=>typeof e=="string"&&e.length>0&&e.length<=Ie))]:[]}function ss(n){if(!Array.isArray(n))return[];let e=new Set,t=wr*Ie;for(let r of n.slice(0,wr)){if(typeof r!="string"||!r.length||e.has(r))continue;let i=r.startsWith(je)?65536:Ie;r.length>i||r.length>t||(e.add(r),t-=r.length)}return[...e]}function Hi(n,e){return typeof n=="number"&&Number.isFinite(n)&&n>=1?Math.floor(n):e}function Vi(n){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:void 0}function as(n,e){let t=Vi(e.flex);for(let r of["width","contentWidth"]){let i=Vi(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 ls(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function ds(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>Ie||e.has(r))return null;e.add(r);let i={colId:r};return ls(i,t),as(i,t),i}function cs(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,Bi)){let i=ds(r,t);i&&e.push(i)}return e}function us(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,Bi)){if(r==null||typeof r!="object")continue;let i=r,o=typeof i.colId=="string"?i.colId.trim():"";!o||o.length>Ie||t.has(o)||i.direction!=="asc"&&i.direction!=="desc"||(t.add(o),e.push({colId:o,direction:i.direction}))}return e}function U(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:cs(e.columns),sortModel:us(e.sortModel),filterModel:Q(e.filterModel),advancedFilterModel:z(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,os):null,pagination:{enabled:t.enabled===!0,page:Hi(t.page,1),pageSize:Hi(t.pageSize,20)},selectedRowIds:Oi(e.selectedRowIds),expandedRowIds:Oi(e.expandedRowIds),expandedGroupIds:ss(e.expandedGroupIds)}}function zi(n,e){let t=U(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 hs(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function Ki(n,e){let t=e?new Set(e.map(String)):null;return n.filter(r=>!t||t.has(r.rowId)).map(r=>({...r,data:hs(r.data),cells:r.cells.map(i=>({...i}))}))}function ps(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 _i(n,e){let t=new Map;for(let r of n??[]){let i=ps(r,e);i&&!t.has(i.rowId)&&t.set(i.rowId,i)}return[...t.values()]}function Wi(n,e){let t=new Set(n.map(d=>d.rowId)),r=_i(e?.conflicts,t),i=new Set(r.map(d=>d.rowId)),o=_i(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 fs(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):K(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 ms(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let r=fs(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 $i(n){return{setData:e=>n.qe(e),transact:e=>n.yr(e),transactAsync:(e,t)=>n.mu(e,t),flushTransactions:()=>n.Fa(),getCount:()=>n.I(),getAt:e=>n.gu(e),getById:e=>n.z(e),forEach:e=>n.Un(e),forEachDisplayed:e=>n.qn(e),reorder:(e,t)=>n.yu(e,t),isRemote:()=>n.p(),reload:e=>n.reload(e),ensureLoaded:(e,t,r)=>n.An(e,t,r),purgeCache:()=>n.Ln(),getCacheSnapshot:()=>n.kn()}}function Ui(n){return{getDefinitions:()=>n.Xr(),setDefinitions:e=>n.ar(e),getState:()=>n.Jr(),setState:e=>n.vu(e),resetState:()=>n.Tn(),setVisible:(e,t)=>n.wn(e,t),setPinned:(e,t)=>n.Cn(e,t),move:(e,t)=>n.ut(e,t),setWidth:(e,t)=>n.Ie(e,t),fit:e=>n.bu(e),autoSize:(e,t)=>n.wu(e,t),autoSizeAll:e=>n.Cu(e),getWorkbenchItems:()=>n.Tu(),openWorkbench:e=>n.Du(e),closeWorkbench:()=>n.Eu()}}function qi(n){return{getRows:()=>n.gi(),getVisibleRows:()=>n.xu(),getNodes:()=>n.Pe(),getIds:()=>n.yi(),setRows:(e,t)=>n.Ru(e,t),setById:(e,t,r)=>n.jn(e,t,r),selectAll:e=>n.selectAll(e),clear:()=>n.deselectAll(),getMode:()=>n.Su(),setMode:e=>n.Mu(e),getRange:()=>n.Ne(),clearRange:()=>n.$t()}}function ji(n){return{startCell:e=>n.Iu(e),startRow:e=>n.Au(e),isRowActive:e=>n.Ei(e),stop:e=>n.Lu(e?.cancel===!0),getChanges:()=>n.getChanges(),getDirtyRowIds:()=>n.getDirtyRowIds(),markSaved:e=>n.ku(e),rollback:e=>n.Pu(e),save:(e,t)=>n.Gu(e,t),undo:()=>n.undo(),redo:()=>n.redo(),canUndo:()=>n.canUndo(),canRedo:()=>n.canRedo()}}function Yi(n){return{get:()=>n.getState(),apply:(e,t)=>n.Oa(e,t)}}function Xi(n){return{get:()=>n.Mo(),getPerformance:()=>n.Nu(),resetPerformance:()=>n.Fu()}}function Ji(n){return{getModel:()=>n.j(),setModel:e=>n.vr(e),getAdvancedModel:()=>n.be(),setAdvancedModel:e=>n.Ot(e),getQuickText:()=>n.br(),setQuickText:e=>n.Ht(e),isPresent:e=>e==null?Object.keys(n.j()).length>0||n.be()!=null||n.br()!=null:n.Ou(e)}}function Zi(n){return{getModel:()=>n.U(),setModel:e=>n.Hu(e)}}function Qi(n){return{isEnabled:()=>n.paginationEnabled(),setEnabled:e=>n.fi(e),getPage:()=>n.getPage(),setPage:e=>n.setPage(e),getPageSize:()=>n.getPageSize(),setPageSize:e=>n.setPageSize(e),getPageCount:()=>n.getPageCount(),getTotalRowCount:()=>n.getTotalRowCount()}}function en(n){return{isRowExpanded:e=>n.isRowExpanded(e),setRowExpanded:(e,t)=>n.isRowExpanded(e)===t?!1:(t?n.Hn(e):n.Bn(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.Vu(e),n.isGroupExpanded(e)===t),setAllGroupsExpanded:e=>e?n.Wn():n.$n(),setAllDetailsExpanded:e=>e?n.zn():n._n()}}function tn(n){return{getRoot:()=>n.Bu(),scrollToRow:(e,t)=>n.Bt(e,t),refreshCells:e=>n.refreshCells(e),refreshLayout:()=>n.refreshLayout(),flush:()=>n.zu(),setOverlay:e=>n.setOverlay(e),getPinnedRows:e=>n.getPinnedRows(e),setPinnedRows:(e,t)=>n.setPinnedRows(e,t)}}function rn(n){return{exportCsv:e=>n._u(e),importCsv:(e,t)=>n.importCsv(e,t),exportMatrix:e=>n.Ha(e),importMatrix:(e,t)=>n.importMatrix(e,t),print:e=>n.print(e),copyRange:()=>n.Ku()}}function Dt(n){return te(n?.reason,"The operation was aborted")}function nn(n,e){return We(n,e,()=>Dt(e))}function gs(){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 Ae(n,e,t,r=!1){let i=F(n,t,r);return i===void 0||i===e?void 0:i}var Cr=class{constructor(e){this.e=e;this.Yt=null;this.kr=[];this.it=null}batch(e){return this.e.Va(()=>e(this.e.api))}zu(){this.e.Xt.flush()}Bu(){return this.e.s()?null:this.e.o.root}qe(e){this.e.s()||(this.e.r.rowData=e??[],!this.e.i.p&&(this.e.i.qe(e),this.e.u({data:!0})))}yr(e){if(this.e.s()||this.e.i.p)return;let t=this.e.i.yr(e);this.Ba(t)}mu(e,t={}){if(this.e.s()||this.e.i.p)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(Dt(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(Dt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.kr.push(s)});return this.it==null&&(this.it=setTimeout(()=>this.Fa(),this.e.r.asyncTransactionWaitMillis)),r}Fa(){this.it!=null&&clearTimeout(this.it),this.it=null;let e=this.kr;this.kr=[];let t=e.filter(r=>!r.aborted).map(r=>r.transaction);if(t.length>0&&!this.e.s()&&!this.e.i.p){let r=this.e.i.kd(t);this.Ba(r)}for(let r of e)r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort),r.aborted||r.resolve()}Ba(e){if(e.pipelineChanged){this.e.u({data:!0});return}e.updatedRowIds.length!==0&&this.e.u({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}Xr(){return this.e.n.Xr()}ar(e){this.e.s()||(this.e.r.columnDefs=e??[],this.e.n.ar(e),this.e.Io(),this.e.Fe(),this.e.i.p?this.e.i.Ae():(this.e.i.b(),this.e.u({data:!0})))}Jr(){return this.e.n.Jr()}vu(e){this.e.s()||(this.e.n.Ls(e),this.e.Fe())}Tn(){this.e.s()||(this.e.n.Tn(),this.e.Fe())}wn(e,t){this.e.s()||(this.e.n.wn(e,t),this.e.Fe(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}ut(e,t){this.e.s()||this.e.ut(e,t)}Cn(e,t){this.e.s()||(this.e.n.Cn(e,t),this.e.Fe())}Ie(e,t){if(this.e.s())return!1;let r=this.e.n.L(e);return!r||!this.e.n.Ie(r,t)?!1:(this.e.Ze(),this.e.zt([r]),!0)}bu(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.Ao();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=_e(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.As(d,s[c]):this.e.n.Ie(d,s[c]));this.e.Ze(),this.e.zt(l)}wu(e,t=!1){if(this.e.s())return;let r=this.e.n.L(e);r&&this.za(r,t)&&(this.e.Ze(),this.e.zt([r]))}za(e,t){var c;if(this.e.r.columnLayout==="fit"&&e.colDef.suppressSizeToFit)return!1;if(e.hasCheckbox||e.isDetailToggle)return this.e.n.Ie(e,e.isDetailToggle?38:46);this[c="Yt"]??(this[c]=document.createElement("canvas"));let r=this.Yt.getContext("2d");if(!r)return!1;let i=window.getComputedStyle(this.e.o.root);r.font=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;let o=0,s=u=>{if(!u)return;let h=r.measureText(u).width;h>o&&(o=h)};t||s(e.colDef.headerName??e.colDef.field??e.id);let a=this.e.i.pe(),l=Math.min(a.length,2e3);for(let u=0;u<l;u++)s(X(this.e,a[u],e));let d=(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu?22:0)+28;return this.Wu(e,Math.ceil(o)+d)}Wu(e,t){return this.e.r.columnLayout==="fit"?this.e.n.As(e,t):this.e.n.Ie(e,t)}Cu(e){if(this.e.s())return;let t=[];for(let r of this.e.n.c())this.za(r,e??!1)&&t.push(r);t.length>0&&(this.e.Ze(),this.e.zt(t))}U(){return this.e.n.U()}Hu(e){this.e.s()||(this.e.n.dr(e),this.e.dr())}j(){return this.e.i.j()}vr(e){if(!this.e.s()){if(this.e.i.vr(e),this.e.B.Ni(),this.Fi(),this.e.i.p){this.e.i.Ae();return}this.e.i.b(),this.e.u({data:!0})}}be(){return this.e.i.be()}Ot(e){if(!(this.e.s()||!this.e.i.Ot(e))){if(this.Fi(),this.e.i.p){this.e.i.Ae();return}this.e.i.b(),this.e.u({data:!0})}}Fi(){this.e.emit("filterChanged",{filterModel:this.e.i.j(),advancedFilterModel:this.e.i.be()})}Ou(e){return Object.prototype.hasOwnProperty.call(this.e.i.j(),e)}Ht(e){this.e.s()||(this.e.r.quickFilterText=e!=null&&e.trim()!==""?e:null,this.e.i.Ht(e)&&this.e.$u())}br(){return this.e.i.br()}Su(){return this.e.r.rowSelection}Mu(e){this.e.s()||this.e.r.rowSelection!==e&&(this.e.r.rowSelection=e,e==="none"&&this.deselectAll(),this.e.B.Pr(),this.e.a.Lo())}Pe(){return this.e.m.Pe()}gi(){return this.e.m.gi()}jn(e,t=!0,r=!0){this.e.m.jn(e,t,r)}selectAll(e=!0){this.e.m.selectAll(e)}deselectAll(){this.e.m.deselectAll()}I(){return this.e.i.I()}gu(e){return this.e.i.f(e)}z(e){return this.e.i.z(e)}Un(e){this.e.i.Un(e)}qn(e){this.e.i.qn(e)}Bt(e,t="top"){this.e.a.Bt(e,t)}Hn(e){return this.e.s()?!1:this.e.i.Hn(e)}Bn(e){return this.e.s()?!1:this.e.i.Bn(e)}isRowExpanded(e){return this.e.i.isRowExpanded(e)}zn(){this.e.s()||this.e.i.zn()}_n(){this.e.s()||this.e.i._n()}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)}Vu(e){return this.e.s()?!1:this.e.i.Kn(e)}yu(e,t){return this.e.s()||this.e.l.isEditing()?!1:this.e.i.ra(e,t)}isGroupExpanded(e){return this.e.i.isGroupExpanded(e)}Wn(){this.e.s()||this.e.i.Wn()}$n(){this.e.s()||this.e.i.$n()}Ru(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.z(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.Ft()}`)):this.e.i.pe().find(a=>a.data===o);s&&i.push({node:s,selected:!0})}i.length>0?this.e.m.oc(i,t):t&&this.deselectAll()}xu(){let e=new Set(this.e.m.Pe().map(t=>t.id));return this.e.i.je().filter(t=>!t.isDetail&&!t.isGroup&&e.has(t.id)).map(t=>t.data).filter(Boolean)}yi(){return this.e.m.yi()}undo(){return this.e.s()?!1:this.e.O.undo()}redo(){return this.e.s()?!1:this.e.O.redo()}canUndo(){return this.e.O.canUndo()}canRedo(){return this.e.O.canRedo()}getDirtyRowIds(){return this.e.V.getDirtyRowIds()}getChanges(){return this.e.V.getChanges()}ku(e){this.e.V.markSaved(e)}async Gu(e,t){let r=Ki(this.e.V.getChanges(),t);if(r.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let i=this.e.i.mr(),o=Wi(r,await e(r));return!this.e.s()&&i===this.e.i.mr()&&this.e.V.cu(o.saved),o}Pu(e){return this.e.V.rollback(e)}setPinnedRows(e,t){if(this.e.s())return;let r=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.r[r]=t??[],this.e.de.setRows(e,this.e.r[r])}getPinnedRows(e){return this.e.de.getRows(e)}Ne(){return this.e.a.Ne()}$t(){this.e.s()||this.e.a.$t()}Ku(){return this.e.s()?Promise.resolve(!1):this.e.Aa()}Du(e){this.e.s()||this.e.columnMenu.Yc(e)}Eu(){this.e.columnMenu.close()}Tu(){return this.e.n.X().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.he(),this.e.a.Oi(!0))}p(){return this.e.i.p}reload(e={}){return this.e.s()?Promise.resolve():e.signal?.aborted?Promise.reject(Dt(e.signal)):this.e.i.p?nn(this.e.i.li(e.signal),e.signal):(this.e.i.qe(this.e.r.rowData),this.e.u({data:!0}),Promise.resolve())}An(e,t,r={}){return this.e.s()?Promise.resolve():nn(this.e.i.An(e,t,r.signal),r.signal)}Ln(){this.e.s()||this.e.i.Ln()}kn(){return this.e.i.kn()}paginationEnabled(){return this.e.i.we}fi(e){this.e.s()||this.e.i.fi(e)}getPage(){return this.e.i.Cr()}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(nr(e,t.separator??","),{...i,parseValue:r?o=>r({...o,value:o.value}):void 0})}importMatrix(e,t={}){if(this.e.s()||this.e.i.p||!Array.isArray(e)||!e.length)return!1;try{let r=Gi(this.e.api),i=t.mode==="paste"?r.pasteRows(e.length):void 0,o=Ni(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.Jt(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.yr({add:s}):this.qe(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.Zs().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${r.map(d=>`<th>${he(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=i.map(d=>`<tr>${r.map(c=>{let u=X(this.e,d,c);return`<td>${he(u)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${he(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>${he(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}}Iu(e){let t=this.e.n.L(e.colId);return t?this.e.l.start(e.rowIndex,t,e.keyPress??null):!1}Au(e){return this.e.l.startRow(e)}Ei(e){return this.e.l.Ei(e)}Lu(e){return this.e.l.se(e??!1)}refreshCells(e){let t=e==null||e.rowIds==null&&e.rowIndexes==null&&e.columns==null;this.e.u({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.r[e]}updateOptions(e){this.e.s()||(this.e.ko(e),e=Fi(e),Object.keys(e).length!==0&&this.e.Va(()=>{let t=gs(),r=this.e.r.columnMenu;this.Uu(e,t),this.qu(e,t),this.ju(e,t),this.Yu(e,t),this.Xu(e),this.Ju(e,t),this.Zu(e,t),this.Qu(e,t),this.eh(e,t),this.th(e,t),this.rh(e,t,r)}))}Uu(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.ih(e)}ih(e){for(let t of Se){let r=`on${t.charAt(0).toUpperCase()}${t.slice(1)}`;S(e,r)&&Object.assign(this.e.r,{[r]:e[r]})}}qu(e,t){let r=this.e.r,i=Ae(e.rowHeight,r.rowHeight,1),o=Ae(e.headerHeight,r.headerHeight,1),s=Ae(e.rowBuffer,r.rowBuffer,0,!0),a=Ae(e.detailRowHeight,r.detailRowHeight,1);i!==void 0&&(r.rowHeight=i,t.needsRelayout=!0),o!==void 0&&(r.headerHeight=o,t.needsRelayout=!0,t.needsHeaderRebuild=!0),s!==void 0&&(r.rowBuffer=s,t.needsRelayout=!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.nh(r.domLayout),t.needsPoolRebuild=!0),A(e,r,["multiSort"]),a!==void 0&&(r.detailRowHeight=a,this.e.a.Hi(),this.e.a.Gr(!0))}ju(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"])}Yu(e,t){let r=this.e.r;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==r.enableColumnResize&&(this.e.Nr.gt(),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.Zt.ce(),this.e.Ge.ce()),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=Ae(e.undoStackSize,r.undoStackSize,0,!0);i!==void 0&&(r.undoStackSize=i,this.e.O.du());let o=F(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(r.asyncTransactionWaitMillis=o),this.oh(e,t),this.sh(e)}oh(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.Vi(),t.needsRelayout=!0}sh(e){let t=this.e.r;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.$t()),A(e,t,["tooltipComponent"],!0);let r=F(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._a(e.theme),this.e.Bi.refresh())}Xu(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.fi(i),typeof r=="object"&&r&&this.ah(r),t.paginationEnabled&&this.e.i.Bd(),this.e.Zt.ce()}ah(e){let t=this.e.r;t.paginationMode=e.mode==="server"?"server":"client";let r=F(e.page,1,!0),i=F(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)}Ju(e,t){S(e,"rowStyleRules")&&(this.e.r.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.needsCellRefresh=!0,this.e.u({pinned:!0})),this.lh(e,t),this.dh(e,t);let r=this.e.r;e.stripedRows!=null&&e.stripedRows!==r.stripedRows&&(r.stripedRows=e.stripedRows,this.e.o.ch(e.stripedRows)),e.showCellBorders!=null&&e.showCellBorders!==r.showCellBorders&&(r.showCellBorders=e.showCellBorders,this.e.o.uh(e.showCellBorders))}lh(e,t){let r=this.e.r;e.watermark!==void 0&&(Object.assign(r,qt(e)),this.e.Bi.refresh()),this.hh(e),S(e,"summaryMethod")&&(r.summaryMethod=e.summaryMethod,t.needsSummaryRefresh=!0)}hh(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.Ge.ce())}dh(e,t){let{size:r}=e;if(r==null||!S(ve,r)||r===this.e.r.size)return;let i=ve[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.ph(r),t.needsRelayout=!0,t.needsHeaderRebuild=!0}Zu(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.fh(e),this.mh(e)}fh(e){let t=this.e.r,r=!1;for(let i of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])S(e,i)&&(t[i]=e[i]??be[i],r=!0);r&&this.e.o.Ka(t)}mh(e){let t=this.e.r;for(let r of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])S(e,r)&&(t[r]=e[r]??be[r]);A(e,t,["allowUnsafeOverlayHtml"]),S(e,"className")&&(t.className=e.className??"",this.e.o.Wa(t.className)),A(e,t,["loading"]),S(e,"error")&&(t.error=e.error??null)}Qu(e,t){this.gh(e,t),this.yh(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.Ot(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"])}gh(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.zi()),e.quickFilterText!==void 0&&this.Ht(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==r.defaultColDef&&(r.defaultColDef={...$t,...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})=>Ut(i,o):void 0,t.needsRowRebuild=!0}}yh(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.zi()),e.childrenKey!=null&&e.childrenKey!==r.childrenKey&&(r.childrenKey=e.childrenKey,t.needsRowRebuild=!0),A(e,r,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.needsCellRefresh=!0)}eh(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.vh(e,t),this.bh(e,t)}vh(e,t){let r=this.e.r;S(e,"dataProcessor")&&this.e.$a(e.dataProcessor)&&(t.needsRowRebuild=!0);let i=F(e.dataProcessorMinRows,1,!0);i!==void 0&&i!==r.dataProcessorMinRows&&(r.dataProcessorMinRows=i,t.needsRowRebuild=!0)}bh(e,t){let r=this.e.r;S(e,"persistence")&&(r.persistence=Be(e.persistence),t.needsStateLoad=!0)}th(e,t){this.wh(e,t),this.Ch(e,t),this.Th(e,t),this.Dh(e)}wh(e,t){let r=this.e.r;for(let o of["blockSize","maxBlocksInCache","datasourceMaxConcurrentRequests"]){let s=F(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=F(e[o],0,!0);s!==void 0&&(r[o]=s)}let i=F(e.datasourceRetryJitter,0);i!==void 0&&(r.datasourceRetryJitter=Math.min(1,i))}Ch(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:F(e.datasourceRowCount,0,!0)??null;i!==r.datasourceRowCount&&(r.datasourceRowCount=i,t.datasourceChanged=!0)}}Th(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.Zt.ce()),A(e,r,["detailRowRenderer","isRowExpandable"],!0)&&(t.needsCellRefresh=!0)}Dh(e){let t=this.e.r;e.pinnedTopRowData!==void 0&&(t.pinnedTopRowData=e.pinnedTopRowData??[],this.e.de.setRows("top",t.pinnedTopRowData)),e.pinnedBottomRowData!==void 0&&(t.pinnedBottomRowData=e.pinnedBottomRowData??[],this.e.de.setRows("bottom",t.pinnedBottomRowData))}rh(e,t,r){let i=this.e.r;t.needsColumnRebuild&&(this.e.n.ar(i.columnDefs),this.e.Fe(),t.needsHeaderRebuild=!1,t.needsPoolRebuild=!1),t.needsStateLoad&&(this.e.Io(),this.e.Fe()),t.needsFeatureReload&&this.e.Ua(i.features),this.Eh(t),t.filterChanged&&(this.Fi(),!t.datasourceChanged&&!t.needsRowRebuild&&(this.e.i.p?this.e.i.Ae():(this.e.i.b(),this.e.u({data:!0})))),t.needsRelayout&&this.e.o.xh(i.rowHeight,i.headerHeight),e.columnMenu!=null&&e.columnMenu!==r&&(t.needsHeaderRebuild=!0),t.stateToApply&&this.Oa(t.stateToApply),this.e.u({layout:t.needsRelayout,header:t.needsHeaderRebuild,pool:t.needsPoolRebuild,cells:t.needsCellRefresh&&!t.needsPoolRebuild?!0:void 0,summary:t.needsSummaryRefresh,overlays:!0})}Eh(e){if(e.datasourceChanged){this.e.i.xd();return}if(e.needsRowRebuild){if(this.e.i.p){this.e.i.Ae();return}this.e.i.qe(this.e.r.rowData),this.e.u({data:!0})}}_u(e={}){let t=this.Ha({...e,target:"csv",protectFormulas:!1});return vi(t,e)}Ha(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.m.Pe().slice().sort((o,s)=>o.rowIndex-s.rowIndex):e.onlyAllDisplayed?this.e.i.je():this.e.i.Zs();return[...r,...i.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=xe(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:ce(a)}))]}getState(){return{version:2,columns:this.Jr(),sortModel:this.U(),filterModel:this.j(),advancedFilterModel:this.be(),quickFilterText:this.br(),pagination:{enabled:this.paginationEnabled(),page:this.getPage(),pageSize:this.getPageSize()},selectedRowIds:this.yi(),expandedRowIds:this.e.i.Ud(),expandedGroupIds:this.e.i.qd()}}Oa(e,t={}){if(this.e.s())return;let r=U(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.Rh(r,o),this.Sh(r,o),t.emitEvents!==!1&&this.Mh(o)}Rh(e,t){t.has("columns")&&this.e.n.Ls(e.columns??[]),t.has("sort")&&this.e.n.dr(e.sortModel??[]),t.has("filter")&&(this.e.i.vr(e.filterModel??{}),this.e.i.Ot(e.advancedFilterModel),this.e.i.Ht(e.quickFilterText)),t.has("expansion")&&this.e.i.jd(e.expandedRowIds??[],e.expandedGroupIds??[]),t.has("pagination")&&e.pagination&&(this.e.r.paginationEnabled=e.pagination.enabled&&!this.e.i.p,this.e.i.Qs(e.pagination.page,e.pagination.pageSize),this.e.Zt.ce())}Sh(e,t){t.has("columns")&&this.e.Fe(),this.e.i.p?this.e.i.Ae():(this.e.i.b(),this.e.u({data:!0})),this.e.B.Po(),this.e.B.Ni(),t.has("selection")&&this.e.m.Zd(e.selectedRowIds??[])}Mh(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.U()}),e.has("filter")&&this.Fi(),e.has("pagination")&&this.e.emit("paginationChanged",{page:this.getPage(),pageSize:this.getPageSize(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Mo(){return this.e.Mo()}Nu(){return this.e.re.snapshot()}Fu(){this.e.re.reset()}setOverlay(e){if(e!=="loading"&&e!=="noRows"&&e!=="error"){this.e.o.qa();return}let t=this.e.r,r=e==="loading"?t.overlayLoadingTemplate||this.e.ja():e==="noRows"?t.overlayNoRowsTemplate||this.e.Ya():t.overlayErrorTemplate||this.e.Xa();this.e.o._i(e,r,t.allowUnsafeOverlayHtml)}on(e,t){return this.e.le.on(e,t)}destroy(){this.it!=null&&clearTimeout(this.it),this.it=null;let e=this.kr;this.kr=[];for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},ys={rows:$i,columns:Ui,selection:qi,editing:ji,filtering:Ji,sorting:Zi,pagination:Qi,hierarchy:en,view:tn,state:Yi,io:rn,diagnostics:Xi};function on(n){let e=new Cr(n),t={};for(let[r,i]of Object.entries(ys)){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()}),Pi(t,n),Li(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.l.isEditing()&&n.V.getDirtyRowIds().length===0,readCell:(r,i)=>{let o=n.i.z(r),s=n.n.L(i);return o&&s?tr(xe(n,o,s,"clipboard")):""},writeInput:r=>n.Jt(r.flatMap(({rowId:i,colId:o,value:s})=>{let a=n.i.z(i),l=n.n.L(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var vs=["compact","normal","large"],Et=class{constructor(e){this.e=e;this.Or={left:[],center:[],right:[]};this.Kt={};this.Hr=null;this.Fo=null;this.Oo=!1;this.Ui=null;this.Ho=[];this.qi=null;this.Qt=0;this.Ja=-1;this.Za=-1;this.At=1;this.er=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.Wa(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.Ka(t),this.Fr=f("div","mach-header"),this.Fr.setAttribute("role","rowgroup"),this.Or={left:[],center:[],right:[]},this.Go={},this.Kt={};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.Fr.appendChild(o),this.Go[i]=o,this.Kt[i]=s}this.Qa(1),this.me=f("div","mach-body"),this.Ki=f("div","mach-pinned-rows mach-pinned-rows--top"),this.Ki.style.display="none",this.Wi=f("div","mach-pinned-rows mach-pinned-rows--bottom"),this.Wi.style.display="none",this.S={},this.ge={},this.No={};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.me.appendChild(o),this.No[i]=o,this.S[i]=s,this.ge[i]=a}this.Oe=f("div","mach-overlay"),this.Oe.style.display="none",this.Oe.setAttribute("role","status"),this.Oe.setAttribute("aria-live","polite"),this.He=f("div","mach-overlay-content"),this.Oe.appendChild(this.He),this.nt=f("div","mach-infinite-loading"),this.nt.style.display="none",this.nt.appendChild(f("div","mach-spinner")),this.$i=f("span"),this.nt.appendChild(this.$i),this.root.append(this.Fr,this.Ki,this.me,this.Wi,this.Oe,this.nt),e.appendChild(this.root),typeof ResizeObserver<"u"&&(this.qi=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.Ja&&a===this.Za||(this.Ja=s,this.Za=a,!this.Qt&&(this.Qt=requestAnimationFrame(()=>{this.Qt=0,this.e.he()})))}),this.qi.observe(this.root)),this._a(t.theme)}Ka(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")}Qa(e){this.At=e;for(let t of["left","center","right"]){let r=this.Kt[t],i=this.Or[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.tl()}Vo(){return this.At}tl(){this.Fr.style.height=`${this.At*this.e.r.headerHeight}px`;for(let e of["left","center","right"])this.Or[e].forEach((r,i)=>{r.style.top=`${i*this.e.r.headerHeight}px`,r.style.height=`${this.e.r.headerHeight}px`})}Ih(e,t){this.rl("left",e),this.rl("right",t)}rl(e,t){let r=this.Go[e],i=this.No[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)}Ao(){let e=this.S.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.me.clientWidth-t)}xh(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.tl()}ph(e){for(let t of vs)this.root.classList.toggle(`mach-size--${t}`,t===e)}_a(e){if(!this.root)return;this.er?.(),this.er=null;let t=e==="dark"||e==="auto"&&this.Ah();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.er=()=>r.removeEventListener("change",i)):typeof r.addListener=="function"&&(r.addListener(i),this.er=()=>r.removeListener(i))}}Ah(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}ch(e){this.root.classList.toggle("mach-striped",e)}uh(e){this.root.classList.toggle("mach-cell-borders",e)}nh(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}Wa(e){for(let t of this.Ho)this.root.classList.remove(t);this.Ho=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.Ho.push(t))}Lh(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}kh(e,t,r){if(typeof t=="object"&&t!=null&&"el"in t){this.He.appendChild(t.el),this.Ui=t.destroy??null;return}if(t instanceof HTMLElement){this.He.appendChild(t);return}if(t){r?this.He.innerHTML=t:this.He.textContent=t;return}if(e!=="loading")return;let i=f("div","mach-spinner");i.setAttribute("aria-label","loading"),this.He.appendChild(i)}_i(e,t,r=!1){this.Hr===e&&this.Fo===t&&this.Oo===r||(this.Hr=e,this.Fo=t,this.Oo=r,this.Bo(),this.He.replaceChildren(),this.kh(e,this.Lh(t),r),this.Oe.style.display="",this.Ph(e),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}qa(){this.Hr&&(this.Hr=null,this.Fo=null,this.Oo=!1,this.Oe.style.display="none",this.Bo(),this.He.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Ph(e){this.Oe.setAttribute("role",e==="error"?"alert":"status")}ft(e,t){this.nt&&(e?(this.$i.textContent!==t&&(this.$i.textContent=t),this.nt.style.display="",this.root.setAttribute("aria-busy","true")):(this.nt.style.display="none",this.Hr!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){this.er?.(),this.er=null,this.qi?.disconnect(),this.qi=null,this.Qt&&cancelAnimationFrame(this.Qt),this.Qt=0,this.Bo(),this.root?.remove()}Bo(){if(!this.Ui)return;let e=this.Ui;this.Ui=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};var bs={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 Tr(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=bs[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 sn(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 pe=class{constructor(){this.offsets=new Float64Array(1)}update(e){let t=0,r=this.offsets.length!==e.length+1;for(let o=0;o<e.length;o++)t+=e[o].currentWidth,!r&&this.offsets[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.offsets=i,!0}il(){return this.offsets[this.offsets.length-1]??0}ot(e){let t=Math.max(0,Math.min(Math.trunc(e),this.offsets.length-1));return this.offsets[t]??0}Gh(e){let t=Math.max(0,this.offsets.length-1);return t===0?-1:Math.min(t-1,Math.max(0,sn(this.offsets,Math.max(0,e))-1))}nl(e,t,r=2){let i=Math.max(0,this.offsets.length-1);if(i===0||t<=0||this.il()<=t)return{first:0,lastExcl:i};let o=Math.max(0,e),s=o+t,a=Math.max(0,sn(this.offsets,o)-1),l=Math.min(i,ws(this.offsets,s));return{first:Math.max(0,a-r),lastExcl:Math.min(i,l+r)}}};var Cs=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function Dr(n){return n instanceof HTMLElement&&n.closest(Cs)!=null}function Er(n){return n==="ArrowLeft"||n==="ArrowRight"}var xt=class{constructor(e){this.e=e;this.ee=[];this.ji=[];this.ol={left:[],center:[],right:[]};this.G=new pe;this.Yi=0;this.Xi=Number.MAX_SAFE_INTEGER}Pr(){this.sl(),this.e.Nr.gt();for(let l of this.ee){let d=dr(l.el);if(d)try{d()}catch(c){this.e.reportError(c,"headerComponent.destroy",{colId:l.column.id})}}this.ee=[],this.ji=[];let e=this.e.n.ud();this.e.o.Qa(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 ee){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.cd(),o=this.e.n.C("center"),s=new Set(o.slice(this.Yi,this.Xi));for(let l of["left","center","right"]){let d=r(i,0,l);this.ol[l]=l==="center"?this.al(d,s):d}let a=this.e.r.headerHeight;for(let l of["left","center","right"]){let d=this.e.o.Or[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.Nh(u.column,e-u.level,a);h.appendChild(p.el),this.ee.push(p)}else if(u.group){let p=this.Fh(u.group);h.appendChild(p),this.ji.push({group:u.group,el:p})}for(let p of u.children)c(p)};for(let u of this.ol[l])c(u)}this.e.r.suppressHeaderFocus||this.ee.forEach((l,d)=>{l.el.tabIndex=d===0?0:-1}),this.Ve(),this.Po(),this.Ni(),this.ui()}ll(){let e=this.Yi,t=this.Xi;this.sl(),(e!==this.Yi||t!==this.Xi)&&this.Pr()}sl(){let e=this.e.n.C("center"),t=this.e.o.S.center;this.G.update(e);let r=e.length>20?this.G.nl(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.Yi=r.first,this.Xi=r.lastExcl}al(e,t){let r=[];for(let i of e){if(i.column){t.has(i.column)&&r.push(i);continue}let o=this.al(i.children,t);o.length>0&&r.push({...i,children:o})}return r}Nh(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.Oh(i,e),this.Hh(i,e);let o=this.Vh(i,e);this.Bh(i,e);let s=f("span","mach-sort-indicator");i.appendChild(s);let{filterBtn:a,filterTagEl:l}=this.zh(i,e);return this._h(i,e),this.Kh(i,e),this.Wh(i,e),{column:e,el:i,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}Oh(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")}Hh(e,t){this.e.r.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.zo(t)),e.addEventListener("keydown",r=>this.$h(r,t)))}Vh(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.m.selectAll(!0):this.e.m.deselectAll()}),e.appendChild(r),r}Bh(e,t){let r=t.colDef,i=r.headerComponent,o;if(!i){this._o(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.Uh(e,t,o)}Uh(e,t,r){if(typeof r=="string"){this._o(e,r);return}if(r instanceof HTMLElement){this.dl(e,r);return}if(r&&typeof r=="object"&&r.el instanceof HTMLElement){this.dl(e,r.el),Ri(e,r.destroy);return}let i=t.colDef;this._o(e,i.headerName??i.field??t.id)}_o(e,t){let r=f("span","mach-header-label");r.textContent=t,e.appendChild(r)}dl(e,t){let r=f("span","mach-header-label mach-header-label--custom");r.appendChild(t),e.appendChild(r)}zh(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=Kr,r.addEventListener("click",o=>{o.stopPropagation(),this.e.Ko.toggle(t,r)}),e.appendChild(r);let i=f("span","mach-filter-tag");return e.appendChild(i),{filterBtn:r,filterTagEl:i}}_h(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.g("columnSettings")}`;r.setAttribute("aria-label",o),r.title=o,r.innerHTML=Ur,r.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,r)}),e.appendChild(r)}Kh(e,t){if(!this.cl(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.Nr.cc(i,t))}),r.addEventListener("dblclick",i=>{i.stopPropagation(),this.e.api.columns.autoSize(t.id)}),r.addEventListener("click",i=>i.stopPropagation()),e.appendChild(r)}Wh(e,t){e.addEventListener("click",r=>{this.e.Ji.mc()||Dr(r.target)||t.sortable&&this.e.Zr(t,r.shiftKey)}),e.addEventListener("pointerdown",r=>{r.button!==0||Dr(r.target)||this.e.Ji.fc(r,t)})}Fh(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}Ve(){let e={left:0,center:0,right:0};for(let t of["left","center","right"]){let r=this.e.o.Or[t],i=0,o=new Map;for(let a of this.e.n.C(t))o.set(a.id,i),i+=a.currentWidth;let s=this.e.r.headerHeight;for(let a of this.ee){if(this.e.n.lr(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.Me(a.column.id)+1))}for(let a of this.ji){let l=this.qh(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.Ih(e.left,e.right)}qh(e,t){return e.getLeafColumns().filter(r=>!r.hide&&this.e.n.lr(r)===t)}$h(e,t){this.e.s()||this.jh(e,t)||this.Yh(e,t)||this.Xh(e,t)||this.Jh(e,t)||this.Zh(e)}jh(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(Dr(e.target)||(e.preventDefault(),t.sortable&&this.e.Zr(t,e.shiftKey)),!0)}Yh(e,t){if(!e.altKey||!Er(e.key))return!1;if(!this.cl(t))return!0;let r=e.key==="ArrowRight"?24:-24,i=Math.max(t.colDef.minWidth??40,t.currentWidth+r);return this.e.n.Ie(t,i),this.e.Ze(),this.e.zt([t]),e.preventDefault(),!0}Xh(e,t){if(!e.ctrlKey||!Er(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let r=this.e.n.lr(t),i=this.e.n.C(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.ut(t.id,a),!0}Jh(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!Er(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.zo(r[s]),!0}Zh(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.zo(t[r]),!0}zo(e){let t=this.ee.find(r=>r.column.id===e.id);if(!t&&!e.pinned&&(this.Qh(e),this.ll(),t=this.ee.find(r=>r.column.id===e.id)),!!t){for(let r of this.ee)r.el.tabIndex=r===t?0:-1;t.el.focus({preventScroll:!0})}}Qh(e){let t=this.e.n.C("center"),r=t.indexOf(e);if(r<0)return;let i=this.e.o.S.center;this.G.update(t);let o=this.G.ot(r),s=o+e.currentWidth;o<i.scrollLeft?i.scrollLeft=o:s>i.scrollLeft+i.clientWidth&&(i.scrollLeft=s-i.clientWidth)}cl(e){return this.e.r.enableColumnResize&&e.resizable}Po(){let e=this.e.n.U(),t=e.length>1;for(let r of this.ee){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"?Wr:$r)+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")}}Ni(){let e=this.e.i.j();for(let t of this.ee){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?Tr(r):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}ui(){for(let e of this.ee)e.selectAllEl&&(e.selectAllEl.checked=this.e.m.ic(),e.selectAllEl.indeterminate=this.e.m.nc())}destroy(){for(let e of this.ee){let t=dr(e.el);if(t)try{t()}catch(r){console.error("[mach-table] headerComponent destroy error",r)}}this.ee=[],this.ji=[]}};var Rt=class{constructor(){this.anchor=null;this.end=null;this.cache=!1;this.Wo=-1;this.$o=-1}ep(){return this.anchor}tr(){return this.end}tp(){return this.anchor!=null}start(e,t){(!t||!this.anchor)&&(this.anchor={...e}),this.end={...e},this.invalidate()}rp(e){return this.anchor?!0:e.colIdx<0?!1:(this.anchor={...e},this.invalidate(),!0)}setEnd(e){this.end={...e},this.invalidate()}clear(){this.anchor=null,this.end=null,this.invalidate()}invalidate(){this.cache=!1,this.Wo=-1,this.$o=-1}normalize(e,t){return this.cache!==!1&&this.Wo===e&&this.$o===t?this.cache:(this.Wo=e,this.$o=t,!this.anchor||!this.end||e<=0||t<=0?(this.cache=null,null):(this.cache={r1:Math.max(0,Math.min(this.anchor.row,this.end.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.anchor.row,this.end.row),e-1)),c1:Math.max(0,Math.min(this.anchor.colIdx,this.end.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.anchor.colIdx,this.end.colIdx),t-1))},this.cache))}};var St=class{constructor(e){this.host=e;this.drag=null;this.ie=0;this.Zi=0;this.Je=e=>{let t=this.drag;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.ul()}};this.op=()=>{if(this.ie=0,!!this.drag?.active){if(!this.current()){this.destroy();return}this.Dr(),this.sp()&&this.ul()}};this.Te=e=>{let t=this.drag;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.Dr(),this.hl();try{t.active&&t.drop?.valid&&this.Uo(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.Er=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.yt=e=>{e.type==="pointercancel"&&e.pointerId!==this.drag?.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.drag={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:r,drop:null,active:!1},window.addEventListener("pointermove",this.Je),window.addEventListener("pointerup",this.Te),window.addEventListener("pointercancel",this.yt),window.addEventListener("keydown",this.Er),window.addEventListener("blur",this.yt)}ip(e){return this.drag?.active===!0&&this.sourceContains(e)}np(e,t=()=>!0){this.Zi=requestAnimationFrame(()=>{this.Zi=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(r=>r.closest(".mach-row")?.dataset.id===e)?.focus()})}ul(){this.ie||(this.ie=requestAnimationFrame(this.op))}Uo(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}sp(){let e=this.drag;if(!e||!this.Uo(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}Dr(){let e=this.drag;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.Uo(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)`}hl(){let e=this.drag;this.drag=null,window.removeEventListener("pointermove",this.Je),window.removeEventListener("pointerup",this.Te),window.removeEventListener("pointercancel",this.yt),window.removeEventListener("keydown",this.Er),window.removeEventListener("blur",this.yt),cancelAnimationFrame(this.ie),this.ie=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.hl(),this.release(),cancelAnimationFrame(this.Zi),this.Zi=0}};function an(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 Mt=class extends St{constructor(t,r,i,o){super({get root(){return t.o.root},get body(){return t.o.me},get viewport(){return t.o.S.center},get containers(){return Object.values(t.o.ge)},getRowTop:r,findRowAt:i,scrollBy:o});this.e=t;this.scope=null}pl(t){return!t.loading&&!t.treeLoading&&!t.isGroup}fl(t){if(this.e.l.isEditing()||t.isDetail||!this.pl(t)||t.data==null||this.e.n.ze().length||this.e.r.applyRowDrag&&!this.e.i.ta())return!1;let r=this.rr("canDrag",()=>this.e.r.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return r!==!0?r:!this.e.i.N||!!mr(this.e.api)}canDrag(t){return this.fl(t)===!0}isSource(t){return this.qo()?.isSource(t)??this.ip(t.id)}start(t,r){if(this.destroy(),!this.canDrag(r)||t.isPrimary===!1)return;let i=this.qo();if(i){i.start(t,r);return}let o=this.rr("getRevision",()=>this.jo(r),null);o&&(this.scope={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.qo();if(i){i.moveWithKeyboard(t,r);return}let o=t.key==="ArrowUp"?-1:1,s=r.rowIndex+o;for(;this.e.i.f(s)?.isDetail;)s+=o;let a=this.e.i.f(s),l=this.rr("getRevision",()=>this.jo(r),null);if(!(!a||!l)){this.scope={node:r,from:r.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.np(r.id)}finally{this.release()}}}rr(t,r,i){try{return r()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),i}}jo(t){let r=this.e.i,i=this.e.n.X(),o=this.e.r.rowDragPolicy,s=r.mr(),a=r.Rn(),l=this.e.r.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.rr("getRevision",()=>o?.getRevision?.()===d&&s===r.mr()&&a===r.Rn()&&r.z(t.id)===t&&i===this.e.n.X()&&o===this.e.r.rowDragPolicy&&l===this.e.r.applyRowDrag,!1)}}qo(){let t=mr(this.e.api);return t!==this.factory&&(this.driver?.destroy(),this.factory=t,this.driver=t?this.rr("driver",()=>t({...this.host,api:this.e.api,capture:r=>this.jo(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.driver}current(){return this.scope?.guard.current()??!1}release(){this.scope=null}sourceContains(t){return this.scope?.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.I()-1),i=this.e.i.f(r);if(i?.isDetail&&(i=this.e.i.z(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.scope,o=t.rowIndex+Number(r);for(;this.e.i.f(o)?.isDetail;)o++;let s=this.e.r.rowDragPolicy,a=!this.e.r.applyRowDrag||s?.canDrop?an(i.node,u=>this.e.i.f(u),t,r?"after":"before",i.guard.revision):void 0,l=s?.canDrop&&a?this.rr("canDrop",()=>s.canDrop({node:i.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.pl(t),c=typeof l=="string"?l:Re(this.e.r.locale.rowDragPosition??x.rowDragPosition,i.from+1,this.ml(i.from,o)+1);return{node:t,intent:a,boundary:o,valid:d,text:c,position:r?"after":"before"}}commitDrop(t){let r=this.scope;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.f(o)?.isDetail;)o--;if(r.from===o)return!1;let s=this.e.r.applyRowDrag&&this.e.i.ra(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.ml(r.from,i.boundary),applied:s,intent:i.intent}),!0)}ml(t,r){let i=t+1;for(;this.e.i.f(i)?.isDetail;)i++;return r>t?r-(i-t):r}destroy(){this.driver?.destroy(),super.destroy()}};var Ts=new Set(["warning","danger","success","info"]);function Le(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 fe(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&Ts.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 It=class{constructor(){this.sizes=new Float64Array(0);this.tree=new Float64Array(1);this.Yo=new WeakMap;this.wt=new Map;this.st=0}reset(e,t){this.sizes=new Float64Array(e.length),this.tree=new Float64Array(e.length+1),this.Yo=new WeakMap,this.wt=new Map,this.st=0;for(let r=0;r<e.length;r++){this.Yo.set(e[r],r);let i=Math.max(1,t(e[r],r));this.sizes[r]=i,this.Xo(i,1),this.add(r,i)}}get length(){return this.sizes.length}indexOf(e){return this.Yo.get(e)??-1}update(e,t){if(e<0||e>=this.sizes.length)return!1;let r=Math.max(1,t),i=r-this.sizes[e];return Math.abs(i)<.01?!1:(this.Xo(this.sizes[e],-1),this.sizes[e]=r,this.Xo(r,1),this.add(e,i),!0)}ot(e){let t=Math.max(0,Math.min(Math.trunc(e),this.sizes.length)),r=0;for(;t>0;)r+=this.tree[t],t-=t&-t;return r}Jo(){return this.ot(this.sizes.length)}ap(){return this.st}findIndex(e){if(this.sizes.length===0)return 0;let t=Math.max(0,e),r=0,i=0,o=1;for(;o<<1<=this.sizes.length;)o<<=1;for(;o>0;){let s=r+o;s<=this.sizes.length&&i+this.tree[s]<=t&&(r=s,i+=this.tree[s]),o>>=1}return Math.min(r,this.sizes.length-1)}add(e,t){for(let r=e+1;r<this.tree.length;r+=r&-r)this.tree[r]+=t}Xo(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.st=0;else if(t>0&&(this.st===0||e<this.st))this.st=e;else if(t<0&&e===this.st&&!this.wt.has(e)){let i=Number.POSITIVE_INFINITY;for(let o of this.wt.keys())i=Math.min(i,o);this.st=Number.isFinite(i)?i:0}}};var Ds=16e6,At=class{constructor(){this.height=0;this.Ct=0;this.ir=0;this.Qi=NaN;this.Zo=0}configure(e,t,r=!0){this.height=r?Math.min(e,Ds):e,this.Ct=Math.max(0,e-t),this.ir=Math.max(0,this.height-t),this.Qi=NaN}get at(){return this.Ct>this.ir}lp(e){return this.Ct?E(e,0,this.Ct)*this.ir/this.Ct:0}read(e){return e!==this.Qi&&(this.Qi=e,this.Zo=this.ir>0?E(e,0,this.ir)*this.Ct/this.ir:0),this.Zo}anchor(e,t){this.Zo=E(e,0,this.Ct),this.Qi=t}};var O=["left","center","right"];function ln(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 cn(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 Lt=class{constructor(e){this.e=e;this.pool=[];this.xe=0;this.first=0;this.lastExcl=-1;this.Q=0;this.Qo=0;this.es=0;this.gl=0;this.M=new At;this.lt=0;this.ts=!1;this.en=-1;this.$=new It;this.G=new pe;this.F=new Rt;this.tn=!1;this.rs=0;this.ns=Number.MAX_SAFE_INTEGER;this.T=null;this.os=()=>{this.Q||(this.Q=requestAnimationFrame(()=>{this.Q=0,this.Oi()}))};this.ln=0;this.dn=new WeakMap;this.Dt=new Set;this.cn="";this.Vr=[];this.Yt=null;this.as=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.o.S.center,r=e.deltaMode===1?this.e.r.rowHeight:e.deltaMode===2?t.clientHeight:1,i=this.M.read(t.scrollTop);this.un(i+e.deltaY*r),this.M.read(t.scrollTop)!==i&&(e.preventDefault(),t.scrollLeft+=e.deltaX*r,this.os())};this.sn=null;this.zr=null;this.ms=!1;this.cp=null;this.fn=e=>{let t=this.zr;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.Bl(r),a=this.F.tr();a&&a.row!==s&&(this.F.setEnd({row:s,colIdx:a.colIdx}),this.xt(),this.e.emit("rangeSelectionChanged",{range:this.Ne()}));return}let i=Math.max(t.c2+1,this.zl(r)),o=this.F.tr();o&&o.colIdx!==i&&(this.F.setEnd({row:o.row,colIdx:i}),this.xt(),this.Be(),this.e.emit("rangeSelectionChanged",{range:this.Ne()}))};this.or=e=>{let t=this.zr;if(!t)return;let r=e,i=()=>{this.ss()};if(!t.active){i();return}if(t.axis==="h"){let s=typeof r.clientX=="number"?Math.max(t.c2+1,this.zl(r)):t.c2+1;if(i(),s>t.c2)this.rf(t.r1,t.r2,t.c1,t.c2,s),this.Be();else{let a=this.F.tr();if(!a||a.colIdx===t.c2)return;this.F.setEnd({row:a.row,colIdx:t.c2}),this.xt()}return}let o=typeof r.clientY=="number"?this.Bl(r):t.r2;if(i(),o>t.r2)this.of(t.r1,t.r2,t.c1,t.c2,o),this.Be();else{let s=this.F.tr();if(!s||s.row===t.r2)return;this.F.setEnd({row:t.r2,colIdx:s.colIdx}),this.xt()}};this.yl=e=>{if(this.e.s())return;let t=e.target,r=this.Rt(e);if(r&&!t.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-row-drag-handle")&&!(e.detail>1&&this.e.l.Di())){if(this.e.l.Di()){let i=r.cellEl?.dataset.colId??"";if(this.e.l.isEditing(r.index,i))return;this.e.l.se(!1).then(o=>{if(!o||this.e.s())return;this.Wl(e,t,r);let s=i?this.e.n.L(i):void 0;s&&!this.e.l.Di()&&this.e.l.W(r.node,s)&&this.e.l.start(r.index,s)});return}this.Wl(e,t,r)}};this.vl=e=>{if(this.e.s()||e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell"))return;let t=this.Rt(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.L(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.W(r,a)&&this.e.l.start(i,a)};this.bl=e=>{if(this.e.s())return;let t=this.Rt(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.L(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.De()){let l=this.e.n.Me(s);l>=0&&this.fs(i,l,!1)}this.e.gs.open(e.clientX,e.clientY,{rowIndex:i,colId:s})}};this.wl=e=>{if(!this.yf(e)&&this.e.r.enableRangeSelection&&e.button===0){let t=this.Rt(e);if(t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl&&!t.cellEl.classList.contains("mach-cell--selection")){let r=this.e.n.Me(t.cellEl.dataset.colId??"");r>=0&&(this.fs(t.index,r,e.shiftKey),this.tn=!0,!e.shiftKey&&!this.e.r.suppressCellFocus&&this.Ee(t.index,t.cellEl.dataset.colId??""))}}};this.El=()=>{this.tn=!1};this.Ar=e=>{if(this.e.s())return;let t=this.Rt(e);if(this.tn&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let r=this.e.n.Me(t.cellEl.dataset.colId??""),i=this.F.tr();r>=0&&i&&(i.row!==t.index||i.colIdx!==r)&&this.fs(t.index,r,!0)}this.e.r.suppressRowHoverHighlight||!t||t.node.isDetail||this._l(t.index)};this.Cl=()=>{this._l(-1)};this.Tl=e=>{if(this.e.s()||e.button!==0||!e.target.closest(".mach-row-drag-handle"))return;let r=this.Rt(e);!r||r.node.isDetail||r.node.isGroup||(this.Tt.start(e,r.node),e.preventDefault())};this.Dl=e=>{if(!e.target.closest(".mach-row-drag-handle"))return;let t=this.Rt(e);t&&this.Tt.moveWithKeyboard(e,t.node)};this.Tt=new Mt(e,t=>this.Re(t)-this.lt,t=>this.rn(t+this.lt,this.e.i.I()),t=>this.dp(t))}init(){let e=this.e.o.S.center;this.Qo=e.scrollLeft,this.es=e.scrollTop,e.addEventListener("scroll",this.os,{passive:!0});let t=this.e.o.me;t.addEventListener("click",this.yl),t.addEventListener("dblclick",this.vl),t.addEventListener("contextmenu",this.bl),t.addEventListener("mousedown",this.wl),t.addEventListener("mouseover",this.Ar),t.addEventListener("mouseleave",this.Cl),t.addEventListener("pointerdown",this.Tl),t.addEventListener("keydown",this.Dl),window.addEventListener("mouseup",this.El)}suspend(){cancelAnimationFrame(this.Q),this.Q=0,this.ss(),this.Tt.destroy(),this.tn=!1}destroy(){cancelAnimationFrame(this.Q);let e=this.e.o.S.center;e.removeEventListener("scroll",this.os),e.removeEventListener("wheel",this.as);let t=this.e.o.me;t.removeEventListener("click",this.yl),t.removeEventListener("dblclick",this.vl),t.removeEventListener("contextmenu",this.bl),t.removeEventListener("mousedown",this.wl),t.removeEventListener("mouseover",this.Ar),t.removeEventListener("mouseleave",this.Cl),t.removeEventListener("pointerdown",this.Tl),t.removeEventListener("keydown",this.Dl),window.removeEventListener("mouseup",this.El),this.ss(),this.Tt.destroy();for(let r of this.pool){r.detailRow&&this.nn(r.detailRow);for(let i of O)for(let o of r.cells[i]??[])r.index>=0&&this.e.l.co(r.index,o.dataset.colId??"",o),k(this.e,o)}this.sn?.remove(),this.cp?.remove(),this.pool=[],this.xe=0,this.Vr=[],this.Dt.clear(),this.$.reset([],()=>this.e.r.rowHeight),this.G.update([]),this.Yt=null}Qn(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}Oi(e=!1){if(this.e.s())return;let t=this.e.o,r=t.S.center,i=r.scrollLeft,o=r.scrollTop,s=this.M.read(o),a=e||i!==this.Qo,l=e||o!==this.es||s!==this.gl;!a&&!l||(this.Qo=i,this.es=o,this.gl=s,a&&(t.Kt.center.style.transform=`translate3d(${-i}px, 0, 0)`,this.e.B.ll(),this.e.de.up(i)),l&&this.xl(o),this.e.an.hide(),this.Gr(!1,a),l&&this.e.i.Ed(this.lastExcl-1))}hp(){let e={left:0,center:0,right:0};for(let t of O)e[t]=this.e.n.C(t).reduce((r,i)=>r+i.currentWidth,0);return e}Hi(){let e=this.e.o,t=this.hp();this.G.update(this.e.n.C("center")),t.center=this.G.il();let r=this.e.i.je(),i=this.pp(r.length);this.fp(r,i);let o=this.mp(i);this.gp(t,o),this.yp(o),e.root.setAttribute("aria-rowcount",String(i.rowCount+e.Vo()))}pp(e){let t=this.e.i.Gt(),r=this.e.r.rowHeight,i=this.e.r.masterDetail?[]:this.vp(),o=this.e.r.datasourceMode!=="block"&&(this.e.r.masterDetail||this.e.r.getRowHeight!=null||i.length>0),s=o?this.bp(r,i):`fixed|${r}`;return{autoHeightColumns:i,positionedCount:Math.min(t,e),rowCount:t,rowHeight:r,signature:s,variable:o}}bp(e,t){let r=t.map(i=>`${i.id}:${i.currentWidth}`).join(",");return`${this.e.i.Rn()}|${e}|${this.e.r.detailRowHeight}|${r}`}fp(e,t){if(!t.variable){this.wp(t);return}if(t.signature!==this.cn||this.$.length!==t.positionedCount){let r=e.slice(0,t.positionedCount);this.$.reset(r,i=>this.Rl(i,t.autoHeightColumns)),this.Sl(t);return}if(this.Dt.size!==0){for(let r of this.Dt){let i=this.$.indexOf(r);i>=0&&this.$.update(i,this.Rl(r,t.autoHeightColumns))}this.Sl(t)}}wp(e){this.$.length>0&&this.$.reset([],()=>e.rowHeight),this.cn=e.signature,this.Dt.clear(),this.ln=e.rowHeight}Sl(e){this.cn=e.signature,this.Dt.clear(),this.ln=this.$.ap()||e.rowHeight}mp(e){return(e.variable?this.$.Jo():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}gp(e,t){let r=this.e.o,i=r.S.center,o=this.M.read(i.scrollTop),s=this.M.at;this.M.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 O){let c=r.ge[d];c.style.height=`${this.M.height}px`,c.style.overflow=this.M.at?"hidden":"",d==="center"&&(c.style.width=`${l}px`)}(s||this.M.at)&&this.un(o),this.xl(i.scrollTop),this.ts!==this.M.at&&(this.ts=this.M.at,this.ts?i.addEventListener("wheel",this.as,{passive:!1}):i.removeEventListener("wheel",this.as))}un(e){let t=this.e.o.S.center;t.scrollTop=this.M.lp(e),this.M.anchor(e,t.scrollTop)}xl(e){let t=this.M.at;for(let r of["left","right"]){let i=this.e.o.ge[r].style;i.top=t?`${-e}px`:"",i.transform=t?"":`translate3d(0, ${-e}px, 0)`}}dp(e){let t=this.e.o.S.center,r=this.M.read(t.scrollTop);this.un(r+e);let i=this.M.read(t.scrollTop)!==r;return i&&this.Oi(),i}hi(e){this.dn.delete(e),this.Dt.add(e)}yp(e){this.e.o.me.style.height=this.e.r.domLayout==="autoHeight"?`${e}px`:""}Vi(){this.dn=new WeakMap,this.Dt.clear(),this.cn=""}Rl(e,t){if(e.isDetail)return this.e.r.detailRowHeight;let r=this.dn.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.Cp(e,t))),this.dn.set(e,i),i}Re(e){let t=this.$.length;return t===0?Math.max(0,e)*this.e.r.rowHeight:e<=t?this.$.ot(e):this.$.Jo()+(e-t)*this.e.r.rowHeight}rn(e,t){if(t<=0)return 0;let r=this.$.length,i=this.$.Jo();if(r>0&&e<i)return this.$.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))}vp(){return this.e.n.c().filter(e=>e.colDef.autoHeight===!0)}get Tp(){return this.e.n.c().some(e=>e.colDef.autoHeight===!0)}Cp(e,t){var d;this[d="Yt"]??(this[d]=document.createElement("canvas"));let r=this.Yt.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=X(this.e,e,c);if(!u)continue;let h=Math.max(10,c.currentWidth-s*2-2),p=1,m=0;for(let v of u){let w=r.measureText(v).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)}Pa(e,t){if(this.e.r.flashCells)for(let r of e)for(let i of t)this.Vr.push([r,i])}Ml(){if(this.Vr.length===0)return;let e=this.Vr;this.Vr=[];for(let[t,r]of e){let i=this.xi(t,r);if(!i)continue;i.classList.remove("mach-cell--flash"),i.offsetWidth,i.classList.add("mach-cell--flash");let o=De(i),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{i.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}he(){this.Hi();let e=this.e.o.S.center,r=this.e.r.rowHeight;this.e.r.masterDetail&&(r=Math.min(r,this.e.r.detailRowHeight)),this.ln>0&&(r=Math.min(r,this.ln));let i=Math.ceil(e.clientHeight/Math.max(1,r)),o=this.e.r.domLayout==="autoHeight"?this.e.i.I():i+this.e.r.rowBuffer*2+1,s=o%2===0?o:o+1;if(this.Il())for(let l of this.pool)this.ls(l,"center");s>this.xe&&this.Dp(s),this.ds(),this.Gr(!0,!1),this.cs()}Dp(e){for(;this.xe<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{},cellColIds:{}},r=this.e.o;for(let i of O){if(this.e.n.C(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.ge[i].appendChild(s),t.rows[i]=s,t.cells[i]=[],t.cellColIds[i]=[],this.ls(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.ge.center.appendChild(i),t.detailRow=i}this.pool.push(t),this.xe++}}nr(e){let t=this.e.n.C(e);return e!=="center"||t.length<=20||this.e.n.bn()?t:t.slice(this.rs,this.ns)}Ep(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}ls(e,t){let r=e.rows[t];if(!r)return;let i=this.nr(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.Ep(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.co(e.index,c.dataset.colId??"",c),k(this.e,c),c.remove();e.cells[t]=l,e.cellColIds[t]=d}Lo(){this.Br=void 0,this.Al();for(let e of this.pool){e.detailRow&&this.nn(e.detailRow);for(let t of O){for(let r of e.cells[t]??[])k(this.e,r);e.rows[t]?.remove()}e.detailRow?.remove()}this.pool=[],this.xe=0,this.first=0,this.lastExcl=-1,this.he()}ds(){let e=this.xp();for(let t of O){let r=this.e.n.C(t),i=this.nr(t),o=this.Rp(t,i,r);this.Sp(t,i,o,e)}this.Mp()}xp(){return this.e.r.masterDetail||this.e.r.getRowHeight!=null||this.Tp}Rp(e,t,r){let i=0;e==="center"&&t.length>0&&(this.G.update(r),i=this.G.ot(r.indexOf(t[0])));let o=[];for(let s of t)o.push(i),i+=s.currentWidth;return o}Sp(e,t,r,i){for(let o of this.pool){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.Me(c.id)+1))}}}Mp(){if(!this.e.r.masterDetail)return;let e=`${this.e.r.detailRowHeight}px`;for(let t of this.pool)t.detailRow?.style.setProperty("--mach-detail-h",e)}Il(){let e=this.e.o.S.center,t=this.e.n.C("center"),r=this.rs,i=this.ns;this.G.update(t);let o=t.length>20?this.G.nl(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};return this.rs=o.first,this.ns=o.lastExcl,o.first!==r||o.lastExcl!==i}Mn(){return{first:this.first,lastExcl:this.lastExcl}}Gr(e=!1,t=!0){let r=this.e.re.start();if(!this.Ip(e,t))return;let i=Math.max(0,this.lastExcl-this.first),o=this.e.n.C("left").length+this.nr("center").length+this.e.n.C("right").length;this.e.re.hu(r,i,o)}Ip(e,t){let r=this.e.o.S.center,i=this.M.read(r.scrollTop)-r.scrollTop,o=i!==this.lt;this.lt=i;let s=this.e.i.I(),a=this.e.r.rowBuffer,l=t?this.Il():!1;if(this.Ap(l),s===0){for(let u of this.pool)this.us(u);return this.first=0,this.lastExcl=0,!0}if(this.Lp(s,e,l))return!0;let{first:d,lastExcl:c}=this.kp(r,s,a);return!e&&!l&&d===this.first&&c===this.lastExcl?(o&&(this.Ll(),this.Be()),l||o):(this.first=d,this.lastExcl=c,this.Pp(d,c),this.kl(d,c,e,l),o&&this.Ll(),this.Be(),!0)}kp(e,t,r){let i=this.M.read(e.scrollTop),o=this.rn(i,t),s=i+e.clientHeight,a=Math.min(t,this.rn(s,t)+1);return{first:E(o-r,0,t-1),lastExcl:E(a+r,1,t)}}Pp(e,t){for(let r of this.pool)r.index!==-1&&(r.index<e||r.index>=t)&&this.us(r)}kl(e,t,r,i){for(let o=e;o<t;o++){let s=this.e.i.f(o),a=this.pool[o%this.xe];if(!(!a||!s)){if(!r&&a.index===o&&a.nodeId===s.id){i&&a.kind==="master"&&this.hn(a,s,"center");continue}this.Gp(a,o)}}}Ap(e){if(e){for(let t of this.pool)this.ls(t,"center");this.ds()}}Lp(e,t,r){return this.e.r.domLayout!=="autoHeight"?!1:(!t&&!r&&this.first===0&&this.lastExcl===e||(this.first=0,this.lastExcl=e,this.kl(0,e,t,r)),!0)}us(e){this.Pl(e),this.T?.rowIndex===e.index&&this.e.o.root.removeAttribute("aria-activedescendant"),e.index=-1,e.nodeId="",e.kind="master";for(let t of O){let r=e.rows[t];r&&(r.style.display="none",delete r.dataset.id,delete r.dataset.index,fe(r,void 0),r.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.nn(e.detailRow),e.detailRow.style.display="none")}Gp(e,t){e.index>=0&&e.index!==t&&this.Pl(e);let r=this.e.i.f(t);if(!r){this.us(e);return}e.index=t,e.nodeId=r.id;let i=this.Re(t),o=i-this.lt,s=this.Re(t+1)-i;if(r.isDetail){this.Np(e,r,t,o,s);return}this.Fp(e,r,t,o,s)}Ll(){for(let e of this.pool){if(e.index<this.first||e.index>=this.lastExcl)continue;let t=`translateY(${this.Re(e.index)-this.lt}px)`;for(let r of Object.values(e.rows))r.style.transform=t;e.detailRow&&(e.detailRow.style.transform=t)}}Np(e,t,r,i,o){e.kind="detail";for(let a of O){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.Vo()+1)),this.hs(s,t))}Fp(e,t,r,i,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Op(t),a=Le(this.e,t);for(let l of O){let d=e.rows[l];d&&(this.Hp(d,t,r,i,o,s),fe(d,a),this.hn(e,t,l))}this.T&&this.T.rowIndex===r&&this.pn()}Op(e){let t=this.e.i.N,r=e.isGroup===!0,i=t&&this.e.i.Pn(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.Gn(e)+1),{expanded:s,expandable:o,level:a}}Hp(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.Vo()+1)),this.Gl(e,t);let a=this.en===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.Tt.isSource(t)),this.Vp(e,s)}Gl(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}Vp(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")}hn(e,t,r){let i=this.nr(r),o=e.cells[r];if(!o)return;let s=e.index,a=r==="center"&&this.e.n.bn(),l=0;e.rows[r]?.classList.toggle("mach-row--editing",this.e.l.Ei(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.Bp(t,c,s,i.length-d);h>1?(l=h-1,this.zp(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.Da(s,t,c,u)||(this.Nl(u,t,c),this.ps(u,s,c))}}Bp(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}}zp(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))}hs(e,t){this.nn(e);let r=t.masterId!=null?this.e.i.z(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),Ei(e,a.destroy))}}nn(e){let t=xi(e);if(t)try{t()}catch(r){this.e.reportError(r,"detailRowRenderer.destroy")}e.textContent=""}Nl(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.Et(e);return}e.removeAttribute("aria-busy"),e.setAttribute("aria-readonly",this.e.l.W(t,r)?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let i=this._p(t,r);if(i!=="standard"){k(this.e,e),this.Kp(i,e,t,r);return}dt(this.e,e,t,r),Ee(this.e,e,t,r),lt(this.e,e,t,r),this.Fl(e,t,r),this.Wp(e,t,r)}_p(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":le(t.colDef,"index")?"index":this.e.i.N&&this.Ol()?.id===t.id?"tree":"standard"}Kp(e,t,r,i){if(e==="group")this.$p(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.Et(t)}else if(e==="checkbox"){let o=t.querySelector(".mach-row-checkbox");o&&(o.checked=r.selected,o.indeterminate=this.e.m.Xd(r.id),o.disabled=!this.e.m.ke(r)),t.className!=="mach-cell mach-cell--selection"&&(t.className="mach-cell mach-cell--selection"),this.Et(t)}else if(e==="drag")this.Up(t,r),t.className!=="mach-cell mach-cell--drag"&&(t.className="mach-cell mach-cell--drag"),this.Et(t);else if(e==="index"){t.textContent=String(this.e.i.ea(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.Fl(t,r,i)}else this.qp(t,r,i)}Wp(e,t,r){if(this.e.r.editType!=="cell"||this.e.r.editableIndicator==="none"||!this.e.l.W(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.Ee(t.rowIndex,r.id),this.e.l.start(t.rowIndex,r)}),e.appendChild(i)}Pl(e){if(!(e.index<0))for(let t of O)for(let r of e.cells[t]??[])this.e.l.co(e.index,r.dataset.colId??"",r)}Ol(){return this.Br!==void 0?this.Br:(this.Br=this.e.n.c().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!le(e.colDef,"index"))??null,this.Br)}qp(e,t,r){let i=this.e.i.isRowExpandable(t),o=this.e.i.Gn(t),s=ue(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"),Ee(this.e,e,t,r)}Et(e){e.style.height!==""&&(e.style.height=""),e.style.zIndex!==""&&(e.style.zIndex=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Fl(e,t,r){let i=this.e.i.$d(r.id);if(!i||t.isDetail){this.Et(e);return}let o=this.e.i.ea(t)-1;if(o<0||o>=i.length){this.Et(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.I()),l=this.Re(a)-this.Re(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.Et(e)}$p(e,t,r){if(r.hasCheckbox){this.jp(e,t);return}if(r.isDetailToggle){this.Hl(e);return}let i=this.e.n.Ms();if(i&&r.id===i.id){this.Yp(e,t);return}this.Xp(e,t,r)||this.Hl(e)}jp(e,t){let r=e.querySelector(".mach-row-checkbox");if(r){let i=this.e.m.na(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")}Yp(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.ze()[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")}Xp(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?ue(this.e,t,r,i):cr(i),e.className!=="mach-cell mach-cell--num"&&(e.className="mach-cell mach-cell--num"),!0}Hl(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}Ye(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.pool[r%this.xe];if(!i||i.index!==r)continue;let o=this.e.i.f(r);if(o){if(i.kind==="detail"){i.detailRow&&this.hs(i.detailRow,o);continue}for(let s of O){let a=i.rows[s];a&&this.Gl(a,o),i.cells[s]&&this.hn(i,o,s)}}}this.pn(),this.Ml()}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.pool){let s=this.e.i.f(o.index);!s||!this.Jp(o,s,t,r)||this.Zp(o,s,i,e.force===!0)}this.pn(),this.Ml()}Jp(e,t,r,i){return e.index<0?!1:r==null&&i==null?!0:r?.has(t.id)===!0||i?.has(e.index)===!0}Zp(e,t,r,i){if(e.kind==="detail"){r==null&&e.detailRow&&this.hs(e.detailRow,t);return}let o=r==null||this.e.n.bn(),s=Le(this.e,t);for(let a of O){let l=e.rows[a];l&&fe(l,s),o?this.hn(e,t,a):this.Qp(e,t,a,r,i)}}Qp(e,t,r,i,o){let s=this.nr(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.Da(e.index,t,d,c)||(o&&k(this.e,c),this.Nl(c,t,d),this.ps(c,e.index,d)))}}ef(){this.e.s()||(this.T&&this.T.rowIndex>=this.e.i.I()&&this.Ee(null,null),this.Al(),this.Hi(),this.Gr(!0),this.Be(),this.cs(),this.e.ne.refresh())}cs(){let e=this.e.r;if(e.loading){let t=e.overlayLoadingTemplate||this.e.ja();this.e.o._i("loading",t,e.allowUnsafeOverlayHtml);return}if(e.error!=null){let t=e.overlayErrorTemplate||this.e.Xa();this.e.o._i("error",t,e.allowUnsafeOverlayHtml);return}if(this.e.i.I()===0&&!e.suppressNoRowsOverlay){let t=e.overlayNoRowsTemplate||this.e.Ya();this.e.o._i("noRows",t,e.allowUnsafeOverlayHtml);return}this.e.o.qa()}xi(e,t){let r=this.e.n.L(t);if(!r)return null;let i=this.Qn(r),o=this.pool[e%Math.max(1,this.xe)]?.cellColIds[i]?.indexOf(r.id)??-1;if(o<0)return null;let s=this.pool[e%this.xe];return!s||s.index!==e||s.kind!=="master"?null:s.cells[i]?.[o]??null}Al(){this.F.invalidate()}De(){let e=this.e.i.I(),t=this.e.n.c().length;return this.F.normalize(e,t)}Wt(){let e=this.De();if(e)return e;let t=this.T;if(t){let r=this.e.n.Me(t.colId);if(r>=0)return{r1:t.rowIndex,c1:r,r2:t.rowIndex,c2:r}}return null}Ne(){let e=this.De();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??""}}no(){let e=this.F.ep();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.Wt();return t?{row:t.r1,colIdx:t.c1}:null}$t(){let e=this.De();this.F.clear(),e&&(this.xt(),this.Be(),this.e.emit("rangeSelectionChanged",{range:null}))}xt(){for(let e of this.pool)if(!(e.index<0||e.kind!=="master"))for(let t of O){let r=this.nr(t);e.cells[t]?.forEach((i,o)=>{let s=r[o];s&&this.ps(i,e.index,s)})}}fs(e,t,r){this.F.start({row:e,colIdx:t},r),this.xt(),this.Be(),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}xc(e,t){if(!this.F.tp()){let a=this.T;if(!a)return;let l=this.e.n.Me(a.colId);if(!this.F.rp({row:a.rowIndex,colIdx:l}))return}let r=this.e.i.I(),i=this.e.n.c().length;this.F.setEnd({row:Math.max(0,Math.min(e,r-1)),colIdx:Math.max(0,Math.min(t,i-1))}),this.xt(),this.Be();let o=this.e.n.c(),s=this.F.tr();s&&s.colIdx<o.length&&this.Ee(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}ps(e,t,r){let i=this.De();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.Me(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")}tf(){if(this.sn)return this.sn;let e=f("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.ms=!0,this.Vl(t)}),e.addEventListener("mousedown",t=>{this.ms||this.Vl(t)}),this.e.o.ge.center.appendChild(e),this.sn=e,e}Be(){let e=this.tf(),t=this.De();if(!this.e.r.enableRangeSelection||!this.e.r.fillHandle||!t){e.style.display="none";return}let r=this.e.n,i=r.C("left").length,o=r.C("center");if(t.c2<i||t.c2>=i+o.length){e.style.display="none";return}let s=t.c2-i;this.G.update(o);let a=this.G.ot(s+1),l=this.Re(Math.min(t.r2+1,this.e.i.I()))-this.lt,d=this.e.o.S.center;if(this.M.at&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.M.at?Math.min(a-4,parseFloat(this.e.o.ge.center.style.width)-8):a-4}px`,e.style.top=`${Math.min(l-4,this.M.height-8)}px`}Vl(e){if(this.e.s()||e.button!==0)return;let t=this.De();t&&(e.preventDefault(),e.stopPropagation(),this.zr={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.fn),window.addEventListener("mousemove",this.fn),window.addEventListener("pointerup",this.or),window.addEventListener("mouseup",this.or),window.addEventListener("pointercancel",this.or))}Bl(e){let r=this.e.o.ge.center.getBoundingClientRect(),i=e.clientY-r.top+this.lt,o=this.e.i.I(),s=this.rn(i,o);return Math.max(this.zr.r2,Math.min(s,o-1))}zl(e){let r=this.e.o.ge.center.getBoundingClientRect(),i=e.clientX-r.left,o=this.e.n,s=o.C("left").length,a=o.C("center");this.G.update(a);let l=this.G.Gh(i);if(l<0)return s;let d=this.G.ot(l)+a[l].currentWidth/2;return i<d?s+l:l+1<a.length?s+l+1:s+a.length-1}ss(){this.zr=null,this.ms=!1,window.removeEventListener("pointermove",this.fn),window.removeEventListener("mousemove",this.fn),window.removeEventListener("pointerup",this.or),window.removeEventListener("mouseup",this.or),window.removeEventListener("pointercancel",this.or),this.e.o.root.classList.remove("mach-root--filling")}rf(e,t,r,i,o){let s=this.e.n.c(),a=[];for(let l=e;l<=t;l++)this.nf(l,r,i,o,s,a);this.e.Jt(a),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}nf(e,t,r,i,o,s){let a=this.e.i.f(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(!ln(u)||!this.e.l.W(a,u))continue;let h=cn(d,c-t),p=this.e.d(a,u);s.push({node:a,column:u,oldValue:p,newValue:h})}}of(e,t,r,i,o){let s=this.e.n.c(),a=[];this.sf(e,t,r,i,o,s,a),this.e.Jt(a),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}sf(e,t,r,i,o,s,a){for(let l=r;l<=i;l++){let d=s[l];ln(d)&&this.af(d,e,t,o,a)}}af(e,t,r,i,o){let s=this.lf(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.f(l);if(!d||d.isDetail||d.isGroup||!this.e.l.W(d,e))continue;let c=cn(a,l-t),u=this.e.d(d,e);o.push({node:d,column:e,oldValue:u,newValue:c})}}lf(e,t,r){let i=[];for(let o=t;o<=r;o++){let s=this.e.i.f(o);i.push(s?this.e.d(s,e):void 0)}return i}Ee(e,t){if(this.df(),e==null||t==null){this.T=null;return}this.T={rowIndex:e,colId:t},this.pn(),this.cf()}pn(){if(!this.T)return;let e=this.xi(this.T.rowIndex,this.T.colId);if(e){let t=Math.max(0,this.e.n.Me(this.T.colId));e.id=`mach-grid-${this.e.gridId}-r${this.T.rowIndex}-c${t}`,e.classList.add("mach-cell--focus"),this.e.o.root.setAttribute("aria-activedescendant",e.id)}}df(){if(this.T){let e=this.xi(this.T.rowIndex,this.T.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.o.root.removeAttribute("aria-activedescendant")}cf(){if(!this.T)return;this.Bt(this.T.rowIndex,"nearest");let e=this.e.n.L(this.T.colId);if(!e||e.pinned)return;let t=this.e.o.S.center,r=this.e.n.C("center");this.G.update(r);let i=this.G.ot(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)}Bt(e,t="top"){let r=this.e.o.S.center,i=this.e.i.I();if(i===0)return;let o=E(e,0,i-1),s=r.clientHeight,a=this.M.read(r.scrollTop),l=this.Re(o),d=this.Re(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.Re(i)-s);this.un(E(c,0,u)),this.Oi()}_l(e){if(this.en===e)return;let t=this.en;this.en=e,this.Kl(t,!1),this.Kl(e,!0)}Kl(e,t){if(e<0)return;let r=this.pool[e%this.xe];if(!(!r||r.index!==e||r.kind!=="master"))for(let i of O)r.rows[i]?.classList.toggle("mach-row--hover",t)}_r(){this.e.o.root.focus({preventScroll:!0})}Rt(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.f(i);if(!o)return null;let s=t.closest(".mach-cell");return{node:o,index:i,cellEl:s}}Wl(e,t,r){let{node:i,index:o,cellEl:s}=r;if(this.uf(t,i,s)||this.hf(t,i,s))return;let a=s?.dataset.colId??"",l=a?this.e.n.L(a):void 0;this.pf(i,l)||i.isDetail||this.ff(t,i,o,e)||!s||!l||(this._r(),this.e.r.suppressCellFocus||this.Ee(o,a),this.e.m.sa(i,e,!1),this.mf(e,i,o,l),this.gf(i,o,l))}uf(e,t,r){if(!t.isGroup)return!1;if(this._r(),e.closest(".mach-row-checkbox")){let o=this.e.m.na(t).all;return this.e.m.Qd(t,!o),!0}let i=this.e.n.Ms();return(!i||!r||r.dataset.colId===i.id)&&this.e.i.Kn(t.id),!0}pf(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this._r(),this.e.mi(e.id),!0)}ff(e,t,r,i){let o=e.closest(".mach-cell--selection");return o?(this._r(),this.e.r.suppressCellFocus||this.Ee(r,o.dataset.colId??""),this.$t(),this.e.m.sa(t,i,!0),!0):!1}mf(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})}gf(e,t,r){(this.e.r.singleClickEdit||r.colDef.singleClickEdit===!0)&&this.e.l.W(e,r)&&this.e.l.start(t,r)}hf(e,t,r){if(!this.e.i.N||!e.closest(".mach-tree-toggle"))return!1;let i=this.Ol();return!i||r?.dataset.colId!==i.id||!this.e.i.isRowExpandable(t)?!1:(this._r(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.mi(t.id),!0)}yf(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.l.Di())}Up(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.Tt.fl(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 kt=class{constructor(e){this.e=e;this.Se=null;this.rows={left:void 0,center:void 0,right:void 0};this.ys={left:[],center:[],right:[]}}init(){this.Se=f("div","mach-footer"),this.Se.style.display="none",this.Se.setAttribute("role","row"),this.e.o.root.appendChild(this.Se);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.Se.appendChild(t),this.rows[e]=t}}setVisible(e){this.Se&&(this.Se.style.display=e?"":"none")}refresh(){if(!this.Se||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.je().filter(o=>!o.isDetail&&!o.isGroup),i={...x,...this.e.r.locale};for(let o of["left","center","right"]){let s=this.e.n.C(o),a=this.rows[o];this.ys[o].length!==s.length&&(a.textContent="",this.ys[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.ys[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=W(i.totalRowsLabel,r.length):u.textContent=""})}}destroy(){this.Se?.remove(),this.Se=null}};var Pt=class{constructor(e){this.e=e;this.w=null;this.mn=null;this.vs=null;this.sr=null;this.St=null;this.Kr=null;this.Wr=null;this.$r=null;this.Ur=null;this.Mt=[]}init(){this.w=f("div","mach-pagination"),this.w.style.display="none",this.w.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.mn=f("span","mach-pagination-total"),this.Kr=e("mach-pagination-first",this.t("pageFirst"),"\xAB"),this.Wr=e("mach-pagination-prev",this.t("pagePrev"),"\u2039"),this.vs=f("span","mach-pagination-page"),this.$r=e("mach-pagination-next",this.t("pageNext"),"\u203A"),this.Ur=e("mach-pagination-last",this.t("pageLast"),"\xBB"),this.Kr.addEventListener("click",()=>this.e.i.setPage(1)),this.Wr.addEventListener("click",()=>this.e.i.setPage(this.e.i.Cr()-1)),this.$r.addEventListener("click",()=>this.e.i.setPage(this.e.i.Cr()+1)),this.Ur.addEventListener("click",()=>this.e.i.setPage(this.e.i.getPageCount())),this.w.append(this.mn,this.Kr,this.Wr,this.vs,this.$r,this.Ur),this.e.r.paginationShowSizeSelector&&(this.St=Y({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.sr=this.St.native,this.$l(),this.w.appendChild(this.St.el)),this.e.o.root.appendChild(this.w),this.Mt.push(this.e.le.on("modelUpdated",()=>this.refresh()),this.e.le.on("paginationChanged",()=>this.refresh())),this.refresh()}$l(){if(!this.sr)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.St?.setOptions(e.map(r=>({value:String(r),label:W(this.t("perPage"),r)})),String(t))}t(e){return this.e.r.locale?.[e]??x[e]}ce(){this.w&&(this.sr&&this.e.r.paginationShowSizeSelector&&this.$l(),this.refresh())}Ul(e,t){e&&e.textContent!==t&&(e.textContent=t)}vf(e,t){let r=e<=1,i=e>=t;this.Kr&&(this.Kr.disabled=r),this.Wr&&(this.Wr.disabled=r),this.$r&&(this.$r.disabled=i),this.Ur&&(this.Ur.disabled=i)}refresh(){if(!this.w||this.e.s())return;let e=this.e.i,t=e.we,r=e.getTotalRowCount(),i=t&&r>0;if(this.w.style.display=i?"":"none",!i)return;let o=e.Cr(),s=e.getPageCount();this.mn&&this.e.r.paginationShowTotal&&this.Ul(this.mn,W(this.t("paginationTotal"),r)),this.Ul(this.vs,Re(this.t("paginationPage"),o,s)),this.vf(o,s),this.sr&&Number(this.sr.value)!==this.e.r.paginationPageSize&&this.St?.setValue(String(this.e.r.paginationPageSize))}destroy(){for(let e of this.Mt)e();this.Mt=[],this.St?.destroy(),this.St=null,this.sr=null,this.w?.remove(),this.w=null}};var se=["left","center","right"],Gt=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.ql(this.e.o.Ki),this.bottom=this.ql(this.e.o.Wi)}ql(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 se)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.ce(),this.Ve(),this.e.he())}setRows(e,t){let r=this[e];this.e.s()||!r||(r.data=t??[],this.bs(r,e),this.Ve(),this.e.he())}getRows(e){return this[e]?.data.slice()??[]}ce(){!this.top||!this.bottom||(this.bs(this.top,"top"),this.bs(this.bottom,"bottom"))}bs(e,t){for(let o of e.cells)for(let s of se)for(let a of o[s])k(this.e,a);for(let o of se){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=Le(this.e,a,t);for(let c of se){let u=f("div","mach-pinned-row");fe(u,d),u.style.height=`${r}px`,u.setAttribute("role","row"),l[c]=[];for(let h of i.C(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{dt(this.e,p,a,h),Ee(this.e,p,a,h),lt(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)})}Ve(){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 se){let o=0;for(let s of e.C(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 se){let d=e.C(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}})}}up(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.ce(),this.Ve()}destroy(){for(let e of[this.top,this.bottom])if(e)for(let t of e.cells)for(let r of se)for(let i of t[r])k(this.e,i);this.top=null,this.bottom=null}};var Nt=class{constructor(e){this.e=e;this.w=null;this.items={};this.Mt=[]}init(){this.w=f("div","mach-statusbar"),this.w.style.display="none",this.w.setAttribute("role","status"),this.e.o.root.appendChild(this.w),this.ce(),this.Mt.push(this.e.le.on("modelUpdated",()=>this.refresh()),this.e.le.on("selectionChanged",()=>this.refresh()),this.e.le.on("rangeSelectionChanged",()=>this.refresh()),this.e.le.on("cellValueChanged",()=>this.refresh()))}ce(){if(!this.w)return;this.w.textContent="",this.items={};let e=this.e.r;if(!e.statusBarEnabled){this.w.style.display="none";return}for(let t of e.statusBarPanels){let r=f("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.w.appendChild(r),this.items[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 W(i,o)}ws(e,t){let r=this.items[e];r&&r.textContent!==t&&(r.textContent=t)}bf(e){let t=this.e.i,r=t.Gt(),i=t.we?t.getTotalRowCount():t.I(),o=W(this.text(e,"totalRowsLabel"),i);return t.p&&r>i?`${o} / ${r}`:o}wf(e){let t=this.e.a.De();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.f(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.w||this.e.s())return;let e=this.e.r;if(this.w.style.display=e.statusBarEnabled?"":"none",!e.statusBarEnabled)return;let t={...x,...e.locale};if(this.items.rowCount&&this.ws("rowCount",this.bf(t)),this.items.selectedRowCount){let r=this.e.m.Pe().length;this.ws("selectedRowCount",W(this.text(t,"statusSelected"),r))}this.items.rangeAggregate&&this.ws("rangeAggregate",this.wf(t))}destroy(){for(let e of this.Mt)e();this.Mt=[],this.w?.remove(),this.w=null}};function xr(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function un(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function hn(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??xr())?.getItem(r(o));if(!s)return null;if(un(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=U(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=U(s);if(!a)throw new TypeError(`[MachTable] Invalid grid state for "${o}".`);let l=JSON.stringify({schemaVersion:2,savedAt:Date.now(),state:a});if(un(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??xr())?.setItem(r(o),l)}catch(a){i(a,"save",o)}},clear(o){try{(n.storage??xr())?.removeItem(r(o))}catch(s){i(s,"clear",o)}}}}var Rr=hn();function Sr(n,e){Rr.save(n,e)}function Mr(n){return Rr.load(n)}function Es(n){Rr.clear(n)}var xs=[[/^(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"]];function pn(n,e){let t=String(n??"");if(e){let r=e[t];if(r)return r;let i=e[t.toLowerCase()];if(i)return i}for(let[r,i]of xs)if(r.test(t))return i;return"neutral"}function fn(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=pn(e.value,n.variantMap),r=n.labelMap?.[String(e.value)]??(e.formatted||String(e.value)),i=document.createElement("span");return i.className=`mach-tag mach-tag--${t}`,i.textContent=r,i}}function mn(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 gn(n){if(n.value==null||n.value==="")return"";let e=f("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var Ar={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 Ft(n,e=14){let t=Ar[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,B=null;function yn(n){B&&n.contains(B)&&q()}function q(n=!1){Z?.remove(),Z=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",vn,!0),document.removeEventListener("keydown",Lr,!0)}function vn(n){Z&&!Z.contains(n.target)&&!B?.contains(n.target)&&q()}function Lr(n){if(!Z)return;if(n.key==="Escape"){n.preventDefault(),q(!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 bn(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&&Ar[n.icon]?t.innerHTML=`${Ft(n.icon,16)}<span>${n.label}</span>`:t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function Rs(n,e){q();let t=f("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let r of e){let i=bn(r,"mach-context-menu-item");i.setAttribute("role","menuitem"),t.appendChild(i)}P(t,n.closest(".mach-root")),document.body.appendChild(t),j(t,n),Z=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",vn,!0),document.addEventListener("keydown",Lr,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function Ss(n,e,t){q();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=Ft("close",16),a.addEventListener("click",()=>q(!0)),o.append(s,a);let l=f("div","mach-action-drawer__body");for(let d of t)l.appendChild(bn(d,"mach-action-drawer__item"));i.append(o,l),r.appendChild(i),r.addEventListener("mousedown",d=>{d.target===r&&q(!0)}),P(r,n.closest(".mach-root")),document.body.appendChild(r),Z=r,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Lr,!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 wn(n){return n.variant??"default"}function Cn(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function kr(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Cn(n),...t?{message:t}:{},params:e}}function Ot(n,e,t){let r=t.api.getOption("actionPolicy");try{r?.onError?r.onError(n,kr(e,t)):console.error("[mach-table] action handler failed",n)}catch(i){console.error("[mach-table] action error policy failed",i,n)}}function Ms(n,e){if(Cn(n).length===0)return!0;let r=e.api.getOption("actionPolicy");if(!r?.canAccess)return!0;try{return r.canAccess(kr(n,e))}catch(i){return Ot(i,n,e),!1}}function Is(n,e){return n.filter(t=>{if(!Ms(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Pr(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 As(n,e,t,r){Promise.resolve(n).catch(i=>Ot(i,e,t)).finally(()=>Pr(e,t,r))}function Ls(n,e,t){try{As(n.onClick(e),n,e,t)}catch(r){Ot(r,n,e),Pr(n,e,t)}}function Ir(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(kr(e,t,r)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(r)}function ks(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Ir(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(r=>Ir(r,n,e)):Ir(t,n,e)}function Ps(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){Ls(e,n,t);return}(async()=>{await ks(e,n)&&await e.onClick(n)})().catch(i=>Ot(i,e,n)).finally(()=>{Pr(e,n,t)})}}function Gs(n,e,t){let r=document.createElement("button");r.type="button",r.className="mach-action-btn";let i=wn(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&&Ar[n.icon]?(r.innerHTML=Ft(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 Ns(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=`${Ft("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:wn(c),disabled:J(c.disabled,r)||J(c.loading,r),pick:u=>{q(),i(c,u)}}));e==="drawer"?Ss(o,t.drawerTitle??a,d):Rs(o,d)}),o}function ke(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return r=>{let i=Is(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=Ps(r);for(let d of s)o.appendChild(Gs(d,r,l));return a.length>0&&o.appendChild(Ns(a,t,n,r,l)),{el:o,destroy:()=>{B&&o.contains(B)&&q()}}}}function me(n,e,t){return n??e??t}function Fs(n,e){let t=e.api.getOption("locale")??{};return{view:me(n.labels?.view,t.actionView,x.actionView),edit:me(n.labels?.edit,t.actionEdit,x.actionEdit),delete:me(n.labels?.delete,t.actionDelete,x.actionDelete),confirm:me(n.labels?.confirm,t.actionConfirm,x.actionConfirm),save:me(n.labels?.save,t.actionSave,x.actionSave),cancel:me(n.labels?.cancel,t.actionCancel,x.actionCancel)}}function Os(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 ke({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 Hs(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 Gr(n={}){return e=>{let t=Fs(n,e);if(e.api.editing.isRowActive(e.rowIndex))return Os(n,e,t);let r=Hs(n,e,t);return ke({actions:r,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var Vs=fn(),Bs=mn(),Tn=Object.freeze({statusTag:Vs,progressBar:Bs,link:gn});var Pe=class{constructor(e){this.onError=e;this.gn=new Set;this.disposed=!1}add(e){let t=!0,r=()=>{if(t){t=!1,this.gn.delete(r);try{e()}catch(i){try{this.onError(i)}catch{}}}};return this.disposed?r():this.gn.add(r),r}A(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.gn].reverse();this.gn.clear();for(let t of e)t()}};function zs(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function _s(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 Ks(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!Kt(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`),zs(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`),_s(n,t,e.issues)}function Dn(n,e){for(let t of n){if(we(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Dn(t.children,e);continue}e.leafIndex++,Ks(t,e)}}function En(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Dn(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 xn=new Set([...yr,...vr]);function Ws(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 $s(n){let e,t=Number.POSITIVE_INFINITY;for(let i of xn){let o=Ws(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 Us(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(...qs(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 qs(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"}),Rn(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 Rn(n){return n.rowKey!=null}function js(n){let e=new Set(["enableColumnResize","pagination","rowKey"]),t=[];for(let r of yr){if(e.has(r)||!Object.prototype.hasOwnProperty.call(n,r))continue;let i=n[r],o=Me[r];br(i,o)||t.push({code:"INVALID_OPTION_VALUE",option:r,message:`${r} \u503C\u7C7B\u578B\u65E0\u6548\uFF0C\u671F\u671B ${o}`})}return t}function Ys(n){let e=[];for(let t of Object.keys(n)){if(xn.has(t))continue;let r=$s(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 Xs(n,e){if(e.mode!=="server")return[];let t=[];Rn(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 Js(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(...Xs(n,t)),e}function Zs(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 Nr(n){let e=n,t=Ys(e);return t.push(...Js(e)),t.push(...Zs(e)),t.push(...js(e)),t.push(...Us(e)),t}function Sn(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 Fr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Qs(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function ea(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let r=Sn(t[2]);if(!r)return!1;let i=Fr(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&&Fr(n,Qs(r))<0;case"~":return i>=0&&Fr(n,[r[0],r[1]+1,0])<0;default:return i===0}}function Mn(n,e){if(!e?.trim())return!0;let t=n?Sn(n):null;return t?e.split("||").some(r=>{let i=r.trim().split(/\s+/).filter(Boolean);return i.length>0&&i.every(o=>ea(t,o))}):!1}function ta(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function Ht(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 Or(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 Ht(d.requires)){let u=t.get(c.key);u?Mn(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 ta(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 Ht(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 ra=["datasource","treeData"],ia=["columnState.","gridState."],na=new Set(["valueFormatter","cellStyle","cellClass"]),oa=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","displayedColumnsChanged","paginationChanged","detailToggled"]),sa=0,Vt=class{constructor(e,t){this.E=!1;this.Cf=0;this.qr=0;this.jl=!1;this.Cs="";this.x=new Pe(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.Ql=0;this.jr=0;this.recentErrors=[];this.dt=null;this.ed=0;this.Ts=0;this.Ds=!1;this.Es=!1;this.xs=null;this.ad=null;this.yn=new Set;let r;this.Yl=new Promise(i=>{r=i}),this.Xl=r,this.gridId=++sa,this.r=Yr(t),this.le=new Ve((i,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",i):this.reportError(i,"eventBus.listener",{eventType:o})});try{if(this.$a(t.dataProcessor),this.n=new Ke(this),this.i=this.x.A(new Je(this)),this.m=new Ze(this),this.o=this.x.A(new Et(this)),this.B=this.x.A(new xt(this)),this.a=this.x.A(new Lt(this)),this.Nr=this.x.A(new Qe(this)),this.Ji=this.x.A(new et(this)),this.yo=this.x.A(new rt(this)),this.l=this.x.A(new ut(this)),this._=new ct(this),this.O=new vt(this),this.re=this.x.A(new Ct),this.Xt=this.x.A(new Tt(i=>this.Tf(i))),this.Ko=this.x.A(new pt(this)),this.columnMenu=this.x.A(new ft(this)),this.gs=this.x.A(new mt(this)),this.an=this.x.A(new gt(this)),this.Bi=this.x.A(new yt(this)),this.Zt=this.x.A(new Pt(this)),this.de=this.x.A(new Gt(this)),this.ne=this.x.A(new kt(this)),this.Ge=this.x.A(new Nt(this)),this.api=on(this),this.V=this.x.A(new bt(this)),this.x.add(()=>this.td()),this.V.init(),this.o.init(e,this.r),this.Bi.init(),this.a.init(),this.yo.init(),this.an.init(),this.Zt.init(),this.ne.init(),this.Ge.init(),this.de.init(),this.i.Qs(this.r.paginationPage,this.r.paginationPageSize),this.n.ar(this.r.columnDefs),this.i.Ot(this.r.advancedFilterModel),this.i.Ht(this.r.quickFilterText),this.zi(),this.rd(this.r.columnDefs),this.ko(t),this.B.Pr(),this.r.datasource?this.i.li().catch(()=>{}):this.i.qe(this.r.rowData),this.r.initialState&&this.api.state.apply(this.r.initialState,{emitEvents:!1}),this.Io(),this.he(),this.de.setData(this.r.pinnedTopRowData,this.r.pinnedBottomRowData),this.Ua(this.r.features),this.E)return;this.qr=requestAnimationFrame(()=>{this.qr=0,this.E||this.emit("gridReady",{}),this.nd()})}catch(i){throw this.api&&this.reportError(i,"grid.constructor"),this.destroy(),i}}$a(e){if(e===this.Jl)return!1;let t=++this.Ql,r=typeof e=="function"?e():e;if(this.E||t!==this.Ql)return r?.destroy?.(),!1;let i=this.Zl;return this.Jl=e,r===this.r.dataProcessor&&i?!1:(this.r.dataProcessor=r,this.Zl=r?this.x.add(()=>r.destroy?.()):void 0,i?.(),!0)}whenReady(){return this.Yl}nd(){this.jl||(this.jl=!0,this.Xl(this.api))}Lc(e){return this.r.components?.cellRenderers?.[e]??Tn[e]}Bc(e){return this.r.components?.cellEditors?.[e]}Df(e){return Ht(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}Ua(e){let t=this.jr+1;if(this.td(),this.E||this.jr!==t)return;let r=Or(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.E||this.jr!==t)return;let o=i.key.trim(),s=this.Df(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 Pe(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.le.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.E||this.jr!==t){this.od(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})}}}td(){this.jr++;let e=[...this.activeFeatures.entries()].reverse();this.activeFeatures.clear();for(let[t,r]of e)this.od(t,r)}od(e,t){t.scope.dispose();try{t.feature.destroy?.()}catch(r){this.reportError(r,"feature.destroy",{key:e})}}s(){return this.E}suspend(){this.ve(),this.api.editing.stop({cancel:!0}),this.Ko.close(),this.columnMenu.close(),this.gs.close(),this.an.hide(),this.Nr.gt(),this.Ji.destroy(),this.a.suspend(),wi(this.o.root),yn(this.o.root);let e=document.activeElement;e instanceof HTMLElement&&this.o.root.contains(e)&&e.blur()}Ft(){return++this.Cf}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 K(e.data,r.field)}g(e){return this.r.locale[e]??x[e]}Ti(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?ye(e.data,o.field,r):!1}ao(e,t,r,i){this.a.hi(e),this.a.Pa([e.rowIndex],[t.id]),this.O.Eo({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})}to(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.f(o);i.push(r.map(a=>!s||s.isDetail||s.isGroup?"":xe(this,s,a,"clipboard")))}return rr(i)}Aa(){let e=this.a.Wt();return e?Te(this.to(e)):Promise.resolve(!1)}ro(e){if(this.E)return;let t=this.n.c(),r=[];for(let i=e.r1;i<=e.r2;i++){let o=this.i.f(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.Jt(r)}Jt(e){this._.Nc(e)}ve(){this._?.kc()}va(e,t,r){if(this.E)return;let i=ir(e);if(i.length===0)return;let o=this.n.c(),s=this.i.I(),a=[],l=t;for(let d of i){let c=this.Ef(l,s);if(!c)break;this.xf(c.node,d,o,r,a),l=c.index+1}this.Jt(a)}Ef(e,t){for(let r=e;r<t;r++){let i=this.i.f(r);if(i&&!i.isDetail&&!i.isGroup)return{index:r,node:i}}return null}Rf(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}xf(e,t,r,i,o){let s=i,a=o.length;for(let l of t){if(s=this.Rf(r,s),s>=r.length)return;let d=r[s];if(!this.l.W(e,d)){s++;continue}let c=this.d(e,d);try{let u=d.colDef.valueParser?oe(this,e,d,l,"clipboard",c):tt(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++}}ru(){let e=this.a.no();if(!e)return Promise.resolve();let t=this._.oo(),r=this.i.f(e.row),i=this.n.c()[e.colIdx];if(!r||!i)return Promise.resolve();let o=this.d(r,i),s=this._.xr([{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.no();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.f(e.row)===r&&this.n.c()[e.colIdx]===i&&this.va(a,e.row,e.colIdx)}).catch(()=>{})}catch{}return Promise.resolve()}emit(e,t){let r={type:e,api:this.api,...t};this.le.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||oa.has(e))&&this.Sf(),r}reportError(e,t,r){let i=this.Mf(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.E&&this.emit("gridError",{code:i,error:e,source:t,context:r})}Mf(e,t){if(ra.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")||na.has(e)?"RENDERER_ERROR":e.toLowerCase().includes("editor")||e==="editable"?"EDITOR_ERROR":e.startsWith("feature.")?"FEATURE_ERROR":ia.some(i=>e.startsWith(i))?"STATE_ERROR":e.startsWith("eventBus.")||e.startsWith("eventHandler.")?"EVENT_HANDLER_ERROR":"GRID_ERROR"}Mo(){return{gridId:this.gridId,version:He,destroyed:this.E,infinite:this.i.p,loading:this.i.bd()||this.r.loading,rowCount:this.i.Gt(),renderedRowCount:this.o.me.querySelectorAll(".mach-row[data-index]").length,columnCount:this.n.X().length,selectedRowCount:this.m.Pe().length,dirtyRowCount:this.V.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.re.snapshot(),updates:this.Xt.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Zr(e,t){this.n.Zr(e,t),this.dr()}dr(){if(this.B.Po(),this.emit("sortChanged",{sortModel:this.n.U()}),this.i.p){this.i.Ae();return}this.i.b(),this.u({data:!0})}vo(e,t){let r=this.i.j();if(t?r[e.id]=t:delete r[e.id],this.i.vr(r),this.B.Ni(),this.emit("filterChanged",{filterModel:this.i.j(),advancedFilterModel:this.i.be()}),this.i.p){this.i.Ae();return}this.i.b(),this.u({data:!0})}$u(){if(this.emit("filterChanged",{filterModel:this.i.j(),advancedFilterModel:this.i.be()}),this.i.p){this.i.Ae();return}this.i.b(),this.u({data:!0})}ut(e,t){this.n.ut(e,t)&&(this.Fe(),this.emit("columnMoved",{colId:e,toIndex:t}))}mi(e){return this.i.mi(e)}ha(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}zt(e){if(!(this.E||e.length===0))for(let t of e){if(this.E)break;this.ha(t,!0)}}Io(){let e=++this.ed,t=this.Ts,r=this.r.persistence;if(!r)return;let{key:i,store:o,sections:s}=r,a;try{a=o?o.load(i):Mr(i)}catch(d){this.reportError(d,"gridState.load");return}let l=d=>{if(!(this.E||e!==this.ed||t!==this.Ts||!d)){this.Ds=!0;try{this.api.state.apply(d,{emitEvents:!1,...s?{sections:s}:{}})}finally{this.Ds=!1}}};a&&typeof a.then=="function"?Promise.resolve(a).then(l).catch(d=>this.reportError(d,"gridState.load")):l(a)}Sf(){let e=this.r.persistence;if(!(!e||this.E||this.Ds)){if(this.Ts++,this.dt&&clearTimeout(this.dt),e.debounceMs===0){this.dt=null,this.Rs();return}this.dt=setTimeout(()=>{this.dt=null,this.Rs()},e.debounceMs)}}Rs(){let e=this.r.persistence;if(!e||this.E)return;let{key:t,store:r,sections:i}=e,o=this.api.state.get(),s=i?zi(o,i):o,a={key:t,...r?{store:r}:{},state:s};if(this.Es){this.xs=a;return}this.sd(a)}sd(e){try{let t=e.store?e.store.save(e.key,e.state):Sr(e.key,e.state);if(!t||typeof t.then!="function")return;this.Es=!0,Promise.resolve(t).catch(r=>this.reportError(r,"gridState.save")).finally(()=>{this.Es=!1;let r=this.xs;this.xs=null,r&&this.sd(r)})}catch(t){this.reportError(t,"gridState.save")}}Xa(){let e=f("div","mach-empty mach-empty--error"),t=f("div","mach-empty__title");t.textContent=this.g("requestFailed");let r=f("div","mach-empty__hint");return r.textContent=this.g("requestFailedHint"),e.append(t,r),e}ja(){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.g("loading"),r.append(i,o),e.append(t,r),e}Ya(){let e=this.r.locale??{},t=e.emptyRows??x.emptyRows,r=e.emptyRowsHint??x.emptyRowsHint,i=f("div","mach-empty"),o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("class","mach-empty__icon"),o.setAttribute("viewBox","0 0 96 84"),o.setAttribute("width","96"),o.setAttribute("height","84"),o.setAttribute("fill","none"),o.setAttribute("aria-hidden","true"),o.innerHTML='<rect x="8" y="10" width="68" height="56" rx="6" fill="#eaf3fe"/><rect x="8" y="10" width="68" height="12" rx="6" fill="#d5e8fd"/><rect x="8" y="19" width="68" height="3" fill="#d5e8fd"/><g stroke="#bcd7f8" stroke-width="2.4" stroke-linecap="round"><line x1="16" y1="32" x2="68" y2="32"/><line x1="16" y1="42" x2="60" y2="42"/><line x1="16" y1="52" x2="64" y2="52"/></g><circle cx="66" cy="52" r="15" fill="#ffffff" stroke="#8fbdf5" stroke-width="3"/><line x1="77" y1="63" x2="86" y2="72" stroke="#8fbdf5" stroke-width="4" stroke-linecap="round"/><line x1="60" y1="52" x2="72" y2="52" stroke="#bcd7f8" stroke-width="2.6" stroke-linecap="round"/>';let s=f("div","mach-empty__title");s.textContent=t;let a=f("div","mach-empty__hint");return a.textContent=r,i.append(o,s,a),i}ko(e){if(!(this.r.suppressWarnings||this.E)){if(e)for(let t of Nr(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.ze().length>0&&console.warn("[mach-table] treeData \u4E0E rowGroup \u4E0D\u652F\u6301\u540C\u65F6\u542F\u7528\uFF0C\u884C\u5206\u7EC4\u5DF2\u88AB\u5FFD\u7565")}}rd(e){if(!(this.r.suppressWarnings||this.E)&&this.ad!==e){this.ad=e;for(let t of En(e))this.yn.has(t)||(this.yn.add(t),console.warn(`[mach-table] ${t}`))}}Fe(){this.Xt.Na({columns:!0})}u(e){this.Xt.Na(e)}Va(e){return this.Xt.batch(e)}Tf(e){this.E||(e.columns?this.If():(e.header&&this.B.Pr(),e.pool?this.a.Lo():e.layout&&this.he()),e.data&&!e.pool&&!e.columns?this.a.ef():e.cells&&this.a.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.de.refresh(),e.summary&&this.ne.refresh(),e.overlays&&this.a.cs())}If(){this.ko(),this.rd(this.n.Xr()),this.a.Vi(),this.B.Pr(),this.a.Lo(),this.he(),this.de.ce(),this.ne.refresh(),this.emit("displayedColumnsChanged",{})}he(){if(this.E)return;let e=this.re.start();this.zi(),this.n.Is(this.o.Ao());let t=this.n.c().map(r=>`${r.id}:${r.currentWidth}`).join("|");this.Cs&&t!==this.Cs&&this.a.Vi(),this.Cs=t,this.o.root.setAttribute("aria-colcount",String(this.n.c().length)),this.B.Ve(),this.a.he(),this.de.Ve(),this.ne.refresh(),this.re.pu(e)}zi(){if(!this.o.root)return;let e=this.r.treeData||this.n.ze().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")}Ze(e=!0){this.E||(this.n.Is(this.o.Ao()),e&&this.a.Vi(),this.B.Ve(),this.a.Hi(),this.a.ds(),this.a.Gr(!0),this.de.Ve(),this.ne.refresh())}destroy(){if(!this.E){if(this.dt&&(clearTimeout(this.dt),this.dt=null,this.Rs()),this.E=!0,this.ve(),this.qr&&cancelAnimationFrame(this.qr),this.qr=0,this.api){this.nd();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.x.dispose(),this.le.clear()}}};function aa(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 Vt(n,e).api}function la(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function da(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:Q(t.filterModel),advancedFilterModel:z(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:la(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function ca(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function ua(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 ha(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 pa(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function fa(n,e,t){if(t==="number"){n.type="rightAligned";return}if(t==="date"){n.valueFormatter=ua(e.format);return}if(t==="boolean"){n.valueFormatter=ca;return}if(t!=="select")return;let r=e.options??[];n.valueFormatter=ha(r),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:r})}function In(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:pa(n,e),cellClass:n.cellClass};return fa(t,n,e),t}function ma(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(In(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(In(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 ga(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?gr(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 Ge={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function ya(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Ge,...n}}function va(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",...Ge,...n}}function ba(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Ge,...n}}function wa(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:ke(r),...Ge,cellRendererParams:void 0}}function Ca(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:Gr(r),...Ge,cellRendererParams:void 0}}function Ta(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function Da(n){return[...n]}function Hr(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Ea(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 xa(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function Ra(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 Sa(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]=Ea(i,o))}}function Ma(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=xa(n,e);r&&(t.components=r);let i=Ra(n,e);return i&&(t.columnTypes=i),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=Hr(n.pagination,e.pagination),t.statusBar=Hr(n.statusBar,e.statusBar),t.watermark=Hr(n.watermark,e.watermark),Sa(t,n,e),t}function An(...n){return n.reduce(Ma,{})}function Ia(n={}){return An({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 Aa(n){return n}function La(n){return n}function ka(n){return n}function Ne(n){return`${typeof n}:${String(n)}`}function Vr(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Ln(n){let e=Math.max(0,Vr(n.ttlMs,3e5)),t=Math.max(1,Math.floor(Vr(n.maxSize,2e3))),r=Math.max(0,Vr(n.batchDelayMs,0)),i=new Map,o=new Map,s=new Map,a=null,l=null,d=!1,c=b=>{let g=i.get(b);if(g){if(g.expiresAt<=Date.now()){i.delete(b);return}return i.delete(b),i.set(b,g),g}},u=(b,g)=>{for(i.delete(b),i.set(b,{label:g,expiresAt:e===0?1/0:Date.now()+e});i.size>t;)i.delete(i.keys().next().value)},h=b=>o.get(b.id)===b,p=(b,g,y)=>{h(b)&&(o.delete(b.id),s.delete(b.id),b.batch&&b.batch.pendingCount--,b.batch=void 0,y?b.reject(y.cause):b.resolve(g))},m=()=>{!d&&s.size>0&&a==null&&l==null&&(a=setTimeout(()=>{R()},r))},v=()=>{if(l?.pendingCount===0){let b=l;l=null,b.controller.abort()}s.size===0&&a!=null&&(clearTimeout(a),a=null),m()},w=(b,g)=>{let y=new Set(b.entries.map(T=>T.id)),D=new Map;for(let T of g){let N=Ne(T.value);y.has(N)&&D.set(N,String(T.label))}for(let T of b.entries){if(!h(T))continue;let N=D.get(T.id);u(T.id,N),p(T,N)}},C=(b,g)=>{let y=[];for(let D of b.entries)h(D)&&(y.push(D.key),p(D,void 0,{cause:g}));if(!(y.length===0||b.controller.signal.aborted))try{Promise.resolve(n.onError?.(g,y)).catch(()=>{})}catch{}},R=async()=>{if(a=null,d||l||s.size===0)return;let b=[...s.values()];s.clear();let g={entries:b,controller:new AbortController,pendingCount:b.length};for(let y of b)y.batch=g;l=g;try{let y=await n.load(b.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=b=>{if(d)return Promise.reject(new Error("[MachTable] Dictionary resolver has been destroyed."));let g=Ne(b),y=c(g);if(y)return Promise.resolve(y.label);let D=o.get(g);if(D)return D.promise;let T,N,_=new Promise((zt,Vn)=>{T=zt,N=Vn}),L={id:g,key:b,promise:_,resolve:T,reject:N};return o.set(g,L),s.set(g,L),m(),_};return{get:b=>c(Ne(b))?.label,resolve:M,async resolveMany(b){let g=await Promise.all(b.map(async y=>[y,await M(y)]));return new Map(g.filter(y=>y[1]!==void 0))},prime(b){if(d)return;let g=new Map;for(let y of b){let D=Ne(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)}v()},invalidate(b){if(b)for(let g of b){let y=Ne(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)}v()},destroy(){d=!0,a!=null&&clearTimeout(a),a=null,l?.controller.abort(),l=null;let b=new Error("[MachTable] Dictionary resolver has been destroyed.");for(let g of o.values())p(g,void 0,{cause:b});i.clear()},get size(){return i.size}}}function Fe(n){return n!=null&&n!==""}function Pa(n){if(!Fe(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function Bt(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function kn(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function Ga(n){if(!Fe(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function Na(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",r=Bt(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),i=Bt(n.locale,{maximumFractionDigits:0}),o=Bt(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=Bt(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=kn(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=kn(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(!Fe(p))return e;let m=Pa(p);return m==null?t:u.format(m*h)},c=u=>({value:h})=>{if(!Fe(h))return e;let p=Ga(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 Fa(n,e={}){return t=>{if(!Fe(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 Pn(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Gn(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function Nn(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function Br(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==1)return null;let t=U({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 Oe(n){if(n==null||typeof n!="object")return null;let e=n,t=Nn(e.id),r=typeof e.name=="string"?e.name.trim().slice(0,120):"",i=Br(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 Fn(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 On(n,e,t={}){let r=Br(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 Hn(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??Pn())?.getItem(i(l));if(!d||Gn(d)>r)return[];let c=JSON.parse(d);return c.schemaVersion!==1||!Array.isArray(c.views)?[]:c.views.flatMap(u=>{let h=Oe(u);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let c=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(Gn(c)>r)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${r} bytes.`);let u=n.storage??Pn();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=Oe(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 Oa(){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 Ha(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??Hn(),i=async()=>(await r.list(t)).flatMap(s=>{let a=Oe(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=Nn(s)??Oa(),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:Fn(n)};return await r.save(t,u),u},async apply(o,s){let a=typeof o=="string"?(await i()).find(d=>d.id===o):Oe(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!On(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 Eh=He;export{qe as BUILTIN_AGG_FUNCS,x as DEFAULT_LOCALE,Se as EVENT_TYPES,Xo as LOCALE_EN,wa as actionsColumn,to as advancedFilterCondition,ro as advancedFilterGroup,On as applyGridViewState,ma as buildColDefsFromSchema,Fn as captureGridViewState,Es as clearGridState,ke as createActionButtonsRenderer,Zt as createAggResolver,Na as createBusinessColumnTypes,Ln as createCachedDictionary,Ta as createColumnHelper,Fa as createDictionaryRenderer,Ia as createEnterprisePreset,aa as createGrid,Ha as createGridViewManager,hn as createLocalGridStateStore,Hn as createLocalGridViewStore,ga as createMachTableCommands,An as createMachTablePreset,mn as createProgressBarRenderer,da as createRemoteExportRequest,Gr as createRowActionsRenderer,fn as createStatusTagRenderer,Da as defineColumns,La as defineGridOptions,ka as defineMachTableConfig,Aa as defineMachTablePreset,Tr as describeFilter,gr as downloadFile,ba as dragColumn,he as escapeHtml,W as formatText,Re as formatTwo,K as getByPath,va as indexColumn,we as isColDefGroup,Kt as isSafePath,gn as linkRenderer,Mr as loadGridState,ur as matchLocaleKey,z as normalizeAdvancedFilterModel,Wt as normalizeColumnFilter,Q as normalizeFilterModel,U as normalizeGridState,Br as normalizeGridViewState,Oe as normalizeSavedGridView,nr as parseCsv,or as parseDelimited,ir as parseTsv,Or as resolveGridFeatures,ms as resolveSaveConflict,pn as resolveTagVariant,Ca as rowActionsColumn,ce as sanitizeFormulaCell,Sr as saveGridState,ya as selectionColumn,ye as setByPath,rr as toTsv,Nr as validateGridOptions,Eh as version};
|
|
6
|
+
`?s+=2:s++;continue}i+=a,s++}return(i!==""||r.length>0)&&(r.push(i),t.push(r)),t}function Oo(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 Te(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return Oo(n)}var Ho=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","F2","Home","End","PageUp","PageDown","Tab"," ","Escape","Delete","Backspace"]),Vo=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),rt=class{constructor(e){this.e=e;this.fa=e=>{if(this.e.r.suppressClipboard||this.e.l.isEditing())return;let t=this.e.a.Wt();if(!t)return;let r=this.e.to(t),i=e.clipboardData;i&&typeof i.setData=="function"?i.setData("text/plain",r):Te(r),e.preventDefault()};this.ma=e=>{if(this.e.r.suppressClipboard||this.e.l.isEditing())return;let t=this.e.a.Wt();if(!t)return;let r=this.e.to(t),i=e.clipboardData;i&&typeof i.setData=="function"?i.setData("text/plain",r):Te(r),this.e.ro(t),e.preventDefault()};this.ga=e=>{if(this.e.r.suppressClipboard||this.e.l.isEditing())return;let t=this.e.a.no();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.va(i,t.row,t.colIdx))};this.Er=e=>{this.e.s()||this.e.l.isEditing()||this.bc(e)||this.wc(e)||Ho.has(e.key)&&(this.Cc(e)||this.Tc(e)||this.Dc(e))}}init(){this.e.o.root.addEventListener("keydown",this.Er),this.e.o.root.addEventListener("copy",this.fa),this.e.o.root.addEventListener("cut",this.ma),this.e.o.root.addEventListener("paste",this.ga)}destroy(){this.e.o.root.removeEventListener("keydown",this.Er),this.e.o.root.removeEventListener("copy",this.fa),this.e.o.root.removeEventListener("cut",this.ma),this.e.o.root.removeEventListener("paste",this.ga)}ya(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.I(),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.vt(l+1,1)}else if(a<0){if(l<=0)return null;a=i.length-1,l=this.vt(l-1,-1)}if(l<0||l>=s)return null;let c=this.e.i.f(l);if(c&&!c.isDetail&&this.e.l.W(c,i[a]))return{rowIndex:l,column:i[a]}}return null}vt(e,t){let r=this.e.i.I(),i=0;for(;e>=0&&e<r;){let o=this.e.i.f(e);if(!o||!o.isDetail)return e;if(e+=t,i++,i>r+2)break}return-1}bc(e){return!(e.ctrlKey||e.metaKey)||e.key.toLowerCase()!=="a"?!1:(this.e.r.rowSelection==="multiple"&&(e.preventDefault(),this.e.m.selectAll(!0)),!0)}wc(e){if(!e.ctrlKey&&!e.metaKey||e.altKey)return!1;let t=e.key.toLowerCase();return t==="z"?(e.preventDefault(),e.shiftKey?this.e.O.redo():this.e.O.undo(),!0):t!=="y"?!1:(e.preventDefault(),this.e.O.redo(),!0)}Cc(e){let t=this.e.a;if(e.key==="Escape")return this.e.ve(),this.e.r.enableRangeSelection&&t.De()&&(e.preventDefault(),t.$t()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;if(!this.e.r.enableRangeSelection)return!0;let r=t.De();return r&&!(r.r1===r.r2&&r.c1===r.c2)&&(e.preventDefault(),this.e.ro(r)),!0}Tc(e){if(this.e.a.T)return!1;let t=this.e.n.c();return this.e.i.I()>0&&t.length>0&&(e.preventDefault(),this.e.a.Ee(0,t[0].id)),!0}Dc(e){let t=this.e.a,r=t.T;if(!r)return;let i=this.e.n.c(),o=i.findIndex(c=>c.id===r.colId),s=this.e.i.I();if(o<0||s===0)return;let a={row:r.rowIndex,colIdx:o},l=this.Ec(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.xc(l.row,l.colIdx);return}d&&t.Ee(l.row,i[l.colIdx].id)}Ec(e,t,r,i){return Vo.has(e.key)?this.Rc(e,t,r.length,i):e.key==="Enter"||e.key==="F2"?this.Sc(e,t,r,i):e.key===" "?(this.Mc(t.row),t):e.key==="Tab"?this.Ic(e,t,r):null}Rc(e,t,r,i){let{row:o,colIdx:s}=t;switch(e.key){case"ArrowUp":o=this.bi(o,this.vt(o-1,-1),i);break;case"ArrowDown":o=this.bi(o,this.vt(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.vt(i-1,-1)));break;case"PageUp":case"PageDown":o=this.Ac(e.key,o,i);break}return{row:o,colIdx:s}}bi(e,t,r){return t>=0&&t<r?t:e}Ac(e,t,r){let i=this.e.o.S.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.bi(t,this.vt(a,s),r)}Sc(e,t,r,i){let o=this.e.i.f(t.row),s=r[t.colIdx];if(o&&!o.isDetail&&s&&this.e.l.W(o,s))return this.e.l.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.vt(t.row+1,1);return{...t,row:this.bi(t.row,a,i)}}Mc(e){let t=this.e.i.f(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Kn(t.id);return}this.e.r.rowSelection!=="none"&&this.e.m.oa(t,!t.selected,this.e.r.rowSelection==="single")}}Ic(e,t,r){let i=this.ya(t.row,r[t.colIdx].id,e.shiftKey?-1:1);return i?(this.e.a.Ee(i.rowIndex,i.column.id),this.e.l.start(i.rowIndex,i.column),t):null}};var G=null;function wi(n){G?.owner&&(n===G.owner||n.contains(G.owner))&&G.close()}function Ci(n){let e=n.target;G?.contains(e)||G?.close()}function ot(){G?.reposition()}function Ti(n){n.key!=="Escape"||!G||(n.preventDefault(),n.stopImmediatePropagation(),G.close(!0))}function Bo(n){G?.close!==n.close&&G?.close(),!G&&(G=n,document.addEventListener("mousedown",Ci,!0),document.addEventListener("keydown",Ti,!0),window.addEventListener("resize",ot),window.addEventListener("scroll",ot,!0))}function zo(n){G?.close===n&&(G=null,document.removeEventListener("mousedown",Ci,!0),document.removeEventListener("keydown",Ti,!0),window.removeEventListener("resize",ot),window.removeEventListener("scroll",ot,!0))}function ie(n,e){return e?`${n} ${e}`:n}function nt(n){let e=[];return n.forEach((t,r)=>{t.disabled||e.push(r)}),e}function bi(n,e,t){let r=nt(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 it(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function Y(n){let e=f("div",ie("mach-select-control",n.classNames?.root)),t=f("select",ie("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let r=f("button",ie("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",ie("mach-select-value",n.classNames?.value)),o=f("span",ie("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),r.append(i,o);let s=f("div",ie("mach-select-listbox",n.classNames?.listbox));s.id=_r("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)),N=window.innerHeight-g.bottom-8,_=N<Math.min(y.height,240)&&g.top>N,L=_?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",_)},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(),zo(m),g&&!c&&r.focus({preventScroll:!0}),!0):!1,v=(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")||(Bo({owner:u(),close:m,contains:g=>e.contains(g)||s.contains(g),reposition:p}),d=it(a,t.value),d<0&&(d=nt(a)[0]??-1),P(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,N)=>{let _=document.createElement("option");_.value=T.value,_.textContent=T.label,_.disabled=T.disabled===!0,t.appendChild(_);let L=f("button",ie("mach-select-option",n.classNames?.option));return L.id=`${s.id}-option-${N}`,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",zt=>zt.preventDefault()),L.addEventListener("click",()=>C(N)),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=it(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=nt(a)[0]??-1;else if(g.key==="End"){let D=nt(a);y=D[D.length-1]??-1}else return;g.preventDefault(),g.stopPropagation(),s.classList.contains("mach-select-listbox--open")||w(),v(y)},b=()=>{d=it(a,t.value),h(),n.onChange?.(t.value)};return r.addEventListener("click",()=>{m()||w()}),r.addEventListener("keydown",M),t.addEventListener("change",b),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=it(a,g),h()},setOptions:R,destroy:()=>{c||(c=!0,m(),r.removeEventListener("keydown",M),t.removeEventListener("change",b),e.remove())}}}function Di(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 _o(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function Ko(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 sr(n,e,t){let r=n.colDef,i=typeof r.cellEditor=="string"?r.cellEditor:Ko(e,r.cellEditorParams);if(i==="date"){let a=Di("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=_o(r.cellEditorParams),l=Y({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=Di(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()}}}var ar=new WeakMap,st=new WeakMap,at=new WeakMap;function De(n){let e=ar.get(n);return e||(e={},ar.set(n,e)),e}function lr(n){return ar.get(n)}function Ei(n,e){e?st.set(n,e):st.delete(n)}function xi(n){let e=st.get(n);return st.delete(n),e}function Ri(n,e){e?at.set(n,e):at.delete(n)}function dr(n){let e=at.get(n);return at.delete(n),e}function cr(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=lr(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 Si(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 Wo(n,e,t,r,i,o){let s=lr(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 X(n,e,t){return ue(n,e,t,n.d(e,t))}function ue(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 cr(r)}function lt(n,e,t,r){let i=r.colDef.cellStyle,o=De(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 dt(n,e,t,r){let i=n.d(t,r),o=X(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(Wo(n,e,t,r,a,l)){Si(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=De(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;Si(n,e,t,r,i,o)}function $o(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}(le(e.colDef,"rightAligned")||le(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function Uo(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 qo(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 Ee(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];$o(o,r,i),Uo(n,o,t,r,i),qo(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function ne(n){return n!=null&&typeof n.then=="function"}var ct=class{constructor(e){this.e=e;this.generation=0}kc(){this.generation++}oo(){let e=++this.generation;return()=>e===this.generation&&!this.e.s()}wi(e){let t=e[0].node,r=this.e.n.X(),i=r.map(a=>this.e.d(t,a)),o=this.xr(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]))}xr(e){let t=e[0].node,r=t.data,i=this.e.n.X(),o=new Set(i),s=e.every(a=>a.node===t&&o.has(a.column));return()=>s&&!this.e.s()&&this.e.i.z(t.id)===t&&t.data===r&&this.e.n.X()===i}Ci(e,t){let r=e.map(o=>this.Pc(o,t)),i=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.Gc(e,t)};return r.some(ne)?Promise.all(r.map(o=>Promise.resolve(o))).then(i):i(r)}Pc(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 ne(d)?d.then(l,a):l(d)}catch(d){return a(d)}}Gc(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.X())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 ne(l)?l.then(s,a):s(l)}catch(l){return a(l)}}so(e,t){let r=[],i=this.xr(e);for(let o of e){if(!t()||!i()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.l.W(o.node,o.column)||!this.e.Ti(o.node,o.column,o.newValue,o.oldValue)){for(let s of r.reverse()){if(!t()||!i())break;this.e.Ti(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"}}Nc(e){let t=this.oo();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.W(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.wi(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Ci(a,d)}}),o=a=>{this.ba(i,a,t)},s=i.map(a=>a.validation);s.some(ne)?Promise.all(s.map(a=>Promise.resolve(a))).then(o):o(s)}ba(e,t,r){let i=e.map(()=>({applied:!1,errors:[]}));if(!r())return i;let o=new Set;this.e.O.wa();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.so(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.xr(s);d.applied=!0;for(let h of s){if(!r()||!u()){d.applied=!1;break}this.e.ao(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.O.Ca()}return o.size&&r()&&(this.e.a.Ye([...o]),this.e.ne.refresh(),this.e.Ge.refresh()),i}};function oe(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 xe(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:ue(n,e,t,i)}var jo='<path d="M3 8.5 6.4 12 13.5 4"/>',Yo='<path d="m4 4 8 8m0-8-8 8"/>';function Mi(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"?jo:Yo}</svg>`,t.addEventListener("mousedown",r=>{r.preventDefault(),r.stopPropagation()}),t}var ut=class{constructor(e){this.e=e;this.v=null;this.D=null;this.oe=null;this.Qe=0;this.Fc=e=>{if(this.v&&!(e.isComposing||e.keyCode===229)){if(e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.se(!1);else if(e.key==="Escape")e.preventDefault(),e.stopPropagation(),this.se(!0);else if(e.key==="Tab"){e.preventDefault(),e.stopPropagation();let t=this.v,r=this.e.yo.ya(t.rowIndex,t.column.id,e.shiftKey?-1:1);this.se(!1).then(i=>{i&&r&&(this.e.a.Bt(r.rowIndex,"nearest"),this.e.a.Ee(r.rowIndex,r.column.id),this.start(r.rowIndex,r.column))})}}}}isEditing(e,t){return this.v?e==null&&t==null?!0:this.v.rowIndex===e&&this.v.column.id===t:this.D?e==null&&t==null?!0:this.Rr(this.D)!==e?!1:t==null||this.D.drafts.has(t):!1}Di(){return this.v!=null}Rd(){return this.v?.node.rowIndex??(this.D?this.Rr(this.D):null)}Ei(e){return this.D?e==null||this.Rr(this.D)===e:!1}W(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.v)return this.v.rowIndex===e&&this.v.column.id===t.id||this.se(!1).then(p=>{p&&!this.v&&!this.D&&this.start(e,t,r)}),!0;let i=this.e.i.f(e);if(!i||i.data==null||!this.W(i,t))return!1;let o=this.e.a.xi(e,t.id);if(!o)return!1;this.e.ve();let s=this.e.d(i,t),a=this.Ta(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=Mi("confirm","Confirm edit"),u=Mi("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.Fc;return a.el.addEventListener("keydown",h),c.addEventListener("click",p=>{p.stopPropagation(),this.se(!1)}),u.addEventListener("click",p=>{p.stopPropagation(),this.se(!0)}),this.v={node:i,column:t,editor:a,rowIndex:e,oldValue:s,cell:o,shell:l,keydown:h,confirmButton:c,cancelButton:u},this.lo(a,t,i),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:i}),!0}startRow(e,t){if(this.v||this.D)return!1;let r=this.e.i.f(e);if(!r||r.data==null||r.isDetail||r.isGroup)return!1;this.e.ve();let i=new Map;for(let l of this.e.n.c()){if(!this.W(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.Ye([e]),i.size===0)return this.D=null,this.e.a.Ye([e]),!1;let s=i.values().next().value,a=(t?i.get(t):void 0)??s;return a?.mounted&&this.lo(a.mounted.editor,a.column,r),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:r,data:r.data}),!0}Da(e,t,r,i){if(this.v)return this.v.node===t&&this.v.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.Ea(s),!this.Oc(e,o,s,i))?(o.drafts.delete(r.id),!1):!0:!1}co(e,t,r){let i=this.D;if(i&&this.Rr(i)===e){let o=i.drafts.get(t);o?.mounted?.cell===r&&this.Ea(o);return}if(this.v?.cell===r){let o=this.v;this.se(!1),this.v===o&&this.se(!0)}}stop(e=!1){this.se(e)}se(e=!1){if(this.D)return this.uo(e);let t=this.v;if(!t)return Promise.resolve(!1);if(e)return this.Qe++,this.oe=null,Promise.resolve(this.Ut(t,!0,t.oldValue));if(this.oe)return this.oe;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.Ut(t,!0,t.oldValue))}try{Object.is(r,t.oldValue)||(r=oe(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.Sr(t.editor,u instanceof Error?u.message:String(u)),Promise.resolve(!1)}try{if(t.editor.isCancelAfterEnd?.(r))return Promise.resolve(this.Ut(t,!0,t.oldValue))}catch(u){return this.e.reportError(u,"cellEditor.isCancelAfterEnd",{colId:t.column.id,rowId:t.node.id}),Promise.resolve(this.Ut(t,!0,t.oldValue))}let i=[{node:t.node,column:t.column,oldValue:t.oldValue,newValue:r}],o=this.e._.wi(i),s=++this.Qe,a=()=>s===this.Qe&&this.v===t&&o(),l=u=>a()?u.length?(this.ho(t,!1),this.Sr(t.editor,u[0].message),!1):this.Ut(t,!1,r):(s===this.Qe&&this.v===t&&this.Ut(t,!0,t.oldValue),!1),d=this.e._.Ci(i,a);if(!ne(d))return Promise.resolve(l(d));this.ho(t,!0);let c=d.then(l).finally(()=>{this.oe===c&&(this.oe=null)});return this.oe=c,c}uo(e=!1){let t=this.D;if(!t)return Promise.resolve(!1);if(e)return this.Qe++,this.oe=null,Promise.resolve(this.Ri(t,!0));if(this.oe)return this.oe;for(let h of t.drafts.values())this.po(h);let r=[];for(let h of t.drafts.values())if(!Object.is(h.oldValue,h.value))try{let p=oe(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.fo(t,[{draft:h,message:p instanceof Error?p.message:String(p)}]),Promise.resolve(!1)}if(r.length===0)return Promise.resolve(this.Ri(t,!1,r));let i=r.map(h=>t.drafts.get(h.column.id)),o=i.map(h=>h.value),s=this.e._.wi(r),a=++this.Qe,l=()=>a===this.Qe&&this.D===t&&s();for(let h of i)h.error=void 0;let d=h=>l()?h.length?(this.fo(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.mo(t,!1),!1):this.Ri(t,!1,r):(a===this.Qe&&this.D===t&&this.Ri(t,!0),!1),c=this.e._.Ci(r,l);if(!ne(c))return Promise.resolve(d(c));t.validating=!0,this.mo(t,!0);let u=c.then(d).finally(()=>{this.oe===u&&(this.oe=null)});return this.oe=u,u}Ut(e,t,r){if(this.v!==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._.so([i],()=>!this.e.s());if(s)return this.ho(e,!1),this.Sr(e.editor,s.message),!1}return this.v=null,o&&this.e.ao(e.node,e.column,e.oldValue,r),this.go(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.Ye([e.node.rowIndex]),this.e.ne.refresh(),this.e.Ge.refresh()),!0}Ri(e,t,r=[]){if(this.D!==e)return!1;let i=t?[]:this.Hc(e,r);if(i==null)return!1;for(let s of e.drafts.values())s.mounted&&this.go(s.mounted,!0),s.mounted=null;if(this.D=null,this.e.s())return!0;let o=this.Rr(e);return this.e.emit("rowEditingStopped",{rowIndex:o,rowNode:e.node,data:e.node.data,cancelled:t,changes:i}),o>=0&&this.e.a.Ye([o]),this.e.ne.refresh(),this.e.Ge.refresh(),!0}Hc(e,t){if(t.length===0)return[];let r=this.e._.so(t,()=>!this.e.s());if(r)return this.fo(e,[{draft:e.drafts.get(r.colId)??e.drafts.get(t[0].column.id),message:r.message}]),null;let i=this.e._.xr(t);this.e.O.wa();try{for(let o of t){if(!i())break;this.e.ao(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.O.Ca()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}Oc(e,t,r,i){let o=this.Ta(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.Vc(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.Sr(o,r.error),t.validating&&(o.el.classList.add("mach-editor-validating"),o.el.setAttribute("aria-busy","true"),o.el.inert=!0),!0}Ea(e){e.mounted&&(this.po(e),this.go(e.mounted,!0),e.mounted=null)}po(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})}}Ta(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.Bc(s.cellEditor)?.(l)??sr(t,i,o):a=sr(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}fo(e,t){e.validating=!1,this.mo(e,!1);for(let{draft:r,message:i}of t)r.error=i,r.mounted&&this.Sr(r.mounted.editor,i);t[0].draft.mounted?.editor.focus?.()}Sr(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})}ho(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)}mo(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)}}lo(e,t,r){try{e.focus?.()}catch(i){this.e.reportError(i,"cellEditor.focus",{colId:t.id,rowId:r.id})}}go(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")}Rr(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}Vc(e,t,r){if(this.D!==t)return;if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.uo(!0);return}if(e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.uo(!1);return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.po(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.lo(l.mounted.editor,l.column,t.node);break}}}destroy(){(this.v||this.D)&&this.se(!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"},Xo={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"},Jo={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 ur(n){return Jo[n]??"matchEquals"}function W(n,e){return n.replace("{n}",String(e))}function Re(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}function hr(n){return n==="blank"||n==="notBlank"}function ht(n){return n===null?"null:":`${typeof n}:${String(n)}`}var pt=class{constructor(e){this.e=e;this.y=null;this.et=null;this.qt=null;this.tt=e=>{if(!this.y)return;let t=e.target;if(!this.y.contains(t)&&!this.qt?.contains(t)){this.close();return}this.qt?.contains(t)||(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.xa()};this.rt=e=>{if(e.key==="Escape"){if(this.xa(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.et===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let r=this.e.i.j()[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.zc(o,e,r):this._c(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.g("reset"),a.addEventListener("click",()=>{this.e.vo(e,null),this.close()});let l=f("button","mach-filter-btn-apply");l.type="button",l.textContent=this.e.g("apply"),l.addEventListener("click",()=>{let c=this.Ra(o);this.e.vo(e,c),this.close()}),s.append(a,l),o.appendChild(s),P(o,this.e.o.root),document.body.appendChild(o),this.y=o,this.et=e.id,j(o,t),document.addEventListener("mousedown",this.tt,!0),document.addEventListener("keydown",this.rt,!0),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.y&&(this.qt?.destroy(),this.qt=null,this.y.remove(),this.y=null,this.et=null,document.removeEventListener("mousedown",this.tt,!0),document.removeEventListener("keydown",this.rt,!0))}destroy(){this.close()}_c(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.Kc(r,s),d=this.Sa(r),c=this.Sa(r,!0);this.Wc(r,s,o,d,c),this.Ma(s,d,c),l.addEventListener("change",()=>{this.Ma(l.value,d,c)}),this.$c(t,e,d,c);let u=f("div","mach-filter-body");u.append(a,d,c),e.appendChild(u),e.dataset.filterType=r}Kc(e,t){let r=Y({ariaLabel:"Filter condition",options:ae[e].map(i=>({value:i,label:this.e.g(ur(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.qt=r,{root:r.el,select:r.native}}xa(e=!1){return this.qt?.close(e)??!1}Sa(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}Wc(e,t,r,i,o){r?.value!=null&&!hr(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))}Ma(e,t,r){t.style.display=hr(e)?"none":"",r.style.display=e==="inRange"?"":"none"}$c(e,t,r,i){let o=s=>{s.key==="Enter"&&(this.e.vo(e,this.Ra(t)),this.close())};r.addEventListener("keydown",o),i.addEventListener("keydown",o)}zc(e,t,r){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let v=new Set;s=[];let w=this.e.i.pe(),C=Math.min(w.length,o?.maxValues??500);for(let R=0;R<C;R++){let M=this.e.d(w[R],t),b=ht(M??null);v.has(b)||(v.add(b),s.push(M))}}let a=new Set(r?.type==="set"?r.values.map(ht):s.map(ht)),l=f("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.g("search");let d=f("div","mach-filter-set-list"),c=[],u=new Map,h=v=>{d.textContent="",c.length=0;let w=v.trim().toLowerCase();for(let C of s){let R=C==null?this.e.g("emptySetLabel"):String(C);if(w&&!R.toLowerCase().includes(w))continue;let M=ht(C);u.set(M,C);let b=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,b.append(g,y),d.appendChild(b),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 v=[...u.entries()];e.dataset.setValues=JSON.stringify(v)})();let m=f("div","mach-filter-body mach-filter-body--set");m.append(l,d),e.appendChild(m)}Ra(e){let t=e.dataset.filterType;if(t==="set")return this.Uc(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(hr(a))return{type:t,conditions:[{match:a}]};let l=o.value;return l===""&&a!=="inRange"?null:t==="number"?this.qc(a,l,s):t==="date"?this.jc(a,l,s):{type:"text",conditions:[{match:a,value:l}]}}Uc(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}}qc(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}]}}jc(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 ft=class{constructor(e){this.e=e;this.y=null;this.et=null;this.Si=null;this.Mi="";this.Mr=new Set;this.tt=e=>{let t=e.target;this.y&&!this.y.contains(t)&&!this.Xc(t)&&this.close()};this.rt=e=>{if(e.key!=="Escape")return;if([...this.Mr].find(r=>r.isOpen())?.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}toggle(e,t){if(this.et===e.id){this.close();return}this.close(),this.open(e,t)}Yc(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.Si=o,o})();this.open(null,t)}close(){this.Ia(),this.Si&&(this.Si.remove(),this.Si=null),this.y?.remove(),this.y=null,this.et=null,document.removeEventListener("mousedown",this.tt,!0),document.removeEventListener("keydown",this.rt,!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.g("columnSettings")));let o=f("div","mach-column-panel-title");if(o.textContent=e?e.colDef.headerName??e.colDef.field??e.id:this.e.g("columnSettings"),i.appendChild(o),e&&e.sortable){let C=f("div","mach-column-panel-actions"),R=(M,b)=>{let g=f("button","mach-column-panel-btn");return g.type="button",g.textContent=this.e.g(M),g.addEventListener("click",()=>{r.sorting.setModel(b?[{colId:e.id,direction:b}]:[]),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.g(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.g("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.g("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.g("columnVisibility"),i.appendChild(h),!e){let C=document.createElement("input");C.type="search",C.className="mach-column-workbench-search",C.placeholder=this.e.g("search"),C.setAttribute("aria-label",this.e.g("search")),C.value=this.Mi,C.addEventListener("input",()=>{this.Mi=C.value.trim().toLocaleLowerCase(),this.bo(p,!0)}),i.appendChild(C)}let p=f("div","mach-column-panel-list");this.bo(p,!e),i.appendChild(p);let m=f("div","mach-filter-footer"),v=f("button","mach-filter-btn-reset");v.type="button",v.textContent=this.e.g("resetAll"),v.addEventListener("click",()=>{r.columns.resetState(),this.close()});let w=f("button","mach-filter-btn-apply");w.type="button",w.textContent=this.e.g("autoSizeAll"),w.addEventListener("click",()=>{r.columns.autoSizeAll(),this.close()}),m.append(v,w),i.appendChild(m),P(i,this.e.o.root),document.body.appendChild(i),this.y=i,this.et=e?e.id:"__standalone__",j(i,t),document.addEventListener("mousedown",this.tt,!0),document.addEventListener("keydown",this.rt,!0)}wo(){if(!this.y)return;let e=this.y.querySelector(".mach-column-panel-list");e&&this.bo(e,this.et==="__standalone__")}bo(e,t){let r=this.e.api;this.Ia(e),e.replaceChildren();let i=this.e.n.X().filter(o=>o.isDetailToggle?!1:!t||!this.Mi?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.Mi));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.wo()});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=Y({ariaLabel:`${d.textContent} ${this.e.g("clearPin")}`,options:[{value:"",label:this.e.g("clearPin")},{value:"left",label:this.e.g("pinLeft")},{value:"right",label:this.e.g("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.wo()}});c.trigger.disabled=!o.movable,c.native.disabled=!o.movable,this.Mr.add(c),s.appendChild(c.el);let u=this.e.n.X().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=u.indexOf(o),p=(m,v,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,v),this.wo()}),C};s.append(p("\u2191",h-1,h<=0),p("\u2193",h+1,h<0||h>=u.length-1))}e.appendChild(s)}}Xc(e){return[...this.Mr].some(t=>t.contains(e))}Ia(e){for(let t of[...this.Mr])e&&!e.contains(t.el)||(t.destroy(),this.Mr.delete(t))}};var mt=class{constructor(e){this.e=e;this.y=null;this.tt=e=>{this.y&&!this.y.contains(e.target)&&this.close()};this.rt=e=>{e.key==="Escape"&&this.close()}}Jc(e){if(e){let o=this.e.i.f(e.rowIndex),s=this.e.n.L(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.a.Wt();if(!t)return null;let r=this.e.i.f(t.r1),i=this.e.n.c()[t.c1];return r&&i?{node:r,column:i}:null}Zc(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}}Qc(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.eu(s,r,i))),e.appendChild(a)}return o}eu(e,t,r){this.close();try{e.action?.()}catch(i){this.e.reportError(i,"contextMenu.action",{colId:r.id,rowId:t.id})}}Co(e,t,r){let i=f("button","mach-context-menu-item");i.type="button",i.textContent=t,i.addEventListener("click",r),e.appendChild(i)}tu(e){let t=this.e;this.Co(e,t.g("menuCopy"),()=>{t.Aa(),this.close()}),!t.r.suppressClipboard&&(this.Co(e,t.g("menuPaste"),()=>{t.ru(),this.close()}),this.Co(e,t.g("menuClearContents"),()=>{let r=t.a.Wt();r&&t.ro(r),this.close()}))}open(e,t,r){this.close();let i=this.Jc(r);if(!i)return;let o=f("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.r.getContextMenuItems){let s=this.Zc(i.node,i.column);if(!s||!this.Qc(o,s,i.node,i.column))return;this.La(o,e,t);return}this.tu(o),this.La(o,e,t)}La(e,t,r){P(e,this.e.o.root),document.body.appendChild(e),this.y=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.tt,!0),document.addEventListener("keydown",this.rt,!0)}close(){this.y&&(this.y.remove(),this.y=null,document.removeEventListener("mousedown",this.tt,!0),document.removeEventListener("keydown",this.rt,!0))}destroy(){this.close()}};var gt=class{constructor(e){this.e=e;this.y=null;this.Ii=0;this.To=0;this.Ir=null;this.Ar=e=>{if(this.e.s()||!this.e.r.tooltipComponent)return;let r=e.target.closest(".mach-cell");if(!r||r===this.Ir)return;this.Do(),this.Ai(),this.Ir=r;let i=this.iu(r);if(!i||r.classList.contains("mach-cell--editing"))return;let o=this.nu(i.node,i.column,i.index);this.ou(o,i.column)&&(this.Ii=window.setTimeout(()=>{this.e.s()||this.Ir!==r||this.su(r,o)},Math.max(0,this.e.r.tooltipShowDelay)))};this.ka=()=>{this.hide()}}init(){let e=this.e.o.me;e.addEventListener("mouseover",this.Ar),e.addEventListener("mouseleave",this.ka)}destroy(){this.Do(),this.Ai();let e=this.e.o.me;e.removeEventListener("mouseover",this.Ar),e.removeEventListener("mouseleave",this.ka),this.Ir=null}hide(){this.Do(),this.Ai(),this.Ir=null}Do(){this.Ii&&(clearTimeout(this.Ii),this.Ii=0),this.To&&(clearTimeout(this.To),this.To=0)}Ai(){this.y&&(this.y.remove(),this.y=null)}iu(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.f(r),o=t?this.e.n.L(t):void 0;return!i||!o||i.isDetail||i.isGroup?null:{node:i,column:o,index:r}}nu(e,t,r){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:X(this.e,e,t),rowIndex:r}}ou(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}su(e,t){this.Ai();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),P(i,this.e.o.root),document.body.appendChild(i),this.y=i,j(i,e,6)}};var yt=class{constructor(e){this.e=e;this.Y=null}init(){this.Y=document.createElement("div"),this.Y.className="mach-watermark",this.Y.setAttribute("aria-hidden","true"),this.Y.style.pointerEvents="none",this.e.o.root.appendChild(this.Y),this.apply()}apply(){if(!this.Y||this.e.s())return;let e=this.e.r.watermarkEnabled?this.e.r.watermarkConfig:null;if(!e||!e.text){this.Y.style.display="none",this.Y.style.backgroundImage="";return}let t=this.au(e);this.Y.style.display="",t?(this.Y.style.backgroundImage=`url(${t})`,this.Y.style.backgroundColor=""):this.Y.style.backgroundImage=""}au(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.lu()?"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}}lu(){return this.e.o.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.Y?.remove(),this.Y=null}};var vt=class{constructor(e){this.e=e;this.stack=[];this.ae=-1;this.pending=null}wa(){this.pending||(this.pending=[])}Ca(){if(!this.pending)return;let e=this.pending;this.pending=null,e.length>0&&this.push(e)}Eo(e){if(this.pending){this.pending.push(e);return}this.push([e])}push(e){let t=Math.max(0,this.e.r.undoStackSize);if(t!==0){for(this.stack.length=this.ae+1,this.stack.push(e);this.stack.length>t;)this.stack.shift();this.ae=this.stack.length-1}}du(){let e=Math.max(0,this.e.r.undoStackSize);if(e===0){this.clear();return}for(;this.stack.length>e;)this.stack.shift(),this.ae--;this.ae<-1&&(this.ae=-1)}canUndo(){return this.ae>=0}canRedo(){return this.ae<this.stack.length-1}undo(){return this.e.ve(),this.canUndo()?(this.apply(this.stack[this.ae],!1),this.ae--,!0):!1}redo(){return this.e.ve(),this.canRedo()?(this.ae++,this.apply(this.stack[this.ae],!0),!0):!1}apply(e,t){let r=this.e,i=[];for(let o of e){let s=r.i.z(o.nodeId),a=r.n.L(o.columnId);if(!s||!a||s.data==null)continue;let l=t?o.newValue:o.oldValue,d=t?o.oldValue:o.newValue;r.Ti(s,a,l,d)&&(r.a.hi(s),r.a.Pa([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.Ye(i),r.ne.refresh(),r.Ge.refresh()}clear(){this.stack=[],this.ae=-1,this.pending=null}};var bt=class{constructor(e){this.e=e;this.changes=new Map;this.xo=!1;this.unsubscribe=null}init(){this.unsubscribe=this.e.le.on("cellValueChanged",e=>{this.xo||this.Eo(e)})}Eo(e){let t=`${e.rowNode.id}\0${e.column.id}`,i=this.changes.get(t)?.originalValue??e.oldValue;Object.is(e.newValue,i)?this.changes.delete(t):this.changes.set(t,{rowId:e.rowNode.id,colId:e.column.id,originalValue:i,value:e.newValue}),this.jt()}getDirtyRowIds(){return[...new Set([...this.changes.values()].map(e=>e.rowId))]}getChanges(){let e=new Map;for(let t of this.changes.values()){let r=this.e.i.z(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.changes.clear();else{let t=new Set(e);for(let[r,i]of this.changes)t.has(i.rowId)&&this.changes.delete(r)}this.jt()}cu(e){for(let t of e)for(let r of t.cells){let i=`${t.rowId}\0${r.colId}`,o=this.changes.get(i);if(o){Object.is(o.value,r.value)?this.changes.delete(i):o.originalValue=r.value;continue}let s=this.e.i.z(t.rowId),a=this.e.n.L(r.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,r.value)||this.changes.set(i,{rowId:t.rowId,colId:r.colId,originalValue:r.value,value:l})}this.jt()}rollback(e){let t=e?new Set(e):null,r=[...this.changes.entries()].filter(([,s])=>!t||t.has(s.rowId));if(r.length===0)return!1;let i=new Set,o=new Set;this.xo=!0;try{for(let[s,a]of r){let l=this.e.i.z(a.rowId),d=this.e.n.L(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.Ti(l,d,a.originalValue,c)&&(o.add(s),this.e.a.hi(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.xo=!1}for(let s of o)this.changes.delete(s);return i.size>0&&this.e.a.Ye([...i]),this.e.ne.refresh(),this.e.Ge.refresh(),this.jt(),o.size>0}Ld(e){if(e.length===0)return;let t=new Set(e);for(let[r,i]of this.changes)t.has(i.rowId)&&this.changes.delete(r);this.jt()}clear(){this.changes.size!==0&&(this.changes.clear(),this.jt())}destroy(){this.unsubscribe?.(),this.unsubscribe=null,this.changes.clear()}jt(){this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var fr=class{constructor(){this.Lr=null;this.Li=0;this.count=0;this.totalMs=0}acquire(){this.Li++,this.uu();let e=!1;return()=>{e||(e=!0,this.Li=Math.max(0,this.Li-1),this.Li===0&&this.disconnect())}}snapshot(){return{count:this.count,totalMs:this.totalMs}}uu(){if(!(this.Lr||typeof PerformanceObserver>"u"))try{this.Lr=new PerformanceObserver(e=>{for(let t of e.getEntries())this.count++,this.totalMs+=t.duration}),this.Lr.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.Lr;this.Lr=null;try{e?.disconnect()}catch{}}},wt=new fr;function pr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var Ct=class{constructor(){this.bt=[];this.ki=[];this.Pi=[];this.Ro=wt.acquire(),this.Gi=wt.snapshot()}start(){return pr()}hu(e,t,r){this.bt.push({duration:Math.max(0,pr()-e),rows:t,columns:r}),this.bt.length>120&&this.bt.shift()}pu(e){this.Ga(this.ki,e)}On(e){this.Ga(this.Pi,e)}snapshot(){let e=this.bt.map(o=>o.duration),t=this.bt[this.bt.length-1],r=[...e].sort((o,s)=>o-s),i=wt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.fu(e),maxRenderMs:r[r.length-1]??0,p95RenderMs:this.So(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.ki.length,p95LayoutMs:this.So(this.ki),modelSampleCount:this.Pi.length,p95ModelMs:this.So(this.Pi),longTaskCount:Math.max(0,i.count-this.Gi.count),longTaskTotalMs:Math.max(0,i.totalMs-this.Gi.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.bt=[],this.ki=[],this.Pi=[],this.Gi=wt.snapshot()}destroy(){this.Ro?.(),this.Ro=null}Ga(e,t){e.push(Math.max(0,pr()-t)),e.length>120&&e.shift()}fu(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}So(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 Ii(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Zo(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Ii(n.rowIds,e.rowIds),rowIndexes:n.rowIndexes==null||e.rowIndexes==null?void 0:[...new Set([...n.rowIndexes,...e.rowIndexes])],columns:Ii(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}function Qo(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:Zo(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 Tt=class{constructor(e){this.apply=e;this.depth=0;this.pending=null;this.flushCount=0;this.requestCount=0;this.coalescedRequestCount=0;this.destroyed=!1}batch(e){if(this.destroyed)return e();this.depth++;try{return e()}finally{this.depth--,this.depth===0&&this.flush()}}Na(e){this.destroyed||(this.requestCount++,this.pending&&this.coalescedRequestCount++,this.pending=Qo(this.pending??{},e),this.depth===0&&this.flush())}flush(){if(this.destroyed||this.depth>0||!this.pending)return;let e=this.pending;this.pending=null,this.flushCount++,this.apply(e)}snapshot(){return{batchDepth:this.depth,flushCount:this.flushCount,requestCount:this.requestCount,coalescedRequestCount:this.coalescedRequestCount,pending:this.pending!=null}}destroy(){this.destroyed=!0,this.pending=null,this.depth=0}};var Ai=Symbol.for("mach-table.adapter.lifecycle.v1");function Li(n,e){Object.defineProperty(n,Ai,{value:e})}function mr(n){let e=n[Ai]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var ki=Symbol.for("mach-table.import.v1");function Pi(n,e){Object.defineProperty(n,ki,{value:{begin:()=>e._.oo(),revision:()=>e.i.mr(),isEditing:()=>e.l.isEditing(),columns:()=>e.n.X(),visibleColumns:()=>e.n.c(),read:(r,i)=>e.d(r,i),editable:(r,i)=>e.l.W(r,i),parse:(r,i,o,s)=>oe(e,r,i,o,"import",s),pasteRows:r=>{let i=[];for(let o of e.i.je())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._.Ci(r,i),guard:r=>e._.wi(r),commitRows:(r,i,o)=>e._.ba(r,i,o)}})}function Gi(n){let e=n[ki];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}var Se=["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 es(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 ts(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):tt(i,o.coerceNumbers!==!1);if(l!=null&&typeof l.then=="function")throw new TypeError("Import parsers must return synchronous values");if(!ye(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function is(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 Ni(n,e,t={},r,i=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);ts(e,s);let a=es(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)&&is(n,c,d-s-1,a,t,l,r,o)}return l}function he(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function gr(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 Me={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 yr=Object.freeze(Object.keys(Me));var vr=new Set(Se.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function br(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 Fi(n){let e={};for(let[t,r]of Object.entries(n)){if(vr.has(t)){(r==null||typeof r=="function")&&(e[t]=r);continue}let i=Me[t];!i||!br(r,i)||(e[t]=r)}return e}var Bi=2e3,wr=1e5,Ie=512,os=1e4;function Oi(n){return Array.isArray(n)?[...new Set(n.slice(0,wr).filter(e=>typeof e=="string"&&e.length>0&&e.length<=Ie))]:[]}function ss(n){if(!Array.isArray(n))return[];let e=new Set,t=wr*Ie;for(let r of n.slice(0,wr)){if(typeof r!="string"||!r.length||e.has(r))continue;let i=r.startsWith(je)?65536:Ie;r.length>i||r.length>t||(e.add(r),t-=r.length)}return[...e]}function Hi(n,e){return typeof n=="number"&&Number.isFinite(n)&&n>=1?Math.floor(n):e}function Vi(n){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:void 0}function as(n,e){let t=Vi(e.flex);for(let r of["width","contentWidth"]){let i=Vi(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 ls(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function ds(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>Ie||e.has(r))return null;e.add(r);let i={colId:r};return ls(i,t),as(i,t),i}function cs(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,Bi)){let i=ds(r,t);i&&e.push(i)}return e}function us(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,Bi)){if(r==null||typeof r!="object")continue;let i=r,o=typeof i.colId=="string"?i.colId.trim():"";!o||o.length>Ie||t.has(o)||i.direction!=="asc"&&i.direction!=="desc"||(t.add(o),e.push({colId:o,direction:i.direction}))}return e}function U(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:cs(e.columns),sortModel:us(e.sortModel),filterModel:Q(e.filterModel),advancedFilterModel:z(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,os):null,pagination:{enabled:t.enabled===!0,page:Hi(t.page,1),pageSize:Hi(t.pageSize,20)},selectedRowIds:Oi(e.selectedRowIds),expandedRowIds:Oi(e.expandedRowIds),expandedGroupIds:ss(e.expandedGroupIds)}}function zi(n,e){let t=U(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 hs(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function Ki(n,e){let t=e?new Set(e.map(String)):null;return n.filter(r=>!t||t.has(r.rowId)).map(r=>({...r,data:hs(r.data),cells:r.cells.map(i=>({...i}))}))}function ps(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 _i(n,e){let t=new Map;for(let r of n??[]){let i=ps(r,e);i&&!t.has(i.rowId)&&t.set(i.rowId,i)}return[...t.values()]}function Wi(n,e){let t=new Set(n.map(d=>d.rowId)),r=_i(e?.conflicts,t),i=new Set(r.map(d=>d.rowId)),o=_i(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 fs(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):K(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 ms(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let r=fs(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 $i(n){return{setData:e=>n.qe(e),transact:e=>n.yr(e),transactAsync:(e,t)=>n.mu(e,t),flushTransactions:()=>n.Fa(),getCount:()=>n.I(),getAt:e=>n.gu(e),getById:e=>n.z(e),forEach:e=>n.Un(e),forEachDisplayed:e=>n.qn(e),reorder:(e,t)=>n.yu(e,t),isRemote:()=>n.p(),reload:e=>n.reload(e),ensureLoaded:(e,t,r)=>n.An(e,t,r),purgeCache:()=>n.Ln(),getCacheSnapshot:()=>n.kn()}}function Ui(n){return{getDefinitions:()=>n.Xr(),setDefinitions:e=>n.ar(e),getState:()=>n.Jr(),setState:e=>n.vu(e),resetState:()=>n.Tn(),setVisible:(e,t)=>n.wn(e,t),setPinned:(e,t)=>n.Cn(e,t),move:(e,t)=>n.ut(e,t),setWidth:(e,t)=>n.Ie(e,t),fit:e=>n.bu(e),autoSize:(e,t)=>n.wu(e,t),autoSizeAll:e=>n.Cu(e),getWorkbenchItems:()=>n.Tu(),openWorkbench:e=>n.Du(e),closeWorkbench:()=>n.Eu()}}function qi(n){return{getRows:()=>n.gi(),getVisibleRows:()=>n.xu(),getNodes:()=>n.Pe(),getIds:()=>n.yi(),setRows:(e,t)=>n.Ru(e,t),setById:(e,t,r)=>n.jn(e,t,r),selectAll:e=>n.selectAll(e),clear:()=>n.deselectAll(),getMode:()=>n.Su(),setMode:e=>n.Mu(e),getRange:()=>n.Ne(),clearRange:()=>n.$t()}}function ji(n){return{startCell:e=>n.Iu(e),startRow:e=>n.Au(e),isRowActive:e=>n.Ei(e),stop:e=>n.Lu(e?.cancel===!0),getChanges:()=>n.getChanges(),getDirtyRowIds:()=>n.getDirtyRowIds(),markSaved:e=>n.ku(e),rollback:e=>n.Pu(e),save:(e,t)=>n.Gu(e,t),undo:()=>n.undo(),redo:()=>n.redo(),canUndo:()=>n.canUndo(),canRedo:()=>n.canRedo()}}function Yi(n){return{get:()=>n.getState(),apply:(e,t)=>n.Oa(e,t)}}function Xi(n){return{get:()=>n.Mo(),getPerformance:()=>n.Nu(),resetPerformance:()=>n.Fu()}}function Ji(n){return{getModel:()=>n.j(),setModel:e=>n.vr(e),getAdvancedModel:()=>n.be(),setAdvancedModel:e=>n.Ot(e),getQuickText:()=>n.br(),setQuickText:e=>n.Ht(e),isPresent:e=>e==null?Object.keys(n.j()).length>0||n.be()!=null||n.br()!=null:n.Ou(e)}}function Zi(n){return{getModel:()=>n.U(),setModel:e=>n.Hu(e)}}function Qi(n){return{isEnabled:()=>n.paginationEnabled(),setEnabled:e=>n.fi(e),getPage:()=>n.getPage(),setPage:e=>n.setPage(e),getPageSize:()=>n.getPageSize(),setPageSize:e=>n.setPageSize(e),getPageCount:()=>n.getPageCount(),getTotalRowCount:()=>n.getTotalRowCount()}}function en(n){return{isRowExpanded:e=>n.isRowExpanded(e),setRowExpanded:(e,t)=>n.isRowExpanded(e)===t?!1:(t?n.Hn(e):n.Bn(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.Vu(e),n.isGroupExpanded(e)===t),setAllGroupsExpanded:e=>e?n.Wn():n.$n(),setAllDetailsExpanded:e=>e?n.zn():n._n()}}function tn(n){return{getRoot:()=>n.Bu(),scrollToRow:(e,t)=>n.Bt(e,t),refreshCells:e=>n.refreshCells(e),refreshLayout:()=>n.refreshLayout(),flush:()=>n.zu(),setOverlay:e=>n.setOverlay(e),getPinnedRows:e=>n.getPinnedRows(e),setPinnedRows:(e,t)=>n.setPinnedRows(e,t)}}function rn(n){return{exportCsv:e=>n._u(e),importCsv:(e,t)=>n.importCsv(e,t),exportMatrix:e=>n.Ha(e),importMatrix:(e,t)=>n.importMatrix(e,t),print:e=>n.print(e),copyRange:()=>n.Ku()}}function Dt(n){return te(n?.reason,"The operation was aborted")}function nn(n,e){return We(n,e,()=>Dt(e))}function gs(){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 Ae(n,e,t,r=!1){let i=F(n,t,r);return i===void 0||i===e?void 0:i}var Cr=class{constructor(e){this.e=e;this.Yt=null;this.kr=[];this.it=null}batch(e){return this.e.Va(()=>e(this.e.api))}zu(){this.e.Xt.flush()}Bu(){return this.e.s()?null:this.e.o.root}qe(e){this.e.s()||(this.e.r.rowData=e??[],!this.e.i.p&&(this.e.i.qe(e),this.e.u({data:!0})))}yr(e){if(this.e.s()||this.e.i.p)return;let t=this.e.i.yr(e);this.Ba(t)}mu(e,t={}){if(this.e.s()||this.e.i.p)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(Dt(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(Dt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.kr.push(s)});return this.it==null&&(this.it=setTimeout(()=>this.Fa(),this.e.r.asyncTransactionWaitMillis)),r}Fa(){this.it!=null&&clearTimeout(this.it),this.it=null;let e=this.kr;this.kr=[];let t=e.filter(r=>!r.aborted).map(r=>r.transaction);if(t.length>0&&!this.e.s()&&!this.e.i.p){let r=this.e.i.kd(t);this.Ba(r)}for(let r of e)r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort),r.aborted||r.resolve()}Ba(e){if(e.pipelineChanged){this.e.u({data:!0});return}e.updatedRowIds.length!==0&&this.e.u({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}Xr(){return this.e.n.Xr()}ar(e){this.e.s()||(this.e.r.columnDefs=e??[],this.e.n.ar(e),this.e.Io(),this.e.Fe(),this.e.i.p?this.e.i.Ae():(this.e.i.b(),this.e.u({data:!0})))}Jr(){return this.e.n.Jr()}vu(e){this.e.s()||(this.e.n.Ls(e),this.e.Fe())}Tn(){this.e.s()||(this.e.n.Tn(),this.e.Fe())}wn(e,t){this.e.s()||(this.e.n.wn(e,t),this.e.Fe(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}ut(e,t){this.e.s()||this.e.ut(e,t)}Cn(e,t){this.e.s()||(this.e.n.Cn(e,t),this.e.Fe())}Ie(e,t){if(this.e.s())return!1;let r=this.e.n.L(e);return!r||!this.e.n.Ie(r,t)?!1:(this.e.Ze(),this.e.zt([r]),!0)}bu(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.Ao();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=_e(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.As(d,s[c]):this.e.n.Ie(d,s[c]));this.e.Ze(),this.e.zt(l)}wu(e,t=!1){if(this.e.s())return;let r=this.e.n.L(e);r&&this.za(r,t)&&(this.e.Ze(),this.e.zt([r]))}za(e,t){var c;if(this.e.r.columnLayout==="fit"&&e.colDef.suppressSizeToFit)return!1;if(e.hasCheckbox||e.isDetailToggle)return this.e.n.Ie(e,e.isDetailToggle?38:46);this[c="Yt"]??(this[c]=document.createElement("canvas"));let r=this.Yt.getContext("2d");if(!r)return!1;let i=window.getComputedStyle(this.e.o.root);r.font=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;let o=0,s=u=>{if(!u)return;let h=r.measureText(u).width;h>o&&(o=h)};t||s(e.colDef.headerName??e.colDef.field??e.id);let a=this.e.i.pe(),l=Math.min(a.length,2e3);for(let u=0;u<l;u++)s(X(this.e,a[u],e));let d=(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu?22:0)+28;return this.Wu(e,Math.ceil(o)+d)}Wu(e,t){return this.e.r.columnLayout==="fit"?this.e.n.As(e,t):this.e.n.Ie(e,t)}Cu(e){if(this.e.s())return;let t=[];for(let r of this.e.n.c())this.za(r,e??!1)&&t.push(r);t.length>0&&(this.e.Ze(),this.e.zt(t))}U(){return this.e.n.U()}Hu(e){this.e.s()||(this.e.n.dr(e),this.e.dr())}j(){return this.e.i.j()}vr(e){if(!this.e.s()){if(this.e.i.vr(e),this.e.B.Ni(),this.Fi(),this.e.i.p){this.e.i.Ae();return}this.e.i.b(),this.e.u({data:!0})}}be(){return this.e.i.be()}Ot(e){if(!(this.e.s()||!this.e.i.Ot(e))){if(this.Fi(),this.e.i.p){this.e.i.Ae();return}this.e.i.b(),this.e.u({data:!0})}}Fi(){this.e.emit("filterChanged",{filterModel:this.e.i.j(),advancedFilterModel:this.e.i.be()})}Ou(e){return Object.prototype.hasOwnProperty.call(this.e.i.j(),e)}Ht(e){this.e.s()||(this.e.r.quickFilterText=e!=null&&e.trim()!==""?e:null,this.e.i.Ht(e)&&this.e.$u())}br(){return this.e.i.br()}Su(){return this.e.r.rowSelection}Mu(e){this.e.s()||this.e.r.rowSelection!==e&&(this.e.r.rowSelection=e,e==="none"&&this.deselectAll(),this.e.B.Pr(),this.e.a.Lo())}Pe(){return this.e.m.Pe()}gi(){return this.e.m.gi()}jn(e,t=!0,r=!0){this.e.m.jn(e,t,r)}selectAll(e=!0){this.e.m.selectAll(e)}deselectAll(){this.e.m.deselectAll()}I(){return this.e.i.I()}gu(e){return this.e.i.f(e)}z(e){return this.e.i.z(e)}Un(e){this.e.i.Un(e)}qn(e){this.e.i.qn(e)}Bt(e,t="top"){this.e.a.Bt(e,t)}Hn(e){return this.e.s()?!1:this.e.i.Hn(e)}Bn(e){return this.e.s()?!1:this.e.i.Bn(e)}isRowExpanded(e){return this.e.i.isRowExpanded(e)}zn(){this.e.s()||this.e.i.zn()}_n(){this.e.s()||this.e.i._n()}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)}Vu(e){return this.e.s()?!1:this.e.i.Kn(e)}yu(e,t){return this.e.s()||this.e.l.isEditing()?!1:this.e.i.ra(e,t)}isGroupExpanded(e){return this.e.i.isGroupExpanded(e)}Wn(){this.e.s()||this.e.i.Wn()}$n(){this.e.s()||this.e.i.$n()}Ru(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.z(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.Ft()}`)):this.e.i.pe().find(a=>a.data===o);s&&i.push({node:s,selected:!0})}i.length>0?this.e.m.oc(i,t):t&&this.deselectAll()}xu(){let e=new Set(this.e.m.Pe().map(t=>t.id));return this.e.i.je().filter(t=>!t.isDetail&&!t.isGroup&&e.has(t.id)).map(t=>t.data).filter(Boolean)}yi(){return this.e.m.yi()}undo(){return this.e.s()?!1:this.e.O.undo()}redo(){return this.e.s()?!1:this.e.O.redo()}canUndo(){return this.e.O.canUndo()}canRedo(){return this.e.O.canRedo()}getDirtyRowIds(){return this.e.V.getDirtyRowIds()}getChanges(){return this.e.V.getChanges()}ku(e){this.e.V.markSaved(e)}async Gu(e,t){let r=Ki(this.e.V.getChanges(),t);if(r.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let i=this.e.i.mr(),o=Wi(r,await e(r));return!this.e.s()&&i===this.e.i.mr()&&this.e.V.cu(o.saved),o}Pu(e){return this.e.V.rollback(e)}setPinnedRows(e,t){if(this.e.s())return;let r=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.r[r]=t??[],this.e.de.setRows(e,this.e.r[r])}getPinnedRows(e){return this.e.de.getRows(e)}Ne(){return this.e.a.Ne()}$t(){this.e.s()||this.e.a.$t()}Ku(){return this.e.s()?Promise.resolve(!1):this.e.Aa()}Du(e){this.e.s()||this.e.columnMenu.Yc(e)}Eu(){this.e.columnMenu.close()}Tu(){return this.e.n.X().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.he(),this.e.a.Oi(!0))}p(){return this.e.i.p}reload(e={}){return this.e.s()?Promise.resolve():e.signal?.aborted?Promise.reject(Dt(e.signal)):this.e.i.p?nn(this.e.i.li(e.signal),e.signal):(this.e.i.qe(this.e.r.rowData),this.e.u({data:!0}),Promise.resolve())}An(e,t,r={}){return this.e.s()?Promise.resolve():nn(this.e.i.An(e,t,r.signal),r.signal)}Ln(){this.e.s()||this.e.i.Ln()}kn(){return this.e.i.kn()}paginationEnabled(){return this.e.i.we}fi(e){this.e.s()||this.e.i.fi(e)}getPage(){return this.e.i.Cr()}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(nr(e,t.separator??","),{...i,parseValue:r?o=>r({...o,value:o.value}):void 0})}importMatrix(e,t={}){if(this.e.s()||this.e.i.p||!Array.isArray(e)||!e.length)return!1;try{let r=Gi(this.e.api),i=t.mode==="paste"?r.pasteRows(e.length):void 0,o=Ni(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.Jt(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.yr({add:s}):this.qe(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.Zs().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${r.map(d=>`<th>${he(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=i.map(d=>`<tr>${r.map(c=>{let u=X(this.e,d,c);return`<td>${he(u)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${he(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>${he(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}}Iu(e){let t=this.e.n.L(e.colId);return t?this.e.l.start(e.rowIndex,t,e.keyPress??null):!1}Au(e){return this.e.l.startRow(e)}Ei(e){return this.e.l.Ei(e)}Lu(e){return this.e.l.se(e??!1)}refreshCells(e){let t=e==null||e.rowIds==null&&e.rowIndexes==null&&e.columns==null;this.e.u({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.r[e]}updateOptions(e){this.e.s()||(this.e.ko(e),e=Fi(e),Object.keys(e).length!==0&&this.e.Va(()=>{let t=gs(),r=this.e.r.columnMenu;this.Uu(e,t),this.qu(e,t),this.ju(e,t),this.Yu(e,t),this.Xu(e),this.Ju(e,t),this.Zu(e,t),this.Qu(e,t),this.eh(e,t),this.th(e,t),this.rh(e,t,r)}))}Uu(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.ih(e)}ih(e){for(let t of Se){let r=`on${t.charAt(0).toUpperCase()}${t.slice(1)}`;S(e,r)&&Object.assign(this.e.r,{[r]:e[r]})}}qu(e,t){let r=this.e.r,i=Ae(e.rowHeight,r.rowHeight,1),o=Ae(e.headerHeight,r.headerHeight,1),s=Ae(e.rowBuffer,r.rowBuffer,0,!0),a=Ae(e.detailRowHeight,r.detailRowHeight,1);i!==void 0&&(r.rowHeight=i,t.needsRelayout=!0),o!==void 0&&(r.headerHeight=o,t.needsRelayout=!0,t.needsHeaderRebuild=!0),s!==void 0&&(r.rowBuffer=s,t.needsRelayout=!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.nh(r.domLayout),t.needsPoolRebuild=!0),A(e,r,["multiSort"]),a!==void 0&&(r.detailRowHeight=a,this.e.a.Hi(),this.e.a.Gr(!0))}ju(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"])}Yu(e,t){let r=this.e.r;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==r.enableColumnResize&&(this.e.Nr.gt(),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.Zt.ce(),this.e.Ge.ce()),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=Ae(e.undoStackSize,r.undoStackSize,0,!0);i!==void 0&&(r.undoStackSize=i,this.e.O.du());let o=F(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(r.asyncTransactionWaitMillis=o),this.oh(e,t),this.sh(e)}oh(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.Vi(),t.needsRelayout=!0}sh(e){let t=this.e.r;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.$t()),A(e,t,["tooltipComponent"],!0);let r=F(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._a(e.theme),this.e.Bi.refresh())}Xu(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.fi(i),typeof r=="object"&&r&&this.ah(r),t.paginationEnabled&&this.e.i.Bd(),this.e.Zt.ce()}ah(e){let t=this.e.r;t.paginationMode=e.mode==="server"?"server":"client";let r=F(e.page,1,!0),i=F(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)}Ju(e,t){S(e,"rowStyleRules")&&(this.e.r.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.needsCellRefresh=!0,this.e.u({pinned:!0})),this.lh(e,t),this.dh(e,t);let r=this.e.r;e.stripedRows!=null&&e.stripedRows!==r.stripedRows&&(r.stripedRows=e.stripedRows,this.e.o.ch(e.stripedRows)),e.showCellBorders!=null&&e.showCellBorders!==r.showCellBorders&&(r.showCellBorders=e.showCellBorders,this.e.o.uh(e.showCellBorders))}lh(e,t){let r=this.e.r;e.watermark!==void 0&&(Object.assign(r,qt(e)),this.e.Bi.refresh()),this.hh(e),S(e,"summaryMethod")&&(r.summaryMethod=e.summaryMethod,t.needsSummaryRefresh=!0)}hh(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.Ge.ce())}dh(e,t){let{size:r}=e;if(r==null||!S(ve,r)||r===this.e.r.size)return;let i=ve[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.ph(r),t.needsRelayout=!0,t.needsHeaderRebuild=!0}Zu(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.fh(e),this.mh(e)}fh(e){let t=this.e.r,r=!1;for(let i of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])S(e,i)&&(t[i]=e[i]??be[i],r=!0);r&&this.e.o.Ka(t)}mh(e){let t=this.e.r;for(let r of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])S(e,r)&&(t[r]=e[r]??be[r]);A(e,t,["allowUnsafeOverlayHtml"]),S(e,"className")&&(t.className=e.className??"",this.e.o.Wa(t.className)),A(e,t,["loading"]),S(e,"error")&&(t.error=e.error??null)}Qu(e,t){this.gh(e,t),this.yh(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.Ot(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"])}gh(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.zi()),e.quickFilterText!==void 0&&this.Ht(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==r.defaultColDef&&(r.defaultColDef={...$t,...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})=>Ut(i,o):void 0,t.needsRowRebuild=!0}}yh(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.zi()),e.childrenKey!=null&&e.childrenKey!==r.childrenKey&&(r.childrenKey=e.childrenKey,t.needsRowRebuild=!0),A(e,r,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.needsCellRefresh=!0)}eh(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.vh(e,t),this.bh(e,t)}vh(e,t){let r=this.e.r;S(e,"dataProcessor")&&this.e.$a(e.dataProcessor)&&(t.needsRowRebuild=!0);let i=F(e.dataProcessorMinRows,1,!0);i!==void 0&&i!==r.dataProcessorMinRows&&(r.dataProcessorMinRows=i,t.needsRowRebuild=!0)}bh(e,t){let r=this.e.r;S(e,"persistence")&&(r.persistence=Be(e.persistence),t.needsStateLoad=!0)}th(e,t){this.wh(e,t),this.Ch(e,t),this.Th(e,t),this.Dh(e)}wh(e,t){let r=this.e.r;for(let o of["blockSize","maxBlocksInCache","datasourceMaxConcurrentRequests"]){let s=F(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=F(e[o],0,!0);s!==void 0&&(r[o]=s)}let i=F(e.datasourceRetryJitter,0);i!==void 0&&(r.datasourceRetryJitter=Math.min(1,i))}Ch(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:F(e.datasourceRowCount,0,!0)??null;i!==r.datasourceRowCount&&(r.datasourceRowCount=i,t.datasourceChanged=!0)}}Th(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.Zt.ce()),A(e,r,["detailRowRenderer","isRowExpandable"],!0)&&(t.needsCellRefresh=!0)}Dh(e){let t=this.e.r;e.pinnedTopRowData!==void 0&&(t.pinnedTopRowData=e.pinnedTopRowData??[],this.e.de.setRows("top",t.pinnedTopRowData)),e.pinnedBottomRowData!==void 0&&(t.pinnedBottomRowData=e.pinnedBottomRowData??[],this.e.de.setRows("bottom",t.pinnedBottomRowData))}rh(e,t,r){let i=this.e.r;t.needsColumnRebuild&&(this.e.n.ar(i.columnDefs),this.e.Fe(),t.needsHeaderRebuild=!1,t.needsPoolRebuild=!1),t.needsStateLoad&&(this.e.Io(),this.e.Fe()),t.needsFeatureReload&&this.e.Ua(i.features),this.Eh(t),t.filterChanged&&(this.Fi(),!t.datasourceChanged&&!t.needsRowRebuild&&(this.e.i.p?this.e.i.Ae():(this.e.i.b(),this.e.u({data:!0})))),t.needsRelayout&&this.e.o.xh(i.rowHeight,i.headerHeight),e.columnMenu!=null&&e.columnMenu!==r&&(t.needsHeaderRebuild=!0),t.stateToApply&&this.Oa(t.stateToApply),this.e.u({layout:t.needsRelayout,header:t.needsHeaderRebuild,pool:t.needsPoolRebuild,cells:t.needsCellRefresh&&!t.needsPoolRebuild?!0:void 0,summary:t.needsSummaryRefresh,overlays:!0})}Eh(e){if(e.datasourceChanged){this.e.i.xd();return}if(e.needsRowRebuild){if(this.e.i.p){this.e.i.Ae();return}this.e.i.qe(this.e.r.rowData),this.e.u({data:!0})}}_u(e={}){let t=this.Ha({...e,target:"csv",protectFormulas:!1});return vi(t,e)}Ha(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.m.Pe().slice().sort((o,s)=>o.rowIndex-s.rowIndex):e.onlyAllDisplayed?this.e.i.je():this.e.i.Zs();return[...r,...i.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=xe(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:ce(a)}))]}getState(){return{version:2,columns:this.Jr(),sortModel:this.U(),filterModel:this.j(),advancedFilterModel:this.be(),quickFilterText:this.br(),pagination:{enabled:this.paginationEnabled(),page:this.getPage(),pageSize:this.getPageSize()},selectedRowIds:this.yi(),expandedRowIds:this.e.i.Ud(),expandedGroupIds:this.e.i.qd()}}Oa(e,t={}){if(this.e.s())return;let r=U(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.Rh(r,o),this.Sh(r,o),t.emitEvents!==!1&&this.Mh(o)}Rh(e,t){t.has("columns")&&this.e.n.Ls(e.columns??[]),t.has("sort")&&this.e.n.dr(e.sortModel??[]),t.has("filter")&&(this.e.i.vr(e.filterModel??{}),this.e.i.Ot(e.advancedFilterModel),this.e.i.Ht(e.quickFilterText)),t.has("expansion")&&this.e.i.jd(e.expandedRowIds??[],e.expandedGroupIds??[]),t.has("pagination")&&e.pagination&&(this.e.r.paginationEnabled=e.pagination.enabled&&!this.e.i.p,this.e.i.Qs(e.pagination.page,e.pagination.pageSize),this.e.Zt.ce())}Sh(e,t){t.has("columns")&&this.e.Fe(),this.e.i.p?this.e.i.Ae():(this.e.i.b(),this.e.u({data:!0})),this.e.B.Po(),this.e.B.Ni(),t.has("selection")&&this.e.m.Zd(e.selectedRowIds??[])}Mh(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.U()}),e.has("filter")&&this.Fi(),e.has("pagination")&&this.e.emit("paginationChanged",{page:this.getPage(),pageSize:this.getPageSize(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Mo(){return this.e.Mo()}Nu(){return this.e.re.snapshot()}Fu(){this.e.re.reset()}setOverlay(e){if(e!=="loading"&&e!=="noRows"&&e!=="error"){this.e.o.qa();return}let t=this.e.r,r=e==="loading"?t.overlayLoadingTemplate||this.e.ja():e==="noRows"?t.overlayNoRowsTemplate||this.e.Ya():t.overlayErrorTemplate||this.e.Xa();this.e.o._i(e,r,t.allowUnsafeOverlayHtml)}on(e,t){return this.e.le.on(e,t)}destroy(){this.it!=null&&clearTimeout(this.it),this.it=null;let e=this.kr;this.kr=[];for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},ys={rows:$i,columns:Ui,selection:qi,editing:ji,filtering:Ji,sorting:Zi,pagination:Qi,hierarchy:en,view:tn,state:Yi,io:rn,diagnostics:Xi};function on(n){let e=new Cr(n),t={};for(let[r,i]of Object.entries(ys)){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()}),Pi(t,n),Li(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.l.isEditing()&&n.V.getDirtyRowIds().length===0,readCell:(r,i)=>{let o=n.i.z(r),s=n.n.L(i);return o&&s?tr(xe(n,o,s,"clipboard")):""},writeInput:r=>n.Jt(r.flatMap(({rowId:i,colId:o,value:s})=>{let a=n.i.z(i),l=n.n.L(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var vs=["compact","normal","large"],Et=class{constructor(e){this.e=e;this.Or={left:[],center:[],right:[]};this.Kt={};this.Hr=null;this.Fo=null;this.Oo=!1;this.Ui=null;this.Ho=[];this.qi=null;this.Qt=0;this.Ja=-1;this.Za=-1;this.At=1;this.er=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.Wa(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.Ka(t),this.Fr=f("div","mach-header"),this.Fr.setAttribute("role","rowgroup"),this.Or={left:[],center:[],right:[]},this.Go={},this.Kt={};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.Fr.appendChild(o),this.Go[i]=o,this.Kt[i]=s}this.Qa(1),this.me=f("div","mach-body"),this.Ki=f("div","mach-pinned-rows mach-pinned-rows--top"),this.Ki.style.display="none",this.Wi=f("div","mach-pinned-rows mach-pinned-rows--bottom"),this.Wi.style.display="none",this.S={},this.ge={},this.No={};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.me.appendChild(o),this.No[i]=o,this.S[i]=s,this.ge[i]=a}this.Oe=f("div","mach-overlay"),this.Oe.style.display="none",this.Oe.setAttribute("role","status"),this.Oe.setAttribute("aria-live","polite"),this.He=f("div","mach-overlay-content"),this.Oe.appendChild(this.He),this.nt=f("div","mach-infinite-loading"),this.nt.style.display="none",this.nt.appendChild(f("div","mach-spinner")),this.$i=f("span"),this.nt.appendChild(this.$i),this.root.append(this.Fr,this.Ki,this.me,this.Wi,this.Oe,this.nt),e.appendChild(this.root),typeof ResizeObserver<"u"&&(this.qi=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.Ja&&a===this.Za||(this.Ja=s,this.Za=a,!this.Qt&&(this.Qt=requestAnimationFrame(()=>{this.Qt=0,this.e.he()})))}),this.qi.observe(this.root)),this._a(t.theme)}Ka(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")}Qa(e){this.At=e;for(let t of["left","center","right"]){let r=this.Kt[t],i=this.Or[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.tl()}Vo(){return this.At}tl(){this.Fr.style.height=`${this.At*this.e.r.headerHeight}px`;for(let e of["left","center","right"])this.Or[e].forEach((r,i)=>{r.style.top=`${i*this.e.r.headerHeight}px`,r.style.height=`${this.e.r.headerHeight}px`})}Ih(e,t){this.rl("left",e),this.rl("right",t)}rl(e,t){let r=this.Go[e],i=this.No[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)}Ao(){let e=this.S.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.me.clientWidth-t)}xh(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.tl()}ph(e){for(let t of vs)this.root.classList.toggle(`mach-size--${t}`,t===e)}_a(e){if(!this.root)return;this.er?.(),this.er=null;let t=e==="dark"||e==="auto"&&this.Ah();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.er=()=>r.removeEventListener("change",i)):typeof r.addListener=="function"&&(r.addListener(i),this.er=()=>r.removeListener(i))}}Ah(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}ch(e){this.root.classList.toggle("mach-striped",e)}uh(e){this.root.classList.toggle("mach-cell-borders",e)}nh(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}Wa(e){for(let t of this.Ho)this.root.classList.remove(t);this.Ho=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.Ho.push(t))}Lh(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}kh(e,t,r){if(typeof t=="object"&&t!=null&&"el"in t){this.He.appendChild(t.el),this.Ui=t.destroy??null;return}if(t instanceof HTMLElement){this.He.appendChild(t);return}if(t){r?this.He.innerHTML=t:this.He.textContent=t;return}if(e!=="loading")return;let i=f("div","mach-spinner");i.setAttribute("aria-label","loading"),this.He.appendChild(i)}_i(e,t,r=!1){this.Hr===e&&this.Fo===t&&this.Oo===r||(this.Hr=e,this.Fo=t,this.Oo=r,this.Bo(),this.He.replaceChildren(),this.kh(e,this.Lh(t),r),this.Oe.style.display="",this.Ph(e),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}qa(){this.Hr&&(this.Hr=null,this.Fo=null,this.Oo=!1,this.Oe.style.display="none",this.Bo(),this.He.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Ph(e){this.Oe.setAttribute("role",e==="error"?"alert":"status")}ft(e,t){this.nt&&(e?(this.$i.textContent!==t&&(this.$i.textContent=t),this.nt.style.display="",this.root.setAttribute("aria-busy","true")):(this.nt.style.display="none",this.Hr!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){this.er?.(),this.er=null,this.qi?.disconnect(),this.qi=null,this.Qt&&cancelAnimationFrame(this.Qt),this.Qt=0,this.Bo(),this.root?.remove()}Bo(){if(!this.Ui)return;let e=this.Ui;this.Ui=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};var bs={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 Tr(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=bs[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 sn(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 pe=class{constructor(){this.offsets=new Float64Array(1)}update(e){let t=0,r=this.offsets.length!==e.length+1;for(let o=0;o<e.length;o++)t+=e[o].currentWidth,!r&&this.offsets[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.offsets=i,!0}il(){return this.offsets[this.offsets.length-1]??0}ot(e){let t=Math.max(0,Math.min(Math.trunc(e),this.offsets.length-1));return this.offsets[t]??0}Gh(e){let t=Math.max(0,this.offsets.length-1);return t===0?-1:Math.min(t-1,Math.max(0,sn(this.offsets,Math.max(0,e))-1))}nl(e,t,r=2){let i=Math.max(0,this.offsets.length-1);if(i===0||t<=0||this.il()<=t)return{first:0,lastExcl:i};let o=Math.max(0,e),s=o+t,a=Math.max(0,sn(this.offsets,o)-1),l=Math.min(i,ws(this.offsets,s));return{first:Math.max(0,a-r),lastExcl:Math.min(i,l+r)}}};var Cs=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function Dr(n){return n instanceof HTMLElement&&n.closest(Cs)!=null}function Er(n){return n==="ArrowLeft"||n==="ArrowRight"}var xt=class{constructor(e){this.e=e;this.ee=[];this.ji=[];this.ol={left:[],center:[],right:[]};this.G=new pe;this.Yi=0;this.Xi=Number.MAX_SAFE_INTEGER}Pr(){this.sl(),this.e.Nr.gt();for(let l of this.ee){let d=dr(l.el);if(d)try{d()}catch(c){this.e.reportError(c,"headerComponent.destroy",{colId:l.column.id})}}this.ee=[],this.ji=[];let e=this.e.n.ud();this.e.o.Qa(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 ee){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.cd(),o=this.e.n.C("center"),s=new Set(o.slice(this.Yi,this.Xi));for(let l of["left","center","right"]){let d=r(i,0,l);this.ol[l]=l==="center"?this.al(d,s):d}let a=this.e.r.headerHeight;for(let l of["left","center","right"]){let d=this.e.o.Or[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.Nh(u.column,e-u.level,a);h.appendChild(p.el),this.ee.push(p)}else if(u.group){let p=this.Fh(u.group);h.appendChild(p),this.ji.push({group:u.group,el:p})}for(let p of u.children)c(p)};for(let u of this.ol[l])c(u)}this.e.r.suppressHeaderFocus||this.ee.forEach((l,d)=>{l.el.tabIndex=d===0?0:-1}),this.Ve(),this.Po(),this.Ni(),this.ui()}ll(){let e=this.Yi,t=this.Xi;this.sl(),(e!==this.Yi||t!==this.Xi)&&this.Pr()}sl(){let e=this.e.n.C("center"),t=this.e.o.S.center;this.G.update(e);let r=e.length>20?this.G.nl(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.Yi=r.first,this.Xi=r.lastExcl}al(e,t){let r=[];for(let i of e){if(i.column){t.has(i.column)&&r.push(i);continue}let o=this.al(i.children,t);o.length>0&&r.push({...i,children:o})}return r}Nh(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.Oh(i,e),this.Hh(i,e);let o=this.Vh(i,e);this.Bh(i,e);let s=f("span","mach-sort-indicator");i.appendChild(s);let{filterBtn:a,filterTagEl:l}=this.zh(i,e);return this._h(i,e),this.Kh(i,e),this.Wh(i,e),{column:e,el:i,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}Oh(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")}Hh(e,t){this.e.r.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.zo(t)),e.addEventListener("keydown",r=>this.$h(r,t)))}Vh(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.m.selectAll(!0):this.e.m.deselectAll()}),e.appendChild(r),r}Bh(e,t){let r=t.colDef,i=r.headerComponent,o;if(!i){this._o(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.Uh(e,t,o)}Uh(e,t,r){if(typeof r=="string"){this._o(e,r);return}if(r instanceof HTMLElement){this.dl(e,r);return}if(r&&typeof r=="object"&&r.el instanceof HTMLElement){this.dl(e,r.el),Ri(e,r.destroy);return}let i=t.colDef;this._o(e,i.headerName??i.field??t.id)}_o(e,t){let r=f("span","mach-header-label");r.textContent=t,e.appendChild(r)}dl(e,t){let r=f("span","mach-header-label mach-header-label--custom");r.appendChild(t),e.appendChild(r)}zh(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=Kr,r.addEventListener("click",o=>{o.stopPropagation(),this.e.Ko.toggle(t,r)}),e.appendChild(r);let i=f("span","mach-filter-tag");return e.appendChild(i),{filterBtn:r,filterTagEl:i}}_h(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.g("columnSettings")}`;r.setAttribute("aria-label",o),r.title=o,r.innerHTML=Ur,r.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,r)}),e.appendChild(r)}Kh(e,t){if(!this.cl(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.Nr.cc(i,t))}),r.addEventListener("dblclick",i=>{i.stopPropagation(),this.e.api.columns.autoSize(t.id)}),r.addEventListener("click",i=>i.stopPropagation()),e.appendChild(r)}Wh(e,t){e.addEventListener("click",r=>{this.e.Ji.mc()||Dr(r.target)||t.sortable&&this.e.Zr(t,r.shiftKey)}),e.addEventListener("pointerdown",r=>{r.button!==0||Dr(r.target)||this.e.Ji.fc(r,t)})}Fh(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}Ve(){let e={left:0,center:0,right:0};for(let t of["left","center","right"]){let r=this.e.o.Or[t],i=0,o=new Map;for(let a of this.e.n.C(t))o.set(a.id,i),i+=a.currentWidth;let s=this.e.r.headerHeight;for(let a of this.ee){if(this.e.n.lr(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.Me(a.column.id)+1))}for(let a of this.ji){let l=this.qh(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.Ih(e.left,e.right)}qh(e,t){return e.getLeafColumns().filter(r=>!r.hide&&this.e.n.lr(r)===t)}$h(e,t){this.e.s()||this.jh(e,t)||this.Yh(e,t)||this.Xh(e,t)||this.Jh(e,t)||this.Zh(e)}jh(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(Dr(e.target)||(e.preventDefault(),t.sortable&&this.e.Zr(t,e.shiftKey)),!0)}Yh(e,t){if(!e.altKey||!Er(e.key))return!1;if(!this.cl(t))return!0;let r=e.key==="ArrowRight"?24:-24,i=Math.max(t.colDef.minWidth??40,t.currentWidth+r);return this.e.n.Ie(t,i),this.e.Ze(),this.e.zt([t]),e.preventDefault(),!0}Xh(e,t){if(!e.ctrlKey||!Er(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let r=this.e.n.lr(t),i=this.e.n.C(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.ut(t.id,a),!0}Jh(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!Er(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.zo(r[s]),!0}Zh(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.zo(t[r]),!0}zo(e){let t=this.ee.find(r=>r.column.id===e.id);if(!t&&!e.pinned&&(this.Qh(e),this.ll(),t=this.ee.find(r=>r.column.id===e.id)),!!t){for(let r of this.ee)r.el.tabIndex=r===t?0:-1;t.el.focus({preventScroll:!0})}}Qh(e){let t=this.e.n.C("center"),r=t.indexOf(e);if(r<0)return;let i=this.e.o.S.center;this.G.update(t);let o=this.G.ot(r),s=o+e.currentWidth;o<i.scrollLeft?i.scrollLeft=o:s>i.scrollLeft+i.clientWidth&&(i.scrollLeft=s-i.clientWidth)}cl(e){return this.e.r.enableColumnResize&&e.resizable}Po(){let e=this.e.n.U(),t=e.length>1;for(let r of this.ee){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"?Wr:$r)+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")}}Ni(){let e=this.e.i.j();for(let t of this.ee){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?Tr(r):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}ui(){for(let e of this.ee)e.selectAllEl&&(e.selectAllEl.checked=this.e.m.ic(),e.selectAllEl.indeterminate=this.e.m.nc())}destroy(){for(let e of this.ee){let t=dr(e.el);if(t)try{t()}catch(r){console.error("[mach-table] headerComponent destroy error",r)}}this.ee=[],this.ji=[]}};var Rt=class{constructor(){this.anchor=null;this.end=null;this.cache=!1;this.Wo=-1;this.$o=-1}ep(){return this.anchor}tr(){return this.end}tp(){return this.anchor!=null}start(e,t){(!t||!this.anchor)&&(this.anchor={...e}),this.end={...e},this.invalidate()}rp(e){return this.anchor?!0:e.colIdx<0?!1:(this.anchor={...e},this.invalidate(),!0)}setEnd(e){this.end={...e},this.invalidate()}clear(){this.anchor=null,this.end=null,this.invalidate()}invalidate(){this.cache=!1,this.Wo=-1,this.$o=-1}normalize(e,t){return this.cache!==!1&&this.Wo===e&&this.$o===t?this.cache:(this.Wo=e,this.$o=t,!this.anchor||!this.end||e<=0||t<=0?(this.cache=null,null):(this.cache={r1:Math.max(0,Math.min(this.anchor.row,this.end.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.anchor.row,this.end.row),e-1)),c1:Math.max(0,Math.min(this.anchor.colIdx,this.end.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.anchor.colIdx,this.end.colIdx),t-1))},this.cache))}};var St=class{constructor(e){this.host=e;this.drag=null;this.ie=0;this.Zi=0;this.Je=e=>{let t=this.drag;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.ul()}};this.op=()=>{if(this.ie=0,!!this.drag?.active){if(!this.current()){this.destroy();return}this.Dr(),this.sp()&&this.ul()}};this.Te=e=>{let t=this.drag;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.Dr(),this.hl();try{t.active&&t.drop?.valid&&this.Uo(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.Er=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.yt=e=>{e.type==="pointercancel"&&e.pointerId!==this.drag?.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.drag={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:r,drop:null,active:!1},window.addEventListener("pointermove",this.Je),window.addEventListener("pointerup",this.Te),window.addEventListener("pointercancel",this.yt),window.addEventListener("keydown",this.Er),window.addEventListener("blur",this.yt)}ip(e){return this.drag?.active===!0&&this.sourceContains(e)}np(e,t=()=>!0){this.Zi=requestAnimationFrame(()=>{this.Zi=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(r=>r.closest(".mach-row")?.dataset.id===e)?.focus()})}ul(){this.ie||(this.ie=requestAnimationFrame(this.op))}Uo(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}sp(){let e=this.drag;if(!e||!this.Uo(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}Dr(){let e=this.drag;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.Uo(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)`}hl(){let e=this.drag;this.drag=null,window.removeEventListener("pointermove",this.Je),window.removeEventListener("pointerup",this.Te),window.removeEventListener("pointercancel",this.yt),window.removeEventListener("keydown",this.Er),window.removeEventListener("blur",this.yt),cancelAnimationFrame(this.ie),this.ie=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.hl(),this.release(),cancelAnimationFrame(this.Zi),this.Zi=0}};function an(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 Mt=class extends St{constructor(t,r,i,o){super({get root(){return t.o.root},get body(){return t.o.me},get viewport(){return t.o.S.center},get containers(){return Object.values(t.o.ge)},getRowTop:r,findRowAt:i,scrollBy:o});this.e=t;this.scope=null}pl(t){return!t.loading&&!t.treeLoading&&!t.isGroup}fl(t){if(this.e.l.isEditing()||t.isDetail||!this.pl(t)||t.data==null||this.e.n.ze().length||this.e.r.applyRowDrag&&!this.e.i.ta())return!1;let r=this.rr("canDrag",()=>this.e.r.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return r!==!0?r:!this.e.i.N||!!mr(this.e.api)}canDrag(t){return this.fl(t)===!0}isSource(t){return this.qo()?.isSource(t)??this.ip(t.id)}start(t,r){if(this.destroy(),!this.canDrag(r)||t.isPrimary===!1)return;let i=this.qo();if(i){i.start(t,r);return}let o=this.rr("getRevision",()=>this.jo(r),null);o&&(this.scope={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.qo();if(i){i.moveWithKeyboard(t,r);return}let o=t.key==="ArrowUp"?-1:1,s=r.rowIndex+o;for(;this.e.i.f(s)?.isDetail;)s+=o;let a=this.e.i.f(s),l=this.rr("getRevision",()=>this.jo(r),null);if(!(!a||!l)){this.scope={node:r,from:r.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.np(r.id)}finally{this.release()}}}rr(t,r,i){try{return r()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),i}}jo(t){let r=this.e.i,i=this.e.n.X(),o=this.e.r.rowDragPolicy,s=r.mr(),a=r.Rn(),l=this.e.r.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.rr("getRevision",()=>o?.getRevision?.()===d&&s===r.mr()&&a===r.Rn()&&r.z(t.id)===t&&i===this.e.n.X()&&o===this.e.r.rowDragPolicy&&l===this.e.r.applyRowDrag,!1)}}qo(){let t=mr(this.e.api);return t!==this.factory&&(this.driver?.destroy(),this.factory=t,this.driver=t?this.rr("driver",()=>t({...this.host,api:this.e.api,capture:r=>this.jo(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.driver}current(){return this.scope?.guard.current()??!1}release(){this.scope=null}sourceContains(t){return this.scope?.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.I()-1),i=this.e.i.f(r);if(i?.isDetail&&(i=this.e.i.z(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.scope,o=t.rowIndex+Number(r);for(;this.e.i.f(o)?.isDetail;)o++;let s=this.e.r.rowDragPolicy,a=!this.e.r.applyRowDrag||s?.canDrop?an(i.node,u=>this.e.i.f(u),t,r?"after":"before",i.guard.revision):void 0,l=s?.canDrop&&a?this.rr("canDrop",()=>s.canDrop({node:i.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.pl(t),c=typeof l=="string"?l:Re(this.e.r.locale.rowDragPosition??x.rowDragPosition,i.from+1,this.ml(i.from,o)+1);return{node:t,intent:a,boundary:o,valid:d,text:c,position:r?"after":"before"}}commitDrop(t){let r=this.scope;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.f(o)?.isDetail;)o--;if(r.from===o)return!1;let s=this.e.r.applyRowDrag&&this.e.i.ra(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.ml(r.from,i.boundary),applied:s,intent:i.intent}),!0)}ml(t,r){let i=t+1;for(;this.e.i.f(i)?.isDetail;)i++;return r>t?r-(i-t):r}destroy(){this.driver?.destroy(),super.destroy()}};var Ts=new Set(["warning","danger","success","info"]);function Le(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 fe(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&Ts.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 It=class{constructor(){this.sizes=new Float64Array(0);this.tree=new Float64Array(1);this.Yo=new WeakMap;this.wt=new Map;this.st=0}reset(e,t){this.sizes=new Float64Array(e.length),this.tree=new Float64Array(e.length+1),this.Yo=new WeakMap,this.wt=new Map,this.st=0;for(let r=0;r<e.length;r++){this.Yo.set(e[r],r);let i=Math.max(1,t(e[r],r));this.sizes[r]=i,this.Xo(i,1),this.add(r,i)}}get length(){return this.sizes.length}indexOf(e){return this.Yo.get(e)??-1}update(e,t){if(e<0||e>=this.sizes.length)return!1;let r=Math.max(1,t),i=r-this.sizes[e];return Math.abs(i)<.01?!1:(this.Xo(this.sizes[e],-1),this.sizes[e]=r,this.Xo(r,1),this.add(e,i),!0)}ot(e){let t=Math.max(0,Math.min(Math.trunc(e),this.sizes.length)),r=0;for(;t>0;)r+=this.tree[t],t-=t&-t;return r}Jo(){return this.ot(this.sizes.length)}ap(){return this.st}findIndex(e){if(this.sizes.length===0)return 0;let t=Math.max(0,e),r=0,i=0,o=1;for(;o<<1<=this.sizes.length;)o<<=1;for(;o>0;){let s=r+o;s<=this.sizes.length&&i+this.tree[s]<=t&&(r=s,i+=this.tree[s]),o>>=1}return Math.min(r,this.sizes.length-1)}add(e,t){for(let r=e+1;r<this.tree.length;r+=r&-r)this.tree[r]+=t}Xo(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.st=0;else if(t>0&&(this.st===0||e<this.st))this.st=e;else if(t<0&&e===this.st&&!this.wt.has(e)){let i=Number.POSITIVE_INFINITY;for(let o of this.wt.keys())i=Math.min(i,o);this.st=Number.isFinite(i)?i:0}}};var Ds=16e6,At=class{constructor(){this.height=0;this.Ct=0;this.ir=0;this.Qi=NaN;this.Zo=0}configure(e,t,r=!0){this.height=r?Math.min(e,Ds):e,this.Ct=Math.max(0,e-t),this.ir=Math.max(0,this.height-t),this.Qi=NaN}get at(){return this.Ct>this.ir}lp(e){return this.Ct?E(e,0,this.Ct)*this.ir/this.Ct:0}read(e){return e!==this.Qi&&(this.Qi=e,this.Zo=this.ir>0?E(e,0,this.ir)*this.Ct/this.ir:0),this.Zo}anchor(e,t){this.Zo=E(e,0,this.Ct),this.Qi=t}};var O=["left","center","right"];function ln(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 cn(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 Lt=class{constructor(e){this.e=e;this.pool=[];this.xe=0;this.first=0;this.lastExcl=-1;this.Q=0;this.Qo=0;this.es=0;this.gl=0;this.M=new At;this.lt=0;this.ts=!1;this.en=-1;this.$=new It;this.G=new pe;this.F=new Rt;this.tn=!1;this.rs=0;this.ns=Number.MAX_SAFE_INTEGER;this.T=null;this.os=()=>{this.Q||(this.Q=requestAnimationFrame(()=>{this.Q=0,this.Oi()}))};this.ln=0;this.dn=new WeakMap;this.Dt=new Set;this.cn="";this.Vr=[];this.Yt=null;this.as=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.o.S.center,r=e.deltaMode===1?this.e.r.rowHeight:e.deltaMode===2?t.clientHeight:1,i=this.M.read(t.scrollTop);this.un(i+e.deltaY*r),this.M.read(t.scrollTop)!==i&&(e.preventDefault(),t.scrollLeft+=e.deltaX*r,this.os())};this.sn=null;this.zr=null;this.ms=!1;this.cp=null;this.fn=e=>{let t=this.zr;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.Bl(r),a=this.F.tr();a&&a.row!==s&&(this.F.setEnd({row:s,colIdx:a.colIdx}),this.xt(),this.e.emit("rangeSelectionChanged",{range:this.Ne()}));return}let i=Math.max(t.c2+1,this.zl(r)),o=this.F.tr();o&&o.colIdx!==i&&(this.F.setEnd({row:o.row,colIdx:i}),this.xt(),this.Be(),this.e.emit("rangeSelectionChanged",{range:this.Ne()}))};this.or=e=>{let t=this.zr;if(!t)return;let r=e,i=()=>{this.ss()};if(!t.active){i();return}if(t.axis==="h"){let s=typeof r.clientX=="number"?Math.max(t.c2+1,this.zl(r)):t.c2+1;if(i(),s>t.c2)this.rf(t.r1,t.r2,t.c1,t.c2,s),this.Be();else{let a=this.F.tr();if(!a||a.colIdx===t.c2)return;this.F.setEnd({row:a.row,colIdx:t.c2}),this.xt()}return}let o=typeof r.clientY=="number"?this.Bl(r):t.r2;if(i(),o>t.r2)this.of(t.r1,t.r2,t.c1,t.c2,o),this.Be();else{let s=this.F.tr();if(!s||s.row===t.r2)return;this.F.setEnd({row:t.r2,colIdx:s.colIdx}),this.xt()}};this.yl=e=>{if(this.e.s())return;let t=e.target,r=this.Rt(e);if(r&&!t.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-row-drag-handle")&&!(e.detail>1&&this.e.l.Di())){if(this.e.l.Di()){let i=r.cellEl?.dataset.colId??"";if(this.e.l.isEditing(r.index,i))return;this.e.l.se(!1).then(o=>{if(!o||this.e.s())return;this.Wl(e,t,r);let s=i?this.e.n.L(i):void 0;s&&!this.e.l.Di()&&this.e.l.W(r.node,s)&&this.e.l.start(r.index,s)});return}this.Wl(e,t,r)}};this.vl=e=>{if(this.e.s()||e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell"))return;let t=this.Rt(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.L(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.W(r,a)&&this.e.l.start(i,a)};this.bl=e=>{if(this.e.s())return;let t=this.Rt(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.L(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.De()){let l=this.e.n.Me(s);l>=0&&this.fs(i,l,!1)}this.e.gs.open(e.clientX,e.clientY,{rowIndex:i,colId:s})}};this.wl=e=>{if(!this.yf(e)&&this.e.r.enableRangeSelection&&e.button===0){let t=this.Rt(e);if(t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl&&!t.cellEl.classList.contains("mach-cell--selection")){let r=this.e.n.Me(t.cellEl.dataset.colId??"");r>=0&&(this.fs(t.index,r,e.shiftKey),this.tn=!0,!e.shiftKey&&!this.e.r.suppressCellFocus&&this.Ee(t.index,t.cellEl.dataset.colId??""))}}};this.El=()=>{this.tn=!1};this.Ar=e=>{if(this.e.s())return;let t=this.Rt(e);if(this.tn&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let r=this.e.n.Me(t.cellEl.dataset.colId??""),i=this.F.tr();r>=0&&i&&(i.row!==t.index||i.colIdx!==r)&&this.fs(t.index,r,!0)}this.e.r.suppressRowHoverHighlight||!t||t.node.isDetail||this._l(t.index)};this.Cl=()=>{this._l(-1)};this.Tl=e=>{if(this.e.s()||e.button!==0||!e.target.closest(".mach-row-drag-handle"))return;let r=this.Rt(e);!r||r.node.isDetail||r.node.isGroup||(this.Tt.start(e,r.node),e.preventDefault())};this.Dl=e=>{if(!e.target.closest(".mach-row-drag-handle"))return;let t=this.Rt(e);t&&this.Tt.moveWithKeyboard(e,t.node)};this.Tt=new Mt(e,t=>this.Re(t)-this.lt,t=>this.rn(t+this.lt,this.e.i.I()),t=>this.dp(t))}init(){let e=this.e.o.S.center;this.Qo=e.scrollLeft,this.es=e.scrollTop,e.addEventListener("scroll",this.os,{passive:!0});let t=this.e.o.me;t.addEventListener("click",this.yl),t.addEventListener("dblclick",this.vl),t.addEventListener("contextmenu",this.bl),t.addEventListener("mousedown",this.wl),t.addEventListener("mouseover",this.Ar),t.addEventListener("mouseleave",this.Cl),t.addEventListener("pointerdown",this.Tl),t.addEventListener("keydown",this.Dl),window.addEventListener("mouseup",this.El)}suspend(){cancelAnimationFrame(this.Q),this.Q=0,this.ss(),this.Tt.destroy(),this.tn=!1}destroy(){cancelAnimationFrame(this.Q);let e=this.e.o.S.center;e.removeEventListener("scroll",this.os),e.removeEventListener("wheel",this.as);let t=this.e.o.me;t.removeEventListener("click",this.yl),t.removeEventListener("dblclick",this.vl),t.removeEventListener("contextmenu",this.bl),t.removeEventListener("mousedown",this.wl),t.removeEventListener("mouseover",this.Ar),t.removeEventListener("mouseleave",this.Cl),t.removeEventListener("pointerdown",this.Tl),t.removeEventListener("keydown",this.Dl),window.removeEventListener("mouseup",this.El),this.ss(),this.Tt.destroy();for(let r of this.pool){r.detailRow&&this.nn(r.detailRow);for(let i of O)for(let o of r.cells[i]??[])r.index>=0&&this.e.l.co(r.index,o.dataset.colId??"",o),k(this.e,o)}this.sn?.remove(),this.cp?.remove(),this.pool=[],this.xe=0,this.Vr=[],this.Dt.clear(),this.$.reset([],()=>this.e.r.rowHeight),this.G.update([]),this.Yt=null}Qn(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}Oi(e=!1){if(this.e.s())return;let t=this.e.o,r=t.S.center,i=r.scrollLeft,o=r.scrollTop,s=this.M.read(o),a=e||i!==this.Qo,l=e||o!==this.es||s!==this.gl;!a&&!l||(this.Qo=i,this.es=o,this.gl=s,a&&(t.Kt.center.style.transform=`translate3d(${-i}px, 0, 0)`,this.e.B.ll(),this.e.de.up(i)),l&&this.xl(o),this.e.an.hide(),this.Gr(!1,a),l&&this.e.i.Ed(this.lastExcl-1))}hp(){let e={left:0,center:0,right:0};for(let t of O)e[t]=this.e.n.C(t).reduce((r,i)=>r+i.currentWidth,0);return e}Hi(){let e=this.e.o,t=this.hp();this.G.update(this.e.n.C("center")),t.center=this.G.il();let r=this.e.i.je(),i=this.pp(r.length);this.fp(r,i);let o=this.mp(i);this.gp(t,o),this.yp(o),e.root.setAttribute("aria-rowcount",String(i.rowCount+e.Vo()))}pp(e){let t=this.e.i.Gt(),r=this.e.r.rowHeight,i=this.e.r.masterDetail?[]:this.vp(),o=this.e.r.datasourceMode!=="block"&&(this.e.r.masterDetail||this.e.r.getRowHeight!=null||i.length>0),s=o?this.bp(r,i):`fixed|${r}`;return{autoHeightColumns:i,positionedCount:Math.min(t,e),rowCount:t,rowHeight:r,signature:s,variable:o}}bp(e,t){let r=t.map(i=>`${i.id}:${i.currentWidth}`).join(",");return`${this.e.i.Rn()}|${e}|${this.e.r.detailRowHeight}|${r}`}fp(e,t){if(!t.variable){this.wp(t);return}if(t.signature!==this.cn||this.$.length!==t.positionedCount){let r=e.slice(0,t.positionedCount);this.$.reset(r,i=>this.Rl(i,t.autoHeightColumns)),this.Sl(t);return}if(this.Dt.size!==0){for(let r of this.Dt){let i=this.$.indexOf(r);i>=0&&this.$.update(i,this.Rl(r,t.autoHeightColumns))}this.Sl(t)}}wp(e){this.$.length>0&&this.$.reset([],()=>e.rowHeight),this.cn=e.signature,this.Dt.clear(),this.ln=e.rowHeight}Sl(e){this.cn=e.signature,this.Dt.clear(),this.ln=this.$.ap()||e.rowHeight}mp(e){return(e.variable?this.$.Jo():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}gp(e,t){let r=this.e.o,i=r.S.center,o=this.M.read(i.scrollTop),s=this.M.at;this.M.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 O){let c=r.ge[d];c.style.height=`${this.M.height}px`,c.style.overflow=this.M.at?"hidden":"",d==="center"&&(c.style.width=`${l}px`)}(s||this.M.at)&&this.un(o),this.xl(i.scrollTop),this.ts!==this.M.at&&(this.ts=this.M.at,this.ts?i.addEventListener("wheel",this.as,{passive:!1}):i.removeEventListener("wheel",this.as))}un(e){let t=this.e.o.S.center;t.scrollTop=this.M.lp(e),this.M.anchor(e,t.scrollTop)}xl(e){let t=this.M.at;for(let r of["left","right"]){let i=this.e.o.ge[r].style;i.top=t?`${-e}px`:"",i.transform=t?"":`translate3d(0, ${-e}px, 0)`}}dp(e){let t=this.e.o.S.center,r=this.M.read(t.scrollTop);this.un(r+e);let i=this.M.read(t.scrollTop)!==r;return i&&this.Oi(),i}hi(e){this.dn.delete(e),this.Dt.add(e)}yp(e){this.e.o.me.style.height=this.e.r.domLayout==="autoHeight"?`${e}px`:""}Vi(){this.dn=new WeakMap,this.Dt.clear(),this.cn=""}Rl(e,t){if(e.isDetail)return this.e.r.detailRowHeight;let r=this.dn.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.Cp(e,t))),this.dn.set(e,i),i}Re(e){let t=this.$.length;return t===0?Math.max(0,e)*this.e.r.rowHeight:e<=t?this.$.ot(e):this.$.Jo()+(e-t)*this.e.r.rowHeight}rn(e,t){if(t<=0)return 0;let r=this.$.length,i=this.$.Jo();if(r>0&&e<i)return this.$.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))}vp(){return this.e.n.c().filter(e=>e.colDef.autoHeight===!0)}get Tp(){return this.e.n.c().some(e=>e.colDef.autoHeight===!0)}Cp(e,t){var d;this[d="Yt"]??(this[d]=document.createElement("canvas"));let r=this.Yt.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=X(this.e,e,c);if(!u)continue;let h=Math.max(10,c.currentWidth-s*2-2),p=1,m=0;for(let v of u){let w=r.measureText(v).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)}Pa(e,t){if(this.e.r.flashCells)for(let r of e)for(let i of t)this.Vr.push([r,i])}Ml(){if(this.Vr.length===0)return;let e=this.Vr;this.Vr=[];for(let[t,r]of e){let i=this.xi(t,r);if(!i)continue;i.classList.remove("mach-cell--flash"),i.offsetWidth,i.classList.add("mach-cell--flash");let o=De(i),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{i.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}he(){this.Hi();let e=this.e.o.S.center,r=this.e.r.rowHeight;this.e.r.masterDetail&&(r=Math.min(r,this.e.r.detailRowHeight)),this.ln>0&&(r=Math.min(r,this.ln));let i=Math.ceil(e.clientHeight/Math.max(1,r)),o=this.e.r.domLayout==="autoHeight"?this.e.i.I():i+this.e.r.rowBuffer*2+1,s=o%2===0?o:o+1;if(this.Il())for(let l of this.pool)this.ls(l,"center");s>this.xe&&this.Dp(s),this.ds(),this.Gr(!0,!1),this.cs()}Dp(e){for(;this.xe<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{},cellColIds:{}},r=this.e.o;for(let i of O){if(this.e.n.C(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.ge[i].appendChild(s),t.rows[i]=s,t.cells[i]=[],t.cellColIds[i]=[],this.ls(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.ge.center.appendChild(i),t.detailRow=i}this.pool.push(t),this.xe++}}nr(e){let t=this.e.n.C(e);return e!=="center"||t.length<=20||this.e.n.bn()?t:t.slice(this.rs,this.ns)}Ep(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}ls(e,t){let r=e.rows[t];if(!r)return;let i=this.nr(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.Ep(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.co(e.index,c.dataset.colId??"",c),k(this.e,c),c.remove();e.cells[t]=l,e.cellColIds[t]=d}Lo(){this.Br=void 0,this.Al();for(let e of this.pool){e.detailRow&&this.nn(e.detailRow);for(let t of O){for(let r of e.cells[t]??[])k(this.e,r);e.rows[t]?.remove()}e.detailRow?.remove()}this.pool=[],this.xe=0,this.first=0,this.lastExcl=-1,this.he()}ds(){let e=this.xp();for(let t of O){let r=this.e.n.C(t),i=this.nr(t),o=this.Rp(t,i,r);this.Sp(t,i,o,e)}this.Mp()}xp(){return this.e.r.masterDetail||this.e.r.getRowHeight!=null||this.Tp}Rp(e,t,r){let i=0;e==="center"&&t.length>0&&(this.G.update(r),i=this.G.ot(r.indexOf(t[0])));let o=[];for(let s of t)o.push(i),i+=s.currentWidth;return o}Sp(e,t,r,i){for(let o of this.pool){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.Me(c.id)+1))}}}Mp(){if(!this.e.r.masterDetail)return;let e=`${this.e.r.detailRowHeight}px`;for(let t of this.pool)t.detailRow?.style.setProperty("--mach-detail-h",e)}Il(){let e=this.e.o.S.center,t=this.e.n.C("center"),r=this.rs,i=this.ns;this.G.update(t);let o=t.length>20?this.G.nl(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};return this.rs=o.first,this.ns=o.lastExcl,o.first!==r||o.lastExcl!==i}Mn(){return{first:this.first,lastExcl:this.lastExcl}}Gr(e=!1,t=!0){let r=this.e.re.start();if(!this.Ip(e,t))return;let i=Math.max(0,this.lastExcl-this.first),o=this.e.n.C("left").length+this.nr("center").length+this.e.n.C("right").length;this.e.re.hu(r,i,o)}Ip(e,t){let r=this.e.o.S.center,i=this.M.read(r.scrollTop)-r.scrollTop,o=i!==this.lt;this.lt=i;let s=this.e.i.I(),a=this.e.r.rowBuffer,l=t?this.Il():!1;if(this.Ap(l),s===0){for(let u of this.pool)this.us(u);return this.first=0,this.lastExcl=0,!0}if(this.Lp(s,e,l))return!0;let{first:d,lastExcl:c}=this.kp(r,s,a);return!e&&!l&&d===this.first&&c===this.lastExcl?(o&&(this.Ll(),this.Be()),l||o):(this.first=d,this.lastExcl=c,this.Pp(d,c),this.kl(d,c,e,l),o&&this.Ll(),this.Be(),!0)}kp(e,t,r){let i=this.M.read(e.scrollTop),o=this.rn(i,t),s=i+e.clientHeight,a=Math.min(t,this.rn(s,t)+1);return{first:E(o-r,0,t-1),lastExcl:E(a+r,1,t)}}Pp(e,t){for(let r of this.pool)r.index!==-1&&(r.index<e||r.index>=t)&&this.us(r)}kl(e,t,r,i){for(let o=e;o<t;o++){let s=this.e.i.f(o),a=this.pool[o%this.xe];if(!(!a||!s)){if(!r&&a.index===o&&a.nodeId===s.id){i&&a.kind==="master"&&this.hn(a,s,"center");continue}this.Gp(a,o)}}}Ap(e){if(e){for(let t of this.pool)this.ls(t,"center");this.ds()}}Lp(e,t,r){return this.e.r.domLayout!=="autoHeight"?!1:(!t&&!r&&this.first===0&&this.lastExcl===e||(this.first=0,this.lastExcl=e,this.kl(0,e,t,r)),!0)}us(e){this.Pl(e),this.T?.rowIndex===e.index&&this.e.o.root.removeAttribute("aria-activedescendant"),e.index=-1,e.nodeId="",e.kind="master";for(let t of O){let r=e.rows[t];r&&(r.style.display="none",delete r.dataset.id,delete r.dataset.index,fe(r,void 0),r.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.nn(e.detailRow),e.detailRow.style.display="none")}Gp(e,t){e.index>=0&&e.index!==t&&this.Pl(e);let r=this.e.i.f(t);if(!r){this.us(e);return}e.index=t,e.nodeId=r.id;let i=this.Re(t),o=i-this.lt,s=this.Re(t+1)-i;if(r.isDetail){this.Np(e,r,t,o,s);return}this.Fp(e,r,t,o,s)}Ll(){for(let e of this.pool){if(e.index<this.first||e.index>=this.lastExcl)continue;let t=`translateY(${this.Re(e.index)-this.lt}px)`;for(let r of Object.values(e.rows))r.style.transform=t;e.detailRow&&(e.detailRow.style.transform=t)}}Np(e,t,r,i,o){e.kind="detail";for(let a of O){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.Vo()+1)),this.hs(s,t))}Fp(e,t,r,i,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Op(t),a=Le(this.e,t);for(let l of O){let d=e.rows[l];d&&(this.Hp(d,t,r,i,o,s),fe(d,a),this.hn(e,t,l))}this.T&&this.T.rowIndex===r&&this.pn()}Op(e){let t=this.e.i.N,r=e.isGroup===!0,i=t&&this.e.i.Pn(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.Gn(e)+1),{expanded:s,expandable:o,level:a}}Hp(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.Vo()+1)),this.Gl(e,t);let a=this.en===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.Tt.isSource(t)),this.Vp(e,s)}Gl(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}Vp(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")}hn(e,t,r){let i=this.nr(r),o=e.cells[r];if(!o)return;let s=e.index,a=r==="center"&&this.e.n.bn(),l=0;e.rows[r]?.classList.toggle("mach-row--editing",this.e.l.Ei(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.Bp(t,c,s,i.length-d);h>1?(l=h-1,this.zp(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.Da(s,t,c,u)||(this.Nl(u,t,c),this.ps(u,s,c))}}Bp(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}}zp(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))}hs(e,t){this.nn(e);let r=t.masterId!=null?this.e.i.z(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),Ei(e,a.destroy))}}nn(e){let t=xi(e);if(t)try{t()}catch(r){this.e.reportError(r,"detailRowRenderer.destroy")}e.textContent=""}Nl(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.Et(e);return}e.removeAttribute("aria-busy"),e.setAttribute("aria-readonly",this.e.l.W(t,r)?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let i=this._p(t,r);if(i!=="standard"){k(this.e,e),this.Kp(i,e,t,r);return}dt(this.e,e,t,r),Ee(this.e,e,t,r),lt(this.e,e,t,r),this.Fl(e,t,r),this.Wp(e,t,r)}_p(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":le(t.colDef,"index")?"index":this.e.i.N&&this.Ol()?.id===t.id?"tree":"standard"}Kp(e,t,r,i){if(e==="group")this.$p(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.Et(t)}else if(e==="checkbox"){let o=t.querySelector(".mach-row-checkbox");o&&(o.checked=r.selected,o.indeterminate=this.e.m.Xd(r.id),o.disabled=!this.e.m.ke(r)),t.className!=="mach-cell mach-cell--selection"&&(t.className="mach-cell mach-cell--selection"),this.Et(t)}else if(e==="drag")this.Up(t,r),t.className!=="mach-cell mach-cell--drag"&&(t.className="mach-cell mach-cell--drag"),this.Et(t);else if(e==="index"){t.textContent=String(this.e.i.ea(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.Fl(t,r,i)}else this.qp(t,r,i)}Wp(e,t,r){if(this.e.r.editType!=="cell"||this.e.r.editableIndicator==="none"||!this.e.l.W(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.Ee(t.rowIndex,r.id),this.e.l.start(t.rowIndex,r)}),e.appendChild(i)}Pl(e){if(!(e.index<0))for(let t of O)for(let r of e.cells[t]??[])this.e.l.co(e.index,r.dataset.colId??"",r)}Ol(){return this.Br!==void 0?this.Br:(this.Br=this.e.n.c().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!le(e.colDef,"index"))??null,this.Br)}qp(e,t,r){let i=this.e.i.isRowExpandable(t),o=this.e.i.Gn(t),s=ue(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"),Ee(this.e,e,t,r)}Et(e){e.style.height!==""&&(e.style.height=""),e.style.zIndex!==""&&(e.style.zIndex=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Fl(e,t,r){let i=this.e.i.$d(r.id);if(!i||t.isDetail){this.Et(e);return}let o=this.e.i.ea(t)-1;if(o<0||o>=i.length){this.Et(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.I()),l=this.Re(a)-this.Re(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.Et(e)}$p(e,t,r){if(r.hasCheckbox){this.jp(e,t);return}if(r.isDetailToggle){this.Hl(e);return}let i=this.e.n.Ms();if(i&&r.id===i.id){this.Yp(e,t);return}this.Xp(e,t,r)||this.Hl(e)}jp(e,t){let r=e.querySelector(".mach-row-checkbox");if(r){let i=this.e.m.na(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")}Yp(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.ze()[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")}Xp(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?ue(this.e,t,r,i):cr(i),e.className!=="mach-cell mach-cell--num"&&(e.className="mach-cell mach-cell--num"),!0}Hl(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}Ye(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.pool[r%this.xe];if(!i||i.index!==r)continue;let o=this.e.i.f(r);if(o){if(i.kind==="detail"){i.detailRow&&this.hs(i.detailRow,o);continue}for(let s of O){let a=i.rows[s];a&&this.Gl(a,o),i.cells[s]&&this.hn(i,o,s)}}}this.pn(),this.Ml()}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.pool){let s=this.e.i.f(o.index);!s||!this.Jp(o,s,t,r)||this.Zp(o,s,i,e.force===!0)}this.pn(),this.Ml()}Jp(e,t,r,i){return e.index<0?!1:r==null&&i==null?!0:r?.has(t.id)===!0||i?.has(e.index)===!0}Zp(e,t,r,i){if(e.kind==="detail"){r==null&&e.detailRow&&this.hs(e.detailRow,t);return}let o=r==null||this.e.n.bn(),s=Le(this.e,t);for(let a of O){let l=e.rows[a];l&&fe(l,s),o?this.hn(e,t,a):this.Qp(e,t,a,r,i)}}Qp(e,t,r,i,o){let s=this.nr(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.Da(e.index,t,d,c)||(o&&k(this.e,c),this.Nl(c,t,d),this.ps(c,e.index,d)))}}ef(){this.e.s()||(this.T&&this.T.rowIndex>=this.e.i.I()&&this.Ee(null,null),this.Al(),this.Hi(),this.Gr(!0),this.Be(),this.cs(),this.e.ne.refresh())}cs(){let e=this.e.r;if(e.loading){let t=e.overlayLoadingTemplate||this.e.ja();this.e.o._i("loading",t,e.allowUnsafeOverlayHtml);return}if(e.error!=null){let t=e.overlayErrorTemplate||this.e.Xa();this.e.o._i("error",t,e.allowUnsafeOverlayHtml);return}if(this.e.i.I()===0&&!e.suppressNoRowsOverlay){let t=e.overlayNoRowsTemplate||this.e.Ya();this.e.o._i("noRows",t,e.allowUnsafeOverlayHtml);return}this.e.o.qa()}xi(e,t){let r=this.e.n.L(t);if(!r)return null;let i=this.Qn(r),o=this.pool[e%Math.max(1,this.xe)]?.cellColIds[i]?.indexOf(r.id)??-1;if(o<0)return null;let s=this.pool[e%this.xe];return!s||s.index!==e||s.kind!=="master"?null:s.cells[i]?.[o]??null}Al(){this.F.invalidate()}De(){let e=this.e.i.I(),t=this.e.n.c().length;return this.F.normalize(e,t)}Wt(){let e=this.De();if(e)return e;let t=this.T;if(t){let r=this.e.n.Me(t.colId);if(r>=0)return{r1:t.rowIndex,c1:r,r2:t.rowIndex,c2:r}}return null}Ne(){let e=this.De();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??""}}no(){let e=this.F.ep();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.Wt();return t?{row:t.r1,colIdx:t.c1}:null}$t(){let e=this.De();this.F.clear(),e&&(this.xt(),this.Be(),this.e.emit("rangeSelectionChanged",{range:null}))}xt(){for(let e of this.pool)if(!(e.index<0||e.kind!=="master"))for(let t of O){let r=this.nr(t);e.cells[t]?.forEach((i,o)=>{let s=r[o];s&&this.ps(i,e.index,s)})}}fs(e,t,r){this.F.start({row:e,colIdx:t},r),this.xt(),this.Be(),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}xc(e,t){if(!this.F.tp()){let a=this.T;if(!a)return;let l=this.e.n.Me(a.colId);if(!this.F.rp({row:a.rowIndex,colIdx:l}))return}let r=this.e.i.I(),i=this.e.n.c().length;this.F.setEnd({row:Math.max(0,Math.min(e,r-1)),colIdx:Math.max(0,Math.min(t,i-1))}),this.xt(),this.Be();let o=this.e.n.c(),s=this.F.tr();s&&s.colIdx<o.length&&this.Ee(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}ps(e,t,r){let i=this.De();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.Me(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")}tf(){if(this.sn)return this.sn;let e=f("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.ms=!0,this.Vl(t)}),e.addEventListener("mousedown",t=>{this.ms||this.Vl(t)}),this.e.o.ge.center.appendChild(e),this.sn=e,e}Be(){let e=this.tf(),t=this.De();if(!this.e.r.enableRangeSelection||!this.e.r.fillHandle||!t){e.style.display="none";return}let r=this.e.n,i=r.C("left").length,o=r.C("center");if(t.c2<i||t.c2>=i+o.length){e.style.display="none";return}let s=t.c2-i;this.G.update(o);let a=this.G.ot(s+1),l=this.Re(Math.min(t.r2+1,this.e.i.I()))-this.lt,d=this.e.o.S.center;if(this.M.at&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.M.at?Math.min(a-4,parseFloat(this.e.o.ge.center.style.width)-8):a-4}px`,e.style.top=`${Math.min(l-4,this.M.height-8)}px`}Vl(e){if(this.e.s()||e.button!==0)return;let t=this.De();t&&(e.preventDefault(),e.stopPropagation(),this.zr={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.fn),window.addEventListener("mousemove",this.fn),window.addEventListener("pointerup",this.or),window.addEventListener("mouseup",this.or),window.addEventListener("pointercancel",this.or))}Bl(e){let r=this.e.o.ge.center.getBoundingClientRect(),i=e.clientY-r.top+this.lt,o=this.e.i.I(),s=this.rn(i,o);return Math.max(this.zr.r2,Math.min(s,o-1))}zl(e){let r=this.e.o.ge.center.getBoundingClientRect(),i=e.clientX-r.left,o=this.e.n,s=o.C("left").length,a=o.C("center");this.G.update(a);let l=this.G.Gh(i);if(l<0)return s;let d=this.G.ot(l)+a[l].currentWidth/2;return i<d?s+l:l+1<a.length?s+l+1:s+a.length-1}ss(){this.zr=null,this.ms=!1,window.removeEventListener("pointermove",this.fn),window.removeEventListener("mousemove",this.fn),window.removeEventListener("pointerup",this.or),window.removeEventListener("mouseup",this.or),window.removeEventListener("pointercancel",this.or),this.e.o.root.classList.remove("mach-root--filling")}rf(e,t,r,i,o){let s=this.e.n.c(),a=[];for(let l=e;l<=t;l++)this.nf(l,r,i,o,s,a);this.e.Jt(a),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}nf(e,t,r,i,o,s){let a=this.e.i.f(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(!ln(u)||!this.e.l.W(a,u))continue;let h=cn(d,c-t),p=this.e.d(a,u);s.push({node:a,column:u,oldValue:p,newValue:h})}}of(e,t,r,i,o){let s=this.e.n.c(),a=[];this.sf(e,t,r,i,o,s,a),this.e.Jt(a),this.e.emit("rangeSelectionChanged",{range:this.Ne()})}sf(e,t,r,i,o,s,a){for(let l=r;l<=i;l++){let d=s[l];ln(d)&&this.af(d,e,t,o,a)}}af(e,t,r,i,o){let s=this.lf(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.f(l);if(!d||d.isDetail||d.isGroup||!this.e.l.W(d,e))continue;let c=cn(a,l-t),u=this.e.d(d,e);o.push({node:d,column:e,oldValue:u,newValue:c})}}lf(e,t,r){let i=[];for(let o=t;o<=r;o++){let s=this.e.i.f(o);i.push(s?this.e.d(s,e):void 0)}return i}Ee(e,t){if(this.df(),e==null||t==null){this.T=null;return}this.T={rowIndex:e,colId:t},this.pn(),this.cf()}pn(){if(!this.T)return;let e=this.xi(this.T.rowIndex,this.T.colId);if(e){let t=Math.max(0,this.e.n.Me(this.T.colId));e.id=`mach-grid-${this.e.gridId}-r${this.T.rowIndex}-c${t}`,e.classList.add("mach-cell--focus"),this.e.o.root.setAttribute("aria-activedescendant",e.id)}}df(){if(this.T){let e=this.xi(this.T.rowIndex,this.T.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.o.root.removeAttribute("aria-activedescendant")}cf(){if(!this.T)return;this.Bt(this.T.rowIndex,"nearest");let e=this.e.n.L(this.T.colId);if(!e||e.pinned)return;let t=this.e.o.S.center,r=this.e.n.C("center");this.G.update(r);let i=this.G.ot(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)}Bt(e,t="top"){let r=this.e.o.S.center,i=this.e.i.I();if(i===0)return;let o=E(e,0,i-1),s=r.clientHeight,a=this.M.read(r.scrollTop),l=this.Re(o),d=this.Re(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.Re(i)-s);this.un(E(c,0,u)),this.Oi()}_l(e){if(this.en===e)return;let t=this.en;this.en=e,this.Kl(t,!1),this.Kl(e,!0)}Kl(e,t){if(e<0)return;let r=this.pool[e%this.xe];if(!(!r||r.index!==e||r.kind!=="master"))for(let i of O)r.rows[i]?.classList.toggle("mach-row--hover",t)}_r(){this.e.o.root.focus({preventScroll:!0})}Rt(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.f(i);if(!o)return null;let s=t.closest(".mach-cell");return{node:o,index:i,cellEl:s}}Wl(e,t,r){let{node:i,index:o,cellEl:s}=r;if(this.uf(t,i,s)||this.hf(t,i,s))return;let a=s?.dataset.colId??"",l=a?this.e.n.L(a):void 0;this.pf(i,l)||i.isDetail||this.ff(t,i,o,e)||!s||!l||(this._r(),this.e.r.suppressCellFocus||this.Ee(o,a),this.e.m.sa(i,e,!1),this.mf(e,i,o,l),this.gf(i,o,l))}uf(e,t,r){if(!t.isGroup)return!1;if(this._r(),e.closest(".mach-row-checkbox")){let o=this.e.m.na(t).all;return this.e.m.Qd(t,!o),!0}let i=this.e.n.Ms();return(!i||!r||r.dataset.colId===i.id)&&this.e.i.Kn(t.id),!0}pf(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this._r(),this.e.mi(e.id),!0)}ff(e,t,r,i){let o=e.closest(".mach-cell--selection");return o?(this._r(),this.e.r.suppressCellFocus||this.Ee(r,o.dataset.colId??""),this.$t(),this.e.m.sa(t,i,!0),!0):!1}mf(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})}gf(e,t,r){(this.e.r.singleClickEdit||r.colDef.singleClickEdit===!0)&&this.e.l.W(e,r)&&this.e.l.start(t,r)}hf(e,t,r){if(!this.e.i.N||!e.closest(".mach-tree-toggle"))return!1;let i=this.Ol();return!i||r?.dataset.colId!==i.id||!this.e.i.isRowExpandable(t)?!1:(this._r(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.mi(t.id),!0)}yf(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.l.Di())}Up(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.Tt.fl(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 kt=class{constructor(e){this.e=e;this.Se=null;this.rows={left:void 0,center:void 0,right:void 0};this.ys={left:[],center:[],right:[]}}init(){this.Se=f("div","mach-footer"),this.Se.style.display="none",this.Se.setAttribute("role","row"),this.e.o.root.appendChild(this.Se);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.Se.appendChild(t),this.rows[e]=t}}setVisible(e){this.Se&&(this.Se.style.display=e?"":"none")}refresh(){if(!this.Se||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.je().filter(o=>!o.isDetail&&!o.isGroup),i={...x,...this.e.r.locale};for(let o of["left","center","right"]){let s=this.e.n.C(o),a=this.rows[o];this.ys[o].length!==s.length&&(a.textContent="",this.ys[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.ys[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=W(i.totalRowsLabel,r.length):u.textContent=""})}}destroy(){this.Se?.remove(),this.Se=null}};var Pt=class{constructor(e){this.e=e;this.w=null;this.mn=null;this.vs=null;this.sr=null;this.St=null;this.Kr=null;this.Wr=null;this.$r=null;this.Ur=null;this.Mt=[]}init(){this.w=f("div","mach-pagination"),this.w.style.display="none",this.w.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.mn=f("span","mach-pagination-total"),this.Kr=e("mach-pagination-first",this.t("pageFirst"),"\xAB"),this.Wr=e("mach-pagination-prev",this.t("pagePrev"),"\u2039"),this.vs=f("span","mach-pagination-page"),this.$r=e("mach-pagination-next",this.t("pageNext"),"\u203A"),this.Ur=e("mach-pagination-last",this.t("pageLast"),"\xBB"),this.Kr.addEventListener("click",()=>this.e.i.setPage(1)),this.Wr.addEventListener("click",()=>this.e.i.setPage(this.e.i.Cr()-1)),this.$r.addEventListener("click",()=>this.e.i.setPage(this.e.i.Cr()+1)),this.Ur.addEventListener("click",()=>this.e.i.setPage(this.e.i.getPageCount())),this.w.append(this.mn,this.Kr,this.Wr,this.vs,this.$r,this.Ur),this.e.r.paginationShowSizeSelector&&(this.St=Y({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.sr=this.St.native,this.$l(),this.w.appendChild(this.St.el)),this.e.o.root.appendChild(this.w),this.Mt.push(this.e.le.on("modelUpdated",()=>this.refresh()),this.e.le.on("paginationChanged",()=>this.refresh())),this.refresh()}$l(){if(!this.sr)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.St?.setOptions(e.map(r=>({value:String(r),label:W(this.t("perPage"),r)})),String(t))}t(e){return this.e.r.locale?.[e]??x[e]}ce(){this.w&&(this.sr&&this.e.r.paginationShowSizeSelector&&this.$l(),this.refresh())}Ul(e,t){e&&e.textContent!==t&&(e.textContent=t)}vf(e,t){let r=e<=1,i=e>=t;this.Kr&&(this.Kr.disabled=r),this.Wr&&(this.Wr.disabled=r),this.$r&&(this.$r.disabled=i),this.Ur&&(this.Ur.disabled=i)}refresh(){if(!this.w||this.e.s())return;let e=this.e.i,t=e.we,r=e.getTotalRowCount(),i=t&&r>0;if(this.w.style.display=i?"":"none",!i)return;let o=e.Cr(),s=e.getPageCount();this.mn&&this.e.r.paginationShowTotal&&this.Ul(this.mn,W(this.t("paginationTotal"),r)),this.Ul(this.vs,Re(this.t("paginationPage"),o,s)),this.vf(o,s),this.sr&&Number(this.sr.value)!==this.e.r.paginationPageSize&&this.St?.setValue(String(this.e.r.paginationPageSize))}destroy(){for(let e of this.Mt)e();this.Mt=[],this.St?.destroy(),this.St=null,this.sr=null,this.w?.remove(),this.w=null}};var se=["left","center","right"],Gt=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.ql(this.e.o.Ki),this.bottom=this.ql(this.e.o.Wi)}ql(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 se)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.ce(),this.Ve(),this.e.he())}setRows(e,t){let r=this[e];this.e.s()||!r||(r.data=t??[],this.bs(r,e),this.Ve(),this.e.he())}getRows(e){return this[e]?.data.slice()??[]}ce(){!this.top||!this.bottom||(this.bs(this.top,"top"),this.bs(this.bottom,"bottom"))}bs(e,t){for(let o of e.cells)for(let s of se)for(let a of o[s])k(this.e,a);for(let o of se){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=Le(this.e,a,t);for(let c of se){let u=f("div","mach-pinned-row");fe(u,d),u.style.height=`${r}px`,u.setAttribute("role","row"),l[c]=[];for(let h of i.C(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{dt(this.e,p,a,h),Ee(this.e,p,a,h),lt(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)})}Ve(){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 se){let o=0;for(let s of e.C(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 se){let d=e.C(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}})}}up(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.ce(),this.Ve()}destroy(){for(let e of[this.top,this.bottom])if(e)for(let t of e.cells)for(let r of se)for(let i of t[r])k(this.e,i);this.top=null,this.bottom=null}};var Nt=class{constructor(e){this.e=e;this.w=null;this.items={};this.Mt=[]}init(){this.w=f("div","mach-statusbar"),this.w.style.display="none",this.w.setAttribute("role","status"),this.e.o.root.appendChild(this.w),this.ce(),this.Mt.push(this.e.le.on("modelUpdated",()=>this.refresh()),this.e.le.on("selectionChanged",()=>this.refresh()),this.e.le.on("rangeSelectionChanged",()=>this.refresh()),this.e.le.on("cellValueChanged",()=>this.refresh()))}ce(){if(!this.w)return;this.w.textContent="",this.items={};let e=this.e.r;if(!e.statusBarEnabled){this.w.style.display="none";return}for(let t of e.statusBarPanels){let r=f("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.w.appendChild(r),this.items[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 W(i,o)}ws(e,t){let r=this.items[e];r&&r.textContent!==t&&(r.textContent=t)}bf(e){let t=this.e.i,r=t.Gt(),i=t.we?t.getTotalRowCount():t.I(),o=W(this.text(e,"totalRowsLabel"),i);return t.p&&r>i?`${o} / ${r}`:o}wf(e){let t=this.e.a.De();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.f(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.w||this.e.s())return;let e=this.e.r;if(this.w.style.display=e.statusBarEnabled?"":"none",!e.statusBarEnabled)return;let t={...x,...e.locale};if(this.items.rowCount&&this.ws("rowCount",this.bf(t)),this.items.selectedRowCount){let r=this.e.m.Pe().length;this.ws("selectedRowCount",W(this.text(t,"statusSelected"),r))}this.items.rangeAggregate&&this.ws("rangeAggregate",this.wf(t))}destroy(){for(let e of this.Mt)e();this.Mt=[],this.w?.remove(),this.w=null}};function xr(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function un(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function hn(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??xr())?.getItem(r(o));if(!s)return null;if(un(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=U(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=U(s);if(!a)throw new TypeError(`[MachTable] Invalid grid state for "${o}".`);let l=JSON.stringify({schemaVersion:2,savedAt:Date.now(),state:a});if(un(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??xr())?.setItem(r(o),l)}catch(a){i(a,"save",o)}},clear(o){try{(n.storage??xr())?.removeItem(r(o))}catch(s){i(s,"clear",o)}}}}var Rr=hn();function Sr(n,e){Rr.save(n,e)}function Mr(n){return Rr.load(n)}function Es(n){Rr.clear(n)}var xs=[[/^(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"]];function pn(n,e){let t=String(n??"");if(e){let r=e[t];if(r)return r;let i=e[t.toLowerCase()];if(i)return i}for(let[r,i]of xs)if(r.test(t))return i;return"neutral"}function fn(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=pn(e.value,n.variantMap),r=n.labelMap?.[String(e.value)]??(e.formatted||String(e.value)),i=document.createElement("span");return i.className=`mach-tag mach-tag--${t}`,i.textContent=r,i}}function mn(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 gn(n){if(n.value==null||n.value==="")return"";let e=f("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var Ar={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 Ft(n,e=14){let t=Ar[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,B=null;function yn(n){B&&n.contains(B)&&q()}function q(n=!1){Z?.remove(),Z=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",vn,!0),document.removeEventListener("keydown",Lr,!0)}function vn(n){Z&&!Z.contains(n.target)&&!B?.contains(n.target)&&q()}function Lr(n){if(!Z)return;if(n.key==="Escape"){n.preventDefault(),q(!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 bn(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&&Ar[n.icon]?t.innerHTML=`${Ft(n.icon,16)}<span>${n.label}</span>`:t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function Rs(n,e){q();let t=f("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let r of e){let i=bn(r,"mach-context-menu-item");i.setAttribute("role","menuitem"),t.appendChild(i)}P(t,n.closest(".mach-root")),document.body.appendChild(t),j(t,n),Z=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",vn,!0),document.addEventListener("keydown",Lr,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function Ss(n,e,t){q();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=Ft("close",16),a.addEventListener("click",()=>q(!0)),o.append(s,a);let l=f("div","mach-action-drawer__body");for(let d of t)l.appendChild(bn(d,"mach-action-drawer__item"));i.append(o,l),r.appendChild(i),r.addEventListener("mousedown",d=>{d.target===r&&q(!0)}),P(r,n.closest(".mach-root")),document.body.appendChild(r),Z=r,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Lr,!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 wn(n){return n.variant??"default"}function Cn(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function kr(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Cn(n),...t?{message:t}:{},params:e}}function Ot(n,e,t){let r=t.api.getOption("actionPolicy");try{r?.onError?r.onError(n,kr(e,t)):console.error("[mach-table] action handler failed",n)}catch(i){console.error("[mach-table] action error policy failed",i,n)}}function Ms(n,e){if(Cn(n).length===0)return!0;let r=e.api.getOption("actionPolicy");if(!r?.canAccess)return!0;try{return r.canAccess(kr(n,e))}catch(i){return Ot(i,n,e),!1}}function Is(n,e){return n.filter(t=>{if(!Ms(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Pr(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 As(n,e,t,r){Promise.resolve(n).catch(i=>Ot(i,e,t)).finally(()=>Pr(e,t,r))}function Ls(n,e,t){try{As(n.onClick(e),n,e,t)}catch(r){Ot(r,n,e),Pr(n,e,t)}}function Ir(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(kr(e,t,r)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(r)}function ks(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Ir(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(r=>Ir(r,n,e)):Ir(t,n,e)}function Ps(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){Ls(e,n,t);return}(async()=>{await ks(e,n)&&await e.onClick(n)})().catch(i=>Ot(i,e,n)).finally(()=>{Pr(e,n,t)})}}function Gs(n,e,t){let r=document.createElement("button");r.type="button",r.className="mach-action-btn";let i=wn(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&&Ar[n.icon]?(r.innerHTML=Ft(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 Ns(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=`${Ft("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:wn(c),disabled:J(c.disabled,r)||J(c.loading,r),pick:u=>{q(),i(c,u)}}));e==="drawer"?Ss(o,t.drawerTitle??a,d):Rs(o,d)}),o}function ke(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return r=>{let i=Is(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=Ps(r);for(let d of s)o.appendChild(Gs(d,r,l));return a.length>0&&o.appendChild(Ns(a,t,n,r,l)),{el:o,destroy:()=>{B&&o.contains(B)&&q()}}}}function me(n,e,t){return n??e??t}function Fs(n,e){let t=e.api.getOption("locale")??{};return{view:me(n.labels?.view,t.actionView,x.actionView),edit:me(n.labels?.edit,t.actionEdit,x.actionEdit),delete:me(n.labels?.delete,t.actionDelete,x.actionDelete),confirm:me(n.labels?.confirm,t.actionConfirm,x.actionConfirm),save:me(n.labels?.save,t.actionSave,x.actionSave),cancel:me(n.labels?.cancel,t.actionCancel,x.actionCancel)}}function Os(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 ke({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 Hs(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 Gr(n={}){return e=>{let t=Fs(n,e);if(e.api.editing.isRowActive(e.rowIndex))return Os(n,e,t);let r=Hs(n,e,t);return ke({actions:r,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var Vs=fn(),Bs=mn(),Tn=Object.freeze({statusTag:Vs,progressBar:Bs,link:gn});var Pe=class{constructor(e){this.onError=e;this.gn=new Set;this.disposed=!1}add(e){let t=!0,r=()=>{if(t){t=!1,this.gn.delete(r);try{e()}catch(i){try{this.onError(i)}catch{}}}};return this.disposed?r():this.gn.add(r),r}A(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.gn].reverse();this.gn.clear();for(let t of e)t()}};function zs(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function _s(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 Ks(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!Kt(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`),zs(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`),_s(n,t,e.issues)}function Dn(n,e){for(let t of n){if(we(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Dn(t.children,e);continue}e.leafIndex++,Ks(t,e)}}function En(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Dn(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 xn=new Set([...yr,...vr]);function Ws(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 $s(n){let e,t=Number.POSITIVE_INFINITY;for(let i of xn){let o=Ws(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 Us(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(...qs(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 qs(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"}),Rn(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 Rn(n){return n.rowKey!=null}function js(n){let e=new Set(["enableColumnResize","pagination","rowKey"]),t=[];for(let r of yr){if(e.has(r)||!Object.prototype.hasOwnProperty.call(n,r))continue;let i=n[r],o=Me[r];br(i,o)||t.push({code:"INVALID_OPTION_VALUE",option:r,message:`${r} \u503C\u7C7B\u578B\u65E0\u6548\uFF0C\u671F\u671B ${o}`})}return t}function Ys(n){let e=[];for(let t of Object.keys(n)){if(xn.has(t))continue;let r=$s(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 Xs(n,e){if(e.mode!=="server")return[];let t=[];Rn(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 Js(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(...Xs(n,t)),e}function Zs(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 Nr(n){let e=n,t=Ys(e);return t.push(...Js(e)),t.push(...Zs(e)),t.push(...js(e)),t.push(...Us(e)),t}function Sn(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 Fr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Qs(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function ea(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let r=Sn(t[2]);if(!r)return!1;let i=Fr(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&&Fr(n,Qs(r))<0;case"~":return i>=0&&Fr(n,[r[0],r[1]+1,0])<0;default:return i===0}}function Mn(n,e){if(!e?.trim())return!0;let t=n?Sn(n):null;return t?e.split("||").some(r=>{let i=r.trim().split(/\s+/).filter(Boolean);return i.length>0&&i.every(o=>ea(t,o))}):!1}function ta(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function Ht(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 Or(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 Ht(d.requires)){let u=t.get(c.key);u?Mn(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 ta(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 Ht(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 ra=["datasource","treeData"],ia=["columnState.","gridState."],na=new Set(["valueFormatter","cellStyle","cellClass"]),oa=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","displayedColumnsChanged","paginationChanged","detailToggled"]),sa=0,Vt=class{constructor(e,t){this.E=!1;this.Cf=0;this.qr=0;this.jl=!1;this.Cs="";this.x=new Pe(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.Ql=0;this.jr=0;this.recentErrors=[];this.dt=null;this.ed=0;this.Ts=0;this.Ds=!1;this.Es=!1;this.xs=null;this.ad=null;this.yn=new Set;let r;this.Yl=new Promise(i=>{r=i}),this.Xl=r,this.gridId=++sa,this.r=Yr(t),this.le=new Ve((i,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",i):this.reportError(i,"eventBus.listener",{eventType:o})});try{if(this.$a(t.dataProcessor),this.n=new Ke(this),this.i=this.x.A(new Je(this)),this.m=new Ze(this),this.o=this.x.A(new Et(this)),this.B=this.x.A(new xt(this)),this.a=this.x.A(new Lt(this)),this.Nr=this.x.A(new Qe(this)),this.Ji=this.x.A(new et(this)),this.yo=this.x.A(new rt(this)),this.l=this.x.A(new ut(this)),this._=new ct(this),this.O=new vt(this),this.re=this.x.A(new Ct),this.Xt=this.x.A(new Tt(i=>this.Tf(i))),this.Ko=this.x.A(new pt(this)),this.columnMenu=this.x.A(new ft(this)),this.gs=this.x.A(new mt(this)),this.an=this.x.A(new gt(this)),this.Bi=this.x.A(new yt(this)),this.Zt=this.x.A(new Pt(this)),this.de=this.x.A(new Gt(this)),this.ne=this.x.A(new kt(this)),this.Ge=this.x.A(new Nt(this)),this.api=on(this),this.V=this.x.A(new bt(this)),this.x.add(()=>this.td()),this.V.init(),this.o.init(e,this.r),this.Bi.init(),this.a.init(),this.yo.init(),this.an.init(),this.Zt.init(),this.ne.init(),this.Ge.init(),this.de.init(),this.i.Qs(this.r.paginationPage,this.r.paginationPageSize),this.n.ar(this.r.columnDefs),this.i.Ot(this.r.advancedFilterModel),this.i.Ht(this.r.quickFilterText),this.zi(),this.rd(this.r.columnDefs),this.ko(t),this.B.Pr(),this.r.datasource?this.i.li().catch(()=>{}):this.i.qe(this.r.rowData),this.r.initialState&&this.api.state.apply(this.r.initialState,{emitEvents:!1}),this.Io(),this.he(),this.de.setData(this.r.pinnedTopRowData,this.r.pinnedBottomRowData),this.Ua(this.r.features),this.E)return;this.qr=requestAnimationFrame(()=>{this.qr=0,this.E||this.emit("gridReady",{}),this.nd()})}catch(i){throw this.api&&this.reportError(i,"grid.constructor"),this.destroy(),i}}$a(e){if(e===this.Jl)return!1;let t=++this.Ql,r=typeof e=="function"?e():e;if(this.E||t!==this.Ql)return r?.destroy?.(),!1;let i=this.Zl;return this.Jl=e,r===this.r.dataProcessor&&i?!1:(this.r.dataProcessor=r,this.Zl=r?this.x.add(()=>r.destroy?.()):void 0,i?.(),!0)}whenReady(){return this.Yl}nd(){this.jl||(this.jl=!0,this.Xl(this.api))}Lc(e){return this.r.components?.cellRenderers?.[e]??Tn[e]}Bc(e){return this.r.components?.cellEditors?.[e]}Df(e){return Ht(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}Ua(e){let t=this.jr+1;if(this.td(),this.E||this.jr!==t)return;let r=Or(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.E||this.jr!==t)return;let o=i.key.trim(),s=this.Df(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 Pe(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.le.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.E||this.jr!==t){this.od(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})}}}td(){this.jr++;let e=[...this.activeFeatures.entries()].reverse();this.activeFeatures.clear();for(let[t,r]of e)this.od(t,r)}od(e,t){t.scope.dispose();try{t.feature.destroy?.()}catch(r){this.reportError(r,"feature.destroy",{key:e})}}s(){return this.E}suspend(){this.ve(),this.api.editing.stop({cancel:!0}),this.Ko.close(),this.columnMenu.close(),this.gs.close(),this.an.hide(),this.Nr.gt(),this.Ji.destroy(),this.a.suspend(),wi(this.o.root),yn(this.o.root);let e=document.activeElement;e instanceof HTMLElement&&this.o.root.contains(e)&&e.blur()}Ft(){return++this.Cf}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 K(e.data,r.field)}g(e){return this.r.locale[e]??x[e]}Ti(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?ye(e.data,o.field,r):!1}ao(e,t,r,i){this.a.hi(e),this.a.Pa([e.rowIndex],[t.id]),this.O.Eo({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})}to(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.f(o);i.push(r.map(a=>!s||s.isDetail||s.isGroup?"":xe(this,s,a,"clipboard")))}return rr(i)}Aa(){let e=this.a.Wt();return e?Te(this.to(e)):Promise.resolve(!1)}ro(e){if(this.E)return;let t=this.n.c(),r=[];for(let i=e.r1;i<=e.r2;i++){let o=this.i.f(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.Jt(r)}Jt(e){this._.Nc(e)}ve(){this._?.kc()}va(e,t,r){if(this.E)return;let i=ir(e);if(i.length===0)return;let o=this.n.c(),s=this.i.I(),a=[],l=t;for(let d of i){let c=this.Ef(l,s);if(!c)break;this.xf(c.node,d,o,r,a),l=c.index+1}this.Jt(a)}Ef(e,t){for(let r=e;r<t;r++){let i=this.i.f(r);if(i&&!i.isDetail&&!i.isGroup)return{index:r,node:i}}return null}Rf(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}xf(e,t,r,i,o){let s=i,a=o.length;for(let l of t){if(s=this.Rf(r,s),s>=r.length)return;let d=r[s];if(!this.l.W(e,d)){s++;continue}let c=this.d(e,d);try{let u=d.colDef.valueParser?oe(this,e,d,l,"clipboard",c):tt(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++}}ru(){let e=this.a.no();if(!e)return Promise.resolve();let t=this._.oo(),r=this.i.f(e.row),i=this.n.c()[e.colIdx];if(!r||!i)return Promise.resolve();let o=this.d(r,i),s=this._.xr([{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.no();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.f(e.row)===r&&this.n.c()[e.colIdx]===i&&this.va(a,e.row,e.colIdx)}).catch(()=>{})}catch{}return Promise.resolve()}emit(e,t){let r={type:e,api:this.api,...t};this.le.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||oa.has(e))&&this.Sf(),r}reportError(e,t,r){let i=this.Mf(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.E&&this.emit("gridError",{code:i,error:e,source:t,context:r})}Mf(e,t){if(ra.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")||na.has(e)?"RENDERER_ERROR":e.toLowerCase().includes("editor")||e==="editable"?"EDITOR_ERROR":e.startsWith("feature.")?"FEATURE_ERROR":ia.some(i=>e.startsWith(i))?"STATE_ERROR":e.startsWith("eventBus.")||e.startsWith("eventHandler.")?"EVENT_HANDLER_ERROR":"GRID_ERROR"}Mo(){return{gridId:this.gridId,version:He,destroyed:this.E,infinite:this.i.p,loading:this.i.bd()||this.r.loading,rowCount:this.i.Gt(),renderedRowCount:this.o.me.querySelectorAll(".mach-row[data-index]").length,columnCount:this.n.X().length,selectedRowCount:this.m.Pe().length,dirtyRowCount:this.V.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.re.snapshot(),updates:this.Xt.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Zr(e,t){this.n.Zr(e,t),this.dr()}dr(){if(this.B.Po(),this.emit("sortChanged",{sortModel:this.n.U()}),this.i.p){this.i.Ae();return}this.i.b(),this.u({data:!0})}vo(e,t){let r=this.i.j();if(t?r[e.id]=t:delete r[e.id],this.i.vr(r),this.B.Ni(),this.emit("filterChanged",{filterModel:this.i.j(),advancedFilterModel:this.i.be()}),this.i.p){this.i.Ae();return}this.i.b(),this.u({data:!0})}$u(){if(this.emit("filterChanged",{filterModel:this.i.j(),advancedFilterModel:this.i.be()}),this.i.p){this.i.Ae();return}this.i.b(),this.u({data:!0})}ut(e,t){this.n.ut(e,t)&&(this.Fe(),this.emit("columnMoved",{colId:e,toIndex:t}))}mi(e){return this.i.mi(e)}ha(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}zt(e){if(!(this.E||e.length===0))for(let t of e){if(this.E)break;this.ha(t,!0)}}Io(){let e=++this.ed,t=this.Ts,r=this.r.persistence;if(!r)return;let{key:i,store:o,sections:s}=r,a;try{a=o?o.load(i):Mr(i)}catch(d){this.reportError(d,"gridState.load");return}let l=d=>{if(!(this.E||e!==this.ed||t!==this.Ts||!d)){this.Ds=!0;try{this.api.state.apply(d,{emitEvents:!1,...s?{sections:s}:{}})}finally{this.Ds=!1}}};a&&typeof a.then=="function"?Promise.resolve(a).then(l).catch(d=>this.reportError(d,"gridState.load")):l(a)}Sf(){let e=this.r.persistence;if(!(!e||this.E||this.Ds)){if(this.Ts++,this.dt&&clearTimeout(this.dt),e.debounceMs===0){this.dt=null,this.Rs();return}this.dt=setTimeout(()=>{this.dt=null,this.Rs()},e.debounceMs)}}Rs(){let e=this.r.persistence;if(!e||this.E)return;let{key:t,store:r,sections:i}=e,o=this.api.state.get(),s=i?zi(o,i):o,a={key:t,...r?{store:r}:{},state:s};if(this.Es){this.xs=a;return}this.sd(a)}sd(e){try{let t=e.store?e.store.save(e.key,e.state):Sr(e.key,e.state);if(!t||typeof t.then!="function")return;this.Es=!0,Promise.resolve(t).catch(r=>this.reportError(r,"gridState.save")).finally(()=>{this.Es=!1;let r=this.xs;this.xs=null,r&&this.sd(r)})}catch(t){this.reportError(t,"gridState.save")}}Xa(){let e=f("div","mach-empty mach-empty--error"),t=f("div","mach-empty__title");t.textContent=this.g("requestFailed");let r=f("div","mach-empty__hint");return r.textContent=this.g("requestFailedHint"),e.append(t,r),e}ja(){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.g("loading"),r.append(i,o),e.append(t,r),e}Ya(){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.g("emptyRows");let r=f("div","mach-empty__hint");return r.textContent=this.g("emptyRowsHint"),e.append(t,r),e}ko(e){if(!(this.r.suppressWarnings||this.E)){if(e)for(let t of Nr(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.ze().length>0&&console.warn("[mach-table] treeData \u4E0E rowGroup \u4E0D\u652F\u6301\u540C\u65F6\u542F\u7528\uFF0C\u884C\u5206\u7EC4\u5DF2\u88AB\u5FFD\u7565")}}rd(e){if(!(this.r.suppressWarnings||this.E)&&this.ad!==e){this.ad=e;for(let t of En(e))this.yn.has(t)||(this.yn.add(t),console.warn(`[mach-table] ${t}`))}}Fe(){this.Xt.Na({columns:!0})}u(e){this.Xt.Na(e)}Va(e){return this.Xt.batch(e)}Tf(e){this.E||(e.columns?this.If():(e.header&&this.B.Pr(),e.pool?this.a.Lo():e.layout&&this.he()),e.data&&!e.pool&&!e.columns?this.a.ef():e.cells&&this.a.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.de.refresh(),e.summary&&this.ne.refresh(),e.overlays&&this.a.cs())}If(){this.ko(),this.rd(this.n.Xr()),this.a.Vi(),this.B.Pr(),this.a.Lo(),this.he(),this.de.ce(),this.ne.refresh(),this.emit("displayedColumnsChanged",{})}he(){if(this.E)return;let e=this.re.start();this.zi(),this.n.Is(this.o.Ao());let t=this.n.c().map(r=>`${r.id}:${r.currentWidth}`).join("|");this.Cs&&t!==this.Cs&&this.a.Vi(),this.Cs=t,this.o.root.setAttribute("aria-colcount",String(this.n.c().length)),this.B.Ve(),this.a.he(),this.de.Ve(),this.ne.refresh(),this.re.pu(e)}zi(){if(!this.o.root)return;let e=this.r.treeData||this.n.ze().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")}Ze(e=!0){this.E||(this.n.Is(this.o.Ao()),e&&this.a.Vi(),this.B.Ve(),this.a.Hi(),this.a.ds(),this.a.Gr(!0),this.de.Ve(),this.ne.refresh())}destroy(){if(!this.E){if(this.dt&&(clearTimeout(this.dt),this.dt=null,this.Rs()),this.E=!0,this.ve(),this.qr&&cancelAnimationFrame(this.qr),this.qr=0,this.api){this.nd();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.x.dispose(),this.le.clear()}}};function aa(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 Vt(n,e).api}function la(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function da(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:Q(t.filterModel),advancedFilterModel:z(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:la(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function ca(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function ua(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 ha(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 pa(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function fa(n,e,t){if(t==="number"){n.type="rightAligned";return}if(t==="date"){n.valueFormatter=ua(e.format);return}if(t==="boolean"){n.valueFormatter=ca;return}if(t!=="select")return;let r=e.options??[];n.valueFormatter=ha(r),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:r})}function In(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:pa(n,e),cellClass:n.cellClass};return fa(t,n,e),t}function ma(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(In(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(In(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 ga(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?gr(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 Ge={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function ya(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Ge,...n}}function va(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",...Ge,...n}}function ba(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Ge,...n}}function wa(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:ke(r),...Ge,cellRendererParams:void 0}}function Ca(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:Gr(r),...Ge,cellRendererParams:void 0}}function Ta(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function Da(n){return[...n]}function Hr(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Ea(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 xa(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function Ra(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 Sa(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]=Ea(i,o))}}function Ma(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=xa(n,e);r&&(t.components=r);let i=Ra(n,e);return i&&(t.columnTypes=i),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=Hr(n.pagination,e.pagination),t.statusBar=Hr(n.statusBar,e.statusBar),t.watermark=Hr(n.watermark,e.watermark),Sa(t,n,e),t}function An(...n){return n.reduce(Ma,{})}function Ia(n={}){return An({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 Aa(n){return n}function La(n){return n}function ka(n){return n}function Ne(n){return`${typeof n}:${String(n)}`}function Vr(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Ln(n){let e=Math.max(0,Vr(n.ttlMs,3e5)),t=Math.max(1,Math.floor(Vr(n.maxSize,2e3))),r=Math.max(0,Vr(n.batchDelayMs,0)),i=new Map,o=new Map,s=new Map,a=null,l=null,d=!1,c=b=>{let g=i.get(b);if(g){if(g.expiresAt<=Date.now()){i.delete(b);return}return i.delete(b),i.set(b,g),g}},u=(b,g)=>{for(i.delete(b),i.set(b,{label:g,expiresAt:e===0?1/0:Date.now()+e});i.size>t;)i.delete(i.keys().next().value)},h=b=>o.get(b.id)===b,p=(b,g,y)=>{h(b)&&(o.delete(b.id),s.delete(b.id),b.batch&&b.batch.pendingCount--,b.batch=void 0,y?b.reject(y.cause):b.resolve(g))},m=()=>{!d&&s.size>0&&a==null&&l==null&&(a=setTimeout(()=>{R()},r))},v=()=>{if(l?.pendingCount===0){let b=l;l=null,b.controller.abort()}s.size===0&&a!=null&&(clearTimeout(a),a=null),m()},w=(b,g)=>{let y=new Set(b.entries.map(T=>T.id)),D=new Map;for(let T of g){let N=Ne(T.value);y.has(N)&&D.set(N,String(T.label))}for(let T of b.entries){if(!h(T))continue;let N=D.get(T.id);u(T.id,N),p(T,N)}},C=(b,g)=>{let y=[];for(let D of b.entries)h(D)&&(y.push(D.key),p(D,void 0,{cause:g}));if(!(y.length===0||b.controller.signal.aborted))try{Promise.resolve(n.onError?.(g,y)).catch(()=>{})}catch{}},R=async()=>{if(a=null,d||l||s.size===0)return;let b=[...s.values()];s.clear();let g={entries:b,controller:new AbortController,pendingCount:b.length};for(let y of b)y.batch=g;l=g;try{let y=await n.load(b.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=b=>{if(d)return Promise.reject(new Error("[MachTable] Dictionary resolver has been destroyed."));let g=Ne(b),y=c(g);if(y)return Promise.resolve(y.label);let D=o.get(g);if(D)return D.promise;let T,N,_=new Promise((zt,Vn)=>{T=zt,N=Vn}),L={id:g,key:b,promise:_,resolve:T,reject:N};return o.set(g,L),s.set(g,L),m(),_};return{get:b=>c(Ne(b))?.label,resolve:M,async resolveMany(b){let g=await Promise.all(b.map(async y=>[y,await M(y)]));return new Map(g.filter(y=>y[1]!==void 0))},prime(b){if(d)return;let g=new Map;for(let y of b){let D=Ne(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)}v()},invalidate(b){if(b)for(let g of b){let y=Ne(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)}v()},destroy(){d=!0,a!=null&&clearTimeout(a),a=null,l?.controller.abort(),l=null;let b=new Error("[MachTable] Dictionary resolver has been destroyed.");for(let g of o.values())p(g,void 0,{cause:b});i.clear()},get size(){return i.size}}}function Fe(n){return n!=null&&n!==""}function Pa(n){if(!Fe(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function Bt(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function kn(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function Ga(n){if(!Fe(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function Na(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",r=Bt(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),i=Bt(n.locale,{maximumFractionDigits:0}),o=Bt(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=Bt(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=kn(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=kn(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(!Fe(p))return e;let m=Pa(p);return m==null?t:u.format(m*h)},c=u=>({value:h})=>{if(!Fe(h))return e;let p=Ga(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 Fa(n,e={}){return t=>{if(!Fe(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 Pn(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Gn(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function Nn(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function Br(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==1)return null;let t=U({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 Oe(n){if(n==null||typeof n!="object")return null;let e=n,t=Nn(e.id),r=typeof e.name=="string"?e.name.trim().slice(0,120):"",i=Br(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 Fn(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 On(n,e,t={}){let r=Br(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 Hn(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??Pn())?.getItem(i(l));if(!d||Gn(d)>r)return[];let c=JSON.parse(d);return c.schemaVersion!==1||!Array.isArray(c.views)?[]:c.views.flatMap(u=>{let h=Oe(u);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let c=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(Gn(c)>r)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${r} bytes.`);let u=n.storage??Pn();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=Oe(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 Oa(){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 Ha(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??Hn(),i=async()=>(await r.list(t)).flatMap(s=>{let a=Oe(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=Nn(s)??Oa(),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:Fn(n)};return await r.save(t,u),u},async apply(o,s){let a=typeof o=="string"?(await i()).find(d=>d.id===o):Oe(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!On(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 Eh=He;export{qe as BUILTIN_AGG_FUNCS,x as DEFAULT_LOCALE,Se as EVENT_TYPES,Xo as LOCALE_EN,wa as actionsColumn,to as advancedFilterCondition,ro as advancedFilterGroup,On as applyGridViewState,ma as buildColDefsFromSchema,Fn as captureGridViewState,Es as clearGridState,ke as createActionButtonsRenderer,Zt as createAggResolver,Na as createBusinessColumnTypes,Ln as createCachedDictionary,Ta as createColumnHelper,Fa as createDictionaryRenderer,Ia as createEnterprisePreset,aa as createGrid,Ha as createGridViewManager,hn as createLocalGridStateStore,Hn as createLocalGridViewStore,ga as createMachTableCommands,An as createMachTablePreset,mn as createProgressBarRenderer,da as createRemoteExportRequest,Gr as createRowActionsRenderer,fn as createStatusTagRenderer,Da as defineColumns,La as defineGridOptions,ka as defineMachTableConfig,Aa as defineMachTablePreset,Tr as describeFilter,gr as downloadFile,ba as dragColumn,he as escapeHtml,W as formatText,Re as formatTwo,K as getByPath,va as indexColumn,we as isColDefGroup,Kt as isSafePath,gn as linkRenderer,Mr as loadGridState,ur as matchLocaleKey,z as normalizeAdvancedFilterModel,Wt as normalizeColumnFilter,Q as normalizeFilterModel,U as normalizeGridState,Br as normalizeGridViewState,Oe as normalizeSavedGridView,nr as parseCsv,or as parseDelimited,ir as parseTsv,Or as resolveGridFeatures,ms as resolveSaveConflict,pn as resolveTagVariant,Ca as rowActionsColumn,ce as sanitizeFormulaCell,Sr as saveGridState,ya as selectionColumn,ye as setByPath,rr as toTsv,Nr as validateGridOptions,Eh as version};
|