import './async-D55cHugf.js';
import { d as bind_props, f as attr_class, g as attr_style, i as stringify, a as attr, e as ensure_array_like, c as spread_props, j as clsx } from './index-u8mz_F03.js';
import { t as tick } from './index-server-CQz6EZl_.js';
import { e as ee$1 } from './Upload2-uTutz1dY.js';
import './2-BLdXJizP.js';
import { Q as Qt } from './MarkdownCode-DLHRxFlS.js';
import { d } from './Checkbox-C7eMNvyZ.js';
import { e } from './Check-C7_ZsXgh.js';
import { h } from './Copy-B8YOhH7c.js';
import { w } from './IconButton-BRnu7KaR.js';
import { k } from './FullscreenButton-D8PvgSmk.js';
import { W } from './index3-Df92vI-L.js';
import { G } from './Block-DZmzQwnI.js';
import { $ } from './utils.svelte-B2py64Fz.js';
export { default as BaseExample } from './Example14-s-dCDI60.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';
import { h as html } from './html-CfyvkLET.js';
import './context-CBkBucIx.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import './index-Cg-Pg6j3.js';
import './prism-python--2v-p3P4.js';
import './index50-G3WrDDFf.js';
import 'path';
import 'url';
import 'fs';
import './Maximize-CuHbK64j.js';
import './Clear-D7Yjckqz.js';
import './clone-Yk88IHKV.js';

