@opencorestack/opengridx 0.1.2 → 0.1.3
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/CHANGELOG.md +15 -0
- package/README.md +4 -2
- package/dist/opengridx.es.js +948 -949
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +11 -11
- package/dist/opengridx.umd.js.map +1 -1
- package/llms.txt +494 -0
- package/package.json +3 -2
package/dist/opengridx.umd.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(oe,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],l):(oe=typeof globalThis<"u"?globalThis:oe||self,l(oe.OpenGridX={},oe.React,oe.ReactDOM))})(this,(function(oe,l,
|
|
1
|
+
(function(oe,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],l):(oe=typeof globalThis<"u"?globalThis:oe||self,l(oe.OpenGridX={},oe.React,oe.ReactDOM))})(this,(function(oe,l,kt){"use strict";var an={exports:{}},Yt={};var qn;function Fo(){if(qn)return Yt;qn=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function e(r,i,s){var d=null;if(s!==void 0&&(d=""+s),i.key!==void 0&&(d=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:n,type:r,key:d,ref:i!==void 0?i:null,props:s}}return Yt.Fragment=o,Yt.jsx=e,Yt.jsxs=e,Yt}var Xt={};var Jn;function Wo(){return Jn||(Jn=1,process.env.NODE_ENV!=="production"&&(function(){function n(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===R?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case I:return"Fragment";case E:return"Profiler";case M:return"StrictMode";case y:return"Suspense";case P:return"SuspenseList";case S:return"Activity"}if(typeof v=="object")switch(typeof v.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),v.$$typeof){case m:return"Portal";case _:return v.displayName||"Context";case C:return(v._context.displayName||"Context")+".Consumer";case j:var H=v.render;return v=v.displayName,v||(v=H.displayName||H.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case k:return H=v.displayName||null,H!==null?H:n(v.type)||"Memo";case x:H=v._payload,v=v._init;try{return n(v(H))}catch{}}return null}function o(v){return""+v}function e(v){try{o(v);var H=!1}catch{H=!0}if(H){H=console;var F=H.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&v[Symbol.toStringTag]||v.constructor.name||"Object";return F.call(H,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),o(v)}}function r(v){if(v===I)return"<>";if(typeof v=="object"&&v!==null&&v.$$typeof===x)return"<...>";try{var H=n(v);return H?"<"+H+">":"<...>"}catch{return"<...>"}}function i(){var v=B.A;return v===null?null:v.getOwner()}function s(){return Error("react-stack-top-frame")}function d(v){if(Y.call(v,"key")){var H=Object.getOwnPropertyDescriptor(v,"key").get;if(H&&H.isReactWarning)return!1}return v.key!==void 0}function a(v,H){function F(){q||(q=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",H))}F.isReactWarning=!0,Object.defineProperty(v,"key",{get:F,configurable:!0})}function f(){var v=n(this.type);return D[v]||(D[v]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),v=this.props.ref,v!==void 0?v:null}function g(v,H,F,A,O,Q){var U=F.ref;return v={$$typeof:w,type:v,key:H,props:F,_owner:A},(U!==void 0?U:null)!==null?Object.defineProperty(v,"ref",{enumerable:!1,get:f}):Object.defineProperty(v,"ref",{enumerable:!1,value:null}),v._store={},Object.defineProperty(v._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(v,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(v,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:O}),Object.defineProperty(v,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(v.props),Object.freeze(v)),v}function p(v,H,F,A,O,Q){var U=H.children;if(U!==void 0)if(A)if($(U)){for(A=0;A<U.length;A++)b(U[A]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else b(U);if(Y.call(H,"key")){U=n(v);var T=Object.keys(H).filter(function(ne){return ne!=="key"});A=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",he[U+A]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,A,U,T,U),he[U+A]=!0)}if(U=null,F!==void 0&&(e(F),U=""+F),d(H)&&(e(H.key),U=""+H.key),"key"in H){F={};for(var se in H)se!=="key"&&(F[se]=H[se])}else F=H;return U&&a(F,typeof v=="function"?v.displayName||v.name||"Unknown":v),f(v,U,F,i(),O,Q)}function b(v){c(v)?v._store&&(v._store.validated=1):typeof v=="object"&&v!==null&&v.$$typeof===x&&(v._payload.status==="fulfilled"?c(v._payload.value)&&v._payload.value._store&&(v._payload.value._store.validated=1):v._store&&(v._store.validated=1))}function c(v){return typeof v=="object"&&v!==null&&v.$$typeof===w}var p=l,w=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),_=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),R=Symbol.for("react.client.reference"),B=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,$=Array.isArray,K=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(v){return v()}};var q,D={},Z=p.react_stack_bottom_frame.bind(p,s)(),J=K(r(s)),he={};Xt.Fragment=I,Xt.jsx=function(v,H,F){var A=1e4>B.recentlyCreatedOwnerStacks++;return h(v,H,F,!1,A?Error("react-stack-top-frame"):Z,A?K(r(v)):J)},Xt.jsxs=function(v,H,F){var A=1e4>B.recentlyCreatedOwnerStacks++;return h(v,H,F,!0,A?Error("react-stack-top-frame"):Z,A?K(r(v)):J)}})()),Xt}var Qn;function Oo(){return Qn||(Qn=1,process.env.NODE_ENV==="production"?an.exports=Fo():an.exports=Wo()),an.exports}var t=Oo();function Ao({row:n,rowIndex:o,listViewColumn:e,isSelected:r=!1,checkboxSelection:i=!1,rowHeight:s,onRowClick:d,onSelectionChange:a}){const g={row:n,value:void 0,field:e.field,colDef:{field:e.field},rowIndex:o,colIndex:0},f=h=>{h.stopPropagation(),a?.(n.id,h.target.checked)};return t.jsxs("div",{className:`ogx-list-view__row${r?" ogx-list-view__row--selected":""}`,style:s?{minHeight:s}:void 0,onClick:()=>d?.(n),role:"row","aria-rowindex":o+2,"aria-selected":r,children:[i&&t.jsx("div",{className:"ogx-list-view__checkbox",onClick:h=>h.stopPropagation(),children:t.jsx("input",{type:"checkbox",checked:r,onChange:f,"aria-label":`Select row ${n.id}`})}),t.jsx("div",{className:"ogx-list-view__cell",role:"gridcell",children:e.renderCell(g)})]})}const qt=({indeterminate:n=!1,label:o,className:e="",inputRef:r,...i})=>{const s=l.useRef(null),d=l.useCallback(g=>{s.current=g,typeof r=="function"?r(g):r&&(r.current=g)},[r]);l.useEffect(()=>{s.current&&(s.current.indeterminate=n)},[n]);const a=["ogx-checkbox-wrapper",i.disabled&&"ogx-checkbox-wrapper--disabled",e].filter(Boolean).join(" ");return t.jsxs("label",{className:a,children:[t.jsx("input",{ref:d,type:"checkbox",className:"ogx-checkbox__input","aria-label":o||i["aria-label"]||(n?"Select some":i.checked?"Deselect":"Select"),...i}),t.jsxs("span",{className:"ogx-checkbox__box",children:[i.checked&&!n&&t.jsx("svg",{className:"ogx-checkbox__icon",viewBox:"0 0 24 24","aria-hidden":"true",children:t.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}),n&&t.jsx("svg",{className:"ogx-checkbox__icon",viewBox:"0 0 24 24","aria-hidden":"true",children:t.jsx("path",{d:"M19 13H5v-2h14v2z"})})]}),o&&t.jsx("span",{className:"ogx-checkbox__label",children:o})]})};function zo(n){const{field:o,onResize:e,minWidth:r=50,maxWidth:i=1e3}=n,[s,d]=l.useState(!1),a=l.useRef(0),g=l.useRef(0),f=l.useCallback(c=>{c.preventDefault(),c.stopPropagation(),d(!0),a.current=c.clientX;const p=c.target.closest(".ogx__header-cell");p&&(g.current=p.getBoundingClientRect().width);let w=0;const m=16,I=E=>{const C=E.clientX-a.current,_=Math.max(r,Math.min(i,g.current+C)),j=Date.now();j-w>=m&&(e(o,_),w=j)},M=E=>{d(!1);const C=E.clientX-a.current,_=Math.max(r,Math.min(i,g.current+C));e(o,_),document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",M)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",M)},[o,e,r,i]),h=l.useCallback(c=>{c.preventDefault(),c.stopPropagation()},[o]),b=["ogx-column-resize-handle",s&&"ogx-column-resize-handle--dragging"].filter(Boolean).join(" ");return t.jsx("div",{className:b,onMouseDown:f,onClick:c=>c.stopPropagation(),onDragStart:c=>{c.preventDefault(),c.stopPropagation()},onDoubleClick:h,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} column`,children:t.jsx("div",{className:"ogx-column-resize-handle__line"})})}function dn(n,o){return o?o.left?.includes(n)?"left":o.right?.includes(n)?"right":null:null}function Bo(n,o){const e=[],r=[],i=[];return o?(n.forEach(s=>{const d=dn(s.field,o);d==="left"?e.push(s):d==="right"?i.push(s):r.push(s)}),o.left&&e.sort((s,d)=>{const a=o.left.indexOf(s.field),g=o.left.indexOf(d.field);return a-g}),o.right&&i.sort((s,d)=>{const a=o.right.indexOf(s.field),g=o.right.indexOf(d.field);return a-g}),{left:e,center:r,right:i}):{left:e,center:n,right:i}}function Zn(n,o,e,r,i,s,d,a){const g={};if(!e)return g;const f=Bo(n,e);let h=0;a&&(h+=48),s&&d&&(h+=48),r&&i&&(h+=48),f.left.forEach(c=>{g[c.field]=h;const p=o[c.field]??c.width??100;h+=p});let b=0;return[...f.right].reverse().forEach(c=>{const p=o[c.field]??c.width??100;g[c.field]=b,b+=p}),g}function Sn(n,o){return o?o.top?.includes(n)?"top":o.bottom?.includes(n)?"bottom":null:null}function $o(n,o){const e=[],r=[],i=[];return o?(n.forEach(s=>{const d=Sn(s.id,o);d==="top"?e.push(s):d==="bottom"?i.push(s):r.push(s)}),o.top&&e.sort((s,d)=>{const a=o.top.indexOf(s.id),g=o.top.indexOf(d.id);return a-g}),o.bottom&&i.sort((s,d)=>{const a=o.bottom.indexOf(s.id),g=o.bottom.indexOf(d.id);return a-g}),{top:e,center:r,bottom:i}):{top:e,center:n,bottom:i}}function Mt(){return t.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",children:t.jsx("circle",{cx:"4",cy:"4",r:"4"})})}function It(){return t.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:t.jsx("circle",{cx:"4",cy:"4",r:"3"})})}function Ho(){return t.jsxs("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",width:"13",height:"13",fill:"none",children:[t.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("rect",{x:"8.5",y:"4",width:"7",height:"16",fill:"currentColor",opacity:"0.3"}),t.jsx("line",{x1:"8.5",y1:"4",x2:"8.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"15.5",y1:"4",x2:"15.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"2",y1:"9",x2:"22",y2:"9",stroke:"currentColor",strokeWidth:"1.2"}),t.jsx("line",{x1:"2",y1:"14",x2:"22",y2:"14",stroke:"currentColor",strokeWidth:"1.2"})]})}function Do(){return t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),t.jsx("polyline",{points:"5 12 12 5 19 12"})]})}function Go(){return t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("polyline",{points:"19 12 12 19 5 12"})]})}function Vo(){return t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})}function Uo(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),t.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),t.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function Ko(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"4",y1:"2",x2:"4",y2:"22"}),t.jsx("polyline",{points:"11 8 4 12 11 16"}),t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function Yo(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"20",y1:"2",x2:"20",y2:"22"}),t.jsx("polyline",{points:"13 8 20 12 13 16"}),t.jsx("line",{x1:"20",y1:"12",x2:"4",y2:"12"})]})}function Xo(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"}),t.jsx("line",{x1:"4",y1:"4",x2:"4",y2:"20"}),t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function qo({colDef:n,sortModel:o,onSort:e,onHide:r,onPin:i,pinnedColumns:s,onManageColumns:d,onClose:a,anchorEl:g}){const f=l.useRef(null),[h,b]=l.useState({position:"fixed",zIndex:1300,top:0,left:0,visibility:"hidden"});l.useLayoutEffect(()=>{if(!g||!f.current)return;const j=g.getBoundingClientRect(),y=f.current.getBoundingClientRect(),P=window.innerWidth,k=window.innerHeight,x=8;let S=j.left;S+y.width+x>P&&(S=P-y.width-x),S<x&&(S=x);let R=j.bottom+4;R+y.height+x>k&&(R=j.top-y.height-4),b({position:"fixed",zIndex:1300,top:R,left:S,visibility:"visible"})},[g]),l.useEffect(()=>{function j(P){f.current&&!f.current.contains(P.target)&&g&&!g.contains(P.target)&&a()}function y(P){P.key==="Escape"&&a()}return document.addEventListener("mousedown",j),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",y)}},[g,a]);const c=j=>{e?.(n.field,j),a()},p=()=>{r?.(n.field),a()},w=j=>{i?.(n.field,j),a()},m=o?.find(j=>j.field===n.field)?.sort,I=m==null,M=s?.left?.includes(n.field)??!1,E=s?.right?.includes(n.field)??!1,C=!M&&!E,_=n.headerName||n.field;return yt.createPortal(t.jsxs("div",{ref:f,className:"ogx-column-menu",style:h,role:"menu","aria-label":`Column options for ${_}`,children:[e&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{className:`ogx-menu-item${m==="asc"?" ogx-menu-item--active":""}`,onClick:()=>c("asc"),role:"menuitemradio","aria-checked":m==="asc",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:m==="asc"?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Do,{})}),"Sort Ascending"]}),t.jsxs("button",{className:`ogx-menu-item${m==="desc"?" ogx-menu-item--active":""}`,onClick:()=>c("desc"),role:"menuitemradio","aria-checked":m==="desc",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:m==="desc"?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Go,{})}),"Sort Descending"]}),t.jsxs("button",{className:`ogx-menu-item${I?" ogx-menu-item--active":""}`,onClick:()=>c(null),role:"menuitemradio","aria-checked":I,children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:I?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Vo,{})}),"Unsort"]}),t.jsx("div",{className:"ogx-menu-divider"})]}),t.jsx("div",{className:"ogx-menu-section-label","aria-hidden":"true",children:"Pin column"}),t.jsxs("button",{className:`ogx-menu-item${M?" ogx-menu-item--active":""}`,onClick:()=>w("left"),role:"menuitemradio","aria-checked":M,"aria-label":"Pin to left",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:M?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Ko,{})}),"Pin to Left"]}),t.jsxs("button",{className:`ogx-menu-item${E?" ogx-menu-item--active":""}`,onClick:()=>w("right"),role:"menuitemradio","aria-checked":E,"aria-label":"Pin to right",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:E?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Yo,{})}),"Pin to Right"]}),t.jsxs("button",{className:`ogx-menu-item${C?" ogx-menu-item--active":""}`,onClick:()=>w(null),role:"menuitemradio","aria-checked":C,"aria-label":"Unpin column",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:C?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Xo,{})}),"Unpin"]}),t.jsx("div",{className:"ogx-menu-divider"}),t.jsxs("button",{className:"ogx-menu-item",onClick:p,role:"menuitem","aria-label":`Hide ${_} column`,children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true"}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Uo,{})}),"Hide Column"]}),t.jsx("div",{className:"ogx-menu-divider"}),t.jsxs("button",{className:"ogx-menu-item",onClick:()=>{d?.(),a()},role:"menuitem","aria-label":"Manage all columns",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true"}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Ho,{})}),"Manage columns"]})]}),document.body)}function Jo(){return t.jsx("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18",children:t.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})})}function Qo(){return t.jsx("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",width:"18",height:"18",fill:"currentColor",children:t.jsx("path",{d:"M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"})})}function eo(n){const o=[];for(const e of n.children)typeof e=="string"?o.push(e):o.push(...eo(e));return o}function Zo(n){let o=0;function e(r,i){o=Math.max(o,i);for(const s of r.children)typeof s!="string"&&e(s,i+1)}return n.forEach(r=>e(r,1)),o}function er(n,o,e){function r(a,g,f){if(!eo(a).includes(g))return null;if(f===e)return a;for(const h of a.children)if(typeof h!="string"){const b=r(h,g,f+1);if(b)return b}return null}const i=new Map;for(const a of o){let g=null;for(const f of n)if(g=r(f,a.field,0),g)break;i.set(a.field,g)}const s=[];let d=0;for(;d<o.length;){const a=o[d],g=i.get(a.field)??null,f=a.width;if(!g)s.push({key:`fg-${a.field}-${e}`,label:"",width:f,isGroup:!1}),d++;else{let h=0,b=d;for(;b<o.length&&i.get(o[b].field)===g;)h+=o[b].width,b++;s.push({key:`${g.groupId}-${e}`,label:g.headerName,width:h,isGroup:!0}),d=b}}return s}function to(n){const{columns:o,allColumns:e,columnGroupingModel:r,checkboxSelection:i=!1,allSelected:s=!1,someSelected:d=!1,onSelectAll:a,onSort:g,sortModel:f=[],onColumnResize:h,columnWidths:b={},pinnedColumns:c,hasDetailPanel:p=!1,pinCheckboxColumn:w=!0,pinExpandColumn:m=!0,rowReordering:I=!1,aggregationModel:M,draggedColumn:E,dragOverColumn:C,onDragStart:_,onDragOver:j,onDragEnd:y,onDrop:P,focusedCell:k,onHeaderClick:x,onHideColumn:S,onPinColumn:R,onManageColumns:B}=n,Y=l.useRef({}),[$,K]=l.useState(null),q=T=>se=>{se.stopPropagation(),K({colDef:T,anchorEl:se.currentTarget})},D=()=>{K(null)};l.useLayoutEffect(()=>{if(k?.id==="HEADER"){const T=Y.current[k.field];T&&T.focus()}},[k]);const Z=T=>()=>{if(T.sortable===!1||!g)return;const se=f.find(xe=>xe.field===T.field);let ne="asc";se&&(se.sort==="asc"?ne="desc":ne=null),g(T.field,ne)},J=T=>{const se=f.find(ne=>ne.field===T);return se?t.jsx("span",{className:`ogx__sort-icon ogx__sort-icon--${se.sort}`,"aria-hidden":"true"}):null},he=l.useMemo(()=>Zn(o,b,c,i,w,p,m,I),[o,b,c,i,w,p,m,I]),v=r?Zo(r):0,F=(e??o).filter(T=>!T.isSpacer).map(T=>({field:T.field,width:b[T.field]??T.width??100})),U=(I?48:0)+(p?48:0)+(i?48:0);return t.jsxs("div",{className:"ogx__header-wrap",children:[v>0&&Array.from({length:v},(T,se)=>{const ne=er(r,F,se);return t.jsxs("div",{className:"ogx-col-group-row",role:"row",children:[U>0&&t.jsx("div",{className:"ogx-col-group-cell ogx-col-group-cell--filler",style:{width:U,minWidth:U,flexShrink:0},role:"columnheader"}),ne.map(xe=>t.jsx("div",{role:"columnheader",className:`ogx-col-group-cell ${xe.isGroup?"ogx-col-group-cell--group":"ogx-col-group-cell--filler"}`,style:{width:xe.width,minWidth:xe.width,flexShrink:0},title:xe.isGroup?xe.label:void 0,children:xe.isGroup&&t.jsx("span",{className:"ogx-col-group-cell__label",children:xe.label})},xe.key))]},`ogx-grp-${se}`)}),t.jsxs("div",{className:"ogx__header",role:"row",children:[I&&t.jsx("div",{className:"ogx__header-cell ogx__header-cell--pinned ogx__header-cell--pinned-left",role:"columnheader","aria-label":"Row reorder handle",title:"Drag to reorder rows",style:{minWidth:48,maxWidth:48,position:"sticky",left:0,zIndex:4}}),p&&t.jsx("div",{className:`ogx__header-cell ogx__header-cell--expand ${m?"ogx__header-cell--pinned ogx__header-cell--pinned-left":""}`,role:"columnheader","aria-label":"Expand row details",style:{minWidth:48,maxWidth:48,position:m?"sticky":void 0,left:m?I?48:0:void 0,zIndex:m?5:void 0}}),i&&t.jsx("div",{className:`ogx__header-cell ogx__header-cell--checkbox ${w?"ogx__header-cell--pinned ogx__header-cell--pinned-left":""}`,role:"columnheader",style:{position:w?"sticky":void 0,left:w?(I?48:0)+(p&&m?48:0):void 0},children:t.jsx(qt,{id:"ogx-select-all",name:"ogx-select-all",checked:s,indeterminate:d,onChange:T=>a?.(T.target.checked),"aria-label":s?"Deselect all rows":"Select all rows",tabIndex:k?.id==="HEADER"&&k.field==="__checkbox_col__"?0:-1,onMouseDown:T=>T.preventDefault(),inputRef:T=>{Y.current.__checkbox_col__=T}})}),o.map((T,se)=>{if(T.isSpacer)return t.jsx("div",{style:{width:T.width,minWidth:T.width,flexShrink:0},"aria-hidden":"true"},T.field);const ne=T.sortable!==!1,xe=f.some(We=>We.field===T.field),Qe=T.resizable!==!1,z=dn(T.field,c),Se=z!==null,je=E===T.field,ct=C===T.field,Be=["ogx__header-cell",`ogx__header-cell--align-${T.headerAlign||T.align||"left"}`,ne&&"ogx__header-cell--sortable",xe&&"ogx__header-cell--sorted",Se&&"ogx__header-cell--pinned",Se&&`ogx__header-cell--pinned-${z}`,je&&"ogx__header-cell--dragging",ct&&"ogx__header-cell--drag-over",k?.id==="HEADER"&&k.field===T.field&&"ogx__header-cell--focused",T.headerClassName].filter(Boolean).join(" "),ut={width:b[T.field]??T.width??100,minWidth:T.minWidth,maxWidth:T.maxWidth,flexGrow:T.flex??0,flexShrink:0,flexBasis:(T.flex,"auto"),boxSizing:"border-box",position:Se?"sticky":"relative",zIndex:T.zIndex,opacity:je?.5:1};if(Se&&z){const We=he[T.field];z==="left"?ut.left=We:ut.right=We}const en=T.renderHeader?T.renderHeader({field:T.field,colDef:T,colIndex:se}):T.headerName||T.field,Lt=We=>{if(We.target.closest(".ogx-column-resize-handle")){We.stopPropagation();return}x?.(T.field),ne&&Z(T)()},St=_?_(T.field):void 0,Rt=j?j(T.field):void 0,wt=P?P(T.field):void 0;return t.jsxs("div",{className:Be,style:ut,onClick:Lt,role:"columnheader",draggable:!!_,onDragStart:St,onDragOver:Rt,onDragEnd:y,onDrop:wt,"aria-sort":ne?xe?f.find(We=>We.field===T.field)?.sort==="asc"?"ascending":"descending":"none":void 0,"aria-colindex":se+1+(i?1:0),"data-field":T.field,tabIndex:-1,ref:We=>{Y.current[T.field]=We},children:[t.jsxs("div",{className:"ogx__header-cell-content",children:[je&&t.jsx("div",{className:"ogx__header-drag-icon",children:t.jsx(Qo,{})}),t.jsxs("div",{className:"ogx__header-cell-title-wrapper",children:[t.jsx("span",{className:"ogx__header-cell-title",children:en}),M&&M[T.field]&&t.jsx("span",{className:"ogx__header-cell-aggregation",children:M[T.field]})]}),ne&&J(T.field),!T.disableColumnMenu&&t.jsx("button",{className:"ogx__menu-icon-btn",onClick:q(T),"aria-label":`Open column menu for ${T.headerName||T.field}`,"aria-haspopup":"menu",tabIndex:-1,children:t.jsx(Jo,{})})]}),Qe&&h&&t.jsx(zo,{field:T.field,onResize:h,minWidth:T.minWidth,maxWidth:T.maxWidth})]},T.field)}),$&&t.jsx(qo,{colDef:$.colDef,sortModel:f,onSort:g,onHide:S,onPin:R,pinnedColumns:c,onManageColumns:B,onClose:D,anchorEl:$.anchorEl})]})]})}function tr({value:n,onValueChange:o,onCommit:e,onCancel:r}){const[i,s]=l.useState(String(n??"")),d=l.useRef(null);return l.useEffect(()=>{d.current?.focus(),d.current?.select()},[]),t.jsx("input",{ref:d,type:"text",className:"ogx__edit-input",value:i,onChange:a=>{s(a.target.value),o(a.target.value)},onBlur:e,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),e()),a.key==="Escape"&&(a.stopPropagation(),r())}})}function nr({value:n,onValueChange:o,onCommit:e,onCancel:r}){const[i,s]=l.useState(n??""),d=l.useRef(null);return l.useEffect(()=>{d.current?.focus(),d.current?.select()},[]),t.jsx("input",{ref:d,type:"number",className:"ogx__edit-input ogx__edit-input--number",value:i,onChange:a=>{const g=a.target.value===""?"":Number(a.target.value);s(g),o(g===""?null:g)},onBlur:e,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),e()),a.key==="Escape"&&(a.stopPropagation(),r())}})}function or({value:n,onValueChange:o,onCommit:e,onCancel:r}){const i=l.useRef(null);l.useEffect(()=>{i.current?.focus()},[]);const s=()=>{o(!n),setTimeout(e,0)};return t.jsx("div",{className:"ogx__edit-boolean",children:t.jsx("input",{ref:i,type:"checkbox",className:"ogx__edit-checkbox",checked:!!n,onChange:s,onKeyDown:d=>{d.key==="Escape"&&(d.stopPropagation(),r())}})})}function rr({value:n,colDef:o,onValueChange:e,onCommit:r,onCancel:i}){const s=l.useRef(null);l.useEffect(()=>{s.current?.focus()},[]);const d=o.valueOptions??[];return t.jsx("select",{ref:s,className:"ogx__edit-select",value:n??"",onChange:a=>{e(a.target.value)},onBlur:r,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),r()),a.key==="Escape"&&(a.stopPropagation(),i())},children:d.map(a=>{const g=typeof a=="object"?a.value:a,f=typeof a=="object"?a.label:String(a);return t.jsx("option",{value:String(g),children:f},String(g))})})}function ir({value:n,onValueChange:o,onCommit:e,onCancel:r}){const[i,s]=l.useState(n??""),d=l.useRef(null);return l.useEffect(()=>{d.current?.focus()},[]),t.jsx("input",{ref:d,type:"date",className:"ogx__edit-input",value:i,onChange:a=>{s(a.target.value),o(a.target.value)},onBlur:e,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),e()),a.key==="Escape"&&(a.stopPropagation(),r())}})}function lr(n){const{colDef:o}=n;switch(o.type){case"number":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(nr,{...n})});case"boolean":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(or,{...n})});case"singleSelect":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(rr,{...n})});case"date":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(ir,{...n})});default:return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(tr,{...n})})}}function sr(n){const{onCellClick:o,onCellEditStart:e,onCellValueChange:r,value:i,row:s,colDef:d,rowIndex:a,colIndex:g,isSelected:f,onClick:h,width:b,pinnedPosition:c,pinnedOffset:p,isFocused:w,isFocusVisible:m,isEditable:I,isEditing:M,onEditStart:E,onEditStop:C,onValueChange:_,colSpanInfo:j,rowSpan:y,isHiddenByRowSpan:P}=n;if(j?.spannedByColSpan)return null;if(P)return t.jsx("div",{className:"ogx__cell ogx__cell--hidden",style:{width:b??d.width??100},role:"presentation","data-field":d.field,"data-colindex":g});const k=v=>{o&&(v.stopPropagation(),o({row:s,field:d.field,value:i,colDef:d,rowIndex:a,colIndex:g})),h?.(v)},x=l.useCallback(v=>{r?r(d.field,v):_?.(v)},[r,_,d.field]),S=v=>{I&&(E||e)&&(v.stopPropagation(),e?e(d.field,i):E?.())},R=l.useMemo(()=>d.valueFormatter?d.valueFormatter({value:i,row:s,field:d.field}):i==null?"":String(i),[i,s,d]),B=l.useMemo(()=>M&&(r||_)&&C?d.renderEditCell?d.renderEditCell({value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:g}):t.jsx(lr,{value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:g,onValueChange:x,onCommit:()=>C(),onCancel:()=>C(!0)}):d.renderCell?d.renderCell({value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:g}):R,[i,s,d,a,g,R,M,x,C,r,_]),Y=c!=null,$=l.useMemo(()=>d.cellClassName?typeof d.cellClassName=="function"?d.cellClassName({value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:g})||"":d.cellClassName:"",[d,i,s,a,g]),K=["ogx__cell",`ogx__cell--align-${d.align||"left"}`,f&&"ogx__cell--selected",w&&"ogx__cell--focused",w&&m&&"ogx__cell--focus-visible",d.type&&`ogx__cell--type-${d.type}`,Y&&"ogx__cell--pinned",Y&&`ogx__cell--pinned-${c}`,M&&"ogx__cell--editing",y&&y>1&&"ogx__cell--spanned",$].filter(Boolean).join(" "),q=j?.cellProps?.colSpan||1,D=y||1,Z=j?.cellProps?.width??b??d.width??100,J={width:"var(--width)","--width":typeof Z=="number"?`${Z}px`:Z,flexGrow:d.flex??0,flexShrink:0,flexBasis:(d.flex,"auto"),boxSizing:"border-box",minWidth:d.minWidth,maxWidth:d.maxWidth,position:Y?"sticky":void 0,zIndex:d.zIndex??(Y?3:void 0),padding:M?0:void 0};D>1&&(J.height=`calc(var(--height) * ${D} - var(--border-width, 1px))`,J.zIndex=10,Y&&(J.zIndex=40)),Y&&p!==void 0&&(c==="left"?J.left=p:J.right=p);const he=l.useRef(null);return l.useLayoutEffect(()=>{w&&he.current&&he.current.focus({preventScroll:!0})},[w]),t.jsx("div",{ref:he,className:K,style:J,onClick:k,onDoubleClick:S,role:"gridcell","aria-colindex":g+1,"aria-readonly":!I||void 0,tabIndex:-1,"data-field":d.field,"data-colindex":g,...q>1?{"aria-colspan":q}:{},...D>1?{"aria-rowspan":D}:{},children:t.jsx("div",{className:"ogx__cell-content",children:B})})}const no=l.memo(sr);function oo({isExpanded:n,onClick:o,variant:e="chevron"}){return t.jsx("button",{className:`ogx-expand-icon ${n?"ogx-expand-icon--expanded":""}`,onClick:r=>{o&&o(r)},"aria-label":n?"Collapse row":"Expand row",type:"button",children:e==="plus-minus"?t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M4 8H12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M8 4V12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:n?0:1,transition:"opacity 0.2s ease",transformOrigin:"center"}})]}):t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:n?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"},children:t.jsx("path",{d:"M6 4L10 8L6 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}const ar=({className:n="",...o})=>t.jsx("button",{type:"button",className:`ogx-drag-handle ${n}`,"aria-label":"Drag to reorder row",...o,children:t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})})});function dr(n){const{content:o,height:e,isExpanded:r}=n;if(!r)return null;const i={height:e==="auto"?"auto":`${e}px`,overflow:e==="auto"?"visible":"auto"};return t.jsx("div",{className:"ogx__detail-panel",style:i,children:t.jsx("div",{className:"ogx__detail-panel-content",children:o})})}function Jt(n){const{row:o,columns:e,rowIndex:r,isSelected:i=!1,checkboxSelection:s=!1,onRowClick:d,onCellClick:a,onSelectionChange:g,columnWidths:f={},pinnedColumns:h,pinnedRows:b,hasDetailPanel:c=!1,isDetailPanelExpanded:p=!1,onDetailPanelToggle:w,detailPanelContent:m,detailPanelHeight:I=200,pinCheckboxColumn:M=!0,pinExpandColumn:E=!0,rowReordering:C=!1,onDragStart:_,onDragOver:j,onDragEnd:y,onDrop:P,isDragging:k,isDragOver:x,editingCell:S,onEditStart:R,onEditStop:B,onEditCellValueChange:Y,focusedCellField:$,isFocusVisible:K,colspanMap:q,rowSpanningCaches:D,rowHeight:Z=52}=n,J=l.useRef(null),he=l.useRef(null);if(o._isSkeleton){const z=Math.max(e.length,5);return t.jsx("div",{className:"ogx__row ogx__row--skeleton",role:"row","aria-hidden":"true",style:{height:Z,minHeight:Z},children:Array.from({length:z}).map((Se,je)=>t.jsx("div",{className:"ogx__skeleton-cell",children:t.jsx("div",{className:"ogx__skeleton-bar"})},je))})}l.useLayoutEffect(()=>{$==="__expand_col__"&&J.current&&J.current.focus({preventScroll:!0}),$==="__checkbox_col__"&&he.current&&he.current.focus({preventScroll:!0})},[$]);const v=z=>{z.target.closest(".ogx-checkbox-wrapper, .ogx-expand-icon, .ogx-drag-handle, .ogx__edit-cell")||d?.({row:o,id:o.id,rowIndex:r})},H=z=>{z.stopPropagation(),g?.(o.id,z.target.checked)},F=z=>{z.stopPropagation(),w?.(o.id)},A=l.useMemo(()=>Zn(e,f,h,s,M,c,E,C),[e,f,h,s,M,c,E,C]),O=Sn(o.id,b),Q=O==="top",U=O==="bottom",T=o._hasChildren===!0,se=l.useCallback((z,Se)=>{T||R?.({id:o.id,field:z,value:Se})},[T,o.id,R]),ne=l.useCallback((z,Se)=>{Y?.({id:o.id,field:z,value:Se})},[Y,o.id]),xe=l.useCallback(z=>{B?.({cancel:z})},[B]),Qe=["ogx__row",i&&"ogx__row--selected",r%2===0&&"ogx__row--even",r%2===1&&"ogx__row--odd",Q&&"ogx__row--pinned-top",U&&"ogx__row--pinned-bottom",k&&"ogx__row--dragging",x&&"ogx__row--drag-over",T&&"ogx__row--group"].filter(Boolean).join(" ");return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:Qe,onClick:v,role:"row","aria-rowindex":r+1,"aria-selected":i,"data-rowindex":r,onDragOver:j?j(o.id):void 0,onDrop:P?P(o.id):void 0,style:{maxHeight:`${Z}px`,minHeight:`${Z}px`,"--height":`${Z}px`,"--border-width":"1px"},children:[C&&t.jsx("div",{className:"ogx__cell ogx__cell--drag-handle",role:"gridcell","aria-label":"Drag to reorder row",style:{position:"sticky",left:0,zIndex:4},draggable:!0,onDragStart:_?_(o.id):void 0,onDragEnd:y,onClick:z=>z.stopPropagation(),children:t.jsx(ar,{})}),c&&t.jsx("div",{className:`ogx__cell ogx__cell--expand ${E?"ogx__cell--pinned-left":""} ${$==="__expand_col__"?"ogx__cell--focused":""} ${$==="__expand_col__"&&K?"ogx__cell--focus-visible":""}`,role:"gridcell","aria-label":p?"Collapse row details":"Expand row details","aria-expanded":p,style:{position:E?"sticky":void 0,left:E?C?48:0:void 0,zIndex:E?5:void 0},ref:J,tabIndex:-1,onClick:z=>{z.stopPropagation(),a?.({row:o,field:"__expand_col__",value:p,colDef:{field:"__expand_col__",width:48},rowIndex:r,colIndex:-1})},children:t.jsx(oo,{isExpanded:p,onClick:F,variant:"plus-minus"})}),s&&t.jsx("div",{className:`ogx__cell ogx__cell--checkbox ${M?"ogx__cell--pinned-left":""} ${$==="__checkbox_col__"?"ogx__cell--focused":""} ${$==="__checkbox_col__"&&K?"ogx__cell--focus-visible":""}`,role:"gridcell",style:{position:M?"sticky":void 0,left:M?(C?48:0)+(c&&E?48:0):void 0,zIndex:M?11:void 0},ref:he,tabIndex:-1,onClick:z=>{z.stopPropagation(),a?.({row:o,field:"__checkbox_col__",value:i,colDef:{field:"__checkbox_col__",width:48},rowIndex:r,colIndex:-1})},children:t.jsx(qt,{id:`ogx-select-row-${o.id}`,name:`ogx-select-row-${o.id}`,checked:i,onChange:H,onClick:z=>z.stopPropagation(),"aria-label":i?`Deselect row ${o.id}`:`Select row ${o.id}`,tabIndex:-1,onMouseDown:z=>z.preventDefault()})}),e.map((z,Se)=>{if(z.isSpacer)return t.jsx("div",{style:{width:z.width,minWidth:z.width,flexShrink:0},"aria-hidden":"true"},z.field);const je=z.valueGetter?z.valueGetter({row:o,field:z.field,value:o[z.field]}):o[z.field],ct=f[z.field]??z.width,Be=dn(z.field,h),kt=Be?A[z.field]:void 0,ut=S?.id===o.id&&S?.field===z.field,en=ut?S?.value:je,Lt=q?.get(o.id)?.[z.field],St=D?.spannedCells[o.id]?.[z.field],Rt=D?.hiddenCells[o.id]?.[z.field]||!1;return t.jsx(no,{value:en,row:o,colDef:z,rowIndex:r,colIndex:Se,isSelected:i,onCellClick:a,width:ct,pinnedPosition:Be,pinnedOffset:kt,isFocused:$===z.field,isFocusVisible:K,isEditable:z.editable,isEditing:ut,onCellEditStart:se,onEditStop:xe,onCellValueChange:ne,colSpanInfo:Lt,rowSpan:St,isHiddenByRowSpan:Rt},z.field)})]}),c&&t.jsx(dr,{row:o,rowId:o.id,rowIndex:r,content:m,height:I,isExpanded:p})]})}const cr=({columns:n,rowHeight:o,checkboxSelection:e=!1,hasDetailPanel:r=!1,rowReordering:i=!1})=>t.jsxs("div",{className:"ogx__row ogx__skeleton-row",style:{height:o},role:"row",children:[e&&t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:48,minWidth:48},children:t.jsx("div",{className:"ogx-skeleton-box",style:{width:18,height:18,borderRadius:2}})}),r&&t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:48,minWidth:48},children:t.jsx("div",{className:"ogx-skeleton-box",style:{width:18,height:18,borderRadius:2}})}),i&&t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:48,minWidth:48},children:t.jsx("div",{className:"ogx-skeleton-box",style:{width:18,height:18,borderRadius:2}})}),n.map((s,d)=>{const a=s.width||150,g=Math.min(a*.7,a-20);return t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:a,minWidth:s.minWidth,maxWidth:s.maxWidth,left:s.left,right:s.right,position:s.isSpacer?"relative":s.pinned?"sticky":"relative",zIndex:s.zIndex},children:!s.isSpacer&&t.jsx("div",{className:"ogx-skeleton-box",style:{width:g,height:16,borderRadius:4}})},s.field||d)})]}),Qt=({variant:n="text",size:o="medium",color:e="default",disabled:r=!1,className:i="",children:s,...d})=>{const a=["ogx-button",`ogx-button--${n}`,`ogx-button--${o}`,`ogx-button--${e}`,r&&"ogx-button--disabled",i].filter(Boolean).join(" ");return t.jsx("button",{className:a,disabled:r,...d,children:s})};function ro(n){const{page:o,pageSize:e,rowCount:r,onPageChange:i,onPageSizeChange:s,pageSizeOptions:d=[10,25,50,100],showFirstButton:a=!0,showLastButton:g=!0}=n,f=Math.max(1,Math.ceil(r/e)),h=Math.min(o,f-1),b=h*e,c=Math.min(b+e,r),p=r===0?0:`${b+1}–${c}`,w=()=>{i(0)},m=()=>{i(Math.max(0,h-1))},I=()=>{i(Math.min(f-1,h+1))},M=()=>{i(f-1)},E=j=>{const y=parseInt(j.target.value,10);s(y)},C=h===0,_=h>=f-1;return t.jsxs("div",{className:"ogx-pagination",role:"navigation","aria-label":"Pagination",children:[t.jsxs("div",{className:"ogx-pagination__page-size",children:[t.jsx("label",{htmlFor:"page-size-select",className:"ogx-pagination__label",children:"Rows per page:"}),t.jsx("select",{id:"page-size-select",className:"ogx-pagination__select",value:e,onChange:E,"aria-label":"Rows per page",children:d.map(j=>t.jsx("option",{value:j,children:j},j))})]}),t.jsxs("div",{className:"ogx-pagination__info","aria-live":"polite","aria-atomic":"true",children:[p," of ",r]}),t.jsxs("div",{className:"ogx-pagination__actions",children:[a&&t.jsx(Qt,{variant:"text",size:"small",onClick:w,disabled:C,"aria-label":"Go to first page",title:"First page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})})}),t.jsx(Qt,{variant:"text",size:"small",onClick:m,disabled:C,"aria-label":"Go to previous page",title:"Previous page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),t.jsxs("div",{className:"ogx-pagination__page-info","aria-current":"page",children:["Page ",h+1," of ",f]}),t.jsx(Qt,{variant:"text",size:"small",onClick:I,disabled:_,"aria-label":"Go to next page",title:"Next page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})}),g&&t.jsx(Qt,{variant:"text",size:"small",onClick:M,disabled:_,"aria-label":"Go to last page",title:"Last page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})})})]})]})}function ur(n,o,e={}){const r=new Map,i=[];n.forEach(a=>{const g=a.id;r.set(g,a),i.push(g)});const s=new Map,d=[];return o.forEach(a=>{s.set(a.field,a),d.push(a.field)}),{rows:{idRowsLookup:r,allRows:i},columns:{all:o,lookup:s,orderedFields:d,columnVisibilityModel:e},sorting:{sortModel:[]},filter:{filterModel:{items:[]}},pagination:{paginationModel:{page:0,pageSize:100},rowCount:n.length},selection:{selectedRows:new Set},pinning:{pinnedColumns:{},pinnedRows:{}},virtualization:{renderContext:{firstRowIndex:0,lastRowIndex:0,firstColumnIndex:0,lastColumnIndex:0},scrollTop:0,scrollLeft:0},dimensions:{rowHeight:52,headerHeight:56,viewportWidth:0,viewportHeight:0},dataSource:{loading:!1,error:null}}}function gr(n,o){switch(o.type){case"SET_ROWS":{const e=Array.from(n.rows.idRowsLookup.values()),r=typeof o.payload=="function"?o.payload(e):o.payload,i=new Map,s=[];return r.forEach(d=>{i.set(d.id,d),s.push(d.id)}),{...n,rows:{idRowsLookup:i,allRows:s},pagination:{...n.pagination,rowCount:o.preserveRowCount?n.pagination.rowCount:r.length}}}case"SET_COLUMNS":{const e=new Map,r=[];return o.payload.forEach(i=>{e.set(i.field,i),r.push(i.field)}),{...n,columns:{all:o.payload,lookup:e,orderedFields:r,columnVisibilityModel:{}}}}case"SET_SORT_MODEL":return{...n,sorting:{sortModel:o.payload}};case"SET_FILTER_MODEL":return{...n,filter:{filterModel:o.payload}};case"SET_PAGINATION_MODEL":return{...n,pagination:{...n.pagination,paginationModel:o.payload}};case"SET_SELECTION":return{...n,selection:{selectedRows:o.payload}};case"SET_SCROLL":return{...n,virtualization:{...n.virtualization,scrollTop:o.payload.scrollTop,scrollLeft:o.payload.scrollLeft}};case"SET_DIMENSIONS":return{...n,dimensions:{...n.dimensions,viewportWidth:o.payload.viewportWidth,viewportHeight:o.payload.viewportHeight}};case"SET_DATASOURCE_LOADING":return{...n,dataSource:{...n.dataSource,loading:o.payload}};case"SET_DATASOURCE_ERROR":return{...n,dataSource:{...n.dataSource,error:o.payload}};case"SET_ROW_COUNT":return{...n,pagination:{...n.pagination,rowCount:o.payload}};default:return n}}function fr(n){const{rows:o,columns:e,rowHeight:r=52,headerHeight:i=56,columnVisibilityModel:s,initialState:d}=n,a=l.useMemo(()=>ur(o,e,s),[]),[g,f]=l.useReducer(gr,{...a,sorting:d?.sorting||a.sorting,filter:d?.filter||a.filter,dataSource:d?.dataSource?{...a.dataSource,...d.dataSource}:a.dataSource,pagination:{...a.pagination,...d?.pagination||{},rowCount:n.rowCount??d?.pagination?.rowCount??a.pagination.rowCount},dimensions:{...a.dimensions,rowHeight:r,headerHeight:i}}),h=l.useRef(g);h.current=g;const b=l.useRef(o);l.useEffect(()=>{o!==b.current&&(b.current=o,f({type:"SET_ROWS",payload:o}))},[o]);const c=l.useCallback((k,x)=>{f({type:"SET_ROWS",payload:k,preserveRowCount:x})},[]),p=l.useCallback(k=>{f({type:"SET_COLUMNS",payload:k})},[]),w=l.useCallback(k=>{f({type:"SET_SORT_MODEL",payload:k})},[]),m=l.useCallback(k=>{f({type:"SET_FILTER_MODEL",payload:k})},[]),I=l.useCallback(k=>{f({type:"SET_PAGINATION_MODEL",payload:k})},[]),M=l.useCallback(k=>{f({type:"SET_SELECTION",payload:k})},[]),E=l.useCallback((k,x)=>{f({type:"SET_SCROLL",payload:{scrollTop:k,scrollLeft:x}})},[]),C=l.useCallback((k,x)=>{f({type:"SET_DIMENSIONS",payload:{viewportWidth:k,viewportHeight:x}})},[]),_=l.useCallback(k=>{f({type:"SET_DATASOURCE_LOADING",payload:k})},[]),j=l.useCallback(k=>{f({type:"SET_DATASOURCE_ERROR",payload:k})},[]),y=l.useCallback(k=>{f({type:"SET_ROW_COUNT",payload:k})},[]),P=l.useRef({getRow:k=>h.current.rows.idRowsLookup.get(k)||null,getAllRows:()=>Array.from(h.current.rows.idRowsLookup.values()),getVisibleRows:()=>Array.from(h.current.rows.idRowsLookup.values()),getAggregationResult:()=>null,getAggregationModel:()=>null,getColumn:k=>h.current.columns.lookup.get(k)||null,getAllColumns:()=>h.current.columns.all,getVisibleColumns:()=>h.current.columns.all,selectRow:(k,x=!0)=>{const S=new Set(h.current.selection.selectedRows);x?S.add(k):S.delete(k),M(S)},selectRows:(k,x=!0)=>{const S=new Set(h.current.selection.selectedRows);k.forEach(R=>{x?S.add(R):S.delete(R)}),M(S)},getSelectedRows:()=>Array.from(h.current.selection.selectedRows),sortColumn:(k,x)=>{if(x===null)w(h.current.sorting.sortModel.filter(S=>S.field!==k));else{const S=h.current.sorting.sortModel.findIndex(R=>R.field===k);if(S>=0){const R=[...h.current.sorting.sortModel];R[S]={field:k,sort:x},w(R)}else w([...h.current.sorting.sortModel,{field:k,sort:x}])}},getSortModel:()=>h.current.sorting.sortModel,setFilterModel:m,getFilterModel:()=>h.current.filter.filterModel,setPage:k=>{I({...h.current.pagination.paginationModel,page:k})},setPageSize:k=>{I({...h.current.pagination.paginationModel,pageSize:k,page:0})},scrollToIndexes:()=>{},copySelectedRows:()=>Promise.resolve()});return{state:g,dispatch:f,apiRef:P,setRows:c,setColumns:p,setSortModel:w,setFilterModel:m,setPaginationModel:I,setSelection:M,setScroll:E,setDimensions:C,setDataSourceLoading:_,setDataSourceError:j,setRowCount:y}}function hr(n){const{columns:o,onColumnOrderChange:e,disableColumnReorder:r=!1}=n,[i,s]=l.useState(null),[d,a]=l.useState(null),g=l.useRef(-1),f=l.useCallback(p=>w=>{if(r)return;const m=o.findIndex(M=>M.field===p);if(o[m]?.pinnable===!1){w.preventDefault();return}s(p),g.current=m,w.dataTransfer&&(w.dataTransfer.effectAllowed="move",w.dataTransfer.setData("text/plain",p))},[o,r]),h=l.useCallback(p=>w=>{r||!i||(w.preventDefault(),w.dataTransfer.dropEffect="move",a(p))},[i,r]),b=l.useCallback(p=>w=>{if(w.preventDefault(),r||!i||i===p){s(null),a(null);return}const m=o.findIndex(E=>E.field===i),I=o.findIndex(E=>E.field===p);if(m===-1||I===-1){s(null),a(null);return}const M=o[m];e&&e({column:M,oldIndex:m,targetIndex:I}),s(null),a(null),g.current=-1},[o,i,r,e]),c=l.useCallback(()=>{s(null),a(null),g.current=-1},[]);return{draggedColumn:i,dragOverColumn:d,onDragStart:r?void 0:f,onDragOver:r?void 0:h,onDragEnd:r?void 0:c,onDrop:r?void 0:b}}function pr(n){const{onRowOrderChange:o,rows:e,getRowId:r,rowReordering:i=!1}=n,[s,d]=l.useState(null),[a,g]=l.useState(null),f=l.useCallback(w=>r?r(w):w.id,[r]),h=l.useCallback(w=>m=>{i&&(d(w),m.dataTransfer.effectAllowed="move")},[i]),b=l.useCallback(w=>m=>{!i||!s||(m.preventDefault(),m.dataTransfer.dropEffect="move",a!==w&&g(w))},[i,s,a]),c=l.useCallback(()=>{d(null),g(null)},[]),p=l.useCallback(w=>m=>{if(m.preventDefault(),!s||!o){c();return}const I=e.findIndex(E=>f(E)===s),M=e.findIndex(E=>f(E)===w);I!==-1&&M!==-1&&I!==M&&o({row:e[I],oldIndex:I,targetIndex:M}),c()},[s,o,e,f,c]);return{draggedRowId:s,dragOverRowId:a,onDragStart:i?h:void 0,onDragOver:i?b:void 0,onDragEnd:i?c:void 0,onDrop:i?p:void 0}}const xr={contains:(n,o)=>n==null||o==null?!1:String(n).toLowerCase().includes(String(o).toLowerCase()),equals:(n,o)=>n==null&&o==null?!0:n==null||o==null?!1:String(n).toLowerCase()===String(o).toLowerCase(),startsWith:(n,o)=>n==null||o==null?!1:String(n).toLowerCase().startsWith(String(o).toLowerCase()),endsWith:(n,o)=>n==null||o==null?!1:String(n).toLowerCase().endsWith(String(o).toLowerCase()),isEmpty:n=>n==null||String(n).trim()==="",isNotEmpty:n=>n!=null&&String(n).trim()!=="",">":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e>r},">=":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e>=r},"<":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e<r},"<=":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e<=r},"!=":(n,o)=>{if(o==null||o==="")return!0;const e=Number(n),r=Number(o);return!isNaN(e)&&!isNaN(r)?e!==r:String(n).toLowerCase()!==String(o).toLowerCase()},isAnyOf:(n,o)=>n==null||!Array.isArray(o)?!1:o.some(e=>String(n).toLowerCase()===String(e).toLowerCase()),not:(n,o)=>n==null&&o==null?!1:n==null||o==null?!0:String(n).toLowerCase()!==String(o).toLowerCase(),is:(n,o)=>{if(o==null||o==="")return!0;const e=String(n).toLowerCase(),r=String(o).toLowerCase();return e===r},"=":(n,o)=>n==null||o==null||o===""?!1:Number(n)===Number(o)};function mr(n,o){const{field:e,operator:r,value:i}=o,s=n[e],d=xr[r];return d?d(s,i):(console.warn(`Unknown filter operator: ${r}`),!0)}function br(n,o){return!o||o.length===0?!0:o.every(e=>{const r=e.toLowerCase();return Object.values(n).some(i=>i==null?!1:String(i).toLowerCase().includes(r))})}function jn(n,o){const e=o.items||[],r=o.logicOperator||"and",i=o.quickFilterValues||[];if(i.length>0&&!br(n,i))return!1;if(e.length===0)return!0;const s=d=>{if("logicOperator"in d&&"items"in d){const a=d,g=a.items;return g.length===0?!0:a.logicOperator==="and"?g.every(s):g.some(s)}else return mr(n,d)};return r==="and"?e.every(s):e.some(s)}function wr(n,o){if(!o)return n;const{items:e=[],quickFilterValues:r=[]}=o;return e.length===0&&(!r||r.length===0)?n:n.filter(i=>jn(i,o))}function vr(n){switch(n){case"number":return["=","!=",">",">=","<","<=","isEmpty","isNotEmpty"];case"date":return["is","not","after","onOrAfter","before","onOrBefore","isEmpty","isNotEmpty"];case"boolean":return["is"];case"singleSelect":return["isAnyOf","is","not"];default:return["contains","equals","startsWith","endsWith","isEmpty","isNotEmpty"]}}function En(n,o,e){if(n==null&&o==null)return 0;if(n==null)return e==="asc"?1:-1;if(o==null)return e==="asc"?-1:1;if(typeof n=="number"&&typeof o=="number")return e==="asc"?n-o:o-n;if(n instanceof Date&&o instanceof Date)return e==="asc"?n.getTime()-o.getTime():o.getTime()-n.getTime();const r=String(n).toLowerCase(),i=String(o).toLowerCase();return e==="asc"?r<i?-1:r>i?1:0:r>i?-1:r<i?1:0}function _r(n,o){if(o.length===0)return n;const e=[...n];return e.sort((r,i)=>{for(const s of o){const d=r[s.field],a=i[s.field],g=En(d,a,s.sort);if(g!==0)return g}return 0}),e}function Cr(n){const{rows:o,getRowId:e,getTreeDataPath:r,treeData:i=!1,defaultGroupingExpansionDepth:s=0,filterModel:d,sortModel:a,onRowExpansionChange:g}=n,{treeNodes:f,rootIds:h,groupingRows:b}=l.useMemo(()=>{if(!i||!r)return{treeNodes:new Map,rootIds:[],groupingRows:[]};const _=new Map,j=[],y=[],P=new Map,k=x=>x.join("/");return o.forEach(x=>{const S=e(x),R=r(x),B=k(R);P.set(B,S),_.set(S,{id:S,parentId:null,depth:R.length-1,groupingKey:R[R.length-1],isExpanded:!1,children:[],serverChildrenCount:x.serverChildrenCount})}),o.forEach(x=>{const S=e(x),R=r(x);if(R.length===1){j.push(S);return}const B=$=>{if($.length<=1)return;const K=$.slice(0,-1),q=k(K);let D=P.get(q);if(D===void 0&&(D=`auto-group-${q}`,!_.has(D))){const Z=K[K.length-1];_.set(D,{id:D,parentId:null,depth:K.length-1,groupingKey:Z,isExpanded:!1,children:[],label:Z}),P.set(q,D);const J={id:D,name:Z,_isGroupRow:!0};y.push(J),K.length===1&&j.push(D),B(K)}return D},Y=B(R);if(Y!==void 0){const $=_.get(Y),K=_.get(S);$&&K&&(K.parentId=Y,$.children=$.children||[],$.children.includes(S)||$.children.push(S))}}),y.forEach(x=>{const S=x.id,R=_.get(S);if(!R)return;const Y=S.replace("auto-group-","").split("/");if(Y.length>1){const $=Y.slice(0,-1),K=k($),q=P.get(K);if(q&&_.has(q)){R.parentId=q;const D=_.get(q);D&&(D.children=D.children||[],D.children.includes(S)||D.children.push(S))}}}),{treeNodes:_,rootIds:j,groupingRows:y}},[o,r,i,e]),c=l.useMemo(()=>{if(!i)return new Set;const _=new Set;return f.forEach(j=>{j.children&&j.children.length>0&&(s===-1||j.depth<s)&&_.add(j.id)}),_},[f,i,s]),[p,w]=l.useState(new Set);l.useEffect(()=>{c.size>0&&w(c)},[c]);const m=l.useCallback(_=>{w(j=>{const y=new Set(j),P=!y.has(_);if(y.has(_)?y.delete(_):y.add(_),P&&g){const k=f.get(_);k&&g(k)}return y})},[f,g]),I=l.useCallback(()=>{if(!i)return null;const _=new Map;o.forEach(B=>_.set(e(B),B)),b.forEach(B=>_.set(B.id,B));const j=B=>jn(B,d),y=new Map,P=B=>{if(y.has(B))return y.get(B);const Y=_.get(B);if(!Y)return!1;if(j(Y))return y.set(B,!0),!0;const K=f.get(B);return K&&K.children&&K.children.some(D=>P(D))?(y.set(B,!0),!0):(y.set(B,!1),!1)},k=(B,Y)=>{if(!a||a.length===0)return 0;const $=_.get(B),K=_.get(Y);if(!$||!K)return 0;for(const q of a){const D=$[q.field],Z=K[q.field],J=En(D,Z,q.sort);if(J!==0)return J}return 0},x=[],S=new Set,R=B=>{const Y=B.filter($=>P($));Y.sort(k),Y.forEach($=>{if(S.has($))return;const K=_.get($),q=f.get($);if(K&&q){S.add($);const D={...K,_treeDepth:q.depth,_isExpanded:p.has($),_hasChildren:q.children&&q.children.length>0||q.serverChildrenCount&&q.serverChildrenCount>0,_descendantCount:q.children?q.children.length:0};x.push(D),p.has($)&&q.children&&q.children.length>0&&R(q.children)}})};return R(h),x},[i,o,b,h,f,p,d,a,e]),M=l.useCallback(_=>p.has(_),[p]),E=l.useCallback(_=>f.get(_),[f]),C=l.useCallback(_=>{const j=[];let y=_;for(;y!==null;){const P=f.get(y);if(!P)break;j.unshift(P.groupingKey),y=P.parentId}return j},[f]);return l.useMemo(()=>({treeNodes:f,groupingRows:b,toggleExpansion:m,isGroupExpanded:M,getVisibleRows:I,getNode:E,getNodePath:C}),[f,b,m,M,I,E,C])}const yr=n=>n?.depth===-1?"footer":"inline";function kr(n){const{rows:o,getRowId:e,rowGroupingModel:r=[],aggregationModel:i={},defaultGroupingExpansionDepth:s=0,filterModel:d,sortModel:a,getAggregationPosition:g=yr}=n,[f,h]=l.useState(new Set),{treeNodes:b,rootIds:c,groupingRows:p}=l.useMemo(()=>{const E=new Map,C=new Map,_=[];if(r.length===0)return{treeNodes:E,rootIds:_,groupingRows:C};const j=(k,x,S)=>`auto-group-${k}-${x}-${S||"root"}`,y=(k,x,S)=>{if(x>=r.length)return k.map($=>{const K=e($);return E.set(K,{id:K,parentId:S,depth:x,groupingKey:"",isExpanded:!1}),K});const R=r[x],B=new Map;k.forEach($=>{const K=$[R],q=String(K);B.has(q)||B.set(q,[]),B.get(q).push($)});const Y=[];return B.forEach(($,K)=>{const D=$[0][R],Z=j(R,K,S);Y.push(Z);const J={};i&&Object.entries(i).forEach(([A,O])=>{const Q=$.map(U=>U[A]);if(O==="sum")J[A]=Q.reduce((U,T)=>(Number(U)||0)+(Number(T)||0),0);else if(O==="min")J[A]=Math.min(...Q.map(U=>Number(U)||0));else if(O==="max")J[A]=Math.max(...Q.map(U=>Number(U)||0));else if(O==="avg"){const U=Q.reduce((T,se)=>(Number(T)||0)+(Number(se)||0),0);J[A]=Q.length?U/Q.length:0}else O==="count"&&(J[A]=Q.length)});const he={[R]:D,...J,id:Z};C.set(Z,he);const v={id:Z,parentId:S,depth:x,groupingKey:K,groupingField:R,groupingValue:D,aggregatedValues:J,isExpanded:!1,children:[],label:`${R}: ${String(D)}`};v.aggregationPosition=g(v),E.set(Z,v);const H=y($,x+1,Z);E.get(Z).children=H;const F=$.length;E.get(Z).descendantCount=F}),Y},P=y(o,0,null);return _.push(...P),{treeNodes:E,rootIds:_,groupingRows:C}},[o,r,i,e,g]);l.useEffect(()=>{if(s===-1){const E=new Set;b.forEach((C,_)=>{C.children&&C.children.length>0&&E.add(_)}),h(E)}else if(s>0){const E=new Set;b.forEach((C,_)=>{C.depth<s&&C.children&&C.children.length>0&&E.add(_)}),h(E)}else h(new Set)},[r,s]);const w=l.useCallback(E=>{h(C=>{const _=new Set(C);return _.has(E)?_.delete(E):_.add(E),_})},[]),m=l.useCallback(E=>f.has(E),[f]),I=l.useCallback(()=>{if(r.length===0)return null;const E=[],C=new Set,_=new Map;o.forEach(k=>_.set(e(k),k));const j=k=>{const x=b.get(k);if(!x)return!1;if(!x.children||x.children.length===0){const S=_.get(k);return!(!S||d&&!jn(S,d))}return x.children.some(S=>j(S))},y=k=>{let x=k;d&&(x=k.filter(j)),a&&a.length>0&&x.sort((S,R)=>{const B=p.get(S)||_.get(S),Y=p.get(R)||_.get(R);if(!B||!Y)return 0;for(const $ of a){const K=B[$.field],q=Y[$.field],D=En(K,q,$.sort);if(D!==0)return D}return 0}),x.forEach(S=>{if(C.has(S))return;const R=b.get(S),B=R?.children&&R.children.length>0,Y=B?p.get(S):_.get(S);if(Y&&R){C.add(S);const $={...Y,_treeDepth:R.depth,_isExpanded:f.has(S),_hasChildren:B,_groupingField:R.groupingField,_groupingValue:R.groupingValue,_descendantCount:R.descendantCount};E.push($),P.has(S)&&B&&y(R.children)}})},P=f;return y(c),E},[o,e,b,c,p,d,a,f]),M=l.useCallback(E=>b.get(E),[b]);return l.useMemo(()=>({treeNodes:b,groupingRows:p,toggleExpansion:w,isGroupExpanded:m,getVisibleRows:I,getNode:M}),[b,p,w,m,I,M])}function Sr(n){const{rows:o,getRowId:e,processRowUpdate:r,onProcessRowUpdateError:i,onRowChange:s}=n,[d,a]=l.useState(null),g=l.useRef(null),f=l.useCallback(p=>{a(p),g.current=typeof p=="function"?p(g.current):p},[]),h=l.useCallback(p=>{f({id:p.id,field:p.field,value:p.value,originalValue:p.value})},[]),b=l.useCallback(async p=>{const w=g.current;if(!w)return;if(p?.cancel){f(null);return}const{id:m,field:I,value:M,originalValue:E}=w;if(M===E){f(null);return}const C=o.find(j=>e(j)===m);if(!C){f(null);return}const _={...C,[I]:M};try{if(r){const j=await r(_,C);s?.(j)}else s?.(_);f(null)}catch(j){i&&i(j)}},[d,o,e,r,s,i]),c=l.useCallback(p=>{d&&d.id===p.id&&d.field===p.field&&f(w=>w?{...w,value:p.value}:null)},[d]);return{editingCell:d,startCellEdit:h,stopCellEdit:b,setEditCellValue:c}}function jr(n,o,e){const[r,i]=l.useState(new Map),[s,d]=l.useState({caches:{spannedCells:{},hiddenCells:{},hiddenCellOriginMap:{}},processedRange:{firstRowIndex:0,lastRowIndex:0}}),a=l.useCallback(()=>{i(new Map)},[]),g=l.useCallback((m,I)=>r.get(m)?.[I],[r]),f=l.useCallback((m,I,M,E,C)=>{const _=new Map(r);for(let j=E;j<C;j++){const y=o[j];if(!y)continue;let P=1;if(y.colSpan)if(typeof y.colSpan=="function"){const x={row:I,value:I[y.field],field:y.field,colDef:y,rowIndex:M,colIndex:j};P=y.colSpan(x)}else P=y.colSpan;if(P<=1){Pt(_,m,y.field,{spannedByColSpan:!1,cellProps:{colSpan:1,width:e[y.field]||100}});continue}let k=e[y.field]||100;for(let x=1;x<P;x++)if(j+x<C){const S=o[j+x];S&&(k+=e[S.field]||100,Pt(_,m,S.field,{spannedByColSpan:!0,leftVisibleCellIndex:j,rightVisibleCellIndex:Math.min(j+P-1,o.length-1)}))}Pt(_,m,y.field,{spannedByColSpan:!1,cellProps:{colSpan:P,width:k}}),j+=P-1}i(_)},[r,o,e]),h=l.useCallback((m,I)=>{const M={},E={},C={};o.forEach((_,j)=>{if(_.rowSpan)for(let y=m;y<I;y++){const P=n[y];if(!P||E[P.id]?.[_.field])continue;const k=_.valueGetter?_.valueGetter({row:P,field:_.field,value:P[_.field]}):P[_.field];let x=1;if(typeof _.rowSpan=="function"){const S={row:P,value:k,field:_.field,colDef:_,rowIndex:y,colIndex:j};x=_.rowSpan(S)}else typeof _.rowSpan=="number"&&(x=_.rowSpan);if(x>1){M[P.id]||(M[P.id]={}),M[P.id][_.field]=x;for(let S=1;S<x;S++){const R=y+S;if(R<I&&n[R]){const B=n[R];E[B.id]||(E[B.id]={}),E[B.id][_.field]=!0,C[R]||(C[R]={}),C[R][_.field]=y}}}}}),d({caches:{spannedCells:M,hiddenCells:E,hiddenCellOriginMap:C},processedRange:{firstRowIndex:m,lastRowIndex:I}})},[n,o]),b=l.useCallback(()=>{d({caches:{spannedCells:{},hiddenCells:{},hiddenCellOriginMap:{}},processedRange:{firstRowIndex:0,lastRowIndex:0}})},[]);l.useEffect(()=>{const m=new Map;n.forEach((C,_)=>{for(let j=0;j<o.length;j++){const y=o[j];if(!y)continue;let P=1;if(y.colSpan)if(typeof y.colSpan=="function"){const x={row:C,value:C[y.field],field:y.field,colDef:y,rowIndex:_,colIndex:j};P=y.colSpan(x)}else P=y.colSpan;if(P<=1){const x=e[y.field]||(typeof y.width=="number"?y.width:100);Pt(m,C.id,y.field,{spannedByColSpan:!1,cellProps:{colSpan:1,width:x}});continue}let k=e[y.field]||(typeof y.width=="number"?y.width:100);for(let x=1;x<P;x++)if(j+x<o.length){const S=o[j+x];if(S){const R=e[S.field]||(typeof S.width=="number"?S.width:100);k+=R,Pt(m,C.id,S.field,{spannedByColSpan:!0,leftVisibleCellIndex:j,rightVisibleCellIndex:Math.min(j+P-1,o.length-1)})}}Pt(m,C.id,y.field,{spannedByColSpan:!1,cellProps:{colSpan:P,width:k}}),j+=P-1}}),i(m);const I={},M={},E={};o.forEach((C,_)=>{if(C.rowSpan)for(let j=0;j<n.length;j++){const y=n[j];if(!y||M[y.id]?.[C.field])continue;const P=C.valueGetter?C.valueGetter({row:y,field:C.field,value:y[C.field]}):y[C.field];let k=1;if(typeof C.rowSpan=="function"){const x={row:y,value:P,field:C.field,colDef:C,rowIndex:j,colIndex:_};k=C.rowSpan(x)}else typeof C.rowSpan=="number"&&(k=C.rowSpan);if(k>1){I[y.id]||(I[y.id]={}),I[y.id][C.field]=k;for(let x=1;x<k;x++){const S=j+x;if(S<n.length&&n[S]){const R=n[S];M[R.id]||(M[R.id]={}),M[R.id][C.field]=!0,E[S]||(E[S]={}),E[S][C.field]=j}}}}}),d({caches:{spannedCells:I,hiddenCells:M,hiddenCellOriginMap:E},processedRange:{firstRowIndex:0,lastRowIndex:n.length}})},[n,o,e]);const c=l.useCallback(()=>s.caches.spannedCells,[s]),p=l.useCallback(()=>s.caches.hiddenCells,[s]),w=l.useCallback(()=>s.caches.hiddenCellOriginMap,[s]);return{colspanMap:r,resetColSpan:a,getCellColSpanInfo:g,calculateColSpan:f,rowSpanningState:s,calculateRowSpan:h,resetRowSpan:b,getSpannedCells:c,getHiddenCells:p,getHiddenCellOriginMap:w}}function Pt(n,o,e,r){let i=n.get(o);i||(i={},n.set(o,i)),i[e]=r}function Er(n){const{dataSource:o,sortModel:e,filterModel:r,paginationModel:i,paginationMode:s,sortingMode:d,filterMode:a,aggregationModel:g,setRows:f,setRowCount:h,setDataSourceLoading:b,setDataSourceError:c,onAggregationResults:p}=n,w=l.useRef(null),m=l.useRef(0),I=l.useCallback(async()=>{if(!o)return;const E=++m.current;b(!0),c(null);const C=i.page*i.pageSize,_=C+i.pageSize,j={startRow:C,endRow:_,sortModel:e,filterModel:r,groupKeys:[],aggregationModel:g};try{const y=await o.getRows(j);if(E!==m.current)return;let P=!1;if(s==="infinite"){const k=w.current;if(k){const x=JSON.stringify(k.sortModel)!==JSON.stringify(e),S=JSON.stringify(k.filterModel)!==JSON.stringify(r),R=k.pageSize!==i.pageSize;!x&&!S&&!R&&i.page>k.page&&(P=!0)}}f(P?k=>[...k,...y.rows]:y.rows,!0),y.aggregationResults&&p&&p(y.aggregationResults),y.rowCount!==void 0&&h(y.rowCount),w.current={sortModel:e,filterModel:r,page:i.page,pageSize:i.pageSize}}catch(y){E===m.current&&(c(y),console.error("Data Source Error:",y))}finally{E===m.current&&b(!1)}},[o,i.page,i.pageSize,e,r,s,g,p,f,h,b,c]);l.useEffect(()=>{if(o&&(s==="server"||s==="infinite"||d==="server"||a==="server")){const C=setTimeout(()=>{I()},300);return()=>clearTimeout(C)}},[I,o,s,d,a]);const M=l.useCallback(async(E,C)=>{if(o){b(!0);try{const _=await o.getRows({startRow:0,endRow:-1,sortModel:e,filterModel:r,groupKeys:C});_.rows.length>0&&f(j=>{const y=new Set(j.map(k=>k.id)),P=_.rows.filter(k=>!y.has(k.id));return[...j,...P]})}catch(_){c(_),console.error("Failed to fetch children:",_)}finally{b(!1)}}},[o,e,r,f,b,c]);return{fetchRows:I,fetchChildren:M}}const Nr={sum:n=>n.filter(e=>e!=null&&!isNaN(Number(e))).reduce((e,r)=>e+Number(r),0),avg:n=>{const o=n.filter(e=>e!=null&&!isNaN(Number(e)));return o.length===0?null:o.reduce((e,r)=>e+Number(r),0)/o.length},count:n=>n.filter(o=>o!=null).length,min:n=>{const o=n.filter(e=>e!=null&&!isNaN(Number(e))).map(Number);return o.length?Math.min(...o):null},max:n=>{const o=n.filter(e=>e!=null&&!isNaN(Number(e))).map(Number);return o.length?Math.max(...o):null},unique:n=>new Set(n.filter(o=>o!=null)).size};function mt(n,o){return n==null?"—":typeof n=="number"?o==="avg"?n.toLocaleString(void 0,{maximumFractionDigits:2}):n.toLocaleString():String(n)}function io(n){const{rows:o,aggregationModel:e,isServerSide:r,dataSource:i,filterModel:s,sortModel:d,serverAggregationResults:a}=n,g=l.useMemo(()=>{if(r||Object.keys(e).length===0)return{};const E={};for(const[C,_]of Object.entries(e)){const j=Nr[_];if(!j){console.warn(`[useAggregation] Unknown aggregation function: "${_}"`);continue}const y=o.map(P=>P[C]);E[C]=j(y)}return E},[o,e,r]),[f,h]=l.useState({}),[b,c]=l.useState(!1),[p,w]=l.useState(null),m=l.useRef(0),I=l.useCallback(async()=>{if(!i?.getAggregations||Object.keys(e).length===0)return;const E=++m.current;c(!0),w(null);try{const C=await i.getAggregations({sortModel:d??[],filterModel:s??{items:[]},groupKeys:[],aggregationModel:e});E===m.current&&h(C)}catch(C){E===m.current&&(w(C),console.error("[useAggregation] Server aggregation error:",C))}finally{E===m.current&&c(!1)}},[i,e,s,d]);return l.useEffect(()=>{r&&i?.getAggregations&&!a&&I()},[I,r,i,a]),{aggregationResult:l.useMemo(()=>r?a&&Object.keys(a).length>0?a:f:g,[r,g,a,f]),isLoading:b,error:p}}function Mr(n,o){const e=n.filter(r=>r!=null&&!isNaN(r));if(e.length===0)return null;switch(o){case"sum":return e.reduce((r,i)=>r+i,0);case"avg":return e.reduce((r,i)=>r+i,0)/e.length;case"count":return e.length;case"min":return Math.min(...e);case"max":return Math.max(...e)}}function Nn(n,o){return o.map(e=>String(n[e]??"")).join("\0")}function lo(n,o,e,r){return l.useMemo(()=>{const i={pivotRows:[],pivotColumns:[],colKeys:[],isValid:!1};if(!r)return i;const{rowFields:s,columnFields:d,valueFields:a}=e;if(s.length===0||a.length===0)return i;const g=new Map(o.map(m=>[m.field,m])),f=new Set;for(const m of n)f.add(Nn(m,d));const h=Array.from(f).sort(),b=new Map;for(const m of n){const I=Nn(m,s);if(!b.has(I)){const _={};for(const j of s)_[j]=m[j];b.set(I,{labelValues:_,bucket:new Map})}const M=b.get(I),E=Nn(m,d);M.bucket.has(E)||M.bucket.set(E,new Map);const C=M.bucket.get(E);for(const _ of a){const j=Number(m[_.field]);C.has(_.field)||C.set(_.field,[]),isNaN(j)||C.get(_.field).push(j)}}let c=0;const p=[];for(const[,m]of b){const I={id:c++,...m.labelValues};for(const M of h){const E=m.bucket.get(M);for(const C of a){const _=d.length>0?`${M}${C.field}${C.aggFn}`:`${C.field}${C.aggFn}`,j=E?.get(C.field)??[];I[_]=j.length>0?Mr(j,C.aggFn):null}}p.push(I)}const w=[];for(const m of s){const I=g.get(m);w.push({field:m,headerName:I?.headerName??m,width:I?.width??140,sortable:!0})}for(const m of h){const I=d.length>0?m.split("\0").map((M,E)=>{const C=g.get(d[E]);return C?.headerName?`${C.headerName}: ${M}`:M}).join(" / "):"";for(const M of a){const E=g.get(M.field),C=d.length>0?`${m}${M.field}${M.aggFn}`:`${M.field}${M.aggFn}`,_=M.headerName??E?.headerName??M.field,j=I?`${I} — ${_} (${M.aggFn})`:`${_} (${M.aggFn})`;w.push({field:C,headerName:j,width:140,type:"number",align:"right",headerAlign:"right",sortable:!0,valueFormatter:({value:y})=>{if(y==null)return"—";const P=Number(y);return M.aggFn==="avg"?P.toFixed(2):M.aggFn==="count"?P.toLocaleString():E?.valueFormatter?E.valueFormatter({value:y,row:{},field:M.field}):P.toLocaleString()}})}}return{pivotRows:p,pivotColumns:w,colKeys:h,isValid:!0}},[n,o,e,r])}function Ir(n){const o=document.createElement("textarea");o.value=n,o.style.cssText="position:fixed;top:-9999px;left:-9999px;opacity:0;",document.body.appendChild(o),o.focus(),o.select();let e=!1;try{e=document.execCommand("copy")}finally{document.body.removeChild(o)}return e}async function Pr(n){let o=!1;try{o=Ir(n)}catch{}if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(n);return}catch(e){if(o)return;throw e}else if(!o)throw new Error("Clipboard API not available and fallback failed.")}function Tr(n){const{selectedRowIds:o,columns:e,getVisibleRows:r,getRowId:i}=n,s=l.useCallback(async()=>{if(o.size===0)return;const a=r().filter(c=>o.has(i(c)));if(a.length===0)return;const g=e.filter(c=>!c.field.startsWith("__")),f=g.map(c=>c.headerName||c.field).join(" "),h=a.map(c=>g.map(p=>{const w=c[p.field];return p.valueFormatter?p.valueFormatter({value:w,row:c,field:p.field}):w??""}).join(" ")).join(`
|
|
7
|
-
`),b=`${
|
|
8
|
-
${h}`;try{await Pr(b)}catch(c){console.error("[OpenGridX] Failed to copy to clipboard:",c)}},[o,e,r,i]);return l.useEffect(()=>{const d=a=>{if(!(a.ctrlKey||a.metaKey)||a.key!=="c")return;const g=document.activeElement,f=g?.tagName.toLowerCase(),h=g?.type;f==="input"&&h!=="checkbox"&&h!=="radio"||f==="textarea"||f==="select"||g?.isContentEditable||s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s]),{copySelectedRows:s}}function Lr(){return t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function so(n){const{columns:o,visibleColumns:e,onVisibilityChange:r,onShowAll:i,onHideAll:s}=n,[d,a]=l.useState(""),f=l.useMemo(()=>o.filter(c=>c.hideable!==!1),[o]).every(c=>e.has(c.field)),h=l.useMemo(()=>{if(!d)return o;const c=d.toLowerCase();return o.filter(p=>(p.headerName||p.field).toLowerCase().includes(c))},[o,d]),b=c=>{c.target.checked?i():s()};return t.jsxs("div",{className:"ogx-column-visibility-panel",children:[t.jsx("div",{className:"ogx-column-visibility-panel__search-section",children:t.jsxs("div",{className:"ogx-column-visibility-panel__search-container",children:[t.jsx(Lr,{}),t.jsx("input",{id:"ogx-column-search",name:"ogx-column-search",autoComplete:"off",className:"ogx-column-visibility-panel__search-input",placeholder:"Search",value:d,onChange:c=>a(c.target.value)})]})}),t.jsx("div",{className:"ogx-column-visibility-panel__list",children:h.map(c=>{const p=e.has(c.field),w=c.hideable!==!1;return t.jsxs("label",{className:`ogx-column-visibility-panel__item ${w?"":"ogx-column-visibility-panel__item--disabled"}`,children:[t.jsx(qt,{checked:p,onChange:m=>r(c.field,m.target.checked),disabled:!w}),t.jsx("span",{className:"ogx-column-visibility-panel__label",children:c.headerName||c.field})]},c.field)})}),t.jsxs("div",{className:"ogx-column-visibility-panel__footer",children:[t.jsxs("label",{className:"ogx-column-visibility-panel__item",children:[t.jsx(qt,{checked:f,onChange:b}),t.jsx("span",{className:"ogx-column-visibility-panel__label",children:"Show/Hide All"})]}),t.jsx("button",{className:"ogx-column-visibility-panel__reset-btn",onClick:i,children:"Reset"})]})]})}function Rr(n){const{rows:o,columns:e,getRowId:r,rowHeight:i=52,headerHeight:s=56,autoHeight:d=!1,checkboxSelection:a=!1,rowSelectionModel:g,onRowSelectionModelChange:f,onRowClick:h,onCellClick:b,filterModel:c,onFilterModelChange:p,sortModel:w,onSortModelChange:m,pagination:I=!1,paginationModel:M={page:0,pageSize:100},onPaginationModelChange:E,pageSizeOptions:C=[10,25,50,100],pinnedColumns:_,onPinnedColumnsChange:j,pinnedRows:y,getDetailPanelContent:P,getDetailPanelHeight:k,detailPanelExpandedRowIds:x,onDetailPanelExpandedRowIdsChange:S,pinCheckboxColumn:R=!0,pinExpandColumn:B=!0,disableColumnReorder:Y=!1,columnOrder:$,onColumnOrderChange:K,height:q,rowReordering:D=!1,onRowOrderChange:Z,loading:J=!1,treeData:he=!1,getTreeDataPath:v,defaultGroupingExpansionDepth:H,rowGroupingModel:F,aggregationModel:A,onAggregationModelChange:O,getAggregationPosition:Q,isCellEditable:U,processRowUpdate:T,onProcessRowUpdateError:se,dataSource:ne,sortingMode:xe="client",filterMode:Qe="client",paginationMode:z="client",rowCount:Se,slots:je,slotProps:ct,pivotMode:Be=!1,pivotModel:kt,onPivotModelChange:ut,className:en="",style:Lt,onRowsScrollEnd:St,ariaLabel:Rt,initialState:wt,onStateChange:We,columnVisibilityModel:po,onColumnVisibilityModelChange:xo,listView:cn=!1,listViewColumn:mo,columnGroupingModel:jt,noRowsLabel:In="No Data",apiRef:Pn}=n,vi=l.useMemo(()=>({items:[]}),[]),Ge=c||vi,[_i,Ci]=l.useState(()=>wt?.sorting?.sortModel??[]),Tn=w!==void 0,Ze=Tn?w:_i,yi=l.useMemo(()=>[],[]),Ln=F||yi,Rn=A!==void 0,bo=l.useMemo(()=>je?.toolbar,[je?.toolbar]),[ki,Si]=l.useState(()=>A??{}),et=Rn?A:ki,ji=l.useCallback(u=>{Rn||Si(u),O?.(u)},[Rn,O]),[Ei,Ni]=l.useState(()=>wt?.columns?.columnVisibilityModel??{}),Fn=po!==void 0,Ye=Fn?po:Ei,tn=l.useCallback(u=>{Fn||Ni(u),xo?.(u)},[Fn,xo]),[Mi,Ii]=l.useState(()=>wt?.columns?.pinnedColumns??{}),Wn=_!==void 0,tt=Wn?_:Mi,On=l.useCallback(u=>{Wn||Ii(u),j?.(u)},[Wn,j]),Pi=l.useMemo(()=>({rowFields:[],columnFields:[],valueFields:[]}),[]),[Ti,Li]=l.useState(kt??Pi),wo=kt??Ti,Ri=l.useCallback(u=>{Li(u),ut?.(u)},[ut]),un=lo(o,e,wo,Be),An=Be&&un.isValid?un.pivotRows:o,nt=Be&&un.isValid?un.pivotColumns:e,[Fi,vo]=l.useState(null);l.useEffect(()=>{vo(null)},[et]);const[Wi,Oi]=l.useState(()=>wt?.pagination?.paginationModel??M),zn=n.paginationModel!==void 0,ge=zn?M:Wi,gn=l.useCallback(u=>{zn||Oi(u),E?.(u)},[zn,E]),[Ai,_o]=l.useState([]),nn=g!==void 0,Co=nn?g:Ai,Ee=l.useMemo(()=>new Set(Co),[Co]),fn=f,Et=l.useRef(null),zi=l.useRef(null),hn=l.useRef(null),Bi=l.useCallback(u=>u.id,[]),pn=r||Bi,[Xe,Ft]=l.useState(null),Wt=l.useCallback(u=>{Yn.current?.classList.toggle("ogx--kb",u)},[]),yo=l.useRef(ne);yo.current=ne;const ko=l.useRef(null),So=l.useRef(null),$i=l.useCallback(u=>{if(yo.current&&he&&u.serverChildrenCount>0&&u.children.length===0){const N=So.current?.getNodePath(u.id)||[u.groupingKey];ko.current?.(u.id,N)}},[he]),ot=fr({rows:An,columns:nt,rowHeight:i,headerHeight:s,rowCount:Se,columnVisibilityModel:Ye,initialState:n.initialState}),{state:ae,apiRef:Ot,setRows:Bn,setColumns:jo,setScroll:Eo,setDimensions:No,setDataSourceLoading:Hi,setDataSourceError:Di,setRowCount:Gi}=ot;l.useEffect(()=>{Pn&&(Pn.current=Ot.current)},[Pn,Ot]);const{copySelectedRows:Mo}=Tr({selectedRowIds:Ee,columns:nt,getVisibleRows:()=>Ot.current.getVisibleRows(),getRowId:pn});l.useEffect(()=>{Ot.current.copySelectedRows=Mo,Ot.current.getSelectedRows=()=>Array.from(Ee)},[Mo,Ee,Ot]);const Vi=ae.dataSource.loading,on=J||Vi,rn=l.useMemo(()=>ae.rows.allRows.map(u=>ae.rows.idRowsLookup.get(u)),[ae.rows]),$n=Cr({rows:rn,getRowId:pn,getTreeDataPath:v,treeData:he,defaultGroupingExpansionDepth:H,filterModel:Ge,sortModel:Ze,onRowExpansionChange:$i});l.useEffect(()=>{So.current=$n},[$n]);const Ui=kr({rows:rn,getRowId:pn,rowGroupingModel:Ln,aggregationModel:et,defaultGroupingExpansionDepth:H,filterModel:Ge,sortModel:Ze,getAggregationPosition:Q}),Oe=Sr({rows:rn,getRowId:pn,processRowUpdate:T,onProcessRowUpdateError:se,onRowChange:u=>{const{dispatch:N}=ot,V=Array.from(ot.state.rows.idRowsLookup.values()).map(re=>re.id===u.id?u:re);N({type:"SET_ROWS",payload:V})}}),Hn=he,At=!!(Ln&&Ln.length>0),xn=Hn||At,Ae=Hn?$n:At?Ui:null,Ne=I&&!At,mn=l.useCallback(u=>{const{row:N,id:L}=u;if(xn&&N._hasChildren){Ae?.toggleExpansion(L);return}h?.(u)},[xn,Ae,h]),Le=l.useMemo(()=>xn?nt.map((u,N)=>N===0?{...u,renderCell:L=>{const{_treeDepth:V,_hasChildren:re,_isExpanded:ce,_groupingField:we,_groupingValue:Ue,_descendantCount:He}=L.row,pe=(V||0)*24;let le=u.renderCell?u.renderCell(L):L.value;return Hn&&re&&L.row._isGroupRow&&(le=t.jsxs("div",{className:"ogx__group-cell-content",children:[L.value,He!==void 0&&He>0?` (${He})`:""]})),At&&re&&we&&(le=t.jsxs("div",{className:"ogx__group-cell-content",children:[u.field===we?"":`${we}: `,String(Ue),He!==void 0?` (${He})`:""]})),t.jsxs("div",{style:{display:"flex",alignItems:"center",paddingLeft:pe,width:"100%",height:"100%"},children:[t.jsx("div",{style:{marginRight:4,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",cursor:re?"pointer":"default",flexShrink:0},children:re?t.jsx("div",{onClick:G=>{G.stopPropagation(),G.preventDefault(),Ae?.toggleExpansion(L.row.id)},onMouseDown:G=>{G.stopPropagation()},style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:10,position:"relative"},children:t.jsx(oo,{isExpanded:ce,onClick:G=>{G.stopPropagation(),G.preventDefault(),Ae?.toggleExpansion(L.row.id)}})}):null}),t.jsx("div",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:le})]})}}:{...u,renderCell:L=>{const{_hasChildren:V,_groupingField:re}=L.row;return At&&V?u.field===re?null:L.value!==void 0&&L.value!==null?u.renderCell?u.renderCell(L):L.value:null:u.renderCell?u.renderCell(L):L.value}}):nt,[nt,xn,At,Ae]),Dn=Er({dataSource:ne,sortModel:Ze,filterModel:Ge,paginationModel:ge,paginationMode:z,sortingMode:xe,filterMode:Qe,aggregationModel:et,setRows:Bn,setRowCount:Gi,setDataSourceLoading:Hi,setDataSourceError:Di,onAggregationResults:vo});l.useEffect(()=>{Dn.fetchChildren&&(ko.current=Dn.fetchChildren)},[Dn.fetchChildren]);const[rt,Ki]=l.useState(()=>wt?.columns?.columnWidths??{}),[Yi,Io]=l.useState(()=>wt?.columns?.columnOrder??nt.map(u=>u.field)),zt=$||Yi;l.useEffect(()=>{ne||Bn(An)},[An,Bn,ne]),l.useEffect(()=>{jo(nt)},[nt,jo]),l.useEffect(()=>{Be&&Io(nt.map(u=>u.field))},[Be,nt]);const Bt=l.useMemo(()=>{if(Y)return Le;const u=new Map(zt.map((N,L)=>[N,L]));return[...Le].sort((N,L)=>{const V=u.get(N.field)??Le.indexOf(N),re=u.get(L.field)??Le.indexOf(L);return V-re})},[Le,zt,Y]),Po=l.useMemo(()=>Bt.filter(u=>Ye[u.field]!==!1),[Bt,Ye]),$t=hr({columns:Bt,onColumnOrderChange:l.useCallback(u=>{const{oldIndex:N,targetIndex:L}=u,V=[...zt],[re]=V.splice(N,1);V.splice(L,0,re),$||Io(V),K?.(u)},[zt,$,K]),disableColumnReorder:Y}),[Xi,qi]=l.useState(new Set),vt=x??Xi,qe=!!P,ln=l.useCallback(u=>{const N=new Set(vt);N.has(u)?N.delete(u):N.add(u),x===void 0&&qi(N),S?.(N)},[vt,x,S]),be=l.useMemo(()=>{const u=[];return D&&u.push({field:"__reorder_col__"}),qe&&u.push({field:"__expand_col__"}),a&&u.push({field:"__checkbox_col__"}),[...u,...Bt]},[Bt,a,qe,D]),Ji=l.useCallback((u,N)=>{Ki(L=>({...L,[u]:N}))},[]),Gn=l.useRef(We);Gn.current=We,l.useEffect(()=>{if(!Gn.current)return;const u={sorting:{sortModel:Ze},filter:{filterModel:Ge},pagination:{paginationModel:ge},columns:{columnWidths:rt,columnOrder:zt,columnVisibilityModel:Ye,pinnedColumns:tt}};Gn.current(u)},[Ze,Ge,ge,rt,zt,Ye,tt]);const bn=l.useMemo(()=>rn,[rn]),$e=l.useMemo(()=>Ae?Ae.getVisibleRows()||[]:Qe==="server"&&ne?bn:wr(bn,Ge),[bn,Ge,Ae,Qe,ne]),{top:Ve,center:Ht,bottom:it}=l.useMemo(()=>Ae?{top:[],center:$e,bottom:[]}:$o($e,y),[$e,y,Ae]),Me=l.useMemo(()=>Ae||xe==="server"&&ne?Ht:_r(Ht,Ze),[Ht,Ze,Ae,xe,ne]),gt=l.useMemo(()=>{if(!Ne||z==="server"&&ne)return Me;const u=ge.page*ge.pageSize,N=u+ge.pageSize;return Me.slice(u,N)},[Me,Ne,ge.page,ge.pageSize,z,ne]);l.useEffect(()=>{ot.apiRef.current.getVisibleRows=()=>Me,ot.apiRef.current.getVisibleColumns=()=>Le},[Me,Le,ot.apiRef]);const Dt=pr({rows:Ne?gt:Me,getRowId:u=>u.id,onRowOrderChange:Z,rowReordering:D}),ye=l.useMemo(()=>{if(Ae)return Ht;const u=Ne?gt:Me,N=[...Ve,...u,...it];if(z==="infinite"&&ae.dataSource.loading&&N.length>0){const L=Math.min(ge.pageSize,20),V=Array.from({length:L},(re,ce)=>({id:`__skeleton_${ce}__`,_isSkeleton:!0}));return[...N,...V]}return N},[Ve,gt,Me,it,Ne,Ae,Ht,z,ae.dataSource.loading,ge.pageSize]),Gt=jr(ye,be,rt),{aggregationResult:Vn}=io({rows:$e,aggregationModel:et,isServerSide:!!(ne&&(z==="server"||xe==="server")),dataSource:ne,filterModel:Ge,sortModel:Ze,serverAggregationResults:Fi}),wn=Object.keys(et).length>0;l.useEffect(()=>{ot.apiRef.current.getAggregationResult=()=>wn?Vn:null,ot.apiRef.current.getAggregationModel=()=>wn?et:null},[Vn,et,wn,ot.apiRef]);const Un=l.useMemo(()=>{const u=i,N=Ne?gt:Me,L=N.map((W,X)=>{let ee=u;if(vt.has(W.id)){const ze=k?.({row:W,id:W.id,rowIndex:Ve.length+X})??200;ee+=typeof ze=="number"?ze:parseInt(String(ze),10)||200}return ee}),V=L.reduce((W,X,ee)=>(W.push((W[ee-1]||0)+X),W),[]),ce=(z==="infinite"&&ae.dataSource.loading&&N.length>0?Math.min(ge.pageSize,20):0)*u,we=(V[V.length-1]||0)+ce,Ue=Ve.length*u,He=it.length*u,ie=[],pe=[],le=[],G=[];Po.forEach(W=>{const X=dn(W.field,tt);X==="left"?ie.push(W):X==="right"?pe.push(W):le.push(W)});const fe=ae.dimensions.viewportWidth||1e3,Ce=(a?48:0)+(qe?48:0)+(D?48:0),me=W=>rt[W.field]??W.width,Ie=W=>{if(W===void 0)return{type:"auto",value:0};if(typeof W=="number")return{type:"fixed",value:W};if(typeof W=="string"){if(W.toLowerCase()==="auto")return{type:"auto",value:0};if(W.endsWith("%"))return{type:"percentage",value:parseFloat(W)};const X=parseFloat(W);if(!isNaN(X))return{type:"fixed",value:X}}return{type:"fixed",value:100}},Pe=ie.reduce((W,X)=>{const ee=Ie(me(X));return W+(ee.type==="fixed"?ee.value:100)},0),ue=pe.reduce((W,X)=>{const ee=Ie(me(X));return W+(ee.type==="fixed"?ee.value:100)},0),de=le.reduce((W,X)=>{if(X.flex&&X.flex>0){const ze=X.minWidth??150,xt=typeof X.width=="number"?X.width:150;return W+(ze||xt)}const ee=Ie(me(X));return ee.type==="fixed"?W+ee.value:ee.type==="percentage"?W+100:W+(X.minWidth??150)},0),ft=Math.max(fe-Ce-Pe-ue,de),lt=[],Re=[],ke=[];let Fe=0;le.forEach(W=>{const X=Ie(me(W));if(W.flex&&W.flex>0){ke.push({col:W,flex:W.flex}),Fe+=W.flex;return}X.type==="fixed"?lt.push({col:W,width:X.value}):X.type==="percentage"?Re.push({col:W,percentage:X.value}):(ke.push({col:W,flex:1}),Fe+=1)});const De=lt.reduce((W,{width:X})=>W+X,0);let Te=Math.max(0,ft-De);const st=new Map;Re.forEach(({col:W,percentage:X})=>{const ee=X/100*Te;st.set(W.field,ee),Te-=ee}),Te=Math.max(0,Te);const _t=new Map,ht=ke.map(W=>({...W,minWidth:W.col.minWidth??50,maxWidth:W.col.maxWidth??1/0,frozen:!1,computedWidth:0}));(()=>{let W=0;const X=ht.length*2;for(;W<X;){W++;const ee=ht.filter(te=>!te.frozen);if(ee.length===0)break;const ze=ee.reduce((te,at)=>te+at.flex,0),xt=ht.reduce((te,at)=>at.frozen?te+at.computedWidth:te,0),sl=Math.max(0,Te-xt);if(ze<=0){ee.forEach(te=>{te.computedWidth=te.minWidth,te.frozen=!0});break}const al=sl/ze;let Cn=0;const yn=[],kn=[];if(ee.forEach(te=>{const at=al*te.flex;if(at<te.minWidth){const Xn=te.minWidth-at;Cn+=Xn,yn.push(te)}else if(at>te.maxWidth){const Xn=te.maxWidth-at;Cn+=Xn,kn.push(te)}else te.computedWidth=at}),yn.length===0&&kn.length===0){ee.forEach(te=>te.frozen=!0);break}Cn>0?yn.forEach(te=>{te.computedWidth=te.minWidth,te.frozen=!0}):Cn<0?kn.forEach(te=>{te.computedWidth=te.maxWidth,te.frozen=!0}):(yn.forEach(te=>{te.computedWidth=te.minWidth,te.frozen=!0}),kn.forEach(te=>{te.computedWidth=te.maxWidth,te.frozen=!0}))}})(),ht.forEach(W=>_t.set(W.col.field,W.computedWidth));const Ut=new Map;le.forEach(W=>{let X;if(_t.has(W.field))X=_t.get(W.field);else{const ee=lt.find(xt=>xt.col.field===W.field),ze=Re.find(xt=>xt.col.field===W.field);if(ee)X=ee.width;else if(ze){const xt=st.get(W.field)||0;X=Math.max(W.minWidth??50,xt||100)}else X=100}G.push(X),Ut.set(W.field,X)});const pt=le.map(W=>{const X=ht.find(ee=>ee.col.field===W.field);return{...W,width:Ut.get(W.field)??(typeof W.width=="number"?W.width:100),flex:X?X.flex:W.flex}}),Ke=11,Nt=ie.map((W,X)=>{const ee=Ie(me(W)),ze=ee.type==="fixed"?ee.value:100;return{...W,width:ze,zIndex:Ke+X}}),Kt=11,Ct=pe.map((W,X)=>{const ee=Ie(me(W)),ze=ee.type==="fixed"?ee.value:100;return{...W,width:ze,zIndex:Kt+(pe.length-1-X)}}),Je=G.reduce((W,X)=>W+X,0),ve=Pe+Je+ue+Ce,ll=G.reduce((W,X,ee)=>(W.push((W[ee-1]||0)+X),W),[]);return{rowHeights:L,cumulativeHeights:V,unpinnedRowsHeight:we,pinnedTopHeight:Ue,pinnedBottomHeight:He,leftPinnedCols:Nt,rightPinnedCols:Ct,unpinnedColsWithWidth:pt,unpinnedColWidths:G,unpinnedAccWidths:ll,totalWidth:ve,leftWidth:Pe,rightWidth:ue,unpinnedTotalWidth:Je,systemColumnsWidth:Ce,pinnedTopRowsLength:Ve.length,pinnedBottomRowsLength:it.length,unpinnedRowsLength:N.length}},[i,Ne,gt,Me,vt,k,Ve.length,it.length,vt,k,Ve.length,it.length,Po,tt,rt,ae.dimensions.viewportWidth,a,qe,D,R,B,d,z,ae.dataSource.loading,ge.pageSize]),_e=l.useMemo(()=>{const{unpinnedAccWidths:u,unpinnedColsWithWidth:N,leftPinnedCols:L,rightPinnedCols:V,totalWidth:re,leftWidth:ce,rightWidth:we,unpinnedTotalWidth:Ue,systemColumnsWidth:He,cumulativeHeights:ie,pinnedTopHeight:pe,pinnedBottomHeight:le,unpinnedRowsHeight:G,rowHeights:fe,unpinnedRowsLength:Ce}=Un,me=ae.virtualization.scrollLeft,Ie=ae.virtualization.scrollTop,Pe=ae.dimensions.viewportWidth||1e3,ue=d?pe+G+le+50:ae.dimensions.viewportHeight||600,de=6,ft=Math.max(0,me-ce),lt=me+Pe-ce;let Re=0,ke=N.length-1,Fe=0,De=u.length-1;for(;Fe<=De;){const ve=Fe+De>>>1;u[ve]<ft?Fe=ve+1:De=ve-1}Re=Math.max(0,Fe-de);for(let ve=Re;ve<u.length;ve++){if((ve===0?0:u[ve-1])>lt){ke=Math.min(N.length-1,ve+de);break}ke=Math.min(N.length-1,ve+de)}const Te=Re>0?u[Re-1]:0,st=Ue-u[ke],_t=[...L,...Te>0?[{field:"__spacer_left__",width:Te,isSpacer:!0}]:[],...N.slice(Re,ke+1),...st>0?[{field:"__spacer_right__",width:st,isSpacer:!0}]:[],...V],sn=Pe>0&&re>Pe?16:0,Ut=pe+G+le+sn+2,pt=5;let Ke=0,Nt=Ce-1,Kt=0,Ct=0,Je=ie.length-1;for(;Ct<=Je;){const ve=Ct+Je>>>1;ie[ve]<Ie?Ct=ve+1:Je=ve-1}Ke=Math.max(0,Ct-pt),Kt=Ke>0?ie[Ke-1]:0;for(let ve=Ke;ve<ie.length;ve++)if(ie[ve]>=Ie+ue){Nt=Math.min(Ce-1,ve+pt);break}return{renderContext:{firstRowIndex:Ke,lastRowIndex:Nt,firstColumnIndex:Re,lastColumnIndex:ke},offsetTop:Kt,offsetLeft:0,totalHeight:Ut,pinnedTopHeight:pe,pinnedBottomHeight:le,totalWidth:re,rowHeights:fe,cumulativeHeights:ie,virtualColumns:_t,columnMetrics:{leftPinnedWidth:ce,rightPinnedWidth:we,unpinnedAccWidths:u,unpinnedCols:N,totalSpecialsWidth:He,pinnedSpecialsWidth:(D?48:0)+(qe&&B?48:0)+(a&&R?48:0)}}},[Un,ae.virtualization.scrollTop,ae.virtualization.scrollLeft,ae.dimensions.viewportHeight,ae.dimensions.viewportWidth,d]),Qi=l.useCallback(u=>{const N=u.currentTarget;if(Eo(N.scrollTop,N.scrollLeft),St){const{scrollTop:L,scrollHeight:V,clientHeight:re}=N;V-L-re<100&&St({visibleTop:L,visibleBottom:L+re,viewportHeight:re})}},[Eo,St]);l.useEffect(()=>{if(!Et.current)return;const u=new ResizeObserver(N=>{for(const L of N){const{width:V,height:re}=L.contentRect;No(V,re)}});return u.observe(Et.current),()=>{u.disconnect()}},[No]);const Vt=l.useCallback((u,N)=>{const L=new Set(Ee);N?L.add(u):L.delete(u);const V=Array.from(L);nn||_o(V),fn?.(V)},[Ee,nn,fn]),Zi=l.useCallback(u=>{let N=[];u&&(N=bn.map(L=>L.id)),nn||_o(N),fn?.(N)},[o,nn,fn]),To=l.useCallback((u,N)=>{const L=N?[{field:u,sort:N}]:[];Tn||Ci(L),m?.(L)},[Tn,m]),Kn=l.useCallback(u=>{Wt(!1),Ft({id:u.row.id,field:u.field}),hn.current?.focus({preventScroll:!0}),b?.(u)},[b,Wt]),Lo=l.useRef(Oe.editingCell);l.useEffect(()=>{const u=!!Lo.current,N=!!Oe.editingCell;u&&!N&&hn.current?.focus({preventScroll:!0}),Lo.current=Oe.editingCell},[Oe.editingCell]);const Ro=l.useMemo(()=>{const{firstRowIndex:u,lastRowIndex:N}=_e.renderContext,L=Ve.length,V=Ve.map((le,G)=>({row:le,rowIndex:G})),re=it.map((le,G)=>({row:le,rowIndex:L+(Ne?gt.length:Me.length)+G})),ce=Math.max(0,u-L),we=Math.min(Ne?gt.length:Me.length,N-L+1),Ue=(Ne?gt:Me).slice(ce,we).map((le,G)=>({row:le,rowIndex:L+ce+G})),He=[...V,...Ue,...re],ie=new Set;return He.filter(le=>ie.has(le.row.id)?!1:(ie.add(le.row.id),!0))},[_e.renderContext,Ve,it,gt,Me,Ne,z,ae.dataSource.loading,ge.pageSize,i]),el=o.length>0&&Ee.size===o.length,tl=Ee.size>0&&Ee.size<o.length,nl=l.useCallback(u=>{u.target===u.currentTarget&&Ft(N=>{if(N)return N;if(a)return{id:"HEADER",field:"__checkbox_col__"};const L=ye[0],V=be[0];return L&&V?{id:L.id,field:V.field}:null})},[ye,be]),ol=l.useCallback(u=>{u.currentTarget.contains(u.relatedTarget)||Ft(null)},[]),rl=l.useCallback(u=>{if(Wt(!0),!Xe)return;const{id:N,field:L}=Xe,V=!!Oe.editingCell;if(u.key==="Enter"){if(u.preventDefault(),V)Oe.stopCellEdit();else if(be.find(fe=>fe.field===L)?.editable){const fe=ye.find(Ce=>Ce.id===N);fe&&Oe.startCellEdit({id:N,field:L,value:fe[L]})}return}if((u.key===" "||u.key==="Spacebar")&&!V){if(L==="__checkbox_col__"){u.preventDefault(),Vt(N,!Ee.has(N));return}if(L==="__expand_col__"){u.preventDefault(),ln(N);return}}if(N==="HEADER"&&(u.key==="Enter"||u.key===" ")){u.preventDefault();const G=be.find(fe=>fe.field===L);if(G&&G.sortable!==!1){const fe=Ze.find(me=>me.field===L);let Ce="asc";fe&&(fe.sort==="asc"?Ce="desc":Ce=null),To(L,Ce)}return}if(u.key==="Escape"){V&&(u.preventDefault(),Oe.stopCellEdit({cancel:!0}));return}if(V&&u.key!=="Tab")return;const re=N==="HEADER",ce=re?-1:ye.findIndex(G=>G.id===N),we=be.findIndex(G=>G.field===L);if(!re&&ce===-1||we===-1)return;const Ue=(G,fe,Ce,me,Ie,Pe=!1)=>{let ue=G+Ce,de=fe+me;return Ie&&me!==0&&(me>0&&de>=be.length?(de=0,ue++):me<0&&de<0&&(de=be.length-1,ue--)),!Ie&&(de<0||de>=be.length)||ue<(Pe?-1:0)||ue>=ye.length?null:{r:ue,c:de}},He=(G,fe,Ce,me,Ie,Pe=!1)=>{let ue=G,de=fe,ft=0;const lt=ye.length*be.length+be.length;for(;ft<lt;){if(ft++,ue+=Ce,de+=me,me!==0)me>0?de>=be.length&&(de=0,ue++):de<0&&(de=be.length-1,ue--);else if(de<0||de>=be.length)return null;if(ue<-1||ue>=ye.length)return null;if(ue===-1){if(!Pe)continue;const Te=be[de],st=Te.sortable!==!1;if(["__checkbox_col__"].includes(Te.field)||st)return{r:ue,c:de};continue}const Re=ye[ue],ke=be[de],Fe=["__checkbox_col__","__expand_col__","__reorder_col__"].includes(ke.field);let De=ke.editable||Fe;if(U&&!Fe)try{De=U({row:Re,field:ke.field,value:Re[ke.field],colDef:ke,rowIndex:ue,colIndex:de})}catch(Te){console.error("Error in isCellEditable:",Te)}if(De)return{r:ue,c:de}}return null};let ie=ce,pe=we,le=!1;if(u.key==="Tab"){const G=u.shiftKey?-1:1,fe=He(ce,we,0,G,!0,!1);fe&&(ie=fe.r,pe=fe.c,le=!0)}else if(u.key==="ArrowRight"){const G=Ue(ce,we,0,1,!0,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(u.key==="ArrowLeft"){const G=Ue(ce,we,0,-1,!0,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(u.key==="ArrowDown"){const G=Ue(ce,we,1,0,!1,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(u.key==="ArrowUp"){const G=Ue(ce,we,-1,0,!1,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(u.key==="Home")(u.ctrlKey||u.metaKey)&&(ie=-1),pe=0,le=!0;else if(u.key==="End")(u.ctrlKey||u.metaKey)&&(ie=ye.length-1),pe=be.length-1,le=!0;else if(u.key==="PageUp"){const G=Ne?ge.pageSize:10;ie=Math.max(-1,ie-G),le=!0}else if(u.key==="PageDown"){const G=Ne?ge.pageSize:10;ie=Math.min(ye.length-1,ie+G),le=!0}if(le&&(u.preventDefault(),V&&u.key==="Tab"&&Oe.stopCellEdit(),ie>=-1&&ie<ye.length&&pe>=0&&pe<be.length)){const G=be[pe];if(ie===-1)Ft({id:"HEADER",field:G.field});else{const fe=ye[ie];Ft({id:fe.id,field:G.field})}if(Et.current){const{cumulativeHeights:fe,pinnedTopHeight:Ce}=_e,{clientHeight:me,clientWidth:Ie,scrollTop:Pe,scrollLeft:ue}=Et.current,de=ie===0?0:fe[ie-1],ft=fe[ie],lt=Ce,Re=Pe+lt,ke=Pe+me;let Fe=Pe;if(de<Re?Fe=Math.max(0,de-lt):ft>ke&&(Fe=ft-me),Fe!==Pe&&(Et.current.scrollTop=Fe),_e.columnMetrics){const{leftPinnedWidth:De,rightPinnedWidth:Te,unpinnedAccWidths:st,unpinnedCols:_t,totalSpecialsWidth:ht,pinnedSpecialsWidth:sn}=_e.columnMetrics,Ut=G.field,pt=_t.findIndex(Ke=>Ke.field===Ut);if(pt!==-1){const Ke=ht+De+(pt>0?st[pt-1]:0),Nt=ht+De+st[pt],Kt=ue+sn+De,Ct=ue+Ie-Te;let Je=ue;Ke<Kt?Je=Math.max(0,Ke-sn-De):Nt>Ct&&(Je=Nt-Ie+Te),Je!==ue&&(Et.current.scrollLeft=Je)}}}}},[Xe,ye,be,Oe,_e,Ee,Vt,ln]),il=l.useMemo(()=>Le.some(u=>!!u.rowSpan),[Le]),[vn,_n]=l.useState(!1),Yn=l.useRef(null);return l.useEffect(()=>{if(!vn||je?.toolbar)return;function u(N){const L=document.getElementById("ogx-standalone-col-panel");L&&!L.contains(N.target)&&_n(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[vn,je?.toolbar]),t.jsxs("div",{ref:Yn,className:`ogx ${en} ${d?"ogx--auto-height":""} ${il?"ogx--row-spanning":""} ${cn?"ogx--list-view":""}`,style:{...Lt,height:q??Lt?.height,"--ogx-row-height":`${i}px`,"--ogx-header-height":`${s}px`},"aria-busy":on,children:[bo&&(()=>{const u={apiRef:ot.apiRef,columns:Le,aggregationModel:et,onAggregationModelChange:ji,...Be?{pivotModel:wo,onPivotModelChange:Ri}:{},filterModel:Ge,onFilterModelChange:p,columnVisibilityModel:Ye,onColumnVisibilityModelChange:tn,forceColumnsOpen:vn,onColumnsPanelClose:()=>_n(!1),...ct?.toolbar};return t.jsx(bo,{...u})})(),!je?.toolbar&&vn&&yt.createPortal(t.jsxs("div",{id:"ogx-standalone-col-panel",style:(()=>{const u=Yn.current?.getBoundingClientRect();return{position:"fixed",top:u?u.top+8:16,right:u?window.innerWidth-u.right+8:16,zIndex:9999,display:"inline-block"}})(),children:[t.jsx("button",{onClick:()=>_n(!1),style:{position:"absolute",top:-12,right:-12,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",background:"#334155",color:"#fff",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:14,lineHeight:1,zIndex:1,boxShadow:"0 1px 4px rgba(0,0,0,0.2)"},"aria-label":"Close",children:"×"}),t.jsx(so,{columns:Le,visibleColumns:new Set(Le.filter(u=>Ye[u.field]!==!1).map(u=>u.field)),onVisibilityChange:(u,N)=>{tn({...Ye,[u]:N})},onShowAll:()=>{const u={...Ye};Le.forEach(N=>{N.hideable!==!1&&(u[N.field]=!0)}),tn(u)},onHideAll:()=>{const u={...Ye};Le.forEach(N=>{N.hideable!==!1&&(u[N.field]=!1)}),tn(u)}})]}),document.body),cn&&mo&&t.jsxs("div",{className:"ogx-list-view",role:"grid","aria-label":Rt||"Data grid list view","aria-rowcount":ye.length+1,children:[t.jsx("div",{className:"ogx-list-view__toolbar",children:t.jsxs("span",{children:[$e.length," ",$e.length===1?"item":"items",Ne?` · page ${ge.page+1} of ${Math.ceil($e.length/ge.pageSize)||1}`:"",Ee.size>0?` · ${Ee.size} selected`:""]})}),t.jsx("div",{className:"ogx-list-view__rows",children:ye.length===0?t.jsxs("div",{className:"ogx-list-view__empty","aria-live":"polite",role:"status",children:[t.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("path",{d:"M3 9h18M9 21V9"})]}),In]}):ye.map((u,N)=>t.jsx(Ao,{row:u,rowIndex:N,listViewColumn:mo,isSelected:Ee.has(u.id),checkboxSelection:a,rowHeight:i,onRowClick:L=>mn({row:L,id:L.id,rowIndex:N}),onSelectionChange:Vt},u.id))}),Ne&&(()=>{const u=je?.pagination||ro,N=z==="server"&&ne?ae.pagination.rowCount||0:$e.length,L={page:ge.page,pageSize:ge.pageSize,rowCount:N,pageSizeOptions:C,onPageChange:V=>gn({...ge,page:V}),onPageSizeChange:V=>gn({...ge,pageSize:V,page:0}),...ct?.pagination};return t.jsx(u,{...L})})()]}),!cn&&t.jsx("div",{ref:u=>{Et.current=u,hn.current=u},className:"ogx__viewport",onScroll:Qi,role:"grid","aria-label":Rt||"Data grid","aria-rowcount":$e.length+1,"aria-colcount":e.length+(a?1:0)+(qe?1:0)+(D?1:0),"aria-busy":on,tabIndex:0,onKeyDownCapture:()=>{Wt(!0)},onMouseDownCapture:()=>{Wt(!1)},onKeyDown:rl,onFocus:nl,onBlur:ol,children:t.jsxs("div",{ref:zi,className:"ogx__content",style:{width:_e.totalWidth},role:"presentation",children:[t.jsx(to,{columns:_e.virtualColumns,allColumns:Le,columnGroupingModel:jt,checkboxSelection:a,allSelected:el,someSelected:tl,onSelectAll:Zi,sortModel:Ze,onSort:To,onColumnResize:Ji,columnWidths:rt,pinnedColumns:tt,focusedCell:Xe,onHeaderClick:u=>{Ft({id:"HEADER",field:u}),Wt(!1),hn.current?.focus({preventScroll:!0})},onDragStart:jt?void 0:$t.onDragStart,onDragOver:jt?void 0:$t.onDragOver,onDragEnd:jt?void 0:$t.onDragEnd,onDrop:jt?void 0:$t.onDrop,draggedColumn:jt?void 0:$t.draggedColumn,dragOverColumn:jt?void 0:$t.dragOverColumn,rowReordering:D,hasDetailPanel:qe,pinCheckboxColumn:R,pinExpandColumn:B,aggregationModel:et,onHideColumn:u=>{tn({...Ye,[u]:!1})},onManageColumns:()=>_n(!0),onPinColumn:(u,N)=>{const L=[...tt?.left??[]],V=[...tt?.right??[]],re=L.filter(we=>we!==u),ce=V.filter(we=>we!==u);On(N==="left"?{left:[...re,u],right:ce}:N==="right"?{left:re,right:[...ce,u]}:{left:re,right:ce})}}),!on&&!ae.dataSource.error&&$e.length===0&&t.jsxs("div",{className:"ogx__empty",style:{width:_e.totalWidth},children:[t.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("path",{d:"M3 9h18M9 21V9"})]}),t.jsx("span",{children:In})]}),Ve.length>0&&t.jsx("div",{className:"ogx__pinned-rows ogx__pinned-rows--top",role:"rowgroup",children:Ve.map((u,N)=>t.jsx(Jt,{row:u,columns:_e.virtualColumns,rowIndex:N,isSelected:Ee.has(u.id),checkboxSelection:a,onRowClick:mn,onCellClick:Kn,onSelectionChange:Vt,columnWidths:rt,pinnedColumns:tt,pinnedRows:y,hasDetailPanel:qe,isDetailPanelExpanded:vt.has(u.id),detailPanelContent:P?P({row:u,id:u.id,rowIndex:N}):null,detailPanelHeight:k?.({row:u,id:u.id,rowIndex:N})||200,onDetailPanelToggle:ln,pinCheckboxColumn:R,pinExpandColumn:B,focusedCellField:Xe?.id===u.id?Xe.field:null,colspanMap:Gt.colspanMap,rowSpanningCaches:Gt.rowSpanningState.caches,rowHeight:i},u.id))}),t.jsx("div",{className:"ogx__virtual-container",style:{height:`${_e.totalHeight-_e.pinnedTopHeight-_e.pinnedBottomHeight}px`},role:"presentation",children:t.jsxs("div",{className:"ogx__rows",style:{transform:`translateY(${_e.renderContext.firstRowIndex*i}px)`},role:"rowgroup",children:[on&&Ro.length===0?(()=>{const u=e.length>0?e:(()=>{const N=(ae.dimensions.viewportWidth||1e3)-(a?48:0)-(P?48:0)-(D?48:0),L=150,V=Math.max(1,Math.ceil(N/L));return Array.from({length:V},(re,ce)=>({field:`placeholder_${ce}`,headerName:"",width:L}))})();return Array.from({length:10}).map((N,L)=>t.jsx(cr,{columns:u,rowHeight:i,checkboxSelection:a,hasDetailPanel:!!P,rowReordering:D},`skeleton-${L}`))})():Ro.filter(({row:u})=>!Sn(u.id,y)).filter((u,N,L)=>N===L.findIndex(V=>V.row.id===u.row.id)).map(({row:u,rowIndex:N})=>t.jsx(Jt,{row:u,columns:_e.virtualColumns,rowIndex:N,isSelected:Ee.has(u.id),checkboxSelection:a,onRowClick:mn,onCellClick:Kn,onSelectionChange:Vt,columnWidths:rt,pinnedColumns:tt,pinnedRows:y,hasDetailPanel:qe,isDetailPanelExpanded:vt.has(u.id),detailPanelContent:P?P({row:u,id:u.id,rowIndex:N}):null,detailPanelHeight:k?.({row:u,id:u.id,rowIndex:N})||200,onDetailPanelToggle:ln,pinCheckboxColumn:R,pinExpandColumn:B,rowReordering:D,onDragStart:Dt.onDragStart,onDragOver:Dt.onDragOver,onDragEnd:Dt.onDragEnd,onDrop:Dt.onDrop,isDragging:Dt.draggedRowId===u.id,isDragOver:Dt.dragOverRowId===u.id,editingCell:Oe.editingCell,onEditStart:Oe.startCellEdit,onEditStop:Oe.stopCellEdit,onEditCellValueChange:Oe.setEditCellValue,focusedCellField:Xe!=null&&Xe.id===u.id?Xe.field:null,colspanMap:Gt.colspanMap,rowSpanningCaches:Gt.rowSpanningState.caches,rowHeight:i},`${u.id}-${_e.totalWidth}`)),z==="infinite"&&ae.dataSource.loading&&Me.length>0&&(()=>{const u=Math.min(ge.pageSize,20),N=Un.unpinnedRowsLength;return t.jsx("div",{className:"ogx__skeleton-group",children:Array.from({length:u}).map((L,V)=>t.jsx(Jt,{row:{id:`__skeleton_${V}__`,_isSkeleton:!0},columns:_e.virtualColumns,rowIndex:N+V,rowHeight:i},`__skeleton_${V}__`))})})()]})}),it.length>0&&t.jsx("div",{className:"ogx__pinned-rows ogx__pinned-rows--bottom",role:"rowgroup",children:it.map((u,N)=>t.jsx(Jt,{row:u,columns:_e.virtualColumns,rowIndex:N,isSelected:Ee.has(u.id),checkboxSelection:a,onRowClick:mn,onCellClick:Kn,onSelectionChange:Vt,columnWidths:rt,pinnedColumns:tt,pinnedRows:y,hasDetailPanel:qe,isDetailPanelExpanded:vt.has(u.id),detailPanelContent:P?P({row:u,id:u.id,rowIndex:N}):null,detailPanelHeight:k?.({row:u,id:u.id,rowIndex:N})||200,onDetailPanelToggle:ln,pinCheckboxColumn:R,pinExpandColumn:B,focusedCellField:Xe?.id===u.id?Xe.field:null,colspanMap:Gt.colspanMap,rowSpanningCaches:Gt.rowSpanningState.caches,rowHeight:i},u.id))}),wn&&t.jsxs("div",{className:"ogx__aggregation-footer",role:"row","aria-label":"Aggregation totals","aria-live":"polite",style:{minHeight:`${i}px`},children:[a&&t.jsx("div",{style:{width:48,flexShrink:0}}),qe&&t.jsx("div",{style:{width:48,flexShrink:0}}),D&&t.jsx("div",{style:{width:48,flexShrink:0}}),Bt.map(u=>{const N=et[u.field],L=Vn[u.field],V=rt[u.field]??(typeof u.width=="number"?u.width:120);return t.jsx("div",{className:"ogx__aggregation-cell",role:"gridcell",style:{width:V,minWidth:V,maxWidth:V,textAlign:u.align||"left"},children:N?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ogx__aggregation-label",children:N}),t.jsx("span",{className:"ogx__aggregation-value",children:mt(L,N)})]}):null},u.field)})]})]})}),!cn&&Ne&&(()=>{const u=je?.pagination||ro,N={page:ge.page,pageSize:ge.pageSize,rowCount:ae.pagination.rowCount,pageSizeOptions:C,onPageChange:L=>gn({...ge,page:L}),onPageSizeChange:L=>gn({...ge,pageSize:L,page:0}),...ct?.pagination};return t.jsx(u,{...N})})(),t.jsxs("div",{className:"ogx-aria-live-status",role:"status","aria-live":"polite",children:[on?"Loading data...":"",ae.dataSource.error?`Error: ${ae.dataSource.error.message||"Unknown error"}`:"",!J&&!ae.dataSource.error&&($e.length===0?In:Ge&&((Ge.quickFilterValues?.length||0)>0||(Ge.items?.length||0)>0)?`${$e.length} ${$e.length===1?"row":"rows"} found`:"")]}),ae.dataSource.error&&t.jsxs("div",{className:"ogx-error-overlay","aria-live":"assertive",role:"alert",children:[t.jsxs("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"var(--ogx-color-error)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),t.jsx("div",{className:"ogx-error-overlay__title",children:"Oops! Something went wrong"}),t.jsx("div",{className:"ogx-error-overlay__message",children:ae.dataSource.error.message||"An unexpected error occurred while loading the data."}),t.jsx("button",{onClick:()=>window.location.reload(),className:"ogx-button ogx-button--primary",children:"Retry"})]})]})}function Fr({rows:n=5,columns:o=5}){return t.jsx("div",{className:"ogx__skeleton",children:Array.from({length:n}).map((e,r)=>t.jsx("div",{className:"ogx__skeleton-row",children:Array.from({length:o}).map((i,s)=>t.jsx("div",{className:"ogx__skeleton-cell",children:t.jsx("div",{className:"ogx__skeleton-content"})},s))},r))})}const ao=new Set(["isEmpty","isNotEmpty"]);function Wr(n,o){return n.find(e=>"field"in e&&e.field===o)}const Or=({col:n,item:o,onChange:e})=>{const r=vr(n.type),i=!!o,s=o?.operator??r[0],d=c=>{const p=ao.has(c),w={id:o?.id??`${n.field}-${Date.now()}`,field:n.field,operator:c,value:p?void 0:o?.value??(n.type==="boolean"?"true":"")};e(w)},a=c=>{e({id:o?.id??`${n.field}-${Date.now()}`,field:n.field,operator:s,value:c})},g=()=>{e(null)},f=ao.has(String(s)),h=n.type==="boolean",b=!f;return t.jsxs("div",{className:`ogx-filter__row${i?" ogx-filter__row--active":""}`,children:[t.jsx("span",{className:"ogx-filter__col-label",title:n.field,children:n.headerName||n.field}),t.jsxs("div",{className:"ogx-filter__controls",children:[t.jsx("select",{id:`ogx-filter-op-${n.field}`,name:`filter-op-${n.field}`,className:`ogx-filter__op-select${i?" ogx-filter__op-select--active":""}`,value:String(s),onChange:c=>d(c.target.value),"aria-label":`Filter operator for ${n.headerName||n.field}`,children:r.map(c=>t.jsx("option",{value:c,children:c},c))}),b&&h&&t.jsxs("select",{id:`ogx-filter-val-${n.field}`,name:`filter-val-${n.field}`,className:`ogx-filter__value-input ogx-filter__value-select${i?" ogx-filter__value-input--active":""}`,value:String(o?.value??"true"),onChange:c=>a(c.target.value),"aria-label":`Filter value for ${n.headerName||n.field}`,children:[t.jsx("option",{value:"true",children:"true"}),t.jsx("option",{value:"false",children:"false"})]}),b&&!h&&t.jsx("input",{id:`ogx-filter-val-${n.field}`,name:`filter-val-${n.field}`,className:`ogx-filter__value-input${i?" ogx-filter__value-input--active":""}`,type:n.type==="number"?"number":"text",value:o?.value??"",onChange:c=>a(c.target.value),placeholder:"Value…","aria-label":`Filter value for ${n.headerName||n.field}`}),i&&t.jsx("button",{className:"ogx-filter__row-clear",onClick:g,"aria-label":`Clear filter for ${n.headerName||n.field}`,title:"Clear",children:"×"})]})]})},co=({filterModel:n,columns:o,onFilterModelChange:e})=>{const r=n.items??[],i=n.logicOperator??"and",s=l.useCallback((g,f)=>{const h=r.filter(c=>"field"in c&&c.field!==g),b=f?[...h,f]:h;e({...n,items:b})},[r,n,e]),d=l.useCallback(g=>{e({...n,logicOperator:g})},[n,e]),a=o.filter(g=>g.filterable!==!1);return t.jsxs(t.Fragment,{children:[r.length>1&&t.jsxs("div",{className:"ogx-filter__logic-bar",children:[t.jsx("span",{className:"ogx-filter__logic-label",children:"Match:"}),t.jsx("button",{className:`ogx-filter__logic-pill${i==="and"?" ogx-filter__logic-pill--active":""}`,onClick:()=>d("and"),"aria-pressed":i==="and",children:"ALL (AND)"}),t.jsx("button",{className:`ogx-filter__logic-pill${i==="or"?" ogx-filter__logic-pill--active":""}`,onClick:()=>d("or"),"aria-pressed":i==="or",children:"ANY (OR)"})]}),a.length===0?t.jsx("div",{className:"ogx-filter__empty",children:"No filterable columns."}):a.map(g=>t.jsx(Or,{col:g,item:Wr(r,g.field),onChange:f=>s(g.field,f)},g.field))]})},Ar=["sum","avg","count","min","max"];function uo(){return t.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",fill:"currentColor",opacity:"0.25"}),t.jsx("path",{d:"M17 14v-4M17 10l-2 2 2 2"})]})}function zr({anchorRef:n,columns:o,model:e,onChange:r,onClose:i}){const s=l.useRef(null),[d,a]=l.useState({top:0,right:0}),g=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const x=n.current.getBoundingClientRect();return{top:x.bottom+6,right:window.innerWidth-x.right}},[n]);l.useEffect(()=>{a(g());const x=()=>a(g());return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[g]),l.useEffect(()=>{function x(R){s.current&&!s.current.contains(R.target)&&n.current&&!n.current.contains(R.target)&&i()}function S(R){R.key==="Escape"&&i()}return document.addEventListener("mousedown",x),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",S)}},[n,i]);const f=new Set(e.rowFields),h=new Set(e.columnFields),b=new Set(e.valueFields.map(x=>x.field)),c=x=>f.has(x)||h.has(x)||b.has(x);function p(x){f.has(x)||r({...e,rowFields:[...e.rowFields,x]})}function w(x){h.has(x)||r({...e,columnFields:[...e.columnFields,x]})}function m(x,S="sum"){b.has(x)||r({...e,valueFields:[...e.valueFields,{field:x,aggFn:S}]})}function I(x){r({...e,rowFields:e.rowFields.filter(S=>S!==x)})}function M(x){r({...e,columnFields:e.columnFields.filter(S=>S!==x)})}function E(x){r({...e,valueFields:e.valueFields.filter(S=>S.field!==x)})}function C(x,S){r({...e,valueFields:e.valueFields.map(R=>R.field===x?{...R,aggFn:S}:R)})}function _(){r({rowFields:[],columnFields:[],valueFields:[]})}const j=new Set(o.filter(x=>x.type==="number"||x.aggregable).map(x=>x.field)),y=e.rowFields.length+e.columnFields.length+e.valueFields.length,P=x=>o.find(S=>S.field===x)?.headerName??x,k=t.jsxs("div",{ref:s,className:"ogx-pivot-panel",role:"dialog","aria-label":"Pivot configuration",style:{top:d.top,right:d.right},children:[t.jsxs("div",{className:"ogx-pivot-panel__header",children:[t.jsxs("span",{className:"ogx-pivot-panel__title",children:[t.jsx(uo,{}),"Pivot Mode"]}),y>0&&t.jsx("button",{className:"ogx-pivot-panel__reset-btn",onClick:_,title:"Reset pivot",children:"Reset"})]}),t.jsxs("div",{className:"ogx-pivot-panel__body",children:[t.jsxs("div",{className:"ogx-pivot-zone",children:[t.jsxs("span",{className:"ogx-pivot-zone__label",children:[t.jsx("span",{className:"ogx-pivot-zone__dot ogx-pivot-zone__dot--row"}),"Row Fields"]}),t.jsx("div",{className:`ogx-pivot-chips${e.rowFields.length===0?" ogx-pivot-chips--empty":""}`,"data-placeholder":"Add fields here — each becomes a row label",children:e.rowFields.map(x=>t.jsxs("span",{className:"ogx-pivot-chip ogx-pivot-chip--row",children:[P(x),t.jsx("button",{className:"ogx-pivot-chip__remove",onClick:()=>I(x),title:`Remove ${P(x)}`,children:"×"})]},x))})]}),t.jsxs("div",{className:"ogx-pivot-zone",children:[t.jsxs("span",{className:"ogx-pivot-zone__label",children:[t.jsx("span",{className:"ogx-pivot-zone__dot ogx-pivot-zone__dot--col"}),"Column Fields"]}),t.jsx("div",{className:`ogx-pivot-chips${e.columnFields.length===0?" ogx-pivot-chips--empty":""}`,"data-placeholder":"Add fields here — unique values become column headers",children:e.columnFields.map(x=>t.jsxs("span",{className:"ogx-pivot-chip ogx-pivot-chip--col",children:[P(x),t.jsx("button",{className:"ogx-pivot-chip__remove",onClick:()=>M(x),title:`Remove ${P(x)}`,children:"×"})]},x))})]}),t.jsxs("div",{className:"ogx-pivot-zone",children:[t.jsxs("span",{className:"ogx-pivot-zone__label",children:[t.jsx("span",{className:"ogx-pivot-zone__dot ogx-pivot-zone__dot--value"}),"Value Fields (aggregated)"]}),t.jsx("div",{className:`ogx-pivot-chips${e.valueFields.length===0?" ogx-pivot-chips--empty":""}`,"data-placeholder":"Add numeric fields here — values are aggregated",children:e.valueFields.map(x=>t.jsxs("span",{className:"ogx-pivot-chip ogx-pivot-chip--value",children:[P(x.field),t.jsx("select",{className:"ogx-pivot-chip__fn-select",value:x.aggFn,onChange:S=>C(x.field,S.target.value),title:"Aggregation function",children:Ar.map(S=>t.jsx("option",{value:S,children:S.toUpperCase()},S))}),t.jsx("button",{className:"ogx-pivot-chip__remove",onClick:()=>E(x.field),title:`Remove ${P(x.field)}`,children:"×"})]},x.field))})]}),t.jsx("hr",{className:"ogx-pivot-panel__divider"}),t.jsxs("div",{children:[t.jsx("div",{className:"ogx-pivot-panel__fields-label",children:"Available Fields"}),t.jsxs("div",{className:"ogx-pivot-fields",children:[o.map(x=>{const S=j.has(x.field);return c(x.field)?null:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:3},children:[t.jsx("span",{className:`ogx-pivot-field-btn${S?" ogx-pivot-field-btn--numeric":""}`,children:x.headerName??x.field}),t.jsxs("div",{className:"ogx-pivot-field-actions",children:[t.jsx("button",{className:"ogx-pivot-add-btn ogx-pivot-add-btn--row",onClick:()=>p(x.field),title:"Add to Row Fields",children:"Row"}),t.jsx("button",{className:"ogx-pivot-add-btn ogx-pivot-add-btn--col",onClick:()=>w(x.field),title:"Add to Column Fields",children:"Col"}),S&&t.jsx("button",{className:"ogx-pivot-add-btn ogx-pivot-add-btn--value",onClick:()=>m(x.field),title:"Add to Value Fields",children:"Val"})]})]},x.field)}),o.every(x=>c(x.field))&&t.jsx("span",{style:{fontSize:12,color:"var(--ogx-color-gray-400, #94a3b8)"},children:"All fields are in use."})]})]})]})]});return yt.createPortal(k,document.body)}function Br(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function $r(){return t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Hr({value:n="",onChange:o,placeholder:e="Search...",debounceMs:r=250}){const[i,s]=l.useState(!1),[d,a]=l.useState(n),g=l.useRef(null),f=l.useRef(null);l.useEffect(()=>{a(n),n&&!i&&s(!0)},[n,i]),l.useEffect(()=>{const p=setTimeout(()=>{d!==n&&o(d)},r);return()=>clearTimeout(p)},[d,o,r,n]);const h=()=>{s(!0)},b=p=>{p.stopPropagation(),a(""),g.current?.focus(),o("")},c=()=>{d||s(!1)};return l.useEffect(()=>{const p=w=>{f.current&&!f.current.contains(w.target)&&(d||s(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[d]),t.jsxs("div",{ref:f,className:`ogx-global-search${i?" ogx-global-search--expanded":""}`,onClick:()=>{i||(s(!0),setTimeout(()=>g.current?.focus(),50))},children:[t.jsx("div",{className:"ogx-global-search__icon-wrapper",children:t.jsx(Br,{})}),t.jsx("input",{ref:g,id:"ogx-global-search-input",name:"ogx-global-search",className:"ogx-global-search__input",value:d,onChange:p=>a(p.target.value),onFocus:h,onBlur:c,placeholder:e,"aria-label":"Global Search",autoComplete:"off"}),d&&t.jsx("button",{className:"ogx-global-search__clear",onClick:b,"aria-label":"Clear search",children:t.jsx($r,{})})]})}function Zt({title:n,children:o,placement:e="top",enterDelay:r=200,leaveDelay:i=0}){const[s,d]=l.useState(!1),[a,g]=l.useState({top:0,left:0}),f=l.useRef(null),h=l.useRef(null),b=l.useCallback(()=>{if(!h.current)return;const m=h.current.getBoundingClientRect();let I=0,M=0;const E=window.pageXOffset||document.documentElement.scrollLeft,C=window.pageYOffset||document.documentElement.scrollTop;e==="top"?(I=m.top+C-8,M=m.left+E+m.width/2):e==="bottom"&&(I=m.bottom+C+8,M=m.left+E+m.width/2),g({top:I,left:M})},[e]);l.useLayoutEffect(()=>(s&&(b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b)),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}),[s,b]);const c=()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d(!0)},r)},p=()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d(!1)},i)},w=l.useCallback(m=>{h.current=m?m.firstElementChild??m:null},[]);return t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:w,style:{display:"inline-block",lineHeight:0},onMouseEnter:c,onMouseLeave:p,children:o}),s&&n&&yt.createPortal(t.jsx("div",{className:`ogx-tooltip ogx-tooltip--${e}`,style:{top:a.top,left:a.left,position:"absolute",zIndex:99999},children:n}),document.body)]})}const Dr=["none","sum","avg","count","min","max"];function go(){return t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M18 4H6l6 8-6 8h12"})})}function Gr(){return t.jsxs("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",children:[t.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("rect",{x:"8.5",y:"4",width:"7",height:"16",fill:"currentColor",opacity:"0.25"}),t.jsx("line",{x1:"8.5",y1:"4",x2:"8.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"15.5",y1:"4",x2:"15.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"2",y1:"9",x2:"22",y2:"9",stroke:"currentColor",strokeWidth:"1.2"}),t.jsx("line",{x1:"2",y1:"14",x2:"22",y2:"14",stroke:"currentColor",strokeWidth:"1.2"})]})}function fo(){return t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}function Vr({anchorRef:n,aggregationModel:o,aggregableColumns:e,onFunctionChange:r,onClearAll:i,onClose:s,activeCount:d}){const a=l.useRef(null),[g,f]=l.useState({top:0,right:0}),h=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const c=n.current.getBoundingClientRect();return{top:c.bottom+6,right:window.innerWidth-c.right}},[n]);l.useEffect(()=>{f(h());const c=()=>f(h());return window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[h]),l.useEffect(()=>{function c(p){a.current&&!a.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&s()}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n,s]),l.useEffect(()=>{function c(p){p.key==="Escape"&&s()}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[s]);const b=t.jsxs("div",{ref:a,className:"ogx-toolbar__panel",role:"dialog","aria-label":"Summaries configuration",style:{top:g.top,right:g.right,width:400,maxWidth:"calc(100vw - 24px)"},children:[t.jsxs("div",{className:"ogx-toolbar__panel-header",children:[t.jsxs("span",{className:"ogx-toolbar__panel-title",children:[t.jsx(go,{}),"Summaries"]}),d>0&&t.jsx("button",{className:"ogx-toolbar__clear-btn",onClick:i,title:"Clear all summaries",children:"Clear all"})]}),t.jsx("div",{className:"ogx-toolbar__panel-body",children:e.length===0?t.jsxs("p",{className:"ogx-toolbar__empty",children:["No aggregable columns.",t.jsx("br",{}),"Set ",t.jsx("code",{children:"aggregable: true"})," on a column to enable."]}):e.map(c=>{const p=o[c.field]||"none";return t.jsxs("div",{className:"ogx-toolbar__agg-row",children:[t.jsx("span",{className:"ogx-toolbar__agg-label",title:c.field,children:c.headerName||c.field}),t.jsx("div",{className:"ogx-toolbar__agg-pills",children:Dr.map(w=>t.jsx("button",{className:`ogx-toolbar__pill${p===w?" ogx-toolbar__pill--active":""}`,onClick:()=>r(c.field,w),"aria-pressed":p===w,children:w},w))})]},c.field)})})]});return yt.createPortal(b,document.body)}function Ur({anchorRef:n,columns:o,visibleColumns:e,onVisibilityChange:r,onShowAll:i,onHideAll:s,onClose:d}){const a=l.useRef(null),[g,f]=l.useState({top:0,right:0}),h=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const c=n.current.getBoundingClientRect();return{top:c.bottom+6,right:window.innerWidth-c.right}},[n]);l.useEffect(()=>{f(h());const c=()=>f(h());return window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[h]),l.useEffect(()=>{function c(p){a.current&&!a.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&d()}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n,d]);const b=t.jsx("div",{ref:a,className:"ogx-toolbar__panel",role:"dialog","aria-label":"Column visibility",style:{top:g.top,right:g.right,width:280,padding:0},children:t.jsx(so,{columns:o,visibleColumns:e,onVisibilityChange:r,onShowAll:i,onHideAll:s})});return yt.createPortal(b,document.body)}function Kr({anchorRef:n,columns:o,filterModel:e,onFilterModelChange:r,onClose:i}){const s=l.useRef(null),[d,a]=l.useState({top:0,right:0}),g=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const c=n.current.getBoundingClientRect();return{top:c.bottom+6,right:window.innerWidth-c.right}},[n]);l.useEffect(()=>{a(g());const c=()=>a(g());return window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[g]),l.useEffect(()=>{function c(w){s.current&&!s.current.contains(w.target)&&n.current&&!n.current.contains(w.target)&&i()}function p(w){w.key==="Escape"&&i()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p)}},[n,i]);const f=e.items?.length??0,h=()=>{r({...e,items:[],logicOperator:"and"})},b=t.jsxs("div",{ref:s,className:"ogx-toolbar__panel ogx-toolbar__panel--filter",role:"dialog","aria-label":"Advanced filters",style:{top:d.top,right:d.right,width:540,maxWidth:"calc(100vw - 24px)"},children:[t.jsxs("div",{className:"ogx-toolbar__panel-header",children:[t.jsxs("span",{className:"ogx-toolbar__panel-title",children:[t.jsx(fo,{}),"Filters",f>0&&t.jsx("span",{className:"ogx-toolbar__panel-count",children:f})]}),f>0&&t.jsx("button",{className:"ogx-toolbar__clear-btn",onClick:h,title:"Clear all filters",children:"Clear all"})]}),t.jsx("div",{className:"ogx-toolbar__panel-body ogx-toolbar__panel-body--filter",children:t.jsx(co,{columns:o,filterModel:e,onFilterModelChange:r})})]});return yt.createPortal(b,document.body)}const Yr={rowFields:[],columnFields:[],valueFields:[]};function Xr({columns:n=[],aggregationModel:o={},onAggregationModelChange:e,pivotModel:r,onPivotModelChange:i,filterModel:s,onFilterModelChange:d,columnVisibilityModel:a={},onColumnVisibilityModelChange:g,forceColumnsOpen:f,onColumnsPanelClose:h,children:b,rightContent:c,style:p}){const[w,m]=l.useState(!1),[I,M]=l.useState(!1),[E,C]=l.useState(!1),[_,j]=l.useState(!1);l.useEffect(()=>{f&&(C(!0),m(!1),M(!1),j(!1))},[f]);const y=l.useRef(null),P=l.useRef(null),k=l.useRef(null),x=l.useRef(null),S=r??Yr,R=S.rowFields.length>0||S.columnFields.length>0||S.valueFields.length>0,B=n.filter(F=>F.aggregable!==!1&&(F.type==="number"||F.aggregable===!0)),Y=Object.keys(o).filter(F=>o[F]&&o[F]!=="none").length,$=l.useCallback((F,A)=>{if(!e)return;const O={...o};A==="none"?delete O[F]:O[F]=A,e(O)},[o,e]),K=l.useCallback(()=>{e?.({})},[e]),q=l.useCallback(F=>{if(!d)return;const O={...s||{},quickFilterValues:F?[F]:[],items:s?.items||[]};d(O)},[s,d]),D=s?.quickFilterValues?.[0]||"",Z=s?.items?.length||0,J=new Set(n.filter(F=>a[F.field]!==!1).map(F=>F.field)),he=l.useCallback((F,A)=>{if(!g)return;const O={...a,[F]:A};g(O)},[a,g]),v=l.useCallback(()=>{if(!g)return;const F={...a};n.forEach(A=>{A.hideable!==!1&&(F[A.field]=!0)}),g(F)},[n,a,g]),H=l.useCallback(()=>{if(!g)return;const F={...a};n.forEach(A=>{A.hideable!==!1&&(F[A.field]=!1)}),g(F)},[n,a,g]);return t.jsxs("div",{className:"ogx-toolbar",role:"toolbar","aria-label":"Grid toolbar",style:p,children:[b&&t.jsx("div",{className:"ogx-toolbar__left",children:b}),t.jsx("div",{className:"ogx-toolbar__spacer"}),t.jsxs("div",{className:"ogx-toolbar__actions",children:[d&&t.jsx("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:t.jsx(Hr,{value:D,onChange:q,placeholder:"Search..."})}),g&&t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Columns",children:t.jsx("button",{ref:k,className:`ogx-toolbar__icon-btn${E?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Manage columns",onClick:()=>{C(!E),m(!1),M(!1),j(!1)},children:t.jsx(Gr,{})})}),E&&t.jsx(Ur,{anchorRef:k,columns:n,visibleColumns:J,onVisibilityChange:he,onShowAll:v,onHideAll:H,onClose:()=>{C(!1),h?.()}})]}),d&&t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Filters",children:t.jsxs("button",{ref:x,className:`ogx-toolbar__icon-btn${_?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Advanced filters",onClick:()=>{j(!_),m(!1),M(!1),C(!1)},children:[t.jsx(fo,{}),Z>0&&t.jsx("span",{className:"ogx-toolbar__dot","aria-label":"Filters active"})]})}),_&&t.jsx(Kr,{anchorRef:x,columns:n,filterModel:s||{items:[]},onFilterModelChange:d,onClose:()=>j(!1)})]}),i&&t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Pivot",children:t.jsxs("button",{ref:P,id:"ogx-pivot-btn",className:`ogx-toolbar__icon-btn${I?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Configure pivot","aria-expanded":I,"aria-controls":"ogx-pivot-panel",onClick:()=>{M(!I),m(!1),C(!1),j(!1)},children:[t.jsx(uo,{}),R&&t.jsx("span",{className:"ogx-toolbar__dot","aria-label":"Pivot active"})]})}),I&&t.jsx(zr,{anchorRef:P,columns:n,model:S,onChange:F=>{i?.(F)},onClose:()=>M(!1)})]}),t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Summaries",children:t.jsxs("button",{ref:y,id:"ogx-aggregation-btn",className:`ogx-toolbar__icon-btn${w?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Configure summaries","aria-expanded":w,"aria-controls":"ogx-aggregation-panel",onClick:()=>{m(!w),M(!1),C(!1),j(!1)},children:[t.jsx(go,{}),Y>0&&t.jsx("span",{className:"ogx-toolbar__dot","aria-label":`${Y} active summaries`})]})}),w&&t.jsx(Vr,{anchorRef:y,aggregationModel:o,aggregableColumns:B,onFunctionChange:$,onClearAll:K,onClose:()=>m(!1),activeCount:Y})]}),c]})]})}function qr(){return l.useRef(null)}const Jr=({fullWidth:n=!1,error:o=!1,startAdornment:e,endAdornment:r,className:i="",...s})=>{const d=["ogx-input-wrapper",n&&"ogx-input-wrapper--full-width",o&&"ogx-input-wrapper--error",s.disabled&&"ogx-input-wrapper--disabled",i].filter(Boolean).join(" ");return t.jsxs("div",{className:d,children:[e&&t.jsx("div",{className:"ogx-input__adornment ogx-input__adornment--start",children:e}),t.jsx("input",{className:"ogx-input",...s}),r&&t.jsx("div",{className:"ogx-input__adornment ogx-input__adornment--end",children:r})]})};function Qr(n,o,e={}){const{fileName:r="export.csv",includeHeaders:i=!0,delimiter:s=",",selectedRows:d}=e,a=d&&d.length>0?n.filter(h=>d.includes(h.id)):n;if(a.length===0){console.warn("No rows to export");return}const g=o.filter(h=>!(h.field==="__check__"||h.field==="__actions__"));let f="";if(i){const h=g.map(b=>Tt(b.headerName||b.field));f+=h.join(s)+`
|
|
9
|
-
`}if(a.forEach(
|
|
10
|
-
`}),e.aggregationResult){const
|
|
11
|
-
`;const
|
|
12
|
-
`}Mn(
|
|
13
|
-
`)?`"${n.replace(/"/g,'""')}"`:n}function Zr(n,o,e={}){const{fileName:r="export.xlsx",sheetName:i="Sheet1",includeHeaders:s=!0,selectedRows:d}=e,a=d&&d.length>0?n.filter(
|
|
6
|
+
<%s key={someKey} {...props} />`,A,U,T,U),he[U+A]=!0)}if(U=null,F!==void 0&&(e(F),U=""+F),d(H)&&(e(H.key),U=""+H.key),"key"in H){F={};for(var se in H)se!=="key"&&(F[se]=H[se])}else F=H;return U&&a(F,typeof v=="function"?v.displayName||v.name||"Unknown":v),g(v,U,F,i(),O,Q)}function b(v){u(v)?v._store&&(v._store.validated=1):typeof v=="object"&&v!==null&&v.$$typeof===x&&(v._payload.status==="fulfilled"?u(v._payload.value)&&v._payload.value._store&&(v._payload.value._store.validated=1):v._store&&(v._store.validated=1))}function u(v){return typeof v=="object"&&v!==null&&v.$$typeof===w}var h=l,w=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),_=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),R=Symbol.for("react.client.reference"),B=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,$=Array.isArray,K=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(v){return v()}};var q,D={},Z=h.react_stack_bottom_frame.bind(h,s)(),J=K(r(s)),he={};Xt.Fragment=I,Xt.jsx=function(v,H,F){var A=1e4>B.recentlyCreatedOwnerStacks++;return p(v,H,F,!1,A?Error("react-stack-top-frame"):Z,A?K(r(v)):J)},Xt.jsxs=function(v,H,F){var A=1e4>B.recentlyCreatedOwnerStacks++;return p(v,H,F,!0,A?Error("react-stack-top-frame"):Z,A?K(r(v)):J)}})()),Xt}var Qn;function Oo(){return Qn||(Qn=1,process.env.NODE_ENV==="production"?an.exports=Fo():an.exports=Wo()),an.exports}var t=Oo();function Ao({row:n,rowIndex:o,listViewColumn:e,isSelected:r=!1,checkboxSelection:i=!1,rowHeight:s,onRowClick:d,onSelectionChange:a}){const f={row:n,value:void 0,field:e.field,colDef:{field:e.field},rowIndex:o,colIndex:0},g=p=>{p.stopPropagation(),a?.(n.id,p.target.checked)};return t.jsxs("div",{className:`ogx-list-view__row${r?" ogx-list-view__row--selected":""}`,style:s?{minHeight:s}:void 0,onClick:()=>d?.(n),role:"row","aria-rowindex":o+2,"aria-selected":r,children:[i&&t.jsx("div",{className:"ogx-list-view__checkbox",onClick:p=>p.stopPropagation(),children:t.jsx("input",{type:"checkbox",checked:r,onChange:g,"aria-label":`Select row ${n.id}`})}),t.jsx("div",{className:"ogx-list-view__cell",role:"gridcell",children:e.renderCell(f)})]})}const qt=({indeterminate:n=!1,label:o,className:e="",inputRef:r,...i})=>{const s=l.useRef(null),d=l.useCallback(f=>{s.current=f,typeof r=="function"?r(f):r&&(r.current=f)},[r]);l.useEffect(()=>{s.current&&(s.current.indeterminate=n)},[n]);const a=["ogx-checkbox-wrapper",i.disabled&&"ogx-checkbox-wrapper--disabled",e].filter(Boolean).join(" ");return t.jsxs("label",{className:a,children:[t.jsx("input",{ref:d,type:"checkbox",className:"ogx-checkbox__input","aria-label":o||i["aria-label"]||(n?"Select some":i.checked?"Deselect":"Select"),...i}),t.jsxs("span",{className:"ogx-checkbox__box",children:[i.checked&&!n&&t.jsx("svg",{className:"ogx-checkbox__icon",viewBox:"0 0 24 24","aria-hidden":"true",children:t.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}),n&&t.jsx("svg",{className:"ogx-checkbox__icon",viewBox:"0 0 24 24","aria-hidden":"true",children:t.jsx("path",{d:"M19 13H5v-2h14v2z"})})]}),o&&t.jsx("span",{className:"ogx-checkbox__label",children:o})]})};function zo(n){const{field:o,currentWidth:e,onResize:r,minWidth:i=50,maxWidth:s=1e3}=n,[d,a]=l.useState(!1),f=l.useRef(0),g=l.useRef(0),p=l.useCallback(h=>{h.preventDefault(),h.stopPropagation(),a(!0),f.current=h.clientX,g.current=e;let w=0;const m=16,I=E=>{const C=E.clientX-f.current,_=Math.max(i,Math.min(s,g.current+C)),j=Date.now();j-w>=m&&(r(o,_),w=j)},M=E=>{a(!1);const C=E.clientX-f.current,_=Math.max(i,Math.min(s,g.current+C));r(o,_),document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",M)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",M)},[o,e,r,i,s]),b=l.useCallback(h=>{h.preventDefault(),h.stopPropagation()},[]),u=["ogx-column-resize-handle",d&&"ogx-column-resize-handle--dragging"].filter(Boolean).join(" ");return t.jsx("div",{className:u,onMouseDown:p,onClick:h=>h.stopPropagation(),onDragStart:h=>{h.preventDefault(),h.stopPropagation()},onDoubleClick:b,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} column`,children:t.jsx("div",{className:"ogx-column-resize-handle__line"})})}function dn(n,o){return o?o.left?.includes(n)?"left":o.right?.includes(n)?"right":null:null}function Bo(n,o){const e=[],r=[],i=[];return o?(n.forEach(s=>{const d=dn(s.field,o);d==="left"?e.push(s):d==="right"?i.push(s):r.push(s)}),o.left&&e.sort((s,d)=>{const a=o.left.indexOf(s.field),f=o.left.indexOf(d.field);return a-f}),o.right&&i.sort((s,d)=>{const a=o.right.indexOf(s.field),f=o.right.indexOf(d.field);return a-f}),{left:e,center:r,right:i}):{left:e,center:n,right:i}}function Zn(n,o,e,r,i,s,d,a){const f={};if(!e)return f;const g=Bo(n,e);let p=0;a&&(p+=48),s&&d&&(p+=48),r&&i&&(p+=48),g.left.forEach(u=>{f[u.field]=p;const h=o[u.field]??u.width??100;p+=h});let b=0;return[...g.right].reverse().forEach(u=>{const h=o[u.field]??u.width??100;f[u.field]=b,b+=h}),f}function Sn(n,o){return o?o.top?.includes(n)?"top":o.bottom?.includes(n)?"bottom":null:null}function $o(n,o){const e=[],r=[],i=[];return o?(n.forEach(s=>{const d=Sn(s.id,o);d==="top"?e.push(s):d==="bottom"?i.push(s):r.push(s)}),o.top&&e.sort((s,d)=>{const a=o.top.indexOf(s.id),f=o.top.indexOf(d.id);return a-f}),o.bottom&&i.sort((s,d)=>{const a=o.bottom.indexOf(s.id),f=o.bottom.indexOf(d.id);return a-f}),{top:e,center:r,bottom:i}):{top:e,center:n,bottom:i}}function Mt(){return t.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",children:t.jsx("circle",{cx:"4",cy:"4",r:"4"})})}function It(){return t.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:t.jsx("circle",{cx:"4",cy:"4",r:"3"})})}function Ho(){return t.jsxs("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",width:"13",height:"13",fill:"none",children:[t.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("rect",{x:"8.5",y:"4",width:"7",height:"16",fill:"currentColor",opacity:"0.3"}),t.jsx("line",{x1:"8.5",y1:"4",x2:"8.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"15.5",y1:"4",x2:"15.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"2",y1:"9",x2:"22",y2:"9",stroke:"currentColor",strokeWidth:"1.2"}),t.jsx("line",{x1:"2",y1:"14",x2:"22",y2:"14",stroke:"currentColor",strokeWidth:"1.2"})]})}function Do(){return t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),t.jsx("polyline",{points:"5 12 12 5 19 12"})]})}function Go(){return t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("polyline",{points:"19 12 12 19 5 12"})]})}function Vo(){return t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})}function Uo(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),t.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),t.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function Ko(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"4",y1:"2",x2:"4",y2:"22"}),t.jsx("polyline",{points:"11 8 4 12 11 16"}),t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function Yo(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"20",y1:"2",x2:"20",y2:"22"}),t.jsx("polyline",{points:"13 8 20 12 13 16"}),t.jsx("line",{x1:"20",y1:"12",x2:"4",y2:"12"})]})}function Xo(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"}),t.jsx("line",{x1:"4",y1:"4",x2:"4",y2:"20"}),t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function qo({colDef:n,sortModel:o,onSort:e,onHide:r,onPin:i,pinnedColumns:s,onManageColumns:d,onClose:a,anchorEl:f}){const g=l.useRef(null),[p,b]=l.useState({position:"fixed",zIndex:1300,top:0,left:0,visibility:"hidden"});l.useLayoutEffect(()=>{if(!f||!g.current)return;const j=f.getBoundingClientRect(),y=g.current.getBoundingClientRect(),P=window.innerWidth,k=window.innerHeight,x=8;let S=j.left;S+y.width+x>P&&(S=P-y.width-x),S<x&&(S=x);let R=j.bottom+4;R+y.height+x>k&&(R=j.top-y.height-4),b({position:"fixed",zIndex:1300,top:R,left:S,visibility:"visible"})},[f]),l.useEffect(()=>{function j(P){g.current&&!g.current.contains(P.target)&&f&&!f.contains(P.target)&&a()}function y(P){P.key==="Escape"&&a()}return document.addEventListener("mousedown",j),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",y)}},[f,a]);const u=j=>{e?.(n.field,j),a()},h=()=>{r?.(n.field),a()},w=j=>{i?.(n.field,j),a()},m=o?.find(j=>j.field===n.field)?.sort,I=m==null,M=s?.left?.includes(n.field)??!1,E=s?.right?.includes(n.field)??!1,C=!M&&!E,_=n.headerName||n.field;return kt.createPortal(t.jsxs("div",{ref:g,className:"ogx-column-menu",style:p,role:"menu","aria-label":`Column options for ${_}`,children:[e&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{className:`ogx-menu-item${m==="asc"?" ogx-menu-item--active":""}`,onClick:()=>u("asc"),role:"menuitemradio","aria-checked":m==="asc",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:m==="asc"?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Do,{})}),"Sort Ascending"]}),t.jsxs("button",{className:`ogx-menu-item${m==="desc"?" ogx-menu-item--active":""}`,onClick:()=>u("desc"),role:"menuitemradio","aria-checked":m==="desc",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:m==="desc"?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Go,{})}),"Sort Descending"]}),t.jsxs("button",{className:`ogx-menu-item${I?" ogx-menu-item--active":""}`,onClick:()=>u(null),role:"menuitemradio","aria-checked":I,children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:I?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Vo,{})}),"Unsort"]}),t.jsx("div",{className:"ogx-menu-divider"})]}),t.jsx("div",{className:"ogx-menu-section-label","aria-hidden":"true",children:"Pin column"}),t.jsxs("button",{className:`ogx-menu-item${M?" ogx-menu-item--active":""}`,onClick:()=>w("left"),role:"menuitemradio","aria-checked":M,"aria-label":"Pin to left",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:M?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Ko,{})}),"Pin to Left"]}),t.jsxs("button",{className:`ogx-menu-item${E?" ogx-menu-item--active":""}`,onClick:()=>w("right"),role:"menuitemradio","aria-checked":E,"aria-label":"Pin to right",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:E?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Yo,{})}),"Pin to Right"]}),t.jsxs("button",{className:`ogx-menu-item${C?" ogx-menu-item--active":""}`,onClick:()=>w(null),role:"menuitemradio","aria-checked":C,"aria-label":"Unpin column",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true",children:C?t.jsx(Mt,{}):t.jsx(It,{})}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Xo,{})}),"Unpin"]}),t.jsx("div",{className:"ogx-menu-divider"}),t.jsxs("button",{className:"ogx-menu-item",onClick:h,role:"menuitem","aria-label":`Hide ${_} column`,children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true"}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Uo,{})}),"Hide Column"]}),t.jsx("div",{className:"ogx-menu-divider"}),t.jsxs("button",{className:"ogx-menu-item",onClick:()=>{d?.(),a()},role:"menuitem","aria-label":"Manage all columns",children:[t.jsx("span",{className:"ogx-menu-item__indicator","aria-hidden":"true"}),t.jsx("span",{className:"ogx-menu-item__icon","aria-hidden":"true",children:t.jsx(Ho,{})}),"Manage columns"]})]}),document.body)}function Jo(){return t.jsx("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18",children:t.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})})}function Qo(){return t.jsx("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",width:"18",height:"18",fill:"currentColor",children:t.jsx("path",{d:"M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"})})}function eo(n){const o=[];for(const e of n.children)typeof e=="string"?o.push(e):o.push(...eo(e));return o}function Zo(n){let o=0;function e(r,i){o=Math.max(o,i);for(const s of r.children)typeof s!="string"&&e(s,i+1)}return n.forEach(r=>e(r,1)),o}function er(n,o,e){function r(a,f,g){if(!eo(a).includes(f))return null;if(g===e)return a;for(const p of a.children)if(typeof p!="string"){const b=r(p,f,g+1);if(b)return b}return null}const i=new Map;for(const a of o){let f=null;for(const g of n)if(f=r(g,a.field,0),f)break;i.set(a.field,f)}const s=[];let d=0;for(;d<o.length;){const a=o[d],f=i.get(a.field)??null,g=a.width;if(!f)s.push({key:`fg-${a.field}-${e}`,label:"",width:g,isGroup:!1}),d++;else{let p=0,b=d;for(;b<o.length&&i.get(o[b].field)===f;)p+=o[b].width,b++;s.push({key:`${f.groupId}-${e}`,label:f.headerName,width:p,isGroup:!0}),d=b}}return s}function to(n){const{columns:o,allColumns:e,columnGroupingModel:r,checkboxSelection:i=!1,allSelected:s=!1,someSelected:d=!1,onSelectAll:a,onSort:f,sortModel:g=[],onColumnResize:p,columnWidths:b={},pinnedColumns:u,hasDetailPanel:h=!1,pinCheckboxColumn:w=!0,pinExpandColumn:m=!0,rowReordering:I=!1,aggregationModel:M,draggedColumn:E,dragOverColumn:C,onDragStart:_,onDragOver:j,onDragEnd:y,onDrop:P,focusedCell:k,onHeaderClick:x,onHideColumn:S,onPinColumn:R,onManageColumns:B}=n,Y=l.useRef({}),[$,K]=l.useState(null),q=T=>se=>{se.stopPropagation(),K({colDef:T,anchorEl:se.currentTarget})},D=()=>{K(null)};l.useLayoutEffect(()=>{if(k?.id==="HEADER"){const T=Y.current[k.field];T&&T.focus()}},[k]);const Z=T=>()=>{if(T.sortable===!1||!f)return;const se=g.find(xe=>xe.field===T.field);let ne="asc";se&&(se.sort==="asc"?ne="desc":ne=null),f(T.field,ne)},J=T=>{const se=g.find(ne=>ne.field===T);return se?t.jsx("span",{className:`ogx__sort-icon ogx__sort-icon--${se.sort}`,"aria-hidden":"true"}):null},he=l.useMemo(()=>Zn(o,b,u,i,w,h,m,I),[o,b,u,i,w,h,m,I]),v=r?Zo(r):0,F=(e??o).filter(T=>!T.isSpacer).map(T=>({field:T.field,width:b[T.field]??T.width??100})),U=(I?48:0)+(h?48:0)+(i?48:0);return t.jsxs("div",{className:"ogx__header-wrap",children:[v>0&&Array.from({length:v},(T,se)=>{const ne=er(r,F,se);return t.jsxs("div",{className:"ogx-col-group-row",role:"row",children:[U>0&&t.jsx("div",{className:"ogx-col-group-cell ogx-col-group-cell--filler",style:{width:U,minWidth:U,flexShrink:0},role:"columnheader"}),ne.map(xe=>t.jsx("div",{role:"columnheader",className:`ogx-col-group-cell ${xe.isGroup?"ogx-col-group-cell--group":"ogx-col-group-cell--filler"}`,style:{width:xe.width,minWidth:xe.width,flexShrink:0},title:xe.isGroup?xe.label:void 0,children:xe.isGroup&&t.jsx("span",{className:"ogx-col-group-cell__label",children:xe.label})},xe.key))]},`ogx-grp-${se}`)}),t.jsxs("div",{className:"ogx__header",role:"row",children:[I&&t.jsx("div",{className:"ogx__header-cell ogx__header-cell--pinned ogx__header-cell--pinned-left",role:"columnheader","aria-label":"Row reorder handle",title:"Drag to reorder rows",style:{minWidth:48,maxWidth:48,position:"sticky",left:0,zIndex:4}}),h&&t.jsx("div",{className:`ogx__header-cell ogx__header-cell--expand ${m?"ogx__header-cell--pinned ogx__header-cell--pinned-left":""}`,role:"columnheader","aria-label":"Expand row details",style:{minWidth:48,maxWidth:48,position:m?"sticky":void 0,left:m?I?48:0:void 0,zIndex:m?5:void 0}}),i&&t.jsx("div",{className:`ogx__header-cell ogx__header-cell--checkbox ${w?"ogx__header-cell--pinned ogx__header-cell--pinned-left":""}`,role:"columnheader",style:{position:w?"sticky":void 0,left:w?(I?48:0)+(h&&m?48:0):void 0},children:t.jsx(qt,{id:"ogx-select-all",name:"ogx-select-all",checked:s,indeterminate:d,onChange:T=>a?.(T.target.checked),"aria-label":s?"Deselect all rows":"Select all rows",tabIndex:k?.id==="HEADER"&&k.field==="__checkbox_col__"?0:-1,onMouseDown:T=>T.preventDefault(),inputRef:T=>{Y.current.__checkbox_col__=T}})}),o.map((T,se)=>{if(T.isSpacer)return t.jsx("div",{style:{width:T.width,minWidth:T.width,flexShrink:0},"aria-hidden":"true"},T.field);const ne=T.sortable!==!1,xe=g.some(We=>We.field===T.field),Qe=T.resizable!==!1,z=dn(T.field,u),Se=z!==null,je=E===T.field,ct=C===T.field,Be=["ogx__header-cell",`ogx__header-cell--align-${T.headerAlign||T.align||"left"}`,ne&&"ogx__header-cell--sortable",xe&&"ogx__header-cell--sorted",Se&&"ogx__header-cell--pinned",Se&&`ogx__header-cell--pinned-${z}`,je&&"ogx__header-cell--dragging",ct&&"ogx__header-cell--drag-over",k?.id==="HEADER"&&k.field===T.field&&"ogx__header-cell--focused",T.headerClassName].filter(Boolean).join(" "),ut=b[T.field]??T.width??100,gt={width:ut,minWidth:T.minWidth,maxWidth:T.maxWidth,flexGrow:T.flex??0,flexShrink:0,flexBasis:(T.flex,"auto"),boxSizing:"border-box",position:Se?"sticky":"relative",zIndex:T.zIndex,opacity:je?.5:1};if(Se&&z){const We=he[T.field];z==="left"?gt.left=We:gt.right=We}const en=T.renderHeader?T.renderHeader({field:T.field,colDef:T,colIndex:se}):T.headerName||T.field,Lt=We=>{if(We.target.closest(".ogx-column-resize-handle")){We.stopPropagation();return}x?.(T.field),ne&&Z(T)()},St=_?_(T.field):void 0,Rt=j?j(T.field):void 0,vt=P?P(T.field):void 0;return t.jsxs("div",{className:Be,style:gt,onClick:Lt,role:"columnheader",draggable:!!_,onDragStart:St,onDragOver:Rt,onDragEnd:y,onDrop:vt,"aria-sort":ne?xe?g.find(We=>We.field===T.field)?.sort==="asc"?"ascending":"descending":"none":void 0,"aria-colindex":se+1+(i?1:0),"data-field":T.field,tabIndex:-1,ref:We=>{Y.current[T.field]=We},children:[t.jsxs("div",{className:"ogx__header-cell-content",children:[je&&t.jsx("div",{className:"ogx__header-drag-icon",children:t.jsx(Qo,{})}),t.jsxs("div",{className:"ogx__header-cell-title-wrapper",children:[t.jsx("span",{className:"ogx__header-cell-title",children:en}),M&&M[T.field]&&t.jsx("span",{className:"ogx__header-cell-aggregation",children:M[T.field]})]}),ne&&J(T.field),!T.disableColumnMenu&&t.jsx("button",{className:"ogx__menu-icon-btn",onClick:q(T),"aria-label":`Open column menu for ${T.headerName||T.field}`,"aria-haspopup":"menu",tabIndex:-1,children:t.jsx(Jo,{})})]}),Qe&&p&&t.jsx(zo,{field:T.field,currentWidth:ut,onResize:p,minWidth:T.minWidth,maxWidth:T.maxWidth})]},T.field)}),$&&t.jsx(qo,{colDef:$.colDef,sortModel:g,onSort:f,onHide:S,onPin:R,pinnedColumns:u,onManageColumns:B,onClose:D,anchorEl:$.anchorEl})]})]})}function tr({value:n,onValueChange:o,onCommit:e,onCancel:r}){const[i,s]=l.useState(String(n??"")),d=l.useRef(null);return l.useEffect(()=>{d.current?.focus(),d.current?.select()},[]),t.jsx("input",{ref:d,type:"text",className:"ogx__edit-input",value:i,onChange:a=>{s(a.target.value),o(a.target.value)},onBlur:e,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),e()),a.key==="Escape"&&(a.stopPropagation(),r())}})}function nr({value:n,onValueChange:o,onCommit:e,onCancel:r}){const[i,s]=l.useState(n??""),d=l.useRef(null);return l.useEffect(()=>{d.current?.focus(),d.current?.select()},[]),t.jsx("input",{ref:d,type:"number",className:"ogx__edit-input ogx__edit-input--number",value:i,onChange:a=>{const f=a.target.value===""?"":Number(a.target.value);s(f),o(f===""?null:f)},onBlur:e,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),e()),a.key==="Escape"&&(a.stopPropagation(),r())}})}function or({value:n,onValueChange:o,onCommit:e,onCancel:r}){const i=l.useRef(null);l.useEffect(()=>{i.current?.focus()},[]);const s=()=>{o(!n),setTimeout(e,0)};return t.jsx("div",{className:"ogx__edit-boolean",children:t.jsx("input",{ref:i,type:"checkbox",className:"ogx__edit-checkbox",checked:!!n,onChange:s,onKeyDown:d=>{d.key==="Escape"&&(d.stopPropagation(),r())}})})}function rr({value:n,colDef:o,onValueChange:e,onCommit:r,onCancel:i}){const s=l.useRef(null);l.useEffect(()=>{s.current?.focus()},[]);const d=o.valueOptions??[];return t.jsx("select",{ref:s,className:"ogx__edit-select",value:n??"",onChange:a=>{e(a.target.value)},onBlur:r,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),r()),a.key==="Escape"&&(a.stopPropagation(),i())},children:d.map(a=>{const f=typeof a=="object"?a.value:a,g=typeof a=="object"?a.label:String(a);return t.jsx("option",{value:String(f),children:g},String(f))})})}function ir({value:n,onValueChange:o,onCommit:e,onCancel:r}){const[i,s]=l.useState(n??""),d=l.useRef(null);return l.useEffect(()=>{d.current?.focus()},[]),t.jsx("input",{ref:d,type:"date",className:"ogx__edit-input",value:i,onChange:a=>{s(a.target.value),o(a.target.value)},onBlur:e,onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),e()),a.key==="Escape"&&(a.stopPropagation(),r())}})}function lr(n){const{colDef:o}=n;switch(o.type){case"number":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(nr,{...n})});case"boolean":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(or,{...n})});case"singleSelect":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(rr,{...n})});case"date":return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(ir,{...n})});default:return t.jsx("div",{className:"ogx__edit-cell",children:t.jsx(tr,{...n})})}}function sr(n){const{onCellClick:o,onCellEditStart:e,onCellValueChange:r,value:i,row:s,colDef:d,rowIndex:a,colIndex:f,isSelected:g,onClick:p,width:b,pinnedPosition:u,pinnedOffset:h,isFocused:w,isFocusVisible:m,isEditable:I,isEditing:M,onEditStart:E,onEditStop:C,onValueChange:_,colSpanInfo:j,rowSpan:y,isHiddenByRowSpan:P}=n;if(j?.spannedByColSpan)return null;if(P)return t.jsx("div",{className:"ogx__cell ogx__cell--hidden",style:{width:b??d.width??100},role:"presentation","data-field":d.field,"data-colindex":f});const k=v=>{o&&(v.stopPropagation(),o({row:s,field:d.field,value:i,colDef:d,rowIndex:a,colIndex:f})),p?.(v)},x=l.useCallback(v=>{r?r(d.field,v):_?.(v)},[r,_,d.field]),S=v=>{I&&(E||e)&&(v.stopPropagation(),e?e(d.field,i):E?.())},R=l.useMemo(()=>d.valueFormatter?d.valueFormatter({value:i,row:s,field:d.field}):i==null?"":String(i),[i,s,d]),B=l.useMemo(()=>M&&(r||_)&&C?d.renderEditCell?d.renderEditCell({value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:f}):t.jsx(lr,{value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:f,onValueChange:x,onCommit:()=>C(),onCancel:()=>C(!0)}):d.renderCell?d.renderCell({value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:f}):R,[i,s,d,a,f,R,M,x,C,r,_]),Y=u!=null,$=l.useMemo(()=>d.cellClassName?typeof d.cellClassName=="function"?d.cellClassName({value:i,row:s,field:d.field,colDef:d,rowIndex:a,colIndex:f})||"":d.cellClassName:"",[d,i,s,a,f]),K=["ogx__cell",`ogx__cell--align-${d.align||"left"}`,g&&"ogx__cell--selected",w&&"ogx__cell--focused",w&&m&&"ogx__cell--focus-visible",d.type&&`ogx__cell--type-${d.type}`,Y&&"ogx__cell--pinned",Y&&`ogx__cell--pinned-${u}`,M&&"ogx__cell--editing",y&&y>1&&"ogx__cell--spanned",$].filter(Boolean).join(" "),q=j?.cellProps?.colSpan||1,D=y||1,Z=j?.cellProps?.width??b??d.width??100,J={width:"var(--width)","--width":typeof Z=="number"?`${Z}px`:Z,flexGrow:d.flex??0,flexShrink:0,flexBasis:(d.flex,"auto"),boxSizing:"border-box",minWidth:d.minWidth,maxWidth:d.maxWidth,position:Y?"sticky":void 0,zIndex:d.zIndex??(Y?3:void 0),padding:M?0:void 0};D>1&&(J.height=`calc(var(--height) * ${D} - var(--border-width, 1px))`,J.zIndex=10,Y&&(J.zIndex=40)),Y&&h!==void 0&&(u==="left"?J.left=h:J.right=h);const he=l.useRef(null);return l.useLayoutEffect(()=>{w&&he.current&&he.current.focus({preventScroll:!0})},[w]),t.jsx("div",{ref:he,className:K,style:J,onClick:k,onDoubleClick:S,role:"gridcell","aria-colindex":f+1,"aria-readonly":!I||void 0,tabIndex:-1,"data-field":d.field,"data-colindex":f,...q>1?{"aria-colspan":q}:{},...D>1?{"aria-rowspan":D}:{},children:t.jsx("div",{className:"ogx__cell-content",children:B})})}const no=l.memo(sr);function oo({isExpanded:n,onClick:o,variant:e="chevron"}){return t.jsx("button",{className:`ogx-expand-icon ${n?"ogx-expand-icon--expanded":""}`,onClick:r=>{o&&o(r)},"aria-label":n?"Collapse row":"Expand row",type:"button",children:e==="plus-minus"?t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M4 8H12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M8 4V12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:n?0:1,transition:"opacity 0.2s ease",transformOrigin:"center"}})]}):t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:n?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"},children:t.jsx("path",{d:"M6 4L10 8L6 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}const ar=({className:n="",...o})=>t.jsx("button",{type:"button",className:`ogx-drag-handle ${n}`,"aria-label":"Drag to reorder row",...o,children:t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})})});function dr(n){const{content:o,height:e,isExpanded:r}=n;if(!r)return null;const i={height:e==="auto"?"auto":`${e}px`,overflow:e==="auto"?"visible":"auto"};return t.jsx("div",{className:"ogx__detail-panel",style:i,children:t.jsx("div",{className:"ogx__detail-panel-content",children:o})})}function Jt(n){const{row:o,columns:e,rowIndex:r,isSelected:i=!1,checkboxSelection:s=!1,onRowClick:d,onCellClick:a,onSelectionChange:f,columnWidths:g={},pinnedColumns:p,pinnedRows:b,hasDetailPanel:u=!1,isDetailPanelExpanded:h=!1,onDetailPanelToggle:w,detailPanelContent:m,detailPanelHeight:I=200,pinCheckboxColumn:M=!0,pinExpandColumn:E=!0,rowReordering:C=!1,onDragStart:_,onDragOver:j,onDragEnd:y,onDrop:P,isDragging:k,isDragOver:x,editingCell:S,onEditStart:R,onEditStop:B,onEditCellValueChange:Y,focusedCellField:$,isFocusVisible:K,colspanMap:q,rowSpanningCaches:D,rowHeight:Z=52}=n,J=l.useRef(null),he=l.useRef(null);if(o._isSkeleton){const z=Math.max(e.length,5);return t.jsx("div",{className:"ogx__row ogx__row--skeleton",role:"row","aria-hidden":"true",style:{height:Z,minHeight:Z},children:Array.from({length:z}).map((Se,je)=>t.jsx("div",{className:"ogx__skeleton-cell",children:t.jsx("div",{className:"ogx__skeleton-bar"})},je))})}l.useLayoutEffect(()=>{$==="__expand_col__"&&J.current&&J.current.focus({preventScroll:!0}),$==="__checkbox_col__"&&he.current&&he.current.focus({preventScroll:!0})},[$]);const v=z=>{z.target.closest(".ogx-checkbox-wrapper, .ogx-expand-icon, .ogx-drag-handle, .ogx__edit-cell")||d?.({row:o,id:o.id,rowIndex:r})},H=z=>{z.stopPropagation(),f?.(o.id,z.target.checked)},F=z=>{z.stopPropagation(),w?.(o.id)},A=l.useMemo(()=>Zn(e,g,p,s,M,u,E,C),[e,g,p,s,M,u,E,C]),O=Sn(o.id,b),Q=O==="top",U=O==="bottom",T=o._hasChildren===!0,se=l.useCallback((z,Se)=>{T||R?.({id:o.id,field:z,value:Se})},[T,o.id,R]),ne=l.useCallback((z,Se)=>{Y?.({id:o.id,field:z,value:Se})},[Y,o.id]),xe=l.useCallback(z=>{B?.({cancel:z})},[B]),Qe=["ogx__row",i&&"ogx__row--selected",r%2===0&&"ogx__row--even",r%2===1&&"ogx__row--odd",Q&&"ogx__row--pinned-top",U&&"ogx__row--pinned-bottom",k&&"ogx__row--dragging",x&&"ogx__row--drag-over",T&&"ogx__row--group"].filter(Boolean).join(" ");return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:Qe,onClick:v,role:"row","aria-rowindex":r+1,"aria-selected":i,"data-rowindex":r,onDragOver:j?j(o.id):void 0,onDrop:P?P(o.id):void 0,style:{maxHeight:`${Z}px`,minHeight:`${Z}px`,"--height":`${Z}px`,"--border-width":"1px"},children:[C&&t.jsx("div",{className:"ogx__cell ogx__cell--drag-handle",role:"gridcell","aria-label":"Drag to reorder row",style:{position:"sticky",left:0,zIndex:4},draggable:!0,onDragStart:_?_(o.id):void 0,onDragEnd:y,onClick:z=>z.stopPropagation(),children:t.jsx(ar,{})}),u&&t.jsx("div",{className:`ogx__cell ogx__cell--expand ${E?"ogx__cell--pinned-left":""} ${$==="__expand_col__"?"ogx__cell--focused":""} ${$==="__expand_col__"&&K?"ogx__cell--focus-visible":""}`,role:"gridcell","aria-label":h?"Collapse row details":"Expand row details","aria-expanded":h,style:{position:E?"sticky":void 0,left:E?C?48:0:void 0,zIndex:E?5:void 0},ref:J,tabIndex:-1,onClick:z=>{z.stopPropagation(),a?.({row:o,field:"__expand_col__",value:h,colDef:{field:"__expand_col__",width:48},rowIndex:r,colIndex:-1})},children:t.jsx(oo,{isExpanded:h,onClick:F,variant:"plus-minus"})}),s&&t.jsx("div",{className:`ogx__cell ogx__cell--checkbox ${M?"ogx__cell--pinned-left":""} ${$==="__checkbox_col__"?"ogx__cell--focused":""} ${$==="__checkbox_col__"&&K?"ogx__cell--focus-visible":""}`,role:"gridcell",style:{position:M?"sticky":void 0,left:M?(C?48:0)+(u&&E?48:0):void 0,zIndex:M?11:void 0},ref:he,tabIndex:-1,onClick:z=>{z.stopPropagation(),a?.({row:o,field:"__checkbox_col__",value:i,colDef:{field:"__checkbox_col__",width:48},rowIndex:r,colIndex:-1})},children:t.jsx(qt,{id:`ogx-select-row-${o.id}`,name:`ogx-select-row-${o.id}`,checked:i,onChange:H,onClick:z=>z.stopPropagation(),"aria-label":i?`Deselect row ${o.id}`:`Select row ${o.id}`,tabIndex:-1,onMouseDown:z=>z.preventDefault()})}),e.map((z,Se)=>{if(z.isSpacer)return t.jsx("div",{style:{width:z.width,minWidth:z.width,flexShrink:0},"aria-hidden":"true"},z.field);const je=z.valueGetter?z.valueGetter({row:o,field:z.field,value:o[z.field]}):o[z.field],ct=g[z.field]??z.width,Be=dn(z.field,p),ut=Be?A[z.field]:void 0,gt=S?.id===o.id&&S?.field===z.field,en=gt?S?.value:je,Lt=q?.get(o.id)?.[z.field],St=D?.spannedCells[o.id]?.[z.field],Rt=D?.hiddenCells[o.id]?.[z.field]||!1;return t.jsx(no,{value:en,row:o,colDef:z,rowIndex:r,colIndex:Se,isSelected:i,onCellClick:a,width:ct,pinnedPosition:Be,pinnedOffset:ut,isFocused:$===z.field,isFocusVisible:K,isEditable:z.editable,isEditing:gt,onCellEditStart:se,onEditStop:xe,onCellValueChange:ne,colSpanInfo:Lt,rowSpan:St,isHiddenByRowSpan:Rt},z.field)})]}),u&&t.jsx(dr,{row:o,rowId:o.id,rowIndex:r,content:m,height:I,isExpanded:h})]})}const cr=({columns:n,rowHeight:o,checkboxSelection:e=!1,hasDetailPanel:r=!1,rowReordering:i=!1})=>t.jsxs("div",{className:"ogx__row ogx__skeleton-row",style:{height:o},role:"row",children:[e&&t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:48,minWidth:48},children:t.jsx("div",{className:"ogx-skeleton-box",style:{width:18,height:18,borderRadius:2}})}),r&&t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:48,minWidth:48},children:t.jsx("div",{className:"ogx-skeleton-box",style:{width:18,height:18,borderRadius:2}})}),i&&t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:48,minWidth:48},children:t.jsx("div",{className:"ogx-skeleton-box",style:{width:18,height:18,borderRadius:2}})}),n.map((s,d)=>{const a=s.width||150,f=Math.min(a*.7,a-20);return t.jsx("div",{className:"ogx__cell ogx__skeleton-cell",style:{width:a,minWidth:s.minWidth,maxWidth:s.maxWidth,left:s.left,right:s.right,position:s.isSpacer?"relative":s.pinned?"sticky":"relative",zIndex:s.zIndex},children:!s.isSpacer&&t.jsx("div",{className:"ogx-skeleton-box",style:{width:f,height:16,borderRadius:4}})},s.field||d)})]}),Qt=({variant:n="text",size:o="medium",color:e="default",disabled:r=!1,className:i="",children:s,...d})=>{const a=["ogx-button",`ogx-button--${n}`,`ogx-button--${o}`,`ogx-button--${e}`,r&&"ogx-button--disabled",i].filter(Boolean).join(" ");return t.jsx("button",{className:a,disabled:r,...d,children:s})};function ro(n){const{page:o,pageSize:e,rowCount:r,onPageChange:i,onPageSizeChange:s,pageSizeOptions:d=[10,25,50,100],showFirstButton:a=!0,showLastButton:f=!0}=n,g=Math.max(1,Math.ceil(r/e)),p=Math.min(o,g-1),b=p*e,u=Math.min(b+e,r),h=r===0?0:`${b+1}–${u}`,w=()=>{i(0)},m=()=>{i(Math.max(0,p-1))},I=()=>{i(Math.min(g-1,p+1))},M=()=>{i(g-1)},E=j=>{const y=parseInt(j.target.value,10);s(y)},C=p===0,_=p>=g-1;return t.jsxs("div",{className:"ogx-pagination",role:"navigation","aria-label":"Pagination",children:[t.jsxs("div",{className:"ogx-pagination__page-size",children:[t.jsx("label",{htmlFor:"page-size-select",className:"ogx-pagination__label",children:"Rows per page:"}),t.jsx("select",{id:"page-size-select",className:"ogx-pagination__select",value:e,onChange:E,"aria-label":"Rows per page",children:d.map(j=>t.jsx("option",{value:j,children:j},j))})]}),t.jsxs("div",{className:"ogx-pagination__info","aria-live":"polite","aria-atomic":"true",children:[h," of ",r]}),t.jsxs("div",{className:"ogx-pagination__actions",children:[a&&t.jsx(Qt,{variant:"text",size:"small",onClick:w,disabled:C,"aria-label":"Go to first page",title:"First page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})})}),t.jsx(Qt,{variant:"text",size:"small",onClick:m,disabled:C,"aria-label":"Go to previous page",title:"Previous page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),t.jsxs("div",{className:"ogx-pagination__page-info","aria-current":"page",children:["Page ",p+1," of ",g]}),t.jsx(Qt,{variant:"text",size:"small",onClick:I,disabled:_,"aria-label":"Go to next page",title:"Next page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})}),f&&t.jsx(Qt,{variant:"text",size:"small",onClick:M,disabled:_,"aria-label":"Go to last page",title:"Last page",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})})})]})]})}function ur(n,o,e={}){const r=new Map,i=[];n.forEach(a=>{const f=a.id;r.set(f,a),i.push(f)});const s=new Map,d=[];return o.forEach(a=>{s.set(a.field,a),d.push(a.field)}),{rows:{idRowsLookup:r,allRows:i},columns:{all:o,lookup:s,orderedFields:d,columnVisibilityModel:e},sorting:{sortModel:[]},filter:{filterModel:{items:[]}},pagination:{paginationModel:{page:0,pageSize:100},rowCount:n.length},selection:{selectedRows:new Set},pinning:{pinnedColumns:{},pinnedRows:{}},virtualization:{renderContext:{firstRowIndex:0,lastRowIndex:0,firstColumnIndex:0,lastColumnIndex:0},scrollTop:0,scrollLeft:0},dimensions:{rowHeight:52,headerHeight:56,viewportWidth:0,viewportHeight:0},dataSource:{loading:!1,error:null}}}function gr(n,o){switch(o.type){case"SET_ROWS":{const e=Array.from(n.rows.idRowsLookup.values()),r=typeof o.payload=="function"?o.payload(e):o.payload,i=new Map,s=[];return r.forEach(d=>{i.set(d.id,d),s.push(d.id)}),{...n,rows:{idRowsLookup:i,allRows:s},pagination:{...n.pagination,rowCount:o.preserveRowCount?n.pagination.rowCount:r.length}}}case"SET_COLUMNS":{const e=new Map,r=[];return o.payload.forEach(i=>{e.set(i.field,i),r.push(i.field)}),{...n,columns:{all:o.payload,lookup:e,orderedFields:r,columnVisibilityModel:{}}}}case"SET_SORT_MODEL":return{...n,sorting:{sortModel:o.payload}};case"SET_FILTER_MODEL":return{...n,filter:{filterModel:o.payload}};case"SET_PAGINATION_MODEL":return{...n,pagination:{...n.pagination,paginationModel:o.payload}};case"SET_SELECTION":return{...n,selection:{selectedRows:o.payload}};case"SET_SCROLL":return{...n,virtualization:{...n.virtualization,scrollTop:o.payload.scrollTop,scrollLeft:o.payload.scrollLeft}};case"SET_DIMENSIONS":return{...n,dimensions:{...n.dimensions,viewportWidth:o.payload.viewportWidth,viewportHeight:o.payload.viewportHeight}};case"SET_DATASOURCE_LOADING":return{...n,dataSource:{...n.dataSource,loading:o.payload}};case"SET_DATASOURCE_ERROR":return{...n,dataSource:{...n.dataSource,error:o.payload}};case"SET_ROW_COUNT":return{...n,pagination:{...n.pagination,rowCount:o.payload}};default:return n}}function fr(n){const{rows:o,columns:e,rowHeight:r=52,headerHeight:i=56,columnVisibilityModel:s,initialState:d}=n,a=l.useMemo(()=>ur(o,e,s),[]),[f,g]=l.useReducer(gr,{...a,sorting:d?.sorting||a.sorting,filter:d?.filter||a.filter,dataSource:d?.dataSource?{...a.dataSource,...d.dataSource}:a.dataSource,pagination:{...a.pagination,...d?.pagination||{},rowCount:n.rowCount??d?.pagination?.rowCount??a.pagination.rowCount},dimensions:{...a.dimensions,rowHeight:r,headerHeight:i}}),p=l.useRef(f);p.current=f;const b=l.useRef(o);l.useEffect(()=>{o!==b.current&&(b.current=o,g({type:"SET_ROWS",payload:o}))},[o]);const u=l.useCallback((k,x)=>{g({type:"SET_ROWS",payload:k,preserveRowCount:x})},[]),h=l.useCallback(k=>{g({type:"SET_COLUMNS",payload:k})},[]),w=l.useCallback(k=>{g({type:"SET_SORT_MODEL",payload:k})},[]),m=l.useCallback(k=>{g({type:"SET_FILTER_MODEL",payload:k})},[]),I=l.useCallback(k=>{g({type:"SET_PAGINATION_MODEL",payload:k})},[]),M=l.useCallback(k=>{g({type:"SET_SELECTION",payload:k})},[]),E=l.useCallback((k,x)=>{g({type:"SET_SCROLL",payload:{scrollTop:k,scrollLeft:x}})},[]),C=l.useCallback((k,x)=>{g({type:"SET_DIMENSIONS",payload:{viewportWidth:k,viewportHeight:x}})},[]),_=l.useCallback(k=>{g({type:"SET_DATASOURCE_LOADING",payload:k})},[]),j=l.useCallback(k=>{g({type:"SET_DATASOURCE_ERROR",payload:k})},[]),y=l.useCallback(k=>{g({type:"SET_ROW_COUNT",payload:k})},[]),P=l.useRef({getRow:k=>p.current.rows.idRowsLookup.get(k)||null,getAllRows:()=>Array.from(p.current.rows.idRowsLookup.values()),getVisibleRows:()=>Array.from(p.current.rows.idRowsLookup.values()),getAggregationResult:()=>null,getAggregationModel:()=>null,getColumn:k=>p.current.columns.lookup.get(k)||null,getAllColumns:()=>p.current.columns.all,getVisibleColumns:()=>p.current.columns.all,selectRow:(k,x=!0)=>{const S=new Set(p.current.selection.selectedRows);x?S.add(k):S.delete(k),M(S)},selectRows:(k,x=!0)=>{const S=new Set(p.current.selection.selectedRows);k.forEach(R=>{x?S.add(R):S.delete(R)}),M(S)},getSelectedRows:()=>Array.from(p.current.selection.selectedRows),sortColumn:(k,x)=>{if(x===null)w(p.current.sorting.sortModel.filter(S=>S.field!==k));else{const S=p.current.sorting.sortModel.findIndex(R=>R.field===k);if(S>=0){const R=[...p.current.sorting.sortModel];R[S]={field:k,sort:x},w(R)}else w([...p.current.sorting.sortModel,{field:k,sort:x}])}},getSortModel:()=>p.current.sorting.sortModel,setFilterModel:m,getFilterModel:()=>p.current.filter.filterModel,setPage:k=>{I({...p.current.pagination.paginationModel,page:k})},setPageSize:k=>{I({...p.current.pagination.paginationModel,pageSize:k,page:0})},scrollToIndexes:()=>{},copySelectedRows:()=>Promise.resolve()});return{state:f,dispatch:g,apiRef:P,setRows:u,setColumns:h,setSortModel:w,setFilterModel:m,setPaginationModel:I,setSelection:M,setScroll:E,setDimensions:C,setDataSourceLoading:_,setDataSourceError:j,setRowCount:y}}function hr(n){const{columns:o,onColumnOrderChange:e,disableColumnReorder:r=!1}=n,[i,s]=l.useState(null),[d,a]=l.useState(null),f=l.useRef(-1),g=l.useCallback(h=>w=>{if(r)return;const m=o.findIndex(M=>M.field===h);if(o[m]?.pinnable===!1){w.preventDefault();return}s(h),f.current=m,w.dataTransfer&&(w.dataTransfer.effectAllowed="move",w.dataTransfer.setData("text/plain",h))},[o,r]),p=l.useCallback(h=>w=>{r||!i||(w.preventDefault(),w.dataTransfer.dropEffect="move",a(h))},[i,r]),b=l.useCallback(h=>w=>{if(w.preventDefault(),r||!i||i===h){s(null),a(null);return}const m=o.findIndex(E=>E.field===i),I=o.findIndex(E=>E.field===h);if(m===-1||I===-1){s(null),a(null);return}const M=o[m];e&&e({column:M,oldIndex:m,targetIndex:I}),s(null),a(null),f.current=-1},[o,i,r,e]),u=l.useCallback(()=>{s(null),a(null),f.current=-1},[]);return{draggedColumn:i,dragOverColumn:d,onDragStart:r?void 0:g,onDragOver:r?void 0:p,onDragEnd:r?void 0:u,onDrop:r?void 0:b}}function pr(n){const{onRowOrderChange:o,rows:e,getRowId:r,rowReordering:i=!1}=n,[s,d]=l.useState(null),[a,f]=l.useState(null),g=l.useCallback(w=>r?r(w):w.id,[r]),p=l.useCallback(w=>m=>{i&&(d(w),m.dataTransfer.effectAllowed="move")},[i]),b=l.useCallback(w=>m=>{!i||!s||(m.preventDefault(),m.dataTransfer.dropEffect="move",a!==w&&f(w))},[i,s,a]),u=l.useCallback(()=>{d(null),f(null)},[]),h=l.useCallback(w=>m=>{if(m.preventDefault(),!s||!o){u();return}const I=e.findIndex(E=>g(E)===s),M=e.findIndex(E=>g(E)===w);I!==-1&&M!==-1&&I!==M&&o({row:e[I],oldIndex:I,targetIndex:M}),u()},[s,o,e,g,u]);return{draggedRowId:s,dragOverRowId:a,onDragStart:i?p:void 0,onDragOver:i?b:void 0,onDragEnd:i?u:void 0,onDrop:i?h:void 0}}const xr={contains:(n,o)=>n==null||o==null?!1:String(n).toLowerCase().includes(String(o).toLowerCase()),equals:(n,o)=>n==null&&o==null?!0:n==null||o==null?!1:String(n).toLowerCase()===String(o).toLowerCase(),startsWith:(n,o)=>n==null||o==null?!1:String(n).toLowerCase().startsWith(String(o).toLowerCase()),endsWith:(n,o)=>n==null||o==null?!1:String(n).toLowerCase().endsWith(String(o).toLowerCase()),isEmpty:n=>n==null||String(n).trim()==="",isNotEmpty:n=>n!=null&&String(n).trim()!=="",">":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e>r},">=":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e>=r},"<":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e<r},"<=":(n,o)=>{if(n==null||o==null)return!1;const e=Number(n),r=Number(o);return isNaN(e)||isNaN(r)?!1:e<=r},"!=":(n,o)=>{if(o==null||o==="")return!0;const e=Number(n),r=Number(o);return!isNaN(e)&&!isNaN(r)?e!==r:String(n).toLowerCase()!==String(o).toLowerCase()},isAnyOf:(n,o)=>n==null||!Array.isArray(o)?!1:o.some(e=>String(n).toLowerCase()===String(e).toLowerCase()),not:(n,o)=>n==null&&o==null?!1:n==null||o==null?!0:String(n).toLowerCase()!==String(o).toLowerCase(),is:(n,o)=>{if(o==null||o==="")return!0;const e=String(n).toLowerCase(),r=String(o).toLowerCase();return e===r},"=":(n,o)=>n==null||o==null||o===""?!1:Number(n)===Number(o)};function mr(n,o){const{field:e,operator:r,value:i}=o,s=n[e],d=xr[r];return d?d(s,i):(console.warn(`Unknown filter operator: ${r}`),!0)}function br(n,o){return!o||o.length===0?!0:o.every(e=>{const r=e.toLowerCase();return Object.values(n).some(i=>i==null?!1:String(i).toLowerCase().includes(r))})}function jn(n,o){const e=o.items||[],r=o.logicOperator||"and",i=o.quickFilterValues||[];if(i.length>0&&!br(n,i))return!1;if(e.length===0)return!0;const s=d=>{if("logicOperator"in d&&"items"in d){const a=d,f=a.items;return f.length===0?!0:a.logicOperator==="and"?f.every(s):f.some(s)}else return mr(n,d)};return r==="and"?e.every(s):e.some(s)}function wr(n,o){if(!o)return n;const{items:e=[],quickFilterValues:r=[]}=o;return e.length===0&&(!r||r.length===0)?n:n.filter(i=>jn(i,o))}function vr(n){switch(n){case"number":return["=","!=",">",">=","<","<=","isEmpty","isNotEmpty"];case"date":return["is","not","after","onOrAfter","before","onOrBefore","isEmpty","isNotEmpty"];case"boolean":return["is"];case"singleSelect":return["isAnyOf","is","not"];default:return["contains","equals","startsWith","endsWith","isEmpty","isNotEmpty"]}}function En(n,o,e){if(n==null&&o==null)return 0;if(n==null)return e==="asc"?1:-1;if(o==null)return e==="asc"?-1:1;if(typeof n=="number"&&typeof o=="number")return e==="asc"?n-o:o-n;if(n instanceof Date&&o instanceof Date)return e==="asc"?n.getTime()-o.getTime():o.getTime()-n.getTime();const r=String(n).toLowerCase(),i=String(o).toLowerCase();return e==="asc"?r<i?-1:r>i?1:0:r>i?-1:r<i?1:0}function _r(n,o){if(o.length===0)return n;const e=[...n];return e.sort((r,i)=>{for(const s of o){const d=r[s.field],a=i[s.field],f=En(d,a,s.sort);if(f!==0)return f}return 0}),e}function Cr(n){const{rows:o,getRowId:e,getTreeDataPath:r,treeData:i=!1,defaultGroupingExpansionDepth:s=0,filterModel:d,sortModel:a,onRowExpansionChange:f}=n,{treeNodes:g,rootIds:p,groupingRows:b}=l.useMemo(()=>{if(!i||!r)return{treeNodes:new Map,rootIds:[],groupingRows:[]};const _=new Map,j=[],y=[],P=new Map,k=x=>x.join("/");return o.forEach(x=>{const S=e(x),R=r(x),B=k(R);P.set(B,S),_.set(S,{id:S,parentId:null,depth:R.length-1,groupingKey:R[R.length-1],isExpanded:!1,children:[],serverChildrenCount:x.serverChildrenCount})}),o.forEach(x=>{const S=e(x),R=r(x);if(R.length===1){j.push(S);return}const B=$=>{if($.length<=1)return;const K=$.slice(0,-1),q=k(K);let D=P.get(q);if(D===void 0&&(D=`auto-group-${q}`,!_.has(D))){const Z=K[K.length-1];_.set(D,{id:D,parentId:null,depth:K.length-1,groupingKey:Z,isExpanded:!1,children:[],label:Z}),P.set(q,D);const J={id:D,name:Z,_isGroupRow:!0};y.push(J),K.length===1&&j.push(D),B(K)}return D},Y=B(R);if(Y!==void 0){const $=_.get(Y),K=_.get(S);$&&K&&(K.parentId=Y,$.children=$.children||[],$.children.includes(S)||$.children.push(S))}}),y.forEach(x=>{const S=x.id,R=_.get(S);if(!R)return;const Y=S.replace("auto-group-","").split("/");if(Y.length>1){const $=Y.slice(0,-1),K=k($),q=P.get(K);if(q&&_.has(q)){R.parentId=q;const D=_.get(q);D&&(D.children=D.children||[],D.children.includes(S)||D.children.push(S))}}}),{treeNodes:_,rootIds:j,groupingRows:y}},[o,r,i,e]),u=l.useMemo(()=>{if(!i)return new Set;const _=new Set;return g.forEach(j=>{j.children&&j.children.length>0&&(s===-1||j.depth<s)&&_.add(j.id)}),_},[g,i,s]),[h,w]=l.useState(new Set);l.useEffect(()=>{u.size>0&&w(u)},[u]);const m=l.useCallback(_=>{w(j=>{const y=new Set(j),P=!y.has(_);if(y.has(_)?y.delete(_):y.add(_),P&&f){const k=g.get(_);k&&f(k)}return y})},[g,f]),I=l.useCallback(()=>{if(!i)return null;const _=new Map;o.forEach(B=>_.set(e(B),B)),b.forEach(B=>_.set(B.id,B));const j=B=>jn(B,d),y=new Map,P=B=>{if(y.has(B))return y.get(B);const Y=_.get(B);if(!Y)return!1;if(j(Y))return y.set(B,!0),!0;const K=g.get(B);return K&&K.children&&K.children.some(D=>P(D))?(y.set(B,!0),!0):(y.set(B,!1),!1)},k=(B,Y)=>{if(!a||a.length===0)return 0;const $=_.get(B),K=_.get(Y);if(!$||!K)return 0;for(const q of a){const D=$[q.field],Z=K[q.field],J=En(D,Z,q.sort);if(J!==0)return J}return 0},x=[],S=new Set,R=B=>{const Y=B.filter($=>P($));Y.sort(k),Y.forEach($=>{if(S.has($))return;const K=_.get($),q=g.get($);if(K&&q){S.add($);const D={...K,_treeDepth:q.depth,_isExpanded:h.has($),_hasChildren:q.children&&q.children.length>0||q.serverChildrenCount&&q.serverChildrenCount>0,_descendantCount:q.children?q.children.length:0};x.push(D),h.has($)&&q.children&&q.children.length>0&&R(q.children)}})};return R(p),x},[i,o,b,p,g,h,d,a,e]),M=l.useCallback(_=>h.has(_),[h]),E=l.useCallback(_=>g.get(_),[g]),C=l.useCallback(_=>{const j=[];let y=_;for(;y!==null;){const P=g.get(y);if(!P)break;j.unshift(P.groupingKey),y=P.parentId}return j},[g]);return l.useMemo(()=>({treeNodes:g,groupingRows:b,toggleExpansion:m,isGroupExpanded:M,getVisibleRows:I,getNode:E,getNodePath:C}),[g,b,m,M,I,E,C])}const yr=n=>n?.depth===-1?"footer":"inline";function kr(n){const{rows:o,getRowId:e,rowGroupingModel:r=[],aggregationModel:i={},defaultGroupingExpansionDepth:s=0,filterModel:d,sortModel:a,getAggregationPosition:f=yr}=n,[g,p]=l.useState(new Set),{treeNodes:b,rootIds:u,groupingRows:h}=l.useMemo(()=>{const E=new Map,C=new Map,_=[];if(r.length===0)return{treeNodes:E,rootIds:_,groupingRows:C};const j=(k,x,S)=>`auto-group-${k}-${x}-${S||"root"}`,y=(k,x,S)=>{if(x>=r.length)return k.map($=>{const K=e($);return E.set(K,{id:K,parentId:S,depth:x,groupingKey:"",isExpanded:!1}),K});const R=r[x],B=new Map;k.forEach($=>{const K=$[R],q=String(K);B.has(q)||B.set(q,[]),B.get(q).push($)});const Y=[];return B.forEach(($,K)=>{const D=$[0][R],Z=j(R,K,S);Y.push(Z);const J={};i&&Object.entries(i).forEach(([A,O])=>{const Q=$.map(U=>U[A]);if(O==="sum")J[A]=Q.reduce((U,T)=>(Number(U)||0)+(Number(T)||0),0);else if(O==="min")J[A]=Math.min(...Q.map(U=>Number(U)||0));else if(O==="max")J[A]=Math.max(...Q.map(U=>Number(U)||0));else if(O==="avg"){const U=Q.reduce((T,se)=>(Number(T)||0)+(Number(se)||0),0);J[A]=Q.length?U/Q.length:0}else O==="count"&&(J[A]=Q.length)});const he={[R]:D,...J,id:Z};C.set(Z,he);const v={id:Z,parentId:S,depth:x,groupingKey:K,groupingField:R,groupingValue:D,aggregatedValues:J,isExpanded:!1,children:[],label:`${R}: ${String(D)}`};v.aggregationPosition=f(v),E.set(Z,v);const H=y($,x+1,Z);E.get(Z).children=H;const F=$.length;E.get(Z).descendantCount=F}),Y},P=y(o,0,null);return _.push(...P),{treeNodes:E,rootIds:_,groupingRows:C}},[o,r,i,e,f]);l.useEffect(()=>{if(s===-1){const E=new Set;b.forEach((C,_)=>{C.children&&C.children.length>0&&E.add(_)}),p(E)}else if(s>0){const E=new Set;b.forEach((C,_)=>{C.depth<s&&C.children&&C.children.length>0&&E.add(_)}),p(E)}else p(new Set)},[r,s]);const w=l.useCallback(E=>{p(C=>{const _=new Set(C);return _.has(E)?_.delete(E):_.add(E),_})},[]),m=l.useCallback(E=>g.has(E),[g]),I=l.useCallback(()=>{if(r.length===0)return null;const E=[],C=new Set,_=new Map;o.forEach(k=>_.set(e(k),k));const j=k=>{const x=b.get(k);if(!x)return!1;if(!x.children||x.children.length===0){const S=_.get(k);return!(!S||d&&!jn(S,d))}return x.children.some(S=>j(S))},y=k=>{let x=k;d&&(x=k.filter(j)),a&&a.length>0&&x.sort((S,R)=>{const B=h.get(S)||_.get(S),Y=h.get(R)||_.get(R);if(!B||!Y)return 0;for(const $ of a){const K=B[$.field],q=Y[$.field],D=En(K,q,$.sort);if(D!==0)return D}return 0}),x.forEach(S=>{if(C.has(S))return;const R=b.get(S),B=R?.children&&R.children.length>0,Y=B?h.get(S):_.get(S);if(Y&&R){C.add(S);const $={...Y,_treeDepth:R.depth,_isExpanded:g.has(S),_hasChildren:B,_groupingField:R.groupingField,_groupingValue:R.groupingValue,_descendantCount:R.descendantCount};E.push($),P.has(S)&&B&&y(R.children)}})},P=g;return y(u),E},[o,e,b,u,h,d,a,g]),M=l.useCallback(E=>b.get(E),[b]);return l.useMemo(()=>({treeNodes:b,groupingRows:h,toggleExpansion:w,isGroupExpanded:m,getVisibleRows:I,getNode:M}),[b,h,w,m,I,M])}function Sr(n){const{rows:o,getRowId:e,processRowUpdate:r,onProcessRowUpdateError:i,onRowChange:s}=n,[d,a]=l.useState(null),f=l.useRef(null),g=l.useCallback(h=>{a(h),f.current=typeof h=="function"?h(f.current):h},[]),p=l.useCallback(h=>{g({id:h.id,field:h.field,value:h.value,originalValue:h.value})},[]),b=l.useCallback(async h=>{const w=f.current;if(!w)return;if(h?.cancel){g(null);return}const{id:m,field:I,value:M,originalValue:E}=w;if(M===E){g(null);return}const C=o.find(j=>e(j)===m);if(!C){g(null);return}const _={...C,[I]:M};try{if(r){const j=await r(_,C);s?.(j)}else s?.(_);g(null)}catch(j){i&&i(j)}},[d,o,e,r,s,i]),u=l.useCallback(h=>{d&&d.id===h.id&&d.field===h.field&&g(w=>w?{...w,value:h.value}:null)},[d]);return{editingCell:d,startCellEdit:p,stopCellEdit:b,setEditCellValue:u}}function jr(n,o,e){const[r,i]=l.useState(new Map),[s,d]=l.useState({caches:{spannedCells:{},hiddenCells:{},hiddenCellOriginMap:{}},processedRange:{firstRowIndex:0,lastRowIndex:0}}),a=l.useCallback(()=>{i(new Map)},[]),f=l.useCallback((m,I)=>r.get(m)?.[I],[r]),g=l.useCallback((m,I,M,E,C)=>{const _=new Map(r);for(let j=E;j<C;j++){const y=o[j];if(!y)continue;let P=1;if(y.colSpan)if(typeof y.colSpan=="function"){const x={row:I,value:I[y.field],field:y.field,colDef:y,rowIndex:M,colIndex:j};P=y.colSpan(x)}else P=y.colSpan;if(P<=1){Pt(_,m,y.field,{spannedByColSpan:!1,cellProps:{colSpan:1,width:e[y.field]||100}});continue}let k=e[y.field]||100;for(let x=1;x<P;x++)if(j+x<C){const S=o[j+x];S&&(k+=e[S.field]||100,Pt(_,m,S.field,{spannedByColSpan:!0,leftVisibleCellIndex:j,rightVisibleCellIndex:Math.min(j+P-1,o.length-1)}))}Pt(_,m,y.field,{spannedByColSpan:!1,cellProps:{colSpan:P,width:k}}),j+=P-1}i(_)},[r,o,e]),p=l.useCallback((m,I)=>{const M={},E={},C={};o.forEach((_,j)=>{if(_.rowSpan)for(let y=m;y<I;y++){const P=n[y];if(!P||E[P.id]?.[_.field])continue;const k=_.valueGetter?_.valueGetter({row:P,field:_.field,value:P[_.field]}):P[_.field];let x=1;if(typeof _.rowSpan=="function"){const S={row:P,value:k,field:_.field,colDef:_,rowIndex:y,colIndex:j};x=_.rowSpan(S)}else typeof _.rowSpan=="number"&&(x=_.rowSpan);if(x>1){M[P.id]||(M[P.id]={}),M[P.id][_.field]=x;for(let S=1;S<x;S++){const R=y+S;if(R<I&&n[R]){const B=n[R];E[B.id]||(E[B.id]={}),E[B.id][_.field]=!0,C[R]||(C[R]={}),C[R][_.field]=y}}}}}),d({caches:{spannedCells:M,hiddenCells:E,hiddenCellOriginMap:C},processedRange:{firstRowIndex:m,lastRowIndex:I}})},[n,o]),b=l.useCallback(()=>{d({caches:{spannedCells:{},hiddenCells:{},hiddenCellOriginMap:{}},processedRange:{firstRowIndex:0,lastRowIndex:0}})},[]);l.useEffect(()=>{const m=new Map;n.forEach((C,_)=>{for(let j=0;j<o.length;j++){const y=o[j];if(!y)continue;let P=1;if(y.colSpan)if(typeof y.colSpan=="function"){const x={row:C,value:C[y.field],field:y.field,colDef:y,rowIndex:_,colIndex:j};P=y.colSpan(x)}else P=y.colSpan;if(P<=1){const x=e[y.field]||(typeof y.width=="number"?y.width:100);Pt(m,C.id,y.field,{spannedByColSpan:!1,cellProps:{colSpan:1,width:x}});continue}let k=e[y.field]||(typeof y.width=="number"?y.width:100);for(let x=1;x<P;x++)if(j+x<o.length){const S=o[j+x];if(S){const R=e[S.field]||(typeof S.width=="number"?S.width:100);k+=R,Pt(m,C.id,S.field,{spannedByColSpan:!0,leftVisibleCellIndex:j,rightVisibleCellIndex:Math.min(j+P-1,o.length-1)})}}Pt(m,C.id,y.field,{spannedByColSpan:!1,cellProps:{colSpan:P,width:k}}),j+=P-1}}),i(m);const I={},M={},E={};o.forEach((C,_)=>{if(C.rowSpan)for(let j=0;j<n.length;j++){const y=n[j];if(!y||M[y.id]?.[C.field])continue;const P=C.valueGetter?C.valueGetter({row:y,field:C.field,value:y[C.field]}):y[C.field];let k=1;if(typeof C.rowSpan=="function"){const x={row:y,value:P,field:C.field,colDef:C,rowIndex:j,colIndex:_};k=C.rowSpan(x)}else typeof C.rowSpan=="number"&&(k=C.rowSpan);if(k>1){I[y.id]||(I[y.id]={}),I[y.id][C.field]=k;for(let x=1;x<k;x++){const S=j+x;if(S<n.length&&n[S]){const R=n[S];M[R.id]||(M[R.id]={}),M[R.id][C.field]=!0,E[S]||(E[S]={}),E[S][C.field]=j}}}}}),d({caches:{spannedCells:I,hiddenCells:M,hiddenCellOriginMap:E},processedRange:{firstRowIndex:0,lastRowIndex:n.length}})},[n,o,e]);const u=l.useCallback(()=>s.caches.spannedCells,[s]),h=l.useCallback(()=>s.caches.hiddenCells,[s]),w=l.useCallback(()=>s.caches.hiddenCellOriginMap,[s]);return{colspanMap:r,resetColSpan:a,getCellColSpanInfo:f,calculateColSpan:g,rowSpanningState:s,calculateRowSpan:p,resetRowSpan:b,getSpannedCells:u,getHiddenCells:h,getHiddenCellOriginMap:w}}function Pt(n,o,e,r){let i=n.get(o);i||(i={},n.set(o,i)),i[e]=r}function Er(n){const{dataSource:o,sortModel:e,filterModel:r,paginationModel:i,paginationMode:s,sortingMode:d,filterMode:a,aggregationModel:f,setRows:g,setRowCount:p,setDataSourceLoading:b,setDataSourceError:u,onAggregationResults:h}=n,w=l.useRef(null),m=l.useRef(0),I=l.useCallback(async()=>{if(!o)return;const E=++m.current;b(!0),u(null);const C=i.page*i.pageSize,_=C+i.pageSize,j={startRow:C,endRow:_,sortModel:e,filterModel:r,groupKeys:[],aggregationModel:f};try{const y=await o.getRows(j);if(E!==m.current)return;let P=!1;if(s==="infinite"){const k=w.current;if(k){const x=JSON.stringify(k.sortModel)!==JSON.stringify(e),S=JSON.stringify(k.filterModel)!==JSON.stringify(r),R=k.pageSize!==i.pageSize;!x&&!S&&!R&&i.page>k.page&&(P=!0)}}g(P?k=>[...k,...y.rows]:y.rows,!0),y.aggregationResults&&h&&h(y.aggregationResults),y.rowCount!==void 0&&p(y.rowCount),w.current={sortModel:e,filterModel:r,page:i.page,pageSize:i.pageSize}}catch(y){E===m.current&&(u(y),console.error("Data Source Error:",y))}finally{E===m.current&&b(!1)}},[o,i.page,i.pageSize,e,r,s,f,h,g,p,b,u]);l.useEffect(()=>{if(o&&(s==="server"||s==="infinite"||d==="server"||a==="server")){const C=setTimeout(()=>{I()},300);return()=>clearTimeout(C)}},[I,o,s,d,a]);const M=l.useCallback(async(E,C)=>{if(o){b(!0);try{const _=await o.getRows({startRow:0,endRow:-1,sortModel:e,filterModel:r,groupKeys:C});_.rows.length>0&&g(j=>{const y=new Set(j.map(k=>k.id)),P=_.rows.filter(k=>!y.has(k.id));return[...j,...P]})}catch(_){u(_),console.error("Failed to fetch children:",_)}finally{b(!1)}}},[o,e,r,g,b,u]);return{fetchRows:I,fetchChildren:M}}const Nr={sum:n=>n.filter(e=>e!=null&&!isNaN(Number(e))).reduce((e,r)=>e+Number(r),0),avg:n=>{const o=n.filter(e=>e!=null&&!isNaN(Number(e)));return o.length===0?null:o.reduce((e,r)=>e+Number(r),0)/o.length},count:n=>n.filter(o=>o!=null).length,min:n=>{const o=n.filter(e=>e!=null&&!isNaN(Number(e))).map(Number);return o.length?Math.min(...o):null},max:n=>{const o=n.filter(e=>e!=null&&!isNaN(Number(e))).map(Number);return o.length?Math.max(...o):null},unique:n=>new Set(n.filter(o=>o!=null)).size};function bt(n,o){return n==null?"—":typeof n=="number"?o==="avg"?n.toLocaleString(void 0,{maximumFractionDigits:2}):n.toLocaleString():String(n)}function io(n){const{rows:o,aggregationModel:e,isServerSide:r,dataSource:i,filterModel:s,sortModel:d,serverAggregationResults:a}=n,f=l.useMemo(()=>{if(r||Object.keys(e).length===0)return{};const E={};for(const[C,_]of Object.entries(e)){const j=Nr[_];if(!j){console.warn(`[useAggregation] Unknown aggregation function: "${_}"`);continue}const y=o.map(P=>P[C]);E[C]=j(y)}return E},[o,e,r]),[g,p]=l.useState({}),[b,u]=l.useState(!1),[h,w]=l.useState(null),m=l.useRef(0),I=l.useCallback(async()=>{if(!i?.getAggregations||Object.keys(e).length===0)return;const E=++m.current;u(!0),w(null);try{const C=await i.getAggregations({sortModel:d??[],filterModel:s??{items:[]},groupKeys:[],aggregationModel:e});E===m.current&&p(C)}catch(C){E===m.current&&(w(C),console.error("[useAggregation] Server aggregation error:",C))}finally{E===m.current&&u(!1)}},[i,e,s,d]);return l.useEffect(()=>{r&&i?.getAggregations&&!a&&I()},[I,r,i,a]),{aggregationResult:l.useMemo(()=>r?a&&Object.keys(a).length>0?a:g:f,[r,f,a,g]),isLoading:b,error:h}}function Mr(n,o){const e=n.filter(r=>r!=null&&!isNaN(r));if(e.length===0)return null;switch(o){case"sum":return e.reduce((r,i)=>r+i,0);case"avg":return e.reduce((r,i)=>r+i,0)/e.length;case"count":return e.length;case"min":return Math.min(...e);case"max":return Math.max(...e)}}function Nn(n,o){return o.map(e=>String(n[e]??"")).join("\0")}function lo(n,o,e,r){return l.useMemo(()=>{const i={pivotRows:[],pivotColumns:[],colKeys:[],isValid:!1};if(!r)return i;const{rowFields:s,columnFields:d,valueFields:a}=e;if(s.length===0||a.length===0)return i;const f=new Map(o.map(m=>[m.field,m])),g=new Set;for(const m of n)g.add(Nn(m,d));const p=Array.from(g).sort(),b=new Map;for(const m of n){const I=Nn(m,s);if(!b.has(I)){const _={};for(const j of s)_[j]=m[j];b.set(I,{labelValues:_,bucket:new Map})}const M=b.get(I),E=Nn(m,d);M.bucket.has(E)||M.bucket.set(E,new Map);const C=M.bucket.get(E);for(const _ of a){const j=Number(m[_.field]);C.has(_.field)||C.set(_.field,[]),isNaN(j)||C.get(_.field).push(j)}}let u=0;const h=[];for(const[,m]of b){const I={id:u++,...m.labelValues};for(const M of p){const E=m.bucket.get(M);for(const C of a){const _=d.length>0?`${M}${C.field}${C.aggFn}`:`${C.field}${C.aggFn}`,j=E?.get(C.field)??[];I[_]=j.length>0?Mr(j,C.aggFn):null}}h.push(I)}const w=[];for(const m of s){const I=f.get(m);w.push({field:m,headerName:I?.headerName??m,width:I?.width??140,sortable:!0})}for(const m of p){const I=d.length>0?m.split("\0").map((M,E)=>{const C=f.get(d[E]);return C?.headerName?`${C.headerName}: ${M}`:M}).join(" / "):"";for(const M of a){const E=f.get(M.field),C=d.length>0?`${m}${M.field}${M.aggFn}`:`${M.field}${M.aggFn}`,_=M.headerName??E?.headerName??M.field,j=I?`${I} — ${_} (${M.aggFn})`:`${_} (${M.aggFn})`;w.push({field:C,headerName:j,width:140,type:"number",align:"right",headerAlign:"right",sortable:!0,valueFormatter:({value:y})=>{if(y==null)return"—";const P=Number(y);return M.aggFn==="avg"?P.toFixed(2):M.aggFn==="count"?P.toLocaleString():E?.valueFormatter?E.valueFormatter({value:y,row:{},field:M.field}):P.toLocaleString()}})}}return{pivotRows:h,pivotColumns:w,colKeys:p,isValid:!0}},[n,o,e,r])}function Ir(n){const o=document.createElement("textarea");o.value=n,o.style.cssText="position:fixed;top:-9999px;left:-9999px;opacity:0;",document.body.appendChild(o),o.focus(),o.select();let e=!1;try{e=document.execCommand("copy")}finally{document.body.removeChild(o)}return e}async function Pr(n){let o=!1;try{o=Ir(n)}catch{}if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(n);return}catch(e){if(o)return;throw e}else if(!o)throw new Error("Clipboard API not available and fallback failed.")}function Tr(n){const{selectedRowIds:o,columns:e,getVisibleRows:r,getRowId:i}=n,s=l.useCallback(async()=>{if(o.size===0)return;const a=r().filter(u=>o.has(i(u)));if(a.length===0)return;const f=e.filter(u=>!u.field.startsWith("__")),g=f.map(u=>u.headerName||u.field).join(" "),p=a.map(u=>f.map(h=>{const w=u[h.field];return h.valueFormatter?h.valueFormatter({value:w,row:u,field:h.field}):w??""}).join(" ")).join(`
|
|
7
|
+
`),b=`${g}
|
|
8
|
+
${p}`;try{await Pr(b)}catch(u){console.error("[OpenGridX] Failed to copy to clipboard:",u)}},[o,e,r,i]);return l.useEffect(()=>{const d=a=>{if(!(a.ctrlKey||a.metaKey)||a.key!=="c")return;const f=document.activeElement,g=f?.tagName.toLowerCase(),p=f?.type;g==="input"&&p!=="checkbox"&&p!=="radio"||g==="textarea"||g==="select"||f?.isContentEditable||s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s]),{copySelectedRows:s}}function Lr(){return t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function so(n){const{columns:o,visibleColumns:e,onVisibilityChange:r,onShowAll:i,onHideAll:s}=n,[d,a]=l.useState(""),g=l.useMemo(()=>o.filter(u=>u.hideable!==!1),[o]).every(u=>e.has(u.field)),p=l.useMemo(()=>{if(!d)return o;const u=d.toLowerCase();return o.filter(h=>(h.headerName||h.field).toLowerCase().includes(u))},[o,d]),b=u=>{u.target.checked?i():s()};return t.jsxs("div",{className:"ogx-column-visibility-panel",children:[t.jsx("div",{className:"ogx-column-visibility-panel__search-section",children:t.jsxs("div",{className:"ogx-column-visibility-panel__search-container",children:[t.jsx(Lr,{}),t.jsx("input",{id:"ogx-column-search",name:"ogx-column-search",autoComplete:"off",className:"ogx-column-visibility-panel__search-input",placeholder:"Search",value:d,onChange:u=>a(u.target.value)})]})}),t.jsx("div",{className:"ogx-column-visibility-panel__list",children:p.map(u=>{const h=e.has(u.field),w=u.hideable!==!1;return t.jsxs("label",{className:`ogx-column-visibility-panel__item ${w?"":"ogx-column-visibility-panel__item--disabled"}`,children:[t.jsx(qt,{checked:h,onChange:m=>r(u.field,m.target.checked),disabled:!w}),t.jsx("span",{className:"ogx-column-visibility-panel__label",children:u.headerName||u.field})]},u.field)})}),t.jsxs("div",{className:"ogx-column-visibility-panel__footer",children:[t.jsxs("label",{className:"ogx-column-visibility-panel__item",children:[t.jsx(qt,{checked:g,onChange:b}),t.jsx("span",{className:"ogx-column-visibility-panel__label",children:"Show/Hide All"})]}),t.jsx("button",{className:"ogx-column-visibility-panel__reset-btn",onClick:i,children:"Reset"})]})]})}function Rr(n){const{rows:o,columns:e,getRowId:r,rowHeight:i=52,headerHeight:s=56,autoHeight:d=!1,checkboxSelection:a=!1,rowSelectionModel:f,onRowSelectionModelChange:g,onRowClick:p,onCellClick:b,filterModel:u,onFilterModelChange:h,sortModel:w,onSortModelChange:m,pagination:I=!1,paginationModel:M={page:0,pageSize:100},onPaginationModelChange:E,pageSizeOptions:C=[10,25,50,100],pinnedColumns:_,onPinnedColumnsChange:j,pinnedRows:y,getDetailPanelContent:P,getDetailPanelHeight:k,detailPanelExpandedRowIds:x,onDetailPanelExpandedRowIdsChange:S,pinCheckboxColumn:R=!0,pinExpandColumn:B=!0,disableColumnReorder:Y=!1,columnOrder:$,onColumnOrderChange:K,height:q,rowReordering:D=!1,onRowOrderChange:Z,loading:J=!1,treeData:he=!1,getTreeDataPath:v,defaultGroupingExpansionDepth:H,rowGroupingModel:F,aggregationModel:A,onAggregationModelChange:O,getAggregationPosition:Q,isCellEditable:U,processRowUpdate:T,onProcessRowUpdateError:se,dataSource:ne,sortingMode:xe="client",filterMode:Qe="client",paginationMode:z="client",rowCount:Se,slots:je,slotProps:ct,pivotMode:Be=!1,pivotModel:ut,onPivotModelChange:gt,className:en="",style:Lt,onRowsScrollEnd:St,ariaLabel:Rt,initialState:vt,onStateChange:We,columnVisibilityModel:po,onColumnVisibilityModelChange:xo,listView:cn=!1,listViewColumn:mo,columnGroupingModel:jt,noRowsLabel:In="No Data",apiRef:Pn}=n,vi=l.useMemo(()=>({items:[]}),[]),Ge=u||vi,[_i,Ci]=l.useState(()=>vt?.sorting?.sortModel??[]),Tn=w!==void 0,Ze=Tn?w:_i,yi=l.useMemo(()=>[],[]),Ln=F||yi,Rn=A!==void 0,bo=l.useMemo(()=>je?.toolbar,[je?.toolbar]),[ki,Si]=l.useState(()=>A??{}),et=Rn?A:ki,ji=l.useCallback(c=>{Rn||Si(c),O?.(c)},[Rn,O]),[Ei,Ni]=l.useState(()=>vt?.columns?.columnVisibilityModel??{}),Fn=po!==void 0,Ye=Fn?po:Ei,tn=l.useCallback(c=>{Fn||Ni(c),xo?.(c)},[Fn,xo]),[Mi,Ii]=l.useState(()=>vt?.columns?.pinnedColumns??{}),Wn=_!==void 0,tt=Wn?_:Mi,On=l.useCallback(c=>{Wn||Ii(c),j?.(c)},[Wn,j]),Pi=l.useMemo(()=>({rowFields:[],columnFields:[],valueFields:[]}),[]),[Ti,Li]=l.useState(ut??Pi),wo=ut??Ti,Ri=l.useCallback(c=>{Li(c),gt?.(c)},[gt]),un=lo(o,e,wo,Be),An=Be&&un.isValid?un.pivotRows:o,nt=Be&&un.isValid?un.pivotColumns:e,[Fi,vo]=l.useState(null);l.useEffect(()=>{vo(null)},[et]);const[Wi,Oi]=l.useState(()=>vt?.pagination?.paginationModel??M),zn=n.paginationModel!==void 0,ge=zn?M:Wi,gn=l.useCallback(c=>{zn||Oi(c),E?.(c)},[zn,E]),[Ai,_o]=l.useState([]),nn=f!==void 0,Co=nn?f:Ai,Ee=l.useMemo(()=>new Set(Co),[Co]),fn=g,Et=l.useRef(null),zi=l.useRef(null),hn=l.useRef(null),Bi=l.useCallback(c=>c.id,[]),pn=r||Bi,[Xe,Ft]=l.useState(null),Wt=l.useCallback(c=>{Yn.current?.classList.toggle("ogx--kb",c)},[]),yo=l.useRef(ne);yo.current=ne;const ko=l.useRef(null),So=l.useRef(null),$i=l.useCallback(c=>{if(yo.current&&he&&c.serverChildrenCount>0&&c.children.length===0){const N=So.current?.getNodePath(c.id)||[c.groupingKey];ko.current?.(c.id,N)}},[he]),ot=fr({rows:An,columns:nt,rowHeight:i,headerHeight:s,rowCount:Se,columnVisibilityModel:Ye,initialState:n.initialState}),{state:ae,apiRef:Ot,setRows:Bn,setColumns:jo,setScroll:Eo,setDimensions:No,setDataSourceLoading:Hi,setDataSourceError:Di,setRowCount:Gi}=ot;l.useEffect(()=>{Pn&&(Pn.current=Ot.current)},[Pn,Ot]);const{copySelectedRows:Mo}=Tr({selectedRowIds:Ee,columns:nt,getVisibleRows:()=>Ot.current.getVisibleRows(),getRowId:pn});l.useEffect(()=>{Ot.current.copySelectedRows=Mo,Ot.current.getSelectedRows=()=>Array.from(Ee)},[Mo,Ee,Ot]);const Vi=ae.dataSource.loading,on=J||Vi,rn=l.useMemo(()=>ae.rows.allRows.map(c=>ae.rows.idRowsLookup.get(c)),[ae.rows]),$n=Cr({rows:rn,getRowId:pn,getTreeDataPath:v,treeData:he,defaultGroupingExpansionDepth:H,filterModel:Ge,sortModel:Ze,onRowExpansionChange:$i});l.useEffect(()=>{So.current=$n},[$n]);const Ui=kr({rows:rn,getRowId:pn,rowGroupingModel:Ln,aggregationModel:et,defaultGroupingExpansionDepth:H,filterModel:Ge,sortModel:Ze,getAggregationPosition:Q}),Oe=Sr({rows:rn,getRowId:pn,processRowUpdate:T,onProcessRowUpdateError:se,onRowChange:c=>{const{dispatch:N}=ot,V=Array.from(ot.state.rows.idRowsLookup.values()).map(re=>re.id===c.id?c:re);N({type:"SET_ROWS",payload:V})}}),Hn=he,At=!!(Ln&&Ln.length>0),xn=Hn||At,Ae=Hn?$n:At?Ui:null,Ne=I&&!At,mn=l.useCallback(c=>{const{row:N,id:L}=c;if(xn&&N._hasChildren){Ae?.toggleExpansion(L);return}p?.(c)},[xn,Ae,p]),Le=l.useMemo(()=>xn?nt.map((c,N)=>N===0?{...c,renderCell:L=>{const{_treeDepth:V,_hasChildren:re,_isExpanded:ce,_groupingField:we,_groupingValue:Ue,_descendantCount:He}=L.row,pe=(V||0)*24;let le=c.renderCell?c.renderCell(L):L.value;return Hn&&re&&L.row._isGroupRow&&(le=t.jsxs("div",{className:"ogx__group-cell-content",children:[L.value,He!==void 0&&He>0?` (${He})`:""]})),At&&re&&we&&(le=t.jsxs("div",{className:"ogx__group-cell-content",children:[c.field===we?"":`${we}: `,String(Ue),He!==void 0?` (${He})`:""]})),t.jsxs("div",{style:{display:"flex",alignItems:"center",paddingLeft:pe,width:"100%",height:"100%"},children:[t.jsx("div",{style:{marginRight:4,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",cursor:re?"pointer":"default",flexShrink:0},children:re?t.jsx("div",{onClick:G=>{G.stopPropagation(),G.preventDefault(),Ae?.toggleExpansion(L.row.id)},onMouseDown:G=>{G.stopPropagation()},style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:10,position:"relative"},children:t.jsx(oo,{isExpanded:ce,onClick:G=>{G.stopPropagation(),G.preventDefault(),Ae?.toggleExpansion(L.row.id)}})}):null}),t.jsx("div",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:le})]})}}:{...c,renderCell:L=>{const{_hasChildren:V,_groupingField:re}=L.row;return At&&V?c.field===re?null:L.value!==void 0&&L.value!==null?c.renderCell?c.renderCell(L):L.value:null:c.renderCell?c.renderCell(L):L.value}}):nt,[nt,xn,At,Ae]),Dn=Er({dataSource:ne,sortModel:Ze,filterModel:Ge,paginationModel:ge,paginationMode:z,sortingMode:xe,filterMode:Qe,aggregationModel:et,setRows:Bn,setRowCount:Gi,setDataSourceLoading:Hi,setDataSourceError:Di,onAggregationResults:vo});l.useEffect(()=>{Dn.fetchChildren&&(ko.current=Dn.fetchChildren)},[Dn.fetchChildren]);const[rt,Ki]=l.useState(()=>vt?.columns?.columnWidths??{}),[Yi,Io]=l.useState(()=>vt?.columns?.columnOrder??nt.map(c=>c.field)),zt=$||Yi;l.useEffect(()=>{ne||Bn(An)},[An,Bn,ne]),l.useEffect(()=>{jo(nt)},[nt,jo]),l.useEffect(()=>{Be&&Io(nt.map(c=>c.field))},[Be,nt]);const Bt=l.useMemo(()=>{if(Y)return Le;const c=new Map(zt.map((N,L)=>[N,L]));return[...Le].sort((N,L)=>{const V=c.get(N.field)??Le.indexOf(N),re=c.get(L.field)??Le.indexOf(L);return V-re})},[Le,zt,Y]),Po=l.useMemo(()=>Bt.filter(c=>Ye[c.field]!==!1),[Bt,Ye]),$t=hr({columns:Bt,onColumnOrderChange:l.useCallback(c=>{const{oldIndex:N,targetIndex:L}=c,V=[...zt],[re]=V.splice(N,1);V.splice(L,0,re),$||Io(V),K?.(c)},[zt,$,K]),disableColumnReorder:Y}),[Xi,qi]=l.useState(new Set),_t=x??Xi,qe=!!P,ln=l.useCallback(c=>{const N=new Set(_t);N.has(c)?N.delete(c):N.add(c),x===void 0&&qi(N),S?.(N)},[_t,x,S]),be=l.useMemo(()=>{const c=[];return D&&c.push({field:"__reorder_col__"}),qe&&c.push({field:"__expand_col__"}),a&&c.push({field:"__checkbox_col__"}),[...c,...Bt]},[Bt,a,qe,D]),Ji=l.useCallback((c,N)=>{Ki(L=>({...L,[c]:N}))},[]),Gn=l.useRef(We);Gn.current=We,l.useEffect(()=>{if(!Gn.current)return;const c={sorting:{sortModel:Ze},filter:{filterModel:Ge},pagination:{paginationModel:ge},columns:{columnWidths:rt,columnOrder:zt,columnVisibilityModel:Ye,pinnedColumns:tt}};Gn.current(c)},[Ze,Ge,ge,rt,zt,Ye,tt]);const bn=l.useMemo(()=>rn,[rn]),$e=l.useMemo(()=>Ae?Ae.getVisibleRows()||[]:Qe==="server"&&ne?bn:wr(bn,Ge),[bn,Ge,Ae,Qe,ne]),{top:Ve,center:Ht,bottom:it}=l.useMemo(()=>Ae?{top:[],center:$e,bottom:[]}:$o($e,y),[$e,y,Ae]),Me=l.useMemo(()=>Ae||xe==="server"&&ne?Ht:_r(Ht,Ze),[Ht,Ze,Ae,xe,ne]),ft=l.useMemo(()=>{if(!Ne||z==="server"&&ne)return Me;const c=ge.page*ge.pageSize,N=c+ge.pageSize;return Me.slice(c,N)},[Me,Ne,ge.page,ge.pageSize,z,ne]);l.useEffect(()=>{ot.apiRef.current.getVisibleRows=()=>Me,ot.apiRef.current.getVisibleColumns=()=>Le},[Me,Le,ot.apiRef]);const Dt=pr({rows:Ne?ft:Me,getRowId:c=>c.id,onRowOrderChange:Z,rowReordering:D}),ye=l.useMemo(()=>{if(Ae)return Ht;const c=Ne?ft:Me,N=[...Ve,...c,...it];if(z==="infinite"&&ae.dataSource.loading&&N.length>0){const L=Math.min(ge.pageSize,20),V=Array.from({length:L},(re,ce)=>({id:`__skeleton_${ce}__`,_isSkeleton:!0}));return[...N,...V]}return N},[Ve,ft,Me,it,Ne,Ae,Ht,z,ae.dataSource.loading,ge.pageSize]),Gt=jr(ye,be,rt),{aggregationResult:Vn}=io({rows:$e,aggregationModel:et,isServerSide:!!(ne&&(z==="server"||xe==="server")),dataSource:ne,filterModel:Ge,sortModel:Ze,serverAggregationResults:Fi}),wn=Object.keys(et).length>0;l.useEffect(()=>{ot.apiRef.current.getAggregationResult=()=>wn?Vn:null,ot.apiRef.current.getAggregationModel=()=>wn?et:null},[Vn,et,wn,ot.apiRef]);const Un=l.useMemo(()=>{const c=i,N=Ne?ft:Me,L=N.map((W,X)=>{let ee=c;if(_t.has(W.id)){const ze=k?.({row:W,id:W.id,rowIndex:Ve.length+X})??200;ee+=typeof ze=="number"?ze:parseInt(String(ze),10)||200}return ee}),V=L.reduce((W,X,ee)=>(W.push((W[ee-1]||0)+X),W),[]),ce=(z==="infinite"&&ae.dataSource.loading&&N.length>0?Math.min(ge.pageSize,20):0)*c,we=(V[V.length-1]||0)+ce,Ue=Ve.length*c,He=it.length*c,ie=[],pe=[],le=[],G=[];Po.forEach(W=>{const X=dn(W.field,tt);X==="left"?ie.push(W):X==="right"?pe.push(W):le.push(W)});const fe=ae.dimensions.viewportWidth||1e3,Ce=(a?48:0)+(qe?48:0)+(D?48:0),me=W=>rt[W.field]??W.width,Ie=W=>{if(W===void 0)return{type:"auto",value:0};if(typeof W=="number")return{type:"fixed",value:W};if(typeof W=="string"){if(W.toLowerCase()==="auto")return{type:"auto",value:0};if(W.endsWith("%"))return{type:"percentage",value:parseFloat(W)};const X=parseFloat(W);if(!isNaN(X))return{type:"fixed",value:X}}return{type:"fixed",value:100}},Pe=ie.reduce((W,X)=>{const ee=Ie(me(X));return W+(ee.type==="fixed"?ee.value:100)},0),ue=pe.reduce((W,X)=>{const ee=Ie(me(X));return W+(ee.type==="fixed"?ee.value:100)},0),de=le.reduce((W,X)=>{if(X.flex&&X.flex>0){const ze=X.minWidth??150,mt=typeof X.width=="number"?X.width:150;return W+(ze||mt)}const ee=Ie(me(X));return ee.type==="fixed"?W+ee.value:ee.type==="percentage"?W+100:W+(X.minWidth??150)},0),ht=Math.max(fe-Ce-Pe-ue,de),lt=[],Re=[],ke=[];let Fe=0;le.forEach(W=>{const X=Ie(me(W));if(W.flex&&W.flex>0){ke.push({col:W,flex:W.flex}),Fe+=W.flex;return}X.type==="fixed"?lt.push({col:W,width:X.value}):X.type==="percentage"?Re.push({col:W,percentage:X.value}):(ke.push({col:W,flex:1}),Fe+=1)});const De=lt.reduce((W,{width:X})=>W+X,0);let Te=Math.max(0,ht-De);const st=new Map;Re.forEach(({col:W,percentage:X})=>{const ee=X/100*Te;st.set(W.field,ee),Te-=ee}),Te=Math.max(0,Te);const Ct=new Map,pt=ke.map(W=>({...W,minWidth:W.col.minWidth??50,maxWidth:W.col.maxWidth??1/0,frozen:!1,computedWidth:0}));(()=>{let W=0;const X=pt.length*2;for(;W<X;){W++;const ee=pt.filter(te=>!te.frozen);if(ee.length===0)break;const ze=ee.reduce((te,at)=>te+at.flex,0),mt=pt.reduce((te,at)=>at.frozen?te+at.computedWidth:te,0),sl=Math.max(0,Te-mt);if(ze<=0){ee.forEach(te=>{te.computedWidth=te.minWidth,te.frozen=!0});break}const al=sl/ze;let Cn=0;const yn=[],kn=[];if(ee.forEach(te=>{const at=al*te.flex;if(at<te.minWidth){const Xn=te.minWidth-at;Cn+=Xn,yn.push(te)}else if(at>te.maxWidth){const Xn=te.maxWidth-at;Cn+=Xn,kn.push(te)}else te.computedWidth=at}),yn.length===0&&kn.length===0){ee.forEach(te=>te.frozen=!0);break}Cn>0?yn.forEach(te=>{te.computedWidth=te.minWidth,te.frozen=!0}):Cn<0?kn.forEach(te=>{te.computedWidth=te.maxWidth,te.frozen=!0}):(yn.forEach(te=>{te.computedWidth=te.minWidth,te.frozen=!0}),kn.forEach(te=>{te.computedWidth=te.maxWidth,te.frozen=!0}))}})(),pt.forEach(W=>Ct.set(W.col.field,W.computedWidth));const Ut=new Map;le.forEach(W=>{let X;if(Ct.has(W.field))X=Ct.get(W.field);else{const ee=lt.find(mt=>mt.col.field===W.field),ze=Re.find(mt=>mt.col.field===W.field);if(ee)X=ee.width;else if(ze){const mt=st.get(W.field)||0;X=Math.max(W.minWidth??50,mt||100)}else X=100}G.push(X),Ut.set(W.field,X)});const xt=le.map(W=>{const X=pt.find(ee=>ee.col.field===W.field);return{...W,width:Ut.get(W.field)??(typeof W.width=="number"?W.width:100),flex:X?X.flex:W.flex}}),Ke=11,Nt=ie.map((W,X)=>{const ee=Ie(me(W)),ze=ee.type==="fixed"?ee.value:100;return{...W,width:ze,zIndex:Ke+X}}),Kt=11,yt=pe.map((W,X)=>{const ee=Ie(me(W)),ze=ee.type==="fixed"?ee.value:100;return{...W,width:ze,zIndex:Kt+(pe.length-1-X)}}),Je=G.reduce((W,X)=>W+X,0),ve=Pe+Je+ue+Ce,ll=G.reduce((W,X,ee)=>(W.push((W[ee-1]||0)+X),W),[]);return{rowHeights:L,cumulativeHeights:V,unpinnedRowsHeight:we,pinnedTopHeight:Ue,pinnedBottomHeight:He,leftPinnedCols:Nt,rightPinnedCols:yt,unpinnedColsWithWidth:xt,unpinnedColWidths:G,unpinnedAccWidths:ll,totalWidth:ve,leftWidth:Pe,rightWidth:ue,unpinnedTotalWidth:Je,systemColumnsWidth:Ce,pinnedTopRowsLength:Ve.length,pinnedBottomRowsLength:it.length,unpinnedRowsLength:N.length}},[i,Ne,ft,Me,_t,k,Ve.length,it.length,_t,k,Ve.length,it.length,Po,tt,rt,ae.dimensions.viewportWidth,a,qe,D,R,B,d,z,ae.dataSource.loading,ge.pageSize]),_e=l.useMemo(()=>{const{unpinnedAccWidths:c,unpinnedColsWithWidth:N,leftPinnedCols:L,rightPinnedCols:V,totalWidth:re,leftWidth:ce,rightWidth:we,unpinnedTotalWidth:Ue,systemColumnsWidth:He,cumulativeHeights:ie,pinnedTopHeight:pe,pinnedBottomHeight:le,unpinnedRowsHeight:G,rowHeights:fe,unpinnedRowsLength:Ce}=Un,me=ae.virtualization.scrollLeft,Ie=ae.virtualization.scrollTop,Pe=ae.dimensions.viewportWidth||1e3,ue=d?pe+G+le+50:ae.dimensions.viewportHeight||600,de=6,ht=Math.max(0,me-ce),lt=me+Pe-ce;let Re=0,ke=N.length-1,Fe=0,De=c.length-1;for(;Fe<=De;){const ve=Fe+De>>>1;c[ve]<ht?Fe=ve+1:De=ve-1}Re=Math.max(0,Fe-de);for(let ve=Re;ve<c.length;ve++){if((ve===0?0:c[ve-1])>lt){ke=Math.min(N.length-1,ve+de);break}ke=Math.min(N.length-1,ve+de)}const Te=Re>0?c[Re-1]:0,st=Ue-c[ke],Ct=[...L,...Te>0?[{field:"__spacer_left__",width:Te,isSpacer:!0}]:[],...N.slice(Re,ke+1),...st>0?[{field:"__spacer_right__",width:st,isSpacer:!0}]:[],...V],sn=Pe>0&&re>Pe?16:0,Ut=pe+G+le+sn+2,xt=5;let Ke=0,Nt=Ce-1,Kt=0,yt=0,Je=ie.length-1;for(;yt<=Je;){const ve=yt+Je>>>1;ie[ve]<Ie?yt=ve+1:Je=ve-1}Ke=Math.max(0,yt-xt),Kt=Ke>0?ie[Ke-1]:0;for(let ve=Ke;ve<ie.length;ve++)if(ie[ve]>=Ie+ue){Nt=Math.min(Ce-1,ve+xt);break}return{renderContext:{firstRowIndex:Ke,lastRowIndex:Nt,firstColumnIndex:Re,lastColumnIndex:ke},offsetTop:Kt,offsetLeft:0,totalHeight:Ut,pinnedTopHeight:pe,pinnedBottomHeight:le,totalWidth:re,rowHeights:fe,cumulativeHeights:ie,virtualColumns:Ct,columnMetrics:{leftPinnedWidth:ce,rightPinnedWidth:we,unpinnedAccWidths:c,unpinnedCols:N,totalSpecialsWidth:He,pinnedSpecialsWidth:(D?48:0)+(qe&&B?48:0)+(a&&R?48:0)}}},[Un,ae.virtualization.scrollTop,ae.virtualization.scrollLeft,ae.dimensions.viewportHeight,ae.dimensions.viewportWidth,d]),Qi=l.useCallback(c=>{const N=c.currentTarget;if(Eo(N.scrollTop,N.scrollLeft),St){const{scrollTop:L,scrollHeight:V,clientHeight:re}=N;V-L-re<100&&St({visibleTop:L,visibleBottom:L+re,viewportHeight:re})}},[Eo,St]);l.useEffect(()=>{if(!Et.current)return;const c=new ResizeObserver(N=>{for(const L of N){const{width:V,height:re}=L.contentRect;No(V,re)}});return c.observe(Et.current),()=>{c.disconnect()}},[No]);const Vt=l.useCallback((c,N)=>{const L=new Set(Ee);N?L.add(c):L.delete(c);const V=Array.from(L);nn||_o(V),fn?.(V)},[Ee,nn,fn]),Zi=l.useCallback(c=>{let N=[];c&&(N=bn.map(L=>L.id)),nn||_o(N),fn?.(N)},[o,nn,fn]),To=l.useCallback((c,N)=>{const L=N?[{field:c,sort:N}]:[];Tn||Ci(L),m?.(L)},[Tn,m]),Kn=l.useCallback(c=>{Wt(!1),Ft({id:c.row.id,field:c.field}),hn.current?.focus({preventScroll:!0}),b?.(c)},[b,Wt]),Lo=l.useRef(Oe.editingCell);l.useEffect(()=>{const c=!!Lo.current,N=!!Oe.editingCell;c&&!N&&hn.current?.focus({preventScroll:!0}),Lo.current=Oe.editingCell},[Oe.editingCell]);const Ro=l.useMemo(()=>{const{firstRowIndex:c,lastRowIndex:N}=_e.renderContext,L=Ve.length,V=Ve.map((le,G)=>({row:le,rowIndex:G})),re=it.map((le,G)=>({row:le,rowIndex:L+(Ne?ft.length:Me.length)+G})),ce=Math.max(0,c-L),we=Math.min(Ne?ft.length:Me.length,N-L+1),Ue=(Ne?ft:Me).slice(ce,we).map((le,G)=>({row:le,rowIndex:L+ce+G})),He=[...V,...Ue,...re],ie=new Set;return He.filter(le=>ie.has(le.row.id)?!1:(ie.add(le.row.id),!0))},[_e.renderContext,Ve,it,ft,Me,Ne,z,ae.dataSource.loading,ge.pageSize,i]),el=o.length>0&&Ee.size===o.length,tl=Ee.size>0&&Ee.size<o.length,nl=l.useCallback(c=>{c.target===c.currentTarget&&Ft(N=>{if(N)return N;if(a)return{id:"HEADER",field:"__checkbox_col__"};const L=ye[0],V=be[0];return L&&V?{id:L.id,field:V.field}:null})},[ye,be]),ol=l.useCallback(c=>{c.currentTarget.contains(c.relatedTarget)||Ft(null)},[]),rl=l.useCallback(c=>{if(Wt(!0),!Xe)return;const{id:N,field:L}=Xe,V=!!Oe.editingCell;if(c.key==="Enter"){if(c.preventDefault(),V)Oe.stopCellEdit();else if(be.find(fe=>fe.field===L)?.editable){const fe=ye.find(Ce=>Ce.id===N);fe&&Oe.startCellEdit({id:N,field:L,value:fe[L]})}return}if((c.key===" "||c.key==="Spacebar")&&!V){if(L==="__checkbox_col__"){c.preventDefault(),Vt(N,!Ee.has(N));return}if(L==="__expand_col__"){c.preventDefault(),ln(N);return}}if(N==="HEADER"&&(c.key==="Enter"||c.key===" ")){c.preventDefault();const G=be.find(fe=>fe.field===L);if(G&&G.sortable!==!1){const fe=Ze.find(me=>me.field===L);let Ce="asc";fe&&(fe.sort==="asc"?Ce="desc":Ce=null),To(L,Ce)}return}if(c.key==="Escape"){V&&(c.preventDefault(),Oe.stopCellEdit({cancel:!0}));return}if(V&&c.key!=="Tab")return;const re=N==="HEADER",ce=re?-1:ye.findIndex(G=>G.id===N),we=be.findIndex(G=>G.field===L);if(!re&&ce===-1||we===-1)return;const Ue=(G,fe,Ce,me,Ie,Pe=!1)=>{let ue=G+Ce,de=fe+me;return Ie&&me!==0&&(me>0&&de>=be.length?(de=0,ue++):me<0&&de<0&&(de=be.length-1,ue--)),!Ie&&(de<0||de>=be.length)||ue<(Pe?-1:0)||ue>=ye.length?null:{r:ue,c:de}},He=(G,fe,Ce,me,Ie,Pe=!1)=>{let ue=G,de=fe,ht=0;const lt=ye.length*be.length+be.length;for(;ht<lt;){if(ht++,ue+=Ce,de+=me,me!==0)me>0?de>=be.length&&(de=0,ue++):de<0&&(de=be.length-1,ue--);else if(de<0||de>=be.length)return null;if(ue<-1||ue>=ye.length)return null;if(ue===-1){if(!Pe)continue;const Te=be[de],st=Te.sortable!==!1;if(["__checkbox_col__"].includes(Te.field)||st)return{r:ue,c:de};continue}const Re=ye[ue],ke=be[de],Fe=["__checkbox_col__","__expand_col__","__reorder_col__"].includes(ke.field);let De=ke.editable||Fe;if(U&&!Fe)try{De=U({row:Re,field:ke.field,value:Re[ke.field],colDef:ke,rowIndex:ue,colIndex:de})}catch(Te){console.error("Error in isCellEditable:",Te)}if(De)return{r:ue,c:de}}return null};let ie=ce,pe=we,le=!1;if(c.key==="Tab"){const G=c.shiftKey?-1:1,fe=He(ce,we,0,G,!0,!1);fe&&(ie=fe.r,pe=fe.c,le=!0)}else if(c.key==="ArrowRight"){const G=Ue(ce,we,0,1,!0,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(c.key==="ArrowLeft"){const G=Ue(ce,we,0,-1,!0,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(c.key==="ArrowDown"){const G=Ue(ce,we,1,0,!1,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(c.key==="ArrowUp"){const G=Ue(ce,we,-1,0,!1,!0);G&&(ie=G.r,pe=G.c,le=!0)}else if(c.key==="Home")(c.ctrlKey||c.metaKey)&&(ie=-1),pe=0,le=!0;else if(c.key==="End")(c.ctrlKey||c.metaKey)&&(ie=ye.length-1),pe=be.length-1,le=!0;else if(c.key==="PageUp"){const G=Ne?ge.pageSize:10;ie=Math.max(-1,ie-G),le=!0}else if(c.key==="PageDown"){const G=Ne?ge.pageSize:10;ie=Math.min(ye.length-1,ie+G),le=!0}if(le&&(c.preventDefault(),V&&c.key==="Tab"&&Oe.stopCellEdit(),ie>=-1&&ie<ye.length&&pe>=0&&pe<be.length)){const G=be[pe];if(ie===-1)Ft({id:"HEADER",field:G.field});else{const fe=ye[ie];Ft({id:fe.id,field:G.field})}if(Et.current){const{cumulativeHeights:fe,pinnedTopHeight:Ce}=_e,{clientHeight:me,clientWidth:Ie,scrollTop:Pe,scrollLeft:ue}=Et.current,de=ie===0?0:fe[ie-1],ht=fe[ie],lt=Ce,Re=Pe+lt,ke=Pe+me;let Fe=Pe;if(de<Re?Fe=Math.max(0,de-lt):ht>ke&&(Fe=ht-me),Fe!==Pe&&(Et.current.scrollTop=Fe),_e.columnMetrics){const{leftPinnedWidth:De,rightPinnedWidth:Te,unpinnedAccWidths:st,unpinnedCols:Ct,totalSpecialsWidth:pt,pinnedSpecialsWidth:sn}=_e.columnMetrics,Ut=G.field,xt=Ct.findIndex(Ke=>Ke.field===Ut);if(xt!==-1){const Ke=pt+De+(xt>0?st[xt-1]:0),Nt=pt+De+st[xt],Kt=ue+sn+De,yt=ue+Ie-Te;let Je=ue;Ke<Kt?Je=Math.max(0,Ke-sn-De):Nt>yt&&(Je=Nt-Ie+Te),Je!==ue&&(Et.current.scrollLeft=Je)}}}}},[Xe,ye,be,Oe,_e,Ee,Vt,ln]),il=l.useMemo(()=>Le.some(c=>!!c.rowSpan),[Le]),[vn,_n]=l.useState(!1),Yn=l.useRef(null);return l.useEffect(()=>{if(!vn||je?.toolbar)return;function c(N){const L=document.getElementById("ogx-standalone-col-panel");L&&!L.contains(N.target)&&_n(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[vn,je?.toolbar]),t.jsxs("div",{ref:Yn,className:`ogx ${en} ${d?"ogx--auto-height":""} ${il?"ogx--row-spanning":""} ${cn?"ogx--list-view":""}`,style:{...Lt,height:q??Lt?.height,"--ogx-row-height":`${i}px`,"--ogx-header-height":`${s}px`},"aria-busy":on,children:[bo&&(()=>{const c={apiRef:ot.apiRef,columns:Le,aggregationModel:et,onAggregationModelChange:ji,...Be?{pivotModel:wo,onPivotModelChange:Ri}:{},filterModel:Ge,onFilterModelChange:h,columnVisibilityModel:Ye,onColumnVisibilityModelChange:tn,forceColumnsOpen:vn,onColumnsPanelClose:()=>_n(!1),...ct?.toolbar};return t.jsx(bo,{...c})})(),!je?.toolbar&&vn&&kt.createPortal(t.jsxs("div",{id:"ogx-standalone-col-panel",style:(()=>{const c=Yn.current?.getBoundingClientRect();return{position:"fixed",top:c?c.top+8:16,right:c?window.innerWidth-c.right+8:16,zIndex:9999,display:"inline-block"}})(),children:[t.jsx("button",{onClick:()=>_n(!1),style:{position:"absolute",top:-12,right:-12,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",background:"#334155",color:"#fff",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:14,lineHeight:1,zIndex:1,boxShadow:"0 1px 4px rgba(0,0,0,0.2)"},"aria-label":"Close",children:"×"}),t.jsx(so,{columns:Le,visibleColumns:new Set(Le.filter(c=>Ye[c.field]!==!1).map(c=>c.field)),onVisibilityChange:(c,N)=>{tn({...Ye,[c]:N})},onShowAll:()=>{const c={...Ye};Le.forEach(N=>{N.hideable!==!1&&(c[N.field]=!0)}),tn(c)},onHideAll:()=>{const c={...Ye};Le.forEach(N=>{N.hideable!==!1&&(c[N.field]=!1)}),tn(c)}})]}),document.body),cn&&mo&&t.jsxs("div",{className:"ogx-list-view",role:"grid","aria-label":Rt||"Data grid list view","aria-rowcount":ye.length+1,children:[t.jsx("div",{className:"ogx-list-view__toolbar",children:t.jsxs("span",{children:[$e.length," ",$e.length===1?"item":"items",Ne?` · page ${ge.page+1} of ${Math.ceil($e.length/ge.pageSize)||1}`:"",Ee.size>0?` · ${Ee.size} selected`:""]})}),t.jsx("div",{className:"ogx-list-view__rows",children:ye.length===0?t.jsxs("div",{className:"ogx-list-view__empty","aria-live":"polite",role:"status",children:[t.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("path",{d:"M3 9h18M9 21V9"})]}),In]}):ye.map((c,N)=>t.jsx(Ao,{row:c,rowIndex:N,listViewColumn:mo,isSelected:Ee.has(c.id),checkboxSelection:a,rowHeight:i,onRowClick:L=>mn({row:L,id:L.id,rowIndex:N}),onSelectionChange:Vt},c.id))}),Ne&&(()=>{const c=je?.pagination||ro,N=z==="server"&&ne?ae.pagination.rowCount||0:$e.length,L={page:ge.page,pageSize:ge.pageSize,rowCount:N,pageSizeOptions:C,onPageChange:V=>gn({...ge,page:V}),onPageSizeChange:V=>gn({...ge,pageSize:V,page:0}),...ct?.pagination};return t.jsx(c,{...L})})()]}),!cn&&t.jsx("div",{ref:c=>{Et.current=c,hn.current=c},className:"ogx__viewport",onScroll:Qi,role:"grid","aria-label":Rt||"Data grid","aria-rowcount":$e.length+1,"aria-colcount":e.length+(a?1:0)+(qe?1:0)+(D?1:0),"aria-busy":on,tabIndex:0,onKeyDownCapture:()=>{Wt(!0)},onMouseDownCapture:()=>{Wt(!1)},onKeyDown:rl,onFocus:nl,onBlur:ol,children:t.jsxs("div",{ref:zi,className:"ogx__content",style:{width:_e.totalWidth},role:"presentation",children:[t.jsx(to,{columns:_e.virtualColumns,allColumns:Le,columnGroupingModel:jt,checkboxSelection:a,allSelected:el,someSelected:tl,onSelectAll:Zi,sortModel:Ze,onSort:To,onColumnResize:Ji,columnWidths:rt,pinnedColumns:tt,focusedCell:Xe,onHeaderClick:c=>{Ft({id:"HEADER",field:c}),Wt(!1),hn.current?.focus({preventScroll:!0})},onDragStart:jt?void 0:$t.onDragStart,onDragOver:jt?void 0:$t.onDragOver,onDragEnd:jt?void 0:$t.onDragEnd,onDrop:jt?void 0:$t.onDrop,draggedColumn:jt?void 0:$t.draggedColumn,dragOverColumn:jt?void 0:$t.dragOverColumn,rowReordering:D,hasDetailPanel:qe,pinCheckboxColumn:R,pinExpandColumn:B,aggregationModel:et,onHideColumn:c=>{tn({...Ye,[c]:!1})},onManageColumns:()=>_n(!0),onPinColumn:(c,N)=>{const L=[...tt?.left??[]],V=[...tt?.right??[]],re=L.filter(we=>we!==c),ce=V.filter(we=>we!==c);On(N==="left"?{left:[...re,c],right:ce}:N==="right"?{left:re,right:[...ce,c]}:{left:re,right:ce})}}),!on&&!ae.dataSource.error&&$e.length===0&&t.jsxs("div",{className:"ogx__empty",style:{width:_e.totalWidth},children:[t.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("path",{d:"M3 9h18M9 21V9"})]}),t.jsx("span",{children:In})]}),Ve.length>0&&t.jsx("div",{className:"ogx__pinned-rows ogx__pinned-rows--top",role:"rowgroup",children:Ve.map((c,N)=>t.jsx(Jt,{row:c,columns:_e.virtualColumns,rowIndex:N,isSelected:Ee.has(c.id),checkboxSelection:a,onRowClick:mn,onCellClick:Kn,onSelectionChange:Vt,columnWidths:rt,pinnedColumns:tt,pinnedRows:y,hasDetailPanel:qe,isDetailPanelExpanded:_t.has(c.id),detailPanelContent:P?P({row:c,id:c.id,rowIndex:N}):null,detailPanelHeight:k?.({row:c,id:c.id,rowIndex:N})||200,onDetailPanelToggle:ln,pinCheckboxColumn:R,pinExpandColumn:B,focusedCellField:Xe?.id===c.id?Xe.field:null,colspanMap:Gt.colspanMap,rowSpanningCaches:Gt.rowSpanningState.caches,rowHeight:i},c.id))}),t.jsx("div",{className:"ogx__virtual-container",style:{height:`${_e.totalHeight-_e.pinnedTopHeight-_e.pinnedBottomHeight}px`},role:"presentation",children:t.jsxs("div",{className:"ogx__rows",style:{transform:`translateY(${_e.renderContext.firstRowIndex*i}px)`},role:"rowgroup",children:[on&&Ro.length===0?(()=>{const c=e.length>0?e:(()=>{const N=(ae.dimensions.viewportWidth||1e3)-(a?48:0)-(P?48:0)-(D?48:0),L=150,V=Math.max(1,Math.ceil(N/L));return Array.from({length:V},(re,ce)=>({field:`placeholder_${ce}`,headerName:"",width:L}))})();return Array.from({length:10}).map((N,L)=>t.jsx(cr,{columns:c,rowHeight:i,checkboxSelection:a,hasDetailPanel:!!P,rowReordering:D},`skeleton-${L}`))})():Ro.filter(({row:c})=>!Sn(c.id,y)).filter((c,N,L)=>N===L.findIndex(V=>V.row.id===c.row.id)).map(({row:c,rowIndex:N})=>t.jsx(Jt,{row:c,columns:_e.virtualColumns,rowIndex:N,isSelected:Ee.has(c.id),checkboxSelection:a,onRowClick:mn,onCellClick:Kn,onSelectionChange:Vt,columnWidths:rt,pinnedColumns:tt,pinnedRows:y,hasDetailPanel:qe,isDetailPanelExpanded:_t.has(c.id),detailPanelContent:P?P({row:c,id:c.id,rowIndex:N}):null,detailPanelHeight:k?.({row:c,id:c.id,rowIndex:N})||200,onDetailPanelToggle:ln,pinCheckboxColumn:R,pinExpandColumn:B,rowReordering:D,onDragStart:Dt.onDragStart,onDragOver:Dt.onDragOver,onDragEnd:Dt.onDragEnd,onDrop:Dt.onDrop,isDragging:Dt.draggedRowId===c.id,isDragOver:Dt.dragOverRowId===c.id,editingCell:Oe.editingCell,onEditStart:Oe.startCellEdit,onEditStop:Oe.stopCellEdit,onEditCellValueChange:Oe.setEditCellValue,focusedCellField:Xe!=null&&Xe.id===c.id?Xe.field:null,colspanMap:Gt.colspanMap,rowSpanningCaches:Gt.rowSpanningState.caches,rowHeight:i},`${c.id}-${_e.totalWidth}`)),z==="infinite"&&ae.dataSource.loading&&Me.length>0&&(()=>{const c=Math.min(ge.pageSize,20),N=Un.unpinnedRowsLength;return t.jsx("div",{className:"ogx__skeleton-group",children:Array.from({length:c}).map((L,V)=>t.jsx(Jt,{row:{id:`__skeleton_${V}__`,_isSkeleton:!0},columns:_e.virtualColumns,rowIndex:N+V,rowHeight:i},`__skeleton_${V}__`))})})()]})}),it.length>0&&t.jsx("div",{className:"ogx__pinned-rows ogx__pinned-rows--bottom",role:"rowgroup",children:it.map((c,N)=>t.jsx(Jt,{row:c,columns:_e.virtualColumns,rowIndex:N,isSelected:Ee.has(c.id),checkboxSelection:a,onRowClick:mn,onCellClick:Kn,onSelectionChange:Vt,columnWidths:rt,pinnedColumns:tt,pinnedRows:y,hasDetailPanel:qe,isDetailPanelExpanded:_t.has(c.id),detailPanelContent:P?P({row:c,id:c.id,rowIndex:N}):null,detailPanelHeight:k?.({row:c,id:c.id,rowIndex:N})||200,onDetailPanelToggle:ln,pinCheckboxColumn:R,pinExpandColumn:B,focusedCellField:Xe?.id===c.id?Xe.field:null,colspanMap:Gt.colspanMap,rowSpanningCaches:Gt.rowSpanningState.caches,rowHeight:i},c.id))}),wn&&t.jsxs("div",{className:"ogx__aggregation-footer",role:"row","aria-label":"Aggregation totals","aria-live":"polite",style:{minHeight:`${i}px`},children:[a&&t.jsx("div",{style:{width:48,flexShrink:0}}),qe&&t.jsx("div",{style:{width:48,flexShrink:0}}),D&&t.jsx("div",{style:{width:48,flexShrink:0}}),Bt.map(c=>{const N=et[c.field],L=Vn[c.field],V=rt[c.field]??(typeof c.width=="number"?c.width:120);return t.jsx("div",{className:"ogx__aggregation-cell",role:"gridcell",style:{width:V,minWidth:V,maxWidth:V,textAlign:c.align||"left"},children:N?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ogx__aggregation-label",children:N}),t.jsx("span",{className:"ogx__aggregation-value",children:bt(L,N)})]}):null},c.field)})]})]})}),!cn&&Ne&&(()=>{const c=je?.pagination||ro,N={page:ge.page,pageSize:ge.pageSize,rowCount:ae.pagination.rowCount,pageSizeOptions:C,onPageChange:L=>gn({...ge,page:L}),onPageSizeChange:L=>gn({...ge,pageSize:L,page:0}),...ct?.pagination};return t.jsx(c,{...N})})(),t.jsxs("div",{className:"ogx-aria-live-status",role:"status","aria-live":"polite",children:[on?"Loading data...":"",ae.dataSource.error?`Error: ${ae.dataSource.error.message||"Unknown error"}`:"",!J&&!ae.dataSource.error&&($e.length===0?In:Ge&&((Ge.quickFilterValues?.length||0)>0||(Ge.items?.length||0)>0)?`${$e.length} ${$e.length===1?"row":"rows"} found`:"")]}),ae.dataSource.error&&t.jsxs("div",{className:"ogx-error-overlay","aria-live":"assertive",role:"alert",children:[t.jsxs("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"var(--ogx-color-error)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),t.jsx("div",{className:"ogx-error-overlay__title",children:"Oops! Something went wrong"}),t.jsx("div",{className:"ogx-error-overlay__message",children:ae.dataSource.error.message||"An unexpected error occurred while loading the data."}),t.jsx("button",{onClick:()=>window.location.reload(),className:"ogx-button ogx-button--primary",children:"Retry"})]})]})}function Fr({rows:n=5,columns:o=5}){return t.jsx("div",{className:"ogx__skeleton",children:Array.from({length:n}).map((e,r)=>t.jsx("div",{className:"ogx__skeleton-row",children:Array.from({length:o}).map((i,s)=>t.jsx("div",{className:"ogx__skeleton-cell",children:t.jsx("div",{className:"ogx__skeleton-content"})},s))},r))})}const ao=new Set(["isEmpty","isNotEmpty"]);function Wr(n,o){return n.find(e=>"field"in e&&e.field===o)}const Or=({col:n,item:o,onChange:e})=>{const r=vr(n.type),i=!!o,s=o?.operator??r[0],d=u=>{const h=ao.has(u),w={id:o?.id??`${n.field}-${Date.now()}`,field:n.field,operator:u,value:h?void 0:o?.value??(n.type==="boolean"?"true":"")};e(w)},a=u=>{e({id:o?.id??`${n.field}-${Date.now()}`,field:n.field,operator:s,value:u})},f=()=>{e(null)},g=ao.has(String(s)),p=n.type==="boolean",b=!g;return t.jsxs("div",{className:`ogx-filter__row${i?" ogx-filter__row--active":""}`,children:[t.jsx("span",{className:"ogx-filter__col-label",title:n.field,children:n.headerName||n.field}),t.jsxs("div",{className:"ogx-filter__controls",children:[t.jsx("select",{id:`ogx-filter-op-${n.field}`,name:`filter-op-${n.field}`,className:`ogx-filter__op-select${i?" ogx-filter__op-select--active":""}`,value:String(s),onChange:u=>d(u.target.value),"aria-label":`Filter operator for ${n.headerName||n.field}`,children:r.map(u=>t.jsx("option",{value:u,children:u},u))}),b&&p&&t.jsxs("select",{id:`ogx-filter-val-${n.field}`,name:`filter-val-${n.field}`,className:`ogx-filter__value-input ogx-filter__value-select${i?" ogx-filter__value-input--active":""}`,value:String(o?.value??"true"),onChange:u=>a(u.target.value),"aria-label":`Filter value for ${n.headerName||n.field}`,children:[t.jsx("option",{value:"true",children:"true"}),t.jsx("option",{value:"false",children:"false"})]}),b&&!p&&t.jsx("input",{id:`ogx-filter-val-${n.field}`,name:`filter-val-${n.field}`,className:`ogx-filter__value-input${i?" ogx-filter__value-input--active":""}`,type:n.type==="number"?"number":"text",value:o?.value??"",onChange:u=>a(u.target.value),placeholder:"Value…","aria-label":`Filter value for ${n.headerName||n.field}`}),i&&t.jsx("button",{className:"ogx-filter__row-clear",onClick:f,"aria-label":`Clear filter for ${n.headerName||n.field}`,title:"Clear",children:"×"})]})]})},co=({filterModel:n,columns:o,onFilterModelChange:e})=>{const r=n.items??[],i=n.logicOperator??"and",s=l.useCallback((f,g)=>{const p=r.filter(u=>"field"in u&&u.field!==f),b=g?[...p,g]:p;e({...n,items:b})},[r,n,e]),d=l.useCallback(f=>{e({...n,logicOperator:f})},[n,e]),a=o.filter(f=>f.filterable!==!1);return t.jsxs(t.Fragment,{children:[r.length>1&&t.jsxs("div",{className:"ogx-filter__logic-bar",children:[t.jsx("span",{className:"ogx-filter__logic-label",children:"Match:"}),t.jsx("button",{className:`ogx-filter__logic-pill${i==="and"?" ogx-filter__logic-pill--active":""}`,onClick:()=>d("and"),"aria-pressed":i==="and",children:"ALL (AND)"}),t.jsx("button",{className:`ogx-filter__logic-pill${i==="or"?" ogx-filter__logic-pill--active":""}`,onClick:()=>d("or"),"aria-pressed":i==="or",children:"ANY (OR)"})]}),a.length===0?t.jsx("div",{className:"ogx-filter__empty",children:"No filterable columns."}):a.map(f=>t.jsx(Or,{col:f,item:Wr(r,f.field),onChange:g=>s(f.field,g)},f.field))]})},Ar=["sum","avg","count","min","max"];function uo(){return t.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),t.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",fill:"currentColor",opacity:"0.25"}),t.jsx("path",{d:"M17 14v-4M17 10l-2 2 2 2"})]})}function zr({anchorRef:n,columns:o,model:e,onChange:r,onClose:i}){const s=l.useRef(null),[d,a]=l.useState({top:0,right:0}),f=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const x=n.current.getBoundingClientRect();return{top:x.bottom+6,right:window.innerWidth-x.right}},[n]);l.useEffect(()=>{a(f());const x=()=>a(f());return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[f]),l.useEffect(()=>{function x(R){s.current&&!s.current.contains(R.target)&&n.current&&!n.current.contains(R.target)&&i()}function S(R){R.key==="Escape"&&i()}return document.addEventListener("mousedown",x),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",S)}},[n,i]);const g=new Set(e.rowFields),p=new Set(e.columnFields),b=new Set(e.valueFields.map(x=>x.field)),u=x=>g.has(x)||p.has(x)||b.has(x);function h(x){g.has(x)||r({...e,rowFields:[...e.rowFields,x]})}function w(x){p.has(x)||r({...e,columnFields:[...e.columnFields,x]})}function m(x,S="sum"){b.has(x)||r({...e,valueFields:[...e.valueFields,{field:x,aggFn:S}]})}function I(x){r({...e,rowFields:e.rowFields.filter(S=>S!==x)})}function M(x){r({...e,columnFields:e.columnFields.filter(S=>S!==x)})}function E(x){r({...e,valueFields:e.valueFields.filter(S=>S.field!==x)})}function C(x,S){r({...e,valueFields:e.valueFields.map(R=>R.field===x?{...R,aggFn:S}:R)})}function _(){r({rowFields:[],columnFields:[],valueFields:[]})}const j=new Set(o.filter(x=>x.type==="number"||x.aggregable).map(x=>x.field)),y=e.rowFields.length+e.columnFields.length+e.valueFields.length,P=x=>o.find(S=>S.field===x)?.headerName??x,k=t.jsxs("div",{ref:s,className:"ogx-pivot-panel",role:"dialog","aria-label":"Pivot configuration",style:{top:d.top,right:d.right},children:[t.jsxs("div",{className:"ogx-pivot-panel__header",children:[t.jsxs("span",{className:"ogx-pivot-panel__title",children:[t.jsx(uo,{}),"Pivot Mode"]}),y>0&&t.jsx("button",{className:"ogx-pivot-panel__reset-btn",onClick:_,title:"Reset pivot",children:"Reset"})]}),t.jsxs("div",{className:"ogx-pivot-panel__body",children:[t.jsxs("div",{className:"ogx-pivot-zone",children:[t.jsxs("span",{className:"ogx-pivot-zone__label",children:[t.jsx("span",{className:"ogx-pivot-zone__dot ogx-pivot-zone__dot--row"}),"Row Fields"]}),t.jsx("div",{className:`ogx-pivot-chips${e.rowFields.length===0?" ogx-pivot-chips--empty":""}`,"data-placeholder":"Add fields here — each becomes a row label",children:e.rowFields.map(x=>t.jsxs("span",{className:"ogx-pivot-chip ogx-pivot-chip--row",children:[P(x),t.jsx("button",{className:"ogx-pivot-chip__remove",onClick:()=>I(x),title:`Remove ${P(x)}`,children:"×"})]},x))})]}),t.jsxs("div",{className:"ogx-pivot-zone",children:[t.jsxs("span",{className:"ogx-pivot-zone__label",children:[t.jsx("span",{className:"ogx-pivot-zone__dot ogx-pivot-zone__dot--col"}),"Column Fields"]}),t.jsx("div",{className:`ogx-pivot-chips${e.columnFields.length===0?" ogx-pivot-chips--empty":""}`,"data-placeholder":"Add fields here — unique values become column headers",children:e.columnFields.map(x=>t.jsxs("span",{className:"ogx-pivot-chip ogx-pivot-chip--col",children:[P(x),t.jsx("button",{className:"ogx-pivot-chip__remove",onClick:()=>M(x),title:`Remove ${P(x)}`,children:"×"})]},x))})]}),t.jsxs("div",{className:"ogx-pivot-zone",children:[t.jsxs("span",{className:"ogx-pivot-zone__label",children:[t.jsx("span",{className:"ogx-pivot-zone__dot ogx-pivot-zone__dot--value"}),"Value Fields (aggregated)"]}),t.jsx("div",{className:`ogx-pivot-chips${e.valueFields.length===0?" ogx-pivot-chips--empty":""}`,"data-placeholder":"Add numeric fields here — values are aggregated",children:e.valueFields.map(x=>t.jsxs("span",{className:"ogx-pivot-chip ogx-pivot-chip--value",children:[P(x.field),t.jsx("select",{className:"ogx-pivot-chip__fn-select",value:x.aggFn,onChange:S=>C(x.field,S.target.value),title:"Aggregation function",children:Ar.map(S=>t.jsx("option",{value:S,children:S.toUpperCase()},S))}),t.jsx("button",{className:"ogx-pivot-chip__remove",onClick:()=>E(x.field),title:`Remove ${P(x.field)}`,children:"×"})]},x.field))})]}),t.jsx("hr",{className:"ogx-pivot-panel__divider"}),t.jsxs("div",{children:[t.jsx("div",{className:"ogx-pivot-panel__fields-label",children:"Available Fields"}),t.jsxs("div",{className:"ogx-pivot-fields",children:[o.map(x=>{const S=j.has(x.field);return u(x.field)?null:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:3},children:[t.jsx("span",{className:`ogx-pivot-field-btn${S?" ogx-pivot-field-btn--numeric":""}`,children:x.headerName??x.field}),t.jsxs("div",{className:"ogx-pivot-field-actions",children:[t.jsx("button",{className:"ogx-pivot-add-btn ogx-pivot-add-btn--row",onClick:()=>h(x.field),title:"Add to Row Fields",children:"Row"}),t.jsx("button",{className:"ogx-pivot-add-btn ogx-pivot-add-btn--col",onClick:()=>w(x.field),title:"Add to Column Fields",children:"Col"}),S&&t.jsx("button",{className:"ogx-pivot-add-btn ogx-pivot-add-btn--value",onClick:()=>m(x.field),title:"Add to Value Fields",children:"Val"})]})]},x.field)}),o.every(x=>u(x.field))&&t.jsx("span",{style:{fontSize:12,color:"var(--ogx-color-gray-400, #94a3b8)"},children:"All fields are in use."})]})]})]})]});return kt.createPortal(k,document.body)}function Br(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function $r(){return t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Hr({value:n="",onChange:o,placeholder:e="Search...",debounceMs:r=250}){const[i,s]=l.useState(!1),[d,a]=l.useState(n),f=l.useRef(null),g=l.useRef(null);l.useEffect(()=>{a(n),n&&!i&&s(!0)},[n,i]),l.useEffect(()=>{const h=setTimeout(()=>{d!==n&&o(d)},r);return()=>clearTimeout(h)},[d,o,r,n]);const p=()=>{s(!0)},b=h=>{h.stopPropagation(),a(""),f.current?.focus(),o("")},u=()=>{d||s(!1)};return l.useEffect(()=>{const h=w=>{g.current&&!g.current.contains(w.target)&&(d||s(!1))};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[d]),t.jsxs("div",{ref:g,className:`ogx-global-search${i?" ogx-global-search--expanded":""}`,onClick:()=>{i||(s(!0),setTimeout(()=>f.current?.focus(),50))},children:[t.jsx("div",{className:"ogx-global-search__icon-wrapper",children:t.jsx(Br,{})}),t.jsx("input",{ref:f,id:"ogx-global-search-input",name:"ogx-global-search",className:"ogx-global-search__input",value:d,onChange:h=>a(h.target.value),onFocus:p,onBlur:u,placeholder:e,"aria-label":"Global Search",autoComplete:"off"}),d&&t.jsx("button",{className:"ogx-global-search__clear",onClick:b,"aria-label":"Clear search",children:t.jsx($r,{})})]})}function Zt({title:n,children:o,placement:e="top",enterDelay:r=200,leaveDelay:i=0}){const[s,d]=l.useState(!1),[a,f]=l.useState({top:0,left:0}),g=l.useRef(null),p=l.useRef(null),b=l.useCallback(()=>{if(!p.current)return;const m=p.current.getBoundingClientRect();let I=0,M=0;const E=window.pageXOffset||document.documentElement.scrollLeft,C=window.pageYOffset||document.documentElement.scrollTop;e==="top"?(I=m.top+C-8,M=m.left+E+m.width/2):e==="bottom"&&(I=m.bottom+C+8,M=m.left+E+m.width/2),f({top:I,left:M})},[e]);l.useLayoutEffect(()=>(s&&(b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b)),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}),[s,b]);const u=()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(!0)},r)},h=()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(!1)},i)},w=l.useCallback(m=>{p.current=m?m.firstElementChild??m:null},[]);return t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:w,style:{display:"inline-block",lineHeight:0},onMouseEnter:u,onMouseLeave:h,children:o}),s&&n&&kt.createPortal(t.jsx("div",{className:`ogx-tooltip ogx-tooltip--${e}`,style:{top:a.top,left:a.left,position:"absolute",zIndex:99999},children:n}),document.body)]})}const Dr=["none","sum","avg","count","min","max"];function go(){return t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M18 4H6l6 8-6 8h12"})})}function Gr(){return t.jsxs("svg",{focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",children:[t.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("rect",{x:"8.5",y:"4",width:"7",height:"16",fill:"currentColor",opacity:"0.25"}),t.jsx("line",{x1:"8.5",y1:"4",x2:"8.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"15.5",y1:"4",x2:"15.5",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("line",{x1:"2",y1:"9",x2:"22",y2:"9",stroke:"currentColor",strokeWidth:"1.2"}),t.jsx("line",{x1:"2",y1:"14",x2:"22",y2:"14",stroke:"currentColor",strokeWidth:"1.2"})]})}function fo(){return t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}function Vr({anchorRef:n,aggregationModel:o,aggregableColumns:e,onFunctionChange:r,onClearAll:i,onClose:s,activeCount:d}){const a=l.useRef(null),[f,g]=l.useState({top:0,right:0}),p=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const u=n.current.getBoundingClientRect();return{top:u.bottom+6,right:window.innerWidth-u.right}},[n]);l.useEffect(()=>{g(p());const u=()=>g(p());return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[p]),l.useEffect(()=>{function u(h){a.current&&!a.current.contains(h.target)&&n.current&&!n.current.contains(h.target)&&s()}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n,s]),l.useEffect(()=>{function u(h){h.key==="Escape"&&s()}return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s]);const b=t.jsxs("div",{ref:a,className:"ogx-toolbar__panel",role:"dialog","aria-label":"Summaries configuration",style:{top:f.top,right:f.right,width:400,maxWidth:"calc(100vw - 24px)"},children:[t.jsxs("div",{className:"ogx-toolbar__panel-header",children:[t.jsxs("span",{className:"ogx-toolbar__panel-title",children:[t.jsx(go,{}),"Summaries"]}),d>0&&t.jsx("button",{className:"ogx-toolbar__clear-btn",onClick:i,title:"Clear all summaries",children:"Clear all"})]}),t.jsx("div",{className:"ogx-toolbar__panel-body",children:e.length===0?t.jsxs("p",{className:"ogx-toolbar__empty",children:["No aggregable columns.",t.jsx("br",{}),"Set ",t.jsx("code",{children:"aggregable: true"})," on a column to enable."]}):e.map(u=>{const h=o[u.field]||"none";return t.jsxs("div",{className:"ogx-toolbar__agg-row",children:[t.jsx("span",{className:"ogx-toolbar__agg-label",title:u.field,children:u.headerName||u.field}),t.jsx("div",{className:"ogx-toolbar__agg-pills",children:Dr.map(w=>t.jsx("button",{className:`ogx-toolbar__pill${h===w?" ogx-toolbar__pill--active":""}`,onClick:()=>r(u.field,w),"aria-pressed":h===w,children:w},w))})]},u.field)})})]});return kt.createPortal(b,document.body)}function Ur({anchorRef:n,columns:o,visibleColumns:e,onVisibilityChange:r,onShowAll:i,onHideAll:s,onClose:d}){const a=l.useRef(null),[f,g]=l.useState({top:0,right:0}),p=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const u=n.current.getBoundingClientRect();return{top:u.bottom+6,right:window.innerWidth-u.right}},[n]);l.useEffect(()=>{g(p());const u=()=>g(p());return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[p]),l.useEffect(()=>{function u(h){a.current&&!a.current.contains(h.target)&&n.current&&!n.current.contains(h.target)&&d()}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n,d]);const b=t.jsx("div",{ref:a,className:"ogx-toolbar__panel",role:"dialog","aria-label":"Column visibility",style:{top:f.top,right:f.right,width:280,padding:0},children:t.jsx(so,{columns:o,visibleColumns:e,onVisibilityChange:r,onShowAll:i,onHideAll:s})});return kt.createPortal(b,document.body)}function Kr({anchorRef:n,columns:o,filterModel:e,onFilterModelChange:r,onClose:i}){const s=l.useRef(null),[d,a]=l.useState({top:0,right:0}),f=l.useCallback(()=>{if(!n.current)return{top:0,right:0};const u=n.current.getBoundingClientRect();return{top:u.bottom+6,right:window.innerWidth-u.right}},[n]);l.useEffect(()=>{a(f());const u=()=>a(f());return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[f]),l.useEffect(()=>{function u(w){s.current&&!s.current.contains(w.target)&&n.current&&!n.current.contains(w.target)&&i()}function h(w){w.key==="Escape"&&i()}return document.addEventListener("mousedown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",h)}},[n,i]);const g=e.items?.length??0,p=()=>{r({...e,items:[],logicOperator:"and"})},b=t.jsxs("div",{ref:s,className:"ogx-toolbar__panel ogx-toolbar__panel--filter",role:"dialog","aria-label":"Advanced filters",style:{top:d.top,right:d.right,width:540,maxWidth:"calc(100vw - 24px)"},children:[t.jsxs("div",{className:"ogx-toolbar__panel-header",children:[t.jsxs("span",{className:"ogx-toolbar__panel-title",children:[t.jsx(fo,{}),"Filters",g>0&&t.jsx("span",{className:"ogx-toolbar__panel-count",children:g})]}),g>0&&t.jsx("button",{className:"ogx-toolbar__clear-btn",onClick:p,title:"Clear all filters",children:"Clear all"})]}),t.jsx("div",{className:"ogx-toolbar__panel-body ogx-toolbar__panel-body--filter",children:t.jsx(co,{columns:o,filterModel:e,onFilterModelChange:r})})]});return kt.createPortal(b,document.body)}const Yr={rowFields:[],columnFields:[],valueFields:[]};function Xr({columns:n=[],aggregationModel:o={},onAggregationModelChange:e,pivotModel:r,onPivotModelChange:i,filterModel:s,onFilterModelChange:d,columnVisibilityModel:a={},onColumnVisibilityModelChange:f,forceColumnsOpen:g,onColumnsPanelClose:p,children:b,rightContent:u,style:h}){const[w,m]=l.useState(!1),[I,M]=l.useState(!1),[E,C]=l.useState(!1),[_,j]=l.useState(!1);l.useEffect(()=>{g&&(C(!0),m(!1),M(!1),j(!1))},[g]);const y=l.useRef(null),P=l.useRef(null),k=l.useRef(null),x=l.useRef(null),S=r??Yr,R=S.rowFields.length>0||S.columnFields.length>0||S.valueFields.length>0,B=n.filter(F=>F.aggregable!==!1&&(F.type==="number"||F.aggregable===!0)),Y=Object.keys(o).filter(F=>o[F]&&o[F]!=="none").length,$=l.useCallback((F,A)=>{if(!e)return;const O={...o};A==="none"?delete O[F]:O[F]=A,e(O)},[o,e]),K=l.useCallback(()=>{e?.({})},[e]),q=l.useCallback(F=>{if(!d)return;const O={...s||{},quickFilterValues:F?[F]:[],items:s?.items||[]};d(O)},[s,d]),D=s?.quickFilterValues?.[0]||"",Z=s?.items?.length||0,J=new Set(n.filter(F=>a[F.field]!==!1).map(F=>F.field)),he=l.useCallback((F,A)=>{if(!f)return;const O={...a,[F]:A};f(O)},[a,f]),v=l.useCallback(()=>{if(!f)return;const F={...a};n.forEach(A=>{A.hideable!==!1&&(F[A.field]=!0)}),f(F)},[n,a,f]),H=l.useCallback(()=>{if(!f)return;const F={...a};n.forEach(A=>{A.hideable!==!1&&(F[A.field]=!1)}),f(F)},[n,a,f]);return t.jsxs("div",{className:"ogx-toolbar",role:"toolbar","aria-label":"Grid toolbar",style:h,children:[b&&t.jsx("div",{className:"ogx-toolbar__left",children:b}),t.jsx("div",{className:"ogx-toolbar__spacer"}),t.jsxs("div",{className:"ogx-toolbar__actions",children:[d&&t.jsx("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:t.jsx(Hr,{value:D,onChange:q,placeholder:"Search..."})}),f&&t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Columns",children:t.jsx("button",{ref:k,className:`ogx-toolbar__icon-btn${E?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Manage columns",onClick:()=>{C(!E),m(!1),M(!1),j(!1)},children:t.jsx(Gr,{})})}),E&&t.jsx(Ur,{anchorRef:k,columns:n,visibleColumns:J,onVisibilityChange:he,onShowAll:v,onHideAll:H,onClose:()=>{C(!1),p?.()}})]}),d&&t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Filters",children:t.jsxs("button",{ref:x,className:`ogx-toolbar__icon-btn${_?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Advanced filters",onClick:()=>{j(!_),m(!1),M(!1),C(!1)},children:[t.jsx(fo,{}),Z>0&&t.jsx("span",{className:"ogx-toolbar__dot","aria-label":"Filters active"})]})}),_&&t.jsx(Kr,{anchorRef:x,columns:n,filterModel:s||{items:[]},onFilterModelChange:d,onClose:()=>j(!1)})]}),i&&t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Pivot",children:t.jsxs("button",{ref:P,id:"ogx-pivot-btn",className:`ogx-toolbar__icon-btn${I?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Configure pivot","aria-expanded":I,"aria-controls":"ogx-pivot-panel",onClick:()=>{M(!I),m(!1),C(!1),j(!1)},children:[t.jsx(uo,{}),R&&t.jsx("span",{className:"ogx-toolbar__dot","aria-label":"Pivot active"})]})}),I&&t.jsx(zr,{anchorRef:P,columns:n,model:S,onChange:F=>{i?.(F)},onClose:()=>M(!1)})]}),t.jsxs("div",{className:"ogx-toolbar__dropdown-wrapper",style:{marginRight:4},children:[t.jsx(Zt,{title:"Summaries",children:t.jsxs("button",{ref:y,id:"ogx-aggregation-btn",className:`ogx-toolbar__icon-btn${w?" ogx-toolbar__icon-btn--active":""}`,"aria-label":"Configure summaries","aria-expanded":w,"aria-controls":"ogx-aggregation-panel",onClick:()=>{m(!w),M(!1),C(!1),j(!1)},children:[t.jsx(go,{}),Y>0&&t.jsx("span",{className:"ogx-toolbar__dot","aria-label":`${Y} active summaries`})]})}),w&&t.jsx(Vr,{anchorRef:y,aggregationModel:o,aggregableColumns:B,onFunctionChange:$,onClearAll:K,onClose:()=>m(!1),activeCount:Y})]}),u]})]})}function qr(){return l.useRef(null)}const Jr=({fullWidth:n=!1,error:o=!1,startAdornment:e,endAdornment:r,className:i="",...s})=>{const d=["ogx-input-wrapper",n&&"ogx-input-wrapper--full-width",o&&"ogx-input-wrapper--error",s.disabled&&"ogx-input-wrapper--disabled",i].filter(Boolean).join(" ");return t.jsxs("div",{className:d,children:[e&&t.jsx("div",{className:"ogx-input__adornment ogx-input__adornment--start",children:e}),t.jsx("input",{className:"ogx-input",...s}),r&&t.jsx("div",{className:"ogx-input__adornment ogx-input__adornment--end",children:r})]})};function Qr(n,o,e={}){const{fileName:r="export.csv",includeHeaders:i=!0,delimiter:s=",",selectedRows:d}=e,a=d&&d.length>0?n.filter(p=>d.includes(p.id)):n;if(a.length===0){console.warn("No rows to export");return}const f=o.filter(p=>!(p.field==="__check__"||p.field==="__actions__"));let g="";if(i){const p=f.map(b=>Tt(b.headerName||b.field));g+=p.join(s)+`
|
|
9
|
+
`}if(a.forEach(p=>{const b=f.map(u=>{let h=p[u.field];return u.valueGetter&&(h=u.valueGetter({row:p,field:u.field,value:h})),u.valueFormatter&&h!==void 0&&h!==null&&(h=u.valueFormatter({value:h,row:p,field:u.field})),Tt(String(h??""))});g+=b.join(s)+`
|
|
10
|
+
`}),e.aggregationResult){const p=e.aggregationResult,b=e.aggregationModel||{},u=f.map(w=>b[w.field]?Tt(b[w.field].toUpperCase()):Tt(""));g+=u.join(s)+`
|
|
11
|
+
`;const h=f.map(w=>{const m=p[w.field];if(m!=null){let I=m;return w.valueFormatter?I=w.valueFormatter({value:m,row:{},field:w.field}):b[w.field]&&(I=bt(m,b[w.field])),Tt(String(I))}return Tt("")});g+=h.join(s)+`
|
|
12
|
+
`}Mn(g,r,"text/csv;charset=utf-8;")}function Tt(n){return n.includes(",")||n.includes('"')||n.includes(`
|
|
13
|
+
`)?`"${n.replace(/"/g,'""')}"`:n}function Zr(n,o,e={}){const{fileName:r="export.xlsx",sheetName:i="Sheet1",includeHeaders:s=!0,selectedRows:d}=e,a=d&&d.length>0?n.filter(p=>d.includes(p.id)):n;if(a.length===0){console.warn("No rows to export");return}const f=o.filter(p=>!(p.field==="__check__"||p.field==="__actions__"));let g='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">';if(g+="<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>",g+=`<x:Name>${i}</x:Name>`,g+="<x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->",g+='<meta charset="UTF-8"></head><body>',g+='<table border="1">',s&&(g+="<thead><tr>",f.forEach(p=>{g+=`<th>${dt(p.headerName||p.field)}</th>`}),g+="</tr></thead>"),g+="<tbody>",a.forEach(p=>{g+="<tr>",f.forEach(b=>{let u=p[b.field];b.valueGetter&&(u=b.valueGetter({row:p,field:b.field,value:u})),b.valueFormatter&&u!==void 0&&u!==null&&(u=b.valueFormatter({value:u,row:p,field:b.field})),g+=`<td>${dt(String(u??""))}</td>`})}),e.aggregationResult){const p=e.aggregationResult,b=e.aggregationModel||{};g+='<tr style="font-size: 11px; color: #666; background-color: #f5f5f5;">',f.forEach(u=>{b[u.field]?g+=`<td style="text-align: right; font-weight: bold;">${dt(b[u.field].toUpperCase())}</td>`:g+="<td></td>"}),g+="</tr>",g+='<tr style="font-weight: bold; background-color: #f5f5f5;">',f.forEach(u=>{const h=p[u.field];if(h!=null){let w=h;u.valueFormatter?w=u.valueFormatter({value:h,row:{},field:u.field}):b[u.field]&&(w=bt(h,b[u.field])),g+=`<td style="text-align: right;">${dt(String(w))}</td>`}else g+="<td></td>"}),g+="</tr>"}g+="</tbody></table></body></html>",Mn(g,r,"application/vnd.ms-excel")}function dt(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ei(n,o,e={}){const{fileName:r="export.json",pretty:i=!0,selectedRows:s}=e,d=s&&s.length>0?n.filter(b=>s.includes(b.id)):n;if(d.length===0){console.warn("No rows to export");return}const a=o.filter(b=>!(b.field==="__check__"||b.field==="__actions__")),f=d.map(b=>{const u={};return a.forEach(h=>{let w=b[h.field];h.valueGetter&&(w=h.valueGetter({row:b,field:h.field,value:w})),u[h.field]=w}),u});let g=f;if(e.aggregationResult){const b=e.aggregationResult,u=e.aggregationModel||{},h={};a.forEach(m=>{u[m.field]&&(h[m.field]=u[m.field].toUpperCase())});const w={};a.forEach(m=>{if(b[m.field]!==void 0&&b[m.field]!==null){let I=b[m.field];m.valueFormatter?I=m.valueFormatter({value:I,row:{},field:m.field}):u[m.field]&&(I=bt(I,u[m.field])),w[m.field]=I}}),g={data:f,aggregation:{labels:h,values:w}}}const p=i?JSON.stringify(g,null,2):JSON.stringify(g);Mn(p,r,"application/json;charset=utf-8;")}async function ti(n,o,e){const r=window.open("","_blank");if(!r){console.error("Failed to open print window. Please check your popup blocker settings.");return}r.document.write(`
|
|
14
14
|
<!DOCTYPE html>
|
|
15
15
|
<html>
|
|
16
16
|
<head>
|
|
@@ -30,7 +30,7 @@ ${h}`;try{await Pr(b)}catch(c){console.error("[OpenGridX] Failed to copy to clip
|
|
|
30
30
|
</div>
|
|
31
31
|
</body>
|
|
32
32
|
</html>
|
|
33
|
-
`),r.document.close(),await new Promise(i=>setTimeout(i,100));try{let i="Print",s,d=null,a=null;typeof e=="string"?i=e:typeof e=="object"&&(i=e.title||"Print",s=e.selectedRows,d=e.aggregationResult||null,a=e.aggregationModel||null);const
|
|
33
|
+
`),r.document.close(),await new Promise(i=>setTimeout(i,100));try{let i="Print",s,d=null,a=null;typeof e=="string"?i=e:typeof e=="object"&&(i=e.title||"Print",s=e.selectedRows,d=e.aggregationResult||null,a=e.aggregationModel||null);const f=s&&s.length>0?n.filter(u=>s.includes(u.id)):n;if(f.length===0){r.document.body.innerHTML="<h3>No rows to export</h3>";return}const g=o.filter(u=>!(u.field==="__check__"||u.field==="__actions__"));let p=`
|
|
34
34
|
<!DOCTYPE html>
|
|
35
35
|
<html>
|
|
36
36
|
<head>
|
|
@@ -49,5 +49,5 @@ ${h}`;try{await Pr(b)}catch(c){console.error("[OpenGridX] Failed to copy to clip
|
|
|
49
49
|
</style>
|
|
50
50
|
</head>
|
|
51
51
|
<body>
|
|
52
|
-
`;if(i&&(h+=`<h1>${dt(i)}</h1>`),h+="<table>",h+="<thead><tr>",f.forEach(c=>{h+=`<th>${dt(c.headerName||c.field)}</th>`}),h+="</tr></thead>",h+="<tbody>",g.forEach(c=>{h+="<tr>",f.forEach(p=>{let w=c[p.field];p.valueGetter&&(w=p.valueGetter({row:c,field:p.field,value:w})),p.valueFormatter&&w!==void 0&&w!==null&&(w=p.valueFormatter({value:w,row:c,field:p.field})),p.type==="image"&&w?h+=`<td><div style="display:flex;justify-content:center;"><img src="${w}" alt="${p.headerName}" style="max-height: 40px; border-radius: 4px;"></div></td>`:h+=`<td>${dt(String(w??""))}</td>`}),h+="</tr>"}),d){const c=a||{};h+='<tfoot><tr style="font-size: 11px; color: #666; background-color: #f5f5f5;">',f.forEach(p=>{c[p.field]?h+=`<td style="text-align: right; font-weight: bold;">${dt(c[p.field].toUpperCase())}</td>`:h+="<td></td>"}),h+='</tr><tr style="font-weight: bold; background-color: #f5f5f5;">',f.forEach(p=>{const w=d[p.field];if(w!=null){let m=w;p.valueFormatter?m=p.valueFormatter({value:w,row:{},field:p.field}):c[p.field]&&(m=mt(w,c[p.field])),h+=`<td style="text-align: right;">${dt(String(m))}</td>`}else h+="<td></td>"}),h+="</tr></tfoot>"}h+="</tbody></table></body></html>",r.document.open(),r.document.write(h),r.document.close(),r.document.title=i||"Print Preview",r.focus();let b=!1;r.onload=()=>{b||(b=!0,r.print(),setTimeout(()=>{r.close()},100))},setTimeout(()=>{!b&&r&&!r.closed&&(b=!0,r.print(),setTimeout(()=>{r.closed||r.close()},100))},500)}catch(i){console.error("Print generation failed:",i),r&&!r.closed&&(r.document.body.innerHTML=`<div style="color: red; padding: 20px;"><h3>Error Generating Print Preview</h3><p>${i.message}</p></div>`)}}function Mn(n,o,e){const r=new Blob([n],{type:e}),i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=o,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}function ni(n,o){return n.type==="number"?"number":n.type==="boolean"?"boolean":n.type==="date"?"date":typeof o=="number"?"number":typeof o=="boolean"?"boolean":o instanceof Date?"date":"string"}function oi(n){if(n.type==="number")return"#,##0.##";if(n.type==="date")return"yyyy-mm-dd"}function ri(n,o){if(o!=null)return o;const e=n.width??120;return Math.min(60,Math.max(8,(e-5)/7))}function ii(n,o){const e=o??"";if(e.includes("jpeg")||e.includes("jpg"))return"jpeg";if(e.includes("gif"))return"gif";const r=n.split("?")[0].toLowerCase();return r.endsWith(".jpg")||r.endsWith(".jpeg")?"jpeg":r.endsWith(".gif")?"gif":"png"}async function li(n){const o=await Promise.allSettled(n.map(async r=>{if(r.startsWith("data:")){const a=r.indexOf(","),g=r.slice(0,a),f=r.slice(a+1),h=atob(f),b=new Uint8Array(h.length);for(let m=0;m<h.length;m++)b[m]=h.charCodeAt(m);const p=g.match(/data:([^;,]+)/)?.[1]??"image/png";let w="png";return p.includes("jpeg")||p.includes("jpg")?w="jpeg":p.includes("gif")&&(w="gif"),{url:r,buffer:b.buffer,ext:w}}const i=await fetch(r,{mode:"cors"});if(!i.ok)throw new Error(`HTTP ${i.status}`);const s=await i.arrayBuffer(),d=ii(r,i.headers.get("content-type"));return{url:r,buffer:s,ext:d}})),e=new Map;return o.forEach((r,i)=>{r.status==="fulfilled"?e.set(r.value.url,{buffer:r.value.buffer,extension:r.value.ext}):console.warn(`[exportToExcelAdvanced] Cannot embed image "${n[i]}" (CORS/network error — raw URL written as fallback):`,r.reason)}),e}async function si(n,o,e={}){const{fileName:r="export.xlsx",sheets:i,columnStyles:s={},headerFillColor:d="#f1f5f9",headerTextColor:a="#334155",headerFontSize:g=10,bodyFontSize:f=10,aggregationResult:h=null,aggregationModel:b=null,selectedRows:c}=e,p=(await import("exceljs")).default,w=new p.Workbook;w.creator="OpenGridX",w.created=new Date;const m=o.filter(k=>k.field!=="__check__"&&k.field!=="__actions__"&&!k.isSpacer),I=n,M=c&&c.length>0?n.filter(k=>c.includes(k.id)):n,E=i??[{name:"Data",rows:"all",includeHeaders:!0,includeSummary:!1}],C=new Map;for(const k of E){if("type"in k&&k.type==="summary"){if(!h||!b)continue;const v=w.addWorksheet(k.name??"Summary");v.addRow(["Summary / Aggregation Totals"]),v.getRow(1).font={bold:!0,size:g+2,color:{argb:bt(a)}},v.addRow([]),v.addRow(["Column","Function","Value"]).eachCell(F=>{F.fill={type:"pattern",pattern:"solid",fgColor:{argb:bt(d)}},F.font={bold:!0,size:g,color:{argb:bt(a)}},F.border=ho()}),m.forEach(F=>{const A=b[F.field],O=h[F.field];if(A==null||O==null)return;let Q=O;F.valueFormatter?Q=F.valueFormatter({value:O,row:{},field:F.field}):Q=mt(O,A);const U=v.addRow([F.headerName??F.field,A.toUpperCase(),Q]);U.getCell(3).alignment={horizontal:"right"},U.getCell(3).font={bold:!0,size:f}}),v.getColumn(1).width=20,v.getColumn(2).width=12,v.getColumn(3).width=18;continue}const x=k,{name:S="Data",rows:R="all",includeHeaders:B=!0,includeSummary:Y=!1,autoFilter:$=!0,frozenHeader:K=!0,alternateRowColor:q="#f8fafc"}=x,D=R==="selected"?M:I,Z=m.filter(v=>s[v.field]?.embedImage);if(Z.length>0){const v=[],H=new Set;if(D.forEach(F=>{Z.forEach(A=>{const O=F[A.field];typeof O=="string"&&O&&!C.has(O)&&!H.has(O)&&(v.push(O),H.add(O))})}),v.length>0){const F=await li(v);for(const[A,{buffer:O,extension:Q}]of F){const U=w.addImage({buffer:O,extension:Q});C.set(A,U)}}}const J=w.addWorksheet(S);if(J.columns=m.map(v=>({key:v.field,width:ri(v,s[v.field]?.width),style:{numFmt:s[v.field]?.numFmt??oi(v)}})),B){const v=m.map(F=>F.headerName??F.field),H=J.addRow(v);H.height=20,H.eachCell((F,A)=>{const O=m[A-1];F.fill={type:"pattern",pattern:"solid",fgColor:{argb:bt(d)}},F.font={bold:!0,size:g,color:{argb:bt(a)}},F.alignment={horizontal:s[O?.field]?.alignment??(O?.type==="number"?"right":"left"),vertical:"middle"},F.border=ho()}),$&&(J.autoFilter={from:{row:1,column:1},to:{row:1,column:m.length}}),K?J.views=[{state:"frozen",ySplit:1,showGridLines:!1}]:J.views=[{showGridLines:!1}]}let he=B?1:0;if(D.forEach((v,H)=>{const F=m.map(O=>{if(s[O.field]?.embedImage)return"";let Q=v[O.field];return O.valueGetter&&(Q=O.valueGetter({row:v,field:O.field,value:Q})),ni(O,Q)==="string"&&O.valueFormatter&&Q!=null&&(Q=O.valueFormatter({value:Q,row:v,field:O.field})),Q}),A=J.addRow(F);if(A.font={size:f},q&&H%2===1&&A.eachCell(O=>{O.fill={type:"pattern",pattern:"solid",fgColor:{argb:bt(q)}}}),A.eachCell((O,Q)=>{const U=m[Q-1];U&&(O.alignment={horizontal:s[U.field]?.alignment??(U.type==="number"?"right":"left"),vertical:"middle"},O.border={bottom:{style:"thin",color:{argb:"FFf1f5f9"}}})}),Z.length>0){const O=Z.reduce((T,se)=>Math.max(T,s[se.field]?.imageHeight??40),0),Q=Math.ceil(O/1.333),U=Q*1.333;A.height=Q,Z.forEach(T=>{const se=m.indexOf(T),ne=v[T.field],xe=typeof ne=="string"?C.get(ne):void 0;if(xe===void 0){A.getCell(se+1).value=typeof ne=="string"?ne:"";return}const Qe=s[T.field],z=Qe?.imageWidth??40,Se=Qe?.imageHeight??40,ct=(J.getColumn(se+1).width??8)*7+5,Be=Math.max(0,ct-z)/2,kt=Math.max(0,U-Se)/2;J.addImage(xe,{tl:{col:se,row:he,nativeColOff:Math.floor(Be*9525),nativeRowOff:Math.floor(kt*9525)},ext:{width:z,height:Se},editAs:"oneCell"})})}else A.height=16;he++}),Y&&h&&b){const v=m.map(O=>{const Q=b[O.field];return Q?Q.toUpperCase():""}),H=J.addRow(v);H.height=16,H.font={size:f-1,italic:!0,color:{argb:"FF94a3b8"}},H.eachCell(O=>{O.alignment={horizontal:"right",vertical:"middle"},O.border={top:{style:"thin",color:{argb:"FFcbd5e1"}}}});const F=m.map(O=>{const Q=b[O.field],U=h[O.field];return Q==null||U==null?"":O.valueFormatter?O.valueFormatter({value:U,row:{},field:O.field}):mt(U,Q)}),A=J.addRow(F);A.height=18,A.font={bold:!0,size:f,color:{argb:bt(a)}},A.eachCell(O=>{O.fill={type:"pattern",pattern:"solid",fgColor:{argb:bt(d)}},O.alignment={horizontal:"right",vertical:"middle"},O.border=ai()})}}const _=await w.xlsx.writeBuffer(),j=new Blob([_],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),y=URL.createObjectURL(j),P=document.createElement("a");P.href=y,P.download=r.endsWith(".xlsx")?r:`${r}.xlsx`,document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(y)}function bt(n){const o=n.replace("#","");return o.length===3?"FF"+o.split("").map(e=>e+e).join(""):o.length===6?"FF"+o:"FF"+o.padEnd(6,"0")}function ho(){return{bottom:{style:"medium",color:{argb:"FFcbd5e1"}}}}function ai(){return{top:{style:"medium",color:{argb:"FFcbd5e1"}}}}const di={"--ogx-color-primary":"#3b82f6","--ogx-color-primary-dark":"#2563eb","--ogx-color-primary-light":"#eff6ff","--ogx-color-primary-focus":"rgba(59, 130, 246, 0.5)","--ogx-color-secondary":"#8b5cf6","--ogx-color-secondary-dark":"#7c3aed","--ogx-color-secondary-light":"#f5f3ff","--ogx-color-white":"#ffffff","--ogx-color-black":"#0f172a","--ogx-border-color":"#e2e8f0","--ogx-border-color-hover":"#cbd5e1","--ogx-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--ogx-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03)","--ogx-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02)","--ogx-grid-background":"#ffffff","--ogx-grid-border-color":"#e2e8f0","--ogx-grid-header-background":"#f8fafc","--ogx-grid-header-text":"#334155","--ogx-grid-header-hover-background":"#f1f5f9","--ogx-grid-header-sorted-background":"#f8fafc","--ogx-grid-row-text":"#1e293b","--ogx-grid-row-hover-background":"#f8fafc","--ogx-grid-row-alternate-background":"transparent","--ogx-grid-row-selected-background":"#eff6ff","--ogx-grid-row-selected-hover-background":"#dbeafe","--ogx-grid-cell-focus-border":"#3b82f6","--ogx-checkbox-bg":"#ffffff","--ogx-checkbox-border":"#94a3b8","--ogx-grid-pinned-left-shadow":"4px 0 24px -4px rgba(0, 0, 0, 0.05)","--ogx-grid-pinned-right-shadow":"-4px 0 24px -4px rgba(0, 0, 0, 0.05)","--ogx-toolbar-background":"transparent","--ogx-toolbar-text":"#1e293b","--ogx-toolbar-border":"#e2e8f0","--ogx-toolbar-btn-bg":"transparent","--ogx-toolbar-btn-hover":"#f1f5f9","--ogx-toolbar-btn-text":"#334155","--ogx-toolbar-btn-primary-bg":"#3b82f6","--ogx-toolbar-btn-primary-hover":"#2563eb","--ogx-toolbar-btn-primary-text":"#ffffff","--ogx-toolbar-btn-danger-bg":"rgba(239, 68, 68, 0.08)","--ogx-toolbar-btn-danger-hover":"rgba(239, 68, 68, 0.15)","--ogx-toolbar-btn-danger-text":"#ef4444","--ogx-toolbar-input-bg":"#ffffff","--ogx-toolbar-input-text":"#1e293b","--ogx-toolbar-input-border":"#cbd5e1","--ogx-toolbar-input-focus-border":"#3b82f6","--ogx-toolbar-input-focus-shadow":"0 0 0 3px rgba(59, 130, 246, 0.12)","--ogx-toolbar-chip-bg":"#f1f5f9","--ogx-toolbar-chip-text":"#475569","--ogx-toolbar-chip-active-bg":"rgba(59, 130, 246, 0.12)","--ogx-toolbar-chip-active-text":"#2563eb","--ogx-overlay-background":"#ffffff","--ogx-overlay-text":"#1e293b","--ogx-overlay-border":"#e2e8f0","--ogx-overlay-shadow":"0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.06)","--ogx-overlay-item-hover-bg":"#f8fafc","--ogx-overlay-item-hover-text":"#0f172a","--ogx-overlay-item-selected-bg":"rgba(59, 130, 246, 0.08)","--ogx-overlay-item-selected-text":"#2563eb","--ogx-overlay-item-danger-bg":"rgba(239, 68, 68, 0.08)","--ogx-overlay-item-danger-text":"#ef4444","--ogx-scrollbar-thumb":"rgba(148, 163, 184, 0.5)","--ogx-scrollbar-track":"transparent","--ogx-scrollbar-size":"10px","--ogx-skeleton-base":"#f1f5f9","--ogx-skeleton-highlight":"#ffffff","--ogx-skeleton-dark-base":"#e2e8f0","--ogx-skeleton-dark-highlight":"#f8fafc"};function ci(n){const o={};function e(r,i){i!==void 0&&(o[r]=i)}if(n.colors){const r=n.colors;e("--ogx-color-primary",r.primary),e("--ogx-color-primary-dark",r.primaryDark),e("--ogx-color-primary-light",r.primaryLight),e("--ogx-color-primary-focus",r.primaryFocus),e("--ogx-color-secondary",r.secondary),e("--ogx-color-secondary-dark",r.secondaryDark),e("--ogx-color-secondary-light",r.secondaryLight),e("--ogx-color-success",r.success),e("--ogx-color-warning",r.warning),e("--ogx-color-error",r.error),e("--ogx-color-info",r.info)}if(n.typography){const r=n.typography;e("--ogx-font-family",r.fontFamily),e("--ogx-font-family-mono",r.fontFamilyMono),e("--ogx-font-size-xs",r.fontSizeXs),e("--ogx-font-size-sm",r.fontSizeSm),e("--ogx-font-size-md",r.fontSizeMd),e("--ogx-font-size-lg",r.fontSizeLg),e("--ogx-font-size-xl",r.fontSizeXl)}if(n.spacing){const r=n.spacing;e("--ogx-spacing-xs",r.xs),e("--ogx-spacing-sm",r.sm),e("--ogx-spacing-md",r.md),e("--ogx-spacing-lg",r.lg),e("--ogx-spacing-xl",r.xl),e("--ogx-spacing-xxl",r.xxl)}if(n.borders){const r=n.borders;e("--ogx-border-width-thin",r.widthThin),e("--ogx-border-width-medium",r.widthMedium),e("--ogx-border-width-thick",r.widthThick),e("--ogx-border-radius-sm",r.radiusSm),e("--ogx-border-radius-md",r.radiusMd),e("--ogx-border-radius-lg",r.radiusLg),e("--ogx-border-radius-xl",r.radiusXl),e("--ogx-border-color",r.color),e("--ogx-border-color-hover",r.colorHover)}if(n.shadows){const r=n.shadows;e("--ogx-shadow-sm",r.sm),e("--ogx-shadow-md",r.md),e("--ogx-shadow-lg",r.lg),e("--ogx-shadow-xl",r.xl)}if(n.grid){const r=n.grid;e("--ogx-grid-row-height-compact",r.rowHeightCompact),e("--ogx-grid-row-height-standard",r.rowHeightStandard),e("--ogx-row-height",r.rowHeightStandard),e("--ogx-grid-row-height-comfortable",r.rowHeightComfortable),e("--ogx-grid-header-height",r.headerHeight),e("--ogx-header-height",r.headerHeight),e("--ogx-grid-cell-padding-x",r.cellPaddingX),e("--ogx-grid-cell-padding-y",r.cellPaddingY),e("--ogx-grid-background",r.background),e("--ogx-grid-border-color",r.borderColor),e("--ogx-grid-header-background",r.headerBackground),e("--ogx-grid-header-text",r.headerText),e("--ogx-grid-header-hover-background",r.headerHoverBackground),e("--ogx-grid-header-sorted-background",r.headerSortedBackground),e("--ogx-grid-row-text",r.rowText),e("--ogx-grid-row-hover-background",r.rowHoverBackground),e("--ogx-grid-row-alternate-background",r.rowAlternateBackground),e("--ogx-grid-row-selected-background",r.rowSelectedBackground),e("--ogx-grid-row-selected-hover-background",r.rowSelectedHoverBackground),e("--ogx-grid-cell-focus-border",r.cellFocusBorder),e("--ogx-grid-pinned-left-shadow",r.pinnedLeftShadow),e("--ogx-grid-pinned-right-shadow",r.pinnedRightShadow),e("--ogx-checkbox-bg",r.checkboxBg),e("--ogx-checkbox-border",r.checkboxBorder)}if(n.transitions){const r=n.transitions;e("--ogx-transition-duration-fast",r.durationFast),e("--ogx-transition-duration-normal",r.durationNormal),e("--ogx-transition-duration-slow",r.durationSlow),e("--ogx-transition-easing",r.easing)}if(n.toolbar){const r=n.toolbar;e("--ogx-toolbar-background",r.background),e("--ogx-toolbar-text",r.text),e("--ogx-toolbar-border",r.border),e("--ogx-toolbar-btn-bg",r.buttonBackground),e("--ogx-toolbar-btn-hover",r.buttonHoverBackground),e("--ogx-toolbar-btn-text",r.buttonText),e("--ogx-toolbar-btn-primary-bg",r.buttonPrimaryBackground),e("--ogx-toolbar-btn-primary-hover",r.buttonPrimaryHoverBackground),e("--ogx-toolbar-btn-primary-text",r.buttonPrimaryText),e("--ogx-toolbar-btn-danger-bg",r.buttonDangerBackground),e("--ogx-toolbar-btn-danger-hover",r.buttonDangerHoverBackground),e("--ogx-toolbar-btn-danger-text",r.buttonDangerText),e("--ogx-toolbar-input-bg",r.inputBackground),e("--ogx-toolbar-input-text",r.inputText),e("--ogx-toolbar-input-border",r.inputBorder),e("--ogx-toolbar-input-focus-border",r.inputFocusBorder),e("--ogx-toolbar-input-focus-shadow",r.inputFocusShadow),e("--ogx-toolbar-chip-bg",r.chipBackground),e("--ogx-toolbar-chip-text",r.chipText),e("--ogx-toolbar-chip-active-bg",r.chipActiveBackground),e("--ogx-toolbar-chip-active-text",r.chipActiveText)}if(n.overlays){const r=n.overlays;e("--ogx-overlay-background",r.background),e("--ogx-overlay-text",r.text),e("--ogx-overlay-border",r.border),e("--ogx-overlay-shadow",r.shadow),e("--ogx-overlay-item-hover-bg",r.itemHoverBackground),e("--ogx-overlay-item-hover-text",r.itemHoverText),e("--ogx-overlay-item-selected-bg",r.itemSelectedBackground),e("--ogx-overlay-item-selected-text",r.itemSelectedText),e("--ogx-overlay-item-danger-bg",r.itemDangerBackground),e("--ogx-overlay-item-danger-text",r.itemDangerText)}if(n.scrollbar){const r=n.scrollbar;e("--ogx-scrollbar-thumb",r.thumbColor),e("--ogx-scrollbar-track",r.trackColor),e("--ogx-scrollbar-size",r.size)}if(n.skeleton){const r=n.skeleton;e("--ogx-skeleton-base",r.baseColor),e("--ogx-skeleton-highlight",r.highlightColor),e("--ogx-skeleton-dark-base",r.darkBaseColor),e("--ogx-skeleton-dark-highlight",r.darkHighlightColor)}return o}function ui({theme:n,children:o,className:e,style:r}){const i=l.useMemo(()=>({...di,...ci(n)}),[n]);return t.jsx("div",{className:e,style:{...r,...i},children:o})}const gi={colors:{primary:"#60a5fa",primaryDark:"#3b82f6",primaryLight:"#1e3a5f",primaryFocus:"rgba(96, 165, 250, 0.4)"},grid:{background:"#0f172a",headerBackground:"#1e293b",headerText:"#e2e8f0",headerHoverBackground:"#334155",headerSortedBackground:"#1e3a5f",rowText:"#cbd5e1",borderColor:"#334155",rowHoverBackground:"#1e293b",rowAlternateBackground:"#162032",rowSelectedBackground:"#1e3a5f",rowSelectedHoverBackground:"#1d4ed8",cellFocusBorder:"#60a5fa",checkboxBg:"#1e293b",checkboxBorder:"#64748b"},borders:{color:"#334155",colorHover:"#475569"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.3)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.3)"},toolbar:{background:"transparent",text:"#cbd5e1",border:"#334155",buttonBackground:"transparent",buttonHoverBackground:"#1e293b",buttonText:"#e2e8f0",buttonPrimaryBackground:"#3b82f6",buttonPrimaryHoverBackground:"#2563eb",buttonPrimaryText:"#ffffff",buttonDangerBackground:"rgba(239, 68, 68, 0.15)",buttonDangerHoverBackground:"rgba(239, 68, 68, 0.25)",buttonDangerText:"#fca5a5",inputBackground:"#0f172a",inputText:"#f8fafc",inputBorder:"#334155",inputFocusBorder:"#60a5fa",inputFocusShadow:"0 0 0 3px rgba(96, 165, 250, 0.2)",chipBackground:"#1e293b",chipText:"#94a3b8",chipActiveBackground:"rgba(96, 165, 250, 0.2)",chipActiveText:"#60a5fa"},overlays:{background:"#1e293b",text:"#f8fafc",border:"#334155",shadow:"0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3)",itemHoverBackground:"#334155",itemHoverText:"#ffffff",itemSelectedBackground:"rgba(96, 165, 250, 0.15)",itemSelectedText:"#60a5fa",itemDangerBackground:"rgba(239, 68, 68, 0.15)",itemDangerText:"#fca5a5"},scrollbar:{thumbColor:"rgba(148, 163, 184, 0.2)",trackColor:"transparent"},skeleton:{baseColor:"#1e293b",highlightColor:"#334155",darkBaseColor:"#0f172a",darkHighlightColor:"#1e293b"}},fi={colors:{primary:"#e11d48",primaryDark:"#be123c",primaryLight:"#fff1f2",primaryFocus:"rgba(225, 29, 72, 0.4)"},grid:{headerBackground:"#fff1f2",headerHoverBackground:"#ffe4e6",headerSortedBackground:"#fecdd3",rowAlternateBackground:"#fff8f8",rowSelectedBackground:"#ffe4e6",rowSelectedHoverBackground:"#fecdd3",cellFocusBorder:"#e11d48"}},hi={colors:{primary:"#059669",primaryDark:"#047857",primaryLight:"#ecfdf5",primaryFocus:"rgba(5, 150, 105, 0.4)"},grid:{headerBackground:"#ecfdf5",headerHoverBackground:"#d1fae5",headerSortedBackground:"#a7f3d0",rowAlternateBackground:"#f6fdf9",rowSelectedBackground:"#d1fae5",rowSelectedHoverBackground:"#a7f3d0",cellFocusBorder:"#059669"}},pi={colors:{primary:"#d97706",primaryDark:"#b45309",primaryLight:"#fffbeb",primaryFocus:"rgba(217, 119, 6, 0.4)"},grid:{headerBackground:"#fffbeb",headerHoverBackground:"#fef3c7",headerSortedBackground:"#fde68a",rowAlternateBackground:"#fffdf5",rowSelectedBackground:"#fef3c7",rowSelectedHoverBackground:"#fde68a",cellFocusBorder:"#d97706"}},xi={grid:{rowHeightCompact:"28px",rowHeightStandard:"36px",rowHeightComfortable:"48px",headerHeight:"40px",cellPaddingX:"8px",cellPaddingY:"4px"},typography:{fontSizeSm:"0.8rem",fontSizeMd:"0.875rem"}};function mi(n,o){try{const e=o.getItem(n);return e?JSON.parse(e):void 0}catch{return}}function bi(n,o,e,r){try{const i=e?Object.fromEntries(Object.entries(o).filter(([s])=>e.includes(s))):o;r.setItem(n,JSON.stringify(i))}catch{}}function wi(n){const o=typeof n=="string"?{key:n}:n,{key:e,debounceMs:r=300,include:i,storage:s=typeof window<"u"?window.localStorage:void 0}=o,d=l.useMemo(()=>{if(s)return mi(e,s)},[e]),a=l.useRef(null),g=l.useRef(null),f=l.useCallback(()=>{g.current&&s&&bi(e,g.current,i,s)},[e,i,s]),h=l.useCallback(c=>{g.current=c,a.current&&clearTimeout(a.current),a.current=setTimeout(f,r)},[f,r]);l.useEffect(()=>()=>{a.current&&(clearTimeout(a.current),f())},[f]);const b=l.useCallback(()=>{s&&s.removeItem(e)},[e,s]);return{initialState:d,onStateChange:h,clearState:b}}oe.Button=Qt,oe.Cell=no,oe.Checkbox=qt,oe.DataGrid=Rr,oe.DataGridThemeProvider=ui,oe.FilterPanel=co,oe.GridToolbar=Xr,oe.GridTooltip=Zt,oe.Header=to,oe.Input=Jr,oe.Row=Jt,oe.Skeleton=Fr,oe.amberTheme=pi,oe.compactTheme=xi,oe.darkTheme=gi,oe.emeraldTheme=hi,oe.exportToCsv=Qr,oe.exportToExcel=Zr,oe.exportToExcelAdvanced=si,oe.exportToJson=ei,oe.formatAggregationValue=mt,oe.printGrid=ti,oe.roseTheme=fi,oe.useAggregation=io,oe.useGridApiRef=qr,oe.useGridStateStorage=wi,oe.usePivot=lo,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})}));
|
|
52
|
+
`;if(i&&(p+=`<h1>${dt(i)}</h1>`),p+="<table>",p+="<thead><tr>",g.forEach(u=>{p+=`<th>${dt(u.headerName||u.field)}</th>`}),p+="</tr></thead>",p+="<tbody>",f.forEach(u=>{p+="<tr>",g.forEach(h=>{let w=u[h.field];h.valueGetter&&(w=h.valueGetter({row:u,field:h.field,value:w})),h.valueFormatter&&w!==void 0&&w!==null&&(w=h.valueFormatter({value:w,row:u,field:h.field})),h.type==="image"&&w?p+=`<td><div style="display:flex;justify-content:center;"><img src="${w}" alt="${h.headerName}" style="max-height: 40px; border-radius: 4px;"></div></td>`:p+=`<td>${dt(String(w??""))}</td>`}),p+="</tr>"}),d){const u=a||{};p+='<tfoot><tr style="font-size: 11px; color: #666; background-color: #f5f5f5;">',g.forEach(h=>{u[h.field]?p+=`<td style="text-align: right; font-weight: bold;">${dt(u[h.field].toUpperCase())}</td>`:p+="<td></td>"}),p+='</tr><tr style="font-weight: bold; background-color: #f5f5f5;">',g.forEach(h=>{const w=d[h.field];if(w!=null){let m=w;h.valueFormatter?m=h.valueFormatter({value:w,row:{},field:h.field}):u[h.field]&&(m=bt(w,u[h.field])),p+=`<td style="text-align: right;">${dt(String(m))}</td>`}else p+="<td></td>"}),p+="</tr></tfoot>"}p+="</tbody></table></body></html>",r.document.open(),r.document.write(p),r.document.close(),r.document.title=i||"Print Preview",r.focus();let b=!1;r.onload=()=>{b||(b=!0,r.print(),setTimeout(()=>{r.close()},100))},setTimeout(()=>{!b&&r&&!r.closed&&(b=!0,r.print(),setTimeout(()=>{r.closed||r.close()},100))},500)}catch(i){console.error("Print generation failed:",i),r&&!r.closed&&(r.document.body.innerHTML=`<div style="color: red; padding: 20px;"><h3>Error Generating Print Preview</h3><p>${i.message}</p></div>`)}}function Mn(n,o,e){const r=new Blob([n],{type:e}),i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=o,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}function ni(n,o){return n.type==="number"?"number":n.type==="boolean"?"boolean":n.type==="date"?"date":typeof o=="number"?"number":typeof o=="boolean"?"boolean":o instanceof Date?"date":"string"}function oi(n){if(n.type==="number")return"#,##0.##";if(n.type==="date")return"yyyy-mm-dd"}function ri(n,o){if(o!=null)return o;const e=n.width??120;return Math.min(60,Math.max(8,(e-5)/7))}function ii(n,o){const e=o??"";if(e.includes("jpeg")||e.includes("jpg"))return"jpeg";if(e.includes("gif"))return"gif";const r=n.split("?")[0].toLowerCase();return r.endsWith(".jpg")||r.endsWith(".jpeg")?"jpeg":r.endsWith(".gif")?"gif":"png"}async function li(n){const o=await Promise.allSettled(n.map(async r=>{if(r.startsWith("data:")){const a=r.indexOf(","),f=r.slice(0,a),g=r.slice(a+1),p=atob(g),b=new Uint8Array(p.length);for(let m=0;m<p.length;m++)b[m]=p.charCodeAt(m);const h=f.match(/data:([^;,]+)/)?.[1]??"image/png";let w="png";return h.includes("jpeg")||h.includes("jpg")?w="jpeg":h.includes("gif")&&(w="gif"),{url:r,buffer:b.buffer,ext:w}}const i=await fetch(r,{mode:"cors"});if(!i.ok)throw new Error(`HTTP ${i.status}`);const s=await i.arrayBuffer(),d=ii(r,i.headers.get("content-type"));return{url:r,buffer:s,ext:d}})),e=new Map;return o.forEach((r,i)=>{r.status==="fulfilled"?e.set(r.value.url,{buffer:r.value.buffer,extension:r.value.ext}):console.warn(`[exportToExcelAdvanced] Cannot embed image "${n[i]}" (CORS/network error — raw URL written as fallback):`,r.reason)}),e}async function si(n,o,e={}){const{fileName:r="export.xlsx",sheets:i,columnStyles:s={},headerFillColor:d="#f1f5f9",headerTextColor:a="#334155",headerFontSize:f=10,bodyFontSize:g=10,aggregationResult:p=null,aggregationModel:b=null,selectedRows:u}=e,h=(await import("exceljs")).default,w=new h.Workbook;w.creator="OpenGridX",w.created=new Date;const m=o.filter(k=>k.field!=="__check__"&&k.field!=="__actions__"&&!k.isSpacer),I=n,M=u&&u.length>0?n.filter(k=>u.includes(k.id)):n,E=i??[{name:"Data",rows:"all",includeHeaders:!0,includeSummary:!1}],C=new Map;for(const k of E){if("type"in k&&k.type==="summary"){if(!p||!b)continue;const v=w.addWorksheet(k.name??"Summary");v.addRow(["Summary / Aggregation Totals"]),v.getRow(1).font={bold:!0,size:f+2,color:{argb:wt(a)}},v.addRow([]),v.addRow(["Column","Function","Value"]).eachCell(F=>{F.fill={type:"pattern",pattern:"solid",fgColor:{argb:wt(d)}},F.font={bold:!0,size:f,color:{argb:wt(a)}},F.border=ho()}),m.forEach(F=>{const A=b[F.field],O=p[F.field];if(A==null||O==null)return;let Q=O;F.valueFormatter?Q=F.valueFormatter({value:O,row:{},field:F.field}):Q=bt(O,A);const U=v.addRow([F.headerName??F.field,A.toUpperCase(),Q]);U.getCell(3).alignment={horizontal:"right"},U.getCell(3).font={bold:!0,size:g}}),v.getColumn(1).width=20,v.getColumn(2).width=12,v.getColumn(3).width=18;continue}const x=k,{name:S="Data",rows:R="all",includeHeaders:B=!0,includeSummary:Y=!1,autoFilter:$=!0,frozenHeader:K=!0,alternateRowColor:q="#f8fafc"}=x,D=R==="selected"?M:I,Z=m.filter(v=>s[v.field]?.embedImage);if(Z.length>0){const v=[],H=new Set;if(D.forEach(F=>{Z.forEach(A=>{const O=F[A.field];typeof O=="string"&&O&&!C.has(O)&&!H.has(O)&&(v.push(O),H.add(O))})}),v.length>0){const F=await li(v);for(const[A,{buffer:O,extension:Q}]of F){const U=w.addImage({buffer:O,extension:Q});C.set(A,U)}}}const J=w.addWorksheet(S);if(J.columns=m.map(v=>({key:v.field,width:ri(v,s[v.field]?.width),style:{numFmt:s[v.field]?.numFmt??oi(v)}})),B){const v=m.map(F=>F.headerName??F.field),H=J.addRow(v);H.height=20,H.eachCell((F,A)=>{const O=m[A-1];F.fill={type:"pattern",pattern:"solid",fgColor:{argb:wt(d)}},F.font={bold:!0,size:f,color:{argb:wt(a)}},F.alignment={horizontal:s[O?.field]?.alignment??(O?.type==="number"?"right":"left"),vertical:"middle"},F.border=ho()}),$&&(J.autoFilter={from:{row:1,column:1},to:{row:1,column:m.length}}),K?J.views=[{state:"frozen",ySplit:1,showGridLines:!1}]:J.views=[{showGridLines:!1}]}let he=B?1:0;if(D.forEach((v,H)=>{const F=m.map(O=>{if(s[O.field]?.embedImage)return"";let Q=v[O.field];return O.valueGetter&&(Q=O.valueGetter({row:v,field:O.field,value:Q})),ni(O,Q)==="string"&&O.valueFormatter&&Q!=null&&(Q=O.valueFormatter({value:Q,row:v,field:O.field})),Q}),A=J.addRow(F);if(A.font={size:g},q&&H%2===1&&A.eachCell(O=>{O.fill={type:"pattern",pattern:"solid",fgColor:{argb:wt(q)}}}),A.eachCell((O,Q)=>{const U=m[Q-1];U&&(O.alignment={horizontal:s[U.field]?.alignment??(U.type==="number"?"right":"left"),vertical:"middle"},O.border={bottom:{style:"thin",color:{argb:"FFf1f5f9"}}})}),Z.length>0){const O=Z.reduce((T,se)=>Math.max(T,s[se.field]?.imageHeight??40),0),Q=Math.ceil(O/1.333),U=Q*1.333;A.height=Q,Z.forEach(T=>{const se=m.indexOf(T),ne=v[T.field],xe=typeof ne=="string"?C.get(ne):void 0;if(xe===void 0){A.getCell(se+1).value=typeof ne=="string"?ne:"";return}const Qe=s[T.field],z=Qe?.imageWidth??40,Se=Qe?.imageHeight??40,ct=(J.getColumn(se+1).width??8)*7+5,Be=Math.max(0,ct-z)/2,ut=Math.max(0,U-Se)/2;J.addImage(xe,{tl:{col:se,row:he,nativeColOff:Math.floor(Be*9525),nativeRowOff:Math.floor(ut*9525)},ext:{width:z,height:Se},editAs:"oneCell"})})}else A.height=16;he++}),Y&&p&&b){const v=m.map(O=>{const Q=b[O.field];return Q?Q.toUpperCase():""}),H=J.addRow(v);H.height=16,H.font={size:g-1,italic:!0,color:{argb:"FF94a3b8"}},H.eachCell(O=>{O.alignment={horizontal:"right",vertical:"middle"},O.border={top:{style:"thin",color:{argb:"FFcbd5e1"}}}});const F=m.map(O=>{const Q=b[O.field],U=p[O.field];return Q==null||U==null?"":O.valueFormatter?O.valueFormatter({value:U,row:{},field:O.field}):bt(U,Q)}),A=J.addRow(F);A.height=18,A.font={bold:!0,size:g,color:{argb:wt(a)}},A.eachCell(O=>{O.fill={type:"pattern",pattern:"solid",fgColor:{argb:wt(d)}},O.alignment={horizontal:"right",vertical:"middle"},O.border=ai()})}}const _=await w.xlsx.writeBuffer(),j=new Blob([_],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),y=URL.createObjectURL(j),P=document.createElement("a");P.href=y,P.download=r.endsWith(".xlsx")?r:`${r}.xlsx`,document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(y)}function wt(n){const o=n.replace("#","");return o.length===3?"FF"+o.split("").map(e=>e+e).join(""):o.length===6?"FF"+o:"FF"+o.padEnd(6,"0")}function ho(){return{bottom:{style:"medium",color:{argb:"FFcbd5e1"}}}}function ai(){return{top:{style:"medium",color:{argb:"FFcbd5e1"}}}}const di={"--ogx-color-primary":"#3b82f6","--ogx-color-primary-dark":"#2563eb","--ogx-color-primary-light":"#eff6ff","--ogx-color-primary-focus":"rgba(59, 130, 246, 0.5)","--ogx-color-secondary":"#8b5cf6","--ogx-color-secondary-dark":"#7c3aed","--ogx-color-secondary-light":"#f5f3ff","--ogx-color-white":"#ffffff","--ogx-color-black":"#0f172a","--ogx-border-color":"#e2e8f0","--ogx-border-color-hover":"#cbd5e1","--ogx-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--ogx-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03)","--ogx-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02)","--ogx-grid-background":"#ffffff","--ogx-grid-border-color":"#e2e8f0","--ogx-grid-header-background":"#f8fafc","--ogx-grid-header-text":"#334155","--ogx-grid-header-hover-background":"#f1f5f9","--ogx-grid-header-sorted-background":"#f8fafc","--ogx-grid-row-text":"#1e293b","--ogx-grid-row-hover-background":"#f8fafc","--ogx-grid-row-alternate-background":"transparent","--ogx-grid-row-selected-background":"#eff6ff","--ogx-grid-row-selected-hover-background":"#dbeafe","--ogx-grid-cell-focus-border":"#3b82f6","--ogx-checkbox-bg":"#ffffff","--ogx-checkbox-border":"#94a3b8","--ogx-grid-pinned-left-shadow":"4px 0 24px -4px rgba(0, 0, 0, 0.05)","--ogx-grid-pinned-right-shadow":"-4px 0 24px -4px rgba(0, 0, 0, 0.05)","--ogx-toolbar-background":"transparent","--ogx-toolbar-text":"#1e293b","--ogx-toolbar-border":"#e2e8f0","--ogx-toolbar-btn-bg":"transparent","--ogx-toolbar-btn-hover":"#f1f5f9","--ogx-toolbar-btn-text":"#334155","--ogx-toolbar-btn-primary-bg":"#3b82f6","--ogx-toolbar-btn-primary-hover":"#2563eb","--ogx-toolbar-btn-primary-text":"#ffffff","--ogx-toolbar-btn-danger-bg":"rgba(239, 68, 68, 0.08)","--ogx-toolbar-btn-danger-hover":"rgba(239, 68, 68, 0.15)","--ogx-toolbar-btn-danger-text":"#ef4444","--ogx-toolbar-input-bg":"#ffffff","--ogx-toolbar-input-text":"#1e293b","--ogx-toolbar-input-border":"#cbd5e1","--ogx-toolbar-input-focus-border":"#3b82f6","--ogx-toolbar-input-focus-shadow":"0 0 0 3px rgba(59, 130, 246, 0.12)","--ogx-toolbar-chip-bg":"#f1f5f9","--ogx-toolbar-chip-text":"#475569","--ogx-toolbar-chip-active-bg":"rgba(59, 130, 246, 0.12)","--ogx-toolbar-chip-active-text":"#2563eb","--ogx-overlay-background":"#ffffff","--ogx-overlay-text":"#1e293b","--ogx-overlay-border":"#e2e8f0","--ogx-overlay-shadow":"0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.06)","--ogx-overlay-item-hover-bg":"#f8fafc","--ogx-overlay-item-hover-text":"#0f172a","--ogx-overlay-item-selected-bg":"rgba(59, 130, 246, 0.08)","--ogx-overlay-item-selected-text":"#2563eb","--ogx-overlay-item-danger-bg":"rgba(239, 68, 68, 0.08)","--ogx-overlay-item-danger-text":"#ef4444","--ogx-scrollbar-thumb":"rgba(148, 163, 184, 0.5)","--ogx-scrollbar-track":"transparent","--ogx-scrollbar-size":"10px","--ogx-skeleton-base":"#f1f5f9","--ogx-skeleton-highlight":"#ffffff","--ogx-skeleton-dark-base":"#e2e8f0","--ogx-skeleton-dark-highlight":"#f8fafc"};function ci(n){const o={};function e(r,i){i!==void 0&&(o[r]=i)}if(n.colors){const r=n.colors;e("--ogx-color-primary",r.primary),e("--ogx-color-primary-dark",r.primaryDark),e("--ogx-color-primary-light",r.primaryLight),e("--ogx-color-primary-focus",r.primaryFocus),e("--ogx-color-secondary",r.secondary),e("--ogx-color-secondary-dark",r.secondaryDark),e("--ogx-color-secondary-light",r.secondaryLight),e("--ogx-color-success",r.success),e("--ogx-color-warning",r.warning),e("--ogx-color-error",r.error),e("--ogx-color-info",r.info)}if(n.typography){const r=n.typography;e("--ogx-font-family",r.fontFamily),e("--ogx-font-family-mono",r.fontFamilyMono),e("--ogx-font-size-xs",r.fontSizeXs),e("--ogx-font-size-sm",r.fontSizeSm),e("--ogx-font-size-md",r.fontSizeMd),e("--ogx-font-size-lg",r.fontSizeLg),e("--ogx-font-size-xl",r.fontSizeXl)}if(n.spacing){const r=n.spacing;e("--ogx-spacing-xs",r.xs),e("--ogx-spacing-sm",r.sm),e("--ogx-spacing-md",r.md),e("--ogx-spacing-lg",r.lg),e("--ogx-spacing-xl",r.xl),e("--ogx-spacing-xxl",r.xxl)}if(n.borders){const r=n.borders;e("--ogx-border-width-thin",r.widthThin),e("--ogx-border-width-medium",r.widthMedium),e("--ogx-border-width-thick",r.widthThick),e("--ogx-border-radius-sm",r.radiusSm),e("--ogx-border-radius-md",r.radiusMd),e("--ogx-border-radius-lg",r.radiusLg),e("--ogx-border-radius-xl",r.radiusXl),e("--ogx-border-color",r.color),e("--ogx-border-color-hover",r.colorHover)}if(n.shadows){const r=n.shadows;e("--ogx-shadow-sm",r.sm),e("--ogx-shadow-md",r.md),e("--ogx-shadow-lg",r.lg),e("--ogx-shadow-xl",r.xl)}if(n.grid){const r=n.grid;e("--ogx-grid-row-height-compact",r.rowHeightCompact),e("--ogx-grid-row-height-standard",r.rowHeightStandard),e("--ogx-row-height",r.rowHeightStandard),e("--ogx-grid-row-height-comfortable",r.rowHeightComfortable),e("--ogx-grid-header-height",r.headerHeight),e("--ogx-header-height",r.headerHeight),e("--ogx-grid-cell-padding-x",r.cellPaddingX),e("--ogx-grid-cell-padding-y",r.cellPaddingY),e("--ogx-grid-background",r.background),e("--ogx-grid-border-color",r.borderColor),e("--ogx-grid-header-background",r.headerBackground),e("--ogx-grid-header-text",r.headerText),e("--ogx-grid-header-hover-background",r.headerHoverBackground),e("--ogx-grid-header-sorted-background",r.headerSortedBackground),e("--ogx-grid-row-text",r.rowText),e("--ogx-grid-row-hover-background",r.rowHoverBackground),e("--ogx-grid-row-alternate-background",r.rowAlternateBackground),e("--ogx-grid-row-selected-background",r.rowSelectedBackground),e("--ogx-grid-row-selected-hover-background",r.rowSelectedHoverBackground),e("--ogx-grid-cell-focus-border",r.cellFocusBorder),e("--ogx-grid-pinned-left-shadow",r.pinnedLeftShadow),e("--ogx-grid-pinned-right-shadow",r.pinnedRightShadow),e("--ogx-checkbox-bg",r.checkboxBg),e("--ogx-checkbox-border",r.checkboxBorder)}if(n.transitions){const r=n.transitions;e("--ogx-transition-duration-fast",r.durationFast),e("--ogx-transition-duration-normal",r.durationNormal),e("--ogx-transition-duration-slow",r.durationSlow),e("--ogx-transition-easing",r.easing)}if(n.toolbar){const r=n.toolbar;e("--ogx-toolbar-background",r.background),e("--ogx-toolbar-text",r.text),e("--ogx-toolbar-border",r.border),e("--ogx-toolbar-btn-bg",r.buttonBackground),e("--ogx-toolbar-btn-hover",r.buttonHoverBackground),e("--ogx-toolbar-btn-text",r.buttonText),e("--ogx-toolbar-btn-primary-bg",r.buttonPrimaryBackground),e("--ogx-toolbar-btn-primary-hover",r.buttonPrimaryHoverBackground),e("--ogx-toolbar-btn-primary-text",r.buttonPrimaryText),e("--ogx-toolbar-btn-danger-bg",r.buttonDangerBackground),e("--ogx-toolbar-btn-danger-hover",r.buttonDangerHoverBackground),e("--ogx-toolbar-btn-danger-text",r.buttonDangerText),e("--ogx-toolbar-input-bg",r.inputBackground),e("--ogx-toolbar-input-text",r.inputText),e("--ogx-toolbar-input-border",r.inputBorder),e("--ogx-toolbar-input-focus-border",r.inputFocusBorder),e("--ogx-toolbar-input-focus-shadow",r.inputFocusShadow),e("--ogx-toolbar-chip-bg",r.chipBackground),e("--ogx-toolbar-chip-text",r.chipText),e("--ogx-toolbar-chip-active-bg",r.chipActiveBackground),e("--ogx-toolbar-chip-active-text",r.chipActiveText)}if(n.overlays){const r=n.overlays;e("--ogx-overlay-background",r.background),e("--ogx-overlay-text",r.text),e("--ogx-overlay-border",r.border),e("--ogx-overlay-shadow",r.shadow),e("--ogx-overlay-item-hover-bg",r.itemHoverBackground),e("--ogx-overlay-item-hover-text",r.itemHoverText),e("--ogx-overlay-item-selected-bg",r.itemSelectedBackground),e("--ogx-overlay-item-selected-text",r.itemSelectedText),e("--ogx-overlay-item-danger-bg",r.itemDangerBackground),e("--ogx-overlay-item-danger-text",r.itemDangerText)}if(n.scrollbar){const r=n.scrollbar;e("--ogx-scrollbar-thumb",r.thumbColor),e("--ogx-scrollbar-track",r.trackColor),e("--ogx-scrollbar-size",r.size)}if(n.skeleton){const r=n.skeleton;e("--ogx-skeleton-base",r.baseColor),e("--ogx-skeleton-highlight",r.highlightColor),e("--ogx-skeleton-dark-base",r.darkBaseColor),e("--ogx-skeleton-dark-highlight",r.darkHighlightColor)}return o}function ui({theme:n,children:o,className:e,style:r}){const i=l.useMemo(()=>({...di,...ci(n)}),[n]);return t.jsx("div",{className:e,style:{...r,...i},children:o})}const gi={colors:{primary:"#60a5fa",primaryDark:"#3b82f6",primaryLight:"#1e3a5f",primaryFocus:"rgba(96, 165, 250, 0.4)"},grid:{background:"#0f172a",headerBackground:"#1e293b",headerText:"#e2e8f0",headerHoverBackground:"#334155",headerSortedBackground:"#1e3a5f",rowText:"#cbd5e1",borderColor:"#334155",rowHoverBackground:"#1e293b",rowAlternateBackground:"#162032",rowSelectedBackground:"#1e3a5f",rowSelectedHoverBackground:"#1d4ed8",cellFocusBorder:"#60a5fa",checkboxBg:"#1e293b",checkboxBorder:"#64748b"},borders:{color:"#334155",colorHover:"#475569"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.3)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.3)"},toolbar:{background:"transparent",text:"#cbd5e1",border:"#334155",buttonBackground:"transparent",buttonHoverBackground:"#1e293b",buttonText:"#e2e8f0",buttonPrimaryBackground:"#3b82f6",buttonPrimaryHoverBackground:"#2563eb",buttonPrimaryText:"#ffffff",buttonDangerBackground:"rgba(239, 68, 68, 0.15)",buttonDangerHoverBackground:"rgba(239, 68, 68, 0.25)",buttonDangerText:"#fca5a5",inputBackground:"#0f172a",inputText:"#f8fafc",inputBorder:"#334155",inputFocusBorder:"#60a5fa",inputFocusShadow:"0 0 0 3px rgba(96, 165, 250, 0.2)",chipBackground:"#1e293b",chipText:"#94a3b8",chipActiveBackground:"rgba(96, 165, 250, 0.2)",chipActiveText:"#60a5fa"},overlays:{background:"#1e293b",text:"#f8fafc",border:"#334155",shadow:"0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3)",itemHoverBackground:"#334155",itemHoverText:"#ffffff",itemSelectedBackground:"rgba(96, 165, 250, 0.15)",itemSelectedText:"#60a5fa",itemDangerBackground:"rgba(239, 68, 68, 0.15)",itemDangerText:"#fca5a5"},scrollbar:{thumbColor:"rgba(148, 163, 184, 0.2)",trackColor:"transparent"},skeleton:{baseColor:"#1e293b",highlightColor:"#334155",darkBaseColor:"#0f172a",darkHighlightColor:"#1e293b"}},fi={colors:{primary:"#e11d48",primaryDark:"#be123c",primaryLight:"#fff1f2",primaryFocus:"rgba(225, 29, 72, 0.4)"},grid:{headerBackground:"#fff1f2",headerHoverBackground:"#ffe4e6",headerSortedBackground:"#fecdd3",rowAlternateBackground:"#fff8f8",rowSelectedBackground:"#ffe4e6",rowSelectedHoverBackground:"#fecdd3",cellFocusBorder:"#e11d48"}},hi={colors:{primary:"#059669",primaryDark:"#047857",primaryLight:"#ecfdf5",primaryFocus:"rgba(5, 150, 105, 0.4)"},grid:{headerBackground:"#ecfdf5",headerHoverBackground:"#d1fae5",headerSortedBackground:"#a7f3d0",rowAlternateBackground:"#f6fdf9",rowSelectedBackground:"#d1fae5",rowSelectedHoverBackground:"#a7f3d0",cellFocusBorder:"#059669"}},pi={colors:{primary:"#d97706",primaryDark:"#b45309",primaryLight:"#fffbeb",primaryFocus:"rgba(217, 119, 6, 0.4)"},grid:{headerBackground:"#fffbeb",headerHoverBackground:"#fef3c7",headerSortedBackground:"#fde68a",rowAlternateBackground:"#fffdf5",rowSelectedBackground:"#fef3c7",rowSelectedHoverBackground:"#fde68a",cellFocusBorder:"#d97706"}},xi={grid:{rowHeightCompact:"28px",rowHeightStandard:"36px",rowHeightComfortable:"48px",headerHeight:"40px",cellPaddingX:"8px",cellPaddingY:"4px"},typography:{fontSizeSm:"0.8rem",fontSizeMd:"0.875rem"}};function mi(n,o){try{const e=o.getItem(n);return e?JSON.parse(e):void 0}catch{return}}function bi(n,o,e,r){try{const i=e?Object.fromEntries(Object.entries(o).filter(([s])=>e.includes(s))):o;r.setItem(n,JSON.stringify(i))}catch{}}function wi(n){const o=typeof n=="string"?{key:n}:n,{key:e,debounceMs:r=300,include:i,storage:s=typeof window<"u"?window.localStorage:void 0}=o,d=l.useMemo(()=>{if(s)return mi(e,s)},[e]),a=l.useRef(null),f=l.useRef(null),g=l.useCallback(()=>{f.current&&s&&bi(e,f.current,i,s)},[e,i,s]),p=l.useCallback(u=>{f.current=u,a.current&&clearTimeout(a.current),a.current=setTimeout(g,r)},[g,r]);l.useEffect(()=>()=>{a.current&&(clearTimeout(a.current),g())},[g]);const b=l.useCallback(()=>{s&&s.removeItem(e)},[e,s]);return{initialState:d,onStateChange:p,clearState:b}}oe.Button=Qt,oe.Cell=no,oe.Checkbox=qt,oe.DataGrid=Rr,oe.DataGridThemeProvider=ui,oe.FilterPanel=co,oe.GridToolbar=Xr,oe.GridTooltip=Zt,oe.Header=to,oe.Input=Jr,oe.Row=Jt,oe.Skeleton=Fr,oe.amberTheme=pi,oe.compactTheme=xi,oe.darkTheme=gi,oe.emeraldTheme=hi,oe.exportToCsv=Qr,oe.exportToExcel=Zr,oe.exportToExcelAdvanced=si,oe.exportToJson=ei,oe.formatAggregationValue=bt,oe.printGrid=ti,oe.roseTheme=fi,oe.useAggregation=io,oe.useGridApiRef=qr,oe.useGridStateStorage=wi,oe.usePivot=lo,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})}));
|
|
53
53
|
//# sourceMappingURL=opengridx.umd.js.map
|