mantine-datatable 8.1.2 → 8.2.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/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";import{Box as Gr,Table as Xr}from"@mantine/core";import{useDebouncedCallback as Qr,useMergedRef as Wo}from"@mantine/hooks";import Ao from"clsx";import{useCallback as ke,useMemo as Ur,useState as Ke}from"react";import{useState as kt}from"react";import{createSafeContext as Ua}from"@mantine/core";var[Rt,ce]=Ua("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as $a}from"react/jsx-runtime";var at=e=>{let{children:t,columnsOrder:o,setColumnsOrder:a,columnsToggle:n,setColumnsToggle:r,resetColumnsOrder:l,resetColumnsToggle:i,setColumnWidth:s,resetColumnsWidth:d}=e,[p,b]=kt(""),[f,T]=kt("");return $a(Rt,{value:{sourceColumn:p,setSourceColumn:b,targetColumn:f,setTargetColumn:T,columnsToggle:n,setColumnsToggle:r,swapColumns:()=>{if(!o||!a||!p||!f)return;let v=o.indexOf(p),D=o.indexOf(f);if(v!==-1&&D!==-1){let P=o.splice(v,1)[0];o.splice(D,0,P),a([...o])}},resetColumnsOrder:l,resetColumnsToggle:i,setColumnWidth:s,resetColumnsWidth:d},children:t})};import{jsx as Et}from"react/jsx-runtime";function Nt(){return Et("tr",{className:"mantine-datatable-empty-row",children:Et("td",{})})}import{Center as Ja,Text as Za}from"@mantine/core";import{jsx as xe,jsxs as Ka}from"react/jsx-runtime";function Lt(){return Ka("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[xe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),xe("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),xe("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),xe("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),xe("path",{d:"M3 3l18 18"})]})}import{Fragment as Ya,jsx as Oe,jsxs as qa}from"react/jsx-runtime";function Ht({icon:e,text:t,pt:o,pb:a,active:n,children:r}){return Oe(Ja,{pt:o,pb:a,className:"mantine-datatable-empty-state","data-active":n||void 0,children:r||qa(Ya,{children:[e||Oe("div",{className:"mantine-datatable-empty-state-icon",children:Oe(Lt,{})}),Oe(Za,{component:"div",size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as yn,TableTr as wn,rem as Pn}from"@mantine/core";import Sn from"clsx";import{TableTh as Tn}from"@mantine/core";import gn from"clsx";import{useLocalStorage as nt}from"@mantine/hooks";import{useMemo as ja}from"react";var It=({key:e,columns:t=[],getInitialValueInEffect:o=!0})=>{function a(u,y){let c=[];return u.forEach(m=>{y.find(h=>h.accessor===m)&&c.push(m)}),y.forEach(m=>{c.includes(m.accessor)||c.push(m.accessor)}),c}function n(u,y){let c=[];return u.forEach(m=>{y.find(h=>h.accessor===m.accessor)&&c.push(m)}),y.forEach(m=>{c.find(h=>h.accessor===m.accessor)||c.push({accessor:m.accessor,defaultToggle:m.defaultToggle||!0,toggleable:m.toggleable,toggled:m.defaultToggle===void 0?!0:m.defaultToggle})}),c}function r(u,y){let c=[];return u.forEach(m=>{let h=Object.keys(m)[0];y.find(w=>w.accessor===h)&&c.push(m)}),y.forEach(m=>{let h=m.accessor;if(!c.find(w=>Object.keys(w)[0]===h)){let w={};w[h]="",c.push(w)}}),c}function l(){let[u,y]=nt({key:e?`${e}-columns-order`:"",defaultValue:e?d:void 0,getInitialValueInEffect:o});function c(w){e&&y(w)}if(!e)return[u,c];let m=a(u,t),h=JSON.stringify(u);return JSON.stringify(m)!==h&&c(m),[m,c]}function i(){let[u,y]=nt({key:e?`${e}-columns-toggle`:"",defaultValue:e?b:void 0,getInitialValueInEffect:o});function c(w){e&&y(w)}if(!e)return[u,c];let m=n(u,t),h=JSON.stringify(u);return JSON.stringify(m)!==h&&c(m),[n(u,t),c]}function s(){let[u,y]=nt({key:e?`${e}-columns-width`:"",defaultValue:e?p:void 0,getInitialValueInEffect:o});function c(w){e&&y(w)}if(!e)return[u,c];let m=r(u,t),h=JSON.stringify(u);return JSON.stringify(m)!==h&&c(m),[r(u,t),c]}let d=t&&t.map(u=>u.accessor)||[],p=t&&t.map(u=>({[u.accessor]:u.width??"initial"}))||[],b=t&&t.map(u=>({accessor:u.accessor,defaultToggle:u.defaultToggle||!0,toggleable:u.toggleable,toggled:u.defaultToggle===void 0?!0:u.defaultToggle})),[f,T]=l(),[g,v]=i(),[D,P]=s(),R=()=>T(d),S=()=>{v(b)},x=()=>P(p);return{effectiveColumns:ja(()=>f?f.map(c=>t.find(m=>m.accessor===c)).map(c=>({...c,hidden:c?.hidden||!g.find(m=>m.accessor===c?.accessor)?.toggled})).map(c=>({...c,width:D.find(m=>m[c?.accessor])?.[c?.accessor]})):t,[t,f,g,D]),setColumnsOrder:T,columnsOrder:f,resetColumnsOrder:R,columnsToggle:g,setColumnsToggle:v,resetColumnsToggle:S,columnsWidth:D,setColumnsWidth:P,setColumnWidth:(u,y)=>{let c=D.map(m=>m[u]?{[u]:y}:m);P(c)},resetColumnsWidth:x}};import{useResizeObserver as en}from"@mantine/hooks";function re(){let[e]=en(),{width:t,height:o}=e.current?.getBoundingClientRect()||{width:0,height:0};return{ref:e,width:t,height:o}}import{useEffect as tn,useLayoutEffect as on}from"react";var Ot=typeof window<"u"?on:tn;import{useEffect as an,useState as nn}from"react";function Wt(e){let[t,o]=nn(null),a=e?.join(":")||"";return an(()=>{o(null)},[a]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}import{useEffect as rn,useRef as ln,useState as sn}from"react";function dn(e,t){let o=()=>{t(e.map(n=>n.matches))},a=e.map(n=>{try{return n.addEventListener("change",o),()=>n.removeEventListener("change",o)}catch{return n.addListener(o),()=>n.removeListener(o)}});return()=>{a.forEach(n=>n())}}function cn(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function At(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[a,n]=sn(o?t:cn(e,t)),r=ln(null);return rn(()=>{if("matchMedia"in window)return r.current=e.map(l=>window.matchMedia(l)),n(r.current.map(l=>l.matches)),dn(r.current,l=>{n(l)})},[e]),a}import{useMantineTheme as un}from"@mantine/core";import{useMemo as zt}from"react";function Vt(e){let t=un(),o=zt(()=>e.map(n=>(typeof n=="function"?n(t):n)??""),[e,t]),a=zt(()=>e.map(()=>!0),[e]);return At(o,a)}import{useMantineTheme as mn}from"@mantine/core";import{useMediaQuery as pn}from"@mantine/hooks";function K(e){let t=mn(),o=typeof e=="function"?e(t):e;return pn(o||"",!0)}import{useState as fn}from"react";function ue(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function _t(e,t,o){return e.filter(a=>!t.map(o).includes(o(a)))}function We(e,t){return e.filter((o,a,n)=>a===n.findIndex(r=>t(o)===t(r)))}function rt(e,t){return t?t.match(/([^[.\]])+/g).reduce((a,n)=>a&&a[n],e):void 0}function E(e,t){return typeof t=="string"?rt(e,t):t(e)}function Ll(e,t){let o=structuredClone(t),a=o[e.source.index];return e.destination&&(o.splice(e.source.index,1),o.splice(e.destination.index,0,a)),o}function Hl(e,t){let o=structuredClone(t),a=e.destination;if(!a)return o;let n=o[e.source.index],r=o[a.index];return o.splice(a.index,1,n),o.splice(e.source.index,1,r),o}function Ft({rowExpansion:e,records:t,idAccessor:o}){let a=[];if(e&&t){let{trigger:i,allowMultiple:s,initiallyExpanded:d}=e;t&&i==="always"?a=t.map(p=>E(p,o)):d&&(a=t.filter((p,b)=>d({record:p,index:b})).map(p=>E(p,o)),s||(a=[a[0]]))}let n,r,l=fn(a);if(e){let{expandable:i,trigger:s,allowMultiple:d,collapseProps:p,content:b}=e;e.expanded?{recordIds:n,onRecordIdsChange:r}=e.expanded:[n,r]=l;let f=T=>r?.(n.filter(g=>g!==E(T,o)));return{expandOnClick:s!=="always"&&s!=="never",isRowExpanded:T=>s==="always"?!0:n.includes(E(T,o)),isExpandable:({record:T,index:g})=>i?i({record:T,index:g}):!0,expandRow:T=>{let g=E(T,o);r?.(d?[...n,g]:[g])},collapseRow:f,collapseProps:p,content:({record:T,index:g})=>()=>b({record:T,index:g,collapse:()=>f(T)})}}}import{useTimeout as Bt}from"@mantine/hooks";import{useEffect as bn,useState as Gt}from"react";function Xt(e,t){let[o,a]=Gt(e),[n,r]=Gt(e),l=Bt(()=>a(!0),0),i=Bt(()=>r(!1),t||200);return bn(()=>{e?(i.clear(),r(!0),l.start()):(l.clear(),a(!1),i.start())},[l,i,e]),{expanded:o,visible:n}}var me="mantine-datatable-nowrap",pe="mantine-datatable-ellipsis",B="mantine-datatable-pointer-cursor",Ae="mantine-datatable-context-menu-cursor",Qt="mantine-datatable-text-selection-disabled",J="mantine-datatable-text-align-left",Z="mantine-datatable-text-align-center",Y="mantine-datatable-text-align-right";import{jsx as hn}from"react/jsx-runtime";function Ut({className:e,style:t,visibleMediaQuery:o,title:a,noWrap:n,ellipsis:r,textAlign:l,width:i}){return K(o)?hn(Tn,{className:gn({[me]:n||r,[pe]:r,[J]:l==="left",[Z]:l==="center",[Y]:l==="right"},e),style:[{width:i,minWidth:i,maxWidth:i},t],children:a}):null}import{TableTh as Cn}from"@mantine/core";import{jsx as Dn}from"react/jsx-runtime";function $t({shadowVisible:e}){return Dn(Cn,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as lt,jsxs as vn}from"react/jsx-runtime";function Kt({className:e,style:t,columns:o,defaultColumnProps:a,selectionVisible:n,selectorCellShadowVisible:r,scrollDiff:l,ref:i}){let s=l<0;return lt(yn,{ref:i,className:Sn("mantine-datatable-footer",e),style:[{position:s?"relative":"sticky",bottom:Pn(s?l:0)},t],children:vn(wn,{children:[n&&lt($t,{shadowVisible:r}),o.map(({hidden:d,...p})=>{if(d)return null;let{accessor:b,visibleMediaQuery:f,textAlign:T,width:g,footer:v,footerClassName:D,footerStyle:P,noWrap:R,ellipsis:S}={...a,...p};return lt(Ut,{className:D,style:P,visibleMediaQuery:f,textAlign:T,width:g,title:v,noWrap:R,ellipsis:S},b)})]})})}import{Checkbox as or,Group as ar,Popover as nr,PopoverDropdown as rr,PopoverTarget as lr,Stack as ir,TableThead as sr,TableTr as mo}from"@mantine/core";import dr from"clsx";import{useState as cr}from"react";import{TableTh as xn}from"@mantine/core";import Mn from"clsx";import{useMemo as Jt}from"react";import{jsx as Rn}from"react/jsx-runtime";function Zt({group:{id:e,columns:t,title:o,textAlign:a,className:n,style:r}}){let l=Jt(()=>t.map(({visibleMediaQuery:d})=>d),[t]),i=Vt(l),s=Jt(()=>t.filter(({hidden:d},p)=>!d&&i?.[p]).length,[t,i]);return s>0?Rn(xn,{colSpan:s,className:Mn("mantine-datatable-column-group-header-cell",{[J]:a==="left",[Z]:a==="center",[Y]:a==="right"},n),style:r,children:o??ue(e)}):null}import{ActionIcon as io,Box as Un,Center as Fe,Flex as $n,Group as Kn,TableTh as Jn}from"@mantine/core";import Be from"clsx";import{useRef as Zn,useState as Yn}from"react";import{ActionIcon as Nn,Popover as Ln,PopoverDropdown as Hn,PopoverTarget as In}from"@mantine/core";import{useClickOutside as On,useDisclosure as Wn}from"@mantine/hooks";import{jsx as Yt,jsxs as kn}from"react/jsx-runtime";function qt(){return kn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Yt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Yt("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"})]})}import{jsx as jt,jsxs as En}from"react/jsx-runtime";function eo(){return En("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[jt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),jt("path",{d:"M20 3h-16a1 1 0 0 0 -1 1v2.227l.008 .223a3 3 0 0 0 .772 1.795l4.22 4.641v8.114a1 1 0 0 0 1.316 .949l6 -2l.108 -.043a1 1 0 0 0 .576 -.906v-6.586l4.121 -4.12a3 3 0 0 0 .879 -2.123v-2.171a1 1 0 0 0 -1 -1z",strokeWidth:"0",fill:"currentColor"})]})}import{jsx as ze,jsxs as An}from"react/jsx-runtime";function to({children:e,isActive:t,filterPopoverProps:o,filterPopoverDisableClickOutside:a}){let[n,{close:r,toggle:l}]=Wn(!1),i=t?eo:qt,s=On(r);return a&&(s=void 0),An(Ln,{withArrow:!0,shadow:"md",opened:n,onClose:r,trapFocus:!0,...o,children:[ze(In,{children:ze(Nn,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:d=>{d.preventDefault(),l()},onKeyDown:d=>d.stopPropagation(),children:ze(i,{})})}),ze(Hn,{ref:s,onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),children:typeof e=="function"?e({close:r}):e})]})}import{rem as zn}from"@mantine/core";import{useRef as Vn,useState as _n}from"react";import{jsx as Fn}from"react/jsx-runtime";var oo=e=>{let{accessor:t,columnRef:o}=e,a=Vn(null),[n,r]=_n(0),{setColumnWidth:l}=ce(),i=b=>{b.preventDefault(),b.stopPropagation(),document.addEventListener("mousemove",s),document.addEventListener("mouseup",d),document.body.style.cursor="col-resize"},s=b=>{if(!o.current)return;let f=b.clientX-o.current.getBoundingClientRect().right,g=`${o.current.getBoundingClientRect().width+f}px`;o.current.style.width=g,l(t,o.current.style.width),r(-f)},d=()=>{o.current&&(document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",d),document.body.style.cursor="initial",l(t,o.current.style.width),r(0))};return Fn("div",{ref:a,onClick:b=>b.stopPropagation(),onMouseDown:i,onDoubleClick:()=>{o.current&&(o.current.style.maxWidth="initial",o.current.style.minWidth="initial",o.current.style.width="initial",l(t,"initial"))},className:"mantine-datatable-header-resizable-handle",style:{right:zn(n)}})};import{jsx as Ve,jsxs as Bn}from"react/jsx-runtime";function ao(){return Bn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ve("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ve("path",{d:"M12 5l0 14"}),Ve("path",{d:"M16 9l-4 -4"}),Ve("path",{d:"M8 9l4 -4"})]})}import{jsx as _e,jsxs as Gn}from"react/jsx-runtime";function no(){return Gn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[_e("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_e("path",{d:"M8 7l4 -4l4 4"}),_e("path",{d:"M8 17l4 4l4 -4"}),_e("path",{d:"M12 3l0 18"})]})}import{jsx as le,jsxs as Xn}from"react/jsx-runtime";function ro(){return Xn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[le("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),le("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as it,jsxs as Qn}from"react/jsx-runtime";function lo(){return Qn("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[it("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),it("path",{d:"M18 6l-12 12"}),it("path",{d:"M6 6l12 12"})]})}import{Fragment as qn,jsx as N,jsxs as st}from"react/jsx-runtime";function so({className:e,style:t,accessor:o,visibleMediaQuery:a,title:n,sortable:r,draggable:l,toggleable:i,resizable:s,sortIcons:d,textAlign:p,width:b,sortStatus:f,onSortStatusChange:T,filter:g,filterPopoverProps:v,filterPopoverDisableClickOutside:D,filtering:P,sortKey:R}){let{setSourceColumn:S,setTargetColumn:x,swapColumns:O,setColumnsToggle:W}=ce(),[u,y]=Yn(!1),c=Zn(null);if(!K(a))return null;let m=n??ue(o),h=typeof m=="string"?m:void 0,w=r&&T?k=>{k?.defaultPrevented||T({sortKey:R,columnAccessor:o,direction:f?.columnAccessor===o?f.direction==="asc"?"desc":"asc":f?.direction??"asc"})}:void 0,L=k=>{k.stopPropagation(),S(o),y(!1)},V=k=>{k.preventDefault(),x(o),y(!0)},_=()=>{x(o),y(!1),O()},U=()=>{y(!0)},F=()=>{y(!1)},G=k=>{k.stopPropagation(),W(j=>j.map(X=>X.accessor===o?{...X,toggled:!1}:X))};return st(Jn,{className:Be({"mantine-datatable-header-cell-sortable":r,"mantine-datatable-header-cell-toggleable":i,"mantine-datatable-header-cell-resizable":s},e),style:[{width:b,...s?{minWidth:"1px"}:{minWidth:b,maxWidth:b}},t],role:r?"button":void 0,tabIndex:r?0:void 0,onClick:w,onKeyDown:k=>k.key==="Enter"&&w?.(),ref:c,children:[st(Kn,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[st($n,{align:"center",w:"100%",className:Be({"mantine-datatable-header-cell-draggable":l,"mantine-datatable-header-cell-drag-over":u}),draggable:l,onDragStart:l?L:void 0,onDragEnter:l?U:void 0,onDragOver:l?V:void 0,onDrop:l?_:void 0,onDragLeave:l?F:void 0,children:[l?N(Fe,{role:"img","aria-label":"Drag column",children:N(io,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:k=>{k.stopPropagation()},children:N(ro,{})})}):null,N(Un,{className:Be("mantine-datatable-header-cell-sortable-text",{[J]:p==="left",[Z]:p==="center",[Y]:p==="right"},me,pe),title:h,children:m})]}),i?N(Fe,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:N(io,{size:"xs",variant:"light",onClick:G,children:N(lo,{})})}):null,r||f?.columnAccessor===o?N(qn,{children:f?.columnAccessor===o?N(Fe,{className:Be("mantine-datatable-header-cell-sortable-icon",{"mantine-datatable-header-cell-sortable-icon-reversed":f.direction==="desc"}),role:"img","aria-label":`Sorted ${f.direction==="desc"?"descending":"ascending"}`,children:d?.sorted||N(ao,{})}):N(Fe,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:d?.unsorted||N(no,{})})}):null,g?N(to,{filterPopoverProps:v,isActive:!!P,filterPopoverDisableClickOutside:D,children:g}):null]}),s?N(oo,{accessor:o,columnRef:c}):null]})}import{Checkbox as jn,TableTh as er}from"@mantine/core";import tr from"clsx";import{jsx as co}from"react/jsx-runtime";function uo({className:e,style:t,trigger:o,shadowVisible:a,checked:n,indeterminate:r,checkboxProps:l,onChange:i,rowSpan:s,ref:d}){let p=!l.disabled;return co(er,{ref:d,className:tr("mantine-datatable-header-selector-cell",{[B]:o==="cell"&&p},e),style:t,rowSpan:s,"data-shadow-visible":a||void 0,onClick:o==="cell"&&p?i:void 0,children:co(jn,{classNames:p?{input:B}:void 0,checked:n,indeterminate:r,onChange:i,...l,disabled:!(i||l.onChange)||l.disabled})})}import{jsx as q,jsxs as Ge}from"react/jsx-runtime";function po({selectionColumnHeaderRef:e,className:t,style:o,sortStatus:a,sortIcons:n,onSortStatusChange:r,columns:l,defaultColumnProps:i,groups:s,selectionTrigger:d,selectionVisible:p,selectionChecked:b,selectionIndeterminate:f,onSelectionChange:T,selectionCheckboxProps:g,selectorCellShadowVisible:v,selectionColumnClassName:D,selectionColumnStyle:P,ref:R}){let S=p?q(uo,{ref:e,className:D,style:P,trigger:d,shadowVisible:v,checked:b,indeterminate:f,checkboxProps:g,onChange:T,rowSpan:s?2:void 0}):null,{columnsToggle:x,setColumnsToggle:O}=ce(),[W,u]=cr(!1),y=l.some(h=>h.toggleable),c=y?Object.fromEntries(l.map(({accessor:h,title:w})=>[h,w??ue(String(h))])):void 0,m=Ge(sr,{className:dr("mantine-datatable-header",t),style:o,ref:R,onContextMenu:y?h=>{h.preventDefault(),u(w=>!w)}:void 0,children:[s&&Ge(mo,{children:[S,s.map(h=>q(Zt,{group:h},h.id))]}),Ge(mo,{children:[!s&&S,l.map(({hidden:h,...w},L)=>{if(h)return null;let{accessor:V,visibleMediaQuery:_,textAlign:U,width:F,title:G,sortable:k,draggable:j,toggleable:X,resizable:fe,titleClassName:be,titleStyle:Te,filter:ge,filterPopoverProps:ee,filterPopoverDisableClickOutside:he,filtering:Ce,sortKey:Q}={...i,...w};return q(so,{accessor:V,className:be,style:Te,visibleMediaQuery:_,textAlign:U,width:F,title:G,sortable:k,draggable:j,toggleable:X,resizable:fe&&L<l.length-1,sortStatus:a,sortIcons:n,sortKey:Q,onSortStatusChange:r,filter:ge,filterPopoverProps:ee,filterPopoverDisableClickOutside:he,filtering:Ce},V)})]})]});return y?Ge(nr,{position:"bottom",withArrow:!0,shadow:"md",opened:W,onChange:u,children:[q(lr,{children:m}),q(rr,{children:q(ir,{children:x.filter(h=>h.toggleable).map(h=>q(ar,{children:q(or,{classNames:{label:"mantine-datatable-header-column-toggle-checkbox-label"},size:"xs",label:c[h.accessor],checked:h.toggled,onChange:w=>{O(x.map(L=>L.accessor===h.accessor?{...L,toggled:w.currentTarget.checked}:L))}})},h.accessor))})})]}):m}import{Center as ur,Loader as mr}from"@mantine/core";import pr from"clsx";import{jsx as fo}from"react/jsx-runtime";function bo({pt:e,pb:t,fetching:o,customContent:a,backgroundBlur:n,size:r,type:l,color:i}){return fo(ur,{pt:e,pb:t,className:pr("mantine-datatable-loader",{"mantine-datatable-loader-fetching":o}),style:[{backdropFilter:n?`blur(${n}px)`:void 0}],children:o&&(a||fo(mr,{size:r,type:l,color:i}))})}import{Box as Pr,Pagination as Sr,Text as vr,rem as xr}from"@mantine/core";import Po from"clsx";import{Button as Tr,Group as gr,Menu as hr,MenuDropdown as Cr,MenuItem as Dr,MenuTarget as yr,Text as Co,rem as Me}from"@mantine/core";import wr from"clsx";import{parseThemeColor as fr}from"@mantine/core";function M(e,t,o){return e?fr({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function To({theme:e,c:t,backgroundColor:o,borderColor:a,rowBorderColor:n,stripedColor:r,highlightOnHoverColor:l}){return{"--mantine-datatable-color-light":M(t,e,"light"),"--mantine-datatable-color-dark":M(t,e,"dark"),"--mantine-datatable-background-color-light":M(o,e,"light"),"--mantine-datatable-background-color-dark":M(o,e,"dark"),"--mantine-datatable-border-color-light":M(a,e,"light"),"--mantine-datatable-border-color-dark":M(a,e,"dark"),"--mantine-datatable-row-border-color-light":M(n,e,"light"),"--mantine-datatable-row-border-color-dark":M(n,e,"dark"),"--mantine-datatable-striped-color-light":M(r,e,"light"),"--mantine-datatable-striped-color-dark":M(r,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":M(l,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":M(l,e,"dark")}}function Xe({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":M(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":M(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":M(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":M(o,e,"dark")}}function go({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":M(t,e,"light"),"--mantine-datatable-row-color-dark":M(t,e,"dark"),"--mantine-datatable-row-background-color-light":M(o,e,"light"),"--mantine-datatable-row-background-color-dark":M(o,e,"dark")}}import{jsx as dt,jsxs as br}from"react/jsx-runtime";function ho(){return br("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[dt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),dt("path",{d:"M8 9l4 -4l4 4"}),dt("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as ie,jsxs as yo}from"react/jsx-runtime";var Do={xs:Me(22),sm:Me(26),md:Me(32),lg:Me(38),xl:Me(44)};function wo({size:e,label:t,values:o,value:a,activeTextColor:n,activeBackgroundColor:r,onChange:l}){return yo(gr,{gap:"xs",children:[ie(Co,{component:"div",size:e,children:t}),yo(hr,{withinPortal:!0,withArrow:!0,offset:2,classNames:{arrow:"mantine-datatable-page-size-selector-menu-arrow"},children:[ie(yr,{children:ie(Tr,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:ie(ho,{}),style:[{fontWeight:"normal"},i=>({height:Do[e],paddingLeft:i.spacing[e],paddingRight:i.spacing[e]})],children:a})}),ie(Cr,{children:o.map(i=>{let s=i===a;return ie(Dr,{className:wr({"mantine-datatable-page-size-selector-active":s}),style:[{height:Do[e]},s&&(n||r)?d=>Xe({theme:d,paginationActiveTextColor:n,paginationActiveBackgroundColor:r}):void 0],disabled:s,onClick:()=>l(i),children:ie(Co,{component:"div",size:e,children:i})},i)})})]})]})}import{jsx as ct,jsxs as Mr}from"react/jsx-runtime";function So({className:e,style:t,fetching:o,page:a,onPageChange:n,paginationWithEdges:r,paginationWithControls:l,paginationActiveTextColor:i,paginationActiveBackgroundColor:s,paginationSize:d,loadingText:p,noRecordsText:b,paginationText:f,totalRecords:T,recordsPerPage:g,onRecordsPerPageChange:v,recordsPerPageLabel:D,recordsPerPageOptions:P,recordsLength:R,horizontalSpacing:S,paginationWrapBreakpoint:x,getPaginationControlProps:O,ref:W}){let u;if(T){let c=(a-1)*g+1,m=c+(R||0)-1;u=f({from:c,to:m,totalRecords:T})}else u=o?p:b;let y=K(({breakpoints:c})=>`(min-width: ${typeof x=="number"?`${xr(x)}rem`:c[x]||x})`);return Mr(Pr,{ref:W,px:S??"xs",py:"xs",className:Po("mantine-datatable-pagination",e),style:[{flexDirection:y?"row":"column"},t],children:[ct(vr,{component:"div",className:"mantine-datatable-pagination-text",size:d,children:u}),P&&ct(wo,{activeTextColor:i,activeBackgroundColor:s,size:d,label:D,values:P,value:g,onChange:v}),ct(Sr,{classNames:{root:Po("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!R}),control:"mantine-datatable-pagination-pages-control"},style:i||s?c=>Xe({theme:c,paginationActiveTextColor:i,paginationActiveBackgroundColor:s}):void 0,withEdges:r,withControls:l,value:a,onChange:n,size:d,total:Math.ceil(T/g),getControlProps:O})]})}import{TableTr as zr}from"@mantine/core";import Vr from"clsx";import{TableTd as Rr}from"@mantine/core";import kr from"clsx";import{jsx as Er}from"react/jsx-runtime";function vo({className:e,style:t,visibleMediaQuery:o,record:a,index:n,onClick:r,onDoubleClick:l,onContextMenu:i,noWrap:s,ellipsis:d,textAlign:p,width:b,accessor:f,render:T,defaultRender:g,customCellAttributes:v}){return K(o)?Er(Rr,{className:kr({[me]:s||d,[pe]:d,[B]:r||l,[Ae]:i,[J]:p==="left",[Z]:p==="center",[Y]:p==="right"},e),style:[{width:b,minWidth:b,maxWidth:b},t],onClick:r,onDoubleClick:l,onContextMenu:i,...v?.(a,n),children:T?T(a,n):g?g(a,n,f):rt(a,f)}):null}import{Collapse as Nr,TableTd as Lr,TableTr as xo}from"@mantine/core";import{Fragment as Hr,jsx as Re,jsxs as Ir}from"react/jsx-runtime";function Mo({open:e,colSpan:t,content:o,collapseProps:a}){let{expanded:n,visible:r}=Xt(e,a?.transitionDuration);return r?Ir(Hr,{children:[Re(xo,{}),Re(xo,{children:Re(Lr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:Re(Nr,{in:n,...a,children:Re("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}import{Checkbox as Or,TableTd as Wr}from"@mantine/core";import Ar from"clsx";import{jsx as Ro}from"react/jsx-runtime";function ko({className:e,style:t,record:o,index:a,trigger:n,onChange:r,withRightShadow:l,checkboxProps:i,getCheckboxProps:s,...d}){let p={...i,...s(o,a)},b=!d.disabled&&!p.disabled,f=T=>{T.stopPropagation(),n==="cell"&&b&&r?.(T)};return Ro(Wr,{className:Ar("mantine-datatable-row-selector-cell",{[B]:n==="cell"&&b},e),style:t,"data-shadow-visible":l||void 0,onClick:f,children:Ro(Or,{classNames:b?{input:B}:void 0,onChange:r,...d,...p})})}import{Fragment as Eo,jsx as Qe,jsxs as No}from"react/jsx-runtime";function Lo({record:e,index:t,columns:o,defaultColumnProps:a,defaultColumnRender:n,selectionTrigger:r,selectionVisible:l,selectionChecked:i,onSelectionChange:s,isRecordSelectable:d,selectionCheckboxProps:p,getSelectionCheckboxProps:b,onClick:f,onDoubleClick:T,onContextMenu:g,onCellClick:v,onCellDoubleClick:D,onCellContextMenu:P,expansion:R,customAttributes:S,color:x,backgroundColor:O,className:W,style:u,selectorCellShadowVisible:y,selectionColumnClassName:c,selectionColumnStyle:m,rowFactory:h}){let w=No(Eo,{children:[l&&Qe(ko,{className:c,style:m,record:e,index:t,trigger:r,withRightShadow:y,checked:i,disabled:!s||(d?!d(e,t):!1),onChange:s,checkboxProps:p,getCheckboxProps:b}),o.map(({hidden:_,hiddenContent:U,...F},G)=>{if(_||U)return null;let{accessor:k,visibleMediaQuery:j,textAlign:X,noWrap:fe,ellipsis:be,width:Te,render:ge,cellsClassName:ee,cellsStyle:he,customCellAttributes:Ce}={...a,...F};return Qe(vo,{className:typeof ee=="function"?ee(e,t):ee,style:he?.(e,t),visibleMediaQuery:j,record:e,index:t,onClick:v?Q=>v({event:Q,record:e,index:t,column:F,columnIndex:G}):void 0,onDoubleClick:D?Q=>D({event:Q,record:e,index:t,column:F,columnIndex:G}):void 0,onContextMenu:P?Q=>P({event:Q,record:e,index:t,column:F,columnIndex:G}):void 0,accessor:k,textAlign:X,noWrap:fe,ellipsis:be,width:Te,render:ge,defaultRender:n,customCellAttributes:Ce},k)})]}),L=R&&Qe(Mo,{colSpan:o.filter(({hidden:_})=>!_).length+(l?1:0),open:R.isRowExpanded(e),content:R.content({record:e,index:t}),collapseProps:R.collapseProps}),V=_r({record:e,index:t,selectionChecked:i,onClick:f,onDoubleClick:T,onContextMenu:g,expansion:R,customAttributes:S,color:x,backgroundColor:O,className:W,style:u});return h?h({record:e,index:t,rowProps:V,children:w,expandedElement:L}):No(Eo,{children:[Qe(zr,{...V,children:w}),L]})}function _r({record:e,index:t,selectionChecked:o,onClick:a,onDoubleClick:n,onContextMenu:r,expansion:l,customAttributes:i,color:s,backgroundColor:d,className:p,style:b}){return{className:Vr("mantine-datatable-row",{[B]:a||n||l?.isExpandable({record:e,index:t})&&l?.expandOnClick},{[Ae]:r},typeof p=="function"?p(e,t):p),"data-selected":o||void 0,onClick:f=>{if(l){let{isExpandable:T,isRowExpanded:g,expandOnClick:v,expandRow:D,collapseRow:P}=l;T({record:e,index:t})&&v&&(g(e)?P(e):D(e))}a?.({event:f,record:e,index:t})},onDoubleClick:n?f=>n({event:f,record:e,index:t}):void 0,onContextMenu:r?f=>r({event:f,record:e,index:t}):void 0,style:[s||d?f=>{let T=s?.(e,t),g=d?.(e,t);return go({theme:f,color:T,backgroundColor:g})}:void 0,b?.(e,t)],...i?.(e,t)??{}}}import{Box as Ho,ScrollArea as Fr,rem as Io}from"@mantine/core";import Ue from"clsx";import{jsx as $e,jsxs as Br}from"react/jsx-runtime";function Oo({topShadowVisible:e,leftShadowVisible:t,leftShadowBehind:o,rightShadowVisible:a,rightShadowBehind:n,bottomShadowVisible:r,headerHeight:l,footerHeight:i,onScrollPositionChange:s,children:d,viewportRef:p,scrollAreaProps:b}){return Br(Fr,{...b,viewportRef:p,classNames:{root:"mantine-datatable-scroll-area",scrollbar:"mantine-datatable-scroll-area-scrollbar",thumb:"mantine-datatable-scroll-area-thumb",corner:"mantine-datatable-scroll-area-corner"},onScrollPositionChange:s,children:[d,$e(Ho,{className:Ue("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow",{"mantine-datatable-scroll-area-shadow-visible":e}),style:{top:l?Io(l):0}}),$e("div",{className:Ue("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-visible":t,"mantine-datatable-scroll-area-shadow-behind":o})}),$e("div",{className:Ue("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-visible":a,"mantine-datatable-scroll-area-shadow-behind":n})}),$e(Ho,{className:Ue("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow",{"mantine-datatable-scroll-area-shadow-visible":r}),style:{bottom:i?Io(i+1):0}})]})}import{jsx as I,jsxs as zo}from"react/jsx-runtime";function $r({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:a="100%",minHeight:n,maxHeight:r,shadow:l,verticalAlign:i="center",fetching:s,columns:d,storeColumnsKey:p,groups:b,pinFirstColumn:f,pinLastColumn:T,defaultColumnProps:g,defaultColumnRender:v,idAccessor:D="id",records:P,selectionTrigger:R="checkbox",selectedRecords:S,onSelectedRecordsChange:x,selectionColumnClassName:O,selectionColumnStyle:W,isRecordSelectable:u,selectionCheckboxProps:y,allRecordsSelectionCheckboxProps:c={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:m=(H,te)=>({"aria-label":`Select record ${te+1}`}),sortStatus:h,sortIcons:w,onSortStatusChange:L,horizontalSpacing:V,page:_,onPageChange:U,totalRecords:F,recordsPerPage:G,onRecordsPerPageChange:k,recordsPerPageOptions:j,recordsPerPageLabel:X="Records per page",paginationWithEdges:fe,paginationWithControls:be,paginationActiveTextColor:Te,paginationActiveBackgroundColor:ge,paginationSize:ee="sm",paginationText:he=({from:H,to:te,totalRecords:oe})=>`${H} - ${te} / ${oe}`,paginationWrapBreakpoint:Ce="sm",getPaginationControlProps:Q=H=>H==="previous"?{"aria-label":"Previous page"}:H==="next"?{"aria-label":"Next page"}:{},loaderBackgroundBlur:Vo,customLoader:_o,loaderSize:Fo,loaderType:Bo,loaderColor:Go,loadingText:Xo="...",emptyState:Qo,noRecordsText:ut="No records",noRecordsIcon:Uo,highlightOnHover:$o,striped:Ko,noHeader:Jo,onRowClick:Zo,onRowDoubleClick:Yo,onRowContextMenu:qo,onCellClick:jo,onCellDoubleClick:ea,onCellContextMenu:ta,onScroll:mt,onScrollToTop:pt,onScrollToBottom:ft,onScrollToLeft:bt,onScrollToRight:Tt,c:oa,backgroundColor:aa,borderColor:na,rowBorderColor:ra,stripedColor:la,highlightOnHoverColor:ia,rowColor:sa,rowBackgroundColor:da,rowExpansion:ca,rowClassName:ua,rowStyle:ma,customRowAttributes:pa,scrollViewportRef:fa,scrollAreaProps:ba,tableRef:Ta,bodyRef:ga,m:ha,my:Ca,mx:Da,mt:ya,mb:wa,ml:Pa,mr:Sa,className:va,classNames:De,style:xa,styles:ye,rowFactory:Ma,tableWrapper:Je,...gt}){let{ref:H,width:te,height:oe}=re(),we=Ur(()=>b?.flatMap(C=>C.columns)??d,[d,b]),ht=It({key:p,columns:we}),{ref:Ra,height:Ze}=re(),{ref:ka,width:Ye,height:Pe}=re(),{ref:Ea,height:Na}=re(),{ref:La,height:Ct}=re(),{ref:Ha,width:Ia}=re(),Oa=Wo(ka,Ta),Wa=Wo(H,fa),[qe,Dt]=Ke(!0),[je,yt]=Ke(!0),[Se,wt]=Ke(!0),[Ee,Pt]=Ke(!0),Aa=Ft({rowExpansion:ca,records:P,idAccessor:D}),et=ke(()=>{let C=H.current?.scrollTop??0,$=H.current?.scrollLeft??0;if(s||Pe<=oe)Dt(!0),yt(!0);else{let A=C===0,z=Pe-C-oe<1;Dt(A),yt(z),A&&A!==qe&&pt?.(),z&&z!==je&&ft?.()}if(s||Ye===te)wt(!0),Pt(!0);else{let A=$===0,z=Ye-$-te<1;wt(A),Pt(z),A&&A!==Se&&bt?.(),z&&z!==Ee&&Tt?.()}},[s,ft,bt,Tt,pt,oe,H,te,je,Se,Ee,qe,Pe,Ye]);Ot(et,[et]);let St=Qr(et,50),za=ke(C=>{mt?.(C),St()},[St,mt]),Va=ke(C=>{H.current?.scrollTo({top:0,left:0}),U(C)},[U,H]),Ne=P?.length,vt=P?.map(C=>E(C,D)),se=!!S,ve=S?.map(C=>E(C,D)),xt=vt!==void 0&&ve!==void 0&&ve.length>0,tt=u?P?.filter(u):P,Le=tt?.map(C=>E(C,D)),He=xt&&Le.every(C=>ve.includes(C)),_a=xt&&Le.some(C=>ve.includes(C)),Fa=ke(()=>{S&&x&&x(He?S.filter(C=>!Le.includes(E(C,D))):We([...S,...tt],C=>E(C,D)))},[He,D,x,Le,tt,S]),{lastSelectionChangeIndex:Ie,setLastSelectionChangeIndex:Ba}=Wt(vt),ot=se&&!Se&&!f,Ga={m:ha,my:Ca,mx:Da,mt:ya,mb:wa,ml:Pa,mr:Sa},Xa=ke(({children:C})=>Je?Je({children:C}):C,[Je]);return I(at,{...ht,children:zo(Gr,{...Ga,className:Ao("mantine-datatable",{"mantine-datatable-with-border":e},va,De?.root),style:[C=>({...To({theme:C,c:oa,backgroundColor:aa,borderColor:na,rowBorderColor:ra,stripedColor:la,highlightOnHoverColor:ia}),borderRadius:C.radius[t]||t,boxShadow:C.shadows[l]||l,height:a,minHeight:n,maxHeight:r}),xa,ye?.root,{position:"relative"}],children:[I(Oo,{viewportRef:Wa,topShadowVisible:!qe,leftShadowVisible:!Se,leftShadowBehind:se||!!f,rightShadowVisible:!Ee,rightShadowBehind:T,bottomShadowVisible:!je,headerHeight:Ze,footerHeight:Na,onScrollPositionChange:za,scrollAreaProps:ba,children:I(Xa,{children:zo(Xr,{ref:Oa,horizontalSpacing:V,className:Ao("mantine-datatable-table",{[Qt]:o,"mantine-datatable-vertical-align-top":i==="top","mantine-datatable-vertical-align-bottom":i==="bottom","mantine-datatable-last-row-border-bottom-visible":gt.withRowBorders&&Pe<oe,"mantine-datatable-pin-last-column":T,"mantine-datatable-pin-last-column-scrolled":!Ee&&T,"mantine-datatable-selection-column-visible":se,"mantine-datatable-pin-first-column":f,"mantine-datatable-pin-first-column-scrolled":!Se&&f},De?.table),style:{...ye?.table,"--mantine-datatable-selection-column-width":`${Ia}px`},"data-striped":Ne&&Ko||void 0,"data-highlight-on-hover":$o||void 0,...gt,children:[Jo?null:I(at,{...ht,children:I(po,{ref:Ra,selectionColumnHeaderRef:Ha,className:De?.header,style:ye?.header,columns:we,defaultColumnProps:g,groups:b,sortStatus:h,sortIcons:w,onSortStatusChange:L,selectionTrigger:R,selectionVisible:se,selectionChecked:He,selectionIndeterminate:_a&&!He,onSelectionChange:Fa,selectionCheckboxProps:{...y,...c},selectorCellShadowVisible:ot,selectionColumnClassName:O,selectionColumnStyle:W})}),I("tbody",{ref:ga,children:Ne?P.map((C,$)=>{let A=E(C,D),z=ve?.includes(A)||!1,Mt;return x&&S&&(Mt=Qa=>{if(Qa.nativeEvent.shiftKey&&Ie!==null){let de=P.filter($>Ie?(ae,ne)=>ne>=Ie&&ne<=$&&(u?u(ae,ne):!0):(ae,ne)=>ne>=$&&ne<=Ie&&(u?u(ae,ne):!0));x(z?_t(S,de,ae=>E(ae,D)):We([...S,...de],ae=>E(ae,D)))}else x(z?S.filter(de=>E(de,D)!==A):We([...S,C],de=>E(de,D)));Ba($)}),I(Lo,{record:C,index:$,columns:we,defaultColumnProps:g,defaultColumnRender:v,selectionTrigger:R,selectionVisible:se,selectionChecked:z,onSelectionChange:Mt,isRecordSelectable:u,selectionCheckboxProps:y,getSelectionCheckboxProps:m,onClick:Zo,onDoubleClick:Yo,onCellClick:jo,onCellDoubleClick:ea,onContextMenu:qo,onCellContextMenu:ta,expansion:Aa,color:sa,backgroundColor:da,className:ua,style:ma,customAttributes:pa,selectorCellShadowVisible:ot,selectionColumnClassName:O,selectionColumnStyle:W,idAccessor:D,rowFactory:Ma},A)}):I(Nt,{})}),we.some(({footer:C})=>C)&&I(Kt,{ref:Ea,className:De?.footer,style:ye?.footer,columns:we,defaultColumnProps:g,selectionVisible:se,selectorCellShadowVisible:ot,scrollDiff:Pe-oe})]})})}),_&&I(So,{ref:La,className:De?.pagination,style:ye?.pagination,horizontalSpacing:V,fetching:s,page:_,onPageChange:Va,totalRecords:F,recordsPerPage:G,onRecordsPerPageChange:k,recordsPerPageOptions:j,recordsPerPageLabel:X,paginationWithEdges:fe,paginationWithControls:be,paginationActiveTextColor:Te,paginationActiveBackgroundColor:ge,paginationSize:ee,paginationText:he,paginationWrapBreakpoint:Ce,getPaginationControlProps:Q,noRecordsText:ut,loadingText:Xo,recordsLength:Ne}),I(bo,{pt:Ze,pb:Ct,fetching:s,backgroundBlur:Vo,customContent:_o,size:Fo,type:Bo,color:Go}),I(Ht,{pt:Ze,pb:Ct,icon:Uo,text:ut,active:!s&&!Ne,children:Qo})]})})}import{TableTr as Kr}from"@mantine/core";import{useMergedRef as Jr}from"@mantine/hooks";import{useEffect as Zr,useRef as Yr}from"react";import{jsx as jr}from"react/jsx-runtime";function qr({className:e,children:t,isDragging:o,ref:a,...n}){let r=Yr(null),l=Jr(r,a);return Zr(()=>{if(!r.current||!o)return;let p=r.current.parentElement.parentElement.children[0].children[0];for(let b=0;b<p.children.length;b++){let T=p.children[b].getBoundingClientRect(),g=r.current.children[b];g.style.height=T.height+"px",g.style.width=T.width+"px",g.style.minWidth=T.width+"px",g.style.maxWidth=T.width+"px"}},[o,t]),jr(Kr,{"data-is-dragging":o,ref:l,...n,className:e,children:t})}export{$r as DataTable,qr as DataTableDraggableRow,_t as differenceBy,E as getRecordId,rt as getValueAtPath,ue as humanize,Ll as reorderRecords,Hl as swapRecords,We as uniqBy,It as useDataTableColumns};
1
+ "use client";import{Box as Nr,Table as Lr}from"@mantine/core";import{useMergedRef as Po}from"@mantine/hooks";import vo from"clsx";import{useCallback as it,useMemo as Mo}from"react";import{useState as ft}from"react";import{createSafeContext as On}from"@mantine/core";var[pt,ie]=On("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as An}from"react/jsx-runtime";var Ke=e=>{let{children:t,columnsOrder:o,setColumnsOrder:n,columnsToggle:a,setColumnsToggle:r,resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:f,setMultipleColumnWidths:b,resetColumnsWidth:d}=e,[g,m]=ft(""),[p,T]=ft("");return An(pt,{value:{sourceColumn:g,setSourceColumn:m,targetColumn:p,setTargetColumn:T,columnsToggle:a,setColumnsToggle:r,swapColumns:()=>{if(!o||!n||!g||!p)return;let h=o.indexOf(g),y=o.indexOf(p);if(h!==-1&&y!==-1){let k=o.splice(h,1)[0];o.splice(y,0,k),n([...o])}},resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:f,setMultipleColumnWidths:b,resetColumnsWidth:d},children:t})};import{jsx as bt}from"react/jsx-runtime";function Tt(){return bt("tr",{className:"mantine-datatable-empty-row",children:bt("td",{})})}import{Center as zn,Text as Vn}from"@mantine/core";import{jsx as De,jsxs as _n}from"react/jsx-runtime";function gt(){return _n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[De("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),De("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),De("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),De("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),De("path",{d:"M3 3l18 18"})]})}import{Fragment as Bn,jsx as Ee,jsxs as Fn}from"react/jsx-runtime";function ht({icon:e,text:t,active:o,children:n}){return Ee(zn,{className:"mantine-datatable-empty-state","data-active":o||void 0,children:n||Fn(Bn,{children:[e||Ee("div",{className:"mantine-datatable-empty-state-icon",children:Ee(gt,{})}),Ee(Vn,{component:"div",size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as ma,TableTr as pa}from"@mantine/core";import fa from"clsx";import{TableTh as ia}from"@mantine/core";import sa from"clsx";import{useCallback as tl,useRef as ol,useState as nl}from"react";import{useLocalStorage as Je}from"@mantine/hooks";import{useMemo as Gn}from"react";var Ct=({key:e,columns:t=[],getInitialValueInEffect:o=!0})=>{function n(s,D){let u=[];return s.forEach(i=>{D.find(C=>C.accessor===i)&&u.push(i)}),D.forEach(i=>{u.includes(i.accessor)||u.push(i.accessor)}),u}function a(s,D){let u=[];return s.forEach(i=>{D.find(C=>C.accessor===i.accessor)&&u.push(i)}),D.forEach(i=>{u.find(C=>C.accessor===i.accessor)||u.push({accessor:i.accessor,defaultToggle:i.defaultToggle||!0,toggleable:i.toggleable,toggled:i.defaultToggle===void 0?!0:i.defaultToggle})}),u}function r(s,D){let u=[];return s.forEach(i=>{let C=Object.keys(i)[0];D.find(v=>v.accessor===C)&&u.push(i)}),D.forEach(i=>{let C=i.accessor;if(!u.find(v=>Object.keys(v)[0]===C)){let v={};v[C]="",u.push(v)}}),u}function l(){let[s,D]=Je({key:e?`${e}-columns-order`:"",defaultValue:e?b:void 0,getInitialValueInEffect:o});function u(v){e&&D(v)}if(!e)return[s,u];let i=n(s,t),C=JSON.stringify(s);return JSON.stringify(i)!==C&&u(i),[i,u]}function c(){let[s,D]=Je({key:e?`${e}-columns-toggle`:"",defaultValue:e?g:void 0,getInitialValueInEffect:o});function u(v){e&&D(v)}if(!e)return[s,u];let i=a(s,t),C=JSON.stringify(s);return JSON.stringify(i)!==C&&u(i),[a(s,t),u]}function f(){let[s,D]=Je({key:e?`${e}-columns-width`:"",defaultValue:e?d:void 0,getInitialValueInEffect:o});function u(v){e&&D(v)}if(!e)return[s,u];let i=r(s,t),C=JSON.stringify(s);return JSON.stringify(i)!==C&&u(i),[r(s,t),u]}let b=t&&t.map(s=>s.accessor)||[],d=t&&t.map(s=>({[s.accessor]:s.width??"initial"}))||[],g=t&&t.map(s=>({accessor:s.accessor,defaultToggle:s.defaultToggle||!0,toggleable:s.toggleable,toggled:s.defaultToggle===void 0?!0:s.defaultToggle})),[m,p]=l(),[T,M]=c(),[h,y]=f(),k=()=>p(b),S=()=>{M(g)},w=()=>y(d);return{effectiveColumns:Gn(()=>m?m.map(u=>t.find(i=>i.accessor===u)).map(u=>({...u,hidden:u?.hidden||!T.find(i=>i.accessor===u?.accessor)?.toggled})).map(u=>({...u,width:h.find(i=>i[u?.accessor])?.[u?.accessor]})):t,[t,m,T,h]),setColumnsOrder:p,columnsOrder:m,resetColumnsOrder:k,columnsToggle:T,setColumnsToggle:M,resetColumnsToggle:S,columnsWidth:h,setColumnsWidth:y,setColumnWidth:(s,D)=>{let u=h.map(i=>i[s]?{[s]:D}:i);y(u)},setMultipleColumnWidths:s=>{let D=h.map(u=>{let i=Object.keys(u)[0],C=s.find(v=>v.accessor===i);return C?{[i]:C.width}:u});y(D)},resetColumnsWidth:w}};import{rem as Un}from"@mantine/core";import{useCallback as Kn,useEffect as qe,useRef as U}from"react";import{useEffect as $n,useLayoutEffect as Xn}from"react";var Ze=typeof window<"u"?Xn:$n;import{useRef as Qn}from"react";function Ye(e){let t=Qn(e);return t.current=e,t}var yt="--mantine-datatable-header-height",xt="--mantine-datatable-footer-height",Dt="--mantine-datatable-selection-column-width",wt="--mantine-datatable-last-row-border-bottom";function z(e,t,o){e?.style.setProperty(t,o)}function et(e){let t=e.borderBoxSize?.[0]||e.contentBoxSize?.[0];return t?{width:t.inlineSize,height:t.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}}function je(e,t,o){if(e){let n=new ResizeObserver(a=>{let r=a[0];r&&t(et(r))});return n.observe(e),()=>{n.disconnect(),o()}}}function St({scrollCallbacks:e,withRowBorders:t}){let o={root:U(null),table:U(null),scrollViewport:U(null),header:U(null),footer:U(null),selectionColumnHeader:U(null)},{root:n,table:a,scrollViewport:r,header:l,footer:c,selectionColumnHeader:f}=o,b=Ye({withRowBorders:t}),d=Ye(e),g=U(()=>{}),m=U(()=>{}),p=Kn(T=>{d.current.onScroll?.(T),g.current()},[]);return qe(()=>je(l.current,T=>{z(n.current,yt,`${T.height}px`)},()=>z(n.current,yt,"0")),[l.current]),qe(()=>je(c.current,T=>{z(n.current,xt,`${T.height}px`)},()=>z(n.current,xt,"0")),[c.current]),qe(()=>je(f.current,T=>{z(n.current,Dt,`${T.width}px`)},()=>z(n.current,Dt,"0")),[f.current]),Ze(()=>{if(typeof window===void 0)return;let T={top:!0,bottom:!0,left:!0,right:!0},M={width:0,height:0},h={width:0,height:0};function y(P,x){let s=T[P];return T[P]=x,z(n.current,`--mantine-datatable-${P}-shadow-opacity`,x?"0":"1"),s}function k(){let P=M.height-h.height,x=P<0;z(n.current,"--mantine-datatable-footer-position",x?"relative":"sticky"),z(n.current,"--mantine-datatable-footer-bottom",x?`${P}px`:"0")}function S(){b.current.withRowBorders&&M.height<h.height?z(n.current,wt,`${Un("1px")} solid var(--mantine-datatable-border-color)`):z(n.current,wt,"unset")}m.current=S;function w(){let P=d.current,x=r.current?.scrollTop??0,s=r.current?.scrollLeft??0,D=x===0,u=M.height-x-h.height<1,i=y("top",D),C=y("bottom",u);D&&D!==i&&P.onScrollToTop?.(),u&&u!==C&&P.onScrollToBottom?.();let v=s===0,I=M.width-s-h.width<1,A=y("left",v),V=y("right",I);v&&v!==A&&P.onScrollToLeft?.(),I&&I!==V&&P.onScrollToRight?.()}g.current=w;let E=new ResizeObserver(P=>{for(let x of P)switch(x.target.tagName){case"TABLE":{M=et(x);break}case"DIV":{h=et(x);break}}w(),k(),S()});return E.observe(a.current),E.observe(r.current),()=>{E.disconnect()}},[]),Ze(()=>{m.current()},[t]),{refs:o,onScroll:p}}import{useEffect as Jn,useState as Zn}from"react";function Rt(e){let[t,o]=Zn(null),n=e?.join(":")||"";return Jn(()=>{o(null)},[n]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}import{useEffect as Yn,useRef as qn,useState as jn}from"react";function ea(e,t){let o=()=>{t(e.map(a=>a.matches))},n=e.map(a=>{try{return a.addEventListener("change",o),()=>a.removeEventListener("change",o)}catch{return a.addListener(o),()=>a.removeListener(o)}});return()=>{n.forEach(a=>a())}}function ta(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function Pt(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[n,a]=jn(o?t:ta(e,t)),r=qn(null);return Yn(()=>{if("matchMedia"in window)return r.current=e.map(l=>window.matchMedia(l)),a(r.current.map(l=>l.matches)),ea(r.current,l=>{a(l)})},[e]),n}import{useMantineTheme as oa}from"@mantine/core";import{useMemo as vt}from"react";function Mt(e){let t=oa(),o=vt(()=>e.map(a=>(typeof a=="function"?a(t):a)??""),[e,t]),n=vt(()=>e.map(()=>!0),[e]);return Pt(o,n)}import{useMantineTheme as na}from"@mantine/core";import{useMediaQuery as aa}from"@mantine/hooks";function K(e){let t=na(),o=typeof e=="function"?e(t):e;return aa(o||"",!0)}import{useState as ra}from"react";function se(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function kt(e,t,o){return e.filter(n=>!t.map(o).includes(o(n)))}function Ne(e,t){return e.filter((o,n,a)=>n===a.findIndex(r=>t(o)===t(r)))}function tt(e,t){return t?t.match(/([^[.\]])+/g).reduce((n,a)=>n&&n[a],e):void 0}function W(e,t){return typeof t=="string"?tt(e,t):t(e)}function Ml(e,t){let o=structuredClone(t),n=o[e.source.index];return e.destination&&(o.splice(e.source.index,1),o.splice(e.destination.index,0,n)),o}function kl(e,t){let o=structuredClone(t),n=e.destination;if(!n)return o;let a=o[e.source.index],r=o[n.index];return o.splice(n.index,1,a),o.splice(e.source.index,1,r),o}function Et({rowExpansion:e,records:t,idAccessor:o}){let n=[];if(e&&t){let{trigger:c,allowMultiple:f,initiallyExpanded:b}=e;t&&c==="always"?n=t.map(d=>W(d,o)):b&&(n=t.filter((d,g)=>b({record:d,index:g})).map(d=>W(d,o)),f||(n=[n[0]]))}let a,r,l=ra(n);if(e){let{expandable:c,trigger:f,allowMultiple:b,collapseProps:d,content:g}=e;e.expanded?{recordIds:a,onRecordIdsChange:r}=e.expanded:[a,r]=l;let m=p=>r?.(a.filter(T=>T!==W(p,o)));return{expandOnClick:f!=="always"&&f!=="never",isRowExpanded:p=>f==="always"?!0:a.includes(W(p,o)),isExpandable:({record:p,index:T})=>c?c({record:p,index:T}):!0,expandRow:p=>{let T=W(p,o);r?.(b?[...a,T]:[T])},collapseRow:m,collapseProps:d,content:({record:p,index:T})=>()=>g({record:p,index:T,collapse:()=>m(p)})}}}import{useTimeout as Nt}from"@mantine/hooks";import{useEffect as la,useState as Lt}from"react";function Wt(e,t){let[o,n]=Lt(e),[a,r]=Lt(e),l=Nt(()=>n(!0),0),c=Nt(()=>r(!1),t||200);return la(()=>{e?(c.clear(),r(!0),l.start()):(l.clear(),n(!1),c.start())},[l,c,e]),{expanded:o,visible:a}}var ce="mantine-datatable-nowrap",de="mantine-datatable-ellipsis",F="mantine-datatable-pointer-cursor",Le="mantine-datatable-context-menu-cursor",It="mantine-datatable-text-selection-disabled",J="mantine-datatable-text-align-left",Z="mantine-datatable-text-align-center",Y="mantine-datatable-text-align-right";import{jsx as ca}from"react/jsx-runtime";function Ht({className:e,style:t,visibleMediaQuery:o,title:n,noWrap:a,ellipsis:r,textAlign:l,width:c}){return K(o)?ca(ia,{className:sa({[ce]:a||r,[de]:r,[J]:l==="left",[Z]:l==="center",[Y]:l==="right"},e),style:[{width:c,minWidth:c,maxWidth:c},t],children:n}):null}import{TableTh as da}from"@mantine/core";import{jsx as ua}from"react/jsx-runtime";function Ot({shadowVisible:e}){return ua(da,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as ot,jsxs as ba}from"react/jsx-runtime";function At({className:e,style:t,columns:o,defaultColumnProps:n,selectionVisible:a,selectorCellShadowVisible:r,ref:l}){return ot(ma,{ref:l,className:fa("mantine-datatable-footer",e),style:t,children:ba(pa,{children:[a&&ot(Ot,{shadowVisible:r}),o.map(({hidden:c,...f})=>{if(c)return null;let{accessor:b,visibleMediaQuery:d,textAlign:g,width:m,footer:p,footerClassName:T,footerStyle:M,noWrap:h,ellipsis:y}={...n,...f};return ot(Ht,{className:T,style:M,visibleMediaQuery:d,textAlign:g,width:m,title:p,noWrap:h,ellipsis:y},b)})]})})}import{Checkbox as $a,Group as Xa,Popover as Qa,PopoverDropdown as Ua,PopoverTarget as Ka,Stack as Ja,TableThead as Za,TableTr as oo}from"@mantine/core";import Ya from"clsx";import{useState as qa}from"react";import{TableTh as Ta}from"@mantine/core";import ga from"clsx";import{useMemo as _t}from"react";import{jsx as ha}from"react/jsx-runtime";function zt({group:{id:e,columns:t,title:o,textAlign:n,className:a,style:r}}){let l=_t(()=>t.map(({visibleMediaQuery:b})=>b),[t]),c=Mt(l),f=_t(()=>t.filter(({hidden:b},d)=>!b&&c?.[d]).length,[t,c]);return f>0?ha(Ta,{colSpan:f,className:ga("mantine-datatable-column-group-header-cell",{[J]:n==="left",[Z]:n==="center",[Y]:n==="right"},a),style:r,children:o??se(e)}):null}import{ActionIcon as qt,Box as Ia,Center as Oe,Flex as Ha,Group as Oa,TableTh as Aa}from"@mantine/core";import Ae from"clsx";import{useRef as _a,useState as za}from"react";import{ActionIcon as xa,Popover as Da,PopoverDropdown as wa,PopoverTarget as Sa}from"@mantine/core";import{useClickOutside as Ra,useDisclosure as Pa}from"@mantine/hooks";import{jsx as Vt,jsxs as Ca}from"react/jsx-runtime";function Bt(){return Ca("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Vt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Vt("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"})]})}import{jsx as Ft,jsxs as ya}from"react/jsx-runtime";function Gt(){return ya("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ft("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ft("path",{d:"M20 3h-16a1 1 0 0 0 -1 1v2.227l.008 .223a3 3 0 0 0 .772 1.795l4.22 4.641v8.114a1 1 0 0 0 1.316 .949l6 -2l.108 -.043a1 1 0 0 0 .576 -.906v-6.586l4.121 -4.12a3 3 0 0 0 .879 -2.123v-2.171a1 1 0 0 0 -1 -1z",strokeWidth:"0",fill:"currentColor"})]})}import{jsx as We,jsxs as va}from"react/jsx-runtime";function $t({children:e,isActive:t,filterPopoverProps:o,filterPopoverDisableClickOutside:n}){let[a,{close:r,toggle:l}]=Pa(!1),c=t?Gt:Bt,f=Ra(r);return n&&(f=void 0),va(Da,{withArrow:!0,shadow:"md",opened:a,onClose:r,trapFocus:!0,...o,children:[We(Sa,{children:We(xa,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:b=>{b.preventDefault(),l()},onKeyDown:b=>b.stopPropagation(),children:We(c,{})})}),We(wa,{ref:f,onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),children:typeof e=="function"?e({close:r}):e})]})}import{useCallback as Xt,useRef as Qt,useState as Ma}from"react";import{jsx as ka}from"react/jsx-runtime";var Ut=e=>{let{accessor:t,columnRef:o}=e,[n,a]=Ma(!1),r=Qt(0),l=Qt({current:0,next:0}),{setMultipleColumnWidths:c}=ie(),f=Xt(d=>{if(d.preventDefault(),d.stopPropagation(),!o.current)return;let g=o.current,m=g.nextElementSibling;for(;m;){let S=m.getAttribute("data-accessor");if(S&&S!=="__selection__")break;m=m.nextElementSibling}if(!m)return;let p=m.getAttribute("data-accessor");if(!p)return;let T=p==="__selection__";a(!0),r.current=d.clientX;let M=g.offsetWidth,h=m.offsetWidth;l.current={current:M,next:h};let y=S=>{if(!o.current)return;let w=o.current,E=w.nextElementSibling;if(!E)return;let P=S.clientX-r.current,x=50,s=l.current.current-x,D=l.current.next-x,u=Math.max(-s,Math.min(P,D)),i=l.current.current+u,C=l.current.next-u;w.style.width=`${i}px`,E.style.width=`${C}px`,w.style.minWidth=`${i}px`,w.style.maxWidth=`${i}px`,E.style.minWidth=`${C}px`,E.style.maxWidth=`${C}px`},k=()=>{if(!o.current)return;let S=o.current,w=S.nextElementSibling;a(!1),document.body.style.cursor="initial",document.body.style.userSelect="initial";let E=parseInt(S.style.width)||S.offsetWidth,P=w?parseInt(w.style.width)||w.offsetWidth:0,x=[{accessor:t,width:`${E}px`}];if(w&&!T){let s=w.getAttribute("data-accessor");s&&x.push({accessor:s,width:`${P}px`})}setTimeout(()=>{c(x)},0),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",k)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",k)},[t,c]),b=Xt(()=>{if(!o.current)return;let d=o.current,g=d.nextElementSibling;d.style.width="",d.style.minWidth="",d.style.maxWidth="";let m=[{accessor:t,width:"initial"}];if(g){g.style.width="",g.style.minWidth="",g.style.maxWidth="";let p=g.getAttribute("data-accessor");p&&p!=="__selection__"&&m.push({accessor:p,width:"initial"})}setTimeout(()=>{c(m)},0)},[t,c]);return ka("div",{className:"mantine-datatable-header-resizable-handle",style:{cursor:n?"col-resize":void 0},onMouseDown:f,onDoubleClick:b,onClick:d=>d.stopPropagation(),title:"Drag to resize column, double-click to reset"})};import{jsx as Ie,jsxs as Ea}from"react/jsx-runtime";function Kt(){return Ea("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ie("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ie("path",{d:"M12 5l0 14"}),Ie("path",{d:"M16 9l-4 -4"}),Ie("path",{d:"M8 9l4 -4"})]})}import{jsx as He,jsxs as Na}from"react/jsx-runtime";function Jt(){return Na("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[He("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),He("path",{d:"M8 7l4 -4l4 4"}),He("path",{d:"M8 17l4 4l4 -4"}),He("path",{d:"M12 3l0 18"})]})}import{jsx as ne,jsxs as La}from"react/jsx-runtime";function Zt(){return La("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ne("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ne("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ne("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as nt,jsxs as Wa}from"react/jsx-runtime";function Yt(){return Wa("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[nt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),nt("path",{d:"M18 6l-12 12"}),nt("path",{d:"M6 6l12 12"})]})}import{Fragment as Va,jsx as H,jsxs as at}from"react/jsx-runtime";function jt({className:e,style:t,accessor:o,visibleMediaQuery:n,title:a,sortable:r,draggable:l,toggleable:c,resizable:f,sortIcons:b,textAlign:d,width:g,sortStatus:m,onSortStatusChange:p,filter:T,filterPopoverProps:M,filterPopoverDisableClickOutside:h,filtering:y,sortKey:k}){let{setSourceColumn:S,setTargetColumn:w,swapColumns:E,setColumnsToggle:P}=ie(),[x,s]=za(!1),D=_a(null);if(!K(n))return null;let u=a??se(o),i=typeof u=="string"?u:void 0,C=r&&p?L=>{L?.defaultPrevented||p({sortKey:k,columnAccessor:o,direction:m?.columnAccessor===o?m.direction==="asc"?"desc":"asc":m?.direction??"asc"})}:void 0,v=L=>{L.stopPropagation(),S(o),s(!1)},I=L=>{L.preventDefault(),w(o),s(!0)},A=()=>{w(o),s(!1),E()},V=()=>{s(!0)},B=()=>{s(!1)},G=L=>{L.stopPropagation(),P(j=>j.map($=>$.accessor===o?{...$,toggled:!1}:$))};return at(Aa,{"data-accessor":o,className:Ae({"mantine-datatable-header-cell-sortable":r,"mantine-datatable-header-cell-toggleable":c,"mantine-datatable-header-cell-resizable":f},e),style:[{width:g,...f?{minWidth:"1px"}:{minWidth:g,maxWidth:g}},t],role:r?"button":void 0,tabIndex:r?0:void 0,onClick:C,onKeyDown:L=>L.key==="Enter"&&C?.(),ref:D,children:[at(Oa,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[at(Ha,{align:"center",w:"100%",className:Ae({"mantine-datatable-header-cell-draggable":l,"mantine-datatable-header-cell-drag-over":x}),draggable:l,onDragStart:l?v:void 0,onDragEnter:l?V:void 0,onDragOver:l?I:void 0,onDrop:l?A:void 0,onDragLeave:l?B:void 0,children:[l?H(Oe,{role:"img","aria-label":"Drag column",children:H(qt,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:L=>{L.stopPropagation()},children:H(Zt,{})})}):null,H(Ia,{className:Ae("mantine-datatable-header-cell-sortable-text",{[J]:d==="left",[Z]:d==="center",[Y]:d==="right"},ce,de),title:i,children:u})]}),c?H(Oe,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:H(qt,{size:"xs",variant:"light",onClick:G,children:H(Yt,{})})}):null,r||m?.columnAccessor===o?H(Va,{children:m?.columnAccessor===o?H(Oe,{className:Ae("mantine-datatable-header-cell-sortable-icon",{"mantine-datatable-header-cell-sortable-icon-reversed":m.direction==="desc"}),role:"img","aria-label":`Sorted ${m.direction==="desc"?"descending":"ascending"}`,children:b?.sorted||H(Kt,{})}):H(Oe,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:b?.unsorted||H(Jt,{})})}):null,T?H($t,{filterPopoverProps:M,isActive:!!y,filterPopoverDisableClickOutside:h,children:T}):null]}),f&&o!=="__selection__"?H(Ut,{accessor:o,columnRef:D}):null]})}import{Checkbox as Ba,TableTh as Fa}from"@mantine/core";import Ga from"clsx";import{jsx as eo}from"react/jsx-runtime";function to({className:e,style:t,trigger:o,shadowVisible:n,checked:a,indeterminate:r,checkboxProps:l,onChange:c,rowSpan:f,ref:b}){let d=!l.disabled;return eo(Fa,{ref:b,className:Ga("mantine-datatable-header-selector-cell",{[F]:o==="cell"&&d},e),style:t,rowSpan:f,"data-shadow-visible":n||void 0,"data-accessor":"__selection__",onClick:o==="cell"&&d?c:void 0,children:eo(Ba,{classNames:d?{input:F}:void 0,checked:a,indeterminate:r,onChange:c,...l,disabled:!(c||l.onChange)||l.disabled})})}import{jsx as q,jsxs as _e}from"react/jsx-runtime";function no({selectionColumnHeaderRef:e,className:t,style:o,sortStatus:n,sortIcons:a,onSortStatusChange:r,columns:l,defaultColumnProps:c,groups:f,selectionTrigger:b,selectionVisible:d,selectionChecked:g,selectionIndeterminate:m,onSelectionChange:p,selectionCheckboxProps:T,selectorCellShadowVisible:M,selectionColumnClassName:h,selectionColumnStyle:y,ref:k}){let S=d?q(to,{ref:e,className:h,style:y,trigger:b,shadowVisible:M,checked:g,indeterminate:m,checkboxProps:T,onChange:p,rowSpan:f?2:void 0}):null,{columnsToggle:w,setColumnsToggle:E}=ie(),[P,x]=qa(!1),s=l.some(i=>i.toggleable),D=s?Object.fromEntries(l.map(({accessor:i,title:C})=>[i,C??se(String(i))])):void 0,u=_e(Za,{className:Ya("mantine-datatable-header",t),style:o,ref:k,onContextMenu:s?i=>{i.preventDefault(),x(C=>!C)}:void 0,children:[f&&_e(oo,{children:[S,f.map(i=>q(zt,{group:i},i.id))]}),_e(oo,{children:[!f&&S,l.map(({hidden:i,...C},v)=>{if(i)return null;let{accessor:I,visibleMediaQuery:A,textAlign:V,width:B,title:G,sortable:L,draggable:j,toggleable:$,resizable:ue,titleClassName:me,titleStyle:pe,filter:fe,filterPopoverProps:ee,filterPopoverDisableClickOutside:be,filtering:Te,sortKey:X}={...c,...C};return q(jt,{accessor:I,className:me,style:pe,visibleMediaQuery:A,textAlign:V,width:B,title:G,sortable:L,draggable:j,toggleable:$,resizable:ue&&v<l.length-1,sortStatus:n,sortIcons:a,sortKey:X,onSortStatusChange:r,filter:fe,filterPopoverProps:ee,filterPopoverDisableClickOutside:be,filtering:Te},I)})]})]});return s?_e(Qa,{position:"bottom",withArrow:!0,shadow:"md",opened:P,onChange:x,children:[q(Ka,{children:u}),q(Ua,{children:q(Ja,{children:w.filter(i=>i.toggleable).map(i=>q(Xa,{children:q($a,{classNames:{label:"mantine-datatable-header-column-toggle-checkbox-label"},size:"xs",label:D[i.accessor],checked:i.toggled,onChange:C=>{E(w.map(v=>v.accessor===i.accessor?{...v,toggled:C.currentTarget.checked}:v))}})},i.accessor))})})]}):u}import{Center as ja,Loader as er}from"@mantine/core";import tr from"clsx";import{jsx as ao}from"react/jsx-runtime";function ro({fetching:e,customContent:t,backgroundBlur:o,size:n,type:a,color:r}){return ao(ja,{className:tr("mantine-datatable-loader",{"mantine-datatable-loader-fetching":e}),style:[{backdropFilter:o?`blur(${o}px)`:void 0}],children:e&&(t||ao(er,{size:n,type:a,color:r}))})}import{Box as ur,Pagination as mr,Text as pr,rem as fr}from"@mantine/core";import fo from"clsx";import{Button as ar,Group as rr,Menu as lr,MenuDropdown as ir,MenuItem as sr,MenuTarget as cr,Text as co,rem as we}from"@mantine/core";import dr from"clsx";import{parseThemeColor as or}from"@mantine/core";function N(e,t,o){return e?or({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function lo({theme:e,c:t,backgroundColor:o,borderColor:n,rowBorderColor:a,stripedColor:r,highlightOnHoverColor:l}){return{"--mantine-datatable-color-light":N(t,e,"light"),"--mantine-datatable-color-dark":N(t,e,"dark"),"--mantine-datatable-background-color-light":N(o,e,"light"),"--mantine-datatable-background-color-dark":N(o,e,"dark"),"--mantine-datatable-border-color-light":N(n,e,"light"),"--mantine-datatable-border-color-dark":N(n,e,"dark"),"--mantine-datatable-row-border-color-light":N(a,e,"light"),"--mantine-datatable-row-border-color-dark":N(a,e,"dark"),"--mantine-datatable-striped-color-light":N(r,e,"light"),"--mantine-datatable-striped-color-dark":N(r,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":N(l,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":N(l,e,"dark")}}function ze({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":N(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":N(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":N(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":N(o,e,"dark")}}function io({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":N(t,e,"light"),"--mantine-datatable-row-color-dark":N(t,e,"dark"),"--mantine-datatable-row-background-color-light":N(o,e,"light"),"--mantine-datatable-row-background-color-dark":N(o,e,"dark")}}import{jsx as rt,jsxs as nr}from"react/jsx-runtime";function so(){return nr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[rt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),rt("path",{d:"M8 9l4 -4l4 4"}),rt("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as ae,jsxs as mo}from"react/jsx-runtime";var uo={xs:we(22),sm:we(26),md:we(32),lg:we(38),xl:we(44)};function po({size:e,label:t,values:o,value:n,activeTextColor:a,activeBackgroundColor:r,onChange:l}){return mo(rr,{gap:"xs",children:[ae(co,{component:"div",size:e,children:t}),mo(lr,{withinPortal:!0,withArrow:!0,offset:2,classNames:{arrow:"mantine-datatable-page-size-selector-menu-arrow"},children:[ae(cr,{children:ae(ar,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:ae(so,{}),style:[{fontWeight:"normal"},c=>({height:uo[e],paddingLeft:c.spacing[e],paddingRight:c.spacing[e]})],children:n})}),ae(ir,{children:o.map(c=>{let f=c===n;return ae(sr,{className:dr({"mantine-datatable-page-size-selector-active":f}),style:[{height:uo[e]},f&&(a||r)?b=>ze({theme:b,paginationActiveTextColor:a,paginationActiveBackgroundColor:r}):void 0],disabled:f,onClick:()=>l(c),children:ae(co,{component:"div",size:e,children:c})},c)})})]})]})}import{jsx as lt,jsxs as br}from"react/jsx-runtime";function bo({className:e,style:t,fetching:o,page:n,onPageChange:a,paginationWithEdges:r,paginationWithControls:l,paginationActiveTextColor:c,paginationActiveBackgroundColor:f,paginationSize:b,loadingText:d,noRecordsText:g,paginationText:m,totalRecords:p,recordsPerPage:T,onRecordsPerPageChange:M,recordsPerPageLabel:h,recordsPerPageOptions:y,recordsLength:k,horizontalSpacing:S,paginationWrapBreakpoint:w,getPaginationControlProps:E}){let P;if(p){let s=(n-1)*T+1,D=s+(k||0)-1;P=m({from:s,to:D,totalRecords:p})}else P=o?d:g;let x=K(({breakpoints:s})=>`(min-width: ${typeof w=="number"?`${fr(w)}rem`:s[w]||w})`);return br(ur,{px:S??"xs",py:"xs",className:fo("mantine-datatable-pagination",e),style:[{flexDirection:x?"row":"column"},t],children:[lt(pr,{component:"div",className:"mantine-datatable-pagination-text",size:b,children:P}),y&&lt(po,{activeTextColor:c,activeBackgroundColor:f,size:b,label:h,values:y,value:T,onChange:M}),lt(mr,{classNames:{root:fo("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!k}),control:"mantine-datatable-pagination-pages-control"},style:c||f?s=>ze({theme:s,paginationActiveTextColor:c,paginationActiveBackgroundColor:f}):void 0,withEdges:r,withControls:l,value:n,onChange:a,size:b,total:Math.ceil(p/T),getControlProps:E})]})}import{TableTr as Pr}from"@mantine/core";import vr from"clsx";import{TableTd as Tr}from"@mantine/core";import gr from"clsx";import{jsx as hr}from"react/jsx-runtime";function To({className:e,style:t,visibleMediaQuery:o,record:n,index:a,onClick:r,onDoubleClick:l,onContextMenu:c,noWrap:f,ellipsis:b,textAlign:d,width:g,accessor:m,render:p,defaultRender:T,customCellAttributes:M}){return K(o)?hr(Tr,{className:gr({[ce]:f||b,[de]:b,[F]:r||l,[Le]:c,[J]:d==="left",[Z]:d==="center",[Y]:d==="right"},e),style:[{width:g,minWidth:g,maxWidth:g},t],onClick:r,onDoubleClick:l,onContextMenu:c,...M?.(n,a),children:p?p(n,a):T?T(n,a,m):tt(n,m)}):null}import{Collapse as Cr,TableTd as yr,TableTr as go}from"@mantine/core";import{Fragment as xr,jsx as Se,jsxs as Dr}from"react/jsx-runtime";function ho({open:e,colSpan:t,content:o,collapseProps:n}){let{expanded:a,visible:r}=Wt(e,n?.transitionDuration);return r?Dr(xr,{children:[Se(go,{}),Se(go,{children:Se(yr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:Se(Cr,{in:a,...n,children:Se("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}import{Checkbox as wr,TableTd as Sr}from"@mantine/core";import Rr from"clsx";import{jsx as Co}from"react/jsx-runtime";function yo({className:e,style:t,record:o,index:n,trigger:a,onChange:r,withRightShadow:l,checkboxProps:c,getCheckboxProps:f,...b}){let d={...c,...f(o,n)},g=!b.disabled&&!d.disabled,m=p=>{p.stopPropagation(),a==="cell"&&g&&r?.(p)};return Co(Sr,{className:Rr("mantine-datatable-row-selector-cell",{[F]:a==="cell"&&g},e),style:t,"data-shadow-visible":l||void 0,onClick:m,children:Co(wr,{classNames:g?{input:F}:void 0,onChange:r,...b,...d})})}import{Fragment as xo,jsx as Ve,jsxs as Do}from"react/jsx-runtime";function wo({record:e,index:t,columns:o,defaultColumnProps:n,defaultColumnRender:a,selectionTrigger:r,selectionVisible:l,selectionChecked:c,onSelectionChange:f,isRecordSelectable:b,selectionCheckboxProps:d,getSelectionCheckboxProps:g,onClick:m,onDoubleClick:p,onContextMenu:T,onCellClick:M,onCellDoubleClick:h,onCellContextMenu:y,expansion:k,customAttributes:S,color:w,backgroundColor:E,className:P,style:x,selectorCellShadowVisible:s,selectionColumnClassName:D,selectionColumnStyle:u,rowFactory:i}){let C=Do(xo,{children:[l&&Ve(yo,{className:D,style:u,record:e,index:t,trigger:r,withRightShadow:s,checked:c,disabled:!f||(b?!b(e,t):!1),onChange:f,checkboxProps:d,getCheckboxProps:g}),o.map(({hidden:A,hiddenContent:V,...B},G)=>{if(A||V)return null;let{accessor:L,visibleMediaQuery:j,textAlign:$,noWrap:ue,ellipsis:me,width:pe,render:fe,cellsClassName:ee,cellsStyle:be,customCellAttributes:Te}={...n,...B};return Ve(To,{className:typeof ee=="function"?ee(e,t):ee,style:be?.(e,t),visibleMediaQuery:j,record:e,index:t,onClick:M?X=>M({event:X,record:e,index:t,column:B,columnIndex:G}):void 0,onDoubleClick:h?X=>h({event:X,record:e,index:t,column:B,columnIndex:G}):void 0,onContextMenu:y?X=>y({event:X,record:e,index:t,column:B,columnIndex:G}):void 0,accessor:L,textAlign:$,noWrap:ue,ellipsis:me,width:pe,render:fe,defaultRender:a,customCellAttributes:Te},L)})]}),v=k&&Ve(ho,{colSpan:o.filter(({hidden:A})=>!A).length+(l?1:0),open:k.isRowExpanded(e),content:k.content({record:e,index:t}),collapseProps:k.collapseProps}),I=Mr({record:e,index:t,selectionChecked:c,onClick:m,onDoubleClick:p,onContextMenu:T,expansion:k,customAttributes:S,color:w,backgroundColor:E,className:P,style:x});return i?i({record:e,index:t,rowProps:I,children:C,expandedElement:v}):Do(xo,{children:[Ve(Pr,{...I,children:C}),v]})}function Mr({record:e,index:t,selectionChecked:o,onClick:n,onDoubleClick:a,onContextMenu:r,expansion:l,customAttributes:c,color:f,backgroundColor:b,className:d,style:g}){return{className:vr("mantine-datatable-row",{[F]:n||a||l?.isExpandable({record:e,index:t})&&l?.expandOnClick},{[Le]:r},typeof d=="function"?d(e,t):d),"data-selected":o||void 0,onClick:m=>{if(l){let{isExpandable:p,isRowExpanded:T,expandOnClick:M,expandRow:h,collapseRow:y}=l;p({record:e,index:t})&&M&&(T(e)?y(e):h(e))}n?.({event:m,record:e,index:t})},onDoubleClick:a?m=>a({event:m,record:e,index:t}):void 0,onContextMenu:r?m=>r({event:m,record:e,index:t}):void 0,style:[f||b?m=>{let p=f?.(e,t),T=b?.(e,t);return io({theme:m,color:p,backgroundColor:T})}:void 0,g?.(e,t)],...c?.(e,t)??{}}}import{Box as So,ScrollArea as kr}from"@mantine/core";import Be from"clsx";import{jsx as Fe,jsxs as Er}from"react/jsx-runtime";function Ro({leftShadowBehind:e,rightShadowBehind:t,onScrollPositionChange:o,children:n,viewportRef:a,scrollAreaProps:r}){return Er(kr,{...r,viewportRef:a,classNames:{root:"mantine-datatable-scroll-area",scrollbar:"mantine-datatable-scroll-area-scrollbar",thumb:"mantine-datatable-scroll-area-thumb",corner:"mantine-datatable-scroll-area-corner"},onScrollPositionChange:o,children:[n,Fe(So,{className:Be("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow")}),Fe("div",{className:Be("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-behind":e})}),Fe("div",{className:Be("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-behind":t})}),Fe(So,{className:Be("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow")})]})}import{jsx as _,jsxs as ko}from"react/jsx-runtime";function Wr({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:n="100%",minHeight:a,maxHeight:r,shadow:l,verticalAlign:c="center",fetching:f,columns:b,storeColumnsKey:d,groups:g,pinFirstColumn:m,pinLastColumn:p,defaultColumnProps:T,defaultColumnRender:M,idAccessor:h="id",records:y,selectionTrigger:k="checkbox",selectedRecords:S,onSelectedRecordsChange:w,selectionColumnClassName:E,selectionColumnStyle:P,isRecordSelectable:x,selectionCheckboxProps:s,allRecordsSelectionCheckboxProps:D={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:u=(O,Ce)=>({"aria-label":`Select record ${Ce+1}`}),sortStatus:i,sortIcons:C,onSortStatusChange:v,horizontalSpacing:I,page:A,onPageChange:V,totalRecords:B,recordsPerPage:G,onRecordsPerPageChange:L,recordsPerPageOptions:j,recordsPerPageLabel:$="Records per page",paginationWithEdges:ue,paginationWithControls:me,paginationActiveTextColor:pe,paginationActiveBackgroundColor:fe,paginationSize:ee="sm",paginationText:be=({from:O,to:Ce,totalRecords:Re})=>`${O} - ${Ce} / ${Re}`,paginationWrapBreakpoint:Te="sm",getPaginationControlProps:X=O=>O==="previous"?{"aria-label":"Previous page"}:O==="next"?{"aria-label":"Next page"}:{},loaderBackgroundBlur:Eo,customLoader:No,loaderSize:Lo,loaderType:Wo,loaderColor:Io,loadingText:Ho="...",emptyState:Oo,noRecordsText:st="No records",noRecordsIcon:Ao,highlightOnHover:_o,striped:zo,noHeader:Vo,onRowClick:Bo,onRowDoubleClick:Fo,onRowContextMenu:Go,onCellClick:$o,onCellDoubleClick:Xo,onCellContextMenu:Qo,onScroll:Uo,onScrollToTop:Ko,onScrollToBottom:Jo,onScrollToLeft:Zo,onScrollToRight:Yo,c:qo,backgroundColor:jo,borderColor:en,rowBorderColor:tn,stripedColor:on,highlightOnHoverColor:nn,rowColor:an,rowBackgroundColor:rn,rowExpansion:ln,rowClassName:sn,rowStyle:cn,customRowAttributes:dn,scrollViewportRef:un,scrollAreaProps:mn,tableRef:pn,bodyRef:fn,m:bn,my:Tn,mx:gn,mt:hn,mb:Cn,ml:yn,mr:xn,className:Dn,classNames:ge,style:wn,styles:he,rowFactory:Sn,tableWrapper:Ge,...ct}){let O=Mo(()=>g?.flatMap(R=>R.columns)??b,[b,g]),Ce=Mo(()=>O.some(R=>R.resizable),[O]),Re=Ct({key:d,columns:O}),{refs:Q,onScroll:Rn}=St({scrollCallbacks:{onScroll:Uo,onScrollToTop:Ko,onScrollToBottom:Jo,onScrollToLeft:Zo,onScrollToRight:Yo},withRowBorders:ct.withRowBorders}),Pn=Po(Q.table,pn),vn=Po(Q.scrollViewport,un),Mn=Et({rowExpansion:ln,records:y,idAccessor:h}),kn=it(R=>{Q.scrollViewport.current?.scrollTo({top:0,left:0}),V(R)},[V,Q.scrollViewport]),Pe=y?.length,dt=y?.map(R=>W(R,h)),re=!!S,ye=S?.map(R=>W(R,h)),ut=dt!==void 0&&ye!==void 0&&ye.length>0,$e=x?y?.filter(x):y,ve=$e?.map(R=>W(R,h)),Me=ut&&ve.every(R=>ye.includes(R)),En=ut&&ve.some(R=>ye.includes(R)),Nn=it(()=>{S&&w&&w(Me?S.filter(R=>!ve.includes(W(R,h))):Ne([...S,...$e],R=>W(R,h)))},[Me,h,w,ve,$e,S]),{lastSelectionChangeIndex:ke,setLastSelectionChangeIndex:Ln}=Rt(dt),Xe=re&&!m,Wn={m:bn,my:Tn,mx:gn,mt:hn,mb:Cn,ml:yn,mr:xn},In=it(({children:R})=>Ge?Ge({children:R}):R,[Ge]);return _(Ke,{...Re,children:ko(Nr,{ref:Q.root,...Wn,className:vo("mantine-datatable",{"mantine-datatable-with-border":e},Dn,ge?.root),style:[R=>({...lo({theme:R,c:qo,backgroundColor:jo,borderColor:en,rowBorderColor:tn,stripedColor:on,highlightOnHoverColor:nn}),borderRadius:R.radius[t]||t,boxShadow:R.shadows[l]||l,height:n,minHeight:a,maxHeight:r}),wn,he?.root,{position:"relative"}],children:[_(Ro,{viewportRef:vn,leftShadowBehind:re||!!m,rightShadowBehind:p,onScrollPositionChange:Rn,scrollAreaProps:mn,children:_(In,{children:ko(Lr,{ref:Pn,horizontalSpacing:I,className:vo("mantine-datatable-table",{[It]:o,"mantine-datatable-vertical-align-top":c==="top","mantine-datatable-vertical-align-bottom":c==="bottom","mantine-datatable-pin-last-column":p,"mantine-datatable-selection-column-visible":re,"mantine-datatable-pin-first-column":m,"mantine-datatable-resizable-columns":Ce},ge?.table),style:{...he?.table},"data-striped":Pe&&zo||void 0,"data-highlight-on-hover":_o||void 0,...ct,children:[Vo?null:_(Ke,{...Re,children:_(no,{ref:Q.header,selectionColumnHeaderRef:Q.selectionColumnHeader,className:ge?.header,style:he?.header,columns:O,defaultColumnProps:T,groups:g,sortStatus:i,sortIcons:C,onSortStatusChange:v,selectionTrigger:k,selectionVisible:re,selectionChecked:Me,selectionIndeterminate:En&&!Me,onSelectionChange:Nn,selectionCheckboxProps:{...s,...D},selectorCellShadowVisible:Xe,selectionColumnClassName:E,selectionColumnStyle:P})}),_("tbody",{ref:fn,children:Pe?y.map((R,xe)=>{let Qe=W(R,h),Ue=ye?.includes(Qe)||!1,mt;return w&&S&&(mt=Hn=>{if(Hn.nativeEvent.shiftKey&&ke!==null){let le=y.filter(xe>ke?(te,oe)=>oe>=ke&&oe<=xe&&(x?x(te,oe):!0):(te,oe)=>oe>=xe&&oe<=ke&&(x?x(te,oe):!0));w(Ue?kt(S,le,te=>W(te,h)):Ne([...S,...le],te=>W(te,h)))}else w(Ue?S.filter(le=>W(le,h)!==Qe):Ne([...S,R],le=>W(le,h)));Ln(xe)}),_(wo,{record:R,index:xe,columns:O,defaultColumnProps:T,defaultColumnRender:M,selectionTrigger:k,selectionVisible:re,selectionChecked:Ue,onSelectionChange:mt,isRecordSelectable:x,selectionCheckboxProps:s,getSelectionCheckboxProps:u,onClick:Bo,onDoubleClick:Fo,onCellClick:$o,onCellDoubleClick:Xo,onContextMenu:Go,onCellContextMenu:Qo,expansion:Mn,color:an,backgroundColor:rn,className:sn,style:cn,customAttributes:dn,selectorCellShadowVisible:Xe,selectionColumnClassName:E,selectionColumnStyle:P,idAccessor:h,rowFactory:Sn},Qe)}):_(Tt,{})}),O.some(({footer:R})=>R)&&_(At,{ref:Q.footer,className:ge?.footer,style:he?.footer,columns:O,defaultColumnProps:T,selectionVisible:re,selectorCellShadowVisible:Xe})]})})}),A&&_(bo,{className:ge?.pagination,style:he?.pagination,horizontalSpacing:I,fetching:f,page:A,onPageChange:kn,totalRecords:B,recordsPerPage:G,onRecordsPerPageChange:L,recordsPerPageOptions:j,recordsPerPageLabel:$,paginationWithEdges:ue,paginationWithControls:me,paginationActiveTextColor:pe,paginationActiveBackgroundColor:fe,paginationSize:ee,paginationText:be,paginationWrapBreakpoint:Te,getPaginationControlProps:X,noRecordsText:st,loadingText:Ho,recordsLength:Pe}),_(ro,{fetching:f,backgroundBlur:Eo,customContent:No,size:Lo,type:Wo,color:Io}),_(ht,{icon:Ao,text:st,active:!f&&!Pe,children:Oo})]})})}import{TableTr as Ir}from"@mantine/core";import{useMergedRef as Hr}from"@mantine/hooks";import{useEffect as Or,useRef as Ar}from"react";import{jsx as zr}from"react/jsx-runtime";function _r({className:e,children:t,isDragging:o,ref:n,...a}){let r=Ar(null),l=Hr(r,n);return Or(()=>{if(!r.current||!o)return;let d=r.current.parentElement.parentElement.children[0].children[0];for(let g=0;g<d.children.length;g++){let p=d.children[g].getBoundingClientRect(),T=r.current.children[g];T.style.height=p.height+"px",T.style.width=p.width+"px",T.style.minWidth=p.width+"px",T.style.maxWidth=p.width+"px"}},[o,t]),zr(Ir,{"data-is-dragging":o,ref:l,...a,className:e,children:t})}export{Wr as DataTable,_r as DataTableDraggableRow,kt as differenceBy,W as getRecordId,tt as getValueAtPath,se as humanize,Ml as reorderRecords,kl as swapRecords,Ne as uniqBy,Ct as useDataTableColumns};
2
2
  //# sourceMappingURL=index.mjs.map