simple-table-core 3.0.0-beta.19 → 3.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/src/managers/DimensionManager.d.ts +2 -0
  3. package/dist/cjs/src/managers/SelectionManager/SelectionManager.d.ts +7 -0
  4. package/dist/cjs/src/managers/SelectionManager/mouseUtils.d.ts +2 -1
  5. package/dist/cjs/src/managers/SelectionManager/types.d.ts +2 -0
  6. package/dist/cjs/src/utils/columnEditor/createColumnEditor.d.ts +0 -1
  7. package/dist/cjs/src/utils/columnEditor/createColumnEditorPopout.d.ts +0 -1
  8. package/dist/cjs/src/utils/headerCell/eventTracking.d.ts +3 -0
  9. package/dist/cjs/src/utils/pinnedColumnUtils.d.ts +5 -1
  10. package/dist/cjs/stories/SimpleTable.stories.d.ts +1 -0
  11. package/dist/cjs/stories/tests/07-RowSelectionTests.stories.d.ts +1 -0
  12. package/dist/cjs/stories/tests/10-ColumnPinningTests.stories.d.ts +9 -0
  13. package/dist/cjs/stories/tests/testUtils.d.ts +2 -0
  14. package/dist/cjs/styles.css +1 -1
  15. package/dist/index.es.js +1 -1
  16. package/dist/src/managers/DimensionManager.d.ts +2 -0
  17. package/dist/src/managers/SelectionManager/SelectionManager.d.ts +7 -0
  18. package/dist/src/managers/SelectionManager/mouseUtils.d.ts +2 -1
  19. package/dist/src/managers/SelectionManager/types.d.ts +2 -0
  20. package/dist/src/utils/columnEditor/createColumnEditor.d.ts +0 -1
  21. package/dist/src/utils/columnEditor/createColumnEditorPopout.d.ts +0 -1
  22. package/dist/src/utils/headerCell/eventTracking.d.ts +3 -0
  23. package/dist/src/utils/pinnedColumnUtils.d.ts +5 -1
  24. package/dist/stories/SimpleTable.stories.d.ts +1 -0
  25. package/dist/stories/tests/07-RowSelectionTests.stories.d.ts +1 -0
  26. package/dist/stories/tests/10-ColumnPinningTests.stories.d.ts +9 -0
  27. package/dist/stories/tests/testUtils.d.ts +2 -0
  28. package/dist/styles.css +1 -1
  29. package/package.json +1 -1
  30. package/src/styles/base.css +6 -2
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=150,e=["lineAreaChart","barChart"],n=40,o=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),s="parentExpanded",i=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],o=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let s=e;for(const e of t.children)s=o(e,s);return s};return o(t,e),n},r=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...r(t.children)),e}),l=(t=0)=>t?t+1:0,a=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},d=({accessor:t,rowId:e})=>`${e}-${t}`,c=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,h=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},u=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=h(e);let s=t[n];return null!==o&&Array.isArray(s)&&(s=s[o]),s},t):t[e]},p=(t,e,n)=>{const o=e+"";if(!o.includes(".")&&!o.includes("["))return void(t[e]=n);const s=o.split(".");let i=t;for(let t=0;s.length-1>t;t++){const{key:e,index:n}=h(s[t]);if(null==i[e]){const n=h(s[t+1]);i[e]=null!==n.index?[]:{}}if(i=i[e],null!==n){if(!Array.isArray(i))throw Error(`Expected array at ${s.slice(0,t+1).join(".")}, but found ${typeof i}`);for(;n>=i.length;)i.push(null);null==i[n]&&(i[n]={}),i=i[n]}}const{key:r,index:l}=h(s[s.length-1]);if(null!==l){for(Array.isArray(i[r])||(i[r]=[]);l>=i[r].length;)i[r].push(null);i[r][l]=n}else i[r]=n},f=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],w=t=>{const{getRowId:e,rowPath:n}=t,o=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});o.push(n)}return o},v=t=>t.join("-"),m=(t,e,n,o,s)=>{const i=t+"",r=o.has(i)&&o.get(i)===e,l=s.has(i)&&s.get(i)===e;return n.has(e)?!l:r},g=(t,e)=>{if(t.hide)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||s;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>g(t,e))]:0===n.length?[t]:n.flatMap(t=>g(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||s;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>g(t,e))]:n.flatMap(t=>g(t,e))};function x(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return e.endsWith("px")?{type:"px",value:parseFloat(e)||0}:e.endsWith("fr")?{type:"fr",value:parseFloat(e)||1}:e.endsWith("%")?{type:"pct",value:parseFloat(e)||0}:null}function b(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function y(e,n){const o=e.map(t=>x(t)),s=o.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),i=o.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),r=n*(i/100),l=o.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),a=l>0?Math.max(0,n-s-r)/l:150,d=new Map;return e.forEach((e,s)=>{const i=o[s];if(i)if("px"===i.type)d.set(e.accessor,i.value);else if("fr"===i.type){const t=i.value*a,n="number"==typeof e.minWidth?e.minWidth:"string"==typeof e.minWidth&&parseFloat(e.minWidth+"")||0;d.set(e.accessor,n>0?Math.max(t,n):t)}else d.set(e.accessor,"pct"===i.type?n*i.value/100:t);else d.set(e.accessor,t)}),d}function R(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let o,s="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=b(t);o=y(e,n)}else{const e=b(t),n=e.map(t=>x(t));let i=s;if(null==i||0>=i){const t=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),e=n.filter(t=>"fr"===(null==t?void 0:t.type)).length;i=t+(e>0?150*e:0)+(n.filter(t=>"pct"===(null==t?void 0:t.type)).length>0?160:0),i=Math.max(i,800)}o=y(e,i)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const s=o.get(e.accessor);return null!=s&&(n.width=s),n})}const C=e=>{if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);{const n=document.getElementById(d({accessor:e.accessor,rowId:"header"}));return(null==n?void 0:n.offsetWidth)||t}},S=e=>{var n;const o=e.width;"string"==typeof o&&o.includes("fr")&&(e.width=(null===(n=document.getElementById(d({accessor:e.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth)||t),e.children&&e.children.length>0&&e.children.forEach(t=>{S(t)})},I=t=>"number"==typeof t.minWidth?t.minWidth:n,H=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...g(t,e))}),n},M=(o,s)=>{const{rows:i,header:r,maxWidth:l=500,sampleSize:a=50,styleRoot:c}=s||{},h=null!=c?c:document,p=document.getElementById(d({accessor:o,rowId:"header"}));if(!p)return t;const f=window.getComputedStyle(p),w=parseFloat(f.paddingLeft)||0,v=parseFloat(f.paddingRight)||0,m=parseFloat(f.gap)||0;let g=w+v;const x=p.querySelector(".st-header-label");if(x){const t=x.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const o=e.offsetWidth;document.body.removeChild(e),g+=o}}const b=Array.from(p.children);let y=1;for(let t=0;b.length>t;t++){const e=b[t];if(e.classList.contains("st-header-label"))continue;if(e.classList.contains("st-sr-only"))continue;const n=window.getComputedStyle(e);"none"!==n.display&&(g+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),y++)}m>0&&y>1&&(g+=m*(y-1));let R=0;const C=r&&r.type&&e.includes(r.type);if(i&&i.length>0&&!C){const t=Math.min(i.length,a),e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";let n=0,s=0;const l=h.querySelector(".st-cell-content");if(l){const t=window.getComputedStyle(l);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0}document.body.appendChild(e);for(let l=0;t>l;l++){const t=i[l];let a;a=(null==r?void 0:r.valueGetter)?r.valueGetter({accessor:o,row:t,rowIndex:l}):u(t,o);let d=a;(null==r?void 0:r.valueFormatter)&&null!=a&&(d=r.valueFormatter({accessor:o,colIndex:0,row:t,rowIndex:l,value:a})),e.textContent=null!=d?d+"":"";const c=e.offsetWidth+n+s;c>R&&(R=c)}document.body.removeChild(e)}let S=Math.max(g,R);return C&&(S=Math.max(S,150)),S>l&&(S=l),Math.max(S+2,n)};class k{constructor(t){this.previousValue=t}update(t){const e=this.previousValue;return JSON.stringify(e)!==JSON.stringify(t)&&(this.previousValue=t),e}get(){return this.previousValue}set(t){this.previousValue=t}}const E=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...E(t.children,null!=e?e:t.pinned)):n.push(t))}),n},O=(t,e)=>e>=t.reduce((t,e)=>t+I(e),0),T=(t,e)=>{const n=new Map,o=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===o)return n;const s=e/o;if(s>=1&&.01>s-1)return n;let i=0;return t.forEach((o,r)=>{const l="number"==typeof o.width?o.width:"string"==typeof o.width&&o.width.endsWith("px")?parseFloat(o.width):150;let a;r===t.length-1?a=e-i:(a=Math.round(l*s),i+=a),n.set(o.accessor,a)}),n},A=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:s,pinnedRightWidth:i,isResizing:r}=e;if(!n||0===o||r)return t;const l=Math.max(0,o-s-i),a=t.filter(t=>"left"===t.pinned),d=t.filter(t=>"right"===t.pinned),c=t.filter(t=>!t.pinned),h=E(a,"left"),u=E(d,"right"),p=E(c,void 0),f=h.length>0&&O(h,s),w=u.length>0&&O(u,i),v=p.length>0&&l>0&&O(p,l),m=new Map;if(f&&T(h,s).forEach((t,e)=>m.set(e,t)),w&&T(u,i).forEach((t,e)=>m.set(e,t)),v&&T(p,l).forEach((t,e)=>m.set(e,t)),0===m.size)return t;const g=(t,e)=>{var n;if(t.hide)return t;const o=null!=e?e:t.pinned,s=null===(n=t.children)||void 0===n?void 0:n.map(t=>g(t,o));if(!t.children||0===t.children.length){const e=m.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==e?{width:e,children:s}:{children:s})}return Object.assign(Object.assign({},t),{children:s})};return t.map(t=>g(t,t.pinned))};class W{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new k(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new k(t.containerWidth)}updateConfig(t){var e;this.config=Object.assign(Object.assign({},this.config),t);const n=null!==(e=this.config.isResizing)&&void 0!==e&&e,o=this.config.containerWidth,s=this.isResizingTracker.get();this.isResizingTracker.set(n);const i=this.containerWidthTracker.get();this.containerWidthTracker.set(o),s&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(o-i)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return A(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class P{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),o=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:o},t.containerElement&&this.observeContainer(t.containerElement)}getHeaderDepth(t){var e,n;return t.singleRowChildren&&(null===(e=t.children)||void 0===e?void 0:e.length)?1:(null===(n=t.children)||void 0===n?void 0:n.length)?1+Math.max(...t.children.map(t=>this.getHeaderDepth(t))):1}calculateMaxHeaderDepth(){let t=0;return this.config.effectiveHeaders.forEach(e=>{const n=this.getHeaderDepth(e);t=Math.max(t,n)}),t}calculateHeaderHeight(t){var e;let n=1;if("undefined"!=typeof window){const t=document.documentElement,e=getComputedStyle(t).getPropertyValue("--st-border-width").trim();if(e){const t=parseFloat(e);isNaN(t)||(n=t)}}return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)+n}convertHeightToPixels(t){var e;const n=this.config.containerElement||document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:s,footerHeight:i}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=s||n;if(t>=r+o*n+(i||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=this.convertHeightToPixels(t);return 0!==r?Math.max(0,r-n):void 0}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth;e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.notifySubscribers())}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let o=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),o=!0}if(t.height||t.maxHeight||void 0!==t.totalRowCount){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),o=!0}t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),o=!0),o&&this.notifySubscribers()}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}getState(){return this.state}getContainerWidth(){return this.state.containerWidth}getCalculatedHeaderHeight(){return this.state.calculatedHeaderHeight}getMaxHeaderDepth(){return this.state.maxHeaderDepth}getContentHeight(){return this.state.contentHeight}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class ${constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.config=t,this.state={scrollTop:0,scrollLeft:0,scrollDirection:"none",isScrolling:!1}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}handleScroll(t,e,n,o){const s=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:s,isScrolling:!0},null!==this.scrollTimeoutId&&clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=window.setTimeout(()=>{this.state=Object.assign(Object.assign({},this.state),{isScrolling:!1}),this.notifySubscribers()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.notifySubscribers()}setScrolling(t){this.state=Object.assign(Object.assign({},this.state),{isScrolling:t}),this.notifySubscribers()}getState(){return this.state}getScrollTop(){return this.state.scrollTop}getScrollLeft(){return this.state.scrollLeft}getScrollDirection(){return this.state.scrollDirection}isScrolling(){return this.state.isScrolling}destroy(){null!==this.scrollTimeoutId&&(clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=null),this.subscribers.clear()}}class D{constructor(t={}){this.scrollLeftBySection={"pinned-left":0,main:0,"pinned-right":0},this.panesBySection=new Map([["pinned-left",new Set],["main",new Set],["pinned-right",new Set]]),this.scrollHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var o;const s=this.panesBySection.get(t);if(Array.from(s).find(t=>t.element===e))return;const i=Array.from(s).find(t=>t.role===n);i&&(this.removeScrollListener(i.element),s.delete(i)),s.add({element:e,role:n}),this.addScrollListener(t,e);const r=null!==(o=this.scrollLeftBySection[t])&&void 0!==o?o:0;e.scrollLeft!==r&&(this.isSyncing=!0,e.scrollLeft=r,this.isSyncing=!1)}unregisterPane(t,e){const n=this.panesBySection.get(t);if(!n)return;this.removeScrollListener(e);const o=Array.from(n).find(t=>t.element===e);o&&n.delete(o)}unregisterSection(t){const e=this.panesBySection.get(t);e&&(e.forEach(({element:t})=>this.removeScrollListener(t)),e.clear())}setSectionScrollLeft(t,e){this.scrollLeftBySection[t]=e;const n=this.panesBySection.get(t);n&&(n.forEach(({element:t})=>{t.scrollLeft!==e&&(t.scrollLeft=e)}),"main"===t&&this.config.onMainSectionScrollLeft&&(this.lastMainVirtualizationScrollLeft=e,this.config.onMainSectionScrollLeft(e)))}getSectionScrollLeft(t){var e;return null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0}restoreAll(){["pinned-left","main","pinned-right"].forEach(t=>{var e;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0;this.isSyncing=!0,this.setSectionScrollLeft(t,n),this.isSyncing=!1})}addScrollListener(t,e){this.removeScrollListener(e);const n=()=>{if(this.isSyncing)return;const n=e.scrollLeft;this.scrollLeftBySection[t]=n,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t})=>{t!==e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(n-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=n,this.config.onMainSectionScrollLeft(n)),this.isSyncing=!1};this.scrollHandlers.set(e,n),e.addEventListener("scroll",n,{passive:!0})}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t))}destroy(){["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const F={string:(t,e,n)=>{if(t===e)return 0;const o=t.localeCompare(e);return"asc"===n?o:-o},number:(t,e,n)=>{if(t===e)return 0;const o=t-e;return"asc"===n?o:-o},boolean:(t,e,n)=>{if(t===e)return 0;const o=t===e?0:t?-1:1;return"asc"===n?o:-o},date:(t,e,n)=>{const o=new Date(t),s=new Date(e);if(o.getTime()===s.getTime())return 0;const i=o.getTime()-s.getTime();return"asc"===n?i:-i},enum:(t,e,n)=>F.string(t,e,n),default:(t,e,n)=>t===e?0:null==t?"asc"===n?-1:1:null==e?"asc"===n?1:-1:"string"==typeof t&&"string"==typeof e?F.string(t,e,n):"number"==typeof t&&"number"==typeof e?F.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?F.boolean(t,e,n):F.string(t+"",e+"",n)},L=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const o=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=o(n.children,e);if(t)return t}}},s=o(n,e.key.accessor),i=(null==s?void 0:s.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let o,a;if(null==s?void 0:s.valueGetter){const i=t.indexOf(e),r=t.indexOf(n);o=s.valueGetter({accessor:l,row:e,rowIndex:i}),a=s.valueGetter({accessor:l,row:n,rowIndex:r})}else o=u(e,l),a=u(n,l);return(null==s?void 0:s.comparator)?s.comparator({rowA:e,rowB:n,valueA:o,valueB:a,direction:r}):((t,e,n="string",o)=>{if(null==t||""===t)return"asc"===o?-1:1;if(null==e||""===e)return"asc"===o?1:-1;if("number"===n){const n=t=>{var e;if("number"==typeof t)return t;const n=t+"";if("string"==typeof n){const t=n.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){let n=parseFloat(t[1]);const o=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===o?n*=1e12:"B"===o?n*=1e9:"M"===o?n*=1e6:"K"===o&&(n*=1e3),n}}return parseFloat(n)||0},s=n(t),i=n(e);return F.number(s,i,o)}return"date"===n?F.date(t+"",e+"",o):"boolean"===n?F.boolean(!!t,!!e,o):"enum"===n?F.enum(t+"",e+"",o):F.string(t+"",e+"",o)})(o,a,i,r)})})({rows:e,sortColumn:n,headers:t}),j=t=>{const{rows:e=[],headers:n=[],rowGrouping:o,rowManager:s}=t;if(s)return s.getAggregatedRows();if(!o||0===o.length)return e;const i=(t=>r(t).filter(t=>t.aggregation))(n);if(0===i.length)return e;const l=JSON.parse(JSON.stringify(e)),a=(t,e=0)=>t.map(t=>{const n=o[e],s=o[e+1],r=t[n];if(r&&f(r)){const o=a(r,e+1),l=Object.assign({},t);return l[n]=o,i.forEach(t=>{const e=((t,e,n,o)=>{const s=[],i=t=>{t.forEach(t=>{const n=o?t[o]:void 0;if(o&&n&&f(n))i(n);else{const n=u(t,e);null!=n&&s.push(n)}})};if(i(t),0===s.length)return;if("custom"===n.type&&n.customFn)return n.customFn(s);const r=n.parseValue?s.map(n.parseValue).filter(t=>!isNaN(t)):s.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?s.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=s.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(o,t.accessor,t.aggregation,s);void 0!==e&&p(l,t.accessor,e)}),l}return t});return a(l)};class B{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e=this.getInitialSort(),n=this.computeSortedRows(t.tableRows,e);this.state={sort:e,sortedRows:n}}updateHeaderLookup(){const t=r(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}getInitialSort(){if(!this.config.initialSortColumn)return null;const t=this.headerLookup.get(this.config.initialSortColumn);return t?{key:t,direction:this.config.initialSortDirection||"asc"}:null}sortNestedRows({groupingKeys:t,headers:e,rows:n,sortColumn:o}){const s=L({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?s.map(n=>{const s=t[0],i=n[s];if(f(i)){const r=this.sortNestedRows({rows:i,sortColumn:o,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[s]:r})}return n}):s}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=j({rows:t,headers:this.config.headers,rowGrouping:this.config.rowGrouping});return e?this.config.rowGrouping&&this.config.rowGrouping.length>0?this.sortNestedRows({groupingKeys:this.config.rowGrouping,headers:this.config.headers,rows:n,sortColumn:e}):L({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,o,s;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.config.tableRows}),null===(n=(e=this.config).onSortChange)||void 0===n||n.call(e,null),void this.notifySubscribers();const{accessor:i,direction:r}=t,l=this.headerLookup.get(i);if(!l)return;let a=null;if(r)a={key:l,direction:r};else{const t=l.sortingOrder||["asc","desc",null];let e=-1;this.state.sort&&this.state.sort.key.accessor===i&&(e=t.indexOf(this.state.sort.direction));const n=t[(e+1)%t.length];a=null===n?null:{key:l,direction:n}}const d=this.computeSortedRows(this.config.tableRows,a);this.state={sort:a,sortedRows:d},null===(s=(o=this.config).onSortChange)||void 0===s||s.call(o,a),this.config.announce&&this.config.announce(a?`Sorted by ${l.label}, ${"asc"===a.direction?"ascending":"descending"}`:"Sort removed from "+l.label),this.notifySubscribers()}computeSortedRowsPreview(t){const e=n=>{for(const o of n){if(o.accessor===t)return o;if(o.children&&o.children.length>0){const t=e(o.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let o=null;const s=n.sortingOrder||["asc","desc",null];let i=-1;this.state.sort&&this.state.sort.key.accessor===t&&(i=s.indexOf(this.state.sort.direction));const r=s[(i+1)%s.length];return o=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,o)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const N=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,o]=t.split("-").map(Number);return new Date(e,n-1,o,12,0,0)}const e=new Date(t);return isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0)},z=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),V=t=>{if(!t)return new Date;if("string"==typeof t)return N(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:z(e)}return t instanceof Date?z(t):new Date};class q{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e={},n=this.computeFilteredRows(t.rows,e);this.state={filters:e,filteredRows:n}}updateHeaderLookup(){const t=r(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}computeFilteredRows(t,e){return this.config.externalFilterHandling?t:e&&0!==Object.keys(e).length?t.filter(t=>Object.values(e).every(e=>{try{return((t,e)=>{const{operator:n,value:o,values:s}=e;if(null==t)return"isEmpty"===n;if("isEmpty"===n)return!t||""===(t+"").trim();if("isNotEmpty"===n)return t&&""!==(t+"").trim();if("string"==typeof t||"contains"===n||"notContains"===n||"startsWith"===n||"endsWith"===n){const e=(t+"").toLowerCase(),s=o?(o+"").toLowerCase():"";switch(n){case"equals":return e===s;case"notEquals":return e!==s;case"contains":return e.includes(s);case"notContains":return!e.includes(s);case"startsWith":return e.startsWith(s);case"endsWith":return e.endsWith(s)}}if("number"==typeof t||!isNaN(+t)){const e=+t,i=+o;switch(n){case"equals":return e===i;case"notEquals":return e!==i;case"greaterThan":return e>i;case"lessThan":return i>e;case"greaterThanOrEqual":return e>=i;case"lessThanOrEqual":return i>=e;case"between":if(s&&2===s.length){const[t,n]=s.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(s&&2===s.length){const[t,n]=s.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=V(t),i=V((o||"")+""),r=z(e),l=z(i);switch(n){case"equals":return r.getTime()===l.getTime();case"notEquals":return r.getTime()!==l.getTime();case"before":return l>r;case"after":return r>l;case"between":if(s&&2===s.length){const[t,e]=s.map(t=>z(V((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(s&&2===s.length){const[t,e]=s.map(t=>z(V((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!o;if(Array.isArray(t)){const e=t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", ");t=e}if("in"===n||"notIn"===n){if(s&&Array.isArray(s)){const e=s.includes(t+"");return"in"===n?e:!e}return!1}const i=(t+"").toLowerCase(),r=o?(o+"").toLowerCase():"";switch(n){case"equals":return i===r;case"notEquals":return i!==r;default:return!0}})(u(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const o=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),s=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:s},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t.accessor);e&&this.config.announce("Filter applied to "+e.label)}this.notifySubscribers()}clearFilter(t){var e,n;const o=Object.assign({},this.state.filters);delete o[t];const s=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:s},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t);e&&this.config.announce("Filter removed from "+e.label)}this.notifySubscribers()}clearAllFilters(){var t,e;this.state={filters:{},filteredRows:this.config.rows},null===(e=(t=this.config).onFilterChange)||void 0===e||e.call(t,{}),this.config.announce&&this.config.announce("All filters cleared"),this.notifySubscribers()}computeFilteredRowsPreview(t){const e=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t});return this.computeFilteredRows(this.config.rows,e)}getState(){return this.state}getFilters(){return this.state.filters}getFilteredRows(){return this.state.filteredRows}destroy(){this.subscribers.clear()}}const G=(t,e)=>{const{rowTopPositions:n}=e;if(0===n.length)return 0;if(0>=t)return 0;if(t>=e.totalHeight)return n.length-1;let o=0,s=n.length-1;for(;s>o;){const e=Math.floor((o+s+1)/2);n[e]>t?s=e-1:o=e}return o},U=(t,e)=>{if(!e||0===e.length)return 0;let n=0,o=0,s=e.length;for(;s>o;){const n=Math.floor((o+s)/2);t>e[n][0]?o=n+1:s=n}for(let t=0;o>t;t++)n+=e[t][1];return n},K=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:o,tableRows:s,scrollDirection:i="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===i?(r=Math.max(l,.1*n),a=.9*n):"up"===i&&(r=.9*n,a=Math.max(l,.1*n));const d=o+e+a,c=Math.max(0,Math.floor(Math.max(0,o-r)/l)),h=Math.min(s.length,Math.ceil(d/l)),u=o+e,p=Math.max(0,Math.ceil(o/l)),f=Math.min(s.length,Math.floor(u/l)),w=o+e,v=Math.max(0,Math.floor(o/l)),m=Math.min(s.length,Math.ceil(w/l));return{rendered:{startIndex:c,endIndex:h,rows:s.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:s.slice(p,f)},partiallyVisible:{startIndex:v,endIndex:m,rows:s.slice(v,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,h=d;"down"===i?(c=Math.max(l,.1*d),h=.9*d):"up"===i&&(c=.9*d,h=Math.max(l,.1*d));const u=o+e+h,p=G(Math.max(0,o-c),r);let f=G(u,r)+1;f=Math.min(s.length,f);const w=o,v=o+e;let m=G(w,r);w>a[m]&&(m=Math.min(m+1,s.length));let g=G(v,r);g=Math.min(s.length,g);const x=o+e,b=G(o,r);let y=G(x,r)+1;return y=Math.min(s.length,y),{rendered:{startIndex:p,endIndex:f,rows:s.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:s.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:s.slice(b,y)}}},J=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+U(t,n),Y=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+U(t,n),_=(t,e)=>{var n,o;const s=t.position,i=e[s+1];return null!==(o=null===(n=null==i?void 0:i.parentIndices)||void 0===n?void 0:n.includes(s))&&void 0!==o&&o},X=new Map,Q=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i,stickyParents:r,rowGrouping:l})=>{let a=o[s];if(!a||i>10)return{stickyParents:r,regularRows:e};let d=0;if(a.parentIndices&&a.parentIndices.length>0){for(const e of a.parentIndices){const o=t[e];if(o){const e=n.some(t=>t.position===o.position);if(a.rowIndexPath&&a.rowIndexPath.length>0){const e=t[a.parentIndices[a.parentIndices.length-1]],n=e.row[l[e.depth]];if(r.length>=(Array.isArray(n)?n:[]).length-a.rowIndexPath[a.rowIndexPath.length-1])break}e||r.some(t=>v(t.rowId)===v(o.rowId))||(r.push(o),d++)}}if(r.length>0){_(a,t)&&(r.push(a),d++);const e=o[s+=d];e&&(a=e)}}else if(_(a,t))return r.push(a),s++,Q({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i+1,stickyParents:r,rowGrouping:l});return _(a,t)?Q({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Z=(t,e,n)=>{const o=t.getBoundingClientRect(),s=e.getBoundingClientRect(),i=10;if(s.top+i>o.top?e.scrollTop-=s.top-o.top+i:o.bottom>s.bottom-i&&(e.scrollTop+=o.bottom-s.bottom+i),n){const t=n.getBoundingClientRect();t.left+i>o.left?n.scrollLeft-=t.left-o.left+i:o.right>t.right-i&&(n.scrollLeft+=o.right-t.right+i)}},tt=(t,e,n,o)=>{const s=document.querySelector(".st-body-container"),i=document.querySelector(".st-body-main");if(!s)return;const r=o?o.findIndex(e=>v(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=s.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&o){const t=((t,e,n,o)=>{const s=K({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:o,scrollDirection:"none"}),{startIndex:i,endIndex:r}=s.fullyVisible;return t>=i&&r>t})(l,s,e,o);if(t)return void Z(d,s,i)}if(!d)return s.scrollTop=Math.max(0,l*a-s.clientHeight/3),void setTimeout(()=>{const e=s.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&Z(e,s,i)},100);Z(d,s,i)},et=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function nt(t,e,n,o){const s=new Set,i=new Map;n.forEach((t,e)=>{const n=v(t.rowId);i.set(n,e)});const r=i.get(t.rowId+""),l=i.get(e.rowId+""),a=void 0!==r?r:t.rowIndex,d=void 0!==l?l:e.rowIndex,c=Math.min(a,d),h=Math.max(a,d),u=Math.min(t.colIndex,e.colIndex),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const i=v(n[t].rowId);s.add(et({colIndex:e,rowIndex:t,rowId:i}))}return s}function ot(t,e){var n,o,s;const i=document.querySelector(".st-body-container");if(!i)return null;const r=i.getBoundingClientRect(),l=Math.max(r.left,Math.min(r.right,t)),a=Math.max(r.top,Math.min(r.bottom,e)),d=document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===d.length)return null;const c=new Map;for(let t=0;d.length>t;t++){const e=d[t],o=e.getAttribute("data-row-id"),s=null!==(n=null!=o?o:e.getAttribute("data-row-index"))&&void 0!==n?n:"";if(!s)continue;let i=c.get(s);i||(i=[],c.set(s,i)),i.push(e)}const h=[];c.forEach((t,e)=>{const n=t[0].getBoundingClientRect();h.push({key:e,top:n.top,bottom:n.bottom})}),h.sort((t,e)=>t.top-e.top);let u=null,p=1/0;for(let t=0;h.length>t;t++){const{key:e,top:n,bottom:o}=h[t];if(a>=n&&o>=a){u=e,p=0;break}const s=Math.abs(a-(n+o)/2);p>s&&(p=s,u=e)}if(null===u)return null;const f=c.get(u);if(!f||0===f.length)return null;let w=null,v=1/0;for(let t=0;f.length>t;t++){const e=f[t],n=parseInt(null!==(o=e.getAttribute("data-row-index"))&&void 0!==o?o:"-1",10),i=parseInt(null!==(s=e.getAttribute("data-col-index"))&&void 0!==s?s:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>i||null==r||""===r)continue;const d=e.getBoundingClientRect(),c=Math.sqrt((d.left+d.width/2-l)**2+(d.top+d.height/2-a)**2);v>c&&(v=c,w=e)}if(null!==w){const t=parseInt(w.getAttribute("data-row-index")||"-1",10),e=parseInt(w.getAttribute("data-col-index")||"-1",10),n=w.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class st{constructor(t){this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.initialFocusedCell=null,this.copyFlashCells=new Set,this.warningFlashCells=new Set,this.isSelecting=!1,this.startCell=null,this.keydownHandler=null,this.currentMouseX=null,this.currentMouseY=null,this.scrollAnimationFrame=null,this.lastSelectionUpdate=0,this.selectionThrottleMs=16,this.globalMouseMoveHandler=null,this.globalMouseUpHandler=null,this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.leafHeaders=[],this.rowIdToTableIndex=new Map,this.selectedByRowIdColIndex=new Set,this.fullTableSelected=!1,this.config=t,this.updateDerivedState(),this.setupKeyboardNavigation()}updateConfig(t,e){this.config=Object.assign(Object.assign({},this.config),t),(null==e?void 0:e.positionOnlyBody)?this.updateRowIdAndSelectionLookupOnly():this.updateDerivedState()}updateDerivedState(){if(this.leafHeaders=this.config.headers.flatMap(t=>g(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(v(t.rowId),e)}),this.fullTableSelected){this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set;const t=this.leafHeaders.length,e=this.config.enableRowSelection?1:0;for(let n=0;t>n;n++)this.columnsWithSelectedCells.add(n+e);return this.rowsWithSelectedCells=new Set,void this.config.tableRows.forEach(t=>{this.rowsWithSelectedCells.add(v(t.rowId))})}this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||(this.selectedByRowIdColIndex.add(`${n}\t${t}`),this.columnsWithSelectedCells.add(t),this.rowsWithSelectedCells.add(n))}}),this.selectedColumns.forEach(t=>{this.columnsWithSelectedCells.add(t),this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${v(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(v(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(v(t.rowId),e)}),this.fullTableSelected||(this.selectedByRowIdColIndex.clear(),this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||this.selectedByRowIdColIndex.add(`${n}\t${t}`)}}),this.selectedColumns.forEach(t=>{this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${v(e.rowId)}\t${t}`)})}))}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleKeyDown(t){if(!this.config.selectableCells)return;if(!this.initialFocusedCell)return;const e=document.activeElement;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||"true"===(null==e?void 0:e.getAttribute("contenteditable")))){if((t.ctrlKey||t.metaKey)&&"a"===t.key)return t.preventDefault(),void this.selectAll();if(0!==this.selectedCells.size||this.fullTableSelected){if(!t.ctrlKey&&!t.metaKey||"c"!==t.key)return(t.ctrlKey||t.metaKey)&&"v"===t.key?(t.preventDefault(),void this.pasteFromClipboard()):"Delete"===t.key||"Backspace"===t.key?(t.preventDefault(),void this.deleteSelectedCells()):void("Escape"!==t.key?this.handleNavigationKeys(t):this.clearSelection());this.copyToClipboard()}}}handleNavigationKeys(t){if(!this.initialFocusedCell)return;let{rowIndex:e,colIndex:n,rowId:o}=this.initialFocusedCell;const s=this.config.tableRows[e];if((s?v(s.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>v(t.rowId)===o);if(-1===t)return;e=t}"ArrowUp"===t.key?(t.preventDefault(),this.handleArrowUp(t,e,n)):"ArrowDown"===t.key?(t.preventDefault(),this.handleArrowDown(t,e,n)):"ArrowLeft"===t.key||"Tab"===t.key&&t.shiftKey?(t.preventDefault(),this.handleArrowLeft(t,e,n)):"ArrowRight"===t.key||"Tab"===t.key?(t.preventDefault(),this.handleArrowRight(t,e,n)):"Home"===t.key?(t.preventDefault(),this.handleHome(t,e,n)):"End"===t.key?(t.preventDefault(),this.handleEnd(t,e,n)):"PageUp"===t.key?(t.preventDefault(),this.handlePageUp(t,e,n)):"PageDown"===t.key&&(t.preventDefault(),this.handlePageDown(t,e,n))}findEdgeInDirection(t,e,n){return function(t,e,n,o,s,i){let r=o,l=s;return"up"===i?r=0:"down"===i?r=t-1:"left"===i?l=n?1:0:"right"===i&&(l=n?e:e-1),{rowIndex:r,colIndex:l}}(this.config.tableRows.length,this.leafHeaders.length,!!this.config.enableRowSelection,t,e,n)}handleArrowUp(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e-1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex),o>=0){const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(e>0){let o=e-1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex);const s=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:s}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>o){const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let o=e+1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex);const s=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:s}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n-1;if(t.ctrlKey||t.metaKey)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=v(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(n>0){let o=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=v(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let s=n+1;if((t.ctrlKey||t.metaKey)&&(s=this.findEdgeInDirection(e,n,"right").colIndex),o>=s){const t=v(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:s,rowId:t})}}else if(o>n){let s=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(s=this.findEdgeInDirection(e,n,"right").colIndex),o>=s){const t=v(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:s,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const s=v(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:s})}else{let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const s=v(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:s}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const s=v(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:s})}else{let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const s=v(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:s}),this.startCell=null}}handlePageUp(t,e,n){let o=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let o=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}copyToClipboard(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const e=((t,e,n,o=!1)=>{const s=this.leafHeaders.filter(t=>!t.hide&&!t.excludeFromRender),i=new Map,r=new Map;s.forEach((t,e)=>{i.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var o;const[s,l]=e.split("-").map(Number);t[s]||(t[s]=[]);const a=i.get(l),d=r.get(l);if(a&&(null===(o=n[s])||void 0===o?void 0:o.row)){const e=n[s].row,o=u(e,a);if(!1!==(null==d?void 0:d.useFormattedValueForClipboard)&&(null==d?void 0:d.valueFormatter)){const n=d.valueFormatter({accessor:a,colIndex:l,row:e,rowIndex:s,value:o});t[s][l]=n}else t[s][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?o:Array.isArray(o)?o.join(", "):""}else t[s][l]="";return t},{}),a=new Set;o&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);a.add(e)});let d="";o&&a.size>0&&(d=Array.from(a).sort((t,e)=>t-e).map(t=>{var e;const n=r.get(t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:""}).join("\t"));const c=Object.values(l).map(t=>Object.values(t).join("\t")).join("\n");return o&&d?`${d}\n${c}`:c})(t,0,this.config.tableRows,this.config.copyHeadersToClipboard);navigator.clipboard.writeText(e),this.copyFlashCells=new Set(t),this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)}async pasteFromClipboard(){if(this.initialFocusedCell)try{const t=await navigator.clipboard.readText();if(!t)return;const{updatedCells:e,warningCells:n}=((t,e,n,o,s,i)=>{const r=new Set,l=new Set,a=t.split("\n").filter(t=>t.length>0);if(0===a.length)return{updatedCells:r,warningCells:l};const d=n.filter(t=>!t.hide&&!t.excludeFromRender),c=o.findIndex(t=>v(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{const a=h+e,c=u+n;if(a>=o.length||c>=d.length)return;const f=o[a],w=d[c],m=v(f.rowId);if(!(null==w?void 0:w.isEditable))return void l.add(`${a}-${c}-${m}`);let g=t;if("number"===w.type){const e=+t;isNaN(e)||(g=e)}else if("boolean"===w.type)g="true"===t.toLowerCase()||"1"===t;else if("date"===w.type){const e=new Date(t);isNaN(e.getTime())||(g=e)}else"lineAreaChart"!==w.type&&"barChart"!==w.type||(g=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(p(f.row,w.accessor,g),i){const t=i.get(`${m}-${w.accessor}`);t&&t.updateContent(g)}null==s||s({accessor:w.accessor,newValue:g,row:f.row,rowIndex:a}),r.add(`${a}-${c}-${m}`)})}),{updatedCells:r,warningCells:l}})(t,this.initialFocusedCell,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}catch(t){console.warn("Failed to paste from clipboard:",t)}}deleteSelectedCells(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const{deletedCells:e,warningCells:n}=((t,e,n,o,s)=>{const i=new Set,r=new Set,l=e.filter(t=>!t.hide&&!t.excludeFromRender),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{const[e,a]=t.split("-").map(Number);if(e>=n.length||a>=l.length)return;const d=n[e],c=l[a],h=v(d.rowId);if(!(null==c?void 0:c.isEditable))return void r.add(t);let f=null;if(f="string"===c.type?"":"number"===c.type?null:"boolean"!==c.type&&("date"===c.type?null:"lineAreaChart"===c.type||"barChart"===c.type||Array.isArray(u(d.row,c.accessor))?[]:""),p(d.row,c.accessor,f),s){const t=s.get(`${h}-${c.accessor}`);t&&t.updateContent(f)}null==o||o({accessor:c.accessor,newValue:f,row:d.row,rowIndex:e}),i.add(t)}),{deletedCells:i,warningCells:r}})(t,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}selectAll(){this.fullTableSelected=!0,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.updateDerivedState(),this.updateAllCellClasses()}buildFullTableSelectedSet(){const t=new Set;for(let e=0;this.config.tableRows.length>e;e++)for(let n=0;this.leafHeaders.length>n;n++){const o=this.config.enableRowSelection?n+1:n,s=v(this.config.tableRows[e].rowId);t.add(`${e}-${o}-${s}`)}return t}clearSelection(){this.fullTableSelected=!1,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.startCell=null,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedCells(t){this.fullTableSelected=!1,this.selectedCells=t,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedColumns(t){this.fullTableSelected=!1,this.selectedColumns=t,this.updateDerivedState(),this.updateAllCellClasses()}updateCellFlashClasses(){requestAnimationFrame(()=>{document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=parseInt(t.getAttribute("data-row-index")||"-1",10),n=parseInt(t.getAttribute("data-col-index")||"-1",10),o=t.getAttribute("data-row-id");if(0>e||0>n||!o)return;const s=et({rowIndex:e,colIndex:n,rowId:o}),i=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:o});this.copyFlashCells.has(s)?t.classList.add(i?"st-cell-copy-flash-first":"st-cell-copy-flash"):t.classList.remove("st-cell-copy-flash-first","st-cell-copy-flash"),this.warningFlashCells.has(s)?t.classList.add(i?"st-cell-warning-flash-first":"st-cell-warning-flash"):t.classList.remove("st-cell-warning-flash-first","st-cell-warning-flash")})})}syncAllCellClasses(){var t;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]");if(this.fullTableSelected||0!==this.selectedCells.size||0!==this.selectedColumns.size)for(let t=0;e.length>t;t++){const n=e[t];if(!(n instanceof HTMLElement))continue;const o=parseInt(n.getAttribute("data-row-index")||"-1",10),s=parseInt(n.getAttribute("data-col-index")||"-1",10),i=n.getAttribute("data-row-id");if(0>o||0>s||!i)continue;const r={rowIndex:o,colIndex:s,rowId:i},l=this.isSelected(r),a=this.selectedColumns.has(s),d=l&&!a,c=this.isInitialFocusedCell(r),h=this.getBorderClass(r),u=new Set;d&&(u.add(c?"st-cell-selected-first":"st-cell-selected"),h.split(" ").filter(Boolean).forEach(t=>u.add(t))),a&&u.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of st.SELECTION_CLASSES){const e=u.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus()}}else for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of st.SELECTION_CLASSES)n.classList.contains(t)&&n.classList.remove(t);"-1"!==n.getAttribute("tabindex")&&n.setAttribute("tabindex","-1")}}}updateAllCellClasses(){this.isSelecting||this.fullTableSelected?this.syncAllCellClasses():requestAnimationFrame(()=>this.syncAllCellClasses())}isSelected({colIndex:t,rowIndex:e,rowId:n}){if(this.fullTableSelected)return!0;const o=n+"";if(this.selectedByRowIdColIndex.has(`${o}\t${t}`))return!0;const s=this.rowIdToTableIndex.get(o);if(void 0!==s){const e=et({rowIndex:s,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const i=et({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(i)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var o;if(this.isSelecting)return"";const s=null!==(o=this.rowIdToTableIndex.get(n+""))&&void 0!==o?o:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,o=[];return 0===s&&o.push("st-selected-top-border"),s===this.config.tableRows.length-1&&o.push("st-selected-bottom-border"),t===e&&o.push("st-selected-left-border"),t===n&&o.push("st-selected-right-border"),o.join(" ")}const i=[],r=this.config.tableRows[s-1],l=r?v(r.rowId):null,a=this.config.tableRows[s+1],d=a?v(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:s-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:s+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:s,rowId:n}),p=this.isSelected({colIndex:t+1,rowIndex:s,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===s)&&i.push("st-selected-top-border"),(!d||!h||this.selectedColumns.has(t)&&s===this.config.tableRows.length-1)&&i.push("st-selected-bottom-border"),u||i.push("st-selected-left-border"),p||i.push("st-selected-right-border"),i.join(" ")}isInitialFocusedCell({colIndex:t,rowId:e}){return!!this.initialFocusedCell&&t===this.initialFocusedCell.colIndex&&e+""==this.initialFocusedCell.rowId+""}isCopyFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=et({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=et({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(o)}getColumnsWithSelectedCells(){return this.columnsWithSelectedCells}getRowsWithSelectedCells(){return this.rowsWithSelectedCells}getSelectedCells(){return this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells}getSelectedColumns(){return this.selectedColumns}getLastSelectedColumnIndex(){return this.lastSelectedColumnIndex}getStartCell(){return this.startCell}setInitialFocusedCell(t){this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses()}selectSingleCell(t){if(t.rowIndex>=0&&this.config.tableRows.length>t.rowIndex&&t.colIndex>=0&&(this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1)>=t.colIndex){this.fullTableSelected=!1;const e=et(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>tt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=nt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>tt(e,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}selectColumns(t,e=!1){this.fullTableSelected=!1,this.selectedCells=new Set,this.initialFocusedCell=null;const n=new Set(e?this.selectedColumns:[]);t.forEach(t=>n.add(t)),this.selectedColumns=n,t.length>0&&(this.lastSelectedColumnIndex=t[t.length-1]),this.updateDerivedState(),this.updateAllCellClasses()}updateSelectionRange(t,e){this.fullTableSelected=!1;const n=nt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}calculateNearestCell(t,e){return ot(t,e)}getCellFromMousePosition(t,e){return function(t,e){const n=document.elementFromPoint(t,e);if(!n)return null;const o=n.closest(".st-cell");if(o instanceof HTMLElement){const t=parseInt(o.getAttribute("data-row-index")||"-1",10),e=parseInt(o.getAttribute("data-col-index")||"-1",10),n=o.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return ot(t,e)}(t,e)}handleAutoScroll(t,e){!function(t,e){const n=document.querySelector(".st-body-container");if(!n)return;const o=n.getBoundingClientRect();o.top+50>e?n.scrollTop-=10*Math.min(3,1+Math.max(0,o.top-e)/100):e>o.bottom-50&&(n.scrollTop+=10*Math.min(3,1+Math.max(0,e-o.bottom)/100));const s=document.querySelector(".st-body-main");s&&(o.left+50>t?s.scrollLeft-=10*Math.min(3,1+Math.max(0,o.left-t)/100):t>o.right-50&&(s.scrollLeft+=10*Math.min(3,1+Math.max(0,t-o.right)/100)))}(t,e)}continuousScroll(){if(this.isSelecting&&this.startCell){if(null!==this.currentMouseX&&null!==this.currentMouseY){this.handleAutoScroll(this.currentMouseX,this.currentMouseY);const t=Date.now();if(t-this.lastSelectionUpdate>=this.selectionThrottleMs){const e=this.getCellFromMousePosition(this.currentMouseX,this.currentMouseY);e&&(this.updateSelectionRange(this.startCell,e),this.lastSelectionUpdate=t)}}this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll())}else null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleMouseDown({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const o=et({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n},this.updateDerivedState(),this.updateAllCellClasses()},0),this.currentMouseX=null,this.currentMouseY=null,this.lastSelectionUpdate=0,this.globalMouseMoveHandler=t=>{this.isSelecting&&this.startCell&&(this.currentMouseX=t.clientX,this.currentMouseY=t.clientY)},this.globalMouseUpHandler=()=>{var t,e;this.isSelecting=!1,null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null===(e=(t=this.config).onSelectionDragEnd)||void 0===e||e.call(t),this.syncAllCellClasses(),requestAnimationFrame(()=>this.syncAllCellClasses())},document.addEventListener("mousemove",this.globalMouseMoveHandler),document.addEventListener("mouseup",this.globalMouseUpHandler),this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll()))}handleMouseOver({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&this.isSelecting&&this.startCell&&this.updateSelectionRange(this.startCell,{colIndex:t,rowIndex:e,rowId:n})}}st.SELECTION_CLASSES=["st-cell-selected","st-cell-selected-first","st-cell-column-selected","st-cell-column-selected-first","st-selected-top-border","st-selected-bottom-border","st-selected-left-border","st-selected-right-border"];const it=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(v(t.rowId))).map(t=>t.row);class rt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:it(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(v(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const o=this.config.tableRows.find(e=>v(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>v(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>v(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>v(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class lt{constructor(){this.callbacks=new Set,this.isListening=!1,this.handleResize=()=>{this.callbacks.forEach(t=>t())}}addCallback(t){return this.callbacks.add(t),this.isListening||this.startListening(),()=>{this.callbacks.delete(t),0===this.callbacks.size&&this.stopListening()}}startListening(){this.isListening||(window.addEventListener("resize",this.handleResize),this.isListening=!0)}stopListening(){this.isListening&&(window.removeEventListener("resize",this.handleResize),this.isListening=!1)}destroy(){this.stopListening(),this.callbacks.clear()}}class at{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,o,s,i,r;const l=t.target;if(!l.closest(".editable-cell-input")||!l.closest(".st-header-cell")){if(this.config.activeHeaderDropdown&&this.config.setActiveHeaderDropdown){const t=l.closest(".st-dropdown-content")||l.closest(".dropdown-content");l.closest(".st-header-cell")||t||this.config.setActiveHeaderDropdown(null)}if(!(l.closest(".st-cell")||this.config.selectableColumns&&(l.classList.contains("st-header-cell")||l.classList.contains("st-header-label")||l.classList.contains("st-header-label-text")))){const t=null!==(o=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==o?o:this.config.selectedCells,l=null!==(r=null===(i=(s=this.config).getSelectedColumns)||void 0===i?void 0:i.call(s))&&void 0!==r?r:this.config.selectedColumns;(t.size>0||l.size>0)&&(this.config.onClearSelection?this.config.onClearSelection():(this.config.setSelectedCells(new Set),this.config.setSelectedColumns(new Set),this.config.startCell&&(this.config.startCell.current=null)))}}},this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}startListening(){this.isListening||(document.addEventListener("mousedown",this.handleClickOutside),this.isListening=!0)}stopListening(){this.isListening&&(document.removeEventListener("mousedown",this.handleClickOutside),this.isListening=!1)}destroy(){this.stopListening()}}class dt{constructor(t){this.isMainSectionScrollable=!1,this.headerContainer=null,this.mainSection=null,this.scrollbarWidth=0,this.resizeObserver=null,this.observers=new Set,this.rafId=null,this.headerContainer=t.headerContainer||null,this.mainSection=t.mainSection||null,this.scrollbarWidth=t.scrollbarWidth,this.mainSection&&this.headerContainer&&this.initialize()}initialize(){this.mainSection&&this.headerContainer&&(this.checkScrollability(),this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.checkScrollability()})}),this.resizeObserver.observe(this.mainSection))}checkScrollability(){if(this.mainSection){const t=this.mainSection.scrollHeight>this.mainSection.clientHeight;t!==this.isMainSectionScrollable&&(this.isMainSectionScrollable=t,this.updateHeaderPadding(),this.notifyObservers())}}updateHeaderPadding(){this.headerContainer&&(this.isMainSectionScrollable?(this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",this.scrollbarWidth+"px")):this.headerContainer.classList.remove("st-header-scroll-padding"))}setScrollbarWidth(t){this.scrollbarWidth=t,this.updateHeaderPadding()}setHeaderContainer(t){this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.headerContainer=t,this.updateHeaderPadding()}setMainSection(t){this.resizeObserver&&this.mainSection&&this.resizeObserver.unobserve(this.mainSection),this.mainSection=t,this.mainSection&&this.headerContainer&&this.initialize()}getIsMainSectionScrollable(){return this.isMainSectionScrollable}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.isMainSectionScrollable))}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&this.mainSection&&(this.resizeObserver.unobserve(this.mainSection),this.resizeObserver=null),this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.observers.clear()}}const ct=(t,e)=>{if(!e||0===e.length)return new Set;if(t){const t=Array.from({length:e.length},(t,e)=>e);return new Set(t)}return new Set};class ht{constructor(t,e){this.observers=new Set,this.expandedDepths=ct(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class ut{constructor(){this.announcement="",this.timeoutId=null,this.observers=new Set}announce(t){this.announcement=t,this.notifyObservers(),this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.announcement="",this.notifyObservers()},1e3)}getAnnouncement(){return this.announcement}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.announcement))}destroy(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.observers.clear(),this.announcement=""}}function pt(t){return t?t.offsetWidth-t.clientWidth:0}const ft=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(ft);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=ft(t[n]));return e},wt=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),vt={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},mt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},gt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},xt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},bt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},yt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t),o.setAttribute("cy",n),o.setAttribute("r","1.5"),o.setAttribute("fill","currentColor"),e.appendChild(o)}),e},Rt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e};function Ct(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function St(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function It(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=St(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Ht(t,e){var n;const{pinnedLeft:o,unpinned:s,pinnedRight:i}=Ct(t);if(!It(o,e))return!1;if(!It(s,e))return!1;if(!It(i,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Mt(o.children,e))return!1;return!0}function Mt(t,e){var n;if(!It(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Mt(o.children,e))return!1;return!0}function kt(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=Ct(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function Et(t,e,n){return[...t.filter(t=>St(e.get(t+""),n)),...t.filter(t=>!St(e.get(t+""),n))]}function Ot(t,e,n){const o=new Set(t.map(t=>t.accessor+"")),s=[...e.left,...e.main,...e.right];if(s.length!==o.size)return null;for(const t of s)if(!o.has(t+""))return null;const i=new Map(t.map(t=>[t.accessor+"",t])),r=Et(e.left,i,n),l=Et(e.main,i,n),a=Et(e.right,i,n),d=(t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n};return[...r.map(t=>d(i.get(t+""),"left")),...l.map(t=>d(i.get(t+""),void 0)),...a.map(t=>d(i.get(t+""),"right"))]}function Tt(t,e,n,o){const s=e+"",i=kt(t),r=i.left.filter(t=>t+""!==s),l=i.main.filter(t=>t+""!==s),a=i.right.filter(t=>t+""!==s),d=t.find(t=>t.accessor+""===s);return d&&(!St(d,o)||"main"!==n||"left"!==d.pinned&&"right"!==d.pinned)?("left"===n?r.push(e):"right"===n?a.push(e):l.push(e),Ot(t,{left:r,main:l,right:a},o)):null}class At{static resolveIcons(t){var e,n,o,s,i,r,l,a,d,c,h,u,p,f,w,v,m,g;const x={drag:yt("st-drag-icon"),expand:gt("st-expand-icon"),filter:Rt("st-header-icon"),headerCollapse:gt("st-header-icon"),headerExpand:mt("st-header-icon"),next:gt("st-next-prev-icon"),prev:mt("st-next-prev-icon"),sortDown:bt("st-header-icon"),sortUp:xt("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:x.drag,expand:null!==(s=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==s?s:x.expand,filter:null!==(r=null===(i=t.icons)||void 0===i?void 0:i.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(v=null===(w=t.icons)||void 0===w?void 0:w.sortDown)&&void 0!==v?v:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.sortUp}}static mergeCustomTheme(t){return Object.assign(Object.assign({},vt),t.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,s,i,r,l,a,d,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(s=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.searchEnabled)||void 0===s||s,searchPlaceholder:null!==(r=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const s of t)s.isEssential&&e.add(s.accessor+""),(null===(o=s.children)||void 0===o?void 0:o.length)&&n(s.children)};return n(t),e}(t)}static getInitialCollapsedHeaders(t){const e=new Set,n=t=>{t.forEach(t=>{t.collapseDefault&&t.collapsible&&e.add(t.accessor),t.children&&n(t.children)})};return n(t),e}static getInitialExpandedDepths(t){var e;return ct(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Wt{constructor(){this.elements=null,this.refs={mainBodyRef:{current:null},pinnedLeftRef:{current:null},pinnedRightRef:{current:null},mainHeaderRef:{current:null},pinnedLeftHeaderRef:{current:null},pinnedRightHeaderRef:{current:null},headerContainerRef:{current:null},tableBodyContainerRef:{current:null},horizontalScrollbarRef:{current:null}}}createDOMStructure(t,e){var n,o,s;const i=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(o=e.className)&&void 0!==o?o:"",l=null!==(s=e.columnBorders)&&void 0!==s&&s,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${i} ${r} ${l?"st-column-borders":""}`,a.setAttribute("role","grid");const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),d.appendChild(c),d.appendChild(f),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}getElements(){return this.elements}getRefs(){return this.refs}destroy(t){var e;(null===(e=this.elements)||void 0===e?void 0:e.rootElement)&&t.contains(this.elements.rootElement)&&t.removeChild(this.elements.rootElement),this.elements=null}}const Pt=new WeakMap;let $t=0,Dt=Date.now(),Ft={screenX:0,screenY:0},Lt=null;const jt=t=>{Dt=t},Bt=new WeakMap,Nt=t=>(Bt.has(t)||Bt.set(t,new Map),Bt.get(t)),zt=new WeakMap,Vt=t=>(zt.has(t)||zt.set(t,new Map),zt.get(t)),qt=(t,e)=>{const n=Date.now();0!==$t&&e>n-$t||($t=n,t())},Gt=(t,e,n,o)=>{t.addEventListener(e,n,o),Pt.has(t)||Pt.set(t,[]),Pt.get(t).push({event:e,handler:n,options:o})},Ut=t=>{if($t=0,t){const e=Nt(t);e.forEach(t=>{t.remove()}),e.clear(),Vt(t).clear()}},Kt={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Does not contain",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",notBetween:"Not between",before:"Before",after:"After",in:"Is one of",notIn:"Is not one of",isEmpty:"Is empty",isNotEmpty:"Is not empty"},Jt=t=>{switch(t){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},Yt=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),_t=t=>["between","notBetween","in","notIn"].includes(t),Xt=t=>["isEmpty","isNotEmpty"].includes(t),Qt=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},Zt=t=>{var e,n,o;let{children:s,containerRef:i,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:p="fixed",allowDescendantOverflow:f=!1}=t,w=f;const v="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",w&&m.classList.add(v),m.style.position=p,m.style.overflow=w?"visible":c,h&&(m.style.width=h+"px"),u&&(m.style.maxWidth=u+"px"),m.addEventListener("click",t=>t.stopPropagation()),m.addEventListener("mousedown",t=>t.stopPropagation()),m.addEventListener("touchstart",t=>t.stopPropagation()),m.appendChild(s);let g=l;if("fixed"===p){const t=null!==(o=null!==(n=null!==(e=Qt(g))&&void 0!==e?e:Qt(null!=r?r:null))&&void 0!==n?n:Qt(null!=i?i:null))&&void 0!==o?o:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,o=h||m.offsetWidth;let s;s=i?i.getBoundingClientRect():r?r.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:()=>{}};const l=s.bottom-e.bottom,a=e.top-s.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(o>s.right-e.right+e.width&&(c="right"),"fixed"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${w?" "+v:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=w?"visible":c),void 0!==t.allowDescendantOverflow&&(w=t.allowDescendantOverflow,m.classList.toggle(v,w),m.style.overflow=w?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},te=t=>{let{value:e,onChange:n,options:o,placeholder:s="Select...",className:i="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!1,c=-1;const h=document.createElement("div");h.className=`st-custom-select ${i} ${r?"st-custom-select-disabled":""}`.trim();const u=document.createElement("button");u.type="button",u.className="st-custom-select-trigger",u.disabled=r,u.setAttribute("aria-haspopup","listbox"),u.setAttribute("aria-expanded","false"),u.setAttribute("aria-labelledby","select-label");const p=document.createElement("span");p.className="st-custom-select-value";const f=o.find(t=>t.value===e);p.textContent=f?f.label:s;const w=document.createElement("template");w.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const v=w.content.firstElementChild;u.appendChild(p),u.appendChild(v),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.innerHTML="",o.forEach((t,n)=>{const o=document.createElement("div");o.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),o.setAttribute("role","option"),o.setAttribute("aria-selected",""+(t.value===e)),o.setAttribute("tabindex","0"),o.textContent=t.label,o.addEventListener("click",()=>y(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(o)})};g();const x=Zt({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=o.find(t=>t.value===e);p.textContent=n?n.label:s},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);p.textContent=n?n.label:s,g()}void 0!==t.options&&(o=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},ee=t=>{let{type:e="text",value:n,onChange:o,onEnter:s,placeholder:i="",autoFocus:r=!1,min:l,max:a,step:d}=t;const c=document.createElement("input");c.className="st-filter-input",c.type=e,c.value=n,c.placeholder=i,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&setTimeout(()=>c.focus(),0);const h=t=>{o(t.target.value)},u=t=>{"Enter"===t.key&&s&&(t.preventDefault(),s())};return c.addEventListener("input",h),c.addEventListener("keydown",u),{element:c,update:t=>{void 0!==t.value&&(n=t.value,c.value=n),void 0!==t.type&&(e=t.type,c.type=e),void 0!==t.placeholder&&(i=t.placeholder,c.placeholder=i),void 0!==t.min&&(l=t.min,c.min=l),void 0!==t.max&&(a=t.max,c.max=a),void 0!==t.step&&(d=t.step,c.step=d),void 0!==t.onChange&&(o=t.onChange),void 0!==t.onEnter&&(s=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},ne=t=>{let{onApply:e,onClear:n,canApply:o,showClear:s}=t;const i=document.createElement("div");i.className="st-filter-actions";const r=document.createElement("button");r.type="button",r.tabIndex=0,r.textContent="Apply";const l=()=>{r.disabled=!o,r.className=("st-filter-button st-filter-button-apply"+(o?"":" st-filter-button-disabled")).trim()};l();const a=()=>{e()};r.addEventListener("click",a),i.appendChild(r);let d=null;const c=()=>{null==n||n()},h=()=>{const t=s&&!!n;t&&!d?(d=document.createElement("button"),d.type="button",d.tabIndex=0,d.className="st-filter-button st-filter-button-clear",d.textContent="Clear",d.addEventListener("click",c),i.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return h(),{element:i,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(s=t.showClear,h()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,h())},destroy:()=>{r.removeEventListener("click",a),d&&d.removeEventListener("click",c),i.remove()}}},oe=t=>{let{onChange:e,onClose:n,value:o}=t,s=o||new Date,i="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{s=new Date(s.getFullYear(),s.getMonth()-1,1),f()},d=()=>{s=new Date(s.getFullYear(),s.getMonth()+1,1),f()},c=t=>{s=new Date(t,s.getMonth(),1),i="months",f()},h=t=>{const o=s.getFullYear(),i=s.getMonth(),r=new Date(o,i,t,12,0,0);s=r,e(r),null==n||n()},u=t=>{const o=new Date(s.getFullYear(),s.getMonth()-1,t,12,0,0);s=o,e(o),null==n||n()},p=t=>{const o=new Date(s.getFullYear(),s.getMonth()+1,t,12,0,0);s=o,e(o),null==n||n()},f=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===i){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${w=s,w.toLocaleString("default",{month:"long"})} ${s.getFullYear()}`,n.addEventListener("click",()=>{i="months",f()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',o.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===i){const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent=""+s.getFullYear(),e.addEventListener("click",()=>{i="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var w;r.appendChild(t);const v=document.createElement("div");var m;v.className=`st-datepicker-grid st-datepicker-${i}-grid`,"days"===i?(t=>{const e=s.getFullYear(),n=s.getMonth(),i=l(e,n),r=((t,e)=>new Date(t,e,1).getDay())(e,n),a=l(e,n-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=e,t.appendChild(n)});for(let e=0;r>e;e++){const n=a-r+e+1,o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=""+n,o.addEventListener("click",()=>u(n)),t.appendChild(o)}for(let s=1;i>=s;s++){const i=s===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(o),l=s===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${i?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+s,a.addEventListener("click",()=>h(s)),t.appendChild(a)}const d=35-(r+i);for(let e=1;d>=e;e++){const n=document.createElement("div");n.className="st-datepicker-day other-month",n.textContent=""+e,n.addEventListener("click",()=>p(e)),t.appendChild(n)}})(v):"months"===i?(m=v,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===s.getMonth(),o=document.createElement("div");o.className=("st-datepicker-month "+(n?"selected":"")).trim(),o.textContent=t,o.addEventListener("click",()=>(t=>{s=new Date(s.getFullYear(),t,1),i="days",f()})(e)),m.appendChild(o)})):(t=>{const e=s.getFullYear(),n=e-6;for(let o=n;n+12>o;o++){const n=o===e,s=document.createElement("div");s.className=("st-datepicker-year "+(n?"selected":"")).trim(),s.textContent=""+o,s.addEventListener("click",()=>c(o)),t.appendChild(s)}})(v),r.appendChild(v);const g=document.createElement("div");g.className="st-datepicker-footer";const x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);s=o,e(o),null==n||n()}),g.appendChild(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,s=o||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},se=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},ie=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");n&&o&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),o.className="st-checkbox-custom "+(e?"st-checked":""),o.setAttribute("aria-hidden","true"),o.innerHTML="",e&&o.appendChild(se()))},re=({checked:t,onChange:e,ariaLabel:n})=>{const o=document.createElement("label");o.className="st-checkbox-label";const s=document.createElement("input");s.type="checkbox",s.checked=t,s.className="st-checkbox-input",n&&s.setAttribute("aria-label",n),s.setAttribute("aria-checked",""+t);const i=document.createElement("span");i.className="st-checkbox-custom "+(t?"st-checked":""),i.setAttribute("aria-hidden","true"),t&&i.appendChild(se());const r=()=>{const t=s.checked;s.setAttribute("aria-checked",""+t),t?(i.classList.add("st-checked"),i.appendChild(se())):(i.classList.remove("st-checked"),i.innerHTML=""),e(t)};return s.addEventListener("change",r),s.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(s),o.appendChild(i),{element:o,update:t=>{s.checked!==t&&(s.checked=t,s.setAttribute("aria-checked",""+t),t?(i.classList.add("st-checked"),i.innerHTML="",i.appendChild(se())):(i.classList.remove("st-checked"),i.innerHTML=""))},destroy:()=>{s.removeEventListener("change",r)}}},le=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s,containerRef:i,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"";const d=Jt("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=te({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Kt[t]})),containerRef:i,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>{const t=Object.assign({accessor:e.accessor,operator:l},Yt(l)&&{value:a});o(t)},m=()=>Xt(l)||""!==a.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Yt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ee({type:"text",value:a,onChange:t=>{a=t,w&&w.update({canApply:m()})},onEnter:v,placeholder:"Filter...",autoFocus:!0}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:m()})};return w=ne({onApply:v,onClear:s,canApply:m(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"",u.update({value:l}),f&&f.update({value:a}),w&&w.update({showClear:!!n,canApply:m()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:s,onApplyFilter:i,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==s?void 0:s.operator)||"equals",c=((null==s?void 0:s.value)||"")+"",h=((null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"";const p=Jt("number"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=te({value:d,onChange:t=>{d=t,S()},options:p.map(t=>({value:t,label:Kt[t]})),containerRef:l,mainBodyRef:a});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,x=null,b=null,y=null;const R=()=>{const t={accessor:o.accessor,operator:d};Yt(d)?t.value=parseFloat(c):_t(d)&&(t.values=[parseFloat(h),parseFloat(u)]),i(t)},C=()=>!!Xt(d)||(Yt(d)?""!==c.trim():!!_t(d)&&""!==h.trim()&&""!==u.trim()),S=()=>{m&&(m.remove(),m=null),g&&(g.destroy(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),Yt(d)?(m=document.createElement("div"),m.className="st-filter-section",g=ee({type:"number",value:c,onChange:t=>{c=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"Enter number...",autoFocus:!0}),m.appendChild(g.element),f.insertBefore(m,f.lastChild)):_t(d)&&(m=document.createElement("div"),m.className="st-filter-section",x=ee({type:"number",value:h,onChange:t=>{h=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),b=ee({type:"number",value:u,onChange:t=>{u=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"To..."}),m.appendChild(x.element),m.appendChild(b.element),f.insertBefore(m,f.lastChild)),y&&y.update({canApply:C()})};return y=ne({onApply:R,onClear:r,canApply:C(),showClear:!!s}),f.appendChild(y.element),S(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(s=t.currentFilter,d=(null==s?void 0:s.operator)||"equals",c=((null==s?void 0:s.value)||"")+"",h=((null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:d}),g&&g.update({value:c}),x&&x.update({value:h}),b&&b.update({value:u}),y&&y.update({showClear:!!s,canApply:C()}),S())},destroy:()=>{v.destroy(),g&&g.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),f.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s,containerRef:i,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const d=Jt("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=te({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Kt[t]})),containerRef:i,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>Xt(l)||""!==a,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Yt(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=te({value:a,onChange:t=>{a=t,w&&w.update({canApply:v()})},options:m,containerRef:i,mainBodyRef:r}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:v()})};return w=ne({onApply:()=>{const t={accessor:e.accessor,operator:l};Yt(l)&&(t.value="true"===a),o(t)},onClear:s,canApply:v(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true",u.update({value:l}),f&&f.update({value:a}),w&&w.update({showClear:!!n,canApply:v()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:s,onApplyFilter:i,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==s?void 0:s.operator)||"equals",c=(null==s?void 0:s.value)?s.value+"":"",h=(null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])?s.values[0]+"":"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"";const p=Jt("date"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=te({value:d,onChange:t=>{d=t,T()},options:p.map(t=>({value:t,label:Kt[t]})),containerRef:l,mainBodyRef:a});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null;const k=()=>!!Xt(d)||(Yt(d)?""!==c.trim():!!_t(d)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=V(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},O=(t,e,n,o=!1)=>{const s=document.createElement("div");s.className="st-date-input-container",s.style.position="relative";const i=document.createElement("input");i.type="text",i.className="st-filter-input",i.value=E(t),i.placeholder=n,i.readOnly=!0,i.style.cursor="pointer",o&&setTimeout(()=>i.focus(),0);let r=!1;const d=t?V(t):new Date,c=oe({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),i.value=E(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=Zt({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:i,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});s.appendChild(i),s.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return i.addEventListener("click",u),i.addEventListener("keydown",p),{container:s,input:i,picker:c,dropdown:h,destroy:()=>{i.removeEventListener("click",u),i.removeEventListener("keydown",p),c.destroy(),h.destroy(),s.remove()}}},T=()=>{if(m&&(m.remove(),m=null),g&&(g=null),x&&(x=null),b&&(b=null),y&&(y.destroy(),y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),Yt(d)){m=document.createElement("div"),m.className="st-filter-section";const t=O(c,t=>{c=t,M&&M.update({canApply:k()})},"Select date...",!0);g=t.container,y=t.picker,S=t.dropdown,m.appendChild(g),f.insertBefore(m,f.lastChild)}else if(_t(d)){m=document.createElement("div"),m.className="st-filter-section";const t=O(h,t=>{h=t,M&&M.update({canApply:k()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=O(u,t=>{u=t,M&&M.update({canApply:k()})},"To date...",!1);x=t.container,R=t.picker,I=t.dropdown,b=e.container,C=e.picker,H=e.dropdown,m.appendChild(x),m.appendChild(b),f.insertBefore(m,f.lastChild)}M&&M.update({canApply:k()})};return M=ne({onApply:()=>{const t={accessor:o.accessor,operator:d};Yt(d)?t.value=c:_t(d)&&(t.values=[h,u]),i(t)},onClear:r,canApply:k(),showClear:!!s}),f.appendChild(M.element),T(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(s=t.currentFilter,d=(null==s?void 0:s.operator)||"equals",c=(null==s?void 0:s.value)?s.value+"":"",h=(null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])?s.values[0]+"":"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:d}),M&&M.update({showClear:!!s,canApply:k()}),T())},destroy:()=>{v.destroy(),y&&y.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),f.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s}=t;const i=e.enumOptions||[],r=i.map(t=>t.value);let l=(null==n?void 0:n.values)?n.values.map(String):r,a="";const d=document.createElement("div");d.className="st-filter-container";const c=document.createElement("div");c.className="st-filter-section";const h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const p=re({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let w=null,v=null;i.length>10&&(w=document.createElement("div"),w.className="st-enum-search",v=ee({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),w.appendChild(v.element),h.appendChild(w));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?i.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):i;if(a&&0===t.length){const t=document.createElement("div");t.className="st-enum-no-results",t.textContent="No matching options",m.appendChild(t)}else t.forEach(t=>{const e=re({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=ne({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):s()},onClear:s,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",v&&v.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),v&&v.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},ae=new WeakMap,de=(t,e,n,o)=>{t.addEventListener(e,n,o),ae.has(t)||ae.set(t,[]),ae.get(t).push({event:e,handler:n,options:o})},ce=new WeakMap,he=t=>(ce.has(t)||ce.set(t,new Map),ce.get(t)),ue=(t,e,n)=>{var o,s;const i=t.querySelector(".st-expand-icon-container");if(!(i&&i instanceof HTMLElement))return;if(i.classList.contains("expanded")===e)return;const r=null!==(o=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==o?o:"Collapse row",l=null!==(s=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==s?s:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.classList.toggle("expanded",e),i.classList.toggle("collapsed",!e),i.setAttribute("aria-label",e?r:l),(null==n?void 0:n.syncAriaExpanded)&&i.setAttribute("aria-expanded",e+"")})})},pe=(t,e,n=[])=>{for(let o=0;t.length>o;o++){const s=t[o];if(s.accessor===e)return[...n,o];if(s.children&&s.children.length>0){const t=pe(s.children,e,[...n,o]);if(t)return t}}return null},fe=t=>"left"===t.pinned?"left":"right"===t.pinned?"right":"main";function we(t,e,n){const o=ft(t);let s=!1;function i(t,e){let n,o=t;for(let t=0;e.length-1>t;t++)o=o[e[t]].children;return n=o[e[e.length-1]],n}function r(t,e,n){let o=t;for(let t=0;e.length-1>t;t++){if(!o[e[t]].children){s=!0;break}o=o[e[t]].children}o[e[e.length-1]]=n}const l=i(o,e);return r(o,e,i(o,n)),r(o,n,l),{newHeaders:o,emergencyBreak:s}}const ve=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let s=0,i=0,r=0;t.forEach(t=>{if(t.hide)return;const e=g(t,n).reduce((t,e)=>t+C(e),0);"left"===t.pinned?s+=e:"right"===t.pinned?i+=e:r+=e});const a=s,d=i;if(e&&e>0){const t=e*o(e,s>0,i>0);s>t&&(s=t),i>t&&(i=t)}return{leftWidth:l(s),rightWidth:l(i),mainWidth:r,leftContentWidth:a,rightContentWidth:d}},me=(t,e)=>{if(t.pinned)return t.pinned;const n=((t,e)=>{const n=r(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null})(e,t.accessor);return n?me(n,e):void 0},ge=(t,e,n)=>{var o;const i=[],r=[],l=[];t.forEach(e=>{if(e.hide)return;const n=me(e,t);"left"===n?i.push(e):"right"===n?l.push(e):r.push(e)});const a=(t,o,i)=>{var r,l;const d=o;if(t.children&&t.children.length>0){const l=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||s;return l?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:C(t);return i.set(t.accessor,{left:d,width:e}),o=d+e,c.forEach(t=>{o=a(t,o,i)}),o}c.forEach(t=>{o=a(t,o,i)}),i.set(t.accessor,{left:d,width:o-d})}else{const e=null!==(l=null==n?void 0:n.get(t.accessor))&&void 0!==l?l:"number"==typeof t.width?t.width:C(t);i.set(t.accessor,{left:o,width:e}),o+=e}return o},c=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=a(t,n,e)}),e},h=c(i),u=c(r),p=c(l),f=new Map;h.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),p.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:o}=t,s=d({accessor:e,rowId:"header"}),i=document.getElementById(s);h.has(e),p.has(e),i&&(i.style.left=n+"px",i.style.width=o+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=o+"px")})});const w=document.querySelector(".st-body-container"),v=null!==(o=null==w?void 0:w.clientWidth)&&void 0!==o?o:0,{leftWidth:m,rightWidth:g}=ve({headers:t,containerWidth:v>0?v:void 0,collapsedHeaders:e});if(m>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}if(g>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}},xe=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:o})=>{if(0>e){const n=Math.abs(e),s=t.reduce((t,e)=>t+(o.get(e.accessor)||100),0);if(0===s)return;return void t.forEach((e,i)=>{const r=o.get(e.accessor)||100;let l=n*(r/s);if(i===t.length-1){const e=t.slice(0,i).reduce((t,e)=>{const n=o.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-n)},0);l=n-e}e.width=r+l})}let s=e;for(;s>.5;){const e=n,i=t.map(t=>{const n=o.get(t.accessor)||100;return{column:t,headroom:Math.max(0,n-e),initialWidth:n,minWidth:e}}).filter(t=>t.headroom>0);if(0>=i.length)break;{const t=i.reduce((t,e)=>t+e.headroom,0);let e=0;const n=s;i.forEach((o,s)=>{let r=n*(o.headroom/t);r=Math.min(r,o.headroom),s===i.length-1&&(r=Math.min(n-e,o.headroom)),o.column.width=o.initialWidth-r,e+=r}),s-=e}}},be=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:s,delta:i,headers:r,initialWidthsMap:l,isParentResize:a=!1,resizedHeader:d,reverse:c,rootPinned:h,sectionHeaders:u,sectionWidth:p,startWidth:f})=>{let w=i;if(h&&s>0){const t=((t,e,n)=>t*o(t,e,n))(s,r.some(t=>"left"===t.pinned&&!t.hide),r.some(t=>"right"===t.pinned&&!t.hide)),e=Array.from(l.values()).reduce((t,e)=>t+e,0);i>0&&e+i>t&&(w=Math.max(0,t-e))}if(i=w,a&&t.length>1){const o=H(u,e),s=o.findIndex(e=>e.accessor===t[0].accessor),r=o.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===s||-1===r)return;const a=0===s,d=r===o.length-1;let w;w="left"===h&&d||"right"===h&&a?[]:a?o.slice(r+1):d||c?o.slice(0,s):o.slice(r+1);const v=Array.from(l.values()).reduce((t,e)=>t+e,0);if(i>0){let e=i,o=!1;if(w.length>0&&v+i>(p>0?Math.max(p,v):v+Math.abs(i)+1)){o=!0;const t=w.reduce((t,e)=>{const o=l.get(e.accessor)||100;return t+Math.max(0,o-n)},0);e=Math.min(i,t)}const s=(f+e)/t.reduce((t,e)=>t+(l.get(e.accessor)||100),0);t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)}),o&&e>0&&w.length>0&&xe({columnsToShrink:w,totalCompensation:e,initialWidthsMap:l})}else{const e=t.reduce((t,e)=>t+(l.get(e.accessor)||100),0),o=Math.max(f+i,n*t.length),s=o/e;t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)});const r=f-o;r>0&&w.length>0&&xe({columnsToShrink:w,totalCompensation:-r,initialWidthsMap:l})}return}const v=H(u,e),m=v.findIndex(t=>t.accessor===d.accessor);if(-1===m)return;const g=0===m,x=m===v.length-1;let b;if(b="left"===h&&x||"right"===h&&g?[]:g?v.slice(m+1):x||c?v.slice(0,m):v.slice(m+1),0===b.length)return void(d.width=Math.max(f+i,n));const y=Array.from(l.values()).reduce((t,e)=>t+e,0);if(i>0){if((p>0?Math.max(p,y):y+Math.abs(i)+1)>=y+i)return void(d.width=f+i);const t=b.reduce((t,e)=>{const o=l.get(e.accessor)||100;return t+Math.max(0,o-n)},0),e=Math.min(i,t);d.width=f+e,e>0&&xe({columnsToShrink:b,totalCompensation:e,initialWidthsMap:l})}else{const t=Math.max(f+i,40),e=f-t;d.width=t,e>0&&xe({columnsToShrink:b,totalCompensation:-e,initialWidthsMap:l})}},ye=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const o=n.closest(".simple-table-root"),s=null==o?void 0:o.querySelector(".st-body-container");return s instanceof HTMLElement?s.clientWidth:n.clientWidth},Re=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:s,header:i,headers:r,mainBodyRef:l,onColumnWidthChange:a,reverse:d=!1,setHeaders:c,setIsResizing:h,startWidth:u})=>{s.preventDefault();const p="clientX"in s?s.clientX:s.touches[0].clientX,f="touches"in s;if(!i||i.hide)return;const w=ye(n,l);h(!0);const v=me(i,r),m=I(i);let x;if(i.children&&i.children.length>0){const t=g(i,e);x=t.length>0?t:[i]}else x=[i];const b=new Map;let y=0,R=0;if(t){const t=r.filter(t=>t.pinned===v);if(H(t,e).forEach(t=>{const e=C(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=ve({headers:r,containerWidth:w,collapsedHeaders:e});y="left"===v?t:"right"===v?n:o,R=w-t-n}}let M=!1;const k=new Map;let E=[];if(t&&v&&w>0){const t=H(r.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(x.length>1){const e=t.findIndex(t=>t.accessor===x[0].accessor),o=t.findIndex(t=>t.accessor===x[x.length-1].accessor);n="left"===v&&o===t.length-1||"right"===v&&0===e}else{const e=x[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&o===t.length-1||"right"===v&&0===o}if(n){M=!0;const t=r.filter(t=>!t.pinned);E=H(t,e),E.forEach(t=>{k.set(t.accessor,C(t))})}}}const O=(n,s=!1)=>{const l="right"===v?p-n:n-p;if(t){const t=r.filter(t=>t.pinned===v);if(be({childrenToResize:x,collapsedHeaders:e,containerWidth:w,delta:l,headers:r,initialWidthsMap:b,isParentResize:x.length>1,resizedHeader:x.length>0?x[x.length-1]:i,reverse:d,rootPinned:v,sectionHeaders:t,sectionWidth:y,startWidth:u}),M&&E.length>0){const t=x.reduce((t,e)=>{const n=b.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,R-t),n=Array.from(k.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;E.forEach((n,s)=>{const i=k.get(n.accessor)||100;s===E.length-1?n.width=e-o:(n.width=Math.round(i*t),o+=n.width)})}}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const s=document.querySelector(".st-body-container");if(!s||0===s.clientWidth)return 1e3;const i=s.clientWidth;if(!t.pinned)return 1/0;const r=e.some(t=>"left"===t.pinned&&!t.hide),l=e.some(t=>"right"===t.pinned&&!t.hide),a=i*o(i,r,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+g(e,n).reduce((t,e)=>t+C(e),0),0),d=I(t);return d>a?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),d):a})({header:i,headers:r,collapsedHeaders:e});x.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:s})=>{const i=e.reduce((t,e)=>Math.min(t,I(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(o+t,s),i)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:l,leafHeaders:x,minWidth:m,startWidth:u,maxWidth:t}):x[0].width=Math.max(Math.min(u+l,t),m),r.forEach(t=>{S(t)})}if(s){const t=[...r];c(t);const n=new Map;x.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),M&&E.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),ge(r,e,n)}else ge(r,e)};let T=null,A=null,W=p;const P=t=>{W=t,A=t,null===T&&(T=requestAnimationFrame(()=>{null!==A&&(O(A,!1),A=null),T=null}))};if(f){const t=t=>{P(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),a&&a([...r])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{P(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),a&&a([...r])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Ce=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=o.closest(".simple-table-root"))&&void 0!==n?n:o:null},Se=(e,n,o)=>{const{columnResizing:s}=n;if(!s||e.isSelectionColumn&&n.enableRowSelection||o)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${e.label} column`),i.setAttribute("aria-orientation","vertical");const r=document.createElement("div");r.className="st-header-resize-handle",i.appendChild(r);const l=t=>({rows:n.rows,header:t,maxWidth:500,sampleSize:50,styleRoot:Ce(n)});let a=0;const c=()=>{const t=Date.now();120>t-a||(a=t,(()=>{const t=document.getElementById(d({accessor:e.accessor,rowId:"header"}));if(n.autoExpandColumns){(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:s,reverse:i,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=ye(o,s),c=me(t,e);let h;if(t.children&&t.children.length>0){const e=g(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const w=e.filter(t=>t.pinned===c);if(H(w,n).forEach(t=>{const e=C(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:o,mainWidth:s}=ve({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?o:s,f=d-t-o}let v=!1;const m=new Map;let x=[];if(c&&d>0){const o=H(e.filter(t=>t.pinned===c),n);if(o.length>0){let s=!1;if(h.length>1){const t=o.findIndex(t=>t.accessor===h[0].accessor),e=o.findIndex(t=>t.accessor===h[h.length-1].accessor);s="left"===c&&e===o.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);s="left"===c&&n===o.length-1||"right"===c&&0===n}if(s){v=!0;const t=e.filter(t=>!t.pinned);x=H(t,n),x.forEach(t=>{m.set(t.accessor,C(t))})}}}const b=h.reduce((t,e)=>t+l(e),0),y=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+C(e),0);if(be({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:b-y,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:i,rootPinned:c,sectionHeaders:w,sectionWidth:p,startWidth:y}),v&&x.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;x.forEach((n,s)=>{const i=m.get(n.accessor)||100;s===x.length-1?n.width=e-o:(n.width=Math.round(i*t),o+=n.width)})}}const R=new Map;h.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),v&&x.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),ge(e,n,R)})({header:e,headers:n.headers,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,mainBodyRef:n.mainBodyRef,reverse:n.reverse,headerCellElement:t,getTargetLeafWidth:t=>M(t.accessor,l(t))});const o=[...n.headers];return n.setHeaders(o),void(n.onColumnWidthChange&&n.onColumnWidthChange(o))}const o=M(e.accessor,l(e)),s=pe(n.headers,e.accessor);if(!s)return;const i=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(n.headers,s),r=s[s.length-1],a=i.map((t,e)=>e===r?Object.assign(Object.assign({},t),{width:o}):t),c=((t,e,n)=>{if(1===e.length)return n;let o=t;for(let t=0;e.length-2>t;t++)o=o[e[t]].children;return o[e[e.length-2]].children=n,t})(n.headers,s,a);c.forEach(t=>S(t));const h=a[r],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),ge(c,n.collapsedHeaders,u),n.setHeaders(c),n.onColumnWidthChange&&n.onColumnWidthChange(c)})())};return Gt(i,"mousedown",o=>{var s;if(o.detail>=2)return o.preventDefault(),void c();const i=null===(s=document.getElementById(d({accessor:e.accessor,rowId:"header"})))||void 0===s?void 0:s.offsetWidth;qt(()=>{Re({autoExpandColumns:n.autoExpandColumns,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,event:o,forceUpdate:n.forceUpdate,header:e,headers:n.headers,mainBodyRef:n.mainBodyRef,onColumnWidthChange:n.onColumnWidthChange,pinnedLeftRef:n.pinnedLeftRef,pinnedRightRef:n.pinnedRightRef,reverse:n.reverse,setHeaders:n.setHeaders,setIsResizing:n.setIsResizing,startWidth:null!=i?i:t})},10)}),Gt(i,"touchstart",o=>{var s;const i=o,r=null===(s=document.getElementById(d({accessor:e.accessor,rowId:"header"})))||void 0===s?void 0:s.offsetWidth;qt(()=>{Re({autoExpandColumns:n.autoExpandColumns,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,event:i,forceUpdate:n.forceUpdate,header:e,headers:n.headers,mainBodyRef:n.mainBodyRef,onColumnWidthChange:n.onColumnWidthChange,pinnedLeftRef:n.pinnedLeftRef,pinnedRightRef:n.pinnedRightRef,reverse:n.reverse,setHeaders:n.setHeaders,setIsResizing:n.setIsResizing,startWidth:null!=r?r:t})},10)}),Gt(i,"dblclick",c),i},Ie=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",Gt(o,"blur",()=>{const s=o.value;s!==t.label&&(n=>{const o=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(o),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(s);const i=n.parentElement;if(i){const o=He(t,e,s);i.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),Gt(o,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),o.blur()):"Escape"===e.key&&(e.preventDefault(),o.value=t.label||"",o.blur())}),setTimeout(()=>o.focus(),0),o},He=(t,e,n)=>{const o=t.isSelectionColumn&&e.enableRowSelection,s=void 0!==n?n:t.label||"",i=document.createElement("span");if(i.className="st-header-label-text "+("right"===t.align?"right-aligned":"center"===t.align?"center-aligned":"left-aligned"),o){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return re({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);i.appendChild(t)}else i.textContent=s;if(t.tooltip&&!o){let e=null,n=null;const o=()=>{n=setTimeout(()=>{const n=i.getBoundingClientRect();if(n.width>0&&n.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const o=200,s=40;let r=n.left+n.width/2-o/2,l=n.bottom+8;8>r?r=8:r+o>window.innerWidth-8&&(r=window.innerWidth-o-8),l+s>window.innerHeight-8&&(l=n.top-s-8),e.style.top=l+"px",e.style.left=r+"px",(i.closest(".simple-table-root")||document.body).appendChild(e)}},500)},s=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};Gt(i,"mouseenter",o),Gt(i,"mouseleave",s)}return i},Me=(t,e,n,o)=>{const{columnReordering:s,draggedHeaderRef:i,hoveredHeaderRef:r,headers:l}=o;!s||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),Gt(t,"dragstart",t=>{i.current=n,jt(Date.now()),e.classList.add("st-dragging")}),Gt(t,"dragend",t=>{t.preventDefault(),i.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(o.headers)},10)}),Gt(e,"dragover",t=>{const e=t;e.preventDefault(),l&&i.current&&qt(()=>{const{screenX:t,screenY:s}=e,a=Math.sqrt(Math.pow(t-Ft.screenX,2)+Math.pow(s-Ft.screenY,2));r.current=n;const d=i.current;if(!d)return;let c,h=!1;if(fe(d)!==fe(n)){const t=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=ft(t);let s=!1;try{const t=fe(n),i=o.findIndex(t=>t.accessor===e.accessor),r=o.findIndex(t=>t.accessor===n.accessor);if(-1===i||-1===r)return s=!0,{newHeaders:o,emergencyBreak:s};const[l]=o.splice(i,1),a=((t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n})(l,t);o.splice(r,0,a)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),s=!0}return{newHeaders:o,emergencyBreak:s}}({headers:l,draggedHeader:d,hoveredHeader:n});c=t.newHeaders,h=t.emergencyBreak}else{const t=pe(l,d.accessor),e=pe(l,n.accessor);if(!t||!e)return;const o=t.length,s=e.length;let i=e;if(o!==s){const t=s-o;t>0&&(i=e.slice(0,-t))}if((u=t).length!==(p=i).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===p[e]))return;const r=we(l,t,i);c=r.newHeaders,h=r.emergencyBreak}var u,p;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(l)||h)return;const f=o.essentialAccessors;if(f&&f.size>0&&!Ht(c,f))return;const w=Date.now();JSON.stringify(c)===JSON.stringify(Lt)&&(1500>w-Dt||40>a)||(jt(w),Ft={screenX:t,screenY:s},(t=>{Lt=t})(l),o.onTableHeaderDragEnd(c))},50)}),Gt(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},ke=(t,e,n)=>{var o,r;const{header:l,colIndex:a,parentHeader:d}=t,{collapsedHeaders:c,columnBorders:h,columnReordering:u,enableHeaderEditing:p,selectedColumns:f,columnsWithSelectedCells:w,draggedHeaderRef:v,hoveredHeaderRef:m}=e,g=l.isSelectionColumn&&e.enableRowSelection,x=!!(null==l?void 0:l.isSortable),b=c.has(l.accessor),y=!(!l.children||0===l.children.length)&&(!b||l.children.some(t=>{const e=t.showWhen||s;return"parentCollapsed"===e||"always"===e})),R=null==d?void 0:d.singleRowChildren,C=y&&!l.singleRowChildren,S=!!h&&(l.children&&0!==l.children.length?i(l,a).includes(e.lastHeaderIndex):a===e.lastHeaderIndex),I=!(!e.selectableColumns||g)&&i(l,a).some(t=>f.has(t)),H=!g&&i(l,a).some(t=>w.has(t));return["st-header-cell",l.accessor===(null===(o=m.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(r=v.current)||void 0===r?void 0:r.accessor)===l.accessor?"st-dragging":"",x?"clickable":"",u&&!x?"columnReordering":"",C?"parent":"",R?"st-sub-header":"",S?"st-last-column":"",p&&!g?"st-header-editable":"",I?"st-header-selected":"",H&&!I?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},Ee=(t,e,n)=>{var o;const{header:s,colIndex:r}=t,{reverse:l}=e,c=s.isSelectionColumn&&e.enableRowSelection,h=ke(t,e,n),u=document.createElement("div");u.className=h,u.id=d({accessor:s.accessor,rowId:"header"}),u.setAttribute("data-accessor",s.accessor+""),u.setAttribute("role","columnheader"),u.setAttribute("aria-colindex",r+1+""),s.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?u.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):u.setAttribute("aria-sort","none"));const p=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(p){const t="header-desc-"+s.accessor;u.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=p,u.appendChild(e)}u.style.position="absolute",u.style.left=t.left+"px",u.style.top=t.top+"px",u.style.width=t.width+"px",u.style.height=t.height+"px";const f=((t,e)=>{const{sort:n,icons:o}=e;if(!n||n.key.accessor!==t.accessor)return null;const s=document.createElement("div");s.className="st-icon-container",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const i="asc"===n.direction?o.sortUp:o.sortDown;return i&&("string"==typeof i?s.innerHTML=i:(i instanceof HTMLElement||i instanceof SVGSVGElement)&&s.appendChild(i.cloneNode(!0))),Gt(s,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),Gt(s,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),s})(s,e),w=((t,e)=>{const{filters:n,handleApplyFilter:o,handleClearFilter:s,icons:i}=e;if(!t.filterable)return null;const r=n[t.accessor],l=document.createElement("div");l.className="st-icon-container",l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Filter "+t.label),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-haspopup","dialog");const a=i.filter;let d=null;if(a)if("string"==typeof a)l.innerHTML=a,d=l.querySelector("svg");else if(a instanceof HTMLElement||a instanceof SVGSVGElement){const t=a.cloneNode(!0);l.appendChild(t),d=t}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},i=()=>{s(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=le({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:i,containerRef:a,mainBodyRef:a}),u=Zt({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return Gt(l,"click",p),Gt(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l})(s,e),v=((t,e)=>{var n,o;const{icons:s}=e;if(!a(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const i=(null!==(o=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==o?o:e.collapsedHeaders).has(t.accessor),r=document.createElement("div");r.className="st-icon-container st-expand-icon-container "+(i?"collapsed":"expanded"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${i?"Expand":"Collapse"} ${t.label} column`),r.setAttribute("aria-expanded",!i+"");const l=s.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const d=n=>{var o,s;n.stopPropagation();const i=(null!==(s=null===(o=e.getCollapsedHeaders)||void 0===o?void 0:o.call(e))&&void 0!==s?s:e.collapsedHeaders).has(t.accessor);e.setCollapsedHeaders(e=>{const n=new Set(e);return i?n.delete(t.accessor):n.add(t.accessor),n})};return Gt(r,"click",d),Gt(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),d(t))}),r})(s,e);if(l){const t=Se(s,e,n);t&&u.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f));const m=document.createElement("div");if(m.className="st-header-label",s.headerRenderer){const t=He(s,e),n=s.headerRenderer({accessor:s.accessor,colIndex:r,header:s,components:{sortIcon:f||void 0,filterIcon:w||void 0,collapseIcon:v||void 0,labelContent:t}});n instanceof HTMLElement?m.appendChild(n):m.appendChild(t)}else{const t=He(s,e);m.appendChild(t)}if(Gt(m,"click",t=>{c||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const s=i(e,n),r=s.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&r&&!t.shiftKey){const t=document.getElementById(d({accessor:e.accessor,rowId:"header"}));if(t){const n=t.querySelector(".st-header-label");if(n){const t=n.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Ie(e,o,t);if(t.appendChild(n),o.headerRegistry&&!e.isSelectionColumn){const t=o.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&o.selectColumns?o.setSelectedColumns(t=>{if(0===t.size)return new Set(s);const e=s[0],n=Array.from(t).sort((t,e)=>t-e);let o=n[0],i=Math.abs(e-o);n.forEach(t=>{const n=Math.abs(e-t);i>n&&(i=n,o=t)});const r=[...((t,e)=>{const n=Math.min(t,e);return Array.from({length:Math.max(t,e)-n+1},(t,e)=>n+e)})(o,e),...s];return new Set([...Array.from(t),...r])}):o.selectColumns&&o.selectColumns(s),o.setSelectedCells(new Set),o.setInitialFocusedCell(null)}o.onColumnSelect&&o.onColumnSelect(e),!o.selectableColumns&&e.isSortable&&o.onSort(e.accessor)}})(t,s,r,e)}),Gt(m,"dblclick",t=>{c||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,s,e)}),Me(m,u,s,e),u.appendChild(m),s.headerRenderer||"right"===s.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f)),!l){const t=Se(s,e,n);t&&u.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Ie(s,e,t);t.appendChild(n)}}}}),u},Oe=(t,e,n,o=0)=>{var s,i;const r=n.pinned?n.containerWidth:null!==(s=n.mainSectionContainerWidth)&&void 0!==s?s:n.containerWidth||(null===(i=t.parentElement)||void 0===i?void 0:i.clientWidth)||t.clientWidth||0,l=n.pinned?e:((t,e,n,o=100)=>{if(0===t.length)return[];const s=e-o,i=e+n+o;return t.filter(t=>t.left+t.width>=s&&i>=t.left)})(e,o,r),c=(t=>0===t.length?-1:t[t.length-1].colIndex)(e),h=Nt(t),u=new Set(l.map(t=>d({accessor:t.header.accessor,rowId:"header"}))),p=Vt(t);h.forEach((t,e)=>{u.has(e)||(p.delete(e),t.remove(),h.delete(e))});const f=document.createDocumentFragment(),w=[];l.forEach(t=>{const e=d({accessor:t.header.accessor,rowId:"header"}),o=!(!n.autoExpandColumns||n.pinned||t.colIndex!==c);if(h.has(e)){const s=h.get(e),i=p.get(e);(!i||i.left!==t.left||i.top!==t.top||i.width!==t.width||i.height!==t.height)&&(s.style.left=t.left+"px",s.style.top=t.top+"px",s.style.width=t.width+"px",s.style.height=t.height+"px",p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})),t.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{ie(t,e)})(s,n.areAllRowsSelected());const r=ke(t,n,o);s.className!==r&&(s.className=r),a(t.header)&&((t,e,n)=>{ue(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(s,n.collapsedHeaders.has(t.header.accessor),t.header.label)}else w.push({cell:t,cellId:e,isLastMainAutoExpandColumn:o})}),w.forEach(({cell:t,cellId:e,isLastMainAutoExpandColumn:o})=>{const s=Ee(t,n,o);f.appendChild(s),h.set(e,s),p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}),f.childNodes.length>0&&t.appendChild(f),n.pinned||(t.dataset.lastScrollLeft=o+"")},Te=(t,e,n)=>{var o;const s=document.createElement("div");s.className="st-dropdown-content",s.style.position=n.positioning||"fixed",s.style.zIndex="1000",s.style.visibility="hidden",s.style.overflow=null!==(o=n.overflow)&&void 0!==o?o:"auto",n.width&&(s.style.width=n.width+"px"),n.maxHeight&&(s.style.maxHeight=n.maxHeight+"px"),s.appendChild(e);const i=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?i?i.appendChild(s):document.body.appendChild(s):t.appendChild(s),requestAnimationFrame(()=>{const{position:e,placement:o}=((t,e,n)=>{const o=t.getBoundingClientRect(),s=window.innerHeight,i=window.innerWidth,r=s-o.bottom,l=i-o.left;let a="bottom";e.offsetHeight>r&&o.top>r&&(a="top");let d="left";(n.width||e.offsetWidth)>l&&o.right>l&&(d="right");const c={};return"fixed"===n.positioning?("bottom"===a?c.top=o.bottom+4:c.bottom=s-o.top+4,"left"===d?c.left=o.left:c.right=i-o.right):("bottom"===a?c.top=o.height+4:c.bottom=o.height+4,"left"===d?c.left=0:c.right=0),{position:c,placement:`${a}-${d}`}})(t,s,n);s.className="st-dropdown-content st-dropdown-"+o,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(s.style[t]=e+"px")}),s.style.visibility="visible"});const r=e=>{const n=e.target;s.contains(n)||t.contains(n)||d()},l=t=>{"Escape"===t.key&&(t.preventDefault(),d())},a=t=>{s.contains(t.target)||d()},d=()=>{s.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("scroll",a,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l,!0),window.addEventListener("scroll",a,!0)},0),de(s,"mousedown",t=>{t.stopPropagation()}),s},Ae=(t,e)=>new Date(t,e+1,0).getDate(),We=["January","February","March","April","May","June","July","August","September","October","November","December"],Pe=["Su","Mo","Tu","We","Th","Fr","Sa"],$e=(t,e,n)=>{const{header:o,row:s}=t,i=u(s,o.accessor);return"boolean"===o.type?((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t;let l;const a=document.createElement("div");a.className="st-dropdown-item "+(!0===n?"selected":""),a.textContent="True",a.setAttribute("role","option"),a.setAttribute("aria-selected",(!0===n)+""),a.setAttribute("aria-disabled","false");const c=document.createElement("div");c.className="st-dropdown-item "+(!1===n?"selected":""),c.textContent="False",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!1===n)+""),c.setAttribute("aria-disabled","false");const h=t=>{p(i,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:i,rowIndex:r}),l.remove(),o()};de(a,"click",()=>h(!0)),de(c,"click",()=>h(!1));const u=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===a?c.focus():a.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===a?h(!0):document.activeElement===c&&h(!1))};a.setAttribute("tabindex","0"),c.setAttribute("tabindex","0"),de(a,"keydown",u),de(c,"keydown",u);const f=document.createDocumentFragment();f.appendChild(a),f.appendChild(c);const w=d({accessor:s.accessor,rowId:t.rowId}),v=document.getElementById(w);return l=Te(v||document.body,f,{width:120,positioning:"fixed",onClose:o}),l})(t,e,!!i,n):"enum"===o.type?((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t,l=s.enumOptions||[];let a;const c=t=>{p(i,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:i,rowIndex:r}),a.remove(),o()},h=[];l.forEach((t,e)=>{const o=document.createElement("div");o.className="st-dropdown-item "+(n===t.value?"selected":""),o.textContent=t.label,o.setAttribute("role","option"),o.setAttribute("aria-selected",(n===t.value)+""),o.setAttribute("aria-disabled","false"),o.setAttribute("tabindex","0"),o.dataset.value=t.value,de(o,"click",()=>c(t.value)),h.push(o)});const u=t=>{const e=t,n=h.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),h[(n+1)%h.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),h[(n-1+h.length)%h.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&c(t)}};h.forEach(t=>{de(t,"keydown",u)});const f=document.createElement("div");f.className="st-enum-dropdown-content",h.forEach(t=>f.appendChild(t));const w=d({accessor:s.accessor,rowId:t.rowId}),v=document.getElementById(w);return a=Te(v||document.body,f,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=l.findIndex(t=>t.value===n);t>=0&&h[t]?(h[t].focus(),h[t].scrollIntoView({block:"nearest"})):h.length>0&&h[0].focus()},0),a})(t,e,(i||"")+"",n):"date"===o.type?((t,e,n,o)=>{var s,i;const{header:r,row:l,rowIndex:a}=t;let c,h;try{h=n?N(n+""):new Date}catch(t){h=new Date}let u=h.getFullYear(),f=h.getMonth();const w=document.createElement("div");w.className="st-datepicker";const v=document.createElement("div");v.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(s=e.icons.prev)&&void 0!==s?s:mt("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(i=e.icons.next)&&void 0!==i?i:gt("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),v.appendChild(m),v.appendChild(x),v.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",Pe.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",de(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),w.appendChild(v),w.appendChild(R),w.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];p(l,r.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:r.accessor,newValue:n,row:l,rowIndex:a}),c.remove(),o()},H=()=>{var t,e,n;for(x.textContent=`${We[f]} ${u}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=Ae(u,f),s=new Date(u,f,1).getDay(),i=Ae(u,f-1),r=new Date;for(let t=0;s>t;t++){const n=i-s+t+1,o=new Date(u,f-1,n),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=n+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${null!==(e=We[f-1])&&void 0!==e?e:We[11]} ${n}, ${o.getFullYear()}`),de(r,"click",()=>I(o)),de(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(r)}const l=h.getFullYear()===u&&h.getMonth()===f;for(let t=1;o>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${We[f]} ${t}, ${u}`),r.getFullYear()===u&&r.getMonth()===f&&r.getDate()===t&&e.classList.add("today"),l&&h.getDate()===t&&e.classList.add("selected");const n=new Date(u,f,t);de(e,"click",()=>I(n)),de(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const a=s+o,d=Math.max(35,7*Math.ceil(a/7))-a;for(let t=1;d>=t;t++){const e=new Date(u,f+1,t),o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=t+"",o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${null!==(n=We[f+1])&&void 0!==n?n:We[0]} ${t}, ${e.getFullYear()}`),de(o,"click",()=>I(e)),de(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};de(m,"click",()=>{f--,0>f&&(f=11,u--),H()}),de(b,"click",()=>{f++,f>11&&(f=0,u++),H()}),H();const M=d({accessor:r.accessor,rowId:t.rowId}),k=document.getElementById(M);return c=Te(k||document.body,w,{width:240,overflow:"hidden",positioning:"fixed",onClose:o}),c})(t,e,i,n):((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===s.type?(l.type="text",l.inputMode="decimal"):l.type="text",l.value=null!=n?n+"":"",l.setAttribute("autofocus","true"),setTimeout(()=>{l.focus(),l.select()},0);let a=!0;if("number"===s.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};de(l,"input",t)}return de(l,"blur",t=>{if(!a)return void o();let n=l.value;if("number"===s.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}p(i,s.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:n,row:i,rowIndex:r}),o()}),de(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),de(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,i,n)},De=(t,e,n,o,s)=>{if(e.valueFormatter){const i=e.valueFormatter({accessor:e.accessor,colIndex:n,row:o,rowIndex:s,value:t});return"object"==typeof i&&null!==i?t+"":i+""}return"boolean"==typeof t?t?"True":"False":Array.isArray(t)?0===t.length?"[]":t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", "):"date"===e.type&&null!=t&&("string"==typeof t||"number"==typeof t||"object"==typeof t&&t instanceof Date)?V(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Fe=(t,e,n)=>{var o;const{header:s,row:i,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=u(i,s.accessor),h=s.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(h){const o=document.createElement("div");o.className="st-selection-cell-content";const s=document.createElement("div");s.className="st-selection-control";const i=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>re({checked:n,onChange:n=>{var o;null===(o=e.handleRowSelect)||void 0===o||o.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,i);s.appendChild(r),o.appendChild(s);const l=((t,e)=>{if(!e.rowButtons||0===e.rowButtons.length)return null;const n=document.createElement("div");n.className="st-row-buttons",n.setAttribute("role","group"),n.setAttribute("aria-label","Actions for row "+(t.displayRowNumber+1));const o={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(o);if(!e)return;const s=document.createElement("span");s.className="st-row-button",s.appendChild(e),n.appendChild(s)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&o.appendChild(l),void n.appendChild(o)}const p=e.rowGrouping&&e.rowGrouping[a],w=!!p&&((t,e)=>!!e&&f(t[e]))(i,p),v=e.rowGrouping&&e.rowGrouping.length>a,g=!e.canExpandRowGroup||e.canExpandRowGroup(i);if(s.expandable&&(w&&v&&g||s.nestedTable||e.onRowGroupExpand&&v&&g)){const o=new Set(e.expandedDepths),s=((t,e,n)=>{const o=document.createElement("div");o.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("aria-label",n?"Collapse row":"Expand row"),o.setAttribute("tabindex","0");const s=e.icons.expand;s&&("string"==typeof s?o.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&o.appendChild(s.cloneNode(!0)));const i=n=>{n.stopPropagation();const{rowId:o,depth:s}=t,i=new Set(e.expandedDepths),r=e.getExpandedRows?e.getExpandedRows():e.expandedRows,l=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,a=m(o,s,i,r,l),d=!a;if(a?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(o,s),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(o),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(o),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(o,s),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(o),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{loading:t,triggerSection:n})),s})},0)},r=t=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{error:t,loading:!1,triggerSection:n})),s})},l=(t,s)=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{isEmpty:t,loading:!1,triggerSection:n})),s})};e.onRowGroupExpand({row:t.row,depth:s,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[s],isExpanded:d,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:r,setEmpty:l})}};return de(o,"click",i),de(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i(t))}),o})(t,e,m(d,a,o,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===s.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:s,fillColor:i,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const h=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=o,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",o+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const w=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",n),o.setAttribute("fill",i||"var(--st-chart-fill-color)"),o.setAttribute("fill-opacity",r+""),o.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",s||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(o),f.appendChild(a)};return w(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,f.setAttribute("height",o+"")),void 0!==t.color&&(s=t.color),void 0!==t.fillColor&&(i=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),w()):f.innerHTML=""},destroy:()=>{f.remove()}}})(Object.assign({data:t,width:"100%",height:30},s.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===s.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:s,gap:i=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=o,p=(100-i*(e.length-1))/e.length,f=0>d,w=f?u*(c/h):u,v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",n+""),v.setAttribute("height",o+""),v.setAttribute("viewBox","0 0 100 "+u),v.setAttribute("preserveAspectRatio","none"),v.setAttribute("class",("st-bar-chart "+r).trim()),v.setAttribute("shape-rendering","crispEdges"),v.style.display="block";const m=()=>{v.innerHTML="",e.forEach((t,e)=>{const n=e*(p+i),o=(t-d)/h*u;let r=u-o,l=o;f&&(0>t?(l=Math.abs(t)/h*u,r=w):(l=t/h*u,r=w-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",s||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),v.appendChild(a)})};return m(),{element:v,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,v.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,v.setAttribute("height",o+"")),void 0!==t.color&&(s=t.color),void 0!==t.gap&&(i=t.gap),void 0!==t.className&&(r=t.className,v.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):v.innerHTML=""},destroy:()=>{v.remove()}}})(Object.assign({data:t,width:"100%",height:30},s.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(s.cellRenderer){try{const a=s.cellRenderer({accessor:s.accessor,colIndex:l,row:i,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(o=s.valueFormatter)||void 0===o?void 0:o.call(s,{accessor:s.accessor,colIndex:l,row:i,rowIndex:r,value:c})});if("string"==typeof a||"number"==typeof a){const t=document.createTextNode(a+"");n.appendChild(t)}else if(a instanceof Node)n.appendChild(a);else if(null!=a&&"object"==typeof a){const t=De(c,s,l,i,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=De(c,s,l,i,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const x=De(c,s,l,i,r);if(null!==x){const t=document.createTextNode(x);n.appendChild(t)}},Le=new Map,je=new WeakMap;let Be=null;const Ne=(t,e)=>{const n=Le.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},ze=(t,e)=>{var n;const{header:o,rowIndex:s,colIndex:i,rowId:r,depth:l,isOdd:a}=t,d=o.isSelectionColumn&&e.enableRowSelection,c=!!(null==o?void 0:o.isEditable)||!(!e.onCellClick||d),h={rowIndex:s,colIndex:i,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),w=e.isCopyFlashing(h),v=e.isWarningFlashing(h),m=e.selectedColumns.has(i),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{var t,n,s;if(!e.columnBorders)return!1;const i=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===o.pinned?(null===(t=i[i.length-1])||void 0===t?void 0:t.accessor)===o.accessor:"right"===o.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===o.accessor:(null===(s=r[r.length-1])||void 0===s?void 0:s.accessor)===o.accessor})();return["st-cell",l>0&&o.expandable?"st-cell-depth-"+l:"",g?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",w?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",v?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?i%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},Ve=(t,e)=>{var n;const{header:o,row:s,rowIndex:i,colIndex:r,rowId:l}=t,a=o.isSelectionColumn&&e.enableRowSelection,c={rowIndex:i,colIndex:r,rowId:l},h=e.isInitialFocusedCell(c),f=ze(t,e),w=document.createElement("div");w.className=f,w.id=d({accessor:o.accessor,rowId:l}),w.setAttribute("role","gridcell"),w.setAttribute("tabindex",h?"0":"-1");const v=null!==(n=e.maxHeaderDepth)&&void 0!==n?n:1;w.setAttribute("aria-rowindex",t.tableRow.position+v+1+""),w.setAttribute("aria-colindex",r+1+""),w.setAttribute("data-row-index",i+""),w.setAttribute("data-col-index",r+""),w.setAttribute("data-row-id",l+""),w.setAttribute("data-accessor",o.accessor+""),w.style.position="absolute",w.style.left=t.left+"px",w.style.top=t.top+"px",w.style.width=t.width+"px",w.style.height=t.height+"px";let m=!1;const g="boolean"===o.type||"date"===o.type||"enum"===o.type,x=()=>{if(m&&!g){w.innerHTML="",w.setAttribute("tabindex","-1");const n=$e(t,e,()=>{m=!1,w.setAttribute("tabindex",h?"0":"-1"),x(),b()});if(n){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(n),w.appendChild(t)}}else if(m&&g)$e(t,e,()=>{m=!1,x(),b()});else{w.innerHTML="";const n=document.createElement("span");n.className="st-cell-content "+("right"===o.align?"right-aligned":"center"===o.align?"center-aligned":"left-aligned"),Fe(t,e,n),w.appendChild(n)}};x();const b=()=>{e.cellRegistry&&!a&&e.cellRegistry.set(`${l}-${o.accessor}`,{updateContent:t=>{m||(p(s,o.accessor,t),x(),e.cellUpdateFlash&&(w.classList.add(h?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{w.classList.remove("st-cell-updating-first","st-cell-updating")},800)))}})};if(b(),!m&&!a){const t=()=>{e.handleMouseOver(c)};de(w,"mousedown",t=>{t.preventDefault(),t.target.closest(".st-expand-icon-container")||e.handleMouseDown(c)}),de(w,"mouseover",t)}if(de(w,"keydown",t=>{m||a||"F2"!==t.key&&"Enter"!==t.key||!o.isEditable||m||(t.preventDefault(),m=!0,x())}),de(w,"dblclick",t=>{!o.isEditable||a||m||(m=!0,x())}),je.set(w,{current:s}),e.onCellClick&&!a){const t=t=>{var n,l,a;if(t.target.closest(".st-expand-icon-container"))return;const d=null!==(l=null===(n=je.get(w))||void 0===n?void 0:n.current)&&void 0!==l?l:s,c=u(d,o.accessor);null===(a=e.onCellClick)||void 0===a||a.call(e,{accessor:o.accessor,colIndex:r,row:d,rowIndex:i,value:c})};de(w,"click",t)}if(e.useHoverRowBackground){((t,e)=>{Le.has(t)||Le.set(t,new Set),Le.get(t).add(e)})(i,w);const t=()=>{Ne(i,!1),Be===i&&(Be=null)};de(w,"mouseenter",()=>{null!==Be&&Be!==i&&Ne(Be,!1),Ne(i,!0),Be=i}),de(w,"mouseleave",t)}return w},qe=t=>{const{position:e,rowHeight:n,displayStrongBorder:o,heightOffsets:s,customTheme:i=vt,isSticky:r=!1}=t,l=document.createElement("div");l.className="st-row-separator "+(o?"st-last-group-row":"");const a=r?e:J({position:e,rowHeight:n,heightOffsets:s,customTheme:i});l.style.width="100%",r?(l.style.position="absolute",l.style.top="0",l.style.left="0",l.style.transform=`translateY(${a}px)`):l.style.transform=`translate3d(0, ${a}px, 0)`;const d=document.createElement("div");d.style.width="100%",l.appendChild(d);let c=null;return l.addEventListener("mousedown",t=>{t.preventDefault();const e=l.style.pointerEvents;l.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(l.style.pointerEvents=e,!n)return;const o=n.closest(".st-cell");if(o instanceof HTMLElement){c=o;const e=o.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});o.dispatchEvent(n)}}),l.addEventListener("mouseup",t=>{if(c){const e=c.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});c.dispatchEvent(n),c=null}}),l},Ge=new WeakMap,Ue=new WeakMap,Ke=t=>(Ue.has(t)||Ue.set(t,new Map),Ue.get(t)),Je=(t,e,n,o=0,s,i)=>{var r,l,a,c,h;const u=n.pinned?null!==(l=null!==(r=n.containerWidth)&&void 0!==r?r:t.clientWidth)&&void 0!==l?l:0:null!==(h=null!==(c=null!==(a=n.mainSectionContainerWidth)&&void 0!==a?a:n.containerWidth)&&void 0!==c?c:t.clientWidth)&&void 0!==h?h:0,p=n.pinned?e:((t,e,n,o=100)=>{if(0===t.length)return[];const s=e-o,i=e+n+o;return t.filter(t=>t.left+t.width>=s&&i>=t.left)})(e,o,u),f=he(t),w=(t=>(Ge.has(t)||Ge.set(t,new Map),Ge.get(t)))(t),v=new Set(p.map(t=>d({accessor:t.header.accessor,rowId:t.rowId}))),g=(null==s?void 0:s.length)?new Set(s.map(t=>t.position)):new Set(p.map(t=>t.rowIndex));if(f.forEach((t,e)=>{if(!v.has(e)){const n=parseInt(t.getAttribute("data-row-index")||"-1",10);0>n||((t,e)=>{const n=Le.get(t);n&&(n.delete(e),0===n.size&&Le.delete(t))})(n,t),t.remove(),f.delete(e)}}),!i){const e=Ke(t);w.forEach((t,n)=>{g.has(n)||(t.remove(),w.delete(n),e.delete(n))})}const x=document.createDocumentFragment(),b=[];p.forEach(t=>{var e,o,s,r;const l=d({accessor:t.header.accessor,rowId:t.rowId});if(f.has(l)){const a=f.get(l);if(i)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px"})(a,t);else{if(((t,e,n)=>{var o;const{rowIndex:s,colIndex:i,rowId:r}=e,l={rowIndex:s,colIndex:i,rowId:r};t.className=ze(e,n);const a=n.isInitialFocusedCell(l);t.setAttribute("tabindex",a?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px",t.setAttribute("data-row-index",s+""),t.setAttribute("data-col-index",i+"");const d=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+d+1+""),t.setAttribute("aria-colindex",i+1+""),t.setAttribute("data-row-id",r+""),t.setAttribute("data-accessor",e.header.accessor+"");const c=je.get(t);if(c&&(c.current=e.row),!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",Fe(e,n,o))}})(a,t,n),t.header.isSelectionColumn&&n.enableRowSelection&&n.isRowSelected){const e=n.isRowSelected(t.rowId);ie(a,e)}if(t.header.expandable){const i=new Set(n.expandedDepths),l=null!==(o=null===(e=n.getExpandedRows)||void 0===e?void 0:e.call(n))&&void 0!==o?o:n.expandedRows,d=null!==(r=null===(s=n.getCollapsedRows)||void 0===s?void 0:s.call(n))&&void 0!==r?r:n.collapsedRows,c=m(t.rowId,t.depth,i,l,d);ue(a,c)}}}else b.push({cell:t,cellId:l})}),b.forEach(({cell:t,cellId:e})=>{const o=Ve(t,n);x.appendChild(o),f.set(e,o)}),x.childNodes.length>0&&t.appendChild(x),i||((t,e,n,o,s)=>{const i=Ke(t);let r=[];if(s&&s.length>0)r=s.map((t,e)=>({rowIndex:t.position,position:t.position,displayStrongBorder:e>0&&s[e-1].isLastGroupRow}));else if(e.length>0){const t=[];let n,o=-1,s=null;e.forEach(e=>{e.rowIndex!==o&&(s&&o>0&&t.push({rowIndex:o,firstCell:s,prevCell:n}),n=s||void 0,o=e.rowIndex,s=e)}),s&&o>0&&t.push({rowIndex:o,firstCell:s,prevCell:n}),r=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var o,s;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(s=null===(o=null==n?void 0:n.tableRow)||void 0===o?void 0:o.isLastGroupRow)&&void 0!==s&&s}})}0!==r.length&&r.forEach(({rowIndex:e,position:s,displayStrongBorder:r})=>{var l;const a=i.get(e);if(o.has(e)){const t=o.get(e);if(!a||a.position!==s||a.displayStrongBorder!==r){if((null==a?void 0:a.displayStrongBorder)!==r&&(r?t.classList.add("st-last-group-row"):t.classList.remove("st-last-group-row")),!a||a.position!==s){const e=J({position:s,rowHeight:n.rowHeight,heightOffsets:n.heightOffsets,customTheme:null!==(l=n.customTheme)&&void 0!==l?l:vt});t.style.transform=`translate3d(0, ${e}px, 0)`}i.set(e,{position:s,displayStrongBorder:r})}}else{const l=qe({position:s,rowHeight:n.rowHeight,displayStrongBorder:r,heightOffsets:n.heightOffsets,customTheme:n.customTheme,isSticky:!1});t.appendChild(l),o.set(e,l),i.set(e,{position:s,displayStrongBorder:r})}})})(t,p,n,w,s)};function Ye(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class _e{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:o,maxHeaderDepth:s,headerHeight:i,context:r,sectionWidth:l,startColIndex:a=0}=t,d=o||"main";let c=this.headerSections.get(d);c||(c=document.createElement("div"),c.className="left"===o?"st-header-pinned-left":"right"===o?"st-header-pinned-right":"st-header-main",c.setAttribute("role","rowgroup"),this.headerSections.set(d,c));const h=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===h.length)return c.style.display="none",c;c.style.display="",c.style.cssText=`\n position: relative;\n ${void 0!==l?`width: ${l}px;`:""}\n height: ${s*i}px;\n `;const u=this.getCachedHeaderCells(d,h,n,s,i,a),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,o),w=c.scrollLeft;return Oe(c,u,f,w),o||w===c.scrollLeft||(c.scrollLeft=w),!o&&c&&(c.__renderHeaderCells=t=>{c&&Oe(c,u,f,t)}),c}renderBodySection(t){var e,n;const{headers:o,rows:s,collapsedHeaders:i,pinned:r,context:l,sectionWidth:a,rowHeight:d,heightOffsets:c,totalRowCount:h,startColIndex:u=0,positionOnly:p=!1,fullTableRows:f,renderedStartIndex:w,renderedEndIndex:v}=t,m=r||"main";let g=this.bodySections.get(m);g||(g=document.createElement("div"),g.className="left"===r?"st-body-pinned-left":"right"===r?"st-body-pinned-right":"st-body-main",g.setAttribute("role","rowgroup"),this.bodySections.set(m,g));const x=o.filter(t=>"left"===r?"left"===t.pinned:"right"===r?"right"===t.pinned:!t.pinned);if(0===x.length)return g.style.display="none",g;g.style.display="";const b=((t,e,n,o)=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==h?h:s.length,d,c,null!==(e=l.customTheme)&&void 0!==e?e:vt);g.style.cssText=`\n position: relative;\n ${void 0!==a?`width: ${a}px;`:""}\n ${r?"":"flex-grow: 1;"}\n height: ${b}px;\n `;const y=this.getCachedBodyCells(m,x,s,i,d,c,null!==(n=l.customTheme)&&void 0!==n?n:vt,u,f,w,v),R=y.length>0?Math.max(...y.map(t=>t.colIndex))+1:u;this.nextColIndexMap.set(m,R);const C=this.getCachedContext("body-"+m,l,r);return Je(g,y,C,g.scrollLeft,s,p),this.renderNestedGridRows(g,m,s,r,C),r||this.renderStateRows(g,m,s,C),!r&&g&&(g.__renderBodyCells=t=>{g&&Je(g,y,C,t,s,!0)}),g}renderNestedGridRows(t,e,n,o,s){var i;const r=n.filter(t=>t.nestedTable),l=new Set(r.map(t=>t.position));let a=this.nestedGridRowsMap.get(e);a||(a=new Map,this.nestedGridRowsMap.set(e,a)),a.forEach((t,e)=>{var n;l.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),a.delete(e))});const d={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(i=s.customTheme)&&void 0!==i?i:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons};r.forEach(e=>{var n;const i=e.position;if(!a.get(i))if(o){const o=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const o=t.nestedTable.expandableHeader.nestedTable,s=c({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),i=Y({position:t.position,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme}),r=document.createElement("div");return r.className="st-row st-nested-grid-spacer",r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${i}px, 0)`,r.style.height=s+"px",r.style.pointerEvents="none",r}(e,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(n=s.customTheme)&&void 0!==n?n:{}});t.appendChild(o),a.set(i,{element:o})}else{d.depth=e.depth>0?e.depth-1:0;const{element:n,cleanup:o}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:o,heightOffsets:s,customTheme:i,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:h,emptyStateRenderer:p,icons:f}=e,{parentRow:w,expandableHeader:v,childAccessor:m,calculatedHeight:g}=n,x=v.nestedTable;if(!x)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=u(w,m),y=Array.isArray(b)?b:[],R=l&&l[a+1]?l.slice(a+1):void 0,C=x.customTheme?Object.assign(Object.assign({},i),x.customTheme):i,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:g,customHeight:x.height,customTheme:i}),I=c({calculatedHeight:g,customHeight:x.height,customTheme:i}),H=Y({position:t.position,rowHeight:o,heightOffsets:s,customTheme:i}),M=document.createElement("div");M.className="st-row st-nested-grid-row",M.dataset.index=t.position+"",M.style.position="absolute",M.style.left="0",M.style.right="0",M.style.transform=`translate3d(0, ${H}px, 0)`,M.style.height=I+"px",M.style.paddingTop=i.nestedGridPaddingTop+"px",M.style.paddingBottom=i.nestedGridPaddingBottom+"px",M.style.paddingLeft=i.nestedGridPaddingLeft+"px",M.style.paddingRight=i.nestedGridPaddingRight+"px",M.style.boxSizing="border-box";const k=document.createElement("div");k.style.height="100%",k.style.width="100%",M.appendChild(k);const E=Object.assign(Object.assign({},x),{defaultHeaders:x.defaultHeaders,rows:y,theme:r,customTheme:C,height:S,rowGrouping:R,loadingStateRenderer:d,errorStateRenderer:h,emptyStateRenderer:p,icons:f}),O=new vn(k,E);O.mount();const T=()=>{O.destroy()};return M.__nestedTableCleanup=T,{element:M,cleanup:T}}(e,d);t.appendChild(n),a.set(i,{element:n,cleanup:o})}})}renderStateRows(t,e,n,o){var s;const i=n.filter(t=>t.stateIndicator),r=new Set(i.map(t=>t.position));let l=this.stateRowsMap.get(e);l||(l=new Map,this.stateRowsMap.set(e,l)),l.forEach((t,e)=>{r.has(e)||(t.remove(),l.delete(e))});const a={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};i.forEach((e,n)=>{var s,i;const r=e.position,d=l.get(r);if(d){const t=Y({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}});return void(d.style.transform=`translate3d(0, ${t}px, 0)`)}const c=((t,e)=>{const{position:n,stateIndicator:o}=t;if(!o)throw Error("createStateRow called without stateIndicator");const s=document.createElement("div");s.className="st-row st-state-row",s.dataset.index=e.index+"",s.style.width="100%",s.style.transform=`translate3d(0, ${Y({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,s.style.height=e.rowHeight+"px";const i=document.createElement("div");i.className="st-cell st-state-row-cell",i.style.width="100%",i.style.padding="0";let r=null;return o.state.loading&&e.loadingStateRenderer?r=Ye(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=Ye(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=Ye(e.emptyStateRenderer,{message:o.state.emptyMessage,parentRow:o.parentRow})),r&&("string"==typeof r?i.textContent=r:r instanceof HTMLElement&&i.appendChild(r)),s.appendChild(i),s})(e,Object.assign(Object.assign({},a),{index:n})),h=Y({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}});c.style.position="absolute",c.style.transform=`translate3d(0, ${h}px, 0)`,c.style.width="100%",t.appendChild(c),l.set(r,c)})}calculateAbsoluteHeaderCells(t,e,n,o,s=0){const i=[];let r=s,l=0;const a=(t,s,d)=>{if(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;i.push({header:t,left:l,top:s*o,width:c,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,s,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return i.push({header:t,left:l,top:s*o,width:e,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}const h=l;let u=0;return e.forEach(e=>{u+=a(e,s+1,t)}),i.push({header:t,left:h,top:s*o,width:u,height:o,colIndex:r,parentHeader:d}),r++,u}{const e="number"==typeof t.width?t.width:150;return i.push({header:t,left:l,top:s*o,width:e,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),i}calculateAbsoluteBodyCells(t,e,n,o,s,i,r=0){const l=[],a=e.filter(t=>!t.nestedTable&&!t.stateIndicator),d=this.getLeafHeaders(t,n),c=new Map;let h=0;return d.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:h,width:e}),h+=e}),a.forEach((t,e)=>{const n=i?Y({position:t.position,rowHeight:o,heightOffsets:s,customTheme:i}):e*o;d.forEach((s,i)=>{var a,d;const h=c.get(s.accessor);l.push({header:s,row:t.row,rowIndex:e,colIndex:r+i,rowId:v(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:e%2==1,tableRow:t,left:null!==(a=null==h?void 0:h.left)&&void 0!==a?a:0,top:n,width:null!==(d=null==h?void 0:h.width)&&void 0!==d?d:150,height:o})})}),l}getLeafHeaders(t,e){const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const s=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return s?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");if(e+=t.sort?`|sort:${t.sort.key.accessor}-${t.sort.direction}`:"|sort:none",e+=t.filters&&Object.keys(t.filters).length>0?"|filters:"+JSON.stringify(t.filters):"|filters:none",t.expandedRows&&(e+="|expandedRows:"+t.expandedRows.size),t.collapsedRows&&(e+="|collapsedRows:"+t.collapsedRows.size),t.expandedDepths&&(e+="|expandedDepths:"+(Array.isArray(t.expandedDepths)?t.expandedDepths.length:t.expandedDepths.size)),null!=t.collapsedHeaders){const n=t.collapsedHeaders.size;e+=`|collapsedHeaders:${n}:${0===n?"":Array.from(t.collapsedHeaders).sort().join(",")}`}return void 0!==t.selectedRowCount&&(e+="|selectedRowCount:"+t.selectedRowCount),t.selectedColumns&&void 0!==t.selectedColumns.size&&(e+="|selectedColumns:"+Array.from(t.selectedColumns).sort((t,e)=>t-e).join(",")),t.columnsWithSelectedCells&&void 0!==t.columnsWithSelectedCells.size&&(e+="|columnsWithSelectedCells:"+Array.from(t.columnsWithSelectedCells).sort((t,e)=>t-e).join(",")),t.rowsWithSelectedCells&&void 0!==t.rowsWithSelectedCells.size&&(e+="|rowsWithSelectedCells:"+Array.from(t.rowsWithSelectedCells).sort().join(",")),e}getCachedBodyCells(t,e,n,o,s,i,r,l=0,a,d,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(i),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t);if(f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===s&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&f.deps.renderedStartIndex===d&&f.deps.renderedEndIndex===c:f.deps.rowsRef===n))return f.cells;const w=p?a.slice(d,c):n,v=this.calculateAbsoluteBodyCells(e,w,o,s,i,r,l);return this.bodyCellsCache.set(t,{cells:v,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:o.size,rowHeight:s,heightOffsetsHash:u},p&&{fullTableRowsRef:a,renderedStartIndex:d,renderedEndIndex:c})}),v}getCachedHeaderCells(t,e,n,o,s,i=0){const r=this.headerCellsCache.get(t),l=this.createHeadersHash(e);if(r&&r.deps.headersHash===l&&r.deps.collapsedHeadersSize===n.size&&r.deps.maxDepth===o&&r.deps.headerHeight===s)return r.cells;const a=this.calculateAbsoluteHeaderCells(e,n,o,s,i);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:o,headerHeight:s}}),a}getCachedContext(t,e,n){const o=this.contextCache.get(t),s=this.createContextHash(e);if(o&&o.deps.contextHash===s)return o.context;const i=Object.assign(Object.assign({},e),{pinned:n});return this.contextCache.set(t,{context:i,deps:{contextHash:s}}),i}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?(this.headerCellsCache.clear(),this.headerSections.forEach(t=>{Ut(t)})):"context"===t&&(this.contextCache.clear(),this.headerSections.forEach(t=>{Ut(t)})):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{(t=>{if(t){const e=he(t);e.forEach(t=>{t.remove()}),e.clear()}})(t)}),this.headerSections.forEach(t=>{Ut(t)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const Xe=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Qe=(t,e,n=new Set)=>{for(const o of t)if(!n.has(o.accessor)&&(n.add(o.accessor),o.children&&o.children.length>0)){const t=o.children.some(t=>t.accessor===e);let s=!1;if(!t)for(const t of o.children)if(Qe([t],e,n),!1===t.hide){s=!0;break}(t||s)&&(o.hide=!1)}},Ze=t=>t.every(t=>t.hide),tn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(tn(t.children),Ze(t.children)&&(t.hide=!0))})},en=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>en(t,e))},nn=(t,e,n)=>{if(!e.trim())return t;const o=n||en;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function on(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function sn(t,e,n,o,s,i,r){const l=e({headers:n,searchSection:o,listSection:s,resetSection:i,resetColumns:r});if(l instanceof HTMLElement)t.appendChild(l);else if("string"==typeof l){const e=document.createElement("div");e.innerHTML=l,t.appendChild(e)}}const rn=t=>{let e=t,{headers:n,open:o,searchEnabled:s,searchPlaceholder:i,searchFunction:r,columnEditorConfig:l,contextHeaders:a,essentialAccessors:d,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,resetColumns:p}=e,f="",w=null,v=null,m=!1;const g=new Set,x=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),x(t.children))})};x(n);let b=g;const y=document.createElement("div");y.className="st-column-editor-popout "+(o?"open":"");const R=document.createElement("div");R.className="st-column-editor-popout-content",R.addEventListener("click",t=>t.stopPropagation());let C=null,S=null;if(s){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const o=document.createElement("input");return o.type="text",o.value="",o.placeholder=t,o.className="st-filter-input",o.addEventListener("click",t=>t.stopPropagation()),o.addEventListener("input",t=>{f=t.target.value,P()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(i);S=t.wrapper,C=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let H=null;p&&(H=function(t){const e=document.createElement("div");e.className="st-column-editor-footer";const n=document.createElement("button");return n.type="button",n.className="st-column-editor-reset-btn",n.textContent="Reset columns",n.addEventListener("click",e=>{e.stopPropagation(),t()}),e.appendChild(n),e}(p));let M=l.customRenderer;M?sn(R,M,n,S,I,H,p):on(R,S,I,H),y.appendChild(R);const k=t=>{w=t,null!==t?m=!0:(m=!1,P())},E=()=>{v=null},O=t=>{v=t,m?A():P()},T=t=>{const e=b;b=t,P(e)},A=()=>{I.querySelectorAll(".st-column-editor-drag-separator").forEach((t,e)=>{const n=t;n.style.opacity=0===e?-1===v?"1":"0":v===e-1?"1":"0"})},W=(t,e,o,i,p)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(s?nn(m,f,r):m).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,i.appendChild(t)}const g=document.createElement("div");g.className="st-column-editor-list st-column-editor-list-section",i.appendChild(g);const x=((t,e)=>{const n=s?nn(t,f,r):t,o=[],i=s&&f.trim().length>0,l=({headers:t,depth:n=0,parent:s=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];o.push({header:t,visualIndex:o.length,depth:n,parent:s,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=i||b.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),o})(t,e),y=(t=>t.some(t=>t.children&&t.children.length>0))(t);x.forEach(t=>{var o;const i=(t=>{var e;const{allHeaders:n,clearHoverSeparator:o,depth:s,doesAnyHeaderHaveChildren:i,draggingRow:r,getDraggingRow:l,getHoveredSeparatorIndex:a,expandedHeaders:d,flattenedHeaders:c,forceExpanded:h,header:u,hoveredSeparatorIndex:p,panelSection:f,rowIndex:w,setDraggingRow:v,setExpandedHeaders:m,setHoveredSeparatorIndex:g,headers:x,setHeaders:b,onColumnVisibilityChange:y,onColumnOrderChange:R,previousExpandedHeaders:C}=t,S=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,H=St(u,S),M=!H,k=document.createDocumentFragment(),E=16*s+"px",O=u.children&&u.children.length>0,T=!(u.hide||O&&u.children&&Ze(u.children)),A=d.has(u.accessor),W=h||A;let P;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=-1===p?"1":"0",k.appendChild(t)}const $=document.createElement("div");$.className="st-header-checkbox-item",$.style.paddingLeft=E,$.draggable=!0;const D=t=>!(S.size>0&&!Ht(t,S)||(null==R||R(t),b(t),0)),F=t=>{if(t.stopPropagation(),h)return;const e=new Set(d);A?e.delete(u.accessor):e.add(u.accessor),m(e)};let L;if($.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),v(c[w])}),$.addEventListener("dragenter",t=>{t.preventDefault()}),$.addEventListener("dragover",t=>{t.preventDefault();const e=l?l():r;if(e&&e.panelSection===f){const n=t.currentTarget.getBoundingClientRect(),o=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:o})=>{var s,i;const r=t[n];if(r.depth===e.depth)return(null===(s=r.parent)||void 0===s?void 0:s.accessor)!==(null===(i=e.parent)||void 0===i?void 0:i.accessor)?null:o||r.header.children?n-1:n;if(r.depth>e.depth){let s=r,i=n;for(;s.parent&&s.depth>e.depth;){const e=s.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;s=t[n],i=n}const l=i;let a=i;for(let e=i+1;t.length>e&&t[e].depth>s.depth;e++)a=e;const d=a-l+1,c=n-l;let h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=o),h?i-1:a}return null})({flattenedHeaders:c,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});g(o)}}),$.addEventListener("dragend",()=>{const t=l?l():r,e=a?a():p,n=()=>{v(null),g(null)};if(!t||null===e||t.panelSection!==f)return void n();let o,s=c[e>t.visualIndex?e:e+1];if(s){if(s.depth>t.depth&&s.parent){const t=c.findIndex(t=>t.header.accessor===s.parent.accessor);-1!==t&&(s=c[t])}if(t.header.accessor!==s.header.accessor)if(t.indexPath.length!==s.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===s.indexPath[e]))n();else{if(1===t.indexPath.length){const{newHeaders:e,emergencyBreak:i}=we(x,t.indexPath,s.indexPath);if(i)return void n();o=e}else{const{newHeaders:e,emergencyBreak:i}=we(x,t.indexPath,s.indexPath);if(i)return void n();o=e}D(o),n()}else n()}else n()}),i){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==C?h||C.has(u.accessor):W,n=!h&&void 0!==C&&t!==W,o=n?t:W,s=document.createElement("div");s.className="st-collapsible-header-icon st-expand-icon-container "+(o?"expanded":"collapsed"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",o+""),s.setAttribute("aria-label",o?`Collapse ${u.label} column`:`Expand ${u.label} column`),s.appendChild(gt("st-expand-icon")),s.addEventListener("click",F),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),F(t))}),e.appendChild(s),L=s,n&&(P=()=>{ue($,W,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||$.appendChild(e)}const j=re({checked:T,onChange:t=>{if(!M)return;u.hide=!t,t?(Qe(n,u.accessor),O&&u.children&&u.children.length>0&&u.children.every(t=>!0===t.hide)&&u.children[0]&&(u.children[0].hide=!1,Qe(n,u.children[0].accessor))):tn(n);const e=[...x];if(b(ft(e)),y){const t=(t=>{const e={},n=t=>{e[t.accessor]=!t.hide,t.children&&t.children.length>0&&t.children.forEach(n)};return t.forEach(n),e})(e);y(t)}}});M||(j.element.classList.add("st-checkbox-disabled"),j.element.style.pointerEvents="none");const B=document.createElement("div");B.className="st-drag-icon-container",B.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const N=document.createElement("div");N.className="st-column-label-container",N.textContent=u.label;const z="left"===u.pinned||"right"===u.pinned?u.pinned:null,V=!!z&&!H,q=!z&&"main"===f,G=!z&&"main"===f,U=()=>{const t=Tt(x,u.accessor,"left",S);t&&D(t)},K=()=>{const t=Tt(x,u.accessor,"right",S);t&&D(t)},J=()=>{const t=Tt(x,u.accessor,"main",S);t&&D(t)},{rowRenderer:Y}=t.columnEditorConfig;if(Y){const t=Y({accessor:u.accessor,header:u,components:{expandIcon:L,checkbox:j.element,dragIcon:B,labelContent:N},panelSection:f,isEssential:H,canToggleVisibility:M,allowColumnPinning:I,pinControl:I&&0===s?{pinnedSide:z,canPinLeft:q,canPinRight:G,canUnpin:V,pinLeft:U,pinRight:K,unpin:J}:void 0});t instanceof HTMLElement?$.appendChild(t):"string"==typeof t&&($.innerHTML=t)}else if($.appendChild(j.element),$.appendChild(B),$.appendChild(N),I&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",z){const e=document.createElement("div"),n=H;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===z?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",V&&e.addEventListener("click",t=>{t.stopPropagation(),J()}),t.appendChild(e)}else{if(q){const e=document.createElement("button");e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="L",e.title="Pin column to left",e.addEventListener("click",t=>{t.stopPropagation(),U()}),t.appendChild(e)}if(G){const e=document.createElement("button");e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="R",e.title="Pin column to right",e.addEventListener("click",t=>{t.stopPropagation(),K()}),t.appendChild(e)}}$.appendChild(t)}k.appendChild($);const _=document.createElement("div");return _.className="st-column-editor-drag-separator",_.style.opacity=p===w?"1":"0",k.appendChild(_),{fragment:k,scheduleExpandIconAnimation:P}})({allHeaders:n,clearHoverSeparator:E,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:w,getDraggingRow:()=>w,getHoveredSeparatorIndex:()=>v,expandedHeaders:b,flattenedHeaders:x,forceExpanded:s&&f.trim().length>0,header:t.header,hoveredSeparatorIndex:v,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:T,setHoveredSeparatorIndex:O,columnEditorConfig:l,essentialAccessors:null!=d?d:new Set,headers:a,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:p});g.appendChild(i.fragment),null===(o=i.scheduleExpandIconAnimation)||void 0===o||o.call(i)})},P=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:o,unpinned:s,pinnedRight:i}=Ct(n);if(e)W(o,"left","Pinned Left",I,t),W(s,"main",null,I,t),W(i,"right","Pinned Right",I,t);else{const e=[...o,...s,...i];W(e,"main",null,I,t)}};return P(),{element:y,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(s=t.searchEnabled),void 0!==t.searchPlaceholder&&(i=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),void 0!==t.contextHeaders&&(a=t.contextHeaders),void 0!==t.essentialAccessors&&(d=t.essentialAccessors),void 0!==t.setHeaders&&(c=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(h=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(u=t.onColumnOrderChange),void 0!==t.resetColumns&&(p=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==M&&(M=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?y.classList.add("open"):y.classList.remove("open")),C&&void 0!==t.searchPlaceholder&&(C.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",M?sn(R,M,n,S,I,H,p):on(R,S,I,H)),P()},destroy:()=>{C&&(C.removeEventListener("input",()=>{}),C.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},ln=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),o=t.querySelector(".st-horizontal-scrollbar-middle"),s=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),s instanceof HTMLElement&&e.unregisterPane("pinned-right",s)}t.remove()},an=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:s,treeTransitionOffset:i,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:p,sectionScrollController:f}=t,w=document.createElement("div");w.className=h?"st-sticky-section-"+h:"st-sticky-section-main",w.style.position="relative",w.style.height=o+"px",h&&u?(w.style.width=u+"px",w.style.flexGrow="0",w.style.flexShrink="0"):w.style.flexGrow="1";const m=((t,e)=>{const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const s=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return s?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n})(e,c),g=new Map;let x=0;return m.forEach(t=>{const e="number"==typeof t.width?t.width:150;g.set(t.accessor,{left:x,width:e}),x+=e}),n.forEach((t,e)=>{const o=-1!==s&&e>=s,c=o?i:0,h=e*(r+1)+c,u=o?e:n.length-e,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),m.forEach((e,n)=>{var o,s;const i=g.get(e.accessor),l={header:e,row:t.row,rowIndex:t.position,colIndex:n,rowId:v(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(o=null==i?void 0:i.left)&&void 0!==o?o:0,top:0,width:null!==(s=null==i?void 0:i.width)&&void 0!==s?s:150,height:r},a=Ve(l,d);p.appendChild(a)}),w.appendChild(p);const f=qe({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0});w.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",w,"sticky"),w},dn=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),o=t.querySelector(".st-sticky-section-main"),s=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),s instanceof HTMLElement&&e.unregisterPane("pinned-right",s)}t.remove()};class cn{constructor(){this.footerInstance=null,this.columnEditorInstance=null,this.horizontalScrollbarRef={current:null},this.scrollbarTimeoutId=null,this.stickyParentsContainer=null,this.sectionScrollController=null,this.renderScheduled=!1,this.pendingRenderCallback=null,this.sectionRenderer=new _e}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}renderHeader(t,e,n,o){var s,i,r,l,a,d,c,h,u,p,f,w;if(!t||o.config.hideHeader)return;t.style.height=e+"px";const v=wt(o.effectiveHeaders,"left")||wt(o.effectiveHeaders,void 0)||wt(o.effectiveHeaders,"right");t.style.minHeight=v?"":e+"px",t.setAttribute("aria-rowcount",1+o.localRows.length+""),t.setAttribute("aria-colcount",o.effectiveHeaders.length+"");const m=null!==(i=null===(s=o.dimensionManager)||void 0===s?void 0:s.getState())&&void 0!==i?i:{containerWidth:0,calculatedHeaderHeight:o.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:g,leftWidth:x,rightWidth:b}=ve({headers:o.effectiveHeaders,containerWidth:m.containerWidth,collapsedHeaders:o.collapsedHeaders}),y=null===(r=o.sortManager)||void 0===r?void 0:r.getState(),R=null===(l=o.filterManager)||void 0===l?void 0:l.getState(),C=null!==(d=null===(a=o.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,S=Object.assign(Object.assign({reverse:!1,collapsedHeaders:o.collapsedHeaders,getCollapsedHeaders:o.getCollapsedHeaders,columnBorders:null!==(c=o.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=o.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=o.config.columnResizing)&&void 0!==u&&u,containerWidth:m.containerWidth,mainSectionContainerWidth:g,enableHeaderEditing:o.config.enableHeaderEditing,enableRowSelection:o.config.enableRowSelection,selectedRowCount:C,filters:null!==(p=null==R?void 0:R.filters)&&void 0!==p?p:{},icons:o.resolvedIcons},o.config.selectableColumns&&o.selectionManager?{selectedColumns:o.selectionManager.getSelectedColumns(),columnsWithSelectedCells:o.selectionManager.getColumnsWithSelectedCells()}:{selectedColumns:new Set,columnsWithSelectedCells:new Set}),{sort:null!==(f=null==y?void 0:y.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(w=o.config.autoExpandColumns)&&void 0!==w&&w,essentialAccessors:o.essentialAccessors,selectableColumns:o.config.selectableColumns,headers:o.effectiveHeaders,rows:o.localRows,headerHeight:o.customTheme.headerHeight,lastHeaderIndex:o.effectiveHeaders.length-1,onSort:t=>{o.sortManager&&o.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{o.filterManager&&o.filterManager.updateFilter(t)},handleClearFilter:t=>{o.filterManager&&o.filterManager.clearFilter(t)},handleSelectAll:t=>{var e;null===(e=o.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{o.setCollapsedHeaders("function"==typeof t?t(o.collapsedHeaders):t),o.onRender()},setHeaders:t=>{o.setHeaders("function"==typeof t?t(o.getHeaders()):t),o.onRender()},setIsResizing:t=>{o.setIsResizing("function"==typeof t?t(o.isResizing):t)},onColumnWidthChange:o.config.onColumnWidthChange,onColumnOrderChange:o.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{o.setHeaders(t),o.onRender()},onHeaderEdit:o.config.onHeaderEdit,onColumnSelect:o.config.onColumnSelect,selectColumns:o.selectionManager&&o.config.selectableColumns?(t,e)=>{o.selectionManager.selectColumns(t,e),o.onRender()}:t=>{},setSelectedColumns:o.selectionManager&&o.config.selectableColumns?t=>{const e=o.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;o.selectionManager.setSelectedColumns(n),o.onRender()}:t=>{},setSelectedCells:o.selectionManager?t=>{var e;const n=o.selectionManager.getSelectedCells(),s="function"==typeof t?t(n):t;o.selectionManager.setSelectedCells(s instanceof Set?s:new Set),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},setInitialFocusedCell:o.selectionManager?t=>{var e;o.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=o.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:o.draggedHeaderRef,hoveredHeaderRef:o.hoveredHeaderRef,headerRegistry:o.headerRegistry,forceUpdate:()=>o.onRender(),mainBodyRef:o.mainBodyRef,pinnedLeftRef:o.pinnedLeftRef,pinnedRightRef:o.pinnedRightRef}),I=o.effectiveHeaders.filter(t=>"left"===t.pinned),H=o.effectiveHeaders.filter(t=>!t.pinned),M=o.effectiveHeaders.filter(t=>"right"===t.pinned);let k=0;const E=[];if(I.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:x,startColIndex:k});o.pinnedLeftHeaderRef.current=e,E.push(e),t.contains(e)||t.appendChild(e),k=this.sectionRenderer.getNextColIndex("left")}if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:g,startColIndex:k});o.mainHeaderRef.current=e,E.push(e),t.contains(e)||t.appendChild(e),k=this.sectionRenderer.getNextColIndex("main")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:b,startColIndex:k});o.pinnedRightHeaderRef.current=e,E.push(e),t.contains(e)||t.appendChild(e)}Array.from(t.children).forEach(t=>{E.includes(t)||t.remove()})}renderBody(t,e,n){var o,s,i,r,l,a,d,c,h,u,p,f,w,v,m,g,x,b,y;if(!t)return;if(wt(n.effectiveHeaders,"left")||wt(n.effectiveHeaders,void 0)||wt(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(s=null===(o=null==e?void 0:e.heightMap)||void 0===o?void 0:o.totalHeight)&&void 0!==s?s:0;t.style.minHeight=n+"px"}const R=e.rowsToRender||e.currentTableRows,C=!n.internalIsLoading&&0===e.currentTableRows.length;if(n.selectionManager&&e.currentTableRows&&n.selectionManager.updateConfig({tableRows:e.currentTableRows,headers:n.effectiveHeaders,collapsedHeaders:n.collapsedHeaders},{positionOnlyBody:n.positionOnlyBody}),C){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const S=null!==(r=null===(i=n.dimensionManager)||void 0===i?void 0:i.getState())&&void 0!==r?r:{containerWidth:0,calculatedHeaderHeight:n.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:I,leftWidth:H,rightWidth:M}=ve({headers:n.effectiveHeaders,containerWidth:S.containerWidth,collapsedHeaders:n.collapsedHeaders}),k=null!==(a=null===(l=n.rowSelectionManager)||void 0===l?void 0:l.getSelectedRowCount())&&void 0!==a?a:0,E=null!==(d=S.maxHeaderDepth)&&void 0!==d?d:1,O={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(h=null===(c=n.selectionManager)||void 0===c?void 0:c.getSelectedColumns())&&void 0!==h?h:new Set,rowsWithSelectedCells:null!==(p=null===(u=n.selectionManager)||void 0===u?void 0:u.getRowsWithSelectedCells())&&void 0!==p?p:new Set,columnBorders:null!==(f=n.config.columnBorders)&&void 0!==f&&f,enableRowSelection:n.config.enableRowSelection,selectedRowCount:k,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:n.config.useHoverRowBackground,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:E,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:S.containerWidth,mainSectionContainerWidth:I,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var o;null===(o=n.rowSelectionManager)||void 0===o||o.handleRowSelect(t,e)},cellRegistry:n.cellRegistry,getCollapsedRows:()=>n.getCollapsedRows(),getExpandedRows:()=>n.getExpandedRows(),setCollapsedRows:t=>{n.setCollapsedRows("function"==typeof t?t(n.getCollapsedRows()):t),this.scheduleRender(n.onRender)},setExpandedRows:t=>{n.setExpandedRows("function"==typeof t?t(n.getExpandedRows()):t),this.scheduleRender(n.onRender)},setRowStateMap:t=>{n.setRowStateMap("function"==typeof t?t(n.getRowStateMap()):t),this.scheduleRender(n.onRender)},icons:n.resolvedIcons,theme:null!==(w=n.config.theme)&&void 0!==w?w:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,getBorderClass:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.getBorderClass(t))||""},isSelected:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isSelected(t))||!1},isInitialFocusedCell:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isInitialFocusedCell(t))||!1},isCopyFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isCopyFlashing(t))||!1},isWarningFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isWarningFlashing(t))||!1},handleMouseDown:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseDown(t)},handleMouseOver:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseOver(t)},isRowSelected:t=>{var e,o;return null!==(o=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==o&&o},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading},T=n.effectiveHeaders.filter(t=>"left"===t.pinned),A=n.effectiveHeaders.filter(t=>!t.pinned),W=n.effectiveHeaders.filter(t=>"right"===t.pinned);let P=0;const $=[];if(T.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:R,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:O,sectionWidth:H,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:P,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedLeftRef.current=o,$.push(o),t.contains(o)||t.appendChild(o),P=this.sectionRenderer.getNextColIndex("left")}if(A.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:R,collapsedHeaders:n.collapsedHeaders,context:O,sectionWidth:I,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:P,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.mainBodyRef.current=o,$.push(o),t.contains(o)||t.appendChild(o),P=this.sectionRenderer.getNextColIndex("main")}if(W.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:R,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:O,sectionWidth:M,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:P,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedRightRef.current=o,$.push(o),t.contains(o)||t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(dn(this.stickyParentsContainer,null!==(v=n.sectionScrollController)&&void 0!==v?v:null),this.stickyParentsContainer=null);const o=null!==(g=null===(m=n.mainBodyRef.current)||void 0===m?void 0:m.scrollTop)&&void 0!==g?g:0;this.stickyParentsContainer=((t,e)=>{const{stickyParents:n}=t;if(0===n.length)return null;const{treeTransitionOffset:o,offsetStartIndex:s}=((t,e,n,o,s,i)=>{var r,l;if(0===t.length)return{treeTransitionOffset:0,offsetStartIndex:-1};const a=e[0];if(!a)return{treeTransitionOffset:0,offsetStartIndex:-1};let d;if((null==a?void 0:a.parentIndices)&&a.parentIndices.length>0)for(let e=a.parentIndices.length-1;e>=0;e--){const n=a.parentIndices[e];if(t.some(t=>t.position===n)){d=n;break}}const c=void 0!==d?t.findIndex(t=>t.position===d):-1;let h=-1;for(let e=0;t.length>e;e++){const n=t[e],o=t[e+1];if(!o)break;if(o.depth===n.depth){h=e;break}if(n.depth>o.depth){h=t.findIndex(t=>t.depth===n.depth);break}}if(-1===h)return{treeTransitionOffset:0,offsetStartIndex:c};const u=null===(r=t[h])||void 0===r?void 0:r.position;if(void 0===u)return{treeTransitionOffset:0,offsetStartIndex:c};let p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let w;return w=n?n.rowTopPositions[f.position]:f.position*(o+s.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*o+Math.max(0,i-w)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),i=n.length>0?n.length*(e.rowHeight+1)+o:0,r=`calc(100% - ${t.scrollbarWidth}px - ${e.editColumns?"29.5px":"0px"})`,l=document.createElement("div");l.className="st-sticky-top",l.style.height=i+"px",l.style.width=r,l.style.top=t.calculatedHeaderHeight+"px";const a=e.headers.filter(t=>!t.pinned),d=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const r=an({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:i,offsetStartIndex:s,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:d});l.appendChild(r)}const c=an({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:s,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:a,stickyHeight:i,stickyParents:n,treeTransitionOffset:o,sectionScrollController:d});if(l.appendChild(c),t.pinnedRightColumns.length>0){const r=an({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:i,offsetStartIndex:s,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:d});l.appendChild(r)}return l})({calculatedHeaderHeight:S.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:T,pinnedLeftWidth:H,pinnedRightColumns:W,pinnedRightWidth:M,scrollTop:o,scrollbarWidth:n.mainBodyRef.current?n.mainBodyRef.current.offsetWidth-n.mainBodyRef.current.clientWidth:0,stickyParents:e.stickyParents},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(x=n.config.editColumns)&&void 0!==x&&x,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:O,sectionScrollController:null!==(b=n.sectionScrollController)&&void 0!==b?b:null}),this.stickyParentsContainer&&($.push(this.stickyParentsContainer),t.contains(this.stickyParentsContainer)||t.appendChild(this.stickyParentsContainer))}else this.stickyParentsContainer&&(dn(this.stickyParentsContainer,null!==(y=n.sectionScrollController)&&void 0!==y?y:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{$.includes(t)||t.remove()})}renderFooter(t,e,n,o,s){var i,r,l,a,d,c,h,u,p,f,w;if(!t)return;const v=!!s.config.footerRenderer;if(!v&&(!s.config.shouldPaginate||s.config.hideFooter))return void(t.innerHTML="");const m=null!==(i=s.config.rowsPerPage)&&void 0!==i?i:10,g=Math.ceil(e/m);if(v){const i=(n-1)*m+1,a=s.config.footerRenderer({currentPage:n,endRow:Math.min(n*m,e),hasNextPage:g>n,hasPrevPage:n>1,nextIcon:null===(r=s.resolvedIcons)||void 0===r?void 0:r.next,onNextPage:async()=>{g>n&&(o(n+1),s.config.onNextPage&&await s.config.onNextPage(n+1))},onPageChange:o,onPrevPage:()=>{n>1&&o(n-1)},prevIcon:null===(l=s.resolvedIcons)||void 0===l?void 0:l.prev,rowsPerPage:m,startRow:i,totalPages:g,totalRows:e});return t.innerHTML="",a instanceof HTMLElement?t.appendChild(a):"string"==typeof a&&(t.innerHTML=a),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(a=s.config.hideFooter)&&void 0!==a&&a,onPageChange:o,onNextPage:s.config.onNextPage,onUserPageChange:s.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(d=s.config.shouldPaginate)&&void 0!==d&&d,totalPages:g,totalRows:e,prevIcon:null===(c=s.resolvedIcons)||void 0===c?void 0:c.prev,nextIcon:null===(h=s.resolvedIcons)||void 0===h?void 0:h.next});else{t.innerHTML="";const i=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:s,onUserPageChange:i,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,w=Math.min((e-1)*r+1,d),v=Math.min(e*r,d),m=!t,g=!n&&!s||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${w} to ${v} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let o,s;if(t>8)if(e-7>t){const e=7;o=t-e,s=t+(15-e-1)}else o=Math.max(1,e-15+1),s=e;else o=1,s=14;o>2?(n.push(1),n.push(-1)):2===o&&n.push(1);for(let t=o;s>=t;t++)n.push(t);return e-1>s?(n.push(-2),n.push(e)):s===e-1&&n.push(e),n})(e,a),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const s=document.createElement("button"),r=n>0&&0>R[n-1];s.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),s.textContent=""+t,s.setAttribute("aria-label","Go to page "+t),e===t&&s.setAttribute("aria-current","page"),s.addEventListener("click",()=>(async t=>{1>t||t>a||(o(t),i&&await i(t))})(t)),y.appendChild(s),C.push({button:s,page:t,afterEllipsis:r})}}),C.forEach((t,n)=>{const{button:o,page:s,afterEllipsis:i}=t,r=n+1,l=e===s,a=o.previousElementSibling,d=o.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||i||c)&&o.classList.add("st-page-btn--compact-hidden")});const S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Xe(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),i&&await i(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Xe(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(s&&e===a&&!await s(e))return u=!1,void f();t>a&&!s||(o(t),i&&await i(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(o=t.onPageChange),void 0!==t.onNextPage&&(s=t.onNextPage),void 0!==t.onUserPageChange&&(i=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(u=s.config.hideFooter)&&void 0!==u&&u,onPageChange:o,onNextPage:s.config.onNextPage,onUserPageChange:s.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(p=s.config.shouldPaginate)&&void 0!==p&&p,totalPages:g,totalRows:e,prevIcon:null===(f=s.resolvedIcons)||void 0===f?void 0:f.prev,nextIcon:null===(w=s.resolvedIcons)||void 0===w?void 0:w.next});this.footerInstance=i,t.appendChild(i.element)}}renderColumnEditor(t,e,n,o,s){if(!t)return;if(!s.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const i=()=>{const t=s.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));s.setHeaders(e),s.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,editColumns:s.config.editColumns,headers:s.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,contextHeaders:s.headers,essentialAccessors:s.essentialAccessors,setHeaders:t=>{s.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t,contextHeaders:t}),s.onRender()},onColumnVisibilityChange:s.config.onColumnVisibilityChange,onColumnOrderChange:s.config.onColumnOrderChange,resetColumns:i,setOpen:n});else{const r=(t=>{let{columnEditorText:e,editColumns:n,headers:o,open:s,searchEnabled:i,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,contextHeaders:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f,setOpen:w}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const v=document.createElement("div");v.className="st-column-editor "+(s?"open":""),v.style.width="29.5px";const m=t=>{w(!s)},g=document.createElement("div");g.className="st-column-editor-text",g.textContent=e,v.addEventListener("click",m),v.appendChild(g);const x=rn({headers:o,open:s,searchEnabled:i,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,contextHeaders:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f});v.appendChild(x.element);const b={update:t=>{void 0!==t.open&&(s=t.open,t.open?v.classList.add("open"):v.classList.remove("open")),void 0!==t.setOpen&&(w=t.setOpen),void 0!==t.columnEditorText&&(g.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(c=t.essentialAccessors),void 0!==t.resetColumns&&(h=t.resetColumns),x.update({headers:t.headers,open:t.open,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,contextHeaders:t.contextHeaders,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{v.removeEventListener("click",m),x.destroy(),v.remove()}};return v.__columnEditor=b,Object.assign({element:v},b)})({columnEditorText:o.text,editColumns:s.config.editColumns,headers:s.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,contextHeaders:s.headers,essentialAccessors:s.essentialAccessors,setHeaders:t=>{s.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t,contextHeaders:t}),s.onRender()},onColumnVisibilityChange:s.config.onColumnVisibilityChange,onColumnOrderChange:s.config.onColumnOrderChange,resetColumns:i,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,o,s,i,r,l){if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)||(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(a=l.sectionScrollController)&&void 0!==a?a:null;const c=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:s,pinnedLeftContentWidth:i,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?29.5:0,h=(a?s+1:s)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.className="st-horizontal-scrollbar-container",o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=o+"px";const e=document.createElement("div");e.style.width=i+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(s>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=h+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:i,tableBodyContainerRef:r,editColumns:null!==(d=l.config.editColumns)&&void 0!==d&&d,sectionScrollController:this.sectionScrollController});if(c){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(c,e.nextSibling):t.appendChild(c),this.horizontalScrollbarRef.current=c}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(ln(this.horizontalScrollbarRef.current),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(ln(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(dn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function hn(t){const{rows:e=[],rowGrouping:n=[],getRowId:o,expandedRows:s=new Map,collapsedRows:i=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:h=!1,headers:u=[],rowHeight:p=40,headerHeight:g=40,customTheme:x}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],s=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:w({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:s,groupingKey:void 0}),rowPath:n,rowIndexPath:s,absoluteRowIndex:e,isLastGroupRow:!1}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const b=[],y=[],R=[],C=[];let S=0;const I=(t,e,H=[],M=[],k=[])=>{t.forEach((t,E)=>{var O,T;const A=n[e],W=b.length,P=[...H,E],$=[...M,E],D=w({row:t,getRowId:o,depth:e,index:E,rowPath:P,rowIndexPath:$,groupingKey:A}),F=b.length,L={row:t,depth:e,displayPosition:S,groupingKey:A,position:W,isLastGroupRow:!1,rowId:D,rowPath:P,rowIndexPath:$,absoluteRowIndex:W,parentIndices:k.length>0?[...k]:void 0};b.push(L),y.push(L),S++;const j=v(D);if(m(j,e,r,s,i)&&n.length>e){const n=null==l?void 0:l.get(j),o=((t,e)=>{const n=t[e];return f(n)?n:[]})(t,A),s=u.find(t=>t.expandable&&t.nestedTable);if((null==s?void 0:s.nestedTable)&&o.length>0){const n=b.length,i=(null===(O=s.nestedTable.customTheme)||void 0===O?void 0:O.rowHeight)||p,r=(null===(T=s.nestedTable.customTheme)||void 0===T?void 0:T.headerHeight)||g,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:o})=>Math.min(n+o.rowSeparatorWidth+t*(e+o.rowSeparatorWidth)+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth,o.nestedGridMaxHeight+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth))({childRowCount:o.length,rowHeight:i,headerHeight:r,customTheme:x}),a=c({calculatedHeight:l,customHeight:s.nestedTable.height,customTheme:x});R.push([n,a-p]);const d=[...P,A];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:$,nestedTable:{parentRow:t,expandableHeader:s,childAccessor:A,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&h){const o=b.length,s=[...P,A];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:o,isLastGroupRow:!1,rowId:s,rowPath:s,rowIndexPath:$,stateIndicator:{parentRowId:j,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...k,F]})}else if(n.loading&&!a){const t=b.length,n=[...P,A,"loading-skeleton"];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:$,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...k,F]})}}else if(o.length>0){const t=[...P,A],n=[...$];I(o,e+1,t,n,[...k,F])}}0===e&&C.push(b.length)})};return I(e,0,[],[],[]),C.forEach((t,e)=>{const n=t-1;n>=0&&b.length>n&&(b[n].isLastGroupRow=!0)}),{flattenedRows:b,heightOffsets:R,paginatableRows:y,parentEndPositions:C}}const un=t=>{var e;const n=document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t};class pn{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.tableRenderer=new cn}getCachedFlattenResult(){var t,e;return null!==(e=null===(t=this.flattenedRowsCache)||void 0===t?void 0:t.flattenResult)&&void 0!==e?e:null}getLastProcessedResult(){return this.lastProcessedResult}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null)}computeEffectiveHeaders(t,e,n,o){var s;let i=[...t];return e.enableRowSelection&&!(null===(s=null==t?void 0:t[0])||void 0===s?void 0:s.isSelectionColumn)&&(i=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...i]),null!=o&&o>0?R(i,{containerWidth:o}):R(i)}render(t,e,n,o,s){var i,r,l,a,d,c,h,p,f,w,v,m,g,x,b,y,R,C,S,I,H,M,k;if(this.lastHeadersRef!==n.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=n.headers),!n.dimensionManager)return;const E=null!==(c=null!==(l=null===(r=null===(i=n.mainBodyRef)||void 0===i?void 0:i.current)||void 0===r?void 0:r.scrollLeft)&&void 0!==l?l:null===(d=null===(a=n.mainHeaderRef)||void 0===a?void 0:a.current)||void 0===d?void 0:d.scrollLeft)&&void 0!==c?c:0,O=n.dimensionManager.getState(),{containerWidth:T,calculatedHeaderHeight:W,maxHeaderDepth:P}=O;let $=this.computeEffectiveHeaders(n.headers,n.config,n.customTheme,T);const{leftWidth:D,rightWidth:F}=ve({headers:$,containerWidth:T,collapsedHeaders:n.collapsedHeaders});n.config.autoExpandColumns&&T>0&&($=A($,{autoExpandColumns:!0,containerWidth:T,pinnedLeftWidth:D,pinnedRightWidth:F,mainBodyRef:null!==(h=n.mainBodyRef)&&void 0!==h?h:{current:null},isResizing:null!==(p=n.isResizing)&&void 0!==p&&p}));const{mainWidth:L,leftWidth:B,rightWidth:N,leftContentWidth:z,rightContentWidth:V}=ve({headers:$,containerWidth:T,collapsedHeaders:n.collapsedHeaders}),q=T-B-N,G=t=>"number"==typeof t?t+"px":t;let U="",J="";if(n.config.maxHeight){const t=G(n.config.maxHeight);U=`max-height: ${t};`,J=void 0===O.contentHeight?"height: auto;":`height: ${t};`}else n.config.height&&(J=`height: ${G(n.config.height)};`);const{customTheme:Y}=n;t.rootElement.style.cssText=`\n ${U}\n ${J}\n --st-main-section-width: ${q}px;\n --st-scrollbar-width: ${o.scrollbarWidth}px;\n --st-editor-width: ${n.config.editColumns?29.5:0}px;\n --st-border-width: ${Y.borderWidth}px;\n --st-footer-height: ${Y.footerHeight}px;\n `;const _=null!==(f=n.config.columnResizing)&&void 0!==f&&f;t.content.className="st-content "+(_?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%";let Z=n.localRows;if(n.sortManager?Z=n.sortManager.getSortedRows():n.filterManager&&(Z=n.filterManager.getFilteredRows()),this.lastRowsRef!==Z&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=Z),n.internalIsLoading&&0===Z.length){let t=n.config.shouldPaginate&&null!==(w=n.config.rowsPerPage)&&void 0!==w?w:10;o.isMainSectionScrollable&&(t+=1),Z=Array.from({length:t},()=>({}))}const tt=null===(v=n.sortManager)||void 0===v?void 0:v.getState(),et=null===(m=n.filterManager)||void 0===m?void 0:m.getState(),nt=(null==tt?void 0:tt.sort)?`${tt.sort.key.accessor}-${tt.sort.direction}`:"none",ot=JSON.stringify((null==et?void 0:et.filters)||{}),st=n.config.quickFilter,it=st?`${null!==(g=st.text)&&void 0!==g?g:""}|${null!==(x=st.mode)&&void 0!==x?x:"simple"}`:"";let rt,lt,at;this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===Z&&this.flattenedRowsCache.deps.quickFilterKey===it&&this.flattenedRowsCache.deps.expandedRowsSize===n.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===n.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===n.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===n.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===nt&&this.flattenedRowsCache.deps.filterKey===ot&&this.flattenedRowsCache?(rt=this.flattenedRowsCache.aggregatedRows,lt=this.flattenedRowsCache.quickFilteredRows,at=this.flattenedRowsCache.flattenResult):(rt=n.sortManager?Z:j({rows:Z,headers:n.headers,rowGrouping:n.config.rowGrouping}),lt=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:o,columns:s,caseSensitive:i=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!t.hide&&!t.excludeFromRender&&(s&&s.length>0?s.includes(t.accessor):!1!==t.quickFilterable)),d="smart"===r?(t=>{const e=[];let n=0;for(;t.length>n;){for(;t.length>n&&/\s/.test(t[n]);)n++;if(n>=t.length)break;if("-"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(o,n);s&&e.push({type:"negation",value:s});continue}if('"'===t[n]){n++;const o=n;for(;t.length>n&&'"'!==t[n];)n++;const s=t.substring(o,n);s&&e.push({type:"phrase",value:s}),t.length>n&&'"'===t[n]&&n++;continue}const o=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const s=t.substring(o,n);if(t.length>n&&":"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const i=t.substring(o,n);i&&e.push({type:"columnSpecific",value:i,column:s});continue}s&&e.push({type:"word",value:s})}return e})(o):null;return t.filter(t=>{if("smart"===r&&d){const e=new Set,n=new Map;d.forEach((t,e)=>{"columnSpecific"===t.type&&t.column&&(n.has(t.column)||n.set(t.column,[]),n.get(t.column).push(e))});const o=[];a.forEach(s=>{try{let r;if(s.quickFilterGetter)r=s.quickFilterGetter({row:t,accessor:s.accessor});else{const e=u(t,s.accessor);if(l&&s.valueFormatter){const n=s.valueFormatter({accessor:s.accessor,colIndex:0,row:t,rowIndex:0,value:e});r=Array.isArray(n)?n.join(" "):n+""}else r=null==e?"":Array.isArray(e)?e.join(" "):e+""}o.push(r);const a=n.get(s.accessor);a&&a.forEach(t=>{const n=d[t],o=i?r:r.toLowerCase(),s=i?n.value:n.value.toLowerCase();o.includes(s)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${s.accessor}:`,t)}});const s=i?o.join(" "):o.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const o=i?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":s.includes(o)&&e.add(n);break;case"negation":s.includes(o)||e.add(n)}}),e.size===d.length}return a.some(e=>{try{let n;if(e.quickFilterGetter)n=e.quickFilterGetter({row:t,accessor:e.accessor});else{const o=u(t,e.accessor);if(l&&e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:o});n=Array.isArray(s)?s.join(" "):s+""}else n=null==o?"":Array.isArray(o)?o.join(" "):o+""}return((t,e,n)=>{if(!e)return!0;const o=n?t:t.toLowerCase(),s=n?e:e.toLowerCase();return o.includes(s)})(n,o,i)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:rt,headers:$,quickFilter:n.config.quickFilter}),at=hn({rows:lt,rowGrouping:n.config.rowGrouping,getRowId:n.config.getRowId,expandedRows:n.expandedRows,collapsedRows:n.collapsedRows,expandedDepths:n.expandedDepths,rowStateMap:n.rowStateMap,hasLoadingRenderer:!!n.config.loadingStateRenderer,hasErrorRenderer:!!n.config.errorStateRenderer,hasEmptyRenderer:!!n.config.emptyStateRenderer,headers:$,rowHeight:n.customTheme.rowHeight,headerHeight:n.customTheme.headerHeight,customTheme:n.customTheme}),this.flattenedRowsCache={aggregatedRows:rt,quickFilteredRows:lt,flattenResult:at,deps:{rowsRef:Z,quickFilterKey:it,expandedRowsSize:n.expandedRows.size,collapsedRowsSize:n.collapsedRows.size,expandedDepthsSize:n.expandedDepths.size,rowStateMapSize:n.rowStateMap.size,sortKey:nt,filterKey:ot}});const dt=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:s,footerHeight:i})=>{if(e){const t=un(e);if(0===t)return;const r=s||n;if(t>=r+o*n+(i||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=un(t);return 0!==r?Math.max(0,r-n):void 0})({height:n.config.height,maxHeight:n.config.maxHeight,rowHeight:n.customTheme.rowHeight,shouldPaginate:null!==(b=n.config.shouldPaginate)&&void 0!==b&&b,rowsPerPage:null!==(y=n.config.rowsPerPage)&&void 0!==y?y:10,totalRowCount:null!==(R=n.config.totalRowCount)&&void 0!==R?R:at.paginatableRows.length,headerHeight:W,footerHeight:!n.config.shouldPaginate&&!n.config.footerRenderer||n.config.hideFooter?void 0:n.customTheme.footerHeight}),ct=function(t){const{contentHeight:e,currentPage:n,customTheme:o,enableStickyParents:s,flattenedRows:i,heightOffsets:r,parentEndPositions:l,rowHeight:a,rowsPerPage:d,scrollDirection:c="none",scrollTop:h,serverSidePagination:u,shouldPaginate:p,rowGrouping:f}=t,w=(t=>Math.ceil(800/(t+1)))(a),v=function(t,e,n,o,s,i){if(!s||i)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*o,l=n*o,a=0===r?0:e[r-1];return t.slice(a,l>e.length?t.length:e[l-1]).map((t,e)=>{const n=t.nestedTable?t.absoluteRowIndex:s&&!i?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(i,l,n,d,p,u),m=r&&0!==r.length&&p&&!u?(()=>{const t=new Map;return v.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),r.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():r,g=m&&m.length>0?((t,e,n,o)=>{const s=e+o.rowSeparatorWidth,i=Array(t),r=new Map;n&&n.forEach(([t,e])=>{r.set(t,e)});let l=0;for(let e=0;t>e;e++){i[e]=l,l+=s;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:i,totalHeight:l-o.rowSeparatorWidth}})(v.length,a,m,o):void 0;let x,b=0,y=v.length;if(void 0===e)x=v;else{const t=K({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:a,scrollTop:h,scrollDirection:c,heightMap:g});x=t.rendered.rows,b=t.rendered.startIndex,y=t.rendered.endIndex}const{stickyParents:R,regularRows:C,partiallyVisibleRows:S}=s&&void 0!==e?(()=>{const t=K({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:a,scrollTop:h,scrollDirection:c,heightMap:g}),n=f?((t,e,n,o,s)=>{var i,r,l,a,d,c;const h=null!==(r=null===(i=o[0])||void 0===i?void 0:i.position)&&void 0!==r?r:-1,u=null!==(a=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==a?a:-1,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${s.join(",")}`,w=X.get(f);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===p)return w.result;const v=Q({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:s});if(X.set(f,{result:v,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),X.size>50){const t=X.keys().next().value;void 0!==t&&X.delete(t)}return v})(v,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,f):{stickyParents:[],regularRows:t.rendered.rows,partiallyVisibleRows:[]};return Object.assign(Object.assign({},n),{partiallyVisibleRows:t.partiallyVisible.rows})})():{stickyParents:[],regularRows:x,partiallyVisibleRows:[]};return{currentTableRows:v,rowsToRender:x,renderedStartIndex:b,renderedEndIndex:y,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:m,heightMap:g}}({flattenedRows:at.flattenedRows,paginatableRows:at.paginatableRows,parentEndPositions:at.parentEndPositions,currentPage:o.currentPage,rowsPerPage:null!==(C=n.config.rowsPerPage)&&void 0!==C?C:10,shouldPaginate:null!==(S=n.config.shouldPaginate)&&void 0!==S&&S,serverSidePagination:null!==(I=n.config.serverSidePagination)&&void 0!==I&&I,contentHeight:dt,rowHeight:n.customTheme.rowHeight,scrollTop:o.scrollTop,scrollDirection:o.scrollDirection,heightOffsets:at.heightOffsets,customTheme:n.customTheme,enableStickyParents:null!==(H=n.config.enableStickyParents)&&void 0!==H&&H,rowGrouping:n.config.rowGrouping});this.lastProcessedResult=ct,null===(M=n.rowSelectionManager)||void 0===M||M.updateConfig({tableRows:ct.currentTableRows}),this.renderHeader(t.headerContainer,W,P,$,n),this.renderBody(t.bodyContainer,ct,$,n),this.registerSectionPanes(n);const ht=n.sectionScrollController;ht&&(ht.setSectionScrollLeft("main",E),null!=n.pinnedLeftRef.current&&ht.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&ht.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),ht.restoreAll()),this.renderFooter(t.footerContainer,null!==(k=n.config.totalRowCount)&&void 0!==k?k:at.paginatableRows.length,o.currentPage,$,n),this.renderColumnEditor(t.contentWrapper,o.columnEditorOpen,s,$,n),this.renderHorizontalScrollbar(t.wrapperContainer,L,B,N,z,V,e.tableBodyContainerRef.current,$,n)}renderHeader(t,e,n,o,s){if(s.config.hideHeader)return;const i=this.buildRendererDeps(o,s);this.tableRenderer.renderHeader(t,e,n,i)}renderBody(t,e,n,o){const s=this.buildRendererDeps(n,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,o,s){const i=this.buildRendererDeps(o,s);this.tableRenderer.renderFooter(t,e,n,t=>{s.setCurrentPage(t),s.onRender()},i)}renderColumnEditor(t,e,n,o,s){const i=this.buildRendererDeps(o,s);this.tableRenderer.renderColumnEditor(t,e,t=>{s.setColumnEditorOpen(t),s.onRender()},n,i)}renderHorizontalScrollbar(t,e,n,o,s,i,r,l,a){if(!a.mainBodyRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,o,s,i,r,d)}registerSectionPanes(t){const e=t.sectionScrollController;e&&(t.pinnedLeftHeaderRef.current&&e.registerPane("pinned-left",t.pinnedLeftHeaderRef.current,"header"),t.pinnedLeftRef.current&&e.registerPane("pinned-left",t.pinnedLeftRef.current,"body"),t.mainHeaderRef.current&&e.registerPane("main",t.mainHeaderRef.current,"header"),t.mainBodyRef.current&&e.registerPane("main",t.mainBodyRef.current,"body"),t.pinnedRightHeaderRef.current&&e.registerPane("pinned-right",t.pinnedRightHeaderRef.current,"header"),t.pinnedRightRef.current&&e.registerPane("pinned-right",t.pinnedRightRef.current,"body"))}buildRendererDeps(t,e){return{config:e.config,customTheme:e.customTheme,resolvedIcons:e.resolvedIcons,effectiveHeaders:t,headers:e.headers,localRows:e.localRows,collapsedHeaders:e.collapsedHeaders,collapsedRows:e.collapsedRows,expandedRows:e.expandedRows,expandedDepths:e.expandedDepths,isResizing:e.isResizing,internalIsLoading:e.internalIsLoading,cellRegistry:e.cellRegistry,headerRegistry:e.headerRegistry,draggedHeaderRef:e.draggedHeaderRef,hoveredHeaderRef:e.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.pinnedRightHeaderRef,dimensionManager:e.dimensionManager,sectionScrollController:e.sectionScrollController,sortManager:e.sortManager,filterManager:e.filterManager,selectionManager:e.selectionManager,rowSelectionManager:e.rowSelectionManager,rowStateMap:e.rowStateMap,onRender:e.onRender,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const fn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class wn{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||hn({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})};return{updateData:e=>{var n;const{rowIndex:o,accessor:s,newValue:i}=e;if(o>=0&&t.localRows.length>o){t.localRows[o][s]=i;const e=[o],r=`${(t.config.getRowId?[o,t.config.getRowId({row:t.localRows[o],depth:0,index:o,rowPath:e,rowIndexPath:e})]:[o]).join("-")}-${s}`,l=null===(n=t.cellRegistry)||void 0===n?void 0:n.get(r);l?l.updateContent(i):t.onRender()}},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const o=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return o?o.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var o;((t,e,n,o=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a"),s=URL.createObjectURL(n);o.setAttribute("href",s),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)})(((t,e,n=!0)=>{const o=(t=>{const e=[],n=t=>{for(const o of t)o.hide||o.isSelectionColumn||o.excludeFromCsv||(o.children&&o.children.length>0?(o.singleRowChildren&&e.push(o),n(o.children)):e.push(o))};return n(t),e})(e),s=o.map(t=>fn(t.label)).join(","),i=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const s=u(n,t.accessor);if(t.exportValueGetter){const i=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s,formattedValue:i});return fn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const i=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s});return fn(i)}return fn(s)}).join(",")});return(n?[s,...i]:i).join("\n")})(t,e,o),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(o=t.config.includeHeadersInCSVExport)||void 0===o||o)},getSortState:()=>{var e,n;return null!==(n=null===(e=t.sortManager)||void 0===e?void 0:e.getSortColumn())&&void 0!==n?n:null},applySortState:async e=>{t.sortManager&&t.sortManager.updateSort(e)},getPinnedState:()=>kt(t.headers),applyPinnedState:async e=>{const n=Ot(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(ft(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,o;const s=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(s/(null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10))},setPage:async n=>{var o,s;const i=null!==(o=t.config.totalRowCount)&&void 0!==o?o:e().paginatableRows.length,r=null!==(s=t.config.rowsPerPage)&&void 0!==s?s:10;1>n||n>Math.ceil(i/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{t.expandedDepths=e,t.onRender()},getExpandedDepths:()=>{var e,n;return null!==(n=null===(e=t.expandedDepthsManager)||void 0===e?void 0:e.getExpandedDepths())&&void 0!==n?n:t.expandedDepths},getGroupingProperty:e=>{var n;return null===(n=t.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},toggleColumnEditor:e=>{t.config.editColumns&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const s=o.accessor+"";let i=s in e?!e[s]:o.hide;return St(o,t.essentialAccessors)&&(i=!1),Object.assign(Object.assign({},o),{hide:i,children:o.children?n(o.children):o.children})});t.setHeaders(n(t.headers)),t.onRender(),t.config.onColumnVisibilityChange&&t.config.onColumnVisibilityChange(e)},setQuickFilter:e=>{var n;(null===(n=t.config.quickFilter)||void 0===n?void 0:n.onChange)&&t.config.quickFilter.onChange(e)},getSelectedCells:()=>{var e;return(null===(e=t.selectionManager)||void 0===e?void 0:e.getSelectedCells())||new Set},clearSelection:()=>{var e;null===(e=t.selectionManager)||void 0===e||e.clearSelection()},selectCell:e=>{var n;null===(n=t.selectionManager)||void 0===n||n.selectSingleCell(e)},selectCellRange:(e,n)=>{var o;null===(o=t.selectionManager)||void 0===o||o.selectCellRange(e,n)}}}}class vn{constructor(t,e){var n,o;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.container=t,this.config=e,this.customTheme=At.mergeCustomTheme(e),this.mergedColumnEditorConfig=At.mergeColumnEditorConfig(e),this.resolvedIcons=At.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=At.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(o=e.isLoading)&&void 0!==o&&o,this.collapsedHeaders=At.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=At.getInitialExpandedDepths(e),this.domManager=new Wt,this.renderOrchestrator=new pn,this.rebuildRowIndexMap(),this.initializeManagers()}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=w({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=v(n);this.rowIndexMap.set(o,e)})}initializeManagers(){var t,e;this.ariaAnnouncementManager=new ut,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ht(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.expandedDepths=t,this.render("expandedDepthsManager")});const n=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new B({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:n}),this.sortManager.subscribe(t=>{this.render("sortManager")}),this.filterManager=new q({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:n}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new st({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t;const e=this.domManager.getRefs(),n=this.domManager.getElements();if(!e.tableBodyContainerRef.current||!n)return;this.scrollbarWidth=pt(e.tableBodyContainerRef.current);const o=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new P({effectiveHeaders:o,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:this.localRows.length,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:e.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.config.onGridReady&&this.config.onGridReady())}),this.scrollManager=new $({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:200}),this.scrollManager.subscribe(()=>{this.render("scrollManager")}),this.sectionScrollController=new D({onMainSectionScrollLeft:t=>{var e,n;const o=this.domManager.getRefs(),s=o.mainHeaderRef.current,i=o.mainBodyRef.current;null===(e=null==s?void 0:s.__renderHeaderCells)||void 0===e||e.call(s,t),null===(n=null==i?void 0:i.__renderBodyCells)||void 0===n||n.call(i,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new W({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:e.mainBodyRef,isResizing:this.isResizing},()=>{this.render("autoScaleManager")})),e.headerContainerRef.current&&e.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new dt({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new lt,this.windowResizeManager.addCallback(()=>{var t;if(e.tableBodyContainerRef.current){const n=pt(e.tableBodyContainerRef.current);this.scrollbarWidth=n,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(n)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new rt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new at({selectableColumns:null!==(t=this.config.selectableColumns)&&void 0!==t&&t,selectedCells:new Set,selectedColumns:new Set,setSelectedCells:t=>this.selectionManager.setSelectedCells(t),setSelectedColumns:t=>this.selectionManager.setSelectedColumns(t),getSelectedCells:()=>this.selectionManager.getSelectedCells(),getSelectedColumns:()=>this.selectionManager.getSelectedColumns(),onClearSelection:()=>this.selectionManager.clearSelection()}),this.handleOutsideClickManager.startListening()),this.setupEventListeners()}setupEventListeners(){const t=this.domManager.getElements();(null==t?void 0:t.bodyContainer)&&(t.bodyContainer.addEventListener("scroll",this.handleScroll.bind(this)),t.bodyContainer.addEventListener("mouseleave",()=>{this.clearHoveredRows()}))}handleScroll(t){const e=t.currentTarget,n=e.scrollTop;this.isScrolling=!0,null!==this.scrollEndTimeoutId&&clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=window.setTimeout(()=>{this.isScrolling=!1,this.scrollEndTimeoutId=null,this.render("scroll-end")},150),null!==this.scrollRafId&&cancelAnimationFrame(this.scrollRafId),this.scrollRafId=requestAnimationFrame(()=>{const t=n>this.lastScrollTop?"down":this.lastScrollTop>n?"up":"none";this.scrollTop=n,this.scrollDirection=t,this.lastScrollTop=n,this.scrollManager&&this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight),this.render("scroll-raf"),this.scrollRafId=null})}clearHoveredRows(){document.querySelectorAll(".st-row.hovered").forEach(t=>{t.classList.remove("hovered")})}updateAriaLiveRegion(){const t=this.domManager.getElements();(null==t?void 0:t.ariaLiveRegion)&&(t.ariaLiveRegion.textContent=this.announcement)}getRenderContext(){const t=this.domManager.getRefs();return{config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,onRender:()=>this.render("resizeHandler-onRender"),setIsResizing:t=>{var e,n,o,s,i,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(o=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:null===(i=null===(s=t.mainBodyRef)||void 0===s?void 0:s.current)||void 0===i?void 0:i.clientWidth)&&void 0!==r?r:null===(l=this.dimensionManager)||void 0===l?void 0:l.getState().containerWidth)&&void 0!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.headers=ft(t),this.renderOrchestrator.invalidateCache("header")},setCollapsedHeaders:t=>{this.collapsedHeaders=t},setCollapsedRows:t=>{this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}render(t){if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;this._positionOnlyBody="scroll-raf"===t&&!0===this.isScrolling;const e=this.domManager.getElements(),n=this.domManager.getRefs();e&&this.renderOrchestrator.render(e,n,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig)}update(t){this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),t),void 0!==t.rows&&(this.localRows=[...t.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows})),void 0!==t.defaultHeaders&&(this.headers=[...t.defaultHeaders],this.essentialAccessors=At.buildEssentialAccessors(this.headers),this.filterManager&&this.filterManager.updateConfig({headers:this.headers}),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers})),void 0!==t.isLoading&&(this.internalIsLoading=t.isLoading),void 0!==t.theme&&this.domManager.updateTheme(t.theme),void 0!==t.customTheme&&(this.customTheme=At.mergeCustomTheme(this.config),this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme})),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,o,s,i,r,l,a,d,c,h,u;this.mounted=!1,this.firstRenderDone=!1,null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),null===(t=this.dimensionManager)||void 0===t||t.destroy(),null===(e=this.scrollManager)||void 0===e||e.destroy(),null===(n=this.sectionScrollController)||void 0===n||n.destroy(),null===(o=this.sortManager)||void 0===o||o.destroy(),null===(s=this.filterManager)||void 0===s||s.destroy(),null===(i=this.rowSelectionManager)||void 0===i||i.destroy(),null===(r=this.selectionManager)||void 0===r||r.destroy(),null===(l=this.autoScaleManager)||void 0===l||l.destroy(),null===(a=this.windowResizeManager)||void 0===a||a.destroy(),null===(d=this.handleOutsideClickManager)||void 0===d||d.destroy(),null===(c=this.scrollbarVisibilityManager)||void 0===c||c.destroy(),null===(h=this.expandedDepthsManager)||void 0===h||h.destroy(),null===(u=this.ariaAnnouncementManager)||void 0===u||u.destroy(),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return wn.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,expandedRows:this.expandedRows,collapsedRows:this.collapsedRows,expandedDepths:this.expandedDepths,rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,columnEditorOpen:this.columnEditorOpen,getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.headers=ft(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=vn,exports.asRows=function(t){return t};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=150,e=["lineAreaChart","barChart"],n=40,o=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),s="parentExpanded",i=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],o=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let s=e;for(const e of t.children)s=o(e,s);return s};return o(t,e),n},r=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...r(t.children)),e}),l=(t=0)=>t?t+1:0,a=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},d=({accessor:t,rowId:e})=>`${e}-${t}`,c=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,h=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},u=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=h(e);let s=t[n];return null!==o&&Array.isArray(s)&&(s=s[o]),s},t):t[e]},p=(t,e,n)=>{const o=e+"";if(!o.includes(".")&&!o.includes("["))return void(t[e]=n);const s=o.split(".");let i=t;for(let t=0;s.length-1>t;t++){const{key:e,index:n}=h(s[t]);if(null==i[e]){const n=h(s[t+1]);i[e]=null!==n.index?[]:{}}if(i=i[e],null!==n){if(!Array.isArray(i))throw Error(`Expected array at ${s.slice(0,t+1).join(".")}, but found ${typeof i}`);for(;n>=i.length;)i.push(null);null==i[n]&&(i[n]={}),i=i[n]}}const{key:r,index:l}=h(s[s.length-1]);if(null!==l){for(Array.isArray(i[r])||(i[r]=[]);l>=i[r].length;)i[r].push(null);i[r][l]=n}else i[r]=n},f=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],w=t=>{const{getRowId:e,rowPath:n}=t,o=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});o.push(n)}return o},v=t=>t.join("-"),m=(t,e,n,o,s)=>{const i=t+"",r=o.has(i)&&o.get(i)===e,l=s.has(i)&&s.get(i)===e;return n.has(e)?!l:r},g=(t,e)=>{if(t.hide)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||s;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>g(t,e))]:0===n.length?[t]:n.flatMap(t=>g(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||s;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>g(t,e))]:n.flatMap(t=>g(t,e))};function x(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return e.endsWith("px")?{type:"px",value:parseFloat(e)||0}:e.endsWith("fr")?{type:"fr",value:parseFloat(e)||1}:e.endsWith("%")?{type:"pct",value:parseFloat(e)||0}:null}function b(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function y(e,n){const o=e.map(t=>x(t)),s=o.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),i=o.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),r=n*(i/100),l=o.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),a=l>0?Math.max(0,n-s-r)/l:150,d=new Map;return e.forEach((e,s)=>{const i=o[s];if(i)if("px"===i.type)d.set(e.accessor,i.value);else if("fr"===i.type){const t=i.value*a,n="number"==typeof e.minWidth?e.minWidth:"string"==typeof e.minWidth&&parseFloat(e.minWidth+"")||0;d.set(e.accessor,n>0?Math.max(t,n):t)}else d.set(e.accessor,"pct"===i.type?n*i.value/100:t);else d.set(e.accessor,t)}),d}function R(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let o,s="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=b(t);o=y(e,n)}else{const e=b(t),n=e.map(t=>x(t));let i=s;if(null==i||0>=i){const t=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),e=n.filter(t=>"fr"===(null==t?void 0:t.type)).length;i=t+(e>0?150*e:0)+(n.filter(t=>"pct"===(null==t?void 0:t.type)).length>0?160:0),i=Math.max(i,800)}o=y(e,i)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const s=o.get(e.accessor);return null!=s&&(n.width=s),n})}const C=e=>{if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);{const n=document.getElementById(d({accessor:e.accessor,rowId:"header"}));return(null==n?void 0:n.offsetWidth)||t}},S=e=>{var n;const o=e.width;"string"==typeof o&&o.includes("fr")&&(e.width=(null===(n=document.getElementById(d({accessor:e.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth)||t),e.children&&e.children.length>0&&e.children.forEach(t=>{S(t)})},I=t=>"number"==typeof t.minWidth?t.minWidth:n,H=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...g(t,e))}),n},M=(o,s)=>{const{rows:i,header:r,maxWidth:l=500,sampleSize:a=50,styleRoot:c}=s||{},h=null!=c?c:document,p=document.getElementById(d({accessor:o,rowId:"header"}));if(!p)return t;const f=window.getComputedStyle(p),w=parseFloat(f.paddingLeft)||0,v=parseFloat(f.paddingRight)||0,m=parseFloat(f.gap)||0;let g=w+v;const x=p.querySelector(".st-header-label");if(x){const t=x.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const o=e.offsetWidth;document.body.removeChild(e),g+=o}}const b=Array.from(p.children);let y=1;for(let t=0;b.length>t;t++){const e=b[t];if(e.classList.contains("st-header-label"))continue;if(e.classList.contains("st-sr-only"))continue;const n=window.getComputedStyle(e);"none"!==n.display&&(g+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),y++)}m>0&&y>1&&(g+=m*(y-1));let R=0;const C=r&&r.type&&e.includes(r.type);if(i&&i.length>0&&!C){const t=Math.min(i.length,a),e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";let n=0,s=0;const l=h.querySelector(".st-cell-content");if(l){const t=window.getComputedStyle(l);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0}document.body.appendChild(e);for(let l=0;t>l;l++){const t=i[l];let a;a=(null==r?void 0:r.valueGetter)?r.valueGetter({accessor:o,row:t,rowIndex:l}):u(t,o);let d=a;(null==r?void 0:r.valueFormatter)&&null!=a&&(d=r.valueFormatter({accessor:o,colIndex:0,row:t,rowIndex:l,value:a})),e.textContent=null!=d?d+"":"";const c=e.offsetWidth+n+s;c>R&&(R=c)}document.body.removeChild(e)}let S=Math.max(g,R);return C&&(S=Math.max(S,150)),S>l&&(S=l),Math.max(S+2,n)};class k{constructor(t){this.previousValue=t}update(t){const e=this.previousValue;return JSON.stringify(e)!==JSON.stringify(t)&&(this.previousValue=t),e}get(){return this.previousValue}set(t){this.previousValue=t}}const E=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...E(t.children,null!=e?e:t.pinned)):n.push(t))}),n},O=(t,e)=>e>=t.reduce((t,e)=>t+I(e),0),T=(t,e)=>{const n=new Map,o=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===o)return n;const s=e/o;if(s>=1&&.01>s-1)return n;let i=0;return t.forEach((o,r)=>{const l="number"==typeof o.width?o.width:"string"==typeof o.width&&o.width.endsWith("px")?parseFloat(o.width):150;let a;r===t.length-1?a=e-i:(a=Math.round(l*s),i+=a),n.set(o.accessor,a)}),n},A=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:s,pinnedRightWidth:i,isResizing:r}=e;if(!n||0===o||r)return t;const l=Math.max(0,o-s-i),a=t.filter(t=>"left"===t.pinned),d=t.filter(t=>"right"===t.pinned),c=t.filter(t=>!t.pinned),h=E(a,"left"),u=E(d,"right"),p=E(c,void 0),f=h.length>0&&O(h,s),w=u.length>0&&O(u,i),v=p.length>0&&l>0&&O(p,l),m=new Map;if(f&&T(h,s).forEach((t,e)=>m.set(e,t)),w&&T(u,i).forEach((t,e)=>m.set(e,t)),v&&T(p,l).forEach((t,e)=>m.set(e,t)),0===m.size)return t;const g=(t,e)=>{var n;if(t.hide)return t;const o=null!=e?e:t.pinned,s=null===(n=t.children)||void 0===n?void 0:n.map(t=>g(t,o));if(!t.children||0===t.children.length){const e=m.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==e?{width:e,children:s}:{children:s})}return Object.assign(Object.assign({},t),{children:s})};return t.map(t=>g(t,t.pinned))};class W{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new k(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new k(t.containerWidth)}updateConfig(t){var e;this.config=Object.assign(Object.assign({},this.config),t);const n=null!==(e=this.config.isResizing)&&void 0!==e&&e,o=this.config.containerWidth,s=this.isResizingTracker.get();this.isResizingTracker.set(n);const i=this.containerWidthTracker.get();this.containerWidthTracker.set(o),s&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(o-i)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return A(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class P{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),o=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:o},t.containerElement&&this.observeContainer(t.containerElement)}getHeaderDepth(t){var e,n;return t.singleRowChildren&&(null===(e=t.children)||void 0===e?void 0:e.length)?1:(null===(n=t.children)||void 0===n?void 0:n.length)?1+Math.max(...t.children.map(t=>this.getHeaderDepth(t))):1}calculateMaxHeaderDepth(){let t=0;return this.config.effectiveHeaders.forEach(e=>{const n=this.getHeaderDepth(e);t=Math.max(t,n)}),t}calculateHeaderHeight(t){var e;let n=1;if("undefined"!=typeof window){const t=document.documentElement,e=getComputedStyle(t).getPropertyValue("--st-border-width").trim();if(e){const t=parseFloat(e);isNaN(t)||(n=t)}}return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)+n}convertHeightToPixels(t){var e;const n=this.config.containerElement||document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:s,footerHeight:i}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=s||n;if(t>=r+o*n+(i||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=this.convertHeightToPixels(t);return 0!==r?Math.max(0,r-n):void 0}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let o=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),o=!0}if(t.height||t.maxHeight||void 0!==t.totalRowCount){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),o=!0}t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),o=!0),o&&this.notifySubscribers()}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}getState(){return this.state}getContainerWidth(){return this.state.containerWidth}getCalculatedHeaderHeight(){return this.state.calculatedHeaderHeight}getMaxHeaderDepth(){return this.state.maxHeaderDepth}getContentHeight(){return this.state.contentHeight}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class ${constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.config=t,this.state={scrollTop:0,scrollLeft:0,scrollDirection:"none",isScrolling:!1}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}handleScroll(t,e,n,o){const s=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:s,isScrolling:!0},null!==this.scrollTimeoutId&&clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=window.setTimeout(()=>{this.state=Object.assign(Object.assign({},this.state),{isScrolling:!1}),this.notifySubscribers()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.notifySubscribers()}setScrolling(t){this.state=Object.assign(Object.assign({},this.state),{isScrolling:t}),this.notifySubscribers()}getState(){return this.state}getScrollTop(){return this.state.scrollTop}getScrollLeft(){return this.state.scrollLeft}getScrollDirection(){return this.state.scrollDirection}isScrolling(){return this.state.isScrolling}destroy(){null!==this.scrollTimeoutId&&(clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=null),this.subscribers.clear()}}class D{constructor(t={}){this.scrollLeftBySection={"pinned-left":0,main:0,"pinned-right":0},this.panesBySection=new Map([["pinned-left",new Set],["main",new Set],["pinned-right",new Set]]),this.scrollHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var o;const s=this.panesBySection.get(t);if(Array.from(s).find(t=>t.element===e))return;const i=Array.from(s).find(t=>t.role===n);i&&(this.removeScrollListener(i.element),s.delete(i)),s.add({element:e,role:n}),this.addScrollListener(t,e);const r=null!==(o=this.scrollLeftBySection[t])&&void 0!==o?o:0;e.scrollLeft!==r&&(this.isSyncing=!0,e.scrollLeft=r,this.isSyncing=!1)}unregisterPane(t,e){const n=this.panesBySection.get(t);if(!n)return;this.removeScrollListener(e);const o=Array.from(n).find(t=>t.element===e);o&&n.delete(o)}unregisterSection(t){const e=this.panesBySection.get(t);e&&(e.forEach(({element:t})=>this.removeScrollListener(t)),e.clear())}setSectionScrollLeft(t,e){this.scrollLeftBySection[t]=e;const n=this.panesBySection.get(t);n&&(n.forEach(({element:t})=>{t.scrollLeft!==e&&(t.scrollLeft=e)}),"main"===t&&this.config.onMainSectionScrollLeft&&(this.lastMainVirtualizationScrollLeft=e,this.config.onMainSectionScrollLeft(e)))}getSectionScrollLeft(t){var e;return null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0}restoreAll(){["pinned-left","main","pinned-right"].forEach(t=>{var e;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0;this.isSyncing=!0,this.setSectionScrollLeft(t,n),this.isSyncing=!1})}addScrollListener(t,e){this.removeScrollListener(e);const n=()=>{if(this.isSyncing)return;const n=e.scrollLeft;this.scrollLeftBySection[t]=n,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t})=>{t!==e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(n-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=n,this.config.onMainSectionScrollLeft(n)),this.isSyncing=!1};this.scrollHandlers.set(e,n),e.addEventListener("scroll",n,{passive:!0})}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t))}destroy(){["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const F={string:(t,e,n)=>{if(t===e)return 0;const o=t.localeCompare(e);return"asc"===n?o:-o},number:(t,e,n)=>{if(t===e)return 0;const o=t-e;return"asc"===n?o:-o},boolean:(t,e,n)=>{if(t===e)return 0;const o=t===e?0:t?-1:1;return"asc"===n?o:-o},date:(t,e,n)=>{const o=new Date(t),s=new Date(e);if(o.getTime()===s.getTime())return 0;const i=o.getTime()-s.getTime();return"asc"===n?i:-i},enum:(t,e,n)=>F.string(t,e,n),default:(t,e,n)=>t===e?0:null==t?"asc"===n?-1:1:null==e?"asc"===n?1:-1:"string"==typeof t&&"string"==typeof e?F.string(t,e,n):"number"==typeof t&&"number"==typeof e?F.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?F.boolean(t,e,n):F.string(t+"",e+"",n)},L=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const o=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=o(n.children,e);if(t)return t}}},s=o(n,e.key.accessor),i=(null==s?void 0:s.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let o,a;if(null==s?void 0:s.valueGetter){const i=t.indexOf(e),r=t.indexOf(n);o=s.valueGetter({accessor:l,row:e,rowIndex:i}),a=s.valueGetter({accessor:l,row:n,rowIndex:r})}else o=u(e,l),a=u(n,l);return(null==s?void 0:s.comparator)?s.comparator({rowA:e,rowB:n,valueA:o,valueB:a,direction:r}):((t,e,n="string",o)=>{if(null==t||""===t)return"asc"===o?-1:1;if(null==e||""===e)return"asc"===o?1:-1;if("number"===n){const n=t=>{var e;if("number"==typeof t)return t;const n=t+"";if("string"==typeof n){const t=n.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){let n=parseFloat(t[1]);const o=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===o?n*=1e12:"B"===o?n*=1e9:"M"===o?n*=1e6:"K"===o&&(n*=1e3),n}}return parseFloat(n)||0},s=n(t),i=n(e);return F.number(s,i,o)}return"date"===n?F.date(t+"",e+"",o):"boolean"===n?F.boolean(!!t,!!e,o):"enum"===n?F.enum(t+"",e+"",o):F.string(t+"",e+"",o)})(o,a,i,r)})})({rows:e,sortColumn:n,headers:t}),j=t=>{const{rows:e=[],headers:n=[],rowGrouping:o,rowManager:s}=t;if(s)return s.getAggregatedRows();if(!o||0===o.length)return e;const i=(t=>r(t).filter(t=>t.aggregation))(n);if(0===i.length)return e;const l=JSON.parse(JSON.stringify(e)),a=(t,e=0)=>t.map(t=>{const n=o[e],s=o[e+1],r=t[n];if(r&&f(r)){const o=a(r,e+1),l=Object.assign({},t);return l[n]=o,i.forEach(t=>{const e=((t,e,n,o)=>{const s=[],i=t=>{t.forEach(t=>{const n=o?t[o]:void 0;if(o&&n&&f(n))i(n);else{const n=u(t,e);null!=n&&s.push(n)}})};if(i(t),0===s.length)return;if("custom"===n.type&&n.customFn)return n.customFn(s);const r=n.parseValue?s.map(n.parseValue).filter(t=>!isNaN(t)):s.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?s.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=s.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(o,t.accessor,t.aggregation,s);void 0!==e&&p(l,t.accessor,e)}),l}return t});return a(l)};class B{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e=this.getInitialSort(),n=this.computeSortedRows(t.tableRows,e);this.state={sort:e,sortedRows:n}}updateHeaderLookup(){const t=r(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}getInitialSort(){if(!this.config.initialSortColumn)return null;const t=this.headerLookup.get(this.config.initialSortColumn);return t?{key:t,direction:this.config.initialSortDirection||"asc"}:null}sortNestedRows({groupingKeys:t,headers:e,rows:n,sortColumn:o}){const s=L({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?s.map(n=>{const s=t[0],i=n[s];if(f(i)){const r=this.sortNestedRows({rows:i,sortColumn:o,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[s]:r})}return n}):s}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=j({rows:t,headers:this.config.headers,rowGrouping:this.config.rowGrouping});return e?this.config.rowGrouping&&this.config.rowGrouping.length>0?this.sortNestedRows({groupingKeys:this.config.rowGrouping,headers:this.config.headers,rows:n,sortColumn:e}):L({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,o,s;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.config.tableRows}),null===(n=(e=this.config).onSortChange)||void 0===n||n.call(e,null),void this.notifySubscribers();const{accessor:i,direction:r}=t,l=this.headerLookup.get(i);if(!l)return;let a=null;if(r)a={key:l,direction:r};else{const t=l.sortingOrder||["asc","desc",null];let e=-1;this.state.sort&&this.state.sort.key.accessor===i&&(e=t.indexOf(this.state.sort.direction));const n=t[(e+1)%t.length];a=null===n?null:{key:l,direction:n}}const d=this.computeSortedRows(this.config.tableRows,a);this.state={sort:a,sortedRows:d},null===(s=(o=this.config).onSortChange)||void 0===s||s.call(o,a),this.config.announce&&this.config.announce(a?`Sorted by ${l.label}, ${"asc"===a.direction?"ascending":"descending"}`:"Sort removed from "+l.label),this.notifySubscribers()}computeSortedRowsPreview(t){const e=n=>{for(const o of n){if(o.accessor===t)return o;if(o.children&&o.children.length>0){const t=e(o.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let o=null;const s=n.sortingOrder||["asc","desc",null];let i=-1;this.state.sort&&this.state.sort.key.accessor===t&&(i=s.indexOf(this.state.sort.direction));const r=s[(i+1)%s.length];return o=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,o)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const N=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,o]=t.split("-").map(Number);return new Date(e,n-1,o,12,0,0)}const e=new Date(t);return isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0)},z=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),V=t=>{if(!t)return new Date;if("string"==typeof t)return N(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:z(e)}return t instanceof Date?z(t):new Date};class q{constructor(t){this.subscribers=new Set,this.headerLookup=new Map,this.config=t,this.updateHeaderLookup();const e={},n=this.computeFilteredRows(t.rows,e);this.state={filters:e,filteredRows:n}}updateHeaderLookup(){const t=r(this.config.headers);this.headerLookup=new Map,t.forEach(t=>{this.headerLookup.set(t.accessor,t)})}computeFilteredRows(t,e){return this.config.externalFilterHandling?t:e&&0!==Object.keys(e).length?t.filter(t=>Object.values(e).every(e=>{try{return((t,e)=>{const{operator:n,value:o,values:s}=e;if(null==t)return"isEmpty"===n;if("isEmpty"===n)return!t||""===(t+"").trim();if("isNotEmpty"===n)return t&&""!==(t+"").trim();if("string"==typeof t||"contains"===n||"notContains"===n||"startsWith"===n||"endsWith"===n){const e=(t+"").toLowerCase(),s=o?(o+"").toLowerCase():"";switch(n){case"equals":return e===s;case"notEquals":return e!==s;case"contains":return e.includes(s);case"notContains":return!e.includes(s);case"startsWith":return e.startsWith(s);case"endsWith":return e.endsWith(s)}}if("number"==typeof t||!isNaN(+t)){const e=+t,i=+o;switch(n){case"equals":return e===i;case"notEquals":return e!==i;case"greaterThan":return e>i;case"lessThan":return i>e;case"greaterThanOrEqual":return e>=i;case"lessThanOrEqual":return i>=e;case"between":if(s&&2===s.length){const[t,n]=s.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(s&&2===s.length){const[t,n]=s.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=V(t),i=V((o||"")+""),r=z(e),l=z(i);switch(n){case"equals":return r.getTime()===l.getTime();case"notEquals":return r.getTime()!==l.getTime();case"before":return l>r;case"after":return r>l;case"between":if(s&&2===s.length){const[t,e]=s.map(t=>z(V((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(s&&2===s.length){const[t,e]=s.map(t=>z(V((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!o;if(Array.isArray(t)){const e=t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", ");t=e}if("in"===n||"notIn"===n){if(s&&Array.isArray(s)){const e=s.includes(t+"");return"in"===n?e:!e}return!1}const i=(t+"").toLowerCase(),r=o?(o+"").toLowerCase():"";switch(n){case"equals":return i===r;case"notEquals":return i!==r;default:return!0}})(u(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const o=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),s=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:s},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t.accessor);e&&this.config.announce("Filter applied to "+e.label)}this.notifySubscribers()}clearFilter(t){var e,n;const o=Object.assign({},this.state.filters);delete o[t];const s=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:s},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,o),this.config.announce){const e=this.headerLookup.get(t);e&&this.config.announce("Filter removed from "+e.label)}this.notifySubscribers()}clearAllFilters(){var t,e;this.state={filters:{},filteredRows:this.config.rows},null===(e=(t=this.config).onFilterChange)||void 0===e||e.call(t,{}),this.config.announce&&this.config.announce("All filters cleared"),this.notifySubscribers()}computeFilteredRowsPreview(t){const e=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t});return this.computeFilteredRows(this.config.rows,e)}getState(){return this.state}getFilters(){return this.state.filters}getFilteredRows(){return this.state.filteredRows}destroy(){this.subscribers.clear()}}const G=(t,e)=>{const{rowTopPositions:n}=e;if(0===n.length)return 0;if(0>=t)return 0;if(t>=e.totalHeight)return n.length-1;let o=0,s=n.length-1;for(;s>o;){const e=Math.floor((o+s+1)/2);n[e]>t?s=e-1:o=e}return o},U=(t,e)=>{if(!e||0===e.length)return 0;let n=0,o=0,s=e.length;for(;s>o;){const n=Math.floor((o+s)/2);t>e[n][0]?o=n+1:s=n}for(let t=0;o>t;t++)n+=e[t][1];return n},K=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:o,tableRows:s,scrollDirection:i="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===i?(r=Math.max(l,.1*n),a=.9*n):"up"===i&&(r=.9*n,a=Math.max(l,.1*n));const d=o+e+a,c=Math.max(0,Math.floor(Math.max(0,o-r)/l)),h=Math.min(s.length,Math.ceil(d/l)),u=o+e,p=Math.max(0,Math.ceil(o/l)),f=Math.min(s.length,Math.floor(u/l)),w=o+e,v=Math.max(0,Math.floor(o/l)),m=Math.min(s.length,Math.ceil(w/l));return{rendered:{startIndex:c,endIndex:h,rows:s.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:s.slice(p,f)},partiallyVisible:{startIndex:v,endIndex:m,rows:s.slice(v,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,h=d;"down"===i?(c=Math.max(l,.1*d),h=.9*d):"up"===i&&(c=.9*d,h=Math.max(l,.1*d));const u=o+e+h,p=G(Math.max(0,o-c),r);let f=G(u,r)+1;f=Math.min(s.length,f);const w=o,v=o+e;let m=G(w,r);w>a[m]&&(m=Math.min(m+1,s.length));let g=G(v,r);g=Math.min(s.length,g);const x=o+e,b=G(o,r);let y=G(x,r)+1;return y=Math.min(s.length,y),{rendered:{startIndex:p,endIndex:f,rows:s.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:s.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:s.slice(b,y)}}},J=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+U(t,n),Y=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+U(t,n),_=(t,e)=>{var n,o;const s=t.position,i=e[s+1];return null!==(o=null===(n=null==i?void 0:i.parentIndices)||void 0===n?void 0:n.includes(s))&&void 0!==o&&o},X=new Map,Q=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i,stickyParents:r,rowGrouping:l})=>{let a=o[s];if(!a||i>10)return{stickyParents:r,regularRows:e};let d=0;if(a.parentIndices&&a.parentIndices.length>0){for(const e of a.parentIndices){const o=t[e];if(o){const e=n.some(t=>t.position===o.position);if(a.rowIndexPath&&a.rowIndexPath.length>0){const e=t[a.parentIndices[a.parentIndices.length-1]],n=e.row[l[e.depth]];if(r.length>=(Array.isArray(n)?n:[]).length-a.rowIndexPath[a.rowIndexPath.length-1])break}e||r.some(t=>v(t.rowId)===v(o.rowId))||(r.push(o),d++)}}if(r.length>0){_(a,t)&&(r.push(a),d++);const e=o[s+=d];e&&(a=e)}}else if(_(a,t))return r.push(a),s++,Q({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i+1,stickyParents:r,rowGrouping:l});return _(a,t)?Q({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:s,recursionDepth:i+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Z=(t,e,n)=>{const o=t.getBoundingClientRect(),s=e.getBoundingClientRect(),i=10;if(s.top+i>o.top?e.scrollTop-=s.top-o.top+i:o.bottom>s.bottom-i&&(e.scrollTop+=o.bottom-s.bottom+i),n){const t=n.getBoundingClientRect();t.left+i>o.left?n.scrollLeft-=t.left-o.left+i:o.right>t.right-i&&(n.scrollLeft+=o.right-t.right+i)}},tt=(t,e,n,o)=>{const s=document.querySelector(".st-body-container"),i=document.querySelector(".st-body-main");if(!s)return;const r=o?o.findIndex(e=>v(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=s.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&o){const t=((t,e,n,o)=>{const s=K({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:o,scrollDirection:"none"}),{startIndex:i,endIndex:r}=s.fullyVisible;return t>=i&&r>t})(l,s,e,o);if(t)return void Z(d,s,i)}if(!d)return s.scrollTop=Math.max(0,l*a-s.clientHeight/3),void setTimeout(()=>{const e=s.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&Z(e,s,i)},100);Z(d,s,i)},et=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function nt(t,e,n,o){const s=new Set,i=new Map;n.forEach((t,e)=>{const n=v(t.rowId);i.set(n,e)});const r=i.get(t.rowId+""),l=i.get(e.rowId+""),a=void 0!==r?r:t.rowIndex,d=void 0!==l?l:e.rowIndex,c=Math.min(a,d),h=Math.max(a,d),u=Math.min(t.colIndex,e.colIndex),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const i=v(n[t].rowId);s.add(et({colIndex:e,rowIndex:t,rowId:i}))}return s}function ot(t,e){var n,o,s;const i=document.querySelector(".st-body-container");if(!i)return null;const r=i.getBoundingClientRect(),l=Math.max(r.left,Math.min(r.right,t)),a=Math.max(r.top,Math.min(r.bottom,e)),d=document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===d.length)return null;const c=new Map;for(let t=0;d.length>t;t++){const e=d[t],o=e.getAttribute("data-row-id"),s=null!==(n=null!=o?o:e.getAttribute("data-row-index"))&&void 0!==n?n:"";if(!s)continue;let i=c.get(s);i||(i=[],c.set(s,i)),i.push(e)}const h=[];c.forEach((t,e)=>{const n=t[0].getBoundingClientRect();h.push({key:e,top:n.top,bottom:n.bottom})}),h.sort((t,e)=>t.top-e.top);let u=null,p=1/0;for(let t=0;h.length>t;t++){const{key:e,top:n,bottom:o}=h[t];if(a>=n&&o>=a){u=e,p=0;break}const s=Math.abs(a-(n+o)/2);p>s&&(p=s,u=e)}if(null===u)return null;const f=c.get(u);if(!f||0===f.length)return null;let w=null,v=1/0;for(let t=0;f.length>t;t++){const e=f[t],n=parseInt(null!==(o=e.getAttribute("data-row-index"))&&void 0!==o?o:"-1",10),i=parseInt(null!==(s=e.getAttribute("data-col-index"))&&void 0!==s?s:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>i||null==r||""===r)continue;const d=e.getBoundingClientRect(),c=Math.sqrt((d.left+d.width/2-l)**2+(d.top+d.height/2-a)**2);v>c&&(v=c,w=e)}if(null!==w){const t=parseInt(w.getAttribute("data-row-index")||"-1",10),e=parseInt(w.getAttribute("data-col-index")||"-1",10),n=w.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class st{constructor(t){this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.initialFocusedCell=null,this.copyFlashCells=new Set,this.warningFlashCells=new Set,this.isSelecting=!1,this.startCell=null,this.keydownHandler=null,this.currentMouseX=null,this.currentMouseY=null,this.scrollAnimationFrame=null,this.lastSelectionUpdate=0,this.selectionThrottleMs=16,this.globalMouseMoveHandler=null,this.globalMouseUpHandler=null,this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.leafHeaders=[],this.rowIdToTableIndex=new Map,this.selectedByRowIdColIndex=new Set,this.fullTableSelected=!1,this.config=t,this.updateDerivedState(),this.setupKeyboardNavigation()}updateConfig(t,e){this.config=Object.assign(Object.assign({},this.config),t),(null==e?void 0:e.positionOnlyBody)?this.updateRowIdAndSelectionLookupOnly():this.updateDerivedState()}updateDerivedState(){if(this.leafHeaders=this.config.headers.flatMap(t=>g(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(v(t.rowId),e)}),this.fullTableSelected){this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set;const t=this.leafHeaders.length,e=this.config.enableRowSelection?1:0;for(let n=0;t>n;n++)this.columnsWithSelectedCells.add(n+e);return this.rowsWithSelectedCells=new Set,void this.config.tableRows.forEach(t=>{this.rowsWithSelectedCells.add(v(t.rowId))})}this.selectedByRowIdColIndex.clear(),this.columnsWithSelectedCells=new Set,this.rowsWithSelectedCells=new Set,this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||(this.selectedByRowIdColIndex.add(`${n}\t${t}`),this.columnsWithSelectedCells.add(t),this.rowsWithSelectedCells.add(n))}}),this.selectedColumns.forEach(t=>{this.columnsWithSelectedCells.add(t),this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${v(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(v(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(v(t.rowId),e)}),this.fullTableSelected||(this.selectedByRowIdColIndex.clear(),this.selectedCells.forEach(t=>{const e=t.split("-");if(e.length>=3){const t=parseInt(e[1],10),n=e.slice(2).join("-");isNaN(t)||this.selectedByRowIdColIndex.add(`${n}\t${t}`)}}),this.selectedColumns.forEach(t=>{this.config.tableRows.forEach(e=>{this.selectedByRowIdColIndex.add(`${v(e.rowId)}\t${t}`)})}))}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleKeyDown(t){if(!this.config.selectableCells)return;if(!this.initialFocusedCell)return;const e=document.activeElement;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||"true"===(null==e?void 0:e.getAttribute("contenteditable")))){if((t.ctrlKey||t.metaKey)&&"a"===t.key)return t.preventDefault(),void this.selectAll();if(0!==this.selectedCells.size||this.fullTableSelected){if(!t.ctrlKey&&!t.metaKey||"c"!==t.key)return(t.ctrlKey||t.metaKey)&&"v"===t.key?(t.preventDefault(),void this.pasteFromClipboard()):"Delete"===t.key||"Backspace"===t.key?(t.preventDefault(),void this.deleteSelectedCells()):void("Escape"!==t.key?this.handleNavigationKeys(t):this.clearSelection());this.copyToClipboard()}}}handleNavigationKeys(t){if(!this.initialFocusedCell)return;let{rowIndex:e,colIndex:n,rowId:o}=this.initialFocusedCell;const s=this.config.tableRows[e];if((s?v(s.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>v(t.rowId)===o);if(-1===t)return;e=t}"ArrowUp"===t.key?(t.preventDefault(),this.handleArrowUp(t,e,n)):"ArrowDown"===t.key?(t.preventDefault(),this.handleArrowDown(t,e,n)):"ArrowLeft"===t.key||"Tab"===t.key&&t.shiftKey?(t.preventDefault(),this.handleArrowLeft(t,e,n)):"ArrowRight"===t.key||"Tab"===t.key?(t.preventDefault(),this.handleArrowRight(t,e,n)):"Home"===t.key?(t.preventDefault(),this.handleHome(t,e,n)):"End"===t.key?(t.preventDefault(),this.handleEnd(t,e,n)):"PageUp"===t.key?(t.preventDefault(),this.handlePageUp(t,e,n)):"PageDown"===t.key&&(t.preventDefault(),this.handlePageDown(t,e,n))}findEdgeInDirection(t,e,n){return function(t,e,n,o,s,i){let r=o,l=s;return"up"===i?r=0:"down"===i?r=t-1:"left"===i?l=n?1:0:"right"===i&&(l=n?e:e-1),{rowIndex:r,colIndex:l}}(this.config.tableRows.length,this.leafHeaders.length,!!this.config.enableRowSelection,t,e,n)}handleArrowUp(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e-1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex),o>=0){const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(e>0){let o=e-1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"up").rowIndex);const s=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:s}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let o=e+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>o){const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let o=e+1;(t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"down").rowIndex);const s=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:s}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n-1;if(t.ctrlKey||t.metaKey)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=v(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(n>0){let o=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)o=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===o)return;if(o>=0){const t=v(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let s=n+1;if((t.ctrlKey||t.metaKey)&&(s=this.findEdgeInDirection(e,n,"right").colIndex),o>=s){const t=v(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:s,rowId:t})}}else if(o>n){let s=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(s=this.findEdgeInDirection(e,n,"right").colIndex),o>=s){const t=v(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:s,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const s=v(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:s})}else{let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const s=v(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:s}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const s=v(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:s})}else{let n=e;const o=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const s=v(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:s}),this.startCell=null}}handlePageUp(t,e,n){let o=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let o=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=v(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=v(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:t}),this.startCell=null}}copyToClipboard(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const e=((t,e,n,o=!1)=>{const s=this.leafHeaders.filter(t=>!t.hide&&!t.excludeFromRender),i=new Map,r=new Map;s.forEach((t,e)=>{i.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var o;const[s,l]=e.split("-").map(Number);t[s]||(t[s]=[]);const a=i.get(l),d=r.get(l);if(a&&(null===(o=n[s])||void 0===o?void 0:o.row)){const e=n[s].row,o=u(e,a);if(!1!==(null==d?void 0:d.useFormattedValueForClipboard)&&(null==d?void 0:d.valueFormatter)){const n=d.valueFormatter({accessor:a,colIndex:l,row:e,rowIndex:s,value:o});t[s][l]=n}else t[s][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?o:Array.isArray(o)?o.join(", "):""}else t[s][l]="";return t},{}),a=new Set;o&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);a.add(e)});let d="";o&&a.size>0&&(d=Array.from(a).sort((t,e)=>t-e).map(t=>{var e;const n=r.get(t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:""}).join("\t"));const c=Object.values(l).map(t=>Object.values(t).join("\t")).join("\n");return o&&d?`${d}\n${c}`:c})(t,0,this.config.tableRows,this.config.copyHeadersToClipboard);navigator.clipboard.writeText(e),this.copyFlashCells=new Set(t),this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)}async pasteFromClipboard(){if(this.initialFocusedCell)try{const t=await navigator.clipboard.readText();if(!t)return;const{updatedCells:e,warningCells:n}=((t,e,n,o,s,i)=>{const r=new Set,l=new Set,a=t.split("\n").filter(t=>t.length>0);if(0===a.length)return{updatedCells:r,warningCells:l};const d=n.filter(t=>!t.hide&&!t.excludeFromRender),c=o.findIndex(t=>v(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{const a=h+e,c=u+n;if(a>=o.length||c>=d.length)return;const f=o[a],w=d[c],m=v(f.rowId);if(!(null==w?void 0:w.isEditable))return void l.add(`${a}-${c}-${m}`);let g=t;if("number"===w.type){const e=+t;isNaN(e)||(g=e)}else if("boolean"===w.type)g="true"===t.toLowerCase()||"1"===t;else if("date"===w.type){const e=new Date(t);isNaN(e.getTime())||(g=e)}else"lineAreaChart"!==w.type&&"barChart"!==w.type||(g=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(p(f.row,w.accessor,g),i){const t=i.get(`${m}-${w.accessor}`);t&&t.updateContent(g)}null==s||s({accessor:w.accessor,newValue:g,row:f.row,rowIndex:a}),r.add(`${a}-${c}-${m}`)})}),{updatedCells:r,warningCells:l}})(t,this.initialFocusedCell,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}catch(t){console.warn("Failed to paste from clipboard:",t)}}deleteSelectedCells(){const t=this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells;if(0===t.size)return;const{deletedCells:e,warningCells:n}=((t,e,n,o,s)=>{const i=new Set,r=new Set,l=e.filter(t=>!t.hide&&!t.excludeFromRender),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{const[e,a]=t.split("-").map(Number);if(e>=n.length||a>=l.length)return;const d=n[e],c=l[a],h=v(d.rowId);if(!(null==c?void 0:c.isEditable))return void r.add(t);let f=null;if(f="string"===c.type?"":"number"===c.type?null:"boolean"!==c.type&&("date"===c.type?null:"lineAreaChart"===c.type||"barChart"===c.type||Array.isArray(u(d.row,c.accessor))?[]:""),p(d.row,c.accessor,f),s){const t=s.get(`${h}-${c.accessor}`);t&&t.updateContent(f)}null==o||o({accessor:c.accessor,newValue:f,row:d.row,rowIndex:e}),i.add(t)}),{deletedCells:i,warningCells:r}})(t,this.leafHeaders,this.config.tableRows,this.config.onCellEdit,this.config.cellRegistry);e.size>0&&(this.copyFlashCells=e,this.updateCellFlashClasses(),setTimeout(()=>{this.copyFlashCells=new Set,this.updateCellFlashClasses()},800)),n.size>0&&(this.warningFlashCells=n,this.updateCellFlashClasses(),setTimeout(()=>{this.warningFlashCells=new Set,this.updateCellFlashClasses()},800))}selectAll(){this.fullTableSelected=!0,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.updateDerivedState(),this.updateAllCellClasses()}buildFullTableSelectedSet(){const t=new Set;for(let e=0;this.config.tableRows.length>e;e++)for(let n=0;this.leafHeaders.length>n;n++){const o=this.config.enableRowSelection?n+1:n,s=v(this.config.tableRows[e].rowId);t.add(`${e}-${o}-${s}`)}return t}clearSelection(){this.fullTableSelected=!1,this.selectedCells=new Set,this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.startCell=null,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedCells(t){this.fullTableSelected=!1,this.selectedCells=t,this.updateDerivedState(),this.updateAllCellClasses()}setSelectedColumns(t){this.fullTableSelected=!1,this.selectedColumns=t,this.updateDerivedState(),this.updateAllCellClasses()}updateCellFlashClasses(){requestAnimationFrame(()=>{document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=parseInt(t.getAttribute("data-row-index")||"-1",10),n=parseInt(t.getAttribute("data-col-index")||"-1",10),o=t.getAttribute("data-row-id");if(0>e||0>n||!o)return;const s=et({rowIndex:e,colIndex:n,rowId:o}),i=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:o});this.copyFlashCells.has(s)?t.classList.add(i?"st-cell-copy-flash-first":"st-cell-copy-flash"):t.classList.remove("st-cell-copy-flash-first","st-cell-copy-flash"),this.warningFlashCells.has(s)?t.classList.add(i?"st-cell-warning-flash-first":"st-cell-warning-flash"):t.classList.remove("st-cell-warning-flash-first","st-cell-warning-flash")})})}syncHeaderSelectionClasses(){var t;if(!this.config.selectableColumns)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell"),n=new Map;for(const t of r(this.config.headers))n.set(t.accessor+"",t);for(let t=0;e.length>t;t++){const o=e[t];if(!(o instanceof HTMLElement))continue;const s=o.getAttribute("data-accessor"),r=o.getAttribute("aria-colindex");if(!s||!r)continue;const l=parseInt(r,10)-1;if(0>l||Number.isNaN(l))continue;const a=n.get(s);if(!a)continue;if(a.isSelectionColumn&&this.config.enableRowSelection){for(const t of st.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const d=i(a,l),c=d.some(t=>this.selectedColumns.has(t)),h=!c&&d.some(t=>this.columnsWithSelectedCells.has(t));if(c)o.classList.add("st-header-selected"),o.classList.remove("st-header-has-highlighted-cell");else if(h)o.classList.add("st-header-has-highlighted-cell"),o.classList.remove("st-header-selected");else for(const t of st.HEADER_SELECTION_CLASSES)o.classList.remove(t)}}clearHeaderSelectionHighlightClasses(){var t;if(!this.config.selectableColumns)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell");for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement)for(const t of st.HEADER_SELECTION_CLASSES)n.classList.remove(t)}}syncAllCellClasses(){var t;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]");if(this.fullTableSelected||0!==this.selectedCells.size||0!==this.selectedColumns.size){for(let t=0;e.length>t;t++){const n=e[t];if(!(n instanceof HTMLElement))continue;const o=parseInt(n.getAttribute("data-row-index")||"-1",10),s=parseInt(n.getAttribute("data-col-index")||"-1",10),i=n.getAttribute("data-row-id");if(0>o||0>s||!i)continue;const r={rowIndex:o,colIndex:s,rowId:i},l=this.isSelected(r),a=this.selectedColumns.has(s),d=l&&!a,c=this.isInitialFocusedCell(r),h=this.getBorderClass(r),u=new Set;d&&(u.add(c?"st-cell-selected-first":"st-cell-selected"),h.split(" ").filter(Boolean).forEach(t=>u.add(t))),a&&u.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of st.SELECTION_CLASSES){const e=u.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of st.SELECTION_CLASSES)n.classList.contains(t)&&n.classList.remove(t);"-1"!==n.getAttribute("tabindex")&&n.setAttribute("tabindex","-1")}}this.clearHeaderSelectionHighlightClasses()}}updateAllCellClasses(){this.isSelecting||this.fullTableSelected?this.syncAllCellClasses():requestAnimationFrame(()=>this.syncAllCellClasses())}isSelected({colIndex:t,rowIndex:e,rowId:n}){if(this.fullTableSelected)return!0;const o=n+"";if(this.selectedByRowIdColIndex.has(`${o}\t${t}`))return!0;const s=this.rowIdToTableIndex.get(o);if(void 0!==s){const e=et({rowIndex:s,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const i=et({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(i)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var o;if(this.isSelecting)return"";const s=null!==(o=this.rowIdToTableIndex.get(n+""))&&void 0!==o?o:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,o=[];return 0===s&&o.push("st-selected-top-border"),s===this.config.tableRows.length-1&&o.push("st-selected-bottom-border"),t===e&&o.push("st-selected-left-border"),t===n&&o.push("st-selected-right-border"),o.join(" ")}const i=[],r=this.config.tableRows[s-1],l=r?v(r.rowId):null,a=this.config.tableRows[s+1],d=a?v(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:s-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:s+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:s,rowId:n}),p=this.isSelected({colIndex:t+1,rowIndex:s,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===s)&&i.push("st-selected-top-border"),(!d||!h||this.selectedColumns.has(t)&&s===this.config.tableRows.length-1)&&i.push("st-selected-bottom-border"),u||i.push("st-selected-left-border"),p||i.push("st-selected-right-border"),i.join(" ")}isInitialFocusedCell({colIndex:t,rowId:e}){return!!this.initialFocusedCell&&t===this.initialFocusedCell.colIndex&&e+""==this.initialFocusedCell.rowId+""}isCopyFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=et({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=et({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(o)}getColumnsWithSelectedCells(){return this.columnsWithSelectedCells}getRowsWithSelectedCells(){return this.rowsWithSelectedCells}getSelectedCells(){return this.fullTableSelected?this.buildFullTableSelectedSet():this.selectedCells}getSelectedColumns(){return this.selectedColumns}getLastSelectedColumnIndex(){return this.lastSelectedColumnIndex}getStartCell(){return this.startCell}setInitialFocusedCell(t){this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses()}selectSingleCell(t){if(t.rowIndex>=0&&this.config.tableRows.length>t.rowIndex&&t.colIndex>=0&&(this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1)>=t.colIndex){this.fullTableSelected=!1;const e=et(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>tt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=nt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>tt(e,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}selectColumns(t,e=!1){this.fullTableSelected=!1,this.selectedCells=new Set,this.initialFocusedCell=null;const n=new Set(e?this.selectedColumns:[]);t.forEach(t=>n.add(t)),this.selectedColumns=n,t.length>0&&(this.lastSelectedColumnIndex=t[t.length-1]),this.updateDerivedState(),this.updateAllCellClasses()}updateSelectionRange(t,e){this.fullTableSelected=!1;const n=nt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}calculateNearestCell(t,e){return ot(t,e)}getCellFromMousePosition(t,e){return function(t,e){const n=document.elementFromPoint(t,e);if(!n)return null;const o=n.closest(".st-cell");if(o instanceof HTMLElement){const t=parseInt(o.getAttribute("data-row-index")||"-1",10),e=parseInt(o.getAttribute("data-col-index")||"-1",10),n=o.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return ot(t,e)}(t,e)}handleAutoScroll(t,e){var n;!function(t,e,n=document){const o=n.querySelector(".st-body-container");if(!o)return;const s=o.getBoundingClientRect(),i=Math.max(0,o.scrollHeight-o.clientHeight);s.top+50>e?o.scrollTop=Math.max(0,o.scrollTop-10*Math.min(3,1+Math.max(0,s.top-e)/100)):e>s.bottom-50&&(o.scrollTop=Math.min(i,o.scrollTop+10*Math.min(3,1+Math.max(0,e-s.bottom)/100)));const r=n.querySelector(".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);s.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,s.left-t)/100)):t>s.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-s.right)/100)))}}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:document)}continuousScroll(){if(this.isSelecting&&this.startCell){if(null!==this.currentMouseX&&null!==this.currentMouseY){this.handleAutoScroll(this.currentMouseX,this.currentMouseY);const t=Date.now();if(t-this.lastSelectionUpdate>=this.selectionThrottleMs){const e=this.getCellFromMousePosition(this.currentMouseX,this.currentMouseY);e&&(this.updateSelectionRange(this.startCell,e),this.lastSelectionUpdate=t)}}this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll())}else null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleMouseDown({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const o=et({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n},this.updateDerivedState(),this.updateAllCellClasses()},0),this.currentMouseX=null,this.currentMouseY=null,this.lastSelectionUpdate=0,this.globalMouseMoveHandler=t=>{this.isSelecting&&this.startCell&&(this.currentMouseX=t.clientX,this.currentMouseY=t.clientY)},this.globalMouseUpHandler=()=>{var t,e;this.isSelecting=!1,null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null===(e=(t=this.config).onSelectionDragEnd)||void 0===e||e.call(t),this.syncAllCellClasses(),requestAnimationFrame(()=>this.syncAllCellClasses())},document.addEventListener("mousemove",this.globalMouseMoveHandler),document.addEventListener("mouseup",this.globalMouseUpHandler),this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll()))}handleMouseOver({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&this.isSelecting&&this.startCell&&this.updateSelectionRange(this.startCell,{colIndex:t,rowIndex:e,rowId:n})}}st.SELECTION_CLASSES=["st-cell-selected","st-cell-selected-first","st-cell-column-selected","st-cell-column-selected-first","st-selected-top-border","st-selected-bottom-border","st-selected-left-border","st-selected-right-border"],st.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const it=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(v(t.rowId))).map(t=>t.row);class rt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:it(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(v(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const o=this.config.tableRows.find(e=>v(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>v(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>v(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>v(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class lt{constructor(){this.callbacks=new Set,this.isListening=!1,this.handleResize=()=>{this.callbacks.forEach(t=>t())}}addCallback(t){return this.callbacks.add(t),this.isListening||this.startListening(),()=>{this.callbacks.delete(t),0===this.callbacks.size&&this.stopListening()}}startListening(){this.isListening||(window.addEventListener("resize",this.handleResize),this.isListening=!0)}stopListening(){this.isListening&&(window.removeEventListener("resize",this.handleResize),this.isListening=!1)}destroy(){this.stopListening(),this.callbacks.clear()}}class at{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,o,s,i,r;const l=t.target;if(!l.closest(".editable-cell-input")||!l.closest(".st-header-cell")){if(this.config.activeHeaderDropdown&&this.config.setActiveHeaderDropdown){const t=l.closest(".st-dropdown-content")||l.closest(".dropdown-content");l.closest(".st-header-cell")||t||this.config.setActiveHeaderDropdown(null)}if(!(l.closest(".st-cell")||this.config.selectableColumns&&(l.classList.contains("st-header-cell")||l.classList.contains("st-header-label")||l.classList.contains("st-header-label-text")))){const t=null!==(o=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==o?o:this.config.selectedCells,l=null!==(r=null===(i=(s=this.config).getSelectedColumns)||void 0===i?void 0:i.call(s))&&void 0!==r?r:this.config.selectedColumns;(t.size>0||l.size>0)&&(this.config.onClearSelection?this.config.onClearSelection():(this.config.setSelectedCells(new Set),this.config.setSelectedColumns(new Set),this.config.startCell&&(this.config.startCell.current=null)))}}},this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}startListening(){this.isListening||(document.addEventListener("mousedown",this.handleClickOutside),this.isListening=!0)}stopListening(){this.isListening&&(document.removeEventListener("mousedown",this.handleClickOutside),this.isListening=!1)}destroy(){this.stopListening()}}class dt{constructor(t){this.isMainSectionScrollable=!1,this.headerContainer=null,this.mainSection=null,this.scrollbarWidth=0,this.resizeObserver=null,this.observers=new Set,this.rafId=null,this.headerContainer=t.headerContainer||null,this.mainSection=t.mainSection||null,this.scrollbarWidth=t.scrollbarWidth,this.mainSection&&this.headerContainer&&this.initialize()}initialize(){this.mainSection&&this.headerContainer&&(this.checkScrollability(),this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.checkScrollability()})}),this.resizeObserver.observe(this.mainSection))}checkScrollability(){if(this.mainSection){const t=this.mainSection.scrollHeight>this.mainSection.clientHeight;t!==this.isMainSectionScrollable&&(this.isMainSectionScrollable=t,this.updateHeaderPadding(),this.notifyObservers())}}updateHeaderPadding(){this.headerContainer&&(this.isMainSectionScrollable?(this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",this.scrollbarWidth+"px")):this.headerContainer.classList.remove("st-header-scroll-padding"))}setScrollbarWidth(t){this.scrollbarWidth=t,this.updateHeaderPadding()}setHeaderContainer(t){this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.headerContainer=t,this.updateHeaderPadding()}setMainSection(t){this.resizeObserver&&this.mainSection&&this.resizeObserver.unobserve(this.mainSection),this.mainSection=t,this.mainSection&&this.headerContainer&&this.initialize()}getIsMainSectionScrollable(){return this.isMainSectionScrollable}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.isMainSectionScrollable))}destroy(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&this.mainSection&&(this.resizeObserver.unobserve(this.mainSection),this.resizeObserver=null),this.headerContainer&&this.headerContainer.classList.remove("st-header-scroll-padding"),this.observers.clear()}}const ct=(t,e)=>{if(!e||0===e.length)return new Set;if(t){const t=Array.from({length:e.length},(t,e)=>e);return new Set(t)}return new Set};class ht{constructor(t,e){this.observers=new Set,this.expandedDepths=ct(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class ut{constructor(){this.announcement="",this.timeoutId=null,this.observers=new Set}announce(t){this.announcement=t,this.notifyObservers(),this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.announcement="",this.notifyObservers()},1e3)}getAnnouncement(){return this.announcement}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.announcement))}destroy(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.observers.clear(),this.announcement=""}}function pt(t){return t?t.offsetWidth-t.clientWidth:0}const ft=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(ft);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=ft(t[n]));return e},wt=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),vt={rowHeight:32,headerHeight:32,footerHeight:49,rowSeparatorWidth:1,borderWidth:1,pinnedBorderWidth:1,nestedGridBorderWidth:2,nestedGridPaddingTop:8,nestedGridPaddingBottom:8,nestedGridPaddingLeft:8,nestedGridPaddingRight:8,nestedGridMaxHeight:400,selectionColumnWidth:42},mt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},gt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},xt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},bt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},yt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t),o.setAttribute("cy",n),o.setAttribute("r","1.5"),o.setAttribute("fill","currentColor"),e.appendChild(o)}),e},Rt=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e};function Ct(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function St(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function It(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=St(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Ht(t,e){var n;const{pinnedLeft:o,unpinned:s,pinnedRight:i}=Ct(t);if(!It(o,e))return!1;if(!It(s,e))return!1;if(!It(i,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Mt(o.children,e))return!1;return!0}function Mt(t,e){var n;if(!It(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Mt(o.children,e))return!1;return!0}function kt(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=Ct(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function Et(t,e,n){return[...t.filter(t=>St(e.get(t+""),n)),...t.filter(t=>!St(e.get(t+""),n))]}function Ot(t,e,n){const o=new Set(t.map(t=>t.accessor+"")),s=[...e.left,...e.main,...e.right];if(s.length!==o.size)return null;for(const t of s)if(!o.has(t+""))return null;const i=new Map(t.map(t=>[t.accessor+"",t])),r=Et(e.left,i,n),l=Et(e.main,i,n),a=Et(e.right,i,n),d=(t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n};return[...r.map(t=>d(i.get(t+""),"left")),...l.map(t=>d(i.get(t+""),void 0)),...a.map(t=>d(i.get(t+""),"right"))]}function Tt(t,e,n,o){const s=e+"",i=kt(t),r=i.left.filter(t=>t+""!==s),l=i.main.filter(t=>t+""!==s),a=i.right.filter(t=>t+""!==s),d=t.find(t=>t.accessor+""===s);return d&&(!St(d,o)||"main"!==n||"left"!==d.pinned&&"right"!==d.pinned)?("left"===n?r.push(e):"right"===n?a.push(e):"left"===d.pinned?l.unshift(e):l.push(e),Ot(t,{left:r,main:l,right:a},o)):null}class At{static resolveIcons(t){var e,n,o,s,i,r,l,a,d,c,h,u,p,f,w,v,m,g;const x={drag:yt("st-drag-icon"),expand:gt("st-expand-icon"),filter:Rt("st-header-icon"),headerCollapse:gt("st-header-icon"),headerExpand:mt("st-header-icon"),next:gt("st-next-prev-icon"),prev:mt("st-next-prev-icon"),sortDown:bt("st-header-icon"),sortUp:xt("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:x.drag,expand:null!==(s=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==s?s:x.expand,filter:null!==(r=null===(i=t.icons)||void 0===i?void 0:i.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(v=null===(w=t.icons)||void 0===w?void 0:w.sortDown)&&void 0!==v?v:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.sortUp}}static mergeCustomTheme(t){return Object.assign(Object.assign({},vt),t.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,s,i,r,l,a,d,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(s=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.searchEnabled)||void 0===s||s,searchPlaceholder:null!==(r=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const s of t)s.isEssential&&e.add(s.accessor+""),(null===(o=s.children)||void 0===o?void 0:o.length)&&n(s.children)};return n(t),e}(t)}static getInitialCollapsedHeaders(t){const e=new Set,n=t=>{t.forEach(t=>{t.collapseDefault&&t.collapsible&&e.add(t.accessor),t.children&&n(t.children)})};return n(t),e}static getInitialExpandedDepths(t){var e;return ct(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Wt{constructor(){this.elements=null,this.refs={mainBodyRef:{current:null},pinnedLeftRef:{current:null},pinnedRightRef:{current:null},mainHeaderRef:{current:null},pinnedLeftHeaderRef:{current:null},pinnedRightHeaderRef:{current:null},headerContainerRef:{current:null},tableBodyContainerRef:{current:null},horizontalScrollbarRef:{current:null}}}createDOMStructure(t,e){var n,o,s;const i=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(o=e.className)&&void 0!==o?o:"",l=null!==(s=e.columnBorders)&&void 0!==s&&s,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${i} ${r} ${l?"st-column-borders":""}`,a.setAttribute("role","grid");const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),d.appendChild(c),d.appendChild(f),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}getElements(){return this.elements}getRefs(){return this.refs}destroy(t){var e;(null===(e=this.elements)||void 0===e?void 0:e.rootElement)&&t.contains(this.elements.rootElement)&&t.removeChild(this.elements.rootElement),this.elements=null}}const Pt=new WeakMap;let $t=0,Dt=Date.now(),Ft={screenX:0,screenY:0},Lt=null;const jt=t=>{Dt=t},Bt=new WeakMap,Nt=t=>(Bt.has(t)||Bt.set(t,new Map),Bt.get(t)),zt=new WeakMap,Vt=t=>(zt.has(t)||zt.set(t,new Map),zt.get(t)),qt=(t,e)=>{const n=Date.now();0!==$t&&e>n-$t||($t=n,t())},Gt=(t,e,n,o)=>{t.addEventListener(e,n,o),Pt.has(t)||Pt.set(t,[]),Pt.get(t).push({event:e,handler:n,options:o})},Ut=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},Kt=t=>{if($t=0,t){const e=Nt(t);e.forEach(t=>{t.remove()}),e.clear(),Vt(t).clear(),Ut(t)}},Jt={equals:"Equals",notEquals:"Not equals",contains:"Contains",notContains:"Does not contain",startsWith:"Starts with",endsWith:"Ends with",greaterThan:"Greater than",lessThan:"Less than",greaterThanOrEqual:"Greater than or equal",lessThanOrEqual:"Less than or equal",between:"Between",notBetween:"Not between",before:"Before",after:"After",in:"Is one of",notIn:"Is not one of",isEmpty:"Is empty",isNotEmpty:"Is not empty"},Yt=t=>{switch(t){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},_t=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Xt=t=>["between","notBetween","in","notIn"].includes(t),Qt=t=>["isEmpty","isNotEmpty"].includes(t),Zt=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},te=t=>{var e,n,o;let{children:s,containerRef:i,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:p="fixed",allowDescendantOverflow:f=!1}=t,w=f;const v="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",w&&m.classList.add(v),m.style.position=p,m.style.overflow=w?"visible":c,h&&(m.style.width=h+"px"),u&&(m.style.maxWidth=u+"px"),m.addEventListener("click",t=>t.stopPropagation()),m.addEventListener("mousedown",t=>t.stopPropagation()),m.addEventListener("touchstart",t=>t.stopPropagation()),m.appendChild(s);let g=l;if("fixed"===p){const t=null!==(o=null!==(n=null!==(e=Zt(g))&&void 0!==e?e:Zt(null!=r?r:null))&&void 0!==n?n:Zt(null!=i?i:null))&&void 0!==o?o:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,o=h||m.offsetWidth;let s;s=i?i.getBoundingClientRect():r?r.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:()=>{}};const l=s.bottom-e.bottom,a=e.top-s.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(o>s.right-e.right+e.width&&(c="right"),"fixed"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${w?" "+v:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=w?"visible":c),void 0!==t.allowDescendantOverflow&&(w=t.allowDescendantOverflow,m.classList.toggle(v,w),m.style.overflow=w?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},ee=t=>{let{value:e,onChange:n,options:o,placeholder:s="Select...",className:i="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!1,c=-1;const h=document.createElement("div");h.className=`st-custom-select ${i} ${r?"st-custom-select-disabled":""}`.trim();const u=document.createElement("button");u.type="button",u.className="st-custom-select-trigger",u.disabled=r,u.setAttribute("aria-haspopup","listbox"),u.setAttribute("aria-expanded","false"),u.setAttribute("aria-labelledby","select-label");const p=document.createElement("span");p.className="st-custom-select-value";const f=o.find(t=>t.value===e);p.textContent=f?f.label:s;const w=document.createElement("template");w.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const v=w.content.firstElementChild;u.appendChild(p),u.appendChild(v),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.innerHTML="",o.forEach((t,n)=>{const o=document.createElement("div");o.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),o.setAttribute("role","option"),o.setAttribute("aria-selected",""+(t.value===e)),o.setAttribute("tabindex","0"),o.textContent=t.label,o.addEventListener("click",()=>y(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(o)})};g();const x=te({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=o.find(t=>t.value===e);p.textContent=n?n.label:s},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);p.textContent=n?n.label:s,g()}void 0!==t.options&&(o=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},ne=t=>{let{type:e="text",value:n,onChange:o,onEnter:s,placeholder:i="",autoFocus:r=!1,min:l,max:a,step:d}=t;const c=document.createElement("input");c.className="st-filter-input",c.type=e,c.value=n,c.placeholder=i,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&setTimeout(()=>c.focus(),0);const h=t=>{o(t.target.value)},u=t=>{"Enter"===t.key&&s&&(t.preventDefault(),s())};return c.addEventListener("input",h),c.addEventListener("keydown",u),{element:c,update:t=>{void 0!==t.value&&(n=t.value,c.value=n),void 0!==t.type&&(e=t.type,c.type=e),void 0!==t.placeholder&&(i=t.placeholder,c.placeholder=i),void 0!==t.min&&(l=t.min,c.min=l),void 0!==t.max&&(a=t.max,c.max=a),void 0!==t.step&&(d=t.step,c.step=d),void 0!==t.onChange&&(o=t.onChange),void 0!==t.onEnter&&(s=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},oe=t=>{let{onApply:e,onClear:n,canApply:o,showClear:s}=t;const i=document.createElement("div");i.className="st-filter-actions";const r=document.createElement("button");r.type="button",r.tabIndex=0,r.textContent="Apply";const l=()=>{r.disabled=!o,r.className=("st-filter-button st-filter-button-apply"+(o?"":" st-filter-button-disabled")).trim()};l();const a=()=>{e()};r.addEventListener("click",a),i.appendChild(r);let d=null;const c=()=>{null==n||n()},h=()=>{const t=s&&!!n;t&&!d?(d=document.createElement("button"),d.type="button",d.tabIndex=0,d.className="st-filter-button st-filter-button-clear",d.textContent="Clear",d.addEventListener("click",c),i.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return h(),{element:i,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(s=t.showClear,h()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,h())},destroy:()=>{r.removeEventListener("click",a),d&&d.removeEventListener("click",c),i.remove()}}},se=t=>{let{onChange:e,onClose:n,value:o}=t,s=o||new Date,i="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{s=new Date(s.getFullYear(),s.getMonth()-1,1),f()},d=()=>{s=new Date(s.getFullYear(),s.getMonth()+1,1),f()},c=t=>{s=new Date(t,s.getMonth(),1),i="months",f()},h=t=>{const o=s.getFullYear(),i=s.getMonth(),r=new Date(o,i,t,12,0,0);s=r,e(r),null==n||n()},u=t=>{const o=new Date(s.getFullYear(),s.getMonth()-1,t,12,0,0);s=o,e(o),null==n||n()},p=t=>{const o=new Date(s.getFullYear(),s.getMonth()+1,t,12,0,0);s=o,e(o),null==n||n()},f=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===i){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${w=s,w.toLocaleString("default",{month:"long"})} ${s.getFullYear()}`,n.addEventListener("click",()=>{i="months",f()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',o.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===i){const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent=""+s.getFullYear(),e.addEventListener("click",()=>{i="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var w;r.appendChild(t);const v=document.createElement("div");var m;v.className=`st-datepicker-grid st-datepicker-${i}-grid`,"days"===i?(t=>{const e=s.getFullYear(),n=s.getMonth(),i=l(e,n),r=((t,e)=>new Date(t,e,1).getDay())(e,n),a=l(e,n-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=e,t.appendChild(n)});for(let e=0;r>e;e++){const n=a-r+e+1,o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=""+n,o.addEventListener("click",()=>u(n)),t.appendChild(o)}for(let s=1;i>=s;s++){const i=s===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(o),l=s===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${i?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+s,a.addEventListener("click",()=>h(s)),t.appendChild(a)}const d=35-(r+i);for(let e=1;d>=e;e++){const n=document.createElement("div");n.className="st-datepicker-day other-month",n.textContent=""+e,n.addEventListener("click",()=>p(e)),t.appendChild(n)}})(v):"months"===i?(m=v,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===s.getMonth(),o=document.createElement("div");o.className=("st-datepicker-month "+(n?"selected":"")).trim(),o.textContent=t,o.addEventListener("click",()=>(t=>{s=new Date(s.getFullYear(),t,1),i="days",f()})(e)),m.appendChild(o)})):(t=>{const e=s.getFullYear(),n=e-6;for(let o=n;n+12>o;o++){const n=o===e,s=document.createElement("div");s.className=("st-datepicker-year "+(n?"selected":"")).trim(),s.textContent=""+o,s.addEventListener("click",()=>c(o)),t.appendChild(s)}})(v),r.appendChild(v);const g=document.createElement("div");g.className="st-datepicker-footer";const x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);s=o,e(o),null==n||n()}),g.appendChild(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,s=o||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},ie=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},re=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");n&&o&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),o.className="st-checkbox-custom "+(e?"st-checked":""),o.setAttribute("aria-hidden","true"),o.innerHTML="",e&&o.appendChild(ie()))},le=({checked:t,onChange:e,ariaLabel:n})=>{const o=document.createElement("label");o.className="st-checkbox-label";const s=document.createElement("input");s.type="checkbox",s.checked=t,s.className="st-checkbox-input",n&&s.setAttribute("aria-label",n),s.setAttribute("aria-checked",""+t);const i=document.createElement("span");i.className="st-checkbox-custom "+(t?"st-checked":""),i.setAttribute("aria-hidden","true"),t&&i.appendChild(ie());const r=()=>{const t=s.checked;s.setAttribute("aria-checked",""+t),t?(i.classList.add("st-checked"),i.appendChild(ie())):(i.classList.remove("st-checked"),i.innerHTML=""),e(t)};return s.addEventListener("change",r),s.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(s),o.appendChild(i),{element:o,update:t=>{s.checked!==t&&(s.checked=t,s.setAttribute("aria-checked",""+t),t?(i.classList.add("st-checked"),i.innerHTML="",i.appendChild(ie())):(i.classList.remove("st-checked"),i.innerHTML=""))},destroy:()=>{s.removeEventListener("change",r)}}},ae=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s,containerRef:i,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"";const d=Yt("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ee({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Jt[t]})),containerRef:i,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>{const t=Object.assign({accessor:e.accessor,operator:l},_t(l)&&{value:a});o(t)},m=()=>Qt(l)||""!==a.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),_t(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ne({type:"text",value:a,onChange:t=>{a=t,w&&w.update({canApply:m()})},onEnter:v,placeholder:"Filter...",autoFocus:!0}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:m()})};return w=oe({onApply:v,onClear:s,canApply:m(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"",u.update({value:l}),f&&f.update({value:a}),w&&w.update({showClear:!!n,canApply:m()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:s,onApplyFilter:i,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==s?void 0:s.operator)||"equals",c=((null==s?void 0:s.value)||"")+"",h=((null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"";const p=Yt("number"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ee({value:d,onChange:t=>{d=t,S()},options:p.map(t=>({value:t,label:Jt[t]})),containerRef:l,mainBodyRef:a});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,x=null,b=null,y=null;const R=()=>{const t={accessor:o.accessor,operator:d};_t(d)?t.value=parseFloat(c):Xt(d)&&(t.values=[parseFloat(h),parseFloat(u)]),i(t)},C=()=>!!Qt(d)||(_t(d)?""!==c.trim():!!Xt(d)&&""!==h.trim()&&""!==u.trim()),S=()=>{m&&(m.remove(),m=null),g&&(g.destroy(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),_t(d)?(m=document.createElement("div"),m.className="st-filter-section",g=ne({type:"number",value:c,onChange:t=>{c=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"Enter number...",autoFocus:!0}),m.appendChild(g.element),f.insertBefore(m,f.lastChild)):Xt(d)&&(m=document.createElement("div"),m.className="st-filter-section",x=ne({type:"number",value:h,onChange:t=>{h=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),b=ne({type:"number",value:u,onChange:t=>{u=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"To..."}),m.appendChild(x.element),m.appendChild(b.element),f.insertBefore(m,f.lastChild)),y&&y.update({canApply:C()})};return y=oe({onApply:R,onClear:r,canApply:C(),showClear:!!s}),f.appendChild(y.element),S(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(s=t.currentFilter,d=(null==s?void 0:s.operator)||"equals",c=((null==s?void 0:s.value)||"")+"",h=((null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:d}),g&&g.update({value:c}),x&&x.update({value:h}),b&&b.update({value:u}),y&&y.update({showClear:!!s,canApply:C()}),S())},destroy:()=>{v.destroy(),g&&g.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),f.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s,containerRef:i,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const d=Yt("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=ee({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Jt[t]})),containerRef:i,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,w=null;const v=()=>Qt(l)||""!==a,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),_t(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=ee({value:a,onChange:t=>{a=t,w&&w.update({canApply:v()})},options:m,containerRef:i,mainBodyRef:r}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),w&&w.update({canApply:v()})};return w=oe({onApply:()=>{const t={accessor:e.accessor,operator:l};_t(l)&&(t.value="true"===a),o(t)},onClear:s,canApply:v(),showClear:!!n}),c.appendChild(w.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true",u.update({value:l}),f&&f.update({value:a}),w&&w.update({showClear:!!n,canApply:v()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),w&&w.destroy(),c.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:s,onApplyFilter:i,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==s?void 0:s.operator)||"equals",c=(null==s?void 0:s.value)?s.value+"":"",h=(null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])?s.values[0]+"":"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"";const p=Yt("date"),f=document.createElement("div");f.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const v=ee({value:d,onChange:t=>{d=t,T()},options:p.map(t=>({value:t,label:Jt[t]})),containerRef:l,mainBodyRef:a});w.appendChild(v.element),f.appendChild(w);let m=null,g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null;const k=()=>!!Qt(d)||(_t(d)?""!==c.trim():!!Xt(d)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=V(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},O=(t,e,n,o=!1)=>{const s=document.createElement("div");s.className="st-date-input-container",s.style.position="relative";const i=document.createElement("input");i.type="text",i.className="st-filter-input",i.value=E(t),i.placeholder=n,i.readOnly=!0,i.style.cursor="pointer",o&&setTimeout(()=>i.focus(),0);let r=!1;const d=t?V(t):new Date,c=se({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),i.value=E(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=te({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:i,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});s.appendChild(i),s.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return i.addEventListener("click",u),i.addEventListener("keydown",p),{container:s,input:i,picker:c,dropdown:h,destroy:()=>{i.removeEventListener("click",u),i.removeEventListener("keydown",p),c.destroy(),h.destroy(),s.remove()}}},T=()=>{if(m&&(m.remove(),m=null),g&&(g=null),x&&(x=null),b&&(b=null),y&&(y.destroy(),y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),_t(d)){m=document.createElement("div"),m.className="st-filter-section";const t=O(c,t=>{c=t,M&&M.update({canApply:k()})},"Select date...",!0);g=t.container,y=t.picker,S=t.dropdown,m.appendChild(g),f.insertBefore(m,f.lastChild)}else if(Xt(d)){m=document.createElement("div"),m.className="st-filter-section";const t=O(h,t=>{h=t,M&&M.update({canApply:k()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=O(u,t=>{u=t,M&&M.update({canApply:k()})},"To date...",!1);x=t.container,R=t.picker,I=t.dropdown,b=e.container,C=e.picker,H=e.dropdown,m.appendChild(x),m.appendChild(b),f.insertBefore(m,f.lastChild)}M&&M.update({canApply:k()})};return M=oe({onApply:()=>{const t={accessor:o.accessor,operator:d};_t(d)?t.value=c:Xt(d)&&(t.values=[h,u]),i(t)},onClear:r,canApply:k(),showClear:!!s}),f.appendChild(M.element),T(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(s=t.currentFilter,d=(null==s?void 0:s.operator)||"equals",c=(null==s?void 0:s.value)?s.value+"":"",h=(null===(e=null==s?void 0:s.values)||void 0===e?void 0:e[0])?s.values[0]+"":"",u=((null===(n=null==s?void 0:s.values)||void 0===n?void 0:n[1])||"")+"",v.update({value:d}),M&&M.update({showClear:!!s,canApply:k()}),T())},destroy:()=>{v.destroy(),y&&y.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),f.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:s}=t;const i=e.enumOptions||[],r=i.map(t=>t.value);let l=(null==n?void 0:n.values)?n.values.map(String):r,a="";const d=document.createElement("div");d.className="st-filter-container";const c=document.createElement("div");c.className="st-filter-section";const h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const p=le({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let w=null,v=null;i.length>10&&(w=document.createElement("div"),w.className="st-enum-search",v=ne({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),w.appendChild(v.element),h.appendChild(w));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?i.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):i;if(a&&0===t.length){const t=document.createElement("div");t.className="st-enum-no-results",t.textContent="No matching options",m.appendChild(t)}else t.forEach(t=>{const e=le({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=oe({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):s()},onClear:s,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",v&&v.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),v&&v.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},de=new WeakMap,ce=(t,e,n,o)=>{t.addEventListener(e,n,o),de.has(t)||de.set(t,[]),de.get(t).push({event:e,handler:n,options:o})},he=new WeakMap,ue=t=>(he.has(t)||he.set(t,new Map),he.get(t)),pe=(t,e,n)=>{var o,s;const i=t.querySelector(".st-expand-icon-container");if(!(i&&i instanceof HTMLElement))return;if(i.classList.contains("expanded")===e)return;const r=null!==(o=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==o?o:"Collapse row",l=null!==(s=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==s?s:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.classList.toggle("expanded",e),i.classList.toggle("collapsed",!e),i.setAttribute("aria-label",e?r:l),(null==n?void 0:n.syncAriaExpanded)&&i.setAttribute("aria-expanded",e+"")})})},fe=(t,e,n=[])=>{for(let o=0;t.length>o;o++){const s=t[o];if(s.accessor===e)return[...n,o];if(s.children&&s.children.length>0){const t=fe(s.children,e,[...n,o]);if(t)return t}}return null},we=t=>"left"===t.pinned?"left":"right"===t.pinned?"right":"main";function ve(t,e,n){const o=ft(t);let s=!1;function i(t,e){let n,o=t;for(let t=0;e.length-1>t;t++)o=o[e[t]].children;return n=o[e[e.length-1]],n}function r(t,e,n){let o=t;for(let t=0;e.length-1>t;t++){if(!o[e[t]].children){s=!0;break}o=o[e[t]].children}o[e[e.length-1]]=n}const l=i(o,e);return r(o,e,i(o,n)),r(o,n,l),{newHeaders:o,emergencyBreak:s}}const me=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let s=0,i=0,r=0;t.forEach(t=>{if(t.hide)return;const e=g(t,n).reduce((t,e)=>t+C(e),0);"left"===t.pinned?s+=e:"right"===t.pinned?i+=e:r+=e});const a=s,d=i;if(e&&e>0){const t=e*o(e,s>0,i>0);s>t&&(s=t),i>t&&(i=t)}return{leftWidth:l(s),rightWidth:l(i),mainWidth:r,leftContentWidth:a,rightContentWidth:d}},ge=(t,e)=>{if(t.pinned)return t.pinned;const n=((t,e)=>{const n=r(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null})(e,t.accessor);return n?ge(n,e):void 0},xe=(t,e,n)=>{var o;const i=[],r=[],l=[];t.forEach(e=>{if(e.hide)return;const n=ge(e,t);"left"===n?i.push(e):"right"===n?l.push(e):r.push(e)});const a=(t,o,i)=>{var r,l;const d=o;if(t.children&&t.children.length>0){const l=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||s;return l?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:C(t);return i.set(t.accessor,{left:d,width:e}),o=d+e,c.forEach(t=>{o=a(t,o,i)}),o}c.forEach(t=>{o=a(t,o,i)}),i.set(t.accessor,{left:d,width:o-d})}else{const e=null!==(l=null==n?void 0:n.get(t.accessor))&&void 0!==l?l:"number"==typeof t.width?t.width:C(t);i.set(t.accessor,{left:o,width:e}),o+=e}return o},c=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=a(t,n,e)}),e},h=c(i),u=c(r),p=c(l),f=new Map;h.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),p.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:o}=t,s=d({accessor:e,rowId:"header"}),i=document.getElementById(s);h.has(e),p.has(e),i&&(i.style.left=n+"px",i.style.width=o+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=o+"px")})});const w=document.querySelector(".st-body-container"),v=null!==(o=null==w?void 0:w.clientWidth)&&void 0!==o?o:0,{leftWidth:m,rightWidth:g}=me({headers:t,containerWidth:v>0?v:void 0,collapsedHeaders:e});if(m>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}if(g>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}},be=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:o})=>{if(0>e){const n=Math.abs(e),s=t.reduce((t,e)=>t+(o.get(e.accessor)||100),0);if(0===s)return;return void t.forEach((e,i)=>{const r=o.get(e.accessor)||100;let l=n*(r/s);if(i===t.length-1){const e=t.slice(0,i).reduce((t,e)=>{const n=o.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-n)},0);l=n-e}e.width=r+l})}let s=e;for(;s>.5;){const e=n,i=t.map(t=>{const n=o.get(t.accessor)||100;return{column:t,headroom:Math.max(0,n-e),initialWidth:n,minWidth:e}}).filter(t=>t.headroom>0);if(0>=i.length)break;{const t=i.reduce((t,e)=>t+e.headroom,0);let e=0;const n=s;i.forEach((o,s)=>{let r=n*(o.headroom/t);r=Math.min(r,o.headroom),s===i.length-1&&(r=Math.min(n-e,o.headroom)),o.column.width=o.initialWidth-r,e+=r}),s-=e}}},ye=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:s,delta:i,headers:r,initialWidthsMap:l,isParentResize:a=!1,resizedHeader:d,reverse:c,rootPinned:h,sectionHeaders:u,sectionWidth:p,startWidth:f})=>{let w=i;if(h&&s>0){const t=((t,e,n)=>t*o(t,e,n))(s,r.some(t=>"left"===t.pinned&&!t.hide),r.some(t=>"right"===t.pinned&&!t.hide)),e=Array.from(l.values()).reduce((t,e)=>t+e,0);i>0&&e+i>t&&(w=Math.max(0,t-e))}if(i=w,a&&t.length>1){const o=H(u,e),s=o.findIndex(e=>e.accessor===t[0].accessor),r=o.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===s||-1===r)return;const a=0===s,d=r===o.length-1;let w;w="left"===h&&d||"right"===h&&a?[]:a?o.slice(r+1):d||c?o.slice(0,s):o.slice(r+1);const v=Array.from(l.values()).reduce((t,e)=>t+e,0);if(i>0){let e=i,o=!1;if(w.length>0&&v+i>(p>0?Math.max(p,v):v+Math.abs(i)+1)){o=!0;const t=w.reduce((t,e)=>{const o=l.get(e.accessor)||100;return t+Math.max(0,o-n)},0);e=Math.min(i,t)}const s=(f+e)/t.reduce((t,e)=>t+(l.get(e.accessor)||100),0);t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)}),o&&e>0&&w.length>0&&be({columnsToShrink:w,totalCompensation:e,initialWidthsMap:l})}else{const e=t.reduce((t,e)=>t+(l.get(e.accessor)||100),0),o=Math.max(f+i,n*t.length),s=o/e;t.forEach(t=>{const e=l.get(t.accessor)||100;t.width=Math.max(e*s,40)});const r=f-o;r>0&&w.length>0&&be({columnsToShrink:w,totalCompensation:-r,initialWidthsMap:l})}return}const v=H(u,e),m=v.findIndex(t=>t.accessor===d.accessor);if(-1===m)return;const g=0===m,x=m===v.length-1;let b;if(b="left"===h&&x||"right"===h&&g?[]:g?v.slice(m+1):x||c?v.slice(0,m):v.slice(m+1),0===b.length)return void(d.width=Math.max(f+i,n));const y=Array.from(l.values()).reduce((t,e)=>t+e,0);if(i>0){if((p>0?Math.max(p,y):y+Math.abs(i)+1)>=y+i)return void(d.width=f+i);const t=b.reduce((t,e)=>{const o=l.get(e.accessor)||100;return t+Math.max(0,o-n)},0),e=Math.min(i,t);d.width=f+e,e>0&&be({columnsToShrink:b,totalCompensation:e,initialWidthsMap:l})}else{const t=Math.max(f+i,40),e=f-t;d.width=t,e>0&&be({columnsToShrink:b,totalCompensation:-e,initialWidthsMap:l})}},Re=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const o=n.closest(".simple-table-root"),s=null==o?void 0:o.querySelector(".st-body-container");return s instanceof HTMLElement?s.clientWidth:n.clientWidth},Ce=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:s,header:i,headers:r,mainBodyRef:l,onColumnWidthChange:a,reverse:d=!1,setHeaders:c,setIsResizing:h,startWidth:u})=>{s.preventDefault();const p="clientX"in s?s.clientX:s.touches[0].clientX,f="touches"in s;if(!i||i.hide)return;const w=Re(n,l);h(!0);const v=ge(i,r),m=I(i);let x;if(i.children&&i.children.length>0){const t=g(i,e);x=t.length>0?t:[i]}else x=[i];const b=new Map;let y=0,R=0;if(t){const t=r.filter(t=>t.pinned===v);if(H(t,e).forEach(t=>{const e=C(t);b.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=me({headers:r,containerWidth:w,collapsedHeaders:e});y="left"===v?t:"right"===v?n:o,R=w-t-n}}let M=!1;const k=new Map;let E=[];if(t&&v&&w>0){const t=H(r.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(x.length>1){const e=t.findIndex(t=>t.accessor===x[0].accessor),o=t.findIndex(t=>t.accessor===x[x.length-1].accessor);n="left"===v&&o===t.length-1||"right"===v&&0===e}else{const e=x[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&o===t.length-1||"right"===v&&0===o}if(n){M=!0;const t=r.filter(t=>!t.pinned);E=H(t,e),E.forEach(t=>{k.set(t.accessor,C(t))})}}}const O=(n,s=!1)=>{const l="right"===v?p-n:n-p;if(t){const t=r.filter(t=>t.pinned===v);if(ye({childrenToResize:x,collapsedHeaders:e,containerWidth:w,delta:l,headers:r,initialWidthsMap:b,isParentResize:x.length>1,resizedHeader:x.length>0?x[x.length-1]:i,reverse:d,rootPinned:v,sectionHeaders:t,sectionWidth:y,startWidth:u}),M&&E.length>0){const t=x.reduce((t,e)=>{const n=b.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,R-t),n=Array.from(k.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;E.forEach((n,s)=>{const i=k.get(n.accessor)||100;s===E.length-1?n.width=e-o:(n.width=Math.round(i*t),o+=n.width)})}}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const s=document.querySelector(".st-body-container");if(!s||0===s.clientWidth)return 1e3;const i=s.clientWidth;if(!t.pinned)return 1/0;const r=e.some(t=>"left"===t.pinned&&!t.hide),l=e.some(t=>"right"===t.pinned&&!t.hide),a=i*o(i,r,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+g(e,n).reduce((t,e)=>t+C(e),0),0),d=I(t);return d>a?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),d):a})({header:i,headers:r,collapsedHeaders:e});x.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:s})=>{const i=e.reduce((t,e)=>Math.min(t,I(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(o+t,s),i)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:l,leafHeaders:x,minWidth:m,startWidth:u,maxWidth:t}):x[0].width=Math.max(Math.min(u+l,t),m),r.forEach(t=>{S(t)})}if(s){const t=[...r];c(t);const n=new Map;x.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),M&&E.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),xe(r,e,n)}else xe(r,e)};let T=null,A=null,W=p;const P=t=>{W=t,A=t,null===T&&(T=requestAnimationFrame(()=>{null!==A&&(O(A,!1),A=null),T=null}))};if(f){const t=t=>{P(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),a&&a([...r])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{P(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==T&&(cancelAnimationFrame(T),T=null),O(W,!0),h(!1),a&&a([...r])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Se=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=o.closest(".simple-table-root"))&&void 0!==n?n:o:null},Ie=(e,n,o)=>{const{columnResizing:s}=n;if(!s||e.isSelectionColumn&&n.enableRowSelection||o)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${e.label} column`),i.setAttribute("aria-orientation","vertical");const r=document.createElement("div");r.className="st-header-resize-handle",i.appendChild(r);const l=t=>({rows:n.rows,header:t,maxWidth:500,sampleSize:50,styleRoot:Se(n)});let a=0;const c=()=>{const t=Date.now();120>t-a||(a=t,(()=>{const t=document.getElementById(d({accessor:e.accessor,rowId:"header"}));if(n.autoExpandColumns){(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:s,reverse:i,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=Re(o,s),c=ge(t,e);let h;if(t.children&&t.children.length>0){const e=g(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const w=e.filter(t=>t.pinned===c);if(H(w,n).forEach(t=>{const e=C(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:o,mainWidth:s}=me({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?o:s,f=d-t-o}let v=!1;const m=new Map;let x=[];if(c&&d>0){const o=H(e.filter(t=>t.pinned===c),n);if(o.length>0){let s=!1;if(h.length>1){const t=o.findIndex(t=>t.accessor===h[0].accessor),e=o.findIndex(t=>t.accessor===h[h.length-1].accessor);s="left"===c&&e===o.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);s="left"===c&&n===o.length-1||"right"===c&&0===n}if(s){v=!0;const t=e.filter(t=>!t.pinned);x=H(t,n),x.forEach(t=>{m.set(t.accessor,C(t))})}}}const b=h.reduce((t,e)=>t+l(e),0),y=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+C(e),0);if(ye({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:b-y,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:i,rootPinned:c,sectionHeaders:w,sectionWidth:p,startWidth:y}),v&&x.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;x.forEach((n,s)=>{const i=m.get(n.accessor)||100;s===x.length-1?n.width=e-o:(n.width=Math.round(i*t),o+=n.width)})}}const R=new Map;h.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),v&&x.forEach(t=>{"number"==typeof t.width&&R.set(t.accessor,t.width)}),xe(e,n,R)})({header:e,headers:n.headers,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,mainBodyRef:n.mainBodyRef,reverse:n.reverse,headerCellElement:t,getTargetLeafWidth:t=>M(t.accessor,l(t))});const o=[...n.headers];return n.setHeaders(o),void(n.onColumnWidthChange&&n.onColumnWidthChange(o))}const o=M(e.accessor,l(e)),s=fe(n.headers,e.accessor);if(!s)return;const i=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(n.headers,s),r=s[s.length-1],a=i.map((t,e)=>e===r?Object.assign(Object.assign({},t),{width:o}):t),c=((t,e,n)=>{if(1===e.length)return n;let o=t;for(let t=0;e.length-2>t;t++)o=o[e[t]].children;return o[e[e.length-2]].children=n,t})(n.headers,s,a);c.forEach(t=>S(t));const h=a[r],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),xe(c,n.collapsedHeaders,u),n.setHeaders(c),n.onColumnWidthChange&&n.onColumnWidthChange(c)})())};return Gt(i,"mousedown",o=>{var s;if(o.detail>=2)return o.preventDefault(),void c();const i=null===(s=document.getElementById(d({accessor:e.accessor,rowId:"header"})))||void 0===s?void 0:s.offsetWidth;qt(()=>{Ce({autoExpandColumns:n.autoExpandColumns,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,event:o,forceUpdate:n.forceUpdate,header:e,headers:n.headers,mainBodyRef:n.mainBodyRef,onColumnWidthChange:n.onColumnWidthChange,pinnedLeftRef:n.pinnedLeftRef,pinnedRightRef:n.pinnedRightRef,reverse:n.reverse,setHeaders:n.setHeaders,setIsResizing:n.setIsResizing,startWidth:null!=i?i:t})},10)}),Gt(i,"touchstart",o=>{var s;const i=o,r=null===(s=document.getElementById(d({accessor:e.accessor,rowId:"header"})))||void 0===s?void 0:s.offsetWidth;qt(()=>{Ce({autoExpandColumns:n.autoExpandColumns,collapsedHeaders:n.collapsedHeaders,containerWidth:n.containerWidth,event:i,forceUpdate:n.forceUpdate,header:e,headers:n.headers,mainBodyRef:n.mainBodyRef,onColumnWidthChange:n.onColumnWidthChange,pinnedLeftRef:n.pinnedLeftRef,pinnedRightRef:n.pinnedRightRef,reverse:n.reverse,setHeaders:n.setHeaders,setIsResizing:n.setIsResizing,startWidth:null!=r?r:t})},10)}),Gt(i,"dblclick",c),i},He=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",Gt(o,"blur",()=>{const s=o.value;s!==t.label&&(n=>{const o=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(o),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(s);const i=n.parentElement;if(i){const o=Me(t,e,s);i.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),Gt(o,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),o.blur()):"Escape"===e.key&&(e.preventDefault(),o.value=t.label||"",o.blur())}),setTimeout(()=>o.focus(),0),o},Me=(t,e,n)=>{const o=t.isSelectionColumn&&e.enableRowSelection,s=void 0!==n?n:t.label||"",i=document.createElement("span");if(i.className="st-header-label-text "+("right"===t.align?"right-aligned":"center"===t.align?"center-aligned":"left-aligned"),o){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return le({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);i.appendChild(t)}else i.textContent=s;if(t.tooltip&&!o){let e=null,n=null;const o=()=>{n=setTimeout(()=>{if(!i.isConnected)return;const n=i.getBoundingClientRect();if(n.width>0&&n.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const o=200,s=40;let r=n.left+n.width/2-o/2,l=n.bottom+8;8>r?r=8:r+o>window.innerWidth-8&&(r=window.innerWidth-o-8),l+s>window.innerHeight-8&&(l=n.top-s-8),e.style.top=l+"px",e.style.left=r+"px",(i.closest(".simple-table-root")||document.body).appendChild(e)}},500)},s=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};Gt(i,"mouseenter",o),Gt(i,"mouseleave",s)}return i},ke=(t,e,n,o)=>{const{columnReordering:s,draggedHeaderRef:i,hoveredHeaderRef:r,headers:l}=o;!s||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),Gt(t,"dragstart",t=>{i.current=n,jt(Date.now()),e.classList.add("st-dragging")}),Gt(t,"dragend",t=>{t.preventDefault(),i.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(o.headers)},10)}),Gt(e,"dragover",t=>{const e=t;e.preventDefault(),l&&i.current&&qt(()=>{const{screenX:t,screenY:s}=e,a=Math.sqrt(Math.pow(t-Ft.screenX,2)+Math.pow(s-Ft.screenY,2));r.current=n;const d=i.current;if(!d)return;let c,h=!1;if(we(d)!==we(n)){const t=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=ft(t);let s=!1;try{const t=we(n),i=o.findIndex(t=>t.accessor===e.accessor),r=o.findIndex(t=>t.accessor===n.accessor);if(-1===i||-1===r)return s=!0,{newHeaders:o,emergencyBreak:s};const[l]=o.splice(i,1),a=((t,e)=>{const n=Object.assign({},t);return"left"===e?n.pinned="left":"right"===e?n.pinned="right":delete n.pinned,n})(l,t);o.splice(r,0,a)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),s=!0}return{newHeaders:o,emergencyBreak:s}}({headers:l,draggedHeader:d,hoveredHeader:n});c=t.newHeaders,h=t.emergencyBreak}else{const t=fe(l,d.accessor),e=fe(l,n.accessor);if(!t||!e)return;const o=t.length,s=e.length;let i=e;if(o!==s){const t=s-o;t>0&&(i=e.slice(0,-t))}if((u=t).length!==(p=i).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===p[e]))return;const r=ve(l,t,i);c=r.newHeaders,h=r.emergencyBreak}var u,p;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(l)||h)return;const f=o.essentialAccessors;if(f&&f.size>0&&!Ht(c,f))return;const w=Date.now();JSON.stringify(c)===JSON.stringify(Lt)&&(1500>w-Dt||40>a)||(jt(w),Ft={screenX:t,screenY:s},(t=>{Lt=t})(l),o.onTableHeaderDragEnd(c))},50)}),Gt(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Ee=(t,e,n)=>{var o,r;const{header:l,colIndex:a,parentHeader:d}=t,{collapsedHeaders:c,columnBorders:h,columnReordering:u,enableHeaderEditing:p,selectedColumns:f,columnsWithSelectedCells:w,draggedHeaderRef:v,hoveredHeaderRef:m}=e,g=l.isSelectionColumn&&e.enableRowSelection,x=!!(null==l?void 0:l.isSortable),b=c.has(l.accessor),y=!(!l.children||0===l.children.length)&&(!b||l.children.some(t=>{const e=t.showWhen||s;return"parentCollapsed"===e||"always"===e})),R=null==d?void 0:d.singleRowChildren,C=y&&!l.singleRowChildren,S=!!h&&(l.children&&0!==l.children.length?i(l,a).includes(e.lastHeaderIndex):a===e.lastHeaderIndex),I=!(!e.selectableColumns||g)&&i(l,a).some(t=>f.has(t)),H=!g&&i(l,a).some(t=>w.has(t));return["st-header-cell",l.accessor===(null===(o=m.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(r=v.current)||void 0===r?void 0:r.accessor)===l.accessor?"st-dragging":"",x?"clickable":"",u&&!x?"columnReordering":"",C?"parent":"",R?"st-sub-header":"",S?"st-last-column":"",p&&!g?"st-header-editable":"",I?"st-header-selected":"",H&&!I?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},Oe=(t,e,n)=>{var o;const{header:s,colIndex:r}=t,{reverse:l}=e,c=s.isSelectionColumn&&e.enableRowSelection,h=Ee(t,e,n),u=document.createElement("div");u.className=h,u.id=d({accessor:s.accessor,rowId:"header"}),u.setAttribute("data-accessor",s.accessor+""),u.setAttribute("role","columnheader"),u.setAttribute("aria-colindex",r+1+""),s.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?u.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):u.setAttribute("aria-sort","none"));const p=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(p){const t="header-desc-"+s.accessor;u.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=p,u.appendChild(e)}u.style.position="absolute",u.style.left=t.left+"px",u.style.top=t.top+"px",u.style.width=t.width+"px",u.style.height=t.height+"px";const f=((t,e)=>{const{sort:n,icons:o}=e;if(!n||n.key.accessor!==t.accessor)return null;const s=document.createElement("div");s.className="st-icon-container",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const i="asc"===n.direction?o.sortUp:o.sortDown;return i&&("string"==typeof i?s.innerHTML=i:(i instanceof HTMLElement||i instanceof SVGSVGElement)&&s.appendChild(i.cloneNode(!0))),Gt(s,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),Gt(s,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),s})(s,e),w=((t,e)=>{const{filters:n,handleApplyFilter:o,handleClearFilter:s,icons:i}=e;if(!t.filterable)return null;const r=n[t.accessor],l=document.createElement("div");l.className="st-icon-container",l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Filter "+t.label),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-haspopup","dialog");const a=i.filter;let d=null;if(a)if("string"==typeof a)l.innerHTML=a,d=l.querySelector("svg");else if(a instanceof HTMLElement||a instanceof SVGSVGElement){const t=a.cloneNode(!0);l.appendChild(t),d=t}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},i=()=>{s(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=ae({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:i,containerRef:a,mainBodyRef:a}),u=te({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return Gt(l,"click",p),Gt(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l})(s,e),v=((t,e)=>{var n,o;const{icons:s}=e;if(!a(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const i=(null!==(o=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==o?o:e.collapsedHeaders).has(t.accessor),r=document.createElement("div");r.className="st-icon-container st-expand-icon-container "+(i?"collapsed":"expanded"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${i?"Expand":"Collapse"} ${t.label} column`),r.setAttribute("aria-expanded",!i+"");const l=s.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const d=n=>{var o,s;n.stopPropagation();const i=(null!==(s=null===(o=e.getCollapsedHeaders)||void 0===o?void 0:o.call(e))&&void 0!==s?s:e.collapsedHeaders).has(t.accessor);e.setCollapsedHeaders(e=>{const n=new Set(e);return i?n.delete(t.accessor):n.add(t.accessor),n})};return Gt(r,"click",d),Gt(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),d(t))}),r})(s,e);if(l){const t=Ie(s,e,n);t&&u.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f));const m=document.createElement("div");if(m.className="st-header-label",s.headerRenderer){const t=Me(s,e),n=s.headerRenderer({accessor:s.accessor,colIndex:r,header:s,components:{sortIcon:f||void 0,filterIcon:w||void 0,collapseIcon:v||void 0,labelContent:t}});n instanceof HTMLElement?m.appendChild(n):m.appendChild(t)}else{const t=Me(s,e);m.appendChild(t)}if(Gt(m,"click",t=>{c||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const s=i(e,n),r=s.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&r&&!t.shiftKey){const t=document.getElementById(d({accessor:e.accessor,rowId:"header"}));if(t){const n=t.querySelector(".st-header-label");if(n){const t=n.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=He(e,o,t);if(t.appendChild(n),o.headerRegistry&&!e.isSelectionColumn){const t=o.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&o.selectColumns?o.setSelectedColumns(t=>{if(0===t.size)return new Set(s);const e=s[0],n=Array.from(t).sort((t,e)=>t-e);let o=n[0],i=Math.abs(e-o);n.forEach(t=>{const n=Math.abs(e-t);i>n&&(i=n,o=t)});const r=[...((t,e)=>{const n=Math.min(t,e);return Array.from({length:Math.max(t,e)-n+1},(t,e)=>n+e)})(o,e),...s];return new Set([...Array.from(t),...r])}):o.selectColumns&&o.selectColumns(s),o.setSelectedCells(new Set),o.setInitialFocusedCell(null)}o.onColumnSelect&&o.onColumnSelect(e),!o.selectableColumns&&e.isSortable&&o.onSort(e.accessor)}})(t,s,r,e)}),Gt(m,"dblclick",t=>{c||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,s,e)}),ke(m,u,s,e),u.appendChild(m),s.headerRenderer||"right"===s.align||(v&&u.appendChild(v),w&&u.appendChild(w),f&&u.appendChild(f)),!l){const t=Ie(s,e,n);t&&u.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=He(s,e,t);t.appendChild(n)}}}}),u},Te=(t,e,n,o=0)=>{var s,i;const r=n.pinned?n.containerWidth:null!==(s=n.mainSectionContainerWidth)&&void 0!==s?s:n.containerWidth||(null===(i=t.parentElement)||void 0===i?void 0:i.clientWidth)||t.clientWidth||0,l=n.pinned?e:((t,e,n,o=100)=>{if(0===t.length)return[];const s=e-o,i=e+n+o;return t.filter(t=>t.left+t.width>=s&&i>=t.left)})(e,o,r),c=(t=>0===t.length?-1:t[t.length-1].colIndex)(e),h=Nt(t),u=new Set(l.map(t=>d({accessor:t.header.accessor,rowId:"header"}))),p=Vt(t);let f=!1;h.forEach((t,e)=>{u.has(e)||(p.delete(e),t.remove(),h.delete(e),f=!0)}),f&&Ut(t);const w=document.createDocumentFragment(),v=[];l.forEach(t=>{const e=d({accessor:t.header.accessor,rowId:"header"}),o=!(!n.autoExpandColumns||n.pinned||t.colIndex!==c);if(h.has(e)){const s=h.get(e),i=p.get(e);(!i||i.left!==t.left||i.top!==t.top||i.width!==t.width||i.height!==t.height)&&(s.style.left=t.left+"px",s.style.top=t.top+"px",s.style.width=t.width+"px",s.style.height=t.height+"px",p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})),t.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{re(t,e)})(s,n.areAllRowsSelected());const r=Ee(t,n,o);s.className!==r&&(s.className=r),a(t.header)&&((t,e,n)=>{pe(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(s,n.collapsedHeaders.has(t.header.accessor),t.header.label)}else v.push({cell:t,cellId:e,isLastMainAutoExpandColumn:o})}),v.forEach(({cell:t,cellId:e,isLastMainAutoExpandColumn:o})=>{const s=Oe(t,n,o);w.appendChild(s),h.set(e,s),p.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}),w.childNodes.length>0&&t.appendChild(w),n.pinned||(t.dataset.lastScrollLeft=o+"")},Ae=(t,e,n)=>{var o;const s=document.createElement("div");s.className="st-dropdown-content",s.style.position=n.positioning||"fixed",s.style.zIndex="1000",s.style.visibility="hidden",s.style.overflow=null!==(o=n.overflow)&&void 0!==o?o:"auto",n.width&&(s.style.width=n.width+"px"),n.maxHeight&&(s.style.maxHeight=n.maxHeight+"px"),s.appendChild(e);const i=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?i?i.appendChild(s):document.body.appendChild(s):t.appendChild(s),requestAnimationFrame(()=>{const{position:e,placement:o}=((t,e,n)=>{const o=t.getBoundingClientRect(),s=window.innerHeight,i=window.innerWidth,r=s-o.bottom,l=i-o.left;let a="bottom";e.offsetHeight>r&&o.top>r&&(a="top");let d="left";(n.width||e.offsetWidth)>l&&o.right>l&&(d="right");const c={};return"fixed"===n.positioning?("bottom"===a?c.top=o.bottom+4:c.bottom=s-o.top+4,"left"===d?c.left=o.left:c.right=i-o.right):("bottom"===a?c.top=o.height+4:c.bottom=o.height+4,"left"===d?c.left=0:c.right=0),{position:c,placement:`${a}-${d}`}})(t,s,n);s.className="st-dropdown-content st-dropdown-"+o,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(s.style[t]=e+"px")}),s.style.visibility="visible"});const r=e=>{const n=e.target;s.contains(n)||t.contains(n)||d()},l=t=>{"Escape"===t.key&&(t.preventDefault(),d())},a=t=>{s.contains(t.target)||d()},d=()=>{s.remove(),document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("scroll",a,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l,!0),window.addEventListener("scroll",a,!0)},0),ce(s,"mousedown",t=>{t.stopPropagation()}),s},We=(t,e)=>new Date(t,e+1,0).getDate(),Pe=["January","February","March","April","May","June","July","August","September","October","November","December"],$e=["Su","Mo","Tu","We","Th","Fr","Sa"],De=(t,e,n)=>{const{header:o,row:s}=t,i=u(s,o.accessor);return"boolean"===o.type?((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t;let l;const a=document.createElement("div");a.className="st-dropdown-item "+(!0===n?"selected":""),a.textContent="True",a.setAttribute("role","option"),a.setAttribute("aria-selected",(!0===n)+""),a.setAttribute("aria-disabled","false");const c=document.createElement("div");c.className="st-dropdown-item "+(!1===n?"selected":""),c.textContent="False",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!1===n)+""),c.setAttribute("aria-disabled","false");const h=t=>{p(i,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:i,rowIndex:r}),l.remove(),o()};ce(a,"click",()=>h(!0)),ce(c,"click",()=>h(!1));const u=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===a?c.focus():a.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===a?h(!0):document.activeElement===c&&h(!1))};a.setAttribute("tabindex","0"),c.setAttribute("tabindex","0"),ce(a,"keydown",u),ce(c,"keydown",u);const f=document.createDocumentFragment();f.appendChild(a),f.appendChild(c);const w=d({accessor:s.accessor,rowId:t.rowId}),v=document.getElementById(w);return l=Ae(v||document.body,f,{width:120,positioning:"fixed",onClose:o}),l})(t,e,!!i,n):"enum"===o.type?((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t,l=s.enumOptions||[];let a;const c=t=>{p(i,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:i,rowIndex:r}),a.remove(),o()},h=[];l.forEach((t,e)=>{const o=document.createElement("div");o.className="st-dropdown-item "+(n===t.value?"selected":""),o.textContent=t.label,o.setAttribute("role","option"),o.setAttribute("aria-selected",(n===t.value)+""),o.setAttribute("aria-disabled","false"),o.setAttribute("tabindex","0"),o.dataset.value=t.value,ce(o,"click",()=>c(t.value)),h.push(o)});const u=t=>{const e=t,n=h.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),h[(n+1)%h.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),h[(n-1+h.length)%h.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&c(t)}};h.forEach(t=>{ce(t,"keydown",u)});const f=document.createElement("div");f.className="st-enum-dropdown-content",h.forEach(t=>f.appendChild(t));const w=d({accessor:s.accessor,rowId:t.rowId}),v=document.getElementById(w);return a=Ae(v||document.body,f,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=l.findIndex(t=>t.value===n);t>=0&&h[t]?(h[t].focus(),h[t].scrollIntoView({block:"nearest"})):h.length>0&&h[0].focus()},0),a})(t,e,(i||"")+"",n):"date"===o.type?((t,e,n,o)=>{var s,i;const{header:r,row:l,rowIndex:a}=t;let c,h;try{h=n?N(n+""):new Date}catch(t){h=new Date}let u=h.getFullYear(),f=h.getMonth();const w=document.createElement("div");w.className="st-datepicker";const v=document.createElement("div");v.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(s=e.icons.prev)&&void 0!==s?s:mt("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(i=e.icons.next)&&void 0!==i?i:gt("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),v.appendChild(m),v.appendChild(x),v.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",$e.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",ce(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),w.appendChild(v),w.appendChild(R),w.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];p(l,r.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:r.accessor,newValue:n,row:l,rowIndex:a}),c.remove(),o()},H=()=>{var t,e,n;for(x.textContent=`${Pe[f]} ${u}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=We(u,f),s=new Date(u,f,1).getDay(),i=We(u,f-1),r=new Date;for(let t=0;s>t;t++){const n=i-s+t+1,o=new Date(u,f-1,n),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=n+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${null!==(e=Pe[f-1])&&void 0!==e?e:Pe[11]} ${n}, ${o.getFullYear()}`),ce(r,"click",()=>I(o)),ce(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(r)}const l=h.getFullYear()===u&&h.getMonth()===f;for(let t=1;o>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${Pe[f]} ${t}, ${u}`),r.getFullYear()===u&&r.getMonth()===f&&r.getDate()===t&&e.classList.add("today"),l&&h.getDate()===t&&e.classList.add("selected");const n=new Date(u,f,t);ce(e,"click",()=>I(n)),ce(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const a=s+o,d=Math.max(35,7*Math.ceil(a/7))-a;for(let t=1;d>=t;t++){const e=new Date(u,f+1,t),o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=t+"",o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${null!==(n=Pe[f+1])&&void 0!==n?n:Pe[0]} ${t}, ${e.getFullYear()}`),ce(o,"click",()=>I(e)),ce(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};ce(m,"click",()=>{f--,0>f&&(f=11,u--),H()}),ce(b,"click",()=>{f++,f>11&&(f=0,u++),H()}),H();const M=d({accessor:r.accessor,rowId:t.rowId}),k=document.getElementById(M);return c=Ae(k||document.body,w,{width:240,overflow:"hidden",positioning:"fixed",onClose:o}),c})(t,e,i,n):((t,e,n,o)=>{const{header:s,row:i,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===s.type?(l.type="text",l.inputMode="decimal"):l.type="text",l.value=null!=n?n+"":"",l.setAttribute("autofocus","true"),setTimeout(()=>{l.focus(),l.select()},0);let a=!0;if("number"===s.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};ce(l,"input",t)}return ce(l,"blur",t=>{if(!a)return void o();let n=l.value;if("number"===s.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}p(i,s.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:n,row:i,rowIndex:r}),o()}),ce(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),ce(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,i,n)},Fe=(t,e,n,o,s)=>{if(e.valueFormatter){const i=e.valueFormatter({accessor:e.accessor,colIndex:n,row:o,rowIndex:s,value:t});return"object"==typeof i&&null!==i?t+"":i+""}return"boolean"==typeof t?t?"True":"False":Array.isArray(t)?0===t.length?"[]":t.map(t=>"object"==typeof t&&null!==t?JSON.stringify(t):t+"").join(", "):"date"===e.type&&null!=t&&("string"==typeof t||"number"==typeof t||"object"==typeof t&&t instanceof Date)?V(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Le=(t,e,n)=>{var o;const{header:s,row:i,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=u(i,s.accessor),h=s.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(h){const o=document.createElement("div");o.className="st-selection-cell-content";const s=document.createElement("div");s.className="st-selection-control";const i=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>le({checked:n,onChange:n=>{var o;null===(o=e.handleRowSelect)||void 0===o||o.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,i);s.appendChild(r),o.appendChild(s);const l=((t,e)=>{if(!e.rowButtons||0===e.rowButtons.length)return null;const n=document.createElement("div");n.className="st-row-buttons",n.setAttribute("role","group"),n.setAttribute("aria-label","Actions for row "+(t.displayRowNumber+1));const o={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(o);if(!e)return;const s=document.createElement("span");s.className="st-row-button",s.appendChild(e),n.appendChild(s)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&o.appendChild(l),void n.appendChild(o)}const p=e.rowGrouping&&e.rowGrouping[a],w=!!p&&((t,e)=>!!e&&f(t[e]))(i,p),v=e.rowGrouping&&e.rowGrouping.length>a,g=!e.canExpandRowGroup||e.canExpandRowGroup(i);if(s.expandable&&(w&&v&&g||s.nestedTable||e.onRowGroupExpand&&v&&g)){const o=new Set(e.expandedDepths),s=((t,e,n)=>{const o=document.createElement("div");o.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("aria-label",n?"Collapse row":"Expand row"),o.setAttribute("tabindex","0");const s=e.icons.expand;s&&("string"==typeof s?o.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&o.appendChild(s.cloneNode(!0)));const i=n=>{n.stopPropagation();const{rowId:o,depth:s}=t,i=new Set(e.expandedDepths),r=e.getExpandedRows?e.getExpandedRows():e.expandedRows,l=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,a=m(o,s,i,r,l),d=!a;if(a?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(o,s),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(o),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(o),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(o,s),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(o),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{loading:t,triggerSection:n})),s})},0)},r=t=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{error:t,loading:!1,triggerSection:n})),s})},l=(t,s)=>{e.setRowStateMap(e=>{const s=new Map(e),i=s.get(o)||{};return s.set(o,Object.assign(Object.assign({},i),{isEmpty:t,loading:!1,triggerSection:n})),s})};e.onRowGroupExpand({row:t.row,depth:s,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[s],isExpanded:d,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:r,setEmpty:l})}};return ce(o,"click",i),ce(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i(t))}),o})(t,e,m(d,a,o,e.expandedRows,e.collapsedRows));n.appendChild(s)}if("lineAreaChart"===s.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:s,fillColor:i,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const h=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=o,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",o+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const w=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",n),o.setAttribute("fill",i||"var(--st-chart-fill-color)"),o.setAttribute("fill-opacity",r+""),o.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",s||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(o),f.appendChild(a)};return w(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,f.setAttribute("height",o+"")),void 0!==t.color&&(s=t.color),void 0!==t.fillColor&&(i=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),w()):f.innerHTML=""},destroy:()=>{f.remove()}}})(Object.assign({data:t,width:"100%",height:30},s.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===s.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:s,gap:i=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=o,p=(100-i*(e.length-1))/e.length,f=0>d,w=f?u*(c/h):u,v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",n+""),v.setAttribute("height",o+""),v.setAttribute("viewBox","0 0 100 "+u),v.setAttribute("preserveAspectRatio","none"),v.setAttribute("class",("st-bar-chart "+r).trim()),v.setAttribute("shape-rendering","crispEdges"),v.style.display="block";const m=()=>{v.innerHTML="",e.forEach((t,e)=>{const n=e*(p+i),o=(t-d)/h*u;let r=u-o,l=o;f&&(0>t?(l=Math.abs(t)/h*u,r=w):(l=t/h*u,r=w-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",s||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),v.appendChild(a)})};return m(),{element:v,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,v.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,v.setAttribute("height",o+"")),void 0!==t.color&&(s=t.color),void 0!==t.gap&&(i=t.gap),void 0!==t.className&&(r=t.className,v.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):v.innerHTML=""},destroy:()=>{v.remove()}}})(Object.assign({data:t,width:"100%",height:30},s.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(s.cellRenderer){try{const a=s.cellRenderer({accessor:s.accessor,colIndex:l,row:i,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(o=s.valueFormatter)||void 0===o?void 0:o.call(s,{accessor:s.accessor,colIndex:l,row:i,rowIndex:r,value:c})});if("string"==typeof a||"number"==typeof a){const t=document.createTextNode(a+"");n.appendChild(t)}else if(a instanceof Node)n.appendChild(a);else if(null!=a&&"object"==typeof a){const t=Fe(c,s,l,i,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=Fe(c,s,l,i,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const x=Fe(c,s,l,i,r);if(null!==x){const t=document.createTextNode(x);n.appendChild(t)}},je=new Map,Be=new WeakMap;let Ne=null;const ze=(t,e)=>{const n=je.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Ve=(t,e)=>{var n;const{header:o,rowIndex:s,colIndex:i,rowId:r,depth:l,isOdd:a}=t,d=o.isSelectionColumn&&e.enableRowSelection,c=!!(null==o?void 0:o.isEditable)||!(!e.onCellClick||d),h={rowIndex:s,colIndex:i,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),w=e.isCopyFlashing(h),v=e.isWarningFlashing(h),m=e.selectedColumns.has(i),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{var t,n,s;if(!e.columnBorders)return!1;const i=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===o.pinned?(null===(t=i[i.length-1])||void 0===t?void 0:t.accessor)===o.accessor:"right"===o.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===o.accessor:(null===(s=r[r.length-1])||void 0===s?void 0:s.accessor)===o.accessor})();return["st-cell",l>0&&o.expandable?"st-cell-depth-"+l:"",g?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",w?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",v?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?i%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},qe=(t,e)=>{var n;const{header:o,row:s,rowIndex:i,colIndex:r,rowId:l}=t,a=o.isSelectionColumn&&e.enableRowSelection,c={rowIndex:i,colIndex:r,rowId:l},h=e.isInitialFocusedCell(c),f=Ve(t,e),w=document.createElement("div");w.className=f,w.id=d({accessor:o.accessor,rowId:l}),w.setAttribute("role","gridcell"),w.setAttribute("tabindex",h?"0":"-1");const v=null!==(n=e.maxHeaderDepth)&&void 0!==n?n:1;w.setAttribute("aria-rowindex",t.tableRow.position+v+1+""),w.setAttribute("aria-colindex",r+1+""),w.setAttribute("data-row-index",i+""),w.setAttribute("data-col-index",r+""),w.setAttribute("data-row-id",l+""),w.setAttribute("data-accessor",o.accessor+""),w.style.position="absolute",w.style.left=t.left+"px",w.style.top=t.top+"px",w.style.width=t.width+"px",w.style.height=t.height+"px";let m=!1;const g="boolean"===o.type||"date"===o.type||"enum"===o.type,x=()=>{if(m&&!g){w.innerHTML="",w.setAttribute("tabindex","-1");const n=De(t,e,()=>{m=!1,w.setAttribute("tabindex",h?"0":"-1"),x(),b()});if(n){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(n),w.appendChild(t)}}else if(m&&g)De(t,e,()=>{m=!1,x(),b()});else{w.innerHTML="";const n=document.createElement("span");n.className="st-cell-content "+("right"===o.align?"right-aligned":"center"===o.align?"center-aligned":"left-aligned"),Le(t,e,n),w.appendChild(n)}};x();const b=()=>{e.cellRegistry&&!a&&e.cellRegistry.set(`${l}-${o.accessor}`,{updateContent:t=>{m||(p(s,o.accessor,t),x(),e.cellUpdateFlash&&(w.classList.add(h?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{w.classList.remove("st-cell-updating-first","st-cell-updating")},800)))}})};if(b(),!m&&!a){const t=()=>{e.handleMouseOver(c)};ce(w,"mousedown",t=>{t.preventDefault(),t.target.closest(".st-expand-icon-container")||e.handleMouseDown(c)}),ce(w,"mouseover",t)}if(ce(w,"keydown",t=>{m||a||"F2"!==t.key&&"Enter"!==t.key||!o.isEditable||m||(t.preventDefault(),m=!0,x())}),ce(w,"dblclick",t=>{!o.isEditable||a||m||(m=!0,x())}),Be.set(w,{current:s}),e.onCellClick&&!a){const t=t=>{var n,l,a;if(t.target.closest(".st-expand-icon-container"))return;const d=null!==(l=null===(n=Be.get(w))||void 0===n?void 0:n.current)&&void 0!==l?l:s,c=u(d,o.accessor);null===(a=e.onCellClick)||void 0===a||a.call(e,{accessor:o.accessor,colIndex:r,row:d,rowIndex:i,value:c})};ce(w,"click",t)}if(e.useHoverRowBackground){((t,e)=>{je.has(t)||je.set(t,new Set),je.get(t).add(e)})(i,w);const t=()=>{ze(i,!1),Ne===i&&(Ne=null)};ce(w,"mouseenter",()=>{null!==Ne&&Ne!==i&&ze(Ne,!1),ze(i,!0),Ne=i}),ce(w,"mouseleave",t)}return w},Ge=t=>{const{position:e,rowHeight:n,displayStrongBorder:o,heightOffsets:s,customTheme:i=vt,isSticky:r=!1}=t,l=document.createElement("div");l.className="st-row-separator "+(o?"st-last-group-row":"");const a=r?e:J({position:e,rowHeight:n,heightOffsets:s,customTheme:i});l.style.width="100%",r?(l.style.position="absolute",l.style.top="0",l.style.left="0",l.style.transform=`translateY(${a}px)`):l.style.transform=`translate3d(0, ${a}px, 0)`;const d=document.createElement("div");d.style.width="100%",l.appendChild(d);let c=null;return l.addEventListener("mousedown",t=>{t.preventDefault();const e=l.style.pointerEvents;l.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(l.style.pointerEvents=e,!n)return;const o=n.closest(".st-cell");if(o instanceof HTMLElement){c=o;const e=o.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});o.dispatchEvent(n)}}),l.addEventListener("mouseup",t=>{if(c){const e=c.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});c.dispatchEvent(n),c=null}}),l},Ue=new WeakMap,Ke=new WeakMap,Je=t=>(Ke.has(t)||Ke.set(t,new Map),Ke.get(t)),Ye=(t,e,n,o=0,s,i)=>{var r,l,a,c,h;const u=n.pinned?null!==(l=null!==(r=n.containerWidth)&&void 0!==r?r:t.clientWidth)&&void 0!==l?l:0:null!==(h=null!==(c=null!==(a=n.mainSectionContainerWidth)&&void 0!==a?a:n.containerWidth)&&void 0!==c?c:t.clientWidth)&&void 0!==h?h:0,p=n.pinned?e:((t,e,n,o=100)=>{if(0===t.length)return[];const s=e-o,i=e+n+o;return t.filter(t=>t.left+t.width>=s&&i>=t.left)})(e,o,u),f=ue(t),w=(t=>(Ue.has(t)||Ue.set(t,new Map),Ue.get(t)))(t),v=new Set(p.map(t=>d({accessor:t.header.accessor,rowId:t.rowId}))),g=(null==s?void 0:s.length)?new Set(s.map(t=>t.position)):new Set(p.map(t=>t.rowIndex));if(f.forEach((t,e)=>{if(!v.has(e)){const n=parseInt(t.getAttribute("data-row-index")||"-1",10);0>n||((t,e)=>{const n=je.get(t);n&&(n.delete(e),0===n.size&&je.delete(t))})(n,t),t.remove(),f.delete(e)}}),!i){const e=Je(t);w.forEach((t,n)=>{g.has(n)||(t.remove(),w.delete(n),e.delete(n))})}const x=document.createDocumentFragment(),b=[];p.forEach(t=>{var e,o,s,r;const l=d({accessor:t.header.accessor,rowId:t.rowId});if(f.has(l)){const a=f.get(l);if(i)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px"})(a,t);else{if(((t,e,n)=>{var o;const{rowIndex:s,colIndex:i,rowId:r}=e,l={rowIndex:s,colIndex:i,rowId:r};t.className=Ve(e,n);const a=n.isInitialFocusedCell(l);t.setAttribute("tabindex",a?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px",t.style.width=e.width+"px",t.style.height=e.height+"px",t.setAttribute("data-row-index",s+""),t.setAttribute("data-col-index",i+"");const d=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+d+1+""),t.setAttribute("aria-colindex",i+1+""),t.setAttribute("data-row-id",r+""),t.setAttribute("data-accessor",e.header.accessor+"");const c=Be.get(t);if(c&&(c.current=e.row),!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",Le(e,n,o))}})(a,t,n),t.header.isSelectionColumn&&n.enableRowSelection&&n.isRowSelected){const e=n.isRowSelected(t.rowId);re(a,e)}if(t.header.expandable){const i=new Set(n.expandedDepths),l=null!==(o=null===(e=n.getExpandedRows)||void 0===e?void 0:e.call(n))&&void 0!==o?o:n.expandedRows,d=null!==(r=null===(s=n.getCollapsedRows)||void 0===s?void 0:s.call(n))&&void 0!==r?r:n.collapsedRows,c=m(t.rowId,t.depth,i,l,d);pe(a,c)}}}else b.push({cell:t,cellId:l})}),b.forEach(({cell:t,cellId:e})=>{const o=qe(t,n);x.appendChild(o),f.set(e,o)}),x.childNodes.length>0&&t.appendChild(x),i||((t,e,n,o,s)=>{const i=Je(t);let r=[];if(s&&s.length>0)r=s.map((t,e)=>({rowIndex:t.position,position:t.position,displayStrongBorder:e>0&&s[e-1].isLastGroupRow}));else if(e.length>0){const t=[];let n,o=-1,s=null;e.forEach(e=>{e.rowIndex!==o&&(s&&o>0&&t.push({rowIndex:o,firstCell:s,prevCell:n}),n=s||void 0,o=e.rowIndex,s=e)}),s&&o>0&&t.push({rowIndex:o,firstCell:s,prevCell:n}),r=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var o,s;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(s=null===(o=null==n?void 0:n.tableRow)||void 0===o?void 0:o.isLastGroupRow)&&void 0!==s&&s}})}0!==r.length&&r.forEach(({rowIndex:e,position:s,displayStrongBorder:r})=>{var l;const a=i.get(e);if(o.has(e)){const t=o.get(e);if(!a||a.position!==s||a.displayStrongBorder!==r){if((null==a?void 0:a.displayStrongBorder)!==r&&(r?t.classList.add("st-last-group-row"):t.classList.remove("st-last-group-row")),!a||a.position!==s){const e=J({position:s,rowHeight:n.rowHeight,heightOffsets:n.heightOffsets,customTheme:null!==(l=n.customTheme)&&void 0!==l?l:vt});t.style.transform=`translate3d(0, ${e}px, 0)`}i.set(e,{position:s,displayStrongBorder:r})}}else{const l=Ge({position:s,rowHeight:n.rowHeight,displayStrongBorder:r,heightOffsets:n.heightOffsets,customTheme:n.customTheme,isSticky:!1});t.appendChild(l),o.set(e,l),i.set(e,{position:s,displayStrongBorder:r})}})})(t,p,n,w,s)};function _e(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class Xe{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:o,maxHeaderDepth:s,headerHeight:i,context:r,sectionWidth:l,startColIndex:a=0}=t,d=o||"main";let c=this.headerSections.get(d);c||(c=document.createElement("div"),c.className="left"===o?"st-header-pinned-left":"right"===o?"st-header-pinned-right":"st-header-main",c.setAttribute("role","rowgroup"),this.headerSections.set(d,c));const h=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===h.length)return c.style.display="none",c;c.style.display="",c.style.cssText=`\n position: relative;\n ${void 0!==l?`width: ${l}px;`:""}\n height: ${s*i}px;\n `;const u=this.getCachedHeaderCells(d,h,n,s,i,a),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,o),w=c.scrollLeft;return Te(c,u,f,w),o||w===c.scrollLeft||(c.scrollLeft=w),!o&&c&&(c.__renderHeaderCells=t=>{c&&Te(c,u,f,t)}),c}renderBodySection(t){var e,n;const{headers:o,rows:s,collapsedHeaders:i,pinned:r,context:l,sectionWidth:a,rowHeight:d,heightOffsets:c,totalRowCount:h,startColIndex:u=0,positionOnly:p=!1,fullTableRows:f,renderedStartIndex:w,renderedEndIndex:v}=t,m=r||"main";let g=this.bodySections.get(m);g||(g=document.createElement("div"),g.className="left"===r?"st-body-pinned-left":"right"===r?"st-body-pinned-right":"st-body-main",g.setAttribute("role","rowgroup"),this.bodySections.set(m,g));const x=o.filter(t=>"left"===r?"left"===t.pinned:"right"===r?"right"===t.pinned:!t.pinned);if(0===x.length)return g.style.display="none",g;g.style.display="";const b=((t,e,n,o)=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==h?h:s.length,d,c,null!==(e=l.customTheme)&&void 0!==e?e:vt);g.style.cssText=`\n position: relative;\n ${void 0!==a?`width: ${a}px;`:""}\n ${r?"":"flex-grow: 1;"}\n height: ${b}px;\n `;const y=this.getCachedBodyCells(m,x,s,i,d,c,null!==(n=l.customTheme)&&void 0!==n?n:vt,u,f,w,v),R=y.length>0?Math.max(...y.map(t=>t.colIndex))+1:u;this.nextColIndexMap.set(m,R);const C=this.getCachedContext("body-"+m,l,r);return Ye(g,y,C,g.scrollLeft,s,p),this.renderNestedGridRows(g,m,s,r,C),r||this.renderStateRows(g,m,s,C),!r&&g&&(g.__renderBodyCells=t=>{g&&Ye(g,y,C,t,s,!0)}),g}renderNestedGridRows(t,e,n,o,s){var i;const r=n.filter(t=>t.nestedTable),l=new Set(r.map(t=>t.position));let a=this.nestedGridRowsMap.get(e);a||(a=new Map,this.nestedGridRowsMap.set(e,a)),a.forEach((t,e)=>{var n;l.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),a.delete(e))});const d={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(i=s.customTheme)&&void 0!==i?i:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons};r.forEach(e=>{var n;const i=e.position;if(!a.get(i))if(o){const o=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const o=t.nestedTable.expandableHeader.nestedTable,s=c({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),i=Y({position:t.position,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme}),r=document.createElement("div");return r.className="st-row st-nested-grid-spacer",r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${i}px, 0)`,r.style.height=s+"px",r.style.pointerEvents="none",r}(e,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(n=s.customTheme)&&void 0!==n?n:{}});t.appendChild(o),a.set(i,{element:o})}else{d.depth=e.depth>0?e.depth-1:0;const{element:n,cleanup:o}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:o,heightOffsets:s,customTheme:i,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:h,emptyStateRenderer:p,icons:f}=e,{parentRow:w,expandableHeader:v,childAccessor:m,calculatedHeight:g}=n,x=v.nestedTable;if(!x)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=u(w,m),y=Array.isArray(b)?b:[],R=l&&l[a+1]?l.slice(a+1):void 0,C=x.customTheme?Object.assign(Object.assign({},i),x.customTheme):i,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:g,customHeight:x.height,customTheme:i}),I=c({calculatedHeight:g,customHeight:x.height,customTheme:i}),H=Y({position:t.position,rowHeight:o,heightOffsets:s,customTheme:i}),M=document.createElement("div");M.className="st-row st-nested-grid-row",M.dataset.index=t.position+"",M.style.position="absolute",M.style.left="0",M.style.right="0",M.style.transform=`translate3d(0, ${H}px, 0)`,M.style.height=I+"px",M.style.paddingTop=i.nestedGridPaddingTop+"px",M.style.paddingBottom=i.nestedGridPaddingBottom+"px",M.style.paddingLeft=i.nestedGridPaddingLeft+"px",M.style.paddingRight=i.nestedGridPaddingRight+"px",M.style.boxSizing="border-box";const k=document.createElement("div");k.style.height="100%",k.style.width="100%",M.appendChild(k);const E=Object.assign(Object.assign({},x),{defaultHeaders:x.defaultHeaders,rows:y,theme:r,customTheme:C,height:S,rowGrouping:R,loadingStateRenderer:d,errorStateRenderer:h,emptyStateRenderer:p,icons:f}),O=new mn(k,E);O.mount();const T=()=>{O.destroy()};return M.__nestedTableCleanup=T,{element:M,cleanup:T}}(e,d);t.appendChild(n),a.set(i,{element:n,cleanup:o})}})}renderStateRows(t,e,n,o){var s;const i=n.filter(t=>t.stateIndicator),r=new Set(i.map(t=>t.position));let l=this.stateRowsMap.get(e);l||(l=new Map,this.stateRowsMap.set(e,l)),l.forEach((t,e)=>{r.has(e)||(t.remove(),l.delete(e))});const a={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};i.forEach((e,n)=>{var s,i;const r=e.position,d=l.get(r);if(d){const t=Y({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(s=o.customTheme)&&void 0!==s?s:{}});return void(d.style.transform=`translate3d(0, ${t}px, 0)`)}const c=((t,e)=>{const{position:n,stateIndicator:o}=t;if(!o)throw Error("createStateRow called without stateIndicator");const s=document.createElement("div");s.className="st-row st-state-row",s.dataset.index=e.index+"",s.style.width="100%",s.style.transform=`translate3d(0, ${Y({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,s.style.height=e.rowHeight+"px";const i=document.createElement("div");i.className="st-cell st-state-row-cell",i.style.width="100%",i.style.padding="0";let r=null;return o.state.loading&&e.loadingStateRenderer?r=_e(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=_e(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=_e(e.emptyStateRenderer,{message:o.state.emptyMessage,parentRow:o.parentRow})),r&&("string"==typeof r?i.textContent=r:r instanceof HTMLElement&&i.appendChild(r)),s.appendChild(i),s})(e,Object.assign(Object.assign({},a),{index:n})),h=Y({position:r,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}});c.style.position="absolute",c.style.transform=`translate3d(0, ${h}px, 0)`,c.style.width="100%",t.appendChild(c),l.set(r,c)})}calculateAbsoluteHeaderCells(t,e,n,o,s=0){const i=[];let r=s,l=0;const a=(t,s,d)=>{if(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;i.push({header:t,left:l,top:s*o,width:c,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,s,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return i.push({header:t,left:l,top:s*o,width:e,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}const h=l;let u=0;return e.forEach(e=>{u+=a(e,s+1,t)}),i.push({header:t,left:h,top:s*o,width:u,height:o,colIndex:r,parentHeader:d}),r++,u}{const e="number"==typeof t.width?t.width:150;return i.push({header:t,left:l,top:s*o,width:e,height:(n-s)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),i}calculateAbsoluteBodyCells(t,e,n,o,s,i,r=0){const l=[],a=e.filter(t=>!t.nestedTable&&!t.stateIndicator),d=this.getLeafHeaders(t,n),c=new Map;let h=0;return d.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:h,width:e}),h+=e}),a.forEach((t,e)=>{const n=i?Y({position:t.position,rowHeight:o,heightOffsets:s,customTheme:i}):e*o;d.forEach((s,i)=>{var a,d;const h=c.get(s.accessor);l.push({header:s,row:t.row,rowIndex:e,colIndex:r+i,rowId:v(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:e%2==1,tableRow:t,left:null!==(a=null==h?void 0:h.left)&&void 0!==a?a:0,top:n,width:null!==(d=null==h?void 0:h.width)&&void 0!==d?d:150,height:o})})}),l}getLeafHeaders(t,e){const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const s=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return s?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");if(e+=t.sort?`|sort:${t.sort.key.accessor}-${t.sort.direction}`:"|sort:none",e+=t.filters&&Object.keys(t.filters).length>0?"|filters:"+JSON.stringify(t.filters):"|filters:none",t.expandedRows&&(e+="|expandedRows:"+t.expandedRows.size),t.collapsedRows&&(e+="|collapsedRows:"+t.collapsedRows.size),t.expandedDepths&&(e+="|expandedDepths:"+(Array.isArray(t.expandedDepths)?t.expandedDepths.length:t.expandedDepths.size)),null!=t.collapsedHeaders){const n=t.collapsedHeaders.size;e+=`|collapsedHeaders:${n}:${0===n?"":Array.from(t.collapsedHeaders).sort().join(",")}`}return void 0!==t.selectedRowCount&&(e+="|selectedRowCount:"+t.selectedRowCount),t.selectedColumns&&void 0!==t.selectedColumns.size&&(e+="|selectedColumns:"+Array.from(t.selectedColumns).sort((t,e)=>t-e).join(",")),t.columnsWithSelectedCells&&void 0!==t.columnsWithSelectedCells.size&&(e+="|columnsWithSelectedCells:"+Array.from(t.columnsWithSelectedCells).sort((t,e)=>t-e).join(",")),t.rowsWithSelectedCells&&void 0!==t.rowsWithSelectedCells.size&&(e+="|rowsWithSelectedCells:"+Array.from(t.rowsWithSelectedCells).sort().join(",")),e}getCachedBodyCells(t,e,n,o,s,i,r,l=0,a,d,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(i),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t);if(f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===s&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&f.deps.renderedStartIndex===d&&f.deps.renderedEndIndex===c:f.deps.rowsRef===n))return f.cells;const w=p?a.slice(d,c):n,v=this.calculateAbsoluteBodyCells(e,w,o,s,i,r,l);return this.bodyCellsCache.set(t,{cells:v,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:o.size,rowHeight:s,heightOffsetsHash:u},p&&{fullTableRowsRef:a,renderedStartIndex:d,renderedEndIndex:c})}),v}getCachedHeaderCells(t,e,n,o,s,i=0){const r=this.headerCellsCache.get(t),l=this.createHeadersHash(e);if(r&&r.deps.headersHash===l&&r.deps.collapsedHeadersSize===n.size&&r.deps.maxDepth===o&&r.deps.headerHeight===s)return r.cells;const a=this.calculateAbsoluteHeaderCells(e,n,o,s,i);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:o,headerHeight:s}}),a}getCachedContext(t,e,n){const o=this.contextCache.get(t),s=this.createContextHash(e);if(o&&o.deps.contextHash===s)return o.context;const i=Object.assign(Object.assign({},e),{pinned:n});return this.contextCache.set(t,{context:i,deps:{contextHash:s}}),i}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?(this.headerCellsCache.clear(),this.headerSections.forEach(t=>{Kt(t)})):"context"===t&&(this.contextCache.clear(),this.headerSections.forEach(t=>{Kt(t)})):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{(t=>{if(t){const e=ue(t);e.forEach(t=>{t.remove()}),e.clear()}})(t)}),this.headerSections.forEach(t=>{Kt(t)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const Qe=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Ze=(t,e,n=new Set)=>{for(const o of t)if(!n.has(o.accessor)&&(n.add(o.accessor),o.children&&o.children.length>0)){const t=o.children.some(t=>t.accessor===e);let s=!1;if(!t)for(const t of o.children)if(Ze([t],e,n),!1===t.hide){s=!0;break}(t||s)&&(o.hide=!1)}},tn=t=>t.every(t=>t.hide),en=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(en(t.children),tn(t.children)&&(t.hide=!0))})},nn=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>nn(t,e))},on=(t,e,n)=>{if(!e.trim())return t;const o=n||nn;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function sn(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function rn(t,e,n,o,s,i,r){const l=e({headers:n,searchSection:o,listSection:s,resetSection:i,resetColumns:r});if(l instanceof HTMLElement)t.appendChild(l);else if("string"==typeof l){const e=document.createElement("div");e.innerHTML=l,t.appendChild(e)}}const ln=t=>{let e=t,{headers:n,open:o,searchEnabled:s,searchPlaceholder:i,searchFunction:r,columnEditorConfig:l,essentialAccessors:a,setHeaders:d,onColumnVisibilityChange:c,onColumnOrderChange:h,resetColumns:u}=e,p="",f=null,w=null,v=!1;const m=new Set,g=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(m.add(t.accessor),g(t.children))})};g(n);let x=m;const b=document.createElement("div");b.className="st-column-editor-popout "+(o?"open":"");const y=document.createElement("div");y.className="st-column-editor-popout-content",y.addEventListener("click",t=>t.stopPropagation());let R=null,C=null;if(s){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const o=document.createElement("input");return o.type="text",o.value="",o.placeholder=t,o.className="st-filter-input",o.addEventListener("click",t=>t.stopPropagation()),o.addEventListener("input",t=>{p=t.target.value,W()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(i);C=t.wrapper,R=t.input}const S=document.createElement("div");S.className="st-column-editor-lists";let I=null;u&&(I=function(t){const e=document.createElement("div");e.className="st-column-editor-footer";const n=document.createElement("button");return n.type="button",n.className="st-column-editor-reset-btn",n.textContent="Reset columns",n.addEventListener("click",e=>{e.stopPropagation(),t()}),e.appendChild(n),e}(u));let H=l.customRenderer;H?rn(y,H,n,C,S,I,u):sn(y,C,S,I),b.appendChild(y);const M=t=>{f=t,null!==t?v=!0:(v=!1,W())},k=()=>{w=null},E=t=>{w=t,v?T():W()},O=t=>{const e=x;x=t,W(e)},T=()=>{S.querySelectorAll(".st-column-editor-drag-separator").forEach((t,e)=>{const n=t;n.style.opacity=0===e?-1===w?"1":"0":w===e-1?"1":"0"})},A=(t,e,o,i,u)=>{if(0===t.length)return;const v=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(s?on(v,p,r):v).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,i.appendChild(t)}const m=document.createElement("div");m.className="st-column-editor-list st-column-editor-list-section",i.appendChild(m);const g=((t,e)=>{const n=s?on(t,p,r):t,o=[],i=s&&p.trim().length>0,l=({headers:t,depth:n=0,parent:s=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];o.push({header:t,visualIndex:o.length,depth:n,parent:s,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=i||x.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),o})(t,e),b=(t=>t.some(t=>t.children&&t.children.length>0))(t);g.forEach(t=>{var o;const i=(t=>{var e;const{allHeaders:n,clearHoverSeparator:o,depth:s,doesAnyHeaderHaveChildren:i,draggingRow:r,getDraggingRow:l,getHoveredSeparatorIndex:a,expandedHeaders:d,flattenedHeaders:c,forceExpanded:h,header:u,hoveredSeparatorIndex:p,panelSection:f,rowIndex:w,setDraggingRow:v,setExpandedHeaders:m,setHoveredSeparatorIndex:g,headers:x,setHeaders:b,onColumnVisibilityChange:y,onColumnOrderChange:R,previousExpandedHeaders:C}=t,S=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,H=St(u,S),M=!H,k=document.createDocumentFragment(),E=16*s+"px",O=u.children&&u.children.length>0,T=!(u.hide||O&&u.children&&tn(u.children)),A=d.has(u.accessor),W=h||A;let P;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=-1===p?"1":"0",k.appendChild(t)}const $=document.createElement("div");$.className="st-header-checkbox-item",$.style.paddingLeft=E,$.draggable=!0;const D=t=>!(S.size>0&&!Ht(t,S)||(null==R||R(t),b(t),0)),F=t=>{if(t.stopPropagation(),h)return;const e=new Set(d);A?e.delete(u.accessor):e.add(u.accessor),m(e)};let L;if($.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),v(c[w])}),$.addEventListener("dragenter",t=>{t.preventDefault()}),$.addEventListener("dragover",t=>{t.preventDefault();const e=l?l():r;if(e&&e.panelSection===f){const n=t.currentTarget.getBoundingClientRect(),o=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:o})=>{var s,i;const r=t[n];if(r.depth===e.depth)return(null===(s=r.parent)||void 0===s?void 0:s.accessor)!==(null===(i=e.parent)||void 0===i?void 0:i.accessor)?null:o||r.header.children?n-1:n;if(r.depth>e.depth){let s=r,i=n;for(;s.parent&&s.depth>e.depth;){const e=s.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;s=t[n],i=n}const l=i;let a=i;for(let e=i+1;t.length>e&&t[e].depth>s.depth;e++)a=e;const d=a-l+1,c=n-l;let h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=o),h?i-1:a}return null})({flattenedHeaders:c,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});g(o)}}),$.addEventListener("dragend",()=>{const t=l?l():r,e=a?a():p,n=()=>{v(null),g(null)};if(!t||null===e||t.panelSection!==f)return void n();let o,s=c[e>t.visualIndex?e:e+1];if(s){if(s.depth>t.depth&&s.parent){const t=c.findIndex(t=>t.header.accessor===s.parent.accessor);-1!==t&&(s=c[t])}if(t.header.accessor!==s.header.accessor)if(t.indexPath.length!==s.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===s.indexPath[e]))n();else{if(1===t.indexPath.length){const{newHeaders:e,emergencyBreak:i}=ve(x,t.indexPath,s.indexPath);if(i)return void n();o=e}else{const{newHeaders:e,emergencyBreak:i}=ve(x,t.indexPath,s.indexPath);if(i)return void n();o=e}D(o),n()}else n()}else n()}),i){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==C?h||C.has(u.accessor):W,n=!h&&void 0!==C&&t!==W,o=n?t:W,s=document.createElement("div");s.className="st-collapsible-header-icon st-expand-icon-container "+(o?"expanded":"collapsed"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",o+""),s.setAttribute("aria-label",o?`Collapse ${u.label} column`:`Expand ${u.label} column`),s.appendChild(gt("st-expand-icon")),s.addEventListener("click",F),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),F(t))}),e.appendChild(s),L=s,n&&(P=()=>{pe($,W,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||$.appendChild(e)}const j=le({checked:T,onChange:t=>{if(!M)return;u.hide=!t,t?(Ze(n,u.accessor),O&&u.children&&u.children.length>0&&u.children.every(t=>!0===t.hide)&&u.children[0]&&(u.children[0].hide=!1,Ze(n,u.children[0].accessor))):en(n);const e=[...x];if(b(ft(e)),y){const t=(t=>{const e={},n=t=>{e[t.accessor]=!t.hide,t.children&&t.children.length>0&&t.children.forEach(n)};return t.forEach(n),e})(e);y(t)}}});M||(j.element.classList.add("st-checkbox-disabled"),j.element.style.pointerEvents="none");const B=document.createElement("div");B.className="st-drag-icon-container",B.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const N=document.createElement("div");N.className="st-column-label-container",N.textContent=u.label;const z="left"===u.pinned||"right"===u.pinned?u.pinned:null,V=!!z&&!H,q=!z&&"main"===f,G=!z&&"main"===f,U=()=>{const t=Tt(x,u.accessor,"left",S);t&&D(t)},K=()=>{const t=Tt(x,u.accessor,"right",S);t&&D(t)},J=()=>{const t=Tt(x,u.accessor,"main",S);t&&D(t)},{rowRenderer:Y}=t.columnEditorConfig;if(Y){const t=Y({accessor:u.accessor,header:u,components:{expandIcon:L,checkbox:j.element,dragIcon:B,labelContent:N},panelSection:f,isEssential:H,canToggleVisibility:M,allowColumnPinning:I,pinControl:I&&0===s?{pinnedSide:z,canPinLeft:q,canPinRight:G,canUnpin:V,pinLeft:U,pinRight:K,unpin:J}:void 0});t instanceof HTMLElement?$.appendChild(t):"string"==typeof t&&($.innerHTML=t)}else if($.appendChild(j.element),$.appendChild(B),$.appendChild(N),I&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),z){const e=document.createElement("div"),n=H;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===z?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",V&&e.addEventListener("click",t=>{t.stopPropagation(),J()}),t.appendChild(e)}else{if(q){const e=document.createElement("button");e.type="button",e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="L",e.title="Pin column to left",e.addEventListener("click",t=>{t.stopPropagation(),U()}),t.appendChild(e)}if(G){const e=document.createElement("button");e.type="button",e.className="st-column-pin-btn st-column-pin-side st-column-pin-side-option",e.textContent="R",e.title="Pin column to right",e.addEventListener("click",t=>{t.stopPropagation(),K()}),t.appendChild(e)}}$.appendChild(t)}k.appendChild($);const _=document.createElement("div");return _.className="st-column-editor-drag-separator",_.style.opacity=p===w?"1":"0",k.appendChild(_),{fragment:k,scheduleExpandIconAnimation:P}})({allHeaders:n,clearHoverSeparator:k,depth:t.depth,doesAnyHeaderHaveChildren:b,draggingRow:f,getDraggingRow:()=>f,getHoveredSeparatorIndex:()=>w,expandedHeaders:x,flattenedHeaders:g,forceExpanded:s&&p.trim().length>0,header:t.header,hoveredSeparatorIndex:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:M,setExpandedHeaders:O,setHoveredSeparatorIndex:E,columnEditorConfig:l,essentialAccessors:null!=a?a:new Set,headers:n,setHeaders:d,onColumnVisibilityChange:c,onColumnOrderChange:h,previousExpandedHeaders:u});m.appendChild(i.fragment),null===(o=i.scheduleExpandIconAnimation)||void 0===o||o.call(i)})},W=t=>{S.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:o,unpinned:s,pinnedRight:i}=Ct(n);if(e)A(o,"left","Pinned Left",S,t),A(s,"main","Main",S,t),A(i,"right","Pinned Right",S,t);else{const e=[...o,...s,...i];A(e,"main",null,S,t)}};return W(),{element:b,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(s=t.searchEnabled),void 0!==t.searchPlaceholder&&(i=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),void 0!==t.essentialAccessors&&(a=t.essentialAccessors),void 0!==t.setHeaders&&(d=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(c=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(h=t.onColumnOrderChange),void 0!==t.resetColumns&&(u=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==H&&(H=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?b.classList.add("open"):b.classList.remove("open")),R&&void 0!==t.searchPlaceholder&&(R.placeholder=t.searchPlaceholder),e&&(y.innerHTML="",H?rn(y,H,n,C,S,I,u):sn(y,C,S,I)),W()},destroy:()=>{R&&(R.removeEventListener("input",()=>{}),R.removeEventListener("click",()=>{})),b.removeEventListener("click",()=>{}),b.remove()}}},an=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),o=t.querySelector(".st-horizontal-scrollbar-middle"),s=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),s instanceof HTMLElement&&e.unregisterPane("pinned-right",s)}t.remove()},dn=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:s,treeTransitionOffset:i,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:p,sectionScrollController:f}=t,w=document.createElement("div");w.className=h?"st-sticky-section-"+h:"st-sticky-section-main",w.style.position="relative",w.style.height=o+"px",h&&u?(w.style.width=u+"px",w.style.flexGrow="0",w.style.flexShrink="0"):w.style.flexGrow="1";const m=((t,e)=>{const n=[],o=t=>{if(t.hide||t.excludeFromRender)return;const s=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return s?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>o(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>o(t)),n})(e,c),g=new Map;let x=0;return m.forEach(t=>{const e="number"==typeof t.width?t.width:150;g.set(t.accessor,{left:x,width:e}),x+=e}),n.forEach((t,e)=>{const o=-1!==s&&e>=s,c=o?i:0,h=e*(r+1)+c,u=o?e:n.length-e,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),m.forEach((e,n)=>{var o,s;const i=g.get(e.accessor),l={header:e,row:t.row,rowIndex:t.position,colIndex:n,rowId:v(t.rowId),displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(o=null==i?void 0:i.left)&&void 0!==o?o:0,top:0,width:null!==(s=null==i?void 0:i.width)&&void 0!==s?s:150,height:r},a=qe(l,d);p.appendChild(a)}),w.appendChild(p);const f=Ge({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0});w.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",w,"sticky"),w},cn=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),o=t.querySelector(".st-sticky-section-main"),s=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),s instanceof HTMLElement&&e.unregisterPane("pinned-right",s)}t.remove()};class hn{constructor(){this.footerInstance=null,this.columnEditorInstance=null,this.horizontalScrollbarRef={current:null},this.scrollbarTimeoutId=null,this.stickyParentsContainer=null,this.sectionScrollController=null,this.renderScheduled=!1,this.pendingRenderCallback=null,this.sectionRenderer=new Xe}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}renderHeader(t,e,n,o){var s,i,r,l,a,d,c,h,u,p,f,w;if(!t||o.config.hideHeader)return;t.style.height=e+"px";const v=wt(o.effectiveHeaders,"left")||wt(o.effectiveHeaders,void 0)||wt(o.effectiveHeaders,"right");t.style.minHeight=v?"":e+"px",t.setAttribute("aria-rowcount",1+o.localRows.length+""),t.setAttribute("aria-colcount",o.effectiveHeaders.length+"");const m=null!==(i=null===(s=o.dimensionManager)||void 0===s?void 0:s.getState())&&void 0!==i?i:{containerWidth:0,calculatedHeaderHeight:o.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:g,leftWidth:x,rightWidth:b}=me({headers:o.effectiveHeaders,containerWidth:m.containerWidth,collapsedHeaders:o.collapsedHeaders}),y=null===(r=o.sortManager)||void 0===r?void 0:r.getState(),R=null===(l=o.filterManager)||void 0===l?void 0:l.getState(),C=null!==(d=null===(a=o.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,S=Object.assign(Object.assign({reverse:!1,collapsedHeaders:o.collapsedHeaders,getCollapsedHeaders:o.getCollapsedHeaders,columnBorders:null!==(c=o.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=o.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=o.config.columnResizing)&&void 0!==u&&u,containerWidth:m.containerWidth,mainSectionContainerWidth:g,enableHeaderEditing:o.config.enableHeaderEditing,enableRowSelection:o.config.enableRowSelection,selectedRowCount:C,filters:null!==(p=null==R?void 0:R.filters)&&void 0!==p?p:{},icons:o.resolvedIcons},o.config.selectableColumns&&o.selectionManager?{selectedColumns:o.selectionManager.getSelectedColumns(),columnsWithSelectedCells:o.selectionManager.getColumnsWithSelectedCells()}:{selectedColumns:new Set,columnsWithSelectedCells:new Set}),{sort:null!==(f=null==y?void 0:y.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(w=o.config.autoExpandColumns)&&void 0!==w&&w,essentialAccessors:o.essentialAccessors,selectableColumns:o.config.selectableColumns,headers:o.effectiveHeaders,rows:o.localRows,headerHeight:o.customTheme.headerHeight,lastHeaderIndex:o.effectiveHeaders.length-1,onSort:t=>{o.sortManager&&o.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{o.filterManager&&o.filterManager.updateFilter(t)},handleClearFilter:t=>{o.filterManager&&o.filterManager.clearFilter(t)},handleSelectAll:t=>{var e;null===(e=o.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{o.setCollapsedHeaders("function"==typeof t?t(o.collapsedHeaders):t),o.onRender()},setHeaders:t=>{o.setHeaders("function"==typeof t?t(o.getHeaders()):t),o.onRender()},setIsResizing:t=>{o.setIsResizing("function"==typeof t?t(o.isResizing):t)},onColumnWidthChange:o.config.onColumnWidthChange,onColumnOrderChange:o.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{o.setHeaders(t),o.onRender()},onHeaderEdit:o.config.onHeaderEdit,onColumnSelect:o.config.onColumnSelect,selectColumns:o.selectionManager&&o.config.selectableColumns?(t,e)=>{o.selectionManager.selectColumns(t,e),o.onRender()}:t=>{},setSelectedColumns:o.selectionManager&&o.config.selectableColumns?t=>{const e=o.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;o.selectionManager.setSelectedColumns(n),o.onRender()}:t=>{},setSelectedCells:o.selectionManager?t=>{var e;const n=o.selectionManager.getSelectedCells(),s="function"==typeof t?t(n):t;o.selectionManager.setSelectedCells(s instanceof Set?s:new Set),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},setInitialFocusedCell:o.selectionManager?t=>{var e;o.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=o.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:o.draggedHeaderRef,hoveredHeaderRef:o.hoveredHeaderRef,headerRegistry:o.headerRegistry,forceUpdate:()=>o.onRender(),mainBodyRef:o.mainBodyRef,pinnedLeftRef:o.pinnedLeftRef,pinnedRightRef:o.pinnedRightRef}),I=o.effectiveHeaders.filter(t=>"left"===t.pinned),H=o.effectiveHeaders.filter(t=>!t.pinned),M=o.effectiveHeaders.filter(t=>"right"===t.pinned);let k=0;const E=[];if(I.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:x,startColIndex:k});o.pinnedLeftHeaderRef.current=e,E.push(e),t.appendChild(e),k=this.sectionRenderer.getNextColIndex("left")}if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:g,startColIndex:k});o.mainHeaderRef.current=e,E.push(e),t.appendChild(e),k=this.sectionRenderer.getNextColIndex("main")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:S,sectionWidth:b,startColIndex:k});o.pinnedRightHeaderRef.current=e,E.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{E.includes(t)||t.remove()})}renderBody(t,e,n){var o,s,i,r,l,a,d,c,h,u,p,f,w,v,m,g,x,b,y,R;if(!t)return;if(wt(n.effectiveHeaders,"left")||wt(n.effectiveHeaders,void 0)||wt(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(s=null===(o=null==e?void 0:e.heightMap)||void 0===o?void 0:o.totalHeight)&&void 0!==s?s:0;t.style.minHeight=n+"px"}const C=e.rowsToRender||e.currentTableRows,S=!n.internalIsLoading&&0===e.currentTableRows.length;if(n.selectionManager&&e.currentTableRows&&n.selectionManager.updateConfig({tableRows:e.currentTableRows,headers:n.effectiveHeaders,collapsedHeaders:n.collapsedHeaders,selectableColumns:null!==(i=n.config.selectableColumns)&&void 0!==i&&i},{positionOnlyBody:n.positionOnlyBody}),S){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const I=null!==(l=null===(r=n.dimensionManager)||void 0===r?void 0:r.getState())&&void 0!==l?l:{containerWidth:0,calculatedHeaderHeight:n.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:H,leftWidth:M,rightWidth:k}=me({headers:n.effectiveHeaders,containerWidth:I.containerWidth,collapsedHeaders:n.collapsedHeaders}),E=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,O=null!==(c=I.maxHeaderDepth)&&void 0!==c?c:1,T={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(u=null===(h=n.selectionManager)||void 0===h?void 0:h.getSelectedColumns())&&void 0!==u?u:new Set,rowsWithSelectedCells:null!==(f=null===(p=n.selectionManager)||void 0===p?void 0:p.getRowsWithSelectedCells())&&void 0!==f?f:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectedRowCount:E,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:n.config.useHoverRowBackground,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:O,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:I.containerWidth,mainSectionContainerWidth:H,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var o;null===(o=n.rowSelectionManager)||void 0===o||o.handleRowSelect(t,e)},cellRegistry:n.cellRegistry,getCollapsedRows:()=>n.getCollapsedRows(),getExpandedRows:()=>n.getExpandedRows(),setCollapsedRows:t=>{n.setCollapsedRows("function"==typeof t?t(n.getCollapsedRows()):t),this.scheduleRender(n.onRender)},setExpandedRows:t=>{n.setExpandedRows("function"==typeof t?t(n.getExpandedRows()):t),this.scheduleRender(n.onRender)},setRowStateMap:t=>{n.setRowStateMap("function"==typeof t?t(n.getRowStateMap()):t),this.scheduleRender(n.onRender)},icons:n.resolvedIcons,theme:null!==(v=n.config.theme)&&void 0!==v?v:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,getBorderClass:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.getBorderClass(t))||""},isSelected:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isSelected(t))||!1},isInitialFocusedCell:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isInitialFocusedCell(t))||!1},isCopyFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isCopyFlashing(t))||!1},isWarningFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isWarningFlashing(t))||!1},handleMouseDown:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseDown(t)},handleMouseOver:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseOver(t)},isRowSelected:t=>{var e,o;return null!==(o=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==o&&o},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading},A=n.effectiveHeaders.filter(t=>"left"===t.pinned),W=n.effectiveHeaders.filter(t=>!t.pinned),P=n.effectiveHeaders.filter(t=>"right"===t.pinned);let $=0;const D=[];if(A.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:T,sectionWidth:M,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:$,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedLeftRef.current=o,D.push(o),t.appendChild(o),$=this.sectionRenderer.getNextColIndex("left")}if(W.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,context:T,sectionWidth:H,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:$,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.mainBodyRef.current=o,D.push(o),t.appendChild(o),$=this.sectionRenderer.getNextColIndex("main")}if(P.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:C,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:T,sectionWidth:k,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:$,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex});n.pinnedRightRef.current=o,D.push(o),t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(cn(this.stickyParentsContainer,null!==(m=n.sectionScrollController)&&void 0!==m?m:null),this.stickyParentsContainer=null);const o=null!==(x=null===(g=n.mainBodyRef.current)||void 0===g?void 0:g.scrollTop)&&void 0!==x?x:0;this.stickyParentsContainer=((t,e)=>{const{stickyParents:n}=t;if(0===n.length)return null;const{treeTransitionOffset:o,offsetStartIndex:s}=((t,e,n,o,s,i)=>{var r,l;if(0===t.length)return{treeTransitionOffset:0,offsetStartIndex:-1};const a=e[0];if(!a)return{treeTransitionOffset:0,offsetStartIndex:-1};let d;if((null==a?void 0:a.parentIndices)&&a.parentIndices.length>0)for(let e=a.parentIndices.length-1;e>=0;e--){const n=a.parentIndices[e];if(t.some(t=>t.position===n)){d=n;break}}const c=void 0!==d?t.findIndex(t=>t.position===d):-1;let h=-1;for(let e=0;t.length>e;e++){const n=t[e],o=t[e+1];if(!o)break;if(o.depth===n.depth){h=e;break}if(n.depth>o.depth){h=t.findIndex(t=>t.depth===n.depth);break}}if(-1===h)return{treeTransitionOffset:0,offsetStartIndex:c};const u=null===(r=t[h])||void 0===r?void 0:r.position;if(void 0===u)return{treeTransitionOffset:0,offsetStartIndex:c};let p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let w;return w=n?n.rowTopPositions[f.position]:f.position*(o+s.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*o+Math.max(0,i-w)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),i=n.length>0?n.length*(e.rowHeight+1)+o:0,r=`calc(100% - ${t.scrollbarWidth}px - ${e.editColumns?"29.5px":"0px"})`,l=document.createElement("div");l.className="st-sticky-top",l.style.height=i+"px",l.style.width=r,l.style.top=t.calculatedHeaderHeight+"px";const a=e.headers.filter(t=>!t.pinned),d=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const r=dn({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:i,offsetStartIndex:s,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:d});l.appendChild(r)}const c=dn({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:s,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:a,stickyHeight:i,stickyParents:n,treeTransitionOffset:o,sectionScrollController:d});if(l.appendChild(c),t.pinnedRightColumns.length>0){const r=dn({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:i,offsetStartIndex:s,treeTransitionOffset:o,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:d});l.appendChild(r)}return l})({calculatedHeaderHeight:I.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:A,pinnedLeftWidth:M,pinnedRightColumns:P,pinnedRightWidth:k,scrollTop:o,scrollbarWidth:n.mainBodyRef.current?n.mainBodyRef.current.offsetWidth-n.mainBodyRef.current.clientWidth:0,stickyParents:e.stickyParents},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(b=n.config.editColumns)&&void 0!==b&&b,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:T,sectionScrollController:null!==(y=n.sectionScrollController)&&void 0!==y?y:null}),this.stickyParentsContainer&&(D.push(this.stickyParentsContainer),t.contains(this.stickyParentsContainer)||t.appendChild(this.stickyParentsContainer))}else this.stickyParentsContainer&&(cn(this.stickyParentsContainer,null!==(R=n.sectionScrollController)&&void 0!==R?R:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{D.includes(t)||t.remove()})}renderFooter(t,e,n,o,s){var i,r,l,a,d,c,h,u,p,f,w;if(!t)return;const v=!!s.config.footerRenderer;if(!v&&(!s.config.shouldPaginate||s.config.hideFooter))return void(t.innerHTML="");const m=null!==(i=s.config.rowsPerPage)&&void 0!==i?i:10,g=Math.ceil(e/m);if(v){const i=(n-1)*m+1,a=s.config.footerRenderer({currentPage:n,endRow:Math.min(n*m,e),hasNextPage:g>n,hasPrevPage:n>1,nextIcon:null===(r=s.resolvedIcons)||void 0===r?void 0:r.next,onNextPage:async()=>{g>n&&(o(n+1),s.config.onNextPage&&await s.config.onNextPage(n+1))},onPageChange:o,onPrevPage:()=>{n>1&&o(n-1)},prevIcon:null===(l=s.resolvedIcons)||void 0===l?void 0:l.prev,rowsPerPage:m,startRow:i,totalPages:g,totalRows:e});return t.innerHTML="",a instanceof HTMLElement?t.appendChild(a):"string"==typeof a&&(t.innerHTML=a),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(a=s.config.hideFooter)&&void 0!==a&&a,onPageChange:o,onNextPage:s.config.onNextPage,onUserPageChange:s.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(d=s.config.shouldPaginate)&&void 0!==d&&d,totalPages:g,totalRows:e,prevIcon:null===(c=s.resolvedIcons)||void 0===c?void 0:c.prev,nextIcon:null===(h=s.resolvedIcons)||void 0===h?void 0:h.next});else{t.innerHTML="";const i=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:s,onUserPageChange:i,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,w=Math.min((e-1)*r+1,d),v=Math.min(e*r,d),m=!t,g=!n&&!s||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${w} to ${v} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let o,s;if(t>8)if(e-7>t){const e=7;o=t-e,s=t+(15-e-1)}else o=Math.max(1,e-15+1),s=e;else o=1,s=14;o>2?(n.push(1),n.push(-1)):2===o&&n.push(1);for(let t=o;s>=t;t++)n.push(t);return e-1>s?(n.push(-2),n.push(e)):s===e-1&&n.push(e),n})(e,a),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const s=document.createElement("button"),r=n>0&&0>R[n-1];s.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),s.textContent=""+t,s.setAttribute("aria-label","Go to page "+t),e===t&&s.setAttribute("aria-current","page"),s.addEventListener("click",()=>(async t=>{1>t||t>a||(o(t),i&&await i(t))})(t)),y.appendChild(s),C.push({button:s,page:t,afterEllipsis:r})}}),C.forEach((t,n)=>{const{button:o,page:s,afterEllipsis:i}=t,r=n+1,l=e===s,a=o.previousElementSibling,d=o.nextElementSibling,c=null!==a&&a.classList.contains("st-page-btn")&&a.classList.contains("active")||null!==d&&d.classList.contains("st-page-btn")&&d.classList.contains("active");r>9&&!(l||i||c)&&o.classList.add("st-page-btn--compact-hidden")});const S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Qe(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),i&&await i(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Qe(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(s&&e===a&&!await s(e))return u=!1,void f();t>a&&!s||(o(t),i&&await i(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(o=t.onPageChange),void 0!==t.onNextPage&&(s=t.onNextPage),void 0!==t.onUserPageChange&&(i=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(u=s.config.hideFooter)&&void 0!==u&&u,onPageChange:o,onNextPage:s.config.onNextPage,onUserPageChange:s.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(p=s.config.shouldPaginate)&&void 0!==p&&p,totalPages:g,totalRows:e,prevIcon:null===(f=s.resolvedIcons)||void 0===f?void 0:f.prev,nextIcon:null===(w=s.resolvedIcons)||void 0===w?void 0:w.next});this.footerInstance=i,t.appendChild(i.element)}}renderColumnEditor(t,e,n,o,s){if(!t)return;if(!s.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const i=()=>{const t=s.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));s.setHeaders(e),s.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,editColumns:s.config.editColumns,headers:s.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,essentialAccessors:s.essentialAccessors,setHeaders:t=>{s.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),s.onRender()},onColumnVisibilityChange:s.config.onColumnVisibilityChange,onColumnOrderChange:s.config.onColumnOrderChange,resetColumns:i,setOpen:n});else{const r=(t=>{let{columnEditorText:e,editColumns:n,headers:o,open:s,searchEnabled:i,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,essentialAccessors:d,resetColumns:c,setHeaders:h,onColumnVisibilityChange:u,onColumnOrderChange:p,setOpen:f}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(s?"open":""),w.style.width="29.5px";const v=t=>{f(!s)},m=document.createElement("div");m.className="st-column-editor-text",m.textContent=e,w.addEventListener("click",v),w.appendChild(m);const g=ln({headers:o,open:s,searchEnabled:i,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,essentialAccessors:d,resetColumns:c,setHeaders:h,onColumnVisibilityChange:u,onColumnOrderChange:p});w.appendChild(g.element);const x={update:t=>{void 0!==t.open&&(s=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(f=t.setOpen),void 0!==t.columnEditorText&&(m.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(d=t.essentialAccessors),void 0!==t.resetColumns&&(c=t.resetColumns),g.update({headers:t.headers,open:t.open,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{w.removeEventListener("click",v),g.destroy(),w.remove()}};return w.__columnEditor=x,Object.assign({element:w},x)})({columnEditorText:o.text,editColumns:s.config.editColumns,headers:s.headers,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,essentialAccessors:s.essentialAccessors,setHeaders:t=>{s.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),s.onRender()},onColumnVisibilityChange:s.config.onColumnVisibilityChange,onColumnOrderChange:s.config.onColumnOrderChange,resetColumns:i,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,o,s,i,r,l){if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)||(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(a=l.sectionScrollController)&&void 0!==a?a:null;const c=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:s,pinnedLeftContentWidth:i,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?29.5:0,h=(a?s+1:s)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.className="st-horizontal-scrollbar-container",o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=o+"px";const e=document.createElement("div");e.style.width=i+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(s>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=h+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:i,tableBodyContainerRef:r,editColumns:null!==(d=l.config.editColumns)&&void 0!==d&&d,sectionScrollController:this.sectionScrollController});if(c){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(c,e.nextSibling):t.appendChild(c),this.horizontalScrollbarRef.current=c}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(an(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(an(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(cn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function un(t){const{rows:e=[],rowGrouping:n=[],getRowId:o,expandedRows:s=new Map,collapsedRows:i=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:h=!1,headers:u=[],rowHeight:p=40,headerHeight:g=40,customTheme:x}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],s=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:w({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:s,groupingKey:void 0}),rowPath:n,rowIndexPath:s,absoluteRowIndex:e,isLastGroupRow:!1}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const b=[],y=[],R=[],C=[];let S=0;const I=(t,e,H=[],M=[],k=[])=>{t.forEach((t,E)=>{var O,T;const A=n[e],W=b.length,P=[...H,E],$=[...M,E],D=w({row:t,getRowId:o,depth:e,index:E,rowPath:P,rowIndexPath:$,groupingKey:A}),F=b.length,L={row:t,depth:e,displayPosition:S,groupingKey:A,position:W,isLastGroupRow:!1,rowId:D,rowPath:P,rowIndexPath:$,absoluteRowIndex:W,parentIndices:k.length>0?[...k]:void 0};b.push(L),y.push(L),S++;const j=v(D);if(m(j,e,r,s,i)&&n.length>e){const n=null==l?void 0:l.get(j),o=((t,e)=>{const n=t[e];return f(n)?n:[]})(t,A),s=u.find(t=>t.expandable&&t.nestedTable);if((null==s?void 0:s.nestedTable)&&o.length>0){const n=b.length,i=(null===(O=s.nestedTable.customTheme)||void 0===O?void 0:O.rowHeight)||p,r=(null===(T=s.nestedTable.customTheme)||void 0===T?void 0:T.headerHeight)||g,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:o})=>Math.min(n+o.rowSeparatorWidth+t*(e+o.rowSeparatorWidth)+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth,o.nestedGridMaxHeight+o.nestedGridPaddingTop+o.nestedGridPaddingBottom+o.nestedGridBorderWidth))({childRowCount:o.length,rowHeight:i,headerHeight:r,customTheme:x}),a=c({calculatedHeight:l,customHeight:s.nestedTable.height,customTheme:x});R.push([n,a-p]);const d=[...P,A];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:$,nestedTable:{parentRow:t,expandableHeader:s,childAccessor:A,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&h){const o=b.length,s=[...P,A];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:o,isLastGroupRow:!1,rowId:s,rowPath:s,rowIndexPath:$,stateIndicator:{parentRowId:j,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...k,F]})}else if(n.loading&&!a){const t=b.length,n=[...P,A,"loading-skeleton"];b.push({row:{},depth:e+1,displayPosition:S-1,groupingKey:A,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:$,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...k,F]})}}else if(o.length>0){const t=[...P,A],n=[...$];I(o,e+1,t,n,[...k,F])}}0===e&&C.push(b.length)})};return I(e,0,[],[],[]),C.forEach((t,e)=>{const n=t-1;n>=0&&b.length>n&&(b[n].isLastGroupRow=!0)}),{flattenedRows:b,heightOffsets:R,paginatableRows:y,parentEndPositions:C}}const pn=t=>{var e;const n=document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t};class fn{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.tableRenderer=new hn}getCachedFlattenResult(){var t,e;return null!==(e=null===(t=this.flattenedRowsCache)||void 0===t?void 0:t.flattenResult)&&void 0!==e?e:null}getLastProcessedResult(){return this.lastProcessedResult}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null)}computeEffectiveHeaders(t,e,n,o){var s;let i=[...t];return e.enableRowSelection&&!(null===(s=null==t?void 0:t[0])||void 0===s?void 0:s.isSelectionColumn)&&(i=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...i]),null!=o&&o>0?R(i,{containerWidth:o}):R(i)}render(t,e,n,o,s){var i,r,l,a,d,c,h,p,f,w,v,m,g,x,b,y,R,C,S,I,H,M,k;if(this.lastHeadersRef!==n.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=n.headers),!n.dimensionManager)return;const E=null!==(c=null!==(l=null===(r=null===(i=n.mainBodyRef)||void 0===i?void 0:i.current)||void 0===r?void 0:r.scrollLeft)&&void 0!==l?l:null===(d=null===(a=n.mainHeaderRef)||void 0===a?void 0:a.current)||void 0===d?void 0:d.scrollLeft)&&void 0!==c?c:0,O=n.dimensionManager.getState(),{containerWidth:T,calculatedHeaderHeight:W,maxHeaderDepth:P}=O;let $=this.computeEffectiveHeaders(n.headers,n.config,n.customTheme,T);const{leftWidth:D,rightWidth:F}=me({headers:$,containerWidth:T,collapsedHeaders:n.collapsedHeaders});n.config.autoExpandColumns&&T>0&&($=A($,{autoExpandColumns:!0,containerWidth:T,pinnedLeftWidth:D,pinnedRightWidth:F,mainBodyRef:null!==(h=n.mainBodyRef)&&void 0!==h?h:{current:null},isResizing:null!==(p=n.isResizing)&&void 0!==p&&p}));const{mainWidth:L,leftWidth:B,rightWidth:N,leftContentWidth:z,rightContentWidth:V}=me({headers:$,containerWidth:T,collapsedHeaders:n.collapsedHeaders}),q=T-B-N,G=t=>"number"==typeof t?t+"px":t;let U="",J="";if(n.config.maxHeight){const t=G(n.config.maxHeight);U=`max-height: ${t};`,J=void 0===O.contentHeight?"height: auto;":`height: ${t};`}else n.config.height&&(J=`height: ${G(n.config.height)};`);const{customTheme:Y}=n;t.rootElement.style.cssText=`\n ${U}\n ${J}\n --st-main-section-width: ${q}px;\n --st-scrollbar-width: ${o.scrollbarWidth}px;\n --st-editor-width: ${n.config.editColumns?29.5:0}px;\n --st-border-width: ${Y.borderWidth}px;\n --st-footer-height: ${Y.footerHeight}px;\n `;const _=null!==(f=n.config.columnResizing)&&void 0!==f&&f;t.content.className="st-content "+(_?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%";let Z=n.localRows;if(n.sortManager?Z=n.sortManager.getSortedRows():n.filterManager&&(Z=n.filterManager.getFilteredRows()),this.lastRowsRef!==Z&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=Z),n.internalIsLoading&&0===Z.length){let t=n.config.shouldPaginate&&null!==(w=n.config.rowsPerPage)&&void 0!==w?w:10;o.isMainSectionScrollable&&(t+=1),Z=Array.from({length:t},()=>({}))}const tt=null===(v=n.sortManager)||void 0===v?void 0:v.getState(),et=null===(m=n.filterManager)||void 0===m?void 0:m.getState(),nt=(null==tt?void 0:tt.sort)?`${tt.sort.key.accessor}-${tt.sort.direction}`:"none",ot=JSON.stringify((null==et?void 0:et.filters)||{}),st=n.config.quickFilter,it=st?`${null!==(g=st.text)&&void 0!==g?g:""}|${null!==(x=st.mode)&&void 0!==x?x:"simple"}`:"";let rt,lt,at;this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===Z&&this.flattenedRowsCache.deps.quickFilterKey===it&&this.flattenedRowsCache.deps.expandedRowsSize===n.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===n.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===n.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===n.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===nt&&this.flattenedRowsCache.deps.filterKey===ot&&this.flattenedRowsCache?(rt=this.flattenedRowsCache.aggregatedRows,lt=this.flattenedRowsCache.quickFilteredRows,at=this.flattenedRowsCache.flattenResult):(rt=n.sortManager?Z:j({rows:Z,headers:n.headers,rowGrouping:n.config.rowGrouping}),lt=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:o,columns:s,caseSensitive:i=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!t.hide&&!t.excludeFromRender&&(s&&s.length>0?s.includes(t.accessor):!1!==t.quickFilterable)),d="smart"===r?(t=>{const e=[];let n=0;for(;t.length>n;){for(;t.length>n&&/\s/.test(t[n]);)n++;if(n>=t.length)break;if("-"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(o,n);s&&e.push({type:"negation",value:s});continue}if('"'===t[n]){n++;const o=n;for(;t.length>n&&'"'!==t[n];)n++;const s=t.substring(o,n);s&&e.push({type:"phrase",value:s}),t.length>n&&'"'===t[n]&&n++;continue}const o=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const s=t.substring(o,n);if(t.length>n&&":"===t[n]){n++;const o=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const i=t.substring(o,n);i&&e.push({type:"columnSpecific",value:i,column:s});continue}s&&e.push({type:"word",value:s})}return e})(o):null;return t.filter(t=>{if("smart"===r&&d){const e=new Set,n=new Map;d.forEach((t,e)=>{"columnSpecific"===t.type&&t.column&&(n.has(t.column)||n.set(t.column,[]),n.get(t.column).push(e))});const o=[];a.forEach(s=>{try{let r;if(s.quickFilterGetter)r=s.quickFilterGetter({row:t,accessor:s.accessor});else{const e=u(t,s.accessor);if(l&&s.valueFormatter){const n=s.valueFormatter({accessor:s.accessor,colIndex:0,row:t,rowIndex:0,value:e});r=Array.isArray(n)?n.join(" "):n+""}else r=null==e?"":Array.isArray(e)?e.join(" "):e+""}o.push(r);const a=n.get(s.accessor);a&&a.forEach(t=>{const n=d[t],o=i?r:r.toLowerCase(),s=i?n.value:n.value.toLowerCase();o.includes(s)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${s.accessor}:`,t)}});const s=i?o.join(" "):o.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const o=i?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":s.includes(o)&&e.add(n);break;case"negation":s.includes(o)||e.add(n)}}),e.size===d.length}return a.some(e=>{try{let n;if(e.quickFilterGetter)n=e.quickFilterGetter({row:t,accessor:e.accessor});else{const o=u(t,e.accessor);if(l&&e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:o});n=Array.isArray(s)?s.join(" "):s+""}else n=null==o?"":Array.isArray(o)?o.join(" "):o+""}return((t,e,n)=>{if(!e)return!0;const o=n?t:t.toLowerCase(),s=n?e:e.toLowerCase();return o.includes(s)})(n,o,i)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:rt,headers:$,quickFilter:n.config.quickFilter}),at=un({rows:lt,rowGrouping:n.config.rowGrouping,getRowId:n.config.getRowId,expandedRows:n.expandedRows,collapsedRows:n.collapsedRows,expandedDepths:n.expandedDepths,rowStateMap:n.rowStateMap,hasLoadingRenderer:!!n.config.loadingStateRenderer,hasErrorRenderer:!!n.config.errorStateRenderer,hasEmptyRenderer:!!n.config.emptyStateRenderer,headers:$,rowHeight:n.customTheme.rowHeight,headerHeight:n.customTheme.headerHeight,customTheme:n.customTheme}),this.flattenedRowsCache={aggregatedRows:rt,quickFilteredRows:lt,flattenResult:at,deps:{rowsRef:Z,quickFilterKey:it,expandedRowsSize:n.expandedRows.size,collapsedRowsSize:n.collapsedRows.size,expandedDepthsSize:n.expandedDepths.size,rowStateMapSize:n.rowStateMap.size,sortKey:nt,filterKey:ot}});const dt=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:s,footerHeight:i})=>{if(e){const t=pn(e);if(0===t)return;const r=s||n;if(t>=r+o*n+(i||0)||20>o)return;return Math.max(0,t-r)}if(!t)return;const r=pn(t);return 0!==r?Math.max(0,r-n):void 0})({height:n.config.height,maxHeight:n.config.maxHeight,rowHeight:n.customTheme.rowHeight,shouldPaginate:null!==(b=n.config.shouldPaginate)&&void 0!==b&&b,rowsPerPage:null!==(y=n.config.rowsPerPage)&&void 0!==y?y:10,totalRowCount:null!==(R=n.config.totalRowCount)&&void 0!==R?R:at.paginatableRows.length,headerHeight:W,footerHeight:!n.config.shouldPaginate&&!n.config.footerRenderer||n.config.hideFooter?void 0:n.customTheme.footerHeight}),ct=function(t){const{contentHeight:e,currentPage:n,customTheme:o,enableStickyParents:s,flattenedRows:i,heightOffsets:r,parentEndPositions:l,rowHeight:a,rowsPerPage:d,scrollDirection:c="none",scrollTop:h,serverSidePagination:u,shouldPaginate:p,rowGrouping:f}=t,w=(t=>Math.ceil(800/(t+1)))(a),v=function(t,e,n,o,s,i){if(!s||i)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*o,l=n*o,a=0===r?0:e[r-1];return t.slice(a,l>e.length?t.length:e[l-1]).map((t,e)=>{const n=t.nestedTable?t.absoluteRowIndex:s&&!i?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(i,l,n,d,p,u),m=r&&0!==r.length&&p&&!u?(()=>{const t=new Map;return v.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),r.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():r,g=m&&m.length>0?((t,e,n,o)=>{const s=e+o.rowSeparatorWidth,i=Array(t),r=new Map;n&&n.forEach(([t,e])=>{r.set(t,e)});let l=0;for(let e=0;t>e;e++){i[e]=l,l+=s;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:i,totalHeight:l-o.rowSeparatorWidth}})(v.length,a,m,o):void 0;let x,b=0,y=v.length;if(void 0===e)x=v;else{const t=K({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:a,scrollTop:h,scrollDirection:c,heightMap:g});x=t.rendered.rows,b=t.rendered.startIndex,y=t.rendered.endIndex}const{stickyParents:R,regularRows:C,partiallyVisibleRows:S}=s&&void 0!==e?(()=>{const t=K({bufferRowCount:w,contentHeight:e,tableRows:v,rowHeight:a,scrollTop:h,scrollDirection:c,heightMap:g}),n=f?((t,e,n,o,s)=>{var i,r,l,a,d,c;const h=null!==(r=null===(i=o[0])||void 0===i?void 0:i.position)&&void 0!==r?r:-1,u=null!==(a=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==a?a:-1,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${s.join(",")}`,w=X.get(f);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===p)return w.result;const v=Q({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:s});if(X.set(f,{result:v,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),X.size>50){const t=X.keys().next().value;void 0!==t&&X.delete(t)}return v})(v,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,f):{stickyParents:[],regularRows:t.rendered.rows,partiallyVisibleRows:[]};return Object.assign(Object.assign({},n),{partiallyVisibleRows:t.partiallyVisible.rows})})():{stickyParents:[],regularRows:x,partiallyVisibleRows:[]};return{currentTableRows:v,rowsToRender:x,renderedStartIndex:b,renderedEndIndex:y,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:m,heightMap:g}}({flattenedRows:at.flattenedRows,paginatableRows:at.paginatableRows,parentEndPositions:at.parentEndPositions,currentPage:o.currentPage,rowsPerPage:null!==(C=n.config.rowsPerPage)&&void 0!==C?C:10,shouldPaginate:null!==(S=n.config.shouldPaginate)&&void 0!==S&&S,serverSidePagination:null!==(I=n.config.serverSidePagination)&&void 0!==I&&I,contentHeight:dt,rowHeight:n.customTheme.rowHeight,scrollTop:o.scrollTop,scrollDirection:o.scrollDirection,heightOffsets:at.heightOffsets,customTheme:n.customTheme,enableStickyParents:null!==(H=n.config.enableStickyParents)&&void 0!==H&&H,rowGrouping:n.config.rowGrouping});this.lastProcessedResult=ct,null===(M=n.rowSelectionManager)||void 0===M||M.updateConfig({tableRows:ct.currentTableRows}),this.renderHeader(t.headerContainer,W,P,$,n),this.renderBody(t.bodyContainer,ct,$,n),this.registerSectionPanes(n);const ht=n.sectionScrollController;ht&&(ht.setSectionScrollLeft("main",E),null!=n.pinnedLeftRef.current&&ht.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&ht.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),ht.restoreAll()),this.renderFooter(t.footerContainer,null!==(k=n.config.totalRowCount)&&void 0!==k?k:at.paginatableRows.length,o.currentPage,$,n),this.renderColumnEditor(t.contentWrapper,o.columnEditorOpen,s,$,n),this.renderHorizontalScrollbar(t.wrapperContainer,L,B,N,z,V,e.tableBodyContainerRef.current,$,n)}renderHeader(t,e,n,o,s){if(s.config.hideHeader)return;const i=this.buildRendererDeps(o,s);this.tableRenderer.renderHeader(t,e,n,i)}renderBody(t,e,n,o){const s=this.buildRendererDeps(n,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,o,s){const i=this.buildRendererDeps(o,s);this.tableRenderer.renderFooter(t,e,n,t=>{s.setCurrentPage(t),s.onRender()},i)}renderColumnEditor(t,e,n,o,s){const i=this.buildRendererDeps(o,s);this.tableRenderer.renderColumnEditor(t,e,t=>{s.setColumnEditorOpen(t),s.onRender()},n,i)}renderHorizontalScrollbar(t,e,n,o,s,i,r,l,a){if(!a.mainBodyRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,o,s,i,r,d)}registerSectionPanes(t){const e=t.sectionScrollController;e&&(t.pinnedLeftHeaderRef.current&&e.registerPane("pinned-left",t.pinnedLeftHeaderRef.current,"header"),t.pinnedLeftRef.current&&e.registerPane("pinned-left",t.pinnedLeftRef.current,"body"),t.mainHeaderRef.current&&e.registerPane("main",t.mainHeaderRef.current,"header"),t.mainBodyRef.current&&e.registerPane("main",t.mainBodyRef.current,"body"),t.pinnedRightHeaderRef.current&&e.registerPane("pinned-right",t.pinnedRightHeaderRef.current,"header"),t.pinnedRightRef.current&&e.registerPane("pinned-right",t.pinnedRightRef.current,"body"))}buildRendererDeps(t,e){return{config:e.config,customTheme:e.customTheme,resolvedIcons:e.resolvedIcons,effectiveHeaders:t,headers:e.headers,localRows:e.localRows,collapsedHeaders:e.collapsedHeaders,collapsedRows:e.collapsedRows,expandedRows:e.expandedRows,expandedDepths:e.expandedDepths,isResizing:e.isResizing,internalIsLoading:e.internalIsLoading,cellRegistry:e.cellRegistry,headerRegistry:e.headerRegistry,draggedHeaderRef:e.draggedHeaderRef,hoveredHeaderRef:e.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.pinnedRightHeaderRef,dimensionManager:e.dimensionManager,sectionScrollController:e.sectionScrollController,sortManager:e.sortManager,filterManager:e.filterManager,selectionManager:e.selectionManager,rowSelectionManager:e.rowSelectionManager,rowStateMap:e.rowStateMap,onRender:e.onRender,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const wn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class vn{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||un({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})};return{updateData:e=>{var n;const{rowIndex:o,accessor:s,newValue:i}=e;if(o>=0&&t.localRows.length>o){t.localRows[o][s]=i;const e=[o],r=`${(t.config.getRowId?[o,t.config.getRowId({row:t.localRows[o],depth:0,index:o,rowPath:e,rowIndexPath:e})]:[o]).join("-")}-${s}`,l=null===(n=t.cellRegistry)||void 0===n?void 0:n.get(r);l?l.updateContent(i):t.onRender()}},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const o=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return o?o.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var o;((t,e,n,o=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a"),s=URL.createObjectURL(n);o.setAttribute("href",s),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)})(((t,e,n=!0)=>{const o=(t=>{const e=[],n=t=>{for(const o of t)o.hide||o.isSelectionColumn||o.excludeFromCsv||(o.children&&o.children.length>0?(o.singleRowChildren&&e.push(o),n(o.children)):e.push(o))};return n(t),e})(e),s=o.map(t=>wn(t.label)).join(","),i=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const s=u(n,t.accessor);if(t.exportValueGetter){const i=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s,formattedValue:i});return wn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const i=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:s});return wn(i)}return wn(s)}).join(",")});return(n?[s,...i]:i).join("\n")})(t,e,o),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(o=t.config.includeHeadersInCSVExport)||void 0===o||o)},getSortState:()=>{var e,n;return null!==(n=null===(e=t.sortManager)||void 0===e?void 0:e.getSortColumn())&&void 0!==n?n:null},applySortState:async e=>{t.sortManager&&t.sortManager.updateSort(e)},getPinnedState:()=>kt(t.headers),applyPinnedState:async e=>{const n=Ot(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(ft(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,o;const s=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(s/(null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10))},setPage:async n=>{var o,s;const i=null!==(o=t.config.totalRowCount)&&void 0!==o?o:e().paginatableRows.length,r=null!==(s=t.config.rowsPerPage)&&void 0!==s?s:10;1>n||n>Math.ceil(i/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{t.expandedDepths=e,t.onRender()},getExpandedDepths:()=>{var e,n;return null!==(n=null===(e=t.expandedDepthsManager)||void 0===e?void 0:e.getExpandedDepths())&&void 0!==n?n:t.expandedDepths},getGroupingProperty:e=>{var n;return null===(n=t.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},toggleColumnEditor:e=>{t.config.editColumns&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const s=o.accessor+"";let i=s in e?!e[s]:o.hide;return St(o,t.essentialAccessors)&&(i=!1),Object.assign(Object.assign({},o),{hide:i,children:o.children?n(o.children):o.children})});t.setHeaders(n(t.headers)),t.onRender(),t.config.onColumnVisibilityChange&&t.config.onColumnVisibilityChange(e)},setQuickFilter:e=>{var n;(null===(n=t.config.quickFilter)||void 0===n?void 0:n.onChange)&&t.config.quickFilter.onChange(e)},getSelectedCells:()=>{var e;return(null===(e=t.selectionManager)||void 0===e?void 0:e.getSelectedCells())||new Set},clearSelection:()=>{var e;null===(e=t.selectionManager)||void 0===e||e.clearSelection()},selectCell:e=>{var n;null===(n=t.selectionManager)||void 0===n||n.selectSingleCell(e)},selectCellRange:(e,n)=>{var o;null===(o=t.selectionManager)||void 0===o||o.selectCellRange(e,n)}}}}class mn{constructor(t,e){var n,o;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.container=t,this.config=e,this.customTheme=At.mergeCustomTheme(e),this.mergedColumnEditorConfig=At.mergeColumnEditorConfig(e),this.resolvedIcons=At.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=At.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(o=e.isLoading)&&void 0!==o&&o,this.collapsedHeaders=At.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=At.getInitialExpandedDepths(e),this.domManager=new Wt,this.renderOrchestrator=new fn,this.rebuildRowIndexMap(),this.initializeManagers()}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=w({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=v(n);this.rowIndexMap.set(o,e)})}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new ut,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ht(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new B({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(t=>{this.render("sortManager")}),this.filterManager=new q({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:o}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new st({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t;const e=this.domManager.getRefs(),n=this.domManager.getElements();if(!e.tableBodyContainerRef.current||!n)return;this.scrollbarWidth=pt(e.tableBodyContainerRef.current);const o=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new P({effectiveHeaders:o,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:this.localRows.length,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:e.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.config.onGridReady&&this.config.onGridReady())}),this.scrollManager=new $({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:200}),this.scrollManager.subscribe(()=>{this.render("scrollManager")}),this.sectionScrollController=new D({onMainSectionScrollLeft:t=>{var e,n;const o=this.domManager.getRefs(),s=o.mainHeaderRef.current,i=o.mainBodyRef.current;null===(e=null==s?void 0:s.__renderHeaderCells)||void 0===e||e.call(s,t),null===(n=null==i?void 0:i.__renderBodyCells)||void 0===n||n.call(i,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new W({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:e.mainBodyRef,isResizing:this.isResizing},()=>{this.render("autoScaleManager")})),e.headerContainerRef.current&&e.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new dt({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new lt,this.windowResizeManager.addCallback(()=>{var t;if(e.tableBodyContainerRef.current){const n=pt(e.tableBodyContainerRef.current);this.scrollbarWidth=n,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(n)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new rt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new at({selectableColumns:null!==(t=this.config.selectableColumns)&&void 0!==t&&t,selectedCells:new Set,selectedColumns:new Set,setSelectedCells:t=>this.selectionManager.setSelectedCells(t),setSelectedColumns:t=>this.selectionManager.setSelectedColumns(t),getSelectedCells:()=>this.selectionManager.getSelectedCells(),getSelectedColumns:()=>this.selectionManager.getSelectedColumns(),onClearSelection:()=>this.selectionManager.clearSelection()}),this.handleOutsideClickManager.startListening()),this.setupEventListeners()}setupEventListeners(){const t=this.domManager.getElements();(null==t?void 0:t.bodyContainer)&&(t.bodyContainer.addEventListener("scroll",this.handleScroll.bind(this)),t.bodyContainer.addEventListener("mouseleave",()=>{this.clearHoveredRows()}))}handleScroll(t){const e=t.currentTarget,n=e.scrollTop;this.isScrolling=!0,null!==this.scrollEndTimeoutId&&clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=window.setTimeout(()=>{this.isScrolling=!1,this.scrollEndTimeoutId=null,this.render("scroll-end")},150),null!==this.scrollRafId&&cancelAnimationFrame(this.scrollRafId),this.scrollRafId=requestAnimationFrame(()=>{const t=n>this.lastScrollTop?"down":this.lastScrollTop>n?"up":"none";this.scrollTop=n,this.scrollDirection=t,this.lastScrollTop=n,this.scrollManager&&this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight),this.render("scroll-raf"),this.scrollRafId=null})}clearHoveredRows(){document.querySelectorAll(".st-row.hovered").forEach(t=>{t.classList.remove("hovered")})}updateAriaLiveRegion(){const t=this.domManager.getElements();(null==t?void 0:t.ariaLiveRegion)&&(t.ariaLiveRegion.textContent=this.announcement)}getRenderContext(){const t=this.domManager.getRefs();return{config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,onRender:()=>this.render("resizeHandler-onRender"),setIsResizing:t=>{var e,n,o,s,i,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(o=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:null===(i=null===(s=t.mainBodyRef)||void 0===s?void 0:s.current)||void 0===i?void 0:i.clientWidth)&&void 0!==r?r:null===(l=this.dimensionManager)||void 0===l?void 0:l.getState().containerWidth)&&void 0!==a?a:0;this.autoScaleManager.updateConfig({isResizing:!1,containerWidth:d})}},setHeaders:t=>{this.headers=ft(t),this.renderOrchestrator.invalidateCache("header")},setCollapsedHeaders:t=>{this.collapsedHeaders=t},setCollapsedRows:t=>{this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}render(t){if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;this._positionOnlyBody="scroll-raf"===t&&!0===this.isScrolling;const e=this.domManager.getElements(),n=this.domManager.getRefs();e&&this.renderOrchestrator.render(e,n,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig)}update(t){var e;this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),t),void 0!==t.rows&&(this.localRows=[...t.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows})),void 0!==t.defaultHeaders&&(this.headers=[...t.defaultHeaders],this.essentialAccessors=At.buildEssentialAccessors(this.headers),this.filterManager&&this.filterManager.updateConfig({headers:this.headers}),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers})),void 0!==t.isLoading&&(this.internalIsLoading=t.isLoading),void 0!==t.theme&&this.domManager.updateTheme(t.theme),void 0!==t.customTheme&&(this.customTheme=At.mergeCustomTheme(this.config),this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme})),void 0!==t.selectableColumns&&this.selectionManager&&this.selectionManager.updateConfig({selectableColumns:null!==(e=this.config.selectableColumns)&&void 0!==e&&e}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,o,s,i,r,l,a,d,c,h,u;this.mounted=!1,this.firstRenderDone=!1,null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),null===(t=this.dimensionManager)||void 0===t||t.destroy(),null===(e=this.scrollManager)||void 0===e||e.destroy(),null===(n=this.sectionScrollController)||void 0===n||n.destroy(),null===(o=this.sortManager)||void 0===o||o.destroy(),null===(s=this.filterManager)||void 0===s||s.destroy(),null===(i=this.rowSelectionManager)||void 0===i||i.destroy(),null===(r=this.selectionManager)||void 0===r||r.destroy(),null===(l=this.autoScaleManager)||void 0===l||l.destroy(),null===(a=this.windowResizeManager)||void 0===a||a.destroy(),null===(d=this.handleOutsideClickManager)||void 0===d||d.destroy(),null===(c=this.scrollbarVisibilityManager)||void 0===c||c.destroy(),null===(h=this.expandedDepthsManager)||void 0===h||h.destroy(),null===(u=this.ariaAnnouncementManager)||void 0===u||u.destroy(),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return vn.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,expandedRows:this.expandedRows,collapsedRows:this.collapsedRows,expandedDepths:this.expandedDepths,rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,columnEditorOpen:this.columnEditorOpen,getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.headers=ft(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=mn,exports.asRows=function(t){return t};
2
2
  //# sourceMappingURL=index.js.map