@ctlyst.id/internal-ui 1.0.0 → 1.0.1-canary.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ Check the top-level render call using <`+ee+">.")}return F}}function uc(C,F){{if
47
47
  */function $t(e,t){return typeof e=="function"?e(t):e}function gt(e,t){return r=>{t.setState(o=>({...o,[e]:$t(r,o[e])}))}}function Io(e){return e instanceof Function}function Lm(e,t){const r=[],o=n=>{n.forEach(a=>{r.push(a);const i=t(a);i!=null&&i.length&&o(i)})};return o(e),r}function le(e,t,r){let o=[],n;return()=>{let a;r.key&&r.debug&&(a=Date.now());const i=e();if(!(i.length!==o.length||i.some((c,l)=>o[l]!==c)))return n;o=i;let s;if(r.key&&r.debug&&(s=Date.now()),n=t(...i),r==null||r.onChange==null||r.onChange(n),r.key&&r.debug&&r!=null&&r.debug()){const c=Math.round((Date.now()-a)*100)/100,l=Math.round((Date.now()-s)*100)/100,f=l/16,d=(p,g)=>{for(p=String(p);p.length<g;)p=" "+p;return p};console.info(`%c⏱ ${d(l,5)} /${d(c,5)} ms`,`
48
48
  font-size: .6rem;
49
49
  font-weight: bold;
