import{y as ve,r as A,j as p,B as z,b8 as De,aJ as Ee,aP as je,u as Ce,aA as Ae,aB as Ge,aC as He,aD as Le,b_ as ze,cD as Ne,I as ke,aS as Oe}from"./index-Db-xuq0b.js";import{T as Te,a as Be,b as B,c as qe,d as Ue,e as Q}from"./table-D3n3VABd.js";import{S as Xe,a as Ke,b as Je,c as Qe,d as We}from"./select-BoQxM42A.js";import{C as Ye}from"./chevron-left-DCpEaNzo.js";import{c as fe}from"./utils-BncSPdK1.js";import{B as W}from"./badge-D7JvaQeJ.js";import{C as Ze,a as be,b as et,c as tt,d as pe,e as me,f as nt}from"./command-Cr0tMDDu.js";import{P as ot,a as rt,b as it}from"./popover-X-j_SRnG.js";import{S as lt}from"./separator-BaOOgzZX.js";import{R as st}from"./refresh-cw-JB7N413f.js";/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ut=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],at=ve("circle-plus",ut);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gt=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],dt=ve("settings-2",gt);/**
   * table-core
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function G(e,o){return typeof e=="function"?e(o):e}function V(e,o){return t=>{o.setState(n=>({...n,[e]:G(t,n[e])}))}}function J(e){return e instanceof Function}function ct(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function ft(e,o){const t=[],n=r=>{r.forEach(i=>{t.push(i);const l=o(i);l!=null&&l.length&&n(l)})};return n(e),t}function h(e,o,t){let n=[],r;return i=>{let l;t.key&&t.debug&&(l=Date.now());const s=e(i);if(!(s.length!==n.length||s?.some((c,S)=>n[S]!==c)))return r;n=s;let g;if(t.key&&t.debug&&(g=Date.now()),r=o(...s),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const c=Math.round((Date.now()-l)*100)/100,d=Math.round((Date.now()-g)*100)/100/16,u=(f,m)=>{for(f=String(f);f.length<m;)f=" "+f;return f}}return r}}function w(e,o,t,n){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[o]},key:!1,onChange:n}}function pt(e,o,t,n){const r=()=>{var l;return(l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:r,getContext:h(()=>[e,t,o,i],(l,s,a,g)=>({table:l,column:s,row:a,cell:g,getValue:g.getValue,renderValue:g.renderValue}),w(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(i,t,o,e)},{}),i}function mt(e,o,t,n){var r,i;const s={...e._getDefaultColumnDef(),...o},a=s.accessorKey;let g=(r=(i=s.id)!=null?i:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?r:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:a&&(a.includes(".")?c=d=>{let u=d;for(const m of a.split(".")){var f;u=(f=u)==null?void 0:f[m]}return u}:c=d=>d[s.accessorKey]),!g)throw new Error;let S={id:`${String(g)}`,accessorFn:c,parent:n,depth:t,columnDef:s,columns:[],getFlatColumns:h(()=>[!0],()=>{var d;return[S,...(d=S.columns)==null?void 0:d.flatMap(u=>u.getFlatColumns())]},w(e.options,"debugColumns")),getLeafColumns:h(()=>[e._getOrderColumnsFn()],d=>{var u;if((u=S.columns)!=null&&u.length){let f=S.columns.flatMap(m=>m.getLeafColumns());return d(f)}return[S]},w(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(S,e);return S}const y="debugHeaders";function Se(e,o,t){var n;let i={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders?.map(s),l.push(a)};return s(i),l},getContext:()=>({table:e,header:i,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(i,e)}),i}const St={createTable:e=>{e.getHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var i,l;const s=(i=n==null?void 0:n?.map(S=>t.find(d=>d.id===S)).filter(Boolean))!=null?i:[],a=(l=r==null?void 0:r?.map(S=>t.find(d=>d.id===S)).filter(Boolean))!=null?l:[],g=t.filter(S=>!(n!=null&&n.includes(S.id))&&!(r!=null&&r.includes(S.id)));return q(o,[...s,...g,...a],e)},w(e.options,y)),e.getCenterHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(r!=null&&r.includes(i.id))),q(o,t,e,"center")),w(e.options,y)),e.getLeftHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var r;const i=(r=n==null?void 0:n?.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return q(o,i,e,"left")},w(e.options,y)),e.getRightHeaderGroups=h(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var r;const i=(r=n==null?void 0:n?.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?r:[];return q(o,i,e,"right")},w(e.options,y)),e.getFooterGroups=h(()=>[e.getHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getLeftFooterGroups=h(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getCenterFooterGroups=h(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getRightFooterGroups=h(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),w(e.options,y)),e.getFlatHeaders=h(()=>[e.getHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getLeftFlatHeaders=h(()=>[e.getLeftHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getCenterFlatHeaders=h(()=>[e.getCenterHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getRightFlatHeaders=h(()=>[e.getRightHeaderGroups()],o=>o?.map(t=>t.headers).flat(),w(e.options,y)),e.getCenterLeafHeaders=h(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getLeftLeafHeaders=h(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getRightLeafHeaders=h(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),w(e.options,y)),e.getLeafHeaders=h(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,i,l,s,a,g;return[...(r=(i=o[0])==null?void 0:i.headers)!=null?r:[],...(l=(s=t[0])==null?void 0:s.headers)!=null?l:[],...(a=(g=n[0])==null?void 0:g.headers)!=null?a:[]]?.map(c=>c.getLeafHeaders()).flat()},w(e.options,y))}};function q(e,o,t,n){var r,i;let l=0;const s=function(d,u){u===void 0&&(u=1),l=Math.max(l,u),d.filter(f=>f.getIsVisible()).forEach(f=>{var m;(m=f.columns)!=null&&m.length&&s(f.columns,u+1)},0)};s(e);let a=[];const g=(d,u)=>{const f={depth:u,id:[n,`${u}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(v=>{const C=[...m].reverse()[0],R=v.column.depth===f.depth;let x,M=!1;if(R&&v.column.parent?x=v.column.parent:(x=v.column,M=!0),C&&(C==null?void 0:C.column)===x)C.subHeaders.push(v);else{const F=Se(t,x,{id:[n,u,x.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${m.filter(D=>D.column===x).length}`:void 0,depth:u,index:m.length});F.subHeaders.push(v),m.push(F)}f.headers.push(v),v.headerGroup=f}),a.push(f),u>0&&g(m,u-1)},c=o?.map((d,u)=>Se(t,d,{depth:l,index:u}));g(c,l-1),a.reverse();const S=d=>d.filter(f=>f.column.getIsVisible())?.map(f=>{let m=0,v=0,C=[0];f.subHeaders&&f.subHeaders.length?(C=[],S(f.subHeaders).forEach(x=>{let{colSpan:M,rowSpan:F}=x;m+=M,C.push(F)})):m=1;const R=Math.min(...C);return v=v+R,f.colSpan=m,f.rowSpan=v,{colSpan:m,rowSpan:v}});return S((r=(i=a[0])==null?void 0:i.headers)!=null?r:[]),a}const ae=(e,o,t,n,r,i,l)=>{let s={id:o,index:n,original:t,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return s._valuesCache[a]=g.accessorFn(s.original,n),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const g=e.getColumn(a);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=g.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var g;return(g=s.getValue(a))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>ft(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let a=[],g=s;for(;;){const c=g.getParentRow();if(!c)break;a.push(c),g=c}return a.reverse()},getAllCells:h(()=>[e.getAllLeafColumns()],a=>a?.map(g=>pt(e,s,g,g.id)),w(e.options,"debugRows")),_getAllCellsByColumnId:h(()=>[s.getAllCells()],a=>a.reduce((g,c)=>(g[c.column.id]=c,g),{}),w(e.options,"debugRows"))};for(let a=0;a<e._features.length;a++){const g=e._features[a];g==null||g.createRow==null||g.createRow(s,e)}return s},ht={createColumn:(e,o)=>{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Re=(e,o,t)=>{var n,r;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((r=e.getValue(o))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(i))};Re.autoRemove=e=>P(e);const xe=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};xe.autoRemove=e=>P(e);const _e=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};_e.autoRemove=e=>P(e);const Fe=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Fe.autoRemove=e=>P(e);const ye=(e,o,t)=>!t?.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});ye.autoRemove=e=>P(e)||!(e!=null&&e.length);const $e=(e,o,t)=>t?.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});$e.autoRemove=e=>P(e)||!(e!=null&&e.length);const Me=(e,o,t)=>e.getValue(o)===t;Me.autoRemove=e=>P(e);const Ve=(e,o,t)=>e.getValue(o)==t;Ve.autoRemove=e=>P(e);const ge=(e,o,t)=>{let[n,r]=t;const i=e.getValue(o);return i>=n&&i<=r};ge.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,r=typeof t!="number"?parseFloat(t):t,i=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(r)?1/0:r;if(i>l){const s=i;i=l,l=s}return[i,l]};ge.autoRemove=e=>P(e)||P(e[0])&&P(e[1]);const j={includesString:Re,includesStringSensitive:xe,equalsString:_e,arrIncludes:Fe,arrIncludesAll:ye,arrIncludesSome:$e,equals:Me,weakEquals:Ve,inNumberRange:ge};function P(e){return e==null||e===""}const wt={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:V("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?j.includesString:typeof n=="number"?j.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?j.equals:Array.isArray(n)?j.arrIncludes:j.weakEquals},e.getFilterFn=()=>{var t,n;return J(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:j[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const r=e.getFilterFn(),i=n==null?void 0:n.find(c=>c.id===e.id),l=G(t,i?i.value:void 0);if(he(r,l,e)){var s;return(s=n==null?void 0:n.filter(c=>c.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(i){var g;return(g=n==null?void 0:n?.map(c=>c.id===e.id?a:c))!=null?g:[]}return n!=null&&n.length?[...n,a]:[a]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=r=>{var i;return(i=G(o,r))==null?void 0:i.filter(l=>{const s=t.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(he(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function he(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const vt=(e,o,t)=>t.reduce((n,r)=>{const i=r.getValue(e);return n+(typeof i=="number"?i:0)},0),Ct=(e,o,t)=>{let n;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}),n},Rt=(e,o,t)=>{let n;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}),n},xt=(e,o,t)=>{let n,r;return t.forEach(i=>{const l=i.getValue(e);l!=null&&(n===void 0?l>=l&&(n=r=l):(n>l&&(n=l),r<l&&(r=l)))}),[n,r]},_t=(e,o)=>{let t=0,n=0;if(o.forEach(r=>{let i=r.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i)}),t)return n/t},Ft=(e,o)=>{if(!o.length)return;const t=o?.map(i=>i.getValue(e));if(!ct(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((i,l)=>i-l);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},yt=(e,o)=>Array.from(new Set(o?.map(t=>t.getValue(e))).values()),$t=(e,o)=>new Set(o?.map(t=>t.getValue(e))).size,Mt=(e,o)=>o.length,Y={sum:vt,min:Ct,max:Rt,extent:xt,mean:_t,median:Ft,unique:yt,uniqueCount:$t,count:Mt},Vt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:V("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return Y.sum;if(Object.prototype.toString.call(n)==="[object Date]")return Y.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return J(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:Y[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function It(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(i=>!o.includes(i.id));return t==="remove"?n:[...o?.map(i=>e.find(l=>l.id===i)).filter(Boolean),...n]}const Pt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:V("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=h(t=>[T(o,t)],t=>t.findIndex(n=>n.id===e.id),w(o.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=T(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=T(o,t);return((n=r[r.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=h(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>r=>{let i=[];if(!(o!=null&&o.length))i=r;else{const l=[...o],s=[...r];for(;s.length&&l.length;){const a=l.shift(),g=s.findIndex(c=>c.id===a);g>-1&&i.push(s.splice(g,1)[0])}i=[...i,...s]}return It(i,t,n)},w(e.options,"debugTable"))}},Z=()=>({left:[],right:[]}),Dt={getInitialState:e=>({columnPinning:Z(),...e}),getDefaultOptions:e=>({onColumnPinningChange:V("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns()?.map(r=>r.id).filter(Boolean);o.setColumnPinning(r=>{var i,l;if(t==="right"){var s,a;return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(S=>!(n!=null&&n.includes(S))),right:[...((a=r==null?void 0:r.right)!=null?a:[]).filter(S=>!(n!=null&&n.includes(S))),...n]}}if(t==="left"){var g,c;return{left:[...((g=r==null?void 0:r.left)!=null?g:[]).filter(S=>!(n!=null&&n.includes(S))),...n],right:((c=r==null?void 0:r.right)!=null?c:[]).filter(S=>!(n!=null&&n.includes(S)))}}return{left:((i=r==null?void 0:r.left)!=null?i:[]).filter(S=>!(n!=null&&n.includes(S))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(S=>!(n!=null&&n.includes(S)))}})},e.getCanPin=()=>e.getLeafColumns()?.some(n=>{var r,i,l;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((i=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns()?.map(s=>s.id),{left:n,right:r}=o.getState().columnPinning,i=t?.some(s=>n==null?void 0:n.includes(s)),l=t?.some(s=>r==null?void 0:r.includes(s));return i?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();return r?(t=(n=o.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(l=>!i.includes(l.column.id))},w(o.options,"debugRows")),e.getLeftVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[])?.map(i=>t.find(l=>l.column.id===i)).filter(Boolean)?.map(i=>({...i,position:"left"})),w(o.options,"debugRows")),e.getRightVisibleCells=h(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[])?.map(i=>t.find(l=>l.column.id===i)).filter(Boolean)?.map(i=>({...i,position:"right"})),w(o.options,"debugRows"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?Z():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:Z())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var r,i;return!!((r=n.left)!=null&&r.length||(i=n.right)!=null&&i.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[])?.map(n=>o.find(r=>r.id===n)).filter(Boolean),w(e.options,"debugColumns")),e.getRightLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[])?.map(n=>o.find(r=>r.id===n)).filter(Boolean),w(e.options,"debugColumns")),e.getCenterLeafColumns=h(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const r=[...t??[],...n??[]];return o.filter(i=>!r.includes(i.id))},w(e.options,"debugColumns"))}};function Et(e){return e||(typeof document<"u"?document:null)}const U={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},b=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jt={getDefaultColumnDef:()=>U,getInitialState:e=>({columnSizing:{},columnSizingInfo:b(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:V("columnSizing",e),onColumnSizingInfoChange:V("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,r;const i=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:U.minSize,(n=i??e.columnDef.size)!=null?n:U.size),(r=e.columnDef.maxSize)!=null?r:U.maxSize)},e.getStart=h(t=>[t,T(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,i)=>r+i.getSize(),0),w(o.options,"debugColumns")),e.getAfter=h(t=>[t,T(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,i)=>r+i.getSize(),0),w(o.options,"debugColumns")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=r=>{if(r.subHeaders.length)r.subHeaders.forEach(n);else{var i;t+=(i=r.column.getSize())!=null?i:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),ee(i)&&i.touches&&i.touches.length>1))return;const l=e.getSize(),s=e?e.getLeafHeaders()?.map(C=>[C.column.id,C.column.getSize()]):[[n.id,n.getSize()]],a=ee(i)?Math.round(i.touches[0].clientX):i.clientX,g={},c=(C,R)=>{typeof R=="number"&&(o.setColumnSizingInfo(x=>{var M,F;const D=o.options.columnResizeDirection==="rtl"?-1:1,L=(R-((M=x==null?void 0:x.startOffset)!=null?M:0))*D,N=Math.max(L/((F=x==null?void 0:x.startSize)!=null?F:0),-.999999);return x.columnSizingStart.forEach(k=>{let[E,_]=k;g[E]=Math.round(Math.max(_+_*N,0)*100)/100}),{...x,deltaOffset:L,deltaPercentage:N}}),(o.options.columnResizeMode==="onChange"||C==="end")&&o.setColumnSizing(x=>({...x,...g})))},S=C=>c("move",C),d=C=>{c("end",C),o.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=Et(t),f={moveHandler:C=>S(C.clientX),upHandler:C=>{u==null||u.removeEventListener("mousemove",f.moveHandler),u==null||u.removeEventListener("mouseup",f.upHandler),d(C.clientX)}},m={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),S(C.touches[0].clientX),!1),upHandler:C=>{var R;u==null||u.removeEventListener("touchmove",m.moveHandler),u==null||u.removeEventListener("touchend",m.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),d((R=C.touches[0])==null?void 0:R.clientX)}},v=At()?{passive:!1}:!1;ee(i)?(u==null||u.addEventListener("touchmove",m.moveHandler,v),u==null||u.addEventListener("touchend",m.upHandler,v)):(u==null||u.addEventListener("mousemove",f.moveHandler,v),u==null||u.addEventListener("mouseup",f.upHandler,v)),o.setColumnSizingInfo(C=>({...C,startOffset:a,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?b():(t=e.initialState.columnSizingInfo)!=null?t:b())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0}}};let X=null;function At(){if(typeof X=="boolean")return X;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return X=e,X}function ee(e){return e.type==="touchstart"}const Gt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:V("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const r=e.columns;return(t=r.length?r?.some(i=>i.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=h(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),w(o.options,"debugRows")),e.getVisibleCells=h(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],w(o.options,"debugRows"))},createTable:e=>{const o=(t,n)=>h(()=>[n(),n().filter(r=>r.getIsVisible())?.map(r=>r.id).join("_")],r=>r.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),w(e.options,"debugColumns"));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,i)=>({...r,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns()?.some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns()?.some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function T(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Ht={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Lt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:V("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,r,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&((i=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>j.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return J(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:j[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},zt={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:V("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var r,i;e.setExpanded(n?{}:(r=(i=e.initialState)==null?void 0:i.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows?.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n)?.some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows?.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const l=i.split(".");n=Math.max(n,l.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var r;const i=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=n,t=(r=t)!=null?r:!i,!i&&t)return{...l,[e.id]:!0};if(i&&!t){const{[e.id]:s,...a}=l;return a}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,r;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},re=0,ie=10,te=()=>({pageIndex:re,pageSize:ie}),Nt={getInitialState:e=>({...e,pagination:{...te(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:V("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const r=i=>G(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?te():(r=e.initialState.pagination)!=null?r:te())},e.setPageIndex=n=>{e.setPagination(r=>{let i=G(n,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,l)),{...r,pageIndex:i}})},e.resetPageIndex=n=>{var r,i;e.setPageIndex(n?re:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?r:re)},e.resetPageSize=n=>{var r,i;e.setPageSize(n?ie:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?r:ie)},e.setPageSize=n=>{e.setPagination(r=>{const i=Math.max(1,G(n,r.pageSize)),l=r.pageSize*r.pageIndex,s=Math.floor(l/i);return{...r,pageIndex:s,pageSize:i}})},e.setPageCount=n=>e.setPagination(r=>{var i;let l=G(n,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=h(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null)?.map((i,l)=>l)),r},w(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:n<r-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},ne=()=>({top:[],bottom:[]}),kt={getInitialState:e=>({rowPinning:ne(),...e}),getDefaultOptions:e=>({onRowPinningChange:V("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const i=n?e.getLeafRows()?.map(a=>{let{id:g}=a;return g}):[],l=r?e.getParentRows()?.map(a=>{let{id:g}=a;return g}):[],s=new Set([...l,e.id,...i]);o.setRowPinning(a=>{var g,c;if(t==="bottom"){var S,d;return{top:((S=a==null?void 0:a.top)!=null?S:[]).filter(m=>!(s!=null&&s.has(m))),bottom:[...((d=a==null?void 0:a.bottom)!=null?d:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)]}}if(t==="top"){var u,f;return{top:[...((u=a==null?void 0:a.top)!=null?u:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)],bottom:((f=a==null?void 0:a.bottom)!=null?f:[]).filter(m=>!(s!=null&&s.has(m)))}}return{top:((g=a==null?void 0:a.top)!=null?g:[]).filter(m=>!(s!=null&&s.has(m))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(m=>!(s!=null&&s.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:r}=o.options;return typeof n=="function"?n(e):(t=n??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:r}=o.getState().rowPinning,i=t?.some(s=>n==null?void 0:n.includes(s)),l=t?.some(s=>r==null?void 0:r.includes(s));return i?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();if(!r)return-1;const i=(t=r==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t?.map(l=>{let{id:s}=l;return s});return(n=i==null?void 0:i.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?ne():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:ne())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var r,i;return!!((r=n.top)!=null&&r.length||(i=n.bottom)!=null&&i.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[])?.map(l=>{const s=e.getRow(l,!0);return s.getIsAllParentsExpanded()?s:null}):(t??[])?.map(l=>o.find(s=>s.id===l))).filter(Boolean)?.map(l=>({...l,position:n}))},e.getTopRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),w(e.options,"debugRows")),e.getBottomRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),w(e.options,"debugRows")),e.getCenterRows=h(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const r=new Set([...t??[],...n??[]]);return o.filter(i=>!r.has(i.id))},w(e.options,"debugRows"))}},Ot={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:V("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},r=e.getPreGroupedRowModel().flatRows;return o?r.forEach(i=>{i.getCanSelect()&&(n[i.id]=!0)}):r.forEach(i=>{delete n[i.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(i=>{le(r,i.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=h(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getFilteredSelectedRowModel=h(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getGroupedSelectedRowModel=h(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?oe(e,t):{rows:[],flatRows:[],rowsById:{}},w(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o?.some(r=>r.getCanSelect()&&!t[r.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o?.some(r=>!t[r.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect())?.some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const r=e.getIsSelected();o.setRowSelection(i=>{var l;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return i;const s={...i};return le(s,e.id,t,(l=n==null?void 0:n.selectChildren)!=null?l:!0,o),s})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return de(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return se(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return se(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected((r=n.target)==null?void 0:r.checked)}}}},le=(e,o,t,n,r)=>{var i;const l=r.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(i=l.subRows)!=null&&i.length&&l.getCanSelectSubRows()&&l.subRows.forEach(s=>le(e,s.id,t,n,r))};function oe(e,o){const t=e.getState().rowSelection,n=[],r={},i=function(l,s){return l?.map(a=>{var g;const c=de(a,t);if(c&&(n.push(a),r[a.id]=a),(g=a.subRows)!=null&&g.length&&(a={...a,subRows:i(a.subRows)}),c)return a}).filter(Boolean)};return{rows:i(o.rows),flatRows:n,rowsById:r}}function de(e,o){var t;return(t=o[e.id])!=null?t:!1}function se(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,i=!1;return e.subRows.forEach(l=>{if(!(i&&!r)&&(l.getCanSelect()&&(de(l,o)?i=!0:r=!1),l.subRows&&l.subRows.length)){const s=se(l,o);s==="all"?i=!0:(s==="some"&&(i=!0),r=!1)}}),r?"all":i?"some":!1}const ue=/([0-9]+)/gm,Tt=(e,o,t)=>Ie(H(e.getValue(t)).toLowerCase(),H(o.getValue(t)).toLowerCase()),Bt=(e,o,t)=>Ie(H(e.getValue(t)),H(o.getValue(t))),qt=(e,o,t)=>ce(H(e.getValue(t)).toLowerCase(),H(o.getValue(t)).toLowerCase()),Ut=(e,o,t)=>ce(H(e.getValue(t)),H(o.getValue(t))),Xt=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:n<r?-1:0},Kt=(e,o,t)=>ce(e.getValue(t),o.getValue(t));function ce(e,o){return e===o?0:e>o?1:-1}function H(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ie(e,o){const t=e.split(ue).filter(Boolean),n=o.split(ue).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),i=n.shift(),l=parseInt(r,10),s=parseInt(i,10),a=[l,s].sort();if(isNaN(a[0])){if(r>i)return 1;if(i>r)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return t.length-n.length}const O={alphanumeric:Tt,alphanumericCaseSensitive:Bt,text:qt,textCaseSensitive:Ut,datetime:Xt,basic:Kt},Jt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:V("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const r of t){const i=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return O.datetime;if(typeof i=="string"&&(n=!0,i.split(ue).length>1))return O.alphanumeric}return n?O.text:O.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return J(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:O[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;o.setSorting(l=>{const s=l==null?void 0:l.find(u=>u.id===e.id),a=l==null?void 0:l.findIndex(u=>u.id===e.id);let g=[],c,S=i?t:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":l!=null&&l.length&&a!==l.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(i||r||(c="remove")),c==="add"){var d;g=[...l,{id:e.id,desc:S}],g.splice(0,g.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?g=l?.map(u=>u.id===e.id?{...u,desc:S}:u):c==="remove"?g=l.filter(u=>u.id!==e.id):g=[{id:e.id,desc:S}];return g})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,r;const i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Qt=[St,Gt,Pt,Dt,ht,wt,Ht,Lt,Jt,Vt,zt,Nt,kt,Ot,jt];function Wt(e){var o,t;const n=[...Qt,...(o=e._features)!=null?o:[]];let r={_features:n};const i=r._features.reduce((d,u)=>Object.assign(d,u.getDefaultOptions==null?void 0:u.getDefaultOptions(r)),{}),l=d=>r.options.mergeOptions?r.options.mergeOptions(i,d):{...i,...d};let a={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(d=>{var u;a=(u=d.getInitialState==null?void 0:d.getInitialState(a))!=null?u:a});const g=[];let c=!1;const S={_features:n,options:{...i,...e},initialState:a,_queue:d=>{g.push(d),c||(c=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();c=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{r.setState(r.initialState)},setOptions:d=>{const u=G(d,r.options);r.options=l(u)},getState:()=>r.options.state,setState:d=>{r.options.onStateChange==null||r.options.onStateChange(d)},_getRowId:(d,u,f)=>{var m;return(m=r.options.getRowId==null?void 0:r.options.getRowId(d,u,f))!=null?m:`${f?[f.id,u].join("."):u}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(d,u)=>{let f=(u?r.getPrePaginationRowModel():r.getRowModel()).rowsById[d];if(!f&&(f=r.getCoreRowModel().rowsById[d],!f))throw new Error;return f},_getDefaultColumnDef:h(()=>[r.options.defaultColumn],d=>{var u;return d=(u=d)!=null?u:{},{header:f=>{const m=f.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:f=>{var m,v;return(m=(v=f.renderValue())==null||v.toString==null?void 0:v.toString())!=null?m:null},...r._features.reduce((f,m)=>Object.assign(f,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},w(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:h(()=>[r._getColumnDefs()],d=>{const u=function(f,m,v){return v===void 0&&(v=0),f?.map(C=>{const R=mt(r,C,v,m),x=C;return R.columns=x.columns?u(x.columns,R,v+1):[],R})};return u(d)},w(e,"debugColumns")),getAllFlatColumns:h(()=>[r.getAllColumns()],d=>d.flatMap(u=>u.getFlatColumns()),w(e,"debugColumns")),_getAllFlatColumnsById:h(()=>[r.getAllFlatColumns()],d=>d.reduce((u,f)=>(u[f.id]=f,u),{}),w(e,"debugColumns")),getAllLeafColumns:h(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(d,u)=>{let f=d.flatMap(m=>m.getLeafColumns());return u(f)},w(e,"debugColumns")),getColumn:d=>r._getAllFlatColumnsById()[d]};Object.assign(r,S);for(let d=0;d<r._features.length;d++){const u=r._features[d];u==null||u.createTable==null||u.createTable(r)}return r}function Yt(){return e=>h(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,i,l){i===void 0&&(i=0);const s=[];for(let g=0;g<r.length;g++){const c=ae(e,e._getRowId(r[g],g,l),r[g],g,i,void 0,l==null?void 0:l.id);if(t.flatRows.push(c),t.rowsById[c.id]=c,s.push(c),e.options.getSubRows){var a;c.originalSubRows=e.options.getSubRows(r[g],g),(a=c.originalSubRows)!=null&&a.length&&(c.subRows=n(c.originalSubRows,i+1,c))}}return s};return t.rows=n(o),t},w(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Pe(e,o,t){return t.options.filterFromLeafRows?Zt(e,o,t):bt(e,o,t)}function Zt(e,o,t){var n;const r=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,s=function(a,g){g===void 0&&(g=0);const c=[];for(let d=0;d<a.length;d++){var S;let u=a[d];const f=ae(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);if(f.columnFilters=u.columnFilters,(S=u.subRows)!=null&&S.length&&g<l){if(f.subRows=s(u.subRows,g+1),u=f,o(u)&&!f.subRows.length){c.push(u),i[u.id]=u,r.push(u);continue}if(o(u)||f.subRows.length){c.push(u),i[u.id]=u,r.push(u);continue}}else u=f,o(u)&&(c.push(u),i[u.id]=u,r.push(u))}return c};return{rows:s(e),flatRows:r,rowsById:i}}function bt(e,o,t){var n;const r=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,s=function(a,g){g===void 0&&(g=0);const c=[];for(let d=0;d<a.length;d++){let u=a[d];if(o(u)){var S;if((S=u.subRows)!=null&&S.length&&g<l){const m=ae(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);m.subRows=s(u.subRows,g+1),u=m}c.push(u),r.push(u),i[u.id]=u}}return c};return{rows:s(e),flatRows:r,rowsById:i}}function en(){return(e,o)=>h(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r)return t;const i=[...n?.map(s=>s.id).filter(s=>s!==o),r?"__global__":void 0].filter(Boolean),l=s=>{for(let a=0;a<i.length;a++)if(s.columnFilters[i[a]]===!1)return!1;return!0};return Pe(t.rows,l,e)},w(e.options,"debugTable"))}function tn(){return(e,o)=>h(()=>{var t;return[(t=e.getColumn(o))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let n=new Map;for(let i=0;i<t.flatRows.length;i++){const l=t.flatRows[i].getUniqueValues(o);for(let s=0;s<l.length;s++){const a=l[s];if(n.has(a)){var r;n.set(a,((r=n.get(a))!=null?r:0)+1)}else n.set(a,1)}}return n},w(e.options,"debugTable"))}function nn(){return e=>h(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d<o.flatRows.length;d++)o.flatRows[d].columnFilters={},o.flatRows[d].columnFiltersMeta={};return o}const r=[],i=[];(t??[]).forEach(d=>{var u;const f=e.getColumn(d.id);if(!f)return;const m=f.getFilterFn();m&&r.push({id:d.id,filterFn:m,resolvedValue:(u=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?u:d.value})});const l=(t??[])?.map(d=>d.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&s&&a.length&&(l.push("__global__"),a.forEach(d=>{var u;i.push({id:d.id,filterFn:s,resolvedValue:(u=s.resolveFilterValue==null?void 0:s.resolveFilterValue(n))!=null?u:n})}));let g,c;for(let d=0;d<o.flatRows.length;d++){const u=o.flatRows[d];if(u.columnFilters={},r.length)for(let f=0;f<r.length;f++){g=r[f];const m=g.id;u.columnFilters[m]=g.filterFn(u,m,g.resolvedValue,v=>{u.columnFiltersMeta[m]=v})}if(i.length){for(let f=0;f<i.length;f++){c=i[f];const m=c.id;if(c.filterFn(u,m,c.resolvedValue,v=>{u.columnFiltersMeta[m]=v})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const S=d=>{for(let u=0;u<l.length;u++)if(d.columnFilters[l[u]]===!1)return!1;return!0};return Pe(o.rows,S,e)},w(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function on(){return e=>h(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,r=[],i=n.filter(a=>{var g;return(g=e.getColumn(a.id))==null?void 0:g.getCanSort()}),l={};i.forEach(a=>{const g=e.getColumn(a.id);g&&(l[a.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const s=a=>{const g=a?.map(c=>({...c}));return g.sort((c,S)=>{for(let u=0;u<i.length;u+=1){var d;const f=i[u],m=l[f.id],v=m.sortUndefined,C=(d=f==null?void 0:f.desc)!=null?d:!1;let R=0;if(v){const x=c.getValue(f.id),M=S.getValue(f.id),F=x===void 0,D=M===void 0;if(F||D){if(v==="first")return F?-1:1;if(v==="last")return F?1:-1;R=F&&D?0:F?v:-v}}if(R===0&&(R=m.sortingFn(c,S,f.id)),R!==0)return C&&(R*=-1),m.invertSorting&&(R*=-1),R}return c.index-S.index}),g.forEach(c=>{var S;r.push(c),(S=c.subRows)!=null&&S.length&&(c.subRows=s(c.subRows))}),g};return{rows:s(t.rows),flatRows:r,rowsById:t.rowsById}},w(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
   * react-table
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function we(e,o){return e?rn(e)?A.createElement(e,o):e:null}function rn(e){return ln(e)||typeof e=="function"||sn(e)}function ln(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function sn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function un(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=A.useState(()=>({current:Wt(o)})),[n,r]=A.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}const K="…";function an(e,o,t){const n=t*2+5;if(o<=n)return Array.from({length:o},(g,c)=>c+1);const r=Math.max(e-t,2),i=Math.min(e+t,o-1),l=r>2,s=i<o-1,a=[1];l&&a.push(K);for(let g=r;g<=i;g++)a.push(g);return s&&a.push(K),a.push(o),a}function gn({table:e,pageIndex:o,pageSize:t,itemCount:n,onPageChange:r,onPageSizeChange:i,nextFunction:l,prevFunction:s,pageCount:a,siblingCount:g=1}){var k,E;const c=e?((k=e.getState().pagination)==null?void 0:k.pageSize)??10:t??10,S=e?((E=e.getState().pagination)==null?void 0:E.pageIndex)??0:o??0,d=e?e.getPageCount():a??Math.max(1,Math.ceil((n??0)/c)),u=S+1,f=e?e.getCanNextPage():S<d-1,m=e?e.getCanPreviousPage():S>0,v=A.useMemo(()=>an(u,d,g),[u,d,g]);if(e?e.getCoreRowModel().rows.length===0&&(!n||n===0):n!==void 0&&n===0)return null;const R=!!e||!!i;if(d<=1&&!R)return null;const x=()=>{f&&(e?e.nextPage():r==null||r(S+1),l==null||l())},M=()=>{m&&(e?e.previousPage():r==null||r(S-1),s==null||s())},F=_=>{const $=Math.min(Math.max(_,1),d);$-1!==S&&(e?e.setPageIndex($-1):r==null||r($-1))},D=_=>{e?e.setPageSize(_):i==null||i(_)},L=S*c+1,N=Math.min(L+c-1,n??0);return p.jsxs("nav",{role:"navigation","aria-label":"Pagination",className:"flex flex-col gap-3 px-2 py-3 text-sm sm:flex-row sm:items-center sm:justify-between",children:[R?p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("p",{className:"text-xs sm:text-sm font-medium whitespace-nowrap",children:"Rows per page"}),p.jsxs(Xe,{value:`${c}`,onValueChange:_=>{D(Number(_))},children:[p.jsx(Ke,{className:"h-9 sm:h-8 w-[70px] min-w-[70px] text-sm",children:p.jsx(Je,{placeholder:c})}),p.jsx(Qe,{side:"top",children:[10,20,30,40,50]?.map(_=>p.jsx(We,{value:`${_}`,children:_},_))})]})]}):p.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground dark:text-gray-400",children:["Showing"," ",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:L}),"–",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:N})," ","of"," ",p.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:n})]}),p.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1",children:[p.jsxs(z,{variant:"outline",size:"sm",onClick:M,disabled:!m,"aria-label":"Previous page",className:"h-8 gap-1 px-3 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p.jsx(Ye,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Previous"})]}),p.jsx("ul",{className:"flex items-center gap-1",children:v?.map((_,$)=>{if(_===K)return p.jsx("li",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center text-gray-400 dark:text-gray-500",children:K},`ellipsis-${$}`);const I=_===u;return p.jsx("li",{children:p.jsx(z,{type:"button",variant:I?"default":"ghost",size:"sm",onClick:()=>F(_),"aria-current":I?"page":void 0,"aria-label":`Go to page ${_}`,className:De("h-8 min-w-8 px-2 text-sm transition-colors",I?"bg-primary text-primary-foreground font-bold hover:bg-primary/90 dark:bg-primary dark:text-primary-foreground":"font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"),children:_})},_)})}),p.jsxs(z,{variant:"outline",size:"sm",onClick:x,disabled:!f,"aria-label":"Next page",className:"h-8 gap-1 px-3 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:[p.jsx("span",{className:"hidden sm:inline",children:"Next"}),p.jsx(Ee,{className:"h-4 w-4"})]})]})]})}function dn({column:e,title:o,options:t}){const n=e==null?void 0:e.getFacetedUniqueValues(),r=new Set(e==null?void 0:e.getFilterValue());return p.jsxs(ot,{children:[p.jsx(rt,{asChild:!0,children:p.jsxs(z,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[p.jsx(at,{className:"mr-2 h-4 w-4"}),o,(r==null?void 0:r.size)>0&&p.jsxs(p.Fragment,{children:[p.jsx(lt,{orientation:"vertical",className:"mx-2 h-4"}),p.jsx(W,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),p.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?p.jsxs(W,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(i=>r.has(i.value))?.map(i=>p.jsx(W,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),p.jsx(it,{className:"w-[200px] p-0",align:"start",children:p.jsxs(Ze,{children:[p.jsx(be,{placeholder:o}),p.jsxs(et,{children:[p.jsx(tt,{children:"No results found."}),p.jsx(pe,{children:t?.map(i=>{const l=r.has(i.value);return p.jsxs(me,{onSelect:()=>{l?r.delete(i.value):r.add(i.value);const s=Array.from(r);e==null||e.setFilterValue(s.length?s:void 0)},children:[p.jsx("div",{className:fe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:p.jsx(je,{className:fe("h-4 w-4")})}),i.icon&&p.jsx(i.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),p.jsx("span",{children:i.label}),(n==null?void 0:n.get(i.value))&&p.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(i.value)})]},i.value)})}),r.size>0&&p.jsxs(p.Fragment,{children:[p.jsx(nt,{}),p.jsx(pe,{children:p.jsx(me,{onSelect:()=>e==null?void 0:e.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function cn({table:e,refreshTable:o}){const[t,n]=A.useState(!1),r=async()=>{if(o)try{n(!0),await o()}finally{n(!1)}},{t:i}=Ce();return p.jsxs("div",{className:"flex flex-wrap justify-end gap-2 sm:gap-3 mt-2",children:[p.jsxs(z,{variant:"outline",size:"sm",className:"h-8",onClick:r,children:[p.jsx(st,{className:`mr-2 transition-transform duration-500 ${t?"animate-spin":""}`}),i("dashboard.refresh")]}),p.jsxs(Ae,{children:[p.jsx(Ge,{asChild:!0,children:p.jsxs(z,{variant:"outline",size:"sm",className:"h-8",children:[p.jsx(dt,{className:"mr-2"}),i("viewDetail.view")]})}),p.jsxs(He,{align:"end",className:"w-[150px]",children:[p.jsx(Le,{children:i("viewDetail.toogleColumns")}),p.jsx(ze,{}),e.getAllColumns().filter(l=>typeof l.accessorFn<"u"&&l.getCanHide())?.map(l=>p.jsx(Ne,{className:"capitalize",checked:l.getIsVisible(),onCheckedChange:s=>l.toggleVisibility(!!s),children:i(`toogle.${l.id}`)},l.id))]})]})]})}function fn({table:e,tableName:o,toolBarPosition:t="left",extraToolbar:n,filters:r=[],refreshTable:i,onGlobalFilterChange:l,hideToolbarFilter:s=!1}){const a=e.getState().columnFilters.length>0;return p.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!s&&p.jsx(ke,{placeholder:`Filter ${o}...`,onChange:g=>{const c=g.target.value;e.setGlobalFilter(c),l==null||l(c)},className:"h-8 w-full sm:w-[150px] lg:w-[250px]"}),r?.map(({columnKey:g,title:c,options:S,isVisible:d=!0})=>d&&e.getColumn(g)&&p.jsx(dn,{column:e.getColumn(g),title:c,options:S},g)),a&&p.jsxs(z,{variant:"ghost",onClick:()=>e.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",p.jsx(Oe,{className:"ml-2 h-4 w-4"})]})]}),p.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${t==="center"?"justify-center":t==="left"?"justify-start":"justify-end"}`,children:[n,p.jsx(cn,{table:e,refreshTable:i})]})]})}function Fn({columns:e,data:o,tableName:t,initialColumnVisibility:n,extraToolbar:r,toolBarPosition:i="right",isLoading:l=!1,itemCount:s,onPageChange:a,onPageSizeChange:g,nextFunction:c,prevFunction:S,pageIndex:d,pageSize:u=10,refresh:f,onGlobalFilterChange:m,hideToolbarFilter:v=!1}){var _;const[C,R]=A.useState([]),[x,M]=A.useState([]),[F,D]=A.useState(()=>({letterName:!1,fileName:!1,...n??{}})),[L,N]=A.useState({}),{t:k}=Ce(),E=un({data:o,columns:e,pageCount:u>0?Math.ceil(s/u):1,state:{sorting:C,columnVisibility:F,rowSelection:L,columnFilters:x,pagination:{pageIndex:d,pageSize:u}},manualPagination:!0,enableRowSelection:!0,onRowSelectionChange:N,onSortingChange:R,onColumnFiltersChange:M,onColumnVisibilityChange:D,getCoreRowModel:Yt(),getFilteredRowModel:nn(),getSortedRowModel:on(),getFacetedRowModel:en(),getFacetedUniqueValues:tn()});return p.jsxs("div",{className:"space-y-4",children:[p.jsx(fn,{table:E,tableName:t,extraToolbar:r,toolBarPosition:i,refreshTable:f,onGlobalFilterChange:m,hideToolbarFilter:v}),p.jsx("div",{className:"rounded-md border dark:border-gray-700 bg-white dark:bg-gray-900 overflow-x-auto font-urbanist custom-scrollbar",children:p.jsxs(Te,{className:"w-full text-base text-gray-700 dark:text-gray-300 font-urbanist",children:[p.jsx(Be,{className:"bg-gray-50 dark:bg-gray-800",children:E.getHeaderGroups()?.map($=>p.jsx(B,{className:"dark:border-gray-700",children:$.headers?.map(I=>p.jsx(qe,{className:"text-base text-gray-500 dark:text-gray-400 dark:bg-gray-800",children:I.isPlaceholder?null:we(I.column.columnDef.header,I.getContext())},I.id))},$.id))}),p.jsx(Ue,{children:l?p.jsx(B,{children:p.jsx(Q,{colSpan:e.length,className:"text-center py-6",children:"Loading..."})}):(_=E.getRowModel().rows)!=null&&_.length?E.getRowModel().rows?.map($=>p.jsx(B,{"data-state":$.getIsSelected()&&"selected",className:`
                      transition-colors duration-150
                      ${$.original.isUrgent===!0&&t==="Pending Records"||$.original.signStatus==="draft"&&t==="Collaborations"||$.original.action==="inprogress"&&t==="My Approval Records"?"bg-yellow-200 dark:bg-yellow-900/30 hover:bg-yellow-300 dark:hover:bg-yellow-900/50":"hover:bg-gray-100 dark:hover:bg-gray-800"}
                          ${t==="Pending Approval Tasks"&&"bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/30 font-semibold border-l-4 border-l-primary-500 dark:border-l-primary-400"}
                  `,children:$.getVisibleCells()?.map(I=>p.jsx(Q,{className:"py-4",children:p.jsx("div",{className:"max-h-[110px] max-w-[460px] overflow-y-auto overflow-x-auto scrollbar-hidden hover:cursor-pointer custom-scrollbar",children:we(I.column.columnDef.cell,I.getContext())})},I.id))},$.id)):p.jsx(B,{children:p.jsx(Q,{colSpan:e.length,className:"text-center py-6",children:k("common.noResult")})})})]})}),s>u&&p.jsx(gn,{pageIndex:d,pageSize:u,itemCount:s,onPageChange:a,onPageSizeChange:g,nextFunction:c,prevFunction:S})]})}export{Fn as A,at as C};
