react-gridix 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/dist/index.d.ts +14 -0
- package/dist/react-gridix.cjs +4 -4
- package/dist/react-gridix.js +273 -267
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2804,7 +2804,61 @@ Full control (size, rounded ends, hover colour) with `scrollbar="custom"`:
|
|
|
2804
2804
|
The list of options in a `filterType: "select"` popup scrolls without showing a scroll bar.
|
|
2805
2805
|
|
|
2806
2806
|
|
|
2807
|
-
### 6.29
|
|
2807
|
+
### 6.29 Very narrow columns and text overflow
|
|
2808
|
+
|
|
2809
|
+
Any `width` from 1 upward is honored. Widths under 40 also drop the side padding of that column, so `width: 1` really is 1px wide. Use `overflow` to choose what happens to text that does not fit (header and cells):
|
|
2810
|
+
|
|
2811
|
+
```tsx
|
|
2812
|
+
const columns = [
|
|
2813
|
+
{ field: "color", header: "", width: 6 }, // a thin strip (cut off: "clip" is the default under 40)
|
|
2814
|
+
{ field: "id", header: "ID", width: 50 }, // wraps onto new lines by default when a width is set
|
|
2815
|
+
{ field: "name", header: "Name", width: 120, overflow: "ellipsis" }, // "Alexander Ha..."
|
|
2816
|
+
{ field: "notes", header: "Notes", width: 200, overflow: "wrap" }, // breaks lines, even inside a word
|
|
2817
|
+
{ field: "code", header: "Code", width: 80, overflow: "clip" }, // cut off without dots
|
|
2818
|
+
];
|
|
2819
|
+
```
|
|
2820
|
+
|
|
2821
|
+
Tip: show the full text in a tooltip with a cell renderer, `cellRenderer: ({ value }) => <span title={String(value)}>{String(value)}</span>`.
|
|
2822
|
+
|
|
2823
|
+
### 6.30 Skeleton on the first render (refresh, server rendering)
|
|
2824
|
+
|
|
2825
|
+
In server-side mode (`serverSide` with `onQueryChange`) the grid starts in the loading state, so the skeleton is in the server-rendered HTML and in the first paint after a refresh. If you control loading yourself, start with `true` so the first render already shows it:
|
|
2826
|
+
|
|
2827
|
+
```tsx
|
|
2828
|
+
// Fetching in your own code: start as loading, not false
|
|
2829
|
+
const [loading, setLoading] = useState(true);
|
|
2830
|
+
useEffect(() => { fetchRows().then(setRows).finally(() => setLoading(false)); }, []);
|
|
2831
|
+
|
|
2832
|
+
<DataGrid rows={rows} columns={columns} loading={loading} loadingRows={8} />
|
|
2833
|
+
```
|
|
2834
|
+
|
|
2835
|
+
### 6.31 Skeleton per column
|
|
2836
|
+
|
|
2837
|
+
Give a column its own placeholder with `skeleton`. It replaces the default bar (and the grid's `skeletonRow`) for that column; the other columns keep the default bar.
|
|
2838
|
+
|
|
2839
|
+
```tsx
|
|
2840
|
+
import type { ColumnDef, SkeletonCellProps } from "react-gridix";
|
|
2841
|
+
|
|
2842
|
+
// A round avatar placeholder with a text line beside it
|
|
2843
|
+
const UserSkeleton = ({ rowIndex }: SkeletonCellProps) => (
|
|
2844
|
+
<div className="flex items-center gap-2 animate-pulse">
|
|
2845
|
+
<span className="h-8 w-8 rounded-full bg-gray-200" />
|
|
2846
|
+
<span className="h-3 rounded bg-gray-200" style={{ width: 60 + (rowIndex % 3) * 20 }} />
|
|
2847
|
+
</div>
|
|
2848
|
+
);
|
|
2849
|
+
|
|
2850
|
+
const columns: ColumnDef<User>[] = [
|
|
2851
|
+
{ field: "name", header: "Name", skeleton: UserSkeleton }, // custom placeholder
|
|
2852
|
+
{ field: "email", header: "Email" }, // default bar
|
|
2853
|
+
{ field: "status", header: "Status", skeleton: () => <span className="inline-block h-5 w-14 rounded-full bg-gray-200" /> },
|
|
2854
|
+
];
|
|
2855
|
+
|
|
2856
|
+
<DataGrid rows={rows} columns={columns} loading={loading} loadingRows={8} />
|
|
2857
|
+
```
|
|
2858
|
+
|
|
2859
|
+
If any column has a `skeleton`, the grid's whole-row `skeletonRow` is not used (it draws one wide cell, which cannot be mixed with per-column cells).
|
|
2860
|
+
|
|
2861
|
+
### 6.32 Known limitations
|
|
2808
2862
|
|
|
2809
2863
|
Not included:
|
|
2810
2864
|
|
|
@@ -2868,7 +2922,7 @@ The Styling demo loads Tailwind from its CDN, so it needs an internet connection
|
|
|
2868
2922
|
|
|
2869
2923
|
---
|
|
2870
2924
|
|
|
2871
|
-
##
|
|
2925
|
+
## 8. Troubleshooting
|
|
2872
2926
|
|
|
2873
2927
|
| Problem | Cause and fix |
|
|
2874
2928
|
| --- | --- |
|
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,12 @@ export declare interface ColumnDef<T = Record<string, any>> {
|
|
|
141
141
|
sequenceRestartEachPage?: boolean;
|
|
142
142
|
/** Column width: a number (pixels) or any CSS length such as "20%" or "12rem". Columns without one share the remaining space. */
|
|
143
143
|
width?: number | string;
|
|
144
|
+
/**
|
|
145
|
+
* The placeholder drawn in this column's cells while the grid is loading. It replaces the default bar
|
|
146
|
+
* and the grid's `skeletonRow` for this column. Columns without one keep the default bar.
|
|
147
|
+
* (If any column has a `skeleton`, the grid's whole-row `skeletonRow` is not used.)
|
|
148
|
+
*/
|
|
149
|
+
skeleton?: ComponentType<SkeletonCellProps<T>>;
|
|
144
150
|
/**
|
|
145
151
|
* What happens to text that does not fit the column (header and cells):
|
|
146
152
|
* "wrap" breaks it onto new lines (even in the middle of a word), "ellipsis" cuts it and shows "...",
|
|
@@ -829,6 +835,14 @@ export declare interface RowSelection<T> {
|
|
|
829
835
|
/** The field of a `type: "sequence"` column. It holds no data, so it can be any name that starts with `#`. */
|
|
830
836
|
export declare type SequenceField = `#${string}`;
|
|
831
837
|
|
|
838
|
+
/** Props received by a column's `skeleton` component, which draws the placeholder of ONE cell while loading. */
|
|
839
|
+
export declare interface SkeletonCellProps<T = Record<string, any>> {
|
|
840
|
+
/** Position of this placeholder row (0, 1, 2 ...). */
|
|
841
|
+
rowIndex: number;
|
|
842
|
+
/** The column this placeholder belongs to. */
|
|
843
|
+
column: ColumnDef<T>;
|
|
844
|
+
}
|
|
845
|
+
|
|
832
846
|
/** Props received by the `skeletonRow` component, which draws one placeholder row while loading. */
|
|
833
847
|
export declare interface SkeletonRowProps<T = Record<string, any>> {
|
|
834
848
|
/** Position of this placeholder row (0, 1, 2 ...). */
|
package/dist/react-gridix.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var xs=Object.create;var Wr=Object.defineProperty;var bs=Object.getOwnPropertyDescriptor;var ys=Object.getOwnPropertyNames;var _s=Object.getPrototypeOf,ws=Object.prototype.hasOwnProperty;var vs=(t,n,o,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let f of ys(n))!ws.call(t,f)&&f!==o&&Wr(t,f,{get:()=>n[f],enumerable:!(s=bs(n,f))||s.enumerable});return t};var ks=(t,n,o)=>(o=t!=null?xs(_s(t)):{},vs(n||!t||!t.__esModule?Wr(o,"default",{value:t,enumerable:!0}):o,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),p=require("react"),Ss=require("react-dom"),kt=(...t)=>t.filter(Boolean).join(" ");function js(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:i.jsx("path",{d:"M3.5 8.5l3 3 6-7",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cs(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:i.jsx("path",{d:"M4 8h8",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round"})})}function Je({checked:t,onChange:n,indeterminate:o=!1,variant:s="native",disabled:f=!1,label:u,"aria-label":c,id:m,name:x,indicator:_,className:F,style:b,classNames:S={},styles:g={}}){const k=o?"indeterminate":t?"checked":"unchecked";return i.jsxs("label",{className:kt("rg-checkbox",`rg-checkbox--${s}`,k==="checked"&&"rg-checkbox--checked",o&&"rg-checkbox--indeterminate",f&&"rg-checkbox--disabled",S.root,F),style:{...g.root,...b},"data-state":k,children:[s==="native"?i.jsx("input",{type:"checkbox",id:m,name:x,ref:E=>{E&&(E.indeterminate=o)},className:kt("rg-checkbox__control",S.control),style:g.control,checked:t,disabled:f,"aria-label":c,"data-state":k,onChange:E=>n(E.target.checked)}):i.jsx("button",{type:"button",role:"checkbox",id:m,className:kt("rg-checkbox__control",S.control),style:g.control,"aria-checked":o?"mixed":t,"aria-label":c,disabled:f,"data-state":k,onClick:()=>n(!t),children:i.jsx("span",{className:kt("rg-checkbox__indicator",_!==void 0&&!o&&"rg-checkbox__indicator--custom",S.indicator),style:g.indicator,"data-state":k,"aria-hidden":"true",children:o?s==="tick"?i.jsx(Cs,{}):null:_!==void 0?_:s==="tick"?i.jsx(js,{}):null})}),u!=null&&u!==!1&&u!==""&&i.jsx("span",{className:kt("rg-checkbox__label",S.label),style:g.label,children:u})]})}const Ns=/^(\d{4})-(\d{2})-(\d{2})$/,Br=t=>String(t).padStart(2,"0");function re(t){const n=Ns.exec(t);if(!n)return null;const[o,s,f]=[Number(n[1]),Number(n[2]),Number(n[3])],u=new Date(o,s-1,f);return u.getFullYear()===o&&u.getMonth()===s-1&&u.getDate()===f?u:null}function ue(t){var n;if(t instanceof Date)return Number.isNaN(t.getTime())?null:`${t.getFullYear()}-${Br(t.getMonth()+1)}-${Br(t.getDate())}`;if(typeof t=="number")return Number.isFinite(t)?ue(new Date(t)):null;if(typeof t=="string"){const o=t.trim();if(o==="")return null;const s=(n=/^\d{4}-\d{2}-\d{2}/.exec(o))==null?void 0:n[0];if(s)return re(s)?s:null;const f=Date.parse(o);return Number.isNaN(f)?null:ue(new Date(f))}return null}function Es(t,n,o){const s=ue(t);return s?re(s).toLocaleDateString(n,o??{year:"numeric",month:"short",day:"numeric"}):t==null?"":String(t)}function Ds(t,n){var o;return t===""?null:n instanceof Date?re(t):typeof n=="number"?((o=re(t))==null?void 0:o.getTime())??null:t}const O=(...t)=>t.filter(Boolean).join(" "),Ct=t=>t.headerName??(t.type==="boolean"?"":t.type==="sequence"?"#":t.field),Ge=t=>Ct(t)||t.field,Kr=t=>String(t).padStart(2,"0"),Ln=(t,n,o)=>`${t}-${Kr(n+1)}-${Kr(o)}`;function qr(t,n,o,s){const f=[t,n==null?void 0:n.from,n==null?void 0:n.to].map(x=>x?re(x):null).find(Boolean);if(f)return new Date(f.getFullYear(),f.getMonth(),1);const u=new Date;let c=ue(u);o&&c<o&&(c=o),s&&c>s&&(c=s);const m=re(c)??u;return new Date(m.getFullYear(),m.getMonth(),1)}function ao({value:t,range:n,min:o,max:s,onPick:f,locale:u,weekStart:c=0,hideFooter:m,keepFocus:x,className:_}){var je;const[F,b]=p.useState(()=>qr(t,n,o,s)),[S,g]=p.useState(null),k=p.useRef(null),E=p.useRef({value:t,from:n==null?void 0:n.from,to:n==null?void 0:n.to});p.useEffect(()=>{const w=E.current;E.current={value:t,from:n==null?void 0:n.from,to:n==null?void 0:n.to};const H=t!==w.value?t:(n==null?void 0:n.from)!==w.from?n==null?void 0:n.from:(n==null?void 0:n.to)!==w.to?n==null?void 0:n.to:void 0,j=H?re(H):null;j&&b(A=>A.getFullYear()===j.getFullYear()&&A.getMonth()===j.getMonth()?A:new Date(j.getFullYear(),j.getMonth(),1))},[t,n==null?void 0:n.from,n==null?void 0:n.to]);const N=ue(new Date),T=F.getFullYear(),v=F.getMonth(),R=p.useMemo(()=>{const w=new Intl.DateTimeFormat(u,{weekday:"short"});return Array.from({length:7},(H,j)=>w.format(new Date(2023,0,1+(j+c)%7)))},[u,c]),Y=new Intl.DateTimeFormat(u,{month:"long",year:"numeric"}).format(F),K=p.useMemo(()=>{const w=(new Date(T,v,1).getDay()-c+7)%7;return Array.from({length:42},(H,j)=>{const A=new Date(T,v,1-w+j);return{iso:Ln(A.getFullYear(),A.getMonth(),A.getDate()),day:A.getDate(),outside:A.getMonth()!==v}})},[T,v,c]),U=w=>!!o&&w<o||!!s&&w>s,z=w=>b(new Date(T,v+w,1)),ye=w=>{const H=re(w);H&&((H.getFullYear()!==T||H.getMonth()!==v)&&b(new Date(H.getFullYear(),H.getMonth(),1)),g(w),requestAnimationFrame(()=>{var j,A;return(A=(j=k.current)==null?void 0:j.querySelector(`[data-iso="${w}"]`))==null?void 0:A.focus()}))},De=(w,H)=>{const j=re(H),A=le=>{w.preventDefault(),ye(Ln(j.getFullYear(),j.getMonth(),j.getDate()+le))};switch(w.key){case"ArrowLeft":return A(-1);case"ArrowRight":return A(1);case"ArrowUp":return A(-7);case"ArrowDown":return A(7);case"Home":return A(-((j.getDay()-c+7)%7));case"End":return A(6-(j.getDay()-c+7)%7);case"PageUp":case"PageDown":{w.preventDefault();const le=w.key==="PageUp"?-1:1,fe=new Date(j.getFullYear(),j.getMonth()+le+1,0).getDate();ye(Ln(j.getFullYear(),j.getMonth()+le,Math.min(j.getDate(),fe)));return}}},Oe=w=>!!w&&K.some(H=>H.iso===w&&!H.outside),Se=[S,t,N].find(w=>Oe(w)&&!U(w))??((je=K.find(w=>!w.outside&&!U(w.iso)))==null?void 0:je.iso),q=n==null?void 0:n.from,oe=n==null?void 0:n.to;return i.jsxs("div",{className:O("rg-cal",_),onMouseDown:x?w=>w.preventDefault():void 0,role:"group","aria-label":`Calendar, ${Y}`,children:[i.jsxs("div",{className:"rg-cal__head",children:[i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Previous year",onClick:()=>z(-12),children:"«"}),i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Previous month",onClick:()=>z(-1),children:"‹"}),i.jsx("span",{className:"rg-cal__title","aria-live":"polite",children:Y}),i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Next month",onClick:()=>z(1),children:"›"}),i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Next year",onClick:()=>z(12),children:"»"})]}),i.jsxs("div",{className:"rg-cal__grid",ref:k,children:[R.map(w=>i.jsx("span",{className:"rg-cal__dow","aria-hidden":"true",children:w.slice(0,2)},w)),K.map(({iso:w,day:H,outside:j})=>{const A=w===t,le=w===q,fe=w===oe,Ue=!!q&&!!oe&&w>q&&w<oe;return i.jsx("button",{type:"button","data-iso":w,tabIndex:w===Se?0:-1,disabled:U(w),"aria-pressed":A||le||fe,"aria-label":new Intl.DateTimeFormat(u,{dateStyle:"full"}).format(re(w)),className:O("rg-cal__day",j&&"rg-cal__day--outside",w===N&&"rg-cal__day--today",(A||le||fe)&&"rg-cal__day--selected",Ue&&"rg-cal__day--in-range",q&&oe&&le&&q!==oe&&"rg-cal__day--range-start",q&&oe&&fe&&q!==oe&&"rg-cal__day--range-end"),onClick:()=>f(w),onKeyDown:Qe=>De(Qe,w),onFocus:()=>g(w),children:H},w)})]}),!m&&i.jsxs("div",{className:"rg-cal__foot",children:[i.jsx("button",{type:"button",className:"rg-cal__link",disabled:U(N),onClick:()=>{b(qr(N)),f(N)},children:"Today"}),i.jsx("button",{type:"button",className:"rg-cal__link",onClick:()=>f(""),children:"Clear"})]})]})}const Nt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function St(t,n,o){const[s,f]=p.useState(n),u=t!==void 0,c=u?t:s,m=p.useCallback(x=>{u||f(x),o==null||o(x)},[u,o]);return[c,m]}function co(t,n){const o=p.useRef(t);o.current=t;const s=p.useRef(void 0),f=p.useRef(null),u=p.useCallback(()=>{s.current!==void 0&&clearTimeout(s.current),s.current=void 0,f.current=null},[]),c=p.useCallback(()=>{s.current!==void 0&&clearTimeout(s.current),s.current=void 0;const x=f.current;f.current=null,x&&o.current(...x)},[]),m=p.useCallback((...x)=>{if(n<=0){u(),o.current(...x);return}f.current=x,s.current!==void 0&&clearTimeout(s.current),s.current=setTimeout(c,n)},[n,u,c]);return p.useEffect(()=>c,[c]),{call:m,flush:c,cancel:u}}function mn({anchorRef:t,open:n,onClose:o,label:s,theme:f,className:u,style:c,keepFocus:m,children:x}){const _=p.useRef(null),[F,b]=p.useState({top:0,left:0}),S=p.useCallback(()=>{var T;const g=t.current;if(!g)return;const k=g.getBoundingClientRect(),E=((T=_.current)==null?void 0:T.offsetWidth)??260,N=Math.max(8,Math.min(k.left,window.innerWidth-E-8));b({top:k.bottom+6,left:N})},[t]);return Nt(()=>{n&&S()},[n,S]),p.useEffect(()=>{if(!n)return;const g=E=>{var T,v;const N=E.target;(T=_.current)!=null&&T.contains(N)||(v=t.current)!=null&&v.contains(N)||o()},k=E=>{var N;E.key==="Escape"&&(o(),(N=t.current)==null||N.focus())};return document.addEventListener("mousedown",g),document.addEventListener("keydown",k),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",k),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[n,o,S,t]),!n||typeof document>"u"?null:Ss.createPortal(i.jsx("div",{ref:_,role:"dialog",onMouseDown:m?g=>g.preventDefault():void 0,"aria-label":s,"data-rg-theme":f||void 0,className:O("rg-grid-popup",u),style:{position:"fixed",top:F.top,left:F.left,...c},children:x}),document.body)}function Ts({value:t,onChange:n,onPick:o,onBlur:s,onKeyDown:f,min:u,max:c,locale:m,invalid:x,label:_,theme:F,className:b,style:S}){const g=p.useRef(null),k=E=>{const N=E.ctrlKey||E.altKey||E.metaKey,T=E.key==="ArrowUp"?{days:-7,months:0}:E.key==="ArrowDown"?{days:7,months:0}:N&&E.key==="ArrowLeft"?{days:-1,months:0}:N&&E.key==="ArrowRight"?{days:1,months:0}:E.key==="PageUp"?{days:0,months:-1}:E.key==="PageDown"?{days:0,months:1}:null;if(!T||E.shiftKey)return f(E);E.preventDefault();const v=re(t)??new Date,R=new Date(v.getFullYear(),v.getMonth()+T.months+1,0).getDate(),Y=new Date(v.getFullYear(),v.getMonth()+T.months,Math.min(v.getDate(),R)+T.days);let K=ue(Y);u&&K<u&&(K=u),c&&K>c&&(K=c),n(K)};return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:g,autoFocus:!0,type:"text",inputMode:"numeric",placeholder:"YYYY-MM-DD",autoComplete:"off",className:b,style:S,value:t,"aria-label":_,"aria-invalid":x||void 0,"aria-haspopup":"dialog","aria-expanded":!0,onChange:E=>n(E.target.value.trim()),onBlur:s,onKeyDown:k,onFocus:E=>E.currentTarget.setSelectionRange(E.currentTarget.value.length,E.currentTarget.value.length)}),i.jsx(mn,{anchorRef:g,open:!0,onClose:()=>{},label:_,theme:F,className:"rg-date-popup",keepFocus:!0,children:i.jsx(ao,{value:t,min:u,max:c,locale:m,onPick:o,keepFocus:!0})})]})}function zr(t){return t.filterType?t.filterType:t.type==="number"?"number":t.type==="date"?"date":t.type==="boolean"?"select":"text"}const Yr=["contains","notContains","equals","notEquals","startsWith","notStartsWith","endsWith","notEndsWith"],Vr={contains:"Contains",notContains:"Does not contain",equals:"Equals",notEquals:"Not equal",startsWith:"Starts with",notStartsWith:"Does not start with",endsWith:"Ends with",notEndsWith:"Does not end with"};function uo(t){const n=t.filterOperators;if(!n)return null;if(n===!0)return Yr;const o=Yr.filter(s=>n.includes(s));return o.length>0?o:null}function Fs(t,n){const o=uo(t),s=t.filterOperator??(n==="exact"?"equals":"contains");return o&&!o.includes(s)?o[0]:s}function Hr(t,n,o){const s=n.toLowerCase(),f=o.trim().toLowerCase();switch(t){case"contains":return s.includes(f);case"notContains":return!s.includes(f);case"equals":return s===f;case"notEquals":return s!==f;case"startsWith":return s.startsWith(f);case"notStartsWith":return!s.startsWith(f);case"endsWith":return s.endsWith(f);case"notEndsWith":return!s.endsWith(f)}}const fo=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function ho(t){if(t==null)return!1;if(typeof t=="string")return t.trim()!=="";if(Array.isArray(t))return t.length>0;if(fo(t)){const n=t;return typeof n.operator=="string"?typeof n.value=="string"&&n.value.trim()!=="":typeof n.min=="number"||typeof n.max=="number"||!!n.from||!!n.to}return!1}function Ms(t,n,o,s){switch(t){case"text":case"exact":{if(fo(n)){const f=n;return Hr(f.operator,o,String(f.value??""))}return Hr(t==="exact"?"equals":"contains",o,String(n))}case"number":{const{min:f,max:u}=n,c=typeof s=="number"?s:s==null||s===""?NaN:Number(s);return Number.isNaN(c)?!1:(typeof f!="number"||c>=f)&&(typeof u!="number"||c<=u)}case"date":{const{from:f,to:u}=n,c=ue(s);return c?(!f||c>=f)&&(!u||c<=u):!1}case"select":return n.includes(String(s??""))}}function Is(t,n,o,s){if(t.filterOptions)return t.filterOptions.map(u=>typeof u=="string"?{value:u,label:u}:u);if(t.type==="boolean")return[{value:"true",label:"Yes"},{value:"false",label:"No"}];const f=new Map;for(const u of n){const c=o(u);if(c==null||c==="")continue;const m=String(c);f.has(m)||f.set(m,s(u))}return[...f].map(([u,c])=>({value:u,label:c})).sort((u,c)=>u.label.localeCompare(c.label,void 0,{numeric:!0}))}const Xr=t=>{if(t.trim()==="")return;const n=Number(t);return Number.isFinite(n)?n:void 0},qn=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function $s({value:t,onChange:n,label:o,debounce:s,inputClassName:f,inputStyle:u}){const c=qn(t)?t:{},[m,x]=p.useState(c.min===void 0?"":String(c.min)),[_,F]=p.useState(c.max===void 0?"":String(c.max)),b=p.useRef(c),S=co((g,k)=>{const E=Xr(g),N=Xr(k);b.current={min:E,max:N},n(E===void 0&&N===void 0?void 0:{min:E,max:N})},s);return p.useEffect(()=>{c.min===b.current.min&&c.max===b.current.max||(b.current=c,S.cancel(),x(c.min===void 0?"":String(c.min)),F(c.max===void 0?"":String(c.max)))},[c.min,c.max]),i.jsxs("div",{className:"rg-grid__filter-fields",children:[i.jsxs("label",{className:"rg-grid__filter-field",children:[i.jsx("span",{children:"Min"}),i.jsx("input",{autoFocus:!0,type:"number",className:O("rg-grid__filter-input",f),style:u,value:m,"aria-label":`Minimum ${o}`,onChange:g=>{x(g.target.value),S.call(g.target.value,_)},onKeyDown:g=>g.key==="Enter"&&S.flush()})]}),i.jsxs("label",{className:"rg-grid__filter-field",children:[i.jsx("span",{children:"Max"}),i.jsx("input",{type:"number",className:O("rg-grid__filter-input",f),style:u,value:_,"aria-label":`Maximum ${o}`,onChange:g=>{F(g.target.value),S.call(m,g.target.value)},onKeyDown:g=>g.key==="Enter"&&S.flush()})]})]})}function Rs({value:t,onChange:n,onEnter:o,label:s,kind:f,placeholder:u,debounce:c,inputClassName:m,inputStyle:x}){const[_,F]=p.useState(t),b=p.useRef(t),S=co(g=>{b.current=g,n(g||void 0)},c);return p.useEffect(()=>{t!==b.current&&(b.current=t,S.cancel(),F(t))},[t]),i.jsx("input",{autoFocus:!0,type:"text",className:O("rg-grid__filter-input",m),style:x,value:_,placeholder:u??(f==="exact"?"Exactly…":`Filter ${s}…`),"aria-label":`Filter text for ${s}`,onChange:g=>{F(g.target.value),S.call(g.target.value)},onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),S.flush(),o())}})}function Ps({value:t,onChange:n,label:o,inputClassName:s,inputStyle:f,min:u,max:c,locale:m}){const x=qn(t)?t:{},_=(T,v)=>n(!T&&!v?void 0:{from:T||void 0,to:v||void 0}),[F,b]=p.useState(x.from??""),[S,g]=p.useState(x.to??"");p.useEffect(()=>{(re(F)?F:"")!==(x.from??"")&&b(x.from??""),(re(S)?S:"")!==(x.to??"")&&g(x.to??"")},[x.from,x.to]);const k=(T,v)=>{if((T==="from"?b:g)(v),v!==""&&!re(v))return;const R=v||void 0;T==="from"?_(R,x.to):_(x.from,R)},E=T=>{T&&(!x.from||x.to?_(T,void 0):T<x.from?_(T,x.from):_(x.from,T))},N=(T,v,R)=>i.jsxs("label",{className:"rg-grid__filter-field",children:[i.jsx("span",{children:T==="from"?"From":"To"}),i.jsx("input",{autoFocus:R,type:"text",inputMode:"numeric",placeholder:"YYYY-MM-DD",className:O("rg-grid__filter-input",v!==""&&!re(v)&&"rg-grid__filter-input--invalid",s),style:f,value:v,"aria-label":`${o} ${T}`,"aria-invalid":v!==""&&!re(v)||void 0,onChange:Y=>k(T,Y.target.value.trim())})]});return i.jsxs("div",{className:"rg-grid__filter-fields rg-grid__filter-fields--stack",children:[i.jsxs("div",{className:"rg-grid__filter-date-row",children:[N("from",F,!0),N("to",S,!1)]}),i.jsx(ao,{range:x,min:u,max:c,locale:m,onPick:E,hideFooter:!0})]})}function Ls({value:t,onChange:n,options:o}){const s=Array.isArray(t)?t:[],f=(u,c)=>{const m=c?[...s,u]:s.filter(x=>x!==u);n(m.length?m:void 0)};return i.jsxs("div",{className:"rg-grid__filter-fields rg-grid__filter-options",role:"group",children:[o.length===0&&i.jsx("span",{className:"rg-grid__filter-empty",children:"No values"}),o.map(u=>i.jsx(Je,{checked:s.includes(u.value),onChange:c=>f(u.value,c),label:u.label??u.value},u.value))]})}function Os({value:t,options:n,onChange:o,label:s}){const[f,u]=p.useState(!1),[c,m]=p.useState(0),x=p.useId(),_=p.useRef(null),F=()=>{m(Math.max(0,n.indexOf(t))),u(!0)},b=g=>{var k;o(g),u(!1),(k=_.current)==null||k.focus()},S=g=>{if(!f){(g.key==="ArrowDown"||g.key==="ArrowUp")&&(g.preventDefault(),F());return}switch(g.key){case"ArrowDown":g.preventDefault(),m(k=>Math.min(n.length-1,k+1));break;case"ArrowUp":g.preventDefault(),m(k=>Math.max(0,k-1));break;case"Home":g.preventDefault(),m(0);break;case"End":g.preventDefault(),m(n.length-1);break;case"Enter":case" ":g.preventDefault(),b(n[c]);break;case"Escape":g.preventDefault(),g.stopPropagation(),u(!1);break;case"Tab":u(!1);break}};return i.jsxs("div",{className:"rg-op",children:[i.jsxs("button",{ref:_,type:"button",className:"rg-op__btn",role:"combobox","aria-label":`Comparison for ${s}`,"aria-haspopup":"listbox","aria-expanded":f,"aria-controls":f?x:void 0,"aria-activedescendant":f?`${x}-${c}`:void 0,onClick:()=>f?u(!1):F(),onBlur:()=>u(!1),onKeyDown:S,children:[i.jsx("span",{className:"rg-op__value",children:Vr[t]}),i.jsx("svg",{className:"rg-op__chevron",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5"})})]}),f&&i.jsx("ul",{id:x,role:"listbox",className:"rg-op__list","aria-label":`Comparisons for ${s}`,onMouseDown:g=>g.preventDefault(),children:n.map((g,k)=>i.jsxs("li",{id:`${x}-${k}`,role:"option","aria-selected":g===t,"data-op":g,className:O("rg-op__option",g===t&&"rg-op__option--selected",k===c&&"rg-op__option--active"),onMouseEnter:()=>m(k),onClick:()=>b(g),children:[Vr[g],g===t&&i.jsx("svg",{className:"rg-op__check",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 6.5 5 9l4.5-5.5"})})]},g))})]})}function Us({column:t,label:n,kind:o,value:s,onChange:f,options:u,debounce:c=300,theme:m,indicatorClassName:x,indicatorStyle:_,popupClassName:F,popupStyle:b,inputClassName:S,inputStyle:g}){const[k,E]=p.useState(!1),N=p.useRef(null),T=ho(s),v=p.useCallback(()=>E(!1),[]),R=qn(s)?s:null,Y=typeof s=="string"?s:typeof(R==null?void 0:R.value)=="string"?R.value:"",K=(o==="text"||o==="exact")&&!t.filterRenderer?uo(t):null,[U,z]=p.useState(()=>Fs(t,o)),ye=R&&typeof R.operator=="string"?R.operator:U,De=q=>{if(q===void 0)return f(void 0);f(K?{operator:ye,value:String(q)}:q)},Oe=q=>{z(q),Y.trim()!==""&&f({operator:q,value:Y})},Se=()=>{if(t.filterRenderer)return p.createElement(t.filterRenderer,{column:t,value:Y,onChange:q=>f(q||void 0)});switch(o){case"number":return i.jsx($s,{value:s,onChange:f,label:n,debounce:c,inputClassName:S,inputStyle:g});case"date":return i.jsx(Ps,{value:s,onChange:f,label:n,min:t.dateMin,max:t.dateMax,locale:t.dateLocale,inputClassName:S,inputStyle:g});case"select":return i.jsx(Ls,{value:s,onChange:f,options:u});default:return i.jsxs("div",{className:"rg-grid__filter-stack",children:[K&&i.jsx(Os,{value:ye,options:K,onChange:Oe,label:n}),i.jsx(Rs,{value:Y,onChange:De,onEnter:()=>{var q;E(!1),(q=N.current)==null||q.focus()},label:n,kind:o,placeholder:t.filterPlaceholder,debounce:c,inputClassName:S,inputStyle:g})]})}};return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:N,type:"button",className:O("rg-grid__filter-btn",T&&"rg-grid__filter-btn--active",k&&"rg-grid__filter-btn--open",x),style:_,"aria-label":`Filter ${n}`,"aria-haspopup":"dialog","aria-expanded":k,"data-active":T||void 0,onClick:q=>{q.stopPropagation(),E(oe=>!oe)},onKeyDown:q=>q.stopPropagation(),children:t.filterIndicator?p.createElement(t.filterIndicator,{column:t,active:T,open:k}):i.jsx("span",{className:"rg-grid__filter-dot","aria-hidden":"true"})}),i.jsxs(mn,{anchorRef:N,open:k,onClose:v,label:`Filter ${n}`,theme:m,className:F,style:b,children:[Se(),T&&i.jsx("button",{type:"button",className:"rg-grid__filter-clear",onClick:()=>f(void 0),children:"Clear"})]})]})}function As({columns:t,hidden:n,onToggle:o,theme:s,className:f,style:u}){const[c,m]=p.useState(!1),x=p.useRef(null),_=p.useCallback(()=>m(!1),[]),F=t.filter(b=>!n.has(b.field)).length;return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:x,type:"button",className:O("rg-grid__tool-btn",f),style:u,"aria-haspopup":"dialog","aria-expanded":c,onClick:()=>m(b=>!b),children:"Columns"}),i.jsx(mn,{anchorRef:x,open:c,onClose:_,label:"Show or hide columns",theme:s,children:i.jsx("div",{className:"rg-grid__filter-fields rg-grid__filter-options",role:"group","aria-label":"Columns",children:t.filter(b=>b.hideable!==!1).map(b=>{const S=!n.has(b.field);return i.jsx(Je,{checked:S,disabled:S&&F<=1,onChange:g=>o(b.field,!g),label:Ge(b)},b.field)})})})]})}const Ws=/^[=+\-@\t\r]/;function Bs(t,n,o){if(t==null)return"";let s=String(t);return o&&typeof t=="string"&&Ws.test(s)&&!Number.isFinite(Number(s))&&(s=`'${s}`),s.includes(n)||/["\r\n]/.test(s)?`"${s.replace(/"/g,'""')}"`:s}function Ks(t,n,o={}){const{delimiter:s=",",sanitize:f=!0}=o,u=c=>c.map(m=>Bs(m,s,f)).join(s);return[u(t),...n.map(u)].join(`\r
|
|
2
|
-
`)}function hn(t,n){if(typeof document>"u")return;const o=URL.createObjectURL(t),s=document.createElement("a");s.href=o,s.download=n,s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function qs(t,n){hn(new Blob(["\uFEFF",t],{type:"text/csv;charset=utf-8"}),n)}const po={csv:"CSV",xlsx:"Excel",json:"JSON",pdf:"PDF"},zs={csv:".csv",xlsx:".xlsx",json:".json",pdf:".pdf"},Ys=t=>`Export ${po[t]}`;function Vs({formats:t,scopes:n,scope:o,onScopeChange:s,onExport:f,theme:u,className:c,style:m,popupClassName:x}){const[_,F]=p.useState(!1),[b,S]=p.useState(null),g=p.useRef(null),k=p.useCallback(()=>F(!1),[]),E=async N=>{var T;S(N);try{await f(N,o)}finally{S(null),F(!1),(T=g.current)==null||T.focus()}};return i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:g,type:"button",className:O("rg-grid__tool-btn",c),style:m,"aria-haspopup":"dialog","aria-expanded":_,onClick:()=>F(N=>!N),children:["Export",i.jsx("svg",{className:"rg-export__chevron",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5"})})]}),i.jsx(mn,{anchorRef:g,open:_,onClose:k,label:"Export",theme:u,className:O("rg-export-popup",x),children:i.jsxs("div",{className:"rg-export",children:[n.length>1&&i.jsxs("div",{className:"rg-export__group",role:"radiogroup","aria-label":"Rows to export",children:[i.jsx("div",{className:"rg-export__title",children:"Rows to export"}),n.map(N=>{const T=N.count===0;return i.jsxs("label",{className:O("rg-export__scope",T&&"rg-export__scope--disabled",N.value===o&&"rg-export__scope--on"),children:[i.jsx("input",{type:"radio",name:"rg-export-scope",value:N.value,checked:N.value===o,disabled:T,onChange:()=>s(N.value)}),i.jsx("span",{className:"rg-export__scope-label",children:N.label}),i.jsx("span",{className:"rg-export__count",children:N.count})]},N.value)})]}),i.jsxs("div",{className:"rg-export__group",children:[i.jsx("div",{className:"rg-export__title",children:"Download as"}),t.map(N=>i.jsxs("button",{type:"button",className:"rg-export__format","data-format":N,disabled:b!==null,onClick:()=>E(N),children:[i.jsx("span",{children:po[N]}),i.jsx("span",{className:"rg-export__ext",children:b===N?"Preparing…":zs[N]})]},N))]})]})})]})}let xe;function de(t){const n=(t??"").trim();if(!n||n==="transparent"||n==="none")return null;const o=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n);if(o){let _=o[1];return _.length===3&&(_=_.split("").map(F=>F+F).join("")),[parseInt(_.slice(0,2),16),parseInt(_.slice(2,4),16),parseInt(_.slice(4,6),16)]}const s=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i.exec(n);if(s)return Gr([Number(s[1]),Number(s[2]),Number(s[3])],Hs(s[4]));if(typeof document>"u"||(xe===void 0&&(xe=document.createElement("canvas").getContext("2d",{willReadFrequently:!0})),!xe))return null;xe.fillStyle="#000000",xe.fillStyle=n;const f=String(xe.fillStyle);if(xe.fillStyle="#ffffff",xe.fillStyle=n,f!==String(xe.fillStyle))return null;xe.clearRect(0,0,1,1),xe.fillRect(0,0,1,1);const[u,c,m,x]=xe.getImageData(0,0,1,1).data;return x===0?null:Gr([u,c,m],x/255)}const Hs=t=>t===void 0?1:t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Gr(t,n){if(!(n>0))return null;const o=Math.min(1,n);return t.map(s=>Math.round(Math.min(255,s)*o+255*(1-o)))}const Xs=([t,n,o])=>(.299*t+.587*n+.114*o)/255,On=t=>Xs(t)>.55?[31,41,55]:[243,244,246],Un=72/96,Et="Install them with: npm install jspdf jspdf-autotable (and html2canvas for header / footer elements), then pass them in exportable.pdf.libraries.";async function Jr(t,n){try{return await n()}catch(o){const s=o instanceof Error?o.message:String(o);throw new Error(`PDF export needs the package "${t}", which could not be loaded (${s}). ${Et}`)}}function Qr(t,n,o){return t.replace(/\{page\}/g,String(n)).replace(/\{pages\}/g,String(o)).replace(/\{date\}/g,new Date().toLocaleDateString())}async function Gs(t){const n=Array.from(t.querySelectorAll("img")).map(o=>o.complete?Promise.resolve():new Promise(s=>{o.addEventListener("load",()=>s(),{once:!0}),o.addEventListener("error",()=>s(),{once:!0})}));await Promise.race([Promise.all(n),new Promise(o=>setTimeout(o,5e3))])}async function Js(t,n,o,s,f){const u=o.html2canvas;if(typeof u!="function")throw new Error(`A PDF header / footer element needs html2canvas. Add it to exportable.pdf.libraries. ${Et}`);const[c,m]=await Promise.all([Jr("react-dom/client",()=>Promise.resolve().then(()=>require("./client-40__X0_a.cjs")).then(b=>b.client)),Jr("react-dom",()=>import("react-dom"))]),x=2,_=document.createElement("div");_.style.cssText=`position:fixed;left:-10000px;top:0;width:${Math.round(n/Un)}px;background:${s};color:${f};font-family:system-ui,sans-serif;font-size:14px;`,document.body.appendChild(_);const F=c.createRoot(_);try{m.flushSync(()=>F.render(t)),await Gs(_),await new Promise(S=>requestAnimationFrame(()=>S(void 0)));const b=await u(_,{scale:x,backgroundColor:s,useCORS:!0,logging:!1});return{dataUrl:b.toDataURL("image/png"),width:b.width/x*Un,height:b.height/x*Un}}finally{F.unmount(),_.remove()}}async function An(t,n,o,s,f,u){if(t==null||t===!1||t===!0||t==="")return null;if(typeof t=="string"||typeof t=="number")return{kind:"text",text:String(t)};const c=await Js(t,n,s,f,u),m=Math.min(1,n/c.width,o/c.height);return{kind:"image",dataUrl:c.dataUrl,width:c.width*m,height:c.height*m}}const Zr=t=>`rgb(${t[0]},${t[1]},${t[2]})`,eo=["normal","bold","italic","bolditalic"];function to(t,n){return typeof t=="number"?{top:t,right:t,bottom:t,left:t}:{top:(t==null?void 0:t.top)??n,right:(t==null?void 0:t.right)??n,bottom:(t==null?void 0:t.bottom)??n,left:(t==null?void 0:t.left)??n}}function no(t){return Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0))}async function Qs(t,n={},o={}){var et,tt;let s;try{s=typeof n.libraries=="function"?await n.libraries():n.libraries}catch(D){const G=D instanceof Error?D.message:String(D);throw new Error(`PDF export could not load jspdf / jspdf-autotable (${G}). ${Et}`)}if(!s)throw new Error(`PDF export needs the jspdf and jspdf-autotable libraries. ${Et}`);const f=s.jsPDF,u=s.autoTable;if(typeof f!="function"||typeof u!="function")throw new Error(`exportable.pdf.libraries must contain jsPDF (a class) and autoTable (a function). ${Et}`);const{title:c,header:m,footer:x,headerAlign:_="left",footerAlign:F="center",orientation:b="auto",pageSize:S="a4",tableTheme:g="striped",pageNumbers:k=!0,maxImageHeight:E=90,beforeRender:N,autoTableOptions:T}=n,v={...o,...no({headColor:n.headColor,headTextColor:n.headTextColor,fontSize:n.fontSize,fontName:n.fontName,margin:n.margin}),...no(n.style??{})},R=to(v.margin,36),Y=v.fontName??"helvetica",K=v.fontSize??9,U=de(v.pageBackground),z=U?On(U):[75,85,99],ye=de(v.textColor)??z,De=de(v.titleColor)??(U?On(U):[17,24,39]),Oe=de(v.headColor)??[79,70,229],Se=de(v.headTextColor)??[255,255,255],q=de(v.bodyTextColor),oe=de((et=v.stripeColors)==null?void 0:et[0]),je=de((tt=v.stripeColors)==null?void 0:tt[1]),w=de(v.bodyColor)??oe??U??void 0,H=de(v.borderColor),j=new f({orientation:b==="auto"?t.headers.length>6?"landscape":"portrait":b,unit:"pt",format:S});N&&await N(j);const A=j.internal.pageSize.getWidth(),le=j.internal.pageSize.getHeight(),fe=A-R.left-R.right,Ue=10,Qe=12,Dt=new Set,it=D=>{!U||Dt.has(D)||(Dt.add(D),j.setFillColor(...U),j.rect(0,0,A,le,"F"))};it(1);const Ae=U?Zr(U):"#ffffff",We=Zr(ye),ie=await An(m,fe,E,s,Ae,We),he=await An(x,fe,E,s,Ae,We);j.setFont(Y,"normal"),j.setFontSize(Ue);const at=D=>D?D.kind==="image"?D.height:j.splitTextToSize(Qr(D.text,99,99),fe).length*Qe:0,Be=at(ie),ct=at(he),Te=Math.min(18,R.top),dt=le-14,ut=le-(k?26:18),Tt=ie?Math.max(R.top,Te+Be+12):R.top,ft=Math.max(R.bottom,he?le-ut+ct+10:k?34:0);let Ke=Tt;if(c&&typeof c!="string"&&typeof c!="number"&&typeof c!="boolean"){const D=await An(c,fe,E,s,Ae,We);D&&D.kind==="image"&&(j.addImage(D.dataUrl,"PNG",R.left,Ke,D.width,D.height),Ke+=D.height+12)}else c&&(j.setFont(Y,"bold"),j.setFontSize(v.titleSize??14),j.setTextColor(...De),j.text(String(c),R.left,Ke+(v.titleSize??14)),Ke+=(v.titleSize??14)+12);const Ft={};t.fields.forEach((D,G)=>{var It;const $=(It=v.columns)==null?void 0:It[D],se={},ze=($==null?void 0:$.align)??t.aligns[G];ze&&(se.halign=ze),($==null?void 0:$.width)!==void 0&&(se.cellWidth=$.width);const Fe=de($==null?void 0:$.textColor);Fe&&(se.textColor=Fe);const Mt=de($==null?void 0:$.backgroundColor);Mt&&(se.fillColor=Mt),$!=null&&$.fontStyle&&eo.includes($.fontStyle)&&(se.fontStyle=$.fontStyle),$!=null&&$.fontSize&&(se.fontSize=$.fontSize),Object.keys(se).length>0&&(Ft[G]=se)});const Ce={font:Y,fontSize:K,cellPadding:to(v.cellPadding,4),overflow:"linebreak",valign:"middle"};q?Ce.textColor=q:U&&(Ce.textColor=On(U)),H&&(Ce.lineColor=H),v.borderWidth!==void 0?Ce.lineWidth=v.borderWidth:H&&(Ce.lineWidth=.5),v.minRowHeight&&(Ce.minCellHeight=v.minRowHeight);const _e={head:[t.headers],body:t.rows,startY:Ke,margin:{top:Tt,right:R.right,bottom:ft,left:R.left},theme:g,showHead:"everyPage",styles:Ce,headStyles:{fillColor:Oe,textColor:Se,fontStyle:v.headFontStyle&&eo.includes(v.headFontStyle)?v.headFontStyle:"bold",...v.headFontSize?{fontSize:v.headFontSize}:null},columnStyles:Ft,willDrawPage:()=>{var G,$;const D=typeof j.getCurrentPageInfo=="function"?j.getCurrentPageInfo():($=(G=j.internal).getCurrentPageInfo)==null?void 0:$.call(G);D!=null&&D.pageNumber&&it(D.pageNumber)}};w&&(_e.bodyStyles={fillColor:w}),oe&&je?(_e.bodyStyles={fillColor:oe},_e.alternateRowStyles={fillColor:je}):(oe||w)&&(_e.alternateRowStyles={fillColor:w});const Ze={..._e,...T};for(const D of["styles","headStyles","bodyStyles","alternateRowStyles","margin"]){const G=_e[D],$=T==null?void 0:T[D];G&&$&&typeof $=="object"&&(Ze[D]={...G,...$})}u(j,Ze);const ht=typeof j.getNumberOfPages=="function"?j.getNumberOfPages():j.internal.getNumberOfPages(),ae=(D,G)=>D==="center"?(A-G)/2:D==="right"?A-R.right-G:R.left,qe=(D,G,$,se)=>{if(!D)return;if(D.kind==="image"){j.addImage(D.dataUrl,"PNG",ae($,D.width),G,D.width,D.height);return}j.setFont(Y,"normal"),j.setFontSize(Ue),j.setTextColor(...ye);const ze=j.splitTextToSize(Qr(D.text,se,ht),fe),Fe=$==="center"?A/2:$==="right"?A-R.right:R.left;j.text(ze,Fe,G+Ue,{align:$})};for(let D=1;D<=ht;D++)j.setPage(D),qe(ie,Te,_,D),qe(he,ut-ct,F,D),k&&(j.setFont(Y,"normal"),j.setFontSize(8),j.setTextColor(...ye),j.text(`Page ${D} of ${ht}`,A-R.right,dt,{align:"right"}));return j.output("blob")}function Zs(t){var F;if(!t||typeof getComputedStyle>"u")return{};const n={},o=b=>b?getComputedStyle(b):null,s=b=>{var S;for(let g=b;g;g=g.parentElement){const k=(S=o(g))==null?void 0:S.backgroundColor;if(k&&de(k))return k}},f=b=>{const S=de(b);return S?"#"+S.map(g=>g.toString(16).padStart(2,"0")).join(""):void 0},u=b=>b?Math.round(parseFloat(b)*.75*10)/10:void 0,c=t.querySelector("thead th");if(c){const b=o(c);n.headColor=f(s(c)),n.headTextColor=f(b.color),n.headFontStyle=parseInt(b.fontWeight,10)>=600?"bold":"normal"}const m=Array.from(t.querySelectorAll("tbody tr.rg-grid__row:not(.rg-grid__row--exit)")).slice(0,2),x=(F=m[0])==null?void 0:F.querySelector("td");if(x){const b=o(x);n.bodyTextColor=f(b.color);const S=u(b.fontSize);S&&!Number.isNaN(S)&&(n.fontSize=Math.min(14,Math.max(6,S)));const g=f(s(m[0].querySelector("td"))),k=f(m[1]?s(m[1].querySelector("td")):void 0);n.bodyColor=g,g&&k&&g!==k&&(n.stripeColors=[g,k]);const E=o(x);parseFloat(E.borderBottomWidth)>0&&E.borderBottomStyle!=="none"&&(n.borderColor=f(E.borderBottomColor),n.borderWidth=.5)}const _=f(s(t));return _&&_!=="#ffffff"&&(n.pageBackground=_),n.textColor=f(o(t).color),n.fontName=void 0,Object.keys(n).forEach(b=>n[b]===void 0&&delete n[b]),n}const go={none:0,asc:0,desc:180};function mo({direction:t,size:n=14,priority:o,className:s,style:f}){const u=p.useRef(0),m=((go[t??"none"]-u.current)%360+360)%360;return u.current+=m,i.jsxs("span",{className:O("rg-sort-arrow",t&&"rg-sort-arrow--active",s),style:f,"data-direction":t??"none",children:[i.jsxs("svg",{className:"rg-sort-arrow__icon",width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",style:{transform:`rotate(${u.current}deg)`},children:[i.jsx("path",{d:"M8 13V3"}),i.jsx("path",{d:"M3.5 7.5 8 3l4.5 4.5"})]}),t&&o!==void 0&&i.jsx("sup",{className:"rg-sort-arrow__order",children:o})]})}function el({direction:t,children:n}){const o=p.useRef(0),s=((go[t??"none"]-o.current)%360+360)%360;return o.current+=s,i.jsx("span",{className:"rg-sort-turn",style:{transform:`rotate(${o.current}deg)`},children:n})}const xo=new TextEncoder;let fn=null;function tl(t){if(!fn){fn=new Uint32Array(256);for(let o=0;o<256;o++){let s=o;for(let f=0;f<8;f++)s=s&1?3988292384^s>>>1:s>>>1;fn[o]=s>>>0}}let n=4294967295;for(let o=0;o<t.length;o++)n=fn[(n^t[o])&255]^n>>>8;return(n^4294967295)>>>0}async function nl(t){const n=globalThis.CompressionStream;if(typeof n>"u")return null;try{const o=new Blob([t]).stream().pipeThrough(new n("deflate-raw"));return new Uint8Array(await new Response(o).arrayBuffer())}catch{return null}}async function rl(t){const n=new Date,o=n.getHours()<<11|n.getMinutes()<<5|n.getSeconds()>>1,s=n.getFullYear()-1980<<9|n.getMonth()+1<<5|n.getDate(),f=[],u=[];let c=0;for(const g of t){const k=xo.encode(g.name),E=tl(g.data),N=await nl(g.data),T=N!==null&&N.length<g.data.length,v=T?N:g.data,R=T?8:0,Y=new Uint8Array(30+k.length),K=new DataView(Y.buffer);K.setUint32(0,67324752,!0),K.setUint16(4,20,!0),K.setUint16(6,2048,!0),K.setUint16(8,R,!0),K.setUint16(10,o,!0),K.setUint16(12,s,!0),K.setUint32(14,E,!0),K.setUint32(18,v.length,!0),K.setUint32(22,g.data.length,!0),K.setUint16(26,k.length,!0),K.setUint16(28,0,!0),Y.set(k,30);const U=new Uint8Array(46+k.length),z=new DataView(U.buffer);z.setUint32(0,33639248,!0),z.setUint16(4,20,!0),z.setUint16(6,20,!0),z.setUint16(8,2048,!0),z.setUint16(10,R,!0),z.setUint16(12,o,!0),z.setUint16(14,s,!0),z.setUint32(16,E,!0),z.setUint32(20,v.length,!0),z.setUint32(24,g.data.length,!0),z.setUint16(28,k.length,!0),z.setUint32(42,c,!0),U.set(k,46),f.push(Y,v),u.push(U),c+=Y.length+v.length}const m=u.reduce((g,k)=>g+k.length,0),x=new Uint8Array(22),_=new DataView(x.buffer);_.setUint32(0,101010256,!0),_.setUint16(8,t.length,!0),_.setUint16(10,t.length,!0),_.setUint32(12,m,!0),_.setUint32(16,c,!0);const F=[...f,...u,x],b=new Uint8Array(F.reduce((g,k)=>g+k.length,0));let S=0;for(const g of F)b.set(g,S),S+=g.length;return b}function gn(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function pn(t){let n=t+1,o="";for(;n>0;){const s=(n-1)%26;o=String.fromCharCode(65+s)+o,n=Math.floor((n-1)/26)}return o}function ol(t){const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(!n)return null;const[o,s,f]=[Number(n[1]),Number(n[2]),Number(n[3])],u=new Date(Date.UTC(o,s-1,f));return u.getUTCFullYear()!==o||u.getUTCMonth()!==s-1||u.getUTCDate()!==f?null:Math.round((u.getTime()-Date.UTC(1899,11,30))/864e5)}function sl(t){return(t??"").replace(/[\[\]:*?/\\]/g," ").trim().slice(0,31)||"Sheet1"}const ll=1,il=2,al=3,cl=4,dl=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1
|
+
"use strict";var bs=Object.create;var Wr=Object.defineProperty;var ys=Object.getOwnPropertyDescriptor;var _s=Object.getOwnPropertyNames;var ws=Object.getPrototypeOf,vs=Object.prototype.hasOwnProperty;var ks=(t,n,o,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let f of _s(n))!vs.call(t,f)&&f!==o&&Wr(t,f,{get:()=>n[f],enumerable:!(s=ys(n,f))||s.enumerable});return t};var Ss=(t,n,o)=>(o=t!=null?bs(ws(t)):{},ks(n||!t||!t.__esModule?Wr(o,"default",{value:t,enumerable:!0}):o,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),p=require("react"),js=require("react-dom"),kt=(...t)=>t.filter(Boolean).join(" ");function Cs(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:i.jsx("path",{d:"M3.5 8.5l3 3 6-7",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ns(){return i.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:i.jsx("path",{d:"M4 8h8",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round"})})}function Je({checked:t,onChange:n,indeterminate:o=!1,variant:s="native",disabled:f=!1,label:u,"aria-label":c,id:m,name:x,indicator:_,className:F,style:b,classNames:S={},styles:g={}}){const k=o?"indeterminate":t?"checked":"unchecked";return i.jsxs("label",{className:kt("rg-checkbox",`rg-checkbox--${s}`,k==="checked"&&"rg-checkbox--checked",o&&"rg-checkbox--indeterminate",f&&"rg-checkbox--disabled",S.root,F),style:{...g.root,...b},"data-state":k,children:[s==="native"?i.jsx("input",{type:"checkbox",id:m,name:x,ref:E=>{E&&(E.indeterminate=o)},className:kt("rg-checkbox__control",S.control),style:g.control,checked:t,disabled:f,"aria-label":c,"data-state":k,onChange:E=>n(E.target.checked)}):i.jsx("button",{type:"button",role:"checkbox",id:m,className:kt("rg-checkbox__control",S.control),style:g.control,"aria-checked":o?"mixed":t,"aria-label":c,disabled:f,"data-state":k,onClick:()=>n(!t),children:i.jsx("span",{className:kt("rg-checkbox__indicator",_!==void 0&&!o&&"rg-checkbox__indicator--custom",S.indicator),style:g.indicator,"data-state":k,"aria-hidden":"true",children:o?s==="tick"?i.jsx(Ns,{}):null:_!==void 0?_:s==="tick"?i.jsx(Cs,{}):null})}),u!=null&&u!==!1&&u!==""&&i.jsx("span",{className:kt("rg-checkbox__label",S.label),style:g.label,children:u})]})}const Es=/^(\d{4})-(\d{2})-(\d{2})$/,Br=t=>String(t).padStart(2,"0");function re(t){const n=Es.exec(t);if(!n)return null;const[o,s,f]=[Number(n[1]),Number(n[2]),Number(n[3])],u=new Date(o,s-1,f);return u.getFullYear()===o&&u.getMonth()===s-1&&u.getDate()===f?u:null}function ue(t){var n;if(t instanceof Date)return Number.isNaN(t.getTime())?null:`${t.getFullYear()}-${Br(t.getMonth()+1)}-${Br(t.getDate())}`;if(typeof t=="number")return Number.isFinite(t)?ue(new Date(t)):null;if(typeof t=="string"){const o=t.trim();if(o==="")return null;const s=(n=/^\d{4}-\d{2}-\d{2}/.exec(o))==null?void 0:n[0];if(s)return re(s)?s:null;const f=Date.parse(o);return Number.isNaN(f)?null:ue(new Date(f))}return null}function Ds(t,n,o){const s=ue(t);return s?re(s).toLocaleDateString(n,o??{year:"numeric",month:"short",day:"numeric"}):t==null?"":String(t)}function Ts(t,n){var o;return t===""?null:n instanceof Date?re(t):typeof n=="number"?((o=re(t))==null?void 0:o.getTime())??null:t}const O=(...t)=>t.filter(Boolean).join(" "),Ct=t=>t.headerName??(t.type==="boolean"?"":t.type==="sequence"?"#":t.field),Ge=t=>Ct(t)||t.field,Kr=t=>String(t).padStart(2,"0"),Ln=(t,n,o)=>`${t}-${Kr(n+1)}-${Kr(o)}`;function qr(t,n,o,s){const f=[t,n==null?void 0:n.from,n==null?void 0:n.to].map(x=>x?re(x):null).find(Boolean);if(f)return new Date(f.getFullYear(),f.getMonth(),1);const u=new Date;let c=ue(u);o&&c<o&&(c=o),s&&c>s&&(c=s);const m=re(c)??u;return new Date(m.getFullYear(),m.getMonth(),1)}function ao({value:t,range:n,min:o,max:s,onPick:f,locale:u,weekStart:c=0,hideFooter:m,keepFocus:x,className:_}){var je;const[F,b]=p.useState(()=>qr(t,n,o,s)),[S,g]=p.useState(null),k=p.useRef(null),E=p.useRef({value:t,from:n==null?void 0:n.from,to:n==null?void 0:n.to});p.useEffect(()=>{const w=E.current;E.current={value:t,from:n==null?void 0:n.from,to:n==null?void 0:n.to};const H=t!==w.value?t:(n==null?void 0:n.from)!==w.from?n==null?void 0:n.from:(n==null?void 0:n.to)!==w.to?n==null?void 0:n.to:void 0,j=H?re(H):null;j&&b(A=>A.getFullYear()===j.getFullYear()&&A.getMonth()===j.getMonth()?A:new Date(j.getFullYear(),j.getMonth(),1))},[t,n==null?void 0:n.from,n==null?void 0:n.to]);const N=ue(new Date),T=F.getFullYear(),v=F.getMonth(),P=p.useMemo(()=>{const w=new Intl.DateTimeFormat(u,{weekday:"short"});return Array.from({length:7},(H,j)=>w.format(new Date(2023,0,1+(j+c)%7)))},[u,c]),Y=new Intl.DateTimeFormat(u,{month:"long",year:"numeric"}).format(F),K=p.useMemo(()=>{const w=(new Date(T,v,1).getDay()-c+7)%7;return Array.from({length:42},(H,j)=>{const A=new Date(T,v,1-w+j);return{iso:Ln(A.getFullYear(),A.getMonth(),A.getDate()),day:A.getDate(),outside:A.getMonth()!==v}})},[T,v,c]),U=w=>!!o&&w<o||!!s&&w>s,z=w=>b(new Date(T,v+w,1)),ye=w=>{const H=re(w);H&&((H.getFullYear()!==T||H.getMonth()!==v)&&b(new Date(H.getFullYear(),H.getMonth(),1)),g(w),requestAnimationFrame(()=>{var j,A;return(A=(j=k.current)==null?void 0:j.querySelector(`[data-iso="${w}"]`))==null?void 0:A.focus()}))},De=(w,H)=>{const j=re(H),A=le=>{w.preventDefault(),ye(Ln(j.getFullYear(),j.getMonth(),j.getDate()+le))};switch(w.key){case"ArrowLeft":return A(-1);case"ArrowRight":return A(1);case"ArrowUp":return A(-7);case"ArrowDown":return A(7);case"Home":return A(-((j.getDay()-c+7)%7));case"End":return A(6-(j.getDay()-c+7)%7);case"PageUp":case"PageDown":{w.preventDefault();const le=w.key==="PageUp"?-1:1,fe=new Date(j.getFullYear(),j.getMonth()+le+1,0).getDate();ye(Ln(j.getFullYear(),j.getMonth()+le,Math.min(j.getDate(),fe)));return}}},Oe=w=>!!w&&K.some(H=>H.iso===w&&!H.outside),Se=[S,t,N].find(w=>Oe(w)&&!U(w))??((je=K.find(w=>!w.outside&&!U(w.iso)))==null?void 0:je.iso),q=n==null?void 0:n.from,oe=n==null?void 0:n.to;return i.jsxs("div",{className:O("rg-cal",_),onMouseDown:x?w=>w.preventDefault():void 0,role:"group","aria-label":`Calendar, ${Y}`,children:[i.jsxs("div",{className:"rg-cal__head",children:[i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Previous year",onClick:()=>z(-12),children:"«"}),i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Previous month",onClick:()=>z(-1),children:"‹"}),i.jsx("span",{className:"rg-cal__title","aria-live":"polite",children:Y}),i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Next month",onClick:()=>z(1),children:"›"}),i.jsx("button",{type:"button",className:"rg-cal__nav","aria-label":"Next year",onClick:()=>z(12),children:"»"})]}),i.jsxs("div",{className:"rg-cal__grid",ref:k,children:[P.map(w=>i.jsx("span",{className:"rg-cal__dow","aria-hidden":"true",children:w.slice(0,2)},w)),K.map(({iso:w,day:H,outside:j})=>{const A=w===t,le=w===q,fe=w===oe,Ue=!!q&&!!oe&&w>q&&w<oe;return i.jsx("button",{type:"button","data-iso":w,tabIndex:w===Se?0:-1,disabled:U(w),"aria-pressed":A||le||fe,"aria-label":new Intl.DateTimeFormat(u,{dateStyle:"full"}).format(re(w)),className:O("rg-cal__day",j&&"rg-cal__day--outside",w===N&&"rg-cal__day--today",(A||le||fe)&&"rg-cal__day--selected",Ue&&"rg-cal__day--in-range",q&&oe&&le&&q!==oe&&"rg-cal__day--range-start",q&&oe&&fe&&q!==oe&&"rg-cal__day--range-end"),onClick:()=>f(w),onKeyDown:Ze=>De(Ze,w),onFocus:()=>g(w),children:H},w)})]}),!m&&i.jsxs("div",{className:"rg-cal__foot",children:[i.jsx("button",{type:"button",className:"rg-cal__link",disabled:U(N),onClick:()=>{b(qr(N)),f(N)},children:"Today"}),i.jsx("button",{type:"button",className:"rg-cal__link",onClick:()=>f(""),children:"Clear"})]})]})}const Nt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function St(t,n,o){const[s,f]=p.useState(n),u=t!==void 0,c=u?t:s,m=p.useCallback(x=>{u||f(x),o==null||o(x)},[u,o]);return[c,m]}function co(t,n){const o=p.useRef(t);o.current=t;const s=p.useRef(void 0),f=p.useRef(null),u=p.useCallback(()=>{s.current!==void 0&&clearTimeout(s.current),s.current=void 0,f.current=null},[]),c=p.useCallback(()=>{s.current!==void 0&&clearTimeout(s.current),s.current=void 0;const x=f.current;f.current=null,x&&o.current(...x)},[]),m=p.useCallback((...x)=>{if(n<=0){u(),o.current(...x);return}f.current=x,s.current!==void 0&&clearTimeout(s.current),s.current=setTimeout(c,n)},[n,u,c]);return p.useEffect(()=>c,[c]),{call:m,flush:c,cancel:u}}function mn({anchorRef:t,open:n,onClose:o,label:s,theme:f,className:u,style:c,keepFocus:m,children:x}){const _=p.useRef(null),[F,b]=p.useState({top:0,left:0}),S=p.useCallback(()=>{var T;const g=t.current;if(!g)return;const k=g.getBoundingClientRect(),E=((T=_.current)==null?void 0:T.offsetWidth)??260,N=Math.max(8,Math.min(k.left,window.innerWidth-E-8));b({top:k.bottom+6,left:N})},[t]);return Nt(()=>{n&&S()},[n,S]),p.useEffect(()=>{if(!n)return;const g=E=>{var T,v;const N=E.target;(T=_.current)!=null&&T.contains(N)||(v=t.current)!=null&&v.contains(N)||o()},k=E=>{var N;E.key==="Escape"&&(o(),(N=t.current)==null||N.focus())};return document.addEventListener("mousedown",g),document.addEventListener("keydown",k),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",k),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[n,o,S,t]),!n||typeof document>"u"?null:js.createPortal(i.jsx("div",{ref:_,role:"dialog",onMouseDown:m?g=>g.preventDefault():void 0,"aria-label":s,"data-rg-theme":f||void 0,className:O("rg-grid-popup",u),style:{position:"fixed",top:F.top,left:F.left,...c},children:x}),document.body)}function Fs({value:t,onChange:n,onPick:o,onBlur:s,onKeyDown:f,min:u,max:c,locale:m,invalid:x,label:_,theme:F,className:b,style:S}){const g=p.useRef(null),k=E=>{const N=E.ctrlKey||E.altKey||E.metaKey,T=E.key==="ArrowUp"?{days:-7,months:0}:E.key==="ArrowDown"?{days:7,months:0}:N&&E.key==="ArrowLeft"?{days:-1,months:0}:N&&E.key==="ArrowRight"?{days:1,months:0}:E.key==="PageUp"?{days:0,months:-1}:E.key==="PageDown"?{days:0,months:1}:null;if(!T||E.shiftKey)return f(E);E.preventDefault();const v=re(t)??new Date,P=new Date(v.getFullYear(),v.getMonth()+T.months+1,0).getDate(),Y=new Date(v.getFullYear(),v.getMonth()+T.months,Math.min(v.getDate(),P)+T.days);let K=ue(Y);u&&K<u&&(K=u),c&&K>c&&(K=c),n(K)};return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:g,autoFocus:!0,type:"text",inputMode:"numeric",placeholder:"YYYY-MM-DD",autoComplete:"off",className:b,style:S,value:t,"aria-label":_,"aria-invalid":x||void 0,"aria-haspopup":"dialog","aria-expanded":!0,onChange:E=>n(E.target.value.trim()),onBlur:s,onKeyDown:k,onFocus:E=>E.currentTarget.setSelectionRange(E.currentTarget.value.length,E.currentTarget.value.length)}),i.jsx(mn,{anchorRef:g,open:!0,onClose:()=>{},label:_,theme:F,className:"rg-date-popup",keepFocus:!0,children:i.jsx(ao,{value:t,min:u,max:c,locale:m,onPick:o,keepFocus:!0})})]})}function zr(t){return t.filterType?t.filterType:t.type==="number"?"number":t.type==="date"?"date":t.type==="boolean"?"select":"text"}const Yr=["contains","notContains","equals","notEquals","startsWith","notStartsWith","endsWith","notEndsWith"],Vr={contains:"Contains",notContains:"Does not contain",equals:"Equals",notEquals:"Not equal",startsWith:"Starts with",notStartsWith:"Does not start with",endsWith:"Ends with",notEndsWith:"Does not end with"};function uo(t){const n=t.filterOperators;if(!n)return null;if(n===!0)return Yr;const o=Yr.filter(s=>n.includes(s));return o.length>0?o:null}function Ms(t,n){const o=uo(t),s=t.filterOperator??(n==="exact"?"equals":"contains");return o&&!o.includes(s)?o[0]:s}function Hr(t,n,o){const s=n.toLowerCase(),f=o.trim().toLowerCase();switch(t){case"contains":return s.includes(f);case"notContains":return!s.includes(f);case"equals":return s===f;case"notEquals":return s!==f;case"startsWith":return s.startsWith(f);case"notStartsWith":return!s.startsWith(f);case"endsWith":return s.endsWith(f);case"notEndsWith":return!s.endsWith(f)}}const fo=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function ho(t){if(t==null)return!1;if(typeof t=="string")return t.trim()!=="";if(Array.isArray(t))return t.length>0;if(fo(t)){const n=t;return typeof n.operator=="string"?typeof n.value=="string"&&n.value.trim()!=="":typeof n.min=="number"||typeof n.max=="number"||!!n.from||!!n.to}return!1}function Is(t,n,o,s){switch(t){case"text":case"exact":{if(fo(n)){const f=n;return Hr(f.operator,o,String(f.value??""))}return Hr(t==="exact"?"equals":"contains",o,String(n))}case"number":{const{min:f,max:u}=n,c=typeof s=="number"?s:s==null||s===""?NaN:Number(s);return Number.isNaN(c)?!1:(typeof f!="number"||c>=f)&&(typeof u!="number"||c<=u)}case"date":{const{from:f,to:u}=n,c=ue(s);return c?(!f||c>=f)&&(!u||c<=u):!1}case"select":return n.includes(String(s??""))}}function $s(t,n,o,s){if(t.filterOptions)return t.filterOptions.map(u=>typeof u=="string"?{value:u,label:u}:u);if(t.type==="boolean")return[{value:"true",label:"Yes"},{value:"false",label:"No"}];const f=new Map;for(const u of n){const c=o(u);if(c==null||c==="")continue;const m=String(c);f.has(m)||f.set(m,s(u))}return[...f].map(([u,c])=>({value:u,label:c})).sort((u,c)=>u.label.localeCompare(c.label,void 0,{numeric:!0}))}const Xr=t=>{if(t.trim()==="")return;const n=Number(t);return Number.isFinite(n)?n:void 0},qn=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function Rs({value:t,onChange:n,label:o,debounce:s,inputClassName:f,inputStyle:u}){const c=qn(t)?t:{},[m,x]=p.useState(c.min===void 0?"":String(c.min)),[_,F]=p.useState(c.max===void 0?"":String(c.max)),b=p.useRef(c),S=co((g,k)=>{const E=Xr(g),N=Xr(k);b.current={min:E,max:N},n(E===void 0&&N===void 0?void 0:{min:E,max:N})},s);return p.useEffect(()=>{c.min===b.current.min&&c.max===b.current.max||(b.current=c,S.cancel(),x(c.min===void 0?"":String(c.min)),F(c.max===void 0?"":String(c.max)))},[c.min,c.max]),i.jsxs("div",{className:"rg-grid__filter-fields",children:[i.jsxs("label",{className:"rg-grid__filter-field",children:[i.jsx("span",{children:"Min"}),i.jsx("input",{autoFocus:!0,type:"number",className:O("rg-grid__filter-input",f),style:u,value:m,"aria-label":`Minimum ${o}`,onChange:g=>{x(g.target.value),S.call(g.target.value,_)},onKeyDown:g=>g.key==="Enter"&&S.flush()})]}),i.jsxs("label",{className:"rg-grid__filter-field",children:[i.jsx("span",{children:"Max"}),i.jsx("input",{type:"number",className:O("rg-grid__filter-input",f),style:u,value:_,"aria-label":`Maximum ${o}`,onChange:g=>{F(g.target.value),S.call(m,g.target.value)},onKeyDown:g=>g.key==="Enter"&&S.flush()})]})]})}function Ps({value:t,onChange:n,onEnter:o,label:s,kind:f,placeholder:u,debounce:c,inputClassName:m,inputStyle:x}){const[_,F]=p.useState(t),b=p.useRef(t),S=co(g=>{b.current=g,n(g||void 0)},c);return p.useEffect(()=>{t!==b.current&&(b.current=t,S.cancel(),F(t))},[t]),i.jsx("input",{autoFocus:!0,type:"text",className:O("rg-grid__filter-input",m),style:x,value:_,placeholder:u??(f==="exact"?"Exactly…":`Filter ${s}…`),"aria-label":`Filter text for ${s}`,onChange:g=>{F(g.target.value),S.call(g.target.value)},onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),S.flush(),o())}})}function Ls({value:t,onChange:n,label:o,inputClassName:s,inputStyle:f,min:u,max:c,locale:m}){const x=qn(t)?t:{},_=(T,v)=>n(!T&&!v?void 0:{from:T||void 0,to:v||void 0}),[F,b]=p.useState(x.from??""),[S,g]=p.useState(x.to??"");p.useEffect(()=>{(re(F)?F:"")!==(x.from??"")&&b(x.from??""),(re(S)?S:"")!==(x.to??"")&&g(x.to??"")},[x.from,x.to]);const k=(T,v)=>{if((T==="from"?b:g)(v),v!==""&&!re(v))return;const P=v||void 0;T==="from"?_(P,x.to):_(x.from,P)},E=T=>{T&&(!x.from||x.to?_(T,void 0):T<x.from?_(T,x.from):_(x.from,T))},N=(T,v,P)=>i.jsxs("label",{className:"rg-grid__filter-field",children:[i.jsx("span",{children:T==="from"?"From":"To"}),i.jsx("input",{autoFocus:P,type:"text",inputMode:"numeric",placeholder:"YYYY-MM-DD",className:O("rg-grid__filter-input",v!==""&&!re(v)&&"rg-grid__filter-input--invalid",s),style:f,value:v,"aria-label":`${o} ${T}`,"aria-invalid":v!==""&&!re(v)||void 0,onChange:Y=>k(T,Y.target.value.trim())})]});return i.jsxs("div",{className:"rg-grid__filter-fields rg-grid__filter-fields--stack",children:[i.jsxs("div",{className:"rg-grid__filter-date-row",children:[N("from",F,!0),N("to",S,!1)]}),i.jsx(ao,{range:x,min:u,max:c,locale:m,onPick:E,hideFooter:!0})]})}function Os({value:t,onChange:n,options:o}){const s=Array.isArray(t)?t:[],f=(u,c)=>{const m=c?[...s,u]:s.filter(x=>x!==u);n(m.length?m:void 0)};return i.jsxs("div",{className:"rg-grid__filter-fields rg-grid__filter-options",role:"group",children:[o.length===0&&i.jsx("span",{className:"rg-grid__filter-empty",children:"No values"}),o.map(u=>i.jsx(Je,{checked:s.includes(u.value),onChange:c=>f(u.value,c),label:u.label??u.value},u.value))]})}function Us({value:t,options:n,onChange:o,label:s}){const[f,u]=p.useState(!1),[c,m]=p.useState(0),x=p.useId(),_=p.useRef(null),F=()=>{m(Math.max(0,n.indexOf(t))),u(!0)},b=g=>{var k;o(g),u(!1),(k=_.current)==null||k.focus()},S=g=>{if(!f){(g.key==="ArrowDown"||g.key==="ArrowUp")&&(g.preventDefault(),F());return}switch(g.key){case"ArrowDown":g.preventDefault(),m(k=>Math.min(n.length-1,k+1));break;case"ArrowUp":g.preventDefault(),m(k=>Math.max(0,k-1));break;case"Home":g.preventDefault(),m(0);break;case"End":g.preventDefault(),m(n.length-1);break;case"Enter":case" ":g.preventDefault(),b(n[c]);break;case"Escape":g.preventDefault(),g.stopPropagation(),u(!1);break;case"Tab":u(!1);break}};return i.jsxs("div",{className:"rg-op",children:[i.jsxs("button",{ref:_,type:"button",className:"rg-op__btn",role:"combobox","aria-label":`Comparison for ${s}`,"aria-haspopup":"listbox","aria-expanded":f,"aria-controls":f?x:void 0,"aria-activedescendant":f?`${x}-${c}`:void 0,onClick:()=>f?u(!1):F(),onBlur:()=>u(!1),onKeyDown:S,children:[i.jsx("span",{className:"rg-op__value",children:Vr[t]}),i.jsx("svg",{className:"rg-op__chevron",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5"})})]}),f&&i.jsx("ul",{id:x,role:"listbox",className:"rg-op__list","aria-label":`Comparisons for ${s}`,onMouseDown:g=>g.preventDefault(),children:n.map((g,k)=>i.jsxs("li",{id:`${x}-${k}`,role:"option","aria-selected":g===t,"data-op":g,className:O("rg-op__option",g===t&&"rg-op__option--selected",k===c&&"rg-op__option--active"),onMouseEnter:()=>m(k),onClick:()=>b(g),children:[Vr[g],g===t&&i.jsx("svg",{className:"rg-op__check",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 6.5 5 9l4.5-5.5"})})]},g))})]})}function As({column:t,label:n,kind:o,value:s,onChange:f,options:u,debounce:c=300,theme:m,indicatorClassName:x,indicatorStyle:_,popupClassName:F,popupStyle:b,inputClassName:S,inputStyle:g}){const[k,E]=p.useState(!1),N=p.useRef(null),T=ho(s),v=p.useCallback(()=>E(!1),[]),P=qn(s)?s:null,Y=typeof s=="string"?s:typeof(P==null?void 0:P.value)=="string"?P.value:"",K=(o==="text"||o==="exact")&&!t.filterRenderer?uo(t):null,[U,z]=p.useState(()=>Ms(t,o)),ye=P&&typeof P.operator=="string"?P.operator:U,De=q=>{if(q===void 0)return f(void 0);f(K?{operator:ye,value:String(q)}:q)},Oe=q=>{z(q),Y.trim()!==""&&f({operator:q,value:Y})},Se=()=>{if(t.filterRenderer)return p.createElement(t.filterRenderer,{column:t,value:Y,onChange:q=>f(q||void 0)});switch(o){case"number":return i.jsx(Rs,{value:s,onChange:f,label:n,debounce:c,inputClassName:S,inputStyle:g});case"date":return i.jsx(Ls,{value:s,onChange:f,label:n,min:t.dateMin,max:t.dateMax,locale:t.dateLocale,inputClassName:S,inputStyle:g});case"select":return i.jsx(Os,{value:s,onChange:f,options:u});default:return i.jsxs("div",{className:"rg-grid__filter-stack",children:[K&&i.jsx(Us,{value:ye,options:K,onChange:Oe,label:n}),i.jsx(Ps,{value:Y,onChange:De,onEnter:()=>{var q;E(!1),(q=N.current)==null||q.focus()},label:n,kind:o,placeholder:t.filterPlaceholder,debounce:c,inputClassName:S,inputStyle:g})]})}};return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:N,type:"button",className:O("rg-grid__filter-btn",T&&"rg-grid__filter-btn--active",k&&"rg-grid__filter-btn--open",x),style:_,"aria-label":`Filter ${n}`,"aria-haspopup":"dialog","aria-expanded":k,"data-active":T||void 0,onClick:q=>{q.stopPropagation(),E(oe=>!oe)},onKeyDown:q=>q.stopPropagation(),children:t.filterIndicator?p.createElement(t.filterIndicator,{column:t,active:T,open:k}):i.jsx("span",{className:"rg-grid__filter-dot","aria-hidden":"true"})}),i.jsxs(mn,{anchorRef:N,open:k,onClose:v,label:`Filter ${n}`,theme:m,className:F,style:b,children:[Se(),T&&i.jsx("button",{type:"button",className:"rg-grid__filter-clear",onClick:()=>f(void 0),children:"Clear"})]})]})}function Ws({columns:t,hidden:n,onToggle:o,theme:s,className:f,style:u}){const[c,m]=p.useState(!1),x=p.useRef(null),_=p.useCallback(()=>m(!1),[]),F=t.filter(b=>!n.has(b.field)).length;return i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:x,type:"button",className:O("rg-grid__tool-btn",f),style:u,"aria-haspopup":"dialog","aria-expanded":c,onClick:()=>m(b=>!b),children:"Columns"}),i.jsx(mn,{anchorRef:x,open:c,onClose:_,label:"Show or hide columns",theme:s,children:i.jsx("div",{className:"rg-grid__filter-fields rg-grid__filter-options",role:"group","aria-label":"Columns",children:t.filter(b=>b.hideable!==!1).map(b=>{const S=!n.has(b.field);return i.jsx(Je,{checked:S,disabled:S&&F<=1,onChange:g=>o(b.field,!g),label:Ge(b)},b.field)})})})]})}const Bs=/^[=+\-@\t\r]/;function Ks(t,n,o){if(t==null)return"";let s=String(t);return o&&typeof t=="string"&&Bs.test(s)&&!Number.isFinite(Number(s))&&(s=`'${s}`),s.includes(n)||/["\r\n]/.test(s)?`"${s.replace(/"/g,'""')}"`:s}function qs(t,n,o={}){const{delimiter:s=",",sanitize:f=!0}=o,u=c=>c.map(m=>Ks(m,s,f)).join(s);return[u(t),...n.map(u)].join(`\r
|
|
2
|
+
`)}function hn(t,n){if(typeof document>"u")return;const o=URL.createObjectURL(t),s=document.createElement("a");s.href=o,s.download=n,s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function zs(t,n){hn(new Blob(["\uFEFF",t],{type:"text/csv;charset=utf-8"}),n)}const po={csv:"CSV",xlsx:"Excel",json:"JSON",pdf:"PDF"},Ys={csv:".csv",xlsx:".xlsx",json:".json",pdf:".pdf"},Vs=t=>`Export ${po[t]}`;function Hs({formats:t,scopes:n,scope:o,onScopeChange:s,onExport:f,theme:u,className:c,style:m,popupClassName:x}){const[_,F]=p.useState(!1),[b,S]=p.useState(null),g=p.useRef(null),k=p.useCallback(()=>F(!1),[]),E=async N=>{var T;S(N);try{await f(N,o)}finally{S(null),F(!1),(T=g.current)==null||T.focus()}};return i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:g,type:"button",className:O("rg-grid__tool-btn",c),style:m,"aria-haspopup":"dialog","aria-expanded":_,onClick:()=>F(N=>!N),children:["Export",i.jsx("svg",{className:"rg-export__chevron",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5"})})]}),i.jsx(mn,{anchorRef:g,open:_,onClose:k,label:"Export",theme:u,className:O("rg-export-popup",x),children:i.jsxs("div",{className:"rg-export",children:[n.length>1&&i.jsxs("div",{className:"rg-export__group",role:"radiogroup","aria-label":"Rows to export",children:[i.jsx("div",{className:"rg-export__title",children:"Rows to export"}),n.map(N=>{const T=N.count===0;return i.jsxs("label",{className:O("rg-export__scope",T&&"rg-export__scope--disabled",N.value===o&&"rg-export__scope--on"),children:[i.jsx("input",{type:"radio",name:"rg-export-scope",value:N.value,checked:N.value===o,disabled:T,onChange:()=>s(N.value)}),i.jsx("span",{className:"rg-export__scope-label",children:N.label}),i.jsx("span",{className:"rg-export__count",children:N.count})]},N.value)})]}),i.jsxs("div",{className:"rg-export__group",children:[i.jsx("div",{className:"rg-export__title",children:"Download as"}),t.map(N=>i.jsxs("button",{type:"button",className:"rg-export__format","data-format":N,disabled:b!==null,onClick:()=>E(N),children:[i.jsx("span",{children:po[N]}),i.jsx("span",{className:"rg-export__ext",children:b===N?"Preparing…":Ys[N]})]},N))]})]})})]})}let xe;function de(t){const n=(t??"").trim();if(!n||n==="transparent"||n==="none")return null;const o=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n);if(o){let _=o[1];return _.length===3&&(_=_.split("").map(F=>F+F).join("")),[parseInt(_.slice(0,2),16),parseInt(_.slice(2,4),16),parseInt(_.slice(4,6),16)]}const s=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i.exec(n);if(s)return Gr([Number(s[1]),Number(s[2]),Number(s[3])],Xs(s[4]));if(typeof document>"u"||(xe===void 0&&(xe=document.createElement("canvas").getContext("2d",{willReadFrequently:!0})),!xe))return null;xe.fillStyle="#000000",xe.fillStyle=n;const f=String(xe.fillStyle);if(xe.fillStyle="#ffffff",xe.fillStyle=n,f!==String(xe.fillStyle))return null;xe.clearRect(0,0,1,1),xe.fillRect(0,0,1,1);const[u,c,m,x]=xe.getImageData(0,0,1,1).data;return x===0?null:Gr([u,c,m],x/255)}const Xs=t=>t===void 0?1:t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Gr(t,n){if(!(n>0))return null;const o=Math.min(1,n);return t.map(s=>Math.round(Math.min(255,s)*o+255*(1-o)))}const Gs=([t,n,o])=>(.299*t+.587*n+.114*o)/255,On=t=>Gs(t)>.55?[31,41,55]:[243,244,246],Un=72/96,Et="Install them with: npm install jspdf jspdf-autotable (and html2canvas for header / footer elements), then pass them in exportable.pdf.libraries.";async function Jr(t,n){try{return await n()}catch(o){const s=o instanceof Error?o.message:String(o);throw new Error(`PDF export needs the package "${t}", which could not be loaded (${s}). ${Et}`)}}function Zr(t,n,o){return t.replace(/\{page\}/g,String(n)).replace(/\{pages\}/g,String(o)).replace(/\{date\}/g,new Date().toLocaleDateString())}async function Js(t){const n=Array.from(t.querySelectorAll("img")).map(o=>o.complete?Promise.resolve():new Promise(s=>{o.addEventListener("load",()=>s(),{once:!0}),o.addEventListener("error",()=>s(),{once:!0})}));await Promise.race([Promise.all(n),new Promise(o=>setTimeout(o,5e3))])}async function Zs(t,n,o,s,f){const u=o.html2canvas;if(typeof u!="function")throw new Error(`A PDF header / footer element needs html2canvas. Add it to exportable.pdf.libraries. ${Et}`);const[c,m]=await Promise.all([Jr("react-dom/client",()=>Promise.resolve().then(()=>require("./client-40__X0_a.cjs")).then(b=>b.client)),Jr("react-dom",()=>import("react-dom"))]),x=2,_=document.createElement("div");_.style.cssText=`position:fixed;left:-10000px;top:0;width:${Math.round(n/Un)}px;background:${s};color:${f};font-family:system-ui,sans-serif;font-size:14px;`,document.body.appendChild(_);const F=c.createRoot(_);try{m.flushSync(()=>F.render(t)),await Js(_),await new Promise(S=>requestAnimationFrame(()=>S(void 0)));const b=await u(_,{scale:x,backgroundColor:s,useCORS:!0,logging:!1});return{dataUrl:b.toDataURL("image/png"),width:b.width/x*Un,height:b.height/x*Un}}finally{F.unmount(),_.remove()}}async function An(t,n,o,s,f,u){if(t==null||t===!1||t===!0||t==="")return null;if(typeof t=="string"||typeof t=="number")return{kind:"text",text:String(t)};const c=await Zs(t,n,s,f,u),m=Math.min(1,n/c.width,o/c.height);return{kind:"image",dataUrl:c.dataUrl,width:c.width*m,height:c.height*m}}const Qr=t=>`rgb(${t[0]},${t[1]},${t[2]})`,eo=["normal","bold","italic","bolditalic"];function to(t,n){return typeof t=="number"?{top:t,right:t,bottom:t,left:t}:{top:(t==null?void 0:t.top)??n,right:(t==null?void 0:t.right)??n,bottom:(t==null?void 0:t.bottom)??n,left:(t==null?void 0:t.left)??n}}function no(t){return Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0))}async function Qs(t,n={},o={}){var et,tt;let s;try{s=typeof n.libraries=="function"?await n.libraries():n.libraries}catch(D){const G=D instanceof Error?D.message:String(D);throw new Error(`PDF export could not load jspdf / jspdf-autotable (${G}). ${Et}`)}if(!s)throw new Error(`PDF export needs the jspdf and jspdf-autotable libraries. ${Et}`);const f=s.jsPDF,u=s.autoTable;if(typeof f!="function"||typeof u!="function")throw new Error(`exportable.pdf.libraries must contain jsPDF (a class) and autoTable (a function). ${Et}`);const{title:c,header:m,footer:x,headerAlign:_="left",footerAlign:F="center",orientation:b="auto",pageSize:S="a4",tableTheme:g="striped",pageNumbers:k=!0,maxImageHeight:E=90,beforeRender:N,autoTableOptions:T}=n,v={...o,...no({headColor:n.headColor,headTextColor:n.headTextColor,fontSize:n.fontSize,fontName:n.fontName,margin:n.margin}),...no(n.style??{})},P=to(v.margin,36),Y=v.fontName??"helvetica",K=v.fontSize??9,U=de(v.pageBackground),z=U?On(U):[75,85,99],ye=de(v.textColor)??z,De=de(v.titleColor)??(U?On(U):[17,24,39]),Oe=de(v.headColor)??[79,70,229],Se=de(v.headTextColor)??[255,255,255],q=de(v.bodyTextColor),oe=de((et=v.stripeColors)==null?void 0:et[0]),je=de((tt=v.stripeColors)==null?void 0:tt[1]),w=de(v.bodyColor)??oe??U??void 0,H=de(v.borderColor),j=new f({orientation:b==="auto"?t.headers.length>6?"landscape":"portrait":b,unit:"pt",format:S});N&&await N(j);const A=j.internal.pageSize.getWidth(),le=j.internal.pageSize.getHeight(),fe=A-P.left-P.right,Ue=10,Ze=12,Dt=new Set,it=D=>{!U||Dt.has(D)||(Dt.add(D),j.setFillColor(...U),j.rect(0,0,A,le,"F"))};it(1);const Ae=U?Qr(U):"#ffffff",We=Qr(ye),ie=await An(m,fe,E,s,Ae,We),he=await An(x,fe,E,s,Ae,We);j.setFont(Y,"normal"),j.setFontSize(Ue);const at=D=>D?D.kind==="image"?D.height:j.splitTextToSize(Zr(D.text,99,99),fe).length*Ze:0,Be=at(ie),ct=at(he),Te=Math.min(18,P.top),dt=le-14,ut=le-(k?26:18),Tt=ie?Math.max(P.top,Te+Be+12):P.top,ft=Math.max(P.bottom,he?le-ut+ct+10:k?34:0);let Ke=Tt;if(c&&typeof c!="string"&&typeof c!="number"&&typeof c!="boolean"){const D=await An(c,fe,E,s,Ae,We);D&&D.kind==="image"&&(j.addImage(D.dataUrl,"PNG",P.left,Ke,D.width,D.height),Ke+=D.height+12)}else c&&(j.setFont(Y,"bold"),j.setFontSize(v.titleSize??14),j.setTextColor(...De),j.text(String(c),P.left,Ke+(v.titleSize??14)),Ke+=(v.titleSize??14)+12);const Ft={};t.fields.forEach((D,G)=>{var It;const $=(It=v.columns)==null?void 0:It[D],se={},ze=($==null?void 0:$.align)??t.aligns[G];ze&&(se.halign=ze),($==null?void 0:$.width)!==void 0&&(se.cellWidth=$.width);const Fe=de($==null?void 0:$.textColor);Fe&&(se.textColor=Fe);const Mt=de($==null?void 0:$.backgroundColor);Mt&&(se.fillColor=Mt),$!=null&&$.fontStyle&&eo.includes($.fontStyle)&&(se.fontStyle=$.fontStyle),$!=null&&$.fontSize&&(se.fontSize=$.fontSize),Object.keys(se).length>0&&(Ft[G]=se)});const Ce={font:Y,fontSize:K,cellPadding:to(v.cellPadding,4),overflow:"linebreak",valign:"middle"};q?Ce.textColor=q:U&&(Ce.textColor=On(U)),H&&(Ce.lineColor=H),v.borderWidth!==void 0?Ce.lineWidth=v.borderWidth:H&&(Ce.lineWidth=.5),v.minRowHeight&&(Ce.minCellHeight=v.minRowHeight);const _e={head:[t.headers],body:t.rows,startY:Ke,margin:{top:Tt,right:P.right,bottom:ft,left:P.left},theme:g,showHead:"everyPage",styles:Ce,headStyles:{fillColor:Oe,textColor:Se,fontStyle:v.headFontStyle&&eo.includes(v.headFontStyle)?v.headFontStyle:"bold",...v.headFontSize?{fontSize:v.headFontSize}:null},columnStyles:Ft,willDrawPage:()=>{var G,$;const D=typeof j.getCurrentPageInfo=="function"?j.getCurrentPageInfo():($=(G=j.internal).getCurrentPageInfo)==null?void 0:$.call(G);D!=null&&D.pageNumber&&it(D.pageNumber)}};w&&(_e.bodyStyles={fillColor:w}),oe&&je?(_e.bodyStyles={fillColor:oe},_e.alternateRowStyles={fillColor:je}):(oe||w)&&(_e.alternateRowStyles={fillColor:w});const Qe={..._e,...T};for(const D of["styles","headStyles","bodyStyles","alternateRowStyles","margin"]){const G=_e[D],$=T==null?void 0:T[D];G&&$&&typeof $=="object"&&(Qe[D]={...G,...$})}u(j,Qe);const ht=typeof j.getNumberOfPages=="function"?j.getNumberOfPages():j.internal.getNumberOfPages(),ae=(D,G)=>D==="center"?(A-G)/2:D==="right"?A-P.right-G:P.left,qe=(D,G,$,se)=>{if(!D)return;if(D.kind==="image"){j.addImage(D.dataUrl,"PNG",ae($,D.width),G,D.width,D.height);return}j.setFont(Y,"normal"),j.setFontSize(Ue),j.setTextColor(...ye);const ze=j.splitTextToSize(Zr(D.text,se,ht),fe),Fe=$==="center"?A/2:$==="right"?A-P.right:P.left;j.text(ze,Fe,G+Ue,{align:$})};for(let D=1;D<=ht;D++)j.setPage(D),qe(ie,Te,_,D),qe(he,ut-ct,F,D),k&&(j.setFont(Y,"normal"),j.setFontSize(8),j.setTextColor(...ye),j.text(`Page ${D} of ${ht}`,A-P.right,dt,{align:"right"}));return j.output("blob")}function el(t){var F;if(!t||typeof getComputedStyle>"u")return{};const n={},o=b=>b?getComputedStyle(b):null,s=b=>{var S;for(let g=b;g;g=g.parentElement){const k=(S=o(g))==null?void 0:S.backgroundColor;if(k&&de(k))return k}},f=b=>{const S=de(b);return S?"#"+S.map(g=>g.toString(16).padStart(2,"0")).join(""):void 0},u=b=>b?Math.round(parseFloat(b)*.75*10)/10:void 0,c=t.querySelector("thead th");if(c){const b=o(c);n.headColor=f(s(c)),n.headTextColor=f(b.color),n.headFontStyle=parseInt(b.fontWeight,10)>=600?"bold":"normal"}const m=Array.from(t.querySelectorAll("tbody tr.rg-grid__row:not(.rg-grid__row--exit)")).slice(0,2),x=(F=m[0])==null?void 0:F.querySelector("td");if(x){const b=o(x);n.bodyTextColor=f(b.color);const S=u(b.fontSize);S&&!Number.isNaN(S)&&(n.fontSize=Math.min(14,Math.max(6,S)));const g=f(s(m[0].querySelector("td"))),k=f(m[1]?s(m[1].querySelector("td")):void 0);n.bodyColor=g,g&&k&&g!==k&&(n.stripeColors=[g,k]);const E=o(x);parseFloat(E.borderBottomWidth)>0&&E.borderBottomStyle!=="none"&&(n.borderColor=f(E.borderBottomColor),n.borderWidth=.5)}const _=f(s(t));return _&&_!=="#ffffff"&&(n.pageBackground=_),n.textColor=f(o(t).color),n.fontName=void 0,Object.keys(n).forEach(b=>n[b]===void 0&&delete n[b]),n}const go={none:0,asc:0,desc:180};function mo({direction:t,size:n=14,priority:o,className:s,style:f}){const u=p.useRef(0),m=((go[t??"none"]-u.current)%360+360)%360;return u.current+=m,i.jsxs("span",{className:O("rg-sort-arrow",t&&"rg-sort-arrow--active",s),style:f,"data-direction":t??"none",children:[i.jsxs("svg",{className:"rg-sort-arrow__icon",width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",style:{transform:`rotate(${u.current}deg)`},children:[i.jsx("path",{d:"M8 13V3"}),i.jsx("path",{d:"M3.5 7.5 8 3l4.5 4.5"})]}),t&&o!==void 0&&i.jsx("sup",{className:"rg-sort-arrow__order",children:o})]})}function tl({direction:t,children:n}){const o=p.useRef(0),s=((go[t??"none"]-o.current)%360+360)%360;return o.current+=s,i.jsx("span",{className:"rg-sort-turn",style:{transform:`rotate(${o.current}deg)`},children:n})}const xo=new TextEncoder;let fn=null;function nl(t){if(!fn){fn=new Uint32Array(256);for(let o=0;o<256;o++){let s=o;for(let f=0;f<8;f++)s=s&1?3988292384^s>>>1:s>>>1;fn[o]=s>>>0}}let n=4294967295;for(let o=0;o<t.length;o++)n=fn[(n^t[o])&255]^n>>>8;return(n^4294967295)>>>0}async function rl(t){const n=globalThis.CompressionStream;if(typeof n>"u")return null;try{const o=new Blob([t]).stream().pipeThrough(new n("deflate-raw"));return new Uint8Array(await new Response(o).arrayBuffer())}catch{return null}}async function ol(t){const n=new Date,o=n.getHours()<<11|n.getMinutes()<<5|n.getSeconds()>>1,s=n.getFullYear()-1980<<9|n.getMonth()+1<<5|n.getDate(),f=[],u=[];let c=0;for(const g of t){const k=xo.encode(g.name),E=nl(g.data),N=await rl(g.data),T=N!==null&&N.length<g.data.length,v=T?N:g.data,P=T?8:0,Y=new Uint8Array(30+k.length),K=new DataView(Y.buffer);K.setUint32(0,67324752,!0),K.setUint16(4,20,!0),K.setUint16(6,2048,!0),K.setUint16(8,P,!0),K.setUint16(10,o,!0),K.setUint16(12,s,!0),K.setUint32(14,E,!0),K.setUint32(18,v.length,!0),K.setUint32(22,g.data.length,!0),K.setUint16(26,k.length,!0),K.setUint16(28,0,!0),Y.set(k,30);const U=new Uint8Array(46+k.length),z=new DataView(U.buffer);z.setUint32(0,33639248,!0),z.setUint16(4,20,!0),z.setUint16(6,20,!0),z.setUint16(8,2048,!0),z.setUint16(10,P,!0),z.setUint16(12,o,!0),z.setUint16(14,s,!0),z.setUint32(16,E,!0),z.setUint32(20,v.length,!0),z.setUint32(24,g.data.length,!0),z.setUint16(28,k.length,!0),z.setUint32(42,c,!0),U.set(k,46),f.push(Y,v),u.push(U),c+=Y.length+v.length}const m=u.reduce((g,k)=>g+k.length,0),x=new Uint8Array(22),_=new DataView(x.buffer);_.setUint32(0,101010256,!0),_.setUint16(8,t.length,!0),_.setUint16(10,t.length,!0),_.setUint32(12,m,!0),_.setUint32(16,c,!0);const F=[...f,...u,x],b=new Uint8Array(F.reduce((g,k)=>g+k.length,0));let S=0;for(const g of F)b.set(g,S),S+=g.length;return b}function gn(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function pn(t){let n=t+1,o="";for(;n>0;){const s=(n-1)%26;o=String.fromCharCode(65+s)+o,n=Math.floor((n-1)/26)}return o}function sl(t){const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(!n)return null;const[o,s,f]=[Number(n[1]),Number(n[2]),Number(n[3])],u=new Date(Date.UTC(o,s-1,f));return u.getUTCFullYear()!==o||u.getUTCMonth()!==s-1||u.getUTCDate()!==f?null:Math.round((u.getTime()-Date.UTC(1899,11,30))/864e5)}function ll(t){return(t??"").replace(/[\[\]:*?/\\]/g," ").trim().slice(0,31)||"Sheet1"}const il=1,al=2,cl=3,dl=4,ul=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
3
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
4
4
|
<numFmts count="1"><numFmt numFmtId="164" formatCode="yyyy\\-mm\\-dd"/></numFmts>
|
|
5
5
|
<fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Calibri"/></font></fonts>
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment horizontal="center"/></xf>
|
|
15
15
|
</cellXfs>
|
|
16
16
|
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
17
|
-
</styleSheet>`;function
|
|
17
|
+
</styleSheet>`;function fl(t,n,o){if(n==null||n==="")return"";const s=o.align==="right"?cl:o.align==="center"?dl:0;if(typeof n=="boolean")return`<c r="${t}" t="b"${s?` s="${s}"`:""}><v>${n?1:0}</v></c>`;if(typeof n=="number")return Number.isFinite(n)?`<c r="${t}"${s?` s="${s}"`:""}><v>${n}</v></c>`:"";if(o.kind==="date"){const u=sl(n);if(u!==null)return`<c r="${t}" s="${al}"><v>${u}</v></c>`}if(o.kind==="number"&&n.trim()!==""&&Number.isFinite(Number(n)))return`<c r="${t}"${s?` s="${s}"`:""}><v>${Number(n)}</v></c>`;const f=gn(n.slice(0,32767));return`<c r="${t}" t="inlineStr"${s?` s="${s}"`:""}><is><t xml:space="preserve">${f}</t></is></c>`}const ro=t=>t==null?0:typeof t=="boolean"?5:String(t).length;function hl(t,n){const o=pn(Math.max(0,t.length-1)),s=n.length+1,f=t.map((c,m)=>{let x=ro(c.header)+3;for(let _=0;_<Math.min(n.length,500);_++)x=Math.max(x,c.kind==="date"?11:ro(n[_][m]));return Math.min(60,Math.max(8,x+2))}),u=[];return u.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),u.push('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">'),u.push(`<dimension ref="A1:${o}${s}"/>`),u.push('<sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft"/></sheetView></sheetViews>'),u.push('<sheetFormatPr defaultRowHeight="15"/>'),u.push("<cols>"+f.map((c,m)=>`<col min="${m+1}" max="${m+1}" width="${c}" customWidth="1"/>`).join("")+"</cols>"),u.push("<sheetData>"),u.push('<row r="1" ht="22" customHeight="1">'+t.map((c,m)=>`<c r="${pn(m)}1" s="${il}" t="inlineStr"><is><t xml:space="preserve">${gn(c.header)}</t></is></c>`).join("")+"</row>"),n.forEach((c,m)=>{const x=m+2,_=t.map((F,b)=>fl(`${pn(b)}${x}`,c[b],F)).join("");u.push(`<row r="${x}">${_}</row>`)}),u.push("</sheetData>"),u.push(`<autoFilter ref="A1:${o}${s}"/>`),u.push("</worksheet>"),u.join("")}async function pl(t,n,o={}){const s=ll(o.sheetName),f=`'${s.replace(/'/g,"''")}'`,u=pn(Math.max(0,t.length-1)),c={"[Content_Types].xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
18
18
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`,"_rels/.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
19
19
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,"xl/workbook.xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
20
20
|
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="${gn(s)}" sheetId="1" r:id="rId1"/></sheets><definedNames><definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">${gn(f)}!$A$1:$${u}$${n.length+1}</definedName></definedNames></workbook>`,"xl/_rels/workbook.xml.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
21
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`,"xl/styles.xml":dl,"xl/worksheets/sheet1.xml":fl(t,n)},m=await rl(Object.entries(c).map(([x,_])=>({name:x,data:xo.encode(_)})));return new Blob([m],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}const Bn=new Set(["__proto__","prototype","constructor"]),bo=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function be(t,n){if(t===null||typeof t!="object")return;if(bo(t,n))return t[n];let o=t;for(const s of n.split(".")){if(o==null||typeof o!="object"||Bn.has(s))return;o=o[s]}return o}function oo(t,n,o){if(Array.isArray(t)){const s=[...t];return s[n]=o,s}return{...t,[n]:o}}function Kn(t,n,o){const s=t??{};if(bo(s,n)||!n.includes("."))return Bn.has(n)?t:oo(s,n,o);const[f,...u]=n.split(".");if(Bn.has(f))return t;const c=s[f];return oo(s,f,Kn(c!==null&&typeof c=="object"?c:{},u.join("."),o))}function so(t,n){if(n.length===0)return t.map((c,m)=>({kind:"row",entry:c,i:m}));const o=new Map;for(const c of n)o.set(c.afterId,[...o.get(c.afterId)??[],c]);const s=[],f=new Set,u=c=>{for(const m of o.get(c)??[])f.has(m.id)||(f.add(m.id),s.push({kind:"ghost",ghost:m}),u(m.id))};return u(null),t.forEach((c,m)=>{s.push({kind:"row",entry:c,i:m}),u(c.id)}),n.forEach(c=>!f.has(c.id)&&s.push({kind:"ghost",ghost:c})),s}const pl=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ee=38,gl=150,lo=10,Wn=(t,n)=>`${typeof t}:${t}\0${n}`;function jt(t,n){const o=be(n,t.field);return t.valueFormatter?t.valueFormatter(o,n):t.type==="boolean"&&typeof o=="boolean"?o?"Yes":"No":t.type==="date"?Es(o,t.dateLocale,t.dateFormat):o==null?"":o instanceof Date?o.toLocaleDateString():String(o)}function ml(t,n,o){if(o.type==="date"){const s=ue(t)??"",f=ue(n)??"";return s<f?-1:s>f?1:0}return typeof t=="number"&&typeof n=="number"?t-n:t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}const xl=t=>t?Array.isArray(t)?t:[t]:[],io=t=>t.type==="date"&&t.validity.badInput;function bl({columns:t,rows:n,getRowId:o,editable:s=!1,enterMovesDown:f=!0,onCellEdit:u,onRowsChange:c,rowSelection:m=!1,selectedRowIds:x,defaultSelectedRowIds:_,onSelectionChange:F,isRowSelectable:b,sort:S,defaultSort:g=null,onSortChange:k,multiSort:E=!1,searchable:N=!1,searchPlaceholder:T="Search…",search:v,onSearchChange:R,filters:Y,onFiltersChange:K,pagination:U=!1,paginationPosition:z="bottom",showToolbar:ye=!0,showFooter:De=!0,pageSize:Oe=10,pageSizeOptions:Se=[5,10,25,50],page:q,onPageChange:oe,onPageSizeChange:je,serverSide:w=!1,rowCount:H,onQueryChange:j,queryDebounce:A=250,filterDebounce:le=300,loading:fe,loadingRows:Ue,skeletonRow:Qe,errorMessage:Dt="Could not load the data.",columnMenu:it=!1,onColumnVisibilityChange:Ae,keyboardNavigation:We=!1,virtualize:ie=!1,rowHeight:he=40,overscan:at=6,exportable:Be=!1,onExportError:ct,apiRef:Te,onRowClick:dt,toolbar:ut,emptyMessage:Tt="No rows to show",emptyComponent:ft,sortIndicator:Ke="default",sortIndicatorRotate:Ft=!0,striped:Ce=!1,stripeColors:_e,checkboxVariant:Ze="native",animateRows:ht=!0,rowAnimation:ae,rowAnimationDuration:qe,rowAnimationStagger:et,rowAnimationClassName:tt,rowExitAnimationClassName:D,theme:G,maxHeight:$,stickyToolbar:se=!1,stickyHeader:ze=!1,stickyOffset:Fe=0,scrollbar:Mt="thin",className:It,style:yo,classNames:V={},styles:W={},rowClassName:xn,rowStyle:bn}){const J=(e,r)=>({className:O(r,V[e]),style:W[e]}),[$t,zn]=p.useState(n),nt=p.useRef(n);p.useEffect(()=>{nt.current=n,zn(n)},[n]);const Yn=e=>{nt.current=e,zn(e)},[pt,Vn]=St(v,"",R),[rt,Hn]=St(Y,{},K),[pe,_o]=St(S,xl(g),k),[yn,ot]=St(q,0,oe),[ee,wo]=p.useState(Oe),vo=e=>{wo(e),je==null||je(e)},[Rt,ko]=p.useState(()=>new Set(t.filter(e=>e.hidden).map(e=>e.field))),So=(e,r)=>{const l=new Set(Rt);r?l.add(e):l.delete(e),ko(l),Ae==null||Ae([...l])},[_n,Xn]=p.useState({}),[Pt,jo]=p.useState({}),[yl,Co]=p.useState(0),gt=p.useRef(new Map),[mt,Ye]=p.useState(null),Me=p.useRef(0),Lt=p.useRef(null),Ot=p.useRef(new Map),[wn,Gn]=p.useState(null),vn=p.useRef(null),Jn=p.useRef(null),xt=p.useRef(null),[kn,Qn]=p.useState({top:0,height:0}),P=p.useMemo(()=>{const e=t.filter(r=>!Rt.has(r.field)).map(r=>r.type==="sequence"?{...r,sortable:!1,filterable:!1,editable:!1,filterRenderer:void 0}:r);return[...e.filter(r=>r.pinned==="left"),...e.filter(r=>r.pinned!=="left"&&r.pinned!=="right"),...e.filter(r=>r.pinned==="right")]},[t,Rt]),Sn=e=>e.sortable===!0,ce=m==="single"?"single":m?"multiple":null,bt=P.length+(ce?1:0),Ve=p.useMemo(()=>$t.map((e,r)=>({row:e,index:r,id:o?o(e,r):r})),[$t,o]),Zn=p.useRef(new Map);Ve.forEach(e=>Zn.current.set(e.id,e.row));const st=p.useMemo(()=>Object.entries(rt).filter(([e,r])=>{const l=P.find(a=>a.field===e);return!!l&&!!l.filterable&&ho(r)}),[rt,P]),[No,Eo]=p.useState(pt);p.useEffect(()=>{if(!w)return;const e=setTimeout(()=>Eo(pt),A);return()=>clearTimeout(e)},[pt,w,A]);const Ie=w?No:pt,er=e=>e.filterRenderer?"text":zr(e),Ne=p.useMemo(()=>{if(w)return Ve;const e=Ie.trim().toLowerCase();let r=Ve.filter(({row:a})=>e&&!P.some(d=>jt(d,a).toLowerCase().includes(e))?!1:st.every(([d,h])=>{const y=P.find(C=>C.field===d);return Ms(er(y),h,jt(y,a),be(a,d))}));const l=pe.map(a=>({col:P.find(d=>d.field===a.field),dir:a.direction==="asc"?1:-1})).filter(a=>!!a.col);return l.length&&(r=[...r].sort((a,d)=>{for(const{col:h,dir:y}of l){const C=be(a.row,h.field),M=be(d.row,h.field),L=C==null||C==="",Q=M==null||M==="";if(L||Q){if(L!==Q)return L?1:-1;continue}const ge=h.comparator?h.comparator(C,M,a.row,d.row):ml(C,M,h);if(ge!==0)return ge*y}return 0})),r},[Ve,P,Ie,st,pe,w]),Ut=JSON.stringify([Ie,rt,pe,ee]),tr=p.useRef(Ut);p.useEffect(()=>{tr.current!==Ut&&(tr.current=Ut,ot(0))},[Ut]);const lt=w?H??Ve.length:Ne.length,$e=U?Math.max(1,Math.ceil(lt/ee)):1,te=Math.min(yn,$e-1),B=U&&!w?Ne.slice(te*ee,te*ee+ee):Ne,Do=lt===0?0:U?te*ee+1:1,To=U?Math.min(lt,(te+1)*ee):lt,jn=p.useMemo(()=>({sort:pe.filter(e=>{const r=t.find(l=>l.field===e.field);return!!r&&Sn(r)}),filters:Object.fromEntries(st),search:Ie.trim(),page:te,pageSize:ee}),[pe,t,st,Ie,te,ee]),Fo=JSON.stringify(jn),At=p.useRef(jn);At.current=jn;const Wt=p.useRef(j);Wt.current=j;const[Mo,Bt]=p.useState(!1),[Cn,Nn]=p.useState(!1),En=p.useRef(0),Kt=p.useCallback(e=>{var a;const r=++En.current,l=(a=Wt.current)==null?void 0:a.call(Wt,e);l&&typeof l.then=="function"?(Bt(!0),Nn(!1),l.then(()=>{r===En.current&&Bt(!1)},()=>{r===En.current&&(Bt(!1),Nn(!0))})):(Bt(!1),Nn(!1))},[]);p.useEffect(()=>{w&&Kt(At.current)},[w,Fo,Kt]),p.useEffect(()=>{w&&U&&yn>$e-1&&ot($e-1)},[w,U,yn,$e]);const yt=fe??Mo,nr=e=>e.map(r=>Zn.current.get(r)).filter(r=>r!==void 0),[ve,qt]=St(x,_??[],e=>F==null?void 0:F({ids:e,rows:nr(e)})),zt=p.useMemo(()=>new Set(ve),[ve]),Yt=e=>b?b(e):!0,Vt=p.useRef(null),rr=p.useRef(!1),Io=(e,r)=>{if(!ce||!Yt(e.row))return;if(ce==="single"){qt(r?[e.id]:[]),Vt.current=e.id;return}const l=new Set(ve),a=rr.current&&Vt.current!==null?B.findIndex(h=>h.id===Vt.current):-1,d=B.findIndex(h=>h.id===e.id);if(a>=0&&d>=0)for(let h=Math.min(a,d);h<=Math.max(a,d);h++)Yt(B[h].row)&&(r?l.add(B[h].id):l.delete(B[h].id));else r?l.add(e.id):l.delete(e.id);Vt.current=e.id,qt([...l])},_t=p.useMemo(()=>Ne.filter(e=>Yt(e.row)),[Ne,b]),or=_t.filter(e=>zt.has(e.id)).length,sr=_t.length>0&&or===_t.length,lr=e=>{const r=new Set(ve);_t.forEach(l=>e?r.add(l.id):r.delete(l.id)),qt([...r])},Ht=(e,r,l)=>({value:be(r,e.field),formattedValue:jt(e,r),row:r,rowIndex:l,field:e.field,column:e}),Dn=(e,r)=>{const l=e.editable??s;return typeof l=="function"?l(r):!!l},Xt=(e,r)=>Dn(e,r)&&!(e.type==="boolean"&&!e.cellEditor),$o=(e,r)=>{const l=Ht(e,r.row,r.index),a=Dn(e,l);return{...l,editable:a,updateValue:d=>a&&ar(r,e,{value:d})}},ir=(e,r)=>{if(!Sn(e))return;const l=pe.find(h=>h.field===e.field),a=l?l.direction==="asc"?"desc":null:"asc";let d;r&&E?a?l?d=pe.map(h=>h.field===e.field?{...h,direction:a}:h):d=[...pe,{field:e.field,direction:a}]:d=pe.filter(h=>h.field!==e.field):d=a?[{field:e.field,direction:a}]:[],_o(d)},Gt=(e,r)=>{var l;return(l=Ot.current.get(Wn(e,r)))==null?void 0:l.focus()},Re=()=>{Me.current+=1,Ye(null)},Ro=e=>{for(const r of nt.current){const l=be(r,e.field);if(l!=null&&l!=="")return l}},Jt=(e,r,l={})=>{if(!Xt(r,Ht(r,e.row,e.index)))return!1;const a=be(e.row,r.field);let d;return r.cellEditor?d=a:r.type==="date"?d=ue(a)??"":d=l.text??(a==null?"":String(a)),Lt.current=d,Me.current+=1,Ye({id:e.id,field:r.field,draft:d,session:Me.current,select:l.select??"end",invalid:!1}),!0},ar=(e,r,l)=>{const a=nt.current[e.index]??e.row,d=be(a,r.field);let h;if("value"in l)h=l.value;else if(r.valueParser)h=r.valueParser(l.text,a);else if(r.type==="date"){if(l.text!==""&&!re(l.text))return!1;h=Ds(l.text,d??Ro(r))}else if(r.type==="number")if(l.text.trim()==="")h=null;else{const M=Number(l.text);if(!Number.isFinite(M))return!1;h=M}else h=l.text;if(r.type==="date"){if(ue(h)===ue(d))return!0;const M=ue(h);if(M&&(r.dateMin&&M<r.dateMin||r.dateMax&&M>r.dateMax))return!1}else if(Object.is(h,d))return!0;if(r.validate&&!r.validate(h,a))return!1;const y=Kn(a,r.field,h),C=nt.current.map((M,L)=>L===e.index?y:M);return Yn(C),u==null||u({rowId:e.id,rowIndex:e.index,field:r.field,oldValue:d,newValue:h,row:y}),c==null||c(C),!0},cr=(e,r,l)=>{const a=B.findIndex(L=>L.id===e.id),d=P.findIndex(L=>L.field===r);if(a<0||d<0)return null;const h=(L,Q)=>Xt(Q,Ht(Q,L.row,L.index));if(l==="down"||l==="up"){const L=l==="down"?1:-1;for(let Q=a+L;Q>=0&&Q<B.length;Q+=L)if(h(B[Q],P[d]))return{entry:B[Q],col:P[d]};return null}const y=l==="right"?1:-1;let C=a,M=d+y;for(;C>=0&&C<B.length;){for(;M>=0&&M<P.length;){if(h(B[C],P[M]))return{entry:B[C],col:P[M]};M+=y}C+=y,M=y>0?0:P.length-1}return null},He=(e,r,l,a={})=>{const{move:d="none",focus:h=!0}=a;if(!ar(e,r,l))return Ye(C=>C&&{...C,invalid:!0}),!1;const y=d==="none"?null:cr(e,r.field,d);return y?Jt(y.entry,y.col,{select:"all"}):(Re(),h&&Gt(e.id,r.field)),!0},dr=(e,r,l)=>{if(e.nativeEvent.isComposing)return;const a=e.currentTarget.value,d=io(e.currentTarget);if(e.key==="Enter"){if(e.preventDefault(),d)return Ye(y=>y&&{...y,invalid:!0});const h=f?e.shiftKey?"up":"down":"none";He(r,l,{text:a},{move:h})}else if(e.key==="Escape")e.preventDefault(),Re(),Gt(r.id,l.field);else if(e.key==="Tab"&&!d){const h=e.shiftKey?"left":"right";cr(r,l.field,h)&&(e.preventDefault(),He(r,l,{text:a},{move:h}))}},Po=(e,r)=>{var h;const l=B[e],a=P[r];if(!l||!a)return;Gn({id:l.id,field:a.field}),vn.current=Wn(l.id,a.field);const d=xt.current;if(ie&&d){const y=((h=d.querySelector("thead"))==null?void 0:h.clientHeight)??0,C=e*he;C<d.scrollTop?d.scrollTo({top:C,behavior:"auto"}):C+he>d.scrollTop+d.clientHeight-y&&d.scrollTo({top:C+he-d.clientHeight+y,behavior:"auto"})}};p.useEffect(()=>{const e=vn.current;if(!e)return;const r=Ot.current.get(e);r&&(vn.current=null,r.focus())});const Lo=(e,r,l)=>{if(!We)return!1;let a=B.findIndex(h=>h.id===r.id),d=P.findIndex(h=>h.field===l.field);if(a<0||d<0)return!1;switch(e.key){case"ArrowDown":a+=1;break;case"ArrowUp":a-=1;break;case"ArrowRight":d+=1;break;case"ArrowLeft":d-=1;break;case"PageDown":a+=lo;break;case"PageUp":a-=lo;break;case"Home":d=0,(e.ctrlKey||e.metaKey)&&(a=0);break;case"End":d=P.length-1,(e.ctrlKey||e.metaKey)&&(a=B.length-1);break;default:return!1}return e.preventDefault(),Po(Math.max(0,Math.min(B.length-1,a)),Math.max(0,Math.min(P.length-1,d))),!0},Oo=(e,r,l,a)=>{e.target===e.currentTarget&&(Lo(e,r,l)||Xt(l,a)&&(e.key==="Enter"||e.key==="F2"?(e.preventDefault(),Jt(r,l)):!l.cellEditor&&l.type!=="date"&&e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),Jt(r,l,{text:e.key}))))};Nt(()=>{if(!ie||!xt.current)return;const e=xt.current,r=()=>Qn(a=>a.height===e.clientHeight?a:{...a,height:e.clientHeight});if(r(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(r);return l.observe(e),()=>l.disconnect()},[ie]);const wt=ie&&!yt&&B.length>0,Uo=kn.height||(typeof $=="number"?$:400),Qt=wt?Math.max(0,Math.floor(kn.top/he)-at):0,Tn=wt?Math.min(B.length,Math.ceil((kn.top+Uo)/he)+at):B.length,ur=wt?B.slice(Qt,Tn):B,Ao=`${te}|${ee}|${JSON.stringify(pe)}|${Ie}|${JSON.stringify(rt)}`,fr=p.useRef(!0);p.useEffect(()=>{if(fr.current){fr.current=!1;return}const e=xt.current;e&&typeof e.scrollTo=="function"&&e.scrollTop>0&&e.scrollTo({top:0,behavior:"smooth"})},[Ao]);const hr=(typeof ae=="string"?ae:ae==null?void 0:ae.enter)??"slide-up",Fn=(typeof ae=="string"?ae:(ae==null?void 0:ae.exit)??(ae==null?void 0:ae.enter))??"slide-up",Mn=ht&&!ie,pr=Mn&&(Fn!=="none"||!!D),gr=qe??380,mr=et??28,Zt=p.useRef(new Map);let Wo=0;const Bo=e=>{let r=Zt.current.get(e);return r===void 0&&(r=Wo++,Zt.current.set(e,r)),Math.min(r,24)},[ke,xr]=p.useState([]),br=p.useRef({rows:[],order:[],pageKey:""}),Pe=p.useRef(new Map),In=`${te}|${ee}|${w}`,$n=p.useCallback(e=>{const r=Pe.current.get(e);r!==void 0&&clearTimeout(r),Pe.current.delete(e),xr(l=>{const a=l.find(d=>d.id===e);return a?l.filter(d=>d.id!==e).map(d=>d.afterId===e?{...d,afterId:a.afterId}:d):l})},[]);Nt(()=>{const e=br.current,r=new Set(B.map(d=>d.id));Zt.current.forEach((d,h)=>!r.has(h)&&Zt.current.delete(h));const l=!pr||yt||Cn||e.pageKey!==In||pl();let a=ke;if(l)a=[];else{a=a.filter(h=>!r.has(h.id));const d=e.rows.filter(h=>!r.has(h.id)&&!a.some(y=>y.id===h.id));if(d.length>0){const h=d.map((y,C)=>{const M=e.order.indexOf(y.id);return{id:y.id,entry:y,afterId:M>0?e.order[M-1]:null,batch:C}});a=[...a,...h]}}(a.length!==ke.length||a.some((d,h)=>d!==ke[h]))&&xr(a),br.current={rows:B,order:so(B,a).map(d=>d.kind==="row"?d.entry.id:d.ghost.id),pageKey:In}},[B,ke,yt,Cn,In,pr]),p.useEffect(()=>{const e=!!D;ke.forEach(r=>{if(Pe.current.has(r.id))return;const l=e?2500:gr*.8+mr*Math.min(r.batch,24)+250;Pe.current.set(r.id,setTimeout(()=>$n(r.id),l))}),Pe.current.forEach((r,l)=>{ke.some(a=>a.id===l)||(clearTimeout(r),Pe.current.delete(l))})},[ke,gr,mr,D,$n]),p.useEffect(()=>()=>{Pe.current.forEach(e=>clearTimeout(e)),Pe.current.clear()},[]);const Ko=p.useMemo(()=>so(ur,ke),[ur,ke]),yr=p.useRef(null),[qo,zo]=p.useState(0);Nt(()=>{const e=yr.current;if(!e||!se)return;const r=()=>zo(e.offsetHeight);if(r(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(r);return l.observe(e),()=>l.disconnect()},[se]);const en=Object.keys(_n).length>0,tn=e=>_n[e.field]??(typeof e.width=="number"?e.width:gl),Yo=e=>Math.max(40,typeof e.minWidth=="number"?e.minWidth:60),nn=e=>e.overflow??(typeof e.width=="number"&&e.width<40?"clip":e.width!==void 0&&e.width!==""?"wrap":void 0),_r=e=>typeof e.width=="number"&&e.width<40?{paddingLeft:0,paddingRight:0}:null,Vo=P.some(e=>e.width!==void 0&&e.width!==null&&e.width!==""),Ho=P.length>0&&P.every(e=>typeof e.width=="number"),Xo=(e,r)=>{e.preventDefault(),e.stopPropagation();const l={..._n};en||P.forEach(L=>{var Q;return l[L.field]=((Q=gt.current.get(L.field))==null?void 0:Q.offsetWidth)??tn(L)});const a=e.clientX,d=l[r.field]??tn(r),h=e.currentTarget;h.setPointerCapture(e.pointerId),Xn(l);const y=L=>Math.min(r.maxWidth??1/0,Math.max(Yo(r),Math.round(L))),C=L=>Xn(Q=>({...Q,[r.field]:y(d+L.clientX-a)})),M=()=>{h.removeEventListener("pointermove",C),h.removeEventListener("pointerup",M),h.removeEventListener("pointercancel",M)};h.addEventListener("pointermove",C),h.addEventListener("pointerup",M),h.addEventListener("pointercancel",M)};Nt(()=>{var d,h;const e={};let r=ce&&P.some(y=>y.pinned==="left")?Ee:0;for(const y of P)y.pinned==="left"&&(e[y.field]=r,r+=((d=gt.current.get(y.field))==null?void 0:d.offsetWidth)??0);let l=0;for(const y of[...P].reverse())y.pinned==="right"&&(e[y.field]=l,l+=((h=gt.current.get(y.field))==null?void 0:h.offsetWidth)??0);const a=Object.keys(e);(a.length!==Object.keys(Pt).length||a.some(y=>e[y]!==Pt[y]))&&jo(e)}),p.useEffect(()=>{const e=()=>Co(r=>r+1);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const wr=P.map(e=>e.pinned).lastIndexOf("left"),Go=P.findIndex(e=>e.pinned==="right"),rn=wr>=0,vr=(e,r)=>({className:e.pinned?O("rg-grid__pinned",`rg-grid__pinned--${e.pinned}`,r===wr&&"rg-grid__pinned--edge",r===Go&&"rg-grid__pinned--edge"):void 0,style:e.pinned==="left"?{left:Pt[e.field]??0}:e.pinned==="right"?{right:Pt[e.field]??0}:void 0}),Le=typeof Be=="object"?Be:{},on=p.useMemo(()=>{var r;const e=(r=Le.formats)!=null&&r.length?Le.formats:["csv"];return e.filter((l,a)=>e.indexOf(l)===a)},[Be]),sn=(e={})=>{const r={...Le,...e,pdf:{...Le.pdf,...e.pdf}},l=r.scope??"filtered",a=l==="page"||l==="visible",d=a?B:l==="selected"?Ve.filter(ge=>zt.has(ge.id)):Ne,h=r.includeHidden?t:P,y=a&&U?te*ee:0,C=h.map(ge=>Ct(ge)||ge.field),M=[],L=[],Q=[];return d.forEach(({row:ge},Rn)=>{const cn=[],I=[],vt={};h.forEach((X,Pn)=>{const Z=be(ge,X.field);let me,ne;if(X.type==="sequence"){const un=Or(X,Rn,X.sequenceRestartEachPage?0:y);me=un,ne=un}else X.exportValue?(me=X.exportValue(Z,ge),ne=me??null):X.type==="date"?(me=ue(Z)??"",ne=me):(me=jt(X,ge),X.type==="number"&&typeof Z=="number"&&Number.isFinite(Z)||X.type==="boolean"&&typeof Z=="boolean"?ne=Z:X.valueFormatter?ne=me:Z==null?ne=null:typeof Z=="string"||typeof Z=="boolean"||typeof Z=="number"&&Number.isFinite(Z)?ne=Z:Z instanceof Date?ne=Number.isNaN(Z.getTime())?null:Z.toISOString():ne=me);cn.push(me),I.push(ne);const dn=r.jsonKeys==="header"?C[Pn]:X.field;vt[dn]=X.type==="date"&&ne===""?null:ne??null}),M.push(cn),L.push(I),Q.push(vt)}),{opts:r,cols:h,headers:C,display:M,typed:L,records:Q}},ln=(e,r)=>`${e.filename??"export"}.${r}`,kr=(e={})=>{const r=sn(e);return Ks(r.headers,r.display,{sanitize:r.opts.sanitize})},Sr=(e={})=>{const r={...Le,...e};qs(kr(e),ln(r,"csv"))},jr=(e={})=>{const r=sn(e);return JSON.stringify(r.records,null,r.opts.jsonIndent??2)},Cr=(e={})=>{const r={...Le,...e};hn(new Blob([jr(e)],{type:"application/json;charset=utf-8"}),ln(r,"json"))},Nr=async(e={})=>{const r=sn(e),l=r.cols.map(a=>({header:Ct(a)||a.field,kind:a.type==="number"||a.type==="sequence"?"number":a.type==="date"?"date":a.type==="boolean"?"boolean":"text",align:a.align??(a.type==="number"||a.type==="sequence"?"right":void 0)}));return hl(l,r.typed,{sheetName:r.opts.sheetName})},Er=async(e={})=>{const r={...Le,...e};hn(await Nr(e),ln(r,"xlsx"))},Dr=async(e={})=>{var l;const r=sn(e);return Qs({headers:r.headers,rows:r.display.map(a=>a.map(d=>d==null?"":String(d))),aligns:r.cols.map(a=>a.align??(a.type==="number"||a.type==="sequence"?"right":void 0)),fields:r.cols.map(a=>a.field)},r.opts.pdf,(l=r.opts.pdf)!=null&&l.matchGridStyle?Zs(Jn.current):void 0)},Tr=async(e={})=>{const r={...Le,...e};hn(await Dr(e),ln(r,"pdf"))},Fr=async(e,r={})=>e==="csv"?Sr(r):e==="json"?Cr(r):e==="xlsx"?Er(r):Tr(r),Mr=async(e,r={})=>{try{await Fr(e,r)}catch(l){const a=l instanceof Error?l:new Error(String(l));ct?ct(a,e):console.error(`[react-gridix] ${e.toUpperCase()} export failed:`,a)}},[Ir,Jo]=p.useState("visible"),Qo=Ve.filter(e=>zt.has(e.id)).length,$r=[{value:"visible",label:"Visible rows",count:B.length},...U?[{value:"filtered",label:"All matching rows",count:Ne.length}]:[],...ce?[{value:"selected",label:"Selected rows",count:Qo}]:[]],Zo=$r.some(e=>e.value===Ir&&e.count>0)?Ir:"visible";p.useEffect(()=>{Te&&(Te.current={getCsv:kr,exportCsv:Sr,getJson:jr,exportJson:Cr,getXlsx:Nr,exportXlsx:Er,getPdf:Dr,exportPdf:Tr,exportAs:Fr,getSelectedRows:()=>nr(ve),getSelectedRowIds:()=>ve,selectAll:()=>lr(!0),clearSelection:()=>qt([]),refresh:()=>{w&&Kt(At.current)}})}),p.useEffect(()=>()=>{Te&&(Te.current=null)},[Te]);const Rr=e=>{var l,a,d,h,y,C,M,L;const r=e.checkbox??{};return{variant:r.variant??Ze,indicator:r.indicator,className:r.className,style:r.style,classNames:{root:O(V.checkbox,(l=r.classNames)==null?void 0:l.root),control:O(V.checkboxControl,(a=r.classNames)==null?void 0:a.control),indicator:O(V.checkboxIndicator,(d=r.classNames)==null?void 0:d.indicator),label:(h=r.classNames)==null?void 0:h.label},styles:{root:{...W.checkbox,...(y=r.styles)==null?void 0:y.root},control:{...W.checkboxControl,...(C=r.styles)==null?void 0:C.control},indicator:{...W.checkboxIndicator,...(M=r.styles)==null?void 0:M.indicator},label:(L=r.styles)==null?void 0:L.label}}},Xe=e=>e.stopPropagation(),es=(e,r)=>i.jsx("span",{className:"rg-grid__checkbox-cell",onClick:Xe,onDoubleClick:Xe,children:i.jsx(Je,{...Rr(e),checked:!!r.value,disabled:!r.editable,"aria-label":`Toggle ${Ge(e)}`,onChange:l=>r.updateValue(l)})}),Pr=e=>Ne.filter(r=>Dn(e,Ht(e,r.row,r.index))),ts=(e,r)=>{const l=new Map(Pr(e).map(h=>[h.index,h])),a=[],d=nt.current.map((h,y)=>{const C=l.get(y);if(!C)return h;const M=be(h,e.field);if(!!M===r||e.validate&&!e.validate(r,h))return h;const L=Kn(h,e.field,r);return a.push({rowId:C.id,rowIndex:y,field:e.field,oldValue:M,newValue:r,row:L}),L});a.length!==0&&(Yn(d),a.forEach(h=>u==null?void 0:u(h)),c==null||c(d))},ns=e=>{const r=Pr(e),l=r.length>0?r:Ne,a=l.filter(h=>!!be(h.row,e.field)).length,d=l.length>0&&a===l.length;return i.jsx("span",{className:"rg-grid__header-checkbox",onClick:Xe,onDoubleClick:Xe,children:i.jsx(Je,{...Rr(e),checked:d,indeterminate:a>0&&!d,disabled:r.length===0,label:Ct(e)||void 0,"aria-label":`Select all ${Ge(e)}`,onChange:h=>ts(e,h)})})},rs=(e,r,l)=>{if(r.cellEditor)return i.jsx("div",{className:"rg-grid__custom-editor",onBlur:d=>{d.currentTarget.contains(d.relatedTarget)||l.session===Me.current&&(He(e,r,{value:Lt.current},{focus:!1})||Re())},onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),Re(),Gt(e.id,r.field))},children:p.createElement(r.cellEditor,{value:l.draft,row:e.row,rowIndex:e.index,field:r.field,column:r,onChange:d=>{Lt.current=d,Ye(h=>h&&h.session===l.session?{...h,draft:d,invalid:!1}:h)},onCommit:(d,h="none")=>{l.session===Me.current&&He(e,r,{value:d===void 0?Lt.current:d},{move:h})},onCancel:()=>{Re(),Gt(e.id,r.field)}})});const a=r.type==="date";return a?i.jsx(Ts,{value:l.draft===null||l.draft===void 0?"":String(l.draft),label:`Edit ${Ge(r)}`,invalid:l.invalid,min:r.dateMin,max:r.dateMax,locale:r.dateLocale,theme:G,className:O("rg-grid__editor",l.invalid&&"rg-grid__editor--invalid",V.editor),style:{textAlign:r.align,...W.editor},onChange:d=>Ye(h=>h&&{...h,draft:d,invalid:!1}),onPick:d=>{l.session===Me.current&&He(e,r,{text:d},{focus:!0})},onBlur:d=>{l.session===Me.current&&(He(e,r,{text:d.currentTarget.value},{focus:!1})||Re())},onKeyDown:d=>dr(d,e,r)}):i.jsx("input",{autoFocus:!0,type:a?"date":"text",min:a?r.dateMin:void 0,max:a?r.dateMax:void 0,className:O("rg-grid__editor",l.invalid&&"rg-grid__editor--invalid",V.editor),style:{textAlign:r.align,...W.editor},value:l.draft===null||l.draft===void 0?"":String(l.draft),inputMode:r.type==="number"?"decimal":void 0,"aria-label":`Edit ${Ge(r)}`,"aria-invalid":l.invalid||void 0,onChange:d=>{const h=d.target.value;Ye(y=>y&&{...y,draft:h,invalid:!1})},onFocus:d=>{const h=d.currentTarget;a||(l.select==="all"?h.select():h.setSelectionRange(h.value.length,h.value.length))},onBlur:d=>{if(l.session===Me.current){if(io(d.currentTarget))return Re();He(e,r,{text:d.currentTarget.value},{focus:!1})||Re()}},onKeyDown:d=>dr(d,e,r)})},os=p.useMemo(()=>{const e=new Map;for(const r of P)r.filterable&&!r.filterRenderer&&zr(r)==="select"&&e.set(r.field,Is(r,$t,l=>be(l,r.field),l=>jt(r,l)));return e},[P,$t]),ss={...qe!==void 0?{"--rg-row-duration":`${qe}ms`,"--rg-row-exit-duration":`${Math.round(qe*.8)}ms`}:null,...et!==void 0?{"--rg-row-stagger":`${et}ms`}:null},ls=Ce||!!_e,is=_e?{"--rg-stripe-a":_e[0],"--rg-stripe-b":_e[1]}:void 0,as=De&&U&&(z==="top"||z==="both"),cs=De&&U&&(z==="bottom"||z==="both"),ds=ye&&(N||!!ut||it||!!Be),Lr=e=>i.jsxs("div",{className:O("rg-grid__footer",e==="top"&&"rg-grid__footer--top",V.footer),style:W.footer,"data-position":e,children:[i.jsxs("span",{...J("rowCount","rg-grid__count"),children:[lt===0?"0 rows":`${Do}–${To} of ${lt}`,ce&&ve.length>0?` · ${ve.length} selected`:""]}),i.jsxs("div",{...J("pagination","rg-grid__pagination"),children:[i.jsxs("label",{className:"rg-grid__page-size-label",children:["Rows per page",i.jsx("select",{value:ee,onChange:r=>vo(Number(r.target.value)),...J("pageSize","rg-grid__page-size"),children:(Se.includes(ee)?Se:[...Se,ee].sort((r,l)=>r-l)).map(r=>i.jsx("option",{value:r,children:r},r))})]}),i.jsx("button",{type:"button","aria-label":"First page",disabled:te===0,onClick:()=>ot(0),...J("pageButton","rg-grid__page-btn"),children:"«"}),i.jsx("button",{type:"button","aria-label":"Previous page",disabled:te===0,onClick:()=>ot(te-1),...J("pageButton","rg-grid__page-btn"),children:"‹"}),i.jsxs("span",{...J("pageInfo","rg-grid__page-info"),children:["Page ",te+1," of ",$e]}),i.jsx("button",{type:"button","aria-label":"Next page",disabled:te>=$e-1,onClick:()=>ot(te+1),...J("pageButton","rg-grid__page-btn"),children:"›"}),i.jsx("button",{type:"button","aria-label":"Last page",disabled:te>=$e-1,onClick:()=>ot($e-1),...J("pageButton","rg-grid__page-btn"),children:"»"})]})]}),us=(e,r,l)=>{const a=r===null?"default":e.sortIndicator??Ke,d=a!=="default",h=Ft&&a!=="arrow",y=a==="arrow"?i.jsx(mo,{direction:r,priority:l}):a!=="default"?p.createElement(a,{column:e,direction:r,priority:l}):h?r?"▲":"↕":r==="asc"?"▲":r==="desc"?"▼":"↕";return i.jsxs("span",{...J("sortIndicator",O("rg-grid__sort",d&&"rg-grid__sort--custom")),"aria-hidden":"true","data-direction":r??"none",children:[h?i.jsx(el,{direction:r,children:y}):y,a==="default"&&l!==void 0&&i.jsx("sup",{className:"rg-grid__sort-order",children:l})]})},fs=e=>i.jsx("tr",{className:"rg-grid__tr rg-grid__skeleton-row","aria-hidden":"true",style:ie?{height:he}:void 0,children:Qe?i.jsx("td",{colSpan:bt,className:"rg-grid__td rg-grid__skeleton-cell",children:p.createElement(Qe,{rowIndex:e,columns:P})}):i.jsxs(i.Fragment,{children:[ce&&i.jsx("td",{className:"rg-grid__td",children:i.jsx("span",{...J("skeleton","rg-grid__skeleton"),style:{...W.skeleton,width:18}})}),P.map((r,l)=>i.jsx("td",{className:"rg-grid__td",style:{textAlign:r.align},children:i.jsx("span",{...J("skeleton","rg-grid__skeleton"),style:{...W.skeleton,width:`${55+(e*7+l*13)%35}%`}})},r.field))]})},`sk${e}`),Or=(e,r,l=U&&!e.sequenceRestartEachPage?te*ee:0)=>(e.sequenceStart??1)+l+r,Ur=(e,r,l)=>{const{row:a,id:d,index:h}=e,y=!!l,C=typeof xn=="function"?xn(a,h):xn,M=typeof bn=="function"?bn(a,h):bn,L=zt.has(d),Q=typeof tt=="function"?tt(a,h):tt,ge=typeof D=="function"?D(a,h):D,Rn=Q||(hr==="none"?void 0:O("rg-grid__row--enter",`rg-row-in--${hr}`)),cn=ge||O("rg-grid__row--exit",Fn!=="none"&&`rg-row-out--${Fn}`);return i.jsxs("tr",{onClick:dt&&!y?()=>dt(a,h):void 0,"aria-hidden":y||void 0,onAnimationEnd:l?I=>I.target===I.currentTarget&&$n(l.id):void 0,"aria-selected":ce?L:void 0,className:O("rg-grid__tr","rg-grid__row",ls&&(r%2===0?"rg-grid__row--stripe-a":"rg-grid__row--stripe-b"),Mn&&!y&&Rn,y&&cn,L&&"rg-grid__row--selected",dt&&"rg-grid__row--clickable",V.row,C),style:{...Mn?{"--rg-i":l?Math.min(l.batch,24):Bo(d)}:null,...ie?{height:he}:null,...W.row,...M},children:[ce&&i.jsx("td",{className:O("rg-grid__td rg-grid__select-cell",rn&&"rg-grid__pinned rg-grid__pinned--left"),style:{width:Ee,minWidth:Ee,maxWidth:Ee,...rn?{left:0}:null},onClick:Xe,children:i.jsx("span",{className:"rg-grid__checkbox-cell",onClickCapture:I=>rr.current=I.shiftKey,children:i.jsx(Je,{variant:Ze,checked:L,disabled:y||!Yt(a),"aria-label":ce==="single"?"Select row":`Select row ${h+1}`,onChange:I=>Io(e,I),classNames:{root:V.checkbox,control:V.checkboxControl,indicator:V.checkboxIndicator},styles:{root:W.checkbox,control:W.checkboxControl,indicator:W.checkboxIndicator}})})}),P.map((I,vt)=>{let X=$o(I,e);if(I.type==="sequence"){const we=Or(I,r);X={...X,value:we,formattedValue:I.valueFormatter?I.valueFormatter(we,a):String(we),editable:!1}}const Pn=typeof I.cellClassName=="function"?I.cellClassName(X):I.cellClassName,Z=typeof I.cellStyle=="function"?I.cellStyle(X):I.cellStyle,me=mt!==null&&mt.id===d&&mt.field===I.field,ne=Xt(I,X),dn=vr(I,vt),un=wn?wn.id===d&&wn.field===I.field:r===0&&vt===0;return i.jsx("td",{ref:y?void 0:we=>{const Ar=Wn(d,I.field);we?Ot.current.set(Ar,we):Ot.current.delete(Ar)},tabIndex:y?void 0:We?un?0:-1:ne?0:void 0,onFocus:We&&!y?we=>we.target===we.currentTarget&&Gn({id:d,field:I.field}):void 0,onDoubleClick:ne&&!y?()=>Jt(e,I):void 0,onKeyDown:y?void 0:we=>Oo(we,e,I,X),className:O("rg-grid__td",ne&&"rg-grid__td--editable",me&&"rg-grid__td--editing",nn(I)&&!me&&`rg-grid__cell--${nn(I)}`,dn.className,V.cell,I.className,Pn),style:{textAlign:I.align,..._r(I),...W.cell,...I.style,...Z,...dn.style},children:me&&mt&&!y?rs(e,I,mt):I.cellRenderer?p.createElement(I.cellRenderer,X):I.type==="boolean"&&!I.cellEditor?es(I,X):X.formattedValue},I.field)})]},y?`ghost:${d}`:d)},hs=Ie.trim()!==""||st.length>0?"no-results":"no-data",ps=Ue??(U?Math.min(ee,20):5),an=(se||ze)&&$===void 0&&!ie,gs=typeof Fe=="number"?`${Fe}px`:Fe,ms=an?{"--rg-sticky-offset":gs,"--rg-sticky-toolbar-h":se?`${qo}px`:"0px"}:null;return i.jsxs("div",{ref:Jn,className:O("rg-grid",ie&&"rg-grid--virtual",an&&"rg-grid--sticky-page",an&&se&&"rg-grid--sticky-toolbar",an&&ze&&"rg-grid--sticky-header",V.root,It),style:{...is,...ss,...ms,...W.root,...yo},"data-rg-theme":G||void 0,"aria-busy":yt||void 0,children:[ds&&i.jsxs("div",{ref:yr,...J("toolbar","rg-grid__toolbar"),children:[i.jsxs("div",{className:"rg-grid__toolbar-left",children:[N&&i.jsx("input",{type:"search",value:pt,onChange:e=>Vn(e.target.value),placeholder:T,"aria-label":"Search all columns",...J("search","rg-grid__search")}),ce&&ve.length>0&&i.jsxs("span",{className:"rg-grid__selected-count",role:"status",children:[ve.length," selected"]})]}),i.jsxs("div",{className:"rg-grid__toolbar-actions",children:[ut,it&&i.jsx(As,{columns:t,hidden:Rt,onToggle:So,theme:G,className:V.toolButton,style:W.toolButton}),Be&&(on.length>1?i.jsx(Vs,{formats:on,scopes:$r,scope:Zo,onScopeChange:Jo,onExport:(e,r)=>Mr(e,{scope:r}),theme:G,className:O(V.toolButton,V.exportMenu),style:{...W.toolButton,...W.exportMenu}}):i.jsx("button",{type:"button",onClick:()=>Mr(on[0]),...J("toolButton","rg-grid__tool-btn"),children:Ys(on[0])}))]})]}),as&&Lr("top"),i.jsx("div",{ref:xt,...J("scroll",O("rg-grid__scroll",`rg-grid__scroll--${Mt}`)),onScroll:ie?e=>Qn({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}):void 0,style:{...W.scroll,...$!==void 0?{maxHeight:$}:ie?{maxHeight:400}:null},children:i.jsxs("table",{...J("table","rg-grid__table"),role:"grid",style:en?{...W.table,tableLayout:"fixed",width:P.reduce((e,r)=>e+tn(r),ce?Ee:0),minWidth:"100%"}:Vo?{...W.table,tableLayout:"fixed",...Ho?{width:P.reduce((e,r)=>e+r.width,ce?Ee:0)}:null}:W.table,children:[i.jsx("thead",{...J("thead","rg-grid__thead"),children:i.jsxs("tr",{...J("headerRow","rg-grid__tr"),children:[ce&&i.jsx("th",{scope:"col",className:O("rg-grid__th rg-grid__select-cell",rn&&"rg-grid__pinned rg-grid__pinned--left",V.headerCell),style:{width:Ee,minWidth:Ee,maxWidth:Ee,...rn?{left:0}:null,...W.headerCell},children:ce==="multiple"&&i.jsx("span",{className:"rg-grid__checkbox-cell",children:i.jsx(Je,{variant:Ze,checked:sr,indeterminate:or>0&&!sr,disabled:_t.length===0,"aria-label":"Select all rows",onChange:lr,classNames:{root:V.checkbox,control:V.checkboxControl,indicator:V.checkboxIndicator},styles:{root:W.checkbox,control:W.checkboxControl,indicator:W.checkboxIndicator}})})}),P.map((e,r)=>{const l=pe.findIndex(C=>C.field===e.field),a=l>=0?pe[l].direction:null,d=Sn(e),h=er(e),y=vr(e,r);return i.jsxs("th",{ref:C=>{C?gt.current.set(e.field,C):gt.current.delete(e.field)},scope:"col","aria-sort":a?a==="asc"?"ascending":"descending":d?"none":void 0,tabIndex:d?0:void 0,onClick:C=>ir(e,C.shiftKey),onKeyDown:C=>{d&&C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),ir(e,C.shiftKey))},className:O("rg-grid__th",d&&"rg-grid__th--sortable",nn(e)&&`rg-grid__cell--${nn(e)}`,y.className,V.headerCell,e.className,e.headerClassName),style:{width:en?tn(e):e.width,minWidth:e.minWidth,maxWidth:en?void 0:e.maxWidth,textAlign:e.align,..._r(e),...W.headerCell,...e.style,...e.headerStyle,...y.style},children:[i.jsxs("span",{className:"rg-grid__th-content",children:[e.headerRenderer?p.createElement(e.headerRenderer,{column:e,sortDirection:a}):e.headerCheckbox&&e.type==="boolean"?ns(e):i.jsx("span",{className:"rg-grid__th-label",children:Ct(e)}),e.filterable&&i.jsx(Us,{column:e,label:Ge(e),kind:h,value:rt[e.field],onChange:C=>{const M={...rt};C===void 0?delete M[e.field]:M[e.field]=C,Hn(M)},options:os.get(e.field)??[],debounce:e.filterDebounce??le,theme:G,indicatorClassName:O(V.filterIndicator,e.filterIndicatorClassName),indicatorStyle:{...W.filterIndicator,...e.filterIndicatorStyle},popupClassName:O(V.filterPopup,e.filterPopupClassName),popupStyle:{...W.filterPopup,...e.filterPopupStyle},inputClassName:V.filterInput,inputStyle:W.filterInput}),d&&us(e,a,a&&pe.length>1?l+1:void 0)]}),e.resizable&&i.jsx("span",{className:"rg-grid__resizer",role:"separator","aria-orientation":"vertical","aria-label":`Resize ${Ge(e)}`,onPointerDown:C=>Xo(C,e),onClick:Xe,onDoubleClick:Xe})]},e.field)})]})}),i.jsx("tbody",{...J("tbody","rg-grid__tbody"),children:yt?Array.from({length:ps},(e,r)=>fs(r)):Cn?i.jsx("tr",{children:i.jsxs("td",{colSpan:bt,...J("empty","rg-grid__empty rg-grid__error"),role:"alert",children:[Dt," ",i.jsx("button",{type:"button",className:"rg-grid__tool-btn",onClick:()=>Kt(At.current),children:"Retry"})]})}):B.length===0&&ke.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:bt,...J("empty",O("rg-grid__empty",ft&&"rg-grid__empty--custom")),children:ft?p.createElement(ft,{reason:hs,search:Ie.trim(),filters:Object.fromEntries(st),columns:P,clearAll:()=>{Vn(""),Hn({})}}):Tt})}):i.jsxs(i.Fragment,{children:[wt&&Qt>0&&i.jsx("tr",{"aria-hidden":"true",className:"rg-grid__spacer",children:i.jsx("td",{colSpan:bt,style:{height:Qt*he}})}),Ko.map(e=>e.kind==="row"?Ur(e.entry,Qt+e.i):Ur(e.ghost.entry,0,e.ghost)),wt&&Tn<B.length&&i.jsx("tr",{"aria-hidden":"true",className:"rg-grid__spacer",children:i.jsx("td",{colSpan:bt,style:{height:(B.length-Tn)*he}})})]})})]})}),cs&&Lr("bottom")]})}exports.Checkbox=Je;exports.DataGrid=bl;exports.SortArrow=mo;
|
|
21
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`,"xl/styles.xml":ul,"xl/worksheets/sheet1.xml":hl(t,n)},m=await ol(Object.entries(c).map(([x,_])=>({name:x,data:xo.encode(_)})));return new Blob([m],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}const Bn=new Set(["__proto__","prototype","constructor"]),bo=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function be(t,n){if(t===null||typeof t!="object")return;if(bo(t,n))return t[n];let o=t;for(const s of n.split(".")){if(o==null||typeof o!="object"||Bn.has(s))return;o=o[s]}return o}function oo(t,n,o){if(Array.isArray(t)){const s=[...t];return s[n]=o,s}return{...t,[n]:o}}function Kn(t,n,o){const s=t??{};if(bo(s,n)||!n.includes("."))return Bn.has(n)?t:oo(s,n,o);const[f,...u]=n.split(".");if(Bn.has(f))return t;const c=s[f];return oo(s,f,Kn(c!==null&&typeof c=="object"?c:{},u.join("."),o))}function so(t,n){if(n.length===0)return t.map((c,m)=>({kind:"row",entry:c,i:m}));const o=new Map;for(const c of n)o.set(c.afterId,[...o.get(c.afterId)??[],c]);const s=[],f=new Set,u=c=>{for(const m of o.get(c)??[])f.has(m.id)||(f.add(m.id),s.push({kind:"ghost",ghost:m}),u(m.id))};return u(null),t.forEach((c,m)=>{s.push({kind:"row",entry:c,i:m}),u(c.id)}),n.forEach(c=>!f.has(c.id)&&s.push({kind:"ghost",ghost:c})),s}const gl=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ee=38,ml=150,lo=10,Wn=(t,n)=>`${typeof t}:${t}\0${n}`;function jt(t,n){const o=be(n,t.field);return t.valueFormatter?t.valueFormatter(o,n):t.type==="boolean"&&typeof o=="boolean"?o?"Yes":"No":t.type==="date"?Ds(o,t.dateLocale,t.dateFormat):o==null?"":o instanceof Date?o.toLocaleDateString():String(o)}function xl(t,n,o){if(o.type==="date"){const s=ue(t)??"",f=ue(n)??"";return s<f?-1:s>f?1:0}return typeof t=="number"&&typeof n=="number"?t-n:t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}const bl=t=>t?Array.isArray(t)?t:[t]:[],io=t=>t.type==="date"&&t.validity.badInput;function yl({columns:t,rows:n,getRowId:o,editable:s=!1,enterMovesDown:f=!0,onCellEdit:u,onRowsChange:c,rowSelection:m=!1,selectedRowIds:x,defaultSelectedRowIds:_,onSelectionChange:F,isRowSelectable:b,sort:S,defaultSort:g=null,onSortChange:k,multiSort:E=!1,searchable:N=!1,searchPlaceholder:T="Search…",search:v,onSearchChange:P,filters:Y,onFiltersChange:K,pagination:U=!1,paginationPosition:z="bottom",showToolbar:ye=!0,showFooter:De=!0,pageSize:Oe=10,pageSizeOptions:Se=[5,10,25,50],page:q,onPageChange:oe,onPageSizeChange:je,serverSide:w=!1,rowCount:H,onQueryChange:j,queryDebounce:A=250,filterDebounce:le=300,loading:fe,loadingRows:Ue,skeletonRow:Ze,errorMessage:Dt="Could not load the data.",columnMenu:it=!1,onColumnVisibilityChange:Ae,keyboardNavigation:We=!1,virtualize:ie=!1,rowHeight:he=40,overscan:at=6,exportable:Be=!1,onExportError:ct,apiRef:Te,onRowClick:dt,toolbar:ut,emptyMessage:Tt="No rows to show",emptyComponent:ft,sortIndicator:Ke="default",sortIndicatorRotate:Ft=!0,striped:Ce=!1,stripeColors:_e,checkboxVariant:Qe="native",animateRows:ht=!0,rowAnimation:ae,rowAnimationDuration:qe,rowAnimationStagger:et,rowAnimationClassName:tt,rowExitAnimationClassName:D,theme:G,maxHeight:$,stickyToolbar:se=!1,stickyHeader:ze=!1,stickyOffset:Fe=0,scrollbar:Mt="thin",className:It,style:yo,classNames:V={},styles:W={},rowClassName:xn,rowStyle:bn}){const J=(e,r)=>({className:O(r,V[e]),style:W[e]}),[$t,zn]=p.useState(n),nt=p.useRef(n);p.useEffect(()=>{nt.current=n,zn(n)},[n]);const Yn=e=>{nt.current=e,zn(e)},[pt,Vn]=St(v,"",P),[rt,Hn]=St(Y,{},K),[pe,_o]=St(S,bl(g),k),[yn,ot]=St(q,0,oe),[ee,wo]=p.useState(Oe),vo=e=>{wo(e),je==null||je(e)},[Rt,ko]=p.useState(()=>new Set(t.filter(e=>e.hidden).map(e=>e.field))),So=(e,r)=>{const l=new Set(Rt);r?l.add(e):l.delete(e),ko(l),Ae==null||Ae([...l])},[_n,Xn]=p.useState({}),[Pt,jo]=p.useState({}),[_l,Co]=p.useState(0),gt=p.useRef(new Map),[mt,Ye]=p.useState(null),Me=p.useRef(0),Lt=p.useRef(null),Ot=p.useRef(new Map),[wn,Gn]=p.useState(null),vn=p.useRef(null),Jn=p.useRef(null),xt=p.useRef(null),[kn,Zn]=p.useState({top:0,height:0}),R=p.useMemo(()=>{const e=t.filter(r=>!Rt.has(r.field)).map(r=>r.type==="sequence"?{...r,sortable:!1,filterable:!1,editable:!1,filterRenderer:void 0}:r);return[...e.filter(r=>r.pinned==="left"),...e.filter(r=>r.pinned!=="left"&&r.pinned!=="right"),...e.filter(r=>r.pinned==="right")]},[t,Rt]),Sn=e=>e.sortable===!0,ce=m==="single"?"single":m?"multiple":null,bt=R.length+(ce?1:0),Ve=p.useMemo(()=>$t.map((e,r)=>({row:e,index:r,id:o?o(e,r):r})),[$t,o]),Qn=p.useRef(new Map);Ve.forEach(e=>Qn.current.set(e.id,e.row));const st=p.useMemo(()=>Object.entries(rt).filter(([e,r])=>{const l=R.find(a=>a.field===e);return!!l&&!!l.filterable&&ho(r)}),[rt,R]),[No,Eo]=p.useState(pt);p.useEffect(()=>{if(!w)return;const e=setTimeout(()=>Eo(pt),A);return()=>clearTimeout(e)},[pt,w,A]);const Ie=w?No:pt,er=e=>e.filterRenderer?"text":zr(e),Ne=p.useMemo(()=>{if(w)return Ve;const e=Ie.trim().toLowerCase();let r=Ve.filter(({row:a})=>e&&!R.some(d=>jt(d,a).toLowerCase().includes(e))?!1:st.every(([d,h])=>{const y=R.find(C=>C.field===d);return Is(er(y),h,jt(y,a),be(a,d))}));const l=pe.map(a=>({col:R.find(d=>d.field===a.field),dir:a.direction==="asc"?1:-1})).filter(a=>!!a.col);return l.length&&(r=[...r].sort((a,d)=>{for(const{col:h,dir:y}of l){const C=be(a.row,h.field),M=be(d.row,h.field),L=C==null||C==="",Z=M==null||M==="";if(L||Z){if(L!==Z)return L?1:-1;continue}const ge=h.comparator?h.comparator(C,M,a.row,d.row):xl(C,M,h);if(ge!==0)return ge*y}return 0})),r},[Ve,R,Ie,st,pe,w]),Ut=JSON.stringify([Ie,rt,pe,ee]),tr=p.useRef(Ut);p.useEffect(()=>{tr.current!==Ut&&(tr.current=Ut,ot(0))},[Ut]);const lt=w?H??Ve.length:Ne.length,$e=U?Math.max(1,Math.ceil(lt/ee)):1,te=Math.min(yn,$e-1),B=U&&!w?Ne.slice(te*ee,te*ee+ee):Ne,Do=lt===0?0:U?te*ee+1:1,To=U?Math.min(lt,(te+1)*ee):lt,jn=p.useMemo(()=>({sort:pe.filter(e=>{const r=t.find(l=>l.field===e.field);return!!r&&Sn(r)}),filters:Object.fromEntries(st),search:Ie.trim(),page:te,pageSize:ee}),[pe,t,st,Ie,te,ee]),Fo=JSON.stringify(jn),At=p.useRef(jn);At.current=jn;const Wt=p.useRef(j);Wt.current=j;const[Mo,Bt]=p.useState(()=>w&&!!j),[Cn,Nn]=p.useState(!1),En=p.useRef(0),Kt=p.useCallback(e=>{var a;const r=++En.current,l=(a=Wt.current)==null?void 0:a.call(Wt,e);l&&typeof l.then=="function"?(Bt(!0),Nn(!1),l.then(()=>{r===En.current&&Bt(!1)},()=>{r===En.current&&(Bt(!1),Nn(!0))})):(Bt(!1),Nn(!1))},[]);p.useEffect(()=>{w&&Kt(At.current)},[w,Fo,Kt]),p.useEffect(()=>{w&&U&&yn>$e-1&&ot($e-1)},[w,U,yn,$e]);const yt=fe??Mo,nr=e=>e.map(r=>Qn.current.get(r)).filter(r=>r!==void 0),[ve,qt]=St(x,_??[],e=>F==null?void 0:F({ids:e,rows:nr(e)})),zt=p.useMemo(()=>new Set(ve),[ve]),Yt=e=>b?b(e):!0,Vt=p.useRef(null),rr=p.useRef(!1),Io=(e,r)=>{if(!ce||!Yt(e.row))return;if(ce==="single"){qt(r?[e.id]:[]),Vt.current=e.id;return}const l=new Set(ve),a=rr.current&&Vt.current!==null?B.findIndex(h=>h.id===Vt.current):-1,d=B.findIndex(h=>h.id===e.id);if(a>=0&&d>=0)for(let h=Math.min(a,d);h<=Math.max(a,d);h++)Yt(B[h].row)&&(r?l.add(B[h].id):l.delete(B[h].id));else r?l.add(e.id):l.delete(e.id);Vt.current=e.id,qt([...l])},_t=p.useMemo(()=>Ne.filter(e=>Yt(e.row)),[Ne,b]),or=_t.filter(e=>zt.has(e.id)).length,sr=_t.length>0&&or===_t.length,lr=e=>{const r=new Set(ve);_t.forEach(l=>e?r.add(l.id):r.delete(l.id)),qt([...r])},Ht=(e,r,l)=>({value:be(r,e.field),formattedValue:jt(e,r),row:r,rowIndex:l,field:e.field,column:e}),Dn=(e,r)=>{const l=e.editable??s;return typeof l=="function"?l(r):!!l},Xt=(e,r)=>Dn(e,r)&&!(e.type==="boolean"&&!e.cellEditor),$o=(e,r)=>{const l=Ht(e,r.row,r.index),a=Dn(e,l);return{...l,editable:a,updateValue:d=>a&&ar(r,e,{value:d})}},ir=(e,r)=>{if(!Sn(e))return;const l=pe.find(h=>h.field===e.field),a=l?l.direction==="asc"?"desc":null:"asc";let d;r&&E?a?l?d=pe.map(h=>h.field===e.field?{...h,direction:a}:h):d=[...pe,{field:e.field,direction:a}]:d=pe.filter(h=>h.field!==e.field):d=a?[{field:e.field,direction:a}]:[],_o(d)},Gt=(e,r)=>{var l;return(l=Ot.current.get(Wn(e,r)))==null?void 0:l.focus()},Re=()=>{Me.current+=1,Ye(null)},Ro=e=>{for(const r of nt.current){const l=be(r,e.field);if(l!=null&&l!=="")return l}},Jt=(e,r,l={})=>{if(!Xt(r,Ht(r,e.row,e.index)))return!1;const a=be(e.row,r.field);let d;return r.cellEditor?d=a:r.type==="date"?d=ue(a)??"":d=l.text??(a==null?"":String(a)),Lt.current=d,Me.current+=1,Ye({id:e.id,field:r.field,draft:d,session:Me.current,select:l.select??"end",invalid:!1}),!0},ar=(e,r,l)=>{const a=nt.current[e.index]??e.row,d=be(a,r.field);let h;if("value"in l)h=l.value;else if(r.valueParser)h=r.valueParser(l.text,a);else if(r.type==="date"){if(l.text!==""&&!re(l.text))return!1;h=Ts(l.text,d??Ro(r))}else if(r.type==="number")if(l.text.trim()==="")h=null;else{const M=Number(l.text);if(!Number.isFinite(M))return!1;h=M}else h=l.text;if(r.type==="date"){if(ue(h)===ue(d))return!0;const M=ue(h);if(M&&(r.dateMin&&M<r.dateMin||r.dateMax&&M>r.dateMax))return!1}else if(Object.is(h,d))return!0;if(r.validate&&!r.validate(h,a))return!1;const y=Kn(a,r.field,h),C=nt.current.map((M,L)=>L===e.index?y:M);return Yn(C),u==null||u({rowId:e.id,rowIndex:e.index,field:r.field,oldValue:d,newValue:h,row:y}),c==null||c(C),!0},cr=(e,r,l)=>{const a=B.findIndex(L=>L.id===e.id),d=R.findIndex(L=>L.field===r);if(a<0||d<0)return null;const h=(L,Z)=>Xt(Z,Ht(Z,L.row,L.index));if(l==="down"||l==="up"){const L=l==="down"?1:-1;for(let Z=a+L;Z>=0&&Z<B.length;Z+=L)if(h(B[Z],R[d]))return{entry:B[Z],col:R[d]};return null}const y=l==="right"?1:-1;let C=a,M=d+y;for(;C>=0&&C<B.length;){for(;M>=0&&M<R.length;){if(h(B[C],R[M]))return{entry:B[C],col:R[M]};M+=y}C+=y,M=y>0?0:R.length-1}return null},He=(e,r,l,a={})=>{const{move:d="none",focus:h=!0}=a;if(!ar(e,r,l))return Ye(C=>C&&{...C,invalid:!0}),!1;const y=d==="none"?null:cr(e,r.field,d);return y?Jt(y.entry,y.col,{select:"all"}):(Re(),h&&Gt(e.id,r.field)),!0},dr=(e,r,l)=>{if(e.nativeEvent.isComposing)return;const a=e.currentTarget.value,d=io(e.currentTarget);if(e.key==="Enter"){if(e.preventDefault(),d)return Ye(y=>y&&{...y,invalid:!0});const h=f?e.shiftKey?"up":"down":"none";He(r,l,{text:a},{move:h})}else if(e.key==="Escape")e.preventDefault(),Re(),Gt(r.id,l.field);else if(e.key==="Tab"&&!d){const h=e.shiftKey?"left":"right";cr(r,l.field,h)&&(e.preventDefault(),He(r,l,{text:a},{move:h}))}},Po=(e,r)=>{var h;const l=B[e],a=R[r];if(!l||!a)return;Gn({id:l.id,field:a.field}),vn.current=Wn(l.id,a.field);const d=xt.current;if(ie&&d){const y=((h=d.querySelector("thead"))==null?void 0:h.clientHeight)??0,C=e*he;C<d.scrollTop?d.scrollTo({top:C,behavior:"auto"}):C+he>d.scrollTop+d.clientHeight-y&&d.scrollTo({top:C+he-d.clientHeight+y,behavior:"auto"})}};p.useEffect(()=>{const e=vn.current;if(!e)return;const r=Ot.current.get(e);r&&(vn.current=null,r.focus())});const Lo=(e,r,l)=>{if(!We)return!1;let a=B.findIndex(h=>h.id===r.id),d=R.findIndex(h=>h.field===l.field);if(a<0||d<0)return!1;switch(e.key){case"ArrowDown":a+=1;break;case"ArrowUp":a-=1;break;case"ArrowRight":d+=1;break;case"ArrowLeft":d-=1;break;case"PageDown":a+=lo;break;case"PageUp":a-=lo;break;case"Home":d=0,(e.ctrlKey||e.metaKey)&&(a=0);break;case"End":d=R.length-1,(e.ctrlKey||e.metaKey)&&(a=B.length-1);break;default:return!1}return e.preventDefault(),Po(Math.max(0,Math.min(B.length-1,a)),Math.max(0,Math.min(R.length-1,d))),!0},Oo=(e,r,l,a)=>{e.target===e.currentTarget&&(Lo(e,r,l)||Xt(l,a)&&(e.key==="Enter"||e.key==="F2"?(e.preventDefault(),Jt(r,l)):!l.cellEditor&&l.type!=="date"&&e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),Jt(r,l,{text:e.key}))))};Nt(()=>{if(!ie||!xt.current)return;const e=xt.current,r=()=>Zn(a=>a.height===e.clientHeight?a:{...a,height:e.clientHeight});if(r(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(r);return l.observe(e),()=>l.disconnect()},[ie]);const wt=ie&&!yt&&B.length>0,Uo=kn.height||(typeof $=="number"?$:400),Zt=wt?Math.max(0,Math.floor(kn.top/he)-at):0,Tn=wt?Math.min(B.length,Math.ceil((kn.top+Uo)/he)+at):B.length,ur=wt?B.slice(Zt,Tn):B,Ao=`${te}|${ee}|${JSON.stringify(pe)}|${Ie}|${JSON.stringify(rt)}`,fr=p.useRef(!0);p.useEffect(()=>{if(fr.current){fr.current=!1;return}const e=xt.current;e&&typeof e.scrollTo=="function"&&e.scrollTop>0&&e.scrollTo({top:0,behavior:"smooth"})},[Ao]);const hr=(typeof ae=="string"?ae:ae==null?void 0:ae.enter)??"slide-up",Fn=(typeof ae=="string"?ae:(ae==null?void 0:ae.exit)??(ae==null?void 0:ae.enter))??"slide-up",Mn=ht&&!ie,pr=Mn&&(Fn!=="none"||!!D),gr=qe??380,mr=et??28,Qt=p.useRef(new Map);let Wo=0;const Bo=e=>{let r=Qt.current.get(e);return r===void 0&&(r=Wo++,Qt.current.set(e,r)),Math.min(r,24)},[ke,xr]=p.useState([]),br=p.useRef({rows:[],order:[],pageKey:""}),Pe=p.useRef(new Map),In=`${te}|${ee}|${w}`,$n=p.useCallback(e=>{const r=Pe.current.get(e);r!==void 0&&clearTimeout(r),Pe.current.delete(e),xr(l=>{const a=l.find(d=>d.id===e);return a?l.filter(d=>d.id!==e).map(d=>d.afterId===e?{...d,afterId:a.afterId}:d):l})},[]);Nt(()=>{const e=br.current,r=new Set(B.map(d=>d.id));Qt.current.forEach((d,h)=>!r.has(h)&&Qt.current.delete(h));const l=!pr||yt||Cn||e.pageKey!==In||gl();let a=ke;if(l)a=[];else{a=a.filter(h=>!r.has(h.id));const d=e.rows.filter(h=>!r.has(h.id)&&!a.some(y=>y.id===h.id));if(d.length>0){const h=d.map((y,C)=>{const M=e.order.indexOf(y.id);return{id:y.id,entry:y,afterId:M>0?e.order[M-1]:null,batch:C}});a=[...a,...h]}}(a.length!==ke.length||a.some((d,h)=>d!==ke[h]))&&xr(a),br.current={rows:B,order:so(B,a).map(d=>d.kind==="row"?d.entry.id:d.ghost.id),pageKey:In}},[B,ke,yt,Cn,In,pr]),p.useEffect(()=>{const e=!!D;ke.forEach(r=>{if(Pe.current.has(r.id))return;const l=e?2500:gr*.8+mr*Math.min(r.batch,24)+250;Pe.current.set(r.id,setTimeout(()=>$n(r.id),l))}),Pe.current.forEach((r,l)=>{ke.some(a=>a.id===l)||(clearTimeout(r),Pe.current.delete(l))})},[ke,gr,mr,D,$n]),p.useEffect(()=>()=>{Pe.current.forEach(e=>clearTimeout(e)),Pe.current.clear()},[]);const Ko=p.useMemo(()=>so(ur,ke),[ur,ke]),yr=p.useRef(null),[qo,zo]=p.useState(0);Nt(()=>{const e=yr.current;if(!e||!se)return;const r=()=>zo(e.offsetHeight);if(r(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(r);return l.observe(e),()=>l.disconnect()},[se]);const en=Object.keys(_n).length>0,tn=e=>_n[e.field]??(typeof e.width=="number"?e.width:ml),Yo=e=>Math.max(40,typeof e.minWidth=="number"?e.minWidth:60),nn=e=>e.overflow??(typeof e.width=="number"&&e.width<40?"clip":e.width!==void 0&&e.width!==""?"wrap":void 0),_r=e=>typeof e.width=="number"&&e.width<40?{paddingLeft:0,paddingRight:0}:null,Vo=R.some(e=>e.width!==void 0&&e.width!==null&&e.width!==""),Ho=R.length>0&&R.every(e=>typeof e.width=="number"),Xo=(e,r)=>{e.preventDefault(),e.stopPropagation();const l={..._n};en||R.forEach(L=>{var Z;return l[L.field]=((Z=gt.current.get(L.field))==null?void 0:Z.offsetWidth)??tn(L)});const a=e.clientX,d=l[r.field]??tn(r),h=e.currentTarget;h.setPointerCapture(e.pointerId),Xn(l);const y=L=>Math.min(r.maxWidth??1/0,Math.max(Yo(r),Math.round(L))),C=L=>Xn(Z=>({...Z,[r.field]:y(d+L.clientX-a)})),M=()=>{h.removeEventListener("pointermove",C),h.removeEventListener("pointerup",M),h.removeEventListener("pointercancel",M)};h.addEventListener("pointermove",C),h.addEventListener("pointerup",M),h.addEventListener("pointercancel",M)};Nt(()=>{var d,h;const e={};let r=ce&&R.some(y=>y.pinned==="left")?Ee:0;for(const y of R)y.pinned==="left"&&(e[y.field]=r,r+=((d=gt.current.get(y.field))==null?void 0:d.offsetWidth)??0);let l=0;for(const y of[...R].reverse())y.pinned==="right"&&(e[y.field]=l,l+=((h=gt.current.get(y.field))==null?void 0:h.offsetWidth)??0);const a=Object.keys(e);(a.length!==Object.keys(Pt).length||a.some(y=>e[y]!==Pt[y]))&&jo(e)}),p.useEffect(()=>{const e=()=>Co(r=>r+1);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const wr=R.map(e=>e.pinned).lastIndexOf("left"),Go=R.findIndex(e=>e.pinned==="right"),rn=wr>=0,vr=(e,r)=>({className:e.pinned?O("rg-grid__pinned",`rg-grid__pinned--${e.pinned}`,r===wr&&"rg-grid__pinned--edge",r===Go&&"rg-grid__pinned--edge"):void 0,style:e.pinned==="left"?{left:Pt[e.field]??0}:e.pinned==="right"?{right:Pt[e.field]??0}:void 0}),Le=typeof Be=="object"?Be:{},on=p.useMemo(()=>{var r;const e=(r=Le.formats)!=null&&r.length?Le.formats:["csv"];return e.filter((l,a)=>e.indexOf(l)===a)},[Be]),sn=(e={})=>{const r={...Le,...e,pdf:{...Le.pdf,...e.pdf}},l=r.scope??"filtered",a=l==="page"||l==="visible",d=a?B:l==="selected"?Ve.filter(ge=>zt.has(ge.id)):Ne,h=r.includeHidden?t:R,y=a&&U?te*ee:0,C=h.map(ge=>Ct(ge)||ge.field),M=[],L=[],Z=[];return d.forEach(({row:ge},Rn)=>{const cn=[],I=[],vt={};h.forEach((X,Pn)=>{const Q=be(ge,X.field);let me,ne;if(X.type==="sequence"){const un=Or(X,Rn,X.sequenceRestartEachPage?0:y);me=un,ne=un}else X.exportValue?(me=X.exportValue(Q,ge),ne=me??null):X.type==="date"?(me=ue(Q)??"",ne=me):(me=jt(X,ge),X.type==="number"&&typeof Q=="number"&&Number.isFinite(Q)||X.type==="boolean"&&typeof Q=="boolean"?ne=Q:X.valueFormatter?ne=me:Q==null?ne=null:typeof Q=="string"||typeof Q=="boolean"||typeof Q=="number"&&Number.isFinite(Q)?ne=Q:Q instanceof Date?ne=Number.isNaN(Q.getTime())?null:Q.toISOString():ne=me);cn.push(me),I.push(ne);const dn=r.jsonKeys==="header"?C[Pn]:X.field;vt[dn]=X.type==="date"&&ne===""?null:ne??null}),M.push(cn),L.push(I),Z.push(vt)}),{opts:r,cols:h,headers:C,display:M,typed:L,records:Z}},ln=(e,r)=>`${e.filename??"export"}.${r}`,kr=(e={})=>{const r=sn(e);return qs(r.headers,r.display,{sanitize:r.opts.sanitize})},Sr=(e={})=>{const r={...Le,...e};zs(kr(e),ln(r,"csv"))},jr=(e={})=>{const r=sn(e);return JSON.stringify(r.records,null,r.opts.jsonIndent??2)},Cr=(e={})=>{const r={...Le,...e};hn(new Blob([jr(e)],{type:"application/json;charset=utf-8"}),ln(r,"json"))},Nr=async(e={})=>{const r=sn(e),l=r.cols.map(a=>({header:Ct(a)||a.field,kind:a.type==="number"||a.type==="sequence"?"number":a.type==="date"?"date":a.type==="boolean"?"boolean":"text",align:a.align??(a.type==="number"||a.type==="sequence"?"right":void 0)}));return pl(l,r.typed,{sheetName:r.opts.sheetName})},Er=async(e={})=>{const r={...Le,...e};hn(await Nr(e),ln(r,"xlsx"))},Dr=async(e={})=>{var l;const r=sn(e);return Qs({headers:r.headers,rows:r.display.map(a=>a.map(d=>d==null?"":String(d))),aligns:r.cols.map(a=>a.align??(a.type==="number"||a.type==="sequence"?"right":void 0)),fields:r.cols.map(a=>a.field)},r.opts.pdf,(l=r.opts.pdf)!=null&&l.matchGridStyle?el(Jn.current):void 0)},Tr=async(e={})=>{const r={...Le,...e};hn(await Dr(e),ln(r,"pdf"))},Fr=async(e,r={})=>e==="csv"?Sr(r):e==="json"?Cr(r):e==="xlsx"?Er(r):Tr(r),Mr=async(e,r={})=>{try{await Fr(e,r)}catch(l){const a=l instanceof Error?l:new Error(String(l));ct?ct(a,e):console.error(`[react-gridix] ${e.toUpperCase()} export failed:`,a)}},[Ir,Jo]=p.useState("visible"),Zo=Ve.filter(e=>zt.has(e.id)).length,$r=[{value:"visible",label:"Visible rows",count:B.length},...U?[{value:"filtered",label:"All matching rows",count:Ne.length}]:[],...ce?[{value:"selected",label:"Selected rows",count:Zo}]:[]],Qo=$r.some(e=>e.value===Ir&&e.count>0)?Ir:"visible";p.useEffect(()=>{Te&&(Te.current={getCsv:kr,exportCsv:Sr,getJson:jr,exportJson:Cr,getXlsx:Nr,exportXlsx:Er,getPdf:Dr,exportPdf:Tr,exportAs:Fr,getSelectedRows:()=>nr(ve),getSelectedRowIds:()=>ve,selectAll:()=>lr(!0),clearSelection:()=>qt([]),refresh:()=>{w&&Kt(At.current)}})}),p.useEffect(()=>()=>{Te&&(Te.current=null)},[Te]);const Rr=e=>{var l,a,d,h,y,C,M,L;const r=e.checkbox??{};return{variant:r.variant??Qe,indicator:r.indicator,className:r.className,style:r.style,classNames:{root:O(V.checkbox,(l=r.classNames)==null?void 0:l.root),control:O(V.checkboxControl,(a=r.classNames)==null?void 0:a.control),indicator:O(V.checkboxIndicator,(d=r.classNames)==null?void 0:d.indicator),label:(h=r.classNames)==null?void 0:h.label},styles:{root:{...W.checkbox,...(y=r.styles)==null?void 0:y.root},control:{...W.checkboxControl,...(C=r.styles)==null?void 0:C.control},indicator:{...W.checkboxIndicator,...(M=r.styles)==null?void 0:M.indicator},label:(L=r.styles)==null?void 0:L.label}}},Xe=e=>e.stopPropagation(),es=(e,r)=>i.jsx("span",{className:"rg-grid__checkbox-cell",onClick:Xe,onDoubleClick:Xe,children:i.jsx(Je,{...Rr(e),checked:!!r.value,disabled:!r.editable,"aria-label":`Toggle ${Ge(e)}`,onChange:l=>r.updateValue(l)})}),Pr=e=>Ne.filter(r=>Dn(e,Ht(e,r.row,r.index))),ts=(e,r)=>{const l=new Map(Pr(e).map(h=>[h.index,h])),a=[],d=nt.current.map((h,y)=>{const C=l.get(y);if(!C)return h;const M=be(h,e.field);if(!!M===r||e.validate&&!e.validate(r,h))return h;const L=Kn(h,e.field,r);return a.push({rowId:C.id,rowIndex:y,field:e.field,oldValue:M,newValue:r,row:L}),L});a.length!==0&&(Yn(d),a.forEach(h=>u==null?void 0:u(h)),c==null||c(d))},ns=e=>{const r=Pr(e),l=r.length>0?r:Ne,a=l.filter(h=>!!be(h.row,e.field)).length,d=l.length>0&&a===l.length;return i.jsx("span",{className:"rg-grid__header-checkbox",onClick:Xe,onDoubleClick:Xe,children:i.jsx(Je,{...Rr(e),checked:d,indeterminate:a>0&&!d,disabled:r.length===0,label:Ct(e)||void 0,"aria-label":`Select all ${Ge(e)}`,onChange:h=>ts(e,h)})})},rs=(e,r,l)=>{if(r.cellEditor)return i.jsx("div",{className:"rg-grid__custom-editor",onBlur:d=>{d.currentTarget.contains(d.relatedTarget)||l.session===Me.current&&(He(e,r,{value:Lt.current},{focus:!1})||Re())},onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),Re(),Gt(e.id,r.field))},children:p.createElement(r.cellEditor,{value:l.draft,row:e.row,rowIndex:e.index,field:r.field,column:r,onChange:d=>{Lt.current=d,Ye(h=>h&&h.session===l.session?{...h,draft:d,invalid:!1}:h)},onCommit:(d,h="none")=>{l.session===Me.current&&He(e,r,{value:d===void 0?Lt.current:d},{move:h})},onCancel:()=>{Re(),Gt(e.id,r.field)}})});const a=r.type==="date";return a?i.jsx(Fs,{value:l.draft===null||l.draft===void 0?"":String(l.draft),label:`Edit ${Ge(r)}`,invalid:l.invalid,min:r.dateMin,max:r.dateMax,locale:r.dateLocale,theme:G,className:O("rg-grid__editor",l.invalid&&"rg-grid__editor--invalid",V.editor),style:{textAlign:r.align,...W.editor},onChange:d=>Ye(h=>h&&{...h,draft:d,invalid:!1}),onPick:d=>{l.session===Me.current&&He(e,r,{text:d},{focus:!0})},onBlur:d=>{l.session===Me.current&&(He(e,r,{text:d.currentTarget.value},{focus:!1})||Re())},onKeyDown:d=>dr(d,e,r)}):i.jsx("input",{autoFocus:!0,type:a?"date":"text",min:a?r.dateMin:void 0,max:a?r.dateMax:void 0,className:O("rg-grid__editor",l.invalid&&"rg-grid__editor--invalid",V.editor),style:{textAlign:r.align,...W.editor},value:l.draft===null||l.draft===void 0?"":String(l.draft),inputMode:r.type==="number"?"decimal":void 0,"aria-label":`Edit ${Ge(r)}`,"aria-invalid":l.invalid||void 0,onChange:d=>{const h=d.target.value;Ye(y=>y&&{...y,draft:h,invalid:!1})},onFocus:d=>{const h=d.currentTarget;a||(l.select==="all"?h.select():h.setSelectionRange(h.value.length,h.value.length))},onBlur:d=>{if(l.session===Me.current){if(io(d.currentTarget))return Re();He(e,r,{text:d.currentTarget.value},{focus:!1})||Re()}},onKeyDown:d=>dr(d,e,r)})},os=p.useMemo(()=>{const e=new Map;for(const r of R)r.filterable&&!r.filterRenderer&&zr(r)==="select"&&e.set(r.field,$s(r,$t,l=>be(l,r.field),l=>jt(r,l)));return e},[R,$t]),ss={...qe!==void 0?{"--rg-row-duration":`${qe}ms`,"--rg-row-exit-duration":`${Math.round(qe*.8)}ms`}:null,...et!==void 0?{"--rg-row-stagger":`${et}ms`}:null},ls=Ce||!!_e,is=_e?{"--rg-stripe-a":_e[0],"--rg-stripe-b":_e[1]}:void 0,as=De&&U&&(z==="top"||z==="both"),cs=De&&U&&(z==="bottom"||z==="both"),ds=ye&&(N||!!ut||it||!!Be),Lr=e=>i.jsxs("div",{className:O("rg-grid__footer",e==="top"&&"rg-grid__footer--top",V.footer),style:W.footer,"data-position":e,children:[i.jsxs("span",{...J("rowCount","rg-grid__count"),children:[lt===0?"0 rows":`${Do}–${To} of ${lt}`,ce&&ve.length>0?` · ${ve.length} selected`:""]}),i.jsxs("div",{...J("pagination","rg-grid__pagination"),children:[i.jsxs("label",{className:"rg-grid__page-size-label",children:["Rows per page",i.jsx("select",{value:ee,onChange:r=>vo(Number(r.target.value)),...J("pageSize","rg-grid__page-size"),children:(Se.includes(ee)?Se:[...Se,ee].sort((r,l)=>r-l)).map(r=>i.jsx("option",{value:r,children:r},r))})]}),i.jsx("button",{type:"button","aria-label":"First page",disabled:te===0,onClick:()=>ot(0),...J("pageButton","rg-grid__page-btn"),children:"«"}),i.jsx("button",{type:"button","aria-label":"Previous page",disabled:te===0,onClick:()=>ot(te-1),...J("pageButton","rg-grid__page-btn"),children:"‹"}),i.jsxs("span",{...J("pageInfo","rg-grid__page-info"),children:["Page ",te+1," of ",$e]}),i.jsx("button",{type:"button","aria-label":"Next page",disabled:te>=$e-1,onClick:()=>ot(te+1),...J("pageButton","rg-grid__page-btn"),children:"›"}),i.jsx("button",{type:"button","aria-label":"Last page",disabled:te>=$e-1,onClick:()=>ot($e-1),...J("pageButton","rg-grid__page-btn"),children:"»"})]})]}),us=(e,r,l)=>{const a=r===null?"default":e.sortIndicator??Ke,d=a!=="default",h=Ft&&a!=="arrow",y=a==="arrow"?i.jsx(mo,{direction:r,priority:l}):a!=="default"?p.createElement(a,{column:e,direction:r,priority:l}):h?r?"▲":"↕":r==="asc"?"▲":r==="desc"?"▼":"↕";return i.jsxs("span",{...J("sortIndicator",O("rg-grid__sort",d&&"rg-grid__sort--custom")),"aria-hidden":"true","data-direction":r??"none",children:[h?i.jsx(tl,{direction:r,children:y}):y,a==="default"&&l!==void 0&&i.jsx("sup",{className:"rg-grid__sort-order",children:l})]})},fs=R.some(e=>e.skeleton),hs=e=>i.jsx("tr",{className:"rg-grid__tr rg-grid__skeleton-row","aria-hidden":"true",style:ie?{height:he}:void 0,children:Ze&&!fs?i.jsx("td",{colSpan:bt,className:"rg-grid__td rg-grid__skeleton-cell",children:p.createElement(Ze,{rowIndex:e,columns:R})}):i.jsxs(i.Fragment,{children:[ce&&i.jsx("td",{className:"rg-grid__td",children:i.jsx("span",{...J("skeleton","rg-grid__skeleton"),style:{...W.skeleton,width:18}})}),R.map((r,l)=>i.jsx("td",{className:"rg-grid__td",style:{textAlign:r.align},children:r.skeleton?p.createElement(r.skeleton,{rowIndex:e,column:r}):i.jsx("span",{...J("skeleton","rg-grid__skeleton"),style:{...W.skeleton,width:`${55+(e*7+l*13)%35}%`}})},r.field))]})},`sk${e}`),Or=(e,r,l=U&&!e.sequenceRestartEachPage?te*ee:0)=>(e.sequenceStart??1)+l+r,Ur=(e,r,l)=>{const{row:a,id:d,index:h}=e,y=!!l,C=typeof xn=="function"?xn(a,h):xn,M=typeof bn=="function"?bn(a,h):bn,L=zt.has(d),Z=typeof tt=="function"?tt(a,h):tt,ge=typeof D=="function"?D(a,h):D,Rn=Z||(hr==="none"?void 0:O("rg-grid__row--enter",`rg-row-in--${hr}`)),cn=ge||O("rg-grid__row--exit",Fn!=="none"&&`rg-row-out--${Fn}`);return i.jsxs("tr",{onClick:dt&&!y?()=>dt(a,h):void 0,"aria-hidden":y||void 0,onAnimationEnd:l?I=>I.target===I.currentTarget&&$n(l.id):void 0,"aria-selected":ce?L:void 0,className:O("rg-grid__tr","rg-grid__row",ls&&(r%2===0?"rg-grid__row--stripe-a":"rg-grid__row--stripe-b"),Mn&&!y&&Rn,y&&cn,L&&"rg-grid__row--selected",dt&&"rg-grid__row--clickable",V.row,C),style:{...Mn?{"--rg-i":l?Math.min(l.batch,24):Bo(d)}:null,...ie?{height:he}:null,...W.row,...M},children:[ce&&i.jsx("td",{className:O("rg-grid__td rg-grid__select-cell",rn&&"rg-grid__pinned rg-grid__pinned--left"),style:{width:Ee,minWidth:Ee,maxWidth:Ee,...rn?{left:0}:null},onClick:Xe,children:i.jsx("span",{className:"rg-grid__checkbox-cell",onClickCapture:I=>rr.current=I.shiftKey,children:i.jsx(Je,{variant:Qe,checked:L,disabled:y||!Yt(a),"aria-label":ce==="single"?"Select row":`Select row ${h+1}`,onChange:I=>Io(e,I),classNames:{root:V.checkbox,control:V.checkboxControl,indicator:V.checkboxIndicator},styles:{root:W.checkbox,control:W.checkboxControl,indicator:W.checkboxIndicator}})})}),R.map((I,vt)=>{let X=$o(I,e);if(I.type==="sequence"){const we=Or(I,r);X={...X,value:we,formattedValue:I.valueFormatter?I.valueFormatter(we,a):String(we),editable:!1}}const Pn=typeof I.cellClassName=="function"?I.cellClassName(X):I.cellClassName,Q=typeof I.cellStyle=="function"?I.cellStyle(X):I.cellStyle,me=mt!==null&&mt.id===d&&mt.field===I.field,ne=Xt(I,X),dn=vr(I,vt),un=wn?wn.id===d&&wn.field===I.field:r===0&&vt===0;return i.jsx("td",{ref:y?void 0:we=>{const Ar=Wn(d,I.field);we?Ot.current.set(Ar,we):Ot.current.delete(Ar)},tabIndex:y?void 0:We?un?0:-1:ne?0:void 0,onFocus:We&&!y?we=>we.target===we.currentTarget&&Gn({id:d,field:I.field}):void 0,onDoubleClick:ne&&!y?()=>Jt(e,I):void 0,onKeyDown:y?void 0:we=>Oo(we,e,I,X),className:O("rg-grid__td",ne&&"rg-grid__td--editable",me&&"rg-grid__td--editing",nn(I)&&!me&&`rg-grid__cell--${nn(I)}`,dn.className,V.cell,I.className,Pn),style:{textAlign:I.align,..._r(I),...W.cell,...I.style,...Q,...dn.style},children:me&&mt&&!y?rs(e,I,mt):I.cellRenderer?p.createElement(I.cellRenderer,X):I.type==="boolean"&&!I.cellEditor?es(I,X):X.formattedValue},I.field)})]},y?`ghost:${d}`:d)},ps=Ie.trim()!==""||st.length>0?"no-results":"no-data",gs=Ue??(U?Math.min(ee,20):5),an=(se||ze)&&$===void 0&&!ie,ms=typeof Fe=="number"?`${Fe}px`:Fe,xs=an?{"--rg-sticky-offset":ms,"--rg-sticky-toolbar-h":se?`${qo}px`:"0px"}:null;return i.jsxs("div",{ref:Jn,className:O("rg-grid",ie&&"rg-grid--virtual",an&&"rg-grid--sticky-page",an&&se&&"rg-grid--sticky-toolbar",an&&ze&&"rg-grid--sticky-header",V.root,It),style:{...is,...ss,...xs,...W.root,...yo},"data-rg-theme":G||void 0,"aria-busy":yt||void 0,children:[ds&&i.jsxs("div",{ref:yr,...J("toolbar","rg-grid__toolbar"),children:[i.jsxs("div",{className:"rg-grid__toolbar-left",children:[N&&i.jsx("input",{type:"search",value:pt,onChange:e=>Vn(e.target.value),placeholder:T,"aria-label":"Search all columns",...J("search","rg-grid__search")}),ce&&ve.length>0&&i.jsxs("span",{className:"rg-grid__selected-count",role:"status",children:[ve.length," selected"]})]}),i.jsxs("div",{className:"rg-grid__toolbar-actions",children:[ut,it&&i.jsx(Ws,{columns:t,hidden:Rt,onToggle:So,theme:G,className:V.toolButton,style:W.toolButton}),Be&&(on.length>1?i.jsx(Hs,{formats:on,scopes:$r,scope:Qo,onScopeChange:Jo,onExport:(e,r)=>Mr(e,{scope:r}),theme:G,className:O(V.toolButton,V.exportMenu),style:{...W.toolButton,...W.exportMenu}}):i.jsx("button",{type:"button",onClick:()=>Mr(on[0]),...J("toolButton","rg-grid__tool-btn"),children:Vs(on[0])}))]})]}),as&&Lr("top"),i.jsx("div",{ref:xt,...J("scroll",O("rg-grid__scroll",`rg-grid__scroll--${Mt}`)),onScroll:ie?e=>Zn({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}):void 0,style:{...W.scroll,...$!==void 0?{maxHeight:$}:ie?{maxHeight:400}:null},children:i.jsxs("table",{...J("table","rg-grid__table"),role:"grid",style:en?{...W.table,tableLayout:"fixed",width:R.reduce((e,r)=>e+tn(r),ce?Ee:0),minWidth:"100%"}:Vo?{...W.table,tableLayout:"fixed",...Ho?{width:R.reduce((e,r)=>e+r.width,ce?Ee:0)}:null}:W.table,children:[i.jsx("thead",{...J("thead","rg-grid__thead"),children:i.jsxs("tr",{...J("headerRow","rg-grid__tr"),children:[ce&&i.jsx("th",{scope:"col",className:O("rg-grid__th rg-grid__select-cell",rn&&"rg-grid__pinned rg-grid__pinned--left",V.headerCell),style:{width:Ee,minWidth:Ee,maxWidth:Ee,...rn?{left:0}:null,...W.headerCell},children:ce==="multiple"&&i.jsx("span",{className:"rg-grid__checkbox-cell",children:i.jsx(Je,{variant:Qe,checked:sr,indeterminate:or>0&&!sr,disabled:_t.length===0,"aria-label":"Select all rows",onChange:lr,classNames:{root:V.checkbox,control:V.checkboxControl,indicator:V.checkboxIndicator},styles:{root:W.checkbox,control:W.checkboxControl,indicator:W.checkboxIndicator}})})}),R.map((e,r)=>{const l=pe.findIndex(C=>C.field===e.field),a=l>=0?pe[l].direction:null,d=Sn(e),h=er(e),y=vr(e,r);return i.jsxs("th",{ref:C=>{C?gt.current.set(e.field,C):gt.current.delete(e.field)},scope:"col","aria-sort":a?a==="asc"?"ascending":"descending":d?"none":void 0,tabIndex:d?0:void 0,onClick:C=>ir(e,C.shiftKey),onKeyDown:C=>{d&&C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),ir(e,C.shiftKey))},className:O("rg-grid__th",d&&"rg-grid__th--sortable",nn(e)&&`rg-grid__cell--${nn(e)}`,y.className,V.headerCell,e.className,e.headerClassName),style:{width:en?tn(e):e.width,minWidth:e.minWidth,maxWidth:en?void 0:e.maxWidth,textAlign:e.align,..._r(e),...W.headerCell,...e.style,...e.headerStyle,...y.style},children:[i.jsxs("span",{className:"rg-grid__th-content",children:[e.headerRenderer?p.createElement(e.headerRenderer,{column:e,sortDirection:a}):e.headerCheckbox&&e.type==="boolean"?ns(e):i.jsx("span",{className:"rg-grid__th-label",children:Ct(e)}),e.filterable&&i.jsx(As,{column:e,label:Ge(e),kind:h,value:rt[e.field],onChange:C=>{const M={...rt};C===void 0?delete M[e.field]:M[e.field]=C,Hn(M)},options:os.get(e.field)??[],debounce:e.filterDebounce??le,theme:G,indicatorClassName:O(V.filterIndicator,e.filterIndicatorClassName),indicatorStyle:{...W.filterIndicator,...e.filterIndicatorStyle},popupClassName:O(V.filterPopup,e.filterPopupClassName),popupStyle:{...W.filterPopup,...e.filterPopupStyle},inputClassName:V.filterInput,inputStyle:W.filterInput}),d&&us(e,a,a&&pe.length>1?l+1:void 0)]}),e.resizable&&i.jsx("span",{className:"rg-grid__resizer",role:"separator","aria-orientation":"vertical","aria-label":`Resize ${Ge(e)}`,onPointerDown:C=>Xo(C,e),onClick:Xe,onDoubleClick:Xe})]},e.field)})]})}),i.jsx("tbody",{...J("tbody","rg-grid__tbody"),children:yt?Array.from({length:gs},(e,r)=>hs(r)):Cn?i.jsx("tr",{children:i.jsxs("td",{colSpan:bt,...J("empty","rg-grid__empty rg-grid__error"),role:"alert",children:[Dt," ",i.jsx("button",{type:"button",className:"rg-grid__tool-btn",onClick:()=>Kt(At.current),children:"Retry"})]})}):B.length===0&&ke.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:bt,...J("empty",O("rg-grid__empty",ft&&"rg-grid__empty--custom")),children:ft?p.createElement(ft,{reason:ps,search:Ie.trim(),filters:Object.fromEntries(st),columns:R,clearAll:()=>{Vn(""),Hn({})}}):Tt})}):i.jsxs(i.Fragment,{children:[wt&&Zt>0&&i.jsx("tr",{"aria-hidden":"true",className:"rg-grid__spacer",children:i.jsx("td",{colSpan:bt,style:{height:Zt*he}})}),Ko.map(e=>e.kind==="row"?Ur(e.entry,Zt+e.i):Ur(e.ghost.entry,0,e.ghost)),wt&&Tn<B.length&&i.jsx("tr",{"aria-hidden":"true",className:"rg-grid__spacer",children:i.jsx("td",{colSpan:bt,style:{height:(B.length-Tn)*he}})})]})})]})}),cs&&Lr("bottom")]})}exports.Checkbox=Je;exports.DataGrid=yl;exports.SortArrow=mo;
|