function ce(e,o){return typeof e=="function"?e(o):e}function Y(e,o){return t=>{o.setState(n=>({...n,[e]:ce(t,n[e])}));}}function Pe(e){return e instanceof Function}function An(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function Dn(e,o){const t=[],n=s=>{s.forEach(i=>{t.push(i);const l=o(i);l!=null&&l.length&&n(l);});};return n(e),t}function F(e,o,t){let n=[],s;return i=>{let l;t.key&&t.debug&&(l=Date.now());const r=e(i);if(!(r.length!==n.length||r.some((g,f)=>n[f]!==g)))return s;n=r;let c;if(t.key&&t.debug&&(c=Date.now()),s=o(...r),t==null||t.onChange==null||t.onChange(s),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-l)*100)/100,f=Math.round((Date.now()-c)*100)/100,d=f/16,a=(p,_)=>{for(p=String(p);p.length<_;)p=" "+p;return p};console.info(`%c⏱ ${a(f,5)} /${a(g,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,t?.key);}return s}}function M(e,o,t,n){return {debug:()=>{var s;return (s=e?.debugAll)!=null?s:e[o]},key:process.env.NODE_ENV==="development"&&t,onChange:n}}function zn(e,o,t,n){const s=()=>{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:s,getContext:F(()=>[e,t,o,i],(l,r,u,c)=>({table:l,column:r,row:u,cell:c,getValue:c.getValue,renderValue:c.renderValue}),M(e.options,"debugCells","cell.getContext"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(i,t,o,e);},{}),i}function On(e,o,t,n){var s,i;const r={...e._getDefaultColumnDef(),...o},u=r.accessorKey;let c=(s=(i=r.id)!=null?i:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?s:typeof r.header=="string"?r.header:void 0,g;if(r.accessorFn?g=r.accessorFn:u&&(u.includes(".")?g=d=>{let a=d;for(const _ of u.split(".")){var p;a=(p=a)==null?void 0:p[_],process.env.NODE_ENV!=="production"&&a===void 0&&console.warn(`"${_}" in deeply nested key "${u}" returned undefined.`);}return a}:g=d=>d[r.accessorKey]),!c)throw process.env.NODE_ENV!=="production"?new Error(r.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let f={id:`${String(c)}`,accessorFn:g,parent:n,depth:t,columnDef:r,columns:[],getFlatColumns:F(()=>[true],()=>{var d;return [f,...(d=f.columns)==null?void 0:d.flatMap(a=>a.getFlatColumns())]},M(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:F(()=>[e._getOrderColumnsFn()],d=>{var a;if((a=f.columns)!=null&&a.length){let p=f.columns.flatMap(_=>_.getLeafColumns());return d(p)}return [f]},M(e.options,"debugColumns","column.getLeafColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(f,e);return f}const q="debugHeaders";function St(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=[],r=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(r),l.push(u);};return r(i),l},getContext:()=>({table:e,header:i,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(i,e);}),i}const Ln={createTable:e=>{e.getHeaderGroups=F(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,s)=>{var i,l;const r=(i=n?.map(f=>t.find(d=>d.id===f)).filter(Boolean))!=null?i:[],u=(l=s?.map(f=>t.find(d=>d.id===f)).filter(Boolean))!=null?l:[],c=t.filter(f=>!(n!=null&&n.includes(f.id))&&!(s!=null&&s.includes(f.id)));return Ee(o,[...r,...c,...u],e)},M(e.options,q,"getHeaderGroups")),e.getCenterHeaderGroups=F(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,s)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(s!=null&&s.includes(i.id))),Ee(o,t,e,"center")),M(e.options,q,"getCenterHeaderGroups")),e.getLeftHeaderGroups=F(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var s;const i=(s=n?.map(l=>t.find(r=>r.id===l)).filter(Boolean))!=null?s:[];return Ee(o,i,e,"left")},M(e.options,q,"getLeftHeaderGroups")),e.getRightHeaderGroups=F(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var s;const i=(s=n?.map(l=>t.find(r=>r.id===l)).filter(Boolean))!=null?s:[];return Ee(o,i,e,"right")},M(e.options,q,"getRightHeaderGroups")),e.getFooterGroups=F(()=>[e.getHeaderGroups()],o=>[...o].reverse(),M(e.options,q,"getFooterGroups")),e.getLeftFooterGroups=F(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),M(e.options,q,"getLeftFooterGroups")),e.getCenterFooterGroups=F(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),M(e.options,q,"getCenterFooterGroups")),e.getRightFooterGroups=F(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),M(e.options,q,"getRightFooterGroups")),e.getFlatHeaders=F(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),M(e.options,q,"getFlatHeaders")),e.getLeftFlatHeaders=F(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),M(e.options,q,"getLeftFlatHeaders")),e.getCenterFlatHeaders=F(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),M(e.options,q,"getCenterFlatHeaders")),e.getRightFlatHeaders=F(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),M(e.options,q,"getRightFlatHeaders")),e.getCenterLeafHeaders=F(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return !((n=t.subHeaders)!=null&&n.length)}),M(e.options,q,"getCenterLeafHeaders")),e.getLeftLeafHeaders=F(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return !((n=t.subHeaders)!=null&&n.length)}),M(e.options,q,"getLeftLeafHeaders")),e.getRightLeafHeaders=F(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return !((n=t.subHeaders)!=null&&n.length)}),M(e.options,q,"getRightLeafHeaders")),e.getLeafHeaders=F(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var s,i,l,r,u,c;return [...(s=(i=o[0])==null?void 0:i.headers)!=null?s:[],...(l=(r=t[0])==null?void 0:r.headers)!=null?l:[],...(u=(c=n[0])==null?void 0:c.headers)!=null?u:[]].map(g=>g.getLeafHeaders()).flat()},M(e.options,q,"getLeafHeaders"));}};function Ee(e,o,t,n){var s,i;let l=0;const r=function(d,a){a===void 0&&(a=1),l=Math.max(l,a),d.filter(p=>p.getIsVisible()).forEach(p=>{var _;(_=p.columns)!=null&&_.length&&r(p.columns,a+1);},0);};r(e);let u=[];const c=(d,a)=>{const p={depth:a,id:[n,`${a}`].filter(Boolean).join("_"),headers:[]},_=[];d.forEach(C=>{const S=[..._].reverse()[0],x=C.column.depth===p.depth;let y,k=false;if(x&&C.column.parent?y=C.column.parent:(y=C.column,k=true),S&&S?.column===y)S.subHeaders.push(C);else {const A=St(t,y,{id:[n,a,y.id,C?.id].filter(Boolean).join("_"),isPlaceholder:k,placeholderId:k?`${_.filter(D=>D.column===y).length}`:void 0,depth:a,index:_.length});A.subHeaders.push(C),_.push(A);}p.headers.push(C),C.headerGroup=p;}),u.push(p),a>0&&c(_,a-1);},g=o.map((d,a)=>St(t,d,{depth:l,index:a}));c(g,l-1),u.reverse();const f=d=>d.filter(p=>p.column.getIsVisible()).map(p=>{let _=0,C=0,S=[0];p.subHeaders&&p.subHeaders.length?(S=[],f(p.subHeaders).forEach(y=>{let{colSpan:k,rowSpan:A}=y;_+=k,S.push(A);})):_=1;const x=Math.min(...S);return C=C+x,p.colSpan=_,p.rowSpan=C,{colSpan:_,rowSpan:C}});return f((s=(i=u[0])==null?void 0:i.headers)!=null?s:[]),u}const tt=(e,o,t,n,s,i,l)=>{let r={id:o,index:n,original:t,depth:s,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(r._valuesCache.hasOwnProperty(u))return r._valuesCache[u];const c=e.getColumn(u);if(c!=null&&c.accessorFn)return r._valuesCache[u]=c.accessorFn(r.original,n),r._valuesCache[u]},getUniqueValues:u=>{if(r._uniqueValuesCache.hasOwnProperty(u))return r._uniqueValuesCache[u];const c=e.getColumn(u);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(r._uniqueValuesCache[u]=c.columnDef.getUniqueValues(r.original,n),r._uniqueValuesCache[u]):(r._uniqueValuesCache[u]=[r.getValue(u)],r._uniqueValuesCache[u])},renderValue:u=>{var c;return (c=r.getValue(u))!=null?c:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Dn(r.subRows,u=>u.subRows),getParentRow:()=>r.parentId?e.getRow(r.parentId,true):void 0,getParentRows:()=>{let u=[],c=r;for(;;){const g=c.getParentRow();if(!g)break;u.push(g),c=g;}return u.reverse()},getAllCells:F(()=>[e.getAllLeafColumns()],u=>u.map(c=>zn(e,r,c,c.id)),M(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:F(()=>[r.getAllCells()],u=>u.reduce((c,g)=>(c[g.column.id]=g,c),{}),M(e.options,"debugRows","getAllCellsByColumnId"))};for(let u=0;u<e._features.length;u++){const c=e._features[u];c==null||c.createRow==null||c.createRow(r,e);}return r},Hn={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()};}},Pt=(e,o,t)=>{var n,s;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return !!(!((s=e.getValue(o))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(i))};Pt.autoRemove=e=>te(e);const At=(e,o,t)=>{var n;return !!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};At.autoRemove=e=>te(e);const Dt=(e,o,t)=>{var n;return ((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===t?.toLowerCase()};Dt.autoRemove=e=>te(e);const zt=(e,o,t)=>{var n;return (n=e.getValue(o))==null?void 0:n.includes(t)};zt.autoRemove=e=>te(e);const Ot=(e,o,t)=>!t.some(n=>{var s;return !((s=e.getValue(o))!=null&&s.includes(n))});Ot.autoRemove=e=>te(e)||!(e!=null&&e.length);const Lt=(e,o,t)=>t.some(n=>{var s;return (s=e.getValue(o))==null?void 0:s.includes(n)});Lt.autoRemove=e=>te(e)||!(e!=null&&e.length);const Ht=(e,o,t)=>e.getValue(o)===t;Ht.autoRemove=e=>te(e);const jt=(e,o,t)=>e.getValue(o)==t;jt.autoRemove=e=>te(e);const nt=(e,o,t)=>{let[n,s]=t;const i=e.getValue(o);return i>=n&&i<=s};nt.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,s=typeof t!="number"?parseFloat(t):t,i=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(s)?1/0:s;if(i>l){const r=i;i=l,l=r;}return [i,l]};nt.autoRemove=e=>te(e)||te(e[0])&&te(e[1]);const ie={includesString:Pt,includesStringSensitive:At,equalsString:Dt,arrIncludes:zt,arrIncludesAll:Ot,arrIncludesSome:Lt,equals:Ht,weakEquals:jt,inNumberRange:nt};function te(e){return e==null||e===""}const jn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Y("columnFilters",e),filterFromLeafRows:false,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t?.getValue(e.id);return typeof n=="string"?ie.includesString:typeof n=="number"?ie.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?ie.equals:Array.isArray(n)?ie.arrIncludes:ie.weakEquals},e.getFilterFn=()=>{var t,n;return Pe(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:ie[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,s;return ((t=e.columnDef.enableColumnFilter)!=null?t:true)&&((n=o.options.enableColumnFilters)!=null?n:true)&&((s=o.options.enableFilters)!=null?s:true)&&!!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(s=>s.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const s=e.getFilterFn(),i=n?.find(g=>g.id===e.id),l=ce(t,i?i.value:void 0);if(Ct(s,l,e)){var r;return (r=n?.filter(g=>g.id!==e.id))!=null?r:[]}const u={id:e.id,value:l};if(i){var c;return (c=n?.map(g=>g.id===e.id?u:g))!=null?c:[]}return n!=null&&n.length?[...n,u]:[u]});};},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={};},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=s=>{var i;return (i=ce(o,s))==null?void 0:i.filter(l=>{const r=t.find(u=>u.id===l.id);if(r){const u=r.getFilterFn();if(Ct(u,l.value,r))return  false}return  true})};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 Ct(e,o,t){return (e&&e.autoRemove?e.autoRemove(o,t):false)||typeof o>"u"||typeof o=="string"&&!o}const Gn=(e,o,t)=>t.reduce((n,s)=>{const i=s.getValue(e);return n+(typeof i=="number"?i:0)},0),Tn=(e,o,t)=>{let n;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);}),n},Bn=(e,o,t)=>{let n;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);}),n},Nn=(e,o,t)=>{let n,s;return t.forEach(i=>{const l=i.getValue(e);l!=null&&(n===void 0?l>=l&&(n=s=l):(n>l&&(n=l),s<l&&(s=l)));}),[n,s]},qn=(e,o)=>{let t=0,n=0;if(o.forEach(s=>{let i=s.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i);}),t)return n/t},Un=(e,o)=>{if(!o.length)return;const t=o.map(i=>i.getValue(e));if(!An(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),s=t.sort((i,l)=>i-l);return t.length%2!==0?s[n]:(s[n-1]+s[n])/2},Wn=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Kn=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,Xn=(e,o)=>o.length,Ge={sum:Gn,min:Tn,max:Bn,extent:Nn,mean:qn,median:Un,unique:Wn,uniqueCount:Kn,count:Xn},Jn={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:Y("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:true)&&((n=o.options.enableGrouping)!=null?n:true)&&(!!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?.getValue(e.id);if(typeof n=="number")return Ge.sum;if(Object.prototype.toString.call(n)==="[object Date]")return Ge.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return Pe(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:Ge[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 s;return !e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=t.subRows)!=null&&s.length)};}};function Yn(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 Zn={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Y("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=F(t=>[Fe(o,t)],t=>t.findIndex(n=>n.id===e.id),M(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return ((n=Fe(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const s=Fe(o,t);return ((n=s[s.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=F(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>s=>{let i=[];if(!(o!=null&&o.length))i=s;else {const l=[...o],r=[...s];for(;r.length&&l.length;){const u=l.shift(),c=r.findIndex(g=>g.id===u);c>-1&&i.push(r.splice(c,1)[0]);}i=[...i,...r];}return Yn(i,t,n)},M(e.options,"debugTable","_getOrderColumnsFn"));}},Te=()=>({left:[],right:[]}),Qn={getInitialState:e=>({columnPinning:Te(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Y("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(s=>s.id).filter(Boolean);o.setColumnPinning(s=>{var i,l;if(t==="right"){var r,u;return {left:((r=s?.left)!=null?r:[]).filter(f=>!(n!=null&&n.includes(f))),right:[...((u=s?.right)!=null?u:[]).filter(f=>!(n!=null&&n.includes(f))),...n]}}if(t==="left"){var c,g;return {left:[...((c=s?.left)!=null?c:[]).filter(f=>!(n!=null&&n.includes(f))),...n],right:((g=s?.right)!=null?g:[]).filter(f=>!(n!=null&&n.includes(f)))}}return {left:((i=s?.left)!=null?i:[]).filter(f=>!(n!=null&&n.includes(f))),right:((l=s?.right)!=null?l:[]).filter(f=>!(n!=null&&n.includes(f)))}});},e.getCanPin=()=>e.getLeafColumns().some(n=>{var s,i,l;return ((s=n.columnDef.enablePinning)!=null?s:true)&&((i=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?i:true)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(r=>r.id),{left:n,right:s}=o.getState().columnPinning,i=t.some(r=>n?.includes(r)),l=t.some(r=>s?.includes(r));return i?"left":l?"right":false},e.getPinnedIndex=()=>{var t,n;const s=e.getIsPinned();return s?(t=(n=o.getState().columnPinning)==null||(n=n[s])==null?void 0:n.indexOf(e.id))!=null?t:-1:0};},createRow:(e,o)=>{e.getCenterVisibleCells=F(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,s)=>{const i=[...n??[],...s??[]];return t.filter(l=>!i.includes(l.column.id))},M(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=F(()=>[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"})),M(o.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=F(()=>[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"})),M(o.options,"debugRows","getRightVisibleCells"));},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?Te():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:Te())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var s,i;return !!((s=n.left)!=null&&s.length||(i=n.right)!=null&&i.length)}return !!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=F(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(s=>s.id===n)).filter(Boolean),M(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=F(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(s=>s.id===n)).filter(Boolean),M(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=F(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const s=[...t??[],...n??[]];return o.filter(i=>!s.includes(i.id))},M(e.options,"debugColumns","getCenterLeafColumns"));}};function $n(e){return e||(typeof document<"u"?document:null)}const ke={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Be=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:false,columnSizingStart:[]}),eo={getDefaultColumnDef:()=>ke,getInitialState:e=>({columnSizing:{},columnSizingInfo:Be(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Y("columnSizing",e),onColumnSizingInfoChange:Y("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,s;const i=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:ke.minSize,(n=i??e.columnDef.size)!=null?n:ke.size),(s=e.columnDef.maxSize)!=null?s:ke.maxSize)},e.getStart=F(t=>[t,Fe(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((s,i)=>s+i.getSize(),0),M(o.options,"debugColumns","getStart")),e.getAfter=F(t=>[t,Fe(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((s,i)=>s+i.getSize(),0),M(o.options,"debugColumns","getAfter")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...s}=t;return s});},e.getCanResize=()=>{var t,n;return ((t=e.columnDef.enableResizing)!=null?t:true)&&((n=o.options.enableColumnResizing)!=null?n:true)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id;},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=s=>{if(s.subHeaders.length)s.subHeaders.forEach(n);else {var i;t+=(i=s.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),s=n?.getCanResize();return i=>{if(!n||!s||(i.persist==null||i.persist(),Ne(i)&&i.touches&&i.touches.length>1))return;const l=e.getSize(),r=e?e.getLeafHeaders().map(S=>[S.column.id,S.column.getSize()]):[[n.id,n.getSize()]],u=Ne(i)?Math.round(i.touches[0].clientX):i.clientX,c={},g=(S,x)=>{typeof x=="number"&&(o.setColumnSizingInfo(y=>{var k,A;const D=o.options.columnResizeDirection==="rtl"?-1:1,G=(x-((k=y?.startOffset)!=null?k:0))*D,P=Math.max(G/((A=y?.startSize)!=null?A:0),-0.999999);return y.columnSizingStart.forEach(Z=>{let[X,T]=Z;c[X]=Math.round(Math.max(T+T*P,0)*100)/100;}),{...y,deltaOffset:G,deltaPercentage:P}}),(o.options.columnResizeMode==="onChange"||S==="end")&&o.setColumnSizing(y=>({...y,...c})));},f=S=>g("move",S),d=S=>{g("end",S),o.setColumnSizingInfo(x=>({...x,isResizingColumn:false,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}));},a=$n(t),p={moveHandler:S=>f(S.clientX),upHandler:S=>{a?.removeEventListener("mousemove",p.moveHandler),a?.removeEventListener("mouseup",p.upHandler),d(S.clientX);}},_={moveHandler:S=>(S.cancelable&&(S.preventDefault(),S.stopPropagation()),f(S.touches[0].clientX),false),upHandler:S=>{var x;a?.removeEventListener("touchmove",_.moveHandler),a?.removeEventListener("touchend",_.upHandler),S.cancelable&&(S.preventDefault(),S.stopPropagation()),d((x=S.touches[0])==null?void 0:x.clientX);}},C=to()?{passive:false}:false;Ne(i)?(a?.addEventListener("touchmove",_.moveHandler,C),a?.addEventListener("touchend",_.upHandler,C)):(a?.addEventListener("mousemove",p.moveHandler,C),a?.addEventListener("mouseup",p.upHandler,C)),o.setColumnSizingInfo(S=>({...S,startOffset:u,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:r,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?Be():(t=e.initialState.columnSizingInfo)!=null?t:Be());},e.getTotalSize=()=>{var o,t;return (o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return (o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return (o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return (o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,s)=>n+s.getSize(),0))!=null?o:0};}};let Ve=null;function to(){if(typeof Ve=="boolean")return Ve;let e=false;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t);}catch{e=false;}return Ve=e,Ve}function Ne(e){return e.type==="touchstart"}const no={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Y("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 s=e.columns;return (t=s.length?s.some(i=>i.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:true},e.getCanHide=()=>{var t,n;return ((t=e.columnDef.enableHiding)!=null?t:true)&&((n=o.options.enableHiding)!=null?n:true)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked);};},createRow:(e,o)=>{e._getAllVisibleCells=F(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),M(o.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=F(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,s)=>[...t,...n,...s],M(o.options,"debugRows","getVisibleCells"));},createTable:e=>{const o=(t,n)=>F(()=>[n(),n().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),M(e.options,"debugColumns",t));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((s,i)=>({...s,[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 Fe(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const oo={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()};}},so={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Y("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,s,i;return ((t=e.columnDef.enableGlobalFilter)!=null?t:true)&&((n=o.options.enableGlobalFilter)!=null?n:true)&&((s=o.options.enableFilters)!=null?s:true)&&((i=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?i:true)&&!!e.accessorFn};},createTable:e=>{e.getGlobalAutoFilterFn=()=>ie.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return Pe(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:ie[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o);},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter);};}},io={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Y("expanded",e),paginateExpandedRows:true}),createTable:e=>{let o=false,t=false;e._autoResetExpanded=()=>{var n,s;if(!o){e._queue(()=>{o=true;});return}if((n=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=true,e._queue(()=>{e.resetExpanded(),t=false;});}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(true):e.setExpanded({});},e.resetExpanded=n=>{var s,i;e.setExpanded(n?{}:(s=(i=e.initialState)==null?void 0:i.expanded)!=null?s:{});},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===true||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===true:!(!Object.keys(n).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return (e.getState().expanded===true?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 s;const i=n===true?true:!!(n!=null&&n[e.id]);let l={};if(n===true?Object.keys(o.getRowModel().rowsById).forEach(r=>{l[r]=true;}):l=n,t=(s=t)!=null?s:!i,!i&&t)return {...l,[e.id]:true};if(i&&!t){const{[e.id]:r,...u}=l;return u}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===true||n?.[e.id])},e.getCanExpand=()=>{var t,n,s;return (t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:true)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let t=true,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,true),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return ()=>{t&&e.toggleExpanded();}};}},Ye=0,Ze=10,qe=()=>({pageIndex:Ye,pageSize:Ze}),lo={getInitialState:e=>({...e,pagination:{...qe(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Y("pagination",e)}),createTable:e=>{let o=false,t=false;e._autoResetPageIndex=()=>{var n,s;if(!o){e._queue(()=>{o=true;});return}if((n=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=true,e._queue(()=>{e.resetPageIndex(),t=false;});}},e.setPagination=n=>{const s=i=>ce(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=n=>{var s;e.setPagination(n?qe():(s=e.initialState.pagination)!=null?s:qe());},e.setPageIndex=n=>{e.setPagination(s=>{let i=ce(n,s.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)),{...s,pageIndex:i}});},e.resetPageIndex=n=>{var s,i;e.setPageIndex(n?Ye:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?s:Ye);},e.resetPageSize=n=>{var s,i;e.setPageSize(n?Ze:(s=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?s:Ze);},e.setPageSize=n=>{e.setPagination(s=>{const i=Math.max(1,ce(n,s.pageSize)),l=s.pageSize*s.pageIndex,r=Math.floor(l/i);return {...s,pageIndex:r,pageSize:i}});},e.setPageCount=n=>e.setPagination(s=>{var i;let l=ce(n,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...s,pageCount:l}}),e.getPageOptions=F(()=>[e.getPageCount()],n=>{let s=[];return n&&n>0&&(s=[...new Array(n)].fill(null).map((i,l)=>l)),s},M(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,s=e.getPageCount();return s===-1?true:s===0?false:n<s-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};}},Ue=()=>({top:[],bottom:[]}),ro={getInitialState:e=>({rowPinning:Ue(),...e}),getDefaultOptions:e=>({onRowPinningChange:Y("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,s)=>{const i=n?e.getLeafRows().map(u=>{let{id:c}=u;return c}):[],l=s?e.getParentRows().map(u=>{let{id:c}=u;return c}):[],r=new Set([...l,e.id,...i]);o.setRowPinning(u=>{var c,g;if(t==="bottom"){var f,d;return {top:((f=u?.top)!=null?f:[]).filter(_=>!(r!=null&&r.has(_))),bottom:[...((d=u?.bottom)!=null?d:[]).filter(_=>!(r!=null&&r.has(_))),...Array.from(r)]}}if(t==="top"){var a,p;return {top:[...((a=u?.top)!=null?a:[]).filter(_=>!(r!=null&&r.has(_))),...Array.from(r)],bottom:((p=u?.bottom)!=null?p:[]).filter(_=>!(r!=null&&r.has(_)))}}return {top:((c=u?.top)!=null?c:[]).filter(_=>!(r!=null&&r.has(_))),bottom:((g=u?.bottom)!=null?g:[]).filter(_=>!(r!=null&&r.has(_)))}});},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:s}=o.options;return typeof n=="function"?n(e):(t=n??s)!=null?t:true},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:s}=o.getState().rowPinning,i=t.some(r=>n?.includes(r)),l=t.some(r=>s?.includes(r));return i?"top":l?"bottom":false},e.getPinnedIndex=()=>{var t,n;const s=e.getIsPinned();if(!s)return  -1;const i=(t=s==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:r}=l;return r});return (n=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?Ue():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:Ue())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var s,i;return !!((s=n.top)!=null&&s.length||(i=n.bottom)!=null&&i.length)}return !!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var s;return ((s=e.options.keepPinnedRows)==null||s?(t??[]).map(l=>{const r=e.getRow(l,true);return r.getIsAllParentsExpanded()?r:null}):(t??[]).map(l=>o.find(r=>r.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=F(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),M(e.options,"debugRows","getTopRows")),e.getBottomRows=F(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),M(e.options,"debugRows","getBottomRows")),e.getCenterRows=F(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const s=new Set([...t??[],...n??[]]);return o.filter(i=>!s.has(i.id))},M(e.options,"debugRows","getCenterRows"));}},uo={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Y("rowSelection",e),enableRowSelection:true,enableMultiRowSelection:true,enableSubRowSelection:true}),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},s=e.getPreGroupedRowModel().flatRows;return o?s.forEach(i=>{i.getCanSelect()&&(n[i.id]=true);}):s.forEach(i=>{delete n[i.id];}),n});},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),s={...t};return e.getRowModel().rows.forEach(i=>{Qe(s,i.id,n,true,e);}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=F(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},M(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=F(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},M(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=F(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},M(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(s=>s.getCanSelect()&&!t[s.id])&&(n=false),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(s=>!t[s.id])&&(n=false),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()?false: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 s=e.getIsSelected();o.setRowSelection(i=>{var l;if(t=typeof t<"u"?t:!s,e.getCanSelect()&&s===t)return i;const r={...i};return Qe(r,e.id,t,(l=n?.selectChildren)!=null?l:true,o),r});},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return ot(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return $e(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return $e(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:true},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:true},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:true},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var s;t&&e.toggleSelected((s=n.target)==null?void 0:s.checked);}};}},Qe=(e,o,t,n,s)=>{var i;const l=s.getRow(o,true);t?(l.getCanMultiSelect()||Object.keys(e).forEach(r=>delete e[r]),l.getCanSelect()&&(e[o]=true)):delete e[o],n&&(i=l.subRows)!=null&&i.length&&l.getCanSelectSubRows()&&l.subRows.forEach(r=>Qe(e,r.id,t,n,s));};function We(e,o){const t=e.getState().rowSelection,n=[],s={},i=function(l,r){return l.map(u=>{var c;const g=ot(u,t);if(g&&(n.push(u),s[u.id]=u),(c=u.subRows)!=null&&c.length&&(u={...u,subRows:i(u.subRows)}),g)return u}).filter(Boolean)};return {rows:i(o.rows),flatRows:n,rowsById:s}}function ot(e,o){var t;return (t=o[e.id])!=null?t:false}function $e(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return  false;let s=true,i=false;return e.subRows.forEach(l=>{if(!(i&&!s)&&(l.getCanSelect()&&(ot(l,o)?i=true:s=false),l.subRows&&l.subRows.length)){const r=$e(l,o);r==="all"?i=true:(r==="some"&&(i=true),s=false);}}),s?"all":i?"some":false}const et=/([0-9]+)/gm,ao=(e,o,t)=>Gt(de(e.getValue(t)).toLowerCase(),de(o.getValue(t)).toLowerCase()),co=(e,o,t)=>Gt(de(e.getValue(t)),de(o.getValue(t))),go=(e,o,t)=>st(de(e.getValue(t)).toLowerCase(),de(o.getValue(t)).toLowerCase()),fo=(e,o,t)=>st(de(e.getValue(t)),de(o.getValue(t))),ho=(e,o,t)=>{const n=e.getValue(t),s=o.getValue(t);return n>s?1:n<s?-1:0},po=(e,o,t)=>st(e.getValue(t),o.getValue(t));function st(e,o){return e===o?0:e>o?1:-1}function de(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Gt(e,o){const t=e.split(et).filter(Boolean),n=o.split(et).filter(Boolean);for(;t.length&&n.length;){const s=t.shift(),i=n.shift(),l=parseInt(s,10),r=parseInt(i,10),u=[l,r].sort();if(isNaN(u[0])){if(s>i)return 1;if(i>s)return  -1;continue}if(isNaN(u[1]))return isNaN(l)?-1:1;if(l>r)return 1;if(r>l)return  -1}return t.length-n.length}const Re={alphanumeric:ao,alphanumericCaseSensitive:co,text:go,textCaseSensitive:fo,datetime:ho,basic:po},mo={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Y("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=false;for(const s of t){const i=s?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return Re.datetime;if(typeof i=="string"&&(n=true,i.split(et).length>1))return Re.alphanumeric}return n?Re.text:Re.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return Pe(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:Re[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const s=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;o.setSorting(l=>{const r=l?.find(a=>a.id===e.id),u=l?.findIndex(a=>a.id===e.id);let c=[],g,f=i?t:s==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?r?g="toggle":g="add":l!=null&&l.length&&u!==l.length-1?g="replace":r?g="toggle":g="replace",g==="toggle"&&(i||s||(g="remove")),g==="add"){var d;c=[...l,{id:e.id,desc:f}],c.splice(0,c.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER));}else g==="toggle"?c=l.map(a=>a.id===e.id?{...a,desc:f}:a):g==="remove"?c=l.filter(a=>a.id!==e.id):c=[{id:e.id,desc:f}];return c});},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,s;const i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(s=o.options.enableMultiRemove)!=null)||s)?false:l==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return ((t=e.columnDef.enableSorting)!=null?t:true)&&((n=o.options.enableSorting)!=null?n:true)&&!!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(s=>s.id===e.id);return n?n.desc?"desc":"asc":false},e.getSortIndex=()=>{var t,n;return (t=(n=o.getState().sorting)==null?void 0:n.findIndex(s=>s.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):false));}};},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());}},_o=[Ln,no,Zn,Qn,Hn,jn,oo,so,mo,Jn,io,lo,ro,uo,eo];function vo(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[..._o,...(o=e._features)!=null?o:[]];let s={_features:n};const i=s._features.reduce((d,a)=>Object.assign(d,a.getDefaultOptions==null?void 0:a.getDefaultOptions(s)),{}),l=d=>s.options.mergeOptions?s.options.mergeOptions(i,d):{...i,...d};let u={...{},...(t=e.initialState)!=null?t:{}};s._features.forEach(d=>{var a;u=(a=d.getInitialState==null?void 0:d.getInitialState(u))!=null?a:u;});const c=[];let g=false;const f={_features:n,options:{...i,...e},initialState:u,_queue:d=>{c.push(d),g||(g=true,Promise.resolve().then(()=>{for(;c.length;)c.shift()();g=false;}).catch(a=>setTimeout(()=>{throw a})));},reset:()=>{s.setState(s.initialState);},setOptions:d=>{const a=ce(d,s.options);s.options=l(a);},getState:()=>s.options.state,setState:d=>{s.options.onStateChange==null||s.options.onStateChange(d);},_getRowId:(d,a,p)=>{var _;return (_=s.options.getRowId==null?void 0:s.options.getRowId(d,a,p))!=null?_:`${p?[p.id,a].join("."):a}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(d,a)=>{let p=(a?s.getPrePaginationRowModel():s.getRowModel()).rowsById[d];if(!p&&(p=s.getCoreRowModel().rowsById[d],!p))throw process.env.NODE_ENV!=="production"?new Error(`getRow could not find row with ID: ${d}`):new Error;return p},_getDefaultColumnDef:F(()=>[s.options.defaultColumn],d=>{var a;return d=(a=d)!=null?a:{},{header:p=>{const _=p.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:p=>{var _,C;return (_=(C=p.renderValue())==null||C.toString==null?void 0:C.toString())!=null?_:null},...s._features.reduce((p,_)=>Object.assign(p,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...d}},M(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>s.options.columns,getAllColumns:F(()=>[s._getColumnDefs()],d=>{const a=function(p,_,C){return C===void 0&&(C=0),p.map(S=>{const x=On(s,S,C,_),y=S;return x.columns=y.columns?a(y.columns,x,C+1):[],x})};return a(d)},M(e,"debugColumns","getAllColumns")),getAllFlatColumns:F(()=>[s.getAllColumns()],d=>d.flatMap(a=>a.getFlatColumns()),M(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:F(()=>[s.getAllFlatColumns()],d=>d.reduce((a,p)=>(a[p.id]=p,a),{}),M(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:F(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(d,a)=>{let p=d.flatMap(_=>_.getLeafColumns());return a(p)},M(e,"debugColumns","getAllLeafColumns")),getColumn:d=>{const a=s._getAllFlatColumnsById()[d];return process.env.NODE_ENV!=="production"&&!a&&console.error(`[Table] Column with id '${d}' does not exist.`),a}};Object.assign(s,f);for(let d=0;d<s._features.length;d++){const a=s._features[d];a==null||a.createTable==null||a.createTable(s);}return s}function wo(){return e=>F(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(s,i,l){i===void 0&&(i=0);const r=[];for(let c=0;c<s.length;c++){const g=tt(e,e._getRowId(s[c],c,l),s[c],c,i,void 0,l?.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,r.push(g),e.options.getSubRows){var u;g.originalSubRows=e.options.getSubRows(s[c],c),(u=g.originalSubRows)!=null&&u.length&&(g.subRows=n(g.originalSubRows,i+1,g));}}return r};return t.rows=n(o),t},M(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function So(e,o,t){return t.options.filterFromLeafRows?Co(e,o,t):Ro(e,o,t)}function Co(e,o,t){var n;const s=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,r=function(u,c){c===void 0&&(c=0);const g=[];for(let d=0;d<u.length;d++){var f;let a=u[d];const p=tt(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);if(p.columnFilters=a.columnFilters,(f=a.subRows)!=null&&f.length&&c<l){if(p.subRows=r(a.subRows,c+1),a=p,o(a)&&!p.subRows.length){g.push(a),i[a.id]=a,s.push(a);continue}if(o(a)||p.subRows.length){g.push(a),i[a.id]=a,s.push(a);continue}}else a=p,o(a)&&(g.push(a),i[a.id]=a,s.push(a));}return g};return {rows:r(e),flatRows:s,rowsById:i}}function Ro(e,o,t){var n;const s=[],i={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,r=function(u,c){c===void 0&&(c=0);const g=[];for(let d=0;d<u.length;d++){let a=u[d];if(o(a)){var f;if((f=a.subRows)!=null&&f.length&&c<l){const _=tt(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);_.subRows=r(a.subRows,c+1),a=_;}g.push(a),s.push(a),i[a.id]=a;}}return g};return {rows:r(e),flatRows:s,rowsById:i}}function xo(){return e=>F(()=>[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 s=[],i=[];(t??[]).forEach(d=>{var a;const p=e.getColumn(d.id);if(!p)return;const _=p.getFilterFn();if(!_){process.env.NODE_ENV!=="production"&&console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${p.id}.`);return}s.push({id:d.id,filterFn:_,resolvedValue:(a=_.resolveFilterValue==null?void 0:_.resolveFilterValue(d.value))!=null?a:d.value});});const l=(t??[]).map(d=>d.id),r=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&r&&u.length&&(l.push("__global__"),u.forEach(d=>{var a;i.push({id:d.id,filterFn:r,resolvedValue:(a=r.resolveFilterValue==null?void 0:r.resolveFilterValue(n))!=null?a:n});}));let c,g;for(let d=0;d<o.flatRows.length;d++){const a=o.flatRows[d];if(a.columnFilters={},s.length)for(let p=0;p<s.length;p++){c=s[p];const _=c.id;a.columnFilters[_]=c.filterFn(a,_,c.resolvedValue,C=>{a.columnFiltersMeta[_]=C;});}if(i.length){for(let p=0;p<i.length;p++){g=i[p];const _=g.id;if(g.filterFn(a,_,g.resolvedValue,C=>{a.columnFiltersMeta[_]=C;})){a.columnFilters.__global__=true;break}}a.columnFilters.__global__!==true&&(a.columnFilters.__global__=false);}}const f=d=>{for(let a=0;a<l.length;a++)if(d.columnFilters[l[a]]===false)return  false;return  true};return So(o.rows,f,e)},M(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function yo(){return e=>F(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,s=[],i=n.filter(u=>{var c;return (c=e.getColumn(u.id))==null?void 0:c.getCanSort()}),l={};i.forEach(u=>{const c=e.getColumn(u.id);c&&(l[u.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()});});const r=u=>{const c=u.map(g=>({...g}));return c.sort((g,f)=>{for(let a=0;a<i.length;a+=1){var d;const p=i[a],_=l[p.id],C=_.sortUndefined,S=(d=p?.desc)!=null?d:false;let x=0;if(C){const y=g.getValue(p.id),k=f.getValue(p.id),A=y===void 0,D=k===void 0;if(A||D){if(C==="first")return A?-1:1;if(C==="last")return A?1:-1;x=A&&D?0:A?C:-C;}}if(x===0&&(x=_.sortingFn(g,f,p.id)),x!==0)return S&&(x*=-1),_.invertSorting&&(x*=-1),x}return g.index-f.index}),c.forEach(g=>{var f;s.push(g),(f=g.subRows)!=null&&f.length&&(g.subRows=r(g.subRows));}),c};return {rows:r(t.rows),flatRows:s,rowsById:t.rowsById}},M(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function xe(...e){const o={};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n=="function"&&(n=n()),n){const s=Object.getOwnPropertyDescriptors(n);for(const i in s)i in o||Object.defineProperty(o,i,{enumerable:true,get(){for(let l=e.length-1;l>=0;l--){let r=e[l];typeof r=="function"&&(r=r());const u=(r||{})[i];if(u!==void 0)return u}}});}}return o}function Fo(e){const o=xe({state:{},onStateChange(){},renderFallbackValue:null,mergeOptions:(i,l)=>xe(i,l)},e),t=vo(o);let n=t.initialState;function s(){t.setOptions(i=>xe(i,e,{state:xe(n,e.state||{}),onStateChange:l=>{l instanceof Function?n=l(n):n=xe(n,l),e.onStateChange?.(l);}}));}return s(),{getRowModel:()=>t.getRowModel(),getHeaderGroups:()=>t.getHeaderGroups(),getColumn:i=>t.getColumn(i)}}function _e(e,o,t){let n=t.initialDeps??[],s,i=true;function l(){var r,u,c;let g;t.key&&((r=t.debug)!=null&&r.call(t))&&(g=Date.now());const f=e();if(!(f.length!==n.length||f.some((p,_)=>n[_]!==p)))return s;n=f;let a;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(a=Date.now()),s=o(...f),t.key&&((c=t.debug)!=null&&c.call(t))){const p=Math.round((Date.now()-g)*100)/100,_=Math.round((Date.now()-a)*100)/100,C=_/16,S=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${S(_,5)} /${S(p,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*C,120))}deg 100% 31%);`,t?.key);}return t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(s),i=false,s}return l.updateDeps=r=>{n=r;},l}function Rt(e,o){if(e===void 0)throw new Error("Unexpected undefined");return e}const Mo=(e,o)=>Math.abs(e-o)<1.01,bo=(e,o,t)=>{let n;return function(...s){e.clearTimeout(n),n=e.setTimeout(()=>o.apply(this,s),t);}},xt=e=>{const{offsetWidth:o,offsetHeight:t}=e;return {width:o,height:t}},Io=e=>e,Eo=e=>{const o=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let s=o;s<=t;s++)n.push(s);return n},ko=(e,o)=>{const t=e.scrollElement;if(!t)return;const n=e.targetWindow;if(!n)return;const s=l=>{const{width:r,height:u}=l;o({width:Math.round(r),height:Math.round(u)});};if(s(xt(t)),!n.ResizeObserver)return ()=>{};const i=new n.ResizeObserver(l=>{const r=()=>{const u=l[0];if(u?.borderBoxSize){const c=u.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(xt(t));};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r();});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t);}},yt={passive:true},Ft=typeof window>"u"?true:"onscrollend"in window,Vo=(e,o)=>{const t=e.scrollElement;if(!t)return;const n=e.targetWindow;if(!n)return;let s=0;const i=e.options.useScrollendEvent&&Ft?()=>{}:bo(n,()=>{o(s,false);},e.options.isScrollingResetDelay),l=g=>()=>{const{horizontal:f,isRtl:d}=e.options;s=f?t.scrollLeft*(d&&-1||1):t.scrollTop,i(),o(s,g);},r=l(true),u=l(false);t.addEventListener("scroll",r,yt);const c=e.options.useScrollendEvent&&Ft;return c&&t.addEventListener("scrollend",u,yt),()=>{t.removeEventListener("scroll",r),c&&t.removeEventListener("scrollend",u);}},Po=(e,o,t)=>{if(o?.borderBoxSize){const n=o.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Ao=(e,{adjustments:o=0,behavior:t},n)=>{var s,i;const l=e+o;(i=(s=n.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[n.options.horizontal?"left":"top"]:l,behavior:t});};class Do{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=false,this.lanesSettling=false,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,n,s;return ((s=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:s.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const l=()=>{const r=i.target,u=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(r,i,this));};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l();});}));return {disconnect:()=>{var s;(s=n())==null||s.disconnect(),t=null;},observe:s=>{var i;return (i=n())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return (i=n())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,s])=>{typeof s>"u"&&delete t[n];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:Io,rangeExtractor:Eo,onChange:()=>{},measureElement:Po,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:false,useAnimationFrameWithResizeObserver:false,...t};},this.notify=t=>{var n,s;(s=(n=this.options).onChange)==null||s.call(n,this,t);},this.maybeNotify=_e(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s);}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify();})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0});}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const s=new Map,i=new Map;for(let l=n-1;l>=0;l--){const r=t[l];if(s.has(r.lane))continue;const u=i.get(r.lane);if(u==null||r.end>u.end?i.set(r.lane,r):r.end<u.end&&s.set(r.lane,true),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((l,r)=>l.end===r.end?l.index-r.index:l.end-r.end)[0]:void 0},this.getMeasurementOptions=_e(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,n,s,i,l,r)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=true),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:s,getItemKey:i,enabled:l,lanes:r}),{key:false}),this.getMeasurements=_e(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:s,getItemKey:i,enabled:l,lanes:r},u)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const d of this.laneAssignments.keys())d>=t&&this.laneAssignments.delete(d);this.lanesChangedFlag&&(this.lanesChangedFlag=false,this.lanesSettling=true,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size);}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=false);const g=this.measurementsCache.slice(0,c),f=new Array(r).fill(void 0);for(let d=0;d<c;d++){const a=g[d];a&&(f[a.lane]=d);}for(let d=c;d<t;d++){const a=i(d),p=this.laneAssignments.get(d);let _,C;if(p!==void 0&&this.options.lanes>1){_=p;const k=f[_],A=k!==void 0?g[k]:void 0;C=A?A.end+this.options.gap:n+s;}else {const k=this.options.lanes===1?g[d-1]:this.getFurthestMeasurement(g,d);C=k?k.end+this.options.gap:n+s,_=k?k.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,_);}const S=u.get(a),x=typeof S=="number"?S:this.options.estimateSize(d),y=C+x;g[d]={index:d,start:C,size:x,end:y,key:a,lane:_},f[_]=d;}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=_e(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,s,i)=>this.range=t.length>0&&n>0?zo({measurements:t,outerSize:n,scrollOffset:s,lanes:i}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=_e(()=>{let t=null,n=null;const s=this.calculateRange();return s&&(t=s.startIndex,n=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,s,i,l)=>i===null||l===null?[]:t({startIndex:i,endIndex:l,overscan:n,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,s=t.getAttribute(n);return s?parseInt(s,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return  true;const s=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,s-i),r=Math.min(this.options.count-1,s+i);return t>=l&&t<=r}return  true},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,r)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(r));});return}const n=this.indexFromElement(t),s=this.options.getItemKey(n),i=this.elementsCache.get(s);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(s,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this));},this.resizeItem=(t,n)=>{var s;const i=this.measurementsCache[t];if(!i)return;const l=this.itemSizeCache.get(i.key)??i.size,r=n-l;r!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,r,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",r),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(false));},this.getVirtualItems=_e(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const s=[];for(let i=0,l=t.length;i<l;i++){const r=t[i],u=n[r];s.push(u);}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return Rt(n[Tt(0,n.length-1,s=>Rt(n[s]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),l=this.getScrollOffset();n==="auto"&&(n=t>=l+i?"end":"start"),n==="center"?t+=(s-i)/2:n==="end"&&(t-=i);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(n==="auto")if(l.end>=i+s-this.options.scrollPaddingEnd)n="end";else if(l.start<=i+this.options.scrollPaddingStart)n="start";else return [i,n];if(n==="end"&&t===this.options.count-1)return [this.getMaxScrollOffset(),n];const r=n==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return [this.getOffsetForAlignment(r,n,l.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(t,n),l=this.now();this.scrollState={index:null,align:n,behavior:s,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile();},this.scrollToIndex=(t,{align:n="auto",behavior:s="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,n);if(!i)return;const[l,r]=i,u=this.now();this.scrollState={index:t,align:r,behavior:s,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile();},this.scrollBy=(t,{behavior:n="auto"}={})=>{const s=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile();},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let s;if(n.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=n[n.length-1])==null?void 0:t.end)??0;else {const i=Array(this.options.lanes).fill(null);let l=n.length-1;for(;l>=0&&i.some(r=>r===null);){const r=n[l];i[r.lane]===null&&(i[r.lane]=r.end),l--;}s=Math.max(...i.filter(r=>r!==null));}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:n},this);},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(false);},this.setOptions(o);}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll();}));}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=n?n[0]:this.scrollState.lastTargetOffset,i=1,l=s!==this.scrollState.lastTargetOffset;if(!l&&Mo(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,l&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile();}}const Tt=(e,o,t,n)=>{for(;e<=o;){const s=(e+o)/2|0,i=t(s);if(i<n)e=s+1;else if(i>n)o=s-1;else return s}return e>0?e-1:0};function zo({measurements:e,outerSize:o,scrollOffset:t,lanes:n}){const s=e.length-1,i=u=>e[u].start;if(e.length<=n)return {startIndex:0,endIndex:s};let l=Tt(0,s,i,t),r=l;if(n===1)for(;r<s&&e[r].end<t+o;)r++;else if(n>1){const u=Array(n).fill(0);for(;r<s&&u.some(g=>g<t+o);){const g=e[r];u[g.lane]=g.end,r++;}const c=Array(n).fill(t+o);for(;l>=0&&c.some(g=>g>=t);){const g=e[l];c[g.lane]=g.start,l--;}l=Math.max(0,l-l%n),r=Math.min(s,r+(n-1-r%n));}return {startIndex:l,endIndex:r}}function Oo(e){const o=new Do({observeElementRect:ko,observeElementOffset:Vo,scrollToFn:Ao,...e,onChange:(t,n)=>{n||queueMicrotask(()=>{}),e.onChange?.(t,n);}});return {instance:o,virtualItems:()=>o.getVirtualItems(),totalSize:()=>o.getTotalSize()}}function Mt(e,o){e.component(t=>{let{position:n,coords:s,on_click:i=null}=o,l=n==="column"?s[0]===0:s[1]===0,r=n==="column"?l?"down":"up":l?"right":"left";t.push(`<button${attr_class(`selection-button selection-button-${stringify(n)} ${stringify(l?`move-${r}`:"")}`,"svelte-fit6p6")}${attr("aria-label",`Select ${n}`)}><span${attr_class(clsx(r),"svelte-fit6p6")}><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="svelte-fit6p6"><path d="m16.707 13.293-4-4a1 1 0 0 0-1.414 0l-4 4A1 1 0 0 0 8 15h8a1 1 0 0 0 .707-1.707z"${attr("data-name",r)}></path></svg></span></button>`);});}function Lo(e,o){e.component(t=>{let{value:n=false,editable:s=true,on_change:i}=o;function l(g){s&&i(g);}let r=true,u;function c(g){g.push('<div class="bool-cell svelte-1d51ufy" role="button" tabindex="-1">'),d(g,{label:"",interactive:s,on_change:l,get value(){return n},set value(f){n=f,r=false;}}),g.push("<!----></div>");}do r=true,u=t.copy(),c(u);while(!r);t.subsume(u),bind_props(o,{value:n});});}function Bt(e,o){e.component(t=>{let{edit:n,value:s="",display_value:i=null,styling:l="",header:r=false,datatype:u="str",latex_delimiters:c,line_breaks:g=true,editable:f=true,is_static:d=false,max_chars:a=null,components:p={},i18n:_,is_dragging:C=false,wrap_text:S=false,expanded:x=false,show_selection_buttons:y=false,coords:k,on_select_column:A=null,on_select_row:D=null,el:G=null,onblur:P,onkeydown:Z,pad_left:X=false}=o;function T(I,U=null,se=false){if(se)return String(I);const fe=String(I);return !U||U<=0||fe.length<=U?fe:fe.slice(0,U)+"..."}let ge=!n&&!x&&a!==null&&a>0,le=f?s:i!==null?i:s,re=ge?T(le,a,u==="image"):le;function ve(I){P?.({blur_event:I,coords:k});}function we(I){ve({target:{value:s}});}let pe=true,Se;function it(I){if(n&&u!=="bool"){I.push("<!--[-->"),I.push(`<textarea${attr("readonly",d,true)}${attr("aria-readonly",d)}${attr("aria-label",d?"Cell is read-only":"Edit cell")} tabindex="-1"${attr_class("svelte-odwpey",void 0,{header:r,pad_left:X})}>`);const U=escape_html(s);U&&I.push(`${U}`),I.push("</textarea>");}else I.push("<!--[!-->");if(I.push("<!--]--> "),u==="bool"&&typeof s=="boolean")I.push("<!--[-->"),Lo(I,{editable:f,on_change:we,get value(){return s},set value(U){s=U,pe=false;}});else {if(I.push("<!--[!-->"),I.push(`<span tabindex="0" role="button"${attr_style(l)}${attr("data-editable",f)}${attr("data-max-chars",a)}${attr("data-expanded",n)} placeholder=" "${attr_class("svelte-odwpey",void 0,{dragging:C,edit:n,expanded:n,header:r,text:u==="str",wrap:S})}>`),u==="image"&&p.image){I.push("<!--[-->");const U=p.image;I.push("<!---->"),U(I,{value:{url:re},show_label:false,label:"cell-image",show_download_button:false,i18n:_,gradio:{dispatch:()=>{}}}),I.push("<!---->");}else I.push("<!--[!-->"),u==="html"?(I.push("<!--[-->"),I.push(`${html(re)}`)):(I.push("<!--[!-->"),u==="markdown"?(I.push("<!--[-->"),Qt(I,{message:re.toLocaleString(),latex_delimiters:c,line_breaks:g,chatbot:false})):(I.push("<!--[!-->"),I.push(`${escape_html(re)}`)),I.push("<!--]-->")),I.push("<!--]-->");I.push("<!--]--></span>");}I.push("<!--]--> "),y&&k&&A&&D?(I.push("<!--[-->"),Mt(I,{position:"column",coords:k,on_click:()=>A(k[1])}),I.push("<!----> "),Mt(I,{position:"row",coords:k,on_click:()=>D(k[0])}),I.push("<!---->")):I.push("<!--[!-->"),I.push("<!--]-->");}do pe=true,Se=t.copy(),it(Se);while(!pe);t.subsume(Se),bind_props(o,{value:s,el:G});});}function Nt(e,o){e.component(t=>{let{on_click:n}=o;t.push('<button aria-label="Open cell menu" class="cell-menu-button svelte-j6wkfp" aria-haspopup="menu">⋮</button>');});}function Ho(e,o){let{size:t=16}=o;e.push(`<div class="wrapper svelte-4dxgzr" aria-label="Static column"><svg xmlns="http://www.w3.org/2000/svg"${attr("width",t)}${attr("height",t)} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg></div>`);}function jo(e){e.push('<svg viewBox="0 0 24 24" width="20" height="20"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M8 9H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M11 13H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>');}function Go(e,o){let{size:t=16}=o;e.push(`<svg${attr("width",t)}${attr("height",t)} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 8L8 4L12 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 4V12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>`);}function To(e,o){let{size:t=16}=o;e.push(`<svg${attr("width",t)}${attr("height",t)} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 8L8 12L12 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 12V4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>`);}function Bo(e,o){e.component(t=>{let{value:n,col_idx:s,is_editing:i=false,is_selected:l=false,is_static:r=false,is_bool:u=false,select_all_state:c="unchecked",sort_direction:g=null,sort_priority:f=null,multi_sort:d$1=false,is_filtered:a=false,show_menu_button:p=false,is_first_column:_=false,latex_delimiters:C,line_breaks:S=true,editable:x=true,max_chars:y=void 0,i18n:k,wrap_text:A=false,onclick:D,on_menu_click:G,on_end_edit:P,on_select_all:Z}=o,X=u&&x&&!r&&!!Z;t.push(`<th${attr_class("header-cell svelte-1d6xqpb",void 0,{focus:i||l,sorted:g!==null,filtered:a,"first-column":_})}${attr("data-heading",s)}${attr("title",n)}><div class="cell-wrap svelte-1d6xqpb"><div class="header-content svelte-1d6xqpb">`),X?(t.push("<!--[-->"),t.push('<div class="select-all-checkbox svelte-1d6xqpb" role="button" tabindex="-1">'),d(t,{value:c==="checked",indeterminate:c==="indeterminate",label:`Toggle all: ${n}`,interactive:true,on_select:()=>Z?.(s,c!=="checked")}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push("<!--]--> "),Bt(t,{value:n,latex_delimiters:C,line_breaks:S,edit:i,onkeydown:T=>{["Enter","Escape","Tab"].includes(T.key)&&P(T.key);},header:true,editable:x,is_static:r,i18n:k,max_chars:y,wrap_text:A,coords:[s,0],pad_left:!!X}),t.push("<!----></div> "),g||a||r?(t.push("<!--[-->"),t.push('<span class="header-icons svelte-1d6xqpb">'),a?(t.push("<!--[-->"),t.push('<span class="filter-indicator svelte-1d6xqpb" aria-label="Filtered">'),jo(t),t.push("<!----></span>")):t.push("<!--[!-->"),t.push("<!--]--> "),g?(t.push("<!--[-->"),t.push(`<span class="sort-indicator svelte-1d6xqpb"${attr("aria-label",`Sorted ${stringify(g)}ending`)}>`),g==="asc"?(t.push("<!--[-->"),Go(t,{size:13})):(t.push("<!--[!-->"),To(t,{size:13})),t.push("<!--]--> "),d$1&&f!=null?(t.push("<!--[-->"),t.push(`<span class="sort-priority svelte-1d6xqpb">${escape_html(f)}</span>`)):t.push("<!--[!-->"),t.push("<!--]--></span>")):t.push("<!--[!-->"),t.push("<!--]--> "),r?(t.push("<!--[-->"),Ho(t,{size:11})):t.push("<!--[!-->"),t.push("<!--]--></span>")):t.push("<!--[!-->"),t.push("<!--]--> "),p?(t.push("<!--[-->"),Nt(t,{on_click:T=>G(T,s)})):t.push("<!--[!-->"),t.push("<!--]--></div></th>");});}function No(e,o){e.component(t=>{let{value:n,display_value:s=null,datatype:i="str",row_idx:l,col_idx:r,col_style:u="",cell_style:c="",selection_classes:g="",is_editing:f=false,is_flash:d=false,is_static:a=false,show_menu_button:p=false,show_selection_buttons:_=false,is_first_column:C=false,is_solo:S=false,latex_delimiters:x,line_breaks:y=true,editable:k=true,max_chars:A=void 0,i18n:D,components:G={},is_dragging:P=false,wrap_text:Z=false,onmousedown:X,ondblclick:T,oncontextmenu:ge,onblur:le,on_menu_click:re,on_select_column:ve,on_select_row:we}=o;t.push(`<div${attr_class(`body-cell ${stringify(g)}`,"svelte-183k2ki",{flash:d,"first-column":C,static:a,"cell-solo":S})}${attr("data-row",l)}${attr("data-col",r)}${attr("data-testid",`cell-${l}-${r}`)}${attr("tabindex",a?-1:void 0)}${attr_style(`${stringify(u)} ${stringify(c)}`)}><div class="cell-wrap svelte-183k2ki"${attr_style("")}>`),Bt(t,{value:n,display_value:s,latex_delimiters:x,line_breaks:y,editable:k,is_static:a,edit:f,datatype:i,onblur:le,max_chars:A,i18n:D,components:G,show_selection_buttons:_,coords:[l,r],on_select_column:ve,on_select_row:we,is_dragging:P,wrap_text:Z,expanded:S}),t.push("<!----> "),p?(t.push("<!--[-->"),Nt(t,{on_click:re})):t.push("<!--[!-->"),t.push("<!--]--></div></div>");});}function qo(e,o){e.push('<button class="add-row-button svelte-1at77md" aria-label="Add row">+</button>');}function Uo(e,o){if(e==null)return e;if(o==="number"){const t=Number(e);return isNaN(t)?e:t}if(o==="bool"){if(typeof e=="boolean")return e;if(typeof e=="number")return e!==0;const t=String(e).toLowerCase();return t==="true"||t==="1"?true:t==="false"||t==="0"?false:e}if(o==="date"){const t=new Date(e);return isNaN(t.getTime())?e:t.toISOString()}return e}function ee(e,o){let{icon:t}=o;t=="add-column-right"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="4" y="6" width="4" height="12" stroke="currentColor" stroke-width="2" fill="none"></rect><path d="M12 12H19M16 8L19 12L16 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="add-column-left"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="16" y="6" width="4" height="12" stroke="currentColor" stroke-width="2" fill="none"></rect><path d="M12 12H5M8 8L5 12L8 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="add-row-above"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="6" y="16" width="12" height="4" stroke="currentColor" stroke-width="2"></rect><path d="M12 12V5M8 8L12 5L16 8" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="add-row-below"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="6" y="4" width="12" height="4" stroke="currentColor" stroke-width="2"></rect><path d="M12 12V19M8 16L12 19L16 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="delete-row"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="5" y="10" width="14" height="4" stroke="currentColor" stroke-width="2"></rect><path d="M8 7L16 17M16 7L8 17" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="delete-column"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><rect x="10" y="5" width="4" height="14" stroke="currentColor" stroke-width="2"></rect><path d="M7 8L17 16M17 8L7 16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="sort-asc"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M8 16L12 12L16 16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 12V19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 7H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="sort-desc"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M8 12L12 16L16 12" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 16V9" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="clear-sort"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 9H15" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 13H11" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M5 17H7" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M17 17L21 21M21 17L17 21" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="filter"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M8 9H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M11 13H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):(e.push("<!--[!-->"),t=="clear-filter"?(e.push("<!--[-->"),e.push('<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 5H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M8 9H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M11 13H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M17 17L21 21M21 17L17 21" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>')):e.push("<!--[!-->"),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->")),e.push("<!--]-->");}function Wo(e,o){e.component(t=>{let{x:n,y:s,on_add_row_above:i,on_add_row_below:l,on_add_column_left:r,on_add_column_right:u,row:c,col_count:g,row_count:f,on_delete_row:d,on_delete_col:a,can_delete_rows:p,can_delete_cols:_,on_sort:C=()=>{},on_clear_sort:S=()=>{},sort_direction:x=null,sort_priority:y=null,on_filter:k=()=>{},on_clear_filter:A=()=>{},filter_active:D=null,editable:G=true,i18n:P}=o,Z=null,X=c===-1,T=G&&f[1]==="dynamic",ge=G&&g[1]==="dynamic";t.push('<div class="cell-menu svelte-1v4jjjx" role="menu">'),X?(t.push("<!--[-->"),t.push(`<button role="menuitem"${attr_class("svelte-1v4jjjx",void 0,{active:x==="asc"})}>`),ee(t,{icon:"sort-asc"}),t.push(`<!----> ${escape_html(P("dataframe.sort_ascending"))} `),x==="asc"&&y!==null?(t.push("<!--[-->"),t.push(`<span class="priority svelte-1v4jjjx">${escape_html(y)}</span>`)):t.push("<!--[!-->"),t.push(`<!--]--></button> <button role="menuitem"${attr_class("svelte-1v4jjjx",void 0,{active:x==="desc"})}>`),ee(t,{icon:"sort-desc"}),t.push(`<!----> ${escape_html(P("dataframe.sort_descending"))} `),x==="desc"&&y!==null?(t.push("<!--[-->"),t.push(`<span class="priority svelte-1v4jjjx">${escape_html(y)}</span>`)):t.push("<!--[!-->"),t.push('<!--]--></button> <button role="menuitem" class="svelte-1v4jjjx">'),ee(t,{icon:"clear-sort"}),t.push(`<!----> ${escape_html(P("dataframe.clear_sort"))}</button> <button role="menuitem"${attr_class("svelte-1v4jjjx",void 0,{active:D||Z})}>`),ee(t,{icon:"filter"}),t.push(`<!----> ${escape_html(P("dataframe.filter"))} `),D?(t.push("<!--[-->"),t.push('<span class="priority svelte-1v4jjjx">1</span>')):t.push("<!--[!-->"),t.push('<!--]--></button> <button role="menuitem" class="svelte-1v4jjjx">'),ee(t,{icon:"clear-filter"}),t.push(`<!----> ${escape_html(P("dataframe.clear_filter"))}</button>`)):t.push("<!--[!-->"),t.push("<!--]--> "),!X&&T?(t.push("<!--[-->"),t.push('<button role="menuitem" aria-label="Add row above" class="svelte-1v4jjjx">'),ee(t,{icon:"add-row-above"}),t.push(`<!----> ${escape_html(P("dataframe.add_row_above"))}</button> <button role="menuitem" aria-label="Add row below" class="svelte-1v4jjjx">`),ee(t,{icon:"add-row-below"}),t.push(`<!----> ${escape_html(P("dataframe.add_row_below"))}</button> `),p?(t.push("<!--[-->"),t.push('<button role="menuitem" class="delete svelte-1v4jjjx" aria-label="Delete row">'),ee(t,{icon:"delete-row"}),t.push(`<!----> ${escape_html(P("dataframe.delete_row"))}</button>`)):t.push("<!--[!-->"),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--> "),ge?(t.push("<!--[-->"),t.push('<button role="menuitem" aria-label="Add column to the left" class="svelte-1v4jjjx">'),ee(t,{icon:"add-column-left"}),t.push(`<!----> ${escape_html(P("dataframe.add_column_left"))}</button> <button role="menuitem" aria-label="Add column to the right" class="svelte-1v4jjjx">`),ee(t,{icon:"add-column-right"}),t.push(`<!----> ${escape_html(P("dataframe.add_column_right"))}</button> `),_?(t.push("<!--[-->"),t.push('<button role="menuitem" class="delete svelte-1v4jjjx" aria-label="Delete column">'),ee(t,{icon:"delete-column"}),t.push(`<!----> ${escape_html(P("dataframe.delete_column"))}</button>`)):t.push("<!--[!-->"),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--></div> "),t.push("<!--[!-->"),t.push("<!--]-->");});}function Ko(e$1,o){e$1.component(t=>{let{show_fullscreen_button:n=false,show_copy_button:s=false,show_search:i="none",fullscreen:l=false,on_copy:r,current_search_query:u=null,onfullscreen:c}=o,g=false,f;function d(){g=true,f&&clearTimeout(f),f=setTimeout(()=>{g=false;},2e3);}async function a(){await r(),d();}t.push('<div class="toolbar svelte-1rajnm3" role="toolbar" aria-label="Table actions"><div class="toolbar-buttons svelte-1rajnm3">'),i!=="none"?(t.push("<!--[-->"),t.push(`<div class="search-container svelte-1rajnm3"><input type="text"${attr("value",u||"")}${attr("placeholder",i==="filter"?"Filter...":"Search...")}${attr_class("search-input svelte-1rajnm3",void 0,{"filter-mode":i==="filter"})}${attr("title",`Enter text to ${i} the table`)}/> `),u&&i==="filter"?(t.push("<!--[-->"),t.push('<button class="toolbar-button check-button svelte-1rajnm3" aria-label="Apply filter and update dataframe values" title="Apply filter and update dataframe values">'),e(t),t.push("<!----></button>")):t.push("<!--[!-->"),t.push("<!--]--></div>")):t.push("<!--[!-->"),t.push("<!--]--> "),s?(t.push("<!--[-->"),w(t,{Icon:g?e:h,label:g?"Copied to clipboard":"Copy table data",onclick:a})):t.push("<!--[!-->"),t.push("<!--]--> "),n?(t.push("<!--[-->"),k(t,{fullscreen:l,onclick:p=>c?.()})):t.push("<!--[!-->"),t.push("<!--]--></div></div>");});}function Xo(e,o){const[t,n]=e;return o.some(([s,i])=>s===t&&i===n)}function Jo(e,o){const[t,n]=e;if(!o.some(([u,c])=>u===t&&c===n))return "";const s=o.some(([u,c])=>u===t-1&&c===n),i=o.some(([u,c])=>u===t+1&&c===n),l=o.some(([u,c])=>u===t&&c===n-1),r=o.some(([u,c])=>u===t&&c===n+1);return `cell-selected${s?" no-top":""}${i?" no-bottom":""}${l?" no-left":""}${r?" no-right":""}`}var bt={},Ke={},Xe=34,ye=10,Je=13;function qt(e){return new Function("d","return {"+e.map(function(o,t){return JSON.stringify(o)+": d["+t+'] || ""'}).join(",")+"}")}function Zo(e,o){var t=qt(e);return function(n,s){return o(t(n),s,e)}}function It(e){var o=Object.create(null),t=[];return e.forEach(function(n){for(var s in n)s in o||t.push(o[s]=s);}),t}function K(e,o){var t=e+"",n=t.length;return n<o?new Array(o-n+1).join(0)+t:t}function Qo(e){return e<0?"-"+K(-e,6):e>9999?"+"+K(e,6):K(e,4)}function $o(e){var o=e.getUTCHours(),t=e.getUTCMinutes(),n=e.getUTCSeconds(),s=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":Qo(e.getUTCFullYear())+"-"+K(e.getUTCMonth()+1,2)+"-"+K(e.getUTCDate(),2)+(s?"T"+K(o,2)+":"+K(t,2)+":"+K(n,2)+"."+K(s,3)+"Z":n?"T"+K(o,2)+":"+K(t,2)+":"+K(n,2)+"Z":t||o?"T"+K(o,2)+":"+K(t,2)+"Z":"")}function es(e){var o=new RegExp('["'+e+`
\r]`),t=e.charCodeAt(0);function n(f,d){var a,p,_=s(f,function(C,S){if(a)return a(C,S-1);p=C,a=d?Zo(C,d):qt(C);});return _.columns=p||[],_}function s(f,d){var a=[],p=f.length,_=0,C=0,S,x=p<=0,y=false;f.charCodeAt(p-1)===ye&&--p,f.charCodeAt(p-1)===Je&&--p;function k(){if(x)return Ke;if(y)return y=false,bt;var D,G=_,P;if(f.charCodeAt(G)===Xe){for(;_++<p&&f.charCodeAt(_)!==Xe||f.charCodeAt(++_)===Xe;);return (D=_)>=p?x=true:(P=f.charCodeAt(_++))===ye?y=true:P===Je&&(y=true,f.charCodeAt(_)===ye&&++_),f.slice(G+1,D-1).replace(/""/g,'"')}for(;_<p;){if((P=f.charCodeAt(D=_++))===ye)y=true;else if(P===Je)y=true,f.charCodeAt(_)===ye&&++_;else if(P!==t)continue;return f.slice(G,D)}return x=true,f.slice(G,p)}for(;(S=k())!==Ke;){for(var A=[];S!==bt&&S!==Ke;)A.push(S),S=k();d&&(A=d(A,C++))==null||a.push(A);}return a}function i(f,d){return f.map(function(a){return d.map(function(p){return g(a[p])}).join(e)})}function l(f,d){return d==null&&(d=It(f)),[d.map(g).join(e)].concat(i(f,d)).join(`
`)}function r(f,d){return d==null&&(d=It(f)),i(f,d).join(`
`)}function u(f){return f.map(c).join(`
`)}function c(f){return f.map(g).join(e)}function g(f){return f==null?"":f instanceof Date?$o(f):o.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return {parse:n,parseRows:s,format:l,formatBody:r,formatRows:u,formatRow:c,formatValue:g}}async function ts(e,o){if(!e||!e.length)return;const n=(o||e.flatMap((r,u)=>r.map((c,g)=>[u,g]))).reduce((r,[u,c])=>{r[u]=r[u]||{};const g=String(e[u][c].value);return r[u][c]=g.includes(",")||g.includes('"')||g.includes(`
`)?`"${g.replace(/"/g,'""')}"`:g,r},{}),s=Object.keys(n).sort((r,u)=>+r-+u);if(!s.length)return;const i=Object.keys(n[s[0]]).sort((r,u)=>+r-+u),l=s.map(r=>i.map(u=>n[r][u]||"").join(",")).join(`
`);try{await navigator.clipboard.writeText(l);}catch(r){throw new Error("Failed to copy to clipboard: "+r.message)}}function ns(e,o){return o.filter(t);function t(n){var s=-1;return e.split(`
`).every(i);function i(l){if(!l)return  true;var r=l.split(n).length;return s<0&&(s=r),s===r&&r>1}}}function os(e){const o=atob(e.split(",")[1]),t=e.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(o.length),s=new Uint8Array(n);for(let i=0;i<o.length;i++)s[i]=o.charCodeAt(i);return new Blob([n],{type:t})}function ss(e,o,t){const n=os(e),s=new FileReader;s.addEventListener("loadend",i=>{if(!i?.target?.result||typeof i.target.result!="string")return;const[l]=ns(i.target.result,[",","	"]),[r,...u]=es(l).parseRows(i.target.result);o(r),t(u);}),s.readAsText(n);}function is(e,o,t){const{dtype:n,filter:s,value:i}=t,l=String(e.getValue(o)??""),r=i??"";if(n==="number"){const g=parseFloat(l),f=parseFloat(r);if(isNaN(g)||isNaN(f))return s==="Is empty"?l.trim()==="":s==="Is not empty"?l.trim()!=="":true;switch(s){case "=":return g===f;case "≠":return g!==f;case ">":return g>f;case "<":return g<f;case "≥":return g>=f;case "≤":return g<=f;case "Is empty":return l.trim()==="";case "Is not empty":return l.trim()!=="";default:return  true}}const u=l.toLowerCase(),c=r.toLowerCase();switch(s){case "Contains":return u.includes(c);case "Does not contain":return !u.includes(c);case "Starts with":return u.startsWith(c);case "Ends with":return u.endsWith(c);case "Is":return u===c;case "Is not":return u!==c;case "Is empty":return l.trim()==="";case "Is not empty":return l.trim()!=="";default:return  true}}function ls(e){let o=[],t=0,n=0,s=[];function i(u,c){if(!u||u==="auto")return null;if(u.endsWith("%")){const f=parseFloat(u);return !isFinite(f)||c<=0?null:f/100*c}if(u.endsWith("px")){const f=parseFloat(u);return isFinite(f)?f:null}const g=parseFloat(u);return isFinite(g)?g:null}let l=(()=>{if(!e.show_row_numbers())return 0;const u=e.header_row_el();return u?u.querySelector(".row-number-header")?.getBoundingClientRect().width??48:0})();function r(u){if(o[u]!==void 0)return `width: ${o[u]}px; flex: 0 0 ${o[u]}px;`;const c=i(e.column_widths()[u],e.viewport_width());return c!=null?`width: ${c}px; flex: 0 0 ${c}px;`:"width: 150px; flex: 0 0 150px;"}return {get col_widths(){return o},get col_lefts(){return s},get total_header_width(){return t},get header_height(){return n},get row_num_width(){return l},get_col_style:r}}function rs(e,o){e.component(t=>{let{datatype:n,label:s=null,show_label:i=true,headers:l=[],values:r=[],col_count:u,row_count:c,latex_delimiters:g,components:f={},editable:d=true,wrap:a=false,root:p,i18n:_,max_height:C=500,line_breaks:S=true,column_widths:x=[],show_row_numbers:y=false,upload:k,stream_handler:A,buttons:D=null,value_is_output:G=false,max_chars:P=void 0,show_search:Z="none",pinned_columns:X=0,static_columns:T=[],fullscreen:ge=false,display_value:le=null,styling:re=null,onchange:ve,oninput:we,onselect:pe,onedit:Se,onsearch:it,onfullscreen:I}=o,U=(r??[]).map((h,m)=>{const w={_index:m};return (h??[]).forEach((R,b)=>{const z=Array.isArray(n)?n[b]:n;w[`col_${b}`]=Uo(R,z);}),w}),se=(()=>{let h=l??[];return u[1]==="fixed"&&h.length<u[0]&&(h=[...h,...Array(u[0]-h.length).fill(null).map((m,w)=>`${w+h.length}`)]),h.length||(h=Array(u[0]).fill(null).map((m,w)=>`${w}`)),h.map(m=>m??"")})(),fe=se.map((h,m)=>({id:`col_${m}`,accessorKey:`col_${m}`,header:h,size:150,minSize:45,filterFn:is,meta:{colIndex:m,datatype:Array.isArray(n)?n[m]:n,isStatic:T.includes(m)||T.includes(h),isPinned:m<X}})),J=[],ne=[],Me="",Ut={left:fe.filter((h,m)=>m<X).map(h=>h.id)};const lt=Fo({get data(){return U},get columns(){return fe},state:{get sorting(){return J},get columnFilters(){return ne},get globalFilter(){return Me},get columnPinning(){return Ut}},onSortingChange:h=>{J=typeof h=="function"?h(J):h;},onColumnFiltersChange:h=>{ne=typeof h=="function"?h(ne):h;},onGlobalFilterChange:h=>{Me=typeof h=="function"?h(Me):h;},getCoreRowModel:wo(),getSortedRowModel:yo(),getFilteredRowModel:xo(),globalFilterFn:"includesString",enableSorting:true,enableMultiSort:true,maxMultiSortColCount:3});let me=lt.getRowModel().rows,rt=lt.getHeaderGroups(),Wt;const ut=Oo({get count(){return me.length},getScrollElement:()=>Wt,estimateSize:()=>35,overscan:10,measureElement:(h,m,w)=>{const R=h.getBoundingClientRect().height;if(R>0)return R;const b=h.getAttribute("data-index");if(b!=null){const z=w.itemSizeCache?.get(Number(b));if(typeof z=="number")return z}return 35}});let Kt=ut.virtualItems(),Xt=ut.totalSize(),L=[],$=false,ue=false,Ce=false,be=false,H=null,V=null,Ae=false,at=false,ct=false,dt;function De(h){return Array.isArray(n)?n[h]??"str":n}const gt=[2.2,1.7,1.4,1.2,1.1,1.05];function Jt(h){const m=h.match(/^\s*(#{1,6})\s+(.+)/);if(m){const w=m[1].length;return m[2].replace(/[*_`[\]()]/g,"").length*gt[w-1]}return h.replace(/[*_`#[\]()]/g,"").length}function Yt(h){const m=h.replace(/<[^>]+>/g,"").length,w=h.match(/<h([1-6])\b/i);return w?m*gt[parseInt(w[1])-1]:m}function Zt(h,m){return P&&P>0&&m!=="image"&&h.length>P?h.slice(0,P)+"...":h}function Qt$1(){return (rt[0]?.headers??[]).map(m=>{const w=m.column.columnDef.meta?.colIndex??0,R=De(w),b=`col_${w}`;if(R==="bool")return {val:"false",col_idx:w,dtype:R};const z=R==="markdown"?Jt:R==="html"?Yt:E=>E.length;let O="",j=-1;for(const E of me){const oe=E.original._index,B=d?E.original[b]:le?.[oe]?.[w]??r?.[oe]?.[w];if(B==null)continue;const N=Zt(String(B),R),ae=z(N);ae>j&&(j=ae,O=N);}return {val:O,col_idx:w,dtype:R}})}function $t(h,m){return le?.[h]?.[m]!==void 0?le[h][m]:String(r?.[h]?.[m]??"")}function en(h,m){return re?.[h]?.[m]??""}function he(h,m){ve?.({data:h??r,headers:m??se,metadata:null}),G||we?.(),G=false;}function tn(h,m,w){const R=!d||T.includes(w)||T.includes(se[w]);R||h.preventDefault(),h.stopPropagation();const b=[m,w];if(h.shiftKey&&$){const[z,O]=$,[j,E]=b,oe=[];for(let B=Math.min(z,j);B<=Math.max(z,j);B++)for(let N=Math.min(O,E);N<=Math.max(O,E);N++)oe.push([B,N]);L=oe;}else h.metaKey||h.ctrlKey?L=L.some(([O,j])=>O===m&&j===w)?L.filter(([O,j])=>!(O===m&&j===w)):[...L,b]:L=[b];$=b,Ce=false,be=false,H=null,V=null,ue=false,pe?.({index:b,value:r?.[m]?.[w],row_value:r?.[m]??[],col_value:r?.map(z=>z[w])??[]}),R||tick().then(()=>dt?.focus());}function nn(h,m,w){!d||T.includes(w)||T.includes(se[w])||(h.preventDefault(),h.stopPropagation(),ue=[m,w]);}function on(h){const{coords:m}=h,w=h.blur_event.target;if(!w||w.value===void 0)return;const[R,b]=m,z=r?.[R]?.[b],O=w.value;if(String(z)!==String(O)){const j=r.map(E=>[...E]);j[R][b]=O,r=j,Se?.({index:[R,b],value:O,previous_value:String(z??"")}),he(j);}}function sn(h,m){h.target instanceof HTMLAnchorElement||(h.preventDefault(),h.stopPropagation(),d&&(ue=false,$=false,L=[],H=null,V=null,be=m,Ce=d?m:false));}function ln(h){["Escape","Enter","Tab"].includes(h)&&(Ce=false);}function rn(h,m){if(h.stopPropagation(),V?.col===m)V=null;else {const w=h.target.closest("th");if(w){const R=w.getBoundingClientRect();V={col:m,x:R.right,y:R.bottom};}}}function un(h,m){const w=`col_${h}`,R=m==="desc",b=J.findIndex(z=>z.id===w);b>=0&&J[b].desc===R?J=J.filter(z=>z.id!==w):J=[...J.filter(z=>z.id!==w),{id:w,desc:R}].slice(-3);}function an(){J=[];}function cn(h,m,w,R){const b=`col_${h}`;ne.findIndex(O=>O.id===b)>=0?ne=ne.filter(O=>O.id!==b):ne=[...ne,{id:b,value:{dtype:m,filter:w,value:R}}];}function dn(){ne=[];}function gn(h){if(c[1]!=="dynamic")return;const m=r[0]?.length||se.length||1,w=Array(m).fill(""),R=[...r];h!==void 0?R.splice(h,0,w):R.push(w),r=R,he(R),$=[h??R.length-1,0];}function fn(h){if(u[1]!=="dynamic")return;const m=[...l??[],`Header ${(l?.length??0)+1}`],w=r.map(R=>[...R,""]);h!==void 0&&(m.splice(h,0,m.pop()),w.forEach(R=>R.splice(h,0,R.pop()))),r=w,l=m,he(w,m);}function hn(h){r.length<=1||(r=[...r.slice(0,h),...r.slice(h+1)],he(r),H=null,V=null);}function pn(h){u[1]==="dynamic"&&((r[0]?.length??0)<=1||(r=r.map(m=>[...m.slice(0,h),...m.slice(h+1)]),l=[...(l??[]).slice(0,h),...(l??[]).slice(h+1)],he(r,l),H=null,V=null,$=false,L=[],ue=false));}function ft(h,m){gn(m==="above"?h:h+1),H=null;}function ht(h,m){fn(m==="left"?h:h+1),H=null;}function mn(h,m){const w=r.map(R=>{const b=[...R];return b[h]=m,b});r=w,he(w);}function _n(h){if(!r.length)return "unchecked";let m=0;for(const w of r){const R=w[h];(R===true||R==="true"||R==="True")&&m++;}return m===0?"unchecked":m===r.length?"checked":"indeterminate"}async function vn(){const h=r.map(w=>w.map((R,b)=>({id:`${b}`,value:R}))),m=L.length>0?L:null;await ts(h,m),Ae=true,setTimeout(()=>Ae=false,800);}function mt(h,m,w){if(h.stopPropagation(),H?.row===m&&H.col===w)H=null;else {const R=h.target.closest(".body-cell, td");if(R){const b=R.getBoundingClientRect();H={row:m,col:w,x:b.right,y:b.bottom};}}}function wn(h){ss(typeof h=="string"?h:h?.data??"",m=>(l=m.map(w=>w??""),l.map((w,R)=>({id:`h_${R}`,value:w}))),m=>{r=m,he(m,l);});}let Sn,Cn,_t=0;const ze=ls({header_row_el:()=>Sn,header_table_el:()=>Cn,resolved_headers:()=>se,row_data:()=>U,show_row_numbers:()=>y,column_widths:()=>x,viewport_width:()=>_t,on_resize:void 0});let Rn=H!==null||V!==null;$!==false&&$[0];function Ie(h){const m=`col_${h}`,w=J.findIndex(R=>R.id===m);return w===-1?{direction:null,priority:null}:{direction:J[w].desc?"desc":"asc",priority:w+1}}function vt(h){return ne.some(m=>m.id===`col_${h}`)}let Oe=true,Le;function xn(h){h.push(`<div${attr_class("table-container svelte-2balj6",void 0,{fullscreen:ge})}>`),s&&s.length!==0&&i||(D===null||D.includes("fullscreen"))||(D===null||D.includes("copy"))||Z!=="none"?(h.push("<!--[-->"),h.push('<div class="header-row svelte-2balj6">'),s&&s.length!==0&&i?(h.push("<!--[-->"),h.push(`<div class="label svelte-2balj6"><p class="svelte-2balj6">${escape_html(s)}</p></div>`)):h.push("<!--[!-->"),h.push("<!--]--> "),Ko(h,{show_fullscreen_button:D===null?true:D.includes("fullscreen"),fullscreen:ge,on_copy:vn,show_copy_button:D===null?true:D.includes("copy"),show_search:Z,onfullscreen:I,current_search_query:Me||null}),h.push("<!----></div>")):h.push("<!--[!-->"),h.push(`<!--]--> <div${attr_class("table-wrap svelte-2balj6",void 0,{dragging:at,"menu-open":H||V})} role="grid" tabindex="0"${attr_style(`--df-max-col-width: ${stringify(_t)}px;`)}>`),ee$1(h,{upload:k,stream_handler:A,flex:false,center:false,boundedheight:false,disable_click:true,root:p,onload:wn,aria_label:_("dataframe.drop_to_upload"),get dragging(){return ct},set dragging(m){ct=m,Oe=false;},children:m=>{m.push(`<div${attr_class("virtual-table-viewport svelte-2balj6",void 0,{"disable-scroll":Rn})}${attr_style(`max-height: ${stringify(C)}px;`)} role="grid">`),s&&s.length!==0?(m.push("<!--[-->"),m.push(`<span class="sr-only svelte-2balj6">${escape_html(s)}</span>`)):m.push("<!--[!-->"),m.push('<!--]--> <table class="header-table svelte-2balj6"><thead class="svelte-2balj6"><tr class="svelte-2balj6">'),y?(m.push("<!--[-->"),m.push('<th class="row-number-header svelte-2balj6"> </th>')):m.push("<!--[!-->"),m.push("<!--]--><!--[-->");const w=ensure_array_like(rt);for(let b=0,z=w.length;b<z;b++){let O=w[b];m.push("<!--[-->");const j=ensure_array_like(O.headers);for(let E=0,oe=j.length;E<oe;E++){let B=j[E];const N=B.column.columnDef.meta?.colIndex??0;Bo(m,{value:String(B.column.columnDef.header??""),col_idx:N,is_editing:Ce===N,is_selected:be===N,is_static:!!B.column.columnDef.meta?.isStatic,is_bool:De(N)==="bool",select_all_state:_n(N),sort_direction:Ie(N).direction,sort_priority:Ie(N).priority,multi_sort:J.length>1,is_filtered:vt(N),show_menu_button:u[1]==="dynamic",is_first_column:N===0&&!y,latex_delimiters:g,line_breaks:S,editable:d,max_chars:P,i18n:_,wrap_text:a,onclick:sn,on_menu_click:rn,on_end_edit:ln,on_select_all:mn});}m.push("<!--]-->");}if(m.push('<!--]--></tr></thead><tbody class="sizing-body svelte-2balj6" aria-hidden="true">'),me.length>0){m.push("<!--[-->");const b=Qt$1();m.push('<tr class="svelte-2balj6">'),y?(m.push("<!--[-->"),m.push(`<td class="row-number-cell svelte-2balj6">${escape_html(me.length)}</td>`)):m.push("<!--[!-->"),m.push("<!--]--><!--[-->");const z=ensure_array_like(b);for(let O=0,j=z.length;O<j;O++){let E=z[O];m.push('<td class="svelte-2balj6"><div class="cell-wrap svelte-2balj6">'),E.dtype==="markdown"?(m.push("<!--[-->"),Qt(m,{message:E.val,latex_delimiters:g,line_breaks:S,chatbot:false})):(m.push("<!--[!-->"),E.dtype==="html"?(m.push("<!--[-->"),m.push(`${html(E.val)}`)):(m.push("<!--[!-->"),m.push(`${escape_html(E.val)}`)),m.push("<!--]-->")),m.push("<!--]--></div></td>");}m.push("<!--]--></tr>");}else m.push("<!--[!-->");m.push(`<!--]--></tbody></table> <div class="virtual-body svelte-2balj6"${attr_style(`height: ${stringify(Xt)}px; position: relative; flex-shrink: 0; width: ${stringify("100%")};`)}><!--[-->`);const R=ensure_array_like(Kt);for(let b=0,z=R.length;b<z;b++){let O=R[b];const j=me[O.index],E=j?.original._index??O.index;if(j){m.push("<!--[-->"),m.push(`<div${attr_class("virtual-row svelte-2balj6",void 0,{"row-odd":O.index%2!==0})}${attr("data-index",O.index)}${attr_style(`position: absolute; top: 0; left: 0; width: 100%; transform: translateY(${stringify(O.start)}px);${stringify(L.some(([B])=>B===E)?" z-index: 3;":"")}`)}>`),y?(m.push("<!--[-->"),m.push(`<div class="row-number-cell svelte-2balj6"${attr("data-row",E)} data-col="row-number"${attr_style(`flex: 0 0 ${stringify(ze.row_num_width)}px; width: ${stringify(ze.row_num_width)}px;`)}>${escape_html(E+1)}</div>`)):m.push("<!--[!-->"),m.push("<!--]--> <!--[-->");const oe=ensure_array_like(j.getVisibleCells());for(let B=0,N=oe.length;B<N;B++){let ae=oe[B];const W=ae.column.columnDef.meta?.colIndex??0,yn=Xo([E,W],L);No(m,{value:ae.getValue(),display_value:$t(E,W),datatype:De(W),row_idx:E,col_idx:W,col_style:ze.get_col_style(B),cell_style:en(E,W),selection_classes:Jo([E,W],L),is_editing:!!(ue&&ue[0]===E&&ue[1]===W),is_flash:Ae&&yn,is_static:!d||!!ae.column.columnDef.meta?.isStatic,show_menu_button:d&&!ae.column.columnDef.meta?.isStatic&&L.length===1&&L[0][0]===E&&L[0][1]===W,show_selection_buttons:L.length===1&&L[0][0]===E&&L[0][1]===W,is_solo:L.length===1&&L[0][0]===E&&L[0][1]===W,is_first_column:B===0&&!y,latex_delimiters:g,line_breaks:S,editable:d,max_chars:P,i18n:_,components:f,is_dragging:at,wrap_text:a,onmousedown:Q=>tn(Q,E,W),ondblclick:Q=>nn(Q,E,W),oncontextmenu:Q=>{const He=!!ae.column.columnDef.meta?.isStatic;!d||He||(Q.preventDefault(),mt(Q,E,W));},onblur:on,on_menu_click:Q=>mt(Q,E,W),on_select_column:Q=>{L=me.map((He,je)=>[je,Q]),$=L[0];},on_select_row:Q=>{L=se.map((He,je)=>[Q,je]),$=L[0];}});}m.push("<!--]--></div>");}else m.push("<!--[!-->");m.push("<!--]-->");}m.push("<!--]--></div></div>");},$$slots:{default:true}}),h.push("<!----> "),h.push("<!--[!-->"),h.push("<!--]--></div></div> "),H||V?(h.push("<!--[-->"),Wo(h,{x:H?.x??V?.x??0,y:H?.y??V?.y??0,row:V?-1:H?.row??0,col_count:u,row_count:c,on_add_row_above:()=>ft(H?.row??-1,"above"),on_add_row_below:()=>ft(H?.row??-1,"below"),on_add_column_left:()=>ht(H?.col??V?.col??-1,"left"),on_add_column_right:()=>ht(H?.col??V?.col??-1,"right"),on_delete_row:()=>hn(H?.row??-1),on_delete_col:()=>pn(H?.col??V?.col??-1),editable:d,can_delete_rows:!V&&r.length>1&&d,can_delete_cols:r.length>0&&(r[0]?.length??0)>1&&d,i18n:_,on_sort:V?m=>{un(V.col,m),V=null;}:void 0,on_clear_sort:V?()=>{an(),V=null;}:void 0,sort_direction:V?Ie(V.col).direction:null,sort_priority:V?Ie(V.col).priority:null,on_filter:V?(m,w,R)=>{cn(V.col,m,w,R),V=null;}:void 0,on_clear_filter:V?()=>{dn(),V=null;}:void 0,filter_active:V?vt(V.col):null})):h.push("<!--[!-->"),h.push("<!--]--> "),r.length===0&&d&&c[1]==="dynamic"?(h.push("<!--[-->"),qo(h)):h.push("<!--[!-->"),h.push("<!--]-->");}do Oe=true,Le=t.copy(),xn(Le);while(!Oe);t.subsume(Le),bind_props(o,{headers:l,values:r,value_is_output:G});});}function Ms(e,o){e.component(t=>{let{$$slots:n,$$events:s,...i}=o;const l=new $(i);let r=l.props.fullscreen??false,u=(()=>{const p=l.props.datatype;if(!Array.isArray(p))return p;const _=l.props.headers,C=l.props.value?.headers;if(!_||!C)return p;const S=new Map;for(let x=0;x<Math.min(_.length,p.length);x++)S.set(_[x],p[x]);return C.map((x,y)=>S.get(x)??p[y]??"str")})(),c=l.props.value?JSON.stringify(l.props.value):null;function g(p){l.props.value=p;const _=JSON.stringify(p);_!==c&&(c=_,l.dispatch("change",p));}function f(){l.dispatch("input");}function d(p){l.dispatch("select",p);}function a(p){l.dispatch("edit",p);}G(t,{visible:l.shared.visible,elem_id:l.shared.elem_id,elem_classes:l.shared.elem_classes,scale:l.shared.scale,min_width:l.shared.min_width,padding:false,container:false,fullscreen:r,children:p=>{W(p,spread_props([{autoscroll:l.shared.autoscroll,i18n:l.i18n},l.shared.loading_status])),p.push("<!----> "),rs(p,{headers:l.props.value?.headers??[],values:l.props.value?.data??[],display_value:l.props.value?.metadata?.display_value??null,styling:l.props.value?.metadata?.styling??null,col_count:l.props.col_count,row_count:l.props.row_count,label:l.shared.label,show_label:l.shared.show_label,wrap:l.props.wrap,datatype:u,latex_delimiters:l.props.latex_delimiters,max_height:l.props.max_height,editable:l.shared.interactive??true,line_breaks:l.props.line_breaks,column_widths:l.props.column_widths??[],root:l.shared.root,i18n:l.i18n,upload:l.shared.client?.upload,stream_handler:l.shared.client?.stream,buttons:l.props.buttons,max_chars:l.props.max_chars,show_row_numbers:l.props.show_row_numbers,show_search:l.props.show_search,pinned_columns:l.props.pinned_columns,static_columns:l.props.static_columns??[],fullscreen:r,onfullscreen:()=>{r=!r;},onchange:g,oninput:f,onselect:d,onedit:a}),p.push("<!---->");},$$slots:{default:true}});});}

export { rs as BaseDataFrame, Ms as default };
//# sourceMappingURL=Index55-BAtPzDMY.js.map
