simple-table-core 4.1.5 → 4.1.7
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.
- package/README.md +15 -7
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/consts/general-consts.d.ts +0 -4
- package/dist/core/SimpleTableVanilla.d.ts +19 -272
- package/dist/core/api/TableAPIContext.d.ts +74 -0
- package/dist/core/api/TableAPIImpl.d.ts +2 -74
- package/dist/core/api/buildTableAPIContext.d.ts +61 -0
- package/dist/core/dev/UnvirtualizedRowsWarning.d.ts +20 -0
- package/dist/core/initialization/createDataManagers.d.ts +37 -0
- package/dist/core/initialization/wireMountManagers.d.ts +43 -0
- package/dist/core/pipeline/syncPivotPipeline.d.ts +41 -0
- package/dist/core/rendering/RenderContext.d.ts +125 -0
- package/dist/core/rendering/RenderOrchestrator.d.ts +8 -116
- package/dist/core/rendering/SectionRenderer.d.ts +21 -15
- package/dist/core/rendering/TableRenderer.d.ts +6 -95
- package/dist/core/rendering/TableRendererDeps.d.ts +98 -0
- package/dist/core/rendering/buildRenderContext.d.ts +94 -0
- package/dist/core/rendering/cellRenderContexts.d.ts +11 -0
- package/dist/core/rendering/renderBodySections.d.ts +14 -0
- package/dist/core/rendering/renderHeaderSections.d.ts +13 -0
- package/dist/core/rendering/sectionCaches.d.ts +24 -0
- package/dist/core/rendering/sectionExtraRows.d.ts +19 -0
- package/dist/core/rendering/sectionLayout.d.ts +42 -0
- package/dist/core/vanilla/VanillaLiveHost.d.ts +103 -0
- package/dist/core/vanilla/applyTableUpdate.d.ts +10 -0
- package/dist/core/vanilla/createVanillaRenderContext.d.ts +4 -0
- package/dist/core/vanilla/destroyTableResources.d.ts +26 -0
- package/dist/core/vanilla/syncRowSelectionManager.d.ts +13 -0
- package/dist/core/vanilla/tableContainers.d.ts +5 -0
- package/dist/core/vanilla/toTableAPIContextHost.d.ts +3 -0
- package/dist/hooks/contentHeight.d.ts +3 -1
- package/dist/hooks/expandedDepths.d.ts +4 -3
- package/dist/hooks/scrollbarWidth.d.ts +0 -43
- package/dist/hooks/useAggregatedRows.d.ts +0 -2
- package/dist/icons/CloseIcon.d.ts +2 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +1 -1
- package/dist/managers/AccordionController.d.ts +39 -0
- package/dist/managers/AnimationCoordinator.d.ts +15 -1
- package/dist/managers/AutoSizeManager.d.ts +64 -0
- package/dist/managers/CellSlideAnimator.d.ts +54 -0
- package/dist/managers/DragHandlerManager.d.ts +4 -26
- package/dist/managers/ExternalScrollController.d.ts +68 -0
- package/dist/managers/PivotManager.d.ts +0 -2
- package/dist/managers/ScrollRenderCoalescer.d.ts +32 -0
- package/dist/managers/SelectionManager/mouseUtils.d.ts +3 -3
- package/dist/styles.css +1 -1
- package/dist/types/ColumnEditorCustomRendererProps.d.ts +5 -0
- package/dist/types/PivotTypes.d.ts +1 -8
- package/dist/types/SimpleTableConfig.d.ts +3 -1
- package/dist/types/SimpleTableProps.d.ts +8 -2
- package/dist/types/TableAPI.d.ts +2 -2
- package/dist/utils/accordionAnimation.d.ts +0 -5
- package/dist/utils/bodyCell/editing.d.ts +1 -1
- package/dist/utils/bodyCell/editors/booleanDropdown.d.ts +1 -1
- package/dist/utils/bodyCell/editors/datePicker.d.ts +1 -1
- package/dist/utils/bodyCell/editors/enumDropdown.d.ts +1 -1
- package/dist/utils/bodyCell/selection.d.ts +0 -1
- package/dist/utils/bodyCell/styling.d.ts +2 -0
- package/dist/utils/cellScrollUtils.d.ts +1 -1
- package/dist/utils/cellUtils.d.ts +0 -4
- package/dist/utils/collapseUtils.d.ts +0 -10
- package/dist/utils/columnEditor/createColumnEditor.d.ts +6 -0
- package/dist/utils/columnEditor/createColumnEditorPopout.d.ts +6 -0
- package/dist/utils/columnEditor/createPivotPanel.d.ts +16 -0
- package/dist/utils/externalScroll.d.ts +0 -10
- package/dist/utils/filters/createDropdown.d.ts +2 -0
- package/dist/utils/formatters.d.ts +0 -2
- package/dist/utils/headerCell/eventTracking.d.ts +2 -2
- package/dist/utils/headerCell/styling.d.ts +0 -1
- package/dist/utils/headerWidthUtils.d.ts +2 -2
- package/dist/utils/infiniteScrollUtils.d.ts +0 -1
- package/dist/utils/parkAndStagger.d.ts +44 -0
- package/dist/utils/resizeUtils/domUpdates.d.ts +1 -1
- package/dist/utils/resizeUtils/maxWidth.d.ts +2 -1
- package/dist/utils/rowSelectionUtils.d.ts +0 -4
- package/dist/utils/rowSeparatorRenderer.d.ts +0 -1
- package/dist/utils/rowUtils.d.ts +1 -27
- package/dist/utils/setAbsoluteCellPosition.d.ts +31 -0
- package/dist/utils/stateRowRenderer.d.ts +0 -1
- package/dist/utils/tableDomScope.d.ts +20 -0
- package/package.json +4 -3
- package/src/styles/base.css +144 -147
- package/dist/managers/ColumnManager.d.ts +0 -42
- package/dist/managers/RowManager.d.ts +0 -56
- package/dist/managers/TableManager.d.ts +0 -72
- package/dist/types/BoundingBox.d.ts +0 -11
- package/dist/types/DragHandlerProps.d.ts +0 -14
- package/dist/types/OnSortProps.d.ts +0 -3
- package/dist/types/SharedTableProps.d.ts +0 -24
- package/dist/types/TableBodyProps.d.ts +0 -20
- package/dist/types/TableHeaderProps.d.ts +0 -17
- package/dist/types/TableHeaderSectionProps.d.ts +0 -19
- package/dist/types/TableRowProps.d.ts +0 -29
- package/dist/utils/columnIndicesUtils.d.ts +0 -15
- package/dist/utils/columnVirtualizationUtils.d.ts +0 -128
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="parentExpanded",e={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};function n(t){var e;return(null===(e=t.children)||void 0===e?void 0:e.length)?Object.assign(Object.assign({},t),{children:t.children.map(n)}):t}function i(t){return t.map(n)}function o(t){if(!t.columns)throw Error("SimpleTable requires `columns`");return Object.assign(Object.assign({},t),{columns:i(t.columns)})}function s(t){return void 0!==t.columns?Object.assign(Object.assign({},t),{columns:i(t.columns)}):Object.assign({},t)}const r=new WeakMap,l=(t,e,n)=>{const i=(t=>{let e=r.get(t);return e||(e=new Map,r.set(t,e)),e})(t);let o=i.get(e);o||(o=document.createElement("div"),o.className="st-aria-row",o.setAttribute("role","row"),o.style.display="contents",t.appendChild(o),i.set(e,o));const s=n+"";return o.getAttribute("aria-rowindex")!==s&&o.setAttribute("aria-rowindex",s),o},a=t=>{const e=r.get(t);e&&e.forEach((t,n)=>{0===t.childElementCount&&(t.remove(),e.delete(n))})},d=t=>{const e=r.get(t);e&&(e.forEach(t=>t.remove()),e.clear())},c=new WeakMap,h=(t,e,n,i)=>{t.addEventListener(e,n,i),c.has(t)||c.set(t,[]),c.get(t).push({event:e,handler:n,options:i})},u=new WeakMap,f=t=>(u.has(t)||u.set(t,new Map),u.get(t)),v=(t,e)=>{if(t){const n=f(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),d(t)}},p=new WeakMap;let w=0,m=Date.now(),g={screenX:0,screenY:0},b=null;const x=t=>{m=t},y=new WeakMap,R=t=>(y.has(t)||y.set(t,new Map),y.get(t)),S=new WeakMap,C=t=>(S.has(t)||S.set(t,new Map),S.get(t)),M=(t,e)=>{const n=Date.now();0!==w&&e>n-w||(w=n,t())},I=(t,e,n,i)=>{t.addEventListener(e,n,i),p.has(t)||p.set(t,[]),p.get(t).push({event:e,handler:n,options:i})},H=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},k=.5,T="st-cell-animating-out",E="data-animating-out",A="data-shrinking-out",W=t=>{const e=f(t),n=R(t);if(0===e.size)return n;if(0===n.size)return e;const i=new Map(e);return n.forEach((t,e)=>i.set(e,t)),i};class O{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.inFlight=new Map,this.retainedCells=new Map,this.scrollerMetricsCache=new WeakMap,this.externalVerticalScroll=null,this.scheduledFlip=null,this.duration=null!==(e=t.duration)&&void 0!==e?e:400,this.easing=null!==(n=t.easing)&&void 0!==n?n:"ease-out",this.prefersReducedMotion=j()}setOnHostDiscard(t){this.onHostDiscard=t}setEnabled(t){this.enabled!==t&&(this.enabled=t,t||this.cancel())}setDuration(t){Number.isFinite(t)&&t>0&&(this.duration=t)}setEasing(t){"string"==typeof t&&t.length>0&&(this.easing=t)}isEnabled(){return this.enabled&&!this.prefersReducedMotion}isInFlight(t){return this.inFlight.has(t)}hasInFlight(){return this.inFlight.size>0}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}setAccordionPreVisibleAccessors(t){this.accordionPreVisibleAccessors=this.isEnabled()&&t&&t.size>0?t:null}wasRenderableBeforeAccordion(t){var e,n;return null!==(n=null===(e=this.accordionPreVisibleAccessors)||void 0===e?void 0:e.has(t))&&void 0!==n&&n}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);if(!e){const n=$(t);e=this.externalVerticalScroll?Object.assign(Object.assign({},n),{clientHeight:this.externalVerticalScroll.clientHeight,scrollHeight:this.externalVerticalScroll.scrollHeight,scrollTop:this.externalVerticalScroll.scrollTop}):n,this.scrollerMetricsCache.set(t,e)}return e}setExternalVerticalScroll(t){this.externalVerticalScroll=t,this.clearScrollerMetricsCache()}clearScrollerMetricsCache(){this.scrollerMetricsCache=new WeakMap}captureSnapshot(t){var e;if(!this.isEnabled())return void(this.snapshot=null);this.clearScrollerMetricsCache();const n=new Map;for(const i of t.containers){if(!i)continue;const o=i.getBoundingClientRect(),s=o.left,r=o.top;W(i).forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,i,s,r))});const l=this.retainedCells.get(i);l&&l.forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,i,s,r))});const a=null===(e=t.preLayouts)||void 0===e?void 0:e.get(i);a&&a.forEach((t,e)=>{n.has(e)||n.set(e,{sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})})}this.snapshot=n.size>0?n:null}shouldRetain(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntry(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntryInContainer(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);return!!i&&(null===i.sourceContainer||i.sourceContainer===e)}shouldAnimateVerticalTransition(t){const e=this.getScrollerMetrics(t.container),n=F(t.beforeTop,t.cellHeight,e),i=F(t.afterTop,t.cellHeight,e);return n||i}shouldAnimateHorizontalTransition(t){const e=this.getScrollerMetrics(t.container),n=L(t.beforeLeft,t.cellWidth,e),i=L(t.afterLeft,t.cellWidth,e);return n||i}shouldAnimateTransition(t){const e=Math.abs(t.beforeTop-t.afterTop)>=k,n=Math.abs(t.beforeLeft-t.afterLeft)>=k;return!(!e||!this.shouldAnimateVerticalTransition({beforeTop:t.beforeTop,afterTop:t.afterTop,cellHeight:t.cellHeight,container:t.container}))||!(!n||!this.shouldAnimateHorizontalTransition({beforeLeft:t.beforeLeft,afterLeft:t.afterLeft,cellWidth:t.cellWidth,container:t.container}))}shouldMountIncomingCell(t){var e;const n=null===(e=this.snapshot)||void 0===e?void 0:e.get(t.cellId);if(!n)return!0;const i=this.getScrollerMetrics(t.container),o=F(n.styleTop,t.cellHeight,i),s=F(t.afterTop,t.cellHeight,i),r=L(n.styleLeft,t.cellWidth,i),l=L(t.afterLeft,t.cellWidth,i);return o||s||r||l}isCellRenderedInScrollerViewport(t,e){const n=t.getBoundingClientRect();if(0===n.width&&0===n.height)return!1;const i=e.getBoundingClientRect(),o=n.right>i.left&&i.right>n.left,s=this.externalVerticalScroll?null:e.parentElement;if(!s)return o;const r=s.getBoundingClientRect();return o&&n.bottom>r.top&&r.bottom>n.top}shouldRetainDomCellAtScrollExtrema(t,e){var n;const i=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);if(!i||null===i.sourceContainer)return!1;const o=this.getScrollerMetrics(e);if(o.clientHeight>=o.scrollHeight)return!1;const s=o.scrollTop+o.clientHeight>=o.scrollHeight-1,r=1>=o.scrollTop;if(!s&&!r)return!1;const l=o.clientHeight;return!(!s||o.scrollTop-l>i.styleTop)||!(!r||i.styleTop>o.scrollTop+l)}retainCell(t){var e;const{cellId:n,element:i,container:o,newPosition:s}=t,r=P(i.style.top),l=P(i.style.left),a=this.getScrollerMetrics(o),d=D(s.top,r,s.height,a,"y"),c=D(s.left,l,s.width,a,"x");let h=this.retainedCells.get(o);h||(h=new Map,this.retainedCells.set(o,h));const u=h.get(n);u&&u!==i&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,u),u.remove()),i.id&&i.removeAttribute("id"),i.classList.add(T),i.setAttribute(E,"true"),i.style.left=c+"px",i.style.top=d+"px",i.style.width=s.width+"px",i.style.height=s.height+"px",i.style.pointerEvents="none",h.set(n,i)}claimRetainedForReuse(t,e){var n,i;const o=this.retainedCells.get(e);if(!o)return null;const s=o.get(t);return s?s.hasAttribute(A)?(this.cancelInFlight(t),o.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),null===(i=this.onHostDiscard)||void 0===i||i.call(this,s),s.remove(),null):(this.cancelInFlight(t),o.delete(t),s.classList.remove(T),s.removeAttribute(E),s.id=t,s.style.pointerEvents="",s):null}shrinkOutCell(t){var e;const{cellId:n,element:i,container:o,axis:s}=t;this.cancelInFlight(n);let r=this.retainedCells.get(o);r||(r=new Map,this.retainedCells.set(o,r));const l=r.get(n);l&&l!==i&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,l),l.remove()),i.id&&i.removeAttribute("id"),i.classList.add(T),i.setAttribute(E,"true"),i.setAttribute(A,"true"),i.style.pointerEvents="none","horizontal"===s?i.style.width="0px":i.style.height="0px",r.set(n,i);const a=window.setTimeout(()=>{var t;const e=this.retainedCells.get(o);e&&e.get(n)===i&&e.delete(n),null===(t=this.onHostDiscard)||void 0===t||t.call(this,i),i.remove()},this.duration+80);this.inFlight.set(n,{element:i,cleanupTimeout:a,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){var n;const i=this.retainedCells.get(e);if(!i)return;const o=i.get(t);o&&(this.cancelInFlight(t),i.delete(t),null===(n=this.onHostDiscard)||void 0===n||n.call(this,o),o.remove())}play(t){const e=this.snapshot,n=this.incomingOrigins;if(this.snapshot=null,this.incomingOrigins=null,!this.isEnabled()||!e)return void this.retainedCells.forEach(t=>{t.forEach((e,n)=>{var i;this.inFlight.has(n)||(null===(i=this.onHostDiscard)||void 0===i||i.call(this,e),e.remove(),t.delete(n))})});const i=[],o=new Set,s=new Map,r=(t,r,l,a)=>{var d,c;if(o.has(r))return;if(l&&t.hasAttribute(A))return void o.add(r);let h=e.get(r);if(!h&&!l&&n){const t=n.get(r);t&&(h={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!h)return;if(!l&&null!==h.sourceContainer&&h.sourceContainer!==a)return void o.add(r);if(t.querySelector(".st-cell-editing"))return;const u=P(t.style.left),f=P(t.style.top);if(!l&&this.inFlight.has(r)&&k>Math.abs(h.styleTop-f)&&k>Math.abs(h.styleLeft-u))return void o.add(r);const v=l||h.fromDom,p=v?0:P(t.style.height)||t.offsetHeight||0,w=v?0:P(t.style.width)||t.offsetWidth||0,m=v?null:this.getScrollerMetrics(a),g=v||!m?h.top:D(h.top,f,p,m,"y"),b=v||!m?h.left:D(h.left,u,w,m,"x"),x=null!=m?m:this.getScrollerMetrics(a),y=P(t.style.height)||t.offsetHeight||p||0;let R=g;const S=!!x&&F(f,y,x);if(!l&&x&&S){const t=x.scrollTop,e=x.scrollTop+x.clientHeight;(l||null!==h.sourceContainer||h.fromDom||Math.abs(g-f)>=k&&!F(g,y,x))&&F(g,y,x)||(R=g>f?e:t-y)}let C=0;if(null!==h.sourceContainer){const t=(t=>{let e=s.get(t);if(!e){const n=t.getBoundingClientRect();e={left:n.left,top:n.top},s.set(t,e)}return e})(a);C=t.left-h.sourceContainerLeft}let M=b-u-C,I=R-f-0;k>Math.abs(M)&&k>Math.abs(I)?l&&(this.cancelInFlight(r),null===(d=this.retainedCells.get(a))||void 0===d||d.delete(r),null===(c=this.onHostDiscard)||void 0===c||c.call(this,t),t.remove()):(i.push({cellId:r,element:t,dx:M,dy:I,isRetained:l}),o.add(r))};for(const e of t.containers){if(!e)continue;const t=this.retainedCells.get(e);t&&t.forEach((t,n)=>{r(t,n,!0,e)}),W(e).forEach((t,n)=>{r(t,n,!1,e)})}if(this.scheduledFlip){cancelAnimationFrame(this.scheduledFlip.rafId);for(const{element:t}of this.scheduledFlip.pending)t.style.transition="none",t.style.transform="",t.style.willChange="";this.scheduledFlip=null}for(const{cellId:t,element:e,dx:n,dy:o}of i)this.cancelInFlight(t),e.style.transition="none",e.style.transform=`translate3d(${n}px, ${o}px, 0)`,e.style.willChange="transform";if(0===i.length)return;const l=requestAnimationFrame(()=>{const t=requestAnimationFrame(()=>{this.scheduledFlip=null;for(const{cellId:t,element:e,isRetained:n}of i)e.isConnected&&this.startTransition(t,e,n)});this.scheduledFlip&&(this.scheduledFlip.rafId=t)});this.scheduledFlip={rafId:l,pending:i}}cancel(){this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.clearScrollerMetricsCache(),this.scheduledFlip&&(cancelAnimationFrame(this.scheduledFlip.rafId),this.scheduledFlip=null);const t=Array.from(this.inFlight.entries());this.inFlight.clear();for(const[e,n]of t)window.clearTimeout(n.cleanupTimeout),n.element.removeEventListener("transitionend",n.transitionEndHandler),this.finishElement(e,n.element,n.isRetained);this.retainedCells.forEach(t=>{t.forEach(t=>{var e;null===(e=this.onHostDiscard)||void 0===e||e.call(this,t),t.remove()}),t.clear()}),this.retainedCells.clear()}destroy(){this.cancel()}readPosition(t,e,n,i,o){const s=P(e.style.top),r=P(e.style.left);if(this.inFlight.get(t)){const t=e.getBoundingClientRect(),l=e.offsetParent;if(l){const e=l.getBoundingClientRect();return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:t.left-e.left+l.scrollLeft,top:t.top-e.top+l.scrollTop,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:t.left,top:t.top,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:i,sourceContainerTop:o,left:r,top:s,styleTop:s,styleLeft:r,fromDom:!1}}startTransition(t,e,n){e.style.transition=`transform ${this.duration}ms ${n?"ease-in":this.easing}`,e.style.transform="translate3d(0, 0, 0)",n||(e.style.pointerEvents="none");const i=n=>{"transform"===n.propertyName&&this.finalizeCell(t,e)};e.addEventListener("transitionend",i);const o=window.setTimeout(()=>{this.finalizeCell(t,e)},this.duration+80);this.inFlight.set(t,{element:e,cleanupTimeout:o,transitionEndHandler:i,isRetained:n})}cancelInFlight(t){const e=this.inFlight.get(t);e&&(window.clearTimeout(e.cleanupTimeout),e.element.removeEventListener("transitionend",e.transitionEndHandler),this.inFlight.delete(t))}finalizeCell(t,e){var n;const i=this.inFlight.get(t),o=null!==(n=null==i?void 0:i.isRetained)&&void 0!==n?n:this.isCellRetained(e);i&&(window.clearTimeout(i.cleanupTimeout),i.element.removeEventListener("transitionend",i.transitionEndHandler),this.inFlight.delete(t)),this.finishElement(t,e,o)}finishElement(t,e,n){var i;if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),null===(i=this.onHostDiscard)||void 0===i||i.call(this,e),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(E)}}const P=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},$=t=>{const e=t.parentElement;return{clientHeight:e?e.clientHeight:0,scrollHeight:e?e.scrollHeight:0,scrollTop:e?e.scrollTop:0,clientWidth:t.clientWidth,scrollWidth:t.scrollWidth,scrollLeft:t.scrollLeft}},F=(t,e,n)=>{const i=n.clientHeight;return 0>=i||i>=n.scrollHeight||t>=n.scrollTop&&n.scrollTop+i>t},L=(t,e,n)=>{const i=n.clientWidth;return 0>=i||i>=n.scrollWidth||t>=n.scrollLeft&&n.scrollLeft+i>t},D=(t,e,n,i,o)=>{const s="y"===o?i.clientHeight:i.clientWidth;if(0>=s||s>=("y"===o?i.scrollHeight:i.scrollWidth))return t;const r=t-e,l=Math.abs(r);if(0===l)return t;const a=n>0?n:0,d="y"===o?i.scrollTop:i.scrollLeft;if(t>=d-a&&d+s>=t)return t;const c=s+a;if(c>=l)return t;const h=l-c,u=c+s*h/(h+10*c);return e+Math.sign(r)*u},j=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},N=t=>Math.ceil(800/(t+1)),B=29.5,z=(t,e=!0)=>t&&e?B:0,V=(t,e=!0)=>!(!t||!e),q=150,G=["lineAreaChart","barChart"],K=500,_=40,U=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),J=(t,e)=>{if(!t.children||0===t.children.length)return[e];const n=[],i=(t,e)=>{if(!t.children||0===t.children.length)return n.push(e),e+1;let o=e;for(const e of t.children)o=i(e,o);return o};return i(t,e),n},Y=t=>t.flatMap(t=>t.children&&0!==t.children.length?Y(t.children):[t]),X=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...X(t.children)),e}),Q=(t=0)=>t?t+1:0,Z=t=>!(!t.hide&&!t.excludeFromRender),tt=(t,e)=>{const n=X(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},et=(e,n,i)=>{const o=tt(n,e.accessor);if(o){const n=i.has(o.accessor),s=e.showWhen||t;return n?"parentExpanded"===s:"parentCollapsed"===s}return!1},nt=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},it=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const i=Y(t.children);let o=0;for(const t of i)Z(t)||et(t,e,n)||(o+=1);return o},ot=({accessor:t,rowId:e})=>`${e}-${t}`,st=new WeakSet,rt=t=>st.has(t),lt=t=>{if(t)return e=>{if(!rt(e.row))return t(e)}},at=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,dt=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},ct=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:i}=dt(e);let o=t[n];return null!==i&&Array.isArray(o)&&(o=o[i]),o},t):t[e]},ht=(t,e)=>{if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0},ut=(t,e,n)=>{const i=e+"";if(!i.includes(".")&&!i.includes("["))return void(t[e]=n);const o=i.split(".");let s=t;for(let t=0;o.length-1>t;t++){const{key:e,index:n}=dt(o[t]);if(null==s[e]){const n=dt(o[t+1]);s[e]=null!==n.index?[]:{}}if(s=s[e],null!==n){if(!Array.isArray(s))throw Error(`Expected array at ${o.slice(0,t+1).join(".")}, but found ${typeof s}`);for(;n>=s.length;)s.push(null);null==s[n]&&(s[n]={}),s=s[n]}}const{key:r,index:l}=dt(o[o.length-1]);if(null!==l){for(Array.isArray(s[r])||(s[r]=[]);l>=s[r].length;)s[r].push(null);s[r][l]=n}else s[r]=n},ft=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],vt=t=>{const{getRowId:e,rowPath:n}=t,i=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});null!=n&&""!==n&&i.push(n)}return i},pt=t=>t.join("-"),wt=new WeakMap;let mt=0;const gt=t=>{const{getRowId:e}=t,n=e?e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey}):void 0,i=null!=n&&""!==n?n+"":(t=>{if(t&&"object"==typeof t){const e=wt.get(t);if(void 0!==e)return e;const n="__row_"+ ++mt;return wt.set(t,n),n}return"__row_p_"+t})(t.row),o=[];return t.parentStableKey&&o.push(t.parentStableKey),t.groupingKey&&t.depth>0&&o.push(t.groupingKey),o.push(i),o.join("/")},bt=t=>t.stableRowKey?t.stableRowKey:pt(t.rowId),xt=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,yt=(t,e)=>!!e&&ft(t[e]),Rt=(t,e,n,i,o)=>{const s=t+"",r=i.has(s)&&i.get(s)===e,l=o.has(s)&&o.get(s)===e;return n.has(e)?!l:r},St=(e,n)=>{if(Z(e))return[];if(!e.children||0===e.children.length)return[e];if(n&&n.has(e.accessor)){const i=e.children.filter(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n});return e.singleRowChildren?0===i.length?[e]:[e,...i.flatMap(t=>St(t,n))]:0===i.length?[e]:i.flatMap(t=>St(t,n))}const i=e.children.filter(e=>{const n=e.showWhen||t;return"parentExpanded"===n||"always"===n});return e.singleRowChildren?[e,...i.flatMap(t=>St(t,n))]:i.flatMap(t=>St(t,n))};function Ct(t){if(Z(t))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"auto"===e.toLowerCase()?{type:"auto"}: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 Mt(t){const e=[],n=t=>{Z(t)||(t.children&&0!==t.children.length?(t.singleRowChildren&&e.push(t),t.children.forEach(n)):e.push(t))};return t.forEach(n),e}function It(t,e){const n=t.map(t=>Ct(t)),i=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),o=n.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),s=e*(o/100),r=n.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),l=r>0?Math.max(0,e-i-s)/r:150,a=new Map;return t.forEach((t,i)=>{const o=n[i];if(o)if("auto"===o.type)a.set(t.accessor,Math.max(q,"number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0));else if("px"===o.type)a.set(t.accessor,o.value);else if("fr"===o.type){const e=o.value*l,n="number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0;a.set(t.accessor,n>0?Math.max(e,n):e)}else a.set(t.accessor,"pct"===o.type?e*o.value/100:q);else a.set(t.accessor,q)}),a}function Ht(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let i,o="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=Mt(t);i=It(e,n)}else{const e=Mt(t),n=e.map(t=>Ct(t));let s=o;if(null==s||0>=s){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;s=t+(e>0?150*e:0)+(n.filter(t=>"pct"===(null==t?void 0:t.type)).length>0?160:0),s=Math.max(s,800)}i=It(e,s)}return t.map(function t(e){const n=Object.assign({},e),o=i.get(e.accessor);return null!=o&&(n.width=o),e.children&&e.children.length>0&&(n.children=e.children.map(t)),n})}const kt=t=>{if(Z(t))return 0;if("number"==typeof t.width)return t.width;if("string"==typeof t.width&&t.width.endsWith("px"))return parseFloat(t.width);{const e=document.getElementById(ot({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||q}},Tt=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||q),t.children&&t.children.length>0&&t.children.forEach(t=>{Tt(t)})},Et=t=>"number"==typeof t.minWidth?t.minWidth:_,At=(t,e)=>{const n=[];return t.forEach(t=>{Z(t)||n.push(...St(t,e))}),n},Wt=t=>t instanceof HTMLElement?t:document.body,Ot=t=>t.replace(/["\\]/g,"\\$&"),Pt=t=>t.includes("\n")||t.includes("\r")?t.split(/\r\n|\r|\n/):[t],$t=(t,e)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";const i=window.getComputedStyle(e);n.style.font=i.font,n.style.fontSize=i.fontSize,n.style.fontWeight=i.fontWeight,n.style.fontFamily=i.fontFamily,n.style.letterSpacing=i.letterSpacing,n.style.padding=i.padding,document.body.appendChild(n);let o=0;for(const e of Pt(t))n.textContent=e,o=Math.max(o,n.offsetWidth);return document.body.removeChild(n),o},Ft=(t,e,n="st-icon-container")=>{const i=document.createElement("div");i.className=n,i.style.visibility="hidden",i.style.position="absolute",i.style.top="-99999px",i.style.left="-99999px","string"==typeof t?i.innerHTML=t:i.appendChild(t.cloneNode(!0));const o=Wt(e);o.appendChild(i);const s=window.getComputedStyle(i),r=i.offsetWidth+(parseFloat(s.marginLeft)||0)+(parseFloat(s.marginRight)||0);return o.removeChild(i),r+4},Lt=(t,e)=>{var n,i,o,s,r,l,a;const{rows:d,header:c,maxWidth:h=K,headSampleSize:u,stridedSampleSize:f,sampleSize:v,outlierPercentile:p,outlierThreshold:w,autoSizeMode:m=(null!==(n=null==c?void 0:c.autoSizeMode)&&void 0!==n?n:"content"),theme:g,styleRoot:b,sortIcon:x,expandIcon:y,onRendererHostDiscard:R}=e||{},S=null!==(i=null!=u?u:v)&&void 0!==i?i:25,C=null!=f?f:null!=v?0:75,M=null!=b?b:document,I=ot({accessor:t,rowId:"header"}),H=M instanceof HTMLElement?M.querySelector(`[id="${Ot(I)}"]`):document.getElementById(I),k=null!=H?H:M.querySelector(".st-header-cell");if(!k)return{width:q,settled:!0};const T=window.getComputedStyle(k),E=parseFloat(T.paddingLeft)||0,A=parseFloat(T.paddingRight)||0,W=parseFloat(T.gap)||0;let O=E+A,P=!(null==c?void 0:c.headerRenderer);const $=null==H?void 0:H.querySelector(".st-header-label");let F=!1,L=!1;if($){const t=$.querySelector(".st-header-label-text");if((null==c?void 0:c.headerRenderer)||!t){const t=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.height="auto";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontWeight=o.fontWeight,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=Wt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})($,M);if(1>t){if(null==c?void 0:c.headerRenderer)P=!1;else if(null==c?void 0:c.label){const t=null!==(o=M.querySelector(".st-header-label-text"))&&void 0!==o?o:$;O+=$t(c.label+"",t)}}else O+=t,P=!0,F=!!$.querySelector('.st-icon-container[aria-label^="Sort"]'),L=!!$.querySelector(".st-collapsible-header-icon")}else O+=$t(null!==(s=t.textContent)&&void 0!==s?s:"",t)}else if(null==c?void 0:c.label){const t=null!==(r=M.querySelector(".st-header-label-text"))&&void 0!==r?r:k;O+=$t(c.label+"",t),P=!0}const D=H?Array.from(H.children):[];let j=1;for(let t=0;D.length>t;t++){const e=D[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&&(O+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),j++,(null===(l=e.getAttribute("aria-label"))||void 0===l?void 0:l.startsWith("Sort"))&&(F=!0),e.classList.contains("st-collapsible-header-icon")&&(L=!0))}(null==c?void 0:c.sortable)&&!F&&x&&(O+=Ft(x,M),j++),c&&nt(c)&&!L&&y&&(O+=Ft(y,M,"st-icon-container st-collapsible-header-icon st-expand-icon-container expanded"),j++),W>0&&j>1&&(O+=W*(j-1));let N=0,B=!(null==c?void 0:c.cellRenderer)||"header"===m;const z=c&&c.type&&G.includes(c.type);if(d&&d.length>0&&!z&&"header"!==m){const e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.display="inline-block";let n=0,i=0;const o=M.querySelector(".st-cell-content");if(o){const t=window.getComputedStyle(o);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingRight)||0}document.body.appendChild(e);const s=[],r=t=>{let o=0;for(const n of Pt(t))e.textContent=n,o=Math.max(o,e.offsetWidth);return o+n+i},l=((t,e,n)=>{if(0>=t)return[];const i=Math.max(0,Math.floor(e)),o=Math.max(0,Math.floor(n));if(i+o>=t)return Array.from({length:t},(t,e)=>e);const s=new Set;for(let e=0;Math.min(i,t)>e;e++)s.add(e);const r=i,l=t-r;if(o>0&&l>0){const e=Math.max(1,Math.floor(l/o));for(let n=0;o>n;n++){const i=r+n*e;if(i>=t)break;s.add(i)}s.add(t-1)}return Array.from(s).sort((t,e)=>t-e)})(d.length,S,C);let h=!1,u=!1;for(const o of l){const l=d[o];let f;f=(null==c?void 0:c.valueGetter)?c.valueGetter({accessor:t,row:l,rowIndex:o}):ct(l,t);let v=f;(null==c?void 0:c.valueFormatter)&&null!=f&&(v=c.valueFormatter({accessor:t,colIndex:0,row:l,rowIndex:o,value:f}));let p=-1;if((null==c?void 0:c.cellRenderer)&&!h)try{const s=c.cellRenderer({accessor:t,colIndex:0,row:l,rowIndex:o,theme:g,value:f,formattedValue:v});if("string"==typeof s||"number"==typeof s)p=r(s+""),p>0&&(u=!0);else if(s instanceof Node)if(s instanceof HTMLElement&&(s.hasAttribute("data-st-portal-id")||s.hasAttribute("data-st-mount-id")||(null===(a=s.querySelector)||void 0===a?void 0:a.call(s,"[data-st-portal-id], [data-st-mount-id]"))))s instanceof HTMLElement&&(null==R||R(s)),h=!0,p=-1;else{e.textContent="",e.appendChild(s);const t=e.offsetWidth+n+i;s instanceof HTMLElement&&(null==R||R(s)),e.textContent="",p=t>n+i?t:-1,u=!0}}catch(t){p=-1}0>p&&!(null==c?void 0:c.cellRenderer)&&(p=r(null!=v?v+"":"")),0>p||s.push(p)}document.body.removeChild(e),(null==c?void 0:c.cellRenderer)&&(M.querySelectorAll(`.st-cell[data-accessor="${Ot(t+"")}"] .st-cell-content`).forEach(t=>{const e=t;if(e.querySelector(".st-loading-skeleton"))return;const o=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const i=t.cloneNode(!0);i.style.flex="none",i.style.width="max-content",i.style.minWidth="0",i.style.maxWidth="none",i.style.overflow="visible",i.style.padding="0";const o=window.getComputedStyle(t);i.style.font=o.font,i.style.fontSize=o.fontSize,i.style.fontFamily=o.fontFamily,i.style.letterSpacing=o.letterSpacing,n.appendChild(i);const s=Wt(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(e,M);o>0&&(s.push(o+n+i),u=!0)}),B=u),N=((t,e)=>{var n,i,o;if(0===t.length)return 0;const s=Math.max(...t),r=null!==(n=null==e?void 0:e.percentile)&&void 0!==n?n:95,l=null!==(i=null==e?void 0:e.threshold)&&void 0!==i?i:.5;if((null!==(o=null==e?void 0:e.minSampleForClip)&&void 0!==o?o:20)>t.length)return s;const a=((t,e)=>{if(0===t.length)return 0;if(1===t.length)return t[0];const n=[...t].sort((t,e)=>t-e),i=Math.min(100,Math.max(0,e))/100*(n.length-1),o=Math.floor(i),s=Math.ceil(i);return o===s?n[o]:n[o]+(n[s]-n[o])*(i-o)})(t,r);return a>0&&s>a*(1+l)?a:s})(s,{percentile:p,threshold:w})}let V="header"===m?O:Math.max(O,N);z&&(V=Math.max(V,150));const U="number"==typeof(null==c?void 0:c.maxWidth)?c.maxWidth:"string"==typeof(null==c?void 0:c.maxWidth)&&parseFloat(c.maxWidth+"")||void 0,J=null!=U?U:h;return V>J&&(V=J),{width:Math.max(V+2,"number"==typeof(null==c?void 0:c.minWidth)?c.minWidth:"string"==typeof(null==c?void 0:c.minWidth)&&parseFloat(c.minWidth+"")||_,_),settled:P&&B}};class Dt{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 jt=t=>"number"==typeof t.width?t.width:"string"==typeof t.width&&t.width.endsWith("px")?parseFloat(t.width):150,Nt=(t,e)=>{const n=new Map,i=t.map(jt),o=i.reduce((t,e)=>t+e,0);if(0===o)return n;const s=e/o;if(.01>s-1)return n;const r=t.map((t,e)=>{const n="number"==typeof t.maxWidth?t.maxWidth:"string"==typeof t.maxWidth?parseFloat(t.maxWidth):NaN;return Number.isFinite(n)&&n>0?Math.max(n,i[e]):1/0}),l=new Map;let a=s;for(;;){const t=i.map((t,e)=>e).filter(t=>!l.has(t));if(0===t.length)break;const n=Array.from(l.values()).reduce((t,e)=>t+e,0),o=t.reduce((t,e)=>t+i[e],0);a=Math.max(1,(e-n)/o);const s=t.filter(t=>i[t]*a>r[t]);if(0===s.length)break;s.forEach(t=>l.set(t,r[t]))}const d=t.map((t,e)=>{const n=l.get(e);return Math.round(void 0!==n?n:i[e]*a)});let c=-1;for(let e=t.length-1;e>=0;e--)if(!l.has(e)){c=e;break}if(c>=0){const t=d.reduce((t,e,n)=>n===c?t:t+e,0);d[c]=Math.round(Math.min(Math.max(e-t,i[c]),r[c]))}return t.forEach((t,e)=>{n.set(t.accessor,d[e])}),n},Bt=(t,e)=>{const{autoExpandColumns:n,containerWidth:i,pinnedLeftWidth:o,pinnedRightWidth:s,isResizing:r,collapsedHeaders:l}=e;if(!n||0===i||r)return t;const a=Math.max(0,i-o-s),d=t.filter(t=>"left"===t.pinned),c=t.filter(t=>"right"===t.pinned),h=t.filter(t=>!t.pinned),u=At(d,l),f=At(c,l),v=At(h,l),p=new Map;if(u.length>0&&Nt(u,o).forEach((t,e)=>p.set(e,t)),f.length>0&&Nt(f,s).forEach((t,e)=>p.set(e,t)),v.length>0&&a>0&&Nt(v,a).forEach((t,e)=>p.set(e,t)),0===p.size)return t;const w=(t,e)=>{var n;if(Z(t))return t;const i=null!=e?e:t.pinned,o=null===(n=t.children)||void 0===n?void 0:n.map(t=>w(t,i)),s=p.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:o}:{children:o})};return t.map(t=>w(t,t.pinned))};class zt{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new Dt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new Dt(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,i=this.config.containerWidth,o=this.isResizingTracker.get();this.isResizingTracker.set(n);const s=this.containerWidthTracker.get();this.containerWidthTracker.set(i),o&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(i-s)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return Bt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}const Vt=t=>{if(t.endsWith("dvh")||t.endsWith("svh")||t.endsWith("lvh")||t.endsWith("vh")){const e=parseFloat(t);return Number.isFinite(e)?window.innerHeight*e/100:null}return null},qt=(t,e=document.querySelector(".simple-table-root"))=>{var n;if("string"==typeof t){const i=t.trim();if(/^calc\(/i.test(i)&&i.endsWith(")")){const t=((t,e)=>{const n=[];for(let e=0;t.length>e;){const i=t[e];if(" "===i||"\t"===i||"\n"===i){e++;continue}if("("===i||")"===i||"+"===i||"-"===i||"*"===i||"/"===i){n.push(i),e++;continue}const o=/^\d*\.?\d+(px|dvh|svh|lvh|vh|vw|%)?/.exec(t.slice(e));if(!o)return null;n.push(o[0]),e+=o[0].length}if(0===n.length)return null;let i=0,o=!1;const s=()=>{let t=r();for(;!o&&("+"===n[i]||"-"===n[i]);){const e=n[i++],o=r();t="+"===e?t+o:t-o}return t},r=()=>{let t=l();for(;!o&&("*"===n[i]||"/"===n[i]);){const e=n[i++],o=l();t="*"===e?t*o:t/o}return t},l=()=>{const t=n[i];if(void 0===t)return o=!0,0;if("+"===t)return i++,l();if("-"===t)return i++,-l();if("("===t){i++;const t=s();return")"!==n[i]?(o=!0,0):(i++,t)}const r=((t,e)=>{var n;const i=t.trim();if(""===i)return null;if(i.endsWith("px")){const t=parseFloat(i);return Number.isFinite(t)?t:null}const o=Vt(i);if(null!==o)return o;if(i.endsWith("vw")){const t=parseFloat(i);return Number.isFinite(t)?window.innerWidth*t/100:null}if(i.endsWith("%")){const t=parseFloat(i),o=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return Number.isFinite(t)&&o&&o>=50?o*t/100:null}const s=+i;return Number.isFinite(s)?s:null})(t,e);return null===r?(o=!0,0):(i++,r)},a=s();return o||i!==n.length||!Number.isFinite(a)?null:a})(i.slice(i.indexOf("(")+1,-1),e);return null===t?0:Math.max(0,t)}if(i.endsWith("px"))return parseInt(i,10);const o=Vt(i);if(null!==o)return o;if(i.endsWith("%")){const t=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return!t||50>t?0:t*parseInt(i,10)/100}return window.innerHeight}return t};class Gt{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.resizeNotifyDebounceId=null,this.resizeBurstEndId=null,this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),i=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:i},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;return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)}convertHeightToPixels(t){const e=this.config.containerElement||document.querySelector(".simple-table-root");return qt(t,e)}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(!t&&void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=this.convertHeightToPixels(t);return 0!==l?Math.max(0,l-n):void 0}cancelPendingResizeNotify(){null!==this.resizeNotifyDebounceId&&(clearTimeout(this.resizeNotifyDebounceId),this.resizeNotifyDebounceId=null)}cancelResizeBurstEnd(){null!==this.resizeBurstEndId&&(clearTimeout(this.resizeBurstEndId),this.resizeBurstEndId=null)}scheduleResizeBurstEnd(){this.cancelResizeBurstEnd(),this.resizeBurstEndId=setTimeout(()=>{this.resizeBurstEndId=null,this.resizeBurstNeedsFinalFlush&&(this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()),this.resizeBurstNotifyCount=0},150)}scheduleResizeNotify(){this.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeNotifyDebounceId=setTimeout(()=>{this.resizeNotifyDebounceId=null,0===this.resizeBurstNotifyCount?(this.resizeBurstNotifyCount=1,this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()):this.resizeBurstNeedsFinalFlush=!0,this.scheduleResizeBurstEnd()},100)}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})),this.initialNotifyPending?(this.initialNotifyPending=!1,this.cancelPendingResizeNotify(),this.notifySubscribers()):n&&this.scheduleResizeNotify()})}),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 i=!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}),i=!0}if("height"in t||"maxHeight"in t||void 0!==t.totalRowCount||void 0!==t.externalViewportHeight){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),i=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),i=!0),void 0!==t.rowHeight||void 0!==t.headerHeight||void 0!==t.footerHeight){const t=this.calculateHeaderHeight(this.state.maxHeaderDepth),e=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{calculatedHeaderHeight:t,contentHeight:e}),i=!0}i&&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.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class Kt{constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.notifySubscribersRafId=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(){0!==this.subscribers.size&&this.subscribers.forEach(t=>t(this.state))}scheduleNotifySubscribersFromScroll(){0!==this.subscribers.size&&null===this.notifySubscribersRafId&&(this.notifySubscribersRafId=requestAnimationFrame(()=>{this.notifySubscribersRafId=null,this.notifySubscribers()}))}handleScroll(t,e,n,i){const o=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:o,isScrolling:!0},null!==this.scrollTimeoutId&&clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=window.setTimeout(()=>{this.state=Object.assign(Object.assign({},this.state),{isScrolling:!1}),this.scheduleNotifySubscribersFromScroll()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>i-(t+n)&&this.config.onLoadMore(),this.scheduleNotifySubscribersFromScroll()}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),null!==this.notifySubscribersRafId&&(cancelAnimationFrame(this.notifySubscribersRafId),this.notifySubscribersRafId=null),this.subscribers.clear()}}class _t{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.headerTouchMoveHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.isTouchScrolling=!1,this.touchSettleTimeoutId=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var i;const o=this.panesBySection.get(t);if(Array.from(o).find(t=>t.element===e))return;const s=Array.from(o).find(t=>t.role===n);if(s&&(this.removeScrollListener(s.element),o.delete(s)),o.add({element:e,role:n}),("header"===n||"sticky"===n)&&(e.style.overflowX="hidden"),"sticky"!==n&&(this.addScrollListener(t,e,n),"body"===n&&this.addTouchTracking(t,e)),"header"===n){e.style.touchAction="none";const t=t=>t.preventDefault();this.headerTouchMoveHandlers.set(e,t),e.addEventListener("touchmove",t,{passive:!1})}const r=null!==(i=this.scrollLeftBySection[t])&&void 0!==i?i: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 i=Array.from(n).find(t=>t.element===e);i&&n.delete(i)}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,n){this.removeScrollListener(e);const i=()=>{if(this.isSyncing)return;if(this.isTouchScrolling&&"body"!==n)return;const i=e.scrollLeft;this.scrollLeftBySection[t]=i,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t,role:n})=>{t!==e&&t.scrollLeft!==i&&("scrollbar"===n&&this.isTouchScrolling||(t.scrollLeft=i))}),this.isTouchScrolling&&this.scheduleTouchSettle(t),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(i-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=i,this.config.onMainSectionScrollLeft(i)),this.isSyncing=!1};this.scrollHandlers.set(e,i),e.addEventListener("scroll",i,{passive:!0})}addTouchTracking(t,e){e.addEventListener("touchstart",()=>{this.isTouchScrolling=!0,null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null)},{passive:!0}),e.addEventListener("touchend",()=>this.scheduleTouchSettle(t),{passive:!0})}scheduleTouchSettle(t){null!==this.touchSettleTimeoutId&&clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=window.setTimeout(()=>{var e;this.touchSettleTimeoutId=null,this.isTouchScrolling=!1;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0,i=this.panesBySection.get(t);i&&(this.isSyncing=!0,i.forEach(({element:t,role:e})=>{"scrollbar"===e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),this.isSyncing=!1)},100)}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t));const n=this.headerTouchMoveHandlers.get(t);n&&(t.removeEventListener("touchmove",n),this.headerTouchMoveHandlers.delete(t))}destroy(){null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null),["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const Ut={string:(t,e,n)=>{if(t===e)return 0;const i=t.localeCompare(e);return"asc"===n?i:-i},number:(t,e,n)=>{if(t===e)return 0;const i=t-e;return"asc"===n?i:-i},boolean:(t,e,n)=>{if(t===e)return 0;const i=t===e?0:t?-1:1;return"asc"===n?i:-i},date:(t,e,n)=>{const i=new Date(t),o=new Date(e);if(i.getTime()===o.getTime())return 0;const s=i.getTime()-o.getTime();return"asc"===n?s:-s},enum:(t,e,n)=>Ut.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?Ut.string(t,e,n):"number"==typeof t&&"number"==typeof e?Ut.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Ut.boolean(t,e,n):Ut.string(t+"",e+"",n)},Jt=({headers:t,rows:e,sortColumn:n})=>(({rows:t,sortColumn:e,headers:n})=>{const i=(t,e)=>{for(const n of t){if(n.accessor===e)return n;if(n.children&&n.children.length>0){const t=i(n.children,e);if(t)return t}}},o=i(n,e.key.accessor),s=(null==o?void 0:o.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let i,a;if(null==o?void 0:o.valueGetter){const s=t.indexOf(e),r=t.indexOf(n);i=o.valueGetter({accessor:l,row:e,rowIndex:s}),a=o.valueGetter({accessor:l,row:n,rowIndex:r})}else i=ct(e,l),a=ct(n,l);return(null==o?void 0:o.comparator)?o.comparator({rowA:e,rowB:n,valueA:i,valueB:a,direction:r}):((t,e,n="string",i)=>{if(null==t||""===t)return"asc"===i?-1:1;if(null==e||""===e)return"asc"===i?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 i=null===(e=t[2])||void 0===e?void 0:e.toUpperCase();return"T"===i?n*=1e12:"B"===i?n*=1e9:"M"===i?n*=1e6:"K"===i&&(n*=1e3),n}}return parseFloat(n)||0},o=n(t),s=n(e);return Ut.number(o,s,i)}return"date"===n?Ut.date(t+"",e+"",i):"boolean"===n?Ut.boolean(!!t,!!e,i):"enum"===n?Ut.enum(t+"",e+"",i):Ut.string(t+"",e+"",i)})(i,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Yt=(t,e)=>{if(0===t.length)return;if("custom"===e.type&&e.customFn)return e.customFn(t);const n=e.parseValue?t.map(e.parseValue).filter(t=>!isNaN(t)):t.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===n.length)return"count"===e.type?t.length:void 0;let i;switch(e.type){case"sum":i=n.reduce((t,e)=>t+e,0);break;case"average":i=n.reduce((t,e)=>t+e,0)/n.length;break;case"count":i=t.length;break;case"min":i=Math.min(...n);break;case"max":i=Math.max(...n);break;default:return}return e.formatResult?e.formatResult(i):i},Xt=t=>{const{rows:e=[],headers:n=[],rowGrouping:i,rowManager:o}=t;if(o)return o.getAggregatedRows();if(!i||0===i.length)return e;const s=(t=>X(t).filter(t=>t.aggregation))(n);if(0===s.length)return e;const r=JSON.parse(JSON.stringify(e)),l=(t,e=0)=>t.map(t=>{const n=i[e],o=i[e+1],r=t[n];if(r&&ft(r)){const i=l(r,e+1),a=Object.assign({},t);return a[n]=i,s.forEach(t=>{const e=((t,e,n,i)=>{const o=[],s=t=>{t.forEach(t=>{const n=i?t[i]:void 0;if(i&&n&&ft(n))s(n);else{const n=ct(t,e);null!=n&&o.push(n)}})};return s(t),Yt(o,n)})(i,t.accessor,t.aggregation,o);void 0!==e&&ut(a,t.accessor,e)}),a}return t});return l(r)};class Qt{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=X(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:i}){const o=Jt({headers:e,rows:n,sortColumn:i});return t&&0!==t.length?o.map(n=>{const o=t[0],s=n[o];if(ft(s)){const r=this.sortNestedRows({rows:s,sortColumn:i,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[o]:r})}return n}):o}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=Xt({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}):Jt({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);ht(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,i,o;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.computeSortedRows(this.config.tableRows,null)}),null===(n=(e=this.config).onSortChange)||void 0===n||n.call(e,null),void this.notifySubscribers();const{accessor:s,direction:r}=t,l=this.headerLookup.get(s);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===s&&(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===(o=(i=this.config).onSortChange)||void 0===o||o.call(i,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 i of n){if(i.accessor===t)return i;if(i.children&&i.children.length>0){const t=e(i.children);if(t)return t}}},n=e(this.config.headers);if(!n)return this.config.tableRows;let i=null;const o=n.sortingOrder||["asc","desc",null];let s=-1;this.state.sort&&this.state.sort.key.accessor===t&&(s=o.indexOf(this.state.sort.direction));const r=o[(s+1)%o.length];return i=null===r?null:{key:n,direction:r},this.computeSortedRows(this.config.tableRows,i)}getState(){return this.state}getSortColumn(){return this.state.sort}getSortedRows(){return this.state.sortedRows}destroy(){this.subscribers.clear()}}const Zt=t=>{if(!t)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,n,i]=t.split("-").map(Number);return new Date(e,n-1,i,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)},te=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),ee=t=>{if(!t)return new Date;if("string"==typeof t)return Zt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:te(e)}return t instanceof Date?te(t):new Date};class ne{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=X(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:i,values:o}=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(),o=i?(i+"").toLowerCase():"";switch(n){case"equals":return e===o;case"notEquals":return e!==o;case"contains":return e.includes(o);case"notContains":return!e.includes(o);case"startsWith":return e.startsWith(o);case"endsWith":return e.endsWith(o)}}if("number"==typeof t||!isNaN(+t)){const e=+t,s=+i;switch(n){case"equals":return e===s;case"notEquals":return e!==s;case"greaterThan":return e>s;case"lessThan":return s>e;case"greaterThanOrEqual":return e>=s;case"lessThanOrEqual":return s>=e;case"between":if(o&&2===o.length){const[t,n]=o.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(o&&2===o.length){const[t,n]=o.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=ee(t),s=ee((i||"")+""),r=te(e),l=te(s);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(o&&2===o.length){const[t,e]=o.map(t=>te(ee((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(o&&2===o.length){const[t,e]=o.map(t=>te(ee((t||"")+"")));return t>r||r>e}return!0}}if("boolean"==typeof t&&"equals"===n)return t===!!i;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(o&&Array.isArray(o)){const e=o.includes(t+"");return"in"===n?e:!e}return!1}const s=(t+"").toLowerCase(),r=i?(i+"").toLowerCase():"";switch(n){case"equals":return s===r;case"notEquals":return s!==r;default:return!0}})(ct(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);ht(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 i=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),o=this.computeFilteredRows(this.config.rows,i);if(this.state={filters:i,filteredRows:o},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,i),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 i=Object.assign({},this.state.filters);delete i[t];const o=this.computeFilteredRows(this.config.rows,i);if(this.state={filters:i,filteredRows:o},null===(n=(e=this.config).onFilterChange)||void 0===n||n.call(e,i),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 ie="__pivotChildren",oe="__pivotIsTotal",se="__pivot:",re="(blank)",le="",ae="__total__",de=t=>null==t?re:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:t+"",ce=t=>t+"",he=t=>t.map(ce).join(le),ue=t=>""===t?[]:t.split(le),fe=(t,e)=>t===re&&e!==re?1:e===re&&t!==re?-1:t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}),ve=(t,e)=>t.get(e+""),pe=(t,e)=>`${se}${t}${le}${e+""}`,we=t=>pe(ae,t),me=(t,e,n)=>`${t}${le}${e}${le}${n}`,ge=({accessor:t,label:e,field:n,alignRight:i})=>{var o,s,r,l;return{accessor:t,label:e,width:null!==(o=null==n?void 0:n.width)&&void 0!==o?o:100,type:null!==(s=null==n?void 0:n.type)&&void 0!==s?s:"number",align:i?"right":null!==(r=null==n?void 0:n.align)&&void 0!==r?r:"right",sortable:null===(l=null==n?void 0:n.sortable)||void 0===l||l,filterable:!1,editable:!1,valueFormatter:null==n?void 0:n.valueFormatter,valueGetter:null==n?void 0:n.valueGetter,minWidth:null==n?void 0:n.minWidth,maxWidth:null==n?void 0:n.maxWidth}},be=(t,e,n,i,o)=>{const s=`${le}${n}${le}${i}`,r=[];if(o){const n=t.get(`${e}${s}`);return n&&r.push(...n),r}for(const[n,i]of t){if(!n.endsWith(s))continue;const t=n.slice(0,n.length-s.length);(""===e||t===e||t.startsWith(e+le))&&r.push(...i)}return r},xe=({row:t,buckets:e,rowKeyPrefix:n,colKeys:i,values:o,showRowTotals:s,exactRowKey:r})=>{for(const s of i)o.forEach((i,o)=>{const l=be(e,n,s,o,r),a=Yt(l,i.aggregation);void 0!==a&&(t[pe(s,i.accessor)]=a)});s&&o.forEach((o,s)=>{const l=[];for(const t of i)l.push(...be(e,n,t,s,r));0===i.length&&l.push(...be(e,n,"",s,r));const a=Yt(l,o.aggregation);void 0!==a&&(t[we(o.accessor)]=a)})},ye=({rowDims:t,prefixParts:e,distinctRowKeys:n,buckets:i,colKeys:o,values:s,showRowTotals:r})=>{const l=e.length;if(l>=t.length)return[];const a=he(e),d=l,c=new Map;for(const t of n){const e=ue(t);if(""!==a&&t!==a&&!t.startsWith(a+le))continue;if(d>=e.length)continue;const n=e[d];c.set(ce(n),n)}const h=Array.from(c.keys()).sort(fe),u=l===t.length-1;return h.map(a=>{const d=c.get(a),h=[...e,d],f=he(h),v={};if(t.forEach((t,e)=>{e>l||(v[t]=h[e])}),u)return xe({row:v,buckets:i,rowKeyPrefix:f,colKeys:o,values:s,showRowTotals:r,exactRowKey:!0}),v;const p=ye({rowDims:t,prefixParts:h,distinctRowKeys:n,buckets:i,colKeys:o,values:s,showRowTotals:r});return v[ie]=p,xe({row:v,buckets:i,rowKeyPrefix:f,colKeys:o,values:s,showRowTotals:r,exactRowKey:!1}),v})},Re=({rows:t,pivot:e,fieldHeaders:n})=>{var i,o;if(!e.values||0===e.values.length)throw Error("pivot.values must contain at least one measure");const s=null!==(i=e.rows)&&void 0!==i?i:[],r=null!==(o=e.columns)&&void 0!==o?o:[],l=e.values,a=!1!==e.showRowTotals,d=!1!==e.showColumnTotals,c=!1!==e.showGrandTotal,h=new Map;for(const t of X(n))h.set(t.accessor+"",t);const u=new Map,f=new Set,v=new Set;for(const e of t){const t=s.map(t=>de(ct(e,t))),n=r.map(t=>de(ct(e,t))),i=he(t),o=he(n);f.add(i),v.add(o),l.forEach((t,n)=>{const s=ct(e,t.accessor);if(null==s)return;const r=me(i,o,n);let l=u.get(r);l||(l=[],u.set(r,l)),l.push(s)})}const p=Array.from(f).sort((t,e)=>{var n,i;const o=ue(t),s=ue(e),r=Math.max(o.length,s.length);for(let t=0;r>t;t++){const e=fe(null!==(n=o[t])&&void 0!==n?n:"",null!==(i=s[t])&&void 0!==i?i:"");if(0!==e)return e}return 0}),w=Array.from(v).sort((t,e)=>{var n,i;const o=ue(t),s=ue(e),r=Math.max(o.length,s.length);for(let t=0;r>t;t++){const e=fe(null!==(n=o[t])&&void 0!==n?n:"",null!==(i=s[t])&&void 0!==i?i:"");if(0!==e)return e}return 0}),m=0===r.length?[""]:w,g=a&&r.length>0,b=(({colKeys:t,values:e,catalog:n,showRowTotals:i})=>{var o,s;const r=e.length>1,l=[],a={label:"",children:new Map};for(const e of t){const t=ue(e);if(0===t.length)continue;let n=a;for(const e of t){let t=n.children.get(e);t||(t={label:e,children:new Map},n.children.set(e,t)),n=t}n.colKey=e}const d=(t,i)=>Array.from(t.children.entries()).sort(([t],[e])=>fe(t,e)).map(([t,o])=>{const s=i?`${i}${le}${t}`:t;if(void 0!==o.colKey&&0===o.children.size){if(!r){const i=e[0],s=ve(n,i.accessor);return ge({accessor:pe(o.colKey,i.accessor),label:t,field:s,alignRight:!0})}return{accessor:"__pivotGroup:"+o.colKey,label:t,width:100,children:e.map(t=>{var e,i;const s=ve(n,t.accessor);return ge({accessor:pe(o.colKey,t.accessor),label:null!==(i=null!==(e=t.label)&&void 0!==e?e:null==s?void 0:s.label)&&void 0!==i?i:t.accessor+"",field:s,alignRight:!0})})}}return{accessor:"__pivotGroup:"+s,label:t,width:100,children:d(o,s)}});if(0===t.length||1===t.length&&""===t[0])for(const t of e){const e=ve(n,t.accessor);l.push(ge({accessor:pe("",t.accessor),label:null!==(s=null!==(o=t.label)&&void 0!==o?o:null==e?void 0:e.label)&&void 0!==s?s:t.accessor+"",field:e,alignRight:!0}))}else l.push(...d(a,""));if(i)if(r)l.push({accessor:"__pivotGroup:"+ae,label:"Total",width:100,children:e.map(t=>{var e,i;const o=ve(n,t.accessor);return ge({accessor:we(t.accessor),label:null!==(i=null!==(e=t.label)&&void 0!==e?e:null==o?void 0:o.label)&&void 0!==i?i:t.accessor+"",field:o,alignRight:!0})})});else{const t=e[0],i=ve(n,t.accessor);l.push(ge({accessor:we(t.accessor),label:"Total",field:i,alignRight:!0}))}return l})({colKeys:0===r.length?[]:w,values:l,catalog:h,showRowTotals:g}),x=((t,e,n)=>t.map((t,i)=>{var o,s,r,l,a;const d=ve(e,t);return{accessor:t,label:null!==(o=null==d?void 0:d.label)&&void 0!==o?o:t+"",width:null!==(s=null==d?void 0:d.width)&&void 0!==s?s:140,type:null!==(r=null==d?void 0:d.type)&&void 0!==r?r:"string",align:null!==(l=null==d?void 0:d.align)&&void 0!==l?l:"left",pinned:"left",sortable:null===(a=null==d?void 0:d.sortable)||void 0===a||a,filterable:null==d?void 0:d.filterable,expandable:!(!n||0!==i)||(null==d?void 0:d.expandable),valueFormatter:null==d?void 0:d.valueFormatter,valueGetter:null==d?void 0:d.valueGetter,minWidth:null==d?void 0:d.minWidth,maxWidth:null==d?void 0:d.maxWidth}}))(s,h,s.length>1),y=[...x,...b];let R;if(0===s.length){const t={};xe({row:t,buckets:u,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[t]}else R=ye({rowDims:s,prefixParts:[],distinctRowKeys:p,buckets:u,colKeys:m,values:l,showRowTotals:g});if(d&&s.length>0){const t={[oe]:!0};t[s[0]]="Total",xe({row:t,buckets:u,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[...R,t]}return{rows:R,headers:y,rowGrouping:s.length>1?Array.from({length:s.length-1},()=>ie):void 0}};class Se{constructor(t){this.subscribers=new Set,this.cacheKey="",this.config=t,this.state=this.computeState(t),this.cacheKey=this.buildCacheKey(t)}buildCacheKey(t){return`${e=t.pivot,e?JSON.stringify({rows:e.rows,columns:e.columns,values:e.values.map(t=>({accessor:t.accessor,label:t.label,type:t.aggregation.type})),showRowTotals:!1!==e.showRowTotals,showColumnTotals:!1!==e.showColumnTotals,showGrandTotal:!1!==e.showGrandTotal}):""}|rows:${t.sourceRows.length}|hdr:${t.fieldHeaders.length}`;var e}computeState(t){var e;const n=null!==(e=t.pivot)&&void 0!==e?e:null;if(!n||!n.values||0===n.values.length)return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,rowGrouping:void 0,pivot:null};let i;try{i=Re({rows:t.sourceRows,pivot:n,fieldHeaders:t.fieldHeaders})}catch(e){return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,rowGrouping:void 0,pivot:null}}return{active:!0,pivotedRows:i.rows,headers:i.headers,rowGrouping:i.rowGrouping,pivot:n}}getState(){return this.state}isActive(){return this.state.active}getPivot(){return this.state.pivot}updateConfig(t){const e=Object.assign(Object.assign({},this.config),t),n=this.buildCacheKey(e),i=void 0!==t.sourceRows&&t.sourceRows!==this.config.sourceRows,o=void 0!==t.fieldHeaders&&t.fieldHeaders!==this.config.fieldHeaders,s=void 0!==t.pivot&&t.pivot!==this.config.pivot;this.config=e,(i||o||s||n!==this.cacheKey)&&(this.cacheKey=n,this.state=this.computeState(this.config),this.notifySubscribers())}setPivot(t){this.updateConfig({pivot:t})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}destroy(){this.subscribers.clear()}}const Ce=(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 i=0,o=n.length-1;for(;o>i;){const e=Math.floor((i+o+1)/2);n[e]>t?o=e-1:i=e}return i},Me=(t,e)=>{if(!e||0===e.length)return 0;let n=0,i=0,o=e.length;for(;o>i;){const n=Math.floor((i+o)/2);t>e[n][0]?i=n+1:o=n}for(let t=0;i>t;t++)n+=e[t][1];return n},Ie=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:i,tableRows:o,scrollDirection:s="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===s?(r=Math.max(l,.1*n),a=.9*n):"up"===s&&(r=.9*n,a=Math.max(l,.1*n));const d=i+e+a,c=Math.max(0,Math.floor(Math.max(0,i-r)/l)),h=Math.min(o.length,Math.ceil(d/l)),u=i+e,f=Math.max(0,Math.ceil(i/l)),v=Math.min(o.length,Math.floor(u/l)),p=i+e,w=Math.max(0,Math.floor(i/l)),m=Math.min(o.length,Math.ceil(p/l));return{rendered:{startIndex:c,endIndex:h,rows:o.slice(c,h)},fullyVisible:{startIndex:f,endIndex:v,rows:o.slice(f,v)},partiallyVisible:{startIndex:w,endIndex:m,rows:o.slice(w,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,h=d;"down"===s?(c=Math.max(l,.1*d),h=.9*d):"up"===s&&(c=.9*d,h=Math.max(l,.1*d));const u=i+e+h,f=Ce(Math.max(0,i-c),r);let v=Ce(u,r)+1;v=Math.min(o.length,v);const p=i,w=i+e;let m=Ce(p,r);p>a[m]&&(m=Math.min(m+1,o.length));let g=Ce(w,r);g=Math.min(o.length,g);const b=i+e,x=Ce(i,r);let y=Ce(b,r)+1;return y=Math.min(o.length,y),{rendered:{startIndex:f,endIndex:v,rows:o.slice(f,v)},fullyVisible:{startIndex:m,endIndex:g,rows:o.slice(m,g)},partiallyVisible:{startIndex:x,endIndex:y,rows:o.slice(x,y)}}},He=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+Me(t,n),ke=({position:t,rowHeight:e,heightOffsets:n,customTheme:i})=>t*(e+i.rowSeparatorWidth)+Me(t,n),Te=(t,e)=>{var n,i;const o=t.position,s=e[o+1];return null!==(i=null===(n=null==s?void 0:s.parentIndices)||void 0===n?void 0:n.includes(o))&&void 0!==i&&i},Ee=new Map,Ae=t=>{var e;return t?null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId):""},We=(t,e,n,i,o)=>{var s,r,l,a,d,c;const h=null!==(r=null===(s=i[0])||void 0===s?void 0:s.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,f=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,v=[Ae(t[h]),Ae(t[u]),Ae(t[f]),Ae(t[0]),t.length+""].join("|"),p=`${h}:${u}:${f}:${o.join(",")}:${v}`,w=Ee.get(p);if(w&&w.firstVisiblePosition===h&&w.renderedStartPosition===u&&w.renderedEndPosition===f){const n=[];let i=!0;for(const e of w.result.stickyParents){const o=t[e.position];if(!o||Ae(o)!==Ae(e)){i=!1;break}n.push(o)}if(i)return{stickyParents:n,regularRows:e};Ee.delete(p)}const m=Oe({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:o});if(Ee.set(p,{result:m,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:f}),Ee.size>50){const t=Ee.keys().next().value;void 0!==t&&Ee.delete(t)}return m},Oe=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s,stickyParents:r,rowGrouping:l})=>{let a=i[o];if(!a||s>10)return{stickyParents:r,regularRows:e};let d=0;if(a.parentIndices&&a.parentIndices.length>0){for(const e of a.parentIndices){const i=t[e];if(i){const e=n.some(t=>t.position===i.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=>pt(t.rowId)===pt(i.rowId))||(r.push(i),d++)}}if(r.length>0){Te(a,t)&&(r.push(a),d++);const e=i[o+=d];e&&(a=e)}}else if(Te(a,t))return r.push(a),o++,Oe({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Te(a,t)?Oe({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:i,partiallyVisibleRowIndex:o,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Pe=(t,e,n)=>{const i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),s=10;if(o.top+s>i.top?e.scrollTop-=o.top-i.top+s:i.bottom>o.bottom-s&&(e.scrollTop+=i.bottom-o.bottom+s),n){const t=n.getBoundingClientRect();t.left+s>i.left?n.scrollLeft-=t.left-i.left+s:i.right>t.right-s&&(n.scrollLeft+=i.right-t.right+s)}},$e=(t,e,n,i)=>{const o=document.querySelector(".st-body-container"),s=document.querySelector(".st-body-main");if(!o)return;const r=i?i.findIndex(e=>pt(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=o.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&i){const t=((t,e,n,i)=>{const o=Ie({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:i,scrollDirection:"none"}),{startIndex:s,endIndex:r}=o.fullyVisible;return t>=s&&r>t})(l,o,e,i);if(t)return void Pe(d,o,s)}if(!d)return o.scrollTop=Math.max(0,l*a-o.clientHeight/3),void setTimeout(()=>{const e=o.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&Pe(e,o,s)},100);Pe(d,o,s)},Fe=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Le(t,e,n,i){const o=new Set,s=new Map;n.forEach((t,e)=>{const n=pt(t.rowId);s.set(n,e)});const r=s.get(t.rowId+""),l=s.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),f=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;f>=e;e++)if(t>=0&&n.length>t){if(i&&0===e)continue;const s=pt(n[t].rowId);o.add(Fe({colIndex:e,rowIndex:t,rowId:s}))}return o}function De(t,e,n=document){var i,o,s;const r=n,l=r.querySelector(".st-body-container");if(!l)return null;const a=l.getBoundingClientRect(),d=Math.max(a.left,Math.min(a.right,t)),c=Math.max(a.top,Math.min(a.bottom,e)),h=r.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===h.length)return null;const u=new Map;for(let t=0;h.length>t;t++){const e=h[t],n=e.getAttribute("data-row-id"),o=null!==(i=null!=n?n:e.getAttribute("data-row-index"))&&void 0!==i?i:"";if(!o)continue;let s=u.get(o);s||(s=[],u.set(o,s)),s.push(e)}const f=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();f.push({key:e,top:n.top,bottom:n.bottom})}),f.sort((t,e)=>t.top-e.top);let v=null,p=1/0;for(let t=0;f.length>t;t++){const{key:e,top:n,bottom:i}=f[t];if(c>=n&&i>=c){v=e,p=0;break}const o=Math.abs(c-(n+i)/2);p>o&&(p=o,v=e)}if(null===v)return null;const w=u.get(v);if(!w||0===w.length)return null;let m=null,g=1/0;for(let t=0;w.length>t;t++){const e=w[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 l=e.getBoundingClientRect(),a=Math.sqrt((l.left+l.width/2-d)**2+(l.top+l.height/2-c)**2);g>a&&(g=a,m=e)}if(null!==m){const t=parseInt(m.getAttribute("data-row-index")||"-1",10),e=parseInt(m.getAttribute("data-col-index")||"-1",10),n=m.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return null}class je{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=>St(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(pt(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(pt(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(`${pt(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(pt(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(pt(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(`${pt(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:i}=this.initialFocusedCell;const o=this.config.tableRows[e];if((o?pt(o.rowId):null)!==i){const t=this.config.tableRows.findIndex(t=>pt(t.rowId)===i);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,i,o,s){let r=i,l=o;return"up"===s?r=0:"down"===s?r=t-1:"left"===s?l=n?1:0:"right"===s&&(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 i=e-1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"up").rowIndex),i>=0){const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}}else if(e>0){let i=e-1;(t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"up").rowIndex);const o=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:o}),this.startCell=null}}handleArrowDown(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let i=e+1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"down").rowIndex),this.config.tableRows.length>i){const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}}else if(this.config.tableRows.length-1>e){let i=e+1;(t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"down").rowIndex);const o=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:o}),this.startCell=null}}handleArrowLeft(t,e,n){if(t.shiftKey&&"ArrowLeft"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let i=n-1;if(t.ctrlKey||t.metaKey)i=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===i)return;if(i>=0){const t=pt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:i,rowId:t})}}else if(n>0){let i=n-1;if((t.ctrlKey||t.metaKey)&&"ArrowLeft"===t.key)i=this.findEdgeInDirection(e,n,"left").colIndex;else if(this.config.enableRowSelection&&0===i)return;if(i>=0){const t=pt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:i,rowId:t}),this.startCell=null}}}handleArrowRight(t,e,n){const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;if(t.shiftKey&&"ArrowRight"===t.key){this.startCell||(this.startCell=this.initialFocusedCell);let o=n+1;if((t.ctrlKey||t.metaKey)&&(o=this.findEdgeInDirection(e,n,"right").colIndex),i>=o){const t=pt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:o,rowId:t})}}else if(i>n){let o=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(o=this.findEdgeInDirection(e,n,"right").colIndex),i>=o){const t=pt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:o,rowId:t}),this.startCell=null}}}handleHome(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const i=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const o=pt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:i,rowId:o})}else{let n=e;const i=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const o=pt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:i,rowId:o}),this.startCell=null}}handleEnd(t,e,n){if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);let n=e;const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const o=pt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:i,rowId:o})}else{let n=e;const i=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1;(t.ctrlKey||t.metaKey)&&(n=this.config.tableRows.length-1);const o=pt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:i,rowId:o}),this.startCell=null}}handlePageUp(t,e,n){let i=Math.max(0,e-10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,colIndex:n,rowId:t}),this.startCell=null}}handlePageDown(t,e,n){let i=Math.min(this.config.tableRows.length-1,e+10);if(t.shiftKey){this.startCell||(this.startCell=this.initialFocusedCell);const t=pt(this.config.tableRows[i].rowId);this.selectCellRange(this.startCell,{rowIndex:i,colIndex:n,rowId:t})}else{const t=pt(this.config.tableRows[i].rowId);this.selectSingleCell({rowIndex:i,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,i=!1)=>{const o=this.leafHeaders.filter(t=>!Z(t)),s=new Map,r=new Map;o.forEach((t,e)=>{s.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var i;const[o,l]=e.split("-").map(Number);t[o]||(t[o]=[]);const a=s.get(l),d=r.get(l);if(a&&(null===(i=n[o])||void 0===i?void 0:i.row)){const e=n[o].row,i=ct(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:o,value:i});t[o][l]=n}else t[o][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?i:Array.isArray(i)?i.join(", "):""}else t[o][l]="";return t},{}),a=new Set;i&&Array.from(t).forEach(t=>{const[,e]=t.split("-").map(Number);a.add(e)});let d="";i&&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 i&&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,i,o,s)=>{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=>!Z(t)),c=i.findIndex(t=>pt(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{var a;const c=h+e,f=u+n;if(c>=i.length||f>=d.length)return;const v=i[c],p=d[f],w=pt(v.rowId);if(!(null==p?void 0:p.editable))return void l.add(`${c}-${f}-${w}`);let m=t;if("number"===p.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===p.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===p.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==p.type&&"barChart"!==p.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(ut(v.row,p.accessor,m),s){const t=`${null!==(a=v.stableRowKey)&&void 0!==a?a:w}-${p.accessor}`,e=s.get(t);e&&e.updateContent(m)}null==o||o({accessor:p.accessor,newValue:m,row:v.row,rowIndex:c}),r.add(`${c}-${f}-${w}`)})}),{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,i,o)=>{const s=new Set,r=new Set,l=e.filter(t=>!Z(t)),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{var e;const[a,d]=t.split("-").map(Number);if(a>=n.length||d>=l.length)return;const c=n[a],h=l[d],u=pt(c.rowId);if(!(null==h?void 0:h.editable))return void r.add(t);let f=null;if(f="string"===h.type?"":"number"===h.type?null:"boolean"!==h.type&&("date"===h.type?null:"lineAreaChart"===h.type||"barChart"===h.type||Array.isArray(ct(c.row,h.accessor))?[]:""),ut(c.row,h.accessor,f),o){const t=`${null!==(e=c.stableRowKey)&&void 0!==e?e:u}-${h.accessor}`,n=o.get(t);n&&n.updateContent(f)}null==i||i({accessor:h.accessor,newValue:f,row:c.row,rowIndex:a}),s.add(t)}),{deletedCells:s,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 i=this.config.enableRowSelection?n+1:n,o=pt(this.config.tableRows[e].rowId);t.add(`${e}-${i}-${o}`)}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),i=t.getAttribute("data-row-id");if(0>e||0>n||!i)return;const o=Fe({rowIndex:e,colIndex:n,rowId:i}),s=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:i});this.copyFlashCells.has(o)?t.classList.add(s?"st-cell-copy-flash-first":"st-cell-copy-flash"):t.classList.remove("st-cell-copy-flash-first","st-cell-copy-flash"),this.warningFlashCells.has(o)?t.classList.add(s?"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&&!this.config.selectableCells)return;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-header-cell"),n=new Map;for(const t of X(this.config.headers))n.set(t.accessor+"",t);for(let t=0;e.length>t;t++){const i=e[t];if(!(i instanceof HTMLElement))continue;const o=i.getAttribute("data-accessor"),s=i.getAttribute("aria-colindex");if(!o||!s)continue;const r=parseInt(s,10)-1;if(0>r||Number.isNaN(r))continue;const l=n.get(o);if(!l){for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t);continue}const a=J(l,r),d=a.some(t=>this.selectedColumns.has(t)),c=!d&&a.some(t=>this.columnsWithSelectedCells.has(t));if(d)i.classList.add("st-header-selected"),i.classList.remove("st-header-has-highlighted-cell");else if(c)i.classList.add("st-header-has-highlighted-cell"),i.classList.remove("st-header-selected");else for(const t of je.HEADER_SELECTION_CLASSES)i.classList.remove(t)}}clearHeaderSelectionHighlightClasses(){var t;if(!this.config.selectableColumns&&!this.config.selectableCells)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 je.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 i=parseInt(n.getAttribute("data-row-index")||"-1",10),o=parseInt(n.getAttribute("data-col-index")||"-1",10),s=n.getAttribute("data-row-id");if(0>i||0>o||!s)continue;const r={rowIndex:i,colIndex:o,rowId:s},l=this.isSelected(r),a=this.selectedColumns.has(o),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 je.SELECTION_CLASSES){const e=u.has(t),i=n.classList.contains(t);e&&!i?n.classList.add(t):!e&&i&&n.classList.remove(t)}const f=c?"0":"-1";if(n.getAttribute("tabindex")!==f&&n.setAttribute("tabindex",f),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 je.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 i=n+"";if(this.selectedByRowIdColIndex.has(`${i}\t${t}`))return!0;const o=this.rowIdToTableIndex.get(i);if(void 0!==o){const e=Fe({rowIndex:o,colIndex:t,rowId:i});if(this.selectedCells.has(e))return!0}const s=Fe({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(s)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var i;if(this.isSelecting)return"";const o=null!==(i=this.rowIdToTableIndex.get(n+""))&&void 0!==i?i:e;if(this.fullTableSelected){const e=this.config.enableRowSelection?1:0,n=this.config.enableRowSelection?this.leafHeaders.length:this.leafHeaders.length-1,i=[];return 0===o&&i.push("st-selected-top-border"),o===this.config.tableRows.length-1&&i.push("st-selected-bottom-border"),t===e&&i.push("st-selected-left-border"),t===n&&i.push("st-selected-right-border"),i.join(" ")}const s=[],r=this.config.tableRows[o-1],l=r?pt(r.rowId):null,a=this.config.tableRows[o+1],d=a?pt(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:o-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:o+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:o,rowId:n}),f=this.isSelected({colIndex:t+1,rowIndex:o,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===o)&&s.push("st-selected-top-border"),(!d||!h||this.selectedColumns.has(t)&&o===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),u||s.push("st-selected-left-border"),f||s.push("st-selected-right-border"),s.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 i=Fe({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(i)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const i=Fe({colIndex:t,rowIndex:e,rowId:n});return this.warningFlashCells.has(i)}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=Fe(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>$e(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Le(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.startCell=t,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>$e(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=Le(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.initialFocusedCell=e,this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}getCellFromMousePosition(t,e){var n;return function(t,e,n=document){const i=document.elementFromPoint(t,e);if(!i)return null;const o=i.closest(".st-cell");if(o instanceof HTMLElement){if(!n.contains(o))return De(t,e,n);const i=parseInt(o.getAttribute("data-row-index")||"-1",10),s=parseInt(o.getAttribute("data-col-index")||"-1",10),r=o.getAttribute("data-row-id");if(i>=0&&s>=0&&null!==r)return{rowIndex:i,colIndex:s,rowId:r}}return De(t,e,n)}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:document)}handleAutoScroll(t,e){var n;!function(t,e,n=document){const i=n.querySelector(".st-body-container");if(!i)return;const o=i.getBoundingClientRect(),s=Math.max(0,i.scrollHeight-i.clientHeight);o.top+50>e?i.scrollTop=Math.max(0,i.scrollTop-10*Math.min(3,1+Math.max(0,o.top-e)/100)):e>o.bottom-50&&(i.scrollTop=Math.min(s,i.scrollTop+10*Math.min(3,1+Math.max(0,e-o.bottom)/100)));const r=n.querySelector(".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);o.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,o.left-t)/100)):t>o.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-o.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}){if(!this.config.selectableCells)return;this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n};const i=Fe({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([i]),setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells.size>1||(this.selectedCells=new Set([i]),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(t,e,n){var i;if(this.config.selectableCells&&this.isSelecting&&this.startCell){const o=null!==(i=this.getCellFromMousePosition(e,n))&&void 0!==i?i:t;this.updateSelectionRange(this.startCell,o)}}}je.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"],je.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Ne=t=>!(!t.enableRowSelection||(!t.rowButtons||0>=t.rowButtons.length)&&!1===t.showRowSelectionColumn),Be=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(pt(t.rowId))).map(t=>t.row);class ze{constructor(t){this.subscribers=new Set,this.anchorRowId=null,this.keydownHandler=null,this.config=Object.assign({rowSelectionMode:"multiple",selectRowOnClick:!1,showRowSelectionColumn:!0,selectableCells:!1},t),this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[],activeRowId:null},this.setupKeyboardNavigation()}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}getMode(){var t;return null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple"}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Be(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))}fireChange(t,e,n){if(!this.config.onRowSelectionChange)return;const i=this.config.tableRows.find(e=>pt(e.rowId)===t);i&&this.config.onRowSelectionChange({row:i.row,isSelected:e,selectedRows:n})}applySelection(t){const e=this.state.selectedRows;this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.config.onRowSelectionChange&&new Set([...e,...t]).forEach(n=>{const i=e.has(n),o=t.has(n);i!==o&&this.fireChange(n,o,t)}),this.notifySubscribers()}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&"single"!==this.getMode()&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(pt(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}getRow(t){return((t,e)=>{const n=this.config.tableRows.find(t=>null!=(null==t?void 0:t.rowId)&&pt(t.rowId)===e);return null==n?void 0:n.row})(0,t)}getActiveRowId(){return this.state.activeRowId}setActiveRowId(t){this.state.activeRowId!==t&&(this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.notifySubscribers())}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=this.getMode(),i=((t,e,n,i="multiple")=>{if("single"===i){if(e)return new Set([t]);const i=new Set(n);return i.delete(t),i}const o=new Set(n);return e?o.add(t):o.delete(t),o})(t,e,this.state.selectedRows,n);i.size===this.state.selectedRows.size&&[...i].every(t=>this.state.selectedRows.has(t))||(this.anchorRowId=t,this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.applySelection(i))}selectRow(t){this.handleRowSelect(t,!0)}deselectRow(t){this.handleRowSelect(t,!1)}handleSelectAll(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return;let e;e=t?new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>pt(t.rowId))):new Set,this.applySelection(e)}handleToggleRow(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return void this.handleRowSelect(t,!0);const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}handleRowClickSelect(t){this.config.enableRowSelection&&this.config.selectRowOnClick&&this.handleToggleRow(t)}clearSelection(){this.config.enableRowSelection&&0!==this.state.selectedRows.size&&this.applySelection(new Set)}getState(){return this.state}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}isEventInsideTable(t){const e=this.config.tableRoot;if(!e)return!1;const n=t.target;return n instanceof Node&&e.contains(n)}isTypingInFormField(){const t=document.activeElement;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||"true"===(null==t?void 0:t.getAttribute("contenteditable"))}findRowIndex(t){return t?this.config.tableRows.findIndex(e=>pt(e.rowId)===t):-1}resolveActiveRowId(){if(this.state.activeRowId&&-1!==this.findRowIndex(this.state.activeRowId))return this.state.activeRowId;for(const t of this.state.selectedRows)if(-1!==this.findRowIndex(t))return t;const t=this.config.tableRows[0];return t?pt(t.rowId):null}moveActiveRow(t,e){var n;const i=this.config.tableRows;if(0===i.length)return;const o=Math.max(0,Math.min(i.length-1,t)),s=pt(i[o].rowId),r=this.getMode();if(this.state=Object.assign(Object.assign({},this.state),{activeRowId:s}),e&&"multiple"===r){const t=null!==(n=this.anchorRowId)&&void 0!==n?n:s,e=this.findRowIndex(t),r=((t,e,n)=>{const i=Math.min(e,n),o=Math.max(e,n),s=new Set([]);for(let e=i;o>=e;e++){const n=t[e];null!=(null==n?void 0:n.rowId)&&s.add(pt(n.rowId))}return s})(i,-1===e?o:e,o);return void this.applySelection(r)}this.anchorRowId=s,"single"===r?this.applySelection(new Set([s])):this.notifySubscribers()}handleKeyDown(t){var e,n,i;if(!this.config.enableRowSelection)return;if(!this.isEventInsideTable(t))return;if(this.isTypingInFormField())return;const o=!this.config.selectableCells,s=t.key;if(" "===s||"Spacebar"===s){if(t.target instanceof HTMLInputElement&&"checkbox"===t.target.type)return;t.preventDefault();const o=this.resolveActiveRowId();if(o){const t=null===(n=null===(e=document.activeElement)||void 0===e?void 0:e.closest)||void 0===n?void 0:n.call(e,"[data-row-id]"),s=null!==(i=null==t?void 0:t.getAttribute("data-row-id"))&&void 0!==i?i:o;this.handleToggleRow(s),this.state=Object.assign(Object.assign({},this.state),{activeRowId:s})}return}if(!o)return;if((t.ctrlKey||t.metaKey)&&"a"===s.toLowerCase())return void("multiple"===this.getMode()&&(t.preventDefault(),this.handleSelectAll(!0)));const r=this.resolveActiveRowId(),l=this.findRowIndex(r),a=this.config.tableRows.length-1;if(0>a)return;const d=t.shiftKey;"ArrowUp"===s?(t.preventDefault(),this.moveActiveRow(l>0?l-1:0,d)):"ArrowDown"===s?(t.preventDefault(),this.moveActiveRow(0>l?0:Math.min(a,l+1),d)):"Home"===s?(t.preventDefault(),this.moveActiveRow(0,d)):"End"===s&&(t.preventDefault(),this.moveActiveRow(a,d))}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.subscribers.clear()}}class Ve{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 qe{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,i,o,s,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!==(i=null===(n=(e=this.config).getSelectedCells)||void 0===n?void 0:n.call(e))&&void 0!==i?i:this.config.selectedCells,l=null!==(r=null===(s=(o=this.config).getSelectedColumns)||void 0===s?void 0:s.call(o))&&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 Ge{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(){if(this.headerContainer)if(this.isMainSectionScrollable){const t=null!=this.mainSection?this.mainSection.offsetWidth-this.mainSection.clientWidth:this.scrollbarWidth;this.scrollbarWidth=t,this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",t+"px")}else 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 Ke=(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 _e{constructor(t,e){this.observers=new Set,this.notifyMicrotaskScheduled=!1,this.expandedDepths=Ke(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.notifyMicrotaskScheduled||(this.notifyMicrotaskScheduled=!0,queueMicrotask(()=>{this.notifyMicrotaskScheduled=!1,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 Ue{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 Je(t){return t?t.offsetWidth-t.clientWidth:0}const Ye=(t,e,n)=>{var i;const o=document.createElement("div");o.className="st-dropdown-content",o.style.position=n.positioning||"fixed",o.style.zIndex="1000",o.style.visibility="hidden",o.style.overflow=null!==(i=n.overflow)&&void 0!==i?i:"auto",n.width&&(o.style.width=n.width+"px"),n.maxHeight&&(o.style.maxHeight=n.maxHeight+"px"),o.appendChild(e);const s=t.closest(".simple-table-root")||document.querySelector(".simple-table-root");"fixed"===n.positioning?s?s.appendChild(o):document.body.appendChild(o):t.appendChild(o),requestAnimationFrame(()=>{const{position:e,placement:i}=((t,e,n)=>{const i=t.getBoundingClientRect(),o=window.innerHeight,s=window.innerWidth,r=o-i.bottom,l=s-i.left;let a="bottom";e.offsetHeight>r&&i.top>r&&(a="top");let d="left";(n.width||e.offsetWidth)>l&&i.right>l&&(d="right");const c={};return"fixed"===n.positioning?("bottom"===a?c.top=i.bottom+4:c.bottom=o-i.top+4,"left"===d?c.left=i.left:c.right=s-i.right):("bottom"===a?c.top=i.height+4:c.bottom=i.height+4,"left"===d?c.left=0:c.right=0),{position:c,placement:`${a}-${d}`}})(t,o,n);o.className="st-dropdown-content st-dropdown-"+i,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(o.style[t]=e+"px")}),o.style.visibility="visible"});const r=e=>{const n=e.target;o.contains(n)||t.contains(n)||d()},l=t=>{"Escape"===t.key&&(t.preventDefault(),d())},a=t=>{o.contains(t.target)||d()},d=()=>{o.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),h(o,"mousedown",t=>{t.stopPropagation()}),o},Xe=({className:t,width:e=20,height:n=20,paths:i,circles:o=[],strokeWidth:s=2})=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true"),r.setAttribute("role","img"),r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("width",e+""),r.setAttribute("height",n+""),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width",s+""),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),t&&r.setAttribute("class",t);for(const t of i){const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d",t),e.setAttribute("fill","none"),r.appendChild(e)}for(const{cx:t,cy:e,r:n}of o){const i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",t+""),i.setAttribute("cy",e+""),i.setAttribute("r",n+""),i.setAttribute("fill","currentColor"),i.setAttribute("stroke","none"),r.appendChild(i)}return r},Qe=t=>Xe({className:t,paths:["m15 18-6-6 6-6"]}),Ze=t=>Xe({className:t,paths:["m9 18 6-6-6-6"]}),tn=t=>Xe({className:t,paths:["m5 12 7-7 7 7","M12 19V5"]}),en=t=>Xe({className:t,paths:["M12 5v14","m19 12-7 7-7-7"]}),nn=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","16"),e.setAttribute("height","10"),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 i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",t),i.setAttribute("cy",n),i.setAttribute("r","1.5"),i.setAttribute("fill","currentColor"),e.appendChild(i)}),e},on=(t,e)=>new Date(t,e+1,0).getDate(),sn=["January","February","March","April","May","June","July","August","September","October","November","December"],rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ln=["Su","Mo","Tu","We","Th","Fr","Sa"],an=(t,e,n)=>{const{header:i,row:o}=t,s=ct(o,i.accessor);return"boolean"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:l}=t;let a;const d=document.createElement("div");d.className="st-dropdown-item "+(!0===n?"selected":""),d.textContent="True",d.setAttribute("role","option"),d.setAttribute("aria-selected",(!0===n)+""),d.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 u=t=>{ut(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),a.remove(),i()};h(d,"click",()=>u(!0)),h(c,"click",()=>u(!1));const f=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===d?c.focus():d.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===d?u(!0):document.activeElement===c&&u(!1))};d.setAttribute("tabindex","0"),c.setAttribute("tabindex","0"),h(d,"keydown",f),h(c,"keydown",f);const v=document.createDocumentFragment();v.appendChild(d),v.appendChild(c);const p=ot({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(p);return a=Ye(w||document.body,v,{width:120,positioning:"fixed",onClose:i}),a})(t,e,!!s,n):"enum"===i.type?((t,e,n,i)=>{var o;const{header:s,row:r,rowIndex:l}=t,a=s.enumOptions||[];let d;const c=t=>{ut(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),d.remove(),i()},u=[];a.forEach((t,e)=>{const i=document.createElement("div");i.className="st-dropdown-item "+(n===t.value?"selected":""),i.textContent=t.label,i.setAttribute("role","option"),i.setAttribute("aria-selected",(n===t.value)+""),i.setAttribute("aria-disabled","false"),i.setAttribute("tabindex","0"),i.dataset.value=t.value,h(i,"click",()=>c(t.value)),u.push(i)});const f=t=>{const e=t,n=u.findIndex(t=>t===document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),u[(n+1)%u.length].focus();else if("ArrowUp"===e.key)e.preventDefault(),u[(n-1+u.length)%u.length].focus();else if("Enter"===e.key){e.preventDefault();const t=document.activeElement.dataset.value;t&&c(t)}};u.forEach(t=>{h(t,"keydown",f)});const v=document.createElement("div");v.className="st-enum-dropdown-content",u.forEach(t=>v.appendChild(t));const p=ot({accessor:s.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId}),w=document.getElementById(p);return d=Ye(w||document.body,v,{width:150,maxHeight:300,positioning:"fixed",onClose:i}),setTimeout(()=>{const t=a.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),d})(t,e,(s||"")+"",n):"date"===i.type?((t,e,n,i)=>{var o,s,r;const{header:l,row:a,rowIndex:d}=t;let c,u;try{u=n?Zt(n+""):new Date}catch(t){u=new Date}let f=u.getFullYear(),v=u.getMonth(),p="days";const w=document.createElement("div");w.className="st-datepicker";const m=null!==(o=e.icons.prev)&&void 0!==o?o:Qe("st-next-prev-icon"),g=null!==(s=e.icons.next)&&void 0!==s?s:Ze("st-next-prev-icon"),b=(t,e)=>{"string"==typeof e?t.innerHTML=e:t.appendChild(e.cloneNode(!0))},x=t=>{const n=t.toISOString().split("T")[0];ut(a,l.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:l.accessor,newValue:n,row:a,rowIndex:d}),c.remove(),i()},y=()=>{w.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===p){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.setAttribute("aria-label","Previous month"),b(e,m),h(e,"click",()=>{v--,0>v&&(v=11,f--),y()});const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${sn[v]} ${f}`;const i=()=>{p="months",y()};h(n,"click",i),h(n,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.setAttribute("aria-label","Next month"),b(o,g),h(o,"click",()=>{v++,v>11&&(v=0,f++),y()}),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===p){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=f+"";const n=()=>{p="years",y()};h(e,"click",n),h(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n())}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}w.appendChild(t);const e=document.createElement("div");if(e.className=`st-datepicker-grid st-datepicker-${p}-grid`,"days"===p){ln.forEach(t=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=t,e.appendChild(n)});const t=on(f,v),n=new Date(f,v,1).getDay(),i=on(f,v-1),o=new Date;for(let t=0;n>t;t++){const o=i-n+t+1,s=new Date(f,v-1,o),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=o+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${sn[s.getMonth()]} ${o}, ${s.getFullYear()}`),h(r,"click",()=>x(s)),h(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(s))}),e.appendChild(r)}const s=u.getFullYear()===f&&u.getMonth()===v;for(let n=1;t>=n;n++){const t=document.createElement("div");t.className="st-datepicker-day",t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",`${sn[v]} ${n}, ${f}`),o.getFullYear()===f&&o.getMonth()===v&&o.getDate()===n&&t.classList.add("today"),s&&u.getDate()===n&&t.classList.add("selected");const i=new Date(f,v,n);h(t,"click",()=>x(i)),h(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(i))}),e.appendChild(t)}const r=n+t,l=Math.max(35,7*Math.ceil(r/7))-r;for(let t=1;l>=t;t++){const n=new Date(f,v+1,t),i=document.createElement("div");i.className="st-datepicker-day other-month",i.textContent=t+"",i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",`${sn[n.getMonth()]} ${t}, ${n.getFullYear()}`),h(i,"click",()=>x(n)),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(n))}),e.appendChild(i)}}else if("months"===p)rn.forEach((t,n)=>{const i=document.createElement("div");i.className="st-datepicker-month"+(n===v?" selected":""),i.textContent=t,i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",sn[n]);const o=()=>{v=n,p="days",y()};h(i,"click",o),h(i,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),e.appendChild(i)});else{const t=f-6;for(let n=t;t+12>n;n++){const t=document.createElement("div");t.className="st-datepicker-year"+(n===f?" selected":""),t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",n+"");const i=()=>{f=n,p="months",y()};h(t,"click",i),h(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())}),e.appendChild(t)}}w.appendChild(e);const n=document.createElement("div");n.className="st-datepicker-footer";const i=document.createElement("button");i.className="st-datepicker-today-btn",i.textContent="Today",h(i,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);x(e)}),n.appendChild(i),w.appendChild(n)};y();const R=ot({accessor:l.accessor,rowId:null!==(r=t.stableRowKey)&&void 0!==r?r:t.rowId}),S=document.getElementById(R);return c=Ye(S||document.body,w,{width:280,overflow:"hidden",positioning:"fixed",onClose:i}),c})(t,e,s,n):((t,e,n,i)=>{const{header:o,row:s,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===o.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"===o.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};h(l,"input",t)}return h(l,"blur",t=>{if(!a)return void i();let n=l.value;if("number"===o.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}ut(s,o.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:o.accessor,newValue:n,row:s,rowIndex:r}),i()}),h(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),h(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,s,n)};let dn=0;const cn=(t,e,n,i)=>{t.checked=n,t.indeterminate=i,t.setAttribute("aria-checked",i?"mixed":n+""),e.className="st-checkbox-custom "+(i?"st-indeterminate":n?"st-checked":""),e.setAttribute("aria-hidden","true"),e.innerHTML="",i?e.appendChild(Xe({className:"st-checkbox-minus",width:12,height:12,strokeWidth:2.5,paths:["M5 12h14"]})):n&&e.appendChild(Xe({className:"st-checkbox-checkmark",width:12,height:12,strokeWidth:2.5,paths:["M20 6 9 17l-5-5"]}))},hn=(t,e,n=!1)=>{const i=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");i&&o&&(i.checked===e&&i.indeterminate===n&&i.getAttribute("aria-checked")===(n?"mixed":e+"")||cn(i,o,e,n))},un=({checked:t,indeterminate:e=!1,onChange:n,ariaLabel:i})=>{const o=document.createElement("label");o.className="st-checkbox-label";const s=document.createElement("input");s.type="checkbox",s.className="st-checkbox-input",i&&s.setAttribute("aria-label",i);const r=document.createElement("span");cn(s,r,t,e);const l=()=>{cn(s,r,s.checked,!1),n(s.checked)};return s.addEventListener("change",l),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(r),{element:o,update:(t,e=!1)=>{s.checked===t&&s.indeterminate===e||cn(s,r,t,e)},destroy:()=>{s.removeEventListener("change",l)}}},fn=new WeakMap,vn=new WeakMap,pn=new WeakSet,wn=(t,e,n)=>{const i=t.querySelector(".st-expand-icon-container");if(!(i&&i instanceof HTMLElement))return;if(i.classList.contains("placeholder"))return;const o=i.classList.contains("expanded");vn.set(i,{desired:e,options:n}),pn.has(i)||(o!==e?(pn.add(i),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var t,e,n,o;pn.delete(i);const s=vn.get(i);if(vn.delete(i),!s)return;const r=s.desired;if(i.classList.contains("expanded")===r)return;const l=null!==(e=null===(t=s.options)||void 0===t?void 0:t.ariaLabelWhenExpanded)&&void 0!==e?e:"Collapse row",a=null!==(o=null===(n=s.options)||void 0===n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==o?o:"Expand row";i.classList.toggle("expanded",r),i.classList.toggle("collapsed",!r),i.setAttribute("aria-label",r?l:a),i.setAttribute("aria-expanded",r+"")})})):vn.delete(i))},mn=(t,e,n,i,o)=>{if(e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:n,row:i,rowIndex:o,value:t});return"object"==typeof s&&null!==s?t+"":s+""}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)?ee(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},gn=(t,e,n)=>{var i;const{header:o,row:s,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=ct(s,o.accessor),u=o.isSelectionColumn&&e.enableRowSelection;if(t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(u){const i=document.createElement("div");i.className="st-selection-cell-content";const o=document.createElement("div");o.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>un({checked:n,onChange:n=>{var i;null===(i=e.handleRowSelect)||void 0===i||i.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,s);o.appendChild(r),i.appendChild(o);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 i={row:t.row,rowIndex:t.displayRowNumber};return e.rowButtons.forEach((t,e)=>{try{const e=t(i);if(!e)return;const o=document.createElement("span");o.className="st-row-button",o.appendChild(e),n.appendChild(o)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&i.appendChild(l),void n.appendChild(i)}const f=e.rowGrouping&&e.rowGrouping[a],v=!!f&&yt(s,f),p=!(!e.rowGrouping||a>=e.rowGrouping.length),w=!e.canExpandRowGroup||e.canExpandRowGroup(s),m=o.expandable&&(v&&p&&w||!!o.nestedTable||!!e.onRowGroupExpand&&p&&w);if(m||o.expandable&&p){const i=new Set(e.expandedDepths),o=bt(t.tableRow),s=((t,e,n,i)=>{const o=!0===(null==i?void 0:i.placeholder),s=document.createElement("div");s.className="st-icon-container st-expand-icon-container "+(o?"placeholder":n?"expanded":"collapsed");const r=e.icons.expand;if(r&&("string"==typeof r?s.innerHTML=r:(r instanceof HTMLElement||r instanceof SVGSVGElement)&&s.appendChild(r.cloneNode(!0))),o)return s.setAttribute("role","presentation"),s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex","-1"),s;s.setAttribute("role","button"),s.setAttribute("aria-label",n?"Collapse row":"Expand row"),s.setAttribute("aria-expanded",n+""),s.setAttribute("tabindex","0");const l=n=>{var i,o;n.stopPropagation();const r=s.closest("[data-row-id]"),l=r?fn.get(r):void 0,a=null!==(i=null==l?void 0:l.tableRow)&&void 0!==i?i:t.tableRow,d=null!==(o=null==l?void 0:l.row)&&void 0!==o?o:t.row,c=bt(a),h=a.depth,u=new Set(e.expandedDepths),f=e.getExpandedRows?e.getExpandedRows():e.expandedRows,v=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=Rt(c,h,u,f,v),w=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(c),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(c),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(c,h),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(c),e})),e.onRowGroupExpand&&a.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,i=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{loading:t,triggerSection:n})),i})},0)},o=t=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{error:t,loading:!1,triggerSection:n})),i})},s=(t,i)=>{e.setRowStateMap(e=>{const i=new Map(e),o=i.get(c)||{};return i.set(c,Object.assign(Object.assign({},o),{isEmpty:t,loading:!1,triggerSection:n})),i})};e.onRowGroupExpand({row:d,depth:h,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[h],isExpanded:w,rowIndexPath:a.rowIndexPath,rowIdPath:a.rowPath,groupingKeys:e.rowGrouping,setLoading:i,setError:o,setEmpty:s})}};return h(s,"click",l),h(s,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l(t))}),s})(t,e,Rt(o,a,i,e.expandedRows,e.collapsedRows),{placeholder:!m});n.appendChild(s)}if("lineAreaChart"===o.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:i=30,color:o,fillColor:s,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const h="st-line-area-gradient-"+ ++dn,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("width",n+""),u.setAttribute("height",i+""),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("class",("st-line-area-chart "+a).trim()),u.style.display="block";let f="number"==typeof n?n:100;const v=()=>{u.innerHTML="";const t=f,n=i;u.setAttribute("viewBox",`0 0 ${t} ${n}`);const a=void 0!==d?d:Math.min(...e),v=(void 0!==c?c:Math.max(...e))-a||1,p=l/2+.5,w=Math.max(1,t-2*p),m=Math.max(1,n-2*p),g=e.map((t,n)=>({x:1===e.length?p+w/2:p+n/(e.length-1)*w,y:p+m-(t-a)/v*m})),b=g.map((t,e)=>`${0===e?"M":"L"} ${t.x.toFixed(2)},${t.y.toFixed(2)}`).join(" "),x=g[0].x,y=`${b} L ${g[g.length-1].x.toFixed(2)},${n} L ${x.toFixed(2)},${n} Z`,R=s||"var(--st-chart-fill-color)",S=document.createElementNS("http://www.w3.org/2000/svg","defs"),C=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");C.setAttribute("id",h),C.setAttribute("x1","0"),C.setAttribute("y1","0"),C.setAttribute("x2","0"),C.setAttribute("y2","1");const M=document.createElementNS("http://www.w3.org/2000/svg","stop");M.setAttribute("offset","0%"),M.style.stopColor=R,M.setAttribute("stop-opacity",r+"");const I=document.createElementNS("http://www.w3.org/2000/svg","stop");I.setAttribute("offset","100%"),I.style.stopColor=R,I.setAttribute("stop-opacity",.15*r+""),C.appendChild(M),C.appendChild(I),S.appendChild(C),u.appendChild(S);const H=document.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("d",y),H.setAttribute("fill",`url(#${h})`),H.setAttribute("stroke","none");const k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",b),k.setAttribute("fill","none"),k.setAttribute("stroke",o||"var(--st-chart-color)"),k.setAttribute("stroke-width",l+""),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),u.appendChild(H),u.appendChild(k)};v();const p="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-f)>=.5&&(f=i,v())}):null;return null==p||p.observe(u),{element:u,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,u.setAttribute("width",n+""),"number"==typeof n&&(f=n)),void 0!==t.height&&(i=t.height,u.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.fillColor&&(s=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,u.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):u.innerHTML=""},destroy:()=>{null==p||p.disconnect(),u.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===o.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:i=30,color:o,gap:s=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",n+""),d.setAttribute("height",i+""),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("class",("st-bar-chart "+r).trim()),d.style.display="block";let c="number"==typeof n?n:100;const h=()=>{d.innerHTML="";const t=c,n=i;d.setAttribute("viewBox",`0 0 ${t} ${n}`);const r=void 0!==l?l:Math.min(...e),h=void 0!==a?a:Math.max(...e),u=h-r||1,f=e.length;let v=Math.max(0,s);f>1&&1>(t-v*(f-1))/f&&(v=Math.max(0,Math.floor((t-f)/(f-1))));const p=(t-v*(f-1))/f,w=p+v,m=0>r,g=m?n*(h/u):n;e.forEach((t,e)=>{let i,s;m?0>t?(i=g,s=g+Math.abs(t)/u*n):(i=g-t/u*n,s=g):(i=n-(t-r)/u*n,s=n);const l=Math.round(e*w),a=Math.max(l+1,Math.round(e*w+p)),c=Math.round(i),h=Math.max(c+1,Math.round(s)),f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("x",l+""),f.setAttribute("y",c+""),f.setAttribute("width",a-l+""),f.setAttribute("height",h-c+""),f.setAttribute("fill",o||"var(--st-chart-color)"),f.setAttribute("rx",Math.min(1,(a-l)/3)+""),d.appendChild(f)})};h();const u="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const i=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;i>0&&Math.abs(i-c)>=.5&&(c=i,h())}):null;return null==u||u.observe(d),{element:d,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,d.setAttribute("width",n+""),"number"==typeof n&&(c=n)),void 0!==t.height&&(i=t.height,d.setAttribute("height",i+"")),void 0!==t.color&&(o=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,d.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),h()):d.innerHTML=""},destroy:()=>{null==u||u.disconnect(),d.remove()}}})(Object.assign({data:t,width:"100%",height:30},o.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(o.cellRenderer){try{const a=o.cellRenderer({accessor:o.accessor,colIndex:l,row:s,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:c,formattedValue:null===(i=o.valueFormatter)||void 0===i?void 0:i.call(o,{accessor:o.accessor,colIndex:l,row:s,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=mn(c,o,l,s,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=mn(c,o,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const g=mn(c,o,l,s,r);if(null!==g){const t=document.createTextNode(g);n.appendChild(t)}},bn=new Map,xn=new Map,yn=new WeakMap,Rn=new WeakMap,Sn=new WeakMap,Cn=(t,e,n)=>{yn.set(e,n);const i=(t=>{let e=bn.get(t);return e||(e=new Map,bn.set(t,e)),e})(n);i.has(t)||i.set(t,new Set),i.get(t).add(e)},Mn=(t,e)=>{const n=yn.get(e);if(!n)return;yn.delete(e);const i=bn.get(n);if(!i)return;const o=i.get(t);o&&(o.delete(e),0===o.size&&i.delete(t)),0===i.size&&(bn.delete(n),xn.delete(n))},In=(t,e,n)=>{var i;const o=null===(i=bn.get(n))||void 0===i?void 0:i.get(t);o&&o.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},Hn=(t,e)=>{var n,i,o;const{header:s,rowIndex:r,colIndex:l,rowId:a,depth:d,isOdd:c}=t,h=s.isSelectionColumn&&e.enableRowSelection,u=!!(null==s?void 0:s.editable)||!(!e.onCellClick||h)||!(!e.selectRowOnClick||!e.enableRowSelection||h),f={rowIndex:r,colIndex:l,rowId:a},v=e.getBorderClass(f),p=e.isSelected(f),w=e.isInitialFocusedCell(f),m=e.isCopyFlashing(f),g=e.isWarningFlashing(f),b=e.selectedColumns.has(l),x=p&&!b,y=h&&e.rowsWithSelectedCells.has(a+""),R=(()=>{var t,n,i;if(!e.columnBorders)return!1;const o=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===s.pinned?(null===(t=o[o.length-1])||void 0===t?void 0:t.accessor)===s.accessor:"right"===s.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===s.accessor:(null===(i=r[r.length-1])||void 0===i?void 0:i.accessor)===s.accessor})();return["st-cell","st-row-position-"+t.tableRow.position,d>0&&s.expandable?"st-cell-depth-"+d:"",x?w?"st-cell-selected-first "+v:"st-cell-selected "+v:"",b?w?"st-cell-column-selected-first":"st-cell-column-selected":"",u?"clickable":"",m?w?"st-cell-copy-flash-first":"st-cell-copy-flash":"",g?w?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.oddColumnBackground?l%2==0?"even-column":"odd-column":"",h?"st-selection-cell":"",y?"st-selection-has-highlighted-cell":"",R?"st-last-column":"","",e.oddEvenRowBackground?c?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,a))?"st-cell-selected-row":"",null!=e.activeRowId&&e.activeRowId+""==a+""?"st-row-active":"",null!==(i=s.cellClass)&&void 0!==i?i:"",...kn(null===(o=e.getRowClass)||void 0===o?void 0:o.call(e,{row:t.row,rowId:a,position:t.tableRow.position,depth:d}))].filter(Boolean).join(" ")},kn=t=>{if(null==t)return[];const e=Array.isArray(t)?t:[t],n=[];for(const t of e)if("string"==typeof t)for(const e of t.trim().split(/\s+/))e&&n.push(e);return n},Tn=(t,e)=>{var n,i,o;const{header:s,row:r,rowIndex:l,colIndex:a,rowId:d}=t,c=s.isSelectionColumn&&e.enableRowSelection,u={rowIndex:l,colIndex:a,rowId:d},f=e.isInitialFocusedCell(u),v=Hn(t,e),p=document.createElement("div");p.className=v,p.id=ot({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d}),p.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),p.setAttribute("tabindex",f?"0":"-1");const w=null!==(i=e.maxHeaderDepth)&&void 0!==i?i:1;p.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),p.setAttribute("aria-colindex",a+1+""),e.enableRowSelection&&p.setAttribute("aria-selected",(null===(o=e.isRowSelected)||void 0===o?void 0:o.call(e,d))?"true":"false"),p.setAttribute("data-row-index",l+""),p.setAttribute("data-col-index",a+""),p.setAttribute("data-row-id",d+""),p.setAttribute("data-accessor",s.accessor+""),p.style.position="absolute",p.style.left=t.left+"px",p.style.top=t.top+"px",p.style.width=t.width+"px",p.style.height=t.height+"px";let m=!1;const g="boolean"===s.type||"date"===s.type||"enum"===s.type,b=()=>{var n,i,o,r;const l=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.context)&&void 0!==i?i:e;if(m&&!g){null===(o=l.onRendererHostDiscard)||void 0===o||o.call(l,p),p.innerHTML="",p.setAttribute("tabindex","-1");const e=an(t,l,()=>{m=!1,p.setAttribute("tabindex",f?"0":"-1"),b(),y()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),p.appendChild(t)}}else if(m&&g)an(t,l,()=>{m=!1,b(),y()});else{null===(r=l.onRendererHostDiscard)||void 0===r||r.call(l,p),p.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),gn(t,l,e),p.appendChild(e)}};b(),t.header.expandable||Sn.set(p,{row:t.row,value:ct(r,s.accessor),theme:e.theme,skeleton:!!t.tableRow.isLoadingSkeleton});const x={row:r,tableRow:t.tableRow,context:e};fn.set(p,x);const y=()=>{var n;if(e.cellRegistry&&!c){const i=ot({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d});Rn.set(p,i),e.cellRegistry.set(i,{updateContent:t=>{var n,i;if(!m){if(ut(x.row,s.accessor,t),b(),!s.expandable){const t=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.context)&&void 0!==i?i:e;Sn.set(p,{row:x.row,value:ct(x.row,s.accessor),theme:t.theme,skeleton:!!x.tableRow.isLoadingSkeleton})}e.cellUpdateFlash&&(p.classList.add(f?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{p.classList.remove("st-cell-updating-first","st-cell-updating")},800))}}})}};if(y(),!m&&!c){const t=t=>{var n,i;const o=t.target;if(o.closest("a, button, input, select, textarea, [contenteditable='true']"))return;if(t.preventDefault(),o.closest(".st-expand-icon-container"))return;const s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=p.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=p.getAttribute("data-row-id");0>s||0>r||null===l||e.handleMouseDown({rowIndex:s,colIndex:r,rowId:l})},n=t=>{var n,i;const o=t,s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(i=p.getAttribute("data-col-index"))&&void 0!==i?i:"-1",10),l=p.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?u:{rowIndex:s,colIndex:r,rowId:l},o.clientX,o.clientY)};h(p,"mousedown",t),h(p,"mouseover",n)}if(h(p,"keydown",t=>{m||c||"F2"!==t.key&&"Enter"!==t.key||!s.editable||m||(t.preventDefault(),m=!0,b())}),h(p,"dblclick",t=>{!s.editable||c||m||(m=!0,b())}),(e.onCellClick||e.selectRowOnClick)&&!c){const t=t=>{var n,i,o,c,h,u,f,v;if(t.target.closest(".st-expand-icon-container"))return;const w=null!==(i=null===(n=fn.get(p))||void 0===n?void 0:n.row)&&void 0!==i?i:r,m=null!==(c=null===(o=fn.get(p))||void 0===o?void 0:o.context)&&void 0!==c?c:e,g=null!==(h=p.getAttribute("data-row-id"))&&void 0!==h?h:d+"";if(m.selectRowOnClick&&m.enableRowSelection&&(null===(u=m.handleToggleRow)||void 0===u||u.call(m,g)),m.onCellClick){const t=ct(w,s.accessor),e=parseInt(null!==(f=p.getAttribute("data-row-index"))&&void 0!==f?f:l+"",10),n=parseInt(null!==(v=p.getAttribute("data-col-index"))&&void 0!==v?v:a+"",10);m.onCellClick({accessor:s.accessor,colIndex:n,row:w,rowIndex:e,value:t})}};h(p,"click",t)}if(e.hoverRowBackground){const t=d+"",n=e.hoverScopeId;Cn(t,p,n);const i=()=>{var e,i,o;const s=null!==(e=yn.get(p))&&void 0!==e?e:n,r=null!==(i=p.getAttribute("data-row-id"))&&void 0!==i?i:t,l=null!==(o=xn.get(s))&&void 0!==o?o:null;null!==l&&l!==r&&In(l,!1,s),In(r,!0,s),xn.set(s,r)},o=()=>{var e,i,o;const s=null!==(e=yn.get(p))&&void 0!==e?e:n,r=null!==(i=p.getAttribute("data-row-id"))&&void 0!==i?i:t;In(r,!1,s),(null!==(o=xn.get(s))&&void 0!==o?o:null)===r&&xn.set(s,null)};h(p,"mouseenter",i),h(p,"mouseleave",o)}return p},En=(t,e,n)=>{var i,o,s,r,l,a;const{rowIndex:d,colIndex:c,rowId:h}=e,u={rowIndex:d,colIndex:c,rowId:h};t.className=Hn(e,n);const f=n.isInitialFocusedCell(u);t.setAttribute("tabindex",f?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const v=t.dataset.stAccordionGrow;"horizontal"!==v&&(t.style.width=e.width+"px"),"vertical"!==v&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",d+""),t.setAttribute("data-col-index",c+"");const p=null!==(i=n.maxHeaderDepth)&&void 0!==i?i:1;t.setAttribute("aria-rowindex",e.tableRow.position+p+1+""),t.setAttribute("aria-colindex",c+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,h))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const w=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==w&&t.setAttribute("role",w);const m=t.getAttribute("data-row-id"),g=h+"";if(m&&m!==g){const e=null!==(s=yn.get(t))&&void 0!==s?s:n.hoverScopeId;Mn(m,t),Cn(g,t,e)}t.setAttribute("data-row-id",g),t.setAttribute("data-accessor",e.header.accessor+"");const b=fn.get(t);if(b?(b.row=e.row,b.tableRow=e.tableRow,b.context=n):fn.set(t,{row:e.row,tableRow:e.tableRow,context:n}),e.header.expandable){const i=t.querySelector(".st-cell-content");i&&!!e.tableRow.isLoadingSkeleton!=(null!==i.querySelector(".st-loading-skeleton"))&&(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,i),i.innerHTML="",gn(e,n,i))}else{const i=t.querySelector(".st-cell-content");if(i){const o=Sn.get(t),s=ct(e.row,e.header.accessor),r=!!e.tableRow.isLoadingSkeleton,d=i.querySelector("[data-st-portal-id]"),c=null!==d&&""===(null!==(l=d.textContent)&&void 0!==l?l:"").trim()&&0===d.childNodes.length;0!==i.childNodes.length&&!c&&void 0!==o&&o.row===e.row&&o.value===s&&o.theme===n.theme&&o.skeleton===r||(Sn.set(t,{row:e.row,value:s,theme:n.theme,skeleton:r}),null===(a=n.onRendererHostDiscard)||void 0===a||a.call(n,i),i.innerHTML="",gn(e,n,i))}}},An=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(An);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=An(t[n]));return e},Wn=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!Z(t)),On="st-accordion-animating",Pn="--st-accordion-duration",$n="--st-accordion-easing";function Fn(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function Ln(t,e){return!0===t.essential||e.has(t.accessor+"")}function Dn(t,e){let n=!1;for(const i of t){if(i.isSelectionColumn||Z(i))continue;const t=Ln(i,e);if(t&&n)return!1;t||(n=!0)}return!0}function jn(t,e){var n;const{pinnedLeft:i,unpinned:o,pinnedRight:s}=Fn(t);if(!Dn(i,e))return!1;if(!Dn(o,e))return!1;if(!Dn(s,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!Nn(i.children,e))return!1;return!0}function Nn(t,e){var n;if(!Dn(t,e))return!1;for(const i of t)if((null===(n=i.children)||void 0===n?void 0:n.length)&&!Nn(i.children,e))return!1;return!0}function Bn(t){const{pinnedLeft:e,unpinned:n,pinnedRight:i}=Fn(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:i.map(t=>t.accessor)}}function zn(t,e,n){return[...t.filter(t=>Ln(e.get(t+""),n)),...t.filter(t=>!Ln(e.get(t+""),n))]}function Vn(t,e,n){const i=new Set(t.map(t=>t.accessor+"")),o=[...e.left,...e.main,...e.right];if(o.length!==i.size)return null;for(const t of o)if(!i.has(t+""))return null;const s=new Map(t.map(t=>[t.accessor+"",t])),r=zn(e.left,s,n),l=zn(e.main,s,n),a=zn(e.right,s,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(s.get(t+""),"left")),...l.map(t=>d(s.get(t+""),void 0)),...a.map(t=>d(s.get(t+""),"right"))]}function qn(t,e,n,i){const o=e+"",s=Bn(t),r=s.left.filter(t=>t+""!==o),l=s.main.filter(t=>t+""!==o),a=s.right.filter(t=>t+""!==o),d=t.find(t=>t.accessor+""===o);return d&&(!Ln(d,i)||"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),Vn(t,{left:r,main:l,right:a},i)):null}class Gn{static resolveIcons(t){var e,n,i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g;const b={drag:nn("st-drag-icon"),expand:Ze("st-expand-icon"),filter:Xe({className:"st-header-icon",paths:["M3 6h18","M7 12h10","M10 18h4"]}),headerCollapse:Ze("st-header-icon"),headerExpand:Qe("st-header-icon"),next:Ze("st-next-prev-icon"),prev:Qe("st-next-prev-icon"),sortDown:en("st-header-icon"),sortUp:tn("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:b.drag,expand:null!==(o=null===(i=t.icons)||void 0===i?void 0:i.expand)&&void 0!==o?o:b.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:b.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:b.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:b.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:b.next,prev:null!==(v=null===(f=t.icons)||void 0===f?void 0:f.prev)&&void 0!==v?v:b.prev,sortDown:null!==(w=null===(p=t.icons)||void 0===p?void 0:p.sortDown)&&void 0!==w?w:b.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:b.sortUp}}static mergeCustomTheme(t){return Object.assign(Object.assign({},e),t.customTheme)}static mergeColumnEditorConfig(t){var e,n,i,o,s,r,l,a,d,c,h,u,f;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",showToggle:null===(o=null===(i=t.columnEditorConfig)||void 0===i?void 0:i.showToggle)||void 0===o||o,searchEnabled:null===(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchEnabled)||void 0===r||r,searchPlaceholder:null!==(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.searchPlaceholder)&&void 0!==a?a:"Search columns...",allowColumnPinning:null===(c=null===(d=t.columnEditorConfig)||void 0===d?void 0:d.allowColumnPinning)||void 0===c||c,searchFunction:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.searchFunction,rowRenderer:null===(u=t.columnEditorConfig)||void 0===u?void 0:u.rowRenderer,customRenderer:null===(f=t.columnEditorConfig)||void 0===f?void 0:f.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var i;for(const o of t)o.essential&&e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.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 Ke(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Kn{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,i,o,s;const r=null!==(n=e.theme)&&void 0!==n?n:"modern-light",l=null!==(i=e.className)&&void 0!==i?i:"",a=null!==(o=e.columnBorders)&&void 0!==o&&o,d=document.createElement("div");d.className=`simple-table-root st-wrapper theme-${r} ${l} ${a?"st-column-borders":""}`;const c=document.createElement("div");c.className="st-wrapper-container";const h=document.createElement("div");h.className="st-content-wrapper";const u=document.createElement("div");u.className="st-content",u.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid");const f=z(e.enableColumnEditor,null===(s=e.columnEditorConfig)||void 0===s?void 0:s.showToggle);u.style.width=f>0?`calc(100% - ${f}px)`:"100%";const v=document.createElement("div");v.className="st-header-container",v.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=v;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const w=document.createElement("div");w.id="st-footer-container";const m="top"===e.footerPosition;m&&d.classList.add("st-footer-position-top");const g=document.createElement("div");return g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true"),g.className="st-sr-only",u.appendChild(v),u.appendChild(p),h.appendChild(u),m?(c.appendChild(w),c.appendChild(h)):(c.appendChild(h),c.appendChild(w)),d.appendChild(c),d.appendChild(g),t.appendChild(d),this.elements={rootElement:d,wrapperContainer:c,contentWrapper:h,content:u,headerContainer:v,bodyContainer:p,footerContainer:w,ariaLiveRegion:g},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}`}syncFooterPosition(t){if(!this.elements)return;const{rootElement:e,wrapperContainer:n,contentWrapper:i,footerContainer:o}=this.elements,s="top"===t;e.classList.toggle("st-footer-position-top",s);const r=n.querySelector(".st-horizontal-scrollbar-container");if(s)return o!==n.firstElementChild&&n.insertBefore(o,i),void(r&&n.appendChild(r));r&&r.parentElement===n?n.insertBefore(o,r):o!==n.lastElementChild&&n.appendChild(o)}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 _n=(t,e)=>{const{sort:n,icons:i}=e;if(!n||n.key.accessor!==t.accessor)return null;const o=document.createElement("div");o.className="st-icon-container",o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const s="asc"===n.direction?i.sortUp:i.sortDown;return s&&("string"==typeof s?o.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&o.appendChild(s.cloneNode(!0))),I(o,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),I(o,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),o},Un={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"},Jn={string:["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"],number:["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"],boolean:["equals","isEmpty","isNotEmpty"],date:["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"],enum:["in","notIn","isEmpty","isNotEmpty"]},Yn=["equals","notEquals","isEmpty","isNotEmpty"],Xn=(t,e)=>{var n;const i=null!==(n=Jn[t])&&void 0!==n?n:Yn;if(e&&e.length>0){const t=new Set(i),n=e.filter(e=>t.has(e));if(n.length>0)return n}return i},Qn=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Zn=t=>["between","notBetween","in","notIn"].includes(t),ti=t=>["isEmpty","isNotEmpty"].includes(t),ei=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},ni=t=>{var e,n,i;let{children:o,containerRef:s,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:f="fixed",allowDescendantOverflow:v=!1}=t,p=v;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",p&&m.classList.add(w),m.style.position=f,m.style.overflow=p?"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(o);let g=l;if("fixed"===f){const t=null!==(i=null!==(n=null!==(e=ei(g))&&void 0!==e?e:ei(null!=r?r:null))&&void 0!==n?n:ei(null!=s?s:null))&&void 0!==i?i:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const b=t=>{d&&m&&!m.contains(t.target)&&(S(!1),null==a||a())},x=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===f){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}S(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(S(!1),null==a||a())},R=t=>{"Enter"===t.key&&x(t)},S=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===f&&!m.parentElement)return;if("fixed"===f&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t?requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,i=h||m.offsetWidth;let o;o=s?s.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=o.bottom-e.bottom,a=e.top-o.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(i>o.right-e.right+e.width&&(c="right"),"fixed"===f)"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 void(m.style.visibility="visible");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}${p?" "+w:""}`,m.style.visibility="visible"}):m.style.visibility="visible"})(),window.addEventListener("scroll",b,!0),document.addEventListener("mousedown",x,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",b,!0),document.removeEventListener("mousedown",x,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?S(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&S(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=p?"visible":c),void 0!==t.allowDescendantOverflow&&(p=t.allowDescendantOverflow,m.classList.toggle(w,p),m.style.overflow=p?"visible":c)},destroy:()=>{S(!1),m.remove()},setOpen:S}},ii=t=>{let{value:e,onChange:n,options:i,placeholder:o="Select...",className:s="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!1,c=-1;const h=document.createElement("div");h.className=`st-custom-select ${s} ${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 f=document.createElement("span");f.className="st-custom-select-value";const v=i.find(t=>t.value===e);f.textContent=v?v.label:o;const p=(()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","st-custom-select-arrow"),t.setAttribute("width","12"),t.setAttribute("height","12"),t.setAttribute("viewBox","0 0 12 12"),t.setAttribute("fill","none"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M3 4.5L6 7.5L9 4.5"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","1.5"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("fill","none"),t.appendChild(e),t})();u.appendChild(f),u.appendChild(p),h.appendChild(u);const w=document.createElement("div");w.className="st-custom-select-options",w.setAttribute("role","listbox");const m=()=>{w.innerHTML="",i.forEach((t,n)=>{const i=document.createElement("div");i.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),i.setAttribute("role","option"),i.setAttribute("aria-selected",""+(t.value===e)),i.setAttribute("tabindex","0"),i.textContent=t.label,i.addEventListener("click",()=>x(t.value)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(t.value))}),w.appendChild(i)})};m();const g=ni({children:w,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(g.element);const b=t=>{e=t;const n=i.find(t=>t.value===e);f.textContent=n?n.label:o},x=t=>{b(t),n(t),S(!1),c=-1,m()},y=()=>{if(!r){if(S(!d),d)c=-1;else{const t=i.findIndex(t=>t.value===e);c=0>t?0:t}m()}},R=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=i.length-1>c?c+1:0,m();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:i.length-1,m();break;case"Enter":if(t.preventDefault(),c>=0){const t=i[c].value;b(t),n(t),S(!1),c=-1,m()}break;case"Escape":t.preventDefault(),S(!1),c=-1,m()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",R)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",R)),g.setOpen(d)};return u.addEventListener("click",y),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=i.find(t=>t.value===e);f.textContent=n?n.label:o,m()}void 0!==t.options&&(i=t.options,m()),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",y),document.removeEventListener("keydown",R),g.destroy(),h.remove()},setOpen:S}},oi=t=>{let{type:e="text",value:n,onChange:i,onEnter:o,placeholder:s="",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=s,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.focus()})});const h=t=>{i(t.target.value)},u=t=>{"Enter"===t.key&&o&&(t.preventDefault(),o())};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&&(s=t.placeholder,c.placeholder=s),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&&(i=t.onChange),void 0!==t.onEnter&&(o=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},si=t=>{let{onApply:e,onClear:n,canApply:i,showClear:o}=t;const s=document.createElement("div");s.className="st-filter-actions";const r=document.createElement("button");r.type="button",r.tabIndex=0,r.textContent="Apply";const l=()=>{r.disabled=!i,r.className=("st-filter-button st-filter-button-apply"+(i?"":" st-filter-button-disabled")).trim()};l();const a=()=>{e()};r.addEventListener("click",a),s.appendChild(r);let d=null;const c=()=>{null==n||n()},h=()=>{const t=o&&!!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),s.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return h(),{element:s,update:t=>{void 0!==t.canApply&&(i=t.canApply,l()),void 0!==t.showClear&&(o=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),s.remove()}}},ri=t=>{let{onChange:e,onClose:n,value:i}=t,o=i||new Date,s="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{o=new Date(o.getFullYear(),o.getMonth()-1,1),v()},d=()=>{o=new Date(o.getFullYear(),o.getMonth()+1,1),v()},c=t=>{o=new Date(t,o.getMonth(),1),s="months",v()},h=t=>{const i=o.getFullYear(),s=o.getMonth(),r=new Date(i,s,t,12,0,0);o=r,e(r),null==n||n()},u=t=>{const i=new Date(o.getFullYear(),o.getMonth()-1,t,12,0,0);o=i,e(i),null==n||n()},f=t=>{const i=new Date(o.getFullYear(),o.getMonth()+1,t,12,0,0);o=i,e(i),null==n||n()},v=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===s){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.appendChild(Qe()),e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${p=o,p.toLocaleString("default",{month:"long"})} ${o.getFullYear()}`,n.addEventListener("click",()=>{s="months",v()});const i=document.createElement("button");i.className="st-datepicker-nav-btn",i.appendChild(Ze()),i.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(i)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=""+o.getFullYear(),e.addEventListener("click",()=>{s="years",v()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var p;r.appendChild(t);const w=document.createElement("div");var m;w.className=`st-datepicker-grid st-datepicker-${s}-grid`,"days"===s?(t=>{const e=o.getFullYear(),n=o.getMonth(),s=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,i=document.createElement("div");i.className="st-datepicker-day other-month",i.textContent=""+n,i.addEventListener("click",()=>u(n)),t.appendChild(i)}for(let o=1;s>=o;o++){const s=o===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(i),l=o===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${s?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+o,a.addEventListener("click",()=>h(o)),t.appendChild(a)}const d=35-(r+s);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",()=>f(e)),t.appendChild(n)}})(w):"months"===s?(m=w,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===o.getMonth(),i=document.createElement("div");i.className=("st-datepicker-month "+(n?"selected":"")).trim(),i.textContent=t,i.addEventListener("click",()=>(t=>{o=new Date(o.getFullYear(),t,1),s="days",v()})(e)),m.appendChild(i)})):(t=>{const e=o.getFullYear(),n=e-6;for(let i=n;n+12>i;i++){const n=i===e,o=document.createElement("div");o.className=("st-datepicker-year "+(n?"selected":"")).trim(),o.textContent=""+i,o.addEventListener("click",()=>c(i)),t.appendChild(o)}})(w),r.appendChild(w);const g=document.createElement("div");g.className="st-datepicker-footer";const b=document.createElement("button");b.className="st-datepicker-today-btn",b.textContent="Today",b.addEventListener("click",()=>{const t=new Date,i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);o=i,e(i),null==n||n()}),g.appendChild(b),r.appendChild(g)};return v(),{element:r,update:t=>{void 0!==t.value&&(i=t.value,o=i||new Date,v()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},li=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=Xn("string",e.filterOperators),a=l.includes("contains")?"contains":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=((null==n?void 0:n.value)||"")+"";const h=document.createElement("div");h.className="st-filter-container";const u=document.createElement("div");u.className="st-filter-section";const f=ii({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:Un[t]})),containerRef:s,mainBodyRef:r});u.appendChild(f.element),h.appendChild(u);let v=null,p=null,w=null;const m=()=>{const t=Object.assign({accessor:e.accessor,operator:d},Qn(d)&&{value:c});i(t)},g=()=>ti(d)||""!==c.trim(),b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),Qn(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=oi({type:"text",value:c,onChange:t=>{c=t,w&&w.update({canApply:g()})},onEnter:m,placeholder:"Filter...",autoFocus:!0}),v.appendChild(p.element),h.insertBefore(v,h.lastChild)),w&&w.update({canApply:g()})};return w=si({onApply:m,onClear:o,canApply:g(),showClear:!!n}),h.appendChild(w.element),b(),{element:h,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=((null==n?void 0:n.value)||"")+"",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:g()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),h.remove()}}})(t);case"number":return(t=>{var e,n;let{header:i,currentFilter:o,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Xn("number",i.filterOperators),c=d.includes("equals")?"equals":d[0];let h=(null==o?void 0:o.operator)||c;d.includes(h)||(h=c);let u=((null==o?void 0:o.value)||"")+"",f=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ii({value:h,onChange:t=>{h=t,M()},options:d.map(t=>({value:t,label:Un[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null;const S=()=>{const t={accessor:i.accessor,operator:h};Qn(h)?t.value=parseFloat(u):Zn(h)&&(t.values=[parseFloat(f),parseFloat(v)]),s(t)},C=()=>!!ti(h)||(Qn(h)?""!==u.trim():!!Zn(h)&&""!==f.trim()&&""!==v.trim()),M=()=>{g&&(g.remove(),g=null),b&&(b.destroy(),b=null),x&&(x.destroy(),x=null),y&&(y.destroy(),y=null),Qn(h)?(g=document.createElement("div"),g.className="st-filter-section",b=oi({type:"number",value:u,onChange:t=>{u=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(b.element),p.insertBefore(g,p.lastChild)):Zn(h)&&(g=document.createElement("div"),g.className="st-filter-section",x=oi({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),y=oi({type:"number",value:v,onChange:t=>{v=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"To..."}),g.appendChild(x.element),g.appendChild(y.element),p.insertBefore(g,p.lastChild)),R&&R.update({canApply:C()})};return R=si({onApply:S,onClear:r,canApply:C(),showClear:!!o}),p.appendChild(R.element),M(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(o=t.currentFilter,h=(null==o?void 0:o.operator)||c,d.includes(h)||(h=c),u=((null==o?void 0:o.value)||"")+"",f=((null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),b&&b.update({value:u}),x&&x.update({value:f}),y&&y.update({value:v}),R&&R.update({showClear:!!o,canApply:C()}),M())},destroy:()=>{m.destroy(),b&&b.destroy(),x&&x.destroy(),y&&y.destroy(),R&&R.destroy(),p.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o,containerRef:s,mainBodyRef:r}=t;const l=Xn("boolean",e.filterOperators),a=l.includes("equals")?"equals":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const h=document.createElement("div");h.className="st-filter-container";const u=document.createElement("div");u.className="st-filter-section";const f=ii({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:Un[t]})),containerRef:s,mainBodyRef:r});u.appendChild(f.element),h.appendChild(u);let v=null,p=null,w=null;const m=()=>ti(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),Qn(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=ii({value:c,onChange:t=>{c=t,w&&w.update({canApply:m()})},options:g,containerRef:s,mainBodyRef:r}),v.appendChild(p.element),h.insertBefore(v,h.lastChild)),w&&w.update({canApply:m()})};return w=si({onApply:()=>{const t={accessor:e.accessor,operator:d};Qn(d)&&(t.value="true"===c),i(t)},onClear:o,canApply:m(),showClear:!!n}),h.appendChild(w.element),b(),{element:h,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=void 0!==(null==n?void 0:n.value)?n.value+"":"true",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:m()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),h.remove()}}})(t);case"date":return(t=>{var e,n;let{header:i,currentFilter:o,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Xn("date",i.filterOperators),c=d.includes("equals")?"equals":d[0];let h=(null==o?void 0:o.operator)||c;d.includes(h)||(h=c);let u=(null==o?void 0:o.value)?o.value+"":"",f=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=ii({value:h,onChange:t=>{h=t,W()},options:d.map(t=>({value:t,label:Un[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null,S=null,C=null,M=null,I=null,H=null,k=null;const T=()=>!!ti(h)||(Qn(h)?""!==u.trim():!!Zn(h)&&""!==f.trim()&&""!==v.trim()),E=t=>{if(!t)return"";const e=ee(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},A=(t,e,n,i=!1)=>{const o=document.createElement("div");o.className="st-date-input-container",o.style.position="relative";const s=document.createElement("input");s.type="text",s.className="st-filter-input",s.value=E(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",i&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?ee(t):new Date,c=ri({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),s.value=E(n),h.setOpen(!1),r=!1},onClose:()=>{h.setOpen(!1),r=!1}}),h=ni({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:280});o.appendChild(s),o.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},f=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return s.addEventListener("click",u),s.addEventListener("keydown",f),{container:o,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",f),c.destroy(),h.destroy(),o.remove()}}},W=()=>{if(g&&(g.remove(),g=null),b&&(b=null),x&&(x=null),y&&(y=null),R&&(R.destroy(),R=null),S&&(S.destroy(),S=null),C&&(C.destroy(),C=null),M&&(M.destroy(),M=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),Qn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(u,t=>{u=t,k&&k.update({canApply:T()})},"Select date...",!0);b=t.container,R=t.picker,M=t.dropdown,g.appendChild(b),p.insertBefore(g,p.lastChild)}else if(Zn(h)){g=document.createElement("div"),g.className="st-filter-section";const t=A(f,t=>{f=t,k&&k.update({canApply:T()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=A(v,t=>{v=t,k&&k.update({canApply:T()})},"To date...",!1);x=t.container,S=t.picker,I=t.dropdown,y=e.container,C=e.picker,H=e.dropdown,g.appendChild(x),g.appendChild(y),p.insertBefore(g,p.lastChild)}k&&k.update({canApply:T()})};return k=si({onApply:()=>{const t={accessor:i.accessor,operator:h};Qn(h)?t.value=u:Zn(h)&&(t.values=[f,v]),s(t)},onClear:r,canApply:T(),showClear:!!o}),p.appendChild(k.element),W(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(o=t.currentFilter,h=(null==o?void 0:o.operator)||c,d.includes(h)||(h=c),u=(null==o?void 0:o.value)?o.value+"":"",f=(null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])?o.values[0]+"":"",v=((null===(n=null==o?void 0:o.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:h}),k&&k.update({showClear:!!o,canApply:T()}),W())},destroy:()=>{m.destroy(),R&&R.destroy(),S&&S.destroy(),C&&C.destroy(),M&&M.destroy(),I&&I.destroy(),H&&H.destroy(),k&&k.destroy(),p.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:i,onClearFilter:o}=t;const s=e.enumOptions||[],r=s.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 f=un({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],b(),y&&y.update({canApply:x()})}}),v=document.createElement("span");v.className="st-enum-option-label st-enum-select-all-label",v.textContent="Select All",f.element.appendChild(v),u.appendChild(f.element),h.appendChild(u);let p=null,w=null;s.length>10&&(p=document.createElement("div"),p.className="st-enum-search",w=oi({type:"text",value:a,onChange:t=>{a=t,b()},placeholder:"Search..."}),p.appendChild(w.element),h.appendChild(p));const m=document.createElement("div");h.appendChild(m);const g=[],b=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?s.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):s;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=un({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;f.element.querySelector("input").checked=e,y&&y.update({canApply:x()})}}),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;f.element.querySelector("input").checked=e};b(),c.appendChild(h),d.appendChild(c);const x=()=>0!==l.length&&l.length!==r.length,y=si({onApply:()=>{l.length!==r.length?i({accessor:e.accessor,operator:"in",values:l}):o()},onClear:o,canApply:x(),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="",w&&w.update({value:a}),b(),y&&y.update({showClear:!!n,canApply:x()}))},destroy:()=>{f.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},ai=(t,e)=>{const{filters:n,handleApplyFilter:i,handleClearFilter:o,icons:s}=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=s.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}if(d){const t=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)";d.style.color=t,"none"!==d.getAttribute("fill")&&(d.style.fill=t)}let c=!1,h=null,u=null;const f=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{i(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.color="var(--st-button-active-background-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-button-active-background-color)"))},s=()=>{o(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.color="var(--st-header-icon-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-header-icon-color)"))},a=e.mainBodyRef.current||void 0;h=li({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=ni({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:320,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return I(l,"click",f),I(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),f(t))}),l},di=(t,e)=>{var n,i;const{icons:o}=e;if(!nt(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const s=(null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders).has(t.accessor),r=document.createElement("div");r.className="st-icon-container st-collapsible-header-icon st-expand-icon-container "+(s?"collapsed":"expanded"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${s?"Expand":"Collapse"} ${t.label} column`),r.setAttribute("aria-expanded",!s+"");const l=o.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const a=n=>{var i,o;n.stopPropagation();const s=(null!==(o=null===(i=e.getCollapsedHeaders)||void 0===i?void 0:i.call(e))&&void 0!==o?o:e.collapsedHeaders).has(t.accessor);e.setCollapsedHeaders(e=>{const n=new Set(e);return s?n.delete(t.accessor):n.add(t.accessor),n})};return I(r,"click",a),I(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},ci=(t,e,n=[])=>{for(let i=0;t.length>i;i++){const o=t[i];if(o.accessor===e)return[...n,i];if(o.children&&o.children.length>0){const t=ci(o.children,e,[...n,i]);if(t)return t}}return null},hi=(t,e)=>{if(t.pinned)return t.pinned;const n=tt(e,t.accessor);return n?hi(n,e):void 0},ui=(t,e)=>{const n=hi(t,e);return"left"===n?"left":"right"===n?"right":"main"};function fi(t,e,n){const i=An(t);let o=!1;function s(t,e){let n,i=t;for(let t=0;e.length-1>t;t++)i=i[e[t]].children;return n=i[e[e.length-1]],n}function r(t,e,n){let i=t;for(let t=0;e.length-1>t;t++){if(!i[e[t]].children){o=!0;break}i=i[e[t]].children}i[e[e.length-1]]=n}const l=s(i,e);return r(i,e,s(i,n)),r(i,n,l),{newHeaders:i,emergencyBreak:o}}const vi=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a}=e,d=a?B:0,c=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),h=t.querySelector(".st-horizontal-scrollbar-left"),u=null==h?void 0:h.firstElementChild;i>0&&h&&u&&(h.style.width=i+"px",u.style.width=s+"px");const f=t.querySelector(".st-horizontal-scrollbar-middle"),v=null==f?void 0:f.firstElementChild;n>0&&f&&v&&(v.style.width=n+"px");const p=t.querySelector(".st-horizontal-scrollbar-right"),w=null==p?void 0:p.firstElementChild;if(o>0&&p&&w&&(p.style.width=c+"px",w.style.width=r+"px"),d>0){const e=Array.from(t.children).find(t=>t instanceof HTMLElement&&!t.classList.contains("st-horizontal-scrollbar-left")&&!t.classList.contains("st-horizontal-scrollbar-middle")&&!t.classList.contains("st-horizontal-scrollbar-right"));e&&(e.style.width=d-1.5+"px")}},pi=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),i=t.querySelector(".st-horizontal-scrollbar-middle"),o=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),i instanceof HTMLElement&&e.unregisterPane("main",i),o instanceof HTMLElement&&e.unregisterPane("pinned-right",o)}t.remove()},wi=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,mi=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let i=0,o=0,s=0;t.forEach(t=>{if(Z(t))return;const e=St(t,n).reduce((t,e)=>t+kt(e),0);"left"===t.pinned?i+=e:"right"===t.pinned?o+=e:s+=e});const r=i,l=o;if(e&&e>0){const t=e*U(e,i>0,o>0);i>t&&(i=t),o>t&&(o=t)}return{leftWidth:Q(i),rightWidth:Q(o),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},gi=(t,e)=>{if(t.pinned)return t.pinned;const n=tt(e,t.accessor);return n?gi(n,e):void 0},bi=(e,n,i)=>{var o;const s=[],r=[],l=[];e.forEach(t=>{if(Z(t))return;const n=gi(t,e);"left"===n?s.push(t):"right"===n?l.push(t):r.push(t)});const a=(e,o,s)=>{var r,l;if(Z(e))return o;const d=o;if(e.children&&e.children.length>0){const l=null==n?void 0:n.has(e.accessor),c=e.children.filter(e=>{if(Z(e))return!1;const n=e.showWhen||t;return l?"parentCollapsed"===n||"always"===n:"parentExpanded"===n||"always"===n});if(e.singleRowChildren){const t=null!==(r=null==i?void 0:i.get(e.accessor))&&void 0!==r?r:kt(e);return s.set(e.accessor,{left:d,width:t}),o=d+t,c.forEach(t=>{o=a(t,o,s)}),o}c.forEach(t=>{o=a(t,o,s)}),s.set(e.accessor,{left:d,width:o-d})}else{const t=null!==(l=null==i?void 0:i.get(e.accessor))&&void 0!==l?l:kt(e);s.set(e.accessor,{left:o,width:t}),o+=t}return o},d=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=a(t,n,e)}),e},c=d(s),h=d(r),u=d(l),f=new Map;c.forEach((t,e)=>f.set(e,t)),h.forEach((t,e)=>f.set(e,t)),u.forEach((t,e)=>f.set(e,t)),f.forEach((t,e)=>{const{left:n,width:i}=t,o=ot({accessor:e,rowId:"header"}),s=document.getElementById(o);c.has(e),u.has(e),s&&(s.style.left=n+"px",s.style.width=i+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=i+"px")})});const v=document.querySelector(".st-body-container"),p=null!==(o=null==v?void 0:v.clientWidth)&&void 0!==o?o:0,w=mi({headers:e,containerWidth:p>0?p:void 0,collapsedHeaders:n}),{leftWidth:m,rightWidth:g,mainWidth:b,leftContentWidth:x,rightContentWidth:y}=w;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")}const R=null==v?void 0:v.closest(".simple-table-root"),S=null==R?void 0:R.querySelector(".st-horizontal-scrollbar-container"),C=null==R?void 0:R.querySelector(".st-body-main"),M=!!(null==R?void 0:R.querySelector(".st-column-editor:not(.st-column-editor--no-toggle)"));S&&C&&v&&C.scrollWidth-C.clientWidth>1&&vi(S,{mainBodyRef:C,mainBodyWidth:b,pinnedLeftWidth:m,pinnedRightWidth:g,pinnedLeftContentWidth:x,pinnedRightContentWidth:y,tableBodyContainerRef:v,enableColumnEditor:M})},xi=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n,shrinkFloors:i})=>{if(0>e){const i=Math.abs(e),o=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===o)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=i*(r/o);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const i=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-i)},0);l=i-e}e.width=r+l})}let o=e;for(;o>.5;){const e=t.map(t=>{var e;const o=n.get(t.accessor)||100,s=Math.max(null!==(e=null==i?void 0:i.get(t.accessor))&&void 0!==e?e:_,_),r=Math.min(s,o);return{column:t,headroom:Math.max(0,o-r),initialWidth:o,minWidth:r}}).filter(t=>t.headroom>0);if(0>=e.length)break;{const t=e.reduce((t,e)=>t+e.headroom,0);let n=0;const i=o;e.forEach((o,s)=>{let r=i*(o.headroom/t);r=Math.min(r,o.headroom),s===e.length-1&&(r=Math.min(i-n,o.headroom)),o.column.width=o.initialWidth-r,n+=r}),o-=n}}},yi=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:i,headers:o,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,sectionViewportWidth:u=0,shrinkFloors:f,startWidth:v})=>{const p=t=>t.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-(t=>{var e;const n=s.get(t.accessor)||100,i=Math.max(null!==(e=null==f?void 0:f.get(t.accessor))&&void 0!==e?e:_,_);return Math.min(i,n)})(e))},0),w=t=>{if(!d||0>=n||0>=t)return t;const e=o.some(t=>"left"===t.pinned&&!Z(t)),i=o.some(t=>"right"===t.pinned&&!Z(t)),r=((t,e,n)=>t*U(t,e,n))(n,e,i),l=Math.max(0,r-Array.from(s.values()).reduce((t,e)=>t+e,0));return Math.min(t,l)};if(r&&t.length>1){const n=At(c,e),o=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===o||-1===r)return;const l=0===o,m=r===n.length-1;let g;g="left"===d&&m||"right"===d&&l?[]:l?n.slice(r+1):m||a?n.slice(0,o):n.slice(r+1);const b=Array.from(s.values()).reduce((t,e)=>t+e,0),x=!d&&u>0?u:h>0?Math.max(h,b):b+Math.abs(i)+1;if(i>0){const e=Math.max(0,x-b),n=Math.max(0,i-e),o=g.length>0?p(g):0,r=Math.min(n,o);let l;l=d?0===g.length?w(i):Math.min(i,w(e)+r):i;const a=(v+l)/t.reduce((t,e)=>t+(s.get(e.accessor)||100),0);t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*a,_)}),r>0&&g.length>0&&xi({columnsToShrink:g,totalCompensation:r,initialWidthsMap:s,shrinkFloors:f})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(v+i,_*t.length),o=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*o,_)});const r=Math.max(0,v-n-Math.max(0,b-x));r>0&&g.length>0&&xi({columnsToShrink:g,totalCompensation:-r,initialWidthsMap:s})}return}const m=At(c,e),g=m.findIndex(t=>t.accessor===l.accessor);if(-1===g)return;const b=0===g,x=g===m.length-1;let y;if(y="left"===d&&x||"right"===d&&b?[]:b?m.slice(g+1):x||a?m.slice(0,g):m.slice(g+1),0===y.length){const t=i>0?w(i):i;return void(l.width=Math.max(v+t,_))}const R=Array.from(s.values()).reduce((t,e)=>t+e,0),S=!d&&u>0?u:h>0?Math.max(h,R):R+Math.abs(i)+1;if(i>0){const t=Math.max(0,S-R);if(t>=i){const t=w(i);return void(l.width=v+t)}const e=i-t,n=p(y),o=Math.min(e,n);if(d){const e=w(t)+o;l.width=v+e}else l.width=v+i;o>0&&xi({columnsToShrink:y,totalCompensation:o,initialWidthsMap:s,shrinkFloors:f})}else{const t=Math.max(v+i,_),e=v-t;l.width=t;const n=Math.max(0,e-Math.max(0,R-S));n>0&&xi({columnsToShrink:y,totalCompensation:-n,initialWidthsMap:s})}},Ri=({mainLeafHeaders:t,mainInitialWidths:e,newMainAvailable:n,shrinkFloors:i})=>{const o=Array.from(e.values()).reduce((t,e)=>t+e,0);if(0>=n||0>=o)return;const s=n/o;if(s>=1){let i=0;return void t.forEach((o,r)=>{const l=e.get(o.accessor)||100;r===t.length-1?o.width=n-i:(o.width=Math.round(l*s),i+=o.width)})}t.forEach(t=>{var n;const o=e.get(t.accessor)||100,r=Math.min(Math.max(null!==(n=null==i?void 0:i.get(t.accessor))&&void 0!==n?n:_,_),o);t.width=Math.max(Math.round(o*s),r)})},Si=(t,e)=>{if(t>0)return t;const n=null==e?void 0:e.current;if(!n)return 0;const i=n.closest(".simple-table-root"),o=null==i?void 0:i.querySelector(".st-body-container");return o instanceof HTMLElement?o.clientWidth:n.clientWidth},Ci=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:i,header:o,headers:s,mainBodyRef:r,onColumnWidthChange:l,onAutoExpandNaturalWidths:a,reverse:d=!1,setHeaders:c,setIsResizing:h,shrinkFloors:u,startWidth:f})=>{i.preventDefault();const v="clientX"in i?i.clientX:i.touches[0].clientX,p="touches"in i;if(!o||Z(o))return;const w=Si(n,r);h(!0);const m=gi(o,s),g=Et(o);let b;if(o.children&&o.children.length>0){const t=St(o,e);b=t.length>0?t:[o]}else b=[o];const x=new Map;let y=0,R=0;if(t){const t=s.filter(t=>t.pinned===m);if(At(t,e).forEach(t=>{const e=kt(t);x.set(t.accessor,e)}),w>0){const{leftWidth:t,rightWidth:n,mainWidth:i}=mi({headers:s,containerWidth:w,collapsedHeaders:e});y="left"===m?t:"right"===m?n:i;const o=Math.max(0,w-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;R=l>0?Math.min(o,l):o}}let S=!1;const C=new Map;let M=[];if(t&&m&&w>0){const t=At(s.filter(t=>t.pinned===m),e);if(t.length>0){let n=!1;if(b.length>1){const e=t.findIndex(t=>t.accessor===b[0].accessor),i=t.findIndex(t=>t.accessor===b[b.length-1].accessor);n="left"===m&&i===t.length-1||"right"===m&&0===e}else{const e=b[0]||o,i=t.findIndex(t=>t.accessor===e.accessor);n="left"===m&&i===t.length-1||"right"===m&&0===i}if(n){S=!0;const t=s.filter(t=>!t.pinned);M=At(t,e),M.forEach(t=>{C.set(t.accessor,kt(t))})}}}const I=(n,i=!1)=>{const r="right"===m?v-n:n-v;if(t){const t=s.filter(t=>t.pinned===m);if(yi({childrenToResize:b,collapsedHeaders:e,containerWidth:w,delta:r,headers:s,initialWidthsMap:x,isParentResize:b.length>1,resizedHeader:b.length>0?b[b.length-1]:o,reverse:d,rootPinned:m,sectionHeaders:t,sectionWidth:y,sectionViewportWidth:m?y:R,shrinkFloors:u,startWidth:f}),S&&M.length>0){const t=b.reduce((t,e)=>{const n=x.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);Ri({mainLeafHeaders:M,mainInitialWidths:C,newMainAvailable:Math.max(0,R-t),shrinkFloors:u})}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const i=document.querySelector(".st-body-container");if(!i||0===i.clientWidth)return 1e3;const o=i.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!Z(t)),r=e.some(t=>"right"===t.pinned&&!Z(t)),l=o*U(o,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>Z(e)?t:t+St(e,n).reduce((t,e)=>t+kt(e),0),0),a=Et(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:o,headers:s,collapsedHeaders:e});b.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:i,maxWidth:o})=>{const s=e.reduce((t,e)=>Math.min(t,Et(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(i+t,o),s)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:r,leafHeaders:b,minWidth:g,startWidth:f,maxWidth:t}):b[0].width=Math.max(Math.min(f+r,t),g),s.forEach(t=>{Tt(t)})}if(i){if(t&&a){const t=new Map;b.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const n=[...s];c(n);const i=new Map;b.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),S&&M.forEach(t=>{"number"==typeof t.width&&i.set(t.accessor,t.width)}),bi(s,e,i)}else bi(s,e)};let H=null,k=null,T=v;const E=t=>{T=t,k=t,null===H&&(H=requestAnimationFrame(()=>{null!==k&&(I(k,!1),k=null),H=null}))};if(p){const t=t=>{E(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==H&&(cancelAnimationFrame(H),H=null),I(T,!0),h(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{E(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==H&&(cancelAnimationFrame(H),H=null),I(T,!0),h(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Mi=t=>{var e,n;const i=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return i?null!==(n=i.closest(".simple-table-root"))&&void 0!==n?n:i:null},Ii=(t,e)=>{var n;for(const i of t){if(i.accessor===e)return i;if(null===(n=i.children)||void 0===n?void 0:n.length){const t=Ii(i.children,e);if(t)return t}}},Hi=(t,e)=>{const{columnResizing:n}=e;if(!n||t.isSelectionColumn&&e.enableRowSelection)return null;const i=document.createElement("div");i.className="st-header-resize-handle-container",i.setAttribute("role","separator"),i.setAttribute("aria-label",`Resize ${t.label} column`),i.setAttribute("aria-orientation","vertical");const o=document.createElement("div");o.className="st-header-resize-handle",i.appendChild(o);const s=t=>({rows:e.rows,header:t,styleRoot:Mi(e),autoSizeMode:t.autoSizeMode,sortIcon:e.icons.sortUp,expandIcon:e.icons.expand,onRendererHostDiscard:e.onRendererHostDiscard}),r=()=>{var n,i,o;const s=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders,r=e.getHeaders();return((t,e)=>{const n=At(t,e);for(const t of n){const e=document.getElementById(ot({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(r,s),{headers:r,header:null!==(o=Ii(r,t.accessor))&&void 0!==o?o:t,collapsedHeaders:s}};let l=0;const a=()=>{const n=Date.now();120>n-l||(l=n,(()=>{var n;const i=document.getElementById(ot({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o,collapsedHeaders:l}=r();(({header:t,headers:e,collapsedHeaders:n,containerWidth:i,mainBodyRef:o,reverse:s,headerCellElement:r,getTargetLeafWidth:l,onAutoExpandNaturalWidths:a,shrinkFloors:d})=>{var c;if(!t||Z(t))return;const h=Si(i,o),u=gi(t,e);let f;if(t.children&&t.children.length>0){const e=St(t,n);f=e.length>0?e:[t]}else f=[t];const v=new Map;let p=0,w=0;const m=e.filter(t=>t.pinned===u);if(At(m,n).forEach(t=>{const e=kt(t);v.set(t.accessor,e)}),h>0){const{leftWidth:t,rightWidth:i,mainWidth:s}=mi({headers:e,containerWidth:h,collapsedHeaders:n});p="left"===u?t:"right"===u?i:s;const r=Math.max(0,h-t-i),l=null!=(null==o?void 0:o.current)&&o.current.clientWidth>0?o.current.clientWidth:0;w=l>0?Math.min(r,l):r}let g=!1;const b=new Map;let x=[];if(u&&h>0){const i=At(e.filter(t=>t.pinned===u),n);if(i.length>0){let o=!1;if(f.length>1){const t=i.findIndex(t=>t.accessor===f[0].accessor),e=i.findIndex(t=>t.accessor===f[f.length-1].accessor);o="left"===u&&e===i.length-1||"right"===u&&0===t}else{const e=f[0]||t,n=i.findIndex(t=>t.accessor===e.accessor);o="left"===u&&n===i.length-1||"right"===u&&0===n}if(o){g=!0;const t=e.filter(t=>!t.pinned);x=At(t,n),x.forEach(t=>{b.set(t.accessor,kt(t))})}}}const y=f.reduce((t,e)=>t+l(e),0),R=null!==(c=null==r?void 0:r.offsetWidth)&&void 0!==c?c:f.reduce((t,e)=>t+kt(e),0);if(yi({childrenToResize:f,collapsedHeaders:n,containerWidth:h,delta:y-R,headers:e,initialWidthsMap:v,isParentResize:f.length>1,resizedHeader:f.length>0?f[f.length-1]:t,reverse:s,rootPinned:u,sectionHeaders:m,sectionWidth:p,sectionViewportWidth:u?p:w,shrinkFloors:d,startWidth:R}),g&&x.length>0){const t=f.reduce((t,e)=>{const n=v.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);Ri({mainLeafHeaders:x,mainInitialWidths:b,newMainAvailable:Math.max(0,w-t),shrinkFloors:d})}if(a){const t=new Map;f.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const S=new Map;f.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),g&&x.forEach(t=>{"number"==typeof t.width&&S.set(t.accessor,t.width)}),bi(e,n,S)})({header:o,headers:t,collapsedHeaders:l,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:i,getTargetLeafWidth:t=>Lt(t.accessor,s(t)).width,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,shrinkFloors:null===(n=e.getShrinkFloors)||void 0===n?void 0:n.call(e)});const a=[...t];return e.setHeaders(a),void(e.onColumnWidthChange&&e.onColumnWidthChange(a))}const{headers:o,header:l,collapsedHeaders:a}=r(),d=Lt(l.accessor,s(l)).width,c=ci(o,l.accessor);if(!c)return;const h=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(o,c),u=c[c.length-1],f=h.map((t,e)=>e===u?Object.assign(Object.assign({},t),{width:d}):t),v=((t,e,n)=>{if(1===e.length)return n;let i=t;for(let t=0;e.length-2>t;t++)i=i[e[t]].children;return i[e[e.length-2]].children=n,t})(o,c,f);v.forEach(t=>Tt(t));const p=f[u],w=new Map;p&&"number"==typeof p.width&&w.set(p.accessor+"",p.width),bi(v,a,w),e.setHeaders(v),e.onColumnWidthChange&&e.onColumnWidthChange(v)})())};return I(i,"mousedown",n=>{var i;if(n.detail>=2)return n.preventDefault(),void a();const o=null===(i=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;M(()=>{var t;const{headers:i,header:s,collapsedHeaders:l}=r();Ci({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:s,headers:i,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=o?o:q})},10)}),I(i,"touchstart",n=>{var i;const o=n,s=null===(i=document.getElementById(ot({accessor:t.accessor,rowId:"header"})))||void 0===i?void 0:i.offsetWidth;M(()=>{var t;const{headers:n,header:i,collapsedHeaders:l}=r();Ci({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:o,forceUpdate:e.forceUpdate,header:i,headers:n,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=s?s:q})},10)}),I(i,"dblclick",a),i},ki=(t,e,n)=>{const i=document.createElement("input");return i.type="text",i.className="st-header-edit-input",i.value=t.label||"",I(i,"blur",()=>{const o=i.value;o!==t.label&&(n=>{const i=e.headers.map(e=>e.accessor===t.accessor?Object.assign(Object.assign({},e),{label:n}):e);e.setHeaders(i),e.onHeaderEdit&&e.onHeaderEdit(t,n)})(o);const s=n.parentElement;if(s){const i=Ti(t,e,o);s.replaceChild(i,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),I(i,"keydown",e=>{"Enter"===e.key?(e.preventDefault(),i.blur()):"Escape"===e.key&&(e.preventDefault(),i.value=t.label||"",i.blur())}),setTimeout(()=>i.focus(),0),i},Ti=(t,e,n)=>{const i=t.isSelectionColumn&&e.enableRowSelection,o=void 0!==n?n:t.label||"",s=document.createElement("span");if(s.className="st-header-label-text "+("right"===t.align?"right-aligned":"center"===t.align?"center-aligned":"left-aligned"),i){if("single"!==e.rowSelectionMode){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return un({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);s.appendChild(t)}}else s.textContent=o;if(t.tooltip&&!i){let e=null,n=null;const i=()=>{var i;n&&(clearTimeout(n),n=null),e&&(null===(i=e.parentElement)||void 0===i||i.removeChild(e),e=null),n=setTimeout(()=>{if(!s.isConnected)return void(n=null);const i=s.getBoundingClientRect();if(i.width>0&&i.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const n=200,o=40;let r=i.left+i.width/2-n/2,l=i.bottom+8;8>r?r=8:r+n>window.innerWidth-8&&(r=window.innerWidth-n-8),l+o>window.innerHeight-8&&(l=i.top-o-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}n=null},500)},o=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};I(s,"mouseenter",i),I(s,"mouseleave",o)}return s},Ei=(t,e,n,i)=>{const{columnReordering:o,draggedHeaderRef:s,hoveredHeaderRef:r}=i;!o||n.disableReorder||n.isSelectionColumn&&i.enableRowSelection||(t.setAttribute("draggable","true"),I(t,"dragstart",t=>{s.current=n,x(Date.now()),e.classList.add("st-dragging")}),I(t,"dragend",t=>{t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{i.setHeaders(t=>[...t]),i.onColumnOrderChange&&i.onColumnOrderChange(An(i.getHeaders()))},10)}),I(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&M(()=>{const t=i.getHeaders();if(!t)return;const{screenX:o,screenY:l}=e,a=Math.sqrt(Math.pow(o-g.screenX,2)+Math.pow(l-g.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,h=!1;if(ui(d,t)!==ui(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const i=An(t);let o=!1;try{const t=ui(n,i),s=i.findIndex(t=>t.accessor===e.accessor),r=i.findIndex(t=>t.accessor===n.accessor);if(-1===s||-1===r)return o=!0,{newHeaders:i,emergencyBreak:o};const[l]=i.splice(s,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);i.splice(r,0,a)}catch(t){console.error("Error in insertHeaderAcrossSections:",t),o=!0}return{newHeaders:i,emergencyBreak:o}}({headers:t,draggedHeader:d,hoveredHeader:n});c=e.newHeaders,h=e.emergencyBreak}else{const e=ci(t,d.accessor),i=ci(t,n.accessor);if(!e||!i)return;const o=e.length,s=i.length;let r=i;if(o!==s){const t=s-o;t>0&&(r=i.slice(0,-t))}if((u=e).length!==(f=r).length||1!==u.length&&!u.slice(0,-1).every((t,e)=>t===f[e]))return;const l=fi(t,e,r);c=l.newHeaders,h=l.emergencyBreak}var u,f;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||h)return;const v=i.essentialAccessors;if(v&&v.size>0&&!jn(c,v))return;const p=Date.now();JSON.stringify(c)===JSON.stringify(b)&&(150>p-m||40>a)||(x(p),g={screenX:o,screenY:l},b=t,i.onTableHeaderDragEnd(c))},50)}),I(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Ai=(e,n)=>{var i,o;const{header:s,colIndex:r,parentHeader:l}=e,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:f,draggedHeaderRef:v,hoveredHeaderRef:p}=n,w=s.isSelectionColumn&&n.enableRowSelection,m=!!(null==s?void 0:s.sortable),g=a.has(s.accessor),b=!(!s.children||0===s.children.length)&&(!g||s.children.some(e=>{const n=e.showWhen||t;return"parentCollapsed"===n||"always"===n})),x=null==l?void 0:l.singleRowChildren,y=b&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?J(s,r).includes(n.lastHeaderIndex):r===n.lastHeaderIndex),S=!(!n.selectableColumns||w)&&J(s,r).some(t=>u.has(t)),C=!w&&J(s,r).some(t=>f.has(t));return["st-header-cell",s.accessor===(null===(i=p.current)||void 0===i?void 0:i.accessor)?"st-hovered":"",(null===(o=v.current)||void 0===o?void 0:o.accessor)===s.accessor?"st-dragging":"",m?"clickable":"",c&&!m?"columnReordering":"",y?"parent":"",x?"st-sub-header":"",R?"st-last-column":"",h&&!w?"st-header-editable":"",S?"st-header-selected":"",C&&!S?"st-header-has-highlighted-cell":""].filter(Boolean).join(" ")},Wi=(t,e,n,i,o)=>{var s;const r=Ti(e,i),l=e.headerRenderer({accessor:e.accessor,colIndex:n,header:e,components:{sortIcon:o.sortIcon||void 0,filterIcon:o.filterIcon||void 0,collapseIcon:o.collapseIcon||void 0,labelContent:r}});l instanceof HTMLElement&&l.parentElement===t||(null===(s=i.onRendererHostDiscard)||void 0===s||s.call(i,t),H(t),t.innerHTML="",l instanceof HTMLElement?t.appendChild(l):t.appendChild(r))},Oi=(t,e,n,i=0)=>{var o,s;const r=n.pinned?n.containerWidth:null!==(o=n.mainSectionViewportWidth)&&void 0!==o?o:n.containerWidth||(null===(s=t.parentElement)||void 0===s?void 0:s.clientWidth)||t.clientWidth||0,d=n.pinned||!1===n.enableVirtualization?e:((t,e,n,i=100)=>{if(0===t.length)return[];const o=e-i,s=e+n+i;return t.filter(t=>t.left+t.width>=o&&s>=t.left)})(e,i,r);(t=>{0===t.length||t.map(t=>t.colIndex)})(e);const c=R(t),h=new Set(d.map(t=>ot({accessor:t.header.accessor,rowId:"header"}))),u=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>u.set(t,e));const v=t=>"header-band-"+Math.round(t.top),p=t=>{var e;return(null!==(e=u.get(Math.round(t.top)))&&void 0!==e?e:0)+1},w=C(t),m=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,g="horizontal"===m?(t=>{const e=new Set,n=t=>{var i;for(const o of t)Z(o)||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(n.headers):null;let b=!1;c.forEach((e,i)=>{var o,s,r;if(!h.has(i)){w.delete(i);const l=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",a=null!==(s=null==g?void 0:g.has(l))&&void 0!==s&&s;"horizontal"===m&&n.animationCoordinator&&!a&&n.animationCoordinator.shouldRetain(i)?n.animationCoordinator.shrinkOutCell({cellId:i,element:e,container:t,axis:m}):(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,e),e.remove()),c.delete(i),b=!0}}),b&&H(t);const x=[];d.forEach(e=>{const i=ot({accessor:e.header.accessor,rowId:"header"});if(c.has(i)){const o=c.get(i);l(t,v(e),p(e)),o.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&o.setAttribute("aria-colspan",it(e.header,n.headers,n.collapsedHeaders)+"");const s=w.get(i);if(!s||s.left!==e.left||s.top!==e.top||s.width!==e.width||s.height!==e.height){o.style.left=e.left+"px",o.style.top=e.top+"px";const t=o.dataset.stAccordionGrow;"horizontal"!==t&&(o.style.width=e.width+"px"),"vertical"!==t&&(o.style.height=e.height+"px"),w.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{hn(t,e)})(o,n.areAllRowsSelected());const r=Ai(e,n);if(o.className!==r&&(o.className=r),nt(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);o.setAttribute("aria-expanded",!t+""),((t,e,n)=>{wn(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(o,t,e.header.label)}const a=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;o.dataset.stIconState!==a&&(((t,e,n,i)=>{const o=_n(e,n),s=ai(e,n),r=di(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&Wi(l,e,i,n,{sortIcon:o,filterIcon:s,collapseIcon:r}))}const l=t.querySelector('.st-icon-container[aria-label*="Sort"]'),a=t.querySelector('.st-icon-container[aria-label*="Filter"]'),d=t.querySelector(".st-expand-icon-container");if(null==l||l.remove(),null==a||a.remove(),null==d||d.remove(),"right"===e.align)r&&t.insertBefore(r,t.firstChild),s&&t.insertBefore(s,t.firstChild),o&&t.insertBefore(o,t.firstChild);else{const e=t.querySelector(".st-header-resize-handle-container"),n=null!=e&&e!==t.firstChild;o&&(n?t.insertBefore(o,e):t.appendChild(o)),s&&(n?t.insertBefore(s,e):t.appendChild(s)),r&&(n?t.insertBefore(r,e):t.appendChild(r))}})(o,e.header,n,e.colIndex),o.dataset.stIconState=a)}else x.push({cell:e,cellId:i})});const y=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,S=[];x.forEach(({cell:e,cellId:i})=>{const o=((t,e)=>{var n,i,o;const{header:s,colIndex:r}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,d=Ai(t,e),c=document.createElement("div");if(c.className=d,c.id=ot({accessor:s.accessor,rowId:"header"}),c.setAttribute("data-accessor",s.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",r+1+""),s.children&&s.children.length>0){const t=it(s,e.headers,e.collapsedHeaders);c.setAttribute("aria-colspan",t+"")}if(nt(s)){const t=null!==(i=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==i?i:e.collapsedHeaders;c.setAttribute("aria-expanded",!t.has(s.accessor)+"")}s.sortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===s.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.setAttribute("aria-sort","none"));const h=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.sortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(h){const t="header-desc-"+s.accessor;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=h,c.appendChild(e)}c.style.position="absolute",c.style.left=t.left+"px",c.style.top=t.top+"px",c.style.width=t.width+"px",c.style.height=t.height+"px";const u=_n(s,e),f=ai(s,e),v=di(s,e),p=l!==("right"===e.pinned);if(p){const t=Hi(s,e);t&&c.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&c.appendChild(v),f&&c.appendChild(f),u&&c.appendChild(u));const w=document.createElement("div");if(w.className="st-header-label",s.headerRenderer)Wi(w,s,r,e,{sortIcon:u,filterIcon:f,collapseIcon:v});else{const t=Ti(s,e);w.appendChild(t)}if(I(w,"click",t=>{a||((t,e,n,i)=>{if(!e.isSelectionColumn){if(i.selectableColumns){const o=J(e,n),s=o.some(t=>i.selectedColumns.has(t));if(i.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(ot({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=ki(e,i,t);if(t.appendChild(n),i.headerRegistry&&!e.isSelectionColumn){const t=i.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&i.selectColumns?i.setSelectedColumns(t=>{if(0===t.size)return new Set(o);const e=o[0],n=Array.from(t).sort((t,e)=>t-e);let i=n[0],s=Math.abs(e-i);n.forEach(t=>{const n=Math.abs(e-t);s>n&&(s=n,i=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)})(i,e),...o];return new Set([...Array.from(t),...r])}):i.selectColumns&&i.selectColumns(o),i.setSelectedCells(new Set),i.setInitialFocusedCell(null)}i.onColumnSelect&&i.onColumnSelect(e),!i.selectableColumns&&e.sortable&&i.onSort(e.accessor)}})(t,s,r,e)}),I(w,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.sortable&&n.onSort(e.accessor)})(0,s,e)}),Ei(w,c,s,e),c.appendChild(w),s.headerRenderer||"right"===s.align||(v&&c.appendChild(v),f&&c.appendChild(f),u&&c.appendChild(u)),!p){const t=Hi(s,e);t&&c.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=w.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=ki(s,e,t);t.appendChild(n)}}}}),c})(e,n);o.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,y&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(i)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===y?o.style.height="0px":o.style.width="0px",o.dataset.stAccordionGrow=y,S.push({element:o,cell:e})),l(t,v(e),p(e)).appendChild(o),c.set(i,o),w.set(i,{left:e.left,top:e.top,width:e.width,height:e.height})}),y&&S.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of S)t.isConnected&&("vertical"===y?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),n.pinned||(t.dataset.lastScrollLeft=i+""),d.forEach(t=>{const e=c.get(ot({accessor:t.header.accessor,rowId:"header"}));if(!e)return;const n=(t=>{const e=t.top,n=t.top+t.height,i=f.filter(t=>t>=e-1&&n-1>t).length;return i>0?i:1})(t);n>1?e.setAttribute("aria-rowspan",n+""):e.hasAttribute("aria-rowspan")&&e.removeAttribute("aria-rowspan")}),a(t)},Pi=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},$i=t=>{const{position:n,rowHeight:i,displayStrongBorder:o,heightOffsets:s,customTheme:r=e,isSticky:l=!1,sectionWidthPx:a}=t,d=document.createElement("div");d.className="st-row-separator "+(o?"st-last-group-row":"");const c=l?n:He({position:n,rowHeight:i,heightOffsets:s,customTheme:r});Pi(d,a),l?(d.style.position="absolute",d.style.top="0",d.style.transform=`translateY(${c}px)`):d.style.transform=`translate3d(0, ${c}px, 0)`;const h=document.createElement("div");h.style.width="100%",d.appendChild(h);let u=null;return d.addEventListener("mousedown",t=>{t.preventDefault();const e=d.style.pointerEvents;d.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(d.style.pointerEvents=e,!n)return;const i=n.closest(".st-cell");if(i instanceof HTMLElement){u=i;const e=i.getBoundingClientRect(),n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});i.dispatchEvent(n)}}),d.addEventListener("mouseup",t=>{if(u){const e=u.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});u.dispatchEvent(n),u=null}}),d},Fi=new WeakMap,Li=new WeakMap,Di=t=>(Li.has(t)||Li.set(t,new Map),Li.get(t)),ji=(t,n,i,o=0,s,r,d,c)=>{var h,u,v,p,w,m,g,b;const x=i.pinned?null!==(u=null!==(h=i.containerWidth)&&void 0!==h?h:t.clientWidth)&&void 0!==u?u:0:null!==(w=null!==(p=null!==(v=i.mainSectionViewportWidth)&&void 0!==v?v:i.containerWidth)&&void 0!==p?p:t.clientWidth)&&void 0!==w?w:0,y=i.pinned||!1===i.enableVirtualization?n:((t,e,n,i=100)=>{if(0===t.length)return[];const o=e-i,s=e+n+i;return t.filter(t=>t.left+t.width>=o&&s>=t.left)})(n,o,x),R=f(t),S=(t=>(Fi.has(t)||Fi.set(t,new Map),Fi.get(t)))(t),C=new Set(y.map(t=>{var e;return ot({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let M=null;if(d)if(c)M=c;else{M=new Map;for(const t of n){const e=ot({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});M.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const I=d&&i.accordionAxis?i.accordionAxis:null,H="horizontal"===I?(t=>{const e=new Set,n=t=>{var i;for(const o of t)Z(o)||(e.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&n(o.children))};return n(t),e})(i.headers):null,k=(null==s?void 0:s.length)?new Set(s.map(t=>t.position)):new Set(y.map(t=>t.rowIndex));R.forEach((e,n)=>{var o,s,r;if(!C.has(n)){const l=e.getAttribute("data-row-id");l&&Mn(l,e);const a=null==M?void 0:M.get(n);if(d&&d.shouldRetain(n)&&a&&(d.shouldAnimateTransition({beforeTop:parseFloat(e.style.top||"0"),afterTop:a.top,beforeLeft:parseFloat(e.style.left||"0"),afterLeft:a.left,cellHeight:a.height||parseFloat(e.style.height||"0"),cellWidth:a.width||parseFloat(e.style.width||"0"),container:t})||d.isCellRenderedInScrollerViewport(e,t)||d.shouldRetainDomCellAtScrollExtrema(n,t)))return d.retainCell({cellId:n,element:e,container:t,newPosition:a}),void R.delete(n);if(d&&"horizontal"===I&&d.shouldRetain(n)){const i=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"";if(null===(s=null==H?void 0:H.has(i))||void 0===s||!s)return d.shrinkOutCell({cellId:n,element:e,container:t,axis:I}),void R.delete(n)}((t,e)=>{const n=Rn.get(t);void 0!==n&&(null==e||e.delete(n),Rn.delete(t))})(e,i.cellRegistry),null===(r=i.onRendererHostDiscard)||void 0===r||r.call(i,e),e.remove(),R.delete(n)}});const T=Di(t);S.forEach((t,e)=>{k.has(e)||(t.remove(),S.delete(e),T.delete(e))});const E=null!==(g=i.maxHeaderDepth)&&void 0!==g?g:1,A=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId)+""},W=t=>t.tableRow.position+E+1,O=(t,e)=>{var n;i.enableRowSelection?t.setAttribute("aria-selected",(null===(n=i.isRowSelected)||void 0===n?void 0:n.call(i,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},P=!!i.rowGrouping&&i.rowGrouping.length>0,$=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId))+""},F=new Map;if(P&&s&&s.length>0){const t=new Map;for(const e of s){const n=null!==(b=e.rowIndexPath)&&void 0!==b?b:[],i=`${e.depth}|${n.slice(0,-1).join("/")}`;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(e)}t.forEach(t=>{t.slice().sort((t,e)=>t.position-e.position).forEach((e,n)=>{F.set($(e),{posinset:n+1,setsize:t.length})})})}const L=(t,e)=>{if(!P)return;const n=e.tableRow;t.setAttribute("aria-level",n.depth+1+"");const o=F.get($(n));o&&(t.setAttribute("aria-posinset",o.posinset+""),t.setAttribute("aria-setsize",o.setsize+""));const{expandable:s,expanded:r}=(t=>{var e;const n=t.depth,o=null===(e=i.rowGrouping)||void 0===e?void 0:e[n],s=!!o&&yt(t.row,o),r=!!i.rowGrouping&&i.rowGrouping.length>n,l=!i.canExpandRowGroup||i.canExpandRowGroup(t.row);return s&&r&&l||i.onRowGroupExpand&&r&&l?{expandable:!0,expanded:Rt(bt(t),n,new Set(i.expandedDepths),i.expandedRows,i.collapsedRows)}:{expandable:!1,expanded:!1}})(n);s?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},D=[],j=new Set;y.forEach(e=>{var n,o,s,a,c;const h=ot({accessor:e.header.accessor,rowId:null!==(n=e.stableRowKey)&&void 0!==n?n:e.rowId});if(!j.has(h))if(j.add(h),R.has(h)){const n=R.get(h),d=l(t,A(e),W(e));if(O(d,e),L(d,e),r)((t,e)=>{t.style.left=e.left+"px",t.style.top=e.top+"px";const n=t.dataset.stAccordionGrow;"horizontal"!==n&&(t.style.width=e.width+"px"),"vertical"!==n&&(t.style.height=e.height+"px")})(n,e);else{if(En(n,e,i),e.header.isSelectionColumn&&i.enableRowSelection&&i.isRowSelected){const t=i.isRowSelected(e.rowId);hn(n,t)}if(e.header.expandable){const t=new Set(i.expandedDepths),r=null!==(s=null===(o=i.getExpandedRows)||void 0===o?void 0:o.call(i))&&void 0!==s?s:i.expandedRows,l=null!==(c=null===(a=i.getCollapsedRows)||void 0===a?void 0:a.call(i))&&void 0!==c?c:i.collapsedRows,d=Rt(bt(e.tableRow),e.depth,t,r,l);wn(n,d)}}}else{if(d&&d.hasSnapshotEntry(h)&&!d.shouldMountIncomingCell({cellId:h,afterTop:e.top,afterLeft:e.left,cellHeight:e.height,cellWidth:e.width,container:t}))return;D.push({cell:e,cellId:h})}});const N=[];D.forEach(({cell:e,cellId:n})=>{const o=null==d?void 0:d.claimRetainedForReuse(n,t);if(o){(t=>{Sn.delete(t)})(o),En(o,e,i);const s=l(t,A(e),W(e));return O(s,e),L(s,e),o.parentElement!==s&&s.appendChild(o),void R.set(n,o)}const s=Tn(e,i);I&&d&&!d.hasSnapshotEntry(n)&&!d.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===I?s.style.height="0px":s.style.width="0px",s.dataset.stAccordionGrow=I,N.push({element:s,cell:e}));const r=l(t,A(e),W(e));O(r,e),L(r,e),r.appendChild(s),R.set(n,s)}),I&&N.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of N)t.isConnected&&("vertical"===I?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,n,i,o,s)=>{const r=Di(t),l=i.pinned&&n.length>0?n.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,a=(()=>{var e,n,o;if(i.pinned){const e=Math.max("number"==typeof i.pinnedSectionWidthPx&&i.pinnedSectionWidthPx>0?i.pinnedSectionWidthPx:t.clientWidth,l);return e>0?e:void 0}const s=null!==(o=null!==(n=null!==(e=i.mainSectionContainerWidth)&&void 0!==e?e:i.containerWidth)&&void 0!==n?n:t.clientWidth)&&void 0!==o?o:0;return s>0?s:void 0})();let d=[];if(s&&s.length>0)d=s.map((t,e)=>({rowIndex:t.position,position:t.position,displayStrongBorder:e>0&&s[e-1].isLastGroupRow}));else if(n.length>0){const t=[];let e,i=-1,o=null;n.forEach(n=>{n.rowIndex!==i&&(o&&i>0&&t.push({rowIndex:i,firstCell:o,prevCell:e}),e=o||void 0,i=n.rowIndex,o=n)}),o&&i>0&&t.push({rowIndex:i,firstCell:o,prevCell:e}),d=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var i,o;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(o=null===(i=null==n?void 0:n.tableRow)||void 0===i?void 0:i.isLastGroupRow)&&void 0!==o&&o}})}0!==d.length&&d.forEach(({rowIndex:n,position:s,displayStrongBorder:l})=>{var d;const c=r.get(n),h=He({position:s,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(d=i.customTheme)&&void 0!==d?d:e});if(o.has(n)){const t=o.get(n);(!c||c.topPx!==h||c.displayStrongBorder!==l||c.sectionWidthPx!==a)&&(Pi(t,a),(null==c?void 0:c.displayStrongBorder)!==l&&(l?t.classList.add("st-last-group-row"):t.classList.remove("st-last-group-row")),c&&c.topPx===h||(t.style.transform=`translate3d(0, ${h}px, 0)`),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a}))}else{const e=$i({position:s,rowHeight:i.rowHeight,displayStrongBorder:l,heightOffsets:i.heightOffsets,customTheme:i.customTheme,isSticky:!1,sectionWidthPx:a});t.appendChild(e),o.set(n,e),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a})}})})(t,y,i,S,s),a(t)};function Ni(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}const Bi=new WeakMap;let zi=1;function Vi(t){var e,n;const i=new Map,o=t.rows.filter(t=>!t.nestedTable&&!t.stateIndicator),s=void 0!==t.pageStartIndex;for(const r of o){let o;o=s?(r.position-(null!==(e=t.pageStartIndex)&&void 0!==e?e:0))*t.rowHeight:t.customTheme?ke({position:r.position,rowHeight:t.rowHeight,heightOffsets:t.heightOffsets,customTheme:t.customTheme}):r.position*t.rowHeight;const l=null!==(n=r.stableRowKey)&&void 0!==n?n:pt(r.rowId);for(const e of t.headerPositions){const n=ot({accessor:e.accessor,rowId:l});i.set(n,{left:e.left,top:o,width:e.width,height:t.rowHeight})}}return i}class qi{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map,this.bodySectionSnapshots=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:i,maxHeaderDepth:o,headerHeight:s,context:r,sectionWidth:l,startColIndex:a=0}=t,d=i||"main";let c=this.headerSections.get(d);c||(c=document.createElement("div"),c.className="left"===i?"st-header-pinned-left":"right"===i?"st-header-pinned-right":"st-header-main",this.headerSections.set(d,c));const h=e.filter(t=>"left"===i?"left"===t.pinned:"right"===i?"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: ${o*s}px;\n `;const u=this.getCachedHeaderCells(d,h,n,o,s,a),f=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,f);const v=this.getCachedContext("header-"+d,r,i,l),p=c.scrollLeft;return Oi(c,u,v,p),i||p===c.scrollLeft||(c.scrollLeft=p),!i&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},v),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):v;Oi(c,u,n,t)}),c}renderBodySection(t){var n,i,o,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:h,rowHeight:u,heightOffsets:f,totalRowCount:v,startColIndex:p=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:b,allFlattenedRows:x,pageStartIndex:y,animationCoordinator:R}=t,S=d||"main";let C=this.bodySections.get(S);C||(C=document.createElement("div"),C.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(S,C));const M=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===M.length)return C.style.display="none",C;C.style.display="";const I=((t,e,n,i)=>t*(e+i.rowSeparatorWidth)-i.rowSeparatorWidth+((null==n?void 0:n.reduce((t,[e,n])=>t+n,0))||0))(void 0!==v?v:l.length,u,f,null!==(n=c.customTheme)&&void 0!==n?n:e);C.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${I}px;\n `;const H=this.getCachedBodyCells(S,M,l,a,u,f,null!==(i=c.customTheme)&&void 0!==i?i:e,p,m,g,b),k=null!==(o=null!=x?x:m)&&void 0!==o?o:l;this.captureSnapshotConfig(S,M,a,k,u,f,null!==(s=c.customTheme)&&void 0!==s?s:e,void 0!==x?null!=y?y:0:void 0);const T=R?this.getFullSectionLayout(S):null,E=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(S,H.length>0&&E>0?p+H.length/E:p);const A=this.getCachedContext("body-"+S,c,d,h);return ji(C,H,A,C.scrollLeft,l,w,R,null!=T?T:void 0),this.renderNestedGridRows(C,S,l,d,A,R),d||this.renderStateRows(C,S,l,A,R),!d&&C&&(C.__renderBodyCells=t=>{C&&ji(C,H,A,t,l,!0)}),C}renderNestedGridRows(t,e,n,i,s,r){var l,a;const d=null!==(l=null==r?void 0:r.isEnabled())&&void 0!==l&&l,c=d?`transform ${r.getDuration()}ms ${r.getEasing()}, height ${r.getDuration()}ms ${r.getEasing()}`:"",h=n.filter(t=>t.nestedTable),u=new Set(h.map(t=>bt(t)));let f=this.nestedGridRowsMap.get(e);f||(f=new Map,this.nestedGridRowsMap.set(e,f)),f.forEach((t,e)=>{var n;u.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),f.delete(e))});const v={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(a=s.customTheme)&&void 0!==a?a:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons,createNestedTable:s.createNestedTable};h.forEach(n=>{var r,l,a,h,u,p,w;const m=bt(n),g=f.get(m);if(g){const t=ke({position:n.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(r=s.customTheme)&&void 0!==r?r:{}}),e=at({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(l=n.nestedTable.expandableHeader.nestedTable)||void 0===l?void 0:l.height,customTheme:null!==(a=s.customTheme)&&void 0!==a?a:{}}),i=g.lastTop!==t,o=g.lastWrapperHeight!==e;return(i||o)&&(g.element.style.transition=c,i&&(g.element.style.transform=`translate3d(0, ${t}px, 0)`),o&&(g.element.style.height=e+"px"),g.lastTop=t,g.lastWrapperHeight=e),g.element.dataset.index=n.position+"",void(g.lastPosition=n.position)}const b=this.stateRowsMap.get(e),x=b&&b.has(m)?s.rowHeight:0,y=at({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(h=n.nestedTable.expandableHeader.nestedTable)||void 0===h?void 0:h.height,customTheme:null!==(u=s.customTheme)&&void 0!==u?u:{}}),R=ke({position:n.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(p=s.customTheme)&&void 0!==p?p:{}});if(i){const e=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const i=t.nestedTable.expandableHeader.nestedTable,o=at({calculatedHeight:n.calculatedHeight,customHeight:null==i?void 0:i.height,customTheme:e.customTheme}),s=ke({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.setAttribute("role","presentation"),r.setAttribute("aria-hidden","true"),r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${s}px, 0)`,r.style.height=o+"px",r.style.pointerEvents="none",r}(n,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(w=s.customTheme)&&void 0!==w?w:{}});d&&x!==y&&(e.style.height=x+"px"),t.appendChild(e),f.set(m,{element:e,lastPosition:n.position,lastTop:R,lastWrapperHeight:y}),d&&x!==y&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=c,e.style.height=y+"px"})})}else{v.depth=n.depth>0?n.depth-1:0;const{element:e,cleanup:i}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:i,heightOffsets:s,customTheme:r,theme:l,rowGrouping:a,depth:d,loadingStateRenderer:c,errorStateRenderer:h,emptyStateRenderer:u,icons:f}=e,{parentRow:v,expandableHeader:p,childAccessor:w,calculatedHeight:m}=n,g=p.nestedTable;if(!g)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=ct(v,w),x=Array.isArray(b)?b:[],y=a&&a[d+1]?a.slice(d+1):void 0,R=g.customTheme?Object.assign(Object.assign({},r),g.customTheme):r,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:m,customHeight:g.height,customTheme:r}),C=at({calculatedHeight:m,customHeight:g.height,customTheme:r}),M=ke({position:t.position,rowHeight:i,heightOffsets:s,customTheme:r}),I=document.createElement("div");I.className="st-row st-nested-grid-row st-row-position-"+t.position,I.setAttribute("role","row"),I.dataset.index=t.position+"",I.style.position="absolute",I.style.left="0",I.style.right="0",I.style.transform=`translate3d(0, ${M}px, 0)`,I.style.height=C+"px",I.style.paddingTop=r.nestedGridPaddingTop+"px",I.style.paddingBottom=r.nestedGridPaddingBottom+"px",I.style.paddingLeft=r.nestedGridPaddingLeft+"px",I.style.paddingRight=r.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");if(H.setAttribute("role","gridcell"),H.style.height="100%",H.style.width="100%",I.appendChild(H),!g.columns)throw Error("createNestedGridRow: nestedTable.columns is required");const k=o(Object.assign(Object.assign({},g),{columns:g.columns,rows:x,theme:l,customTheme:R,height:S,rowGrouping:y,loadingStateRenderer:c,errorStateRenderer:h,emptyStateRenderer:u,icons:f}));if(!e.createNestedTable)throw Error("createNestedGridRow: context.createNestedTable factory was not provided");const T=e.createNestedTable(H,k);T.mount();const E=()=>{T.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,v);d&&x!==y&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),f.set(m,{element:e,cleanup:i,lastPosition:n.position,lastTop:R,lastWrapperHeight:y}),d&&x!==y&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=c,e.style.height=y+"px"})})}})}renderStateRows(t,e,n,i,o){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>bt(t)));let d=this.stateRowsMap.get(e);d||(d=new Map,this.stateRowsMap.set(e,d));const c=null!==(s=null==o?void 0:o.isEnabled())&&void 0!==s&&s,h=c?`transform ${o.getDuration()}ms ${o.getEasing()}, height ${o.getDuration()}ms ${o.getEasing()}`:"";d.forEach((t,e)=>{a.has(e)||(t.element.remove(),d.delete(e))});const u={index:0,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(r=i.customTheme)&&void 0!==r?r:{},loadingStateRenderer:i.loadingStateRenderer,errorStateRenderer:i.errorStateRenderer,emptyStateRenderer:i.emptyStateRenderer};l.forEach((e,n)=>{var o;const s=bt(e),r=ke({position:e.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(o=i.customTheme)&&void 0!==o?o:{}}),l=d.get(s);if(l)return l.lastTop!==r&&(l.element.style.transition=h,l.element.style.transform=`translate3d(0, ${r}px, 0)`,l.lastTop=r),void(l.lastPosition=e.position);const a=((t,e)=>{const{position:n,stateIndicator:i}=t;if(!i)throw Error("createStateRow called without stateIndicator");const o=document.createElement("div");o.className="st-row st-state-row st-row-position-"+n,o.setAttribute("role","row"),o.dataset.index=e.index+"",o.style.width="100%",o.style.transform=`translate3d(0, ${ke({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,o.style.height=e.rowHeight+"px";const s=document.createElement("div");s.className="st-cell st-state-row-cell",s.setAttribute("role","gridcell"),s.style.width="100%",s.style.padding="0";let r=null;return i.state.loading&&e.loadingStateRenderer?r=Ni(e.loadingStateRenderer,{parentRow:i.parentRow}):i.state.error&&e.errorStateRenderer?r=Ni(e.errorStateRenderer,{error:i.state.error,parentRow:i.parentRow}):i.state.isEmpty&&e.emptyStateRenderer&&(r=Ni(e.emptyStateRenderer,{message:i.state.emptyMessage,parentRow:i.parentRow})),r&&("string"==typeof r?s.textContent=r:r instanceof HTMLElement&&s.appendChild(r)),o.appendChild(s),o})(e,Object.assign(Object.assign({},u),{index:n}));a.style.position="absolute",a.style.transform=`translate3d(0, ${r}px, 0)`,a.style.width="100%",c?(a.style.height="0px",a.style.overflow="hidden",t.appendChild(a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.style.transition=h,a.style.height=i.rowHeight+"px"})})):t.appendChild(a),d.set(s,{element:a,lastTop:r,lastPosition:e.position})})}calculateAbsoluteHeaderCells(t,e,n,i,o=0){const s=[];let r=o,l=0;const a=(t,o,d)=>{if(Z(t))return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(Z(t))return!1;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;s.push({header:t,left:l,top:o*i,width:c,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,o,t)}),c+h}if(0===e.length){const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:o*i,width:e,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=e,e}const h=l,u=r;let f=0;return e.forEach(e=>{f+=a(e,o+1,t)}),s.push({header:t,left:h,top:o*i,width:f,height:i,colIndex:u,parentHeader:d}),f}{const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:o*i,width:e,height:(n-o)*i,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),s}calculateAbsoluteBodyCells(t,e,n,i,o,s,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=s?ke({position:t.position,rowHeight:i,heightOffsets:o,customTheme:s}):e*i,a=t.position%2==1;d.forEach((o,s)=>{var d,h;const u=c.get(o.accessor);l.push({header:o,row:t.row,rowIndex:e,colIndex:r+s,rowId:pt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:a,tableRow:t,left:null!==(d=null==u?void 0:u.left)&&void 0!==d?d:0,top:n,width:null!==(h=null==u?void 0:u.width)&&void 0!==h?h:150,height:i})})}),l}getLeafHeaders(t,e){const n=[],i=t=>{if(Z(t))return;const o=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(Z(t))return!1;const e=t.showWhen||"parentExpanded";return o?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>i(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>i(t)),n}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}:${t.excludeFromRender||""}`;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","selectRowOnClick","rowSelectionMode","activeRowId","cellUpdateFlash","oddColumnBackground","hoverRowBackground","oddEvenRowBackground","rowHeight","containerWidth","isLoading","mainSectionViewportWidth","mainSectionContainerWidth","enableVirtualization"].map(e=>`${e}:${t[e]}`).join("|");e+="|getRowClass:"+(t=>{if("function"!=typeof t)return"none";let e=Bi.get(t);return void 0===e&&(e=zi++,Bi.set(t,e)),e+""})(t.getRowClass);const n=t.heightOffsets;if(Array.isArray(n)&&n.length>0){let t="";for(let e=0;n.length>e;e++){const i=n[e];t+=`${i[0]}:${i[1]};`}e+="|offsets:"+t}else e+="|offsets:none";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(",")),t.pinned&&(e+="|pinned:"+t.pinned),void 0!==t.pinnedSectionWidthPx&&(e+="|pinnedSectionWidthPx:"+t.pinnedSectionWidthPx),e}getCachedBodyCells(t,e,n,i,o,s,r,l=0,a,d,c){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(s),f=null!=a&&null!=d&&null!=c,v=this.bodyCellsCache.get(t),p=v&&v.deps.headersHash===h&&v.deps.collapsedHeadersSize===i.size&&v.deps.rowHeight===o&&v.deps.heightOffsetsHash===u&&(f?v.deps.fullTableRowsRef===a&&void 0!==v.deps.bandStart&&void 0!==v.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(v.deps.bandStart,v.deps.bandEnd):v.deps.rowsRef===n);if(p&&v){if(!f)return v.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of v.cells){const i=t.get(n.tableRow.position);void 0!==i&&e.push(n.rowIndex!==i?Object.assign(Object.assign({},n),{rowIndex:i}):n)}return e}let w,m,g;if(f){const t=a.length;m=Math.max(0,d-28),g=Math.min(t,c+28),w=a.slice(m,g)}else w=n;const b=this.calculateAbsoluteBodyCells(e,w,i,o,s,r,l);if(this.bodyCellsCache.set(t,{cells:b,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:i.size,rowHeight:o,heightOffsetsHash:u},f&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!f)return b;const x=new Map;n.forEach((t,e)=>{x.set(t.position,e)});const y=[];for(const t of b){const e=x.get(t.tableRow.position);void 0!==e&&y.push(t.rowIndex!==e?Object.assign(Object.assign({},t),{rowIndex:e}):t)}return y}getCachedHeaderCells(t,e,n,i,o,s=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===i&&r.deps.headerHeight===o)return r.cells;const a=this.calculateAbsoluteHeaderCells(e,n,i,o,s);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:i,headerHeight:o}}),a}getCachedContext(t,e,n,i){const o=this.contextCache.get(t),s="left"===n||"right"===n?i:void 0,r=Object.assign(Object.assign({},e),{pinned:n,pinnedSectionWidthPx:s}),l=this.createContextHash(r);return o&&o.deps.contextHash===l?o.context:(this.contextCache.set(t,{context:r,deps:{contextHash:l}}),r)}setOnRendererHostDiscard(t){this.onRendererHostDiscard=t}invalidateCache(t){t&&"all"!==t?"body"===t?this.bodyCellsCache.clear():"header"===t?this.headerCellsCache.clear():"context"===t&&(this.contextCache.clear(),this.headerCellsCache.clear()):(this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySections.forEach(t=>{v(t,this.onRendererHostDiscard)}),this.headerSections.forEach(t=>{((t,e)=>{if(w=0,t){const n=R(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),C(t).clear(),H(t),d(t)}})(t,this.onRendererHostDiscard)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}getCurrentBodyLayouts(){const t=new Map;return this.bodySectionSnapshots.forEach((e,n)=>{const i=this.bodySections.get(n);i&&t.set(i,Vi(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Vi(e):null}captureSnapshotConfig(t,e,n,i,o,s,r,l){const a=this.getLeafHeaders(e,n),d=[];let c=0;for(const t of a){const e="number"==typeof t.width?t.width:150;d.push({accessor:t.accessor,left:c,width:e}),c+=e}this.bodySectionSnapshots.set(t,{rows:i,headerPositions:d,rowHeight:o,heightOffsets:s,customTheme:r,pageStartIndex:l})}releaseBodySections(){this.bodySections.forEach(t=>{v(t,this.onRendererHostDiscard),t.remove()}),this.bodySections.clear(),this.bodyCellsCache.clear(),this.bodySectionSnapshots.clear(),this.nestedGridRowsMap.forEach(t=>{t.forEach(t=>{var e;null===(e=t.cleanup)||void 0===e||e.call(t),t.element.remove()}),t.clear()}),this.nestedGridRowsMap.clear(),this.stateRowsMap.forEach(t=>{t.forEach(t=>{t.element.remove()}),t.clear()}),this.stateRowsMap.clear()}cleanup(){this.releaseBodySections(),this.headerSections.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.nextColIndexMap.clear()}}const Gi=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Ki=(t,e,n=new Set)=>{for(const i of t)if(!n.has(i.accessor)&&(n.add(i.accessor),i.children&&i.children.length>0)){const t=i.children.some(t=>t.accessor===e);let o=!1;if(!t)for(const t of i.children)if(Ki([t],e,n),!1===t.hide){o=!0;break}(t||o)&&(i.hide=!1)}},_i=t=>t.every(t=>t.hide),Ui=t=>t.every(t=>!t.hide),Ji=t=>{for(const e of t)e.hide=!1,e.children&&e.children.length>0&&Ji(e.children)},Yi=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(Yi(t.children),_i(t.children)&&(t.hide=!0))})},Xi=(t,e)=>{var n;for(const i of t){if(i.accessor===e)return i;if(null===(n=i.children)||void 0===n?void 0:n.length){const t=Xi(i.children,e);if(t)return t}}return null},Qi=t=>{let e=!t.hide,n=!1;if(t.children&&t.children.length>0&&t.children){const i=_i(t.children),o=Ui(t.children);t.hide||i?(e=!1,n=!1):o?(e=!0,n=!1):(e=!1,n=!0)}return{checked:e,indeterminate:n}},Zi=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Zi(t,e))},to=(t,e,n)=>{if(!e.trim())return t;const i=n||Zi;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&i(t,e))};function eo(t,e,n,i){e&&t.appendChild(e),t.appendChild(n),i&&t.appendChild(i)}function no(t,e,n,i,o,s,r){const l=e({headers:n,searchSection:i,listSection:o,resetSection:s,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 io=t=>{let e=t,{headers:n,open:i,searchEnabled:o,searchPlaceholder:s,searchFunction:r,columnEditorConfig:l,icons:a,essentialAccessors:d,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,resetColumns:f}=e,v="",p=null,w=null,m=!1;const g=new Set,b=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),b(t.children))})};b(n);let x=g;const y=document.createElement("div");y.className="st-column-editor-popout "+(i?"open":"");const R=document.createElement("div");R.className="st-column-editor-popout-content",R.addEventListener("click",t=>t.stopPropagation());let S=null,C=null;if(o){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 i=document.createElement("input");return i.type="text",i.value="",i.placeholder=t,i.className="st-filter-input",i.addEventListener("click",t=>t.stopPropagation()),i.addEventListener("input",t=>{v=t.target.value,$()}),n.appendChild(i),e.appendChild(n),{wrapper:e,input:i}}(s);C=t.wrapper,S=t.input}const M=document.createElement("div");M.className="st-column-editor-lists";let I=null;f&&(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}(f));let H=l.customRenderer;H?no(R,H,n,C,M,I,f):eo(R,C,M,I),y.appendChild(R);const k=t=>{p=t,null!==t?m=!0:(m=!1,$())},T=()=>{w=null},E=t=>{w=t,m?W():$()},A=t=>{const e=x;x=t,$(e)},W=()=>{M.querySelectorAll(".st-column-editor-list-section").forEach(t=>{const e=null!==w&&w.panelSection===t.dataset.panelSection;t.querySelectorAll(".st-column-editor-drag-separator").forEach((t,n)=>{t.style.opacity=e&&w.index===n-1?"1":"0"})})},O=(t,e)=>{const n=o?to(t,v,r):t,i=[],s=o&&v.trim().length>0,l=({headers:t,depth:n=0,parent:o=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];i.push({header:t,visualIndex:i.length,depth:n,parent:o,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=s||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:[]}),i},P=(t,e,i,s,f)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(o?to(m,v,r):m).length)return;if(i){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=i,s.appendChild(t)}const g=document.createElement("div");g.className="st-column-editor-list st-column-editor-list-section",g.dataset.panelSection=e,s.appendChild(g);const b=O(t,e),y=(t=>t.some(t=>t.children&&t.children.length>0))(t);b.forEach(t=>{var i;const s=(t=>{var e,n;const{clearHoverSeparator:i,depth:o,doesAnyHeaderHaveChildren:s,draggingRow:r,getDraggingRow:l,getHoveredSeparator:a,expandedHeaders:d,flattenedHeaders:c,forceExpanded:h,header:u,hoveredSeparator:f,panelSection:v,rowIndex:p,setDraggingRow:w,setExpandedHeaders:m,setHoveredSeparator:g,headers:b,getHeaders:x,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:S,previousExpandedHeaders:C}=t,M=()=>x?x():b,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,H=!1!==t.columnEditorConfig.allowColumnPinning,k=Ln(u,I),T=!k,E=document.createDocumentFragment(),A=16*o+"px",W=u.children&&u.children.length>0,{checked:O,indeterminate:P}=Qi(u),$=d.has(u.accessor),F=h||$,L=null!==f&&f.panelSection===(null!=v?v:"main");let D;if(0===p){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=L&&-1===f.index?"1":"0",E.appendChild(t)}const j=document.createElement("div");j.className="st-header-checkbox-item",j.dataset.accessor=u.accessor+"",j.style.paddingLeft=A,j.draggable=!0;const N=t=>!(I.size>0&&!jn(t,I)||(null==S||S(t),y(t),0)),B=t=>{if(t.stopPropagation(),h)return;const e=new Set(d);$?e.delete(u.accessor):e.add(u.accessor),m(e)};let z;if(j.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==i||i(),w(c[p])}),j.addEventListener("dragenter",t=>{t.preventDefault()}),j.addEventListener("dragover",t=>{t.preventDefault();const e=l?l():r;if(e&&e.panelSection===v){const n=t.currentTarget.getBoundingClientRect(),i=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:i})=>{var o,s;const r=t[n];if(r.depth===e.depth)return(null===(o=r.parent)||void 0===o?void 0:o.accessor)!==(null===(s=e.parent)||void 0===s?void 0:s.accessor)?null:i||r.header.children?n-1:n;if(r.depth>e.depth){let o=r,s=n;for(;o.parent&&o.depth>e.depth;){const e=o.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;o=t[n],s=n}const l=s;let a=s;for(let e=s+1;t.length>e&&t[e].depth>o.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=i),h?s-1:a}return null})({flattenedHeaders:c,draggingRow:e,hoveredRowIndex:p,isTopHalfOfRow:n.top+n.height/2>t.clientY});g(null===i?null:{panelSection:null!=v?v:"main",index:i})}}),j.addEventListener("dragend",()=>{const t=l?l():r,e=a?a():f,n=()=>{w(null),g(null)};if(!t||null===e||t.panelSection!==v)return void n();const i=e.index;let o=c[i>t.visualIndex?i:i+1];if(!o)return void n();if(o.depth>t.depth&&o.parent){const t=c.findIndex(t=>t.header.accessor===o.parent.accessor);-1!==t&&(o=c[t])}if(t.header.accessor===o.header.accessor)return void n();if(t.indexPath.length!==o.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===o.indexPath[e]))return void n();const s=M(),d=ci(s,t.header.accessor),h=ci(s,o.header.accessor);if(!d||!h)return void n();const{newHeaders:u,emergencyBreak:p}=fi(s,d,h);p||N(u),n()}),s){const e=document.createElement("div");if(e.className="st-header-icon-container",W){const t=void 0!==C?h||C.has(u.accessor):F,n=!h&&void 0!==C&&t!==F,i=n?t:F,o=document.createElement("div");o.className="st-column-editor-expand-icon st-expand-icon-container "+(i?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-expanded",i+""),o.setAttribute("aria-label",i?`Collapse ${u.label} column`:`Expand ${u.label} column`),o.appendChild(Ze("st-expand-icon")),o.addEventListener("click",B),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),B(t))}),e.appendChild(o),z=o,n&&(D=()=>{wn(j,F,{ariaLabelWhenExpanded:`Collapse ${u.label} column`,ariaLabelWhenCollapsed:`Expand ${u.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||j.appendChild(e)}const V=un({checked:O,indeterminate:P,onChange:t=>{if(!T)return;const e=M(),n=Xi(e,u.accessor);if(!n)return;const i=!(!n.children||0>=n.children.length);n.hide=!t,t?(Ki(e,n.accessor),i&&n.children&&n.children.length>0&&(_i(n.children)||Ui(n.children)?_i(n.children)&&n.children[0]&&(n.children[0].hide=!1,Ki(e,n.children[0].accessor)):Ji(n.children))):Yi(e);const o=[...e];if(y(An(o)),R){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})(o);R(t)}}});T||(V.element.classList.add("st-checkbox-disabled"),V.element.style.pointerEvents="none");const q=document.createElement("div");q.className="st-drag-icon-container";const G=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof G?q.innerHTML=G:G instanceof HTMLElement||G instanceof SVGSVGElement?q.appendChild(G.cloneNode(!0)):q.appendChild(nn("st-drag-icon"));const K=document.createElement("div");K.className="st-column-label-container",K.textContent=u.label;const _="left"===u.pinned||"right"===u.pinned?u.pinned:null,U=!!_&&!k,J=!_&&"main"===v,Y=!_&&"main"===v,X=()=>{const t=qn(M(),u.accessor,"left",I);t&&N(t)},Q=()=>{const t=qn(M(),u.accessor,"right",I);t&&N(t)},Z=()=>{const t=qn(M(),u.accessor,"main",I);t&&N(t)},{rowRenderer:tt}=t.columnEditorConfig;if(tt){const t=tt({accessor:u.accessor,header:u,components:{expandIcon:z,checkbox:V.element,dragIcon:q,labelContent:K},panelSection:v,essential:k,canToggleVisibility:T,allowColumnPinning:H,pinControl:H&&0===o?{pinnedSide:_,canPinLeft:J,canPinRight:Y,canUnpin:U,pinLeft:X,pinRight:Q,unpin:Z}:void 0});t instanceof HTMLElement?j.appendChild(t):"string"==typeof t&&(j.innerHTML=t)}else if(j.appendChild(V.element),j.appendChild(q),j.appendChild(K),H&&0===o){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()}),_){const e=document.createElement("div"),n=k;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===_?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",U&&e.addEventListener("click",t=>{t.stopPropagation(),Z()}),t.appendChild(e)}else{if(J){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(),X()}),t.appendChild(e)}if(Y){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(),Q()}),t.appendChild(e)}}j.appendChild(t)}E.appendChild(j);const et=document.createElement("div");return et.className="st-column-editor-drag-separator",et.style.opacity=L&&f.index===p?"1":"0",E.appendChild(et),{fragment:E,scheduleExpandIconAnimation:D}})({allHeaders:n,clearHoverSeparator:T,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:p,getDraggingRow:()=>p,getHoveredSeparator:()=>w,expandedHeaders:x,flattenedHeaders:b,forceExpanded:o&&v.trim().length>0,header:t.header,hoveredSeparator:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:A,setHoveredSeparator:E,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,getHeaders:()=>n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:f});g.appendChild(s.fragment),null===(i=s.scheduleExpandIconAnimation)||void 0===i||i.call(s)})},$=t=>{M.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:i,unpinned:o,pinnedRight:s}=Fn(n);if(e)P(i,"left","Pinned Left",M,t),P(o,"main","Main",M,t),P(s,"right","Pinned Right",M,t);else{const e=[...i,...o,...s];P(e,"main",null,M,t)}};return $(),{element:y,update:t=>{let e=!1,v=!1;void 0!==t.searchEnabled&&t.searchEnabled!==o&&(o=t.searchEnabled,e=!0),void 0!==t.searchPlaceholder&&(s=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction,e=!0),void 0!==t.icons&&(a=t.icons),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&&(f=t.resetColumns);let p=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==H&&(H=n,p=!0,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(i=t.open,i?y.classList.add("open"):y.classList.remove("open")),S&&void 0!==t.searchPlaceholder&&(S.placeholder=t.searchPlaceholder),void 0!==t.headers&&(n=t.headers,v=!0),p&&(R.innerHTML="",H?no(R,H,n,C,M,I,f):eo(R,C,M,I)),!e&&v&&(t=>{var e,n;const i=Array.from(M.querySelectorAll(".st-header-checkbox-item"));if(0===i.length)return!1;const o=!1!==l.allowColumnPinning,{pinnedLeft:s,unpinned:r,pinnedRight:a}=Fn(t),d=o?[{headers:s,panelSection:"left"},{headers:r,panelSection:"main"},{headers:a,panelSection:"right"}]:[{headers:[...s,...r,...a],panelSection:"main"}],c=[];for(const t of d)0!==t.headers.length&&c.push(...O(t.headers,t.panelSection));if(c.length!==i.length)return!1;for(let t=0;c.length>t;t++){if(i[t].dataset.accessor!==c[t].header.accessor+"")return!1;const o=i[t].closest(".st-column-editor-list");if((null!==(e=null==o?void 0:o.dataset.panelSection)&&void 0!==e?e:null)!==(null!==(n=c[t].panelSection)&&void 0!==n?n:null))return!1}for(let t=0;c.length>t;t++){const{checked:e,indeterminate:n}=Qi(c[t].header);hn(i[t],e,n)}return!0})(n)||(e||v||p)&&$()},destroy:()=>{S&&(S.removeEventListener("input",()=>{}),S.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},oo=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:i,offsetStartIndex:o,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:f,sectionScrollController:v,startColIndex:p,resolveBodyRowIndex:w}=t,m=document.createElement("div");m.className=h?"st-sticky-section-"+h:"st-sticky-section-main",m.style.position="relative",m.style.height=i+"px",h&&u?(m.style.width=u+"px",m.style.flexGrow="0",m.style.flexShrink="0"):m.style.flexGrow="1";const g=((t,e)=>{const n=[],i=t=>{if(Z(t))return;const o=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return o?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});t.singleRowChildren&&n.push(t),e.length>0?e.forEach(t=>i(t)):t.singleRowChildren||n.push(t)}else n.push(t)};return t.forEach(t=>i(t)),n})(e,c),b=new Map;let x=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;b.set(t.accessor,{left:x,width:e}),x+=e});const y=h&&"number"==typeof u?u:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const i=-1!==o&&e>=o,c=i?s:0,h=e*(r+1)+c,u=i?e:n.length-e,f=document.createElement("div");f.className="st-row st-sticky-parent",f.style.position="absolute",f.style.top="0px",f.style.left="0",f.style.right="0",f.style.height=r+"px",f.style.transform=`translateY(${h}px)`,f.style.zIndex=u+"",f.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var i,o;const s=b.get(e.accessor),l=p+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:pt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(i=null==s?void 0:s.left)&&void 0!==i?i:0,top:0,width:null!==(o=null==s?void 0:s.width)&&void 0!==o?o:150,height:r},c=Tn(a,d);f.appendChild(c)}),m.appendChild(f);const v=$i({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(v)}),v&&f&&v.registerPane("pinned-left"===f?"pinned-left":"pinned-right"===f?"pinned-right":"main",m,"sticky"),m},so=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),i=t.querySelector(".st-sticky-section-main"),o=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),i instanceof HTMLElement&&e.unregisterPane("main",i),o instanceof HTMLElement&&e.unregisterPane("pinned-right",o)}t.remove()};class ro{constructor(){this.footerInstance=null,this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=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 qi}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}setOnRendererHostDiscard(t){this.sectionRenderer.setOnRendererHostDiscard(t)}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}invalidateCustomFooterCache(){this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,i){var o,s,r,l,a,d,c,h,u,f,v,p,w,m;if(!t||i.config.hideHeader)return;t.style.height=e+"px";const g=Wn(i.effectiveHeaders,"left")||Wn(i.effectiveHeaders,void 0)||Wn(i.effectiveHeaders,"right");t.style.minHeight=g?"":e+"px";const b=t.parentElement;if(b)if(b.setAttribute("aria-rowcount",1+i.localRows.length+""),b.setAttribute("aria-colcount",i.effectiveHeaders.length+""),i.config.enableRowSelection){const t="multiple"===(null!==(o=i.config.rowSelectionMode)&&void 0!==o?o:"multiple");b.setAttribute("aria-multiselectable",t?"true":"false")}else b.removeAttribute("aria-multiselectable");const x=null!==(r=null===(s=i.dimensionManager)||void 0===s?void 0:s.getState())&&void 0!==r?r:{containerWidth:0,calculatedHeaderHeight:i.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:y,leftWidth:R,rightWidth:S}=mi({headers:i.effectiveHeaders,containerWidth:x.containerWidth,collapsedHeaders:i.collapsedHeaders}),C=null===(l=i.sortManager)||void 0===l?void 0:l.getState(),M=null===(a=i.filterManager)||void 0===a?void 0:a.getState(),I=null!==(c=null===(d=i.rowSelectionManager)||void 0===d?void 0:d.getSelectedRowCount())&&void 0!==c?c:0,H={reverse:!1,collapsedHeaders:i.collapsedHeaders,getCollapsedHeaders:i.getCollapsedHeaders,columnBorders:null!==(h=i.config.columnBorders)&&void 0!==h&&h,columnReordering:null!==(u=i.config.columnReordering)&&void 0!==u&&u,columnResizing:null!==(f=i.config.columnResizing)&&void 0!==f&&f,containerWidth:x.containerWidth,mainSectionContainerWidth:y,mainSectionViewportWidth:wi({containerWidth:x.containerWidth,leftWidth:R,rightWidth:S}),enableVirtualization:!1!==i.config.enableVirtualization,enableHeaderEditing:i.config.enableHeaderEditing,enableRowSelection:i.config.enableRowSelection,rowSelectionMode:null!==(v=i.config.rowSelectionMode)&&void 0!==v?v:"multiple",selectedRowCount:I,filters:null!==(p=null==M?void 0:M.filters)&&void 0!==p?p:{},icons:i.resolvedIcons,selectedColumns:i.config.selectableColumns&&i.selectionManager?i.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:i.selectionManager&&(i.config.selectableCells||i.config.selectableColumns)?i.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(w=null==C?void 0:C.sort)&&void 0!==w?w:null,autoExpandColumns:null!==(m=i.config.autoExpandColumns)&&void 0!==m&&m,getShrinkFloors:i.getShrinkFloors,onAutoExpandNaturalWidths:i.onAutoExpandNaturalWidths,essentialAccessors:i.essentialAccessors,selectableColumns:i.config.selectableColumns,headers:i.effectiveHeaders,rows:i.localRows,headerHeight:i.customTheme.headerHeight,lastHeaderIndex:i.effectiveHeaders.length-1,onSort:t=>{i.sortManager&&i.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{i.filterManager&&i.filterManager.updateFilter(t)},handleClearFilter:t=>{i.filterManager&&i.filterManager.clearFilter(t)},getHeaders:()=>i.getHeaders(),handleSelectAll:t=>{var e;null===(e=i.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{if("function"==typeof t){const e=i.getCollapsedHeaders?i.getCollapsedHeaders():i.collapsedHeaders;i.setCollapsedHeaders(t(e))}else i.setCollapsedHeaders(t);i.onRender()},setHeaders:t=>{i.setHeaders("function"==typeof t?t(i.getHeaders()):t),i.onRender()},setIsResizing:t=>{i.setIsResizing("function"==typeof t?t(i.isResizing):t)},onColumnWidthChange:i.config.onColumnWidthChange,onColumnOrderChange:i.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{i.setHeaders(t),i.onRender()},onHeaderEdit:i.config.onHeaderEdit,onColumnSelect:i.config.onColumnSelect,selectColumns:i.selectionManager&&i.config.selectableColumns?(t,e)=>{i.selectionManager.selectColumns(t,e),i.onRender()}:t=>{},setSelectedColumns:i.selectionManager&&i.config.selectableColumns?t=>{const e=i.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;i.selectionManager.setSelectedColumns(n),i.onRender()}:t=>{},setSelectedCells:i.selectionManager?t=>{var e;const n=i.selectionManager.getSelectedCells(),o="function"==typeof t?t(n):t;i.selectionManager.setSelectedCells(o instanceof Set?o:new Set),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},setInitialFocusedCell:i.selectionManager?t=>{var e;i.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=i.onRender)||void 0===e||e.call(i)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=i.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:i.draggedHeaderRef,hoveredHeaderRef:i.hoveredHeaderRef,headerRegistry:i.headerRegistry,forceUpdate:()=>i.onRender(),mainBodyRef:i.mainBodyRef,pinnedLeftRef:i.pinnedLeftRef,pinnedRightRef:i.pinnedRightRef,accordionAxis:i.accordionAxis,animationCoordinator:i.animationCoordinator,onRendererHostDiscard:i.config.onRendererHostDiscard},k=i.effectiveHeaders.filter(t=>"left"===t.pinned),T=i.effectiveHeaders.filter(t=>!t.pinned),E=i.effectiveHeaders.filter(t=>"right"===t.pinned);let A=0;const W=[];if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:R,startColIndex:A});i.pinnedLeftHeaderRef.current=e,W.push(e),e.parentElement!==t&&t.insertBefore(e,t.firstChild),A=this.sectionRenderer.getNextColIndex("left")}if(T.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:y,startColIndex:A});if(i.mainHeaderRef.current=e,W.push(e),e.parentElement!==t){const n=i.pinnedRightHeaderRef.current;n&&n.parentElement===t?t.insertBefore(e,n):t.appendChild(e)}A=this.sectionRenderer.getNextColIndex("main")}if(E.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:i.effectiveHeaders,collapsedHeaders:i.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:i.customTheme.headerHeight,context:H,sectionWidth:S,startColIndex:A});i.pinnedRightHeaderRef.current=e,W.push(e),e.parentElement!==t&&t.appendChild(e)}Array.from(t.children).forEach(t=>{W.includes(t)||t.remove()})}renderBody(t,e,n){var i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g,b,x,y,R,S,C,M,I,H,k,T;if(!t)return;if(Wn(n.effectiveHeaders,"left")||Wn(n.effectiveHeaders,void 0)||Wn(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(o=null===(i=null==e?void 0:e.heightMap)||void 0===i?void 0:i.totalHeight)&&void 0!==o?o:0;t.style.minHeight=n+"px"}const E=e.rowsToRender||e.currentTableRows,A=!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!==(s=n.config.selectableColumns)&&void 0!==s&&s},{positionOnlyBody:n.positionOnlyBody}),A){this.sectionRenderer.releaseBodySections(),t.innerHTML="",n.mainBodyRef.current=null,n.pinnedLeftRef.current=null,n.pinnedRightRef.current=null;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 W=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:O,leftWidth:P,rightWidth:$}=mi({headers:n.effectiveHeaders,containerWidth:W.containerWidth,collapsedHeaders:n.collapsedHeaders}),F=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,L=null!==(c=W.maxHeaderDepth)&&void 0!==c?c:1,D=null===(h=Y(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,j={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(f=null===(u=n.selectionManager)||void 0===u?void 0:u.getSelectedColumns())&&void 0!==f?f:new Set,rowsWithSelectedCells:null!==(p=null===(v=n.selectionManager)||void 0===v?void 0:v.getRowsWithSelectedCells())&&void 0!==p?p:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectRowOnClick:null!==(m=n.config.selectRowOnClick)&&void 0!==m&&m,rowSelectionMode:null!==(g=n.config.rowSelectionMode)&&void 0!==g?g:"multiple",selectedRowCount:F,activeRowId:null!==(x=null===(b=n.rowSelectionManager)||void 0===b?void 0:b.getActiveRowId())&&void 0!==x?x:null,cellUpdateFlash:n.config.cellUpdateFlash,oddColumnBackground:n.config.oddColumnBackground,hoverRowBackground:null===(y=n.config.hoverRowBackground)||void 0===y||y,hoverScopeId:n.hoverScopeId,oddEvenRowBackground:n.config.oddEvenRowBackground,getRowClass:n.config.getRowClass,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeaderAccessor:D,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:L,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:W.containerWidth,mainSectionContainerWidth:O,mainSectionViewportWidth:wi({containerWidth:W.containerWidth,leftWidth:P,rightWidth:$}),enableVirtualization:!1!==n.config.enableVirtualization,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var i;null===(i=n.rowSelectionManager)||void 0===i||i.handleRowSelect(t,e)},handleToggleRow:t=>{var e;null===(e=n.rowSelectionManager)||void 0===e||e.handleToggleRow(t)},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!==(R=n.config.theme)&&void 0!==R?R:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,createNestedTable:n.createNestedTable,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,e,i)=>{var o;return null===(o=n.selectionManager)||void 0===o?void 0:o.handleMouseOver(t,e,i)},onRendererHostDiscard:n.config.onRendererHostDiscard,isRowSelected:t=>{var e,i;return null!==(i=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==i&&i},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading,accordionAxis:n.accordionAxis},N=n.effectiveHeaders.filter(t=>"left"===t.pinned),B=n.effectiveHeaders.filter(t=>!t.pinned),z=n.effectiveHeaders.filter(t=>"right"===t.pinned);let q=0;const G=[],K=n.positionOnlyBody?void 0:n.animationCoordinator;if(N.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:j,sectionWidth:P,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});n.pinnedLeftRef.current=i,G.push(i),i.parentElement!==t&&t.insertBefore(i,t.firstChild),q=this.sectionRenderer.getNextColIndex("left")}if(B.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,context:j,sectionWidth:O,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});if(n.mainBodyRef.current=i,G.push(i),i.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(i,e):t.appendChild(i)}q=this.sectionRenderer.getNextColIndex("main")}if(z.length>0){const i=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:E,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:j,sectionWidth:$,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:q,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:K});n.pinnedRightRef.current=i,G.push(i),i.parentElement!==t&&t.appendChild(i)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(so(this.stickyParentsContainer,null!==(S=n.sectionScrollController)&&void 0!==S?S:null),this.stickyParentsContainer=null);const i=n.externalScrollActive?null!==(C=n.stickyParentsScrollTop)&&void 0!==C?C:0:null!==(I=null===(M=n.mainBodyRef.current)||void 0===M?void 0:M.scrollTop)&&void 0!==I?I:0,o=t.offsetWidth-t.clientWidth,s={left:0,main:N.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:B.length>0?this.sectionRenderer.getNextColIndex("main"):N.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=E.filter(t=>!t.nestedTable&&!t.stateIndicator),l=new Map;if(r.forEach((t,e)=>{var n;const i=null!==(n=t.stableRowKey)&&void 0!==n?n:pt(t.rowId);l.set(i,e)}),this.stickyParentsContainer=((t,e)=>{const{stickyParents:n,stickySectionColStart:i,stickyBodyRowIndexByRowKey:o}=t;if(0===n.length)return null;const s=t=>{var e,n;const i=null!==(e=t.stableRowKey)&&void 0!==e?e:pt(t.rowId);return null!==(n=o.get(i))&&void 0!==n?n:t.position},{treeTransitionOffset:r,offsetStartIndex:l}=((t,e,n,i,o,s)=>{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],i=t[e+1];if(!i)break;if(i.depth===n.depth){h=e;break}if(n.depth>i.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 f=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;f++}if(0===f)return{treeTransitionOffset:0,offsetStartIndex:c};const v=e[0];let p;return p=n?n.rowTopPositions[v.position]:v.position*(i+o.rowSeparatorWidth),{treeTransitionOffset:-((h+1-f)*i+Math.max(0,s-p)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),a=n.length>0?n.length*(e.rowHeight+1)+r:0,d=`calc(100% - ${t.scrollbarWidth}px - ${e.enableColumnEditor?"29.5px":"0px"})`,c=document.createElement("div");c.className="st-sticky-top",c.setAttribute("aria-hidden","true"),c.style.height=a+"px",c.style.width=d,t.externalScrollActive?c.style.marginBottom=-a+"px":c.style.top=t.calculatedHeaderHeight+"px";const h=e.headers.filter(t=>!t.pinned),u=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const o=oo({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:u,startColIndex:i.left,resolveBodyRowIndex:s});c.appendChild(o)}const f=oo({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:l,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:h,stickyHeight:a,stickyParents:n,treeTransitionOffset:r,sectionScrollController:u,startColIndex:i.main,resolveBodyRowIndex:s});if(c.appendChild(f),t.pinnedRightColumns.length>0){const o=oo({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:u,startColIndex:i.right,resolveBodyRowIndex:s});c.appendChild(o)}return c})({calculatedHeaderHeight:W.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:N,pinnedLeftWidth:P,pinnedRightColumns:z,pinnedRightWidth:$,scrollTop:i,scrollbarWidth:o,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,enableColumnEditor:V(n.config.enableColumnEditor,null===(H=n.config.columnEditorConfig)||void 0===H?void 0:H.showToggle),headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:j,sectionScrollController:null!==(k=n.sectionScrollController)&&void 0!==k?k:null}),this.stickyParentsContainer){const e=t.parentElement;e&&this.stickyParentsContainer.parentElement!==e?e.insertBefore(this.stickyParentsContainer,t):e||t.appendChild(this.stickyParentsContainer)}}else this.stickyParentsContainer&&(so(this.stickyParentsContainer,null!==(T=n.sectionScrollController)&&void 0!==T?T:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{G.includes(t)||t.remove()})}renderFooter(t,e,n,i,o){var s,r,l,a,d,c,h,u,f,v,p,w,m;if(!t)return;const g=!!o.config.footerRenderer,b=o.config.enablePagination&&!o.config.hideFooter;if(g||(this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null),!g&&!b)return void(t.innerHTML="");const x=null!==(s=o.config.rowsPerPage)&&void 0!==s?s:10,y=Math.ceil(e/x);if(g){const s=(n-1)*x+1,c=Math.min(n*x,e),h=`${n}|${e}|${x}|${y}|${o.config.hideFooter?1:0}|${null!==(r=o.config.footerRenderKey)&&void 0!==r?r:""}`;if(t.childNodes.length>0&&this.lastCustomFooterRenderer===o.config.footerRenderer&&this.lastCustomFooterKey===h)return void(this.footerInstance=null);this.lastCustomFooterRenderer=o.config.footerRenderer,this.lastCustomFooterKey=h;const u=null!==(l=o.config.serverSidePagination)&&void 0!==l&&l,f=t=>{if(u&&o.config.onPageChange)return o.config.onPageChange(t)},v=o.config.footerRenderer({currentPage:n,endRow:c,hasNextPage:y>n,hasPrevPage:n>1,nextIcon:null===(a=o.resolvedIcons)||void 0===a?void 0:a.next,onNextPage:async()=>{y>n&&(i(n+1),o.config.onNextPage&&await o.config.onNextPage(n+1),await f(n+1))},onPageChange:t=>{i(t),f(t)},onPrevPage:()=>{n>1&&(i(n-1),f(n-1))},prevIcon:null===(d=o.resolvedIcons)||void 0===d?void 0:d.prev,rowsPerPage:x,startRow:s,totalPages:y,totalRows:e});return t.innerHTML="",v instanceof HTMLElement?t.appendChild(v):"string"==typeof v&&(t.innerHTML=v),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(c=o.config.hideFooter)&&void 0!==c&&c,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,enablePagination:null!==(h=o.config.enablePagination)&&void 0!==h&&h,totalPages:y,totalRows:e,prevIcon:null===(u=o.resolvedIcons)||void 0===u?void 0:u.prev,nextIcon:null===(f=o.resolvedIcons)||void 0===f?void 0:f.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:i,onNextPage:o,onUserPageChange:s,rowsPerPage:r,enablePagination:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const f=document.createElement("div");f.className="st-footer";const v=()=>{f.innerHTML="";const t=e>1,n=a>e,l=e===a,p=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!o||!u&&l,b=document.createElement("div");b.className="st-footer-info";const x=document.createElement("span");x.className="st-footer-results-text",x.textContent=`Showing ${p} to ${w} of ${d.toLocaleString()} results`,b.appendChild(x),f.appendChild(b);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 i,o;if(t>8)if(e-7>t){const e=7;i=t-e,o=t+(15-e-1)}else i=Math.max(1,e-15+1),o=e;else i=1,o=14;i>2?(n.push(1),n.push(-1)):2===i&&n.push(1);for(let t=i;o>=t;t++)n.push(t);return e-1>o?(n.push(-2),n.push(e)):o===e-1&&n.push(e),n})(e,a),S=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const o=document.createElement("button"),r=n>0&&0>R[n-1];o.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),o.textContent=""+t,o.setAttribute("aria-label","Go to page "+t),e===t&&o.setAttribute("aria-current","page"),o.addEventListener("click",()=>(async t=>{1>t||t>a||(i(t),s&&await s(t))})(t)),y.appendChild(o),S.push({button:o,page:t,afterEllipsis:r})}}),S.forEach((t,n)=>{const{button:i,page:o,afterEllipsis:s}=t,r=n+1,l=e===o,a=i.previousElementSibling,d=i.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||s||c)&&i.classList.add("st-page-btn--compact-hidden")});const C=document.createElement("button");C.className="st-next-prev-btn "+(m?"disabled":""),C.disabled=m,C.setAttribute("aria-label","Go to previous page"),Gi(C,c||Qe("st-next-prev-icon")),C.addEventListener("click",async()=>{const t=e-1;1>t||(i(t),s&&await s(t))}),y.appendChild(C);const M=document.createElement("button");M.className="st-next-prev-btn "+(g?"disabled":""),M.disabled=g,M.setAttribute("aria-label","Go to next page"),Gi(M,h||Ze("st-next-prev-icon")),M.addEventListener("click",async()=>{const t=e+1;if(o&&e===a&&!await o(e))return u=!1,void v();t>a&&!o||(i(t),s&&await s(t))}),y.appendChild(M),f.appendChild(y)};return v(),{element:f,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(i=t.onPageChange),void 0!==t.onNextPage&&(o=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.enablePagination&&(l=t.enablePagination),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?f.style.display="none":(f.style.display="flex",v())},destroy:()=>{f.remove()}}})({currentPage:n,hideFooter:null!==(v=o.config.hideFooter)&&void 0!==v&&v,onPageChange:i,onNextPage:o.config.onNextPage,onUserPageChange:o.config.onPageChange,rowsPerPage:x,enablePagination:null!==(p=o.config.enablePagination)&&void 0!==p&&p,totalPages:y,totalRows:e,prevIcon:null===(w=o.resolvedIcons)||void 0===w?void 0:w.prev,nextIcon:null===(m=o.resolvedIcons)||void 0===m?void 0:m.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,i,o){if(!t)return;if(!o.config.enableColumnEditor)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=o.getPristineDefaultHeaders();t&&(o.setHeaders(An(t)),o.onRender())};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:i.text,enableColumnEditor:o.config.enableColumnEditor,headers:o.headers,open:e,searchEnabled:i.searchEnabled,searchPlaceholder:i.searchPlaceholder,searchFunction:i.searchFunction,columnEditorConfig:i,icons:o.resolvedIcons,essentialAccessors:o.essentialAccessors,setHeaders:t=>{o.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),o.onRender()},onColumnVisibilityChange:o.config.onColumnVisibilityChange,onColumnOrderChange:o.config.onColumnOrderChange,resetColumns:s,setOpen:n});else{const r=(t=>{let{columnEditorText:e,enableColumnEditor:n,headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:f,onColumnOrderChange:v,setOpen:p}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=!1!==a.showToggle,m=document.createElement("div");m.className=`st-column-editor${w?"":" st-column-editor--no-toggle"}${o?" open":""}`,m.style.width=w?"29.5px":"0px";const g=()=>{p(!o)};let b=null;w&&(b=document.createElement("div"),b.className="st-column-editor-text",b.textContent=e,m.addEventListener("click",g),m.appendChild(b));const x=io({headers:i,open:o,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:f,onColumnOrderChange:v});m.appendChild(x.element);const y={update:t=>{void 0!==t.open&&(o=t.open,t.open?m.classList.add("open"):m.classList.remove("open")),void 0!==t.setOpen&&(p=t.setOpen),void 0!==t.columnEditorText&&b&&(b.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(c=t.essentialAccessors),void 0!==t.icons&&(d=t.icons),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,icons:t.icons,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{w&&m.removeEventListener("click",g),x.destroy(),m.remove()}};return m.__columnEditor=y,Object.assign({element:m},y)})({columnEditorText:i.text,enableColumnEditor:o.config.enableColumnEditor,headers:o.headers,open:e,searchEnabled:i.searchEnabled,searchPlaceholder:i.searchPlaceholder,searchFunction:i.searchFunction,columnEditorConfig:i,icons:o.resolvedIcons,essentialAccessors:o.essentialAccessors,setHeaders:t=>{o.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),o.onRender()},onColumnVisibilityChange:o.config.onColumnVisibilityChange,onColumnOrderChange:o.config.onColumnOrderChange,resetColumns:s,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,i,o,s,r,l){var a,d,c,h,u;if(!t||!r)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;const v=null!==(c=null===(d=l.mainBodyRef.current)||void 0===d?void 0:d.clientWidth)&&void 0!==c?c:Math.max(0,r.clientWidth-n-i);if(1>=e-v&&1>=f.scrollWidth-f.clientWidth)return this.horizontalScrollbarRef.current&&(pi(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null));this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?vi(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(h=l.config.columnEditorConfig)||void 0===h?void 0:h.showToggle),sectionScrollController:null!==(u=l.sectionScrollController)&&void 0!==u?u:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h,u;if(!r||!t)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return vi(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(d=l.config.columnEditorConfig)||void 0===d?void 0:d.showToggle),sectionScrollController:null!==(c=l.sectionScrollController)&&void 0!==c?c:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(h=l.sectionScrollController)&&void 0!==h?h:null;const v=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:i,pinnedRightWidth:o,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a,sectionScrollController:d,forceScrollable:c=!1}=t;if(!c){const t=e.clientWidth;if(1>=Math.max(e.scrollWidth,n)-t)return null}const h=a?B:0,u=(a?o+1:o)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),f=document.createElement("div");if(f.className="st-horizontal-scrollbar-container",i>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=i+"px";const e=document.createElement("div");e.style.width=s+"px",t.appendChild(e),f.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),f.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-right",t.style.width=u+"px";const e=document.createElement("div");e.style.width=r+"px",t.appendChild(e),f.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(h>0){const t=document.createElement("div");t.style.width=h-1.5+"px",t.style.height="100%",t.style.flexShrink="0",f.appendChild(t)}return f})({mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:i,pinnedLeftContentWidth:o,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:V(l.config.enableColumnEditor,null===(u=l.config.columnEditorConfig)||void 0===u?void 0:u.showToggle),sectionScrollController:this.sectionScrollController,forceScrollable:!0});if(v){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(v,e.nextSibling):t.appendChild(v),this.horizontalScrollbarRef.current=v}this.scrollbarTimeoutId=null},1))}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&&(pi(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(so(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function lo(t){const{rows:e=[],rowGrouping:n=[],getRowId:i,expandedRows:o=new Map,collapsedRows:s=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:c=!1,headers:h=[],rowHeight:u=40,headerHeight:f=40,customTheme:v}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],o=[e],s=vt({row:t,getRowId:i,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0}),r=gt({getRowId:i,row:t,depth:0,index:e,rowPath:n,rowIndexPath:o,groupingKey:void 0,parentStableKey:null});return Object.assign({row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:s,rowPath:n,rowIndexPath:o,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:r},rt(t)?{isLoadingSkeleton:!0}:{})});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const p=[],w=[],m=[],g=[];let b=0;const x=(t,e,y=[],R=[],S=[],C=null)=>{t.forEach((t,M)=>{var I,H;const k=n[e],T=p.length,E=[...y,M],A=[...R,M],W=vt({row:t,getRowId:i,depth:e,index:M,rowPath:E,rowIndexPath:A,groupingKey:k}),O=gt({getRowId:i,row:t,depth:e,index:M,rowPath:E,rowIndexPath:A,groupingKey:k,parentStableKey:C}),P=p.length,$=Object.assign({row:t,depth:e,displayPosition:b,groupingKey:k,position:T,isLastGroupRow:!1,rowId:W,rowPath:E,rowIndexPath:A,absoluteRowIndex:T,parentIndices:S.length>0?[...S]:void 0,stableRowKey:O},rt(t)?{isLoadingSkeleton:!0}:{});p.push($),w.push($),b++;const F=bt({stableRowKey:O,rowId:W});if(Rt(F,e,r,o,s)&&n.length>e){const n=null==l?void 0:l.get(F),i=((t,e)=>{const n=t[e];return ft(n)?n:[]})(t,k),o=h.find(t=>t.expandable&&t.nestedTable);if((null==o?void 0:o.nestedTable)&&i.length>0){const n=p.length,s=(null===(I=o.nestedTable.customTheme)||void 0===I?void 0:I.rowHeight)||u,r=(null===(H=o.nestedTable.customTheme)||void 0===H?void 0:H.headerHeight)||f,l=(({childRowCount:t,rowHeight:e,headerHeight:n,customTheme:i})=>Math.min(n+i.rowSeparatorWidth+t*(e+i.rowSeparatorWidth)+i.nestedGridPaddingTop+i.nestedGridPaddingBottom+i.nestedGridBorderWidth,i.nestedGridMaxHeight+i.nestedGridPaddingTop+i.nestedGridPaddingBottom+i.nestedGridBorderWidth))({childRowCount:i.length,rowHeight:s,headerHeight:r,customTheme:v}),a=at({calculatedHeight:l,customHeight:o.nestedTable.height,customTheme:v});m.push([n,a-u]);const d=[...E,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:A,stableRowKey:xt(F,k),nestedTable:{parentRow:t,expandableHeader:o,childAccessor:k,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&c){const i=p.length,o=[...E,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:i,isLastGroupRow:!1,rowId:o,rowPath:o,rowIndexPath:A,stableRowKey:xt(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:i,parentIndices:[...S,P]})}else if(n.loading&&!a){const t=p.length,n=[...E,k,"loading-skeleton"];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:A,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...S,P]})}}else if(i.length>0){const t=[...E,k],n=[...A];x(i,e+1,t,n,[...S,P],O)}}0===e&&g.push(p.length)})};return x(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&p.length>n&&(p[n].isLastGroupRow=!0)}),{flattenedRows:p,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}class ao{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null,this.tableRenderer=new ro}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}getCurrentBodyLayouts(){return this.tableRenderer.getCurrentBodyLayouts()}setOnRendererHostDiscard(t){this.tableRenderer.setOnRendererHostDiscard(t)}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null),t&&"all"!==t&&"body"!==t&&"context"!==t||(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null),t&&"all"!==t&&"header"!==t||(this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null)}invalidateCustomFooterCache(){this.tableRenderer.invalidateCustomFooterCache()}computeEffectiveHeaders(t,e,n,i){var o;let s=[...t];return Ne(e)&&!(null===(o=null==t?void 0:t[0])||void 0===o?void 0:o.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,editable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,sortable:!1,filterable:!1,align:"center"},...s]),null!=i&&i>0?Ht(s,{containerWidth:i}):Ht(s)}primeLastProcessedResult(t,e){var n;const i=this.buildRowModelSnapshot(t,e);i&&(this.lastProcessedResult=i.processedResult,null===(n=t.rowSelectionManager)||void 0===n||n.updateConfig({tableRows:i.processedResult.currentTableRows}))}buildRowModelSnapshot(t,e){var n,i,o,s,r,l,a,d,c,h,u,f,v,p,w,m,g,b,x;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const y=t.dimensionManager.getState(),{containerWidth:R,calculatedHeaderHeight:S,maxHeaderDepth:C}=y,M=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let I;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===M?I=this.scrollRafHeadersMemo.effectiveHeaders:(I=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:M,effectiveHeaders:I}:null);const{leftWidth:H,rightWidth:k}=mi({headers:I,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(I=Bt(I,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:H,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i,collapsedHeaders:t.collapsedHeaders}));let T=t.localRows;t.sortManager?T=t.sortManager.getSortedRows():t.filterManager&&(T=t.filterManager.getFilteredRows()),this.lastRowsRef!==T&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=T);const E=t.internalIsLoading,A=null===(o=t.sortManager)||void 0===o?void 0:o.getState(),W=null===(s=t.filterManager)||void 0===s?void 0:s.getState(),O=(null==A?void 0:A.sort)?`${A.sort.key.accessor}-${A.sort.direction}`:"none",P=JSON.stringify((null==W?void 0:W.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(r=$.text)&&void 0!==r?r:""}|${null!==(l=$.mode)&&void 0!==l?l:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===T&&this.flattenedRowsCache.deps.isLoading===E&&this.flattenedRowsCache.deps.quickFilterKey===F&&this.flattenedRowsCache.deps.expandedRowsSize===t.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===t.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===t.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===t.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===O&&this.flattenedRowsCache.deps.filterKey===P;let D,j,B;if(L&&this.flattenedRowsCache)D=this.flattenedRowsCache.aggregatedRows,j=this.flattenedRowsCache.quickFilteredRows,B=this.flattenedRowsCache.flattenResult;else{D=t.sortManager?T:Xt({rows:T,headers:t.headers,rowGrouping:t.config.rowGrouping}),j=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:i,columns:o,caseSensitive:s=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!Z(t)&&(o&&o.length>0?o.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 i=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const o=t.substring(i,n);o&&e.push({type:"negation",value:o});continue}if('"'===t[n]){n++;const i=n;for(;t.length>n&&'"'!==t[n];)n++;const o=t.substring(i,n);o&&e.push({type:"phrase",value:o}),t.length>n&&'"'===t[n]&&n++;continue}const i=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const o=t.substring(i,n);if(t.length>n&&":"===t[n]){n++;const i=n;for(;t.length>n&&!/\s/.test(t[n]);)n++;const s=t.substring(i,n);s&&e.push({type:"columnSpecific",value:s,column:o});continue}o&&e.push({type:"word",value:o})}return e})(i):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 i=[];a.forEach(o=>{try{let r;if(o.quickFilterGetter)r=o.quickFilterGetter({row:t,accessor:o.accessor});else{const e=ct(t,o.accessor);if(l&&o.valueFormatter){const n=o.valueFormatter({accessor:o.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+""}i.push(r);const a=n.get(o.accessor);a&&a.forEach(t=>{const n=d[t],i=s?r:r.toLowerCase(),o=s?n.value:n.value.toLowerCase();i.includes(o)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${o.accessor}:`,t)}});const o=s?i.join(" "):i.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const i=s?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":o.includes(i)&&e.add(n);break;case"negation":o.includes(i)||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 i=ct(t,e.accessor);if(l&&e.valueFormatter){const o=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:i});n=Array.isArray(o)?o.join(" "):o+""}else n=null==i?"":Array.isArray(i)?i.join(" "):i+""}return((t,e,n)=>{if(!e)return!0;const i=n?t:t.toLowerCase(),o=n?e:e.toLowerCase();return i.includes(o)})(n,i,s)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:D,headers:I,quickFilter:t.config.quickFilter});let n=j,i=!1;if(E){let o=t.config.enablePagination&&null!==(a=t.config.rowsPerPage)&&void 0!==a?a:10;e.isMainSectionScrollable&&(o+=1);const s=Array.from({length:o},()=>(()=>{const t={};return st.add(t),t})());n=0===n.length?s:[...n,...s],i=!0}B=lo({rows:n,rowGrouping:t.config.rowGrouping,getRowId:i?lt(t.config.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:I,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:j,flattenResult:B,deps:{rowsRef:T,isLoading:E,quickFilterKey:F,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:O,filterKey:P}}}const z=!1===t.config.enableVirtualization?void 0:(({height:t,maxHeight:e,rowHeight:n,totalRowCount:i,headerHeight:o,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=qt(e);if(0===t)return;const r=o||n;if(t>=r+i*n+(s||0))return;return Math.max(0,t-r)}if(void 0!==r&&r>0)return Math.max(0,r-(o||n));if(!t)return;const l=qt(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,enablePagination:null!==(d=t.config.enablePagination)&&void 0!==d&&d,rowsPerPage:null!==(c=t.config.rowsPerPage)&&void 0!==c?c:10,totalRowCount:null!==(h=t.config.totalRowCount)&&void 0!==h?h:B.paginatableRows.length,headerHeight:S,footerHeight:!t.config.enablePagination&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),V=null!==(u=t.config.enablePagination)&&void 0!==u&&u,q=null!==(f=t.config.rowsPerPage)&&void 0!==f?f:10,G=null!==(v=t.config.serverSidePagination)&&void 0!==v&&v,K=null!==(p=t.config.totalRowCount)&&void 0!==p?p:B.paginatableRows.length,_=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",U=null!==(b=null===(g=B.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==b?b:0;let J=0;if(B.heightOffsets)for(const[,t]of B.heightOffsets)J+=t;const Y=null!==(x=t.config.enableStickyParents)&&void 0!==x&&x,X=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${V}|${G}|${t.customTheme.rowHeight}|${S}|${K}|${Y}|${_}|${B.flattenedRows.length}|${U}|${J}`;let Q;return t.positionOnlyBody&&void 0!==z&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===X&&this.processRowsScrollReuseBase?Q=function(t,e){const{contentHeight:n,rowHeight:i,scrollDirection:o="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=N(i),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,f,v,p,w=0,m=d.length;if(void 0===n)u=d,f=[],v=u,p=[];else{const t=Ie({bufferRowCount:a,contentHeight:n,tableRows:d,rowHeight:i,scrollTop:s,scrollDirection:o,heightMap:h});if(u=t.rendered.rows,w=t.rendered.startIndex,m=t.rendered.endIndex,r)if(l){const e=We(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);f=e.stickyParents,v=e.regularRows,p=t.partiallyVisible.rows}else f=[],v=t.rendered.rows,p=[];else f=[],v=u,p=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:f,regularRows:v,partiallyVisibleRows:p,paginatedHeightOffsets:c,heightMap:h,allFlattenedRows:t.allFlattenedRows,pageStartIndex:t.pageStartIndex}}(this.processRowsScrollReuseBase,{contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,enableStickyParents:Y,rowGrouping:t.config.rowGrouping}):(Q=function(t){var e;const{contentHeight:n,currentPage:i,customTheme:o,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:a,rowHeight:d,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:f,enablePagination:v,rowGrouping:p}=t,w=N(d),m=function(t,e,n,i,o,s){if(!o||s)return t.map((t,e)=>Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:e}));const r=(n-1)*i,l=n*i,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:o&&!s?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(r,a,i,c,v,f);let g=0;if(v&&!f){const t=(i-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const b=l&&0!==l.length&&v&&!f?(()=>{const t=new Map;return m.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),l.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():l,x=b&&b.length>0?((t,e,n,i)=>{const o=e+i.rowSeparatorWidth,s=Array(t),r=new Map;n&&n.forEach(([t,e])=>{r.set(t,e)});let l=0;for(let e=0;t>e;e++){s[e]=l,l+=o;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:s,totalHeight:l-i.rowSeparatorWidth}})(m.length,d,b,o):void 0;let y,R,S,C,M=0,I=m.length;if(void 0===n)y=m,R=[],S=y,C=[];else{const t=Ie({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:x});if(y=t.rendered.rows,M=t.rendered.startIndex,I=t.rendered.endIndex,s)if(p){const e=We(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,p);R=e.stickyParents,S=e.regularRows,C=t.partiallyVisible.rows}else R=[],S=t.rendered.rows,C=[];else R=[],S=y,C=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:M,renderedEndIndex:I,stickyParents:R,regularRows:S,partiallyVisibleRows:C,paginatedHeightOffsets:b,heightMap:x,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:B.flattenedRows,paginatableRows:B.paginatableRows,parentEndPositions:B.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,enablePagination:V,serverSidePagination:G,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:B.heightOffsets,customTheme:t.customTheme,enableStickyParents:Y,rowGrouping:t.config.rowGrouping}),void 0!==z?(this.processRowsScrollReuseKey=X,this.processRowsScrollReuseBase={currentTableRows:Q.currentTableRows,paginatedHeightOffsets:Q.paginatedHeightOffsets,heightMap:Q.heightMap,allFlattenedRows:Q.allFlattenedRows,pageStartIndex:Q.pageStartIndex}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:y,containerWidth:R,effectiveHeaders:I,calculatedHeaderHeight:S,maxHeaderDepth:C,flattenResult:B,processedResult:Q}}render(t,e,n,i,o){var s,r,l,a,d,c,h,u,f;const v=null!==(c=null!==(l=null===(r=null===(s=n.mainBodyRef)||void 0===s?void 0:s.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,p=this.buildRowModelSnapshot(n,i);if(!p)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:b,maxHeaderDepth:x,flattenResult:y,processedResult:R}=p;this.lastProcessedResult=R;const S=!0===n.positionOnlyBody;if(S&&null!==this.lastScrollRafPaintedRange&&R.renderedStartIndex===this.lastScrollRafPaintedRange.start&&R.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(h=n.rowSelectionManager)||void 0===h||h.updateConfig({tableRows:R.currentTableRows});const{mainWidth:C,leftWidth:M,rightWidth:I,leftContentWidth:H,rightContentWidth:k}=mi({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),T=m-M-I;if(!S){const e=t=>"number"==typeof t?t+"px":t,s=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);s.maxHeight=t,s.height=void 0===w.contentHeight?"auto":t}else s.removeProperty("max-height"),n.config.height?s.height=e(n.config.height):s.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:r}=n;s.setProperty("--st-main-section-width",T+"px"),s.setProperty("--st-scrollbar-width",i.scrollbarWidth+"px");const l=z(n.config.enableColumnEditor,o.showToggle);s.setProperty("--st-editor-width",l+"px"),s.setProperty("--st-border-width",r.borderWidth+"px"),s.setProperty("--st-footer-height",r.footerHeight+"px"),s.setProperty("--st-calculated-header-height",b+"px");const a=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(a?"st-resizeable":"st-not-resizeable"),t.content.style.width=l>0?`calc(100% - ${l}px)`:"100%",this.renderHeader(t.headerContainer,b,x,g,n)}this.renderBody(t.bodyContainer,R,g,n,i),this.lastScrollRafPaintedRange=S?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const E=n.sectionScrollController;E&&(E.setSectionScrollLeft("main",v),null!=n.pinnedLeftRef.current&&E.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&E.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),E.restoreAll()),S||(this.renderFooter(t.footerContainer,null!==(f=n.config.totalRowCount)&&void 0!==f?f:y.paginatableRows.length,i.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,i.columnEditorOpen,o,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,C,M,I,H,k,e.tableBodyContainerRef.current,g,n))}renderHeader(t,e,n,i,o){if(o.config.hideHeader)return;const s=this.buildRendererDeps(i,o);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,i,o){const s=this.buildRendererDeps(n,i,o);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderFooter(t,e,n,t=>{o.setCurrentPage(t),o.onRender()},s)}renderColumnEditor(t,e,n,i,o){const s=this.buildRendererDeps(i,o);this.tableRenderer.renderColumnEditor(t,e,t=>{o.setColumnEditorOpen(t),o.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,i,o,s,r,l,a){if(!a.mainBodyRef.current&&!a.mainHeaderRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,i,o,s,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,n){return{accordionAxis:e.accordionAxis,externalScrollActive:void 0!==e.externalViewportHeight,stickyParentsScrollTop:null==n?void 0:n.scrollTop,animationCoordinator:e.animationCoordinator,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,hoverScopeId:e.hoverScopeId,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,createNestedTable:e.createNestedTable,onRender:e.onRender,getShrinkFloors:e.getShrinkFloors,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,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,getPristineDefaultHeaders:e.getPristineDefaultHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const co=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class ho{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||lo({rows:t.getPivotedRows(),rowGrouping:t.getEffectiveRowGrouping(),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})},n=new Map,i=new Set;let o=!1,s=!1,r=null;const l=()=>{var e,s;if(o=!1,0===n.size)return void(i.size>0&&!(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))?a():i.size>0&&c());let r=!1;n.forEach((e,i)=>{var o,s;if(null===(o=t.isCellAnimating)||void 0===o?void 0:o.call(t,i))return void(r=!0);const l=null===(s=t.cellRegistry)||void 0===s?void 0:s.get(i);l&&l.updateContent(e),n.delete(i)}),r&&n.size>0&&c(),(null===(s=t.hasAnimatingCells)||void 0===s?void 0:s.call(t))?c():a()},a=()=>{null==r&&(r=setTimeout(()=>{r=null,(()=>{var e,n,o,s,r,l;if(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))return void c();const a=i;if(0===a.size)return;const d=null===(n=t.filterManager)||void 0===n?void 0:n.getFilters(),h=(d?Object.keys(d):[]).some(t=>a.has(t)),u=null===(o=t.sortManager)||void 0===o?void 0:o.getSortColumn(),f=!(!u||!a.has(u.key.accessor+"")),v=(null!==(l=null===(r=null===(s=t.config.quickFilter)||void 0===s?void 0:s.text)||void 0===r?void 0:r.trim())&&void 0!==l?l:"").length>0;if(!h&&!f&&!v)return void a.clear();a.clear();const p=()=>{var e,n,i;if(h&&t.filterManager&&t.filterManager.updateConfig({rows:t.localRows}),f&&t.sortManager){const i=null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:t.localRows;t.sortManager.updateConfig({tableRows:i})}v&&(null===(i=t.invalidateRowsCache)||void 0===i||i.call(t),t.onRender())};t.runWithoutAnimationSnapshot?t.runWithoutAnimationSnapshot(p):p()})()},400))},d=()=>{o||(o=!0,queueMicrotask(l))},c=()=>{s||(s=!0,setTimeout(()=>{s=!1,(n.size>0||i.size>0)&&d()},120))};let h=null,u=null;return{updateData:e=>{var o;const{accessor:s,newValue:r}=e,l=(e=>null!=e.rowId&&""!==e.rowId?(()=>{const e=t.localRows,n=t.config.getRowId;if(u&&u.rowsRef===e&&u.getRowId===n)return u.map;const i=new Map;for(let t=0;e.length>t;t++){const o=e[t];if(!n)continue;const s=n({row:o,depth:0,index:t,rowPath:[t],rowIndexPath:[t]});null!=s&&""!==s&&i.set(s+"",t)}return u={rowsRef:e,getRowId:n,map:i},i})().get(e.rowId+""):"number"==typeof e.rowIndex?e.rowIndex:void 0)(e);if(void 0===l||0>l||l>=t.localRows.length)return;const a=t.localRows[l];ut(a,s,r);const c=(e=>{var n;const i=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t),o=null==i?void 0:i.rowsToRender;if(o&&0!==o.length){if(!h||h.rowsRef!==o){const t=new WeakMap;for(const e of o)e.row&&t.set(e.row,e);h={rowsRef:o,map:t}}return h.map.get(e)}})(a),f=c?null!==(o=c.stableRowKey)&&void 0!==o?o:pt(c.rowId):gt({getRowId:t.config.getRowId,row:a,depth:0,index:l,rowPath:[l],rowIndexPath:[l]}),v=ot({accessor:s,rowId:f});n.set(v,r),i.add(s+""),d()},setHeaderRename:e=>{const n=t.headerRegistry.get(e.accessor);n&&n.setEditing(!0)},getVisibleRows:()=>{var n;const i=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t);return i?i.rowsToRender:e().flattenedRows},getAllRows:()=>e().flattenedRows,getHeaders:()=>t.effectiveHeaders,exportToCSV:n=>{var i;((t,e,n,i=!0)=>{((t,e="table-export.csv")=>{const n=new Blob([t],{type:"text/csv;charset=utf-8;"}),i=document.createElement("a"),o=URL.createObjectURL(n);i.setAttribute("href",o),i.setAttribute("download",e),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)})(((t,e,n=!0)=>{const i=(t=>{const e=[],n=t=>{for(const i of t)i.hide||i.isSelectionColumn||i.excludeFromCsv||(i.children&&i.children.length>0?(i.singleRowChildren&&e.push(i),n(i.children)):e.push(i))};return n(t),e})(e),o=i.map(t=>co(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return i.map((t,i)=>{const o=ct(n,t.accessor);if(t.exportValueGetter){const s=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o,formattedValue:s});return co(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:i,row:n,rowIndex:e,value:o});return co(s)}return co(o)}).join(",")});return(n?[o,...s]:s).join("\n")})(t,e,i),n)})(e().flattenedRows,t.effectiveHeaders,null==n?void 0:n.filename,null===(i=t.config.includeHeadersInCSVExport)||void 0===i||i)},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:()=>Bn(t.headers),applyPinnedState:async e=>{const n=Vn(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{const e=t.getPivot()?An(t.getPivotHeaders()):An(t.getPristineDefaultHeaders());t.setHeaders(e),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,i;const o=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(o/(null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10))},setPage:async n=>{var i,o;const s=null!==(i=t.config.totalRowCount)&&void 0!==i?i:e().paginatableRows.length,r=null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10;1>n||n>Math.ceil(s/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{var n,i;t.clearExpandedRows(),t.clearCollapsedRows();const o=t.expandedDepthsManager;if(o){const s=null!==(i=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.length)&&void 0!==i?i:0,r=0===s?new Set:new Set([...e].filter(t=>Number.isInteger(t)&&t>=0&&s>t));return void o.setExpandedDepths(r)}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.getEffectiveRowGrouping())||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,i;return null!==(i=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.indexOf(e))&&void 0!==i?i:-1},setPivot:e=>{t.setPivot(e)},getPivot:()=>t.getPivot(),getPivotHeaders:()=>t.getPivotHeaders(),getPivotedRows:()=>t.getPivotedRows(),toggleColumnEditor:e=>{t.config.enableColumnEditor&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=i=>i.map(i=>{const o=i.accessor+"";let s=o in e?!e[o]:i.hide;return Ln(i,t.essentialAccessors)&&(s=!1),Object.assign(Object.assign({},i),{hide:s,children:i.children?n(i.children):i.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 i;null===(i=t.selectionManager)||void 0===i||i.selectCellRange(e,n)},getSelectedRows:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRows())&&void 0!==n?n:new Set},getSelectedRowsData:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRowsData())&&void 0!==n?n:[]},getRow:e=>{var n,i;const o=e+"",s=null===(n=t.rowSelectionManager)||void 0===n?void 0:n.getRow(o);if(void 0!==s)return s;const r=null===(i=t.getCachedProcessedResult)||void 0===i?void 0:i.call(t);if(r){const t=r.currentTableRows.find(t=>null!=(null==t?void 0:t.rowId)&&pt(t.rowId)===o);if(t)return t.row}},selectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.selectRow(e+"")},deselectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.deselectRow(e+"")},toggleRowSelection:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.handleToggleRow(e+"")},clearRowSelection:()=>{var e;null===(e=t.rowSelectionManager)||void 0===e||e.clearSelection()}}}}const uo=t=>{if(!t)return null;if("undefined"!=typeof Window&&t instanceof Window){const e=t.innerHeight;return{top:0,bottom:e,height:e,width:t.innerWidth}}const e=t.getBoundingClientRect();return{top:e.top,bottom:e.bottom,height:e.height,width:e.width}},fo=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,vo=(t,e)=>{if(!t||!e)return null;const n=uo(t);if(!n)return null;const i=e.getBoundingClientRect(),o=i.height;if(0>=o)return{relativeScrollTop:0,visibleViewportHeight:0,distanceFromTableBottom:1/0,tableTotalHeight:0,viewportWidth:n.width};const s=Math.max(n.top,i.top),r=Math.min(Math.max(0,Math.min(n.bottom,i.bottom)-s),fo());return{relativeScrollTop:Math.max(0,Math.min(n.top-i.top,Math.max(0,o-r))),visibleViewportHeight:r,distanceFromTableBottom:i.bottom-n.bottom,tableTotalHeight:o,viewportWidth:n.width}};class po{constructor(t,e){var n,i,s;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.pristineDefaultHeaders=[],this.essentialAccessors=new Set,this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,this.naturalWidths=new Map,this.isAutoSizing=!1,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.hoverScopeId="st-hover-"+ ++po.nextHoverScopeId,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.suppressNextAnimationSnapshot=!1,this.cachedAPI=null,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.pivotManager=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.hasWarnedUnvirtualizedRows=!1,this.unvirtualizedRowsCheckTimeoutId=null,this.resolvedScrollParent=null,this.externalScrollListener=null,this.externalWindowResizeListener=null,this.externalParentResizeObserver=null,this.externalViewportHeight=0,this.externalScrollRetryRaf=null,this.externalScrollRetryCount=0,this.bodyScrollListenerAttached=!1,this.bodyContainerMouseLeaveListener=null,this.bodyContainerScrollListener=null,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="",this.pendingAccordionAxis=null,this.accordionCleanupTimerId=null,this.lastRenderedVisibilityKey=null,this.container=t,this.config=o(e);const r=this.config;this.customTheme=Gn.mergeCustomTheme(r),this.mergedColumnEditorConfig=Gn.mergeColumnEditorConfig(r),this.resolvedIcons=Gn.resolveIcons(r),this.localRows=[...r.rows],this.headers=[...r.columns],this.pristineDefaultHeaders=An(r.columns),this.columnEditorOpen=null!==(n=r.enableColumnEditorInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(i=r.isLoading)&&void 0!==i&&i,this.pivotManager=new Se({sourceRows:this.localRows,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(s=r.pivot)&&void 0!==s?s:null});const l=this.pivotManager.getState();l.active&&(this.headers=l.headers),this.essentialAccessors=Gn.buildEssentialAccessors(this.headers),this.collapsedHeaders=Gn.getInitialCollapsedHeaders(this.headers),this.expandedDepths=Gn.getInitialExpandedDepths(Object.assign(Object.assign({},r),{rowGrouping:this.getEffectiveRowGrouping()})),this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.domManager=new Kn,this.renderOrchestrator=new ao,this.animationCoordinator=new O,this.applyAnimationsConfig(e.animations),this.animationCoordinator.setOnHostDiscard(e.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(e.onRendererHostDiscard),this.rebuildRowIndexMap(),this.initializeManagers()}applyAnimationsConfig(t){var e;this.animationCoordinator.setEnabled(null===(e=null==t?void 0:t.enabled)||void 0===e||e),void 0!==(null==t?void 0:t.duration)&&this.animationCoordinator.setDuration(t.duration),void 0!==(null==t?void 0:t.easing)&&this.animationCoordinator.setEasing(t.easing)}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=vt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),i=pt(n);this.rowIndexMap.set(i,e)})}getBodyContainers(){const t=this.domManager.getRefs();return[t.mainBodyRef.current,t.pinnedLeftRef.current,t.pinnedRightRef.current].filter(t=>null!==t)}getHeaderContainers(){const t=this.domManager.getRefs();return[t.mainHeaderRef.current,t.pinnedLeftHeaderRef.current,t.pinnedRightHeaderRef.current].filter(t=>null!==t)}getAnimatableContainers(){return[...this.getBodyContainers(),...this.getHeaderContainers()]}buildVisibilityKey(t){const e=[],n=(t,i)=>{var o,s;if(Z(t))return;const r=null!==(s=null!==(o=t.pinned)&&void 0!==o?o:i)&&void 0!==s?s:"main";if(t.children&&t.children.length>0)for(const e of t.children)n(e,r);else e.push(`${t.accessor+""}:${r}`)};for(const e of t)n(e,void 0);return e.join("|")}didColumnVisibilityChange(t){const e=this.buildVisibilityKey(t);return null!==this.lastRenderedVisibilityKey&&e!==this.lastRenderedVisibilityKey}captureAnimationSnapshot(){const t=this.animationCoordinator.isEnabled()?this.renderOrchestrator.getCurrentBodyLayouts():void 0;this.updateAnimationVerticalScroll(),this.animationCoordinator.captureSnapshot({containers:this.getAnimatableContainers(),preLayouts:t})}updateAnimationVerticalScroll(){var t,e;if(!this.resolvedScrollParent)return void this.animationCoordinator.setExternalVerticalScroll(null);const n=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container,i=vo(this.resolvedScrollParent,n);this.animationCoordinator.setExternalVerticalScroll(i&&i.visibleViewportHeight>0&&i.tableTotalHeight>0?{clientHeight:i.visibleViewportHeight,scrollHeight:i.tableTotalHeight,scrollTop:i.relativeScrollTop}:null)}collectAccordionRenderableAccessors(){const e=new Set,n=i=>{if(Z(i))return;if(e.add(i.accessor+""),!i.children||0===i.children.length)return;const o=this.collapsedHeaders.has(i.accessor);for(const e of i.children){const i=e.showWhen||t;(o?"parentCollapsed"===i||"always"===i:"parentExpanded"===i||"always"===i)&&n(e)}};for(const t of this.headers)n(t);return e}beginAccordionAnimation(t){var e,n,i,o;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;if("vertical"===t&&(null!==(n=null===(e=this.getEffectiveRowGrouping())||void 0===e?void 0:e.length)&&void 0!==n?n:0)>0)return;const s=null!==(o=null===(i=this.domManager.getElements())||void 0===i?void 0:i.rootElement)&&void 0!==o?o:this.container;if("horizontal"===t&&(null!==this.accordionCleanupTimerId||s.classList.contains(On))){this.animationCoordinator.cancel(),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null),s.classList.remove(On),s.style.removeProperty(Pn),s.style.removeProperty($n),this.pendingAccordionAxis=null,this.captureAnimationSnapshot();const t=this.animationCoordinator.getDuration();return void(this.accordionCleanupTimerId=window.setTimeout(()=>{this.accordionCleanupTimerId=null},t+80))}this.captureAnimationSnapshot(),this.animationCoordinator.setAccordionPreVisibleAccessors("horizontal"===t?this.collectAccordionRenderableAccessors():null),this.pendingAccordionAxis=t;const r=this.animationCoordinator.getDuration(),l=this.animationCoordinator.getEasing();s.style.setProperty(Pn,r+"ms"),s.style.setProperty($n,l),s.classList.add(On),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{s.classList.remove(On),s.style.removeProperty(Pn),s.style.removeProperty($n),this.accordionCleanupTimerId=null},r+80)}initializeManagers(){var t,e,n,i;this.ariaAnnouncementManager=new Ue,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new _e(null===(t=this.config.expandAll)||void 0===t||t,this.getEffectiveRowGrouping()),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)},s=null===(e=this.pivotManager)||void 0===e?void 0:e.getState();this.sortManager=new Qt({headers:this.headers,tableRows:(null==s?void 0:s.active)?s.pivotedRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:t=>{var e,n;return null===(n=(e=this.config).onSortChange)||void 0===n?void 0:n.call(e,t)},rowGrouping:(null==s?void 0:s.active)?s.rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(()=>{this.suppressNextAnimationSnapshot?this.render("live-sort"):(this.captureAnimationSnapshot(),this.render("sortManager"))}),this.filterManager=new ne({rows:this.localRows,headers:this.pristineDefaultHeaders,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:t=>{var e,n;return null===(n=(e=this.config).onFilterChange)||void 0===n?void 0:n.call(e,t)},announce:o}),this.filterManager.subscribe(t=>{this.syncPivotPipeline(t.filteredRows),this.render("filterManager")}),this.selectionManager=new je({selectableCells:null!==(n=this.config.selectableCells)&&void 0!==n&&n,selectableColumns:null!==(i=this.config.selectableColumns)&&void 0!==i&&i,headers:this.headers,tableRows:[],onCellEdit:t=>{var e,n;return null===(n=(e=this.config).onCellEdit)||void 0===n?void 0:n.call(e,t)},cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:Ne(this.config),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,e,n;const i=this.domManager.getRefs(),o=this.domManager.getElements();if(!i.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=Je(i.tableBodyContainerRef.current);const s=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new Gt({effectiveHeaders:s,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:null!==(t=this.config.totalRowCount)&&void 0!==t?t:this.localRows.length,footerHeight:!this.config.enablePagination&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:i.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.resolvedScrollParent&&"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(()=>{this.mounted&&this.recomputeExternalViewportHeight()}),this.config.onTableReady&&this.config.onTableReady())}),this.scrollManager=new Kt({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(e=this.config.infiniteScrollThreshold)&&void 0!==e?e:200});const r=t=>{var e;const n=this.domManager.getRefs().mainHeaderRef.current,i=this.selectionManager,o=i&&(this.config.selectableCells||this.config.selectableColumns)?{columnsWithSelectedCells:i.getColumnsWithSelectedCells(),selectedColumns:i.getSelectedColumns()}:void 0;null===(e=null==n?void 0:n.__renderHeaderCells)||void 0===e||e.call(n,t,o)};this.sectionScrollController=new _t({onMainSectionScrollLeft:t=>{var e;r(t);const n=this.domManager.getRefs().mainBodyRef.current;null===(e=null==n?void 0:n.__renderBodyCells)||void 0===e||e.call(n,t)}}),this.config.autoExpandColumns&&(this.autoScaleManager=new zt({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:i.mainBodyRef,isResizing:this.isResizing,collapsedHeaders:this.collapsedHeaders},()=>{this.render("autoScaleManager")})),i.headerContainerRef.current&&i.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new Ge({headerContainer:i.headerContainerRef.current,mainSection:i.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,i.tableBodyContainerRef.current&&(this.scrollbarWidth=Je(i.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Ve,this.windowResizeManager.addCallback(()=>{var t;if(i.tableBodyContainerRef.current){const e=Je(i.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.syncRowSelectionManager(),this.selectionManager&&(this.handleOutsideClickManager=new qe({selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,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(),this.dimensionManager&&this.renderOrchestrator.primeLastProcessedResult(this.getRenderContext(),this.getRenderState())}setupEventListeners(){const t=this.domManager.getElements();(null==t?void 0:t.bodyContainer)&&(this.bodyContainerMouseLeaveListener=()=>{this.clearHoveredRows()},t.bodyContainer.addEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.syncExternalScrollWiring())}syncExternalScrollWiring(){var t;const e=this.domManager.getElements();if(!(null==e?void 0:e.bodyContainer))return;const n=!(null==this.config.scrollParent||null!=this.config.height&&""!==this.config.height||null!=this.config.maxHeight&&""!==this.config.maxHeight),i=n?(t=>{if(null==t)return null;if("function"==typeof t)try{const e=t();return null!=e?e:null}catch(t){return null}return"window"===t?"undefined"!=typeof window?window:null:"undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"function"==typeof t.addEventListener?t:null})(this.config.scrollParent):null;if(i!==this.resolvedScrollParent&&this.detachExternalScrollWiring(),i)this.externalScrollRetryCount=0,this.attachExternalScrollWiring(i),this.ensureBodyScrollListenerDetached(e.bodyContainer),this.recomputeExternalViewportHeight();else if(n){this.ensureBodyScrollListenerDetached(e.bodyContainer);const n="undefined"!=typeof window?window.innerHeight:0;n>0&&this.externalViewportHeight!==n&&(this.externalViewportHeight=n,null===(t=this.dimensionManager)||void 0===t||t.updateConfig({externalViewportHeight:n})),this.scheduleExternalScrollParentRetry()}else this.externalScrollRetryCount=0,this.ensureBodyScrollListenerAttached(e.bodyContainer),this.externalViewportHeight=0,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:void 0})}scheduleExternalScrollParentRetry(){null===this.externalScrollRetryRaf&&po.EXTERNAL_SCROLL_MAX_RETRIES>this.externalScrollRetryCount&&"undefined"!=typeof requestAnimationFrame&&(this.externalScrollRetryRaf=requestAnimationFrame(()=>{this.externalScrollRetryRaf=null,this.mounted&&(this.externalScrollRetryCount++,this.syncExternalScrollWiring())}))}ensureBodyScrollListenerAttached(t){this.bodyScrollListenerAttached||(this.bodyContainerScrollListener=t=>this.handleScroll(t),t.addEventListener("scroll",this.bodyContainerScrollListener),this.bodyScrollListenerAttached=!0)}ensureBodyScrollListenerDetached(t){this.bodyScrollListenerAttached&&(this.bodyContainerScrollListener&&(t.removeEventListener("scroll",this.bodyContainerScrollListener),this.bodyContainerScrollListener=null),this.bodyScrollListenerAttached=!1)}attachExternalScrollWiring(t){if(!t)return;this.resolvedScrollParent=t;const e=t=>this.handleExternalScroll(t);if(this.externalScrollListener=e,t.addEventListener("scroll",e,{passive:!0}),"undefined"!=typeof Window&&t instanceof Window){const e=()=>this.handleExternalResize();this.externalWindowResizeListener=e,t.addEventListener("resize",e,{passive:!0})}else if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>this.handleExternalResize());e.observe(t),this.externalParentResizeObserver=e}this.recomputeExternalScrollPaddingTop(),this.applyOverscrollContainment(t)}detachExternalScrollWiring(){const t=this.resolvedScrollParent;t&&this.externalScrollListener&&t.removeEventListener("scroll",this.externalScrollListener),this.externalScrollListener=null,t&&this.externalWindowResizeListener&&"undefined"!=typeof Window&&t instanceof Window&&t.removeEventListener("resize",this.externalWindowResizeListener),this.externalWindowResizeListener=null,this.externalParentResizeObserver&&(this.externalParentResizeObserver.disconnect(),this.externalParentResizeObserver=null),this.resolvedScrollParent=null;const e=this.domManager.getElements();e&&e.rootElement.style.removeProperty("--st-external-scroll-padding-top"),this.restoreOverscrollBehavior()}applyOverscrollContainment(t){const e="undefined"!=typeof Window&&t instanceof Window?"undefined"!=typeof document?document.documentElement:null:t;e&&(this.overscrollBehaviorTarget=e,this.overscrollBehaviorPrev=e.style.overscrollBehaviorY,e.style.overscrollBehaviorY="none")}restoreOverscrollBehavior(){this.overscrollBehaviorTarget&&(this.overscrollBehaviorTarget.style.overscrollBehaviorY=this.overscrollBehaviorPrev,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="")}recomputeExternalScrollPaddingTop(){const t=this.domManager.getElements();if(!t)return;const e=this.resolvedScrollParent;let n=0;if(e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement){const t=getComputedStyle(e);n=parseFloat(t.paddingTop)||0}t.rootElement.style.setProperty("--st-external-scroll-padding-top",n+"px")}recomputeExternalViewportHeight(){var t;if(!this.resolvedScrollParent)return;const e=this.domManager.getElements(),n=null!==(t=null==e?void 0:e.rootElement)&&void 0!==t?t:this.container,i=vo(this.resolvedScrollParent,n);if(!i)return;let o=i.visibleViewportHeight;o>0||(o=(()=>{const t=uo(this.resolvedScrollParent);return t?Math.min(t.height,fo()):0})()),o>0&&o!==this.externalViewportHeight&&(this.externalViewportHeight=o,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:o}))}handleExternalResize(){this.recomputeExternalViewportHeight(),this.recomputeExternalScrollPaddingTop(),this.render("external-scroll-resize")}handleExternalScroll(t){var e;const n=this.resolvedScrollParent;if(!n)return;const i=this.domManager.getElements(),o=null!==(e=null==i?void 0:i.rootElement)&&void 0!==e?e:this.container,s=vo(n,o);if(!s)return;const r=s.relativeScrollTop;this.isScrolling=!0,null!==this.scrollEndTimeoutId&&clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=window.setTimeout(()=>{this.isScrolling=!1,this.scrollEndTimeoutId=null,requestAnimationFrame(()=>{this.render("scroll-end")})},150),null!==this.scrollRafId&&cancelAnimationFrame(this.scrollRafId),this.scrollRafId=requestAnimationFrame(()=>{const t=r>this.lastScrollTop?"down":this.lastScrollTop>r?"up":"none";this.scrollTop=r,this.scrollDirection=t,this.lastScrollTop=r,s.visibleViewportHeight!==this.externalViewportHeight&&(this.externalViewportHeight=s.visibleViewportHeight,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:s.visibleViewportHeight})),this.scrollManager&&(this.config.onLoadMore?this.scrollManager.handleScroll(r,0,s.visibleViewportHeight,s.relativeScrollTop+s.visibleViewportHeight+Math.max(0,s.distanceFromTableBottom)):this.scrollManager.handleScroll(r,0,0,0)),this.render("scroll-raf"),this.scrollRafId=null})}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,requestAnimationFrame(()=>{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.config.onLoadMore?this.scrollManager.handleScroll(n,e.scrollLeft,e.clientHeight,e.scrollHeight):this.scrollManager.handleScroll(n,e.scrollLeft,0,0)),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)}getEffectiveRowGrouping(){var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.rowGrouping:this.config.rowGrouping}syncPivotPipeline(t){var e,n,i,o,s,r,l,a,d,c;if(!this.pivotManager)return;const h=null!==(n=null!=t?t:null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows,u=this.pivotManager.isActive();this.pivotManager.updateConfig({sourceRows:h,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(i=this.config.pivot)&&void 0!==i?i:null});const f=this.pivotManager.getState();if(f.active){if(this.headers=f.headers,this.essentialAccessors=Gn.buildEssentialAccessors(this.headers),null===(o=this.sortManager)||void 0===o||o.updateConfig({tableRows:f.pivotedRows,headers:f.headers,rowGrouping:f.rowGrouping}),null===(s=this.selectionManager)||void 0===s||s.updateConfig({headers:f.headers}),u?null===(l=this.expandedDepthsManager)||void 0===l||l.updateRowGrouping(f.rowGrouping):(null===(r=this.expandedDepthsManager)||void 0===r||r.updateRowGrouping(f.rowGrouping),this.collapsedHeaders=Gn.getInitialCollapsedHeaders(f.headers)),this.dimensionManager){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}}else{if(u&&(this.headers=An(this.pristineDefaultHeaders),this.essentialAccessors=Gn.buildEssentialAccessors(this.headers),this.collapsedHeaders=Gn.getInitialCollapsedHeaders(this.headers),null===(a=this.expandedDepthsManager)||void 0===a||a.updateRowGrouping(this.config.rowGrouping),this.dimensionManager)){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}null===(d=this.sortManager)||void 0===d||d.updateConfig({tableRows:h,headers:this.headers,rowGrouping:this.config.rowGrouping}),null===(c=this.selectionManager)||void 0===c||c.updateConfig({headers:this.headers})}}getRenderContext(){var t;const e=this.domManager.getRefs(),n=null===(t=this.pivotManager)||void 0===t?void 0:t.getState(),i=(null==n?void 0:n.active)?Object.assign(Object.assign({},this.config),{rowGrouping:n.rowGrouping}):this.config;return{accordionAxis:this.pendingAccordionAxis,config:i,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:(null==n?void 0:n.active)?n.pivotedRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,createNestedTable:(t,e)=>new po(t,e),cellRegistry:this.cellRegistry,hoverScopeId:this.hoverScopeId,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.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,externalViewportHeight:this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),getShrinkFloors:()=>this.getShrinkFloors(),onAutoExpandNaturalWidths:t=>this.recordNaturalWidths(t),setIsResizing:t=>{var e,n,i,o,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(i=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==i?i:null===(s=null===(o=t.mainBodyRef)||void 0===o?void 0:o.current)||void 0===s?void 0:s.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.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=An(t),this.renderOrchestrator.invalidateCache("header")},animationCoordinator:this.animationCoordinator,setCollapsedHeaders:t=>{this.beginAccordionAnimation("horizontal"),this.collapsedHeaders=t},setCollapsedRows:t=>{this.beginAccordionAnimation("vertical"),this.collapsedRows="function"==typeof t?t(this.collapsedRows):t,this.render("expansion")},setExpandedRows:t=>{this.beginAccordionAnimation("vertical"),this.expandedRows="function"==typeof t?t(this.expandedRows):t,this.render("expansion")},setRowStateMap:t=>{this.beginAccordionAnimation("vertical"),this.rowStateMap="function"==typeof t?t(this.rowStateMap):t,this.render("rowStateMap")},getCollapsedRows:()=>this.collapsedRows,getCollapsedHeaders:()=>this.collapsedHeaders,getExpandedRows:()=>this.expandedRows,getHeaders:()=>this.headers,getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{t!==this.currentPage&&this.config.enablePagination&&!this.config.serverSidePagination&&this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t)),this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}isAutoSizeLeaf(t){return!t.isSelectionColumn&&(t=>"string"==typeof t.width&&"auto"===t.width.trim().toLowerCase())(t)}computeAutoSizeAccessors(){const t=new Set,e=At(this.headers,this.collapsedHeaders);for(const n of e)this.isAutoSizeLeaf(n)&&t.add(n.accessor);return t}getAutoSizeStyleRoot(){var t,e,n,i,o,s,r,l;const a=this.domManager.getRefs(),d=null!==(s=null!==(i=null!==(e=null===(t=a.mainBodyRef)||void 0===t?void 0:t.current)&&void 0!==e?e:null===(n=a.mainHeaderRef)||void 0===n?void 0:n.current)&&void 0!==i?i:null===(o=a.pinnedLeftHeaderRef)||void 0===o?void 0:o.current)&&void 0!==s?s:null===(r=a.pinnedRightHeaderRef)||void 0===r?void 0:r.current;return d?null!==(l=d.closest(".simple-table-root"))&&void 0!==l?l:d:null}getAutoSizeRows(){if(this.config.enablePagination&&!this.config.serverSidePagination){const t=this.renderOrchestrator.getLastProcessedResult();if(t){const e=t.currentTableRows.filter(t=>t.row&&!t.stateIndicator&&!t.isLoadingSkeleton&&!t.nestedTable).map(t=>t.row);if(e.length>0)return e}}return this.localRows}getShrinkFloors(){var t;const e=new Map,n=t=>{if(t.children&&t.children.length>0&&t.children.forEach(n),"number"==typeof t.width)e.set(t.accessor+"",t.width);else if("string"==typeof t.width&&t.width.trim().endsWith("px")){const n=parseFloat(t.width);Number.isFinite(n)&&e.set(t.accessor+"",n)}};this.pristineDefaultHeaders.forEach(n);const i=new Map,o=At(this.headers,this.collapsedHeaders);for(const n of o){const o=n.accessor+"",s=null!==(t=this.naturalWidths.get(o))&&void 0!==t?t:e.get(o);i.set(o,Math.max(null!=s?s:0,Et(n)))}return i}recordNaturalWidths(t){t.forEach((t,e)=>this.naturalWidths.set(e,t))}applyMeasuredWidths(t){const e=n=>{const i=Object.assign({},n);return t.has(n.accessor)&&(i.width=t.get(n.accessor)),n.children&&n.children.length>0&&(i.children=n.children.map(e)),i};this.headers=this.headers.map(e),t.forEach((t,e)=>this.naturalWidths.set(e+"",t))}maybeAutoSizeColumns(){if(this.isAutoSizing||0===this.pendingAutoSize.size)return;const t=this.getAutoSizeStyleRoot();if(t instanceof HTMLElement&&t.querySelector(".st-header-cell")){this.isAutoSizing=!0;try{const e=At(this.headers,this.collapsedHeaders),n=new Map(e.map(t=>[t.accessor,t])),i=this.getAutoSizeRows(),o=new Map;for(const e of this.pendingAutoSize){const s=n.get(e);if(!s)continue;const{width:r}=Lt(e,{rows:i,header:s,styleRoot:t,theme:this.config.theme,autoSizeMode:s.autoSizeMode,sortIcon:this.resolvedIcons.sortUp,expandIcon:this.resolvedIcons.expand,onRendererHostDiscard:this.config.onRendererHostDiscard});o.set(e,r)}if(this.pendingAutoSize.clear(),0===o.size)return;let s=!1;for(const[t,e]of o){const i=n.get(t);if(("number"==typeof(null==i?void 0:i.width)?i.width:this.naturalWidths.get(t+""))!==e){s=!0;break}}if(!s)return;this.applyMeasuredWidths(o),this.renderOrchestrator.invalidateCache("header");const r=this.domManager.getElements(),l=this.domManager.getRefs();r&&this.renderOrchestrator.render(r,l,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),this.config.onColumnWidthChange&&this.config.onColumnWidthChange(this.headers)}finally{this.isAutoSizing=!1}}}refitAutoSizeColumns(){0!==this.autoSizeAccessors.size&&(this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t)),this.render("auto-size-refit"))}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),this.maybeAutoSizeColumns(),this.pendingAccordionAxis=null,this.lastRenderedVisibilityKey=this.buildVisibilityKey(this.headers),"scroll-raf"!==t&&"live-sort"!==t&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}),this.maybeScheduleUnvirtualizedRowsWarning())}maybeScheduleUnvirtualizedRowsWarning(){var t,e,n;(()=>{try{const t=globalThis.process;return!!(null==t?void 0:t.env)&&"production"!==t.env.NODE_ENV}catch(t){return!1}})()&&(this.hasWarnedUnvirtualizedRows||null===this.unvirtualizedRowsCheckTimeoutId&&"undefined"!=typeof window&&!1!==this.config.enableVirtualization&&void 0===(null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight())&&(500>(null!==(n=null===(e=this.renderOrchestrator.getLastProcessedResult())||void 0===e?void 0:e.currentTableRows.length)&&void 0!==n?n:0)||(this.unvirtualizedRowsCheckTimeoutId=window.setTimeout(()=>{this.unvirtualizedRowsCheckTimeoutId=null,this.evaluateUnvirtualizedRowsWarning()},400))))}evaluateUnvirtualizedRowsWarning(){var t,e,n;if(this.hasWarnedUnvirtualizedRows||!this.mounted)return;if(!1===this.config.enableVirtualization)return;if(void 0!==(null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight()))return;const i=null!==(n=null===(e=this.renderOrchestrator.getLastProcessedResult())||void 0===e?void 0:e.currentTableRows.length)&&void 0!==n?n:0;500>i||(this.hasWarnedUnvirtualizedRows=!0,console.warn(`[simple-table] Rendering ${i} rows without virtualization. This can cause slow renders and high memory use. To virtualize, set \`height\` or \`maxHeight\` on the table, or pass a bounded \`scrollParent\`.`+(null!=this.config.scrollParent?' A `scrollParent` is set but did not produce a bounded viewport — make sure it is an element whose visible height is smaller than its content (e.g. a fixed/max height with `overflow: auto`), or use `"window"`.':"")))}update(t){var n,i,o,r,l,a,d,c,h,u,f,v,p,w,m;this.isUpdating=!0;const g=this.config.theme,b=s(t);if(this.config=Object.assign(Object.assign({},this.config),b),void 0!==t.animations&&this.applyAnimationsConfig(t.animations),void 0!==t.onRendererHostDiscard&&(this.animationCoordinator.setOnHostDiscard(t.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(t.onRendererHostDiscard)),void 0!==t.rows&&(this.firstRenderDone&&this.captureAnimationSnapshot(),this.localRows=[...t.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.syncPivotPipeline(null!==(i=null===(n=this.filterManager)||void 0===n?void 0:n.getFilteredRows())&&void 0!==i?i:this.localRows),this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))),void 0!==t.pivot&&void 0===t.rows&&this.syncPivotPipeline(null!==(r=null===(o=this.filterManager)||void 0===o?void 0:o.getFilteredRows())&&void 0!==r?r:this.localRows),void 0===t.rows&&void 0===t.totalRowCount||null===(l=this.dimensionManager)||void 0===l||l.updateConfig({totalRowCount:null!==(a=this.config.totalRowCount)&&void 0!==a?a:this.localRows.length}),void 0!==t.columns&&!this.isResizing){if(this.captureAnimationSnapshot(),this.pristineDefaultHeaders=An(t.columns),this.filterManager&&this.filterManager.updateConfig({headers:this.pristineDefaultHeaders}),null===(d=this.pivotManager)||void 0===d?void 0:d.isActive())this.syncPivotPipeline(null!==(h=null===(c=this.filterManager)||void 0===c?void 0:c.getFilteredRows())&&void 0!==h?h:this.localRows);else if(this.headers=[...t.columns],this.essentialAccessors=Gn.buildEssentialAccessors(this.headers),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers}),this.dimensionManager){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}this.autoSizeAccessors=this.computeAutoSizeAccessors(),this.pendingAutoSize=new Set(this.autoSizeAccessors),this.naturalWidths.clear()}if(void 0!==t.isLoading){const e=this.internalIsLoading;this.internalIsLoading=t.isLoading,e&&!t.isLoading&&this.autoSizeAccessors.size>0&&this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))}if(void 0!==t.theme&&(this.domManager.updateTheme(t.theme),t.theme!==g&&(this.renderOrchestrator.invalidateCache("all"),this.renderOrchestrator.invalidateCustomFooterCache())),void 0!==t.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0===t.rows&&void 0===t.footerRenderer&&void 0===t.footerRenderKey||this.renderOrchestrator.invalidateCustomFooterCache(),void 0!==t.customTheme){const t=this.customTheme;this.customTheme=Gn.mergeCustomTheme(this.config),function(t,n){for(const i of Object.keys(e))if(t[i]!==n[i])return!1;return!0}(t,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(u=this.dimensionManager)||void 0===u||u.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.enablePagination&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.enablePagination&&t.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}if(void 0===t.selectableColumns&&void 0===t.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(f=this.config.selectableColumns)&&void 0!==f&&f,selectableCells:null!==(v=this.config.selectableCells)&&void 0!==v&&v}),(void 0!==t.enableRowSelection||void 0!==t.rowSelectionMode||void 0!==t.selectRowOnClick||void 0!==t.showRowSelectionColumn||void 0!==t.rowButtons||void 0!==t.onRowSelectionChange||void 0!==t.selectableCells)&&(this.syncRowSelectionManager(),null===(p=this.selectionManager)||void 0===p||p.updateConfig({enableRowSelection:Ne(this.config)}),(void 0!==t.enableRowSelection||void 0!==t.showRowSelectionColumn||void 0!==t.rowButtons)&&(this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("all"),this.dimensionManager))){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager.updateConfig({effectiveHeaders:t})}void 0===t.height&&void 0===t.maxHeight||null===(w=this.dimensionManager)||void 0===w||w.updateConfig({height:this.config.height,maxHeight:this.config.maxHeight}),void 0===t.scrollParent&&void 0===t.height&&void 0===t.maxHeight||this.syncExternalScrollWiring(),void 0===t.onLoadMore&&void 0===t.infiniteScrollThreshold||!this.scrollManager||this.scrollManager.updateConfig({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(m=this.config.infiniteScrollThreshold)&&void 0!==m?m:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}syncRowSelectionManager(){var t,e,n,i,o;if(this.config.enableRowSelection){const s={onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0,rowSelectionMode:null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple",selectRowOnClick:null!==(e=this.config.selectRowOnClick)&&void 0!==e&&e,showRowSelectionColumn:!1!==this.config.showRowSelectionColumn,selectableCells:null!==(n=this.config.selectableCells)&&void 0!==n&&n,tableRoot:this.container};this.rowSelectionManager?this.rowSelectionManager.updateConfig(s):(this.rowSelectionManager=new ze(Object.assign({tableRows:null!==(o=null===(i=this.renderOrchestrator.getLastProcessedResult())||void 0===i?void 0:i.currentTableRows)&&void 0!==o?o:[]},s)),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")}))}else this.rowSelectionManager&&(this.rowSelectionManager.destroy(),this.rowSelectionManager=null)}destroy(){var t,e,n,i,o,s,r,l,a,d,c,h,u,f,v,p;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!==this.externalScrollRetryRaf&&(cancelAnimationFrame(this.externalScrollRetryRaf),this.externalScrollRetryRaf=null),null!==this.unvirtualizedRowsCheckTimeoutId&&(clearTimeout(this.unvirtualizedRowsCheckTimeoutId),this.unvirtualizedRowsCheckTimeoutId=null),this.detachExternalScrollWiring();const w=this.domManager.getElements();(null==w?void 0:w.bodyContainer)&&(this.ensureBodyScrollListenerDetached(w.bodyContainer),this.bodyContainerMouseLeaveListener&&(w.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const m=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;m.classList.remove(On),m.style.removeProperty(Pn),m.style.removeProperty($n),null===(n=this.dimensionManager)||void 0===n||n.destroy(),null===(i=this.scrollManager)||void 0===i||i.destroy(),null===(o=this.sectionScrollController)||void 0===o||o.destroy(),null===(s=this.sortManager)||void 0===s||s.destroy(),null===(r=this.filterManager)||void 0===r||r.destroy(),null===(l=this.pivotManager)||void 0===l||l.destroy(),this.pivotManager=null,null===(a=this.rowSelectionManager)||void 0===a||a.destroy(),null===(d=this.selectionManager)||void 0===d||d.destroy(),null===(c=this.autoScaleManager)||void 0===c||c.destroy(),null===(h=this.windowResizeManager)||void 0===h||h.destroy(),null===(u=this.handleOutsideClickManager)||void 0===u||u.destroy(),null===(f=this.scrollbarVisibilityManager)||void 0===f||f.destroy(),null===(v=this.expandedDepthsManager)||void 0===v||v.destroy(),null===(p=this.ariaAnnouncementManager)||void 0===p||p.destroy(),this.animationCoordinator.destroy(),this.cellRegistry.clear(),this.headerRegistry.clear(),m.querySelectorAll("[data-row-id]").forEach(t=>{const e=t.getAttribute("data-row-id");e&&Mn(e,t)}),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container),this.cachedAPI=null}getAPI(){if(this.cachedAPI)return this.cachedAPI;const t=this;return this.cachedAPI=ho.createAPI({get config(){return t.config},get localRows(){return t.localRows},get effectiveHeaders(){return t.renderOrchestrator.computeEffectiveHeaders(t.headers,t.config,t.customTheme)},get headers(){return t.headers},getPristineDefaultHeaders:()=>t.pristineDefaultHeaders,get essentialAccessors(){return t.essentialAccessors},get customTheme(){return t.customTheme},get currentPage(){return t.currentPage},getCurrentPage:()=>this.currentPage,get expandedRows(){return t.expandedRows},get collapsedRows(){return t.collapsedRows},get expandedDepths(){return t.expandedDepths},clearExpandedRows:()=>{t.expandedRows=new Map},clearCollapsedRows:()=>{t.collapsedRows=new Map},get rowStateMap(){return t.rowStateMap},get headerRegistry(){return t.headerRegistry},get cellRegistry(){return t.cellRegistry},isCellAnimating:t=>this.animationCoordinator.isInFlight(t),hasAnimatingCells:()=>this.animationCoordinator.hasInFlight(),get columnEditorOpen(){return t.columnEditorOpen},getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),get expandedDepthsManager(){return t.expandedDepthsManager},get selectionManager(){return t.selectionManager},get rowSelectionManager(){return t.rowSelectionManager},get sortManager(){return t.sortManager},get filterManager(){return t.filterManager},getEffectiveRowGrouping:()=>this.getEffectiveRowGrouping(),setPivot:t=>{var e,n,i,o;this.config=Object.assign(Object.assign({},this.config),{pivot:t}),this.syncPivotPipeline(null!==(n=null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows),null===(o=(i=this.config).onPivotChange)||void 0===o||o.call(i,t),this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("body"),this.render("setPivot")},getPivot:()=>{var t,e,n;return null!==(n=null!==(e=null===(t=this.pivotManager)||void 0===t?void 0:t.getPivot())&&void 0!==e?e:this.config.pivot)&&void 0!==n?n:null},getPivotHeaders:()=>{var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.headers:this.headers},getPivotedRows:()=>{var t;const e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState();return(null==e?void 0:e.active)?e.pivotedRows:this.localRows},onRender:()=>this.render("columnEditor-onRender"),invalidateRowsCache:()=>{this.renderOrchestrator.invalidateCache("body")},runWithoutAnimationSnapshot:t=>{this.suppressNextAnimationSnapshot=!0;try{t()}finally{this.suppressNextAnimationSnapshot=!1}},setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=An(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}}),this.cachedAPI}}function wo(t,e){if(t===e)return!0;if(t.accessor!==e.accessor||t.width!==e.width||t.minWidth!==e.minWidth||t.maxWidth!==e.maxWidth||t.label!==e.label||t.type!==e.type||t.pinned!==e.pinned||t.hide!==e.hide||t.sortable!==e.sortable||t.filterable!==e.filterable||t.align!==e.align||t.collapsible!==e.collapsible||t.collapseDefault!==e.collapseDefault||t.showWhen!==e.showWhen||t.editable!==e.editable||t.essential!==e.essential||t.disableReorder!==e.disableReorder||t.expandable!==e.expandable||t.excludeFromRender!==e.excludeFromRender||t.autoSizeMode!==e.autoSizeMode||t.tooltip!==e.tooltip||t.quickFilterable!==e.quickFilterable)return!1;const n=t.filterOperators,i=e.filterOperators;if(n!==i){if(!n||!i||n.length!==i.length)return!1;for(let t=0;n.length>t;t++)if(n[t]!==i[t])return!1}const o=t.children,s=e.children;if(o===s)return!0;if(!o||!s)return!o&&!s;if(o.length!==s.length)return!1;for(let t=0;o.length>t;t++)if(!wo(o[t],s[t]))return!1;return!0}function mo(t,e){if(t===e)return!0;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(t[i]!==e[i])return!1;return!0}po.nextHoverScopeId=0,po.EXTERNAL_SCROLL_MAX_RETRIES=60,exports.PIVOT_ACCESSOR_PREFIX=se,exports.PIVOT_BLANK_LABEL=re,exports.PIVOT_CHILDREN_KEY=ie,exports.PIVOT_IS_TOTAL_KEY=oe,exports.SHALLOW_ROW_COMPARE_MAX=5e4,exports.SimpleTableVanilla=po,exports.asRows=function(t){return t},exports.buildPivotAccessor=pe,exports.buildPivotRowTotalAccessor=we,exports.collectHeaderAccessors=function t(e,n=new Set){var i;for(const o of e)n.add(o.accessor+""),(null===(i=o.children)||void 0===i?void 0:i.length)&&t(o.children,n);return n},exports.headersStructurallyEqual=function(t,e){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!wo(t[n],e[n]))return!1;return!0},exports.normalizeColumnDef=n,exports.normalizeColumnDefs=i,exports.normalizeConfig=o,exports.normalizeConfigPatch=s,exports.pivotRows=Re,exports.rowsShallowUnchanged=function(t,e,n){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;const i=5e4>=e.length;for(let o=0;t.length>o;o++){const s=t[o],r=e[o];if(s!==r){if(n&&n({row:s,depth:0,index:o,rowPath:[],rowIndexPath:[o]})+""!=n({row:r,depth:0,index:o,rowPath:[],rowIndexPath:[o]})+"")return!1;if(!i)return!1;if(!mo(s,r))return!1}}return!0},exports.shallowEqualRow=mo;
|
|
1
|
+
"use strict";function t(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?Object.assign(Object.assign({},e),{children:e.children.map(t)}):e}function e(e){return e.map(t)}function n(t){if(!t.columns)throw Error("SimpleTable requires `columns`");return Object.assign(Object.assign({},t),{columns:e(t.columns)})}function o(t){return void 0!==t.columns?Object.assign(Object.assign({},t),{columns:e(t.columns)}):Object.assign({},t)}Object.defineProperty(exports,"__esModule",{value:!0});const i=new WeakMap,s=(t,e,n)=>{const o=(t=>{let e=i.get(t);return e||(e=new Map,i.set(t,e)),e})(t);let s=o.get(e);s||(s=document.createElement("div"),s.className="st-aria-row",s.setAttribute("role","row"),s.style.display="contents",t.appendChild(s),o.set(e,s));const r=n+"";return s.getAttribute("aria-rowindex")!==r&&s.setAttribute("aria-rowindex",r),s},r=t=>{const e=i.get(t);e&&e.forEach((t,n)=>{0===t.childElementCount&&(t.remove(),e.delete(n))})},l=t=>{const e=i.get(t);e&&(e.forEach(t=>t.remove()),e.clear())},a=new WeakMap,d=(t,e,n,o)=>{t.addEventListener(e,n,o),a.has(t)||a.set(t,[]),a.get(t).push({event:e,handler:n,options:o})},c=new WeakMap,u=t=>(c.has(t)||c.set(t,new Map),c.get(t)),h=(t,e)=>{if(t){const n=u(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),l(t)}},f=new WeakMap;let v=0,p=Date.now(),w={screenX:0,screenY:0},m=null;const g=t=>{p=t},b=new WeakMap,x=t=>(b.has(t)||b.set(t,new Map),b.get(t)),y=new WeakMap,R=t=>(y.has(t)||y.set(t,new Map),y.get(t)),S=(t,e)=>{const n=Date.now();0!==v&&e>n-v||(v=n,t())},C=(t,e,n,o)=>{t.addEventListener(e,n,o),f.has(t)||f.set(t,[]),f.get(t).push({event:e,handler:n,options:o})};let M=0;const H=()=>M,I=t=>{M+=1;const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())};let k=!0;const E=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},T=t=>{if(!t||"none"===t)return null;const e=t.match(/translate3d\(\s*([^,]+),\s*([^,]+)/i);if(e){const t=parseFloat(e[1]),n=parseFloat(e[2]);if(Number.isFinite(t)&&Number.isFinite(n))return{x:t,y:n}}const n=t.match(/translate\(\s*([^,\s]+)(?:\s*,\s*([^)]+))?/i);if(n){const t=parseFloat(n[1]),e=parseFloat(n[2]||"0");if(Number.isFinite(t)&&Number.isFinite(e))return{x:t,y:e}}const o=t.match(/^matrix\(\s*([^)]+)\)/i);if(o){const t=o[1].split(",").map(t=>parseFloat(t.trim()));if(t.length>=6&&t.every(Number.isFinite))return{x:t[4],y:t[5]}}const i=t.match(/^matrix3d\(\s*([^)]+)\)/i);if(i){const t=i[1].split(",").map(t=>parseFloat(t.trim()));if(t.length>=16&&Number.isFinite(t[12])&&Number.isFinite(t[13]))return{x:t[12],y:t[13]}}return null},A=t=>{if("undefined"!=typeof getComputedStyle){const e=T(getComputedStyle(t).transform);if(e)return e}return T(t.style.transform||"")},O=(t,e,n)=>{const o=E(t.style.left),i=E(t.style.top);k&&((t,e,n)=>{if(0===e&&0===n)return!1;if(!((t,e)=>!(!e||"none"===e)||"transform"===t.style.willChange||!!t.classList.contains("st-flip-active")||"function"==typeof t.getAnimations&&t.getAnimations().some(t=>{const e=t.id;return!("st-cell-slide"!==e&&"st-column-reorder"!==e||"running"!==t.playState&&"paused"!==t.playState)}))(t,t.style.transform||""))return!1;const o=A(t);if(!o)return!1;if(t.style.transition="none",t.style.willChange="transform",t.classList.add("st-flip-active"),t.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`,"function"==typeof t.getAnimations)for(const e of t.getAnimations()){const t=e.id;if("st-cell-slide"===t||"st-column-reorder"===t)try{e.cancel()}catch(t){}}t.style.transform=`translate3d(${o.x-e}px, ${o.y-n}px, 0)`})(t,e-o,n-i),t.style.left=e+"px",t.style.top=n+"px"},P=(t,e,n)=>0>=n.clientSize||t+(e>0?e:0)>=n.scrollOffset&&n.scrollOffset+n.clientSize>=t,W=(t,e,n)=>{var o;const i=new Map;if(0>=e.clientSize){for(const e of t)i.set(e.id,e.truePos);return i}const s=[],r=[];for(const n of t)n.holdTruePos?i.set(n.id,n.truePos):"before"!==n.forceSide?"after"!==n.forceSide?P(n.truePos,n.cellSize,e)?i.set(n.id,n.truePos):e.scrollOffset>n.truePos+(n.cellSize>0?n.cellSize:0)?s.push(n):r.push(n):r.push(n):s.push(n);const l=null!==(o=null==n?void 0:n.gap)&&void 0!==o?o:0,a=e.scrollOffset,d=e.scrollOffset+e.clientSize,c=e.clientSize;return s.sort((t,e)=>e.truePos-t.truePos),r.sort((t,e)=>t.truePos-e.truePos),s.forEach((t,e)=>{var o;const s=t.cellSize>0?t.cellSize:0,r=null!==(o=null==n?void 0:n.margin)&&void 0!==o?o:s,d=s+l;if("before"===t.forceSide)return void i.set(t.id,a-r-s-Math.min(e*d,c));const u=a-Math.min(r,Math.max(0,a-(t.truePos+s)))-s;i.set(t.id,u-Math.min(e*d,Math.max(0,u-t.truePos),c))}),r.forEach((t,e)=>{var o;const s=t.cellSize>0?t.cellSize:0,r=null!==(o=null==n?void 0:n.margin)&&void 0!==o?o:s,a=s+l;if("after"===t.forceSide)return void i.set(t.id,d+r+Math.min(e*a,c));const u=d+Math.min(r,Math.max(0,t.truePos-d));i.set(t.id,u+Math.min(e*a,Math.max(0,t.truePos-u),c))}),i},F=.5,$="st-flip-active",D="st-cell-slide",L=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},j=t=>{var e,n;const o=L(t.style.left),i=L(t.style.top),s=A(t);return{left:o+(null!==(e=null==s?void 0:s.x)&&void 0!==e?e:0),top:i+(null!==(n=null==s?void 0:s.y)&&void 0!==n?n:0)}},N=t=>{t.style.transition="",t.style.transform="",t.style.willChange="",t.style.pointerEvents="",t.classList.remove($)};class B{constructor(t={}){var e;this.active=!1,this.pendingSnap=null,this.running=new Set,this.duration=null!==(e=t.duration)&&void 0!==e?e:400}setDuration(t){this.duration=t}setActive(t){this.active=t,t||(this.pendingSnap=null)}isActive(){return this.active}hasInFlight(){return this.running.size>0}beginOrderChange(t){if(!this.active)return;const e=new Map,n=t.querySelectorAll(".st-header-cell[data-accessor]");for(let t=0;n.length>t;t++){const o=n[t],i=o.getAttribute("data-accessor");if(!i||e.has(i))continue;const s=j(o);e.set(i,{visualLeft:s.left,visualTop:s.top,styleLeft:L(o.style.left),styleTop:L(o.style.top)})}this.pendingSnap=e}commitOrderChange(t){var e,n,o,i,s,r,l,a;if(!this.active)return void(this.pendingSnap=null);const d=this.pendingSnap;if(this.pendingSnap=null,!d||0===d.size)return;const c=null!==(r=null!==(o=null===(n=(e=t).querySelector)||void 0===n?void 0:n.call(e,".st-body-main"))&&void 0!==o?o:null===(s=(i=t).querySelector)||void 0===s?void 0:s.call(i,".st-header-main"))&&void 0!==r?r:null,u={scrollOffset:c?c.scrollLeft:0,clientSize:c?c.clientWidth:"undefined"!=typeof window?window.innerWidth:0},h=t.querySelectorAll(".st-header-cell[data-accessor]"),f=[],v=new Map;for(let t=0;h.length>t;t++){const e=h[t],n=e.getAttribute("data-accessor");if(!n||v.has(n))continue;v.set(n,e);const o=d.get(n),i=L(e.style.left);if(!o)continue;if(F>Math.abs(i-o.styleLeft))continue;const s=L(e.style.width)||120;f.push({accessor:n,el:e,fromLeft:o.visualLeft,toLeft:i,width:s})}if(0===f.length)return;const p=W(f.map(t=>({id:t.accessor,truePos:t.fromLeft,cellSize:t.width,holdTruePos:!0})),u),w=W(f.map(t=>({id:t.accessor,truePos:t.toLeft,cellSize:t.width,holdTruePos:P(t.toLeft,t.width,u)})),u),m=new Map;for(const t of f){const e=null!==(l=p.get(t.accessor))&&void 0!==l?l:t.fromLeft,n=null!==(a=w.get(t.accessor))&&void 0!==a?a:t.toLeft,o=e-t.toLeft,i=n-t.toLeft;F>Math.abs(o-i)&&F>Math.abs(o)||m.set(t.accessor,{fromX:o,toX:i})}if(0===m.size)return;for(const[t,e]of m){const n=v.get(t);n&&this.animate({element:n,id:t,fromX:e.fromX,fromY:0,toX:e.toX,toY:0,easing:"linear",duration:Math.max(this.duration,Math.min(2500,Math.round(3*Math.abs(e.fromX))))})}const g=t.querySelectorAll(".st-cell[data-accessor]");for(let t=0;g.length>t;t++){const e=g[t];if(e.classList.contains("st-header-cell"))continue;const n=e.getAttribute("data-accessor");if(!n||!m.has(n))continue;const o=m.get(n);this.animate({element:e,id:`body:${n}:${t}`,fromX:o.fromX,fromY:0,toX:o.toX,toY:0,easing:"linear",duration:Math.max(this.duration,Math.min(2500,Math.round(3*Math.abs(o.fromX))))})}}animate(t){var e,n,o,i,s;const r=t.element,l=t.fromX,a=t.fromY,d=null!==(e=t.toX)&&void 0!==e?e:0,c=null!==(n=t.toY)&&void 0!==n?n:0,u=t.id,h=A(r);h&&(r.style.transition="none",r.style.transform=`translate3d(${h.x}px, ${h.y}px, 0)`),(t=>{if("function"==typeof t.getAnimations)for(const e of t.getAnimations()){const t=e.id;if(t===D||"st-column-reorder"===t)try{e.cancel()}catch(t){}}})(r),r.style.transition="none";const f=Math.hypot(l-d,a-c);if(F>f)return N(r),this.running.delete(u),null===(o=t.onFinish)||void 0===o||o.call(t),!0;const v=null!==(i=t.duration)&&void 0!==i?i:this.duration,p=null!==(s=t.easing)&&void 0!==s?s:"ease-out",w=`translate3d(${l}px, ${a}px, 0)`,m=`translate3d(${d}px, ${c}px, 0)`;if(r.style.transform=w,r.style.willChange="transform",r.style.pointerEvents="none",r.classList.add($),this.running.add(u),"function"!=typeof r.animate)return window.setTimeout(()=>{var e;F>Math.abs(d)&&F>Math.abs(c)?N(r):r.style.transform=m,this.running.delete(u),null===(e=t.onFinish)||void 0===e||e.call(t)},v),!0;const g=r.animate([{transform:w},{transform:m}],{duration:v,easing:p,fill:"both"});g.id=D;let b=!1;const x=()=>{var e,n,o;if(b)return;const i=null===(e=r.getAnimations)||void 0===e?void 0:e.call(r).find(t=>t.id===D);if(!i||i===g){b=!0;try{null===(n=g.commitStyles)||void 0===n||n.call(g)}catch(t){}F>Math.abs(d)&&F>Math.abs(c)&&N(r);try{g.cancel()}catch(t){}this.running.delete(u),null===(o=t.onFinish)||void 0===o||o.call(t)}};return g.onfinish=x,g.finished.then(x).catch(()=>{var e,n;if(b)return;if(!r.isConnected)return b=!0,void this.running.delete(u);const o=null===(e=r.getAnimations)||void 0===e?void 0:e.call(r).find(t=>t.id===D);o&&o!==g||(b=!0,this.running.delete(u),null===(n=t.onFinish)||void 0===n||n.call(t))}),!0}destroy(){this.active=!1,this.pendingSnap=null,this.running.clear()}}const z=.5,V="st-cell-animating-out",q="data-animating-out",G="data-shrinking-out",K=t=>{const e=u(t),n=x(t);if(0===e.size)return n;if(0===n.size)return e;const o=new Map(e);return n.forEach((t,e)=>o.set(e,t)),o};class _{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.inFlight=new Map,this.retainedCells=new Map,this.scrollerMetricsCache=new WeakMap,this.externalVerticalScroll=null,this.scheduledFlip=null,this.columnReordering=!1,this.cellSlideAnimator=new B,this.duration=null!==(e=t.duration)&&void 0!==e?e:400,this.easing=null!==(n=t.easing)&&void 0!==n?n:"ease-out",this.prefersReducedMotion=Z(),this.cellSlideAnimator.setDuration(this.duration)}setOnHostDiscard(t){this.onHostDiscard=t}setEnabled(t){this.enabled!==t&&(this.enabled=t,t||this.cancel())}setDuration(t){Number.isFinite(t)&&t>0&&(this.duration=t,this.cellSlideAnimator.setDuration(t))}setEasing(t){"string"==typeof t&&t.length>0&&(this.easing=t)}isEnabled(){return this.enabled&&!this.prefersReducedMotion}setColumnReordering(t){this.columnReordering!==t&&(this.columnReordering=t,this.cellSlideAnimator.setActive(t),k=!t)}isColumnReordering(){return this.columnReordering}beginColumnReorder(t){this.isEnabled()&&this.columnReordering&&this.cellSlideAnimator.beginOrderChange(t)}commitColumnReorder(t){this.isEnabled()&&this.columnReordering&&this.cellSlideAnimator.commitOrderChange(t)}isInFlight(t){return this.inFlight.has(t)}hasInFlight(){return this.inFlight.size>0||this.cellSlideAnimator.hasInFlight()}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}setAccordionPreVisibleAccessors(t){this.accordionPreVisibleAccessors=this.isEnabled()&&t&&t.size>0?t:null}wasRenderableBeforeAccordion(t){var e,n;return null!==(n=null===(e=this.accordionPreVisibleAccessors)||void 0===e?void 0:e.has(t))&&void 0!==n&&n}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);if(!e){const n=J(t);e=this.externalVerticalScroll?Object.assign(Object.assign({},n),{clientHeight:this.externalVerticalScroll.clientHeight,scrollHeight:this.externalVerticalScroll.scrollHeight,scrollTop:this.externalVerticalScroll.scrollTop}):n,this.scrollerMetricsCache.set(t,e)}return e}setExternalVerticalScroll(t){this.externalVerticalScroll=t,this.clearScrollerMetricsCache()}clearScrollerMetricsCache(){this.scrollerMetricsCache=new WeakMap}captureSnapshot(t){var e;if(!this.isEnabled())return void(this.snapshot=null);this.clearScrollerMetricsCache();const n=new Map;for(const o of t.containers){if(!o)continue;const i=o.getBoundingClientRect(),s=i.left,r=i.top;K(o).forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,o,s,r))});const l=this.retainedCells.get(o);l&&l.forEach((t,e)=>{n.has(e)||n.set(e,this.readPosition(e,t,o,s,r))});const a=null===(e=t.preLayouts)||void 0===e?void 0:e.get(o);a&&a.forEach((t,e)=>{n.has(e)||n.set(e,{sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})})}this.snapshot=n.size>0?n:null}shouldRetain(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntry(t){var e;return!!(null===(e=this.snapshot)||void 0===e?void 0:e.has(t))}hasSnapshotEntryInContainer(t,e){var n;const o=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);return!!o&&(null===o.sourceContainer||o.sourceContainer===e)}shouldAnimateVerticalTransition(t){const e=this.getScrollerMetrics(t.container),n=Y(t.beforeTop,t.cellHeight,e),o=Y(t.afterTop,t.cellHeight,e);return n||o}shouldAnimateHorizontalTransition(t){const e=this.getScrollerMetrics(t.container),n=X(t.beforeLeft,t.cellWidth,e),o=X(t.afterLeft,t.cellWidth,e);return n||o}shouldAnimateTransition(t){const e=Math.abs(t.beforeTop-t.afterTop)>=z,n=Math.abs(t.beforeLeft-t.afterLeft)>=z;return!(!e||!this.shouldAnimateVerticalTransition({beforeTop:t.beforeTop,afterTop:t.afterTop,cellHeight:t.cellHeight,container:t.container}))||!(!n||!this.shouldAnimateHorizontalTransition({beforeLeft:t.beforeLeft,afterLeft:t.afterLeft,cellWidth:t.cellWidth,container:t.container}))}shouldMountIncomingCell(t){var e;const n=null===(e=this.snapshot)||void 0===e?void 0:e.get(t.cellId);if(!n)return!0;const o=this.getScrollerMetrics(t.container),i=Y(n.styleTop,t.cellHeight,o),s=Y(t.afterTop,t.cellHeight,o),r=X(n.styleLeft,t.cellWidth,o),l=X(t.afterLeft,t.cellWidth,o);return i||s||r||l}isCellRenderedInScrollerViewport(t,e){const n=t.getBoundingClientRect();if(0===n.width&&0===n.height)return!1;const o=e.getBoundingClientRect(),i=n.right>o.left&&o.right>n.left,s=this.externalVerticalScroll?null:e.parentElement;if(!s)return i;const r=s.getBoundingClientRect();return i&&n.bottom>r.top&&r.bottom>n.top}shouldRetainDomCellAtScrollExtrema(t,e){var n;const o=null===(n=this.snapshot)||void 0===n?void 0:n.get(t);if(!o||null===o.sourceContainer)return!1;const i=this.getScrollerMetrics(e);if(i.clientHeight>=i.scrollHeight)return!1;const s=i.scrollTop+i.clientHeight>=i.scrollHeight-1,r=1>=i.scrollTop;if(!s&&!r)return!1;const l=i.clientHeight;return!(!s||i.scrollTop-l>o.styleTop)||!(!r||o.styleTop>i.scrollTop+l)}retainCell(t){var e;const{cellId:n,element:o,container:i,newPosition:s}=t,r=U(o.style.top),l=U(o.style.left),a=this.getScrollerMetrics(i),d=Q(s.top,r,s.height,a,"y"),c=Q(s.left,l,s.width,a,"x");let u=this.retainedCells.get(i);u||(u=new Map,this.retainedCells.set(i,u));const h=u.get(n);h&&h!==o&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,h),h.remove()),o.id&&o.removeAttribute("id"),o.classList.add(V),o.setAttribute(q,"true"),o.style.left=c+"px",o.style.top=d+"px",o.style.width=s.width+"px",o.style.height=s.height+"px",o.style.pointerEvents="none",u.set(n,o)}claimRetainedForReuse(t,e){var n,o;const i=this.retainedCells.get(e);if(!i)return null;const s=i.get(t);return s?s.hasAttribute(G)?(this.cancelInFlight(t),i.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),null===(o=this.onHostDiscard)||void 0===o||o.call(this,s),s.remove(),null):(this.cancelInFlight(t),i.delete(t),s.classList.remove(V),s.removeAttribute(q),s.id=t,s.style.pointerEvents="",s):null}shrinkOutCell(t){var e;const{cellId:n,element:o,container:i,axis:s}=t;this.cancelInFlight(n);let r=this.retainedCells.get(i);r||(r=new Map,this.retainedCells.set(i,r));const l=r.get(n);l&&l!==o&&(this.cancelInFlight(n),null===(e=this.onHostDiscard)||void 0===e||e.call(this,l),l.remove()),o.id&&o.removeAttribute("id"),o.classList.add(V),o.setAttribute(q,"true"),o.setAttribute(G,"true"),o.style.pointerEvents="none","horizontal"===s?o.style.width="0px":o.style.height="0px",r.set(n,o);const a=window.setTimeout(()=>{var t;const e=this.retainedCells.get(i);e&&e.get(n)===o&&e.delete(n),null===(t=this.onHostDiscard)||void 0===t||t.call(this,o),o.remove()},this.duration+80);this.inFlight.set(n,{element:o,cleanupTimeout:a,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){var n;const o=this.retainedCells.get(e);if(!o)return;const i=o.get(t);i&&(this.cancelInFlight(t),o.delete(t),null===(n=this.onHostDiscard)||void 0===n||n.call(this,i),i.remove())}play(t){if(this.columnReordering)return void(this.snapshot=null);const e=this.snapshot,n=this.incomingOrigins;if(this.snapshot=null,this.incomingOrigins=null,!this.isEnabled()||!e)return void this.retainedCells.forEach(t=>{t.forEach((e,n)=>{var o;this.inFlight.has(n)||(null===(o=this.onHostDiscard)||void 0===o||o.call(this,e),e.remove(),t.delete(n))})});const o=[],i=new Set,s=new Map,r=(t,r,l,a)=>{var d,c;if(i.has(r))return;if(l&&t.hasAttribute(G))return void i.add(r);let u=e.get(r);if(!u&&!l&&n){const t=n.get(r);t&&(u={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!u)return;if(!l&&null!==u.sourceContainer&&u.sourceContainer!==a)return void i.add(r);if(t.querySelector(".st-cell-editing"))return;const h=U(t.style.left),f=U(t.style.top);if(!l&&this.inFlight.has(r)&&z>Math.abs(u.styleTop-f)&&z>Math.abs(u.styleLeft-h))return void i.add(r);const v=l||u.fromDom,p=v?0:U(t.style.height)||t.offsetHeight||0,w=v?0:U(t.style.width)||t.offsetWidth||0,m=v?null:this.getScrollerMetrics(a),g=v||!m?u.top:Q(u.top,f,p,m,"y"),b=v||!m?u.left:Q(u.left,h,w,m,"x"),x=null!=m?m:this.getScrollerMetrics(a),y=U(t.style.height)||t.offsetHeight||p||0;let R=g;const S=!!x&&Y(f,y,x);if(!l&&x&&S){const t=x.scrollTop,e=x.scrollTop+x.clientHeight;(l||null!==u.sourceContainer||u.fromDom||Math.abs(g-f)>=z&&!Y(g,y,x))&&Y(g,y,x)||(R=g>f?e:t-y)}let C=0;if(null!==u.sourceContainer){const t=(t=>{let e=s.get(t);if(!e){const n=t.getBoundingClientRect();e={left:n.left,top:n.top},s.set(t,e)}return e})(a);C=t.left-u.sourceContainerLeft}let M=b-h-C,H=R-f-0;z>Math.abs(M)&&z>Math.abs(H)?l&&(this.cancelInFlight(r),null===(d=this.retainedCells.get(a))||void 0===d||d.delete(r),null===(c=this.onHostDiscard)||void 0===c||c.call(this,t),t.remove()):(o.push({cellId:r,element:t,dx:M,dy:H,isRetained:l}),i.add(r))};for(const e of t.containers){if(!e)continue;const t=this.retainedCells.get(e);t&&t.forEach((t,n)=>{r(t,n,!0,e)}),K(e).forEach((t,n)=>{r(t,n,!1,e)})}if(this.scheduledFlip){cancelAnimationFrame(this.scheduledFlip.rafId);for(const{element:t}of this.scheduledFlip.pending)t.style.transition="none",t.style.transform="",t.style.willChange="";this.scheduledFlip=null}for(const{cellId:t,element:e,dx:n,dy:i}of o)this.cancelInFlight(t),e.style.transition="none",e.style.transform=`translate3d(${n}px, ${i}px, 0)`,e.style.willChange="transform";if(0===o.length)return;const l=requestAnimationFrame(()=>{const t=requestAnimationFrame(()=>{this.scheduledFlip=null;for(const{cellId:t,element:e,isRetained:n}of o)e.isConnected&&this.startTransition(t,e,n)});this.scheduledFlip&&(this.scheduledFlip.rafId=t)});this.scheduledFlip={rafId:l,pending:o}}cancel(){this.snapshot=null,this.incomingOrigins=null,this.accordionPreVisibleAccessors=null,this.clearScrollerMetricsCache(),this.scheduledFlip&&(cancelAnimationFrame(this.scheduledFlip.rafId),this.scheduledFlip=null);const t=Array.from(this.inFlight.entries());this.inFlight.clear();for(const[e,n]of t)window.clearTimeout(n.cleanupTimeout),n.element.removeEventListener("transitionend",n.transitionEndHandler),this.finishElement(e,n.element,n.isRetained);this.retainedCells.forEach(t=>{t.forEach(t=>{var e;null===(e=this.onHostDiscard)||void 0===e||e.call(this,t),t.remove()}),t.clear()}),this.retainedCells.clear()}destroy(){this.setColumnReordering(!1),this.cellSlideAnimator.destroy(),this.cancel()}readPosition(t,e,n,o,i){const s=U(e.style.top),r=U(e.style.left);if(this.inFlight.get(t)){const t=e.getBoundingClientRect(),l=e.offsetParent;if(l){const e=l.getBoundingClientRect();return{sourceContainer:n,sourceContainerLeft:o,sourceContainerTop:i,left:t.left-e.left+l.scrollLeft,top:t.top-e.top+l.scrollTop,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:o,sourceContainerTop:i,left:t.left,top:t.top,styleTop:s,styleLeft:r,fromDom:!0}}return{sourceContainer:n,sourceContainerLeft:o,sourceContainerTop:i,left:r,top:s,styleTop:s,styleLeft:r,fromDom:!1}}startTransition(t,e,n){e.style.transition=`transform ${this.duration}ms ${n?"ease-in":this.easing}`,e.style.transform="translate3d(0, 0, 0)",n||(e.style.pointerEvents="none");const o=n=>{"transform"===n.propertyName&&this.finalizeCell(t,e)};e.addEventListener("transitionend",o);const i=window.setTimeout(()=>{this.finalizeCell(t,e)},this.duration+80);this.inFlight.set(t,{element:e,cleanupTimeout:i,transitionEndHandler:o,isRetained:n})}cancelInFlight(t){const e=this.inFlight.get(t);e&&(window.clearTimeout(e.cleanupTimeout),e.element.removeEventListener("transitionend",e.transitionEndHandler),this.inFlight.delete(t))}finalizeCell(t,e){var n;const o=this.inFlight.get(t),i=null!==(n=null==o?void 0:o.isRetained)&&void 0!==n?n:this.isCellRetained(e);o&&(window.clearTimeout(o.cleanupTimeout),o.element.removeEventListener("transitionend",o.transitionEndHandler),this.inFlight.delete(t)),this.finishElement(t,e,i)}finishElement(t,e,n){var o;if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),null===(o=this.onHostDiscard)||void 0===o||o.call(this,e),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(q)}}const U=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},J=t=>{const e=t.parentElement;return{clientHeight:e?e.clientHeight:0,scrollHeight:e?e.scrollHeight:0,scrollTop:e?e.scrollTop:0,clientWidth:t.clientWidth,scrollWidth:t.scrollWidth,scrollLeft:t.scrollLeft}},Y=(t,e,n)=>{const o=n.clientHeight;return 0>=o||o>=n.scrollHeight||t>=n.scrollTop&&n.scrollTop+o>t},X=(t,e,n)=>{const o=n.clientWidth;return 0>=o||o>=n.scrollWidth||t>=n.scrollLeft&&n.scrollLeft+o>t},Q=(t,e,n,o,i)=>{const s="y"===i?o.clientHeight:o.clientWidth;if(0>=s||s>=("y"===i?o.scrollHeight:o.scrollWidth))return t;const r=t-e,l=Math.abs(r);if(0===l)return t;const a=n>0?n:0,d="y"===i?o.scrollTop:o.scrollLeft;if(t>=d-a&&d+s>=t)return t;const c=s+a;if(c>=l)return t;const u=l-c,h=c+s*u/(u+10*c);return e+Math.sign(r)*h},Z=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},tt="parentExpanded",et="st-accordion-animating",nt="--st-accordion-duration",ot="--st-accordion-easing",it=t=>Math.ceil(800/(t+1)),st=29.5,rt=(t,e=!0)=>t&&e?st:0,lt=(t,e=!0)=>!(!t||!e),at=150,dt=["lineAreaChart","barChart"],ct=500,ut=(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 i=e;for(const e of t.children)i=o(e,i);return i};return o(t,e),n},ht=t=>t.flatMap(t=>t.children&&0!==t.children.length?ht(t.children):[t]),ft=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...ft(t.children)),e}),vt=(t=0)=>t?t+1:0,pt=t=>!(!t.hide&&!t.excludeFromRender),wt=(t,e)=>{const n=ft(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},mt=(t,e,n)=>{const o=wt(e,t.accessor);if(o){const e=n.has(o.accessor),i=t.showWhen||tt;return e?"parentExpanded"===i:"parentCollapsed"===i}return!1},gt=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},bt=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const o=ht(t.children);let i=0;for(const t of o)pt(t)||mt(t,e,n)||(i+=1);return i},xt=({accessor:t,rowId:e})=>`${e}-${t}`;class yt{constructor(t){this.pendingAccordionAxis=null,this.accordionCleanupTimerId=null,this.lastRenderedVisibilityKey=null,this.host=t}getPendingAxis(){return this.pendingAccordionAxis}clearPendingAxis(){this.pendingAccordionAxis=null}didColumnVisibilityChange(t){const e=Rt(t);return null!==this.lastRenderedVisibilityKey&&e!==this.lastRenderedVisibilityKey}rememberRenderedHeaders(t){this.lastRenderedVisibilityKey=Rt(t)}captureSnapshot(){const{animationCoordinator:t}=this.host,e=t.isEnabled()?this.host.getCurrentBodyLayouts():void 0;this.updateAnimationVerticalScroll(),t.captureSnapshot({containers:this.host.getAnimatableContainers(),preLayouts:e})}begin(t){var e,n;const{animationCoordinator:o}=this.host;if(!o.isEnabled())return;if(null===t)return;if("vertical"===t&&(null!==(n=null===(e=this.host.getEffectiveRowGrouping())||void 0===e?void 0:e.length)&&void 0!==n?n:0)>0)return;const i=this.host.getRoot();if("horizontal"===t&&(null!==this.accordionCleanupTimerId||i.classList.contains(et))){o.cancel(),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null),i.classList.remove(et),i.style.removeProperty(nt),i.style.removeProperty(ot),this.pendingAccordionAxis=null,this.captureSnapshot();const t=o.getDuration();return void(this.accordionCleanupTimerId=window.setTimeout(()=>{this.accordionCleanupTimerId=null},t+80))}this.captureSnapshot(),o.setAccordionPreVisibleAccessors("horizontal"===t?St(this.host):null),this.pendingAccordionAxis=t;const s=o.getDuration(),r=o.getEasing();i.style.setProperty(nt,s+"ms"),i.style.setProperty(ot,r),i.classList.add(et),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{i.classList.remove(et),i.style.removeProperty(nt),i.style.removeProperty(ot),this.accordionCleanupTimerId=null},s+80)}play(){this.host.animationCoordinator.play({containers:this.host.getAnimatableContainers()})}destroy(){null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const t=this.host.getRoot();t.classList.remove(et),t.style.removeProperty(nt),t.style.removeProperty(ot),this.pendingAccordionAxis=null}updateAnimationVerticalScroll(){const t=this.host.getExternalVerticalScroll();this.host.animationCoordinator.setExternalVerticalScroll(t)}}const Rt=t=>{const e=[],n=(t,o)=>{var i,s;if(pt(t))return;const r=null!==(s=null!==(i=t.pinned)&&void 0!==i?i:o)&&void 0!==s?s:"main";if(t.children&&t.children.length>0)for(const e of t.children)n(e,r);else e.push(`${t.accessor+""}:${r}`)};for(const e of t)n(e,void 0);return e.sort(),e.join("|")},St=t=>{const e=t.getCollapsedHeaders(),n=new Set,o=t=>{if(pt(t))return;if(n.add(t.accessor+""),!t.children||0===t.children.length)return;const i=e.has(t.accessor);for(const e of t.children){const t=e.showWhen||tt;(i?"parentCollapsed"===t||"always"===t:"parentExpanded"===t||"always"===t)&&o(e)}};for(const e of t.getHeaders())o(e);return n},Ct=40,Mt=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),Ht="simple-table-root",It="."+Ht,kt=t=>t?t instanceof HTMLElement&&t.classList.contains(Ht)?t:t.closest(It):null,Et=(t,e)=>e.closest(It)===t,Tt=(t,e)=>{if(!t)return[];const n=t instanceof Element?kt(t):null,o=t.querySelectorAll(e);if(!n)return Array.from(o);const i=[];for(let t=0;o.length>t;t++){const e=o[t];e instanceof Element&&Et(n,e)&&i.push(e)}return i},At=(t,e)=>{var n;return null!==(n=Tt(t,e)[0])&&void 0!==n?n:null},Ot=t=>t.replace(/["\\]/g,"\\$&"),Pt=(t,e)=>At(t,`[id="${Ot(e)}"]`),Wt=Ot,Ft=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,$t=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},Dt=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=$t(e);let i=t[n];return null!==o&&Array.isArray(i)&&(i=i[o]),i},t):t[e]},Lt=(t,e)=>{if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0},jt=(t,e,n)=>{const o=e+"";if(!o.includes(".")&&!o.includes("["))return void(t[e]=n);const i=o.split(".");let s=t;for(let t=0;i.length-1>t;t++){const{key:e,index:n}=$t(i[t]);if(null==s[e]){const n=$t(i[t+1]);s[e]=null!==n.index?[]:{}}if(s=s[e],null!==n){if(!Array.isArray(s))throw Error(`Expected array at ${i.slice(0,t+1).join(".")}, but found ${typeof s}`);for(;n>=s.length;)s.push(null);null==s[n]&&(s[n]={}),s=s[n]}}const{key:r,index:l}=$t(i[i.length-1]);if(null!==l){for(Array.isArray(s[r])||(s[r]=[]);l>=s[r].length;)s[r].push(null);s[r][l]=n}else s[r]=n},Nt=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],Bt=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});null!=n&&""!==n&&o.push(n)}return o},zt=t=>t.join("-"),Vt=new WeakMap;let qt=0;const Gt=t=>{const{getRowId:e}=t,n=e?e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey}):void 0,o=null!=n&&""!==n?n+"":(t=>{if(t&&"object"==typeof t){const e=Vt.get(t);if(void 0!==e)return e;const n="__row_"+ ++qt;return Vt.set(t,n),n}return"__row_p_"+t})(t.row),i=[];return t.parentStableKey&&i.push(t.parentStableKey),t.groupingKey&&t.depth>0&&i.push(t.groupingKey),i.push(o),i.join("/")},Kt=t=>t.stableRowKey?t.stableRowKey:zt(t.rowId),_t=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,Ut=(t,e)=>!!e&&Nt(t[e]),Jt=(t,e,n,o,i)=>{const s=t+"",r=o.has(s)&&o.get(s)===e,l=i.has(s)&&i.get(s)===e;return n.has(e)?!l:r},Yt=(t,e)=>{if(pt(t))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||tt;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>Yt(t,e))]:0===n.length?[t]:n.flatMap(t=>Yt(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||tt;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>Yt(t,e))]:n.flatMap(t=>Yt(t,e))};function Xt(t){if(pt(t))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"auto"===e.toLowerCase()?{type:"auto"}: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 Qt(t){const e=[],n=t=>{pt(t)||(t.children&&0!==t.children.length?(t.singleRowChildren&&e.push(t),t.children.forEach(n)):e.push(t))};return t.forEach(n),e}function Zt(t,e){const n=t.map(t=>Xt(t)),o=n.reduce((t,e)=>"px"===(null==e?void 0:e.type)?t+e.value:t,0),i=n.reduce((t,e)=>"pct"===(null==e?void 0:e.type)?t+e.value:t,0),s=e*(i/100),r=n.reduce((t,e)=>"fr"===(null==e?void 0:e.type)?t+e.value:t,0),l=r>0?Math.max(0,e-o-s)/r:150,a=new Map;return t.forEach((t,o)=>{const i=n[o];if(i)if("auto"===i.type)a.set(t.accessor,Math.max(at,"number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0));else if("px"===i.type)a.set(t.accessor,i.value);else if("fr"===i.type){const e=i.value*l,n="number"==typeof t.minWidth?t.minWidth:"string"==typeof t.minWidth&&parseFloat(t.minWidth+"")||0;a.set(t.accessor,n>0?Math.max(e,n):e)}else a.set(t.accessor,"pct"===i.type?e*i.value/100:at);else a.set(t.accessor,at)}),a}function te(t,e){const n="object"==typeof e&&null!=e?e.containerWidth:void 0;let o,i="number"==typeof e?e:void 0;if(null!=n&&n>0){const e=Qt(t);o=Zt(e,n)}else{const e=Qt(t),n=e.map(t=>Xt(t));let s=i;if(null==s||0>=s){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;s=t+(e>0?150*e:0)+(n.filter(t=>"pct"===(null==t?void 0:t.type)).length>0?160:0),s=Math.max(s,800)}o=Zt(e,s)}return t.map(function t(e){const n=Object.assign({},e),i=o.get(e.accessor);return null!=i&&(n.width=i),e.children&&e.children.length>0&&(n.children=e.children.map(t)),n})}const ee=(t,e)=>{if(pt(t))return 0;if("number"==typeof t.width)return t.width;if("string"==typeof t.width&&t.width.endsWith("px"))return parseFloat(t.width);{const n=Pt(e,xt({accessor:t.accessor,rowId:"header"}));return(null==n?void 0:n.offsetWidth)||at}},ne=(t,e)=>{var n;const o=t.width;"string"==typeof o&&o.includes("fr")&&(t.width=(null===(n=Pt(e,xt({accessor:t.accessor,rowId:"header"})))||void 0===n?void 0:n.offsetWidth)||at),t.children&&t.children.length>0&&t.children.forEach(t=>{ne(t,e)})},oe=t=>"number"==typeof t.minWidth?t.minWidth:Ct,ie=(t,e)=>{const n=[];return t.forEach(t=>{pt(t)||n.push(...Yt(t,e))}),n},se=t=>t instanceof HTMLElement?t:document.body,re=t=>t.includes("\n")||t.includes("\r")?t.split(/\r\n|\r|\n/):[t],le=(t,e)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.width="auto";const o=window.getComputedStyle(e);n.style.font=o.font,n.style.fontSize=o.fontSize,n.style.fontWeight=o.fontWeight,n.style.fontFamily=o.fontFamily,n.style.letterSpacing=o.letterSpacing,n.style.padding=o.padding,document.body.appendChild(n);let i=0;for(const e of re(t))n.textContent=e,i=Math.max(i,n.offsetWidth);return document.body.removeChild(n),i},ae=(t,e,n="st-icon-container")=>{const o=document.createElement("div");o.className=n,o.style.visibility="hidden",o.style.position="absolute",o.style.top="-99999px",o.style.left="-99999px","string"==typeof t?o.innerHTML=t:o.appendChild(t.cloneNode(!0));const i=se(e);i.appendChild(o);const s=window.getComputedStyle(o),r=o.offsetWidth+(parseFloat(s.marginLeft)||0)+(parseFloat(s.marginRight)||0);return i.removeChild(o),r+4},de=(t,e)=>{var n,o,i,s,r,l,a;const{rows:d,header:c,maxWidth:u=ct,headSampleSize:h,stridedSampleSize:f,sampleSize:v,outlierPercentile:p,outlierThreshold:w,autoSizeMode:m=(null!==(n=null==c?void 0:c.autoSizeMode)&&void 0!==n?n:"content"),theme:g,styleRoot:b,sortIcon:x,expandIcon:y,onRendererHostDiscard:R}=e||{},S=null!==(o=null!=h?h:v)&&void 0!==o?o:25,C=null!=f?f:null!=v?0:75,M=null!=b?b:document,H=xt({accessor:t,rowId:"header"}),I=Pt(M,H),k=null!=I?I:At(M,".st-header-cell");if(!k)return{width:at,settled:!0};const E=window.getComputedStyle(k),T=parseFloat(E.paddingLeft)||0,A=parseFloat(E.paddingRight)||0,O=parseFloat(E.gap)||0;let P=T+A,W=!(null==c?void 0:c.headerRenderer);const F=null==I?void 0:I.querySelector(".st-header-label");let $=!1,D=!1;if(F){const t=F.querySelector(".st-header-label-text");if((null==c?void 0:c.headerRenderer)||!t){const t=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const o=t.cloneNode(!0);o.style.flex="none",o.style.width="max-content",o.style.minWidth="0",o.style.maxWidth="none",o.style.overflow="visible",o.style.height="auto";const i=window.getComputedStyle(t);o.style.font=i.font,o.style.fontSize=i.fontSize,o.style.fontWeight=i.fontWeight,o.style.fontFamily=i.fontFamily,o.style.letterSpacing=i.letterSpacing,n.appendChild(o);const s=se(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(F,M);if(1>t){if(null==c?void 0:c.headerRenderer)W=!1;else if(null==c?void 0:c.label){const t=null!==(i=At(M,".st-header-label-text"))&&void 0!==i?i:F;P+=le(c.label+"",t)}}else P+=t,W=!0,$=!!F.querySelector('.st-icon-container[aria-label^="Sort"]'),D=!!F.querySelector(".st-collapsible-header-icon")}else P+=le(null!==(s=t.textContent)&&void 0!==s?s:"",t)}else if(null==c?void 0:c.label){const t=null!==(r=At(M,".st-header-label-text"))&&void 0!==r?r:k;P+=le(c.label+"",t),W=!0}const L=I?Array.from(I.children):[];let j=1;for(let t=0;L.length>t;t++){const e=L[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&&(P+=(e.offsetWidth||0)+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0),j++,(null===(l=e.getAttribute("aria-label"))||void 0===l?void 0:l.startsWith("Sort"))&&($=!0),e.classList.contains("st-collapsible-header-icon")&&(D=!0))}(null==c?void 0:c.sortable)&&!$&&x&&(P+=ae(x,M),j++),c&>(c)&&!D&&y&&(P+=ae(y,M,"st-icon-container st-collapsible-header-icon st-expand-icon-container expanded"),j++),O>0&&j>1&&(P+=O*(j-1));let N=0,B=!(null==c?void 0:c.cellRenderer)||"header"===m;const z=c&&c.type&&dt.includes(c.type);if(d&&d.length>0&&!z&&"header"!==m){const e=document.createElement("div");e.style.visibility="hidden",e.style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.display="inline-block";let n=0,o=0;const i=At(M,".st-cell-content");if(i){const t=window.getComputedStyle(i);e.style.font=t.font,e.style.fontSize=t.fontSize,e.style.fontFamily=t.fontFamily,n=parseFloat(t.paddingLeft)||0,o=parseFloat(t.paddingRight)||0}document.body.appendChild(e);const s=[],r=t=>{let i=0;for(const n of re(t))e.textContent=n,i=Math.max(i,e.offsetWidth);return i+n+o},l=((t,e,n)=>{if(0>=t)return[];const o=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(n));if(o+i>=t)return Array.from({length:t},(t,e)=>e);const s=new Set;for(let e=0;Math.min(o,t)>e;e++)s.add(e);const r=o,l=t-r;if(i>0&&l>0){const e=Math.max(1,Math.floor(l/i));for(let n=0;i>n;n++){const o=r+n*e;if(o>=t)break;s.add(o)}s.add(t-1)}return Array.from(s).sort((t,e)=>t-e)})(d.length,S,C);let u=!1,h=!1;for(const i of l){const l=d[i];let f;f=(null==c?void 0:c.valueGetter)?c.valueGetter({accessor:t,row:l,rowIndex:i}):Dt(l,t);let v=f;(null==c?void 0:c.valueFormatter)&&null!=f&&(v=c.valueFormatter({accessor:t,colIndex:0,row:l,rowIndex:i,value:f}));let p=-1;if((null==c?void 0:c.cellRenderer)&&!u)try{const s=c.cellRenderer({accessor:t,colIndex:0,row:l,rowIndex:i,theme:g,value:f,formattedValue:v});if("string"==typeof s||"number"==typeof s)p=r(s+""),p>0&&(h=!0);else if(s instanceof Node)if(s instanceof HTMLElement&&(s.hasAttribute("data-st-portal-id")||s.hasAttribute("data-st-mount-id")||(null===(a=s.querySelector)||void 0===a?void 0:a.call(s,"[data-st-portal-id], [data-st-mount-id]"))))s instanceof HTMLElement&&(null==R||R(s)),u=!0,p=-1;else{e.textContent="",e.appendChild(s);const t=e.offsetWidth+n+o;s instanceof HTMLElement&&(null==R||R(s)),e.textContent="",p=t>n+o?t:-1,h=!0}}catch(t){p=-1}0>p&&!(null==c?void 0:c.cellRenderer)&&(p=r(null!=v?v+"":"")),0>p||s.push(p)}document.body.removeChild(e),(null==c?void 0:c.cellRenderer)&&(Tt(M,`.st-cell[data-accessor="${Wt(t+"")}"] .st-cell-content`).forEach(t=>{const e=t;if(e.querySelector(".st-loading-skeleton"))return;const i=((t,e)=>{const n=document.createElement("div");n.style.visibility="hidden",n.style.position="absolute",n.style.top="-99999px",n.style.left="-99999px",n.style.whiteSpace="nowrap",n.style.width="max-content";const o=t.cloneNode(!0);o.style.flex="none",o.style.width="max-content",o.style.minWidth="0",o.style.maxWidth="none",o.style.overflow="visible",o.style.padding="0";const i=window.getComputedStyle(t);o.style.font=i.font,o.style.fontSize=i.fontSize,o.style.fontFamily=i.fontFamily,o.style.letterSpacing=i.letterSpacing,n.appendChild(o);const s=se(e);s.appendChild(n);const r=n.offsetWidth;return s.removeChild(n),r})(e,M);i>0&&(s.push(i+n+o),h=!0)}),B=h),N=((t,e)=>{var n,o,i;if(0===t.length)return 0;const s=Math.max(...t),r=null!==(n=null==e?void 0:e.percentile)&&void 0!==n?n:95,l=null!==(o=null==e?void 0:e.threshold)&&void 0!==o?o:.5;if((null!==(i=null==e?void 0:e.minSampleForClip)&&void 0!==i?i:20)>t.length)return s;const a=((t,e)=>{if(0===t.length)return 0;if(1===t.length)return t[0];const n=[...t].sort((t,e)=>t-e),o=Math.min(100,Math.max(0,e))/100*(n.length-1),i=Math.floor(o),s=Math.ceil(o);return i===s?n[i]:n[i]+(n[s]-n[i])*(o-i)})(t,r);return a>0&&s>a*(1+l)?a:s})(s,{percentile:p,threshold:w})}let V="header"===m?P:Math.max(P,N);z&&(V=Math.max(V,150));const q="number"==typeof(null==c?void 0:c.maxWidth)?c.maxWidth:"string"==typeof(null==c?void 0:c.maxWidth)&&parseFloat(c.maxWidth+"")||void 0,G=null!=q?q:u;return V>G&&(V=G),{width:Math.max(V+2,"number"==typeof(null==c?void 0:c.minWidth)?c.minWidth:"string"==typeof(null==c?void 0:c.minWidth)&&parseFloat(c.minWidth+"")||Ct,Ct),settled:W&&B}};class ce{constructor(){this.autoSizeAccessors=new Set,this.pendingAutoSize=new Set,this.naturalWidths=new Map,this.isAutoSizing=!1}getAccessors(){return this.autoSizeAccessors}getNaturalWidths(){return this.naturalWidths}hasPending(){return this.pendingAutoSize.size>0}recomputeAccessors(t,e){this.autoSizeAccessors=ve(t,e),this.pendingAutoSize=new Set(this.autoSizeAccessors)}queuePendingFromAccessors(){this.autoSizeAccessors.forEach(t=>this.pendingAutoSize.add(t))}clearNaturalWidths(){this.naturalWidths.clear()}recordNaturalWidths(t){t.forEach((t,e)=>this.naturalWidths.set(e,t))}getShrinkFloors(t,e,n){var o;const i=new Map,s=t=>{if(t.children&&t.children.length>0&&t.children.forEach(s),"number"==typeof t.width)i.set(t.accessor+"",t.width);else if("string"==typeof t.width&&t.width.trim().endsWith("px")){const e=parseFloat(t.width);Number.isFinite(e)&&i.set(t.accessor+"",e)}};n.forEach(s);const r=new Map,l=ie(t,e);for(const t of l){const e=t.accessor+"",n=null!==(o=this.naturalWidths.get(e))&&void 0!==o?o:i.get(e);r.set(e,Math.max(null!=n?n:0,oe(t)))}return r}maybeMeasure(t){if(this.isAutoSizing||0===this.pendingAutoSize.size)return null;const{styleRoot:e}=t;if(!(e instanceof HTMLElement&&e.querySelector(".st-header-cell")))return null;this.isAutoSizing=!0;try{const n=ie(t.headers,t.collapsedHeaders),o=new Map(n.map(t=>[t.accessor,t])),i=new Map;for(const n of this.pendingAutoSize){const s=o.get(n);if(!s)continue;const{width:r}=de(n,{rows:t.rows,header:s,styleRoot:e,theme:t.theme,autoSizeMode:s.autoSizeMode,sortIcon:t.icons.sortUp,expandIcon:t.icons.expand,onRendererHostDiscard:t.onRendererHostDiscard});i.set(n,r)}if(this.pendingAutoSize.clear(),0===i.size)return null;let s=!1;for(const[t,e]of i){const n=o.get(t);if(("number"==typeof(null==n?void 0:n.width)?n.width:this.naturalWidths.get(t+""))!==e){s=!0;break}}return s?pe(t.headers,i,this.naturalWidths):null}finally{this.isAutoSizing=!1}}}const ue=t=>{var e,n,o,i,s,r,l,a;const d=null!==(r=null!==(i=null!==(n=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current)&&void 0!==n?n:null===(o=t.mainHeaderRef)||void 0===o?void 0:o.current)&&void 0!==i?i:null===(s=t.pinnedLeftHeaderRef)||void 0===s?void 0:s.current)&&void 0!==r?r:null===(l=t.pinnedRightHeaderRef)||void 0===l?void 0:l.current;return d?null!==(a=d.closest(".simple-table-root"))&&void 0!==a?a:d:null},he=t=>{if(t.enablePagination&&!t.serverSidePagination&&t.currentTableRows){const e=t.currentTableRows.filter(t=>t.row&&!t.stateIndicator&&!t.isLoadingSkeleton&&!t.nestedTable).map(t=>t.row);if(e.length>0)return e}return t.localRows},fe=t=>!t.isSelectionColumn&&(t=>"string"==typeof t.width&&"auto"===t.width.trim().toLowerCase())(t),ve=(t,e)=>{const n=new Set,o=ie(t,e);for(const t of o)fe(t)&&n.add(t.accessor);return n},pe=(t,e,n)=>{const o=t=>{const n=Object.assign({},t);return e.has(t.accessor)&&(n.width=e.get(t.accessor)),t.children&&t.children.length>0&&(n.children=t.children.map(o)),n},i=t.map(o);return e.forEach((t,e)=>n.set(e+"",t)),i},we=t=>{if(!t)return null;if("undefined"!=typeof Window&&t instanceof Window){const e=t.innerHeight;return{top:0,bottom:e,height:e,width:t.innerWidth}}const e=t.getBoundingClientRect();return{top:e.top,bottom:e.bottom,height:e.height,width:e.width}},me=()=>"undefined"!=typeof window&&window.innerHeight>0?window.innerHeight:1/0,ge=(t,e)=>{if(!t||!e)return null;const n=we(t);if(!n)return null;const o=e.getBoundingClientRect(),i=o.height;if(0>=i)return{relativeScrollTop:0,visibleViewportHeight:0,distanceFromTableBottom:1/0,tableTotalHeight:0,viewportWidth:n.width};const s=Math.max(n.top,o.top),r=Math.min(Math.max(0,Math.min(n.bottom,o.bottom)-s),me());return{relativeScrollTop:Math.max(0,Math.min(n.top-o.top,Math.max(0,i-r))),visibleViewportHeight:r,distanceFromTableBottom:o.bottom-n.bottom,tableTotalHeight:i,viewportWidth:n.width}};class be{constructor(t){this.resolvedScrollParent=null,this.externalScrollListener=null,this.externalWindowResizeListener=null,this.externalParentResizeObserver=null,this.externalViewportHeight=0,this.externalScrollRetryRaf=null,this.externalScrollRetryCount=0,this.bodyScrollListenerAttached=!1,this.bodyContainerScrollListener=null,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="",this.host=t}getResolvedParent(){return this.resolvedScrollParent}getViewportHeight(){return this.externalViewportHeight}setViewportHeight(t){var e;t!==this.externalViewportHeight&&(this.externalViewportHeight=t,null===(e=this.host.getDimensionManager())||void 0===e||e.updateConfig({externalViewportHeight:t}))}sync(){var t;const e=this.host.getBodyContainer();if(!e)return;const n=this.host.getHeight(),o=this.host.getMaxHeight(),i=null==n||""===n,s=null==o||""===o,r=this.host.getScrollParent(),l=null!=r&&i&&s,a=l?(t=>{if(null==t)return null;if("function"==typeof t)try{const e=t();return null!=e?e:null}catch(t){return null}return"window"===t?"undefined"!=typeof window?window:null:"undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"function"==typeof t.addEventListener?t:null})(r):null;if(a!==this.resolvedScrollParent&&this.detachExternalWiring(),a)this.externalScrollRetryCount=0,this.attachExternalWiring(a),this.ensureBodyScrollListenerDetached(e),this.recomputeViewportHeight();else if(l){this.ensureBodyScrollListenerDetached(e);const t="undefined"!=typeof window?window.innerHeight:0;t>0&&this.externalViewportHeight!==t&&this.setViewportHeight(t),this.scheduleParentRetry()}else this.externalScrollRetryCount=0,this.ensureBodyScrollListenerAttached(e),0!==this.externalViewportHeight&&(this.externalViewportHeight=0,null===(t=this.host.getDimensionManager())||void 0===t||t.updateConfig({externalViewportHeight:void 0}))}recomputeViewportHeight(){var t;if(!this.resolvedScrollParent)return;const e=null!==(t=this.host.getRootElement())&&void 0!==t?t:this.host.getFallbackRoot(),n=ge(this.resolvedScrollParent,e);if(!n)return;let o=n.visibleViewportHeight;o>0||(o=(()=>{const t=we(this.resolvedScrollParent);return t?Math.min(t.height,me()):0})()),o>0&&o!==this.externalViewportHeight&&this.setViewportHeight(o)}getVerticalScrollMetrics(){var t;if(!this.resolvedScrollParent)return null;const e=null!==(t=this.host.getRootElement())&&void 0!==t?t:this.host.getFallbackRoot(),n=ge(this.resolvedScrollParent,e);return n&&n.visibleViewportHeight>0&&n.tableTotalHeight>0?{clientHeight:n.visibleViewportHeight,scrollHeight:n.tableTotalHeight,scrollTop:n.relativeScrollTop}:null}destroy(){null!==this.externalScrollRetryRaf&&(cancelAnimationFrame(this.externalScrollRetryRaf),this.externalScrollRetryRaf=null),this.detachExternalWiring();const t=this.host.getBodyContainer();t&&this.ensureBodyScrollListenerDetached(t)}scheduleParentRetry(){null===this.externalScrollRetryRaf&&60>this.externalScrollRetryCount&&"undefined"!=typeof requestAnimationFrame&&(this.externalScrollRetryRaf=requestAnimationFrame(()=>{this.externalScrollRetryRaf=null,this.host.isMounted()&&(this.externalScrollRetryCount++,this.sync())}))}ensureBodyScrollListenerAttached(t){this.bodyScrollListenerAttached||(this.bodyContainerScrollListener=t=>this.host.onInternalScroll(t),t.addEventListener("scroll",this.bodyContainerScrollListener),this.bodyScrollListenerAttached=!0)}ensureBodyScrollListenerDetached(t){this.bodyScrollListenerAttached&&(this.bodyContainerScrollListener&&(t.removeEventListener("scroll",this.bodyContainerScrollListener),this.bodyContainerScrollListener=null),this.bodyScrollListenerAttached=!1)}attachExternalWiring(t){if(!t)return;this.resolvedScrollParent=t;const e=t=>this.handleExternalScroll(t);if(this.externalScrollListener=e,t.addEventListener("scroll",e,{passive:!0}),"undefined"!=typeof Window&&t instanceof Window){const e=()=>this.handleExternalResize();this.externalWindowResizeListener=e,t.addEventListener("resize",e,{passive:!0})}else if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>this.handleExternalResize());e.observe(t),this.externalParentResizeObserver=e}this.recomputePaddingTop(),this.applyOverscrollContainment(t)}detachExternalWiring(){const t=this.resolvedScrollParent;t&&this.externalScrollListener&&t.removeEventListener("scroll",this.externalScrollListener),this.externalScrollListener=null,t&&this.externalWindowResizeListener&&"undefined"!=typeof Window&&t instanceof Window&&t.removeEventListener("resize",this.externalWindowResizeListener),this.externalWindowResizeListener=null,this.externalParentResizeObserver&&(this.externalParentResizeObserver.disconnect(),this.externalParentResizeObserver=null),this.resolvedScrollParent=null;const e=this.host.getRootElement();e&&e.style.removeProperty("--st-external-scroll-padding-top"),this.restoreOverscrollBehavior()}applyOverscrollContainment(t){const e="undefined"!=typeof Window&&t instanceof Window?"undefined"!=typeof document?document.documentElement:null:t;e&&(this.overscrollBehaviorTarget=e,this.overscrollBehaviorPrev=e.style.overscrollBehaviorY,e.style.overscrollBehaviorY="none")}restoreOverscrollBehavior(){this.overscrollBehaviorTarget&&(this.overscrollBehaviorTarget.style.overscrollBehaviorY=this.overscrollBehaviorPrev,this.overscrollBehaviorTarget=null,this.overscrollBehaviorPrev="")}recomputePaddingTop(){const t=this.host.getRootElement();if(!t)return;const e=this.resolvedScrollParent;let n=0;if(e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement){const t=getComputedStyle(e);n=parseFloat(t.paddingTop)||0}t.style.setProperty("--st-external-scroll-padding-top",n+"px")}handleExternalResize(){this.recomputeViewportHeight(),this.recomputePaddingTop(),this.host.onExternalResize()}handleExternalScroll(t){var e;const n=this.resolvedScrollParent;if(!n)return;const o=null!==(e=this.host.getRootElement())&&void 0!==e?e:this.host.getFallbackRoot(),i=ge(n,o);i&&this.host.onExternalScroll(i)}}class xe{constructor(t){this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isScrolling=!1,this.scrollTop=0,this.scrollDirection="none",this.host=t}schedule(t){this.isScrolling=!0,null!==this.scrollEndTimeoutId&&clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=window.setTimeout(()=>{this.isScrolling=!1,this.scrollEndTimeoutId=null,requestAnimationFrame(()=>{this.host.onRender("scroll-end")})},150),null!==this.scrollRafId&&cancelAnimationFrame(this.scrollRafId),this.scrollRafId=requestAnimationFrame(()=>{var e;const n=t.scrollTop>this.lastScrollTop?"down":this.lastScrollTop>t.scrollTop?"up":"none";this.scrollTop=t.scrollTop,this.scrollDirection=n,this.lastScrollTop=t.scrollTop,null===(e=t.afterApply)||void 0===e||e.call(t);const o=this.host.getScrollManager();o&&(this.host.shouldTrackInfiniteScroll()?o.handleScroll(t.scrollTop,t.scrollLeft,t.containerHeight,t.contentHeight):o.handleScroll(t.scrollTop,t.scrollLeft,0,0)),this.host.onRender("scroll-raf"),this.scrollRafId=null})}destroy(){null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),this.isScrolling=!1}}const ye="__pivotIsTotal",Re="__pivot:",Se="(blank)",Ce=(t,e)=>{if(0===t.length)return;if("custom"===e.type&&e.customFn)return e.customFn(t);const n=e.parseValue?t.map(e.parseValue).filter(t=>!isNaN(t)):t.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===n.length)return"count"===e.type?t.length:void 0;let o;switch(e.type){case"sum":o=n.reduce((t,e)=>t+e,0);break;case"average":o=n.reduce((t,e)=>t+e,0)/n.length;break;case"count":o=t.length;break;case"min":o=Math.min(...n);break;case"max":o=Math.max(...n);break;default:return}return e.formatResult?e.formatResult(o):o},Me="",He="__total__",Ie=t=>null==t?Se:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:t+"",ke=t=>t+"",Ee=t=>t.map(ke).join(Me),Te=t=>""===t?[]:t.split(Me),Ae=(t,e)=>t===Se&&e!==Se?1:e===Se&&t!==Se?-1:t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}),Oe=(t,e)=>t.get(e+""),Pe=(t,e)=>`${Re}${t}${Me}${e+""}`,We=t=>Pe(He,t),Fe=(t,e,n)=>`${t}${Me}${e}${Me}${n}`,$e=({accessor:t,label:e,field:n,alignRight:o})=>{var i,s,r,l;return{accessor:t,label:e,width:null!==(i=null==n?void 0:n.width)&&void 0!==i?i:100,type:null!==(s=null==n?void 0:n.type)&&void 0!==s?s:"number",align:o?"right":null!==(r=null==n?void 0:n.align)&&void 0!==r?r:"right",sortable:null===(l=null==n?void 0:n.sortable)||void 0===l||l,filterable:!1,editable:!1,valueFormatter:null==n?void 0:n.valueFormatter,valueGetter:null==n?void 0:n.valueGetter,minWidth:null==n?void 0:n.minWidth,maxWidth:null==n?void 0:n.maxWidth}},De=(t,e,n,o,i)=>{const s=`${Me}${n}${Me}${o}`,r=[];if(i){const n=t.get(`${e}${s}`);return n&&r.push(...n),r}for(const[n,o]of t){if(!n.endsWith(s))continue;const t=n.slice(0,n.length-s.length);(""===e||t===e||t.startsWith(e+Me))&&r.push(...o)}return r},Le=({row:t,buckets:e,rowKeyPrefix:n,colKeys:o,values:i,showRowTotals:s,exactRowKey:r})=>{for(const s of o)i.forEach((o,i)=>{const l=De(e,n,s,i,r),a=Ce(l,o.aggregation);void 0!==a&&(t[Pe(s,o.accessor)]=a)});s&&i.forEach((i,s)=>{const l=[];for(const t of o)l.push(...De(e,n,t,s,r));0===o.length&&l.push(...De(e,n,"",s,r));const a=Ce(l,i.aggregation);void 0!==a&&(t[We(i.accessor)]=a)})},je=({rows:t,pivot:e,fieldHeaders:n})=>{var o,i;if(!e.values||0===e.values.length)throw Error("pivot.values must contain at least one measure");const s=null!==(o=e.rows)&&void 0!==o?o:[],r=null!==(i=e.columns)&&void 0!==i?i:[],l=e.values,a=!1!==e.showRowTotals,d=!1!==e.showColumnTotals,c=!1!==e.showGrandTotal,u=new Map;for(const t of ft(n))u.set(t.accessor+"",t);const h=new Map,f=new Set,v=new Set;for(const e of t){const t=s.map(t=>Ie(Dt(e,t))),n=r.map(t=>Ie(Dt(e,t))),o=Ee(t),i=Ee(n);f.add(o),v.add(i),l.forEach((t,n)=>{const s=Dt(e,t.accessor);if(null==s)return;const r=Fe(o,i,n);let l=h.get(r);l||(l=[],h.set(r,l)),l.push(s)})}const p=Array.from(f).sort((t,e)=>{var n,o;const i=Te(t),s=Te(e),r=Math.max(i.length,s.length);for(let t=0;r>t;t++){const e=Ae(null!==(n=i[t])&&void 0!==n?n:"",null!==(o=s[t])&&void 0!==o?o:"");if(0!==e)return e}return 0}),w=Array.from(v).sort((t,e)=>{var n,o;const i=Te(t),s=Te(e),r=Math.max(i.length,s.length);for(let t=0;r>t;t++){const e=Ae(null!==(n=i[t])&&void 0!==n?n:"",null!==(o=s[t])&&void 0!==o?o:"");if(0!==e)return e}return 0}),m=0===r.length?[""]:w,g=a&&r.length>0,b=(({colKeys:t,values:e,catalog:n,showRowTotals:o})=>{var i,s;const r=e.length>1,l=[],a={label:"",children:new Map};for(const e of t){const t=Te(e);if(0===t.length)continue;let n=a;for(const e of t){let t=n.children.get(e);t||(t={label:e,children:new Map},n.children.set(e,t)),n=t}n.colKey=e}const d=(t,o)=>Array.from(t.children.entries()).sort(([t],[e])=>Ae(t,e)).map(([t,i])=>{const s=o?`${o}${Me}${t}`:t;if(void 0!==i.colKey&&0===i.children.size){if(!r){const o=e[0],s=Oe(n,o.accessor);return $e({accessor:Pe(i.colKey,o.accessor),label:t,field:s,alignRight:!0})}return{accessor:"__pivotGroup:"+i.colKey,label:t,width:100,children:e.map(t=>{var e,o;const s=Oe(n,t.accessor);return $e({accessor:Pe(i.colKey,t.accessor),label:null!==(o=null!==(e=t.label)&&void 0!==e?e:null==s?void 0:s.label)&&void 0!==o?o:t.accessor+"",field:s,alignRight:!0})})}}return{accessor:"__pivotGroup:"+s,label:t,width:100,children:d(i,s)}});if(0===t.length||1===t.length&&""===t[0])for(const t of e){const e=Oe(n,t.accessor);l.push($e({accessor:Pe("",t.accessor),label:null!==(s=null!==(i=t.label)&&void 0!==i?i:null==e?void 0:e.label)&&void 0!==s?s:t.accessor+"",field:e,alignRight:!0}))}else l.push(...d(a,""));if(o)if(r)l.push({accessor:"__pivotGroup:"+He,label:"Total",width:100,children:e.map(t=>{var e,o;const i=Oe(n,t.accessor);return $e({accessor:We(t.accessor),label:null!==(o=null!==(e=t.label)&&void 0!==e?e:null==i?void 0:i.label)&&void 0!==o?o:t.accessor+"",field:i,alignRight:!0})})});else{const t=e[0],o=Oe(n,t.accessor);l.push($e({accessor:We(t.accessor),label:"Total",field:o,alignRight:!0}))}return l})({colKeys:0===r.length?[]:w,values:l,catalog:u,showRowTotals:g}),x=((t,e)=>t.map(t=>{var n,o,i,s,r;const l=Oe(e,t);return{accessor:t,label:null!==(n=null==l?void 0:l.label)&&void 0!==n?n:t+"",width:null!==(o=null==l?void 0:l.width)&&void 0!==o?o:140,type:null!==(i=null==l?void 0:l.type)&&void 0!==i?i:"string",align:null!==(s=null==l?void 0:l.align)&&void 0!==s?s:"left",pinned:"left",sortable:null===(r=null==l?void 0:l.sortable)||void 0===r||r,filterable:null==l?void 0:l.filterable,expandable:!1,valueFormatter:null==l?void 0:l.valueFormatter,valueGetter:null==l?void 0:l.valueGetter,minWidth:null==l?void 0:l.minWidth,maxWidth:null==l?void 0:l.maxWidth}}))(s,u),y=[...x,...b];let R;if(0===s.length){const t={};Le({row:t,buckets:h,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[t]}else R=(({rowDims:t,distinctRowKeys:e,buckets:n,colKeys:o,values:i,showRowTotals:s})=>e.map(e=>{const r=Te(e),l={};return t.forEach((t,e)=>{var n;l[t]=null!==(n=r[e])&&void 0!==n?n:Se}),Le({row:l,buckets:n,rowKeyPrefix:e,colKeys:o,values:i,showRowTotals:s,exactRowKey:!0}),l}))({rowDims:s,distinctRowKeys:p,buckets:h,colKeys:m,values:l,showRowTotals:g});if(d&&s.length>0){const t={[ye]:!0};t[s[0]]="Total",Le({row:t,buckets:h,rowKeyPrefix:"",colKeys:m,values:l,showRowTotals:g&&c,exactRowKey:!1}),R=[...R,t]}return{rows:R,headers:y}};class Ne{constructor(t){this.subscribers=new Set,this.cacheKey="",this.config=t,this.state=this.computeState(t),this.cacheKey=this.buildCacheKey(t)}buildCacheKey(t){return`${e=t.pivot,e?JSON.stringify({rows:e.rows,columns:e.columns,values:e.values.map(t=>({accessor:t.accessor,label:t.label,type:t.aggregation.type})),showRowTotals:!1!==e.showRowTotals,showColumnTotals:!1!==e.showColumnTotals,showGrandTotal:!1!==e.showGrandTotal}):""}|rows:${t.sourceRows.length}|hdr:${t.fieldHeaders.length}`;var e}computeState(t){var e;const n=null!==(e=t.pivot)&&void 0!==e?e:null;if(!n||!n.values||0===n.values.length)return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,pivot:null};let o;try{o=je({rows:t.sourceRows,pivot:n,fieldHeaders:t.fieldHeaders})}catch(e){return{active:!1,pivotedRows:t.sourceRows,headers:t.fieldHeaders,pivot:null}}return{active:!0,pivotedRows:o.rows,headers:o.headers,pivot:n}}getState(){return this.state}isActive(){return this.state.active}getPivot(){return this.state.pivot}updateConfig(t){const e=Object.assign(Object.assign({},this.config),t),n=this.buildCacheKey(e),o=void 0!==t.sourceRows&&t.sourceRows!==this.config.sourceRows,i=void 0!==t.fieldHeaders&&t.fieldHeaders!==this.config.fieldHeaders,s=void 0!==t.pivot&&t.pivot!==this.config.pivot;this.config=e,(o||i||s||n!==this.cacheKey)&&(this.cacheKey=n,this.state=this.computeState(this.config),this.notifySubscribers())}setPivot(t){this.updateConfig({pivot:t})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}destroy(){this.subscribers.clear()}}const Be=(t,e,n)=>{var o;const i=document.createElement("div");i.className="st-dropdown-content",i.style.position=n.positioning||"fixed",i.style.zIndex="1000",i.style.visibility="hidden",i.style.overflow=null!==(o=n.overflow)&&void 0!==o?o:"auto",n.width&&(i.style.width=n.width+"px"),n.maxHeight&&(i.style.maxHeight=n.maxHeight+"px"),i.appendChild(e);const s=t.closest(".simple-table-root");"fixed"===n.positioning?(null!=s?s:document.body).appendChild(i):t.appendChild(i),requestAnimationFrame(()=>{const{position:e,placement:o}=((t,e,n)=>{const o=t.getBoundingClientRect(),i=window.innerHeight,s=window.innerWidth,r=i-o.bottom,l=s-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=i-o.top+4,"left"===d?c.left=o.left:c.right=s-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,i,n);i.className="st-dropdown-content st-dropdown-"+o,Object.entries(e).forEach(([t,e])=>{void 0!==e&&(i.style[t]=e+"px")}),i.style.visibility="visible"});const r=e=>{const n=e.target;i.contains(n)||t.contains(n)||c()},l=t=>{"Escape"===t.key&&(t.preventDefault(),c())},a=t=>{i.contains(t.target)||c()},c=()=>{i.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),d(i,"mousedown",t=>{t.stopPropagation()}),i},ze=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)},Ve=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),qe=t=>{if(!t)return new Date;if("string"==typeof t)return ze(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:Ve(e)}return t instanceof Date?Ve(t):new Date},Ge=({className:t,width:e=20,height:n=20,paths:o,circles:i=[],strokeWidth:s=2})=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true"),r.setAttribute("role","img"),r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("width",e+""),r.setAttribute("height",n+""),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width",s+""),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),t&&r.setAttribute("class",t);for(const t of o){const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d",t),e.setAttribute("fill","none"),r.appendChild(e)}for(const{cx:t,cy:e,r:n}of i){const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t+""),o.setAttribute("cy",e+""),o.setAttribute("r",n+""),o.setAttribute("fill","currentColor"),o.setAttribute("stroke","none"),r.appendChild(o)}return r},Ke=t=>Ge({className:t,paths:["m15 18-6-6 6-6"]}),_e=t=>Ge({className:t,paths:["m9 18 6-6-6-6"]}),Ue=t=>Ge({className:t,paths:["m5 12 7-7 7 7","M12 19V5"]}),Je=t=>Ge({className:t,paths:["M12 5v14","m19 12-7 7-7-7"]}),Ye=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","16"),e.setAttribute("height","10"),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},Xe=(t,e)=>new Date(t,e+1,0).getDate(),Qe=["January","February","March","April","May","June","July","August","September","October","November","December"],Ze=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tn=["Su","Mo","Tu","We","Th","Fr","Sa"],en=(t,e,n,o)=>{const{header:i,row:s}=t,r=Dt(s,i.accessor);return"boolean"===i.type?((t,e,n,o,i)=>{const{header:s,row:r,rowIndex:l}=t;let a;const c=document.createElement("div");c.className="st-dropdown-item "+(!0===n?"selected":""),c.textContent="True",c.setAttribute("role","option"),c.setAttribute("aria-selected",(!0===n)+""),c.setAttribute("aria-disabled","false");const u=document.createElement("div");u.className="st-dropdown-item "+(!1===n?"selected":""),u.textContent="False",u.setAttribute("role","option"),u.setAttribute("aria-selected",(!1===n)+""),u.setAttribute("aria-disabled","false");const h=t=>{jt(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),a.remove(),o()};d(c,"click",()=>h(!0)),d(u,"click",()=>h(!1));const f=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===c?u.focus():c.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===c?h(!0):document.activeElement===u&&h(!1))};c.setAttribute("tabindex","0"),u.setAttribute("tabindex","0"),d(c,"keydown",f),d(u,"keydown",f);const v=document.createDocumentFragment();return v.appendChild(c),v.appendChild(u),a=Be(null!=i?i:document.body,v,{width:120,positioning:"fixed",onClose:o}),a})(t,e,!!r,n,o):"enum"===i.type?((t,e,n,o,i)=>{const{header:s,row:r,rowIndex:l}=t,a=s.enumOptions||[];let c;const u=t=>{jt(r,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:r,rowIndex:l}),c.remove(),o()},h=[];a.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,d(o,"click",()=>u(t.value)),h.push(o)});const f=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&&u(t)}};h.forEach(t=>{d(t,"keydown",f)});const v=document.createElement("div");return v.className="st-enum-dropdown-content",h.forEach(t=>v.appendChild(t)),c=Be(null!=i?i:document.body,v,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=a.findIndex(t=>t.value===n);t>=0&&h[t]?(h[t].focus(),h[t].scrollIntoView({block:"nearest"})):h.length>0&&h[0].focus()},0),c})(t,e,(r||"")+"",n,o):"date"===i.type?((t,e,n,o,i)=>{var s,r;const{header:l,row:a,rowIndex:c}=t;let u,h;try{h=n?ze(n+""):new Date}catch(t){h=new Date}let f=h.getFullYear(),v=h.getMonth(),p="days";const w=document.createElement("div");w.className="st-datepicker";const m=null!==(s=e.icons.prev)&&void 0!==s?s:Ke("st-next-prev-icon"),g=null!==(r=e.icons.next)&&void 0!==r?r:_e("st-next-prev-icon"),b=(t,e)=>{"string"==typeof e?t.innerHTML=e:t.appendChild(e.cloneNode(!0))},x=t=>{const n=t.toISOString().split("T")[0];jt(a,l.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:l.accessor,newValue:n,row:a,rowIndex:c}),u.remove(),o()},y=()=>{w.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===p){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.setAttribute("aria-label","Previous month"),b(e,m),d(e,"click",()=>{v--,0>v&&(v=11,f--),y()});const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${Qe[v]} ${f}`;const o=()=>{p="months",y()};d(n,"click",o),d(n,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())});const i=document.createElement("button");i.className="st-datepicker-nav-btn",i.setAttribute("aria-label","Next month"),b(i,g),d(i,"click",()=>{v++,v>11&&(v=0,f++),y()}),t.appendChild(e),t.appendChild(n),t.appendChild(i)}else if("months"===p){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=f+"";const n=()=>{p="years",y()};d(e,"click",n),d(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n())}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}w.appendChild(t);const e=document.createElement("div");if(e.className=`st-datepicker-grid st-datepicker-${p}-grid`,"days"===p){tn.forEach(t=>{const n=document.createElement("div");n.className="st-datepicker-weekday",n.textContent=t,e.appendChild(n)});const t=Xe(f,v),n=new Date(f,v,1).getDay(),o=Xe(f,v-1),i=new Date;for(let t=0;n>t;t++){const i=o-n+t+1,s=new Date(f,v-1,i),r=document.createElement("div");r.className="st-datepicker-day other-month",r.textContent=i+"",r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",`${Qe[s.getMonth()]} ${i}, ${s.getFullYear()}`),d(r,"click",()=>x(s)),d(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(s))}),e.appendChild(r)}const s=h.getFullYear()===f&&h.getMonth()===v;for(let n=1;t>=n;n++){const t=document.createElement("div");t.className="st-datepicker-day",t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",`${Qe[v]} ${n}, ${f}`),i.getFullYear()===f&&i.getMonth()===v&&i.getDate()===n&&t.classList.add("today"),s&&h.getDate()===n&&t.classList.add("selected");const o=new Date(f,v,n);d(t,"click",()=>x(o)),d(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(o))}),e.appendChild(t)}const r=n+t,l=Math.max(35,7*Math.ceil(r/7))-r;for(let t=1;l>=t;t++){const n=new Date(f,v+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",`${Qe[n.getMonth()]} ${t}, ${n.getFullYear()}`),d(o,"click",()=>x(n)),d(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x(n))}),e.appendChild(o)}}else if("months"===p)Ze.forEach((t,n)=>{const o=document.createElement("div");o.className="st-datepicker-month"+(n===v?" selected":""),o.textContent=t,o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",Qe[n]);const i=()=>{v=n,p="days",y()};d(o,"click",i),d(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())}),e.appendChild(o)});else{const t=f-6;for(let n=t;t+12>n;n++){const t=document.createElement("div");t.className="st-datepicker-year"+(n===f?" selected":""),t.textContent=n+"",t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label",n+"");const o=()=>{f=n,p="months",y()};d(t,"click",o),d(t,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),e.appendChild(t)}}w.appendChild(e);const n=document.createElement("div");n.className="st-datepicker-footer";const o=document.createElement("button");o.className="st-datepicker-today-btn",o.textContent="Today",d(o,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);x(e)}),n.appendChild(o),w.appendChild(n)};return y(),u=Be(null!=i?i:document.body,w,{width:280,overflow:"hidden",positioning:"fixed",onClose:o}),u})(t,e,r,n,o):((t,e,n,o)=>{const{header:i,row:s,rowIndex:r}=t,l=document.createElement("input");l.className="editable-cell-input","number"===i.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"===i.type){const t=()=>{const t=l.value;/^-?\d*\.?\d*$/.test(t)||(l.value=t.slice(0,-1))};d(l,"input",t)}return d(l,"blur",t=>{if(!a)return void o();let n=l.value;if("number"===i.type){const t=parseFloat(l.value);n=isNaN(t)?0:t}jt(s,i.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:n,row:s,rowIndex:r}),o()}),d(l,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(a=!0,l.blur()):"Escape"===e.key&&(a=!1,l.blur())}),d(l,"mousedown",t=>{t.stopPropagation()}),l})(t,e,r,n)};let nn=0;const on=(t,e,n,o)=>{t.checked=n,t.indeterminate=o,t.setAttribute("aria-checked",o?"mixed":n+""),e.className="st-checkbox-custom "+(o?"st-indeterminate":n?"st-checked":""),e.setAttribute("aria-hidden","true"),e.innerHTML="",o?e.appendChild(Ge({className:"st-checkbox-minus",width:12,height:12,strokeWidth:2.5,paths:["M5 12h14"]})):n&&e.appendChild(Ge({className:"st-checkbox-checkmark",width:12,height:12,strokeWidth:2.5,paths:["M20 6 9 17l-5-5"]}))},sn=(t,e,n=!1)=>{const o=t.querySelector(".st-checkbox-input"),i=t.querySelector(".st-checkbox-custom");o&&i&&(o.checked===e&&o.indeterminate===n&&o.getAttribute("aria-checked")===(n?"mixed":e+"")||on(o,i,e,n))},rn=({checked:t,indeterminate:e=!1,onChange:n,ariaLabel:o})=>{const i=document.createElement("label");i.className="st-checkbox-label";const s=document.createElement("input");s.type="checkbox",s.className="st-checkbox-input",o&&s.setAttribute("aria-label",o);const r=document.createElement("span");on(s,r,t,e);const l=()=>{on(s,r,s.checked,!1),n(s.checked)};return s.addEventListener("change",l),s.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),i.addEventListener("mousedown",t=>{t.stopPropagation()}),i.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),i.appendChild(s),i.appendChild(r),{element:i,update:(t,e=!1)=>{s.checked===t&&s.indeterminate===e||on(s,r,t,e)},destroy:()=>{s.removeEventListener("change",l)}}},ln=new WeakMap,an=new WeakMap,dn=new WeakSet,cn=(t,e,n)=>{const o=t.querySelector(".st-expand-icon-container");if(!(o&&o instanceof HTMLElement))return;if(o.classList.contains("placeholder"))return;const i=o.classList.contains("expanded");an.set(o,{desired:e,options:n}),dn.has(o)||(i!==e?(dn.add(o),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var t,e,n,i;dn.delete(o);const s=an.get(o);if(an.delete(o),!s)return;const r=s.desired;if(o.classList.contains("expanded")===r)return;const l=null!==(e=null===(t=s.options)||void 0===t?void 0:t.ariaLabelWhenExpanded)&&void 0!==e?e:"Collapse row",a=null!==(i=null===(n=s.options)||void 0===n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==i?i:"Expand row";o.classList.toggle("expanded",r),o.classList.toggle("collapsed",!r),o.setAttribute("aria-label",r?l:a),o.setAttribute("aria-expanded",r+"")})})):an.delete(o))},un=(t,e,n,o,i)=>{if(e.valueFormatter){const s=e.valueFormatter({accessor:e.accessor,colIndex:n,row:o,rowIndex:i,value:t});return"object"==typeof s&&null!==s?t+"":s+""}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)?qe(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},hn=(t,e,n)=>{var o;const{header:i,row:s,rowIndex:r,colIndex:l,depth:a,rowId:c}=t,u=Dt(s,i.accessor),h=i.isSelectionColumn&&e.enableRowSelection;if(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 i=document.createElement("div");i.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(c+""),r=((t,e,n)=>rn({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,s);i.appendChild(r),o.appendChild(i);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 i=document.createElement("span");i.className="st-row-button",i.appendChild(e),n.appendChild(i)}catch(t){console.error("Error rendering row button:",t)}}),n})(t,e);return l&&o.appendChild(l),void n.appendChild(o)}const f=e.rowGrouping&&e.rowGrouping[a],v=!!f&&Ut(s,f),p=!(!e.rowGrouping||a>=e.rowGrouping.length),w=!e.canExpandRowGroup||e.canExpandRowGroup(s),m=i.expandable&&(v&&p&&w||!!i.nestedTable||!!e.onRowGroupExpand&&p&&w);if(m||i.expandable&&p){const o=new Set(e.expandedDepths),i=Kt(t.tableRow),s=((t,e,n,o)=>{const i=!0===(null==o?void 0:o.placeholder),s=document.createElement("div");s.className="st-icon-container st-expand-icon-container "+(i?"placeholder":n?"expanded":"collapsed");const r=e.icons.expand;if(r&&("string"==typeof r?s.innerHTML=r:(r instanceof HTMLElement||r instanceof SVGSVGElement)&&s.appendChild(r.cloneNode(!0))),i)return s.setAttribute("role","presentation"),s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex","-1"),s;s.setAttribute("role","button"),s.setAttribute("aria-label",n?"Collapse row":"Expand row"),s.setAttribute("aria-expanded",n+""),s.setAttribute("tabindex","0");const l=n=>{var o,i;n.stopPropagation();const r=s.closest("[data-row-id]"),l=r?ln.get(r):void 0,a=null!==(o=null==l?void 0:l.tableRow)&&void 0!==o?o:t.tableRow,d=null!==(i=null==l?void 0:l.row)&&void 0!==i?i:t.row,c=Kt(a),u=a.depth,h=new Set(e.expandedDepths),f=e.getExpandedRows?e.getExpandedRows():e.expandedRows,v=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=Jt(c,u,h,f,v),w=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(c,u),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(c),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(c),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(c,u),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(c),e})),e.onRowGroupExpand&&a.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,o=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(c)||{};return o.set(c,Object.assign(Object.assign({},i),{loading:t,triggerSection:n})),o})},0)},i=t=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(c)||{};return o.set(c,Object.assign(Object.assign({},i),{error:t,loading:!1,triggerSection:n})),o})},s=(t,o)=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(c)||{};return o.set(c,Object.assign(Object.assign({},i),{isEmpty:t,loading:!1,triggerSection:n})),o})};e.onRowGroupExpand({row:d,depth:u,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[u],isExpanded:w,rowIndexPath:a.rowIndexPath,rowIdPath:a.rowPath,groupingKeys:e.rowGrouping,setLoading:o,setError:i,setEmpty:s})}};return d(s,"click",l),d(s,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l(t))}),s})(t,e,Jt(i,a,o,e.expandedRows,e.collapsedRows),{placeholder:!m});n.appendChild(s)}if("lineAreaChart"===i.type&&Array.isArray(u)){const t=u.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:i,fillColor:s,fillOpacity:r=.25,strokeWidth:l=1.5,className:a="",min:d,max:c}=t;if(!e||0===e.length)return null;const u="st-line-area-gradient-"+ ++nn,h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("width",n+""),h.setAttribute("height",o+""),h.setAttribute("preserveAspectRatio","none"),h.setAttribute("class",("st-line-area-chart "+a).trim()),h.style.display="block";let f="number"==typeof n?n:100;const v=()=>{h.innerHTML="";const t=f,n=o;h.setAttribute("viewBox",`0 0 ${t} ${n}`);const a=void 0!==d?d:Math.min(...e),v=(void 0!==c?c:Math.max(...e))-a||1,p=l/2+.5,w=Math.max(1,t-2*p),m=Math.max(1,n-2*p),g=e.map((t,n)=>({x:1===e.length?p+w/2:p+n/(e.length-1)*w,y:p+m-(t-a)/v*m})),b=g.map((t,e)=>`${0===e?"M":"L"} ${t.x.toFixed(2)},${t.y.toFixed(2)}`).join(" "),x=g[0].x,y=`${b} L ${g[g.length-1].x.toFixed(2)},${n} L ${x.toFixed(2)},${n} Z`,R=s||"var(--st-chart-fill-color)",S=document.createElementNS("http://www.w3.org/2000/svg","defs"),C=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");C.setAttribute("id",u),C.setAttribute("x1","0"),C.setAttribute("y1","0"),C.setAttribute("x2","0"),C.setAttribute("y2","1");const M=document.createElementNS("http://www.w3.org/2000/svg","stop");M.setAttribute("offset","0%"),M.style.stopColor=R,M.setAttribute("stop-opacity",r+"");const H=document.createElementNS("http://www.w3.org/2000/svg","stop");H.setAttribute("offset","100%"),H.style.stopColor=R,H.setAttribute("stop-opacity",.15*r+""),C.appendChild(M),C.appendChild(H),S.appendChild(C),h.appendChild(S);const I=document.createElementNS("http://www.w3.org/2000/svg","path");I.setAttribute("d",y),I.setAttribute("fill",`url(#${u})`),I.setAttribute("stroke","none");const k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",b),k.setAttribute("fill","none"),k.setAttribute("stroke",i||"var(--st-chart-color)"),k.setAttribute("stroke-width",l+""),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),h.appendChild(I),h.appendChild(k)};v();const p="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const o=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;o>0&&Math.abs(o-f)>=.5&&(f=o,v())}):null;return null==p||p.observe(h),{element:h,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,h.setAttribute("width",n+""),"number"==typeof n&&(f=n)),void 0!==t.height&&(o=t.height,h.setAttribute("height",o+"")),void 0!==t.color&&(i=t.color),void 0!==t.fillColor&&(s=t.fillColor),void 0!==t.fillOpacity&&(r=t.fillOpacity),void 0!==t.strokeWidth&&(l=t.strokeWidth),void 0!==t.className&&(a=t.className,h.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):h.innerHTML=""},destroy:()=>{null==p||p.disconnect(),h.remove()}}})(Object.assign({data:t,width:"100%",height:30},i.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}else if("barChart"===i.type&&Array.isArray(u)){const t=u.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:i,gap:s=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",n+""),d.setAttribute("height",o+""),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("class",("st-bar-chart "+r).trim()),d.style.display="block";let c="number"==typeof n?n:100;const u=()=>{d.innerHTML="";const t=c,n=o;d.setAttribute("viewBox",`0 0 ${t} ${n}`);const r=void 0!==l?l:Math.min(...e),u=void 0!==a?a:Math.max(...e),h=u-r||1,f=e.length;let v=Math.max(0,s);f>1&&1>(t-v*(f-1))/f&&(v=Math.max(0,Math.floor((t-f)/(f-1))));const p=(t-v*(f-1))/f,w=p+v,m=0>r,g=m?n*(u/h):n;e.forEach((t,e)=>{let o,s;m?0>t?(o=g,s=g+Math.abs(t)/h*n):(o=g-t/h*n,s=g):(o=n-(t-r)/h*n,s=n);const l=Math.round(e*w),a=Math.max(l+1,Math.round(e*w+p)),c=Math.round(o),u=Math.max(c+1,Math.round(s)),f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("x",l+""),f.setAttribute("y",c+""),f.setAttribute("width",a-l+""),f.setAttribute("height",u-c+""),f.setAttribute("fill",i||"var(--st-chart-color)"),f.setAttribute("rx",Math.min(1,(a-l)/3)+""),d.appendChild(f)})};u();const h="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{var e,n;const o=null!==(n=null===(e=t[0])||void 0===e?void 0:e.contentRect.width)&&void 0!==n?n:0;o>0&&Math.abs(o-c)>=.5&&(c=o,u())}):null;return null==h||h.observe(d),{element:d,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,d.setAttribute("width",n+""),"number"==typeof n&&(c=n)),void 0!==t.height&&(o=t.height,d.setAttribute("height",o+"")),void 0!==t.color&&(i=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,d.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),u()):d.innerHTML=""},destroy:()=>{null==h||h.disconnect(),d.remove()}}})(Object.assign({data:t,width:"100%",height:30},i.chartOptions));return void((null==e?void 0:e.element)&&n.appendChild(e.element))}}if(i.cellRenderer){try{const a=i.cellRenderer({accessor:i.accessor,colIndex:l,row:s,rowIndex:t.tableRow.absoluteRowIndex||r,rowPath:t.tableRow.rowPath,theme:e.theme,value:u,formattedValue:null===(o=i.valueFormatter)||void 0===o?void 0:o.call(i,{accessor:i.accessor,colIndex:l,row:s,rowIndex:r,value:u})});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=un(u,i,l,s,r);if(null!==t){const e=document.createTextNode(t);n.appendChild(e)}}}catch(t){console.error("Error rendering cell:",t);const e=un(u,i,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const g=un(u,i,l,s,r);if(null!==g){const t=document.createTextNode(g);n.appendChild(t)}},fn=new Map,vn=new Map,pn=new WeakMap,wn=new WeakMap,mn=new WeakMap,gn=(t,e,n)=>{pn.set(e,n);const o=(t=>{let e=fn.get(t);return e||(e=new Map,fn.set(t,e)),e})(n);o.has(t)||o.set(t,new Set),o.get(t).add(e)},bn=(t,e)=>{const n=pn.get(e);if(!n)return;pn.delete(e);const o=fn.get(n);if(!o)return;const i=o.get(t);i&&(i.delete(e),0===i.size&&o.delete(t)),0===o.size&&(fn.delete(n),vn.delete(n))},xn=(t,e,n)=>{var o;const i=null===(o=fn.get(n))||void 0===o?void 0:o.get(t);i&&i.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},yn=(t,e)=>{var n,o,i;const{header:s,rowIndex:r,colIndex:l,rowId:a,depth:d,isOdd:c}=t,u=s.isSelectionColumn&&e.enableRowSelection,h=!!(null==s?void 0:s.editable)||!(!e.onCellClick||u)||!(!e.selectRowOnClick||!e.enableRowSelection||u),f={rowIndex:r,colIndex:l,rowId:a},v=e.getBorderClass(f),p=e.isSelected(f),w=e.isInitialFocusedCell(f),m=e.isCopyFlashing(f),g=e.isWarningFlashing(f),b=e.selectedColumns.has(l),x=p&&!b,y=u&&e.rowsWithSelectedCells.has(a+""),R=(()=>{var t,n,o;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"===s.pinned?(null===(t=i[i.length-1])||void 0===t?void 0:t.accessor)===s.accessor:"right"===s.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===s.accessor:(null===(o=r[r.length-1])||void 0===o?void 0:o.accessor)===s.accessor})();return["st-cell","st-row-position-"+t.tableRow.position,d>0&&s.expandable?"st-cell-depth-"+d:"",x?w?"st-cell-selected-first "+v:"st-cell-selected "+v:"",b?w?"st-cell-column-selected-first":"st-cell-column-selected":"",h?"clickable":"",m?w?"st-cell-copy-flash-first":"st-cell-copy-flash":"",g?w?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.oddColumnBackground?l%2==0?"even-column":"odd-column":"",u?"st-selection-cell":"",y?"st-selection-has-highlighted-cell":"",R?"st-last-column":"","",e.oddEvenRowBackground?c?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,a))?"st-cell-selected-row":"",null!=e.activeRowId&&e.activeRowId+""==a+""?"st-row-active":"",null!==(o=s.cellClass)&&void 0!==o?o:"",...Rn(null===(i=e.getRowClass)||void 0===i?void 0:i.call(e,{row:t.row,rowId:a,position:t.tableRow.position,depth:d}))].filter(Boolean).join(" ")},Rn=t=>{if(null==t)return[];const e=Array.isArray(t)?t:[t],n=[];for(const t of e)if("string"==typeof t)for(const e of t.trim().split(/\s+/))e&&n.push(e);return n},Sn=(t,e)=>{var n,o,i;const{header:s,row:r,rowIndex:l,colIndex:a,rowId:c}=t,u=s.isSelectionColumn&&e.enableRowSelection,h={rowIndex:l,colIndex:a,rowId:c},f=e.isInitialFocusedCell(h),v=yn(t,e),p=document.createElement("div");p.className=v,p.id=xt({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c}),p.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),p.setAttribute("tabindex",f?"0":"-1");const w=null!==(o=e.maxHeaderDepth)&&void 0!==o?o:1;p.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),p.setAttribute("aria-colindex",a+1+""),e.enableRowSelection&&p.setAttribute("aria-selected",(null===(i=e.isRowSelected)||void 0===i?void 0:i.call(e,c))?"true":"false"),p.setAttribute("data-row-index",l+""),p.setAttribute("data-col-index",a+""),p.setAttribute("data-row-id",c+""),p.setAttribute("data-accessor",s.accessor+""),p.style.position="absolute",O(p,t.left,t.top),p.style.width=t.width+"px",p.style.height=t.height+"px";let m=!1;const g="boolean"===s.type||"date"===s.type||"enum"===s.type,b=()=>{var n,o,i,r;const l=null!==(o=null===(n=ln.get(p))||void 0===n?void 0:n.context)&&void 0!==o?o:e;if(m&&!g){null===(i=l.onRendererHostDiscard)||void 0===i||i.call(l,p),p.innerHTML="",p.setAttribute("tabindex","-1");const e=en(t,l,()=>{m=!1,p.setAttribute("tabindex",f?"0":"-1"),b(),y()},p);if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),p.appendChild(t)}}else if(m&&g)en(t,l,()=>{m=!1,b(),y()},p);else{null===(r=l.onRendererHostDiscard)||void 0===r||r.call(l,p),p.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),hn(t,l,e),p.appendChild(e)}};b(),t.header.expandable||mn.set(p,{row:t.row,value:Dt(r,s.accessor),theme:e.theme,skeleton:!!t.tableRow.isLoadingSkeleton});const x={row:r,tableRow:t.tableRow,context:e};ln.set(p,x);const y=()=>{var n;if(e.cellRegistry&&!u){const o=xt({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c});wn.set(p,o),e.cellRegistry.set(o,{updateContent:t=>{var n,o;if(!m){if(jt(x.row,s.accessor,t),b(),!s.expandable){const t=null!==(o=null===(n=ln.get(p))||void 0===n?void 0:n.context)&&void 0!==o?o:e;mn.set(p,{row:x.row,value:Dt(x.row,s.accessor),theme:t.theme,skeleton:!!x.tableRow.isLoadingSkeleton})}e.cellUpdateFlash&&(p.classList.add(f?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{p.classList.remove("st-cell-updating-first","st-cell-updating")},800))}}})}};if(y(),!m&&!u){const t=t=>{var n,o;const i=t.target;if(i.closest("a, button, input, select, textarea, [contenteditable='true']"))return;if(t.preventDefault(),i.closest(".st-expand-icon-container"))return;const s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(o=p.getAttribute("data-col-index"))&&void 0!==o?o:"-1",10),l=p.getAttribute("data-row-id");0>s||0>r||null===l||e.handleMouseDown({rowIndex:s,colIndex:r,rowId:l})},n=t=>{var n,o;const i=t,s=parseInt(null!==(n=p.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(o=p.getAttribute("data-col-index"))&&void 0!==o?o:"-1",10),l=p.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?h:{rowIndex:s,colIndex:r,rowId:l},i.clientX,i.clientY)};d(p,"mousedown",t),d(p,"mouseover",n)}if(d(p,"keydown",t=>{m||u||"F2"!==t.key&&"Enter"!==t.key||!s.editable||m||(t.preventDefault(),m=!0,b())}),d(p,"dblclick",t=>{!s.editable||u||m||(m=!0,b())}),(e.onCellClick||e.selectRowOnClick)&&!u){const t=t=>{var n,o,i,d,u,h,f,v;if(t.target.closest(".st-expand-icon-container"))return;const w=null!==(o=null===(n=ln.get(p))||void 0===n?void 0:n.row)&&void 0!==o?o:r,m=null!==(d=null===(i=ln.get(p))||void 0===i?void 0:i.context)&&void 0!==d?d:e,g=null!==(u=p.getAttribute("data-row-id"))&&void 0!==u?u:c+"";if(m.selectRowOnClick&&m.enableRowSelection&&(null===(h=m.handleToggleRow)||void 0===h||h.call(m,g)),m.onCellClick){const t=Dt(w,s.accessor),e=parseInt(null!==(f=p.getAttribute("data-row-index"))&&void 0!==f?f:l+"",10),n=parseInt(null!==(v=p.getAttribute("data-col-index"))&&void 0!==v?v:a+"",10);m.onCellClick({accessor:s.accessor,colIndex:n,row:w,rowIndex:e,value:t})}};d(p,"click",t)}if(e.hoverRowBackground){const t=c+"",n=e.hoverScopeId;gn(t,p,n);const o=()=>{var e,o,i;const s=null!==(e=pn.get(p))&&void 0!==e?e:n,r=null!==(o=p.getAttribute("data-row-id"))&&void 0!==o?o:t,l=null!==(i=vn.get(s))&&void 0!==i?i:null;null!==l&&l!==r&&xn(l,!1,s),xn(r,!0,s),vn.set(s,r)},i=()=>{var e,o,i;const s=null!==(e=pn.get(p))&&void 0!==e?e:n,r=null!==(o=p.getAttribute("data-row-id"))&&void 0!==o?o:t;xn(r,!1,s),(null!==(i=vn.get(s))&&void 0!==i?i:null)===r&&vn.set(s,null)};d(p,"mouseenter",o),d(p,"mouseleave",i)}return p},Cn=(t,e,n)=>{var o,i,s,r,l,a;const{rowIndex:d,colIndex:c,rowId:u}=e,h={rowIndex:d,colIndex:c,rowId:u};t.className=yn(e,n);const f=n.isInitialFocusedCell(h);t.setAttribute("tabindex",f?"0":"-1"),O(t,e.left,e.top);const v=t.dataset.stAccordionGrow;"horizontal"!==v&&(t.style.width=e.width+"px"),"vertical"!==v&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",d+""),t.setAttribute("data-col-index",c+"");const p=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+p+1+""),t.setAttribute("aria-colindex",c+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(i=n.isRowSelected)||void 0===i?void 0:i.call(n,u))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const w=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==w&&t.setAttribute("role",w);const m=t.getAttribute("data-row-id"),g=u+"";if(m&&m!==g){const e=null!==(s=pn.get(t))&&void 0!==s?s:n.hoverScopeId;bn(m,t),gn(g,t,e)}t.setAttribute("data-row-id",g),t.setAttribute("data-accessor",e.header.accessor+"");const b=ln.get(t);if(b?(b.row=e.row,b.tableRow=e.tableRow,b.context=n):ln.set(t,{row:e.row,tableRow:e.tableRow,context:n}),e.header.expandable){const o=t.querySelector(".st-cell-content");o&&!!e.tableRow.isLoadingSkeleton!=(null!==o.querySelector(".st-loading-skeleton"))&&(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,o),o.innerHTML="",hn(e,n,o))}else{const o=t.querySelector(".st-cell-content");if(o){const i=mn.get(t),s=Dt(e.row,e.header.accessor),r=!!e.tableRow.isLoadingSkeleton,d=o.querySelector("[data-st-portal-id]"),c=null!==d&&""===(null!==(l=d.textContent)&&void 0!==l?l:"").trim()&&0===d.childNodes.length;0!==o.childNodes.length&&!c&&void 0!==i&&i.row===e.row&&i.value===s&&i.theme===n.theme&&i.skeleton===r||(mn.set(t,{row:e.row,value:s,theme:n.theme,skeleton:r}),null===(a=n.onRendererHostDiscard)||void 0===a||a.call(n,o),o.innerHTML="",hn(e,n,o))}}},Mn=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(Mn);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=Mn(t[n]));return e},Hn=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!pt(t)),In={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},kn=(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 En{constructor(t,e){this.observers=new Set,this.notifyMicrotaskScheduled=!1,this.shouldExpandAll=t,this.expandedDepths=kn(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);if(this.shouldExpandAll)return void this.setExpandedDepths(kn(!0,t));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.notifyMicrotaskScheduled||(this.notifyMicrotaskScheduled=!0,queueMicrotask(()=>{this.notifyMicrotaskScheduled=!1,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()}}function Tn(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function An(t,e){return!0===t.essential||e.has(t.accessor+"")}function On(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||pt(o))continue;const t=An(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function Pn(t,e){var n;const{pinnedLeft:o,unpinned:i,pinnedRight:s}=Tn(t);if(!On(o,e))return!1;if(!On(i,e))return!1;if(!On(s,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Wn(o.children,e))return!1;return!0}function Wn(t,e){var n;if(!On(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!Wn(o.children,e))return!1;return!0}function Fn(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=Tn(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function $n(t,e,n){return[...t.filter(t=>An(e.get(t+""),n)),...t.filter(t=>!An(e.get(t+""),n))]}function Dn(t,e,n){const o=new Set(t.map(t=>t.accessor+"")),i=[...e.left,...e.main,...e.right];if(i.length!==o.size)return null;for(const t of i)if(!o.has(t+""))return null;const s=new Map(t.map(t=>[t.accessor+"",t])),r=$n(e.left,s,n),l=$n(e.main,s,n),a=$n(e.right,s,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(s.get(t+""),"left")),...l.map(t=>d(s.get(t+""),void 0)),...a.map(t=>d(s.get(t+""),"right"))]}function Ln(t,e,n,o){const i=e+"",s=Fn(t),r=s.left.filter(t=>t+""!==i),l=s.main.filter(t=>t+""!==i),a=s.right.filter(t=>t+""!==i),d=t.find(t=>t.accessor+""===i);return d&&(!An(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),Dn(t,{left:r,main:l,right:a},o)):null}class jn{static resolveIcons(t){var e,n,o,i,s,r,l,a,d,c,u,h,f,v,p,w,m,g;const b={drag:Ye("st-drag-icon"),expand:_e("st-expand-icon"),filter:Ge({className:"st-header-icon",paths:["M3 6h18","M7 12h10","M10 18h4"]}),headerCollapse:_e("st-header-icon"),headerExpand:Ke("st-header-icon"),next:_e("st-next-prev-icon"),prev:Ke("st-next-prev-icon"),sortDown:Je("st-header-icon"),sortUp:Ue("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:b.drag,expand:null!==(i=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==i?i:b.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:b.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:b.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:b.headerExpand,next:null!==(h=null===(u=t.icons)||void 0===u?void 0:u.next)&&void 0!==h?h:b.next,prev:null!==(v=null===(f=t.icons)||void 0===f?void 0:f.prev)&&void 0!==v?v:b.prev,sortDown:null!==(w=null===(p=t.icons)||void 0===p?void 0:p.sortDown)&&void 0!==w?w:b.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:b.sortUp}}static mergeCustomTheme(t){return Object.assign(Object.assign({},In),t.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,i,s,r,l,a,d,c,u,h,f;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",showToggle:null===(i=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.showToggle)||void 0===i||i,searchEnabled:null===(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchEnabled)||void 0===r||r,searchPlaceholder:null!==(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.searchPlaceholder)&&void 0!==a?a:"Search columns...",allowColumnPinning:null===(c=null===(d=t.columnEditorConfig)||void 0===d?void 0:d.allowColumnPinning)||void 0===c||c,searchFunction:null===(u=t.columnEditorConfig)||void 0===u?void 0:u.searchFunction,rowRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.rowRenderer,customRenderer:null===(f=t.columnEditorConfig)||void 0===f?void 0:f.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const i of t)i.essential&&e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.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 kn(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}const Nn={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),i=new Date(e);if(o.getTime()===i.getTime())return 0;const s=o.getTime()-i.getTime();return"asc"===n?s:-s},enum:(t,e,n)=>Nn.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?Nn.string(t,e,n):"number"==typeof t&&"number"==typeof e?Nn.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Nn.boolean(t,e,n):Nn.string(t+"",e+"",n)},Bn=({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}}},i=o(n,e.key.accessor),s=(null==i?void 0:i.type)||"string",r=e.direction,l=e.key.accessor;return[...t].sort((e,n)=>{let o,a;if(null==i?void 0:i.valueGetter){const s=t.indexOf(e),r=t.indexOf(n);o=i.valueGetter({accessor:l,row:e,rowIndex:s}),a=i.valueGetter({accessor:l,row:n,rowIndex:r})}else o=Dt(e,l),a=Dt(n,l);return(null==i?void 0:i.comparator)?i.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},i=n(t),s=n(e);return Nn.number(i,s,o)}return"date"===n?Nn.date(t+"",e+"",o):"boolean"===n?Nn.boolean(!!t,!!e,o):"enum"===n?Nn.enum(t+"",e+"",o):Nn.string(t+"",e+"",o)})(o,a,s,r)})})({rows:e,sortColumn:n,headers:t}),zn=t=>{const{rows:e=[],headers:n=[],rowGrouping:o}=t;if(!o||0===o.length)return e;const i=(t=>ft(t).filter(t=>t.aggregation))(n);if(0===i.length)return e;const s=JSON.parse(JSON.stringify(e)),r=(t,e=0)=>t.map(t=>{const n=o[e],s=o[e+1],l=t[n];if(l&&Nt(l)){const o=r(l,e+1),a=Object.assign({},t);return a[n]=o,i.forEach(t=>{const e=((t,e,n,o)=>{const i=[],s=t=>{t.forEach(t=>{const n=o?t[o]:void 0;if(o&&n&&Nt(n))s(n);else{const n=Dt(t,e);null!=n&&i.push(n)}})};return s(t),Ce(i,n)})(o,t.accessor,t.aggregation,s);void 0!==e&&jt(a,t.accessor,e)}),a}return t});return r(s)};class Vn{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=ft(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 i=Bn({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?i.map(n=>{const i=t[0],s=n[i];if(Nt(s)){const r=this.sortNestedRows({rows:s,sortColumn:o,headers:e,groupingKeys:t.slice(1)});return Object.assign(Object.assign({},n),{[i]:r})}return n}):i}computeSortedRows(t,e){if(this.config.externalSortHandling)return t;const n=zn({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}):Bn({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);Lt(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,i;if(!t)return this.state=Object.assign(Object.assign({},this.state),{sort:null,sortedRows:this.computeSortedRows(this.config.tableRows,null)}),null===(n=(e=this.config).onSortChange)||void 0===n||n.call(e,null),void this.notifySubscribers();const{accessor:s,direction:r}=t,l=this.headerLookup.get(s);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===s&&(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===(i=(o=this.config).onSortChange)||void 0===i||i.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 i=n.sortingOrder||["asc","desc",null];let s=-1;this.state.sort&&this.state.sort.key.accessor===t&&(s=i.indexOf(this.state.sort.direction));const r=i[(s+1)%i.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()}}class qn{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=ft(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:i}=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(),i=o?(o+"").toLowerCase():"";switch(n){case"equals":return e===i;case"notEquals":return e!==i;case"contains":return e.includes(i);case"notContains":return!e.includes(i);case"startsWith":return e.startsWith(i);case"endsWith":return e.endsWith(i)}}if("number"==typeof t||!isNaN(+t)){const e=+t,s=+o;switch(n){case"equals":return e===s;case"notEquals":return e!==s;case"greaterThan":return e>s;case"lessThan":return s>e;case"greaterThanOrEqual":return e>=s;case"lessThanOrEqual":return s>=e;case"between":if(i&&2===i.length){const[t,n]=i.map(Number);return e>=t&&n>=e}return!1;case"notBetween":if(i&&2===i.length){const[t,n]=i.map(Number);return t>e||e>n}return!0}}if(t instanceof Date||!isNaN(Date.parse(t))){const e=qe(t),s=qe((o||"")+""),r=Ve(e),l=Ve(s);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(i&&2===i.length){const[t,e]=i.map(t=>Ve(qe((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(i&&2===i.length){const[t,e]=i.map(t=>Ve(qe((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(i&&Array.isArray(i)){const e=i.includes(t+"");return"in"===n?e:!e}return!1}const s=(t+"").toLowerCase(),r=o?(o+"").toLowerCase():"";switch(n){case"equals":return s===r;case"notEquals":return s!==r;default:return!0}})(Dt(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);Lt(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}),i=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:i},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 i=this.computeFilteredRows(this.config.rows,o);if(this.state={filters:o,filteredRows:i},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 Gn=(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,i=n.length-1;for(;i>o;){const e=Math.floor((o+i+1)/2);n[e]>t?i=e-1:o=e}return o},Kn=(t,e)=>{if(!e||0===e.length)return 0;let n=0,o=0,i=e.length;for(;i>o;){const n=Math.floor((o+i)/2);t>e[n][0]?o=n+1:i=n}for(let t=0;o>t;t++)n+=e[t][1];return n},_n=({bufferRowCount:t,contentHeight:e,rowHeight:n,scrollTop:o,tableRows:i,scrollDirection:s="none",heightMap:r})=>{const l=n+1;if(!r){const n=t*l;let r=n,a=n;"down"===s?(r=Math.max(l,.1*n),a=.9*n):"up"===s&&(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)),u=Math.min(i.length,Math.ceil(d/l)),h=o+e,f=Math.max(0,Math.ceil(o/l)),v=Math.min(i.length,Math.floor(h/l)),p=o+e,w=Math.max(0,Math.floor(o/l)),m=Math.min(i.length,Math.ceil(p/l));return{rendered:{startIndex:c,endIndex:u,rows:i.slice(c,u)},fullyVisible:{startIndex:f,endIndex:v,rows:i.slice(f,v)},partiallyVisible:{startIndex:w,endIndex:m,rows:i.slice(w,m)}}}const{rowTopPositions:a}=r,d=t*l;let c=d,u=d;"down"===s?(c=Math.max(l,.1*d),u=.9*d):"up"===s&&(c=.9*d,u=Math.max(l,.1*d));const h=o+e+u,f=Gn(Math.max(0,o-c),r);let v=Gn(h,r)+1;v=Math.min(i.length,v);const p=o,w=o+e;let m=Gn(p,r);p>a[m]&&(m=Math.min(m+1,i.length));let g=Gn(w,r);g=Math.min(i.length,g);const b=o+e,x=Gn(o,r);let y=Gn(b,r)+1;return y=Math.min(i.length,y),{rendered:{startIndex:f,endIndex:v,rows:i.slice(f,v)},fullyVisible:{startIndex:m,endIndex:g,rows:i.slice(m,g)},partiallyVisible:{startIndex:x,endIndex:y,rows:i.slice(x,y)}}},Un=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+Kn(t,n),Jn=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+Kn(t,n),Yn=(t,e)=>{var n,o;const i=t.position,s=e[i+1];return null!==(o=null===(n=null==s?void 0:s.parentIndices)||void 0===n?void 0:n.includes(i))&&void 0!==o&&o},Xn=new Map,Qn=t=>{var e;return t?null!==(e=t.stableRowKey)&&void 0!==e?e:zt(t.rowId):""},Zn=(t,e,n,o,i)=>{var s,r,l,a,d,c;const u=null!==(r=null===(s=o[0])||void 0===s?void 0:s.position)&&void 0!==r?r:-1,h=null!==(a=null===(l=e[0])||void 0===l?void 0:l.position)&&void 0!==a?a:-1,f=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,v=[Qn(t[u]),Qn(t[h]),Qn(t[f]),Qn(t[0]),t.length+""].join("|"),p=`${u}:${h}:${f}:${i.join(",")}:${v}`,w=Xn.get(p);if(w&&w.firstVisiblePosition===u&&w.renderedStartPosition===h&&w.renderedEndPosition===f){const n=[];let o=!0;for(const e of w.result.stickyParents){const i=t[e.position];if(!i||Qn(i)!==Qn(e)){o=!1;break}n.push(i)}if(o)return{stickyParents:n,regularRows:e};Xn.delete(p)}const m=to({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:i});if(Xn.set(p,{result:m,firstVisiblePosition:u,renderedStartPosition:h,renderedEndPosition:f}),Xn.size>50){const t=Xn.keys().next().value;void 0!==t&&Xn.delete(t)}return m},to=({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s,stickyParents:r,rowGrouping:l})=>{let a=o[i];if(!a||s>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=>zt(t.rowId)===zt(o.rowId))||(r.push(o),d++)}}if(r.length>0){Yn(a,t)&&(r.push(a),d++);const e=o[i+=d];e&&(a=e)}}else if(Yn(a,t))return r.push(a),i++,to({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Yn(a,t)?to({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},eo=(t,e,n)=>{const o=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=10;if(i.top+s>o.top?e.scrollTop-=i.top-o.top+s:o.bottom>i.bottom-s&&(e.scrollTop+=o.bottom-i.bottom+s),n){const t=n.getBoundingClientRect();t.left+s>o.left?n.scrollLeft-=t.left-o.left+s:o.right>t.right-s&&(n.scrollLeft+=o.right-t.right+s)}},no=(t,e,n,o,i)=>{const s=At(null!=i?i:null,".st-body-container"),r=At(null!=i?i:null,".st-body-main");if(!s)return;const l=o?o.findIndex(e=>zt(e.rowId)===t.rowId+""):-1,a=0>l?t.rowIndex:l,d=e+n.rowSeparatorWidth,c=`.st-cell[data-row-id="${Wt(t.rowId+"")}"][data-col-index="${t.colIndex}"]`,u=At(null!=i?i:s,c);if(u&&o){const t=((t,e,n,o)=>{const i=_n({bufferRowCount:0,contentHeight:e.clientHeight,rowHeight:n,scrollTop:e.scrollTop,tableRows:o,scrollDirection:"none"}),{startIndex:s,endIndex:r}=i.fullyVisible;return t>=s&&r>t})(a,s,e,o);if(t)return void eo(u,s,r)}if(!u)return s.scrollTop=Math.max(0,a*d-s.clientHeight/3),void setTimeout(()=>{const t=At(null!=i?i:s,c);t&&eo(t,s,r)},100);eo(u,s,r)},oo=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function io(t,e,n,o){const i=new Set,s=new Map;n.forEach((t,e)=>{const n=zt(t.rowId);s.set(n,e)});const r=s.get(t.rowId+""),l=s.get(e.rowId+""),a=void 0!==r?r:t.rowIndex,d=void 0!==l?l:e.rowIndex,c=Math.min(a,d),u=Math.max(a,d),h=Math.min(t.colIndex,e.colIndex),f=Math.max(t.colIndex,e.colIndex);for(let t=c;u>=t;t++)for(let e=h;f>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const s=zt(n[t].rowId);i.add(oo({colIndex:e,rowIndex:t,rowId:s}))}return i}class so{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=>Yt(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(zt(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(zt(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(`${zt(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(zt(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(zt(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(`${zt(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 i=this.config.tableRows[e];if((i?zt(i.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>zt(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,i,s){let r=o,l=i;return"up"===s?r=0:"down"===s?r=t-1:"left"===s?l=n?1:0:"right"===s&&(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=zt(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 i=zt(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:i}),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=zt(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 i=zt(this.config.tableRows[o].rowId);this.selectSingleCell({rowIndex:o,colIndex:n,rowId:i}),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=zt(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=zt(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 i=n+1;if((t.ctrlKey||t.metaKey)&&(i=this.findEdgeInDirection(e,n,"right").colIndex),o>=i){const t=zt(this.config.tableRows[e].rowId);this.selectCellRange(this.startCell,{rowIndex:e,colIndex:i,rowId:t})}}else if(o>n){let i=n+1;if((t.ctrlKey||t.metaKey)&&"ArrowRight"===t.key&&(i=this.findEdgeInDirection(e,n,"right").colIndex),o>=i){const t=zt(this.config.tableRows[e].rowId);this.selectSingleCell({rowIndex:e,colIndex:i,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 i=zt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:i})}else{let n=e;const o=this.config.enableRowSelection?1:0;(t.ctrlKey||t.metaKey)&&(n=0);const i=zt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:i}),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 i=zt(this.config.tableRows[n].rowId);this.selectCellRange(this.startCell,{rowIndex:n,colIndex:o,rowId:i})}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 i=zt(this.config.tableRows[n].rowId);this.selectSingleCell({rowIndex:n,colIndex:o,rowId:i}),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=zt(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=zt(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=zt(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=zt(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 i=this.leafHeaders.filter(t=>!pt(t)),s=new Map,r=new Map;i.forEach((t,e)=>{s.set(e,t.accessor),r.set(e,t)});const l=Array.from(t).reduce((t,e)=>{var o;const[i,l]=e.split("-").map(Number);t[i]||(t[i]=[]);const a=s.get(l),d=r.get(l);if(a&&(null===(o=n[i])||void 0===o?void 0:o.row)){const e=n[i].row,o=Dt(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:i,value:o});t[i][l]=n}else t[i][l]=!d||"lineAreaChart"!==d.type&&"barChart"!==d.type?o:Array.isArray(o)?o.join(", "):""}else t[i][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,i,s)=>{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=>!pt(t)),c=o.findIndex(t=>zt(t.rowId)===e.rowId+""),u=0>c?e.rowIndex:c,h=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{var a;const c=u+e,f=h+n;if(c>=o.length||f>=d.length)return;const v=o[c],p=d[f],w=zt(v.rowId);if(!(null==p?void 0:p.editable))return void l.add(`${c}-${f}-${w}`);let m=t;if("number"===p.type){const e=+t;isNaN(e)||(m=e)}else if("boolean"===p.type)m="true"===t.toLowerCase()||"1"===t;else if("date"===p.type){const e=new Date(t);isNaN(e.getTime())||(m=e)}else"lineAreaChart"!==p.type&&"barChart"!==p.type||(m=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(jt(v.row,p.accessor,m),s){const t=`${null!==(a=v.stableRowKey)&&void 0!==a?a:w}-${p.accessor}`,e=s.get(t);e&&e.updateContent(m)}null==i||i({accessor:p.accessor,newValue:m,row:v.row,rowIndex:c}),r.add(`${c}-${f}-${w}`)})}),{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,i)=>{const s=new Set,r=new Set,l=e.filter(t=>!pt(t)),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{var e;const[a,d]=t.split("-").map(Number);if(a>=n.length||d>=l.length)return;const c=n[a],u=l[d],h=zt(c.rowId);if(!(null==u?void 0:u.editable))return void r.add(t);let f=null;if(f="string"===u.type?"":"number"===u.type?null:"boolean"!==u.type&&("date"===u.type?null:"lineAreaChart"===u.type||"barChart"===u.type||Array.isArray(Dt(c.row,u.accessor))?[]:""),jt(c.row,u.accessor,f),i){const t=`${null!==(e=c.stableRowKey)&&void 0!==e?e:h}-${u.accessor}`,n=i.get(t);n&&n.updateContent(f)}null==o||o({accessor:u.accessor,newValue:f,row:c.row,rowIndex:a}),s.add(t)}),{deletedCells:s,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,i=zt(this.config.tableRows[e].rowId);t.add(`${e}-${o}-${i}`)}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(()=>{Tt(this.config.tableRoot,".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 i=oo({rowIndex:e,colIndex:n,rowId:o}),s=this.isInitialFocusedCell({rowIndex:e,colIndex:n,rowId:o});this.copyFlashCells.has(i)?t.classList.add(s?"st-cell-copy-flash-first":"st-cell-copy-flash"):t.classList.remove("st-cell-copy-flash-first","st-cell-copy-flash"),this.warningFlashCells.has(i)?t.classList.add(s?"st-cell-warning-flash-first":"st-cell-warning-flash"):t.classList.remove("st-cell-warning-flash-first","st-cell-warning-flash")})})}syncHeaderSelectionClasses(){if(!this.config.selectableColumns&&!this.config.selectableCells)return;const t=this.config.tableRoot;if(!t)return;const e=Tt(t,".st-header-cell"),n=new Map;for(const t of ft(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 i=o.getAttribute("data-accessor"),s=o.getAttribute("aria-colindex");if(!i||!s)continue;const r=parseInt(s,10)-1;if(0>r||Number.isNaN(r))continue;const l=n.get(i);if(!l){for(const t of so.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of so.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const a=ut(l,r),d=a.some(t=>this.selectedColumns.has(t)),c=!d&&a.some(t=>this.columnsWithSelectedCells.has(t));if(d)o.classList.add("st-header-selected"),o.classList.remove("st-header-has-highlighted-cell");else if(c)o.classList.add("st-header-has-highlighted-cell"),o.classList.remove("st-header-selected");else for(const t of so.HEADER_SELECTION_CLASSES)o.classList.remove(t)}}clearHeaderSelectionHighlightClasses(){if(!this.config.selectableColumns&&!this.config.selectableCells)return;const t=this.config.tableRoot;if(!t)return;const e=Tt(t,".st-header-cell");for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement)for(const t of so.HEADER_SELECTION_CLASSES)n.classList.remove(t)}}syncAllCellClasses(){const t=this.config.tableRoot;if(!t)return;const e=Tt(t,".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),i=parseInt(n.getAttribute("data-col-index")||"-1",10),s=n.getAttribute("data-row-id");if(0>o||0>i||!s)continue;const r={rowIndex:o,colIndex:i,rowId:s},l=this.isSelected(r),a=this.selectedColumns.has(i),d=l&&!a,c=this.isInitialFocusedCell(r),u=this.getBorderClass(r),h=new Set;d&&(h.add(c?"st-cell-selected-first":"st-cell-selected"),u.split(" ").filter(Boolean).forEach(t=>h.add(t))),a&&h.add(c?"st-cell-column-selected-first":"st-cell-column-selected");for(const t of so.SELECTION_CLASSES){const e=h.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const f=c?"0":"-1";if(n.getAttribute("tabindex")!==f&&n.setAttribute("tabindex",f),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 so.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 i=this.rowIdToTableIndex.get(o);if(void 0!==i){const e=oo({rowIndex:i,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const s=oo({colIndex:t,rowIndex:e,rowId:n});return this.selectedCells.has(s)}getBorderClass({colIndex:t,rowIndex:e,rowId:n}){var o;if(this.isSelecting)return"";const i=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===i&&o.push("st-selected-top-border"),i===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 s=[],r=this.config.tableRows[i-1],l=r?zt(r.rowId):null,a=this.config.tableRows[i+1],d=a?zt(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:i-1,rowId:l}),u=null!==d&&this.isSelected({colIndex:t,rowIndex:i+1,rowId:d}),h=this.isSelected({colIndex:t-1,rowIndex:i,rowId:n}),f=this.isSelected({colIndex:t+1,rowIndex:i,rowId:n});return(!l||!c||this.selectedColumns.has(t)&&0===i)&&s.push("st-selected-top-border"),(!d||!u||this.selectedColumns.has(t)&&i===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),h||s.push("st-selected-left-border"),f||s.push("st-selected-right-border"),s.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=oo({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=oo({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=oo(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>no(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows,this.config.tableRoot),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=io(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.startCell=t,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>no(e,this.config.rowHeight,this.config.customTheme,this.config.tableRows,this.config.tableRoot),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=io(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.initialFocusedCell=e,this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}getCellFromMousePosition(t,e){var n;return function(t,e,n){if(!n)return null;const o=document.elementFromPoint(t,e);if(!o)return null;const i=o.closest(".st-cell");if(i instanceof HTMLElement&&Et(n,i)){const t=parseInt(i.getAttribute("data-row-index")||"-1",10),e=parseInt(i.getAttribute("data-col-index")||"-1",10),n=i.getAttribute("data-row-id");if(t>=0&&e>=0&&null!==n)return{rowIndex:t,colIndex:e,rowId:n}}return function(t,e,n){var o,i,s;if(!n)return null;const r=At(n,".st-body-container");if(!r)return null;const l=r.getBoundingClientRect(),a=Math.max(l.left,Math.min(l.right,t)),d=Math.max(l.top,Math.min(l.bottom,e)),c=Tt(n,".st-cell[data-row-index][data-col-index][data-row-id]:not(.st-selection-cell)");if(0===c.length)return null;const u=new Map;for(let t=0;c.length>t;t++){const e=c[t],n=e.getAttribute("data-row-id"),i=null!==(o=null!=n?n:e.getAttribute("data-row-index"))&&void 0!==o?o:"";if(!i)continue;let s=u.get(i);s||(s=[],u.set(i,s)),s.push(e)}const h=[];u.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 f=null,v=1/0;for(let t=0;h.length>t;t++){const{key:e,top:n,bottom:o}=h[t];if(d>=n&&o>=d){f=e,v=0;break}const i=Math.abs(d-(n+o)/2);v>i&&(v=i,f=e)}if(null===f)return null;const p=u.get(f);if(!p||0===p.length)return null;let w=null,m=1/0;for(let t=0;p.length>t;t++){const e=p[t],n=parseInt(null!==(i=e.getAttribute("data-row-index"))&&void 0!==i?i:"-1",10),o=parseInt(null!==(s=e.getAttribute("data-col-index"))&&void 0!==s?s:"-1",10),r=e.getAttribute("data-row-id");if(0>n||0>o||null==r||""===r)continue;const l=e.getBoundingClientRect(),c=Math.sqrt((l.left+l.width/2-a)**2+(l.top+l.height/2-d)**2);m>c&&(m=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}(t,e,n)}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:null)}handleAutoScroll(t,e){var n;!function(t,e,n){if(!n)return;const o=At(n,".st-body-container");if(!o)return;const i=o.getBoundingClientRect(),s=Math.max(0,o.scrollHeight-o.clientHeight);i.top+50>e?o.scrollTop=Math.max(0,o.scrollTop-10*Math.min(3,1+Math.max(0,i.top-e)/100)):e>i.bottom-50&&(o.scrollTop=Math.min(s,o.scrollTop+10*Math.min(3,1+Math.max(0,e-i.bottom)/100)));const r=At(n,".st-body-main");if(r){const e=Math.max(0,r.scrollWidth-r.clientWidth);i.left+50>t?r.scrollLeft=Math.max(0,r.scrollLeft-10*Math.min(3,1+Math.max(0,i.left-t)/100)):t>i.right-50&&(r.scrollLeft=Math.min(e,r.scrollLeft+10*Math.min(3,1+Math.max(0,t-i.right)/100)))}}(t,e,null!==(n=this.config.tableRoot)&&void 0!==n?n:null)}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}){if(!this.config.selectableCells)return;this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n};const o=oo({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells.size>1||(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(t,e,n){var o;if(this.config.selectableCells&&this.isSelecting&&this.startCell){const i=null!==(o=this.getCellFromMousePosition(e,n))&&void 0!==o?o:t;this.updateSelectionRange(this.startCell,i)}}}so.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"],so.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];class ro{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=""}}const lo=t=>!(!t.enableRowSelection||(!t.rowButtons||0>=t.rowButtons.length)&&!1===t.showRowSelectionColumn),ao=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(zt(t.rowId))).map(t=>t.row),co=t=>{if(t.endsWith("dvh")||t.endsWith("svh")||t.endsWith("lvh")||t.endsWith("vh")){const e=parseFloat(t);return Number.isFinite(e)?window.innerHeight*e/100:null}return null},uo=(t,e=null)=>{var n;if("string"==typeof t){const o=t.trim();if(/^calc\(/i.test(o)&&o.endsWith(")")){const t=((t,e)=>{const n=[];for(let e=0;t.length>e;){const o=t[e];if(" "===o||"\t"===o||"\n"===o){e++;continue}if("("===o||")"===o||"+"===o||"-"===o||"*"===o||"/"===o){n.push(o),e++;continue}const i=/^\d*\.?\d+(px|dvh|svh|lvh|vh|vw|%)?/.exec(t.slice(e));if(!i)return null;n.push(i[0]),e+=i[0].length}if(0===n.length)return null;let o=0,i=!1;const s=()=>{let t=r();for(;!i&&("+"===n[o]||"-"===n[o]);){const e=n[o++],i=r();t="+"===e?t+i:t-i}return t},r=()=>{let t=l();for(;!i&&("*"===n[o]||"/"===n[o]);){const e=n[o++],i=l();t="*"===e?t*i:t/i}return t},l=()=>{const t=n[o];if(void 0===t)return i=!0,0;if("+"===t)return o++,l();if("-"===t)return o++,-l();if("("===t){o++;const t=s();return")"!==n[o]?(i=!0,0):(o++,t)}const r=((t,e)=>{var n;const o=t.trim();if(""===o)return null;if(o.endsWith("px")){const t=parseFloat(o);return Number.isFinite(t)?t:null}const i=co(o);if(null!==i)return i;if(o.endsWith("vw")){const t=parseFloat(o);return Number.isFinite(t)?window.innerWidth*t/100:null}if(o.endsWith("%")){const t=parseFloat(o),i=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return Number.isFinite(t)&&i&&i>=50?i*t/100:null}const s=+o;return Number.isFinite(s)?s:null})(t,e);return null===r?(i=!0,0):(o++,r)},a=s();return i||o!==n.length||!Number.isFinite(a)?null:a})(o.slice(o.indexOf("(")+1,-1),e);return null===t?0:Math.max(0,t)}if(o.endsWith("px"))return parseInt(o,10);const i=co(o);if(null!==i)return i;if(o.endsWith("%")){const t=null===(n=null==e?void 0:e.parentElement)||void 0===n?void 0:n.clientHeight;return!t||50>t?0:t*parseInt(o,10)/100}return window.innerHeight}return t};class ho{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.resizeNotifyDebounceId=null,this.resizeBurstEndId=null,this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,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;return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)}convertHeightToPixels(t){var e;const n=null!==(e=this.config.containerElement)&&void 0!==e?e:null;return uo(t,n)}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s,externalViewportHeight:r}=this.config;if(e){const t=this.convertHeightToPixels(e);if(0===t)return;const r=i||n;if(t>=r+o*n+(s||0))return;return Math.max(0,t-r)}if(!t&&void 0!==r&&r>0)return Math.max(0,r-(i||n));if(!t)return;const l=this.convertHeightToPixels(t);return 0!==l?Math.max(0,l-n):void 0}cancelPendingResizeNotify(){null!==this.resizeNotifyDebounceId&&(clearTimeout(this.resizeNotifyDebounceId),this.resizeNotifyDebounceId=null)}cancelResizeBurstEnd(){null!==this.resizeBurstEndId&&(clearTimeout(this.resizeBurstEndId),this.resizeBurstEndId=null)}scheduleResizeBurstEnd(){this.cancelResizeBurstEnd(),this.resizeBurstEndId=setTimeout(()=>{this.resizeBurstEndId=null,this.resizeBurstNeedsFinalFlush&&(this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()),this.resizeBurstNotifyCount=0},150)}scheduleResizeNotify(){this.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeNotifyDebounceId=setTimeout(()=>{this.resizeNotifyDebounceId=null,0===this.resizeBurstNotifyCount?(this.resizeBurstNotifyCount=1,this.resizeBurstNeedsFinalFlush=!1,this.notifySubscribers()):this.resizeBurstNeedsFinalFlush=!0,this.scheduleResizeBurstEnd()},100)}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})),this.initialNotifyPending?(this.initialNotifyPending=!1,this.cancelPendingResizeNotify(),this.notifySubscribers()):n&&this.scheduleResizeNotify()})}),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("height"in t||"maxHeight"in t||void 0!==t.totalRowCount||void 0!==t.externalViewportHeight){const t=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{contentHeight:t}),o=!0}if(t.containerElement&&t.containerElement!==n&&(this.resizeObserver&&n&&this.resizeObserver.unobserve(n),this.observeContainer(t.containerElement),o=!0),void 0!==t.rowHeight||void 0!==t.headerHeight||void 0!==t.footerHeight){const t=this.calculateHeaderHeight(this.state.maxHeaderDepth),e=this.calculateContentHeight();this.state=Object.assign(Object.assign({},this.state),{calculatedHeaderHeight:t,contentHeight:e}),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.cancelPendingResizeNotify(),this.cancelResizeBurstEnd(),this.resizeBurstNotifyCount=0,this.resizeBurstNeedsFinalFlush=!1,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class fo{constructor(t){this.subscribers=new Set,this.lastScrollTop=0,this.scrollTimeoutId=null,this.notifySubscribersRafId=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(){0!==this.subscribers.size&&this.subscribers.forEach(t=>t(this.state))}scheduleNotifySubscribersFromScroll(){0!==this.subscribers.size&&null===this.notifySubscribersRafId&&(this.notifySubscribersRafId=requestAnimationFrame(()=>{this.notifySubscribersRafId=null,this.notifySubscribers()}))}handleScroll(t,e,n,o){const i=t>this.lastScrollTop?"down":this.lastScrollTop>t?"up":"none";this.lastScrollTop=t,this.state={scrollTop:t,scrollLeft:e,scrollDirection:i,isScrolling:!0},null!==this.scrollTimeoutId&&clearTimeout(this.scrollTimeoutId),this.scrollTimeoutId=window.setTimeout(()=>{this.state=Object.assign(Object.assign({},this.state),{isScrolling:!1}),this.scheduleNotifySubscribersFromScroll()},150),this.config.onLoadMore&&this.config.infiniteScrollThreshold&&this.config.infiniteScrollThreshold>o-(t+n)&&this.config.onLoadMore(),this.scheduleNotifySubscribersFromScroll()}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),null!==this.notifySubscribersRafId&&(cancelAnimationFrame(this.notifySubscribersRafId),this.notifySubscribersRafId=null),this.subscribers.clear()}}class vo{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.headerTouchMoveHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.isTouchScrolling=!1,this.touchSettleTimeoutId=null,this.config=t}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t)}registerPane(t,e,n){var o;const i=this.panesBySection.get(t);if(Array.from(i).find(t=>t.element===e))return;const s=Array.from(i).find(t=>t.role===n);if(s&&(this.removeScrollListener(s.element),i.delete(s)),i.add({element:e,role:n}),("header"===n||"sticky"===n)&&(e.style.overflowX="hidden"),"sticky"!==n&&(this.addScrollListener(t,e,n),"body"===n&&this.addTouchTracking(t,e)),"header"===n){e.style.touchAction="none";const t=t=>t.preventDefault();this.headerTouchMoveHandlers.set(e,t),e.addEventListener("touchmove",t,{passive:!1})}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,n){this.removeScrollListener(e);const o=()=>{if(this.isSyncing)return;if(this.isTouchScrolling&&"body"!==n)return;const o=e.scrollLeft;this.scrollLeftBySection[t]=o,this.isSyncing=!0;const i=this.panesBySection.get(t);i&&i.forEach(({element:t,role:n})=>{t!==e&&t.scrollLeft!==o&&("scrollbar"===n&&this.isTouchScrolling||(t.scrollLeft=o))}),this.isTouchScrolling&&this.scheduleTouchSettle(t),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(o-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=o,this.config.onMainSectionScrollLeft(o)),this.isSyncing=!1};this.scrollHandlers.set(e,o),e.addEventListener("scroll",o,{passive:!0})}addTouchTracking(t,e){e.addEventListener("touchstart",()=>{this.isTouchScrolling=!0,null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null)},{passive:!0}),e.addEventListener("touchend",()=>this.scheduleTouchSettle(t),{passive:!0})}scheduleTouchSettle(t){null!==this.touchSettleTimeoutId&&clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=window.setTimeout(()=>{var e;this.touchSettleTimeoutId=null,this.isTouchScrolling=!1;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0,o=this.panesBySection.get(t);o&&(this.isSyncing=!0,o.forEach(({element:t,role:e})=>{"scrollbar"===e&&t.scrollLeft!==n&&(t.scrollLeft=n)}),this.isSyncing=!1)},100)}removeScrollListener(t){const e=this.scrollHandlers.get(t);e&&(t.removeEventListener("scroll",e),this.scrollHandlers.delete(t));const n=this.headerTouchMoveHandlers.get(t);n&&(t.removeEventListener("touchmove",n),this.headerTouchMoveHandlers.delete(t))}destroy(){null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null),["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}class po{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 wo=t=>"number"==typeof t.width?t.width:"string"==typeof t.width&&t.width.endsWith("px")?parseFloat(t.width):150,mo=(t,e)=>{const n=new Map,o=t.map(wo),i=o.reduce((t,e)=>t+e,0);if(0===i)return n;const s=e/i;if(.01>s-1)return n;const r=t.map((t,e)=>{const n="number"==typeof t.maxWidth?t.maxWidth:"string"==typeof t.maxWidth?parseFloat(t.maxWidth):NaN;return Number.isFinite(n)&&n>0?Math.max(n,o[e]):1/0}),l=new Map;let a=s;for(;;){const t=o.map((t,e)=>e).filter(t=>!l.has(t));if(0===t.length)break;const n=Array.from(l.values()).reduce((t,e)=>t+e,0),i=t.reduce((t,e)=>t+o[e],0);a=Math.max(1,(e-n)/i);const s=t.filter(t=>o[t]*a>r[t]);if(0===s.length)break;s.forEach(t=>l.set(t,r[t]))}const d=t.map((t,e)=>{const n=l.get(e);return Math.round(void 0!==n?n:o[e]*a)});let c=-1;for(let e=t.length-1;e>=0;e--)if(!l.has(e)){c=e;break}if(c>=0){const t=d.reduce((t,e,n)=>n===c?t:t+e,0);d[c]=Math.round(Math.min(Math.max(e-t,o[c]),r[c]))}return t.forEach((t,e)=>{n.set(t.accessor,d[e])}),n},go=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,isResizing:r,collapsedHeaders:l}=e;if(!n||0===o||r)return t;const a=Math.max(0,o-i-s),d=t.filter(t=>"left"===t.pinned),c=t.filter(t=>"right"===t.pinned),u=t.filter(t=>!t.pinned),h=ie(d,l),f=ie(c,l),v=ie(u,l),p=new Map;if(h.length>0&&mo(h,i).forEach((t,e)=>p.set(e,t)),f.length>0&&mo(f,s).forEach((t,e)=>p.set(e,t)),v.length>0&&a>0&&mo(v,a).forEach((t,e)=>p.set(e,t)),0===p.size)return t;const w=(t,e)=>{var n;if(pt(t))return t;const o=null!=e?e:t.pinned,i=null===(n=t.children)||void 0===n?void 0:n.map(t=>w(t,o)),s=p.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==s?{width:s,children:i}:{children:i})};return t.map(t=>w(t,t.pinned))};class bo{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new po(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new po(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,i=this.isResizingTracker.get();this.isResizingTracker.set(n);const s=this.containerWidthTracker.get();this.containerWidthTracker.set(o),i&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale(),Math.abs(o-s)>10&&!n&&this.config.autoExpandColumns&&this.triggerAutoScale()}triggerAutoScale(){this.onHeadersUpdate&&this.onHeadersUpdate(this.config)}applyAutoScale(t){return go(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class xo{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 yo{constructor(t){this.isListening=!1,this.handleClickOutside=t=>{var e,n,o,i,s,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===(s=(i=this.config).getSelectedColumns)||void 0===s?void 0:s.call(i))&&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 Ro{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(){if(this.headerContainer)if(this.isMainSectionScrollable){const t=null!=this.mainSection?this.mainSection.offsetWidth-this.mainSection.clientWidth:this.scrollbarWidth;this.scrollbarWidth=t,this.headerContainer.classList.add("st-header-scroll-padding"),this.headerContainer.style.setProperty("--st-after-width",t+"px")}else 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()}}function So(t){return t?t.offsetWidth-t.clientWidth:0}class Co{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,i,s;const r=null!==(n=e.theme)&&void 0!==n?n:"modern-light",l=null!==(o=e.className)&&void 0!==o?o:"",a=null!==(i=e.columnBorders)&&void 0!==i&&i,d=document.createElement("div");d.className=`simple-table-root st-wrapper theme-${r} ${l} ${a?"st-column-borders":""}`;const c=document.createElement("div");c.className="st-wrapper-container";const u=document.createElement("div");u.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid");const f=rt(e.enableColumnEditor,null===(s=e.columnEditorConfig)||void 0===s?void 0:s.showToggle);h.style.width=f>0?`calc(100% - ${f}px)`:"100%";const v=document.createElement("div");v.className="st-header-container",v.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=v;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const w=document.createElement("div");w.id="st-footer-container";const m="top"===e.footerPosition;m&&d.classList.add("st-footer-position-top");const g=document.createElement("div");return g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true"),g.className="st-sr-only",h.appendChild(v),h.appendChild(p),u.appendChild(h),m?(c.appendChild(w),c.appendChild(u)):(c.appendChild(u),c.appendChild(w)),d.appendChild(c),d.appendChild(g),t.appendChild(d),this.elements={rootElement:d,wrapperContainer:c,contentWrapper:u,content:h,headerContainer:v,bodyContainer:p,footerContainer:w,ariaLiveRegion:g},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}`}syncFooterPosition(t){if(!this.elements)return;const{rootElement:e,wrapperContainer:n,contentWrapper:o,footerContainer:i}=this.elements,s="top"===t;e.classList.toggle("st-footer-position-top",s);const r=n.querySelector(".st-horizontal-scrollbar-container");if(s)return i!==n.firstElementChild&&n.insertBefore(i,o),void(r&&n.appendChild(r));r&&r.parentElement===n?n.insertBefore(i,r):i!==n.lastElementChild&&n.appendChild(i)}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 Mo=(t,e)=>{const{sort:n,icons:o}=e;if(!n||n.key.accessor!==t.accessor)return null;const i=document.createElement("div");i.className="st-icon-container",i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",`Sort ${t.label} ${"asc"===n.direction?"descending":"ascending"}`);const s="asc"===n.direction?o.sortUp:o.sortDown;return s&&("string"==typeof s?i.innerHTML=s:(s instanceof HTMLElement||s instanceof SVGSVGElement)&&i.appendChild(s.cloneNode(!0))),C(i,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),C(i,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),i},Ho={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"},Io={string:["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"],number:["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"],boolean:["equals","isEmpty","isNotEmpty"],date:["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"],enum:["in","notIn","isEmpty","isNotEmpty"]},ko=["equals","notEquals","isEmpty","isNotEmpty"],Eo=(t,e)=>{var n;const o=null!==(n=Io[t])&&void 0!==n?n:ko;if(e&&e.length>0){const t=new Set(o),n=e.filter(e=>t.has(e));if(n.length>0)return n}return o},To=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Ao=t=>["between","notBetween","in","notIn"].includes(t),Oo=t=>["isEmpty","isNotEmpty"].includes(t),Po=t=>{let{children:e,containerRef:n,mainBodyRef:o,anchorElement:i,onClose:s,open:r,overflow:l="auto",width:a,maxWidth:d,positioning:c="fixed",className:u="",allowDescendantOverflow:h=!1}=t,f=h;const v=u.trim(),p="st-dropdown-content--allow-descendant-overflow",w=()=>{const t=[];return v&&t.push(v),f&&t.push(p),t.length?" "+t.join(" "):""},m=document.createElement("div");m.className="st-dropdown-content"+w(),m.style.position=c,m.style.overflow=f?"visible":l,a&&(m.style.width=a+"px"),d&&(m.style.maxWidth=d+"px"),m.addEventListener("click",t=>t.stopPropagation()),m.addEventListener("mousedown",t=>t.stopPropagation()),m.addEventListener("touchstart",t=>t.stopPropagation()),m.appendChild(e);let g=i;const b=t=>{r&&m&&!m.contains(t.target)&&(S(!1),null==s||s())},x=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===c){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}S(!1),null==s||s()}},y=t=>{"Escape"===t.key&&r&&(S(!1),null==s||s())},R=t=>{"Enter"===t.key&&x(t)},S=t=>{r=t,r?((()=>{if("fixed"!==c)return;const t=null!==(s=null!==(i=null!==(e=kt(g))&&void 0!==e?e:kt(null!=o?o:null))&&void 0!==i?i:kt(null!=n?n:null))&&void 0!==s?s:document.body;var e,i,s;m.parentElement!==t&&t.appendChild(m)})(),m.style.display="flex",(()=>{if(!r)return;if("absolute"===c&&!m.parentElement)return;if("fixed"===c&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t?requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),i=m.offsetHeight,s=a||m.offsetWidth;let r;r=n?n.getBoundingClientRect():o?o.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:()=>{}};const l=r.bottom-e.bottom,d=e.top-r.top;let u="bottom";(i>l&&d>=i||i>l&&d>l)&&(u="top");let h="left";if(s>r.right-e.right+e.width&&(h="right"),"fixed"===c)"bottom"===u?(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"===h?(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 void(m.style.visibility="visible");const n=t.getBoundingClientRect();"bottom"===u?(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"===h?(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-${u}-${h}${w()}`,m.style.visibility="visible"}):m.style.visibility="visible"})(),window.addEventListener("scroll",b,!0),document.addEventListener("mousedown",x,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",b,!0),document.removeEventListener("mousedown",x,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return r?S(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&S(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(a=t.width,m.style.width=a?a+"px":"auto"),void 0!==t.maxWidth&&(d=t.maxWidth,m.style.maxWidth=d?d+"px":""),void 0!==t.overflow&&(l=t.overflow,m.style.overflow=f?"visible":l),void 0!==t.allowDescendantOverflow&&(f=t.allowDescendantOverflow,m.classList.toggle(p,f),m.style.overflow=f?"visible":l)},destroy:()=>{S(!1),m.remove()},setOpen:S}},Wo=t=>{let{value:e,onChange:n,options:o,placeholder:i="Select...",className:s="",disabled:r=!1,containerRef:l,mainBodyRef:a}=t,d=!1,c=-1;const u=document.createElement("div");u.className=`st-custom-select ${s} ${r?"st-custom-select-disabled":""}`.trim();const h=document.createElement("button");h.type="button",h.className="st-custom-select-trigger",h.disabled=r,h.setAttribute("aria-haspopup","listbox"),h.setAttribute("aria-expanded","false"),h.setAttribute("aria-labelledby","select-label");const f=document.createElement("span");f.className="st-custom-select-value";const v=o.find(t=>t.value===e);f.textContent=v?v.label:i;const p=(()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","st-custom-select-arrow"),t.setAttribute("width","12"),t.setAttribute("height","12"),t.setAttribute("viewBox","0 0 12 12"),t.setAttribute("fill","none"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M3 4.5L6 7.5L9 4.5"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","1.5"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("fill","none"),t.appendChild(e),t})();h.appendChild(f),h.appendChild(p),u.appendChild(h);const w=document.createElement("div");w.className="st-custom-select-options",w.setAttribute("role","listbox");const m=()=>{w.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",()=>x(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(t.value))}),w.appendChild(o)})};m();const g=Po({children:w,containerRef:l,mainBodyRef:a,anchorElement:h,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"fixed",className:"st-custom-select-dropdown"}),b=t=>{e=t;const n=o.find(t=>t.value===e);f.textContent=n?n.label:i},x=t=>{b(t),S(!1),c=-1,m(),n(t)},y=()=>{if(!r){if(S(!d),d)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}m()}},R=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,m();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,m();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;b(t),S(!1),c=-1,m(),n(t)}break;case"Escape":t.preventDefault(),S(!1),c=-1,m()}},S=t=>{d=t,h.setAttribute("aria-expanded",""+d),d?(u.classList.add("st-custom-select-open"),document.addEventListener("keydown",R)):(u.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",R)),g.setOpen(d)};return h.addEventListener("click",y),{element:u,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);f.textContent=n?n.label:i,m()}void 0!==t.options&&(o=t.options,m()),void 0!==t.disabled&&(r=t.disabled,h.disabled=r,r?u.classList.add("st-custom-select-disabled"):u.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{h.removeEventListener("click",y),document.removeEventListener("keydown",R),g.destroy(),u.remove()},setOpen:S}},Fo=t=>{let{type:e="text",value:n,onChange:o,onEnter:i,placeholder:s="",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=s,void 0!==l&&(c.min=l),void 0!==a&&(c.max=a),void 0!==d&&(c.step=d),r&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.focus()})});const u=t=>{o(t.target.value)},h=t=>{"Enter"===t.key&&i&&(t.preventDefault(),i())};return c.addEventListener("input",u),c.addEventListener("keydown",h),{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&&(s=t.placeholder,c.placeholder=s),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&&(i=t.onEnter)},destroy:()=>{c.removeEventListener("input",u),c.removeEventListener("keydown",h),c.remove()}}},$o=t=>{let{onApply:e,onClear:n,canApply:o,showClear:i}=t;const s=document.createElement("div");s.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),s.appendChild(r);let d=null;const c=()=>{null==n||n()},u=()=>{const t=i&&!!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),s.appendChild(d)):!t&&d&&(d.removeEventListener("click",c),d.remove(),d=null)};return u(),{element:s,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(i=t.showClear,u()),void 0!==t.onApply&&(e=t.onApply),void 0!==t.onClear&&(n=t.onClear,u())},destroy:()=>{r.removeEventListener("click",a),d&&d.removeEventListener("click",c),s.remove()}}},Do=t=>{let{onChange:e,onClose:n,value:o}=t,i=o||new Date,s="days";const r=document.createElement("div");r.className="st-datepicker";const l=(t,e)=>new Date(t,e+1,0).getDate(),a=()=>{i=new Date(i.getFullYear(),i.getMonth()-1,1),v()},d=()=>{i=new Date(i.getFullYear(),i.getMonth()+1,1),v()},c=t=>{i=new Date(t,i.getMonth(),1),s="months",v()},u=t=>{const o=i.getFullYear(),s=i.getMonth(),r=new Date(o,s,t,12,0,0);i=r,e(r),null==n||n()},h=t=>{const o=new Date(i.getFullYear(),i.getMonth()-1,t,12,0,0);i=o,e(o),null==n||n()},f=t=>{const o=new Date(i.getFullYear(),i.getMonth()+1,t,12,0,0);i=o,e(o),null==n||n()},v=()=>{r.innerHTML="";const t=document.createElement("div");if(t.className="st-datepicker-header","days"===s){const e=document.createElement("button");e.className="st-datepicker-nav-btn",e.appendChild(Ke()),e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select month"),n.textContent=`${p=i,p.toLocaleString("default",{month:"long"})} ${i.getFullYear()}`,n.addEventListener("click",()=>{s="months",v()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.appendChild(_e()),o.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select year"),e.textContent=""+i.getFullYear(),e.addEventListener("click",()=>{s="years",v()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var p;r.appendChild(t);const w=document.createElement("div");var m;w.className=`st-datepicker-grid st-datepicker-${s}-grid`,"days"===s?(t=>{const e=i.getFullYear(),n=i.getMonth(),s=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",()=>h(n)),t.appendChild(o)}for(let i=1;s>=i;i++){const s=i===(new Date).getDate()&&n===(new Date).getMonth()&&e===(new Date).getFullYear(),r=new Date(o),l=i===r.getDate()&&n===r.getMonth()&&e===r.getFullYear(),a=document.createElement("div");a.className=`st-datepicker-day ${s?"today":""} ${l?"selected":""}`.trim(),a.textContent=""+i,a.addEventListener("click",()=>u(i)),t.appendChild(a)}const d=35-(r+s);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",()=>f(e)),t.appendChild(n)}})(w):"months"===s?(m=w,Array.from({length:12},(t,e)=>new Date(2e3,e,1).toLocaleString("default",{month:"short"})).forEach((t,e)=>{const n=e===i.getMonth(),o=document.createElement("div");o.className=("st-datepicker-month "+(n?"selected":"")).trim(),o.textContent=t,o.addEventListener("click",()=>(t=>{i=new Date(i.getFullYear(),t,1),s="days",v()})(e)),m.appendChild(o)})):(t=>{const e=i.getFullYear(),n=e-6;for(let o=n;n+12>o;o++){const n=o===e,i=document.createElement("div");i.className=("st-datepicker-year "+(n?"selected":"")).trim(),i.textContent=""+o,i.addEventListener("click",()=>c(o)),t.appendChild(i)}})(w),r.appendChild(w);const g=document.createElement("div");g.className="st-datepicker-footer";const b=document.createElement("button");b.className="st-datepicker-today-btn",b.textContent="Today",b.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);i=o,e(o),null==n||n()}),g.appendChild(b),r.appendChild(g)};return v(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,i=o||new Date,v()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},Lo=t=>{const{header:e}=t;switch(e.type){case"string":default:return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i,containerRef:s,mainBodyRef:r}=t;const l=Eo("string",e.filterOperators),a=l.includes("contains")?"contains":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=((null==n?void 0:n.value)||"")+"";const u=document.createElement("div");u.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const f=Wo({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:Ho[t]})),containerRef:s,mainBodyRef:r});h.appendChild(f.element),u.appendChild(h);let v=null,p=null,w=null;const m=()=>{const t=Object.assign({accessor:e.accessor,operator:d},To(d)&&{value:c});o(t)},g=()=>Oo(d)||""!==c.trim(),b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),To(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=Fo({type:"text",value:c,onChange:t=>{c=t,w&&w.update({canApply:g()})},onEnter:m,placeholder:"Filter...",autoFocus:!0}),v.appendChild(p.element),u.insertBefore(v,u.lastChild)),w&&w.update({canApply:g()})};return w=$o({onApply:m,onClear:i,canApply:g(),showClear:!!n}),u.appendChild(w.element),b(),{element:u,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=((null==n?void 0:n.value)||"")+"",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:g()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),u.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Eo("number",o.filterOperators),c=d.includes("equals")?"equals":d[0];let u=(null==i?void 0:i.operator)||c;d.includes(u)||(u=c);let h=((null==i?void 0:i.value)||"")+"",f=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=Wo({value:u,onChange:t=>{u=t,M()},options:d.map(t=>({value:t,label:Ho[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null;const S=()=>{const t={accessor:o.accessor,operator:u};To(u)?t.value=parseFloat(h):Ao(u)&&(t.values=[parseFloat(f),parseFloat(v)]),s(t)},C=()=>!!Oo(u)||(To(u)?""!==h.trim():!!Ao(u)&&""!==f.trim()&&""!==v.trim()),M=()=>{g&&(g.remove(),g=null),b&&(b.destroy(),b=null),x&&(x.destroy(),x=null),y&&(y.destroy(),y=null),To(u)?(g=document.createElement("div"),g.className="st-filter-section",b=Fo({type:"number",value:h,onChange:t=>{h=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"Enter number...",autoFocus:!0}),g.appendChild(b.element),p.insertBefore(g,p.lastChild)):Ao(u)&&(g=document.createElement("div"),g.className="st-filter-section",x=Fo({type:"number",value:f,onChange:t=>{f=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),y=Fo({type:"number",value:v,onChange:t=>{v=t,R&&R.update({canApply:C()})},onEnter:S,placeholder:"To..."}),g.appendChild(x.element),g.appendChild(y.element),p.insertBefore(g,p.lastChild)),R&&R.update({canApply:C()})};return R=$o({onApply:S,onClear:r,canApply:C(),showClear:!!i}),p.appendChild(R.element),M(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,u=(null==i?void 0:i.operator)||c,d.includes(u)||(u=c),h=((null==i?void 0:i.value)||"")+"",f=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",v=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:u}),b&&b.update({value:h}),x&&x.update({value:f}),y&&y.update({value:v}),R&&R.update({showClear:!!i,canApply:C()}),M())},destroy:()=>{m.destroy(),b&&b.destroy(),x&&x.destroy(),y&&y.destroy(),R&&R.destroy(),p.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i,containerRef:s,mainBodyRef:r}=t;const l=Eo("boolean",e.filterOperators),a=l.includes("equals")?"equals":l[0];let d=(null==n?void 0:n.operator)||a;l.includes(d)||(d=a);let c=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const u=document.createElement("div");u.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const f=Wo({value:d,onChange:t=>{d=t,b()},options:l.map(t=>({value:t,label:Ho[t]})),containerRef:s,mainBodyRef:r});h.appendChild(f.element),u.appendChild(h);let v=null,p=null,w=null;const m=()=>Oo(d)||""!==c,g=[{value:"true",label:"True"},{value:"false",label:"False"}],b=()=>{v&&(v.remove(),v=null),p&&(p.destroy(),p=null),To(d)&&(v=document.createElement("div"),v.className="st-filter-section",p=Wo({value:c,onChange:t=>{c=t,w&&w.update({canApply:m()})},options:g,containerRef:s,mainBodyRef:r}),v.appendChild(p.element),u.insertBefore(v,u.lastChild)),w&&w.update({canApply:m()})};return w=$o({onApply:()=>{const t={accessor:e.accessor,operator:d};To(d)&&(t.value="true"===c),o(t)},onClear:i,canApply:m(),showClear:!!n}),u.appendChild(w.element),b(),{element:u,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,d=(null==n?void 0:n.operator)||a,l.includes(d)||(d=a),c=void 0!==(null==n?void 0:n.value)?n.value+"":"true",f.update({value:d}),p&&p.update({value:c}),w&&w.update({showClear:!!n,canApply:m()}),b())},destroy:()=>{f.destroy(),p&&p.destroy(),w&&w.destroy(),u.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t;const d=Eo("date",o.filterOperators),c=d.includes("equals")?"equals":d[0];let u=(null==i?void 0:i.operator)||c;d.includes(u)||(u=c);let h=(null==i?void 0:i.value)?i.value+"":"",f=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",v=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=document.createElement("div");p.className="st-filter-container";const w=document.createElement("div");w.className="st-filter-section";const m=Wo({value:u,onChange:t=>{u=t,O()},options:d.map(t=>({value:t,label:Ho[t]})),containerRef:l,mainBodyRef:a});w.appendChild(m.element),p.appendChild(w);let g=null,b=null,x=null,y=null,R=null,S=null,C=null,M=null,H=null,I=null,k=null;const E=()=>!!Oo(u)||(To(u)?""!==h.trim():!!Ao(u)&&""!==f.trim()&&""!==v.trim()),T=t=>{if(!t)return"";const e=qe(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},A=(t,e,n,o=!1)=>{const i=document.createElement("div");i.className="st-date-input-container",i.style.position="relative";const s=document.createElement("input");s.type="text",s.className="st-filter-input",s.value=T(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",o&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?qe(t):new Date,c=Do({value:d,onChange:t=>{const n=t.toISOString().split("T")[0];e(n),s.value=T(n),u.setOpen(!1),r=!1},onClose:()=>{u.setOpen(!1),r=!1}}),u=Po({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:280});i.appendChild(s),i.appendChild(u.element);const h=()=>{r=!r,u.setOpen(r)},f=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,u.setOpen(r)):"Escape"===t.key&&(r=!1,u.setOpen(!1))};return s.addEventListener("click",h),s.addEventListener("keydown",f),{container:i,input:s,picker:c,dropdown:u,destroy:()=>{s.removeEventListener("click",h),s.removeEventListener("keydown",f),c.destroy(),u.destroy(),i.remove()}}},O=()=>{if(g&&(g.remove(),g=null),b&&(b=null),x&&(x=null),y&&(y=null),R&&(R.destroy(),R=null),S&&(S.destroy(),S=null),C&&(C.destroy(),C=null),M&&(M.destroy(),M=null),H&&(H.destroy(),H=null),I&&(I.destroy(),I=null),To(u)){g=document.createElement("div"),g.className="st-filter-section";const t=A(h,t=>{h=t,k&&k.update({canApply:E()})},"Select date...",!0);b=t.container,R=t.picker,M=t.dropdown,g.appendChild(b),p.insertBefore(g,p.lastChild)}else if(Ao(u)){g=document.createElement("div"),g.className="st-filter-section";const t=A(f,t=>{f=t,k&&k.update({canApply:E()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=A(v,t=>{v=t,k&&k.update({canApply:E()})},"To date...",!1);x=t.container,S=t.picker,H=t.dropdown,y=e.container,C=e.picker,I=e.dropdown,g.appendChild(x),g.appendChild(y),p.insertBefore(g,p.lastChild)}k&&k.update({canApply:E()})};return k=$o({onApply:()=>{const t={accessor:o.accessor,operator:u};To(u)?t.value=h:Ao(u)&&(t.values=[f,v]),s(t)},onClear:r,canApply:E(),showClear:!!i}),p.appendChild(k.element),O(),{element:p,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,u=(null==i?void 0:i.operator)||c,d.includes(u)||(u=c),h=(null==i?void 0:i.value)?i.value+"":"",f=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",v=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",m.update({value:u}),k&&k.update({showClear:!!i,canApply:E()}),O())},destroy:()=>{m.destroy(),R&&R.destroy(),S&&S.destroy(),C&&C.destroy(),M&&M.destroy(),H&&H.destroy(),I&&I.destroy(),k&&k.destroy(),p.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i}=t;const s=e.enumOptions||[],r=s.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 u=document.createElement("div");u.className="st-enum-filter-options";const h=document.createElement("div");h.className="st-enum-select-all";const f=rn({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],b(),y&&y.update({canApply:x()})}}),v=document.createElement("span");v.className="st-enum-option-label st-enum-select-all-label",v.textContent="Select All",f.element.appendChild(v),h.appendChild(f.element),u.appendChild(h);let p=null,w=null;s.length>10&&(p=document.createElement("div"),p.className="st-enum-search",w=Fo({type:"text",value:a,onChange:t=>{a=t,b()},placeholder:"Search..."}),p.appendChild(w.element),u.appendChild(p));const m=document.createElement("div");u.appendChild(m);const g=[],b=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?s.filter(t=>t.label.toLowerCase().includes(a.toLowerCase())):s;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=rn({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;f.element.querySelector("input").checked=e,y&&y.update({canApply:x()})}}),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;f.element.querySelector("input").checked=e};b(),c.appendChild(u),d.appendChild(c);const x=()=>0!==l.length&&l.length!==r.length,y=$o({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):i()},onClear:i,canApply:x(),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="",w&&w.update({value:a}),b(),y&&y.update({showClear:!!n,canApply:x()}))},destroy:()=>{f.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},jo=(t,e)=>{const{filters:n,handleApplyFilter:o,handleClearFilter:i,icons:s}=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=s.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}if(d){const t=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)";d.style.color=t,"none"!==d.getAttribute("fill")&&(d.style.fill=t)}let c=!1,u=null,h=null;const f=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null),u&&(u.destroy(),u=null),d&&(d.style.color="var(--st-button-active-background-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-button-active-background-color)"))},s=()=>{i(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null),u&&(u.destroy(),u=null),d&&(d.style.color="var(--st-header-icon-color)","none"!==d.getAttribute("fill")&&(d.style.fill="var(--st-header-icon-color)"))},a=e.mainBodyRef.current||void 0;u=Lo({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),h=Po({children:u.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null)},open:!0,positioning:"fixed",maxWidth:320,allowDescendantOverflow:!0})}else h&&(h.destroy(),h=null),u&&(u.destroy(),u=null)};return C(l,"click",f),C(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),f(t))}),l},No=(t,e)=>{var n,o;const{icons:i}=e;if(!gt(t)||t.isSelectionColumn&&e.enableRowSelection)return null;const s=(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-collapsible-header-icon st-expand-icon-container "+(s?"collapsed":"expanded"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${s?"Expand":"Collapse"} ${t.label} column`),r.setAttribute("aria-expanded",!s+"");const l=i.expand;l&&("string"==typeof l?r.innerHTML=l:(l instanceof HTMLElement||l instanceof SVGSVGElement)&&r.appendChild(l.cloneNode(!0)));const a=n=>{var o,i;n.stopPropagation();const s=(null!==(i=null===(o=e.getCollapsedHeaders)||void 0===o?void 0:o.call(e))&&void 0!==i?i:e.collapsedHeaders).has(t.accessor);e.setCollapsedHeaders(e=>{const n=new Set(e);return s?n.delete(t.accessor):n.add(t.accessor),n})};return C(r,"click",a),C(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},Bo=(t,e,n=[])=>{for(let o=0;t.length>o;o++){const i=t[o];if(i.accessor===e)return[...n,o];if(i.children&&i.children.length>0){const t=Bo(i.children,e,[...n,o]);if(t)return t}}return null},zo=(t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n},Vo=(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},qo=(t,e)=>{if(t.pinned)return t.pinned;const n=wt(e,t.accessor);return n?qo(n,e):void 0},Go=(t,e)=>{const n=qo(t,e);return"left"===n?"left":"right"===n?"right":"main"};function Ko(t,e,n){const o=Mn(t);if(e.length!==n.length)return{newHeaders:o,emergencyBreak:!0};for(let t=0;e.length-1>t;t++)if(e[t]!==n[t])return{newHeaders:o,emergencyBreak:!0};const i=e[e.length-1],s=n[n.length-1];if(i===s)return{newHeaders:o,emergencyBreak:!1};const r=zo(o,e);if(0>i||0>s||i>=r.length||s>=r.length)return{newHeaders:o,emergencyBreak:!0};const[l]=r.splice(i,1);return r.splice(s,0,l),{newHeaders:Vo(o,e,r),emergencyBreak:!1}}const _o=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a}=e,d=a?st:0,c=(a?i+1:i)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=t.querySelector(".st-horizontal-scrollbar-left"),h=null==u?void 0:u.firstElementChild;o>0&&u&&h&&(u.style.width=o+"px",h.style.width=s+"px");const f=t.querySelector(".st-horizontal-scrollbar-middle"),v=null==f?void 0:f.firstElementChild;n>0&&f&&v&&(v.style.width=n+"px");const p=t.querySelector(".st-horizontal-scrollbar-right"),w=null==p?void 0:p.firstElementChild;if(i>0&&p&&w&&(p.style.width=c+"px",w.style.width=r+"px"),d>0){const e=Array.from(t.children).find(t=>t instanceof HTMLElement&&!t.classList.contains("st-horizontal-scrollbar-left")&&!t.classList.contains("st-horizontal-scrollbar-middle")&&!t.classList.contains("st-horizontal-scrollbar-right"));e&&(e.style.width=d-1.5+"px")}},Uo=(t,e)=>{if(e){const n=t.querySelector(".st-horizontal-scrollbar-left"),o=t.querySelector(".st-horizontal-scrollbar-middle"),i=t.querySelector(".st-horizontal-scrollbar-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),i instanceof HTMLElement&&e.unregisterPane("pinned-right",i)}t.remove()},Jo=({containerWidth:t,leftWidth:e,rightWidth:n})=>t>0?Math.max(0,t-e-n):void 0,Yo=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,s=0;t.forEach(t=>{if(pt(t))return;const e=Yt(t,n).reduce((t,e)=>t+ee(e),0);"left"===t.pinned?o+=e:"right"===t.pinned?i+=e:s+=e});const r=o,l=i;if(e&&e>0){const t=e*Mt(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:vt(o),rightWidth:vt(i),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},Xo=(t,e)=>{if(t.pinned)return t.pinned;const n=wt(e,t.accessor);return n?Xo(n,e):void 0},Qo=(t,e,n,o)=>{var i,s;const r=[],l=[],a=[];t.forEach(e=>{if(pt(e))return;const n=Xo(e,t);"left"===n?r.push(e):"right"===n?a.push(e):l.push(e)});const d=(t,i,s)=>{var r,l;if(pt(t))return i;const a=i;if(t.children&&t.children.length>0){const l=null==e?void 0:e.has(t.accessor),c=t.children.filter(t=>{if(pt(t))return!1;const e=t.showWhen||tt;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:ee(t,o);return s.set(t.accessor,{left:a,width:e}),i=a+e,c.forEach(t=>{i=d(t,i,s)}),i}c.forEach(t=>{i=d(t,i,s)}),s.set(t.accessor,{left:a,width:i-a})}else{const e=null!==(l=null==n?void 0:n.get(t.accessor))&&void 0!==l?l:ee(t,o);s.set(t.accessor,{left:i,width:e}),i+=e}return i},c=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=d(t,n,e)}),e},u=c(r),h=c(l),f=c(a),v=new Map;u.forEach((t,e)=>v.set(e,t)),h.forEach((t,e)=>v.set(e,t)),f.forEach((t,e)=>v.set(e,t)),v.forEach((t,e)=>{const{left:n,width:i}=t,s=xt({accessor:e,rowId:"header"}),r=Pt(o,s);u.has(e),f.has(e),r&&(r.style.left=n+"px",r.style.width=i+"px"),Tt(o,`.st-cell[data-accessor="${Wt(e+"")}"]`).forEach(t=>{t.style.left=n+"px",t.style.width=i+"px"})});const p=At(o,".st-body-container"),w=null!==(i=null==p?void 0:p.clientWidth)&&void 0!==i?i:0,m=Yo({headers:t,containerWidth:w>0?w:void 0,collapsedHeaders:e}),{leftWidth:g,rightWidth:b,mainWidth:x,leftContentWidth:y,rightContentWidth:R}=m;if(g>0){const t=At(o,".st-header-pinned-left"),e=At(o,".st-body-pinned-left");t&&(t.style.width=g+"px"),e&&(e.style.width=g+"px")}if(b>0){const t=At(o,".st-header-pinned-right"),e=At(o,".st-body-pinned-right");t&&(t.style.width=b+"px"),e&&(e.style.width=b+"px")}const S=null!==(s=o instanceof Element?kt(o):null)&&void 0!==s?s:p?kt(p):null,C=At(S,".st-horizontal-scrollbar-container"),M=At(S,".st-body-main"),H=!!At(S,".st-column-editor:not(.st-column-editor--no-toggle)");C&&M&&p&&M.scrollWidth-M.clientWidth>1&&_o(C,{mainBodyRef:M,mainBodyWidth:x,pinnedLeftWidth:g,pinnedRightWidth:b,pinnedLeftContentWidth:y,pinnedRightContentWidth:R,tableBodyContainerRef:p,enableColumnEditor:H})},Zo=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n,shrinkFloors:o})=>{if(0>e){const o=Math.abs(e),i=t.reduce((t,e)=>t+(n.get(e.accessor)||100),0);if(0===i)return;return void t.forEach((e,s)=>{const r=n.get(e.accessor)||100;let l=o*(r/i);if(s===t.length-1){const e=t.slice(0,s).reduce((t,e)=>{const o=n.get(e.accessor)||100;return t+(("number"==typeof e.width?e.width:100)-o)},0);l=o-e}e.width=r+l})}let i=e;for(;i>.5;){const e=t.map(t=>{var e;const i=n.get(t.accessor)||100,s=Math.max(null!==(e=null==o?void 0:o.get(t.accessor))&&void 0!==e?e:Ct,Ct),r=Math.min(s,i);return{column:t,headroom:Math.max(0,i-r),initialWidth:i,minWidth:r}}).filter(t=>t.headroom>0);if(0>=e.length)break;{const t=e.reduce((t,e)=>t+e.headroom,0);let n=0;const o=i;e.forEach((i,s)=>{let r=o*(i.headroom/t);r=Math.min(r,i.headroom),s===e.length-1&&(r=Math.min(o-n,i.headroom)),i.column.width=i.initialWidth-r,n+=r}),i-=n}}},ti=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:o,headers:i,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:u,sectionViewportWidth:h=0,shrinkFloors:f,startWidth:v})=>{const p=t=>t.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-(t=>{var e;const n=s.get(t.accessor)||100,o=Math.max(null!==(e=null==f?void 0:f.get(t.accessor))&&void 0!==e?e:Ct,Ct);return Math.min(o,n)})(e))},0),w=t=>{if(!d||0>=n||0>=t)return t;const e=i.some(t=>"left"===t.pinned&&!pt(t)),o=i.some(t=>"right"===t.pinned&&!pt(t)),r=((t,e,n)=>t*Mt(t,e,n))(n,e,o),l=Math.max(0,r-Array.from(s.values()).reduce((t,e)=>t+e,0));return Math.min(t,l)};if(r&&t.length>1){const n=ie(c,e),i=n.findIndex(e=>e.accessor===t[0].accessor),r=n.findIndex(e=>e.accessor===t[t.length-1].accessor);if(-1===i||-1===r)return;const l=0===i,m=r===n.length-1;let g;g="left"===d&&m||"right"===d&&l?[]:l?n.slice(r+1):m||a?n.slice(0,i):n.slice(r+1);const b=Array.from(s.values()).reduce((t,e)=>t+e,0),x=!d&&h>0?h:u>0?Math.max(u,b):b+Math.abs(o)+1;if(o>0){const e=Math.max(0,x-b),n=Math.max(0,o-e),i=g.length>0?p(g):0,r=Math.min(n,i);let l;l=d?0===g.length?w(o):Math.min(o,w(e)+r):o;const a=(v+l)/t.reduce((t,e)=>t+(s.get(e.accessor)||100),0);t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*a,Ct)}),r>0&&g.length>0&&Zo({columnsToShrink:g,totalCompensation:r,initialWidthsMap:s,shrinkFloors:f})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(v+o,Ct*t.length),i=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*i,Ct)});const r=Math.max(0,v-n-Math.max(0,b-x));r>0&&g.length>0&&Zo({columnsToShrink:g,totalCompensation:-r,initialWidthsMap:s})}return}const m=ie(c,e),g=m.findIndex(t=>t.accessor===l.accessor);if(-1===g)return;const b=0===g,x=g===m.length-1;let y;if(y="left"===d&&x||"right"===d&&b?[]:b?m.slice(g+1):x||a?m.slice(0,g):m.slice(g+1),0===y.length){const t=o>0?w(o):o;return void(l.width=Math.max(v+t,Ct))}const R=Array.from(s.values()).reduce((t,e)=>t+e,0),S=!d&&h>0?h:u>0?Math.max(u,R):R+Math.abs(o)+1;if(o>0){const t=Math.max(0,S-R);if(t>=o){const t=w(o);return void(l.width=v+t)}const e=o-t,n=p(y),i=Math.min(e,n);if(d){const e=w(t)+i;l.width=v+e}else l.width=v+o;i>0&&Zo({columnsToShrink:y,totalCompensation:i,initialWidthsMap:s,shrinkFloors:f})}else{const t=Math.max(v+o,Ct),e=v-t;l.width=t;const n=Math.max(0,e-Math.max(0,R-S));n>0&&Zo({columnsToShrink:y,totalCompensation:-n,initialWidthsMap:s})}},ei=({mainLeafHeaders:t,mainInitialWidths:e,newMainAvailable:n,shrinkFloors:o})=>{const i=Array.from(e.values()).reduce((t,e)=>t+e,0);if(0>=n||0>=i)return;const s=n/i;if(s>=1){let o=0;return void t.forEach((i,r)=>{const l=e.get(i.accessor)||100;r===t.length-1?i.width=n-o:(i.width=Math.round(l*s),o+=i.width)})}t.forEach(t=>{var n;const i=e.get(t.accessor)||100,r=Math.min(Math.max(null!==(n=null==o?void 0:o.get(t.accessor))&&void 0!==n?n:Ct,Ct),i);t.width=Math.max(Math.round(i*s),r)})},ni=(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"),i=null==o?void 0:o.querySelector(".st-body-container");return i instanceof HTMLElement?i.clientWidth:n.clientWidth},oi=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:s,mainBodyRef:r,onColumnWidthChange:l,onAutoExpandNaturalWidths:a,reverse:d=!1,setHeaders:c,setIsResizing:u,shrinkFloors:h,startWidth:f})=>{o.preventDefault();const v="clientX"in o?o.clientX:o.touches[0].clientX,p="touches"in o;if(!i||pt(i))return;const w=kt(null==r?void 0:r.current),m=ni(n,r);u(!0);const g=Xo(i,s),b=oe(i);let x;if(i.children&&i.children.length>0){const t=Yt(i,e);x=t.length>0?t:[i]}else x=[i];const y=new Map;let R=0,S=0;if(t){const t=s.filter(t=>t.pinned===g);if(ie(t,e).forEach(t=>{const e=ee(t,w);y.set(t.accessor,e)}),m>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=Yo({headers:s,containerWidth:m,collapsedHeaders:e});R="left"===g?t:"right"===g?n:o;const i=Math.max(0,m-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;S=l>0?Math.min(i,l):i}}let C=!1;const M=new Map;let H=[];if(t&&g&&m>0){const t=ie(s.filter(t=>t.pinned===g),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"===g&&o===t.length-1||"right"===g&&0===e}else{const e=x[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===g&&o===t.length-1||"right"===g&&0===o}if(n){C=!0;const t=s.filter(t=>!t.pinned);H=ie(t,e),H.forEach(t=>{M.set(t.accessor,ee(t,w))})}}}const I=(n,o=!1)=>{const r="right"===g?v-n:n-v;if(t){const t=s.filter(t=>t.pinned===g);if(ti({childrenToResize:x,collapsedHeaders:e,containerWidth:m,delta:r,headers:s,initialWidthsMap:y,isParentResize:x.length>1,resizedHeader:x.length>0?x[x.length-1]:i,reverse:d,rootPinned:g,sectionHeaders:t,sectionWidth:R,sectionViewportWidth:g?R:S,shrinkFloors:h,startWidth:f}),C&&H.length>0){const t=x.reduce((t,e)=>{const n=y.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);ei({mainLeafHeaders:H,mainInitialWidths:M,newMainAvailable:Math.max(0,S-t),shrinkFloors:h})}}else{const t=(({header:t,headers:e,collapsedHeaders:n,tableRoot:o})=>{const i=At(o,".st-body-container");if(!i||0===i.clientWidth)return 1e3;const s=i.clientWidth;if(!t.pinned)return 1/0;const r=e.some(t=>"left"===t.pinned&&!pt(t)),l=e.some(t=>"right"===t.pinned&&!pt(t)),a=s*Mt(s,r,l)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>pt(e)?t:t+Yt(e,n).reduce((t,e)=>t+ee(e,o),0),0),d=oe(t);return d>a?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),d):a})({header:i,headers:s,collapsedHeaders:e,tableRoot:w});x.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:i})=>{const s=e.reduce((t,e)=>Math.min(t,oe(e)),40),r=e.reduce((t,e)=>t+("number"==typeof e.width?e.width:150),0),l=Math.max(Math.min(o+t,i),s)-r;e.forEach(t=>{const e="number"==typeof t.width?t.width:150;t.width=Math.max(e+l*(e/r),n)})})({delta:r,leafHeaders:x,minWidth:b,startWidth:f,maxWidth:t}):x[0].width=Math.max(Math.min(f+r,t),b),s.forEach(t=>{ne(t,w)})}if(o){if(t&&a){const t=new Map;x.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const n=[...s];c(n);const o=new Map;x.forEach(t=>{"number"==typeof t.width&&o.set(t.accessor,t.width)}),C&&H.forEach(t=>{"number"==typeof t.width&&o.set(t.accessor,t.width)}),Qo(s,e,o,w)}else Qo(s,e,void 0,w)};let k=null,E=null,T=v;const A=t=>{T=t,E=t,null===k&&(k=requestAnimationFrame(()=>{null!==E&&(I(E,!1),E=null),k=null}))};if(p){const t=t=>{A(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==k&&(cancelAnimationFrame(k),k=null),I(T,!0),u(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{A(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==k&&(cancelAnimationFrame(k),k=null),I(T,!0),u(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},ii=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=kt(o))&&void 0!==n?n:o:null},si=(t,e)=>{var n;for(const o of t){if(o.accessor===e)return o;if(null===(n=o.children)||void 0===n?void 0:n.length){const t=si(o.children,e);if(t)return t}}},ri=(t,e)=>{const{columnResizing:n}=e;if(!n||t.isSelectionColumn&&e.enableRowSelection)return null;const o=document.createElement("div");o.className="st-header-resize-handle-container",o.setAttribute("role","separator"),o.setAttribute("aria-label",`Resize ${t.label} column`),o.setAttribute("aria-orientation","vertical");const i=document.createElement("div");i.className="st-header-resize-handle",o.appendChild(i);const s=t=>({rows:e.rows,header:t,styleRoot:ii(e),autoSizeMode:t.autoSizeMode,sortIcon:e.icons.sortUp,expandIcon:e.icons.expand,onRendererHostDiscard:e.onRendererHostDiscard}),r=()=>{var n,o,i;const s=null!==(o=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==o?o:e.collapsedHeaders,r=e.getHeaders();return((t,e,n)=>{const o=ie(t,e);for(const t of o){const e=Pt(n,xt({accessor:t.accessor,rowId:"header"})),o=null==e?void 0:e.offsetWidth;null!=o&&o>0&&(t.width=o)}})(r,s,ii(e)),{headers:r,header:null!==(i=si(r,t.accessor))&&void 0!==i?i:t,collapsedHeaders:s}};let l=0;const a=()=>{const n=Date.now();120>n-l||(l=n,(()=>{var n;const o=Pt(ii(e),xt({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:i,collapsedHeaders:l}=r();(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:i,reverse:s,headerCellElement:r,getTargetLeafWidth:l,onAutoExpandNaturalWidths:a,shrinkFloors:d})=>{var c;if(!t||pt(t))return;const u=kt(null==i?void 0:i.current),h=ni(o,i),f=Xo(t,e);let v;if(t.children&&t.children.length>0){const e=Yt(t,n);v=e.length>0?e:[t]}else v=[t];const p=new Map;let w=0,m=0;const g=e.filter(t=>t.pinned===f);if(ie(g,n).forEach(t=>{const e=ee(t,u);p.set(t.accessor,e)}),h>0){const{leftWidth:t,rightWidth:o,mainWidth:s}=Yo({headers:e,containerWidth:h,collapsedHeaders:n});w="left"===f?t:"right"===f?o:s;const r=Math.max(0,h-t-o),l=null!=(null==i?void 0:i.current)&&i.current.clientWidth>0?i.current.clientWidth:0;m=l>0?Math.min(r,l):r}let b=!1;const x=new Map;let y=[];if(f&&h>0){const o=ie(e.filter(t=>t.pinned===f),n);if(o.length>0){let i=!1;if(v.length>1){const t=o.findIndex(t=>t.accessor===v[0].accessor),e=o.findIndex(t=>t.accessor===v[v.length-1].accessor);i="left"===f&&e===o.length-1||"right"===f&&0===t}else{const e=v[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);i="left"===f&&n===o.length-1||"right"===f&&0===n}if(i){b=!0;const t=e.filter(t=>!t.pinned);y=ie(t,n),y.forEach(t=>{x.set(t.accessor,ee(t,u))})}}}const R=v.reduce((t,e)=>t+l(e),0),S=null!==(c=null==r?void 0:r.offsetWidth)&&void 0!==c?c:v.reduce((t,e)=>t+ee(e,u),0);if(ti({childrenToResize:v,collapsedHeaders:n,containerWidth:h,delta:R-S,headers:e,initialWidthsMap:p,isParentResize:v.length>1,resizedHeader:v.length>0?v[v.length-1]:t,reverse:s,rootPinned:f,sectionHeaders:g,sectionWidth:w,sectionViewportWidth:f?w:m,shrinkFloors:d,startWidth:S}),b&&y.length>0){const t=v.reduce((t,e)=>{const n=p.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0);ei({mainLeafHeaders:y,mainInitialWidths:x,newMainAvailable:Math.max(0,m-t),shrinkFloors:d})}if(a){const t=new Map;v.forEach(e=>{"number"==typeof e.width&&t.set(e.accessor,e.width)}),t.size>0&&a(t)}const C=new Map;v.forEach(t=>{"number"==typeof t.width&&C.set(t.accessor,t.width)}),b&&y.forEach(t=>{"number"==typeof t.width&&C.set(t.accessor,t.width)}),Qo(e,n,C,u)})({header:i,headers:t,collapsedHeaders:l,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:o,getTargetLeafWidth:t=>de(t.accessor,s(t)).width,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,shrinkFloors:null===(n=e.getShrinkFloors)||void 0===n?void 0:n.call(e)});const a=[...t];return e.setHeaders(a),void(e.onColumnWidthChange&&e.onColumnWidthChange(a))}const{headers:i,header:l,collapsedHeaders:a}=r(),d=de(l.accessor,s(l)).width,c=Bo(i,l.accessor);if(!c)return;const u=zo(i,c),h=c[c.length-1],f=u.map((t,e)=>e===h?Object.assign(Object.assign({},t),{width:d}):t),v=Vo(i,c,f);v.forEach(t=>ne(t,ii(e)));const p=f[h],w=new Map;p&&"number"==typeof p.width&&w.set(p.accessor+"",p.width),Qo(v,a,w,ii(e)),e.setHeaders(v),e.onColumnWidthChange&&e.onColumnWidthChange(v)})())};return C(o,"mousedown",n=>{var o;if(n.detail>=2)return n.preventDefault(),void a();const i=null===(o=Pt(ii(e),xt({accessor:t.accessor,rowId:"header"})))||void 0===o?void 0:o.offsetWidth;S(()=>{var t;const{headers:o,header:s,collapsedHeaders:l}=r();oi({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:s,headers:o,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=i?i:at})},10)}),C(o,"touchstart",n=>{var o;const i=n,s=null===(o=Pt(ii(e),xt({accessor:t.accessor,rowId:"header"})))||void 0===o?void 0:o.offsetWidth;S(()=>{var t;const{headers:n,header:o,collapsedHeaders:l}=r();oi({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:l,containerWidth:e.containerWidth,event:i,forceUpdate:e.forceUpdate,header:o,headers:n,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,shrinkFloors:null===(t=e.getShrinkFloors)||void 0===t?void 0:t.call(e),startWidth:null!=s?s:at})},10)}),C(o,"dblclick",a),o},li=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",C(o,"blur",()=>{const i=o.value;i!==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)})(i);const s=n.parentElement;if(s){const o=ai(t,e,i);s.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),C(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},ai=(t,e,n)=>{const o=t.isSelectionColumn&&e.enableRowSelection,i=void 0!==n?n:t.label||"",s=document.createElement("span");if(s.className="st-header-label-text "+("right"===t.align?"right-aligned":"center"===t.align?"center-aligned":"left-aligned"),o){if("single"!==e.rowSelectionMode){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return rn({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);s.appendChild(t)}}else s.textContent=i;if(t.tooltip&&!o){let e=null,n=null;const o=()=>{var t;return!!(null===(t=s.closest(".simple-table-root"))||void 0===t?void 0:t.classList.contains("st-column-reordering"))},i=()=>{var i;if(o())return;n&&(clearTimeout(n),n=null),e&&(null===(i=e.parentElement)||void 0===i||i.removeChild(e),e=null);const r=H();n=setTimeout(()=>{if(!s.isConnected||r!==H()||o())return void(n=null);const i=s.getBoundingClientRect();if(i.width>0&&i.height>0){e=document.createElement("div"),e.className="st-tooltip",e.textContent=t.tooltip||"",e.style.position="fixed",e.style.zIndex="10000";const n=200,o=40;let r=i.left+i.width/2-n/2,l=i.bottom+8;8>r?r=8:r+n>window.innerWidth-8&&(r=window.innerWidth-n-8),l+o>window.innerHeight-8&&(l=i.top-o-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}n=null},500)},r=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};C(s,"mouseenter",i),C(s,"mouseleave",r)}return s};let di=null;const ci=t=>{const e=[],n=t=>{for(const o of t)o.children&&o.children.length>0?n(o.children):e.push(o.accessor+"")};return n(t),e.join(">")},ui=(t,e,n,o)=>{const{columnReordering:i,draggedHeaderRef:s,hoveredHeaderRef:r}=o;!i||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),C(t,"dragstart",t=>{var i;null!==di&&(clearTimeout(di),di=null),s.current=n,g(Date.now()),e.classList.add("st-dragging");const r=e.closest(".simple-table-root");null==r||r.classList.add("st-column-reordering"),I(e),null===(i=o.animationCoordinator)||void 0===i||i.setColumnReordering(!0)}),C(t,"dragend",t=>{var n;t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),null===(n=o.animationCoordinator)||void 0===n||n.setColumnReordering(!1);const i=e.closest(".simple-table-root"),l=()=>{var t,e;(null===(t=o.animationCoordinator)||void 0===t?void 0:t.isColumnReordering())||((null===(e=o.animationCoordinator)||void 0===e?void 0:e.hasInFlight())?requestAnimationFrame(l):null==i||i.classList.remove("st-column-reordering"))};requestAnimationFrame(l),null!==di&&clearTimeout(di),di=setTimeout(()=>{di=null,s.current||(o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(Mn(o.getHeaders())))},10)}),C(e,"dragover",t=>{const i=t;i.preventDefault(),s.current&&S(()=>{const t=o.getHeaders();if(!t)return;const{screenX:l,screenY:a}=i,d=Math.sqrt(Math.pow(l-w.screenX,2)+Math.pow(a-w.screenY,2));r.current=n;const c=s.current;if(!c)return;if(n.accessor===c.accessor)return;const u=e.classList.contains("st-flip-active"),h="function"==typeof e.getAnimations&&e.getAnimations().some(t=>{const e=t.id;return e===D||"st-column-reorder"===e});if(u||h)return;let f,v=!1;if(Go(c,t)!==Go(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=Mn(t);let i=!1;try{const t=Go(n,o),s=o.findIndex(t=>t.accessor===e.accessor),r=o.findIndex(t=>t.accessor===n.accessor);if(-1===s||-1===r)return i=!0,{newHeaders:o,emergencyBreak:i};const[l]=o.splice(s,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),i=!0}return{newHeaders:o,emergencyBreak:i}}({headers:t,draggedHeader:c,hoveredHeader:n});f=e.newHeaders,v=e.emergencyBreak}else{const e=Bo(t,c.accessor),o=Bo(t,n.accessor);if(!e||!o)return;const i=e.length,s=o.length;let r=o;if(i!==s){const t=s-i;t>0&&(r=o.slice(0,-t))}if((b=e).length!==(x=r).length||1!==b.length&&!b.slice(0,-1).every((t,e)=>t===x[e]))return;const l=Ko(t,e,r);f=l.newHeaders,v=l.emergencyBreak}var b,x;if(10>d)return;if(ci(f)===ci(t))return;if(v)return;const y=o.essentialAccessors;if(y&&y.size>0&&!Pn(f,y))return;const R=Date.now();null!=m&&ci(f)===ci(m)&&(150>R-p||40>d)||(g(R),w={screenX:l,screenY:a},m=t,o.onTableHeaderDragEnd(f))},50)}),C(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},hi=(t,e)=>{var n;const{header:o,colIndex:i,parentHeader:s}=t,{collapsedHeaders:r,columnBorders:l,enableHeaderEditing:a,selectedColumns:d,columnsWithSelectedCells:c,draggedHeaderRef:u}=e,h=o.isSelectionColumn&&e.enableRowSelection,f=!!(null==o?void 0:o.sortable),v=r.has(o.accessor),p=!(!o.children||0===o.children.length)&&(!v||o.children.some(t=>{const e=t.showWhen||tt;return"parentCollapsed"===e||"always"===e})),w=null==s?void 0:s.singleRowChildren,m=p&&!o.singleRowChildren,g=!!l&&(o.children&&0!==o.children.length?ut(o,i).includes(e.lastHeaderIndex):i===e.lastHeaderIndex),b=!(!e.selectableColumns||h)&&ut(o,i).some(t=>d.has(t)),x=!h&&ut(o,i).some(t=>c.has(t));return["st-header-cell",(null===(n=u.current)||void 0===n?void 0:n.accessor)===o.accessor?"st-dragging":"",f?"clickable":"",m?"parent":"",w?"st-sub-header":"",g?"st-last-column":"",a&&!h?"st-header-editable":"",b?"st-header-selected":"",x&&!b?"st-header-has-highlighted-cell":""].filter(Boolean).join(" ")},fi=(t,e,n,o,i)=>{var s;const r=ai(e,o),l=e.headerRenderer({accessor:e.accessor,colIndex:n,header:e,components:{sortIcon:i.sortIcon||void 0,filterIcon:i.filterIcon||void 0,collapseIcon:i.collapseIcon||void 0,labelContent:r}});l instanceof HTMLElement&&l.parentElement===t||(null===(s=o.onRendererHostDiscard)||void 0===s||s.call(o,t),I(t),t.innerHTML="",l instanceof HTMLElement?t.appendChild(l):t.appendChild(r))},vi=(t,e,n,o=0)=>{var i,l;const a=n.pinned?n.containerWidth:null!==(i=n.mainSectionViewportWidth)&&void 0!==i?i:n.containerWidth||(null===(l=t.parentElement)||void 0===l?void 0:l.clientWidth)||t.clientWidth||0,d=n.pinned||!1===n.enableVirtualization?e:((t,e,n,o=100)=>{if(0===t.length)return[];const i=e-o,s=e+n+o;return t.filter(t=>t.left+t.width>=i&&s>=t.left)})(e,o,a);(t=>{0===t.length||t.map(t=>t.colIndex)})(e);const c=x(t),u=new Set(d.map(t=>xt({accessor:t.header.accessor,rowId:"header"}))),h=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>h.set(t,e));const v=t=>"header-band-"+Math.round(t.top),p=t=>{var e;return(null!==(e=h.get(Math.round(t.top)))&&void 0!==e?e:0)+1},w=R(t),m=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,g="horizontal"===m?(t=>{const e=new Set,n=t=>{var o;for(const i of t)pt(i)||(e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children))};return n(t),e})(n.headers):null;let b=!1;c.forEach((e,o)=>{var i,s,r;if(!u.has(o)){w.delete(o);const l=null!==(i=e.getAttribute("data-accessor"))&&void 0!==i?i:"",a=null!==(s=null==g?void 0:g.has(l))&&void 0!==s&&s;"horizontal"===m&&n.animationCoordinator&&!a&&n.animationCoordinator.shouldRetain(o)?n.animationCoordinator.shrinkOutCell({cellId:o,element:e,container:t,axis:m}):(null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,e),e.remove()),c.delete(o),b=!0}}),b&&I(t);const y=[];d.forEach(e=>{const o=xt({accessor:e.header.accessor,rowId:"header"});if(c.has(o)){const i=c.get(o);s(t,v(e),p(e)),i.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&i.setAttribute("aria-colspan",bt(e.header,n.headers,n.collapsedHeaders)+"");const r=w.get(o);if(!r||r.left!==e.left||r.top!==e.top||r.width!==e.width||r.height!==e.height){O(i,e.left,e.top);const t=i.dataset.stAccordionGrow;"horizontal"!==t&&(i.style.width=e.width+"px"),"vertical"!==t&&(i.style.height=e.height+"px"),w.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&n.enableRowSelection&&"function"==typeof n.areAllRowsSelected&&((t,e)=>{sn(t,e)})(i,n.areAllRowsSelected());const l=hi(e,n);if(i.className!==l&&(i.className=l),gt(e.header)){const t=n.collapsedHeaders.has(e.header.accessor);i.setAttribute("aria-expanded",!t+""),((t,e,n)=>{cn(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(i,t,e.header.label)}const a=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`;i.dataset.stIconState!==a&&(((t,e,n,o)=>{const i=Mo(e,n),s=jo(e,n),r=No(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&fi(l,e,o,n,{sortIcon:i,filterIcon:s,collapseIcon:r}))}const l=t.querySelector('.st-icon-container[aria-label*="Sort"]'),a=t.querySelector('.st-icon-container[aria-label*="Filter"]'),d=t.querySelector(".st-expand-icon-container");if(null==l||l.remove(),null==a||a.remove(),null==d||d.remove(),"right"===e.align)r&&t.insertBefore(r,t.firstChild),s&&t.insertBefore(s,t.firstChild),i&&t.insertBefore(i,t.firstChild);else{const e=t.querySelector(".st-header-resize-handle-container"),n=null!=e&&e!==t.firstChild;i&&(n?t.insertBefore(i,e):t.appendChild(i)),s&&(n?t.insertBefore(s,e):t.appendChild(s)),r&&(n?t.insertBefore(r,e):t.appendChild(r))}})(i,e.header,n,e.colIndex),i.dataset.stIconState=a)}else y.push({cell:e,cellId:o})});const S=n.animationCoordinator&&n.accordionAxis?n.accordionAxis:null,M=[];y.forEach(({cell:e,cellId:o})=>{const i=((t,e)=>{var n,o,i;const{header:s,colIndex:r}=t,{reverse:l}=e,a=s.isSelectionColumn&&e.enableRowSelection,d=hi(t,e),c=document.createElement("div");if(c.className=d,c.id=xt({accessor:s.accessor,rowId:"header"}),c.setAttribute("data-accessor",s.accessor+""),c.setAttribute("role","columnheader"),c.setAttribute("aria-colindex",r+1+""),s.children&&s.children.length>0){const t=bt(s,e.headers,e.collapsedHeaders);c.setAttribute("aria-colspan",t+"")}if(gt(s)){const t=null!==(o=null===(n=e.getCollapsedHeaders)||void 0===n?void 0:n.call(e))&&void 0!==o?o:e.collapsedHeaders;c.setAttribute("aria-expanded",!t.has(s.accessor)+"")}s.sortable&&((null===(i=e.sort)||void 0===i?void 0:i.key.accessor)===s.accessor?c.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):c.setAttribute("aria-sort","none"));const u=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.sortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(s,!!s.filterable);if(u){const t="header-desc-"+s.accessor;c.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=u,c.appendChild(e)}c.style.position="absolute",O(c,t.left,t.top),c.style.width=t.width+"px",c.style.height=t.height+"px";const h=Mo(s,e),f=jo(s,e),v=No(s,e),p=l!==("right"===e.pinned);if(p){const t=ri(s,e);t&&c.appendChild(t)}s.headerRenderer||"right"!==s.align||(v&&c.appendChild(v),f&&c.appendChild(f),h&&c.appendChild(h));const w=document.createElement("div");if(w.className="st-header-label",s.headerRenderer)fi(w,s,r,e,{sortIcon:h,filterIcon:f,collapseIcon:v});else{const t=ai(s,e);w.appendChild(t)}if(C(w,"click",t=>{a||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const i=ut(e,n),s=i.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&s&&!t.shiftKey){const n=t.currentTarget.closest(".st-header-cell");if(n){const t=n.querySelector(".st-header-label");if(t){const n=t.querySelector(".st-header-label-text");if(n){n.innerHTML="";const t=li(e,o,n);if(n.appendChild(t),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(i);const e=i[0],n=Array.from(t).sort((t,e)=>t-e);let o=n[0],s=Math.abs(e-o);n.forEach(t=>{const n=Math.abs(e-t);s>n&&(s=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),...i];return new Set([...Array.from(t),...r])}):o.selectColumns&&o.selectColumns(i),o.setSelectedCells(new Set),o.setInitialFocusedCell(null)}o.onColumnSelect&&o.onColumnSelect(e),!o.selectableColumns&&e.sortable&&o.onSort(e.accessor)}})(t,s,r,e)}),C(w,"dblclick",t=>{a||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.sortable&&n.onSort(e.accessor)})(0,s,e)}),ui(w,c,s,e),c.appendChild(w),s.headerRenderer||"right"===s.align||(v&&c.appendChild(v),f&&c.appendChild(f),h&&c.appendChild(h)),!p){const t=ri(s,e);t&&c.appendChild(t)}return e.headerRegistry&&!s.isSelectionColumn&&e.headerRegistry.set(s.accessor+"",{setEditing:t=>{if(t){const t=w.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=li(s,e,t);t.appendChild(n)}}}}),c})(e,n);i.dataset.stIconState=`${n.sort&&n.sort.key.accessor===e.header.accessor?n.sort.direction:"none"}|${n.filters&&n.filters[e.header.accessor]?"1":"0"}`,S&&n.animationCoordinator&&!n.animationCoordinator.hasSnapshotEntry(o)&&!n.animationCoordinator.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===S?i.style.height="0px":i.style.width="0px",i.dataset.stAccordionGrow=S,M.push({element:i,cell:e})),s(t,v(e),p(e)).appendChild(i),c.set(o,i),w.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}),S&&M.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of M)t.isConnected&&("vertical"===S?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),n.pinned||(t.dataset.lastScrollLeft=o+""),d.forEach(t=>{const e=c.get(xt({accessor:t.header.accessor,rowId:"header"}));if(!e)return;const n=(t=>{const e=t.top,n=t.top+t.height,o=f.filter(t=>t>=e-1&&n-1>t).length;return o>0?o:1})(t);n>1?e.setAttribute("aria-rowspan",n+""):e.hasAttribute("aria-rowspan")&&e.removeAttribute("aria-rowspan")}),r(t)},pi=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},wi=t=>{const{position:e,rowHeight:n,displayStrongBorder:o,heightOffsets:i,customTheme:s=In,isSticky:r=!1,sectionWidthPx:l}=t,a=document.createElement("div");a.className="st-row-separator "+(o?"st-last-group-row":"");const d=r?e:Un({position:e,rowHeight:n,heightOffsets:i,customTheme:s});pi(a,l),r?(a.style.position="absolute",a.style.top="0",a.style.transform=`translateY(${d}px)`):a.style.transform=`translate3d(0, ${d}px, 0)`;const c=document.createElement("div");c.style.width="100%",a.appendChild(c);let u=null;return a.addEventListener("mousedown",t=>{t.preventDefault();const e=a.style.pointerEvents;a.style.pointerEvents="none";const n=document.elementFromPoint(t.clientX,t.clientY);if(a.style.pointerEvents=e,!n)return;const o=n.closest(".st-cell");if(o instanceof HTMLElement){u=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)}}),a.addEventListener("mouseup",t=>{if(u){const e=u.getBoundingClientRect(),n=new MouseEvent("mouseup",{bubbles:!0,cancelable:!0,view:window,button:0,clientX:t.clientX,clientY:e.top+e.height/2});u.dispatchEvent(n),u=null}}),a},mi=new WeakMap,gi=new WeakMap,bi=t=>(gi.has(t)||gi.set(t,new Map),gi.get(t)),xi=(t,e,n,o=0,i,l,a,d)=>{var c,h,f,v,p,w,m,g;const b=n.pinned?null!==(h=null!==(c=n.containerWidth)&&void 0!==c?c:t.clientWidth)&&void 0!==h?h:0:null!==(p=null!==(v=null!==(f=n.mainSectionViewportWidth)&&void 0!==f?f:n.containerWidth)&&void 0!==v?v:t.clientWidth)&&void 0!==p?p:0,x=n.pinned||!1===n.enableVirtualization?e:((t,e,n,o=100)=>{if(0===t.length)return[];const i=e-o,s=e+n+o;return t.filter(t=>t.left+t.width>=i&&s>=t.left)})(e,o,b),y=u(t),R=(t=>(mi.has(t)||mi.set(t,new Map),mi.get(t)))(t),S=new Set(x.map(t=>{var e;return xt({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let C=null;if(a)if(d)C=d;else{C=new Map;for(const t of e){const e=xt({accessor:t.header.accessor,rowId:null!==(w=t.stableRowKey)&&void 0!==w?w:t.rowId});C.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const M=a&&n.accordionAxis?n.accordionAxis:null,H="horizontal"===M?(t=>{const e=new Set,n=t=>{var o;for(const i of t)pt(i)||(e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children))};return n(t),e})(n.headers):null,I=(null==i?void 0:i.length)?new Set(i.map(t=>t.position)):new Set(x.map(t=>t.rowIndex));y.forEach((e,o)=>{var i,s,r;if(!S.has(o)){const l=e.getAttribute("data-row-id");l&&bn(l,e);const d=null==C?void 0:C.get(o);if(a&&a.shouldRetain(o)&&d&&(a.shouldAnimateTransition({beforeTop:parseFloat(e.style.top||"0"),afterTop:d.top,beforeLeft:parseFloat(e.style.left||"0"),afterLeft:d.left,cellHeight:d.height||parseFloat(e.style.height||"0"),cellWidth:d.width||parseFloat(e.style.width||"0"),container:t})||a.isCellRenderedInScrollerViewport(e,t)||a.shouldRetainDomCellAtScrollExtrema(o,t)))return a.retainCell({cellId:o,element:e,container:t,newPosition:d}),void y.delete(o);if(a&&"horizontal"===M&&a.shouldRetain(o)){const n=null!==(i=e.getAttribute("data-accessor"))&&void 0!==i?i:"";if(null===(s=null==H?void 0:H.has(n))||void 0===s||!s)return a.shrinkOutCell({cellId:o,element:e,container:t,axis:M}),void y.delete(o)}((t,e)=>{const n=wn.get(t);void 0!==n&&(null==e||e.delete(n),wn.delete(t))})(e,n.cellRegistry),null===(r=n.onRendererHostDiscard)||void 0===r||r.call(n,e),e.remove(),y.delete(o)}});const k=bi(t);R.forEach((t,e)=>{I.has(e)||(t.remove(),R.delete(e),k.delete(e))});const E=null!==(m=n.maxHeaderDepth)&&void 0!==m?m:1,T=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId)+""},A=t=>t.tableRow.position+E+1,P=(t,e)=>{var o;n.enableRowSelection?t.setAttribute("aria-selected",(null===(o=n.isRowSelected)||void 0===o?void 0:o.call(n,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},W=!!n.rowGrouping&&n.rowGrouping.length>0,F=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:zt(t.rowId))+""},$=new Map;if(W&&i&&i.length>0){const t=new Map;for(const e of i){const n=null!==(g=e.rowIndexPath)&&void 0!==g?g:[],o=`${e.depth}|${n.slice(0,-1).join("/")}`;let i=t.get(o);i||(i=[],t.set(o,i)),i.push(e)}t.forEach(t=>{t.slice().sort((t,e)=>t.position-e.position).forEach((e,n)=>{$.set(F(e),{posinset:n+1,setsize:t.length})})})}const D=(t,e)=>{if(!W)return;const o=e.tableRow;t.setAttribute("aria-level",o.depth+1+"");const i=$.get(F(o));i&&(t.setAttribute("aria-posinset",i.posinset+""),t.setAttribute("aria-setsize",i.setsize+""));const{expandable:s,expanded:r}=(t=>{var e;const o=t.depth,i=null===(e=n.rowGrouping)||void 0===e?void 0:e[o],s=!!i&&Ut(t.row,i),r=!!n.rowGrouping&&n.rowGrouping.length>o,l=!n.canExpandRowGroup||n.canExpandRowGroup(t.row);return s&&r&&l||n.onRowGroupExpand&&r&&l?{expandable:!0,expanded:Jt(Kt(t),o,new Set(n.expandedDepths),n.expandedRows,n.collapsedRows)}:{expandable:!1,expanded:!1}})(o);s?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},L=[],j=new Set;x.forEach(e=>{var o,i,r,d,c;const u=xt({accessor:e.header.accessor,rowId:null!==(o=e.stableRowKey)&&void 0!==o?o:e.rowId});if(!j.has(u))if(j.add(u),y.has(u)){const o=y.get(u),a=s(t,T(e),A(e));if(P(a,e),D(a,e),l)((t,e)=>{O(t,e.left,e.top);const n=t.dataset.stAccordionGrow;"horizontal"!==n&&(t.style.width=e.width+"px"),"vertical"!==n&&(t.style.height=e.height+"px")})(o,e);else{if(Cn(o,e,n),e.header.isSelectionColumn&&n.enableRowSelection&&n.isRowSelected){const t=n.isRowSelected(e.rowId);sn(o,t)}if(e.header.expandable){const t=new Set(n.expandedDepths),s=null!==(r=null===(i=n.getExpandedRows)||void 0===i?void 0:i.call(n))&&void 0!==r?r:n.expandedRows,l=null!==(c=null===(d=n.getCollapsedRows)||void 0===d?void 0:d.call(n))&&void 0!==c?c:n.collapsedRows,a=Jt(Kt(e.tableRow),e.depth,t,s,l);cn(o,a)}}}else{if(a&&a.hasSnapshotEntry(u)&&!a.shouldMountIncomingCell({cellId:u,afterTop:e.top,afterLeft:e.left,cellHeight:e.height,cellWidth:e.width,container:t}))return;L.push({cell:e,cellId:u})}});const N=[];L.forEach(({cell:e,cellId:o})=>{const i=null==a?void 0:a.claimRetainedForReuse(o,t);if(i){(t=>{mn.delete(t)})(i),Cn(i,e,n);const r=s(t,T(e),A(e));return P(r,e),D(r,e),i.parentElement!==r&&r.appendChild(i),void y.set(o,i)}const r=Sn(e,n);M&&a&&!a.hasSnapshotEntry(o)&&!a.wasRenderableBeforeAccordion(e.header.accessor+"")&&("vertical"===M?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=M,N.push({element:r,cell:e}));const l=s(t,T(e),A(e));P(l,e),D(l,e),l.appendChild(r),y.set(o,r)}),M&&N.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of N)t.isConnected&&("vertical"===M?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((t,e,n,o,i)=>{const s=bi(t),r=n.pinned&&e.length>0?e.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,l=(()=>{var e,o,i;if(n.pinned){const e=Math.max("number"==typeof n.pinnedSectionWidthPx&&n.pinnedSectionWidthPx>0?n.pinnedSectionWidthPx:t.clientWidth,r);return e>0?e:void 0}const s=null!==(i=null!==(o=null!==(e=n.mainSectionContainerWidth)&&void 0!==e?e:n.containerWidth)&&void 0!==o?o:t.clientWidth)&&void 0!==i?i:0;return s>0?s:void 0})();let a=[];if(i&&i.length>0)a=i.map((t,e)=>({rowIndex:t.position,position:t.position,displayStrongBorder:e>0&&i[e-1].isLastGroupRow}));else if(e.length>0){const t=[];let n,o=-1,i=null;e.forEach(e=>{e.rowIndex!==o&&(i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:n}),n=i||void 0,o=e.rowIndex,i=e)}),i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:n}),a=t.map(({rowIndex:t,firstCell:e,prevCell:n})=>{var o,i;return{rowIndex:t,position:e.tableRow.position,displayStrongBorder:null!==(i=null===(o=null==n?void 0:n.tableRow)||void 0===o?void 0:o.isLastGroupRow)&&void 0!==i&&i}})}0!==a.length&&a.forEach(({rowIndex:e,position:i,displayStrongBorder:r})=>{var a;const d=s.get(e),c=Un({position:i,rowHeight:n.rowHeight,heightOffsets:n.heightOffsets,customTheme:null!==(a=n.customTheme)&&void 0!==a?a:In});if(o.has(e)){const t=o.get(e);(!d||d.topPx!==c||d.displayStrongBorder!==r||d.sectionWidthPx!==l)&&(pi(t,l),(null==d?void 0:d.displayStrongBorder)!==r&&(r?t.classList.add("st-last-group-row"):t.classList.remove("st-last-group-row")),d&&d.topPx===c||(t.style.transform=`translate3d(0, ${c}px, 0)`),s.set(e,{position:i,topPx:c,displayStrongBorder:r,sectionWidthPx:l}))}else{const a=wi({position:i,rowHeight:n.rowHeight,displayStrongBorder:r,heightOffsets:n.heightOffsets,customTheme:n.customTheme,isSticky:!1,sectionWidthPx:l});t.appendChild(a),o.set(e,a),s.set(e,{position:i,topPx:c,displayStrongBorder:r,sectionWidthPx:l})}})})(t,x,n,R,i),r(t)};function yi(t){var e,n;const o=new Map,i=t.rows.filter(t=>!t.nestedTable&&!t.stateIndicator),s=void 0!==t.pageStartIndex;for(const r of i){let i;i=s?(r.position-(null!==(e=t.pageStartIndex)&&void 0!==e?e:0))*t.rowHeight:t.customTheme?Jn({position:r.position,rowHeight:t.rowHeight,heightOffsets:t.heightOffsets,customTheme:t.customTheme}):r.position*t.rowHeight;const l=null!==(n=r.stableRowKey)&&void 0!==n?n:zt(r.rowId);for(const e of t.headerPositions){const n=xt({accessor:e.accessor,rowId:l});o.set(n,{left:e.left,top:i,width:e.width,height:t.rowHeight})}}return o}function Ri(t,e){const n=[],o=t=>{if(pt(t))return;const i=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(pt(t))return!1;const e=t.showWhen||"parentExpanded";return i?"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}const Si=new WeakMap;let Ci=1;class Mi{constructor(){this.bodyCellsCache=new Map,this.headerCellsCache=new Map,this.contextCache=new Map}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}:${t.excludeFromRender||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeadersStructureHash(t,e=new Set){return Ri(t,e).map(t=>`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}:${t.excludeFromRender||""}`).sort().join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","selectRowOnClick","rowSelectionMode","activeRowId","cellUpdateFlash","oddColumnBackground","hoverRowBackground","oddEvenRowBackground","rowHeight","containerWidth","isLoading","mainSectionViewportWidth","mainSectionContainerWidth","enableVirtualization"].map(e=>`${e}:${t[e]}`).join("|");e+="|getRowClass:"+(t=>{if("function"!=typeof t)return"none";let e=Si.get(t);return void 0===e&&(e=Ci++,Si.set(t,e)),e+""})(t.getRowClass);const n=t.heightOffsets;if(Array.isArray(n)&&n.length>0){let t="";for(let e=0;n.length>e;e++){const o=n[e];t+=`${o[0]}:${o[1]};`}e+="|offsets:"+t}else e+="|offsets:none";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(",")),t.pinned&&(e+="|pinned:"+t.pinned),void 0!==t.pinnedSectionWidthPx&&(e+="|pinnedSectionWidthPx:"+t.pinnedSectionWidthPx),e}getCachedBodyCells(t,e,n,o,i,s,r,l=0,a,d,c){var u;const h=this.createHeadersHash(e),f=this.createHeadersStructureHash(e,o),v=this.createHeightOffsetsHash(s),p=null!=a&&null!=d&&null!=c,w=this.bodyCellsCache.get(t),m=p?w&&w.deps.fullTableRowsRef===a&&void 0!==w.deps.bandStart&&void 0!==w.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(w.deps.bandStart,w.deps.bandEnd):w&&w.deps.rowsRef===n;if(w&&w.deps.headersHash===h&&w.deps.collapsedHeadersSize===o.size&&w.deps.rowHeight===i&&w.deps.heightOffsetsHash===v&&m&&w){if(!p)return w.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of w.cells){const o=t.get(n.tableRow.position);void 0!==o&&e.push(n.rowIndex!==o?Object.assign(Object.assign({},n),{rowIndex:o}):n)}return e}if(w&&w.deps.headersStructureHash===f&&w.deps.collapsedHeadersSize===o.size&&w.deps.rowHeight===i&&w.deps.heightOffsetsHash===v&&m){const i=Ri(e,o),s=new Map;let r=0;i.forEach((t,e)=>{const n="number"==typeof t.width?t.width:150;s.set(t.accessor+"",{left:r,width:n,leafIndex:e}),r+=n});const a=[];for(const t of w.cells){const e=s.get(t.header.accessor+"");e&&a.push(Object.assign(Object.assign({},t),{header:null!==(u=i[e.leafIndex])&&void 0!==u?u:t.header,left:e.left,width:e.width,colIndex:l+e.leafIndex}))}if(this.bodyCellsCache.set(t,{cells:a,deps:Object.assign(Object.assign({},w.deps),{headersHash:h,headersStructureHash:f})}),!p)return a;const d=new Map;n.forEach((t,e)=>{d.set(t.position,e)});const c=[];for(const t of a){const e=d.get(t.tableRow.position);void 0!==e&&c.push(t.rowIndex!==e?Object.assign(Object.assign({},t),{rowIndex:e}):t)}return c}let g,b,x;if(p){const t=a.length;b=Math.max(0,d-28),x=Math.min(t,c+28),g=a.slice(b,x)}else g=n;const y=function(t,e,n,o,i,s,r=0){const l=[],a=e.filter(t=>!t.nestedTable&&!t.stateIndicator),d=Ri(t,n),c=new Map;let u=0;return d.forEach(t=>{const e="number"==typeof t.width?t.width:150;c.set(t.accessor,{left:u,width:e}),u+=e}),a.forEach((t,e)=>{const n=s?Jn({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}):e*o,a=t.position%2==1;d.forEach((i,s)=>{var d,u;const h=c.get(i.accessor);l.push({header:i,row:t.row,rowIndex:e,colIndex:r+s,rowId:zt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:a,tableRow:t,left:null!==(d=null==h?void 0:h.left)&&void 0!==d?d:0,top:n,width:null!==(u=null==h?void 0:h.width)&&void 0!==u?u:150,height:o})})}),l}(e,g,o,i,s,r,l);if(this.bodyCellsCache.set(t,{cells:y,deps:Object.assign({headersHash:h,headersStructureHash:f,rowsRef:g,collapsedHeadersSize:o.size,rowHeight:i,heightOffsetsHash:v},p&&{fullTableRowsRef:a,bandStart:b,bandEnd:x})}),!p)return y;const R=new Map;n.forEach((t,e)=>{R.set(t.position,e)});const S=[];for(const t of y){const e=R.get(t.tableRow.position);void 0!==e&&S.push(t.rowIndex!==e?Object.assign(Object.assign({},t),{rowIndex:e}):t)}return S}getCachedHeaderCells(t,e,n,o,i,s=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===i)return r.cells;const a=function(t,e,n,o,i=0){const s=[];let r=i,l=0;const a=(t,i,d)=>{if(pt(t))return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{if(pt(t))return!1;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;s.push({header:t,left:l,top:i*o,width:c,height:(n-i)*o,colIndex:r,parentHeader:d}),r++,l+=c;let u=0;return e.forEach(e=>{u+=a(e,i,t)}),c+u}if(0===e.length){const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:i*o,width:e,height:(n-i)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}const u=l,h=r;let f=0;return e.forEach(e=>{f+=a(e,i+1,t)}),s.push({header:t,left:u,top:i*o,width:f,height:o,colIndex:h,parentHeader:d}),f}{const e="number"==typeof t.width?t.width:150;return s.push({header:t,left:l,top:i*o,width:e,height:(n-i)*o,colIndex:r,parentHeader:d}),r++,l+=e,e}};return t.forEach(t=>a(t,0)),s}(e,n,o,i,s);return this.headerCellsCache.set(t,{cells:a,deps:{headersHash:l,collapsedHeadersSize:n.size,maxDepth:o,headerHeight:i}}),a}getCachedContext(t,e,n,o){const i=this.contextCache.get(t),s="left"===n||"right"===n?o:void 0,r=Object.assign(Object.assign({},e),{pinned:n,pinnedSectionWidthPx:s}),l=this.createContextHash(r);return i&&i.deps.contextHash===l?i.context:(this.contextCache.set(t,{context:r,deps:{contextHash:l}}),r)}clearBody(){this.bodyCellsCache.clear()}clearHeader(){this.headerCellsCache.clear()}clearContext(){this.contextCache.clear()}clearAll(){this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear()}}function Hi(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}class Ii{constructor(){this.headerSections=new Map,this.bodySections=new Map,this.caches=new Mi,this.bodySectionSnapshots=new Map,this.nextColIndexMap=new Map,this.stateRowsMap=new Map,this.nestedGridRowsMap=new Map,this.mainHeaderScrollPaint=null,this.mainBodyScrollPaint=null}renderHeaderSection(t){const{headers:e,collapsedHeaders:n,pinned:o,maxHeaderDepth:i,headerHeight:s,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",this.headerSections.set(d,c));const u=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===u.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: ${i*s}px;\n `;const h=this.caches.getCachedHeaderCells(d,u,n,i,s,a),f=h.length>0?Math.max(...h.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,f);const v=this.caches.getCachedContext("header-"+d,r,o,l),p=c.scrollLeft;return vi(c,h,v,p),o||p===c.scrollLeft||(c.scrollLeft=p),o||(this.mainHeaderScrollPaint={section:c,absoluteCells:h,cachedContext:v}),c}renderBodySection(t){var e,o,i,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:u,rowHeight:h,heightOffsets:f,totalRowCount:v,startColIndex:p=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:b,allFlattenedRows:x,pageStartIndex:y,animationCoordinator:R}=t,S=d||"main";let C=this.bodySections.get(S);C||(C=document.createElement("div"),C.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(S,C));const M=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===M.length)return C.style.display="none",C;C.style.display="";const H=((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!==v?v:l.length,h,f,null!==(e=c.customTheme)&&void 0!==e?e:In);C.style.cssText=`\n position: relative;\n ${void 0!==u?`width: ${u}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${H}px;\n `;const I=this.caches.getCachedBodyCells(S,M,l,a,h,f,null!==(o=c.customTheme)&&void 0!==o?o:In,p,m,g,b),k=null!==(i=null!=x?x:m)&&void 0!==i?i:l;this.captureSnapshotConfig(S,M,a,k,h,f,null!==(s=c.customTheme)&&void 0!==s?s:In,void 0!==x?null!=y?y:0:void 0);const E=R?this.getFullSectionLayout(S):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(S,I.length>0&&T>0?p+I.length/T:p);const A=this.caches.getCachedContext("body-"+S,c,d,u);return xi(C,I,A,C.scrollLeft,l,w,R,null!=E?E:void 0),function(t,e,o,i,s,r,l,a){var d,c;const u=null!==(d=null==r?void 0:r.isEnabled())&&void 0!==d&&d,h=u?`transform ${r.getDuration()}ms ${r.getEasing()}, height ${r.getDuration()}ms ${r.getEasing()}`:"",f=o.filter(t=>t.nestedTable),v=new Set(f.map(t=>Kt(t)));let p=l.get(e);p||(p=new Map,l.set(e,p)),p.forEach((t,e)=>{var n;v.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),p.delete(e))});const w={rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(c=s.customTheme)&&void 0!==c?c:{},theme:s.theme,rowGrouping:s.rowGrouping,depth:0,loadingStateRenderer:s.loadingStateRenderer,errorStateRenderer:s.errorStateRenderer,emptyStateRenderer:s.emptyStateRenderer,icons:s.icons,createNestedTable:s.createNestedTable};f.forEach(o=>{var r,l,d,c,f,v,m;const g=Kt(o),b=p.get(g);if(b){const t=Jn({position:o.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(r=s.customTheme)&&void 0!==r?r:{}}),e=Ft({calculatedHeight:o.nestedTable.calculatedHeight,customHeight:null===(l=o.nestedTable.expandableHeader.nestedTable)||void 0===l?void 0:l.height,customTheme:null!==(d=s.customTheme)&&void 0!==d?d:{}}),n=b.lastTop!==t,i=b.lastWrapperHeight!==e;return(n||i)&&(b.element.style.transition=h,n&&(b.element.style.transform=`translate3d(0, ${t}px, 0)`),i&&(b.element.style.height=e+"px"),b.lastTop=t,b.lastWrapperHeight=e),b.element.dataset.index=o.position+"",void(b.lastPosition=o.position)}const x=a.get(e),y=x&&x.has(g)?s.rowHeight:0,R=Ft({calculatedHeight:o.nestedTable.calculatedHeight,customHeight:null===(c=o.nestedTable.expandableHeader.nestedTable)||void 0===c?void 0:c.height,customTheme:null!==(f=s.customTheme)&&void 0!==f?f:{}}),S=Jn({position:o.position,rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(v=s.customTheme)&&void 0!==v?v:{}});if(i){const e=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridSpacer called without tableRow.nestedTable");const o=t.nestedTable.expandableHeader.nestedTable,i=Ft({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),s=Jn({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.setAttribute("role","presentation"),r.setAttribute("aria-hidden","true"),r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${s}px, 0)`,r.style.height=i+"px",r.style.pointerEvents="none",r}(o,{rowHeight:s.rowHeight,heightOffsets:s.heightOffsets,customTheme:null!==(m=s.customTheme)&&void 0!==m?m:{}});u&&y!==R&&(e.style.height=y+"px"),t.appendChild(e),p.set(g,{element:e,lastPosition:o.position,lastTop:S,lastWrapperHeight:R}),u&&y!==R&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=h,e.style.height=R+"px"})})}else{w.depth=o.depth>0?o.depth-1:0;const{element:e,cleanup:i}=function(t,e){const{nestedTable:o}=t;if(!o)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:i,heightOffsets:s,customTheme:r,theme:l,rowGrouping:a,depth:d,loadingStateRenderer:c,errorStateRenderer:u,emptyStateRenderer:h,icons:f}=e,{parentRow:v,expandableHeader:p,childAccessor:w,calculatedHeight:m}=o,g=p.nestedTable;if(!g)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const b=Dt(v,w),x=Array.isArray(b)?b:[],y=a&&a[d+1]?a.slice(d+1):void 0,R=g.customTheme?Object.assign(Object.assign({},r),g.customTheme):r,S=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:m,customHeight:g.height,customTheme:r}),C=Ft({calculatedHeight:m,customHeight:g.height,customTheme:r}),M=Jn({position:t.position,rowHeight:i,heightOffsets:s,customTheme:r}),H=document.createElement("div");H.className="st-row st-nested-grid-row st-row-position-"+t.position,H.setAttribute("role","row"),H.dataset.index=t.position+"",H.style.position="absolute",H.style.left="0",H.style.right="0",H.style.transform=`translate3d(0, ${M}px, 0)`,H.style.height=C+"px",H.style.paddingTop=r.nestedGridPaddingTop+"px",H.style.paddingBottom=r.nestedGridPaddingBottom+"px",H.style.paddingLeft=r.nestedGridPaddingLeft+"px",H.style.paddingRight=r.nestedGridPaddingRight+"px",H.style.boxSizing="border-box";const I=document.createElement("div");if(I.setAttribute("role","gridcell"),I.style.height="100%",I.style.width="100%",H.appendChild(I),!g.columns)throw Error("createNestedGridRow: nestedTable.columns is required");const k=n(Object.assign(Object.assign({},g),{columns:g.columns,rows:x,theme:l,customTheme:R,height:S,rowGrouping:y,loadingStateRenderer:c,errorStateRenderer:u,emptyStateRenderer:h,icons:f}));if(!e.createNestedTable)throw Error("createNestedGridRow: context.createNestedTable factory was not provided");const E=e.createNestedTable(I,k);E.mount();const T=()=>{E.destroy()};return H.__nestedTableCleanup=T,{element:H,cleanup:T}}(o,w);u&&y!==R&&(e.style.height=y+"px",e.style.overflow="hidden"),t.appendChild(e),p.set(g,{element:e,cleanup:i,lastPosition:o.position,lastTop:S,lastWrapperHeight:R}),u&&y!==R&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=h,e.style.height=R+"px"})})}})}(C,S,l,d,A,R,this.nestedGridRowsMap,this.stateRowsMap),d||function(t,e,n,o,i,s){var r,l;const a=n.filter(t=>t.stateIndicator),d=new Set(a.map(t=>Kt(t)));let c=s.get(e);c||(c=new Map,s.set(e,c));const u=null!==(r=null==i?void 0:i.isEnabled())&&void 0!==r&&r,h=u?`transform ${i.getDuration()}ms ${i.getEasing()}, height ${i.getDuration()}ms ${i.getEasing()}`:"";c.forEach((t,e)=>{d.has(e)||(t.element.remove(),c.delete(e))});const f={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(l=o.customTheme)&&void 0!==l?l:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};a.forEach((e,n)=>{var i;const s=Kt(e),r=Jn({position:e.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}}),l=c.get(s);if(l)return l.lastTop!==r&&(l.element.style.transition=h,l.element.style.transform=`translate3d(0, ${r}px, 0)`,l.lastTop=r),void(l.lastPosition=e.position);const a=((t,e)=>{const{position:n,stateIndicator:o}=t;if(!o)throw Error("createStateRow called without stateIndicator");const i=document.createElement("div");i.className="st-row st-state-row st-row-position-"+n,i.setAttribute("role","row"),i.dataset.index=e.index+"",i.style.width="100%",i.style.transform=`translate3d(0, ${Jn({position:n,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme})}px, 0)`,i.style.height=e.rowHeight+"px";const s=document.createElement("div");s.className="st-cell st-state-row-cell",s.setAttribute("role","gridcell"),s.style.width="100%",s.style.padding="0";let r=null;return o.state.loading&&e.loadingStateRenderer?r=Hi(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=Hi(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=Hi(e.emptyStateRenderer,{message:o.state.emptyMessage,parentRow:o.parentRow})),r&&("string"==typeof r?s.textContent=r:r instanceof HTMLElement&&s.appendChild(r)),i.appendChild(s),i})(e,Object.assign(Object.assign({},f),{index:n}));a.style.position="absolute",a.style.transform=`translate3d(0, ${r}px, 0)`,a.style.width="100%",u?(a.style.height="0px",a.style.overflow="hidden",t.appendChild(a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.style.transition=h,a.style.height=o.rowHeight+"px"})})):t.appendChild(a),c.set(s,{element:a,lastTop:r,lastPosition:e.position})})}(C,S,l,A,R,this.stateRowsMap),d||(this.mainBodyScrollPaint={section:C,absoluteCells:I,cachedContext:A,rows:l}),C}virtualizeMainHeaderForScroll(t,e){const n=this.mainHeaderScrollPaint;if(!n)return;const o=void 0!==e?Object.assign(Object.assign({},n.cachedContext),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):n.cachedContext;vi(n.section,n.absoluteCells,o,t)}virtualizeMainBodyForScroll(t){const e=this.mainBodyScrollPaint;e&&xi(e.section,e.absoluteCells,e.cachedContext,t,e.rows,!0)}setOnRendererHostDiscard(t){this.onRendererHostDiscard=t}invalidateCache(t){t&&"all"!==t?"body"===t?this.caches.clearBody():"header"===t?this.caches.clearHeader():"context"===t&&(this.caches.clearContext(),this.caches.clearHeader()):(this.caches.clearAll(),this.bodySections.forEach(t=>{h(t,this.onRendererHostDiscard)}),this.headerSections.forEach(t=>{((t,e)=>{if(v=0,t){const n=x(t);n.forEach(t=>{null==e||e(t),t.remove()}),n.clear(),R(t).clear(),I(t),l(t)}})(t,this.onRendererHostDiscard)}))}getNextColIndex(t){var e;return null!==(e=this.nextColIndexMap.get(t))&&void 0!==e?e:0}getCurrentBodyLayouts(){const t=new Map;return this.bodySectionSnapshots.forEach((e,n)=>{const o=this.bodySections.get(n);o&&t.set(o,yi(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?yi(e):null}captureSnapshotConfig(t,e,n,o,i,s,r,l){this.bodySectionSnapshots.set(t,function(t,e,n,o,i,s,r){const l=Ri(t,e),a=[];let d=0;for(const t of l){const e="number"==typeof t.width?t.width:150;a.push({accessor:t.accessor,left:d,width:e}),d+=e}return{rows:n,headerPositions:a,rowHeight:o,heightOffsets:i,customTheme:s,pageStartIndex:r}}(e,n,o,i,s,r,l))}releaseBodySections(){var t,e;this.bodySections.forEach(t=>{h(t,this.onRendererHostDiscard),t.remove()}),this.bodySections.clear(),this.caches.clearBody(),this.bodySectionSnapshots.clear(),this.mainBodyScrollPaint=null,e=this.stateRowsMap,(t=this.nestedGridRowsMap).forEach(t=>{t.forEach(t=>{var e;null===(e=t.cleanup)||void 0===e||e.call(t),t.element.remove()}),t.clear()}),t.clear(),e.forEach(t=>{t.forEach(t=>{t.element.remove()}),t.clear()}),e.clear()}cleanup(){this.releaseBodySections(),this.headerSections.clear(),this.caches.clearHeader(),this.caches.clearContext(),this.nextColIndexMap.clear(),this.mainHeaderScrollPaint=null}}const ki=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Ei=(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 i=!1;if(!t)for(const t of o.children)if(Ei([t],e,n),!1===t.hide){i=!0;break}(t||i)&&(o.hide=!1)}},Ti=t=>t.every(t=>t.hide),Ai=t=>t.every(t=>!t.hide),Oi=t=>{for(const e of t)e.hide=!1,e.children&&e.children.length>0&&Oi(e.children)},Pi=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(Pi(t.children),Ti(t.children)&&(t.hide=!0))})},Wi=(t,e)=>{var n;for(const o of t){if(o.accessor===e)return o;if(null===(n=o.children)||void 0===n?void 0:n.length){const t=Wi(o.children,e);if(t)return t}}return null},Fi=t=>{let e=!t.hide,n=!1;if(t.children&&t.children.length>0&&t.children){const o=Ti(t.children),i=Ai(t.children);t.hide||o?(e=!1,n=!1):i?(e=!0,n=!1):(e=!1,n=!0)}return{checked:e,indeterminate:n}},$i=["sum","average","count","min","max"].map(t=>({value:t,label:t.charAt(0).toUpperCase()+t.slice(1)})),Di={rows:[],columns:[],values:[]};function Li(t){const e=[],n=t=>{for(const o of t)o.isSelectionColumn||o.excludeFromRender||(o.children&&o.children.length>0?n(o.children):e.push(o))};return n(t),e}function ji(t){return"number"===t.type}function Ni(t){return t?{rows:[...t.rows],columns:[...t.columns],values:t.values.map(t=>{var e,n;return{accessor:t.accessor,aggregation:null!==(n=null===(e=t.aggregation)||void 0===e?void 0:e.type)&&void 0!==n?n:"sum"}})}:structuredClone(Di)}function Bi(t,e){var n,o;return null!==(o=null===(n=t.find(t=>t.accessor===e))||void 0===n?void 0:n.label)&&void 0!==o?o:e+""}function zi(t){let e=Li(t.fields),n=Ni(t.pivot),o=t.setPivot;const i=[],s=document.createElement("div");s.className="st-pivot-panel";const r=document.createElement("div");r.className="st-pivot-panel-zone",r.dataset.pivotZone="available";const l=document.createElement("div");l.className="st-pivot-panel-zone",l.dataset.pivotZone="rows";const a=document.createElement("div");a.className="st-pivot-panel-zone",a.dataset.pivotZone="columns";const d=document.createElement("div");d.className="st-pivot-panel-zone",d.dataset.pivotZone="values",s.append(r,l,a,d);const c=()=>{x(),o(function(t){if(0===t.values.length)return null;const e=t.values.map(t=>({accessor:t.accessor,aggregation:{type:t.aggregation}}));return{rows:[...t.rows],columns:[...t.columns],values:e}}(n))},u=t=>{n.rows=n.rows.filter(e=>e!==t),n.columns=n.columns.filter(e=>e!==t),n.values=n.values.filter(e=>e.accessor!==t)},h=(t,o)=>{const i=e.find(e=>e.accessor===t);if(i){if("values"===o){if(!ji(i))return;u(t),n.values=[...n.values,{accessor:t,aggregation:"sum"}]}else{if(ji(i))return;u(t),"rows"===o?n.rows=[...n.rows,t]:n.columns=[...n.columns,t]}c()}},f=t=>{const e=document.createElement("div");return e.className="st-pivot-panel-zone-title",e.textContent=t,e},v=()=>{const t=document.createElement("div");return t.className="st-column-editor-list st-pivot-panel-zone-list",t},p=t=>{const e=document.createElement("div");return e.className="st-pivot-panel-zone-empty",e.textContent=t,e},w=(t,e)=>{const n=document.createElement("button");return n.type="button",n.className="st-pivot-panel-action",n.textContent=t,n.addEventListener("click",t=>{t.stopPropagation(),e()}),n},m=(t,o,s)=>{const r=document.createElement("div");r.className="st-pivot-panel-chip";const l=document.createElement("span");if(l.className="st-pivot-panel-chip-label",l.textContent=Bi(e,t),r.appendChild(l),"values"===o&&s){const e=Wo({value:s,className:"st-pivot-panel-agg",options:$i,onChange:e=>{const o=n.values.find(e=>e.accessor===t);o&&o.aggregation!==e&&(o.aggregation=e,c())}});e.element.dataset.agg=s,e.element.addEventListener("click",t=>t.stopPropagation()),i.push(e),r.appendChild(e.element)}const a=document.createElement("button");return a.type="button",a.className="st-column-pin-btn st-pivot-panel-remove",a.setAttribute("aria-label","Remove "+Bi(e,t)),a.appendChild(Ge({className:"st-column-pin-svg",width:14,height:14,strokeWidth:2,paths:["M18 6L6 18","M6 6l12 12"]})),a.addEventListener("click",e=>{e.stopPropagation(),u(t),c()}),r.appendChild(a),r},g=(t,e,n,o,i,s)=>{t.replaceChildren(),t.appendChild(f(e));const r=v();if(0===o.length)r.appendChild(p(i));else if("values"===n&&s)for(const t of s)r.appendChild(m(t.accessor,"values",t.aggregation));else for(const t of o)r.appendChild(m(t,n));t.appendChild(r)},b=()=>{for(var t;i.length>0;)null===(t=i.pop())||void 0===t||t.destroy()},x=()=>{b(),(()=>{r.replaceChildren(),r.appendChild(f("Available"));const t=v(),o=new Set([...n.rows.map(String),...n.columns.map(String),...n.values.map(t=>t.accessor+"")]),i=e.filter(t=>!o.has(t.accessor+""));if(0===i.length)t.appendChild(p("All fields placed"));else for(const e of i){const n=document.createElement("div");n.className="st-pivot-panel-field";const o=document.createElement("span");o.className="st-pivot-panel-field-label",o.textContent=e.label,n.appendChild(o);const i=document.createElement("div");i.className="st-pivot-panel-field-actions",ji(e)?i.appendChild(w("Values",()=>h(e.accessor,"values"))):(i.appendChild(w("Rows",()=>h(e.accessor,"rows"))),i.appendChild(w("Columns",()=>h(e.accessor,"columns")))),n.appendChild(i),t.appendChild(n)}r.appendChild(t)})(),g(l,"Rows","rows",n.rows,"Add dimensions"),g(a,"Columns","columns",n.columns,"Add dimensions"),g(d,"Values","values",n.values.map(t=>t.accessor),"Add measures",n.values)};return x(),{element:s,update:t=>{void 0!==t.fields&&(e=Li(t.fields)),void 0!==t.setPivot&&(o=t.setPivot),void 0!==t.pivot&&(null!==t.pivot?n=Ni(t.pivot):n.values.length>0&&(n=Ni(null))),x()},destroy:()=>{b(),s.remove()}}}const Vi=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Vi(t,e))},qi=(t,e,n)=>{if(!e.trim())return t;const o=n||Vi;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function Gi(t,e,n,o,i){n?t.appendChild(n):(e&&t.appendChild(e),t.appendChild(o),i&&t.appendChild(i))}function Ki(t,e,n,o,i,s,r,l){const a=e({headers:n,searchSection:o,pivotSection:i,listSection:s,resetSection:r,resetColumns:l});if(a instanceof HTMLElement)t.appendChild(a);else if("string"==typeof a){const e=document.createElement("div");e.innerHTML=a,t.appendChild(e)}}const _i=t=>{let e=t,{headers:n,open:o,enablePivotPanel:i=!1,pivotFields:s,pivot:r=null,setPivot:l,searchEnabled:a,searchPlaceholder:d,searchFunction:c,columnEditorConfig:u,icons:h,essentialAccessors:f,setHeaders:v,onColumnVisibilityChange:p,onColumnOrderChange:w,resetColumns:m}=e,g="",b=null,x=null,y=!1;const R=new Set,S=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(R.add(t.accessor),S(t.children))})};S(n);let C=R;const M=document.createElement("div");M.className="st-column-editor-popout "+(o?"open":"");const H=document.createElement("div");H.className="st-column-editor-popout-content",H.addEventListener("click",t=>t.stopPropagation());let I=null,k=null;if(a){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=>{g=t.target.value,B()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(d);k=t.wrapper,I=t.input}const E=document.createElement("div");E.className="st-column-editor-lists";let T=null;m&&(T=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}(m));let A=null,O=null;i&&l&&s&&(A=zi({fields:s,pivot:r,setPivot:l}),O=A.element);let P=u.customRenderer;P?Ki(H,P,n,k,O,E,T,m):Gi(H,k,O,E,T),M.appendChild(H);const W=t=>{b=t,null!==t?y=!0:(y=!1,B())},F=()=>{x=null},$=t=>{x=t,y?L():B()},D=t=>{const e=C;C=t,B(e)},L=()=>{E.querySelectorAll(".st-column-editor-list-section").forEach(t=>{const e=null!==x&&x.panelSection===t.dataset.panelSection;t.querySelectorAll(".st-column-editor-drag-separator").forEach((t,n)=>{t.style.opacity=e&&x.index===n-1?"1":"0"})})},j=(t,e)=>{const n=a?qi(t,g,c):t,o=[],i=a&&g.trim().length>0,s=({headers:t,depth:n=0,parent:r=null,currentPath:l=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...l,a];o.push({header:t,visualIndex:o.length,depth:n,parent:r,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,u=i||C.has(t.accessor);c&&u&&t.children&&s({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return s({headers:n,depth:0,parent:null,currentPath:[]}),o},N=(t,e,o,i,s)=>{if(0===t.length)return;const r=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(a?qi(r,g,c):r).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,i.appendChild(t)}const l=document.createElement("div");l.className="st-column-editor-list st-column-editor-list-section",l.dataset.panelSection=e,i.appendChild(l);const d=j(t,e),m=(t=>t.some(t=>t.children&&t.children.length>0))(t);d.forEach(t=>{var o;const i=(t=>{var e,n;const{clearHoverSeparator:o,depth:i,doesAnyHeaderHaveChildren:s,draggingRow:r,getDraggingRow:l,getHoveredSeparator:a,expandedHeaders:d,flattenedHeaders:c,forceExpanded:u,header:h,hoveredSeparator:f,panelSection:v,rowIndex:p,setDraggingRow:w,setExpandedHeaders:m,setHoveredSeparator:g,headers:b,getHeaders:x,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:S,previousExpandedHeaders:C}=t,M=()=>x?x():b,H=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,I=!1!==t.columnEditorConfig.allowColumnPinning,k=An(h,H),E=!k,T=document.createDocumentFragment(),A=16*i+"px",O=h.children&&h.children.length>0,{checked:P,indeterminate:W}=Fi(h),F=d.has(h.accessor),$=u||F,D=null!==f&&f.panelSection===(null!=v?v:"main");let L;if(0===p){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=D&&-1===f.index?"1":"0",T.appendChild(t)}const j=document.createElement("div");j.className="st-header-checkbox-item",j.dataset.accessor=h.accessor+"",j.style.paddingLeft=A,j.draggable=!0;const N=t=>!(H.size>0&&!Pn(t,H)||(null==S||S(t),y(t),0)),B=t=>{if(t.stopPropagation(),u)return;const e=new Set(d);F?e.delete(h.accessor):e.add(h.accessor),m(e)};let z;if(j.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==o||o(),w(c[p])}),j.addEventListener("dragenter",t=>{t.preventDefault()}),j.addEventListener("dragover",t=>{t.preventDefault();const e=l?l():r;if(e&&e.panelSection===v){const n=t.currentTarget.getBoundingClientRect(),o=(({flattenedHeaders:t,draggingRow:e,hoveredRowIndex:n,isTopHalfOfRow:o})=>{var i,s;const r=t[n];if(r.depth===e.depth)return(null===(i=r.parent)||void 0===i?void 0:i.accessor)!==(null===(s=e.parent)||void 0===s?void 0:s.accessor)?null:o||r.header.children?n-1:n;if(r.depth>e.depth){let i=r,s=n;for(;i.parent&&i.depth>e.depth;){const e=i.parent.accessor,n=t.findIndex(t=>t.header.accessor===e);if(-1===n)break;i=t[n],s=n}const l=s;let a=s;for(let e=s+1;t.length>e&&t[e].depth>i.depth;e++)a=e;const d=a-l+1,c=n-l;let u=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(u=o),u?s-1:a}return null})({flattenedHeaders:c,draggingRow:e,hoveredRowIndex:p,isTopHalfOfRow:n.top+n.height/2>t.clientY});g(null===o?null:{panelSection:null!=v?v:"main",index:o})}}),j.addEventListener("dragend",()=>{const t=l?l():r,e=a?a():f,n=()=>{w(null),g(null)};if(!t||null===e||t.panelSection!==v)return void n();const o=e.index;let i=c[o>t.visualIndex?o:o+1];if(!i)return void n();if(i.depth>t.depth&&i.parent){const t=c.findIndex(t=>t.header.accessor===i.parent.accessor);-1!==t&&(i=c[t])}if(t.header.accessor===i.header.accessor)return void n();if(t.indexPath.length!==i.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===i.indexPath[e]))return void n();const s=M(),d=Bo(s,t.header.accessor),u=Bo(s,i.header.accessor);if(!d||!u)return void n();const{newHeaders:h,emergencyBreak:p}=Ko(s,d,u);p||N(h),n()}),s){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==C?u||C.has(h.accessor):$,n=!u&&void 0!==C&&t!==$,o=n?t:$,i=document.createElement("div");i.className="st-column-editor-expand-icon st-expand-icon-container "+(o?"expanded":"collapsed"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-expanded",o+""),i.setAttribute("aria-label",o?`Collapse ${h.label} column`:`Expand ${h.label} column`),i.appendChild(_e("st-expand-icon")),i.addEventListener("click",B),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),B(t))}),e.appendChild(i),z=i,n&&(L=()=>{cn(j,$,{ariaLabelWhenExpanded:`Collapse ${h.label} column`,ariaLabelWhenCollapsed:`Expand ${h.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||j.appendChild(e)}const V=rn({checked:P,indeterminate:W,onChange:t=>{if(!E)return;const e=Mn(M()),n=Wi(e,h.accessor);if(!n)return;const o=!(!n.children||0>=n.children.length);if(n.hide=!t,t?(Ei(e,n.accessor),o&&n.children&&n.children.length>0&&(Ti(n.children)||Ai(n.children)?Ti(n.children)&&n.children[0]&&(n.children[0].hide=!1,Ei(e,n.children[0].accessor)):Oi(n.children))):Pi(e),y(e),R){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);R(t)}}});E||(V.element.classList.add("st-checkbox-disabled"),V.element.style.pointerEvents="none");const q=document.createElement("div");q.className="st-drag-icon-container";const G=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof G?q.innerHTML=G:G instanceof HTMLElement||G instanceof SVGSVGElement?q.appendChild(G.cloneNode(!0)):q.appendChild(Ye("st-drag-icon"));const K=document.createElement("div");K.className="st-column-label-container",K.textContent=h.label;const _="left"===h.pinned||"right"===h.pinned?h.pinned:null,U=!!_&&!k,J=!_&&"main"===v,Y=!_&&"main"===v,X=()=>{const t=Ln(M(),h.accessor,"left",H);t&&N(t)},Q=()=>{const t=Ln(M(),h.accessor,"right",H);t&&N(t)},Z=()=>{const t=Ln(M(),h.accessor,"main",H);t&&N(t)},{rowRenderer:tt}=t.columnEditorConfig;if(tt){const t=tt({accessor:h.accessor,header:h,components:{expandIcon:z,checkbox:V.element,dragIcon:q,labelContent:K},panelSection:v,essential:k,canToggleVisibility:E,allowColumnPinning:I,pinControl:I&&0===i?{pinnedSide:_,canPinLeft:J,canPinRight:Y,canUnpin:U,pinLeft:X,pinRight:Q,unpin:Z}:void 0});t instanceof HTMLElement?j.appendChild(t):"string"==typeof t&&(j.innerHTML=t)}else if(j.appendChild(V.element),j.appendChild(q),j.appendChild(K),I&&0===i){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()}),_){const e=document.createElement("div"),n=k;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===_?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",U&&e.addEventListener("click",t=>{t.stopPropagation(),Z()}),t.appendChild(e)}else{if(J){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(),X()}),t.appendChild(e)}if(Y){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(),Q()}),t.appendChild(e)}}j.appendChild(t)}T.appendChild(j);const et=document.createElement("div");return et.className="st-column-editor-drag-separator",et.style.opacity=D&&f.index===p?"1":"0",T.appendChild(et),{fragment:T,scheduleExpandIconAnimation:L}})({allHeaders:n,clearHoverSeparator:F,depth:t.depth,doesAnyHeaderHaveChildren:m,draggingRow:b,getDraggingRow:()=>b,getHoveredSeparator:()=>x,expandedHeaders:C,flattenedHeaders:d,forceExpanded:a&&g.trim().length>0,header:t.header,hoveredSeparator:x,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:W,setExpandedHeaders:D,setHoveredSeparator:$,columnEditorConfig:u,icons:h,essentialAccessors:null!=f?f:new Set,headers:n,getHeaders:()=>n,setHeaders:v,onColumnVisibilityChange:p,onColumnOrderChange:w,previousExpandedHeaders:s});l.appendChild(i.fragment),null===(o=i.scheduleExpandIconAnimation)||void 0===o||o.call(i)})},B=t=>{E.innerHTML="";const e=!1!==u.allowColumnPinning,{pinnedLeft:o,unpinned:i,pinnedRight:s}=Tn(n);if(e)N(o,"left","Pinned Left",E,t),N(i,"main","Main",E,t),N(s,"right","Pinned Right",E,t);else{const e=[...o,...i,...s];N(e,"main",null,E,t)}};return B(),{element:M,update:t=>{let e=!1,g=!1,b=!1;if(void 0!==t.pivotFields&&(s=t.pivotFields),void 0!==t.pivot&&(r=t.pivot),void 0!==t.setPivot&&(l=t.setPivot),void 0!==t.enablePivotPanel&&t.enablePivotPanel!==i?(i=t.enablePivotPanel,null==A||A.destroy(),A=null,O=null,i&&l&&s&&(A=zi({fields:s,pivot:r,setPivot:l}),O=A.element),e=!0,b=!0):i&&!A&&l&&s?(A=zi({fields:s,pivot:r,setPivot:l}),O=A.element,e=!0,b=!0):A&&A.update({fields:s,pivot:r,setPivot:l}),void 0!==t.searchEnabled&&t.searchEnabled!==a&&(a=t.searchEnabled,e=!0),void 0!==t.searchPlaceholder&&(d=t.searchPlaceholder),void 0!==t.searchFunction&&(c=t.searchFunction,e=!0),void 0!==t.icons&&(h=t.icons),void 0!==t.essentialAccessors&&(f=t.essentialAccessors),void 0!==t.setHeaders&&(v=t.setHeaders),void 0!==t.onColumnVisibilityChange&&(p=t.onColumnVisibilityChange),void 0!==t.onColumnOrderChange&&(w=t.onColumnOrderChange),void 0!==t.resetColumns&&(m=t.resetColumns),void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==P&&(P=n,b=!0,e=!0),u=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?M.classList.add("open"):M.classList.remove("open")),I&&void 0!==t.searchPlaceholder&&(I.placeholder=t.searchPlaceholder),void 0!==t.headers&&(n=t.headers,g=!0),b&&(H.innerHTML="",P?Ki(H,P,n,k,O,E,T,m):Gi(H,k,O,E,T)),!e&&g&&(t=>{var e,n;const o=Array.from(E.querySelectorAll(".st-header-checkbox-item"));if(0===o.length)return!1;const i=!1!==u.allowColumnPinning,{pinnedLeft:s,unpinned:r,pinnedRight:l}=Tn(t),a=i?[{headers:s,panelSection:"left"},{headers:r,panelSection:"main"},{headers:l,panelSection:"right"}]:[{headers:[...s,...r,...l],panelSection:"main"}],d=[];for(const t of a)0!==t.headers.length&&d.push(...j(t.headers,t.panelSection));if(d.length!==o.length)return!1;for(let t=0;d.length>t;t++){if(o[t].dataset.accessor!==d[t].header.accessor+"")return!1;const i=o[t].closest(".st-column-editor-list");if((null!==(e=null==i?void 0:i.dataset.panelSection)&&void 0!==e?e:null)!==(null!==(n=d[t].panelSection)&&void 0!==n?n:null))return!1}for(let t=0;d.length>t;t++){const{checked:e,indeterminate:n}=Fi(d[t].header);sn(o[t],e,n)}return!0})(n)||(e||g||b)&&B()},destroy:()=>{null==A||A.destroy(),A=null,I&&(I.removeEventListener("input",()=>{}),I.removeEventListener("click",()=>{})),M.removeEventListener("click",()=>{}),M.remove()}}},Ui=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:i,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:u,width:h,scrollSyncGroup:f,sectionScrollController:v,startColIndex:p,resolveBodyRowIndex:w}=t,m=document.createElement("div");m.className=u?"st-sticky-section-"+u:"st-sticky-section-main",m.style.position="relative",m.style.height=o+"px",u&&h?(m.style.width=h+"px",m.style.flexGrow="0",m.style.flexShrink="0"):m.style.flexGrow="1";const g=((t,e)=>{const n=[],o=t=>{if(pt(t))return;const i=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return i?"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),b=new Map;let x=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;b.set(t.accessor,{left:x,width:e}),x+=e});const y=u&&"number"==typeof h?h:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const o=-1!==i&&e>=i,c=o?s:0,u=e*(r+1)+c,h=o?e:n.length-e,f=document.createElement("div");f.className="st-row st-sticky-parent",f.style.position="absolute",f.style.top="0px",f.style.left="0",f.style.right="0",f.style.height=r+"px",f.style.transform=`translateY(${u}px)`,f.style.zIndex=h+"",f.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var o,i;const s=b.get(e.accessor),l=p+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:zt(t.rowId),stableRowKey:t.stableRowKey,displayRowNumber:t.displayPosition,depth:t.depth,isOdd:t.position%2==1,tableRow:t,left:null!==(o=null==s?void 0:s.left)&&void 0!==o?o:0,top:0,width:null!==(i=null==s?void 0:s.width)&&void 0!==i?i:150,height:r},c=Sn(a,d);f.appendChild(c)}),m.appendChild(f);const v=wi({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(v)}),v&&f&&v.registerPane("pinned-left"===f?"pinned-left":"pinned-right"===f?"pinned-right":"main",m,"sticky"),m},Ji=(t,e)=>{if(e){const n=t.querySelector(".st-sticky-section-left"),o=t.querySelector(".st-sticky-section-main"),i=t.querySelector(".st-sticky-section-right");n instanceof HTMLElement&&e.unregisterPane("pinned-left",n),o instanceof HTMLElement&&e.unregisterPane("main",o),i instanceof HTMLElement&&e.unregisterPane("pinned-right",i)}t.remove()};class Yi{constructor(){this.footerInstance=null,this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=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 Ii}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}setOnRendererHostDiscard(t){this.sectionRenderer.setOnRendererHostDiscard(t)}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}invalidateCustomFooterCache(){this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}virtualizeMainColumnsForScroll(t,e){this.sectionRenderer.virtualizeMainHeaderForScroll(t,e),this.sectionRenderer.virtualizeMainBodyForScroll(t)}renderHeader(t,e,n,o){var i,s;if(!t||o.config.hideHeader)return;const r=null!==(s=null===(i=o.dimensionManager)||void 0===i?void 0:i.getState())&&void 0!==s?s:{containerWidth:0,calculatedHeaderHeight:o.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:l,leftWidth:a,rightWidth:d}=Yo({headers:o.effectiveHeaders,containerWidth:r.containerWidth,collapsedHeaders:o.collapsedHeaders}),c={mainWidth:l,leftWidth:a,rightWidth:d,containerWidth:r.containerWidth},u=((t,e)=>{var n,o,i,s,r,l,a,d,c,u,h;const f=null!==(o=null===(n=t.rowSelectionManager)||void 0===n?void 0:n.getSelectedRowCount())&&void 0!==o?o:0,v=null===(i=t.sortManager)||void 0===i?void 0:i.getState(),p=null===(s=t.filterManager)||void 0===s?void 0:s.getState();return{reverse:!1,collapsedHeaders:t.collapsedHeaders,getCollapsedHeaders:t.getCollapsedHeaders,columnBorders:null!==(r=t.config.columnBorders)&&void 0!==r&&r,columnReordering:null!==(l=t.config.columnReordering)&&void 0!==l&&l,columnResizing:null!==(a=t.config.columnResizing)&&void 0!==a&&a,containerWidth:e.containerWidth,mainSectionContainerWidth:e.mainWidth,mainSectionViewportWidth:Jo({containerWidth:e.containerWidth,leftWidth:e.leftWidth,rightWidth:e.rightWidth}),enableVirtualization:!1!==t.config.enableVirtualization,enableHeaderEditing:t.config.enableHeaderEditing,enableRowSelection:t.config.enableRowSelection,rowSelectionMode:null!==(d=t.config.rowSelectionMode)&&void 0!==d?d:"multiple",selectedRowCount:f,filters:null!==(c=null==p?void 0:p.filters)&&void 0!==c?c:{},icons:t.resolvedIcons,selectedColumns:t.config.selectableColumns&&t.selectionManager?t.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:t.selectionManager&&(t.config.selectableCells||t.config.selectableColumns)?t.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(u=null==v?void 0:v.sort)&&void 0!==u?u:null,autoExpandColumns:null!==(h=t.config.autoExpandColumns)&&void 0!==h&&h,getShrinkFloors:t.getShrinkFloors,onAutoExpandNaturalWidths:t.onAutoExpandNaturalWidths,essentialAccessors:t.essentialAccessors,selectableColumns:t.config.selectableColumns,headers:t.effectiveHeaders,rows:t.localRows,headerHeight:t.customTheme.headerHeight,lastHeaderIndex:t.effectiveHeaders.length-1,onSort:e=>{t.sortManager&&t.sortManager.updateSort({accessor:e})},handleApplyFilter:e=>{t.filterManager&&t.filterManager.updateFilter(e)},handleClearFilter:e=>{t.filterManager&&t.filterManager.clearFilter(e)},getHeaders:()=>t.getHeaders(),handleSelectAll:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.handleSelectAll(e)},setCollapsedHeaders:e=>{if("function"==typeof e){const n=t.getCollapsedHeaders?t.getCollapsedHeaders():t.collapsedHeaders;t.setCollapsedHeaders(e(n))}else t.setCollapsedHeaders(e);t.onRender()},setHeaders:e=>{t.setHeaders("function"==typeof e?e(t.getHeaders()):e),t.onRender()},setIsResizing:e=>{t.setIsResizing("function"==typeof e?e(t.isResizing):e)},onColumnWidthChange:t.config.onColumnWidthChange,onColumnOrderChange:t.config.onColumnOrderChange,onTableHeaderDragEnd:e=>{t.setHeaders(e),t.onRender()},onHeaderEdit:t.config.onHeaderEdit,onColumnSelect:t.config.onColumnSelect,selectColumns:t.selectionManager&&t.config.selectableColumns?(e,n)=>{t.selectionManager.selectColumns(e,n),t.onRender()}:t=>{},setSelectedColumns:t.selectionManager&&t.config.selectableColumns?e=>{const n=t.selectionManager.getSelectedColumns(),o="function"==typeof e?e(n):e;t.selectionManager.setSelectedColumns(o),t.onRender()}:t=>{},setSelectedCells:t.selectionManager?e=>{var n;const o=t.selectionManager.getSelectedCells(),i="function"==typeof e?e(o):e;t.selectionManager.setSelectedCells(i instanceof Set?i:new Set),null===(n=t.onRender)||void 0===n||n.call(t)}:t=>{},setInitialFocusedCell:t.selectionManager?e=>{var n;t.selectionManager.setInitialFocusedCell(null!=e?e:null),null===(n=t.onRender)||void 0===n||n.call(t)}:t=>{},areAllRowsSelected:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.areAllRowsSelected())&&void 0!==n&&n},draggedHeaderRef:t.draggedHeaderRef,hoveredHeaderRef:t.hoveredHeaderRef,headerRegistry:t.headerRegistry,forceUpdate:()=>t.onRender(),mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,accordionAxis:t.accordionAxis,animationCoordinator:t.animationCoordinator,onRendererHostDiscard:t.config.onRendererHostDiscard}})(o,c);(t=>{var e;const{container:n,calculatedHeaderHeight:o,maxHeaderDepth:i,deps:s,headerContext:r,widths:l,sectionRenderer:a}=t;if(!n||s.config.hideHeader)return;n.style.height=o+"px";const d=Hn(s.effectiveHeaders,"left")||Hn(s.effectiveHeaders,void 0)||Hn(s.effectiveHeaders,"right");n.style.minHeight=d?"":o+"px";const c=n.parentElement;if(c)if(c.setAttribute("aria-rowcount",1+s.localRows.length+""),c.setAttribute("aria-colcount",s.effectiveHeaders.length+""),s.config.enableRowSelection){const t="multiple"===(null!==(e=s.config.rowSelectionMode)&&void 0!==e?e:"multiple");c.setAttribute("aria-multiselectable",t?"true":"false")}else c.removeAttribute("aria-multiselectable");const u=s.effectiveHeaders.filter(t=>"left"===t.pinned),h=s.effectiveHeaders.filter(t=>!t.pinned),f=s.effectiveHeaders.filter(t=>"right"===t.pinned);let v=0;const p=[];if(u.length>0){const t=a.renderHeaderSection({headers:s.effectiveHeaders,collapsedHeaders:s.collapsedHeaders,pinned:"left",maxHeaderDepth:i,headerHeight:s.customTheme.headerHeight,context:r,sectionWidth:l.leftWidth,startColIndex:v});s.pinnedLeftHeaderRef.current=t,p.push(t),t.parentElement!==n&&n.insertBefore(t,n.firstChild),v=a.getNextColIndex("left")}if(h.length>0){const t=a.renderHeaderSection({headers:s.effectiveHeaders,collapsedHeaders:s.collapsedHeaders,maxHeaderDepth:i,headerHeight:s.customTheme.headerHeight,context:r,sectionWidth:l.mainWidth,startColIndex:v});if(s.mainHeaderRef.current=t,p.push(t),t.parentElement!==n){const e=s.pinnedRightHeaderRef.current;e&&e.parentElement===n?n.insertBefore(t,e):n.appendChild(t)}v=a.getNextColIndex("main")}if(f.length>0){const t=a.renderHeaderSection({headers:s.effectiveHeaders,collapsedHeaders:s.collapsedHeaders,pinned:"right",maxHeaderDepth:i,headerHeight:s.customTheme.headerHeight,context:r,sectionWidth:l.rightWidth,startColIndex:v});s.pinnedRightHeaderRef.current=t,p.push(t),t.parentElement!==n&&n.appendChild(t)}Array.from(n.children).forEach(t=>{p.includes(t)||t.remove()})})({container:t,calculatedHeaderHeight:e,maxHeaderDepth:n,deps:o,headerContext:u,widths:c,sectionRenderer:this.sectionRenderer})}renderBody(t,e,n){var o,i;if(!t)return;const s=null!==(i=null===(o=n.dimensionManager)||void 0===o?void 0:o.getState())&&void 0!==i?i:{containerWidth:0,calculatedHeaderHeight:n.customTheme.headerHeight,maxHeaderDepth:1},{mainWidth:r,leftWidth:l,rightWidth:a}=Yo({headers:n.effectiveHeaders,containerWidth:s.containerWidth,collapsedHeaders:n.collapsedHeaders}),d={mainWidth:r,leftWidth:l,rightWidth:a,containerWidth:s.containerWidth},c=((t,e,n,o)=>{var i,s,r,l,a,d,c,u,h,f,v,p,w,m,g,b;const x=null!==(s=null===(i=t.rowSelectionManager)||void 0===i?void 0:i.getSelectedRowCount())&&void 0!==s?s:0,y=null!==(l=null===(r=t.dimensionManager)||void 0===r?void 0:r.getState().maxHeaderDepth)&&void 0!==l?l:1,R=null===(a=ht(t.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===a?void 0:a.accessor;return{collapsedHeaders:t.collapsedHeaders,collapsedRows:t.getCollapsedRows(),expandedRows:t.getExpandedRows(),expandedDepths:Array.from(t.expandedDepths),selectedColumns:null!==(c=null===(d=t.selectionManager)||void 0===d?void 0:d.getSelectedColumns())&&void 0!==c?c:new Set,rowsWithSelectedCells:null!==(h=null===(u=t.selectionManager)||void 0===u?void 0:u.getRowsWithSelectedCells())&&void 0!==h?h:new Set,columnBorders:null!==(f=t.config.columnBorders)&&void 0!==f&&f,enableRowSelection:t.config.enableRowSelection,selectRowOnClick:null!==(v=t.config.selectRowOnClick)&&void 0!==v&&v,rowSelectionMode:null!==(p=t.config.rowSelectionMode)&&void 0!==p?p:"multiple",selectedRowCount:x,activeRowId:null!==(m=null===(w=t.rowSelectionManager)||void 0===w?void 0:w.getActiveRowId())&&void 0!==m?m:null,cellUpdateFlash:t.config.cellUpdateFlash,oddColumnBackground:t.config.oddColumnBackground,hoverRowBackground:null===(g=t.config.hoverRowBackground)||void 0===g||g,hoverScopeId:t.hoverScopeId,oddEvenRowBackground:t.config.oddEvenRowBackground,getRowClass:t.config.getRowClass,rowGrouping:t.config.rowGrouping,headers:t.effectiveHeaders,rowHeaderAccessor:R,rowHeight:t.customTheme.rowHeight,maxHeaderDepth:y,heightOffsets:n.paginatedHeightOffsets,customTheme:t.customTheme,containerWidth:e.containerWidth,mainSectionContainerWidth:e.mainWidth,mainSectionViewportWidth:Jo({containerWidth:e.containerWidth,leftWidth:e.leftWidth,rightWidth:e.rightWidth}),enableVirtualization:!1!==t.config.enableVirtualization,onCellEdit:t.config.onCellEdit,onCellClick:t.config.onCellClick,onRowGroupExpand:t.config.onRowGroupExpand,handleRowSelect:(e,n)=>{var o;null===(o=t.rowSelectionManager)||void 0===o||o.handleRowSelect(e,n)},handleToggleRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.handleToggleRow(e)},cellRegistry:t.cellRegistry,getCollapsedRows:()=>t.getCollapsedRows(),getExpandedRows:()=>t.getExpandedRows(),setCollapsedRows:e=>{t.setCollapsedRows("function"==typeof e?e(t.getCollapsedRows()):e),o(t.onRender)},setExpandedRows:e=>{t.setExpandedRows("function"==typeof e?e(t.getExpandedRows()):e),o(t.onRender)},setRowStateMap:e=>{t.setRowStateMap("function"==typeof e?e(t.getRowStateMap()):e),o(t.onRender)},icons:t.resolvedIcons,theme:null!==(b=t.config.theme)&&void 0!==b?b:"modern-light",rowButtons:t.config.rowButtons,loadingStateRenderer:t.config.loadingStateRenderer,errorStateRenderer:t.config.errorStateRenderer,emptyStateRenderer:t.config.emptyStateRenderer,createNestedTable:t.createNestedTable,getBorderClass:e=>{var n;return(null===(n=t.selectionManager)||void 0===n?void 0:n.getBorderClass(e))||""},isSelected:e=>{var n;return(null===(n=t.selectionManager)||void 0===n?void 0:n.isSelected(e))||!1},isInitialFocusedCell:e=>{var n;return(null===(n=t.selectionManager)||void 0===n?void 0:n.isInitialFocusedCell(e))||!1},isCopyFlashing:e=>{var n;return(null===(n=t.selectionManager)||void 0===n?void 0:n.isCopyFlashing(e))||!1},isWarningFlashing:e=>{var n;return(null===(n=t.selectionManager)||void 0===n?void 0:n.isWarningFlashing(e))||!1},handleMouseDown:e=>{var n;return null===(n=t.selectionManager)||void 0===n?void 0:n.handleMouseDown(e)},handleMouseOver:(e,n,o)=>{var i;return null===(i=t.selectionManager)||void 0===i?void 0:i.handleMouseOver(e,n,o)},onRendererHostDiscard:t.config.onRendererHostDiscard,isRowSelected:e=>{var n,o;return null!==(o=null===(n=t.rowSelectionManager)||void 0===n?void 0:n.isRowSelected(e))&&void 0!==o&&o},canExpandRowGroup:t.config.canExpandRowGroup,isLoading:t.internalIsLoading,accordionAxis:t.accordionAxis}})(n,d,e,t=>this.scheduleRender(t));this.stickyParentsContainer=(t=>{var e,n,o,i,s,r,l,a,d,c;const{container:u,processedResult:h,deps:f,bodyContext:v,widths:p,calculatedHeaderHeight:w,sectionRenderer:m}=t;let g=t.stickyParentsContainer;if(!u)return g;if(Hn(f.effectiveHeaders,"left")||Hn(f.effectiveHeaders,void 0)||Hn(f.effectiveHeaders,"right"))u.style.minHeight="";else{const t=null!==(n=null===(e=null==h?void 0:h.heightMap)||void 0===e?void 0:e.totalHeight)&&void 0!==n?n:0;u.style.minHeight=t+"px"}const b=h.rowsToRender||h.currentTableRows,x=!f.internalIsLoading&&0===h.currentTableRows.length;if(f.selectionManager&&h.currentTableRows&&f.selectionManager.updateConfig({tableRows:h.currentTableRows,headers:f.effectiveHeaders,collapsedHeaders:f.collapsedHeaders,selectableColumns:null!==(o=f.config.selectableColumns)&&void 0!==o&&o},{positionOnlyBody:f.positionOnlyBody}),x){m.releaseBodySections(),u.innerHTML="",f.mainBodyRef.current=null,f.pinnedLeftRef.current=null,f.pinnedRightRef.current=null;const t=document.createElement("div");return t.className="st-empty-state-wrapper","string"==typeof f.config.tableEmptyStateRenderer?t.textContent=f.config.tableEmptyStateRenderer:f.config.tableEmptyStateRenderer instanceof HTMLElement?t.appendChild(f.config.tableEmptyStateRenderer.cloneNode(!0)):t.innerHTML="<div class='st-empty-state'>No rows to display</div>",u.appendChild(t),g}const y=f.effectiveHeaders.filter(t=>"left"===t.pinned),R=f.effectiveHeaders.filter(t=>!t.pinned),S=f.effectiveHeaders.filter(t=>"right"===t.pinned);let C=0;const M=[],H={headers:f.effectiveHeaders,rows:b,collapsedHeaders:f.collapsedHeaders,context:v,rowHeight:f.customTheme.rowHeight,heightOffsets:h.paginatedHeightOffsets,totalRowCount:h.currentTableRows.length,positionOnly:f.positionOnlyBody,fullTableRows:h.currentTableRows,renderedStartIndex:h.renderedStartIndex,renderedEndIndex:h.renderedEndIndex,allFlattenedRows:h.allFlattenedRows,pageStartIndex:h.pageStartIndex,animationCoordinator:f.positionOnlyBody?void 0:f.animationCoordinator};if(y.length>0){const t=m.renderBodySection(Object.assign(Object.assign({},H),{pinned:"left",sectionWidth:p.leftWidth,startColIndex:C}));f.pinnedLeftRef.current=t,M.push(t),t.parentElement!==u&&u.insertBefore(t,u.firstChild),C=m.getNextColIndex("left")}if(R.length>0){const t=m.renderBodySection(Object.assign(Object.assign({},H),{sectionWidth:p.mainWidth,startColIndex:C}));if(f.mainBodyRef.current=t,M.push(t),t.parentElement!==u){const e=f.pinnedRightRef.current;e&&e.parentElement===u?u.insertBefore(t,e):u.appendChild(t)}C=m.getNextColIndex("main")}if(S.length>0){const t=m.renderBodySection(Object.assign(Object.assign({},H),{pinned:"right",sectionWidth:p.rightWidth,startColIndex:C}));f.pinnedRightRef.current=t,M.push(t),t.parentElement!==u&&u.appendChild(t)}if(f.config.enableStickyParents&&h.stickyParents&&h.stickyParents.length>0){g&&(Ji(g,null!==(i=f.sectionScrollController)&&void 0!==i?i:null),g=null);const t=f.externalScrollActive?null!==(s=f.stickyParentsScrollTop)&&void 0!==s?s:0:null!==(l=null===(r=f.mainBodyRef.current)||void 0===r?void 0:r.scrollTop)&&void 0!==l?l:0,e=u.offsetWidth-u.clientWidth,n={left:0,main:y.length>0?m.getNextColIndex("left"):0,right:R.length>0?m.getNextColIndex("main"):y.length>0?m.getNextColIndex("left"):0},o=b.filter(t=>!t.nestedTable&&!t.stateIndicator),c=new Map;if(o.forEach((t,e)=>{var n;const o=null!==(n=t.stableRowKey)&&void 0!==n?n:zt(t.rowId);c.set(o,e)}),g=((t,e)=>{const{stickyParents:n,stickySectionColStart:o,stickyBodyRowIndexByRowKey:i}=t;if(0===n.length)return null;const s=t=>{var e,n;const o=null!==(e=t.stableRowKey)&&void 0!==e?e:zt(t.rowId);return null!==(n=i.get(o))&&void 0!==n?n:t.position},{treeTransitionOffset:r,offsetStartIndex:l}=((t,e,n,o,i,s)=>{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 u=-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){u=e;break}if(n.depth>o.depth){u=t.findIndex(t=>t.depth===n.depth);break}}if(-1===u)return{treeTransitionOffset:0,offsetStartIndex:c};const h=null===(r=t[u])||void 0===r?void 0:r.position;if(void 0===h)return{treeTransitionOffset:0,offsetStartIndex:c};let f=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(h)))break;f++}if(0===f)return{treeTransitionOffset:0,offsetStartIndex:c};const v=e[0];let p;return p=n?n.rowTopPositions[v.position]:v.position*(o+i.rowSeparatorWidth),{treeTransitionOffset:-((u+1-f)*o+Math.max(0,s-p)),offsetStartIndex:c}})(n,t.partiallyVisibleRows,t.heightMap,e.rowHeight,e.customTheme,t.scrollTop),a=n.length>0?n.length*(e.rowHeight+1)+r:0,d=`calc(100% - ${t.scrollbarWidth}px - ${e.enableColumnEditor?"29.5px":"0px"})`,c=document.createElement("div");c.className="st-sticky-top",c.setAttribute("aria-hidden","true"),c.style.height=a+"px",c.style.width=d,t.externalScrollActive?c.style.marginBottom=-a+"px":c.style.top=t.calculatedHeaderHeight+"px";const u=e.headers.filter(t=>!t.pinned),h=e.sectionScrollController;if(t.pinnedLeftColumns.length>0){const i=Ui({sectionHeaders:t.pinnedLeftColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"left",width:t.pinnedLeftWidth,scrollSyncGroup:"pinned-left",sectionScrollController:h,startColIndex:o.left,resolveBodyRowIndex:s});c.appendChild(i)}const f=Ui({cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,customTheme:e.customTheme,heightOffsets:e.heightOffsets,offsetStartIndex:l,rowHeight:e.rowHeight,scrollSyncGroup:"default",sectionHeaders:u,stickyHeight:a,stickyParents:n,treeTransitionOffset:r,sectionScrollController:h,startColIndex:o.main,resolveBodyRowIndex:s});if(c.appendChild(f),t.pinnedRightColumns.length>0){const i=Ui({sectionHeaders:t.pinnedRightColumns,stickyParents:n,stickyHeight:a,offsetStartIndex:l,treeTransitionOffset:r,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme,cellRenderContext:e.cellRenderContext,collapsedHeaders:e.collapsedHeaders,pinned:"right",width:t.pinnedRightWidth,scrollSyncGroup:"pinned-right",sectionScrollController:h,startColIndex:o.right,resolveBodyRowIndex:s});c.appendChild(i)}return c})({calculatedHeaderHeight:w,heightMap:h.heightMap,partiallyVisibleRows:h.partiallyVisibleRows||[],pinnedLeftColumns:y,pinnedLeftWidth:p.leftWidth,pinnedRightColumns:S,pinnedRightWidth:p.rightWidth,scrollTop:t,scrollbarWidth:e,stickyParents:h.stickyParents,stickySectionColStart:n,stickyBodyRowIndexByRowKey:c,externalScrollActive:f.externalScrollActive},{collapsedHeaders:f.collapsedHeaders,customTheme:f.customTheme,enableColumnEditor:lt(f.config.enableColumnEditor,null===(a=f.config.columnEditorConfig)||void 0===a?void 0:a.showToggle),headers:f.effectiveHeaders,rowHeight:f.customTheme.rowHeight,heightOffsets:h.paginatedHeightOffsets,cellRenderContext:v,sectionScrollController:null!==(d=f.sectionScrollController)&&void 0!==d?d:null}),g){const t=u.parentElement;t&&g.parentElement!==t?t.insertBefore(g,u):t||u.appendChild(g)}}else g&&(Ji(g,null!==(c=f.sectionScrollController)&&void 0!==c?c:null),g=null);return Array.from(u.children).forEach(t=>{M.includes(t)||t.remove()}),g})({container:t,processedResult:e,deps:n,bodyContext:c,widths:d,calculatedHeaderHeight:s.calculatedHeaderHeight,sectionRenderer:this.sectionRenderer,stickyParentsContainer:this.stickyParentsContainer})}renderFooter(t,e,n,o,i){var s,r,l,a,d,c,u,h,f,v,p,w,m;if(!t)return;const g=!!i.config.footerRenderer,b=i.config.enablePagination&&!i.config.hideFooter;if(g||(this.lastCustomFooterRenderer=null,this.lastCustomFooterKey=null),!g&&!b)return void(t.innerHTML="");const x=null!==(s=i.config.rowsPerPage)&&void 0!==s?s:10,y=Math.ceil(e/x);if(g){const s=(n-1)*x+1,c=Math.min(n*x,e),u=`${n}|${e}|${x}|${y}|${i.config.hideFooter?1:0}|${null!==(r=i.config.footerRenderKey)&&void 0!==r?r:""}`;if(t.childNodes.length>0&&this.lastCustomFooterRenderer===i.config.footerRenderer&&this.lastCustomFooterKey===u)return void(this.footerInstance=null);this.lastCustomFooterRenderer=i.config.footerRenderer,this.lastCustomFooterKey=u;const h=null!==(l=i.config.serverSidePagination)&&void 0!==l&&l,f=t=>{if(h&&i.config.onPageChange)return i.config.onPageChange(t)},v=i.config.footerRenderer({currentPage:n,endRow:c,hasNextPage:y>n,hasPrevPage:n>1,nextIcon:null===(a=i.resolvedIcons)||void 0===a?void 0:a.next,onNextPage:async()=>{y>n&&(o(n+1),i.config.onNextPage&&await i.config.onNextPage(n+1),await f(n+1))},onPageChange:t=>{o(t),f(t)},onPrevPage:()=>{n>1&&(o(n-1),f(n-1))},prevIcon:null===(d=i.resolvedIcons)||void 0===d?void 0:d.prev,rowsPerPage:x,startRow:s,totalPages:y,totalRows:e});return t.innerHTML="",v instanceof HTMLElement?t.appendChild(v):"string"==typeof v&&(t.innerHTML=v),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(c=i.config.hideFooter)&&void 0!==c&&c,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:x,enablePagination:null!==(u=i.config.enablePagination)&&void 0!==u&&u,totalPages:y,totalRows:e,prevIcon:null===(h=i.resolvedIcons)||void 0===h?void 0:h.prev,nextIcon:null===(f=i.resolvedIcons)||void 0===f?void 0:f.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:i,onUserPageChange:s,rowsPerPage:r,enablePagination:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:u}=t,h=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const f=document.createElement("div");f.className="st-footer";const v=()=>{f.innerHTML="";const t=e>1,n=a>e,l=e===a,p=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!i||!h&&l,b=document.createElement("div");b.className="st-footer-info";const x=document.createElement("span");x.className="st-footer-results-text",x.textContent=`Showing ${p} to ${w} of ${d.toLocaleString()} results`,b.appendChild(x),f.appendChild(b);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,i;if(t>8)if(e-7>t){const e=7;o=t-e,i=t+(15-e-1)}else o=Math.max(1,e-15+1),i=e;else o=1,i=14;o>2?(n.push(1),n.push(-1)):2===o&&n.push(1);for(let t=o;i>=t;t++)n.push(t);return e-1>i?(n.push(-2),n.push(e)):i===e-1&&n.push(e),n})(e,a),S=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const i=document.createElement("button"),r=n>0&&0>R[n-1];i.className=["st-page-btn",e===t?"active":""].filter(Boolean).join(" "),i.textContent=""+t,i.setAttribute("aria-label","Go to page "+t),e===t&&i.setAttribute("aria-current","page"),i.addEventListener("click",()=>(async t=>{1>t||t>a||(o(t),s&&await s(t))})(t)),y.appendChild(i),S.push({button:i,page:t,afterEllipsis:r})}}),S.forEach((t,n)=>{const{button:o,page:i,afterEllipsis:s}=t,r=n+1,l=e===i,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||s||c)&&o.classList.add("st-page-btn--compact-hidden")});const C=document.createElement("button");C.className="st-next-prev-btn "+(m?"disabled":""),C.disabled=m,C.setAttribute("aria-label","Go to previous page"),ki(C,c||Ke("st-next-prev-icon")),C.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),s&&await s(t))}),y.appendChild(C);const M=document.createElement("button");M.className="st-next-prev-btn "+(g?"disabled":""),M.disabled=g,M.setAttribute("aria-label","Go to next page"),ki(M,u||_e("st-next-prev-icon")),M.addEventListener("click",async()=>{const t=e+1;if(i&&e===a&&!await i(e))return h=!1,void v();t>a&&!i||(o(t),s&&await s(t))}),y.appendChild(M),f.appendChild(y)};return v(),{element:f,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&&(i=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.enablePagination&&(l=t.enablePagination),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&&(u=t.nextIcon),n||!l?f.style.display="none":(f.style.display="flex",v())},destroy:()=>{f.remove()}}})({currentPage:n,hideFooter:null!==(v=i.config.hideFooter)&&void 0!==v&&v,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:x,enablePagination:null!==(p=i.config.enablePagination)&&void 0!==p&&p,totalPages:y,totalRows:e,prevIcon:null===(w=i.resolvedIcons)||void 0===w?void 0:w.prev,nextIcon:null===(m=i.resolvedIcons)||void 0===m?void 0:m.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,o,i){var s;if(!t)return;if(!i.config.enableColumnEditor)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const r=()=>{const t=i.getPristineDefaultHeaders();t&&(i.setHeaders(Mn(t)),i.onRender())},l=i.getPristineDefaultHeaders();if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,enableColumnEditor:i.config.enableColumnEditor,enablePivotPanel:i.config.enablePivotPanel,headers:i.headers,pivotFields:l,pivot:i.getPivot(),setPivot:i.setPivot,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,icons:i.resolvedIcons,essentialAccessors:i.essentialAccessors,setHeaders:t=>{i.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),i.onRender()},onColumnVisibilityChange:i.config.onColumnVisibilityChange,onColumnOrderChange:i.config.onColumnOrderChange,resetColumns:r,setOpen:n});else{const a=(t=>{let{columnEditorText:e,enableColumnEditor:n,enablePivotPanel:o=!1,headers:i,pivotFields:s,pivot:r=null,setPivot:l,open:a,searchEnabled:d,searchPlaceholder:c,searchFunction:u,columnEditorConfig:h,icons:f,essentialAccessors:v,resetColumns:p,setHeaders:w,onColumnVisibilityChange:m,onColumnOrderChange:g,setOpen:b}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const x=!1!==h.showToggle,y=document.createElement("div");y.className=`st-column-editor${x?"":" st-column-editor--no-toggle"}${a?" open":""}`,y.style.width=x?"29.5px":"0px";const R=()=>{b(!a)};let S=null;x&&(S=document.createElement("div"),S.className="st-column-editor-text",S.textContent=e,y.addEventListener("click",R),y.appendChild(S));const C=_i({headers:i,open:a,enablePivotPanel:o,pivotFields:s,pivot:r,setPivot:l,searchEnabled:d,searchPlaceholder:c,searchFunction:u,columnEditorConfig:h,icons:f,essentialAccessors:v,resetColumns:p,setHeaders:w,onColumnVisibilityChange:m,onColumnOrderChange:g});y.appendChild(C.element);const M={update:t=>{void 0!==t.open&&(a=t.open,t.open?y.classList.add("open"):y.classList.remove("open")),void 0!==t.setOpen&&(b=t.setOpen),void 0!==t.columnEditorText&&S&&(S.textContent=t.columnEditorText),void 0!==t.essentialAccessors&&(v=t.essentialAccessors),void 0!==t.icons&&(f=t.icons),void 0!==t.resetColumns&&(p=t.resetColumns),void 0!==t.enablePivotPanel&&(o=t.enablePivotPanel),void 0!==t.pivotFields&&(s=t.pivotFields),void 0!==t.pivot&&(r=t.pivot),void 0!==t.setPivot&&(l=t.setPivot),C.update({headers:t.headers,open:t.open,enablePivotPanel:void 0!==t.enablePivotPanel?o:void 0,pivotFields:t.pivotFields,pivot:t.pivot,setPivot:t.setPivot,searchEnabled:t.searchEnabled,searchPlaceholder:t.searchPlaceholder,searchFunction:t.searchFunction,columnEditorConfig:t.columnEditorConfig,icons:t.icons,essentialAccessors:t.essentialAccessors,resetColumns:t.resetColumns,setHeaders:t.setHeaders,onColumnVisibilityChange:t.onColumnVisibilityChange,onColumnOrderChange:t.onColumnOrderChange})},destroy:()=>{x&&y.removeEventListener("click",R),C.destroy(),y.remove()}};return y.__columnEditor=M,Object.assign({element:y},M)})({columnEditorText:o.text,enableColumnEditor:null!==(s=i.config.enableColumnEditor)&&void 0!==s&&s,enablePivotPanel:i.config.enablePivotPanel,headers:i.headers,pivotFields:l,pivot:i.getPivot(),setPivot:i.setPivot,open:e,searchEnabled:o.searchEnabled,searchPlaceholder:o.searchPlaceholder,searchFunction:o.searchFunction,columnEditorConfig:o,icons:i.resolvedIcons,essentialAccessors:i.essentialAccessors,setHeaders:t=>{i.setHeaders(t),this.columnEditorInstance&&this.columnEditorInstance.update({headers:t}),i.onRender()},onColumnVisibilityChange:i.config.onColumnVisibilityChange,onColumnOrderChange:i.config.onColumnOrderChange,resetColumns:r,setOpen:n});this.columnEditorInstance=a,t.appendChild(a.element)}}renderHorizontalScrollbar(t,e,n,o,i,s,r,l){var a,d,c,u,h;if(!t||!r)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;const v=null!==(c=null===(d=l.mainBodyRef.current)||void 0===d?void 0:d.clientWidth)&&void 0!==c?c:Math.max(0,r.clientWidth-n-o);if(1>=e-v&&1>=f.scrollWidth-f.clientWidth)return this.horizontalScrollbarRef.current&&(Uo(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null));this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?_o(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:lt(l.config.enableColumnEditor,null===(u=l.config.columnEditorConfig)||void 0===u?void 0:u.showToggle),sectionScrollController:null!==(h=l.sectionScrollController)&&void 0!==h?h:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,u,h;if(!r||!t)return;const f=null!==(a=l.mainBodyRef.current)&&void 0!==a?a:l.mainHeaderRef.current;if(!f)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return _o(this.horizontalScrollbarRef.current,{mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:lt(l.config.enableColumnEditor,null===(d=l.config.columnEditorConfig)||void 0===d?void 0:d.showToggle),sectionScrollController:null!==(c=l.sectionScrollController)&&void 0!==c?c:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(u=l.sectionScrollController)&&void 0!==u?u:null;const v=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,enableColumnEditor:a,sectionScrollController:d,forceScrollable:c=!1}=t;if(!c){const t=e.clientWidth;if(1>=Math.max(e.scrollWidth,n)-t)return null}const u=a?st:0,h=(a?i+1:i)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),f=document.createElement("div");if(f.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=s+"px",t.appendChild(e),f.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),f.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(i>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),f.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(u>0){const t=document.createElement("div");t.style.width=u-1.5+"px",t.style.height="100%",t.style.flexShrink="0",f.appendChild(t)}return f})({mainBodyRef:f,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,enableColumnEditor:lt(l.config.enableColumnEditor,null===(h=l.config.columnEditorConfig)||void 0===h?void 0:h.showToggle),sectionScrollController:this.sectionScrollController,forceScrollable:!0});if(v){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(v,e.nextSibling):t.appendChild(v),this.horizontalScrollbarRef.current=v}this.scrollbarTimeoutId=null},1))}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&&(Uo(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(Ji(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}const Xi=new WeakSet,Qi=t=>Xi.has(t),Zi=t=>{if(t)return e=>{if(!Qi(e.row))return t(e)}};function ts(t){const{rows:e=[],rowGrouping:n=[],getRowId:o,expandedRows:i=new Map,collapsedRows:s=new Map,expandedDepths:r=new Set,rowStateMap:l=new Map,hasLoadingRenderer:a=!1,hasErrorRenderer:d=!1,hasEmptyRenderer:c=!1,headers:u=[],rowHeight:h=40,headerHeight:f=40,customTheme:v}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],i=[e],s=Bt({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0}),r=Gt({getRowId:o,row:t,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0,parentStableKey:null});return Object.assign({row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:s,rowPath:n,rowIndexPath:i,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:r},Qi(t)?{isLoadingSkeleton:!0}:{})});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const p=[],w=[],m=[],g=[];let b=0;const x=(t,e,y=[],R=[],S=[],C=null)=>{t.forEach((t,M)=>{var H,I;const k=n[e],E=p.length,T=[...y,M],A=[...R,M],O=Bt({row:t,getRowId:o,depth:e,index:M,rowPath:T,rowIndexPath:A,groupingKey:k}),P=Gt({getRowId:o,row:t,depth:e,index:M,rowPath:T,rowIndexPath:A,groupingKey:k,parentStableKey:C}),W=p.length,F=Object.assign({row:t,depth:e,displayPosition:b,groupingKey:k,position:E,isLastGroupRow:!1,rowId:O,rowPath:T,rowIndexPath:A,absoluteRowIndex:E,parentIndices:S.length>0?[...S]:void 0,stableRowKey:P},Qi(t)?{isLoadingSkeleton:!0}:{});p.push(F),w.push(F),b++;const $=Kt({stableRowKey:P,rowId:O});if(Jt($,e,r,i,s)&&n.length>e){const n=null==l?void 0:l.get($),o=((t,e)=>{const n=t[e];return Nt(n)?n:[]})(t,k),i=u.find(t=>t.expandable&&t.nestedTable);if((null==i?void 0:i.nestedTable)&&o.length>0){const n=p.length,s=(null===(H=i.nestedTable.customTheme)||void 0===H?void 0:H.rowHeight)||h,r=(null===(I=i.nestedTable.customTheme)||void 0===I?void 0:I.headerHeight)||f,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:s,headerHeight:r,customTheme:v}),a=Ft({calculatedHeight:l,customHeight:i.nestedTable.height,customTheme:v});m.push([n,a-h]);const d=[...T,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:A,stableRowKey:_t($,k),nestedTable:{parentRow:t,expandableHeader:i,childAccessor:k,calculatedHeight:a},absoluteRowIndex:n})}else if(n&&(n.loading||n.error||n.isEmpty)){if(n.loading&&a||n.error&&d||n.isEmpty&&c){const o=p.length,i=[...T,k];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:o,isLastGroupRow:!1,rowId:i,rowPath:i,rowIndexPath:A,stableRowKey:_t($,k),stateIndicator:{parentRowId:$,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...S,W]})}else if(n.loading&&!a){const t=p.length,n=[...T,k,"loading-skeleton"];p.push({row:{},depth:e+1,displayPosition:b-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:A,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...S,W]})}}else if(o.length>0){const t=[...T,k],n=[...A];x(o,e+1,t,n,[...S,W],P)}}0===e&&g.push(p.length)})};return x(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&p.length>n&&(p[n].isLastGroupRow=!0)}),{flattenedRows:p,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}class es{constructor(){this.lastHeadersRef=null,this.lastRowsRef=null,this.flattenedRowsCache=null,this.lastProcessedResult=null,this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null,this.tableRenderer=new Yi}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}getCurrentBodyLayouts(){return this.tableRenderer.getCurrentBodyLayouts()}virtualizeMainColumnsForScroll(t,e){this.tableRenderer.virtualizeMainColumnsForScroll(t,e)}setOnRendererHostDiscard(t){this.tableRenderer.setOnRendererHostDiscard(t)}invalidateCache(t){this.tableRenderer.invalidateCache(t),t&&"all"!==t&&"body"!==t||(this.flattenedRowsCache=null,this.lastProcessedResult=null),t&&"all"!==t&&"body"!==t&&"context"!==t||(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null,this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null),t&&"all"!==t&&"header"!==t||(this.lastScrollRafPaintedRange=null,this.scrollRafHeadersMemo=null)}invalidateCustomFooterCache(){this.tableRenderer.invalidateCustomFooterCache()}computeEffectiveHeaders(t,e,n,o){var i;let s=[...t];return lo(e)&&!(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,editable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,sortable:!1,filterable:!1,align:"center"},...s]),null!=o&&o>0?te(s,{containerWidth:o}):te(s)}primeLastProcessedResult(t,e){var n;const o=this.buildRowModelSnapshot(t,e);o&&(this.lastProcessedResult=o.processedResult,null===(n=t.rowSelectionManager)||void 0===n||n.updateConfig({tableRows:o.processedResult.currentTableRows}))}buildRowModelSnapshot(t,e){var n,o,i,s,r,l,a,d,c,u,h,f,v,p,w,m,g,b,x,y;if(this.lastHeadersRef!==t.headers&&(this.invalidateCache("header"),t.columnDragging?this.scrollRafHeadersMemo=null:this.invalidateCache("context"),this.lastHeadersRef=t.headers),!t.dimensionManager)return null;const R=t.dimensionManager.getState(),{containerWidth:S,calculatedHeaderHeight:C,maxHeaderDepth:M}=R,H=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let I;const k=(null===(n=this.scrollRafHeadersMemo)||void 0===n?void 0:n.headersRef)===t.headers;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&k&&this.scrollRafHeadersMemo.containerWidth===S&&this.scrollRafHeadersMemo.collapsedKey===H?I=this.scrollRafHeadersMemo.effectiveHeaders:(I=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,S),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:S,collapsedKey:H,effectiveHeaders:I}:null);const{leftWidth:E,rightWidth:T}=Yo({headers:I,containerWidth:S,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&S>0&&(I=go(I,{autoExpandColumns:!0,containerWidth:S,pinnedLeftWidth:E,pinnedRightWidth:T,mainBodyRef:null!==(o=t.mainBodyRef)&&void 0!==o?o:{current:null},isResizing:null!==(i=t.isResizing)&&void 0!==i&&i,collapsedHeaders:t.collapsedHeaders}));let A=t.localRows;t.sortManager?A=t.sortManager.getSortedRows():t.filterManager&&(A=t.filterManager.getFilteredRows()),this.lastRowsRef!==A&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=A);const O=t.internalIsLoading,P=null===(s=t.sortManager)||void 0===s?void 0:s.getState(),W=null===(r=t.filterManager)||void 0===r?void 0:r.getState(),F=(null==P?void 0:P.sort)?`${P.sort.key.accessor}-${P.sort.direction}`:"none",$=JSON.stringify((null==W?void 0:W.filters)||{}),D=t.config.quickFilter,L=D?`${null!==(l=D.text)&&void 0!==l?l:""}|${null!==(a=D.mode)&&void 0!==a?a:"simple"}`:"",j=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===A&&this.flattenedRowsCache.deps.isLoading===O&&this.flattenedRowsCache.deps.quickFilterKey===L&&this.flattenedRowsCache.deps.expandedRowsSize===t.expandedRows.size&&this.flattenedRowsCache.deps.collapsedRowsSize===t.collapsedRows.size&&this.flattenedRowsCache.deps.expandedDepthsSize===t.expandedDepths.size&&this.flattenedRowsCache.deps.rowStateMapSize===t.rowStateMap.size&&this.flattenedRowsCache.deps.sortKey===F&&this.flattenedRowsCache.deps.filterKey===$;let N,B,z;if(j&&this.flattenedRowsCache)N=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,z=this.flattenedRowsCache.flattenResult;else{N=t.sortManager?A:zn({rows:A,headers:t.headers,rowGrouping:t.config.rowGrouping}),B=(({rows:t,headers:e,quickFilter:n})=>{if(!n||!n.text||""===n.text.trim())return t;const{text:o,columns:i,caseSensitive:s=!1,mode:r="simple",useFormattedValue:l=!0}=n,a=e.filter(t=>!pt(t)&&(i&&i.length>0?i.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 i=t.substring(o,n);i&&e.push({type:"negation",value:i});continue}if('"'===t[n]){n++;const o=n;for(;t.length>n&&'"'!==t[n];)n++;const i=t.substring(o,n);i&&e.push({type:"phrase",value:i}),t.length>n&&'"'===t[n]&&n++;continue}const o=n;for(;t.length>n&&!/[\s:]/.test(t[n]);)n++;const i=t.substring(o,n);if(t.length>n&&":"===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:"columnSpecific",value:s,column:i});continue}i&&e.push({type:"word",value:i})}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(i=>{try{let r;if(i.quickFilterGetter)r=i.quickFilterGetter({row:t,accessor:i.accessor});else{const e=Dt(t,i.accessor);if(l&&i.valueFormatter){const n=i.valueFormatter({accessor:i.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(i.accessor);a&&a.forEach(t=>{const n=d[t],o=s?r:r.toLowerCase(),i=s?n.value:n.value.toLowerCase();o.includes(i)&&e.add(t)})}catch(t){console.warn(`Quick filter error for column ${i.accessor}:`,t)}});const i=s?o.join(" "):o.join(" ").toLowerCase();return d.forEach((t,n)=>{if("columnSpecific"===t.type)return;const o=s?t.value:t.value.toLowerCase();switch(t.type){case"word":case"phrase":i.includes(o)&&e.add(n);break;case"negation":i.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=Dt(t,e.accessor);if(l&&e.valueFormatter){const i=e.valueFormatter({accessor:e.accessor,colIndex:0,row:t,rowIndex:0,value:o});n=Array.isArray(i)?i.join(" "):i+""}else n=null==o?"":Array.isArray(o)?o.join(" "):o+""}return((t,e,n)=>{if(!e)return!0;const o=n?t:t.toLowerCase(),i=n?e:e.toLowerCase();return o.includes(i)})(n,o,s)}catch(t){return console.warn(`Quick filter error for column ${e.accessor}:`,t),!1}})})})({rows:N,headers:I,quickFilter:t.config.quickFilter});let n=B,o=!1;if(O){let i=t.config.enablePagination&&null!==(d=t.config.rowsPerPage)&&void 0!==d?d:10;e.isMainSectionScrollable&&(i+=1);const s=Array.from({length:i},()=>(()=>{const t={};return Xi.add(t),t})());n=0===n.length?s:[...n,...s],o=!0}z=ts({rows:n,rowGrouping:t.config.rowGrouping,getRowId:o?Zi(t.config.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:I,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:N,quickFilteredRows:B,flattenResult:z,deps:{rowsRef:A,isLoading:O,quickFilterKey:L,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:F,filterKey:$}}}const V=!1===t.config.enableVirtualization?void 0:(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s,externalViewportHeight:r,container:l})=>{if(e){const t=uo(e,null!=l?l:null);if(0===t)return;const r=i||n;if(t>=r+o*n+(s||0))return;return Math.max(0,t-r)}if(void 0!==r&&r>0)return Math.max(0,r-(i||n));if(!t)return;const a=uo(t,null!=l?l:null);return 0!==a?Math.max(0,a-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,enablePagination:null!==(c=t.config.enablePagination)&&void 0!==c&&c,rowsPerPage:null!==(u=t.config.rowsPerPage)&&void 0!==u?u:10,totalRowCount:null!==(h=t.config.totalRowCount)&&void 0!==h?h:z.paginatableRows.length,headerHeight:C,footerHeight:!t.config.enablePagination&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight,container:t.mainBodyRef.current}),q=null!==(f=t.config.enablePagination)&&void 0!==f&&f,G=null!==(v=t.config.rowsPerPage)&&void 0!==v?v:10,K=null!==(p=t.config.serverSidePagination)&&void 0!==p&&p,_=null!==(w=t.config.totalRowCount)&&void 0!==w?w:z.paginatableRows.length,U=null!==(g=null===(m=t.config.rowGrouping)||void 0===m?void 0:m.join("\0"))&&void 0!==g?g:"",J=null!==(x=null===(b=z.heightOffsets)||void 0===b?void 0:b.length)&&void 0!==x?x:0;let Y=0;if(z.heightOffsets)for(const[,t]of z.heightOffsets)Y+=t;const X=null!==(y=t.config.enableStickyParents)&&void 0!==y&&y,Q=void 0===V?"":`${j?1:0}|${V}|${e.currentPage}|${G}|${q}|${K}|${t.customTheme.rowHeight}|${C}|${_}|${X}|${U}|${z.flattenedRows.length}|${J}|${Y}`;let Z;return(t.positionOnlyBody||t.columnDragging)&&void 0!==V&&null!==this.processRowsScrollReuseKey&&null!==this.processRowsScrollReuseBase&&this.processRowsScrollReuseKey===Q&&this.processRowsScrollReuseBase?Z=function(t,e){const{contentHeight:n,rowHeight:o,scrollDirection:i="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=it(o),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:u}=t;let h,f,v,p,w=0,m=d.length;if(void 0===n)h=d,f=[],v=h,p=[];else{const t=_n({bufferRowCount:a,contentHeight:n,tableRows:d,rowHeight:o,scrollTop:s,scrollDirection:i,heightMap:u});if(h=t.rendered.rows,w=t.rendered.startIndex,m=t.rendered.endIndex,r)if(l){const e=Zn(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);f=e.stickyParents,v=e.regularRows,p=t.partiallyVisible.rows}else f=[],v=t.rendered.rows,p=[];else f=[],v=h,p=[]}return{currentTableRows:d,rowsToRender:h,renderedStartIndex:w,renderedEndIndex:m,stickyParents:f,regularRows:v,partiallyVisibleRows:p,paginatedHeightOffsets:c,heightMap:u,allFlattenedRows:t.allFlattenedRows,pageStartIndex:t.pageStartIndex}}(this.processRowsScrollReuseBase,{contentHeight:V,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,enableStickyParents:X,rowGrouping:t.config.rowGrouping}):(Z=function(t){var e;const{contentHeight:n,currentPage:o,customTheme:i,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:a,rowHeight:d,rowsPerPage:c,scrollDirection:u="none",scrollTop:h,serverSidePagination:f,enablePagination:v,rowGrouping:p}=t,w=it(d),m=function(t,e,n,o,i,s){if(!i||s)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:i&&!s?a+e:e;return Object.assign(Object.assign({},t),{position:e,absoluteRowIndex:n})})}(r,a,o,c,v,f);let g=0;if(v&&!f){const t=(o-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const b=l&&0!==l.length&&v&&!f?(()=>{const t=new Map;return m.forEach(e=>{e.nestedTable&&t.set(e.absoluteRowIndex,e.position)}),l.filter(([e])=>t.has(e)).map(([e,n])=>[t.get(e),n])})():l,x=b&&b.length>0?((t,e,n,o)=>{const i=e+o.rowSeparatorWidth,s=Array(t),r=new Map;n&&n.forEach(([t,e])=>{r.set(t,e)});let l=0;for(let e=0;t>e;e++){s[e]=l,l+=i;const t=r.get(e);void 0!==t&&(l+=t)}return{rowTopPositions:s,totalHeight:l-o.rowSeparatorWidth}})(m.length,d,b,i):void 0;let y,R,S,C,M=0,H=m.length;if(void 0===n)y=m,R=[],S=y,C=[];else{const t=_n({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:h,scrollDirection:u,heightMap:x});if(y=t.rendered.rows,M=t.rendered.startIndex,H=t.rendered.endIndex,s)if(p){const e=Zn(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,p);R=e.stickyParents,S=e.regularRows,C=t.partiallyVisible.rows}else R=[],S=t.rendered.rows,C=[];else R=[],S=y,C=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:M,renderedEndIndex:H,stickyParents:R,regularRows:S,partiallyVisibleRows:C,paginatedHeightOffsets:b,heightMap:x,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:z.flattenedRows,paginatableRows:z.paginatableRows,parentEndPositions:z.parentEndPositions,currentPage:e.currentPage,rowsPerPage:G,enablePagination:q,serverSidePagination:K,contentHeight:V,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:z.heightOffsets,customTheme:t.customTheme,enableStickyParents:X,rowGrouping:t.config.rowGrouping}),void 0!==V?(this.processRowsScrollReuseKey=Q,this.processRowsScrollReuseBase={currentTableRows:Z.currentTableRows,paginatedHeightOffsets:Z.paginatedHeightOffsets,heightMap:Z.heightMap,allFlattenedRows:Z.allFlattenedRows,pageStartIndex:Z.pageStartIndex}):(this.processRowsScrollReuseKey=null,this.processRowsScrollReuseBase=null)),{dimensionState:R,containerWidth:S,effectiveHeaders:I,calculatedHeaderHeight:C,maxHeaderDepth:M,flattenResult:z,processedResult:Z,headersUnchangedForScrollBailout:k}}render(t,e,n,o,i){var s,r,l,a,d,c,u,h,f;const v=null!==(c=null!==(l=null===(r=null===(s=n.mainBodyRef)||void 0===s?void 0:s.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,p=this.buildRowModelSnapshot(n,o);if(!p)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:b,maxHeaderDepth:x,flattenResult:y,processedResult:R,headersUnchangedForScrollBailout:S}=p;this.lastProcessedResult=R;const C=!0===n.positionOnlyBody;if(C&&!n.columnDragging&&S&&null!==this.lastScrollRafPaintedRange&&R.renderedStartIndex===this.lastScrollRafPaintedRange.start&&R.renderedEndIndex===this.lastScrollRafPaintedRange.end)return;null===(u=n.rowSelectionManager)||void 0===u||u.updateConfig({tableRows:R.currentTableRows});const{mainWidth:M,leftWidth:H,rightWidth:I,leftContentWidth:k,rightContentWidth:E}=Yo({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),T=m-H-I;if(C)n.columnDragging&&this.renderHeader(t.headerContainer,b,x,g,n);else{const e=t=>"number"==typeof t?t+"px":t,s=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);s.maxHeight=t,s.height=void 0===w.contentHeight?"auto":t}else s.removeProperty("max-height"),n.config.height?s.height=e(n.config.height):s.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:r}=n;s.setProperty("--st-main-section-width",T+"px"),s.setProperty("--st-scrollbar-width",o.scrollbarWidth+"px");const l=rt(n.config.enableColumnEditor,i.showToggle);s.setProperty("--st-editor-width",l+"px"),s.setProperty("--st-border-width",r.borderWidth+"px"),s.setProperty("--st-footer-height",r.footerHeight+"px"),s.setProperty("--st-calculated-header-height",b+"px");const a=null!==(h=n.config.columnResizing)&&void 0!==h&&h;t.content.className="st-content "+(a?"st-resizeable":"st-not-resizeable"),t.content.style.width=l>0?`calc(100% - ${l}px)`:"100%",this.renderHeader(t.headerContainer,b,x,g,n)}this.renderBody(t.bodyContainer,R,g,n,o),this.lastScrollRafPaintedRange=C?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const A=n.sectionScrollController;A&&(A.setSectionScrollLeft("main",v),null!=n.pinnedLeftRef.current&&A.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&A.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),A.restoreAll()),C||(this.renderFooter(t.footerContainer,null!==(f=n.config.totalRowCount)&&void 0!==f?f:y.paginatableRows.length,o.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,o.columnEditorOpen,i,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,M,H,I,k,E,e.tableBodyContainerRef.current,g,n))}renderHeader(t,e,n,o,i){if(i.config.hideHeader)return;const s=this.buildRendererDeps(o,i);this.tableRenderer.renderHeader(t,e,n,s)}renderBody(t,e,n,o,i){const s=this.buildRendererDeps(n,o,i);this.tableRenderer.renderBody(t,e,s)}renderFooter(t,e,n,o,i){const s=this.buildRendererDeps(o,i);this.tableRenderer.renderFooter(t,e,n,t=>{i.setCurrentPage(t),i.onRender()},s)}renderColumnEditor(t,e,n,o,i){const s=this.buildRendererDeps(o,i);this.tableRenderer.renderColumnEditor(t,e,t=>{i.setColumnEditorOpen(t),i.onRender()},n,s)}renderHorizontalScrollbar(t,e,n,o,i,s,r,l,a){if(!a.mainBodyRef.current&&!a.mainHeaderRef.current||!r)return;const d=this.buildRendererDeps(l,a);this.tableRenderer.renderHorizontalScrollbar(t,e,n,o,i,s,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,n){return{accordionAxis:e.accordionAxis,externalScrollActive:void 0!==e.externalViewportHeight,stickyParentsScrollTop:null==n?void 0:n.scrollTop,animationCoordinator:e.animationCoordinator,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,hoverScopeId:e.hoverScopeId,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,createNestedTable:e.createNestedTable,onRender:e.onRender,getShrinkFloors:e.getShrinkFloors,onAutoExpandNaturalWidths:e.onAutoExpandNaturalWidths,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,getPristineDefaultHeaders:e.getPristineDefaultHeaders,getPivot:e.getPivot,setPivot:e.setPivot,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const ns=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class os{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||ts({rows:t.getPivotedRows(),rowGrouping:t.getEffectiveRowGrouping(),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})},n=new Map,o=new Set;let i=!1,s=!1,r=null;const l=()=>{var e,s;if(i=!1,0===n.size)return void(o.size>0&&!(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))?a():o.size>0&&c());let r=!1;n.forEach((e,o)=>{var i,s;if(null===(i=t.isCellAnimating)||void 0===i?void 0:i.call(t,o))return void(r=!0);const l=null===(s=t.cellRegistry)||void 0===s?void 0:s.get(o);l&&l.updateContent(e),n.delete(o)}),r&&n.size>0&&c(),(null===(s=t.hasAnimatingCells)||void 0===s?void 0:s.call(t))?c():a()},a=()=>{null==r&&(r=setTimeout(()=>{r=null,(()=>{var e,n,i,s,r,l;if(null===(e=t.hasAnimatingCells)||void 0===e?void 0:e.call(t))return void c();const a=o;if(0===a.size)return;const d=null===(n=t.filterManager)||void 0===n?void 0:n.getFilters(),u=(d?Object.keys(d):[]).some(t=>a.has(t)),h=null===(i=t.sortManager)||void 0===i?void 0:i.getSortColumn(),f=!(!h||!a.has(h.key.accessor+"")),v=(null!==(l=null===(r=null===(s=t.config.quickFilter)||void 0===s?void 0:s.text)||void 0===r?void 0:r.trim())&&void 0!==l?l:"").length>0;if(!u&&!f&&!v)return void a.clear();a.clear();const p=()=>{var e,n,o;if(u&&t.filterManager&&t.filterManager.updateConfig({rows:t.localRows}),f&&t.sortManager){const o=null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:t.localRows;t.sortManager.updateConfig({tableRows:o})}v&&(null===(o=t.invalidateRowsCache)||void 0===o||o.call(t),t.onRender())};t.runWithoutAnimationSnapshot?t.runWithoutAnimationSnapshot(p):p()})()},400))},d=()=>{i||(i=!0,queueMicrotask(l))},c=()=>{s||(s=!0,setTimeout(()=>{s=!1,(n.size>0||o.size>0)&&d()},120))};let u=null,h=null;return{updateData:e=>{var i;const{accessor:s,newValue:r}=e,l=(e=>null!=e.rowId&&""!==e.rowId?(()=>{const e=t.localRows,n=t.config.getRowId;if(h&&h.rowsRef===e&&h.getRowId===n)return h.map;const o=new Map;for(let t=0;e.length>t;t++){const i=e[t];if(!n)continue;const s=n({row:i,depth:0,index:t,rowPath:[t],rowIndexPath:[t]});null!=s&&""!==s&&o.set(s+"",t)}return h={rowsRef:e,getRowId:n,map:o},o})().get(e.rowId+""):"number"==typeof e.rowIndex?e.rowIndex:void 0)(e);if(void 0===l||0>l||l>=t.localRows.length)return;const a=t.localRows[l];jt(a,s,r);const c=(e=>{var n;const o=null===(n=t.getCachedProcessedResult)||void 0===n?void 0:n.call(t),i=null==o?void 0:o.rowsToRender;if(i&&0!==i.length){if(!u||u.rowsRef!==i){const t=new WeakMap;for(const e of i)e.row&&t.set(e.row,e);u={rowsRef:i,map:t}}return u.map.get(e)}})(a),f=c?null!==(i=c.stableRowKey)&&void 0!==i?i:zt(c.rowId):Gt({getRowId:t.config.getRowId,row:a,depth:0,index:l,rowPath:[l],rowIndexPath:[l]}),v=xt({accessor:s,rowId:f});n.set(v,r),o.add(s+""),d()},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"),i=URL.createObjectURL(n);o.setAttribute("href",i),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)})(((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),i=o.map(t=>ns(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const i=Dt(n,t.accessor);if(t.exportValueGetter){const s=t.valueFormatter?t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i}):void 0,r=t.exportValueGetter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i,formattedValue:s});return ns(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i});return ns(s)}return ns(i)}).join(",")});return(n?[i,...s]:s).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:()=>Fn(t.headers),applyPinnedState:async e=>{const n=Dn(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{const e=t.getPivot()?Mn(t.getPivotHeaders()):Mn(t.getPristineDefaultHeaders());t.setHeaders(e),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 i=null!==(n=t.config.totalRowCount)&&void 0!==n?n:e().paginatableRows.length;return Math.ceil(i/(null!==(o=t.config.rowsPerPage)&&void 0!==o?o:10))},setPage:async n=>{var o,i;const s=null!==(o=t.config.totalRowCount)&&void 0!==o?o:e().paginatableRows.length,r=null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10;1>n||n>Math.ceil(s/r)||(t.setCurrentPage(n),t.onRender(),t.config.onPageChange&&await t.config.onPageChange(n))},expandAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.expandAll()},collapseAll:()=>{var e;t.clearExpandedRows(),t.clearCollapsedRows(),null===(e=t.expandedDepthsManager)||void 0===e||e.collapseAll()},expandDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.expandDepth(e)},collapseDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.collapseDepth(e)},toggleDepth:e=>{var n;t.clearExpandedRows(),t.clearCollapsedRows(),null===(n=t.expandedDepthsManager)||void 0===n||n.toggleDepth(e)},setExpandedDepths:e=>{var n,o;t.clearExpandedRows(),t.clearCollapsedRows();const i=t.expandedDepthsManager;if(i){const s=null!==(o=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.length)&&void 0!==o?o:0,r=0===s?new Set:new Set([...e].filter(t=>Number.isInteger(t)&&t>=0&&s>t));return void i.setExpandedDepths(r)}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.getEffectiveRowGrouping())||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.getEffectiveRowGrouping())||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},setPivot:e=>{t.setPivot(e)},getPivot:()=>t.getPivot(),getPivotHeaders:()=>t.getPivotHeaders(),getPivotedRows:()=>t.getPivotedRows(),toggleColumnEditor:e=>{t.config.enableColumnEditor&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const i=o.accessor+"";let s=i in e?!e[i]:o.hide;return An(o,t.essentialAccessors)&&(s=!1),Object.assign(Object.assign({},o),{hide:s,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)},getSelectedRows:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRows())&&void 0!==n?n:new Set},getSelectedRowsData:()=>{var e,n;return null!==(n=null===(e=t.rowSelectionManager)||void 0===e?void 0:e.getSelectedRowsData())&&void 0!==n?n:[]},getRow:e=>{var n,o;const i=e+"",s=null===(n=t.rowSelectionManager)||void 0===n?void 0:n.getRow(i);if(void 0!==s)return s;const r=null===(o=t.getCachedProcessedResult)||void 0===o?void 0:o.call(t);if(r){const t=r.currentTableRows.find(t=>null!=(null==t?void 0:t.rowId)&&zt(t.rowId)===i);if(t)return t.row}},selectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.selectRow(e+"")},deselectRow:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.deselectRow(e+"")},toggleRowSelection:e=>{var n;null===(n=t.rowSelectionManager)||void 0===n||n.handleToggleRow(e+"")},clearRowSelection:()=>{var e;null===(e=t.rowSelectionManager)||void 0===e||e.clearSelection()}}}}class is{constructor(t){this.hasWarned=!1,this.timeoutId=null,this.host=t}schedule(){(()=>{try{const t=globalThis.process;return!!(null==t?void 0:t.env)&&"production"!==t.env.NODE_ENV}catch(t){return!1}})()&&(this.hasWarned||null===this.timeoutId&&"undefined"!=typeof window&&(this.host.isVirtualizationDisabled()||void 0===this.host.getContentHeight()&&(500>this.host.getRenderedRowCount()||(this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.evaluate()},400)))))}destroy(){null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}evaluate(){if(this.hasWarned||!this.host.isMounted())return;if(this.host.isVirtualizationDisabled())return;if(void 0!==this.host.getContentHeight())return;const t=this.host.getRenderedRowCount();if(500>t)return;this.hasWarned=!0;const e=this.host.hasScrollParent()?' A `scrollParent` is set but did not produce a bounded viewport — make sure it is an element whose visible height is smaller than its content (e.g. a fixed/max height with `overflow: auto`), or use `"window"`.':"";console.warn(`[simple-table] Rendering ${t} rows without virtualization. This can cause slow renders and high memory use. To virtualize, set \`height\` or \`maxHeight\` on the table, or pass a bounded \`scrollParent\`.`+e)}}const ss=t=>{const e=t.getRefs();return[e.mainBodyRef.current,e.pinnedLeftRef.current,e.pinnedRightRef.current].filter(t=>null!==t)},rs=t=>{const e=t.getRefs();return[e.mainHeaderRef.current,e.pinnedLeftHeaderRef.current,e.pinnedRightHeaderRef.current].filter(t=>null!==t)};class ls{constructor(t){this.subscribers=new Set,this.anchorRowId=null,this.keydownHandler=null,this.config=Object.assign({rowSelectionMode:"multiple",selectRowOnClick:!1,showRowSelectionColumn:!0,selectableCells:!1},t),this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[],activeRowId:null},this.setupKeyboardNavigation()}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}getMode(){var t;return null!==(t=this.config.rowSelectionMode)&&void 0!==t?t:"multiple"}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:ao(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))}fireChange(t,e,n){if(!this.config.onRowSelectionChange)return;const o=this.config.tableRows.find(e=>zt(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}applySelection(t){const e=this.state.selectedRows;this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.config.onRowSelectionChange&&new Set([...e,...t]).forEach(n=>{const o=e.has(n),i=t.has(n);o!==i&&this.fireChange(n,i,t)}),this.notifySubscribers()}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&"single"!==this.getMode()&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(zt(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}getRow(t){return((t,e)=>{const n=this.config.tableRows.find(t=>null!=(null==t?void 0:t.rowId)&&zt(t.rowId)===e);return null==n?void 0:n.row})(0,t)}getActiveRowId(){return this.state.activeRowId}setActiveRowId(t){this.state.activeRowId!==t&&(this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.notifySubscribers())}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=this.getMode(),o=((t,e,n,o="multiple")=>{if("single"===o){if(e)return new Set([t]);const o=new Set(n);return o.delete(t),o}const i=new Set(n);return e?i.add(t):i.delete(t),i})(t,e,this.state.selectedRows,n);o.size===this.state.selectedRows.size&&[...o].every(t=>this.state.selectedRows.has(t))||(this.anchorRowId=t,this.state=Object.assign(Object.assign({},this.state),{activeRowId:t}),this.applySelection(o))}selectRow(t){this.handleRowSelect(t,!0)}deselectRow(t){this.handleRowSelect(t,!1)}handleSelectAll(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return;let e;e=t?new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>zt(t.rowId))):new Set,this.applySelection(e)}handleToggleRow(t){if(!this.config.enableRowSelection)return;if("single"===this.getMode())return void this.handleRowSelect(t,!0);const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}handleRowClickSelect(t){this.config.enableRowSelection&&this.config.selectRowOnClick&&this.handleToggleRow(t)}clearSelection(){this.config.enableRowSelection&&0!==this.state.selectedRows.size&&this.applySelection(new Set)}getState(){return this.state}setupKeyboardNavigation(){this.keydownHandler=this.handleKeyDown.bind(this),document.addEventListener("keydown",this.keydownHandler)}isEventInsideTable(t){const e=this.config.tableRoot;if(!e)return!1;const n=t.target;return n instanceof Element&&Et(e,n)}isTypingInFormField(){const t=document.activeElement;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||"true"===(null==t?void 0:t.getAttribute("contenteditable"))}findRowIndex(t){return t?this.config.tableRows.findIndex(e=>zt(e.rowId)===t):-1}resolveActiveRowId(){if(this.state.activeRowId&&-1!==this.findRowIndex(this.state.activeRowId))return this.state.activeRowId;for(const t of this.state.selectedRows)if(-1!==this.findRowIndex(t))return t;const t=this.config.tableRows[0];return t?zt(t.rowId):null}moveActiveRow(t,e){var n;const o=this.config.tableRows;if(0===o.length)return;const i=Math.max(0,Math.min(o.length-1,t)),s=zt(o[i].rowId),r=this.getMode();if(this.state=Object.assign(Object.assign({},this.state),{activeRowId:s}),e&&"multiple"===r){const t=null!==(n=this.anchorRowId)&&void 0!==n?n:s,e=this.findRowIndex(t),r=((t,e,n)=>{const o=Math.min(e,n),i=Math.max(e,n),s=new Set([]);for(let e=o;i>=e;e++){const n=t[e];null!=(null==n?void 0:n.rowId)&&s.add(zt(n.rowId))}return s})(o,-1===e?i:e,i);return void this.applySelection(r)}this.anchorRowId=s,"single"===r?this.applySelection(new Set([s])):this.notifySubscribers()}handleKeyDown(t){var e,n,o;if(!this.config.enableRowSelection)return;if(!this.isEventInsideTable(t))return;if(this.isTypingInFormField())return;const i=!this.config.selectableCells,s=t.key;if(" "===s||"Spacebar"===s){if(t.target instanceof HTMLInputElement&&"checkbox"===t.target.type)return;t.preventDefault();const i=this.resolveActiveRowId();if(i){const t=null===(n=null===(e=document.activeElement)||void 0===e?void 0:e.closest)||void 0===n?void 0:n.call(e,"[data-row-id]"),s=null!==(o=null==t?void 0:t.getAttribute("data-row-id"))&&void 0!==o?o:i;this.handleToggleRow(s),this.state=Object.assign(Object.assign({},this.state),{activeRowId:s})}return}if(!i)return;if((t.ctrlKey||t.metaKey)&&"a"===s.toLowerCase())return void("multiple"===this.getMode()&&(t.preventDefault(),this.handleSelectAll(!0)));const r=this.resolveActiveRowId(),l=this.findRowIndex(r),a=this.config.tableRows.length-1;if(0>a)return;const d=t.shiftKey;"ArrowUp"===s?(t.preventDefault(),this.moveActiveRow(l>0?l-1:0,d)):"ArrowDown"===s?(t.preventDefault(),this.moveActiveRow(0>l?0:Math.min(a,l+1),d)):"Home"===s?(t.preventDefault(),this.moveActiveRow(0,d)):"End"===s&&(t.preventDefault(),this.moveActiveRow(a,d))}destroy(){this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.subscribers.clear()}}class as{constructor(t,e){var o,i,s;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.pristineDefaultHeaders=[],this.essentialAccessors=new Set,this.currentPage=1,this.isResizing=!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.hoverScopeId="st-hover-"+ ++as.nextHoverScopeId,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.suppressNextAnimationSnapshot=!1,this.cachedAPI=null,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.pivotManager=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.isUpdating=!1,this.bodyContainerMouseLeaveListener=null,this.liveHost=null,this.container=t,this.config=n(e);const r=this.config;this.customTheme=jn.mergeCustomTheme(r),this.mergedColumnEditorConfig=jn.mergeColumnEditorConfig(r),this.resolvedIcons=jn.resolveIcons(r),this.localRows=[...r.rows],this.ingestColumnSnapshot(r.columns),this.headers=Mn(this.pristineDefaultHeaders),this.columnEditorOpen=null!==(o=r.enableColumnEditorInitOpen)&&void 0!==o&&o,this.internalIsLoading=null!==(i=r.isLoading)&&void 0!==i&&i,this.pivotManager=new Ne({sourceRows:this.localRows,fieldHeaders:this.pristineDefaultHeaders,pivot:null!==(s=r.pivot)&&void 0!==s?s:null});const l=this.pivotManager.getState();l.active&&(this.headers=l.headers),this.essentialAccessors=jn.buildEssentialAccessors(this.headers),this.collapsedHeaders=jn.getInitialCollapsedHeaders(this.headers),this.expandedDepths=jn.getInitialExpandedDepths(Object.assign(Object.assign({},r),{rowGrouping:this.getEffectiveRowGrouping()})),this.domManager=new Co,this.renderOrchestrator=new es,this.animationCoordinator=new _,this.applyAnimationsConfig(e.animations),this.autoSizeManager=new ce,this.autoSizeManager.recomputeAccessors(this.headers,this.collapsedHeaders),this.externalScrollController=new be({getScrollParent:()=>this.config.scrollParent,getHeight:()=>this.config.height,getMaxHeight:()=>this.config.maxHeight,getBodyContainer:()=>{var t,e;return null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.bodyContainer)&&void 0!==e?e:null},getRootElement:()=>{var t,e;return null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:null},getFallbackRoot:()=>this.container,isMounted:()=>this.mounted,getDimensionManager:()=>this.dimensionManager,onInternalScroll:t=>this.handleScroll(t),onExternalScroll:t=>this.handleExternalScrollMetrics(t),onExternalResize:()=>this.render("external-scroll-resize")}),this.accordionController=new yt({animationCoordinator:this.animationCoordinator,getRoot:()=>this.getTableRoot(),getAnimatableContainers:()=>this.getAnimatableContainers(),getHeaders:()=>this.headers,getCollapsedHeaders:()=>this.collapsedHeaders,getEffectiveRowGrouping:()=>this.getEffectiveRowGrouping(),getCurrentBodyLayouts:()=>this.renderOrchestrator.getCurrentBodyLayouts(),getExternalVerticalScroll:()=>this.externalScrollController.getVerticalScrollMetrics()}),this.scrollCoalescer=new xe({getScrollManager:()=>this.scrollManager,shouldTrackInfiniteScroll:()=>!!this.config.onLoadMore,onRender:t=>this.render(t)}),this.unvirtualizedRowsWarning=new is({isMounted:()=>this.mounted,isVirtualizationDisabled:()=>!1===this.config.enableVirtualization,getContentHeight:()=>{var t;return null===(t=this.dimensionManager)||void 0===t?void 0:t.getContentHeight()},getRenderedRowCount:()=>{var t,e;return null!==(e=null===(t=this.renderOrchestrator.getLastProcessedResult())||void 0===t?void 0:t.currentTableRows.length)&&void 0!==e?e:0},hasScrollParent:()=>null!=this.config.scrollParent}),this.animationCoordinator.setOnHostDiscard(e.onRendererHostDiscard),this.renderOrchestrator.setOnRendererHostDiscard(e.onRendererHostDiscard),this.rebuildRowIndexMap(),this.initializeManagers()}ingestColumnSnapshot(t){const e=Mn(t);this.config.columns=e,this.pristineDefaultHeaders=e}applyAnimationsConfig(t){var e;this.animationCoordinator.setEnabled(null===(e=null==t?void 0:t.enabled)||void 0===e||e),void 0!==(null==t?void 0:t.duration)&&this.animationCoordinator.setDuration(t.duration),void 0!==(null==t?void 0:t.easing)&&this.animationCoordinator.setEasing(t.easing)}rebuildRowIndexMap(){this.rowIndexMap.clear(),this.localRows.forEach((t,e)=>{const n=Bt({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=zt(n);this.rowIndexMap.set(o,e)})}getAnimatableContainers(){return[...ss(t=this.domManager),...rs(t)];var t}applyHeaders(t){var e,n;if(this.accordionController.didColumnVisibilityChange(t))this.accordionController.begin("horizontal");else if(this.draggedHeaderRef.current||this.animationCoordinator.isColumnReordering()){const t=null!==(n=null===(e=this.domManager.getElements())||void 0===e?void 0:e.rootElement)&&void 0!==n?n:this.container;this.animationCoordinator.beginColumnReorder(t)}else this.accordionController.captureSnapshot();this.headers=Mn(t),this.renderOrchestrator.invalidateCache("header")}initializeManagers(){const t=(t=>{var e,n,o,i;const s=t.getConfig(),r=new ro;r.subscribe(e=>{t.onAnnouncement(e)});const l=new En(null===(e=s.expandAll)||void 0===e||e,t.getEffectiveRowGrouping());l.subscribe(e=>{t.onExpandedDepths(e)});const a=t=>{r.announce(t)},d=null===(n=t.getPivotManager())||void 0===n?void 0:n.getState(),c=(null==d?void 0:d.active)?d.pivotedRows:t.getLocalRows(),u=new Vn({headers:t.getHeaders(),tableRows:c,externalSortHandling:s.externalSortHandling||!1,onSortChange:e=>{var n,o;return null===(o=(n=t.getConfig()).onSortChange)||void 0===o?void 0:o.call(n,e)},rowGrouping:t.getEffectiveRowGrouping(),initialSortColumn:s.initialSortColumn,initialSortDirection:s.initialSortDirection,announce:a});u.subscribe(()=>{t.onSortNotify()});const h=new qn({rows:t.getLocalRows(),headers:t.getPristineDefaultHeaders(),externalFilterHandling:s.externalFilterHandling||!1,onFilterChange:e=>{var n,o;return null===(o=(n=t.getConfig()).onFilterChange)||void 0===o?void 0:o.call(n,e)},announce:a});h.subscribe(e=>{t.onFilterNotify(e.filteredRows)});const f=t.getCustomTheme(),v=new so({selectableCells:null!==(o=s.selectableCells)&&void 0!==o&&o,selectableColumns:null!==(i=s.selectableColumns)&&void 0!==i&&i,headers:t.getHeaders(),tableRows:[],onCellEdit:e=>{var n,o;return null===(o=(n=t.getConfig()).onCellEdit)||void 0===o?void 0:o.call(n,e)},cellRegistry:t.getCellRegistry(),collapsedHeaders:t.getCollapsedHeaders(),rowHeight:f.rowHeight,enableRowSelection:lo(s),copyHeadersToClipboard:s.copyHeadersToClipboard,customTheme:f,tableRoot:t.getTableRoot(),onSelectionDragEnd:()=>t.onSelectionDragEnd()});return{ariaAnnouncementManager:r,expandedDepthsManager:l,sortManager:u,filterManager:h,selectionManager:v}})({getConfig:()=>this.config,getHeaders:()=>this.headers,getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getLocalRows:()=>this.localRows,getCustomTheme:()=>this.customTheme,getCollapsedHeaders:()=>this.collapsedHeaders,getCellRegistry:()=>this.cellRegistry,getTableRoot:()=>this.getTableRoot(),getEffectiveRowGrouping:()=>this.getEffectiveRowGrouping(),getPivotManager:()=>this.pivotManager,onAnnouncement:t=>{this.announcement=t,this.updateAriaLiveRegion()},onExpandedDepths:t=>{this.accordionController.begin("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")},onSortNotify:()=>{this.suppressNextAnimationSnapshot?this.render("live-sort"):(this.accordionController.captureSnapshot(),this.render("sortManager"))},onFilterNotify:t=>{this.syncPivotPipeline(t),this.render("filterManager")},onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}});this.ariaAnnouncementManager=t.ariaAnnouncementManager,this.expandedDepthsManager=t.expandedDepthsManager,this.sortManager=t.sortManager,this.filterManager=t.filterManager,this.selectionManager=t.selectionManager}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.bindTableRoot(),this.setupManagers())}setupManagers(){const t=this.domManager.getRefs();if(!this.domManager.getElements())return;const e=((t,e)=>{var n,o,i;if(!e.tableBodyContainerRef.current)return null;const s=t.getConfig(),r=t.getCustomTheme();let l=So(e.tableBodyContainerRef.current);const a=t.getRenderOrchestrator().computeEffectiveHeaders(t.getHeaders(),s,r),d=new ho({effectiveHeaders:a,headerHeight:r.headerHeight,rowHeight:r.rowHeight,height:s.height,maxHeight:s.maxHeight,totalRowCount:null!==(n=s.totalRowCount)&&void 0!==n?n:t.getLocalRowCount(),footerHeight:!s.enablePagination&&!s.footerRenderer||s.hideFooter?void 0:r.footerHeight,containerElement:e.tableBodyContainerRef.current});let c=!0;d.subscribe(()=>{t.onRender("dimensionManager"),c&&(c=!1,t.onFirstDimensionPaint())});const u=new fo({onLoadMore:s.onLoadMore,infiniteScrollThreshold:null!==(o=s.infiniteScrollThreshold)&&void 0!==o?o:200}),h=new vo({onMainSectionScrollLeft:e=>{const n=t.getSelectionManager(),o=t.getConfig(),i=n&&(o.selectableCells||o.selectableColumns)?{columnsWithSelectedCells:n.getColumnsWithSelectedCells(),selectedColumns:n.getSelectedColumns()}:void 0;t.getRenderOrchestrator().virtualizeMainColumnsForScroll(e,i)}});let f=null;s.autoExpandColumns&&(f=new bo({autoExpandColumns:s.autoExpandColumns,containerWidth:d.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:e.mainBodyRef,isResizing:t.getIsResizing(),collapsedHeaders:t.getCollapsedHeaders()},()=>{t.onRender("autoScaleManager")}));let v=null;e.headerContainerRef.current&&e.tableBodyContainerRef.current&&(v=new Ro({headerContainer:e.headerContainerRef.current,mainSection:e.tableBodyContainerRef.current,scrollbarWidth:l}),v.subscribe(n=>{e.tableBodyContainerRef.current&&(l=So(e.tableBodyContainerRef.current)),t.onScrollbarVisibilityChange(n,l)}));const p=new xo;p.addCallback(()=>{if(e.tableBodyContainerRef.current){const n=So(e.tableBodyContainerRef.current);l=n,null==v||v.setScrollbarWidth(n),t.onScrollbarWidthChange(n)}t.onRender("scrollbarWidth-change")});let w=null;const m=t.getSelectionManager();return m&&(w=new yo({selectableColumns:null!==(i=s.selectableColumns)&&void 0!==i&&i,selectedCells:new Set,selectedColumns:new Set,setSelectedCells:t=>m.setSelectedCells(t),setSelectedColumns:t=>m.setSelectedColumns(t),getSelectedCells:()=>m.getSelectedCells(),getSelectedColumns:()=>m.getSelectedColumns(),onClearSelection:()=>m.clearSelection()}),w.startListening()),{dimensionManager:d,scrollManager:u,sectionScrollController:h,autoScaleManager:f,scrollbarVisibilityManager:v,windowResizeManager:p,handleOutsideClickManager:w,scrollbarWidth:l}})({getConfig:()=>this.config,getCustomTheme:()=>this.customTheme,getHeaders:()=>this.headers,getCollapsedHeaders:()=>this.collapsedHeaders,getLocalRowCount:()=>this.localRows.length,getIsResizing:()=>this.isResizing,getSelectionManager:()=>this.selectionManager,getRenderOrchestrator:()=>this.renderOrchestrator,onRender:t=>this.render(t),onFirstDimensionPaint:()=>{var t,e;this.firstRenderDone=!0,this.externalScrollController.getResolvedParent()&&"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(()=>{this.mounted&&this.externalScrollController.recomputeViewportHeight()}),null===(e=(t=this.config).onTableReady)||void 0===e||e.call(t)},onScrollbarVisibilityChange:(t,e)=>{this.isMainSectionScrollable=t,this.scrollbarWidth=e,this.render("scrollbarVisibilityManager")},onScrollbarWidthChange:t=>{this.scrollbarWidth=t}},t);e&&(this.dimensionManager=e.dimensionManager,this.scrollManager=e.scrollManager,this.sectionScrollController=e.sectionScrollController,this.autoScaleManager=e.autoScaleManager,this.scrollbarVisibilityManager=e.scrollbarVisibilityManager,this.windowResizeManager=e.windowResizeManager,this.handleOutsideClickManager=e.handleOutsideClickManager,this.scrollbarWidth=e.scrollbarWidth,this.syncRowSelectionManager(),this.setupEventListeners(),this.renderOrchestrator.primeLastProcessedResult(this.getRenderContext(),this.getRenderState()))}setupEventListeners(){const t=this.domManager.getElements();(null==t?void 0:t.bodyContainer)&&(this.bodyContainerMouseLeaveListener=()=>{this.clearHoveredRows()},t.bodyContainer.addEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.externalScrollController.sync())}handleExternalScrollMetrics(t){this.scrollCoalescer.schedule({scrollTop:t.relativeScrollTop,scrollLeft:0,containerHeight:t.visibleViewportHeight,contentHeight:t.relativeScrollTop+t.visibleViewportHeight+Math.max(0,t.distanceFromTableBottom),afterApply:()=>{t.visibleViewportHeight!==this.externalScrollController.getViewportHeight()&&this.externalScrollController.setViewportHeight(t.visibleViewportHeight)}})}handleScroll(t){const e=t.currentTarget;this.scrollCoalescer.schedule({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,containerHeight:e.clientHeight,contentHeight:e.scrollHeight})}getTableRoot(){var t,e;return null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container}bindTableRoot(){var t,e;const n=this.getTableRoot();null===(t=this.selectionManager)||void 0===t||t.updateConfig({tableRoot:n}),null===(e=this.rowSelectionManager)||void 0===e||e.updateConfig({tableRoot:n})}clearHoveredRows(){(t=>{const e=fn.get(t);e&&e.forEach((e,n)=>{xn(n,!1,t)}),vn.set(t,null)})(this.hoverScopeId)}updateAriaLiveRegion(){const t=this.domManager.getElements();(null==t?void 0:t.ariaLiveRegion)&&(t.ariaLiveRegion.textContent=this.announcement)}getEffectiveRowGrouping(){var t,e;return(t=>{if(!t)return this.config.rowGrouping})(null===(e=null===(t=this.pivotManager)||void 0===t?void 0:t.getState())||void 0===e?void 0:e.active)}syncPivotPipeline(t){if(!this.pivotManager)return;const e=(t=>{var e,n,o,i,s,r,l,a,d,c;const u=null!==(o=null!==(e=t.filteredSourceRows)&&void 0!==e?e:null===(n=t.filterManager)||void 0===n?void 0:n.getFilteredRows())&&void 0!==o?o:t.localRows,h=t.pivotManager.isActive();t.pivotManager.updateConfig({sourceRows:u,fieldHeaders:t.pristineDefaultHeaders,pivot:null!==(i=t.config.pivot)&&void 0!==i?i:null});const f=t.pivotManager.getState();let v=t.headers,p=t.essentialAccessors,w=t.collapsedHeaders;const m=e=>{if(!t.dimensionManager)return;const n=t.renderOrchestrator.computeEffectiveHeaders(e,t.config,t.customTheme);t.dimensionManager.updateConfig({effectiveHeaders:n})};return f.active?(v=f.headers,p=jn.buildEssentialAccessors(v),null===(s=t.sortManager)||void 0===s||s.updateConfig({tableRows:f.pivotedRows,headers:f.headers,rowGrouping:void 0}),null===(r=t.selectionManager)||void 0===r||r.updateConfig({headers:f.headers}),null===(l=t.expandedDepthsManager)||void 0===l||l.updateRowGrouping(void 0),h||(w=jn.getInitialCollapsedHeaders(f.headers)),m(v)):(h&&(v=Mn(t.pristineDefaultHeaders),p=jn.buildEssentialAccessors(v),w=jn.getInitialCollapsedHeaders(v),null===(a=t.expandedDepthsManager)||void 0===a||a.updateRowGrouping(t.config.rowGrouping),m(v)),null===(d=t.sortManager)||void 0===d||d.updateConfig({tableRows:u,headers:v,rowGrouping:t.config.rowGrouping}),null===(c=t.selectionManager)||void 0===c||c.updateConfig({headers:v})),{headers:v,essentialAccessors:p,collapsedHeaders:w}})({pivotManager:this.pivotManager,filterManager:this.filterManager,sortManager:this.sortManager,selectionManager:this.selectionManager,dimensionManager:this.dimensionManager,expandedDepthsManager:this.expandedDepthsManager,renderOrchestrator:this.renderOrchestrator,config:this.config,customTheme:this.customTheme,localRows:this.localRows,pristineDefaultHeaders:this.pristineDefaultHeaders,headers:this.headers,essentialAccessors:this.essentialAccessors,collapsedHeaders:this.collapsedHeaders,filteredSourceRows:t});this.headers=e.headers,this.essentialAccessors=e.essentialAccessors,this.collapsedHeaders=e.collapsedHeaders}getRenderContext(){return(t=>{var e;const n=t.getDomManager().getRefs(),o=null===(e=t.getPivotManager())||void 0===e?void 0:e.getState(),i=t.getConfig(),s=(null==o?void 0:o.active)?Object.assign(Object.assign({},i),{rowGrouping:void 0}):i,r=(null==o?void 0:o.active)?o.pivotedRows:t.getLocalRows(),l=t.getExternalScrollController().getViewportHeight(),a=(t,e)=>"function"==typeof e?e(t):e;return{accordionAxis:(d={accordionAxis:t.getAccordionController().getPendingAxis(),animationCoordinator:t.getAnimationCoordinator(),cellRegistry:t.getCellRegistry(),collapsedHeaders:t.getCollapsedHeaders(),collapsedRows:t.getCollapsedRows(),config:s,customTheme:t.getCustomTheme(),dimensionManager:t.getDimensionManager(),draggedHeaderRef:t.getDraggedHeaderRef(),essentialAccessors:t.getEssentialAccessors(),expandedDepths:t.getExpandedDepths(),expandedRows:t.getExpandedRows(),filterManager:t.getFilterManager(),headerRegistry:t.getHeaderRegistry(),headers:t.getHeaders(),hoverScopeId:t.getHoverScopeId(),hoveredHeaderRef:t.getHoveredHeaderRef(),internalIsLoading:t.getInternalIsLoading(),isResizing:t.getIsResizing(),localRows:r,createNestedTable:(t,e)=>new as(t,e),mainBodyRef:n.mainBodyRef,mainHeaderRef:n.mainHeaderRef,pinnedLeftHeaderRef:n.pinnedLeftHeaderRef,pinnedLeftRef:n.pinnedLeftRef,pinnedRightHeaderRef:n.pinnedRightHeaderRef,pinnedRightRef:n.pinnedRightRef,positionOnlyBody:t.getPositionOnlyBody(),columnDragging:!!t.getDraggedHeaderRef().current,externalViewportHeight:l>0?l:void 0,resolvedIcons:t.getResolvedIcons(),rowSelectionManager:t.getRowSelectionManager(),rowStateMap:t.getRowStateMap(),scrollManager:t.getScrollManager(),sectionScrollController:t.getSectionScrollController(),selectionManager:t.getSelectionManager(),sortManager:t.getSortManager(),onRender:()=>t.onRender("resizeHandler-onRender"),getShrinkFloors:()=>t.getAutoSizeManager().getShrinkFloors(t.getHeaders(),t.getCollapsedHeaders(),t.getPristineDefaultHeaders()),onAutoExpandNaturalWidths:e=>t.getAutoSizeManager().recordNaturalWidths(e),setIsResizing:e=>{var n,o,i,s,r,l,a,d;t.setIsResizing(e);const c=t.getAutoScaleManager();if(c&&!1===e){const e=t.getDomManager().getRefs(),u=null!==(d=null!==(l=null!==(i=null===(o=null===(n=e.tableBodyContainerRef)||void 0===n?void 0:n.current)||void 0===o?void 0:o.clientWidth)&&void 0!==i?i:null===(r=null===(s=e.mainBodyRef)||void 0===s?void 0:s.current)||void 0===r?void 0:r.clientWidth)&&void 0!==l?l:null===(a=t.getDimensionManager())||void 0===a?void 0:a.getState().containerWidth)&&void 0!==d?d:0;c.updateConfig({isResizing:!1,containerWidth:u})}},setHeaders:e=>t.applyHeaders(e),setCollapsedHeaders:e=>{t.beginAccordion("horizontal"),t.setCollapsedHeaders(e)},setCollapsedRows:e=>{t.beginAccordion("vertical"),t.setCollapsedRows(a(t.getCollapsedRows(),e)),t.onRender("expansion")},setExpandedRows:e=>{t.beginAccordion("vertical"),t.setExpandedRows(a(t.getExpandedRows(),e)),t.onRender("expansion")},setRowStateMap:e=>{t.beginAccordion("vertical"),t.setRowStateMap(a(t.getRowStateMap(),e)),t.onRender("rowStateMap")},getCollapsedRows:()=>t.getCollapsedRows(),getCollapsedHeaders:()=>t.getCollapsedHeaders(),getExpandedRows:()=>t.getExpandedRows(),getHeaders:()=>t.getHeaders(),getPristineDefaultHeaders:()=>t.getPristineDefaultHeaders(),getPivot:()=>{var e,n,o;return null!==(o=null!==(n=null===(e=t.getPivotManager())||void 0===e?void 0:e.getPivot())&&void 0!==n?n:t.getConfig().pivot)&&void 0!==o?o:null},setPivot:e=>t.applyPivot(e),getRowStateMap:()=>t.getRowStateMap(),setColumnEditorOpen:e=>t.setColumnEditorOpen(e),setCurrentPage:e=>{e!==t.getCurrentPage()&&t.getConfig().enablePagination&&!t.getConfig().serverSidePagination&&t.getAutoSizeManager().queuePendingFromAccessors(),t.setCurrentPage(e)}}).accordionAxis,animationCoordinator:d.animationCoordinator,cellRegistry:d.cellRegistry,collapsedHeaders:d.collapsedHeaders,collapsedRows:d.collapsedRows,config:d.config,customTheme:d.customTheme,dimensionManager:d.dimensionManager,draggedHeaderRef:d.draggedHeaderRef,effectiveHeaders:[],essentialAccessors:d.essentialAccessors,expandedDepths:d.expandedDepths,expandedRows:d.expandedRows,filterManager:d.filterManager,headerRegistry:d.headerRegistry,headers:d.headers,hoverScopeId:d.hoverScopeId,hoveredHeaderRef:d.hoveredHeaderRef,internalIsLoading:d.internalIsLoading,isResizing:d.isResizing,localRows:d.localRows,createNestedTable:d.createNestedTable,mainBodyRef:d.mainBodyRef,mainHeaderRef:d.mainHeaderRef,pinnedLeftHeaderRef:d.pinnedLeftHeaderRef,pinnedLeftRef:d.pinnedLeftRef,pinnedRightHeaderRef:d.pinnedRightHeaderRef,pinnedRightRef:d.pinnedRightRef,positionOnlyBody:d.positionOnlyBody,columnDragging:d.columnDragging,externalViewportHeight:d.externalViewportHeight,resolvedIcons:d.resolvedIcons,rowSelectionManager:d.rowSelectionManager,rowStateMap:d.rowStateMap,scrollManager:d.scrollManager,sectionScrollController:d.sectionScrollController,selectionManager:d.selectionManager,sortManager:d.sortManager,onRender:d.onRender,getShrinkFloors:d.getShrinkFloors,onAutoExpandNaturalWidths:d.onAutoExpandNaturalWidths,setIsResizing:d.setIsResizing,setHeaders:d.setHeaders,setCollapsedHeaders:d.setCollapsedHeaders,setCollapsedRows:d.setCollapsedRows,setExpandedRows:d.setExpandedRows,setRowStateMap:d.setRowStateMap,getCollapsedRows:d.getCollapsedRows,getCollapsedHeaders:d.getCollapsedHeaders,getExpandedRows:d.getExpandedRows,getHeaders:d.getHeaders,getPristineDefaultHeaders:d.getPristineDefaultHeaders,getPivot:d.getPivot,setPivot:d.setPivot,getRowStateMap:d.getRowStateMap,setColumnEditorOpen:d.setColumnEditorOpen,setCurrentPage:d.setCurrentPage};var d})(this.getLiveHost())}applyPivot(t){var e,n,o,i;this.config=Object.assign(Object.assign({},this.config),{pivot:t}),this.syncPivotPipeline(null!==(n=null===(e=this.filterManager)||void 0===e?void 0:e.getFilteredRows())&&void 0!==n?n:this.localRows),null===(i=(o=this.config).onPivotChange)||void 0===i||i.call(o,t),this.renderOrchestrator.invalidateCache("header"),this.renderOrchestrator.invalidateCache("body"),this.render("setPivot")}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollCoalescer.scrollTop,scrollDirection:this.scrollCoalescer.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}maybeAutoSizeColumns(){var t,e,n;const o=this.autoSizeManager.maybeMeasure({headers:this.headers,collapsedHeaders:this.collapsedHeaders,styleRoot:ue(this.domManager.getRefs()),rows:he({enablePagination:this.config.enablePagination,serverSidePagination:this.config.serverSidePagination,currentTableRows:null===(t=this.renderOrchestrator.getLastProcessedResult())||void 0===t?void 0:t.currentTableRows,localRows:this.localRows}),theme:this.config.theme,icons:this.resolvedIcons,onRendererHostDiscard:this.config.onRendererHostDiscard});if(!o)return;this.headers=o,this.renderOrchestrator.invalidateCache("header");const i=this.domManager.getElements(),s=this.domManager.getRefs();i&&this.renderOrchestrator.render(i,s,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),null===(n=(e=this.config).onColumnWidthChange)||void 0===n||n.call(e,this.headers)}refitAutoSizeColumns(){0!==this.autoSizeManager.getAccessors().size&&(this.autoSizeManager.queuePendingFromAccessors(),this.render("auto-size-refit"))}render(t){var e;if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;const n=!!this.draggedHeaderRef.current;this._positionOnlyBody="scroll-raf"===t&&!0===this.scrollCoalescer.isScrolling||n;const o=this.domManager.getElements(),i=this.domManager.getRefs();if(o){if(this.renderOrchestrator.render(o,i,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),this.maybeAutoSizeColumns(),this.accordionController.clearPendingAxis(),this.accordionController.rememberRenderedHeaders(this.headers),"scroll-raf"!==t&&"live-sort"!==t)if(n||this.animationCoordinator.isColumnReordering()){const t=null!==(e=o.rootElement)&&void 0!==e?e:this.container;this.animationCoordinator.commitColumnReorder(t)}else this.accordionController.play();this.unvirtualizedRowsWarning.schedule()}}update(t){this.isUpdating=!0,((t,e)=>{var n,i,s,r,l,a,d,c,u,h,f,v,p,w,m,g;const b=t.getConfig().theme,x=o(e);t.setConfig(Object.assign(Object.assign({},t.getConfig()),x));const y=t.getConfig();if(void 0!==e.animations&&t.applyAnimationsConfig(e.animations),void 0!==e.onRendererHostDiscard&&(t.getAnimationCoordinator().setOnHostDiscard(e.onRendererHostDiscard),t.getRenderOrchestrator().setOnRendererHostDiscard(e.onRendererHostDiscard)),void 0!==e.rows){t.getFirstRenderDone()&&t.captureSnapshot(),t.setLocalRows([...e.rows]),t.rebuildRowIndexMap();const o=t.getFilterManager();o&&o.updateConfig({rows:t.getLocalRows()}),t.syncPivotPipeline(null!==(n=null==o?void 0:o.getFilteredRows())&&void 0!==n?n:t.getLocalRows()),t.getAutoSizeManager().queuePendingFromAccessors()}if(void 0!==e.pivot&&void 0===e.rows&&t.syncPivotPipeline(null!==(s=null===(i=t.getFilterManager())||void 0===i?void 0:i.getFilteredRows())&&void 0!==s?s:t.getLocalRows()),void 0===e.rows&&void 0===e.totalRowCount||null===(r=t.getDimensionManager())||void 0===r||r.updateConfig({totalRowCount:null!==(l=y.totalRowCount)&&void 0!==l?l:t.getLocalRows().length}),void 0!==e.columns&&!t.getIsResizing()){t.captureSnapshot(),t.ingestColumnSnapshot(x.columns);const e=t.getFilterManager();if(e&&e.updateConfig({headers:t.getPristineDefaultHeaders()}),null===(a=t.getPivotManager())||void 0===a?void 0:a.isActive())t.syncPivotPipeline(null!==(d=null==e?void 0:e.getFilteredRows())&&void 0!==d?d:t.getLocalRows());else{const e=Mn(t.getPristineDefaultHeaders());t.setHeaders(e),t.setEssentialAccessors(jn.buildEssentialAccessors(e)),null===(c=t.getSortManager())||void 0===c||c.updateConfig({headers:e}),null===(u=t.getSelectionManager())||void 0===u||u.updateConfig({headers:e});const n=t.getDimensionManager();if(n){const o=t.getRenderOrchestrator().computeEffectiveHeaders(e,y,t.getCustomTheme());n.updateConfig({effectiveHeaders:o})}}t.getAutoSizeManager().recomputeAccessors(t.getHeaders(),t.getCollapsedHeaders()),t.getAutoSizeManager().clearNaturalWidths()}if(void 0!==e.isLoading){const n=t.getInternalIsLoading();t.setInternalIsLoading(e.isLoading),n&&!e.isLoading&&t.getAutoSizeManager().getAccessors().size>0&&t.getAutoSizeManager().queuePendingFromAccessors()}if(void 0!==e.theme&&(t.getDomManager().updateTheme(e.theme),e.theme!==b&&(t.getRenderOrchestrator().invalidateCache("all"),t.getRenderOrchestrator().invalidateCustomFooterCache())),void 0!==e.footerPosition&&t.getDomManager().syncFooterPosition(y.footerPosition),void 0===e.rows&&void 0===e.footerRenderer&&void 0===e.footerRenderKey||t.getRenderOrchestrator().invalidateCustomFooterCache(),void 0!==e.customTheme){const e=t.getCustomTheme(),n=jn.mergeCustomTheme(y);t.setCustomTheme(n),function(t,e){for(const n of Object.keys(In))if(t[n]!==e[n])return!1;return!0}(e,n)||(null===(h=t.getSelectionManager())||void 0===h||h.updateConfig({customTheme:n,rowHeight:n.rowHeight}),null===(f=t.getDimensionManager())||void 0===f||f.updateConfig({headerHeight:n.headerHeight,rowHeight:n.rowHeight,footerHeight:!y.enablePagination&&!y.footerRenderer||y.hideFooter?void 0:n.footerHeight}),y.enablePagination&&e.rowHeight!==n.rowHeight&&t.setCurrentPage(1),t.getRenderOrchestrator().invalidateCache("all"))}if(void 0===e.selectableColumns&&void 0===e.selectableCells||!t.getSelectionManager()||t.getSelectionManager().updateConfig({selectableColumns:null!==(v=y.selectableColumns)&&void 0!==v&&v,selectableCells:null!==(p=y.selectableCells)&&void 0!==p&&p}),(void 0!==e.enableRowSelection||void 0!==e.rowSelectionMode||void 0!==e.selectRowOnClick||void 0!==e.showRowSelectionColumn||void 0!==e.rowButtons||void 0!==e.onRowSelectionChange||void 0!==e.selectableCells)&&(t.syncRowSelectionManager(),null===(w=t.getSelectionManager())||void 0===w||w.updateConfig({enableRowSelection:lo(y)}),void 0!==e.enableRowSelection||void 0!==e.showRowSelectionColumn||void 0!==e.rowButtons)){t.getRenderOrchestrator().invalidateCache("header"),t.getRenderOrchestrator().invalidateCache("all");const e=t.getDimensionManager();if(e){const n=t.getRenderOrchestrator().computeEffectiveHeaders(t.getHeaders(),y,t.getCustomTheme());e.updateConfig({effectiveHeaders:n})}}void 0===e.height&&void 0===e.maxHeight||null===(m=t.getDimensionManager())||void 0===m||m.updateConfig({height:y.height,maxHeight:y.maxHeight}),void 0===e.scrollParent&&void 0===e.height&&void 0===e.maxHeight||t.getExternalScrollController().sync(),void 0===e.onLoadMore&&void 0===e.infiniteScrollThreshold||!t.getScrollManager()||t.getScrollManager().updateConfig({onLoadMore:y.onLoadMore,infiniteScrollThreshold:null!==(g=y.infiniteScrollThreshold)&&void 0!==g?g:200})})(this.getLiveHost(),t),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}syncRowSelectionManager(){(t=>{var e,n,o,i,s;const r=t.getConfig();if(r.enableRowSelection){const l={onRowSelectionChange:r.onRowSelectionChange,enableRowSelection:!0,rowSelectionMode:null!==(e=r.rowSelectionMode)&&void 0!==e?e:"multiple",selectRowOnClick:null!==(n=r.selectRowOnClick)&&void 0!==n&&n,showRowSelectionColumn:!1!==r.showRowSelectionColumn,selectableCells:null!==(o=r.selectableCells)&&void 0!==o&&o,tableRoot:t.getTableRoot()},a=t.getRowSelectionManager();if(a)a.updateConfig(l);else{const e=new ls(Object.assign({tableRows:null!==(s=null===(i=t.getLastProcessedResult())||void 0===i?void 0:i.currentTableRows)&&void 0!==s?s:[]},l));e.subscribe(()=>{t.onRender("rowSelectionManager")}),t.setRowSelectionManager(e)}}else t.getRowSelectionManager()&&(t.getRowSelectionManager().destroy(),t.setRowSelectionManager(null))})({getConfig:()=>this.config,getTableRoot:()=>this.getTableRoot(),getRowSelectionManager:()=>this.rowSelectionManager,setRowSelectionManager:t=>{this.rowSelectionManager=t},getLastProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),onRender:t=>this.render(t)})}destroy(){var t,e;this.mounted=!1,this.firstRenderDone=!1,this.liveHost=null;const n=this.domManager.getElements();(null==n?void 0:n.bodyContainer)&&this.bodyContainerMouseLeaveListener&&(n.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null);const o=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;(t=>{var e,n,o,i,s,r,l,a,d,c,u,h,f,v;t.scrollCoalescer.destroy(),t.unvirtualizedRowsWarning.destroy(),t.externalScrollController.destroy(),t.accordionController.destroy(),null===(e=t.dimensionManager)||void 0===e||e.destroy(),null===(n=t.scrollManager)||void 0===n||n.destroy(),null===(o=t.sectionScrollController)||void 0===o||o.destroy(),null===(i=t.sortManager)||void 0===i||i.destroy(),null===(s=t.filterManager)||void 0===s||s.destroy(),null===(r=t.pivotManager)||void 0===r||r.destroy(),null===(l=t.rowSelectionManager)||void 0===l||l.destroy(),null===(a=t.selectionManager)||void 0===a||a.destroy(),null===(d=t.autoScaleManager)||void 0===d||d.destroy(),null===(c=t.windowResizeManager)||void 0===c||c.destroy(),null===(u=t.handleOutsideClickManager)||void 0===u||u.destroy(),null===(h=t.scrollbarVisibilityManager)||void 0===h||h.destroy(),null===(f=t.expandedDepthsManager)||void 0===f||f.destroy(),null===(v=t.ariaAnnouncementManager)||void 0===v||v.destroy(),t.animationCoordinator.destroy()})({scrollCoalescer:this.scrollCoalescer,unvirtualizedRowsWarning:this.unvirtualizedRowsWarning,externalScrollController:this.externalScrollController,accordionController:this.accordionController,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,pivotManager:this.pivotManager,rowSelectionManager:this.rowSelectionManager,selectionManager:this.selectionManager,autoScaleManager:this.autoScaleManager,windowResizeManager:this.windowResizeManager,handleOutsideClickManager:this.handleOutsideClickManager,scrollbarVisibilityManager:this.scrollbarVisibilityManager,expandedDepthsManager:this.expandedDepthsManager,ariaAnnouncementManager:this.ariaAnnouncementManager,animationCoordinator:this.animationCoordinator}),this.pivotManager=null,this.cellRegistry.clear(),this.headerRegistry.clear(),(t=>{t.querySelectorAll("[data-row-id]").forEach(t=>{const e=t.getAttribute("data-row-id");e&&bn(e,t)})})(o),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container),this.cachedAPI=null}getAPI(){return this.cachedAPI||(this.cachedAPI=os.createAPI((t=>({get config(){return t.getConfig()},get localRows(){return t.getLocalRows()},get effectiveHeaders(){return t.computeEffectiveHeaders()},get headers(){return t.getHeaders()},getPristineDefaultHeaders:()=>t.getPristineDefaultHeaders(),get essentialAccessors(){return t.getEssentialAccessors()},get customTheme(){return t.getCustomTheme()},get currentPage(){return t.getCurrentPage()},getCurrentPage:()=>t.getCurrentPage(),get expandedRows(){return t.getExpandedRows()},get collapsedRows(){return t.getCollapsedRows()},get expandedDepths(){return t.getExpandedDepths()},clearExpandedRows:()=>t.clearExpandedRows(),clearCollapsedRows:()=>t.clearCollapsedRows(),get rowStateMap(){return t.getRowStateMap()},get headerRegistry(){return t.getHeaderRegistry()},get cellRegistry(){return t.getCellRegistry()},isCellAnimating:e=>t.isCellAnimating(e),hasAnimatingCells:()=>t.hasAnimatingCells(),get columnEditorOpen(){return t.getColumnEditorOpen()},getCachedFlattenResult:()=>t.getCachedFlattenResult(),getCachedProcessedResult:()=>t.getCachedProcessedResult(),get expandedDepthsManager(){return t.getExpandedDepthsManager()},get selectionManager(){return t.getSelectionManager()},get rowSelectionManager(){return t.getRowSelectionManager()},get sortManager(){return t.getSortManager()},get filterManager(){return t.getFilterManager()},getEffectiveRowGrouping:()=>t.getEffectiveRowGrouping(),setPivot:e=>t.setPivot(e),getPivot:()=>t.getPivot(),getPivotHeaders:()=>t.getPivotHeaders(),getPivotedRows:()=>t.getPivotedRows(),onRender:()=>t.onRender(),invalidateRowsCache:()=>t.invalidateRowsCache(),runWithoutAnimationSnapshot:e=>t.runWithoutAnimationSnapshot(e),setHeaders:e=>t.applyHeaders(e),setCurrentPage:e=>t.setCurrentPage(e),setColumnEditorOpen:e=>t.setColumnEditorOpen(e)}))((t=this.getLiveHost(),{getConfig:()=>t.getConfig(),getLocalRows:()=>t.getLocalRows(),getHeaders:()=>t.getHeaders(),applyHeaders:e=>t.applyHeaders(e),getPristineDefaultHeaders:()=>t.getPristineDefaultHeaders(),getEssentialAccessors:()=>t.getEssentialAccessors(),getCustomTheme:()=>t.getCustomTheme(),getCurrentPage:()=>t.getCurrentPage(),setCurrentPage:e=>t.setCurrentPage(e),getExpandedRows:()=>t.getExpandedRows(),getCollapsedRows:()=>t.getCollapsedRows(),getExpandedDepths:()=>t.getExpandedDepths(),clearExpandedRows:()=>t.clearExpandedRows(),clearCollapsedRows:()=>t.clearCollapsedRows(),getRowStateMap:()=>t.getRowStateMap(),getHeaderRegistry:()=>t.getHeaderRegistry(),getCellRegistry:()=>t.getCellRegistry(),isCellAnimating:e=>t.isCellAnimating(e),hasAnimatingCells:()=>t.hasAnimatingCells(),getColumnEditorOpen:()=>t.getColumnEditorOpen(),setColumnEditorOpen:e=>{t.setColumnEditorOpen(e),t.onRender("columnEditor-toggle")},getExpandedDepthsManager:()=>t.getExpandedDepthsManager(),getSelectionManager:()=>t.getSelectionManager(),getRowSelectionManager:()=>t.getRowSelectionManager(),getSortManager:()=>t.getSortManager(),getFilterManager:()=>t.getFilterManager(),getCachedFlattenResult:()=>t.getRenderOrchestrator().getCachedFlattenResult(),getCachedProcessedResult:()=>t.getRenderOrchestrator().getLastProcessedResult(),getEffectiveRowGrouping:()=>t.getEffectiveRowGrouping(),setPivot:e=>t.applyPivot(e),getPivot:()=>{var e,n,o;return null!==(o=null!==(n=null===(e=t.getPivotManager())||void 0===e?void 0:e.getPivot())&&void 0!==n?n:t.getConfig().pivot)&&void 0!==o?o:null},getPivotHeaders:()=>{var e;const n=null===(e=t.getPivotManager())||void 0===e?void 0:e.getState();return(null==n?void 0:n.active)?n.headers:t.getHeaders()},getPivotedRows:()=>{var e;const n=null===(e=t.getPivotManager())||void 0===e?void 0:e.getState();return(null==n?void 0:n.active)?n.pivotedRows:t.getLocalRows()},onRender:()=>t.onRender("columnEditor-onRender"),invalidateRowsCache:()=>{t.getRenderOrchestrator().invalidateCache("body")},runWithoutAnimationSnapshot:e=>t.runWithoutAnimationSnapshot(e),computeEffectiveHeaders:()=>t.getRenderOrchestrator().computeEffectiveHeaders(t.getHeaders(),t.getConfig(),t.getCustomTheme())})))),this.cachedAPI;var t}getLiveHost(){return this.liveHost||(this.liveHost={getConfig:()=>this.config,setConfig:t=>{this.config=t},applyAnimationsConfig:t=>this.applyAnimationsConfig(t),getCustomTheme:()=>this.customTheme,setCustomTheme:t=>{this.customTheme=t},getInternalIsLoading:()=>this.internalIsLoading,setInternalIsLoading:t=>{this.internalIsLoading=t},getCurrentPage:()=>this.currentPage,setCurrentPage:t=>{this.currentPage=t},getFirstRenderDone:()=>this.firstRenderDone,getIsResizing:()=>this.isResizing,setIsResizing:t=>{this.isResizing=t},getLocalRows:()=>this.localRows,setLocalRows:t=>{this.localRows=t},rebuildRowIndexMap:()=>this.rebuildRowIndexMap(),getHeaders:()=>this.headers,setHeaders:t=>{this.headers=t},getPristineDefaultHeaders:()=>this.pristineDefaultHeaders,getEssentialAccessors:()=>this.essentialAccessors,setEssentialAccessors:t=>{this.essentialAccessors=t},ingestColumnSnapshot:t=>this.ingestColumnSnapshot(t),applyHeaders:t=>this.applyHeaders(t),getCollapsedHeaders:()=>this.collapsedHeaders,setCollapsedHeaders:t=>{this.collapsedHeaders=t},getCollapsedRows:()=>this.collapsedRows,setCollapsedRows:t=>{this.collapsedRows=t},getExpandedRows:()=>this.expandedRows,setExpandedRows:t=>{this.expandedRows=t},getExpandedDepths:()=>this.expandedDepths,clearExpandedRows:()=>{this.expandedRows=new Map},clearCollapsedRows:()=>{this.collapsedRows=new Map},getRowStateMap:()=>this.rowStateMap,setRowStateMap:t=>{this.rowStateMap=t},getColumnEditorOpen:()=>this.columnEditorOpen,setColumnEditorOpen:t=>{this.columnEditorOpen=t},getCellRegistry:()=>this.cellRegistry,getHeaderRegistry:()=>this.headerRegistry,getHoverScopeId:()=>this.hoverScopeId,getDraggedHeaderRef:()=>this.draggedHeaderRef,getHoveredHeaderRef:()=>this.hoveredHeaderRef,getResolvedIcons:()=>this.resolvedIcons,getPositionOnlyBody:()=>this._positionOnlyBody,getAnimationCoordinator:()=>this.animationCoordinator,getAccordionController:()=>this.accordionController,getAutoSizeManager:()=>this.autoSizeManager,getAutoScaleManager:()=>this.autoScaleManager,getDomManager:()=>this.domManager,getRenderOrchestrator:()=>this.renderOrchestrator,getDimensionManager:()=>this.dimensionManager,getFilterManager:()=>this.filterManager,getSortManager:()=>this.sortManager,getPivotManager:()=>this.pivotManager,getSelectionManager:()=>this.selectionManager,getRowSelectionManager:()=>this.rowSelectionManager,getScrollManager:()=>this.scrollManager,getSectionScrollController:()=>this.sectionScrollController,getExternalScrollController:()=>this.externalScrollController,getExpandedDepthsManager:()=>this.expandedDepthsManager,syncPivotPipeline:t=>this.syncPivotPipeline(t),syncRowSelectionManager:()=>this.syncRowSelectionManager(),captureSnapshot:()=>this.accordionController.captureSnapshot(),beginAccordion:t=>this.accordionController.begin(t),getEffectiveRowGrouping:()=>this.getEffectiveRowGrouping(),applyPivot:t=>this.applyPivot(t),onRender:t=>this.render(t),isCellAnimating:t=>this.animationCoordinator.isInFlight(t),hasAnimatingCells:()=>this.animationCoordinator.hasInFlight(),runWithoutAnimationSnapshot:t=>{this.suppressNextAnimationSnapshot=!0;try{t()}finally{this.suppressNextAnimationSnapshot=!1}}}),this.liveHost}}function ds(t,e){if(t===e)return!0;if(t.accessor!==e.accessor||t.width!==e.width||t.minWidth!==e.minWidth||t.maxWidth!==e.maxWidth||t.label!==e.label||t.type!==e.type||t.pinned!==e.pinned||t.hide!==e.hide||t.sortable!==e.sortable||t.filterable!==e.filterable||t.align!==e.align||t.collapsible!==e.collapsible||t.collapseDefault!==e.collapseDefault||t.showWhen!==e.showWhen||t.editable!==e.editable||t.essential!==e.essential||t.disableReorder!==e.disableReorder||t.expandable!==e.expandable||t.excludeFromRender!==e.excludeFromRender||t.autoSizeMode!==e.autoSizeMode||t.tooltip!==e.tooltip||t.quickFilterable!==e.quickFilterable)return!1;const n=t.filterOperators,o=e.filterOperators;if(n!==o){if(!n||!o||n.length!==o.length)return!1;for(let t=0;n.length>t;t++)if(n[t]!==o[t])return!1}const i=t.children,s=e.children;if(i===s)return!0;if(!i||!s)return!i&&!s;if(i.length!==s.length)return!1;for(let t=0;i.length>t;t++)if(!ds(i[t],s[t]))return!1;return!0}function cs(t,e){if(t===e)return!0;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(t[o]!==e[o])return!1;return!0}as.nextHoverScopeId=0,exports.PIVOT_ACCESSOR_PREFIX=Re,exports.PIVOT_BLANK_LABEL=Se,exports.PIVOT_IS_TOTAL_KEY=ye,exports.SHALLOW_ROW_COMPARE_MAX=5e4,exports.SimpleTableVanilla=as,exports.asRows=function(t){return t},exports.buildPivotAccessor=Pe,exports.buildPivotRowTotalAccessor=We,exports.collectHeaderAccessors=function t(e,n=new Set){var o;for(const i of e)n.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&t(i.children,n);return n},exports.headersStructurallyEqual=function(t,e){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!ds(t[n],e[n]))return!1;return!0},exports.normalizeColumnDef=t,exports.normalizeColumnDefs=e,exports.normalizeConfig=n,exports.normalizeConfigPatch=o,exports.pivotRows=je,exports.rowsShallowUnchanged=function(t,e,n){if(t===e)return!0;if(!t||!e)return!t&&!e;if(t.length!==e.length)return!1;const o=5e4>=e.length;for(let i=0;t.length>i;i++){const s=t[i],r=e[i];if(s!==r){if(n&&n({row:s,depth:0,index:i,rowPath:[],rowIndexPath:[i]})+""!=n({row:r,depth:0,index:i,rowPath:[],rowIndexPath:[i]})+"")return!1;if(!o)return!1;if(!cs(s,r))return!1}}return!0},exports.shallowEqualRow=cs;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|