50
- color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,r==null?void 0:r.key)}return n}}function jm(e,t,r,o){const a={...e._getDefaultColumnDef(),...t},i=a.accessorKey;let u=a.id??(i?i.replace(".","_"):void 0)??(typeof a.header=="string"?a.header:void 0),s;if(a.accessorFn?s=a.accessorFn:i&&(i.includes(".")?s=l=>{let f=l;for(const d of i.split("."))if(f=f[d],process.env.NODE_ENV!=="production"&&f===void 0)throw new Error(`"${d}" in deeply nested key "${i}" returned undefined.`);return f}:s=l=>l[a.accessorKey]),!u)throw process.env.NODE_ENV!=="production"?new Error(a.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let c={id:`${String(u)}`,accessorFn:s,parent:o,depth:r,columnDef:a,columns:[],getFlatColumns:le(()=>[!0],()=>{var l;return[c,...(l=c.columns)==null?void 0:l.flatMap(f=>f.getFlatColumns())]},{key:process.env.NODE_ENV==="production"&&"column.getFlatColumns",debug:()=>e.options.debugAll??e.options.debugColumns}),getLeafColumns:le(()=>[e._getOrderColumnsFn()],l=>{var f;if((f=c.columns)!=null&&f.length){let d=c.columns.flatMap(p=>p.getLeafColumns());return l(d)}return[c]},{key:process.env.NODE_ENV==="production"&&"column.getLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns})};return c=e._features.reduce((l,f)=>Object.assign(l,f.createColumn==null?void 0:f.createColumn(c,e)),c),c}function gc(e,t,r){let n={id:r.id??t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],i=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(i),a.push(u)};return i(n),a},getContext:()=>({table:e,header:n,column:t})};return e._features.forEach(a=>{Object.assign(n,a.createHeader==null?void 0:a.createHeader(n,e))}),n}const Gm={createTable:e=>({getHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,o,n)=>{const a=(o==null?void 0:o.map(c=>r.find(l=>l.id===c)).filter(Boolean))??[],i=(n==null?void 0:n.map(c=>r.find(l=>l.id===c)).filter(Boolean))??[],u=r.filter(c=>!(o!=null&&o.includes(c.id))&&!(n!=null&&n.includes(c.id)));return wn(t,[...a,...u,...i],e)},{key:process.env.NODE_ENV==="development"&&"getHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,o,n)=>(r=r.filter(a=>!(o!=null&&o.includes(a.id))&&!(n!=null&&n.includes(a.id))),wn(t,r,e,"center")),{key:process.env.NODE_ENV==="development"&&"getCenterHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,o)=>{const n=(o==null?void 0:o.map(a=>r.find(i=>i.id===a)).filter(Boolean))??[];return wn(t,n,e,"left")},{key:process.env.NODE_ENV==="development"&&"getLeftHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,o)=>{const n=(o==null?void 0:o.map(a=>r.find(i=>i.id===a)).filter(Boolean))??[];return wn(t,n,e,"right")},{key:process.env.NODE_ENV==="development"&&"getRightHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getFooterGroups:le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftFooterGroups:le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getLeftFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterFooterGroups:le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getCenterFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightFooterGroups:le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getRightFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getFlatHeaders:le(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftFlatHeaders:le(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getLeftFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterFlatHeaders:le(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getCenterFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightFlatHeaders:le(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getRightFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterLeafHeaders:le(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),{key:process.env.NODE_ENV==="development"&&"getCenterLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftLeafHeaders:le(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),{key:process.env.NODE_ENV==="development"&&"getLeftLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightLeafHeaders:le(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),{key:process.env.NODE_ENV==="development"&&"getRightLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeafHeaders:le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,o)=>{var n,a,i;return[...((n=t[0])==null?void 0:n.headers)??[],...((a=r[0])==null?void 0:a.headers)??[],...((i=o[0])==null?void 0:i.headers)??[]].map(u=>u.getLeafHeaders()).flat()},{key:process.env.NODE_ENV==="development"&&"getLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders})})};function wn(e,t,r,o){var n;let a=0;const i=function(f,d){d===void 0&&(d=1),a=Math.max(a,d),f.filter(p=>p.getIsVisible()).forEach(p=>{var g;(g=p.columns)!=null&&g.length&&i(p.columns,d+1)},0)};i(e);let u=[];const s=(f,d)=>{const p={depth:d,id:[o,`${d}`].filter(Boolean).join("_"),headers:[]},g=[];f.forEach(v=>{const h=[...g].reverse()[0],S=v.column.depth===p.depth;let D,P=!1;if(S&&v.column.parent?D=v.column.parent:(D=v.column,P=!0),h&&(h==null?void 0:h.column)===D)h.subHeaders.push(v);else{const w=gc(r,D,{id:[o,d,D.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:P,placeholderId:P?`${g.filter(y=>y.column===D).length}`:void 0,depth:d,index:g.length});w.subHeaders.push(v),g.push(w)}p.headers.push(v),v.headerGroup=p}),u.push(p),d>0&&s(g,d-1)},c=t.map((f,d)=>gc(r,f,{depth:a,index:d}));s(c,a-1),u.reverse();const l=f=>f.filter(p=>p.column.getIsVisible()).map(p=>{let g=0,v=0,h=[0];p.subHeaders&&p.subHeaders.length?(h=[],l(p.subHeaders).forEach(D=>{let{colSpan:P,rowSpan:w}=D;g+=P,h.push(w)})):g=1;const S=Math.min(...h);return v=v+S,p.colSpan=g,p.rowSpan=v,{colSpan:g,rowSpan:v}});return l(((n=u[0])==null?void 0:n.headers)??[]),u}const Cn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ya=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Hm={getDefaultColumnDef:()=>Cn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ya(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:gt("columnSizing",e),onColumnSizingInfoChange:gt("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{const r=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??Cn.minSize,r??e.columnDef.size??Cn.size),e.columnDef.maxSize??Cn.maxSize)},getStart:r=>{const o=r?r==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),n=o.findIndex(a=>a.id===e.id);if(n>0){const a=o[n-1];return a.getStart(r)+a.getSize()}return 0},resetSize:()=>{t.setColumnSizing(r=>{let{[e.id]:o,...n}=r;return n})},getCanResize:()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let r=0;const o=n=>{n.subHeaders.length?n.subHeaders.forEach(o):r+=n.column.getSize()??0};return o(e),r},getStart:()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},getResizeHandler:()=>{const r=t.getColumn(e.column.id),o=r.getCanResize();return n=>{if(!o||(n.persist==null||n.persist(),za(n)&&n.touches&&n.touches.length>1))return;const a=e.getSize(),i=e?e.getLeafHeaders().map(g=>[g.column.id,g.column.getSize()]):[[r.id,r.getSize()]],u=za(n)?Math.round(n.touches[0].clientX):n.clientX,s=(g,v)=>{if(typeof v!="number")return;let h={};t.setColumnSizingInfo(S=>{const D=v-((S==null?void 0:S.startOffset)??0),P=Math.max(D/((S==null?void 0:S.startSize)??0),-.999999);return S.columnSizingStart.forEach(w=>{let[y,k]=w;h[y]=Math.round(Math.max(k+k*P,0)*100)/100}),{...S,deltaOffset:D,deltaPercentage:P}}),(t.options.columnResizeMode==="onChange"||g==="end")&&t.setColumnSizing(S=>({...S,...h}))},c=g=>s("move",g),l=g=>{s("end",g),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f={moveHandler:g=>c(g.clientX),upHandler:g=>{document.removeEventListener("mousemove",f.moveHandler),document.removeEventListener("mouseup",f.upHandler),l(g.clientX)}},d={moveHandler:g=>(g.cancelable&&(g.preventDefault(),g.stopPropagation()),c(g.touches[0].clientX),!1),upHandler:g=>{var v;document.removeEventListener("touchmove",d.moveHandler),document.removeEventListener("touchend",d.upHandler),g.cancelable&&(g.preventDefault(),g.stopPropagation()),l((v=g.touches[0])==null?void 0:v.clientX)}},p=Wm()?{passive:!1}:!1;za(n)?(document.addEventListener("touchmove",d.moveHandler,p),document.addEventListener("touchend",d.upHandler,p)):(document.addEventListener("mousemove",f.moveHandler,p),document.addEventListener("mouseup",f.upHandler,p)),t.setColumnSizingInfo(g=>({...g,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,isResizingColumn:r.id}))}}}),createTable:e=>({setColumnSizing:t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},resetHeaderSizeInfo:t=>{e.setColumnSizingInfo(t?Ya():e.initialState.columnSizingInfo??Ya())},getTotalSize:()=>{var t;return((t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0},getLeftTotalSize:()=>{var t;return((t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0},getCenterTotalSize:()=>{var t;return((t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0},getRightTotalSize:()=>{var t;return((t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0}})};let _n=null;function Wm(){if(typeof _n=="boolean")return _n;let e=!1;try{const t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return _n=e,_n}function za(e){return e.type==="touchstart"}const $m={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:gt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;return{_autoResetExpanded:()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},setExpanded:o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),toggleAllRowsExpanded:o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:o=>{var n;e.setExpanded(o?{}:((n=e.initialState)==null?void 0:n.expanded)??{})},getCanSomeRowsExpand:()=>e.getRowModel().flatRows.some(o=>o.getCanExpand()),getToggleAllRowsExpandedHandler:()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},getIsAllRowsExpanded:()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows.some(n=>!n.getIsExpanded()))},getExpandedDepth:()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const i=a.split(".");o=Math.max(o,i.length)}),o},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:r=>{t.setExpanded(o=>{const n=o===!0?!0:!!(o!=null&&o[e.id]);let a={};if(o===!0?Object.keys(t.getRowModel().rowsById).forEach(i=>{a[i]=!0}):a=o,r=r??!n,!n&&r)return{...a,[e.id]:!0};if(n&&!r){const{[e.id]:i,...u}=a;return u}return o})},getIsExpanded:()=>{const r=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(r===!0||r!=null&&r[e.id]))},getCanExpand:()=>{var r;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((r=e.subRows)!=null&&r.length))},getToggleExpandedHandler:()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}})},$d=(e,t,r)=>{var o;const n=r.toLowerCase();return(o=e.getValue(t))==null?void 0:o.toLowerCase().includes(n)};$d.autoRemove=e=>wt(e);const Yd=(e,t,r)=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)};Yd.autoRemove=e=>wt(e);const zd=(e,t,r)=>{var o;return((o=e.getValue(t))==null?void 0:o.toLowerCase())===r.toLowerCase()};zd.autoRemove=e=>wt(e);const Xd=(e,t,r)=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)};Xd.autoRemove=e=>wt(e)||!(e!=null&&e.length);const Zd=(e,t,r)=>!r.some(o=>{var n;return!((n=e.getValue(t))!=null&&n.includes(o))});Zd.autoRemove=e=>wt(e)||!(e!=null&&e.length);const Ud=(e,t,r)=>r.some(o=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(o)});Ud.autoRemove=e=>wt(e)||!(e!=null&&e.length);const Jd=(e,t,r)=>e.getValue(t)===r;Jd.autoRemove=e=>wt(e);const qd=(e,t,r)=>e.getValue(t)==r;qd.autoRemove=e=>wt(e);const xs=(e,t,r)=>{let[o,n]=r;const a=e.getValue(t);return a>=o&&a<=n};xs.resolveFilterValue=e=>{let[t,r]=e,o=typeof t!="number"?parseFloat(t):t,n=typeof r!="number"?parseFloat(r):r,a=t===null||Number.isNaN(o)?-1/0:o,i=r===null||Number.isNaN(n)?1/0:n;if(a>i){const u=a;a=i,i=u}return[a,i]};xs.autoRemove=e=>wt(e)||wt(e[0])&&wt(e[1]);const Ft={includesString:$d,includesStringSensitive:Yd,equalsString:zd,arrIncludes:Xd,arrIncludesAll:Zd,arrIncludesSome:Ud,equals:Jd,weakEquals:qd,inNumberRange:xs};function wt(e){return e==null||e===""}const Ym={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:gt("columnFilters",e),onGlobalFilterChange:gt("globalFilter",e),filterFromLeafRows:!1,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r,o;const n=(r=e.getCoreRowModel().flatRows[0])==null||(o=r._getAllCellsByColumnId()[t.id])==null?void 0:o.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const r=t.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(e.id);return typeof o=="string"?Ft.includesString:typeof o=="number"?Ft.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Ft.equals:Array.isArray(o)?Ft.arrIncludes:Ft.weakEquals},getFilterFn:()=>{var r;return Io(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():((r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])??Ft[e.columnDef.filterFn]},getCanFilter:()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,getCanGlobalFilter:()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn,getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var r,o;return(r=t.getState().columnFilters)==null||(o=r.find(n=>n.id===e.id))==null?void 0:o.value},getFilterIndex:()=>{var r;return((r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))??-1},setFilterValue:r=>{t.setColumnFilters(o=>{const n=e.getFilterFn(),a=o==null?void 0:o.find(s=>s.id===e.id),i=$t(r,a?a.value:void 0);if(mc(n,i,e))return(o==null?void 0:o.filter(s=>s.id!==e.id))??[];const u={id:e.id,value:i};return a?(o==null?void 0:o.map(s=>s.id===e.id?u:s))??[]:o!=null&&o.length?[...o,u]:[u]})},_getFacetedRowModel:t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),_getFacetedUniqueValues:t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>Ft.includesString,getGlobalFilterFn:()=>{var t;const{globalFilterFn:r}=e.options;return Io(r)?r:r==="auto"?e.getGlobalAutoFilterFn():((t=e.options.filterFns)==null?void 0:t[r])??Ft[r]},setColumnFilters:t=>{const r=e.getAllLeafColumns(),o=n=>{var a;return(a=$t(t,n))==null?void 0:a.filter(i=>{const u=r.find(s=>s.id===i.id);if(u){const s=u.getFilterFn();if(mc(s,i.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var r;e.setColumnFilters(t?[]:((r=e.initialState)==null?void 0:r.columnFilters)??[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function mc(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}const zm=(e,t,r)=>r.reduce((o,n)=>{const a=n.getValue(e);return o+(typeof a=="number"?a:0)},0),Xm=(e,t,r)=>{let o;return r.forEach(n=>{const a=n.getValue(e);a!=null&&(o>a||o===void 0&&a>=a)&&(o=a)}),o},Zm=(e,t,r)=>{let o;return r.forEach(n=>{const a=n.getValue(e);a!=null&&(o<a||o===void 0&&a>=a)&&(o=a)}),o},Um=(e,t,r)=>{let o,n;return r.forEach(a=>{const i=a.getValue(e);i!=null&&(o===void 0?i>=i&&(o=n=i):(o>i&&(o=i),n<i&&(n=i)))}),[o,n]},Jm=(e,t)=>{let r=0,o=0;if(t.forEach(n=>{let a=n.getValue(e);a!=null&&(a=+a)>=a&&(++r,o+=a)}),r)return o/r},qm=(e,t)=>{if(!t.length)return;let r=0,o=0;return t.forEach(n=>{let a=n.getValue(e);typeof a=="number"&&(r=Math.min(r,a),o=Math.max(o,a))}),(r+o)/2},Qm=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),Km=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,eh=(e,t)=>t.length,Xa={sum:zm,min:Xm,max:Zm,extent:Um,mean:Jm,median:qm,unique:Qm,uniqueCount:Km,count:eh},th={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:gt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(o=>o!==e.id):[...r??[],e.id])},getCanGroup:()=>e.columnDef.enableGrouping??!0??t.options.enableGrouping??!0??!!e.accessorFn,getIsGrouped:()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},getGroupedIndex:()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},getToggleGroupingHandler:()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const r=t.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(e.id);if(typeof o=="number")return Xa.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Xa.extent},getAggregationFn:()=>{var r;if(!e)throw new Error;return Io(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():((r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])??Xa[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var r;e.setGrouping(t?[]:((r=e.initialState)==null?void 0:r.grouping)??[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:e=>({getIsGrouped:()=>!!e.groupingColumnId,_groupingValuesCache:{}}),createCell:(e,t,r,o)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===r.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var n;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((n=r.subRows)!=null&&n.length)}})};function rh(e,t,r){if(!(t!=null&&t.length)||!r)return e;const o=e.filter(a=>!t.includes(a.id));return r==="remove"?o:[...t.map(a=>e.find(i=>i.id===a)).filter(Boolean),...o]}const nh={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:gt("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},_getOrderColumnsFn:le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,o)=>n=>{let a=[];if(!(t!=null&&t.length))a=n;else{const i=[...t],u=[...n];for(;u.length&&i.length;){const s=i.shift(),c=u.findIndex(l=>l.id===s);c>-1&&a.push(u.splice(c,1)[0])}a=[...a,...u]}return rh(a,r,o)},{key:process.env.NODE_ENV==="development"&&"getOrderColumnsFn"})})},Ni=0,Bi=10,Za=()=>({pageIndex:Ni,pageSize:Bi}),oh={getInitialState:e=>({...e,pagination:{...Za(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:gt("pagination",e)}),createTable:e=>{let t=!1,r=!1;return{_autoResetPageIndex:()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},setPagination:o=>{const n=a=>$t(o,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(n)},resetPagination:o=>{e.setPagination(o?Za():e.initialState.pagination??Za())},setPageIndex:o=>{e.setPagination(n=>{let a=$t(o,n.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.min(Math.max(0,a),i),{...n,pageIndex:a}})},resetPageIndex:o=>{var n,a;e.setPageIndex(o?Ni:((n=e.initialState)==null||(a=n.pagination)==null?void 0:a.pageIndex)??Ni)},resetPageSize:o=>{var n,a;e.setPageSize(o?Bi:((n=e.initialState)==null||(a=n.pagination)==null?void 0:a.pageSize)??Bi)},setPageSize:o=>{e.setPagination(n=>{const a=Math.max(1,$t(o,n.pageSize)),i=n.pageSize*n.pageIndex,u=Math.floor(i/a);return{...n,pageIndex:u,pageSize:a}})},setPageCount:o=>e.setPagination(n=>{let a=$t(o,e.options.pageCount??-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...n,pageCount:a}}),getPageOptions:le(()=>[e.getPageCount()],o=>{let n=[];return o&&o>0&&(n=[...new Array(o)].fill(null).map((a,i)=>i)),n},{key:process.env.NODE_ENV==="development"&&"getPageOptions",debug:()=>e.options.debugAll??e.options.debugTable}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:o}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:o<n-1},previousPage:()=>e.setPageIndex(o=>o-1),nextPage:()=>e.setPageIndex(o=>o+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>e.options.pageCount??Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}},Ua=()=>({left:[],right:[]}),ah={getInitialState:e=>({columnPinning:Ua(),...e}),getDefaultOptions:e=>({onColumnPinningChange:gt("columnPinning",e)}),createColumn:(e,t)=>({pin:r=>{const o=e.getLeafColumns().map(n=>n.id).filter(Boolean);t.setColumnPinning(n=>r==="right"?{left:((n==null?void 0:n.left)??[]).filter(a=>!(o!=null&&o.includes(a))),right:[...((n==null?void 0:n.right)??[]).filter(a=>!(o!=null&&o.includes(a))),...o]}:r==="left"?{left:[...((n==null?void 0:n.left)??[]).filter(a=>!(o!=null&&o.includes(a))),...o],right:((n==null?void 0:n.right)??[]).filter(a=>!(o!=null&&o.includes(a)))}:{left:((n==null?void 0:n.left)??[]).filter(a=>!(o!=null&&o.includes(a))),right:((n==null?void 0:n.right)??[]).filter(a=>!(o!=null&&o.includes(a)))})},getCanPin:()=>e.getLeafColumns().some(o=>(o.columnDef.enablePinning??!0)&&(t.options.enablePinning??!0)),getIsPinned:()=>{const r=e.getLeafColumns().map(u=>u.id),{left:o,right:n}=t.getState().columnPinning,a=r.some(u=>o==null?void 0:o.includes(u)),i=r.some(u=>n==null?void 0:n.includes(u));return a?"left":i?"right":!1},getPinnedIndex:()=>{var r,o;const n=e.getIsPinned();return n?((r=t.getState().columnPinning)==null||(o=r[n])==null?void 0:o.indexOf(e.id))??-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,o,n)=>{const a=[...o??[],...n??[]];return r.filter(i=>!a.includes(i.column.id))},{key:process.env.NODE_ENV==="production"&&"row.getCenterVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows}),getLeftVisibleCells:le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(r,o)=>(o??[]).map(a=>r.find(i=>i.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),{key:process.env.NODE_ENV==="production"&&"row.getLeftVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows}),getRightVisibleCells:le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,o)=>(o??[]).map(a=>r.find(i=>i.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),{key:process.env.NODE_ENV==="production"&&"row.getRightVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows})}),createTable:e=>({setColumnPinning:t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var r;return e.setColumnPinning(t?Ua():((r=e.initialState)==null?void 0:r.columnPinning)??Ua())},getIsSomeColumnsPinned:t=>{var r;const o=e.getState().columnPinning;if(!t){var n,a;return!!((n=o.left)!=null&&n.length||(a=o.right)!=null&&a.length)}return!!((r=o[t])!=null&&r.length)},getLeftLeafColumns:le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(o=>t.find(n=>n.id===o)).filter(Boolean),{key:process.env.NODE_ENV==="development"&&"getLeftLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns}),getRightLeafColumns:le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(o=>t.find(n=>n.id===o)).filter(Boolean),{key:process.env.NODE_ENV==="development"&&"getRightLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns}),getCenterLeafColumns:le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,o)=>{const n=[...r??[],...o??[]];return t.filter(a=>!n.includes(a.id))},{key:process.env.NODE_ENV==="development"&&"getCenterLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns})})},ih={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:gt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),toggleAllRowsSelected:t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const o={...r},n=e.getPreGroupedRowModel().flatRows;return t?n.forEach(a=>{a.getCanSelect()&&(o[a.id]=!0)}):n.forEach(a=>{delete o[a.id]}),o})},toggleAllPageRowsSelected:t=>e.setRowSelection(r=>{const o=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),n={...r};return e.getRowModel().rows.forEach(a=>{Vi(n,a.id,o,e)}),n}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?Ja(e,r):{rows:[],flatRows:[],rowsById:{}},{key:process.env.NODE_ENV==="development"&&"getSelectedRowModel",debug:()=>e.options.debugAll??e.options.debugTable}),getFilteredSelectedRowModel:le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?Ja(e,r):{rows:[],flatRows:[],rowsById:{}},{key:process.env.NODE_ENV==="production"&&"getFilteredSelectedRowModel",debug:()=>e.options.debugAll??e.options.debugTable}),getGroupedSelectedRowModel:le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?Ja(e,r):{rows:[],flatRows:[],rowsById:{}},{key:process.env.NODE_ENV==="production"&&"getGroupedSelectedRowModel",debug:()=>e.options.debugAll??e.options.debugTable}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let o=!!(t.length&&Object.keys(r).length);return o&&t.some(n=>n.getCanSelect()&&!r[n.id])&&(o=!1),o},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows,{rowSelection:r}=e.getState();let o=!!t.length;return o&&t.some(n=>!r[n.id])&&(o=!1),o},getIsSomeRowsSelected:()=>{const t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},getIsSomePageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.some(r=>r.getIsSelected()||r.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:r=>{const o=e.getIsSelected();t.setRowSelection(n=>{if(r=typeof r<"u"?r:!o,o===r)return n;const a={...n};return Vi(a,e.id,r,t),a})},getIsSelected:()=>{const{rowSelection:r}=t.getState();return Ss(e,r)},getIsSomeSelected:()=>{const{rowSelection:r}=t.getState();return hc(e,r)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:r}=t.getState();return hc(e,r)==="all"},getCanSelect:()=>typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,getCanSelectSubRows:()=>typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,getCanMultiSelect:()=>typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,getToggleSelectedHandler:()=>{const r=e.getCanSelect();return o=>{var n;r&&e.toggleSelected((n=o.target)==null?void 0:n.checked)}}})},Vi=(e,t,r,o)=>{var n;const a=o.getRow(t);r?(a.getCanMultiSelect()||Object.keys(e).forEach(i=>delete e[i]),a.getCanSelect()&&(e[t]=!0)):delete e[t],(n=a.subRows)!=null&&n.length&&a.getCanSelectSubRows()&&a.subRows.forEach(i=>Vi(e,i.id,r,o))};function Ja(e,t){const r=e.getState().rowSelection,o=[],n={},a=function(i,u){return i.map(s=>{var c;const l=Ss(s,r);if(l&&(o.push(s),n[s.id]=s),(c=s.subRows)!=null&&c.length&&(s={...s,subRows:a(s.subRows)}),l)return s}).filter(Boolean)};return{rows:a(t.rows),flatRows:o,rowsById:n}}function Ss(e,t){return t[e.id]??!1}function hc(e,t,r){if(e.subRows&&e.subRows.length){let o=!0,n=!1;return e.subRows.forEach(a=>{n&&!o||(Ss(a,t)?n=!0:o=!1)}),o?"all":n?"some":!1}return!1}const Li=/([0-9]+)/gm,uh=(e,t,r)=>Qd(Ut(e.getValue(r)).toLowerCase(),Ut(t.getValue(r)).toLowerCase()),sh=(e,t,r)=>Qd(Ut(e.getValue(r)),Ut(t.getValue(r))),ch=(e,t,r)=>Is(Ut(e.getValue(r)).toLowerCase(),Ut(t.getValue(r)).toLowerCase()),lh=(e,t,r)=>Is(Ut(e.getValue(r)),Ut(t.getValue(r))),fh=(e,t,r)=>{const o=e.getValue(r),n=t.getValue(r);return o>n?1:o<n?-1:0},dh=(e,t,r)=>Is(e.getValue(r),t.getValue(r));function Is(e,t){return e===t?0:e>t?1:-1}function Ut(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Qd(e,t){const r=e.split(Li).filter(Boolean),o=t.split(Li).filter(Boolean);for(;r.length&&o.length;){const n=r.shift(),a=o.shift(),i=parseInt(n,10),u=parseInt(a,10),s=[i,u].sort();if(isNaN(s[0])){if(n>a)return 1;if(a>n)return-1;continue}if(isNaN(s[1]))return isNaN(i)?-1:1;if(i>u)return 1;if(u>i)return-1}return r.length-o.length}const $r={alphanumeric:uh,alphanumericCaseSensitive:sh,text:ch,textCaseSensitive:lh,datetime:fh,basic:dh},ph={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto"}),getDefaultOptions:e=>({onSortingChange:gt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const r=t.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const n of r){const a=n==null?void 0:n.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return $r.datetime;if(typeof a=="string"&&(o=!0,a.split(Li).length>1))return $r.alphanumeric}return o?$r.text:$r.basic},getAutoSortDir:()=>{const r=t.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var r;if(!e)throw new Error;return Io(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():((r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])??$r[e.columnDef.sortingFn]},toggleSorting:(r,o)=>{const n=e.getNextSortingOrder(),a=typeof r<"u"&&r!==null;t.setSorting(i=>{const u=i==null?void 0:i.find(d=>d.id===e.id),s=i==null?void 0:i.findIndex(d=>d.id===e.id);let c=[],l,f=a?r:n==="desc";return i!=null&&i.length&&e.getCanMultiSort()&&o?u?l="toggle":l="add":i!=null&&i.length&&s!==i.length-1?l="replace":u?l="toggle":l="replace",l==="toggle"&&(a||n||(l="remove")),l==="add"?(c=[...i,{id:e.id,desc:f}],c.splice(0,c.length-(t.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):l==="toggle"?c=i.map(d=>d.id===e.id?{...d,desc:f}:d):l==="remove"?c=i.filter(d=>d.id!==e.id):c=[{id:e.id,desc:f}],c})},getFirstSortDir:()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()==="desc"?"desc":"asc",getNextSortingOrder:r=>{const o=e.getFirstSortDir(),n=e.getIsSorted();return n?n!==o&&(t.options.enableSortingRemoval??!0)&&(!r||(t.options.enableMultiRemove??!0))?!1:n==="desc"?"asc":"desc":o},getCanSort:()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,getCanMultiSort:()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,getIsSorted:()=>{var r;const o=(r=t.getState().sorting)==null?void 0:r.find(n=>n.id===e.id);return o?o.desc?"desc":"asc":!1},getSortIndex:()=>{var r;return((r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))??-1},clearSorting:()=>{t.setSorting(r=>r!=null&&r.length?r.filter(o=>o.id!==e.id):[])},getToggleSortingHandler:()=>{const r=e.getCanSort();return o=>{r&&(o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(o):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var r;e.setSorting(t?[]:((r=e.initialState)==null?void 0:r.sorting)??[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},gh={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:gt("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:r=>{e.getCanHide()&&t.setColumnVisibility(o=>({...o,[e.id]:r??!e.getIsVisible()}))},getIsVisible:()=>{var r;return((r=t.getState().columnVisibility)==null?void 0:r[e.id])??!0},getCanHide:()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),getToggleVisibilityHandler:()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:le(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(o=>o.column.getIsVisible()),{key:process.env.NODE_ENV==="production"&&"row._getAllVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows}),getVisibleCells:le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,o,n)=>[...r,...o,...n],{key:process.env.NODE_ENV==="development"&&"row.getVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows})}),createTable:e=>{const t=(r,o)=>le(()=>[o(),o().filter(n=>n.getIsVisible()).map(n=>n.id).join("_")],n=>n.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),{key:r,debug:()=>e.options.debugAll??e.options.debugColumns});return{getVisibleFlatColumns:t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),resetColumnVisibility:r=>{e.setColumnVisibility(r?{}:e.initialState.columnVisibility??{})},toggleAllColumnsVisible:r=>{r=r??!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,n)=>({...o,[n.id]:r||!(n.getCanHide!=null&&n.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>r=>{var o;e.toggleAllColumnsVisible((o=r.target)==null?void 0:o.checked)}}}},vc=[Gm,gh,nh,ah,Ym,ph,th,$m,oh,ih,Hm];function mh(e){(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let t={_features:vc};const r=t._features.reduce((c,l)=>Object.assign(c,l.getDefaultOptions==null?void 0:l.getDefaultOptions(t)),{}),o=c=>t.options.mergeOptions?t.options.mergeOptions(r,c):{...r,...c};let a={...{},...e.initialState??{}};t._features.forEach(c=>{a=(c.getInitialState==null?void 0:c.getInitialState(a))??a});const i=[];let u=!1;const s={_features:vc,options:{...r,...e},initialState:a,_queue:c=>{i.push(c),u||(u=!0,Promise.resolve().then(()=>{for(;i.length;)i.shift()();u=!1}).catch(l=>setTimeout(()=>{throw l})))},reset:()=>{t.setState(t.initialState)},setOptions:c=>{const l=$t(c,t.options);t.options=o(l)},getState:()=>t.options.state,setState:c=>{t.options.onStateChange==null||t.options.onStateChange(c)},_getRowId:(c,l,f)=>(t.options.getRowId==null?void 0:t.options.getRowId(c,l,f))??`${f?[f.id,l].join("."):l}`,getCoreRowModel:()=>(t._getCoreRowModel||(t._getCoreRowModel=t.options.getCoreRowModel(t)),t._getCoreRowModel()),getRowModel:()=>t.getPaginationRowModel(),getRow:c=>{const l=t.getRowModel().rowsById[c];if(!l)throw process.env.NODE_ENV!=="production"?new Error(`getRow expected an ID, but got ${c}`):new Error;return l},_getDefaultColumnDef:le(()=>[t.options.defaultColumn],c=>(c=c??{},{header:l=>{const f=l.header.column.columnDef;return f.accessorKey?f.accessorKey:f.accessorFn?f.id:null},cell:l=>{var f;return((f=l.renderValue())==null||f.toString==null?void 0:f.toString())??null},...t._features.reduce((l,f)=>Object.assign(l,f.getDefaultColumnDef==null?void 0:f.getDefaultColumnDef()),{}),...c}),{debug:()=>t.options.debugAll??t.options.debugColumns,key:process.env.NODE_ENV==="development"&&"getDefaultColumnDef"}),_getColumnDefs:()=>t.options.columns,getAllColumns:le(()=>[t._getColumnDefs()],c=>{const l=function(f,d,p){return p===void 0&&(p=0),f.map(g=>{const v=jm(t,g,p,d),h=g;return v.columns=h.columns?l(h.columns,v,p+1):[],v})};return l(c)},{key:process.env.NODE_ENV==="development"&&"getAllColumns",debug:()=>t.options.debugAll??t.options.debugColumns}),getAllFlatColumns:le(()=>[t.getAllColumns()],c=>c.flatMap(l=>l.getFlatColumns()),{key:process.env.NODE_ENV==="development"&&"getAllFlatColumns",debug:()=>t.options.debugAll??t.options.debugColumns}),_getAllFlatColumnsById:le(()=>[t.getAllFlatColumns()],c=>c.reduce((l,f)=>(l[f.id]=f,l),{}),{key:process.env.NODE_ENV==="development"&&"getAllFlatColumnsById",debug:()=>t.options.debugAll??t.options.debugColumns}),getAllLeafColumns:le(()=>[t.getAllColumns(),t._getOrderColumnsFn()],(c,l)=>{let f=c.flatMap(d=>d.getLeafColumns());return l(f)},{key:process.env.NODE_ENV==="development"&&"getAllLeafColumns",debug:()=>t.options.debugAll??t.options.debugColumns}),getColumn:c=>{const l=t._getAllFlatColumnsById()[c];if(!l)throw process.env.NODE_ENV!=="production"&&console.warn(`[Table] Column with id ${c} does not exist.`),new Error;return l}};return Object.assign(t,s),t._features.forEach(c=>Object.assign(t,c.createTable==null?void 0:c.createTable(t))),t}function hh(e,t,r,o){const n=()=>a.getValue()??e.options.renderFallbackValue,a={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(o),renderValue:n,getContext:le(()=>[e,r,t,a],(i,u,s,c)=>({table:i,column:u,row:s,cell:c,getValue:c.getValue,renderValue:c.renderValue}),{key:process.env.NODE_ENV==="development"&&"cell.getContext",debug:()=>e.options.debugAll})};return e._features.forEach(i=>{Object.assign(a,i.createCell==null?void 0:i.createCell(a,r,t,e))},{}),a}const vh=(e,t,r,o,n,a)=>{let i={id:t,index:o,original:r,depth:n,_valuesCache:{},getValue:u=>{if(i._valuesCache.hasOwnProperty(u))return i._valuesCache[u];const s=e.getColumn(u);if(s.accessorFn)return i._valuesCache[u]=s.accessorFn(i.original,o),i._valuesCache[u]},renderValue:u=>i.getValue(u)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>Lm(i.subRows,u=>u.subRows),getAllCells:le(()=>[e.getAllLeafColumns()],u=>u.map(s=>hh(e,i,s,s.id)),{key:process.env.NODE_ENV==="development"&&"row.getAllCells",debug:()=>e.options.debugAll??e.options.debugRows}),_getAllCellsByColumnId:le(()=>[i.getAllCells()],u=>u.reduce((s,c)=>(s[c.column.id]=c,s),{}),{key:process.env.NODE_ENV==="production"&&"row.getAllCellsByColumnId",debug:()=>e.options.debugAll??e.options.debugRows})};for(let u=0;u<e._features.length;u++){const s=e._features[u];Object.assign(i,s==null||s.createRow==null?void 0:s.createRow(i,e))}return i};function yh(){return e=>le(()=>[e.options.data],t=>{const r={rows:[],flatRows:[],rowsById:{}},o=function(n,a,i){a===void 0&&(a=0);const u=[];for(let c=0;c<n.length;c++){const l=vh(e,e._getRowId(n[c],c,i),n[c],c,a);if(r.flatRows.push(l),r.rowsById[l.id]=l,u.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(n[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=o(l.originalSubRows,a+1,l))}}return u};return r.rows=o(t),r},{key:process.env.NODE_ENV==="development"&&"getRowModel",debug:()=>e.options.debugAll??e.options.debugTable,onChange:()=>{e._autoResetPageIndex()}})}function bh(){return e=>le(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;const o=e.getState().sorting,n=[],a=o.filter(s=>e.getColumn(s.id).getCanSort()),i={};a.forEach(s=>{const c=e.getColumn(s.id);i[s.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()}});const u=s=>{const c=s.slice();return c.sort((l,f)=>{for(let d=0;d<a.length;d+=1){const p=a[d],g=i[p.id],v=(p==null?void 0:p.desc)??!1;if(g.sortUndefined){const S=l.getValue(p.id),D=f.getValue(p.id),P=typeof S>"u",w=typeof D>"u";if(P||w)return P&&w?0:P?g.sortUndefined:-g.sortUndefined}let h=g.sortingFn(l,f,p.id);if(h!==0)return v&&(h*=-1),g.invertSorting&&(h*=-1),h}return l.index-f.index}),c.forEach(l=>{n.push(l),!(!l.subRows||l.subRows.length<=1)&&(l.subRows=u(l.subRows))}),c};return{rows:u(r.rows),flatRows:n,rowsById:r.rowsById}},{key:process.env.NODE_ENV==="development"&&"getSortedRowModel",debug:()=>e.options.debugAll??e.options.debugTable,onChange:()=>{e._autoResetPageIndex()}})}function yc(e,t){return e?wh(e)?J.createElement(e,t):e:null}function wh(e){return Ch(e)||typeof e=="function"||_h(e)}function Ch(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function _h(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function xh(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=J.useState(()=>({current:mh(t)})),[o,n]=J.useState(()=>r.current.initialState);return r.current.setOptions(a=>({...a,...e,state:{...o,...e.state},onStateChange:i=>{n(i),e.onStateChange==null||e.onStateChange(i)}})),r.current}const bc=({indeterminate:e=!1,...t})=>{const r=J.useRef(null);return J.useEffect(()=>{r.current&&typeof e=="boolean"&&(r.current.indeterminate=!t.checked&&e)},[r,e]),I.jsx(b.Flex,{align:"center",children:I.jsx("input",{type:"checkbox",ref:r,...t})})},Kd=({columns:e,dataSource:t=[],isLoading:r,withSelectedRow:o,onSelectedRow:n,onSort:a,manualSorting:i,sortingState:u,styles:s,...c})=>{const[l,f]=J.useState(u??[]),[d,p]=J.useState({}),g=J.useMemo(()=>e,[e]),v=J.useMemo(()=>[{id:"select",header:({table:w})=>I.jsx(bc,{checked:w.getIsAllRowsSelected(),indeterminate:w.getIsSomeRowsSelected(),onChange:w.getToggleAllRowsSelectedHandler()}),cell:({row:w})=>I.jsx(bc,{checked:w.getIsSelected(),indeterminate:w.getIsSomeSelected(),onChange:w.getToggleSelectedHandler()})}],[]),h=()=>o?[...v,...g]:g,S=w=>{f(w),a&&a(w)},D=xh({data:t,columns:h(),getCoreRowModel:yh(),getSortedRowModel:bh(),manualPagination:!0,sortDescFirst:!0,state:{sorting:l,rowSelection:d},onRowSelectionChange:p,onSortingChange:S,manualSorting:i}),{flatRows:P}=D.getSelectedRowModel();return J.useEffect(()=>{const w=P.map(y=>y.original);n&&n(w)},[P]),I.jsxs(b.Box,{...c,children:[r&&I.jsx(b.Flex,{w:"100%",h:"100%",pos:"absolute",bg:"white",align:"center",justify:"center",zIndex:2,children:I.jsx(b.Spinner,{color:"primary.500",thickness:"4px",size:"lg"})}),I.jsxs(b.Table,{...s==null?void 0:s.table,children:[I.jsx(b.Thead,{...s==null?void 0:s.tableHead,children:D.getHeaderGroups().map(w=>I.jsx(b.Tr,{bg:b.useColorModeValue("initial","ebony-clay.700"),...s==null?void 0:s.tableRow,children:w.headers.map(y=>I.jsx(b.Th,{colSpan:y.colSpan,...s==null?void 0:s.tableColumnHeader,children:I.jsxs(b.Flex,{"data-test-id":"tBS7lq8teUKR7w3Fo_wUl",textTransform:"capitalize",userSelect:"none",align:"center",justifyContent:"space-between",onClick:y.column.getToggleSortingHandler(),cursor:y.column.getCanSort()?"pointer":"default",children:[I.jsx(b.Text,{fontSize:"text.sm",fontWeight:400,lineHeight:"18px",color:b.useColorModeValue("neutral.900","white"),children:yc(y.column.columnDef.header,y.getContext())}),I.jsx(b.Box,{as:"span",pl:"2",children:(y.column.getCanSort()&&{asc:I.jsx(Wt.ChevronUpIcon,{}),desc:I.jsx(Wt.ChevronDownIcon,{})}[y.column.getIsSorted()])??I.jsx(Wt.UpDownIcon,{h:2})})]})},y.id))},w.id))}),I.jsx(b.Tbody,{...s==null?void 0:s.tableBody,children:D.getRowModel().rows.map(w=>I.jsx(b.Tr,{...s==null?void 0:s.tableRow,css:ie.css`
50
+ color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,r==null?void 0:r.key)}return n}}function jm(e,t,r,o){const a={...e._getDefaultColumnDef(),...t},i=a.accessorKey;let u=a.id??(i?i.replace(".","_"):void 0)??(typeof a.header=="string"?a.header:void 0),s;if(a.accessorFn?s=a.accessorFn:i&&(i.includes(".")?s=l=>{let f=l;for(const d of i.split("."))if(f=f[d],process.env.NODE_ENV!=="production"&&f===void 0)throw new Error(`"${d}" in deeply nested key "${i}" returned undefined.`);return f}:s=l=>l[a.accessorKey]),!u)throw process.env.NODE_ENV!=="production"?new Error(a.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let c={id:`${String(u)}`,accessorFn:s,parent:o,depth:r,columnDef:a,columns:[],getFlatColumns:le(()=>[!0],()=>{var l;return[c,...(l=c.columns)==null?void 0:l.flatMap(f=>f.getFlatColumns())]},{key:process.env.NODE_ENV==="production"&&"column.getFlatColumns",debug:()=>e.options.debugAll??e.options.debugColumns}),getLeafColumns:le(()=>[e._getOrderColumnsFn()],l=>{var f;if((f=c.columns)!=null&&f.length){let d=c.columns.flatMap(p=>p.getLeafColumns());return l(d)}return[c]},{key:process.env.NODE_ENV==="production"&&"column.getLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns})};return c=e._features.reduce((l,f)=>Object.assign(l,f.createColumn==null?void 0:f.createColumn(c,e)),c),c}function gc(e,t,r){let n={id:r.id??t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],i=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(i),a.push(u)};return i(n),a},getContext:()=>({table:e,header:n,column:t})};return e._features.forEach(a=>{Object.assign(n,a.createHeader==null?void 0:a.createHeader(n,e))}),n}const Gm={createTable:e=>({getHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,o,n)=>{const a=(o==null?void 0:o.map(c=>r.find(l=>l.id===c)).filter(Boolean))??[],i=(n==null?void 0:n.map(c=>r.find(l=>l.id===c)).filter(Boolean))??[],u=r.filter(c=>!(o!=null&&o.includes(c.id))&&!(n!=null&&n.includes(c.id)));return wn(t,[...a,...u,...i],e)},{key:process.env.NODE_ENV==="development"&&"getHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,o,n)=>(r=r.filter(a=>!(o!=null&&o.includes(a.id))&&!(n!=null&&n.includes(a.id))),wn(t,r,e,"center")),{key:process.env.NODE_ENV==="development"&&"getCenterHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,o)=>{const n=(o==null?void 0:o.map(a=>r.find(i=>i.id===a)).filter(Boolean))??[];return wn(t,n,e,"left")},{key:process.env.NODE_ENV==="development"&&"getLeftHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightHeaderGroups:le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,o)=>{const n=(o==null?void 0:o.map(a=>r.find(i=>i.id===a)).filter(Boolean))??[];return wn(t,n,e,"right")},{key:process.env.NODE_ENV==="development"&&"getRightHeaderGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getFooterGroups:le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftFooterGroups:le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getLeftFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterFooterGroups:le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getCenterFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightFooterGroups:le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:process.env.NODE_ENV==="development"&&"getRightFooterGroups",debug:()=>e.options.debugAll??e.options.debugHeaders}),getFlatHeaders:le(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftFlatHeaders:le(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getLeftFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterFlatHeaders:le(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getCenterFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightFlatHeaders:le(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),{key:process.env.NODE_ENV==="development"&&"getRightFlatHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getCenterLeafHeaders:le(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),{key:process.env.NODE_ENV==="development"&&"getCenterLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeftLeafHeaders:le(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),{key:process.env.NODE_ENV==="development"&&"getLeftLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getRightLeafHeaders:le(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),{key:process.env.NODE_ENV==="development"&&"getRightLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders}),getLeafHeaders:le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,o)=>{var n,a,i;return[...((n=t[0])==null?void 0:n.headers)??[],...((a=r[0])==null?void 0:a.headers)??[],...((i=o[0])==null?void 0:i.headers)??[]].map(u=>u.getLeafHeaders()).flat()},{key:process.env.NODE_ENV==="development"&&"getLeafHeaders",debug:()=>e.options.debugAll??e.options.debugHeaders})})};function wn(e,t,r,o){var n;let a=0;const i=function(f,d){d===void 0&&(d=1),a=Math.max(a,d),f.filter(p=>p.getIsVisible()).forEach(p=>{var g;(g=p.columns)!=null&&g.length&&i(p.columns,d+1)},0)};i(e);let u=[];const s=(f,d)=>{const p={depth:d,id:[o,`${d}`].filter(Boolean).join("_"),headers:[]},g=[];f.forEach(v=>{const h=[...g].reverse()[0],S=v.column.depth===p.depth;let D,P=!1;if(S&&v.column.parent?D=v.column.parent:(D=v.column,P=!0),h&&(h==null?void 0:h.column)===D)h.subHeaders.push(v);else{const w=gc(r,D,{id:[o,d,D.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:P,placeholderId:P?`${g.filter(y=>y.column===D).length}`:void 0,depth:d,index:g.length});w.subHeaders.push(v),g.push(w)}p.headers.push(v),v.headerGroup=p}),u.push(p),d>0&&s(g,d-1)},c=t.map((f,d)=>gc(r,f,{depth:a,index:d}));s(c,a-1),u.reverse();const l=f=>f.filter(p=>p.column.getIsVisible()).map(p=>{let g=0,v=0,h=[0];p.subHeaders&&p.subHeaders.length?(h=[],l(p.subHeaders).forEach(D=>{let{colSpan:P,rowSpan:w}=D;g+=P,h.push(w)})):g=1;const S=Math.min(...h);return v=v+S,p.colSpan=g,p.rowSpan=v,{colSpan:g,rowSpan:v}});return l(((n=u[0])==null?void 0:n.headers)??[]),u}const Cn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ya=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Hm={getDefaultColumnDef:()=>Cn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ya(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:gt("columnSizing",e),onColumnSizingInfoChange:gt("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{const r=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??Cn.minSize,r??e.columnDef.size??Cn.size),e.columnDef.maxSize??Cn.maxSize)},getStart:r=>{const o=r?r==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),n=o.findIndex(a=>a.id===e.id);if(n>0){const a=o[n-1];return a.getStart(r)+a.getSize()}return 0},resetSize:()=>{t.setColumnSizing(r=>{let{[e.id]:o,...n}=r;return n})},getCanResize:()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let r=0;const o=n=>{n.subHeaders.length?n.subHeaders.forEach(o):r+=n.column.getSize()??0};return o(e),r},getStart:()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},getResizeHandler:()=>{const r=t.getColumn(e.column.id),o=r.getCanResize();return n=>{if(!o||(n.persist==null||n.persist(),za(n)&&n.touches&&n.touches.length>1))return;const a=e.getSize(),i=e?e.getLeafHeaders().map(g=>[g.column.id,g.column.getSize()]):[[r.id,r.getSize()]],u=za(n)?Math.round(n.touches[0].clientX):n.clientX,s=(g,v)=>{if(typeof v!="number")return;let h={};t.setColumnSizingInfo(S=>{const D=v-((S==null?void 0:S.startOffset)??0),P=Math.max(D/((S==null?void 0:S.startSize)??0),-.999999);return S.columnSizingStart.forEach(w=>{let[y,k]=w;h[y]=Math.round(Math.max(k+k*P,0)*100)/100}),{...S,deltaOffset:D,deltaPercentage:P}}),(t.options.columnResizeMode==="onChange"||g==="end")&&t.setColumnSizing(S=>({...S,...h}))},c=g=>s("move",g),l=g=>{s("end",g),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f={moveHandler:g=>c(g.clientX),upHandler:g=>{document.removeEventListener("mousemove",f.moveHandler),document.removeEventListener("mouseup",f.upHandler),l(g.clientX)}},d={moveHandler:g=>(g.cancelable&&(g.preventDefault(),g.stopPropagation()),c(g.touches[0].clientX),!1),upHandler:g=>{var v;document.removeEventListener("touchmove",d.moveHandler),document.removeEventListener("touchend",d.upHandler),g.cancelable&&(g.preventDefault(),g.stopPropagation()),l((v=g.touches[0])==null?void 0:v.clientX)}},p=Wm()?{passive:!1}:!1;za(n)?(document.addEventListener("touchmove",d.moveHandler,p),document.addEventListener("touchend",d.upHandler,p)):(document.addEventListener("mousemove",f.moveHandler,p),document.addEventListener("mouseup",f.upHandler,p)),t.setColumnSizingInfo(g=>({...g,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,isResizingColumn:r.id}))}}}),createTable:e=>({setColumnSizing:t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},resetHeaderSizeInfo:t=>{e.setColumnSizingInfo(t?Ya():e.initialState.columnSizingInfo??Ya())},getTotalSize:()=>{var t;return((t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0},getLeftTotalSize:()=>{var t;return((t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0},getCenterTotalSize:()=>{var t;return((t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0},getRightTotalSize:()=>{var t;return((t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))??0}})};let _n=null;function Wm(){if(typeof _n=="boolean")return _n;let e=!1;try{const t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return _n=e,_n}function za(e){return e.type==="touchstart"}const $m={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:gt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;return{_autoResetExpanded:()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},setExpanded:o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),toggleAllRowsExpanded:o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:o=>{var n;e.setExpanded(o?{}:((n=e.initialState)==null?void 0:n.expanded)??{})},getCanSomeRowsExpand:()=>e.getRowModel().flatRows.some(o=>o.getCanExpand()),getToggleAllRowsExpandedHandler:()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},getIsAllRowsExpanded:()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows.some(n=>!n.getIsExpanded()))},getExpandedDepth:()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const i=a.split(".");o=Math.max(o,i.length)}),o},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:r=>{t.setExpanded(o=>{const n=o===!0?!0:!!(o!=null&&o[e.id]);let a={};if(o===!0?Object.keys(t.getRowModel().rowsById).forEach(i=>{a[i]=!0}):a=o,r=r??!n,!n&&r)return{...a,[e.id]:!0};if(n&&!r){const{[e.id]:i,...u}=a;return u}return o})},getIsExpanded:()=>{const r=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(r===!0||r!=null&&r[e.id]))},getCanExpand:()=>{var r;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((r=e.subRows)!=null&&r.length))},getToggleExpandedHandler:()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}})},$d=(e,t,r)=>{var o;const n=r.toLowerCase();return(o=e.getValue(t))==null?void 0:o.toLowerCase().includes(n)};$d.autoRemove=e=>wt(e);const Yd=(e,t,r)=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)};Yd.autoRemove=e=>wt(e);const zd=(e,t,r)=>{var o;return((o=e.getValue(t))==null?void 0:o.toLowerCase())===r.toLowerCase()};zd.autoRemove=e=>wt(e);const Xd=(e,t,r)=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)};Xd.autoRemove=e=>wt(e)||!(e!=null&&e.length);const Zd=(e,t,r)=>!r.some(o=>{var n;return!((n=e.getValue(t))!=null&&n.includes(o))});Zd.autoRemove=e=>wt(e)||!(e!=null&&e.length);const Ud=(e,t,r)=>r.some(o=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(o)});Ud.autoRemove=e=>wt(e)||!(e!=null&&e.length);const Jd=(e,t,r)=>e.getValue(t)===r;Jd.autoRemove=e=>wt(e);const qd=(e,t,r)=>e.getValue(t)==r;qd.autoRemove=e=>wt(e);const xs=(e,t,r)=>{let[o,n]=r;const a=e.getValue(t);return a>=o&&a<=n};xs.resolveFilterValue=e=>{let[t,r]=e,o=typeof t!="number"?parseFloat(t):t,n=typeof r!="number"?parseFloat(r):r,a=t===null||Number.isNaN(o)?-1/0:o,i=r===null||Number.isNaN(n)?1/0:n;if(a>i){const u=a;a=i,i=u}return[a,i]};xs.autoRemove=e=>wt(e)||wt(e[0])&&wt(e[1]);const Ft={includesString:$d,includesStringSensitive:Yd,equalsString:zd,arrIncludes:Xd,arrIncludesAll:Zd,arrIncludesSome:Ud,equals:Jd,weakEquals:qd,inNumberRange:xs};function wt(e){return e==null||e===""}const Ym={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:gt("columnFilters",e),onGlobalFilterChange:gt("globalFilter",e),filterFromLeafRows:!1,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r,o;const n=(r=e.getCoreRowModel().flatRows[0])==null||(o=r._getAllCellsByColumnId()[t.id])==null?void 0:o.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const r=t.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(e.id);return typeof o=="string"?Ft.includesString:typeof o=="number"?Ft.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Ft.equals:Array.isArray(o)?Ft.arrIncludes:Ft.weakEquals},getFilterFn:()=>{var r;return Io(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():((r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])??Ft[e.columnDef.filterFn]},getCanFilter:()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,getCanGlobalFilter:()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn,getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var r,o;return(r=t.getState().columnFilters)==null||(o=r.find(n=>n.id===e.id))==null?void 0:o.value},getFilterIndex:()=>{var r;return((r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))??-1},setFilterValue:r=>{t.setColumnFilters(o=>{const n=e.getFilterFn(),a=o==null?void 0:o.find(s=>s.id===e.id),i=$t(r,a?a.value:void 0);if(mc(n,i,e))return(o==null?void 0:o.filter(s=>s.id!==e.id))??[];const u={id:e.id,value:i};return a?(o==null?void 0:o.map(s=>s.id===e.id?u:s))??[]:o!=null&&o.length?[...o,u]:[u]})},_getFacetedRowModel:t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),_getFacetedUniqueValues:t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>Ft.includesString,getGlobalFilterFn:()=>{var t;const{globalFilterFn:r}=e.options;return Io(r)?r:r==="auto"?e.getGlobalAutoFilterFn():((t=e.options.filterFns)==null?void 0:t[r])??Ft[r]},setColumnFilters:t=>{const r=e.getAllLeafColumns(),o=n=>{var a;return(a=$t(t,n))==null?void 0:a.filter(i=>{const u=r.find(s=>s.id===i.id);if(u){const s=u.getFilterFn();if(mc(s,i.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var r;e.setColumnFilters(t?[]:((r=e.initialState)==null?void 0:r.columnFilters)??[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function mc(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}const zm=(e,t,r)=>r.reduce((o,n)=>{const a=n.getValue(e);return o+(typeof a=="number"?a:0)},0),Xm=(e,t,r)=>{let o;return r.forEach(n=>{const a=n.getValue(e);a!=null&&(o>a||o===void 0&&a>=a)&&(o=a)}),o},Zm=(e,t,r)=>{let o;return r.forEach(n=>{const a=n.getValue(e);a!=null&&(o<a||o===void 0&&a>=a)&&(o=a)}),o},Um=(e,t,r)=>{let o,n;return r.forEach(a=>{const i=a.getValue(e);i!=null&&(o===void 0?i>=i&&(o=n=i):(o>i&&(o=i),n<i&&(n=i)))}),[o,n]},Jm=(e,t)=>{let r=0,o=0;if(t.forEach(n=>{let a=n.getValue(e);a!=null&&(a=+a)>=a&&(++r,o+=a)}),r)return o/r},qm=(e,t)=>{if(!t.length)return;let r=0,o=0;return t.forEach(n=>{let a=n.getValue(e);typeof a=="number"&&(r=Math.min(r,a),o=Math.max(o,a))}),(r+o)/2},Qm=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),Km=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,eh=(e,t)=>t.length,Xa={sum:zm,min:Xm,max:Zm,extent:Um,mean:Jm,median:qm,unique:Qm,uniqueCount:Km,count:eh},th={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:gt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(o=>o!==e.id):[...r??[],e.id])},getCanGroup:()=>e.columnDef.enableGrouping??!0??t.options.enableGrouping??!0??!!e.accessorFn,getIsGrouped:()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},getGroupedIndex:()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},getToggleGroupingHandler:()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const r=t.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(e.id);if(typeof o=="number")return Xa.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Xa.extent},getAggregationFn:()=>{var r;if(!e)throw new Error;return Io(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():((r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])??Xa[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var r;e.setGrouping(t?[]:((r=e.initialState)==null?void 0:r.grouping)??[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:e=>({getIsGrouped:()=>!!e.groupingColumnId,_groupingValuesCache:{}}),createCell:(e,t,r,o)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===r.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var n;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((n=r.subRows)!=null&&n.length)}})};function rh(e,t,r){if(!(t!=null&&t.length)||!r)return e;const o=e.filter(a=>!t.includes(a.id));return r==="remove"?o:[...t.map(a=>e.find(i=>i.id===a)).filter(Boolean),...o]}const nh={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:gt("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},_getOrderColumnsFn:le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,o)=>n=>{let a=[];if(!(t!=null&&t.length))a=n;else{const i=[...t],u=[...n];for(;u.length&&i.length;){const s=i.shift(),c=u.findIndex(l=>l.id===s);c>-1&&a.push(u.splice(c,1)[0])}a=[...a,...u]}return rh(a,r,o)},{key:process.env.NODE_ENV==="development"&&"getOrderColumnsFn"})})},Ni=0,Bi=10,Za=()=>({pageIndex:Ni,pageSize:Bi}),oh={getInitialState:e=>({...e,pagination:{...Za(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:gt("pagination",e)}),createTable:e=>{let t=!1,r=!1;return{_autoResetPageIndex:()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},setPagination:o=>{const n=a=>$t(o,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(n)},resetPagination:o=>{e.setPagination(o?Za():e.initialState.pagination??Za())},setPageIndex:o=>{e.setPagination(n=>{let a=$t(o,n.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.min(Math.max(0,a),i),{...n,pageIndex:a}})},resetPageIndex:o=>{var n,a;e.setPageIndex(o?Ni:((n=e.initialState)==null||(a=n.pagination)==null?void 0:a.pageIndex)??Ni)},resetPageSize:o=>{var n,a;e.setPageSize(o?Bi:((n=e.initialState)==null||(a=n.pagination)==null?void 0:a.pageSize)??Bi)},setPageSize:o=>{e.setPagination(n=>{const a=Math.max(1,$t(o,n.pageSize)),i=n.pageSize*n.pageIndex,u=Math.floor(i/a);return{...n,pageIndex:u,pageSize:a}})},setPageCount:o=>e.setPagination(n=>{let a=$t(o,e.options.pageCount??-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...n,pageCount:a}}),getPageOptions:le(()=>[e.getPageCount()],o=>{let n=[];return o&&o>0&&(n=[...new Array(o)].fill(null).map((a,i)=>i)),n},{key:process.env.NODE_ENV==="development"&&"getPageOptions",debug:()=>e.options.debugAll??e.options.debugTable}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:o}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:o<n-1},previousPage:()=>e.setPageIndex(o=>o-1),nextPage:()=>e.setPageIndex(o=>o+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>e.options.pageCount??Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}},Ua=()=>({left:[],right:[]}),ah={getInitialState:e=>({columnPinning:Ua(),...e}),getDefaultOptions:e=>({onColumnPinningChange:gt("columnPinning",e)}),createColumn:(e,t)=>({pin:r=>{const o=e.getLeafColumns().map(n=>n.id).filter(Boolean);t.setColumnPinning(n=>r==="right"?{left:((n==null?void 0:n.left)??[]).filter(a=>!(o!=null&&o.includes(a))),right:[...((n==null?void 0:n.right)??[]).filter(a=>!(o!=null&&o.includes(a))),...o]}:r==="left"?{left:[...((n==null?void 0:n.left)??[]).filter(a=>!(o!=null&&o.includes(a))),...o],right:((n==null?void 0:n.right)??[]).filter(a=>!(o!=null&&o.includes(a)))}:{left:((n==null?void 0:n.left)??[]).filter(a=>!(o!=null&&o.includes(a))),right:((n==null?void 0:n.right)??[]).filter(a=>!(o!=null&&o.includes(a)))})},getCanPin:()=>e.getLeafColumns().some(o=>(o.columnDef.enablePinning??!0)&&(t.options.enablePinning??!0)),getIsPinned:()=>{const r=e.getLeafColumns().map(u=>u.id),{left:o,right:n}=t.getState().columnPinning,a=r.some(u=>o==null?void 0:o.includes(u)),i=r.some(u=>n==null?void 0:n.includes(u));return a?"left":i?"right":!1},getPinnedIndex:()=>{var r,o;const n=e.getIsPinned();return n?((r=t.getState().columnPinning)==null||(o=r[n])==null?void 0:o.indexOf(e.id))??-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,o,n)=>{const a=[...o??[],...n??[]];return r.filter(i=>!a.includes(i.column.id))},{key:process.env.NODE_ENV==="production"&&"row.getCenterVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows}),getLeftVisibleCells:le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(r,o)=>(o??[]).map(a=>r.find(i=>i.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),{key:process.env.NODE_ENV==="production"&&"row.getLeftVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows}),getRightVisibleCells:le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,o)=>(o??[]).map(a=>r.find(i=>i.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),{key:process.env.NODE_ENV==="production"&&"row.getRightVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows})}),createTable:e=>({setColumnPinning:t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var r;return e.setColumnPinning(t?Ua():((r=e.initialState)==null?void 0:r.columnPinning)??Ua())},getIsSomeColumnsPinned:t=>{var r;const o=e.getState().columnPinning;if(!t){var n,a;return!!((n=o.left)!=null&&n.length||(a=o.right)!=null&&a.length)}return!!((r=o[t])!=null&&r.length)},getLeftLeafColumns:le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(o=>t.find(n=>n.id===o)).filter(Boolean),{key:process.env.NODE_ENV==="development"&&"getLeftLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns}),getRightLeafColumns:le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(o=>t.find(n=>n.id===o)).filter(Boolean),{key:process.env.NODE_ENV==="development"&&"getRightLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns}),getCenterLeafColumns:le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,o)=>{const n=[...r??[],...o??[]];return t.filter(a=>!n.includes(a.id))},{key:process.env.NODE_ENV==="development"&&"getCenterLeafColumns",debug:()=>e.options.debugAll??e.options.debugColumns})})},ih={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:gt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),toggleAllRowsSelected:t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const o={...r},n=e.getPreGroupedRowModel().flatRows;return t?n.forEach(a=>{a.getCanSelect()&&(o[a.id]=!0)}):n.forEach(a=>{delete o[a.id]}),o})},toggleAllPageRowsSelected:t=>e.setRowSelection(r=>{const o=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),n={...r};return e.getRowModel().rows.forEach(a=>{Vi(n,a.id,o,e)}),n}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?Ja(e,r):{rows:[],flatRows:[],rowsById:{}},{key:process.env.NODE_ENV==="development"&&"getSelectedRowModel",debug:()=>e.options.debugAll??e.options.debugTable}),getFilteredSelectedRowModel:le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?Ja(e,r):{rows:[],flatRows:[],rowsById:{}},{key:process.env.NODE_ENV==="production"&&"getFilteredSelectedRowModel",debug:()=>e.options.debugAll??e.options.debugTable}),getGroupedSelectedRowModel:le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?Ja(e,r):{rows:[],flatRows:[],rowsById:{}},{key:process.env.NODE_ENV==="production"&&"getGroupedSelectedRowModel",debug:()=>e.options.debugAll??e.options.debugTable}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let o=!!(t.length&&Object.keys(r).length);return o&&t.some(n=>n.getCanSelect()&&!r[n.id])&&(o=!1),o},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows,{rowSelection:r}=e.getState();let o=!!t.length;return o&&t.some(n=>!r[n.id])&&(o=!1),o},getIsSomeRowsSelected:()=>{const t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},getIsSomePageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.some(r=>r.getIsSelected()||r.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:r=>{const o=e.getIsSelected();t.setRowSelection(n=>{if(r=typeof r<"u"?r:!o,o===r)return n;const a={...n};return Vi(a,e.id,r,t),a})},getIsSelected:()=>{const{rowSelection:r}=t.getState();return Ss(e,r)},getIsSomeSelected:()=>{const{rowSelection:r}=t.getState();return hc(e,r)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:r}=t.getState();return hc(e,r)==="all"},getCanSelect:()=>typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,getCanSelectSubRows:()=>typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,getCanMultiSelect:()=>typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,getToggleSelectedHandler:()=>{const r=e.getCanSelect();return o=>{var n;r&&e.toggleSelected((n=o.target)==null?void 0:n.checked)}}})},Vi=(e,t,r,o)=>{var n;const a=o.getRow(t);r?(a.getCanMultiSelect()||Object.keys(e).forEach(i=>delete e[i]),a.getCanSelect()&&(e[t]=!0)):delete e[t],(n=a.subRows)!=null&&n.length&&a.getCanSelectSubRows()&&a.subRows.forEach(i=>Vi(e,i.id,r,o))};function Ja(e,t){const r=e.getState().rowSelection,o=[],n={},a=function(i,u){return i.map(s=>{var c;const l=Ss(s,r);if(l&&(o.push(s),n[s.id]=s),(c=s.subRows)!=null&&c.length&&(s={...s,subRows:a(s.subRows)}),l)return s}).filter(Boolean)};return{rows:a(t.rows),flatRows:o,rowsById:n}}function Ss(e,t){return t[e.id]??!1}function hc(e,t,r){if(e.subRows&&e.subRows.length){let o=!0,n=!1;return e.subRows.forEach(a=>{n&&!o||(Ss(a,t)?n=!0:o=!1)}),o?"all":n?"some":!1}return!1}const Li=/([0-9]+)/gm,uh=(e,t,r)=>Qd(Ut(e.getValue(r)).toLowerCase(),Ut(t.getValue(r)).toLowerCase()),sh=(e,t,r)=>Qd(Ut(e.getValue(r)),Ut(t.getValue(r))),ch=(e,t,r)=>Is(Ut(e.getValue(r)).toLowerCase(),Ut(t.getValue(r)).toLowerCase()),lh=(e,t,r)=>Is(Ut(e.getValue(r)),Ut(t.getValue(r))),fh=(e,t,r)=>{const o=e.getValue(r),n=t.getValue(r);return o>n?1:o<n?-1:0},dh=(e,t,r)=>Is(e.getValue(r),t.getValue(r));function Is(e,t){return e===t?0:e>t?1:-1}function Ut(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Qd(e,t){const r=e.split(Li).filter(Boolean),o=t.split(Li).filter(Boolean);for(;r.length&&o.length;){const n=r.shift(),a=o.shift(),i=parseInt(n,10),u=parseInt(a,10),s=[i,u].sort();if(isNaN(s[0])){if(n>a)return 1;if(a>n)return-1;continue}if(isNaN(s[1]))return isNaN(i)?-1:1;if(i>u)return 1;if(u>i)return-1}return r.length-o.length}const $r={alphanumeric:uh,alphanumericCaseSensitive:sh,text:ch,textCaseSensitive:lh,datetime:fh,basic:dh},ph={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto"}),getDefaultOptions:e=>({onSortingChange:gt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const r=t.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const n of r){const a=n==null?void 0:n.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return $r.datetime;if(typeof a=="string"&&(o=!0,a.split(Li).length>1))return $r.alphanumeric}return o?$r.text:$r.basic},getAutoSortDir:()=>{const r=t.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var r;if(!e)throw new Error;return Io(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():((r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])??$r[e.columnDef.sortingFn]},toggleSorting:(r,o)=>{const n=e.getNextSortingOrder(),a=typeof r<"u"&&r!==null;t.setSorting(i=>{const u=i==null?void 0:i.find(d=>d.id===e.id),s=i==null?void 0:i.findIndex(d=>d.id===e.id);let c=[],l,f=a?r:n==="desc";return i!=null&&i.length&&e.getCanMultiSort()&&o?u?l="toggle":l="add":i!=null&&i.length&&s!==i.length-1?l="replace":u?l="toggle":l="replace",l==="toggle"&&(a||n||(l="remove")),l==="add"?(c=[...i,{id:e.id,desc:f}],c.splice(0,c.length-(t.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):l==="toggle"?c=i.map(d=>d.id===e.id?{...d,desc:f}:d):l==="remove"?c=i.filter(d=>d.id!==e.id):c=[{id:e.id,desc:f}],c})},getFirstSortDir:()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()==="desc"?"desc":"asc",getNextSortingOrder:r=>{const o=e.getFirstSortDir(),n=e.getIsSorted();return n?n!==o&&(t.options.enableSortingRemoval??!0)&&(!r||(t.options.enableMultiRemove??!0))?!1:n==="desc"?"asc":"desc":o},getCanSort:()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,getCanMultiSort:()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,getIsSorted:()=>{var r;const o=(r=t.getState().sorting)==null?void 0:r.find(n=>n.id===e.id);return o?o.desc?"desc":"asc":!1},getSortIndex:()=>{var r;return((r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))??-1},clearSorting:()=>{t.setSorting(r=>r!=null&&r.length?r.filter(o=>o.id!==e.id):[])},getToggleSortingHandler:()=>{const r=e.getCanSort();return o=>{r&&(o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(o):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var r;e.setSorting(t?[]:((r=e.initialState)==null?void 0:r.sorting)??[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},gh={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:gt("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:r=>{e.getCanHide()&&t.setColumnVisibility(o=>({...o,[e.id]:r??!e.getIsVisible()}))},getIsVisible:()=>{var r;return((r=t.getState().columnVisibility)==null?void 0:r[e.id])??!0},getCanHide:()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),getToggleVisibilityHandler:()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:le(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(o=>o.column.getIsVisible()),{key:process.env.NODE_ENV==="production"&&"row._getAllVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows}),getVisibleCells:le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,o,n)=>[...r,...o,...n],{key:process.env.NODE_ENV==="development"&&"row.getVisibleCells",debug:()=>t.options.debugAll??t.options.debugRows})}),createTable:e=>{const t=(r,o)=>le(()=>[o(),o().filter(n=>n.getIsVisible()).map(n=>n.id).join("_")],n=>n.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),{key:r,debug:()=>e.options.debugAll??e.options.debugColumns});return{getVisibleFlatColumns:t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),resetColumnVisibility:r=>{e.setColumnVisibility(r?{}:e.initialState.columnVisibility??{})},toggleAllColumnsVisible:r=>{r=r??!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,n)=>({...o,[n.id]:r||!(n.getCanHide!=null&&n.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>r=>{var o;e.toggleAllColumnsVisible((o=r.target)==null?void 0:o.checked)}}}},vc=[Gm,gh,nh,ah,Ym,ph,th,$m,oh,ih,Hm];function mh(e){(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let t={_features:vc};const r=t._features.reduce((c,l)=>Object.assign(c,l.getDefaultOptions==null?void 0:l.getDefaultOptions(t)),{}),o=c=>t.options.mergeOptions?t.options.mergeOptions(r,c):{...r,...c};let a={...{},...e.initialState??{}};t._features.forEach(c=>{a=(c.getInitialState==null?void 0:c.getInitialState(a))??a});const i=[];let u=!1;const s={_features:vc,options:{...r,...e},initialState:a,_queue:c=>{i.push(c),u||(u=!0,Promise.resolve().then(()=>{for(;i.length;)i.shift()();u=!1}).catch(l=>setTimeout(()=>{throw l})))},reset:()=>{t.setState(t.initialState)},setOptions:c=>{const l=$t(c,t.options);t.options=o(l)},getState:()=>t.options.state,setState:c=>{t.options.onStateChange==null||t.options.onStateChange(c)},_getRowId:(c,l,f)=>(t.options.getRowId==null?void 0:t.options.getRowId(c,l,f))??`${f?[f.id,l].join("."):l}`,getCoreRowModel:()=>(t._getCoreRowModel||(t._getCoreRowModel=t.options.getCoreRowModel(t)),t._getCoreRowModel()),getRowModel:()=>t.getPaginationRowModel(),getRow:c=>{const l=t.getRowModel().rowsById[c];if(!l)throw process.env.NODE_ENV!=="production"?new Error(`getRow expected an ID, but got ${c}`):new Error;return l},_getDefaultColumnDef:le(()=>[t.options.defaultColumn],c=>(c=c??{},{header:l=>{const f=l.header.column.columnDef;return f.accessorKey?f.accessorKey:f.accessorFn?f.id:null},cell:l=>{var f;return((f=l.renderValue())==null||f.toString==null?void 0:f.toString())??null},...t._features.reduce((l,f)=>Object.assign(l,f.getDefaultColumnDef==null?void 0:f.getDefaultColumnDef()),{}),...c}),{debug:()=>t.options.debugAll??t.options.debugColumns,key:process.env.NODE_ENV==="development"&&"getDefaultColumnDef"}),_getColumnDefs:()=>t.options.columns,getAllColumns:le(()=>[t._getColumnDefs()],c=>{const l=function(f,d,p){return p===void 0&&(p=0),f.map(g=>{const v=jm(t,g,p,d),h=g;return v.columns=h.columns?l(h.columns,v,p+1):[],v})};return l(c)},{key:process.env.NODE_ENV==="development"&&"getAllColumns",debug:()=>t.options.debugAll??t.options.debugColumns}),getAllFlatColumns:le(()=>[t.getAllColumns()],c=>c.flatMap(l=>l.getFlatColumns()),{key:process.env.NODE_ENV==="development"&&"getAllFlatColumns",debug:()=>t.options.debugAll??t.options.debugColumns}),_getAllFlatColumnsById:le(()=>[t.getAllFlatColumns()],c=>c.reduce((l,f)=>(l[f.id]=f,l),{}),{key:process.env.NODE_ENV==="development"&&"getAllFlatColumnsById",debug:()=>t.options.debugAll??t.options.debugColumns}),getAllLeafColumns:le(()=>[t.getAllColumns(),t._getOrderColumnsFn()],(c,l)=>{let f=c.flatMap(d=>d.getLeafColumns());return l(f)},{key:process.env.NODE_ENV==="development"&&"getAllLeafColumns",debug:()=>t.options.debugAll??t.options.debugColumns}),getColumn:c=>{const l=t._getAllFlatColumnsById()[c];if(!l)throw process.env.NODE_ENV!=="production"&&console.warn(`[Table] Column with id ${c} does not exist.`),new Error;return l}};return Object.assign(t,s),t._features.forEach(c=>Object.assign(t,c.createTable==null?void 0:c.createTable(t))),t}function hh(e,t,r,o){const n=()=>a.getValue()??e.options.renderFallbackValue,a={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(o),renderValue:n,getContext:le(()=>[e,r,t,a],(i,u,s,c)=>({table:i,column:u,row:s,cell:c,getValue:c.getValue,renderValue:c.renderValue}),{key:process.env.NODE_ENV==="development"&&"cell.getContext",debug:()=>e.options.debugAll})};return e._features.forEach(i=>{Object.assign(a,i.createCell==null?void 0:i.createCell(a,r,t,e))},{}),a}const vh=(e,t,r,o,n,a)=>{let i={id:t,index:o,original:r,depth:n,_valuesCache:{},getValue:u=>{if(i._valuesCache.hasOwnProperty(u))return i._valuesCache[u];const s=e.getColumn(u);if(s.accessorFn)return i._valuesCache[u]=s.accessorFn(i.original,o),i._valuesCache[u]},renderValue:u=>i.getValue(u)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>Lm(i.subRows,u=>u.subRows),getAllCells:le(()=>[e.getAllLeafColumns()],u=>u.map(s=>hh(e,i,s,s.id)),{key:process.env.NODE_ENV==="development"&&"row.getAllCells",debug:()=>e.options.debugAll??e.options.debugRows}),_getAllCellsByColumnId:le(()=>[i.getAllCells()],u=>u.reduce((s,c)=>(s[c.column.id]=c,s),{}),{key:process.env.NODE_ENV==="production"&&"row.getAllCellsByColumnId",debug:()=>e.options.debugAll??e.options.debugRows})};for(let u=0;u<e._features.length;u++){const s=e._features[u];Object.assign(i,s==null||s.createRow==null?void 0:s.createRow(i,e))}return i};function yh(){return e=>le(()=>[e.options.data],t=>{const r={rows:[],flatRows:[],rowsById:{}},o=function(n,a,i){a===void 0&&(a=0);const u=[];for(let c=0;c<n.length;c++){const l=vh(e,e._getRowId(n[c],c,i),n[c],c,a);if(r.flatRows.push(l),r.rowsById[l.id]=l,u.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(n[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=o(l.originalSubRows,a+1,l))}}return u};return r.rows=o(t),r},{key:process.env.NODE_ENV==="development"&&"getRowModel",debug:()=>e.options.debugAll??e.options.debugTable,onChange:()=>{e._autoResetPageIndex()}})}function bh(){return e=>le(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;const o=e.getState().sorting,n=[],a=o.filter(s=>e.getColumn(s.id).getCanSort()),i={};a.forEach(s=>{const c=e.getColumn(s.id);i[s.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()}});const u=s=>{const c=s.slice();return c.sort((l,f)=>{for(let d=0;d<a.length;d+=1){const p=a[d],g=i[p.id],v=(p==null?void 0:p.desc)??!1;if(g.sortUndefined){const S=l.getValue(p.id),D=f.getValue(p.id),P=typeof S>"u",w=typeof D>"u";if(P||w)return P&&w?0:P?g.sortUndefined:-g.sortUndefined}let h=g.sortingFn(l,f,p.id);if(h!==0)return v&&(h*=-1),g.invertSorting&&(h*=-1),h}return l.index-f.index}),c.forEach(l=>{n.push(l),!(!l.subRows||l.subRows.length<=1)&&(l.subRows=u(l.subRows))}),c};return{rows:u(r.rows),flatRows:n,rowsById:r.rowsById}},{key:process.env.NODE_ENV==="development"&&"getSortedRowModel",debug:()=>e.options.debugAll??e.options.debugTable,onChange:()=>{e._autoResetPageIndex()}})}function yc(e,t){return e?wh(e)?J.createElement(e,t):e:null}function wh(e){return Ch(e)||typeof e=="function"||_h(e)}function Ch(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function _h(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function xh(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=J.useState(()=>({current:mh(t)})),[o,n]=J.useState(()=>r.current.initialState);return r.current.setOptions(a=>({...a,...e,state:{...o,...e.state},onStateChange:i=>{n(i),e.onStateChange==null||e.onStateChange(i)}})),r.current}const bc=({indeterminate:e=!1,...t})=>{const r=J.useRef(null);return J.useEffect(()=>{r.current&&typeof e=="boolean"&&(r.current.indeterminate=!t.checked&&e)},[r,e]),I.jsx(b.Flex,{align:"center",children:I.jsx("input",{type:"checkbox",ref:r,...t})})},Kd=({columns:e,dataSource:t=[],isLoading:r,withSelectedRow:o,onSelectedRow:n,onSort:a,manualSorting:i,sortingState:u,styles:s,...c})=>{const[l,f]=J.useState(u??[]),[d,p]=J.useState({}),g=J.useMemo(()=>e,[e]),v=J.useMemo(()=>[{id:"select",header:({table:w})=>I.jsx(bc,{checked:w.getIsAllRowsSelected(),indeterminate:w.getIsSomeRowsSelected(),onChange:w.getToggleAllRowsSelectedHandler()}),cell:({row:w})=>I.jsx(bc,{checked:w.getIsSelected(),indeterminate:w.getIsSomeSelected(),onChange:w.getToggleSelectedHandler()})}],[]),h=()=>o?[...v,...g]:g,S=w=>{f(w),a&&a(w)},D=xh({data:t,columns:h(),getCoreRowModel:yh(),getSortedRowModel:bh(),manualPagination:!0,sortDescFirst:!0,state:{sorting:l,rowSelection:d},onRowSelectionChange:p,onSortingChange:S,manualSorting:i}),{flatRows:P}=D.getSelectedRowModel();return J.useEffect(()=>{const w=P.map(y=>y.original);n&&n(w)},[P]),I.jsxs(b.Box,{...c,children:[r&&I.jsx(b.Flex,{w:"100%",h:"100%",pos:"absolute",bg:"white",align:"center",justify:"center",zIndex:2,children:I.jsx(b.Spinner,{color:"primary.500",thickness:"4px",size:"lg"})}),I.jsxs(b.Table,{...s==null?void 0:s.table,children:[I.jsx(b.Thead,{...s==null?void 0:s.tableHead,children:D.getHeaderGroups().map(w=>I.jsx(b.Tr,{bg:b.useColorModeValue("initial","ebony-clay.700"),...s==null?void 0:s.tableRow,children:w.headers.map(y=>I.jsx(b.Th,{colSpan:y.colSpan,...s==null?void 0:s.tableColumnHeader,children:I.jsxs(b.Flex,{"data-test-id":`CT_Container_TableHeader_${y.id}`,textTransform:"capitalize",userSelect:"none",align:"center",justifyContent:"space-between",onClick:y.column.getToggleSortingHandler(),cursor:y.column.getCanSort()?"pointer":"default",children:[I.jsx(b.Text,{fontSize:"text.sm",fontWeight:400,lineHeight:"18px",color:b.useColorModeValue("neutral.900","white"),children:yc(y.column.columnDef.header,y.getContext())}),I.jsx(b.Box,{as:"span",pl:"2","data-test-id":`CT_Container_SortingIcon_${y.id}`,children:(y.column.getCanSort()&&{asc:I.jsx(Wt.ChevronUpIcon,{}),desc:I.jsx(Wt.ChevronDownIcon,{})}[y.column.getIsSorted()])??I.jsx(Wt.UpDownIcon,{h:2})})]})},y.id))},w.id))}),I.jsx(b.Tbody,{...s==null?void 0:s.tableBody,children:D.getRowModel().rows.map(w=>I.jsx(b.Tr,{...s==null?void 0:s.tableRow,css:ie.css`
51
51
  &:last-child {
52
52
  td {
53
53
  border-bottom: none;
package/dist/index.mjs CHANGED
@@ -2860,7 +2860,7 @@ const Nc = ({
2860
2860
  /* @__PURE__ */ x.jsx(th, { ...s == null ? void 0 : s.tableHead, children: E.getHeaderGroups().map((y) => /* @__PURE__ */ x.jsx(Oc, { bg: le("initial", "ebony-clay.700"), ...s == null ? void 0 : s.tableRow, children: y.headers.map((v) => /* @__PURE__ */ x.jsx(rh, { colSpan: v.colSpan, ...s == null ? void 0 : s.tableColumnHeader, children: /* @__PURE__ */ x.jsxs(
2861
2861
  kt,
2862
2862
  {
2863
- "data-test-id": "tBS7lq8teUKR7w3Fo_wUl",
2863
+ "data-test-id": `CT_Container_TableHeader_${v.id}`,
2864
2864
  textTransform: "capitalize",
2865
2865
  userSelect: "none",
2866
2866
  align: "center",
@@ -2878,7 +2878,7 @@ const Nc = ({
2878
2878
  children: Fc(v.column.columnDef.header, v.getContext())
2879
2879
  }
2880
2880
  ),
2881
- /* @__PURE__ */ x.jsx(je, { as: "span", pl: "2", children: (v.column.getCanSort() && {
2881
+ /* @__PURE__ */ x.jsx(je, { as: "span", pl: "2", "data-test-id": `CT_Container_SortingIcon_${v.id}`, children: (v.column.getCanSort() && {
2882
2882
  asc: /* @__PURE__ */ x.jsx(Sh, {}),
2883
2883
  desc: /* @__PURE__ */ x.jsx(mp, {})
2884
2884
  }[v.column.getIsSorted()]) ?? /* @__PURE__ */ x.jsx(Ih, { h: 2 }) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctlyst.id/internal-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-canary.0",
4
4
  "description": "Voila Internal UI Component",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -69,5 +69,5 @@
69
69
  "jest": "^29.4.1",
70
70
  "jest-environment-jsdom": "29.4.1"
71
71
  },
72
- "gitHead": "da41b932835d2285020a610eb1b3eb007798b99c"
72
+ "gitHead": "95a19cbec1694a33a6b73e1a8375291a516f32a2"
73
73
  }