import{r as e}from"./vendor--leCAzSo.js";
/**
 * 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 t(e,t){return"function"==typeof e?e(t):e}function n(e,n){return l=>{n.setState(n=>({...n,[e]:t(l,n[e])}))}}function l(e){return e instanceof Function}function o(e,t,n){let l,o=[];return()=>{let i;n.key&&n.debug&&(i=Date.now());const r=e();if(!(r.length!==o.length||r.some((e,t)=>o[t]!==e)))return l;let u;if(o=r,n.key&&n.debug&&(u=Date.now()),l=t(...r),null==n||null==n.onChange||n.onChange(l),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-u))/100,l=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n            font-size: .6rem;\n            font-weight: bold;\n            color: hsl(${Math.max(0,Math.min(120-120*l,120))}deg 100% 31%);`,null==n?void 0:n.key)}return l}}function i(e,t,n){var l;let o={id:null!=(l=n.id)?l:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(t=>{Object.assign(o,null==t.createHeader?void 0:t.createHeader(o,e))}),o}const r={createTable:e=>({getHeaderGroups:o(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l,o)=>{var i,r;const a=null!=(i=null==l?void 0:l.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],s=null!=(r=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?r:[];return u(t,[...a,...n.filter(e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id))),...s],e)},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterHeaderGroups:o(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l,o)=>u(t,n=n.filter(e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id))),e,"center"),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftHeaderGroups:o(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,l)=>{var o;return u(t,null!=(o=null==l?void 0:l.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[],e,"left")},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightHeaderGroups:o(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,l)=>{var o;return u(t,null!=(o=null==l?void 0:l.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[],e,"right")},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getFooterGroups:o(()=>[e.getHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftFooterGroups:o(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterFooterGroups:o(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightFooterGroups:o(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getFlatHeaders:o(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftFlatHeaders:o(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterFlatHeaders:o(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightFlatHeaders:o(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterLeafHeaders:o(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftLeafHeaders:o(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightLeafHeaders:o(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeafHeaders:o(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var l,o,i,r,u,a;return[...null!=(l=null==(o=e[0])?void 0:o.headers)?l:[],...null!=(i=null==(r=t[0])?void 0:r.headers)?i:[],...null!=(u=null==(a=n[0])?void 0:a.headers)?u:[]].map(e=>e.getLeafHeaders()).flat()},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}})})};function u(e,t,n,l){var o,r;let u=0;const a=function(e,t){void 0===t&&(t=1),u=Math.max(u,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&a(e.columns,t+1)},0)};a(e);let s=[];const g=(e,t)=>{const o={depth:t,id:[l,`${t}`].filter(Boolean).join("_"),headers:[]},r=[];e.forEach(e=>{const u=[...r].reverse()[0];let a,s=!1;if(e.column.depth===o.depth&&e.column.parent?a=e.column.parent:(a=e.column,s=!0),u&&(null==u?void 0:u.column)===a)u.subHeaders.push(e);else{const o=i(n,a,{id:[l,t,a.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:s,placeholderId:s?`${r.filter(e=>e.column===a).length}`:void 0,depth:t,index:r.length});o.subHeaders.push(e),r.push(o)}o.headers.push(e),e.headerGroup=o}),s.push(o),t>0&&g(r,t-1)},d=t.map((e,t)=>i(n,e,{depth:u,index:t}));g(d,u-1),s.reverse();const c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,l=[0];e.subHeaders&&e.subHeaders.length?(l=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:o}=e;t+=n,l.push(o)})):t=1;return n+=Math.min(...l),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(null!=(o=null==(r=s[0])?void 0:r.headers)?o:[]),s}const a={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},s={getDefaultColumnDef:()=>a,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:n("columnSizing",e),onColumnSizingInfoChange:n("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,l,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:a.minSize,null!=(l=null!=i?i:e.columnDef.size)?l:a.size),null!=(o=e.columnDef.maxSize)?o:a.maxSize)},getStart:n=>{const l=n?"left"===n?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),o=l.findIndex(t=>t.id===e.id);if(o>0){const e=l[o-1];return e.getStart(n)+e.getSize()}return 0},resetSize:()=>{t.setColumnSizing(t=>{let{[e.id]:n,...l}=t;return l})},getCanResize:()=>{var n,l;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(l=t.options.enableColumnResizing)||l)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let t=0;const n=e=>{var l;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(l=e.column.getSize())?l:0};return n(e),t},getStart:()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},getResizeHandler:()=>{const n=t.getColumn(e.column.id),l=null==n?void 0:n.getCanResize();return o=>{if(!n||!l)return;if(null==o.persist||o.persist(),d(o)&&o.touches&&o.touches.length>1)return;const i=e.getSize(),r=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[n.id,n.getSize()]],u=d(o)?Math.round(o.touches[0].clientX):o.clientX,a={},s=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var t,l;const o=n-(null!=(t=null==e?void 0:e.startOffset)?t:0),i=Math.max(o/(null!=(l=null==e?void 0:e.startSize)?l:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;a[t]=Math.round(100*Math.max(n+n*i,0))/100}),{...e,deltaOffset:o,deltaPercentage:i}}),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing(e=>({...e,...a})))},c=e=>s("move",e),p=e=>{s("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f={moveHandler:e=>c(e.clientX),upHandler:e=>{document.removeEventListener("mousemove",f.moveHandler),document.removeEventListener("mouseup",f.upHandler),p(e.clientX)}},m={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),c(e.touches[0].clientX),!1),upHandler:e=>{var t;document.removeEventListener("touchmove",m.moveHandler),document.removeEventListener("touchend",m.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),p(null==(t=e.touches[0])?void 0:t.clientX)}},b=!!function(){if("boolean"==typeof g)return g;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return g=e,g}()&&{passive:!1};d(o)?(document.addEventListener("touchmove",m.moveHandler,b),document.addEventListener("touchend",m.upHandler,b)):(document.addEventListener("mousemove",f.moveHandler,b),document.addEventListener("mouseup",f.upHandler,b)),t.setColumnSizingInfo(e=>({...e,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:r,isResizingColumn:n.id}))}}}),createTable:e=>({setColumnSizing:t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},resetHeaderSizeInfo:t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},getTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},getLeftTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},getCenterTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},getRightTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}})};let g=null;function d(e){return"touchstart"===e.type}const c={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:n("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var l,o;if(t){if(null!=(l=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}}else e._queue(()=>{t=!0})},setExpanded:t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),toggleAllRowsExpanded:t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},resetExpanded:t=>{var n,l;e.setExpanded(t?{}:null!=(n=null==(l=e.initialState)?void 0:l.expanded)?n:{})},getCanSomeRowsExpand:()=>e.getRowModel().flatRows.some(e=>e.getCanExpand()),getToggleAllRowsExpandedHandler:()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},getIsAllRowsExpanded:()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some(e=>!e.getIsExpanded())},getExpandedDepth:()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{const n=e.split(".");t=Math.max(t,n.length)}),t},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:n=>{t.setExpanded(l=>{var o;const i=!0===l||!(null==l||!l[e.id]);let r={};if(!0===l?Object.keys(t.getRowModel().rowsById).forEach(e=>{r[e]=!0}):r=l,n=null!=(o=n)?o:!i,!i&&n)return{...r,[e.id]:!0};if(i&&!n){const{[e.id]:t,...n}=r;return n}return l})},getIsExpanded:()=>{var n;const l=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===l||(null==l?void 0:l[e.id]))},getCanExpand:()=>{var n,l,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(l=t.options.enableExpanding)||l)&&!(null==(o=e.subRows)||!o.length)},getToggleExpandedHandler:()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}})},p=(e,t,n)=>{var l;const o=n.toLowerCase();return Boolean(null==(l=e.getValue(t))?void 0:l.toLowerCase().includes(o))};p.autoRemove=e=>F(e);const f=(e,t,n)=>{var l;return Boolean(null==(l=e.getValue(t))?void 0:l.includes(n))};f.autoRemove=e=>F(e);const m=(e,t,n)=>{var l;return(null==(l=e.getValue(t))?void 0:l.toLowerCase())===n.toLowerCase()};m.autoRemove=e=>F(e);const b=(e,t,n)=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)};b.autoRemove=e=>F(e)||!(null!=e&&e.length);const v=(e,t,n)=>!n.some(n=>{var l;return!(null!=(l=e.getValue(t))&&l.includes(n))});v.autoRemove=e=>F(e)||!(null!=e&&e.length);const S=(e,t,n)=>n.some(n=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)});S.autoRemove=e=>F(e)||!(null!=e&&e.length);const C=(e,t,n)=>e.getValue(t)===n;C.autoRemove=e=>F(e);const h=(e,t,n)=>e.getValue(t)==n;h.autoRemove=e=>F(e);const w=(e,t,n)=>{let[l,o]=n;const i=e.getValue(t);return i>=l&&i<=o};w.resolveFilterValue=e=>{let[t,n]=e,l="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(l)?-1/0:l,r=null===n||Number.isNaN(o)?1/0:o;if(i>r){const e=i;i=r,r=e}return[i,r]},w.autoRemove=e=>F(e)||F(e[0])&&F(e[1]);const R={includesString:p,includesStringSensitive:f,equalsString:m,arrIncludes:b,arrIncludesAll:v,arrIncludesSome:S,equals:C,weakEquals:h,inNumberRange:w};function F(e){return null==e||""===e}function M(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const V={sum:(e,t,n)=>n.reduce((t,n)=>{const l=n.getValue(e);return t+("number"==typeof l?l:0)},0),min:(e,t,n)=>{let l;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(l>n||void 0===l&&n>=n)&&(l=n)}),l},max:(e,t,n)=>{let l;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(l<n||void 0===l&&n>=n)&&(l=n)}),l},extent:(e,t,n)=>{let l,o;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(void 0===l?n>=n&&(l=o=n):(l>n&&(l=n),o<n&&(o=n)))}),[l,o]},mean:(e,t)=>{let n=0,l=0;if(t.forEach(t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,l+=o)}),n)return l/n},median:(e,t)=>{if(!t.length)return;let n=0,l=0;return t.forEach(t=>{let o=t.getValue(e);"number"==typeof o&&(n=Math.min(n,o),l=Math.max(l,o))}),(n+l)/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length};const I={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:n("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(e=>{e.getCanSelect()&&(l[e.id]=!0)}):o.forEach(e=>{delete l[e.id]}),l})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const l=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(t=>{y(o,t.id,l,e)}),o}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:o(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?x(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getFilteredSelectedRowModel:o(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?x(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getGroupedSelectedRowModel:o(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?x(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let l=Boolean(t.length&&Object.keys(n).length);return l&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(l=!1),l},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows,{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(l=!1),l},getIsSomeRowsSelected:()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},getIsSomePageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.some(e=>e.getIsSelected()||e.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:n=>{const l=e.getIsSelected();t.setRowSelection(o=>{if(l===(n=void 0!==n?n:!l))return o;const i={...o};return y(i,e.id,n,t),i})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return _(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return"some"===A(e,n)},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return"all"===A(e,n)},getCanSelect:()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},getCanSelectSubRows:()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},getCanMultiSelect:()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},getToggleSelectedHandler:()=>{const t=e.getCanSelect();return n=>{var l;t&&e.toggleSelected(null==(l=n.target)?void 0:l.checked)}}})},y=(e,t,n,l)=>{var o;const i=l.getRow(t);n?(i.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),i.getCanSelect()&&(e[t]=!0)):delete e[t],null!=(o=i.subRows)&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(t=>y(e,t.id,n,l))};function x(e,t){const n=e.getState().rowSelection,l=[],o={},i=function(e,t){return e.map(e=>{var t;const r=_(e,n);if(r&&(l.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:i(e.subRows)}),r)return e}).filter(Boolean)};return{rows:i(t.rows),flatRows:l,rowsById:o}}function _(e,t){var n;return null!=(n=t[e.id])&&n}function A(e,t,n){if(e.subRows&&e.subRows.length){let n=!0,l=!1;return e.subRows.forEach(e=>{l&&!n||(_(e,t)?l=!0:n=!1)}),n?"all":!!l&&"some"}return!1}const P=/([0-9]+)/gm;function E(e,t){return e===t?0:e>t?1:-1}function H(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function G(e,t){const n=e.split(P).filter(Boolean),l=t.split(P).filter(Boolean);for(;n.length&&l.length;){const e=n.shift(),t=l.shift(),o=parseInt(e,10),i=parseInt(t,10),r=[o,i].sort();if(isNaN(r[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(r[1]))return isNaN(o)?-1:1;if(o>i)return 1;if(i>o)return-1}}return n.length-l.length}const z={alphanumeric:(e,t,n)=>G(H(e.getValue(n)).toLowerCase(),H(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>G(H(e.getValue(n)),H(t.getValue(n))),text:(e,t,n)=>E(H(e.getValue(n)).toLowerCase(),H(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>E(H(e.getValue(n)),H(t.getValue(n))),datetime:(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:l<o?-1:0},basic:(e,t,n)=>E(e.getValue(n),t.getValue(n))},L=[r,{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:n("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},getIsVisible:()=>{var n,l;return null==(n=null==(l=t.getState().columnVisibility)?void 0:l[e.id])||n},getCanHide:()=>{var n,l;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(l=t.options.enableHiding)||l)},getToggleVisibilityHandler:()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:o(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),getVisibleCells:o(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],{key:!1,debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}})}),createTable:e=>{const t=(t,n)=>o(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),{key:t,debug:()=>{var t;return null!=(t=e.options.debugAll)?t: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:t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),resetColumnVisibility:t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},toggleAllColumnsVisible:t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}}},{getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:n("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},_getOrderColumnsFn:o(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>l=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...l];for(;n.length&&t.length;){const e=t.shift(),l=n.findIndex(t=>t.id===e);l>-1&&o.push(n.splice(l,1)[0])}o=[...o,...n]}else o=l;return function(e,t,n){if(null==t||!t.length||!n)return e;const l=e.filter(e=>!t.includes(e.id));return"remove"===n?l:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...l]}(o,t,n)},{key:!1})})},{getInitialState:e=>({columnPinning:{left:[],right:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:n("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const l=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,o,i,r,u,a;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter(e=>!(null!=l&&l.includes(e))),right:[...(null!=(r=null==e?void 0:e.right)?r:[]).filter(e=>!(null!=l&&l.includes(e))),...l]}:"left"===n?{left:[...(null!=(u=null==e?void 0:e.left)?u:[]).filter(e=>!(null!=l&&l.includes(e))),...l],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter(e=>!(null!=l&&l.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=l&&l.includes(e))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter(e=>!(null!=l&&l.includes(e)))}})},getCanPin:()=>e.getLeafColumns().some(e=>{var n,l;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(l=t.options.enablePinning)||l)}),getIsPinned:()=>{const n=e.getLeafColumns().map(e=>e.id),{left:l,right:o}=t.getState().columnPinning,i=n.some(e=>null==l?void 0:l.includes(e)),r=n.some(e=>null==o?void 0:o.includes(e));return i?"left":!!r&&"right"},getPinnedIndex:()=>{var n,l,o;const i=e.getIsPinned();return i?null!=(n=null==(l=t.getState().columnPinning)||null==(o=l[i])?void 0:o.indexOf(e.id))?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:o(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!l.includes(e.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),getLeftVisibleCells:o(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),getRightVisibleCells:o(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}})}),createTable:e=>({setColumnPinning:t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var n,l;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(l=e.initialState)?void 0:l.columnPinning)?n:{left:[],right:[]})},getIsSomeColumnsPinned:t=>{var n;const l=e.getState().columnPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.left)?void 0:o.length)||(null==(i=l.right)?void 0:i.length))},getLeftLeafColumns:o(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getRightLeafColumns:o(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getCenterLeafColumns:o(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!l.includes(e.id))},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}})})},{getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:n("columnFilters",e),onGlobalFilterChange:n("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,l;const o=null==(n=e.getCoreRowModel().flatRows[0])||null==(l=n._getAllCellsByColumnId()[t.id])?void 0:l.getValue();return"string"==typeof o||"number"==typeof o}}),createColumn:(e,n)=>({getAutoFilterFn:()=>{const t=n.getCoreRowModel().flatRows[0],l=null==t?void 0:t.getValue(e.id);return"string"==typeof l?R.includesString:"number"==typeof l?R.inNumberRange:"boolean"==typeof l||null!==l&&"object"==typeof l?R.equals:Array.isArray(l)?R.arrIncludes:R.weakEquals},getFilterFn:()=>{var t,o;return l(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(t=null==(o=n.options.filterFns)?void 0:o[e.columnDef.filterFn])?t:R[e.columnDef.filterFn]},getCanFilter:()=>{var t,l,o;return(null==(t=e.columnDef.enableColumnFilter)||t)&&(null==(l=n.options.enableColumnFilters)||l)&&(null==(o=n.options.enableFilters)||o)&&!!e.accessorFn},getCanGlobalFilter:()=>{var t,l,o,i;return(null==(t=e.columnDef.enableGlobalFilter)||t)&&(null==(l=n.options.enableGlobalFilter)||l)&&(null==(o=n.options.enableFilters)||o)&&(null==(i=null==n.options.getColumnCanGlobalFilter?void 0:n.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var t,l;return null==(t=n.getState().columnFilters)||null==(l=t.find(t=>t.id===e.id))?void 0:l.value},getFilterIndex:()=>{var t,l;return null!=(t=null==(l=n.getState().columnFilters)?void 0:l.findIndex(t=>t.id===e.id))?t:-1},setFilterValue:l=>{n.setColumnFilters(n=>{const o=e.getFilterFn(),i=null==n?void 0:n.find(t=>t.id===e.id),r=t(l,i?i.value:void 0);var u;if(M(o,r,e))return null!=(u=null==n?void 0:n.filter(t=>t.id!==e.id))?u:[];const a={id:e.id,value:r};var s;return i?null!=(s=null==n?void 0:n.map(t=>t.id===e.id?a:t))?s:[]:null!=n&&n.length?[...n,a]:[a]})},_getFacetedRowModel:n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),_getFacetedUniqueValues:n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>R.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:o}=e.options;return l(o)?o:"auto"===o?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[o])?t:R[o]},setColumnFilters:n=>{const l=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var o;return null==(o=t(n,e))?void 0:o.filter(e=>{const t=l.find(t=>t.id===e.id);if(t){if(M(t.getFilterFn(),e.value,t))return!1}return!0})})},setGlobalFilter:t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,l;e.setColumnFilters(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.columnFilters)?n:[])},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()}})},{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto"}),getDefaultOptions:e=>({onSortingChange:n("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return z.datetime;if("string"==typeof n&&(l=!0,n.split(P).length>1))return z.alphanumeric}return l?z.text:z.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},getSortingFn:()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(o=t.options.sortingFns)?void 0:o[e.columnDef.sortingFn])?n:z[e.columnDef.sortingFn]},toggleSorting:(n,l)=>{const o=e.getNextSortingOrder(),i=null!=n;t.setSorting(r=>{const u=null==r?void 0:r.find(t=>t.id===e.id),a=null==r?void 0:r.findIndex(t=>t.id===e.id);let s,g=[],d=i?n:"desc"===o;var c;(s=null!=r&&r.length&&e.getCanMultiSort()&&l?u?"toggle":"add":null!=r&&r.length&&a!==r.length-1?"replace":u?"toggle":"replace","toggle"===s&&(i||o||(s="remove")),"add"===s)?(g=[...r,{id:e.id,desc:d}],g.splice(0,g.length-(null!=(c=t.options.maxMultiSortColCount)?c:Number.MAX_SAFE_INTEGER))):g="toggle"===s?r.map(t=>t.id===e.id?{...t,desc:d}:t):"remove"===s?r.filter(t=>t.id!==e.id):[{id:e.id,desc:d}];return g})},getFirstSortDir:()=>{var n,l;return(null!=(n=null!=(l=e.columnDef.sortDescFirst)?l:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},getNextSortingOrder:n=>{var l,o;const i=e.getFirstSortDir(),r=e.getIsSorted();return r?!!(r===i||null!=(l=t.options.enableSortingRemoval)&&!l||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===r?"asc":"desc"):i},getCanSort:()=>{var n,l;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(l=t.options.enableSorting)||l)&&!!e.accessorFn},getCanMultiSort:()=>{var n,l;return null!=(n=null!=(l=e.columnDef.enableMultiSort)?l:t.options.enableMultiSort)?n:!!e.accessorFn},getIsSorted:()=>{var n;const l=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!l&&(l.desc?"desc":"asc")},getSortIndex:()=>{var n,l;return null!=(n=null==(l=t.getState().sorting)?void 0:l.findIndex(t=>t.id===e.id))?n:-1},clearSorting:()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return l=>{n&&(null==l.persist||l.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(l))))}}}),createTable:e=>({setSorting:t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,l;e.setSorting(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.sorting)?n:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},{getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:n("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},getCanGroup:()=>{var n,l,o,i;return null!=(n=null==(l=null!=(o=null==(i=e.columnDef.enableGrouping)||i)?o:t.options.enableGrouping)||l)?n:!!e.accessorFn},getIsGrouped:()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},getGroupedIndex:()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},getToggleGroupingHandler:()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const n=t.getCoreRowModel().flatRows[0],l=null==n?void 0:n.getValue(e.id);return"number"==typeof l?V.sum:"[object Date]"===Object.prototype.toString.call(l)?V.extent:void 0},getAggregationFn:()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(o=t.options.aggregationFns)?void 0:o[e.columnDef.aggregationFn])?n:V[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,l;e.setGrouping(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.grouping)?n:[])},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,n,l)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}})},c,{getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:n("pagination",e)}),createTable:e=>{let n=!1,l=!1;return{_autoResetPageIndex:()=>{var t,o;if(n){if(null!=(t=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?t:!e.options.manualPagination){if(l)return;l=!0,e._queue(()=>{e.resetPageIndex(),l=!1})}}else e._queue(()=>{n=!0})},setPagination:n=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>t(n,e)),resetPagination:t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},setPageIndex:n=>{e.setPagination(l=>{let o=t(n,l.pageIndex);const i=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...l,pageIndex:o}})},resetPageIndex:t=>{var n,l,o;e.setPageIndex(t?0:null!=(n=null==(l=e.initialState)||null==(o=l.pagination)?void 0:o.pageIndex)?n:0)},resetPageSize:t=>{var n,l,o;e.setPageSize(t?10:null!=(n=null==(l=e.initialState)||null==(o=l.pagination)?void 0:o.pageSize)?n:10)},setPageSize:n=>{e.setPagination(e=>{const l=Math.max(1,t(n,e.pageSize)),o=e.pageSize*e.pageIndex,i=Math.floor(o/l);return{...e,pageIndex:i,pageSize:l}})},setPageCount:n=>e.setPagination(l=>{var o;let i=t(n,null!=(o=e.options.pageCount)?o:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...l,pageCount:i}}),getPageOptions:o(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map((e,t)=>t)),t},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},previousPage:()=>e.setPageIndex(e=>e-1),nextPage:()=>e.setPageIndex(e=>e+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:()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},I,s];function D(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let l={_features:L};const i=l._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(l)),{});let r={...null!=(n=e.initialState)?n:{}};l._features.forEach(e=>{var t;r=null!=(t=null==e.getInitialState?void 0:e.getInitialState(r))?t:r});const u=[];let a=!1;const s={_features:L,options:{...i,...e},initialState:r,_queue:e=>{u.push(e),a||(a=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();a=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{l.setState(l.initialState)},setOptions:e=>{const n=t(e,l.options);var o;l.options=(o=n,l.options.mergeOptions?l.options.mergeOptions(i,o):{...i,...o})},getState:()=>l.options.state,setState:e=>{null==l.options.onStateChange||l.options.onStateChange(e)},_getRowId:(e,t,n)=>{var o;return null!=(o=null==l.options.getRowId?void 0:l.options.getRowId(e,t,n))?o:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:e=>{const t=l.getRowModel().rowsById[e];if(!t)throw new Error;return t},_getDefaultColumnDef:o(()=>[l.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...l._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},{debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns},key:!1}),_getColumnDefs:()=>l.options.columns,getAllColumns:o(()=>[l._getColumnDefs()],e=>{const t=function(e,n,i){return void 0===i&&(i=0),e.map(e=>{const r=function(e,t,n,l){var i,r;const u={...e._getDefaultColumnDef(),...t},a=u.accessorKey;let s,g=null!=(i=null!=(r=u.id)?r:a?a.replace(".","_"):void 0)?i:"string"==typeof u.header?u.header:void 0;if(u.accessorFn?s=u.accessorFn:a&&(s=a.includes(".")?e=>{let t=e;for(const l of a.split(".")){var n;t=null==(n=t)?void 0:n[l]}return t}:e=>e[u.accessorKey]),!g)throw new Error;let d={id:`${String(g)}`,accessorFn:s,parent:l,depth:n,columnDef:u,columns:[],getFlatColumns:o(()=>[!0],()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getLeafColumns:o(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=d.columns)&&t.length?e(d.columns.flatMap(e=>e.getLeafColumns())):[d]},{key:"column.getLeafColumns",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}})};return d=e._features.reduce((t,n)=>Object.assign(t,null==n.createColumn?void 0:n.createColumn(d,e)),d),d}(l,e,i,n),u=e;return r.columns=u.columns?t(u.columns,r,i+1):[],r})};return t(e)},{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getAllFlatColumns:o(()=>[l.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),_getAllFlatColumnsById:o(()=>[l.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getAllLeafColumns:o(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getColumn:e=>l._getAllFlatColumnsById()[e]};return Object.assign(l,s),l._features.forEach(e=>Object.assign(l,null==e.createTable?void 0:e.createTable(l))),l}const O=(e,t,n,l,i,r)=>{let u={id:t,index:l,original:n,depth:i,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(u._valuesCache.hasOwnProperty(t))return u._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(u._valuesCache[t]=n.accessorFn(u.original,l),u._valuesCache[t]):void 0},getUniqueValues:t=>{if(u._uniqueValuesCache.hasOwnProperty(t))return u._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(u._uniqueValuesCache[t]=n.columnDef.getUniqueValues(u.original,l),u._uniqueValuesCache[t]):(u._uniqueValuesCache[t]=[u.getValue(t)],u._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=u.getValue(t))?n:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>function(e,t){const n=[],l=e=>{e.forEach(e=>{n.push(e);const o=t(e);null!=o&&o.length&&l(o)})};return l(e),n}(u.subRows,e=>e.subRows),getAllCells:o(()=>[e.getAllLeafColumns()],t=>t.map(t=>function(e,t,n,l){const i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:()=>{var t;return null!=(t=i.getValue())?t:e.options.renderFallbackValue},getContext:o(()=>[e,n,t,i],(e,t,n,l)=>({table:e,column:t,row:n,cell:l,getValue:l.getValue,renderValue:l.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(i,null==l.createCell?void 0:l.createCell(i,n,t,e))},{}),i}(e,u,t,t.id)),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugRows}}),_getAllCellsByColumnId:o(()=>[u.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugRows}})};for(let o=0;o<e._features.length;o++){const t=e._features[o];Object.assign(u,null==t||null==t.createRow?void 0:t.createRow(u,e))}return u};function k(){return e=>o(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(t,o,i){void 0===o&&(o=0);const r=[];for(let a=0;a<t.length;a++){const s=O(e,e._getRowId(t[a],a,i),t[a],a,o);var u;if(n.flatRows.push(s),n.rowsById[s.id]=s,r.push(s),e.options.getSubRows)s.originalSubRows=e.options.getSubRows(t[a],a),null!=(u=s.originalSubRows)&&u.length&&(s.subRows=l(s.originalSubRows,o+1,s))}return r};return n.rows=l(t),n},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function B(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const o=[];for(let s=0;s<e.length;s++){var a;let g=e[s];const d=O(n,g.id,g.original,g.index,g.depth);if(d.columnFilters=g.columnFilters,null!=(a=g.subRows)&&a.length&&l<r){if(d.subRows=u(g.subRows,l+1),g=d,t(g)&&!d.subRows.length){o.push(g),i[g.id]=g,i[s]=g;continue}if(t(g)||d.subRows.length){o.push(g),i[g.id]=g,i[s]=g;continue}}else g=d,t(g)&&(o.push(g),i[g.id]=g,i[s]=g)}return o};return{rows:u(e),flatRows:o,rowsById:i}}(e,t,n):function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g<e.length;g++){let d=e[g];if(t(d)){var s;if(null!=(s=d.subRows)&&s.length&&l<r){const e=O(n,d.id,d.original,d.index,d.depth);e.subRows=u(d.subRows,l+1),d=e}a.push(d),o.push(d),i[d.id]=d}}return a};return{rows:u(e),flatRows:o,rowsById:i}}(e,t,n)}function T(){return e=>o(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,l)=>{if(!t.rows.length||(null==n||!n.length)&&!l){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],i=[];(null!=n?n:[]).forEach(t=>{var n;const l=e.getColumn(t.id);if(!l)return;const i=l.getFilterFn();i&&o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})});const r=n.map(e=>e.id),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());let s,g;l&&u&&a.length&&(r.push("__global__"),a.forEach(e=>{var t;i.push({id:e.id,filterFn:u,resolvedValue:null!=(t=null==u.resolveFilterValue?void 0:u.resolveFilterValue(l))?t:l})}));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){s=o[e];const t=s.id;n.columnFilters[t]=s.filterFn(n,t,s.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(i.length){for(let e=0;e<i.length;e++){g=i[e];const t=g.id;if(g.filterFn(n,t,g.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return B(t.rows,e=>{for(let t=0;t<r.length;t++)if(!1===e.columnFilters[r[t]])return!1;return!0},e)},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function q(){return e=>o(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const l=e.getState().sorting,o=[],i=l.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),r={};i.forEach(t=>{const n=e.getColumn(t.id);n&&(r[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});const u=e=>{const t=[...e];return t.sort((e,t)=>{for(let l=0;l<i.length;l+=1){var n;const o=i[l],u=r[o.id],a=null!=(n=null==o?void 0:o.desc)&&n;if(u.sortUndefined){const n=void 0===e.getValue(o.id),l=void 0===t.getValue(o.id);if(n||l)return n&&l?0:n?u.sortUndefined:-u.sortUndefined}let s=u.sortingFn(e,t,o.id);if(0!==s)return a&&(s*=-1),u.invertSorting&&(s*=-1),s}return e.index-t.index}),t.forEach(e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=u(e.subRows))}),t};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{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 j(t,n){return t?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(l=t)||"function"==typeof l||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(l)?e.createElement(t,n):t:null;var l}function N(t){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[l]=e.useState(()=>({current:D(n)})),[o,i]=e.useState(()=>l.current.initialState);return l.current.setOptions(e=>({...e,...t,state:{...o,...t.state},onStateChange:e=>{i(e),null==t.onStateChange||t.onStateChange(e)}})),l.current}export{q as a,k as b,j as f,T as g,N as u};
