simple-table-core 3.7.0 → 3.7.2
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/dist/cjs/index.js +1 -1
- package/dist/cjs/src/managers/SectionScrollController.d.ts +2 -6
- package/dist/cjs/src/utils/bodyCell/types.d.ts +6 -0
- package/dist/cjs/src/utils/collapseUtils.d.ts +7 -0
- package/dist/cjs/stories/tests/45-AriaSemanticsTests.stories.d.ts +83 -0
- package/dist/index.es.js +1 -1
- package/dist/src/managers/SectionScrollController.d.ts +2 -6
- package/dist/src/utils/bodyCell/types.d.ts +6 -0
- package/dist/src/utils/collapseUtils.d.ts +7 -0
- package/dist/stories/tests/45-AriaSemanticsTests.stories.d.ts +83 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={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},e=new WeakMap,n=(t,n,o)=>{const i=(t=>{let n=e.get(t);return n||(n=new Map,e.set(t,n)),n})(t);let s=i.get(n);s||(s=document.createElement("div"),s.className="st-aria-row",s.setAttribute("role","row"),s.style.display="contents",t.appendChild(s),i.set(n,s));const r=o+"";return s.getAttribute("aria-rowindex")!==r&&s.setAttribute("aria-rowindex",r),s},o=t=>{const n=e.get(t);n&&n.forEach((t,e)=>{0===t.childElementCount&&(t.remove(),n.delete(e))})},i=t=>{const n=e.get(t);n&&(n.forEach(t=>t.remove()),n.clear())},s=new WeakMap,r=(t,e,n,o)=>{t.addEventListener(e,n,o),s.has(t)||s.set(t,[]),s.get(t).push({event:e,handler:n,options:o})},l=new WeakMap,a=t=>(l.has(t)||l.set(t,new Map),l.get(t)),d=new WeakMap;let c=0,h=Date.now(),u={screenX:0,screenY:0},p=null;const f=t=>{h=t},v=new WeakMap,w=t=>(v.has(t)||v.set(t,new Map),v.get(t)),m=new WeakMap,g=t=>(m.has(t)||m.set(t,new Map),m.get(t)),x=(t,e)=>{const n=Date.now();0!==c&&e>n-c||(c=n,t())},b=(t,e,n,o)=>{t.addEventListener(e,n,o),d.has(t)||d.set(t,[]),d.get(t).push({event:e,handler:n,options:o})},y=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},R=.5,C="st-cell-animating-out",S="data-animating-out",I="data-shrinking-out",H=t=>{const e=a(t),n=w(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 M{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=null,this.inFlight=new Map,this.retainedCells=new Map,this.scrollerMetricsCache=new WeakMap,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=O()}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)}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);return e||(e=E(t),this.scrollerMetricsCache.set(t,e)),e}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;H(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)}retainCell(t){const{cellId:e,element:n,container:o,newPosition:i}=t,s=k(n.style.top),r=k(n.style.left),l=this.getScrollerMetrics(o),a=T(i.top,s,i.height,l,"y"),d=T(i.left,r,i.width,l,"x");let c=this.retainedCells.get(o);c||(c=new Map,this.retainedCells.set(o,c));const h=c.get(e);h&&h!==n&&(this.cancelInFlight(e),h.remove()),n.id&&n.removeAttribute("id"),n.classList.add(C),n.setAttribute(S,"true"),n.style.left=d+"px",n.style.top=a+"px",n.style.width=i.width+"px",n.style.height=i.height+"px",n.style.pointerEvents="none",c.set(e,n)}claimRetainedForReuse(t,e){var n;const o=this.retainedCells.get(e);if(!o)return null;const i=o.get(t);return i?i.hasAttribute(I)?(this.cancelInFlight(t),o.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),i.remove(),null):(this.cancelInFlight(t),o.delete(t),i.classList.remove(C),i.removeAttribute(S),i.id=t,i.style.pointerEvents="",i):null}shrinkOutCell(t){const{cellId:e,element:n,container:o,axis:i}=t;this.cancelInFlight(e);let s=this.retainedCells.get(o);s||(s=new Map,this.retainedCells.set(o,s));const r=s.get(e);r&&r!==n&&(this.cancelInFlight(e),r.remove()),n.id&&n.removeAttribute("id"),n.classList.add(C),n.setAttribute(S,"true"),n.setAttribute(I,"true"),n.style.pointerEvents="none","horizontal"===i?n.style.width="0px":n.style.height="0px",s.set(e,n);const l=window.setTimeout(()=>{const t=this.retainedCells.get(o);t&&t.get(e)===n&&t.delete(e),n.remove()},this.duration+80);this.inFlight.set(e,{element:n,cleanupTimeout:l,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){const n=this.retainedCells.get(e);if(!n)return;const o=n.get(t);o&&(this.cancelInFlight(t),n.delete(t),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)=>{this.inFlight.has(n)||(e.remove(),t.delete(n))})});const o=[],i=new Set,s=new Map,r=(t,r,l,a)=>{if(i.has(r))return;if(l&&t.hasAttribute(I))return void i.add(r);let d=e.get(r);if(!d&&!l&&n){const t=n.get(r);t&&(d={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!d)return;if(!l&&null!==d.sourceContainer&&d.sourceContainer!==a)return void i.add(r);if(t.querySelector(".st-cell-editing"))return;const c=k(t.style.left),h=k(t.style.top);if(!l&&this.inFlight.has(r)&&R>Math.abs(d.styleTop-h)&&R>Math.abs(d.styleLeft-c))return void i.add(r);const u=l||d.fromDom,p=u?0:k(t.style.height)||t.offsetHeight||0,f=u?0:k(t.style.width)||t.offsetWidth||0,v=u?null:this.getScrollerMetrics(a),w=u||!v?d.top:T(d.top,h,p,v,"y"),m=u||!v?d.left:T(d.left,c,f,v,"x");let g=0;if(null!==d.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);g=t.left-d.sourceContainerLeft}const x=m-c-g,b=w-h-0;R>Math.abs(x)&&R>Math.abs(b)?l&&t.remove():(o.push({cellId:r,element:t,dx:x,dy:b,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)}),H(e).forEach((t,n)=>{r(t,n,!1,e)})}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";0!==o.length&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{cellId:t,element:e,isRetained:n}of o)e.isConnected&&this.startTransition(t,e,n)})})}cancel(){this.snapshot=null,this.incomingOrigins=null,this.clearScrollerMetricsCache();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=>t.remove()),t.clear()}),this.retainedCells.clear()}destroy(){this.cancel()}readPosition(t,e,n,o,i){const s=k(e.style.top),r=k(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){if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(S)}}const k=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},E=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}},T=(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 h=l-c,u=c+s*h/(h+10*c);return e+Math.sign(r)*u},O=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},A=t=>Math.ceil(800/(t+1)),W=29.5,P=150,$=["lineAreaChart","barChart"],F=40,L=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),D="parentExpanded",B=(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},j=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...j(t.children)),e}),z=(t=0)=>t?t+1:0,N=(t,e)=>{const n=j(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},q=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},V=({accessor:t,rowId:e})=>`${e}-${t}`,G=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,K=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},U=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=K(e);let i=t[n];return null!==o&&Array.isArray(i)&&(i=i[o]),i},t):t[e]},J=(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}=K(i[t]);if(null==s[e]){const n=K(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}=K(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},_=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],Y=t=>{const{getRowId:e,rowPath:n}=t,o=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});o.push(n)}return o},X=t=>t.join("-"),Q=new WeakMap;let Z=0;const tt=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})+"":(t=>{if(t&&"object"==typeof t){const e=Q.get(t);if(void 0!==e)return e;const n="__row_"+ ++Z;return Q.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(n),o.join("/")},et=t=>t.stableRowKey?t.stableRowKey:X(t.rowId),nt=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,ot=(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},it=(t,e)=>{if(t.hide)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||D;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>it(t,e))]:0===n.length?[t]:n.flatMap(t=>it(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||D;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>it(t,e))]:n.flatMap(t=>it(t,e))};function st(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return e.endsWith("px")?{type:"px",value:parseFloat(e)||0}:e.endsWith("fr")?{type:"fr",value:parseFloat(e)||1}:e.endsWith("%")?{type:"pct",value:parseFloat(e)||0}:null}function rt(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function lt(t,e){const n=t.map(t=>st(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("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:P);else a.set(t.accessor,P)}),a}function at(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=rt(t);o=lt(e,n)}else{const e=rt(t),n=e.map(t=>st(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=lt(e,s)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const i=o.get(e.accessor);return null!=i&&(n.width=i),n})}const dt=t=>{if(t.hide)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(V({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||P}},ct=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(V({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||P),t.children&&t.children.length>0&&t.children.forEach(t=>{ct(t)})},ht=t=>"number"==typeof t.minWidth?t.minWidth:F,ut=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...it(t,e))}),n},pt=(t,e)=>{const{rows:n,header:o,maxWidth:i=500,sampleSize:s=50,styleRoot:r}=e||{},l=null!=r?r:document,a=document.getElementById(V({accessor:t,rowId:"header"}));if(!a)return P;const d=window.getComputedStyle(a),c=parseFloat(d.paddingLeft)||0,h=parseFloat(d.paddingRight)||0,u=parseFloat(d.gap)||0;let p=c+h;const f=a.querySelector(".st-header-label");if(f){const t=f.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const o=e.offsetWidth;document.body.removeChild(e),p+=o}}const v=Array.from(a.children);let w=1;for(let t=0;v.length>t;t++){const e=v[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),w++)}u>0&&w>1&&(p+=u*(w-1));let m=0;const g=o&&o.type&&$.includes(o.type);if(n&&n.length>0&&!g){const e=Math.min(n.length,s),i=document.createElement("div");i.style.visibility="hidden",i.style.position="absolute",i.style.whiteSpace="nowrap",i.style.width="auto";let r=0,a=0;const d=l.querySelector(".st-cell-content");if(d){const t=window.getComputedStyle(d);i.style.font=t.font,i.style.fontSize=t.fontSize,i.style.fontFamily=t.fontFamily,r=parseFloat(t.paddingLeft)||0,a=parseFloat(t.paddingRight)||0}document.body.appendChild(i);for(let s=0;e>s;s++){const e=n[s];let l;l=(null==o?void 0:o.valueGetter)?o.valueGetter({accessor:t,row:e,rowIndex:s}):U(e,t);let d=l;(null==o?void 0:o.valueFormatter)&&null!=l&&(d=o.valueFormatter({accessor:t,colIndex:0,row:e,rowIndex:s,value:l})),i.textContent=null!=d?d+"":"";const c=i.offsetWidth+r+a;c>m&&(m=c)}document.body.removeChild(i)}let x=Math.max(p,m);return g&&(x=Math.max(x,150)),x>i&&(x=i),Math.max(x+2,F)};class ft{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 vt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...vt(t.children,null!=e?e:t.pinned)):n.push(t))}),n},wt=(t,e)=>e>=t.reduce((t,e)=>t+ht(e),0),mt=(t,e)=>{const n=new Map,o=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===o)return n;const i=e/o;if(i>=1&&.01>i-1)return n;let s=0;return t.forEach((o,r)=>{const l="number"==typeof o.width?o.width:"string"==typeof o.width&&o.width.endsWith("px")?parseFloat(o.width):150;let a;r===t.length-1?a=e-s:(a=Math.round(l*i),s+=a),n.set(o.accessor,a)}),n},gt=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,isResizing:r}=e;if(!n||0===o||r)return t;const l=Math.max(0,o-i-s),a=t.filter(t=>"left"===t.pinned),d=t.filter(t=>"right"===t.pinned),c=t.filter(t=>!t.pinned),h=vt(a,"left"),u=vt(d,"right"),p=vt(c,void 0),f=h.length>0&&wt(h,i),v=u.length>0&&wt(u,s),w=p.length>0&&l>0&&wt(p,l),m=new Map;if(f&&mt(h,i).forEach((t,e)=>m.set(e,t)),v&&mt(u,s).forEach((t,e)=>m.set(e,t)),w&&mt(p,l).forEach((t,e)=>m.set(e,t)),0===m.size)return t;const g=(t,e)=>{var n;if(t.hide)return t;const o=null!=e?e:t.pinned,i=null===(n=t.children)||void 0===n?void 0:n.map(t=>g(t,o));if(!t.children||0===t.children.length){const e=m.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==e?{width:e,children:i}:{children:i})}return Object.assign(Object.assign({},t),{children:i})};return t.map(t=>g(t,t.pinned))};class xt{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new ft(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new ft(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 gt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class bt{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),o=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:o},t.containerElement&&this.observeContainer(t.containerElement)}getHeaderDepth(t){var e,n;return t.singleRowChildren&&(null===(e=t.children)||void 0===e?void 0:e.length)?1:(null===(n=t.children)||void 0===n?void 0:n.length)?1+Math.max(...t.children.map(t=>this.getHeaderDepth(t))):1}calculateMaxHeaderDepth(){let t=0;return this.config.effectiveHeaders.forEach(e=>{const n=this.getHeaderDepth(e);t=Math.max(t,n)}),t}calculateHeaderHeight(t){var e;return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)}convertHeightToPixels(t){var e;const n=this.config.containerElement||document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight: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}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let o=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),o=!0}if(t.height||t.maxHeight||void 0!==t.totalRowCount||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.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class yt{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 Rt{constructor(t={}){this.scrollLeftBySection={"pinned-left":0,main:0,"pinned-right":0},this.panesBySection=new Map([["pinned-left",new Set],["main",new Set],["pinned-right",new Set]]),this.scrollHandlers=new WeakMap,this.isSyncing=!1,this.lastMainVirtualizationScrollLeft=null,this.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);s&&(this.removeScrollListener(s.element),i.delete(s)),i.add({element:e,role:n}),"header"===n||"sticky"===n?e.style.overflowX="hidden":(this.addScrollListener(t,e),"body"===n&&this.addTouchTracking(t,e));const r=null!==(o=this.scrollLeftBySection[t])&&void 0!==o?o:0;e.scrollLeft!==r&&(this.isSyncing=!0,e.scrollLeft=r,this.isSyncing=!1)}unregisterPane(t,e){const n=this.panesBySection.get(t);if(!n)return;this.removeScrollListener(e);const o=Array.from(n).find(t=>t.element===e);o&&n.delete(o)}unregisterSection(t){const e=this.panesBySection.get(t);e&&(e.forEach(({element:t})=>this.removeScrollListener(t)),e.clear())}setSectionScrollLeft(t,e){this.scrollLeftBySection[t]=e;const n=this.panesBySection.get(t);n&&(n.forEach(({element:t})=>{t.scrollLeft!==e&&(t.scrollLeft=e)}),"main"===t&&this.config.onMainSectionScrollLeft&&(this.lastMainVirtualizationScrollLeft=e,this.config.onMainSectionScrollLeft(e)))}getSectionScrollLeft(t){var e;return null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0}restoreAll(){["pinned-left","main","pinned-right"].forEach(t=>{var e;const n=null!==(e=this.scrollLeftBySection[t])&&void 0!==e?e:0;this.isSyncing=!0,this.setSectionScrollLeft(t,n),this.isSyncing=!1})}addScrollListener(t,e){this.removeScrollListener(e);const n=()=>{if(this.isSyncing)return;const n=e.scrollLeft;this.scrollLeftBySection[t]=n,this.isSyncing=!0;const o=this.panesBySection.get(t);o&&o.forEach(({element:t,role:o})=>{t!==e&&t.scrollLeft!==n&&("scrollbar"===o&&this.isTouchScrolling||(t.scrollLeft=n))}),this.isTouchScrolling&&this.scheduleTouchSettle(t),"main"===t&&this.config.onMainSectionHeaderFrame&&this.config.onMainSectionHeaderFrame(n),"main"!==t||!this.config.onMainSectionScrollLeft||null!==this.lastMainVirtualizationScrollLeft&&20>Math.abs(n-this.lastMainVirtualizationScrollLeft)||(this.lastMainVirtualizationScrollLeft=n,this.config.onMainSectionScrollLeft(n)),this.isSyncing=!1};this.scrollHandlers.set(e,n),e.addEventListener("scroll",n,{passive:!0})}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))}destroy(){null!==this.touchSettleTimeoutId&&(clearTimeout(this.touchSettleTimeoutId),this.touchSettleTimeoutId=null),["pinned-left","main","pinned-right"].forEach(t=>this.unregisterSection(t))}}const Ct={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)=>Ct.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?Ct.string(t,e,n):"number"==typeof t&&"number"==typeof e?Ct.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Ct.boolean(t,e,n):Ct.string(t+"",e+"",n)},St=({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=U(e,l),a=U(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 Ct.number(i,s,o)}return"date"===n?Ct.date(t+"",e+"",o):"boolean"===n?Ct.boolean(!!t,!!e,o):"enum"===n?Ct.enum(t+"",e+"",o):Ct.string(t+"",e+"",o)})(o,a,s,r)})})({rows:e,sortColumn:n,headers:t}),It=t=>{const{rows:e=[],headers:n=[],rowGrouping:o,rowManager:i}=t;if(i)return i.getAggregatedRows();if(!o||0===o.length)return e;const s=(t=>j(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=o[e],i=o[e+1],r=t[n];if(r&&_(r)){const o=l(r,e+1),a=Object.assign({},t);return a[n]=o,s.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&&_(n))s(n);else{const n=U(t,e);null!=n&&i.push(n)}})};if(s(t),0===i.length)return;if("custom"===n.type&&n.customFn)return n.customFn(i);const r=n.parseValue?i.map(n.parseValue).filter(t=>!isNaN(t)):i.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?i.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=i.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(o,t.accessor,t.aggregation,i);void 0!==e&&J(a,t.accessor,e)}),a}return t});return l(r)};class Ht{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=j(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=St({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?i.map(n=>{const i=t[0],s=n[i];if(_(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=It({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}):St({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,o,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()}}const Mt=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)},kt=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),Et=t=>{if(!t)return new Date;if("string"==typeof t)return Mt(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:kt(e)}return t instanceof Date?kt(t):new Date};class Tt{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=j(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=Et(t),s=Et((o||"")+""),r=kt(e),l=kt(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=>kt(Et((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(i&&2===i.length){const[t,e]=i.map(t=>kt(Et((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}})(U(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const o=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),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 Ot=(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},At=(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},Wt=({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)),h=Math.min(i.length,Math.ceil(d/l)),u=o+e,p=Math.max(0,Math.ceil(o/l)),f=Math.min(i.length,Math.floor(u/l)),v=o+e,w=Math.max(0,Math.floor(o/l)),m=Math.min(i.length,Math.ceil(v/l));return{rendered:{startIndex:c,endIndex:h,rows:i.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:i.slice(p,f)},partiallyVisible:{startIndex:w,endIndex:m,rows:i.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=o+e+h,p=Ot(Math.max(0,o-c),r);let f=Ot(u,r)+1;f=Math.min(i.length,f);const v=o,w=o+e;let m=Ot(v,r);v>a[m]&&(m=Math.min(m+1,i.length));let g=Ot(w,r);g=Math.min(i.length,g);const x=o+e,b=Ot(o,r);let y=Ot(x,r)+1;return y=Math.min(i.length,y),{rendered:{startIndex:p,endIndex:f,rows:i.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:i.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:i.slice(b,y)}}},Pt=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+At(t,n),$t=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+At(t,n),Ft=(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},Lt=new Map,Dt=(t,e,n,o,i)=>{var s,r,l,a,d,c;const h=null!==(r=null===(s=o[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,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${i.join(",")}`,v=Lt.get(f);if(v&&v.firstVisiblePosition===h&&v.renderedStartPosition===u&&v.renderedEndPosition===p)return v.result;const w=Bt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:i});if(Lt.set(f,{result:w,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),Lt.size>50){const t=Lt.keys().next().value;void 0!==t&&Lt.delete(t)}return w},Bt=({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=>X(t.rowId)===X(o.rowId))||(r.push(o),d++)}}if(r.length>0){Ft(a,t)&&(r.push(a),d++);const e=o[i+=d];e&&(a=e)}}else if(Ft(a,t))return r.push(a),i++,Bt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return Ft(a,t)?Bt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},jt=(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)}},zt=(t,e,n,o)=>{const i=document.querySelector(".st-body-container"),s=document.querySelector(".st-body-main");if(!i)return;const r=o?o.findIndex(e=>X(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=i.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&o){const t=((t,e,n,o)=>{const i=Wt({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})(l,i,e,o);if(t)return void jt(d,i,s)}if(!d)return i.scrollTop=Math.max(0,l*a-i.clientHeight/3),void setTimeout(()=>{const e=i.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&jt(e,i,s)},100);jt(d,i,s)},Nt=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function qt(t,e,n,o){const i=new Set,s=new Map;n.forEach((t,e)=>{const n=X(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),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const s=X(n[t].rowId);i.add(Nt({colIndex:e,rowIndex:t,rowId:s}))}return i}function Vt(t,e,n=document){var o,i,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"),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 p=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();p.push({key:e,top:n.top,bottom:n.bottom})}),p.sort((t,e)=>t.top-e.top);let f=null,v=1/0;for(let t=0;p.length>t;t++){const{key:e,top:n,bottom:o}=p[t];if(c>=n&&o>=c){f=e,v=0;break}const i=Math.abs(c-(n+o)/2);v>i&&(v=i,f=e)}if(null===f)return null;const w=u.get(f);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!==(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(),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 Gt{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=>it(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(X(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(X(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(`${X(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(X(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(X(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(`${X(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?X(i.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(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=X(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=X(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=X(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=X(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=>!t.hide&&!t.excludeFromRender),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=U(e,a);if(!1!==(null==d?void 0:d.useFormattedValueForClipboard)&&(null==d?void 0:d.valueFormatter)){const n=d.valueFormatter({accessor:a,colIndex:l,row:e,rowIndex: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=>!t.hide&&!t.excludeFromRender),c=o.findIndex(t=>X(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{const a=h+e,c=u+n;if(a>=o.length||c>=d.length)return;const p=o[a],f=d[c],v=X(p.rowId);if(!(null==f?void 0:f.isEditable))return void l.add(`${a}-${c}-${v}`);let w=t;if("number"===f.type){const e=+t;isNaN(e)||(w=e)}else if("boolean"===f.type)w="true"===t.toLowerCase()||"1"===t;else if("date"===f.type){const e=new Date(t);isNaN(e.getTime())||(w=e)}else"lineAreaChart"!==f.type&&"barChart"!==f.type||(w=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(J(p.row,f.accessor,w),s){const t=s.get(`${v}-${f.accessor}`);t&&t.updateContent(w)}null==i||i({accessor:f.accessor,newValue:w,row:p.row,rowIndex:a}),r.add(`${a}-${c}-${v}`)})}),{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=>!t.hide&&!t.excludeFromRender),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{const[e,a]=t.split("-").map(Number);if(e>=n.length||a>=l.length)return;const d=n[e],c=l[a],h=X(d.rowId);if(!(null==c?void 0:c.isEditable))return void r.add(t);let u=null;if(u="string"===c.type?"":"number"===c.type?null:"boolean"!==c.type&&("date"===c.type?null:"lineAreaChart"===c.type||"barChart"===c.type||Array.isArray(U(d.row,c.accessor))?[]:""),J(d.row,c.accessor,u),i){const t=i.get(`${h}-${c.accessor}`);t&&t.updateContent(u)}null==o||o({accessor:c.accessor,newValue:u,row:d.row,rowIndex:e}),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=X(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(()=>{document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=parseInt(t.getAttribute("data-row-index")||"-1",10),n=parseInt(t.getAttribute("data-col-index")||"-1",10),o=t.getAttribute("data-row-id");if(0>e||0>n||!o)return;const i=Nt({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(){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 j(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 Gt.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of Gt.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const a=B(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 Gt.HEADER_SELECTION_CLASSES)o.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 Gt.HEADER_SELECTION_CLASSES)n.classList.remove(t)}}syncAllCellClasses(){var t;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]");if(this.fullTableSelected||0!==this.selectedCells.size||0!==this.selectedColumns.size){for(let t=0;e.length>t;t++){const n=e[t];if(!(n instanceof HTMLElement))continue;const o=parseInt(n.getAttribute("data-row-index")||"-1",10),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),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 Gt.SELECTION_CLASSES){const e=u.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of Gt.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=Nt({rowIndex:i,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const s=Nt({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?X(r.rowId):null,a=this.config.tableRows[i+1],d=a?X(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:i-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:i+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:i,rowId:n}),p=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||!h||this.selectedColumns.has(t)&&i===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),u||s.push("st-selected-left-border"),p||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=Nt({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=Nt({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=Nt(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>zt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=qt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>zt(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=qt(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}getCellFromMousePosition(t,e){var n;return function(t,e,n=document){const o=document.elementFromPoint(t,e);if(!o)return null;const i=o.closest(".st-cell");if(i instanceof HTMLElement){if(!n.contains(i))return Vt(t,e,n);const o=parseInt(i.getAttribute("data-row-index")||"-1",10),s=parseInt(i.getAttribute("data-col-index")||"-1",10),r=i.getAttribute("data-row-id");if(o>=0&&s>=0&&null!==r)return{rowIndex:o,colIndex:s,rowId:r}}return Vt(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 o=n.querySelector(".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=n.querySelector(".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:document)}continuousScroll(){if(this.isSelecting&&this.startCell){if(null!==this.currentMouseX&&null!==this.currentMouseY){this.handleAutoScroll(this.currentMouseX,this.currentMouseY);const t=Date.now();if(t-this.lastSelectionUpdate>=this.selectionThrottleMs){const e=this.getCellFromMousePosition(this.currentMouseX,this.currentMouseY);e&&(this.updateSelectionRange(this.startCell,e),this.lastSelectionUpdate=t)}}this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll())}else null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleMouseDown({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const o=Nt({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n},this.updateDerivedState(),this.updateAllCellClasses()},0),this.currentMouseX=null,this.currentMouseY=null,this.lastSelectionUpdate=0,this.globalMouseMoveHandler=t=>{this.isSelecting&&this.startCell&&(this.currentMouseX=t.clientX,this.currentMouseY=t.clientY)},this.globalMouseUpHandler=()=>{var t,e;this.isSelecting=!1,null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null===(e=(t=this.config).onSelectionDragEnd)||void 0===e||e.call(t),this.syncAllCellClasses(),requestAnimationFrame(()=>this.syncAllCellClasses())},document.addEventListener("mousemove",this.globalMouseMoveHandler),document.addEventListener("mouseup",this.globalMouseUpHandler),this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll()))}handleMouseOver(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)}}}Gt.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"],Gt.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Kt=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(X(t.rowId))).map(t=>t.row);class Ut{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Kt(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(X(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const o=this.config.tableRows.find(e=>X(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>X(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>X(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>X(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class Jt{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 _t{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 Yt{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 Xt=(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 Qt{constructor(t,e){this.observers=new Set,this.expandedDepths=Xt(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class Zt{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 te(t){return t?t.offsetWidth-t.clientWidth:0}const ee=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(ee);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=ee(t[n]));return e},ne=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),oe="st-accordion-animating",ie="--st-accordion-duration",se="--st-accordion-easing",re=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},le=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ae=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},de=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ce=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t),o.setAttribute("cy",n),o.setAttribute("r","1.5"),o.setAttribute("fill","currentColor"),e.appendChild(o)}),e},he=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e};function ue(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function pe(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function fe(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=pe(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function ve(t,e){var n;const{pinnedLeft:o,unpinned:i,pinnedRight:s}=ue(t);if(!fe(o,e))return!1;if(!fe(i,e))return!1;if(!fe(s,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!we(o.children,e))return!1;return!0}function we(t,e){var n;if(!fe(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!we(o.children,e))return!1;return!0}function me(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=ue(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function ge(t,e,n){return[...t.filter(t=>pe(e.get(t+""),n)),...t.filter(t=>!pe(e.get(t+""),n))]}function xe(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=ge(e.left,s,n),l=ge(e.main,s,n),a=ge(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 be(t,e,n,o){const i=e+"",s=me(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&&(!pe(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),xe(t,{left:r,main:l,right:a},o)):null}class ye{static resolveIcons(t){var e,n,o,i,s,r,l,a,d,c,h,u,p,f,v,w,m,g;const x={drag:ce("st-drag-icon"),expand:le("st-expand-icon"),filter:he("st-header-icon"),headerCollapse:le("st-header-icon"),headerExpand:re("st-header-icon"),next:le("st-next-prev-icon"),prev:re("st-next-prev-icon"),sortDown:de("st-header-icon"),sortUp:ae("st-header-icon")};return{drag:null!==(n=null===(e=t.icons)||void 0===e?void 0:e.drag)&&void 0!==n?n:x.drag,expand:null!==(i=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==i?i:x.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(w=null===(v=t.icons)||void 0===v?void 0:v.sortDown)&&void 0!==w?w:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.sortUp}}static mergeCustomTheme(e){return Object.assign(Object.assign({},t),e.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,i,s,r,l,a,d,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(i=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.searchEnabled)||void 0===i||i,searchPlaceholder:null!==(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const i of t)i.isEssential&&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 Xt(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class Re{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;const s=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(o=e.className)&&void 0!==o?o:"",l=null!==(i=e.columnBorders)&&void 0!==i&&i,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${s} ${r} ${l?"st-column-borders":""}`;const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.setAttribute("role","grid"),h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",u.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const v="top"===e.footerPosition;v&&a.classList.add("st-footer-position-top");const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),v?(d.appendChild(f),d.appendChild(c)):(d.appendChild(c),d.appendChild(f)),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}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 Ce=(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))),b(i,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),b(i,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),i},Se={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"},Ie=t=>{switch(t){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},He=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Me=t=>["between","notBetween","in","notIn"].includes(t),ke=t=>["isEmpty","isNotEmpty"].includes(t),Ee=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},Te=t=>{var e,n,o;let{children:i,containerRef:s,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:p="fixed",allowDescendantOverflow:f=!1}=t,v=f;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",v&&m.classList.add(w),m.style.position=p,m.style.overflow=v?"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(i);let g=l;if("fixed"===p){const t=null!==(o=null!==(n=null!==(e=Ee(g))&&void 0!==e?e:Ee(null!=r?r:null))&&void 0!==n?n:Ee(null!=s?s:null))&&void 0!==o?o:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,o=h||m.offsetWidth;let i;i=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=i.bottom-e.bottom,a=e.top-i.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(o>i.right-e.right+e.width&&(c="right"),"fixed"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${v?" "+w:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=v?"visible":c),void 0!==t.allowDescendantOverflow&&(v=t.allowDescendantOverflow,m.classList.toggle(w,v),m.style.overflow=v?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},Oe=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 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 p=document.createElement("span");p.className="st-custom-select-value";const f=o.find(t=>t.value===e);p.textContent=f?f.label:i;const v=document.createElement("template");v.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const w=v.content.firstElementChild;u.appendChild(p),u.appendChild(w),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.innerHTML="",o.forEach((t,n)=>{const o=document.createElement("div");o.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),o.setAttribute("role","option"),o.setAttribute("aria-selected",""+(t.value===e)),o.setAttribute("tabindex","0"),o.textContent=t.label,o.addEventListener("click",()=>y(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(o)})};g();const x=Te({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=o.find(t=>t.value===e);p.textContent=n?n.label:i},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);p.textContent=n?n.label:i,g()}void 0!==t.options&&(o=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},Ae=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&&setTimeout(()=>c.focus(),0);const h=t=>{o(t.target.value)},u=t=>{"Enter"===t.key&&i&&(t.preventDefault(),i())};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&&(o=t.onChange),void 0!==t.onEnter&&(i=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},We=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()},h=()=>{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 h(),{element:s,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(i=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()}}},Pe=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),f()},d=()=>{i=new Date(i.getFullYear(),i.getMonth()+1,1),f()},c=t=>{i=new Date(t,i.getMonth(),1),s="months",f()},h=t=>{const o=i.getFullYear(),s=i.getMonth(),r=new Date(o,s,t,12,0,0);i=r,e(r),null==n||n()},u=t=>{const o=new Date(i.getFullYear(),i.getMonth()-1,t,12,0,0);i=o,e(o),null==n||n()},p=t=>{const o=new Date(i.getFullYear(),i.getMonth()+1,t,12,0,0);i=o,e(o),null==n||n()},f=()=>{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.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${v=i,v.toLocaleString("default",{month:"long"})} ${i.getFullYear()}`,n.addEventListener("click",()=>{s="months",f()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',o.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent=""+i.getFullYear(),e.addEventListener("click",()=>{s="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var v;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",()=>u(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",()=>h(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",()=>p(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",f()})(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 x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);i=o,e(o),null==n||n()}),g.appendChild(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,i=o||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},$e=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},Fe=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");n&&o&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),o.className="st-checkbox-custom "+(e?"st-checked":""),o.setAttribute("aria-hidden","true"),o.innerHTML="",e&&o.appendChild($e()))},Le=({checked:t,onChange:e,ariaLabel:n})=>{const o=document.createElement("label");o.className="st-checkbox-label";const i=document.createElement("input");i.type="checkbox",i.checked=t,i.className="st-checkbox-input",n&&i.setAttribute("aria-label",n),i.setAttribute("aria-checked",""+t);const s=document.createElement("span");s.className="st-checkbox-custom "+(t?"st-checked":""),s.setAttribute("aria-hidden","true"),t&&s.appendChild($e());const r=()=>{const t=i.checked;i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild($e())):(s.classList.remove("st-checked"),s.innerHTML=""),e(t)};return i.addEventListener("change",r),i.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(i),o.appendChild(s),{element:o,update:t=>{i.checked!==t&&(i.checked=t,i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.innerHTML="",s.appendChild($e())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{i.removeEventListener("change",r)}}},De=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,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"";const d=Ie("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=Oe({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Se[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,v=null;const w=()=>{const t=Object.assign({accessor:e.accessor,operator:l},He(l)&&{value:a});o(t)},m=()=>ke(l)||""!==a.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),He(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=Ae({type:"text",value:a,onChange:t=>{a=t,v&&v.update({canApply:m()})},onEnter:w,placeholder:"Filter...",autoFocus:!0}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),v&&v.update({canApply:m()})};return v=We({onApply:w,onClear:i,canApply:m(),showClear:!!n}),c.appendChild(v.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"",u.update({value:l}),f&&f.update({value:a}),v&&v.update({showClear:!!n,canApply:m()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),v&&v.destroy(),c.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==i?void 0:i.operator)||"equals",c=((null==i?void 0:i.value)||"")+"",h=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=Ie("number"),f=document.createElement("div");f.className="st-filter-container";const v=document.createElement("div");v.className="st-filter-section";const w=Oe({value:d,onChange:t=>{d=t,S()},options:p.map(t=>({value:t,label:Se[t]})),containerRef:l,mainBodyRef:a});v.appendChild(w.element),f.appendChild(v);let m=null,g=null,x=null,b=null,y=null;const R=()=>{const t={accessor:o.accessor,operator:d};He(d)?t.value=parseFloat(c):Me(d)&&(t.values=[parseFloat(h),parseFloat(u)]),s(t)},C=()=>!!ke(d)||(He(d)?""!==c.trim():!!Me(d)&&""!==h.trim()&&""!==u.trim()),S=()=>{m&&(m.remove(),m=null),g&&(g.destroy(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),He(d)?(m=document.createElement("div"),m.className="st-filter-section",g=Ae({type:"number",value:c,onChange:t=>{c=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"Enter number...",autoFocus:!0}),m.appendChild(g.element),f.insertBefore(m,f.lastChild)):Me(d)&&(m=document.createElement("div"),m.className="st-filter-section",x=Ae({type:"number",value:h,onChange:t=>{h=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),b=Ae({type:"number",value:u,onChange:t=>{u=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"To..."}),m.appendChild(x.element),m.appendChild(b.element),f.insertBefore(m,f.lastChild)),y&&y.update({canApply:C()})};return y=We({onApply:R,onClear:r,canApply:C(),showClear:!!i}),f.appendChild(y.element),S(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,d=(null==i?void 0:i.operator)||"equals",c=((null==i?void 0:i.value)||"")+"",h=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",w.update({value:d}),g&&g.update({value:c}),x&&x.update({value:h}),b&&b.update({value:u}),y&&y.update({showClear:!!i,canApply:C()}),S())},destroy:()=>{w.destroy(),g&&g.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),f.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i,containerRef:s,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const d=Ie("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=Oe({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:Se[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,v=null;const w=()=>ke(l)||""!==a,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),He(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=Oe({value:a,onChange:t=>{a=t,v&&v.update({canApply:w()})},options:m,containerRef:s,mainBodyRef:r}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),v&&v.update({canApply:w()})};return v=We({onApply:()=>{const t={accessor:e.accessor,operator:l};He(l)&&(t.value="true"===a),o(t)},onClear:i,canApply:w(),showClear:!!n}),c.appendChild(v.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true",u.update({value:l}),f&&f.update({value:a}),v&&v.update({showClear:!!n,canApply:w()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),v&&v.destroy(),c.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==i?void 0:i.operator)||"equals",c=(null==i?void 0:i.value)?i.value+"":"",h=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=Ie("date"),f=document.createElement("div");f.className="st-filter-container";const v=document.createElement("div");v.className="st-filter-section";const w=Oe({value:d,onChange:t=>{d=t,O()},options:p.map(t=>({value:t,label:Se[t]})),containerRef:l,mainBodyRef:a});v.appendChild(w.element),f.appendChild(v);let m=null,g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null;const k=()=>!!ke(d)||(He(d)?""!==c.trim():!!Me(d)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=Et(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},T=(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=E(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",o&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?Et(t):new Date,c=Pe({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=Te({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});i.appendChild(s),i.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return s.addEventListener("click",u),s.addEventListener("keydown",p),{container:i,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",p),c.destroy(),h.destroy(),i.remove()}}},O=()=>{if(m&&(m.remove(),m=null),g&&(g=null),x&&(x=null),b&&(b=null),y&&(y.destroy(),y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),He(d)){m=document.createElement("div"),m.className="st-filter-section";const t=T(c,t=>{c=t,M&&M.update({canApply:k()})},"Select date...",!0);g=t.container,y=t.picker,S=t.dropdown,m.appendChild(g),f.insertBefore(m,f.lastChild)}else if(Me(d)){m=document.createElement("div"),m.className="st-filter-section";const t=T(h,t=>{h=t,M&&M.update({canApply:k()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=T(u,t=>{u=t,M&&M.update({canApply:k()})},"To date...",!1);x=t.container,R=t.picker,I=t.dropdown,b=e.container,C=e.picker,H=e.dropdown,m.appendChild(x),m.appendChild(b),f.insertBefore(m,f.lastChild)}M&&M.update({canApply:k()})};return M=We({onApply:()=>{const t={accessor:o.accessor,operator:d};He(d)?t.value=c:Me(d)&&(t.values=[h,u]),s(t)},onClear:r,canApply:k(),showClear:!!i}),f.appendChild(M.element),O(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,d=(null==i?void 0:i.operator)||"equals",c=(null==i?void 0:i.value)?i.value+"":"",h=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",w.update({value:d}),M&&M.update({showClear:!!i,canApply:k()}),O())},destroy:()=>{w.destroy(),y&&y.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),f.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter: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 h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const p=Le({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let v=null,w=null;s.length>10&&(v=document.createElement("div"),v.className="st-enum-search",w=Ae({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),v.appendChild(w.element),h.appendChild(v));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?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=Le({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=We({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):i()},onClear:i,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",w&&w.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},Be=(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}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},s=()=>{i(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=De({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=Te({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return b(l,"click",p),b(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l},je=(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")||document.querySelector(".simple-table-root");"fixed"===n.positioning?s?s.appendChild(i):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 l=e=>{const n=e.target;i.contains(n)||t.contains(n)||c()},a=t=>{"Escape"===t.key&&(t.preventDefault(),c())},d=t=>{i.contains(t.target)||c()},c=()=>{i.remove(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",d,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",a,!0),window.addEventListener("scroll",d,!0)},0),r(i,"mousedown",t=>{t.stopPropagation()}),i},ze=(t,e)=>new Date(t,e+1,0).getDate(),Ne=["January","February","March","April","May","June","July","August","September","October","November","December"],qe=["Su","Mo","Tu","We","Th","Fr","Sa"],Ve=(t,e,n)=>{const{header:o,row:i}=t,s=U(i,o.accessor);return"boolean"===o.type?((t,e,n,o)=>{var i;const{header:s,row:l,rowIndex:a}=t;let d;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 h=document.createElement("div");h.className="st-dropdown-item "+(!1===n?"selected":""),h.textContent="False",h.setAttribute("role","option"),h.setAttribute("aria-selected",(!1===n)+""),h.setAttribute("aria-disabled","false");const u=t=>{J(l,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:l,rowIndex:a}),d.remove(),o()};r(c,"click",()=>u(!0)),r(h,"click",()=>u(!1));const p=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===c?h.focus():c.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===c?u(!0):document.activeElement===h&&u(!1))};c.setAttribute("tabindex","0"),h.setAttribute("tabindex","0"),r(c,"keydown",p),r(h,"keydown",p);const f=document.createDocumentFragment();f.appendChild(c),f.appendChild(h);const v=V({accessor:s.accessor,rowId:null!==(i=t.stableRowKey)&&void 0!==i?i:t.rowId}),w=document.getElementById(v);return d=je(w||document.body,f,{width:120,positioning:"fixed",onClose:o}),d})(t,e,!!s,n):"enum"===o.type?((t,e,n,o)=>{var i;const{header:s,row:l,rowIndex:a}=t,d=s.enumOptions||[];let c;const h=t=>{J(l,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:l,rowIndex:a}),c.remove(),o()},u=[];d.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,r(o,"click",()=>h(t.value)),u.push(o)});const p=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&&h(t)}};u.forEach(t=>{r(t,"keydown",p)});const f=document.createElement("div");f.className="st-enum-dropdown-content",u.forEach(t=>f.appendChild(t));const v=V({accessor:s.accessor,rowId:null!==(i=t.stableRowKey)&&void 0!==i?i:t.rowId}),w=document.getElementById(v);return c=je(w||document.body,f,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=d.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),c})(t,e,(s||"")+"",n):"date"===o.type?((t,e,n,o)=>{var i,s,l;const{header:a,row:d,rowIndex:c}=t;let h,u;try{u=n?Mt(n+""):new Date}catch(t){u=new Date}let p=u.getFullYear(),f=u.getMonth();const v=document.createElement("div");v.className="st-datepicker";const w=document.createElement("div");w.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(i=e.icons.prev)&&void 0!==i?i:re("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(s=e.icons.next)&&void 0!==s?s:le("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),w.appendChild(m),w.appendChild(x),w.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",qe.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",r(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),v.appendChild(w),v.appendChild(R),v.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];J(d,a.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:a.accessor,newValue:n,row:d,rowIndex:c}),h.remove(),o()},H=()=>{var t,e,n;for(x.textContent=`${Ne[f]} ${p}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=ze(p,f),i=new Date(p,f,1).getDay(),s=ze(p,f-1),l=new Date;for(let t=0;i>t;t++){const n=s-i+t+1,o=new Date(p,f-1,n),l=document.createElement("div");l.className="st-datepicker-day other-month",l.textContent=n+"",l.setAttribute("tabindex","0"),l.setAttribute("role","button"),l.setAttribute("aria-label",`${null!==(e=Ne[f-1])&&void 0!==e?e:Ne[11]} ${n}, ${o.getFullYear()}`),r(l,"click",()=>I(o)),r(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(l)}const a=u.getFullYear()===p&&u.getMonth()===f;for(let t=1;o>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${Ne[f]} ${t}, ${p}`),l.getFullYear()===p&&l.getMonth()===f&&l.getDate()===t&&e.classList.add("today"),a&&u.getDate()===t&&e.classList.add("selected");const n=new Date(p,f,t);r(e,"click",()=>I(n)),r(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const d=i+o,c=Math.max(35,7*Math.ceil(d/7))-d;for(let t=1;c>=t;t++){const e=new Date(p,f+1,t),o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=t+"",o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${null!==(n=Ne[f+1])&&void 0!==n?n:Ne[0]} ${t}, ${e.getFullYear()}`),r(o,"click",()=>I(e)),r(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};r(m,"click",()=>{f--,0>f&&(f=11,p--),H()}),r(b,"click",()=>{f++,f>11&&(f=0,p++),H()}),H();const M=V({accessor:a.accessor,rowId:null!==(l=t.stableRowKey)&&void 0!==l?l:t.rowId}),k=document.getElementById(M);return h=je(k||document.body,v,{width:240,overflow:"hidden",positioning:"fixed",onClose:o}),h})(t,e,s,n):((t,e,n,o)=>{const{header:i,row:s,rowIndex:l}=t,a=document.createElement("input");a.className="editable-cell-input","number"===i.type?(a.type="text",a.inputMode="decimal"):a.type="text",a.value=null!=n?n+"":"",a.setAttribute("autofocus","true"),setTimeout(()=>{a.focus(),a.select()},0);let d=!0;if("number"===i.type){const t=()=>{const t=a.value;/^-?\d*\.?\d*$/.test(t)||(a.value=t.slice(0,-1))};r(a,"input",t)}return r(a,"blur",t=>{if(!d)return void o();let n=a.value;if("number"===i.type){const t=parseFloat(a.value);n=isNaN(t)?0:t}J(s,i.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:n,row:s,rowIndex:l}),o()}),r(a,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,a.blur()):"Escape"===e.key&&(d=!1,a.blur())}),r(a,"mousedown",t=>{t.stopPropagation()}),a})(t,e,s,n)},Ge=(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)?Et(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Ke=(t,e,n)=>{var o;const{header:i,row:s,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=U(s,i.accessor),h=i.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(h){const o=document.createElement("div");o.className="st-selection-cell-content";const i=document.createElement("div");i.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>Le({checked:n,onChange:n=>{var o;null===(o=e.handleRowSelect)||void 0===o||o.call(e,t.rowId+"",n)},ariaLabel:"Select row "+(t.displayRowNumber+1)}).element)(t,e,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 u=e.rowGrouping&&e.rowGrouping[a],p=!!u&&((t,e)=>!!e&&_(t[e]))(s,u),f=e.rowGrouping&&e.rowGrouping.length>a,v=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(i.expandable&&(p&&f&&v||i.nestedTable||e.onRowGroupExpand&&f&&v)){const o=new Set(e.expandedDepths),i=et(t.tableRow),s=ot(i,a,o,e.expandedRows,e.collapsedRows),r=on(t,e,s);n.appendChild(r)}if("lineAreaChart"===i.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color: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 h=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=o,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",o+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const v=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",n),o.setAttribute("fill",s||"var(--st-chart-fill-color)"),o.setAttribute("fill-opacity",r+""),o.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",i||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(o),f.appendChild(a)};return v(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,f.setAttribute("height",o+"")),void 0!==t.color&&(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,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):f.innerHTML=""},destroy:()=>{f.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(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:i,gap:s=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=o,p=(100-s*(e.length-1))/e.length,f=0>d,v=f?u*(c/h):u,w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",n+""),w.setAttribute("height",o+""),w.setAttribute("viewBox","0 0 100 "+u),w.setAttribute("preserveAspectRatio","none"),w.setAttribute("class",("st-bar-chart "+r).trim()),w.setAttribute("shape-rendering","crispEdges"),w.style.display="block";const m=()=>{w.innerHTML="",e.forEach((t,e)=>{const n=e*(p+s),o=(t-d)/h*u;let r=u-o,l=o;f&&(0>t?(l=Math.abs(t)/h*u,r=v):(l=t/h*u,r=v-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",i||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),w.appendChild(a)})};return m(),{element:w,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,w.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,w.setAttribute("height",o+"")),void 0!==t.color&&(i=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,w.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):w.innerHTML=""},destroy:()=>{w.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:c,formattedValue:null===(o=i.valueFormatter)||void 0===o?void 0:o.call(i,{accessor:i.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=Ge(c,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=Ge(c,i,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const w=Ge(c,i,l,s,r);if(null!==w){const t=document.createTextNode(w);n.appendChild(t)}},Ue=new Map,Je=new WeakMap,_e=new WeakMap;let Ye=null;const Xe=(t,e)=>{Ue.has(t)||Ue.set(t,new Set),Ue.get(t).add(e)},Qe=(t,e)=>{const n=Ue.get(t);n&&(n.delete(e),0===n.size&&Ue.delete(t))},Ze=(t,e)=>{const n=Ue.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},tn=(t,e)=>{var n;const{header:o,rowIndex:i,colIndex:s,rowId:r,depth:l,isOdd:a}=t,d=o.isSelectionColumn&&e.enableRowSelection,c=!!(null==o?void 0:o.isEditable)||!(!e.onCellClick||d),h={rowIndex:i,colIndex:s,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),v=e.isCopyFlashing(h),w=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{var t,n,i;if(!e.columnBorders)return!1;const s=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===o.pinned?(null===(t=s[s.length-1])||void 0===t?void 0:t.accessor)===o.accessor:"right"===o.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===o.accessor:(null===(i=r[r.length-1])||void 0===i?void 0:i.accessor)===o.accessor})();return["st-cell","st-row-position-"+t.tableRow.position,l>0&&o.expandable?"st-cell-depth-"+l:"",g?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",v?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",w?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?s%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},en=(t,e)=>{var n,o;const{header:i,row:s,rowIndex:l,colIndex:a,rowId:d}=t,c=i.isSelectionColumn&&e.enableRowSelection,h={rowIndex:l,colIndex:a,rowId:d},u=e.isInitialFocusedCell(h),p=tn(t,e),f=document.createElement("div");f.className=p,f.id=V({accessor:i.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:d}),f.setAttribute("role","gridcell"),f.setAttribute("tabindex",u?"0":"-1");const v=null!==(o=e.maxHeaderDepth)&&void 0!==o?o:1;f.setAttribute("aria-rowindex",t.tableRow.position+v+1+""),f.setAttribute("aria-colindex",a+1+""),f.setAttribute("data-row-index",l+""),f.setAttribute("data-col-index",a+""),f.setAttribute("data-row-id",d+""),f.setAttribute("data-accessor",i.accessor+""),f.style.position="absolute",f.style.left=t.left+"px",f.style.top=t.top+"px",f.style.width=t.width+"px",f.style.height=t.height+"px";let w=!1;const m="boolean"===i.type||"date"===i.type||"enum"===i.type,g=()=>{var n,o;const s=null!==(o=null===(n=Je.get(f))||void 0===n?void 0:n.context)&&void 0!==o?o:e;if(w&&!m){f.innerHTML="",f.setAttribute("tabindex","-1");const e=Ve(t,s,()=>{w=!1,f.setAttribute("tabindex",u?"0":"-1"),g(),b()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),f.appendChild(t)}}else if(w&&m)Ve(t,s,()=>{w=!1,g(),b()});else{f.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===i.align?"right-aligned":"center"===i.align?"center-aligned":"left-aligned"),Ke(t,s,e),f.appendChild(e)}};g();const x={row:s,tableRow:t.tableRow,context:e};Je.set(f,x);const b=()=>{if(e.cellRegistry&&!c){const t=`${d}-${i.accessor}`;_e.set(f,t),e.cellRegistry.set(t,{updateContent:t=>{w||(J(x.row,i.accessor,t),g(),e.cellUpdateFlash&&(f.classList.add(u?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{f.classList.remove("st-cell-updating-first","st-cell-updating")},800)))}})}};if(b(),!w&&!c){const t=t=>{var n,o;if(t.preventDefault(),t.target.closest(".st-expand-icon-container"))return;const i=parseInt(null!==(n=f.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),s=parseInt(null!==(o=f.getAttribute("data-col-index"))&&void 0!==o?o:"-1",10),r=f.getAttribute("data-row-id");0>i||0>s||null===r||e.handleMouseDown({rowIndex:i,colIndex:s,rowId:r})},n=t=>{var n,o;const i=t,s=parseInt(null!==(n=f.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(o=f.getAttribute("data-col-index"))&&void 0!==o?o:"-1",10),l=f.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?h:{rowIndex:s,colIndex:r,rowId:l},i.clientX,i.clientY)};r(f,"mousedown",t),r(f,"mouseover",n)}if(r(f,"keydown",t=>{w||c||"F2"!==t.key&&"Enter"!==t.key||!i.isEditable||w||(t.preventDefault(),w=!0,g())}),r(f,"dblclick",t=>{!i.isEditable||c||w||(w=!0,g())}),e.onCellClick&&!c){const t=t=>{var n,o,r,d,c;if(t.target.closest(".st-expand-icon-container"))return;const h=null!==(o=null===(n=Je.get(f))||void 0===n?void 0:n.row)&&void 0!==o?o:s,u=U(h,i.accessor),p=parseInt(null!==(r=f.getAttribute("data-row-index"))&&void 0!==r?r:l+"",10),v=parseInt(null!==(d=f.getAttribute("data-col-index"))&&void 0!==d?d:a+"",10);null===(c=e.onCellClick)||void 0===c||c.call(e,{accessor:i.accessor,colIndex:v,row:h,rowIndex:p,value:u})};r(f,"click",t)}if(e.useHoverRowBackground){const t=d+"";Xe(t,f);const e=()=>{var e;const n=null!==(e=f.getAttribute("data-row-id"))&&void 0!==e?e:t;null!==Ye&&Ye!==n&&Ze(Ye,!1),Ze(n,!0),Ye=n},n=()=>{var e;const n=null!==(e=f.getAttribute("data-row-id"))&&void 0!==e?e:t;Ze(n,!1),Ye===n&&(Ye=null)};r(f,"mouseenter",e),r(f,"mouseleave",n)}return f},nn=(t,e,n)=>{var o;const{rowIndex:i,colIndex:s,rowId:r}=e,l={rowIndex:i,colIndex:s,rowId:r};t.className=tn(e,n);const a=n.isInitialFocusedCell(l);t.setAttribute("tabindex",a?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const d=t.dataset.stAccordionGrow;"horizontal"!==d&&(t.style.width=e.width+"px"),"vertical"!==d&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",i+""),t.setAttribute("data-col-index",s+"");const c=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+c+1+""),t.setAttribute("aria-colindex",s+1+"");const h=t.getAttribute("data-row-id"),u=r+"";h&&h!==u&&(Qe(h,t),Xe(u,t)),t.setAttribute("data-row-id",u),t.setAttribute("data-accessor",e.header.accessor+"");const p=Je.get(t);if(p?(p.row=e.row,p.tableRow=e.tableRow,p.context=n):Je.set(t,{row:e.row,tableRow:e.tableRow,context:n}),n.cellRegistry&&!e.header.isSelectionColumn){const o=_e.get(t),i=`${e.rowId}-${e.header.accessor}`;if(o!==i){if(o){const t=n.cellRegistry.get(o);t&&(n.cellRegistry.delete(o),n.cellRegistry.set(i,t))}_e.set(t,i)}}if(!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",Ke(e,n,o))}},on=(t,e,n)=>{const o=document.createElement("div");o.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("aria-label",n?"Collapse row":"Expand row"),o.setAttribute("tabindex","0");const i=e.icons.expand;i&&("string"==typeof i?o.innerHTML=i:(i instanceof HTMLElement||i instanceof SVGSVGElement)&&o.appendChild(i.cloneNode(!0)));const s=n=>{var i;n.stopPropagation();const s=o.closest("[data-row-id]"),r=s?Je.get(s):void 0,l=null!==(i=null==r?void 0:r.tableRow)&&void 0!==i?i:t.tableRow,a=et(l),d=l.depth,c=new Set(e.expandedDepths),h=e.getExpandedRows?e.getExpandedRows():e.expandedRows,u=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=ot(a,d,c,h,u),f=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(a),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(a),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(a),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,o=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(a)||{};return o.set(a,Object.assign(Object.assign({},i),{loading:t,triggerSection:n})),o})},0)},i=t=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(a)||{};return o.set(a,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(a)||{};return o.set(a,Object.assign(Object.assign({},i),{isEmpty:t,loading:!1,triggerSection:n})),o})};e.onRowGroupExpand({row:t.row,depth:d,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[d],isExpanded:f,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:o,setError:i,setEmpty:s})}};return r(o,"click",s),r(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),o},sn=(t,e,n)=>{var o,i;const s=t.querySelector(".st-expand-icon-container");if(!(s&&s instanceof HTMLElement))return;if(s.classList.contains("expanded")===e)return;const r=null!==(o=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==o?o:"Collapse row",l=null!==(i=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==i?i:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.classList.toggle("expanded",e),s.classList.toggle("collapsed",!e),s.setAttribute("aria-label",e?r:l),(null==n?void 0:n.syncAriaExpanded)&&s.setAttribute("aria-expanded",e+"")})})},rn=(t,e)=>{var n,o;const{icons:i}=e;if(!q(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 b(r,"click",a),b(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},ln=(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=ln(i.children,e,[...n,o]);if(t)return t}}return null},an=(t,e)=>{if(t.pinned)return t.pinned;const n=N(e,t.accessor);return n?an(n,e):void 0},dn=(t,e)=>{const n=an(t,e);return"left"===n?"left":"right"===n?"right":"main"};function cn(t,e,n){const o=ee(t);let i=!1;function s(t,e){let n,o=t;for(let t=0;e.length-1>t;t++)o=o[e[t]].children;return n=o[e[e.length-1]],n}function r(t,e,n){let o=t;for(let t=0;e.length-1>t;t++){if(!o[e[t]].children){i=!0;break}o=o[e[t]].children}o[e[e.length-1]]=n}const l=s(o,e);return r(o,e,s(o,n)),r(o,n,l),{newHeaders:o,emergencyBreak:i}}const hn=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a}=e,d=a?W:0,c=(a?i+1:i)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),h=t.querySelector(".st-horizontal-scrollbar-left"),u=null==h?void 0:h.firstElementChild;o>0&&h&&u&&(h.style.width=o+"px",u.style.width=s+"px");const p=t.querySelector(".st-horizontal-scrollbar-middle"),f=null==p?void 0:p.firstElementChild;n>0&&p&&f&&(f.style.width=n+"px");const v=t.querySelector(".st-horizontal-scrollbar-right"),w=null==v?void 0:v.firstElementChild;if(i>0&&v&&w&&(v.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")}},un=(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()},pn=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,s=0;t.forEach(t=>{if(t.hide)return;const e=it(t,n).reduce((t,e)=>t+dt(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*L(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:z(o),rightWidth:z(i),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},fn=(t,e)=>{if(t.pinned)return t.pinned;const n=N(e,t.accessor);return n?fn(n,e):void 0},vn=(t,e,n)=>{var o;const i=[],s=[],r=[];t.forEach(e=>{if(e.hide)return;const n=fn(e,t);"left"===n?i.push(e):"right"===n?r.push(e):s.push(e)});const l=(t,o,i)=>{var s,r;const a=o;if(t.children&&t.children.length>0){const r=null==e?void 0:e.has(t.accessor),d=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||D;return r?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(s=null==n?void 0:n.get(t.accessor))&&void 0!==s?s:"number"==typeof t.width?t.width:dt(t);return i.set(t.accessor,{left:a,width:e}),o=a+e,d.forEach(t=>{o=l(t,o,i)}),o}d.forEach(t=>{o=l(t,o,i)}),i.set(t.accessor,{left:a,width:o-a})}else{const e=null!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:dt(t);i.set(t.accessor,{left:o,width:e}),o+=e}return o},a=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=l(t,n,e)}),e},d=a(i),c=a(s),h=a(r),u=new Map;d.forEach((t,e)=>u.set(e,t)),c.forEach((t,e)=>u.set(e,t)),h.forEach((t,e)=>u.set(e,t)),u.forEach((t,e)=>{const{left:n,width:o}=t,i=V({accessor:e,rowId:"header"}),s=document.getElementById(i);d.has(e),h.has(e),s&&(s.style.left=n+"px",s.style.width=o+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=o+"px")})});const p=document.querySelector(".st-body-container"),f=null!==(o=null==p?void 0:p.clientWidth)&&void 0!==o?o:0,v=pn({headers:t,containerWidth:f>0?f:void 0,collapsedHeaders:e}),{leftWidth:w,rightWidth:m,mainWidth:g,leftContentWidth:x,rightContentWidth:b}=v;if(w>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=w+"px"),e&&(e.style.width=w+"px")}if(m>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}const y=null==p?void 0:p.closest(".simple-table-root"),R=null==y?void 0:y.querySelector(".st-horizontal-scrollbar-container"),C=null==y?void 0:y.querySelector(".st-body-main"),S=!!(null==y?void 0:y.querySelector(".st-column-editor"));R&&C&&p&&C.scrollWidth-C.clientWidth>1&&hn(R,{mainBodyRef:C,mainBodyWidth:g,pinnedLeftWidth:w,pinnedRightWidth:m,pinnedLeftContentWidth:x,pinnedRightContentWidth:b,tableBodyContainerRef:p,editColumns:S})},wn=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n})=>{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 o=e;for(;o>.5;){const e=F,i=t.map(t=>{const o=n.get(t.accessor)||100;return{column:t,headroom:Math.max(0,o-e),initialWidth:o,minWidth:e}}).filter(t=>t.headroom>0);if(0>=i.length)break;{const t=i.reduce((t,e)=>t+e.headroom,0);let e=0;const n=o;i.forEach((o,s)=>{let r=n*(o.headroom/t);r=Math.min(r,o.headroom),s===i.length-1&&(r=Math.min(n-e,o.headroom)),o.column.width=o.initialWidth-r,e+=r}),o-=e}}},mn=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:o,headers:i,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,startWidth:u})=>{const p=t=>{if(!d||0>=n||0>=t)return t;const e=i.some(t=>"left"===t.pinned&&!t.hide),o=i.some(t=>"right"===t.pinned&&!t.hide),r=((t,e,n)=>t*L(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=ut(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,f=r===n.length-1;let v;v="left"===d&&f||"right"===d&&l?[]:l?n.slice(r+1):f||a?n.slice(0,i):n.slice(r+1);const w=Array.from(s.values()).reduce((t,e)=>t+e,0);if(o>0){let e=o,n=!1;if(v.length>0&&w+o>(h>0?Math.max(h,w):w+Math.abs(o)+1)){n=!0;const t=v.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-F)},0);e=Math.min(o,t)}o>0&&!n&&(e=p(e));const i=(u+e)/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*i,40)}),n&&e>0&&v.length>0&&wn({columnsToShrink:v,totalCompensation:e,initialWidthsMap:s})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(u+o,F*t.length),i=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*i,40)});const r=u-n;r>0&&v.length>0&&wn({columnsToShrink:v,totalCompensation:-r,initialWidthsMap:s})}return}const f=ut(c,e),v=f.findIndex(t=>t.accessor===l.accessor);if(-1===v)return;const w=0===v,m=v===f.length-1;let g;if(g="left"===d&&m||"right"===d&&w?[]:w?f.slice(v+1):m||a?f.slice(0,v):f.slice(v+1),0===g.length){const t=F,e=o>0?p(o):o;return void(l.width=Math.max(u+e,t))}const x=Array.from(s.values()).reduce((t,e)=>t+e,0);if(o>0){if((h>0?Math.max(h,x):x+Math.abs(o)+1)>=x+o){const t=o>0?p(o):o;return void(l.width=u+t)}const t=g.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-F)},0),e=Math.min(o,t);l.width=u+e,e>0&&wn({columnsToShrink:g,totalCompensation:e,initialWidthsMap:s})}else{const t=Math.max(u+o,40),e=u-t;l.width=t,e>0&&wn({columnsToShrink:g,totalCompensation:-e,initialWidthsMap:s})}},gn=(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},xn=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:s,mainBodyRef:r,onColumnWidthChange:l,reverse:a=!1,setHeaders:d,setIsResizing:c,startWidth:h})=>{o.preventDefault();const u="clientX"in o?o.clientX:o.touches[0].clientX,p="touches"in o;if(!i||i.hide)return;const f=gn(n,r);c(!0);const v=fn(i,s),w=ht(i);let m;if(i.children&&i.children.length>0){const t=it(i,e);m=t.length>0?t:[i]}else m=[i];const g=new Map;let x=0,b=0;if(t){const t=s.filter(t=>t.pinned===v);if(ut(t,e).forEach(t=>{const e=dt(t);g.set(t.accessor,e)}),f>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=pn({headers:s,containerWidth:f,collapsedHeaders:e});x="left"===v?t:"right"===v?n:o;const i=Math.max(0,f-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;b=l>0?Math.min(i,l):i}}let y=!1;const R=new Map;let C=[];if(t&&v&&f>0){const t=ut(s.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(m.length>1){const e=t.findIndex(t=>t.accessor===m[0].accessor),o=t.findIndex(t=>t.accessor===m[m.length-1].accessor);n="left"===v&&o===t.length-1||"right"===v&&0===e}else{const e=m[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&o===t.length-1||"right"===v&&0===o}if(n){y=!0;const t=s.filter(t=>!t.pinned);C=ut(t,e),C.forEach(t=>{R.set(t.accessor,dt(t))})}}}const S=(n,o=!1)=>{const r="right"===v?u-n:n-u;if(t){const t=s.filter(t=>t.pinned===v);if(mn({childrenToResize:m,collapsedHeaders:e,containerWidth:f,delta:r,headers:s,initialWidthsMap:g,isParentResize:m.length>1,resizedHeader:m.length>0?m[m.length-1]:i,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:x,startWidth:h}),y&&C.length>0){const t=m.reduce((t,e)=>{const n=g.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,b-t),n=Array.from(R.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;C.forEach((n,i)=>{const s=R.get(n.accessor)||100;i===C.length-1?n.width=e-o:(n.width=Math.round(s*t),o+=n.width)})}}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const o=document.querySelector(".st-body-container");if(!o||0===o.clientWidth)return 1e3;const i=o.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!t.hide),r=e.some(t=>"right"===t.pinned&&!t.hide),l=i*L(i,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+it(e,n).reduce((t,e)=>t+dt(e),0),0),a=ht(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:i,headers:s,collapsedHeaders:e});m.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:i})=>{const s=e.reduce((t,e)=>Math.min(t,ht(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:m,minWidth:w,startWidth:h,maxWidth:t}):m[0].width=Math.max(Math.min(h+r,t),w),s.forEach(t=>{ct(t)})}if(o){const t=[...s];d(t);const n=new Map;m.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),y&&C.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),vn(s,e,n)}else vn(s,e)};let I=null,H=null,M=u;const k=t=>{M=t,H=t,null===I&&(I=requestAnimationFrame(()=>{null!==H&&(S(H,!1),H=null),I=null}))};if(p){const t=t=>{k(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{k(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},bn=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=o.closest(".simple-table-root"))&&void 0!==n?n:o:null},yn=(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=yn(o.children,e);if(t)return t}}},Rn=(t,e,n)=>{const{columnResizing:o}=e;if(!o||t.isSelectionColumn&&e.enableRowSelection||n)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 s=document.createElement("div");s.className="st-header-resize-handle",i.appendChild(s);const r=t=>({rows:e.rows,header:t,maxWidth:500,sampleSize:50,styleRoot:bn(e)}),l=()=>{var n;if(e.autoExpandColumns){const o=e.getHeaders();return((t,e)=>{const n=ut(t,e);for(const t of n){const e=document.getElementById(V({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(o,e.collapsedHeaders),{headers:o,header:null!==(n=yn(o,t.accessor))&&void 0!==n?n:t}}return{headers:e.headers,header:t}};let a=0;const d=()=>{const n=Date.now();120>n-a||(a=n,(()=>{const n=document.getElementById(V({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o}=l();(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:i,reverse:s,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=gn(o,i),c=fn(t,e);let h;if(t.children&&t.children.length>0){const e=it(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const v=e.filter(t=>t.pinned===c);if(ut(v,n).forEach(t=>{const e=dt(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:o,mainWidth:s}=pn({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?o:s;const r=Math.max(0,d-t-o),l=null!=(null==i?void 0:i.current)&&i.current.clientWidth>0?i.current.clientWidth:0;f=l>0?Math.min(r,l):r}let w=!1;const m=new Map;let g=[];if(c&&d>0){const o=ut(e.filter(t=>t.pinned===c),n);if(o.length>0){let i=!1;if(h.length>1){const t=o.findIndex(t=>t.accessor===h[0].accessor),e=o.findIndex(t=>t.accessor===h[h.length-1].accessor);i="left"===c&&e===o.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);i="left"===c&&n===o.length-1||"right"===c&&0===n}if(i){w=!0;const t=e.filter(t=>!t.pinned);g=ut(t,n),g.forEach(t=>{m.set(t.accessor,dt(t))})}}}const x=h.reduce((t,e)=>t+l(e),0),b=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+dt(e),0);if(mn({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:x-b,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:s,rootPinned:c,sectionHeaders:v,sectionWidth:p,startWidth:b}),w&&g.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;g.forEach((n,i)=>{const s=m.get(n.accessor)||100;i===g.length-1?n.width=e-o:(n.width=Math.round(s*t),o+=n.width)})}}const y=new Map;h.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),w&&g.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),vn(e,n,y)})({header:o,headers:t,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>pt(t.accessor,r(t))});const i=[...t];return e.setHeaders(i),void(e.onColumnWidthChange&&e.onColumnWidthChange(i))}const o=pt(t.accessor,r(t)),i=ln(e.headers,t.accessor);if(!i)return;const s=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(e.headers,i),a=i[i.length-1],d=s.map((t,e)=>e===a?Object.assign(Object.assign({},t),{width:o}):t),c=((t,e,n)=>{if(1===e.length)return n;let o=t;for(let t=0;e.length-2>t;t++)o=o[e[t]].children;return o[e[e.length-2]].children=n,t})(e.headers,i,d);c.forEach(t=>ct(t));const h=d[a],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),vn(c,e.collapsedHeaders,u),e.setHeaders(c),e.onColumnWidthChange&&e.onColumnWidthChange(c)})())};return b(i,"mousedown",n=>{var o;if(n.detail>=2)return n.preventDefault(),void d();const i=null===(o=document.getElementById(V({accessor:t.accessor,rowId:"header"})))||void 0===o?void 0:o.offsetWidth;x(()=>{const{headers:t,header:o}=l();xn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:o,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=i?i:P})},10)}),b(i,"touchstart",n=>{var o;const i=n,s=null===(o=document.getElementById(V({accessor:t.accessor,rowId:"header"})))||void 0===o?void 0:o.offsetWidth;x(()=>{const{headers:t,header:n}=l();xn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:i,forceUpdate:e.forceUpdate,header:n,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=s?s:P})},10)}),b(i,"dblclick",d),i},Cn=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",b(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=Sn(t,e,i);s.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),b(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},Sn=(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){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return Le({checked:e,onChange:e=>{var n;null===(n=t.handleSelectAll)||void 0===n||n.call(t,e)},ariaLabel:"Select all rows"}).element})(e);s.appendChild(t)}else s.textContent=i;if(t.tooltip&&!o){let e=null,n=null;const o=()=>{var o;n&&(clearTimeout(n),n=null),e&&(null===(o=e.parentElement)||void 0===o||o.removeChild(e),e=null),n=setTimeout(()=>{if(!s.isConnected)return void(n=null);const o=s.getBoundingClientRect();if(o.width>0&&o.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,i=40;let r=o.left+o.width/2-n/2,l=o.bottom+8;8>r?r=8:r+n>window.innerWidth-8&&(r=window.innerWidth-n-8),l+i>window.innerHeight-8&&(l=o.top-i-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}n=null},500)},i=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};b(s,"mouseenter",o),b(s,"mouseleave",i)}return s},In=(t,e,n,o)=>{const{columnReordering:i,draggedHeaderRef:s,hoveredHeaderRef:r}=o;!i||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),b(t,"dragstart",t=>{s.current=n,f(Date.now()),e.classList.add("st-dragging")}),b(t,"dragend",t=>{t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(ee(o.getHeaders()))},10)}),b(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&x(()=>{const t=o.getHeaders();if(!t)return;const{screenX:i,screenY:l}=e,a=Math.sqrt(Math.pow(i-u.screenX,2)+Math.pow(l-u.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,v=!1;if(dn(d,t)!==dn(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=ee(t);let i=!1;try{const t=dn(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:d,hoveredHeader:n});c=e.newHeaders,v=e.emergencyBreak}else{const e=ln(t,d.accessor),o=ln(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((w=e).length!==(m=r).length||1!==w.length&&!w.slice(0,-1).every((t,e)=>t===m[e]))return;const l=cn(t,e,r);c=l.newHeaders,v=l.emergencyBreak}var w,m;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||v)return;const g=o.essentialAccessors;if(g&&g.size>0&&!ve(c,g))return;const x=Date.now();JSON.stringify(c)===JSON.stringify(p)&&(150>x-h||40>a)||(f(x),u={screenX:i,screenY:l},p=t,o.onTableHeaderDragEnd(c))},50)}),b(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Hn=(t,e,n)=>{var o,i;const{header:s,colIndex:r,parentHeader:l}=t,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:p,draggedHeaderRef:f,hoveredHeaderRef:v}=e,w=s.isSelectionColumn&&e.enableRowSelection,m=!!(null==s?void 0:s.isSortable),g=a.has(s.accessor),x=!(!s.children||0===s.children.length)&&(!g||s.children.some(t=>{const e=t.showWhen||D;return"parentCollapsed"===e||"always"===e})),b=null==l?void 0:l.singleRowChildren,y=x&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?B(s,r).includes(e.lastHeaderIndex):r===e.lastHeaderIndex),C=!(!e.selectableColumns||w)&&B(s,r).some(t=>u.has(t)),S=!w&&B(s,r).some(t=>p.has(t));return["st-header-cell",s.accessor===(null===(o=v.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(i=f.current)||void 0===i?void 0:i.accessor)===s.accessor?"st-dragging":"",m?"clickable":"",c&&!m?"columnReordering":"",y?"parent":"",b?"st-sub-header":"",R?"st-last-column":"",h&&!w?"st-header-editable":"",C?"st-header-selected":"",S&&!C?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},Mn=(t,e,n,o,i)=>{const s=Sn(e,o),r=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:s}});t.innerHTML="",r instanceof HTMLElement?t.appendChild(r):t.appendChild(s)},kn=(t,e,i,s=0)=>{var r,l;const a=i.pinned?i.containerWidth:null!==(r=i.mainSectionContainerWidth)&&void 0!==r?r:i.containerWidth||(null===(l=t.parentElement)||void 0===l?void 0:l.clientWidth)||t.clientWidth||0,d=i.pinned?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,s,a),c=(t=>0===t.length?-1:Math.max(...t.map(t=>t.colIndex)))(e),h=w(t),u=new Set(d.map(t=>V({accessor:t.header.accessor,rowId:"header"}))),p=new Map;Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e).forEach((t,e)=>p.set(t,e));const f=t=>"header-band-"+Math.round(t.top),v=t=>{var e;return(null!==(e=p.get(Math.round(t.top)))&&void 0!==e?e:0)+1},m=g(t),x=i.animationCoordinator&&i.accordionAxis?i.accordionAxis:null,R="horizontal"===x?(t=>{const e=new Set,n=t=>{var o;for(const i of t)i.hide||i.excludeFromRender||(e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children))};return n(t),e})(i.headers):null;let C=!1;h.forEach((e,n)=>{var o,s;if(!u.has(n)){m.delete(n);const r=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",l=null!==(s=null==R?void 0:R.has(r))&&void 0!==s&&s;"horizontal"===x&&i.animationCoordinator&&!l&&i.animationCoordinator.shouldRetain(n)?i.animationCoordinator.shrinkOutCell({cellId:n,element:e,container:t,axis:x}):e.remove(),h.delete(n),C=!0}}),C&&y(t);const S=[];d.forEach(e=>{const o=V({accessor:e.header.accessor,rowId:"header"}),s=!(!i.autoExpandColumns||i.pinned||e.colIndex!==c);if(h.has(o)){const r=h.get(o);n(t,f(e),v(e)),r.setAttribute("aria-colindex",e.colIndex+1+"");const l=m.get(o);if(!l||l.left!==e.left||l.top!==e.top||l.width!==e.width||l.height!==e.height){r.style.left=e.left+"px",r.style.top=e.top+"px";const t=r.dataset.stAccordionGrow;"horizontal"!==t&&(r.style.width=e.width+"px"),"vertical"!==t&&(r.style.height=e.height+"px"),m.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&i.enableRowSelection&&"function"==typeof i.areAllRowsSelected&&((t,e)=>{Fe(t,e)})(r,i.areAllRowsSelected());const a=Hn(e,i,s);r.className!==a&&(r.className=a),q(e.header)&&((t,e,n)=>{sn(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(r,i.collapsedHeaders.has(e.header.accessor),e.header.label);const d=`${i.sort&&i.sort.key.accessor===e.header.accessor?i.sort.direction:"none"}|${i.filters&&i.filters[e.header.accessor]?"1":"0"}`;r.dataset.stIconState!==d&&(((t,e,n,o)=>{const i=Ce(e,n),s=Be(e,n),r=rn(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&Mn(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))}})(r,e.header,i,e.colIndex),r.dataset.stIconState=d)}else S.push({cell:e,cellId:o,isLastMainAutoExpandColumn:s})});const I=i.animationCoordinator&&i.accordionAxis?i.accordionAxis:null,H=[];S.forEach(({cell:e,cellId:o,isLastMainAutoExpandColumn:s})=>{const r=((t,e,n)=>{var o;const{header:i,colIndex:s}=t,{reverse:r}=e,l=i.isSelectionColumn&&e.enableRowSelection,a=Hn(t,e,n),d=document.createElement("div");d.className=a,d.id=V({accessor:i.accessor,rowId:"header"}),d.setAttribute("data-accessor",i.accessor+""),d.setAttribute("role","columnheader"),d.setAttribute("aria-colindex",s+1+""),i.isSortable&&((null===(o=e.sort)||void 0===o?void 0:o.key.accessor)===i.accessor?d.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):d.setAttribute("aria-sort","none"));const c=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(i,!!i.filterable);if(c){const t="header-desc-"+i.accessor;d.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=c,d.appendChild(e)}d.style.position="absolute",d.style.left=t.left+"px",d.style.top=t.top+"px",d.style.width=t.width+"px",d.style.height=t.height+"px";const h=Ce(i,e),u=Be(i,e),p=rn(i,e),f=r!==("right"===e.pinned);if(f){const t=Rn(i,e,n);t&&d.appendChild(t)}i.headerRenderer||"right"!==i.align||(p&&d.appendChild(p),u&&d.appendChild(u),h&&d.appendChild(h));const v=document.createElement("div");if(v.className="st-header-label",i.headerRenderer)Mn(v,i,s,e,{sortIcon:h,filterIcon:u,collapseIcon:p});else{const t=Sn(i,e);v.appendChild(t)}if(b(v,"click",t=>{l||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const i=B(e,n),s=i.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(V({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=Cn(e,o,t);if(t.appendChild(n),o.headerRegistry&&!e.isSelectionColumn){const t=o.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&o.selectColumns?o.setSelectedColumns(t=>{if(0===t.size)return new Set(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.isSortable&&o.onSort(e.accessor)}})(t,i,s,e)}),b(v,"dblclick",t=>{l||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,i,e)}),In(v,d,i,e),d.appendChild(v),i.headerRenderer||"right"===i.align||(p&&d.appendChild(p),u&&d.appendChild(u),h&&d.appendChild(h)),!f){const t=Rn(i,e,n);t&&d.appendChild(t)}return e.headerRegistry&&!i.isSelectionColumn&&e.headerRegistry.set(i.accessor+"",{setEditing:t=>{if(t){const t=v.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Cn(i,e,t);t.appendChild(n)}}}}),d})(e,i,s);r.dataset.stIconState=`${i.sort&&i.sort.key.accessor===e.header.accessor?i.sort.direction:"none"}|${i.filters&&i.filters[e.header.accessor]?"1":"0"}`,I&&i.animationCoordinator&&!i.animationCoordinator.hasSnapshotEntry(o)&&("vertical"===I?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=I,H.push({element:r,cell:e})),n(t,f(e),v(e)).appendChild(r),h.set(o,r),m.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}),I&&H.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of H)t.isConnected&&("vertical"===I?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),i.pinned||(t.dataset.lastScrollLeft=s+""),o(t)},En=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Tn=e=>{const{position:n,rowHeight:o,displayStrongBorder:i,heightOffsets:s,customTheme:r=t,isSticky:l=!1,sectionWidthPx:a}=e,d=document.createElement("div");d.className="st-row-separator "+(i?"st-last-group-row":"");const c=l?n:Pt({position:n,rowHeight:o,heightOffsets:s,customTheme:r});En(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 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)}}),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},On=new WeakMap,An=new WeakMap,Wn=t=>(An.has(t)||An.set(t,new Map),An.get(t)),Pn=(e,i,s,r=0,l,d,c,h)=>{var u,p,f,v,w,m,g;const x=s.pinned?null!==(p=null!==(u=s.containerWidth)&&void 0!==u?u:e.clientWidth)&&void 0!==p?p:0:null!==(w=null!==(v=null!==(f=s.mainSectionContainerWidth)&&void 0!==f?f:s.containerWidth)&&void 0!==v?v:e.clientWidth)&&void 0!==w?w:0,b=s.pinned?i:((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)})(i,r,x),y=a(e),R=(t=>(On.has(t)||On.set(t,new Map),On.get(t)))(e),C=new Set(b.map(t=>{var e;return V({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let S=null;if(c)if(h)S=h;else{S=new Map;for(const t of i){const e=V({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});S.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const I=c&&s.accordionAxis?s.accordionAxis:null,H="horizontal"===I?(t=>{const e=new Set,n=t=>{var o;for(const i of t)i.hide||i.excludeFromRender||(e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children))};return n(t),e})(s.headers):null,M=(null==l?void 0:l.length)?new Set(l.map(t=>t.position)):new Set(b.map(t=>t.rowIndex));y.forEach((t,n)=>{var o,i;if(!C.has(n)){const s=t.getAttribute("data-row-id");s&&Qe(s,t);const r=null==S?void 0:S.get(n);if(c&&c.shouldRetain(n)&&r)return c.retainCell({cellId:n,element:t,container:e,newPosition:r}),void y.delete(n);if(c&&"horizontal"===I&&c.shouldRetain(n)){const s=null!==(o=t.getAttribute("data-accessor"))&&void 0!==o?o:"";if(null===(i=null==H?void 0:H.has(s))||void 0===i||!i)return c.shrinkOutCell({cellId:n,element:t,container:e,axis:I}),void y.delete(n)}t.remove(),y.delete(n)}});const k=Wn(e);R.forEach((t,e)=>{M.has(e)||(t.remove(),R.delete(e),k.delete(e))});const E=null!==(g=s.maxHeaderDepth)&&void 0!==g?g:1,T=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId)+""},O=t=>t.tableRow.position+E+1,A=[];b.forEach(t=>{var o,i,r,l,a;const c=V({accessor:t.header.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId});if(y.has(c)){const o=y.get(c);if(n(e,T(t),O(t)),d)((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")})(o,t);else{if(nn(o,t,s),t.header.isSelectionColumn&&s.enableRowSelection&&s.isRowSelected){const e=s.isRowSelected(t.rowId);Fe(o,e)}if(t.header.expandable){const e=new Set(s.expandedDepths),n=null!==(r=null===(i=s.getExpandedRows)||void 0===i?void 0:i.call(s))&&void 0!==r?r:s.expandedRows,d=null!==(a=null===(l=s.getCollapsedRows)||void 0===l?void 0:l.call(s))&&void 0!==a?a:s.collapsedRows,c=ot(et(t.tableRow),t.depth,e,n,d);sn(o,c)}}}else A.push({cell:t,cellId:c})});const W=[];A.forEach(({cell:t,cellId:o})=>{const i=null==c?void 0:c.claimRetainedForReuse(o,e);if(i){nn(i,t,s);const r=n(e,T(t),O(t));return i.parentElement!==r&&r.appendChild(i),void y.set(o,i)}const r=en(t,s);I&&c&&!c.hasSnapshotEntry(o)&&("vertical"===I?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=I,W.push({element:r,cell:t})),n(e,T(t),O(t)).appendChild(r),y.set(o,r)}),I&&W.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of W)t.isConnected&&("vertical"===I?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((e,n,o,i,s)=>{const r=Wn(e),l=o.pinned&&n.length>0?n.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,a=(()=>{var t,n,i;if(o.pinned){const t=Math.max("number"==typeof o.pinnedSectionWidthPx&&o.pinnedSectionWidthPx>0?o.pinnedSectionWidthPx:e.clientWidth,l);return t>0?t:void 0}const s=null!==(i=null!==(n=null!==(t=o.mainSectionContainerWidth)&&void 0!==t?t:o.containerWidth)&&void 0!==n?n:e.clientWidth)&&void 0!==i?i: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,o=-1,i=null;n.forEach(n=>{n.rowIndex!==o&&(i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:e}),e=i||void 0,o=n.rowIndex,i=n)}),i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:e}),d=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!==d.length&&d.forEach(({rowIndex:n,position:s,displayStrongBorder:l})=>{var d;const c=r.get(n),h=Pt({position:s,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(d=o.customTheme)&&void 0!==d?d:t});if(i.has(n)){const t=i.get(n);(!c||c.topPx!==h||c.displayStrongBorder!==l||c.sectionWidthPx!==a)&&(En(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 t=Tn({position:s,rowHeight:o.rowHeight,displayStrongBorder:l,heightOffsets:o.heightOffsets,customTheme:o.customTheme,isSticky:!1,sectionWidthPx:a});e.appendChild(t),i.set(n,t),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a})}})})(e,b,s,R,l),o(e)};function $n(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function Fn(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?$t({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:X(r.rowId);for(const e of t.headerPositions){const n=V({accessor:e.accessor,rowId:l});o.set(n,{left:e.left,top:i,width:e.width,height:t.rowHeight})}}return o}class Ln{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: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 h=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===h.length)return c.style.display="none",c;c.style.display="",c.style.cssText=`\n position: relative;\n ${void 0!==l?`width: ${l}px;`:""}\n height: ${i*s}px;\n `;const u=this.getCachedHeaderCells(d,h,n,i,s,a),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,o,l),v=c.scrollLeft;return kn(c,u,f,v),o||v===c.scrollLeft||(c.scrollLeft=v),!o&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},f),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):f;kn(c,u,n,t)}),c}renderBodySection(e){var n,o,i,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:h,rowHeight:u,heightOffsets:p,totalRowCount:f,startColIndex:v=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:x,allFlattenedRows:b,pageStartIndex:y,animationCoordinator:R}=e,C=d||"main";let S=this.bodySections.get(C);S||(S=document.createElement("div"),S.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(C,S));const I=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===I.length)return S.style.display="none",S;S.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!==f?f:l.length,u,p,null!==(n=c.customTheme)&&void 0!==n?n:t);S.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${H}px;\n `;const M=this.getCachedBodyCells(C,I,l,a,u,p,null!==(o=c.customTheme)&&void 0!==o?o:t,v,m,g,x),k=null!==(i=null!=b?b:m)&&void 0!==i?i:l;this.captureSnapshotConfig(C,I,a,k,u,p,null!==(s=c.customTheme)&&void 0!==s?s:t,void 0!==b?null!=y?y:0:void 0);const E=R?this.getFullSectionLayout(C):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(C,M.length>0&&T>0?v+M.length/T:v);const O=this.getCachedContext("body-"+C,c,d,h);return Pn(S,M,O,S.scrollLeft,l,w,R,null!=E?E:void 0),this.renderNestedGridRows(S,C,l,d,O,R),d||this.renderStateRows(S,C,l,O,R),!d&&S&&(S.__renderBodyCells=t=>{S&&Pn(S,M,O,t,l,!0)}),S}renderNestedGridRows(t,e,n,o,i,s){var r,l;const a=null!==(r=null==s?void 0:s.isEnabled())&&void 0!==r&&r,d=a?`transform ${s.getDuration()}ms ${s.getEasing()}, height ${s.getDuration()}ms ${s.getEasing()}`:"",c=n.filter(t=>t.nestedTable),h=new Set(c.map(t=>et(t)));let u=this.nestedGridRowsMap.get(e);u||(u=new Map,this.nestedGridRowsMap.set(e,u)),u.forEach((t,e)=>{var n;h.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),u.delete(e))});const p={rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(l=i.customTheme)&&void 0!==l?l:{},theme:i.theme,rowGrouping:i.rowGrouping,depth:0,loadingStateRenderer:i.loadingStateRenderer,errorStateRenderer:i.errorStateRenderer,emptyStateRenderer:i.emptyStateRenderer,icons:i.icons};c.forEach(n=>{var s,r,l,c,h,f,v;const w=et(n),m=u.get(w);if(m){const t=$t({position:n.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(s=i.customTheme)&&void 0!==s?s:{}}),e=G({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(r=n.nestedTable.expandableHeader.nestedTable)||void 0===r?void 0:r.height,customTheme:null!==(l=i.customTheme)&&void 0!==l?l:{}}),o=m.lastTop!==t,a=m.lastWrapperHeight!==e;return(o||a)&&(m.element.style.transition=d,o&&(m.element.style.transform=`translate3d(0, ${t}px, 0)`),a&&(m.element.style.height=e+"px"),m.lastTop=t,m.lastWrapperHeight=e),m.element.dataset.index=n.position+"",void(m.lastPosition=n.position)}const g=this.stateRowsMap.get(e),x=g&&g.has(w)?i.rowHeight:0,b=G({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(c=n.nestedTable.expandableHeader.nestedTable)||void 0===c?void 0:c.height,customTheme:null!==(h=i.customTheme)&&void 0!==h?h:{}}),y=$t({position:n.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(f=i.customTheme)&&void 0!==f?f:{}});if(o){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=G({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),s=$t({position:t.position,rowHeight:e.rowHeight,heightOffsets:e.heightOffsets,customTheme:e.customTheme}),r=document.createElement("div");return r.className="st-row st-nested-grid-spacer",r.dataset.index=t.position+"",r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.transform=`translate3d(0, ${s}px, 0)`,r.style.height=i+"px",r.style.pointerEvents="none",r}(n,{rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(v=i.customTheme)&&void 0!==v?v:{}});a&&x!==b&&(e.style.height=x+"px"),t.appendChild(e),u.set(w,{element:e,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}else{p.depth=n.depth>0?n.depth-1:0;const{element:e,cleanup:o}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:o,heightOffsets:i,customTheme:s,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u}=e,{parentRow:p,expandableHeader:f,childAccessor:v,calculatedHeight:w}=n,m=f.nestedTable;if(!m)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const g=U(p,v),x=Array.isArray(g)?g:[],b=l&&l[a+1]?l.slice(a+1):void 0,y=m.customTheme?Object.assign(Object.assign({},s),m.customTheme):s,R=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:w,customHeight:m.height,customTheme:s}),C=G({calculatedHeight:w,customHeight:m.height,customTheme:s}),S=$t({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}),I=document.createElement("div");I.className="st-row st-nested-grid-row st-row-position-"+t.position,I.dataset.index=t.position+"",I.style.position="absolute",I.style.left="0",I.style.right="0",I.style.transform=`translate3d(0, ${S}px, 0)`,I.style.height=C+"px",I.style.paddingTop=s.nestedGridPaddingTop+"px",I.style.paddingBottom=s.nestedGridPaddingBottom+"px",I.style.paddingLeft=s.nestedGridPaddingLeft+"px",I.style.paddingRight=s.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");H.style.height="100%",H.style.width="100%",I.appendChild(H);const M=Object.assign(Object.assign({},m),{defaultHeaders:m.defaultHeaders,rows:x,theme:r,customTheme:y,height:R,rowGrouping:b,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u}),k=new oo(H,M);k.mount();const E=()=>{k.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,p);a&&x!==b&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),u.set(w,{element:e,cleanup:o,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}})}renderStateRows(t,e,n,o,i){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>et(t)));let d=this.stateRowsMap.get(e);d||(d=new Map,this.stateRowsMap.set(e,d));const c=null!==(s=null==i?void 0:i.isEnabled())&&void 0!==s&&s,h=c?`transform ${i.getDuration()}ms ${i.getEasing()}, height ${i.getDuration()}ms ${i.getEasing()}`:"";d.forEach((t,e)=>{a.has(e)||(t.element.remove(),d.delete(e))});const u={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(r=o.customTheme)&&void 0!==r?r:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};l.forEach((e,n)=>{var i;const s=et(e),r=$t({position:e.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}}),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: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.dataset.index=e.index+"",i.style.width="100%",i.style.transform=`translate3d(0, ${$t({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.style.width="100%",s.style.padding="0";let r=null;return o.state.loading&&e.loadingStateRenderer?r=$n(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=$n(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=$n(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({},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=o.rowHeight+"px"})})):t.appendChild(a),d.set(s,{element:a,lastTop:r,lastPosition:e.position})})}calculateAbsoluteHeaderCells(t,e,n,o,i=0){const s=[];let r=i,l=0;const a=(t,i,d)=>{if(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;s.push({header:t,left:l,top:i*o,width:c,height:(n-i)*o,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,i,t)}),c+h}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 h=l,u=r;let p=0;return e.forEach(e=>{p+=a(e,i+1,t)}),s.push({header:t,left:h,top:i*o,width:p,height:o,colIndex:u,parentHeader:d}),p}{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}calculateAbsoluteBodyCells(t,e,n,o,i,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?$t({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}):e*o,a=t.position%2==1;d.forEach((i,s)=>{var d,h;const u=c.get(i.accessor);l.push({header:i,row:t.row,rowIndex:e,colIndex:r+s,rowId:X(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:o})})}),l}getLeafHeaders(t,e){const n=[],o=t=>{if(t.hide||t.excludeFromRender)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}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");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){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(s),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t),v=f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===i&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&void 0!==f.deps.bandStart&&void 0!==f.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(f.deps.bandStart,f.deps.bandEnd):f.deps.rowsRef===n);if(v&&f){if(!p)return f.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of f.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}let w,m,g;if(p){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 x=this.calculateAbsoluteBodyCells(e,w,o,i,s,r,l);if(this.bodyCellsCache.set(t,{cells:x,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:o.size,rowHeight:i,heightOffsetsHash:u},p&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!p)return x;const b=new Map;n.forEach((t,e)=>{b.set(t.position,e)});const y=[];for(const t of x){const e=b.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,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=this.calculateAbsoluteHeaderCells(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)}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=>{(t=>{if(t){const e=a(t);e.forEach(t=>{t.remove()}),e.clear(),i(t)}})(t)}),this.headerSections.forEach(t=>{(t=>{if(c=0,t){const e=w(t);e.forEach(t=>{t.remove()}),e.clear(),g(t).clear(),y(t),i(t)}})(t)}))}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,Fn(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?Fn(e):null}captureSnapshotConfig(t,e,n,o,i,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:o,headerPositions:d,rowHeight:i,heightOffsets:s,customTheme:r,pageStartIndex:l})}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySectionSnapshots.clear(),this.nextColIndexMap.clear()}}const Dn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},Bn=(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(Bn([t],e,n),!1===t.hide){i=!0;break}(t||i)&&(o.hide=!1)}},jn=t=>t.every(t=>t.hide),zn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(zn(t.children),jn(t.children)&&(t.hide=!0))})},Nn=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Nn(t,e))},qn=(t,e,n)=>{if(!e.trim())return t;const o=n||Nn;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function Vn(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function Gn(t,e,n,o,i,s,r){const l=e({headers:n,searchSection:o,listSection:i,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 Kn=t=>{let e=t,{headers:n,open:o,searchEnabled:i,searchPlaceholder:s,searchFunction:r,columnEditorConfig:l,icons:a,essentialAccessors:d,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,resetColumns:p}=e,f="",v=null,w=null,m=!1;const g=new Set,x=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),x(t.children))})};x(n);let b=g;const y=document.createElement("div");y.className="st-column-editor-popout "+(o?"open":"");const R=document.createElement("div");R.className="st-column-editor-popout-content",R.addEventListener("click",t=>t.stopPropagation());let C=null,S=null;if(i){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const o=document.createElement("input");return o.type="text",o.value="",o.placeholder=t,o.className="st-filter-input",o.addEventListener("click",t=>t.stopPropagation()),o.addEventListener("input",t=>{f=t.target.value,P()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(s);S=t.wrapper,C=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let H=null;p&&(H=function(t){const e=document.createElement("div");e.className="st-column-editor-footer";const n=document.createElement("button");return n.type="button",n.className="st-column-editor-reset-btn",n.textContent="Reset columns",n.addEventListener("click",e=>{e.stopPropagation(),t()}),e.appendChild(n),e}(p));let M=l.customRenderer;M?Gn(R,M,n,S,I,H,p):Vn(R,S,I,H),y.appendChild(R);const k=t=>{v=t,null!==t?m=!0:(m=!1,P())},E=()=>{w=null},T=t=>{w=t,m?A():P()},O=t=>{const e=b;b=t,P(e)},A=()=>{I.querySelectorAll(".st-column-editor-drag-separator").forEach((t,e)=>{const n=t;n.style.opacity=0===e?-1===w?"1":"0":w===e-1?"1":"0"})},W=(t,e,o,s,p)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(i?qn(m,f,r):m).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,s.appendChild(t)}const g=document.createElement("div");g.className="st-column-editor-list st-column-editor-list-section",s.appendChild(g);const x=((t,e)=>{const n=i?qn(t,f,r):t,o=[],s=i&&f.trim().length>0,l=({headers:t,depth:n=0,parent:i=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];o.push({header:t,visualIndex:o.length,depth:n,parent:i,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=s||b.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),o})(t,e),y=(t=>t.some(t=>t.children&&t.children.length>0))(t);x.forEach(t=>{var o;const s=(t=>{var e,n;const{allHeaders:o,clearHoverSeparator:i,depth:s,doesAnyHeaderHaveChildren:r,draggingRow:l,getDraggingRow:a,getHoveredSeparatorIndex:d,expandedHeaders:c,flattenedHeaders:h,forceExpanded:u,header:p,hoveredSeparatorIndex:f,panelSection:v,rowIndex:w,setDraggingRow:m,setExpandedHeaders:g,setHoveredSeparatorIndex:x,headers:b,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:C,previousExpandedHeaders:S}=t,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,H=!1!==t.columnEditorConfig.allowColumnPinning,M=pe(p,I),k=!M,E=document.createDocumentFragment(),T=16*s+"px",O=p.children&&p.children.length>0,A=!(p.hide||O&&p.children&&jn(p.children)),W=c.has(p.accessor),P=u||W;let $;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=-1===f?"1":"0",E.appendChild(t)}const F=document.createElement("div");F.className="st-header-checkbox-item",F.style.paddingLeft=T,F.draggable=!0;const L=t=>!(I.size>0&&!ve(t,I)||(null==C||C(t),y(t),0)),D=t=>{if(t.stopPropagation(),u)return;const e=new Set(c);W?e.delete(p.accessor):e.add(p.accessor),g(e)};let B;if(F.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==i||i(),m(h[w])}),F.addEventListener("dragenter",t=>{t.preventDefault()}),F.addEventListener("dragover",t=>{t.preventDefault();const e=a?a():l;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 h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=o),h?s-1:a}return null})({flattenedHeaders:h,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});x(o)}}),F.addEventListener("dragend",()=>{const t=a?a():l,e=d?d():f,n=()=>{m(null),x(null)};if(!t||null===e||t.panelSection!==v)return void n();let o,i=h[e>t.visualIndex?e:e+1];if(i){if(i.depth>t.depth&&i.parent){const t=h.findIndex(t=>t.header.accessor===i.parent.accessor);-1!==t&&(i=h[t])}if(t.header.accessor!==i.header.accessor)if(t.indexPath.length!==i.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===i.indexPath[e]))n();else{if(1===t.indexPath.length){const{newHeaders:e,emergencyBreak:s}=cn(b,t.indexPath,i.indexPath);if(s)return void n();o=e}else{const{newHeaders:e,emergencyBreak:s}=cn(b,t.indexPath,i.indexPath);if(s)return void n();o=e}L(o),n()}else n()}else n()}),r){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==S?u||S.has(p.accessor):P,n=!u&&void 0!==S&&t!==P,o=n?t:P,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 ${p.label} column`:`Expand ${p.label} column`),i.appendChild(le("st-expand-icon")),i.addEventListener("click",D),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),D(t))}),e.appendChild(i),B=i,n&&($=()=>{sn(F,P,{ariaLabelWhenExpanded:`Collapse ${p.label} column`,ariaLabelWhenCollapsed:`Expand ${p.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||F.appendChild(e)}const j=Le({checked:A,onChange:t=>{if(!k)return;p.hide=!t,t?(Bn(o,p.accessor),O&&p.children&&p.children.length>0&&p.children.every(t=>!0===t.hide)&&p.children[0]&&(p.children[0].hide=!1,Bn(o,p.children[0].accessor))):zn(o);const e=[...b];if(y(ee(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)}}});k||(j.element.classList.add("st-checkbox-disabled"),j.element.style.pointerEvents="none");const z=document.createElement("div");z.className="st-drag-icon-container";const N=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof N?z.innerHTML=N:N instanceof HTMLElement||N instanceof SVGSVGElement?z.appendChild(N.cloneNode(!0)):z.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const q=document.createElement("div");q.className="st-column-label-container",q.textContent=p.label;const V="left"===p.pinned||"right"===p.pinned?p.pinned:null,G=!!V&&!M,K=!V&&"main"===v,U=!V&&"main"===v,J=()=>{const t=be(b,p.accessor,"left",I);t&&L(t)},_=()=>{const t=be(b,p.accessor,"right",I);t&&L(t)},Y=()=>{const t=be(b,p.accessor,"main",I);t&&L(t)},{rowRenderer:X}=t.columnEditorConfig;if(X){const t=X({accessor:p.accessor,header:p,components:{expandIcon:B,checkbox:j.element,dragIcon:z,labelContent:q},panelSection:v,isEssential:M,canToggleVisibility:k,allowColumnPinning:H,pinControl:H&&0===s?{pinnedSide:V,canPinLeft:K,canPinRight:U,canUnpin:G,pinLeft:J,pinRight:_,unpin:Y}:void 0});t instanceof HTMLElement?F.appendChild(t):"string"==typeof t&&(F.innerHTML=t)}else if(F.appendChild(j.element),F.appendChild(z),F.appendChild(q),H&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),V){const e=document.createElement("div"),n=M;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===V?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",G&&e.addEventListener("click",t=>{t.stopPropagation(),Y()}),t.appendChild(e)}else{if(K){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(),J()}),t.appendChild(e)}if(U){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(),_()}),t.appendChild(e)}}F.appendChild(t)}E.appendChild(F);const Q=document.createElement("div");return Q.className="st-column-editor-drag-separator",Q.style.opacity=f===w?"1":"0",E.appendChild(Q),{fragment:E,scheduleExpandIconAnimation:$}})({allHeaders:n,clearHoverSeparator:E,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:v,getDraggingRow:()=>v,getHoveredSeparatorIndex:()=>w,expandedHeaders:b,flattenedHeaders:x,forceExpanded:i&&f.trim().length>0,header:t.header,hoveredSeparatorIndex:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:O,setHoveredSeparatorIndex:T,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:p});g.appendChild(s.fragment),null===(o=s.scheduleExpandIconAnimation)||void 0===o||o.call(s)})},P=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:o,unpinned:i,pinnedRight:s}=ue(n);if(e)W(o,"left","Pinned Left",I,t),W(i,"main","Main",I,t),W(s,"right","Pinned Right",I,t);else{const e=[...o,...i,...s];W(e,"main",null,I,t)}};return P(),{element:y,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(i=t.searchEnabled),void 0!==t.searchPlaceholder&&(s=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),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&&(p=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==M&&(M=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?y.classList.add("open"):y.classList.remove("open")),C&&void 0!==t.searchPlaceholder&&(C.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",M?Gn(R,M,n,S,I,H,p):Vn(R,S,I,H)),P()},destroy:()=>{C&&(C.removeEventListener("input",()=>{}),C.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},Un=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:i,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:p,sectionScrollController:f,startColIndex:v,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=o+"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=[],o=t=>{if(t.hide||t.excludeFromRender)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),x=new Map;let b=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;x.set(t.accessor,{left:b,width:e}),b+=e});const y=h&&"number"==typeof u?u:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const o=-1!==i&&e>=i,c=o?s:0,h=e*(r+1)+c,u=o?e:n.length-e,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var o,i;const s=x.get(e.accessor),l=v+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:X(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=en(a,d);p.appendChild(c)}),m.appendChild(p);const f=Tn({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",m,"sticky"),m},Jn=(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 _n{constructor(){this.footerInstance=null,this.columnEditorInstance=null,this.horizontalScrollbarRef={current:null},this.scrollbarTimeoutId=null,this.stickyParentsContainer=null,this.sectionScrollController=null,this.renderScheduled=!1,this.pendingRenderCallback=null,this.sectionRenderer=new Ln}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,o){var i,s,r,l,a,d,c,h,u,p,f,v;if(!t||o.config.hideHeader)return;t.style.height=e+"px";const w=ne(o.effectiveHeaders,"left")||ne(o.effectiveHeaders,void 0)||ne(o.effectiveHeaders,"right");t.style.minHeight=w?"":e+"px";const m=t.parentElement;m&&(m.setAttribute("aria-rowcount",1+o.localRows.length+""),m.setAttribute("aria-colcount",o.effectiveHeaders.length+""));const g=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:x,leftWidth:b,rightWidth:y}=pn({headers:o.effectiveHeaders,containerWidth:g.containerWidth,collapsedHeaders:o.collapsedHeaders}),R=null===(r=o.sortManager)||void 0===r?void 0:r.getState(),C=null===(l=o.filterManager)||void 0===l?void 0:l.getState(),S=null!==(d=null===(a=o.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,I={reverse:!1,collapsedHeaders:o.collapsedHeaders,getCollapsedHeaders:o.getCollapsedHeaders,columnBorders:null!==(c=o.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=o.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=o.config.columnResizing)&&void 0!==u&&u,containerWidth:g.containerWidth,mainSectionContainerWidth:x,enableHeaderEditing:o.config.enableHeaderEditing,enableRowSelection:o.config.enableRowSelection,selectedRowCount:S,filters:null!==(p=null==C?void 0:C.filters)&&void 0!==p?p:{},icons:o.resolvedIcons,selectedColumns:o.config.selectableColumns&&o.selectionManager?o.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:o.selectionManager&&(o.config.selectableCells||o.config.selectableColumns)?o.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(f=null==R?void 0:R.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(v=o.config.autoExpandColumns)&&void 0!==v&&v,essentialAccessors:o.essentialAccessors,selectableColumns:o.config.selectableColumns,headers:o.effectiveHeaders,rows:o.localRows,headerHeight:o.customTheme.headerHeight,lastHeaderIndex:o.effectiveHeaders.length-1,onSort:t=>{o.sortManager&&o.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{o.filterManager&&o.filterManager.updateFilter(t)},handleClearFilter:t=>{o.filterManager&&o.filterManager.clearFilter(t)},getHeaders:()=>o.getHeaders(),handleSelectAll:t=>{var e;null===(e=o.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{o.setCollapsedHeaders("function"==typeof t?t(o.collapsedHeaders):t),o.onRender()},setHeaders:t=>{o.setHeaders("function"==typeof t?t(o.getHeaders()):t),o.onRender()},setIsResizing:t=>{o.setIsResizing("function"==typeof t?t(o.isResizing):t)},onColumnWidthChange:o.config.onColumnWidthChange,onColumnOrderChange:o.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{o.setHeaders(t),o.onRender()},onHeaderEdit:o.config.onHeaderEdit,onColumnSelect:o.config.onColumnSelect,selectColumns:o.selectionManager&&o.config.selectableColumns?(t,e)=>{o.selectionManager.selectColumns(t,e),o.onRender()}:t=>{},setSelectedColumns:o.selectionManager&&o.config.selectableColumns?t=>{const e=o.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;o.selectionManager.setSelectedColumns(n),o.onRender()}:t=>{},setSelectedCells:o.selectionManager?t=>{var e;const n=o.selectionManager.getSelectedCells(),i="function"==typeof t?t(n):t;o.selectionManager.setSelectedCells(i instanceof Set?i:new Set),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},setInitialFocusedCell:o.selectionManager?t=>{var e;o.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=o.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:o.draggedHeaderRef,hoveredHeaderRef:o.hoveredHeaderRef,headerRegistry:o.headerRegistry,forceUpdate:()=>o.onRender(),mainBodyRef:o.mainBodyRef,pinnedLeftRef:o.pinnedLeftRef,pinnedRightRef:o.pinnedRightRef,accordionAxis:o.accordionAxis,animationCoordinator:o.animationCoordinator},H=o.effectiveHeaders.filter(t=>"left"===t.pinned),M=o.effectiveHeaders.filter(t=>!t.pinned),k=o.effectiveHeaders.filter(t=>"right"===t.pinned);let E=0;const T=[];if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:I,sectionWidth:b,startColIndex:E});o.pinnedLeftHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("left")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:I,sectionWidth:x,startColIndex:E});o.mainHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("main")}if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:I,sectionWidth:y,startColIndex:E});o.pinnedRightHeaderRef.current=e,T.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{T.includes(t)||t.remove()})}renderBody(t,e,n){var o,i,s,r,l,a,d,c,h,u,p,f,v,w,m,g,x,b,y,R,C,S;if(!t)return;if(ne(n.effectiveHeaders,"left")||ne(n.effectiveHeaders,void 0)||ne(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(i=null===(o=null==e?void 0:e.heightMap)||void 0===o?void 0:o.totalHeight)&&void 0!==i?i:0;t.style.minHeight=n+"px"}const I=e.rowsToRender||e.currentTableRows,H=!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}),H){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const M=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:k,leftWidth:E,rightWidth:T}=pn({headers:n.effectiveHeaders,containerWidth:M.containerWidth,collapsedHeaders:n.collapsedHeaders}),O=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,A=null!==(c=M.maxHeaderDepth)&&void 0!==c?c:1,W={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(u=null===(h=n.selectionManager)||void 0===h?void 0:h.getSelectedColumns())&&void 0!==u?u:new Set,rowsWithSelectedCells:null!==(f=null===(p=n.selectionManager)||void 0===p?void 0:p.getRowsWithSelectedCells())&&void 0!==f?f:new Set,columnBorders:null!==(v=n.config.columnBorders)&&void 0!==v&&v,enableRowSelection:n.config.enableRowSelection,selectedRowCount:O,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:null===(w=n.config.useHoverRowBackground)||void 0===w||w,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:A,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:M.containerWidth,mainSectionContainerWidth:k,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var o;null===(o=n.rowSelectionManager)||void 0===o||o.handleRowSelect(t,e)},cellRegistry:n.cellRegistry,getCollapsedRows:()=>n.getCollapsedRows(),getExpandedRows:()=>n.getExpandedRows(),setCollapsedRows:t=>{n.setCollapsedRows("function"==typeof t?t(n.getCollapsedRows()):t),this.scheduleRender(n.onRender)},setExpandedRows:t=>{n.setExpandedRows("function"==typeof t?t(n.getExpandedRows()):t),this.scheduleRender(n.onRender)},setRowStateMap:t=>{n.setRowStateMap("function"==typeof t?t(n.getRowStateMap()):t),this.scheduleRender(n.onRender)},icons:n.resolvedIcons,theme:null!==(m=n.config.theme)&&void 0!==m?m:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,getBorderClass:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.getBorderClass(t))||""},isSelected:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isSelected(t))||!1},isInitialFocusedCell:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isInitialFocusedCell(t))||!1},isCopyFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isCopyFlashing(t))||!1},isWarningFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isWarningFlashing(t))||!1},handleMouseDown:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseDown(t)},handleMouseOver:(t,e,o)=>{var i;return null===(i=n.selectionManager)||void 0===i?void 0:i.handleMouseOver(t,e,o)},isRowSelected:t=>{var e,o;return null!==(o=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==o&&o},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading,accordionAxis:n.accordionAxis},P=n.effectiveHeaders.filter(t=>"left"===t.pinned),$=n.effectiveHeaders.filter(t=>!t.pinned),F=n.effectiveHeaders.filter(t=>"right"===t.pinned);let L=0;const D=[],B=n.positionOnlyBody?void 0:n.animationCoordinator;if(P.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:I,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:W,sectionWidth:E,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:L,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:B});n.pinnedLeftRef.current=o,D.push(o),o.parentElement!==t&&t.insertBefore(o,t.firstChild),L=this.sectionRenderer.getNextColIndex("left")}if($.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:I,collapsedHeaders:n.collapsedHeaders,context:W,sectionWidth:k,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:L,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:B});if(n.mainBodyRef.current=o,D.push(o),o.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(o,e):t.appendChild(o)}L=this.sectionRenderer.getNextColIndex("main")}if(F.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:I,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:W,sectionWidth:T,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:L,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:B});n.pinnedRightRef.current=o,D.push(o),o.parentElement!==t&&t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(Jn(this.stickyParentsContainer,null!==(g=n.sectionScrollController)&&void 0!==g?g:null),this.stickyParentsContainer=null);const o=n.externalScrollActive?null!==(x=n.stickyParentsScrollTop)&&void 0!==x?x:0:null!==(y=null===(b=n.mainBodyRef.current)||void 0===b?void 0:b.scrollTop)&&void 0!==y?y:0,i=t.offsetWidth-t.clientWidth,s={left:0,main:P.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:$.length>0?this.sectionRenderer.getNextColIndex("main"):P.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=I.filter(t=>!t.nestedTable&&!t.stateIndicator),l=new Map;if(r.forEach((t,e)=>{var n;const o=null!==(n=t.stableRowKey)&&void 0!==n?n:X(t.rowId);l.set(o,e)}),this.stickyParentsContainer=((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:X(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 h=-1;for(let e=0;t.length>e;e++){const n=t[e],o=t[e+1];if(!o)break;if(o.depth===n.depth){h=e;break}if(n.depth>o.depth){h=t.findIndex(t=>t.depth===n.depth);break}}if(-1===h)return{treeTransitionOffset:0,offsetStartIndex:c};const u=null===(r=t[h])||void 0===r?void 0:r.position;if(void 0===u)return{treeTransitionOffset:0,offsetStartIndex:c};let p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let v;return v=n?n.rowTopPositions[f.position]:f.position*(o+i.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*o+Math.max(0,s-v)),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.editColumns?"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 i=Un({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:o.left,resolveBodyRowIndex:s});c.appendChild(i)}const p=Un({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:o.main,resolveBodyRowIndex:s});if(c.appendChild(p),t.pinnedRightColumns.length>0){const i=Un({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:o.right,resolveBodyRowIndex:s});c.appendChild(i)}return c})({calculatedHeaderHeight:M.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:P,pinnedLeftWidth:E,pinnedRightColumns:F,pinnedRightWidth:T,scrollTop:o,scrollbarWidth:i,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(R=n.config.editColumns)&&void 0!==R&&R,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:W,sectionScrollController:null!==(C=n.sectionScrollController)&&void 0!==C?C: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&&(Jn(this.stickyParentsContainer,null!==(S=n.sectionScrollController)&&void 0!==S?S:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{D.includes(t)||t.remove()})}renderFooter(t,e,n,o,i){var s,r,l,a,d,c,h,u,p,f,v;if(!t)return;const w=!!i.config.footerRenderer;if(!w&&(!i.config.shouldPaginate||i.config.hideFooter))return void(t.innerHTML="");const m=null!==(s=i.config.rowsPerPage)&&void 0!==s?s:10,g=Math.ceil(e/m);if(w){const s=(n-1)*m+1,a=i.config.footerRenderer({currentPage:n,endRow:Math.min(n*m,e),hasNextPage:g>n,hasPrevPage:n>1,nextIcon:null===(r=i.resolvedIcons)||void 0===r?void 0:r.next,onNextPage:async()=>{g>n&&(o(n+1),i.config.onNextPage&&await i.config.onNextPage(n+1))},onPageChange:o,onPrevPage:()=>{n>1&&o(n-1)},prevIcon:null===(l=i.resolvedIcons)||void 0===l?void 0:l.prev,rowsPerPage:m,startRow:s,totalPages:g,totalRows:e});return t.innerHTML="",a instanceof HTMLElement?t.appendChild(a):"string"==typeof a&&(t.innerHTML=a),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(a=i.config.hideFooter)&&void 0!==a&&a,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(d=i.config.shouldPaginate)&&void 0!==d&&d,totalPages:g,totalRows:e,prevIcon:null===(c=i.resolvedIcons)||void 0===c?void 0:c.prev,nextIcon:null===(h=i.resolvedIcons)||void 0===h?void 0:h.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:i,onUserPageChange:s,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,v=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!i||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${v} to ${w} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let o,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),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const 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),C.push({button:i,page:t,afterEllipsis:r})}}),C.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 S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Dn(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),s&&await s(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Dn(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(i&&e===a&&!await i(e))return u=!1,void f();t>a&&!i||(o(t),s&&await s(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(o=t.onPageChange),void 0!==t.onNextPage&&(i=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(u=i.config.hideFooter)&&void 0!==u&&u,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(p=i.config.shouldPaginate)&&void 0!==p&&p,totalPages:g,totalRows:e,prevIcon:null===(f=i.resolvedIcons)||void 0===f?void 0:f.prev,nextIcon:null===(v=i.resolvedIcons)||void 0===v?void 0:v.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,o,i){if(!t)return;if(!i.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=i.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));i.setHeaders(e),i.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,editColumns:i.config.editColumns,headers:i.headers,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:s,setOpen:n});else{const r=(t=>{let{columnEditorText:e,editColumns:n,headers:o,open:i,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f,setOpen:v}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(i?"open":""),w.style.width="29.5px";const m=t=>{v(!i)},g=document.createElement("div");g.className="st-column-editor-text",g.textContent=e,w.addEventListener("click",m),w.appendChild(g);const x=Kn({headers:o,open:i,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f});w.appendChild(x.element);const b={update:t=>{void 0!==t.open&&(i=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(v=t.setOpen),void 0!==t.columnEditorText&&(g.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.removeEventListener("click",m),x.destroy(),w.remove()}};return w.__columnEditor=b,Object.assign({element:w},b)})({columnEditorText:o.text,editColumns:i.config.editColumns,headers:i.headers,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:s,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,o,i,s,r,l){var a,d;if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?hn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return hn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(c=l.sectionScrollController)&&void 0!==c?c:null;const u=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?W:0,h=(a?i+1:i)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.className="st-horizontal-scrollbar-container",o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=o+"px";const e=document.createElement("div");e.style.width=s+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(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),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(h=l.config.editColumns)&&void 0!==h&&h,sectionScrollController:this.sectionScrollController});if(u){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(u,e.nextSibling):t.appendChild(u),this.horizontalScrollbarRef.current=u}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(un(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(un(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(Jn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function Yn(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:h=[],rowHeight:u=40,headerHeight:p=40,customTheme:f}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],i=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:Y({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0}),rowPath:n,rowIndexPath:i,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:tt({getRowId:o,row:t,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0,parentStableKey:null})}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const v=[],w=[],m=[],g=[];let x=0;const b=(t,e,y=[],R=[],C=[],S=null)=>{t.forEach((t,I)=>{var H,M;const k=n[e],E=v.length,T=[...y,I],O=[...R,I],A=Y({row:t,getRowId:o,depth:e,index:I,rowPath:T,rowIndexPath:O,groupingKey:k}),W=tt({getRowId:o,row:t,depth:e,index:I,rowPath:T,rowIndexPath:O,groupingKey:k,parentStableKey:S}),P=v.length,$={row:t,depth:e,displayPosition:x,groupingKey:k,position:E,isLastGroupRow:!1,rowId:A,rowPath:T,rowIndexPath:O,absoluteRowIndex:E,parentIndices:C.length>0?[...C]:void 0,stableRowKey:W};v.push($),w.push($),x++;const F=et({stableRowKey:W,rowId:A});if(ot(F,e,r,i,s)&&n.length>e){const n=null==l?void 0:l.get(F),o=((t,e)=>{const n=t[e];return _(n)?n:[]})(t,k),i=h.find(t=>t.expandable&&t.nestedTable);if((null==i?void 0:i.nestedTable)&&o.length>0){const n=v.length,s=(null===(H=i.nestedTable.customTheme)||void 0===H?void 0:H.rowHeight)||u,r=(null===(M=i.nestedTable.customTheme)||void 0===M?void 0:M.headerHeight)||p,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:f}),a=G({calculatedHeight:l,customHeight:i.nestedTable.height,customTheme:f});m.push([n,a-u]);const d=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:O,stableRowKey:nt(F,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=v.length,i=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:o,isLastGroupRow:!1,rowId:i,rowPath:i,rowIndexPath:O,stableRowKey:nt(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...C,P]})}else if(n.loading&&!a){const t=v.length,n=[...T,k,"loading-skeleton"];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:O,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...C,P]})}}else if(o.length>0){const t=[...T,k],n=[...O];b(o,e+1,t,n,[...C,P],W)}}0===e&&g.push(v.length)})};return b(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&v.length>n&&(v[n].isLastGroupRow=!0)}),{flattenedRows:v,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}const Xn=t=>{var e;const n=document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t};class Qn{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 _n}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()}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)}computeEffectiveHeaders(t,e,n,o){var i;let s=[...t];return e.enableRowSelection&&!(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...s]),null!=o&&o>0?at(s,{containerWidth:o}):at(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,h,u,p,f,v,w,m,g,x,b;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:C,maxHeaderDepth:S}=y,I=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let H;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===I?H=this.scrollRafHeadersMemo.effectiveHeaders:(H=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:I,effectiveHeaders:H}:null);const{leftWidth:M,rightWidth:k}=pn({headers:H,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(H=gt(H,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:M,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(o=t.isResizing)&&void 0!==o&&o}));let E=t.localRows;if(t.sortManager?E=t.sortManager.getSortedRows():t.filterManager&&(E=t.filterManager.getFilteredRows()),this.lastRowsRef!==E&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=E),t.internalIsLoading&&0===E.length){let n=t.config.shouldPaginate&&null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10;e.isMainSectionScrollable&&(n+=1),E=Array.from({length:n},()=>({}))}const T=null===(s=t.sortManager)||void 0===s?void 0:s.getState(),O=null===(r=t.filterManager)||void 0===r?void 0:r.getState(),W=(null==T?void 0:T.sort)?`${T.sort.key.accessor}-${T.sort.direction}`:"none",P=JSON.stringify((null==O?void 0:O.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(l=$.text)&&void 0!==l?l:""}|${null!==(a=$.mode)&&void 0!==a?a:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===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===W&&this.flattenedRowsCache.deps.filterKey===P;let D,B,j;L&&this.flattenedRowsCache?(D=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,j=this.flattenedRowsCache.flattenResult):(D=t.sortManager?E:It({rows:E,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=>!t.hide&&!t.excludeFromRender&&(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=U(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=U(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:D,headers:H,quickFilter:t.config.quickFilter}),j=Yn({rows:B,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:H,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:B,flattenResult:j,deps:{rowsRef:E,quickFilterKey:F,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:W,filterKey:P}});const z=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=Xn(e);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 l=Xn(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,shouldPaginate:null!==(d=t.config.shouldPaginate)&&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:j.paginatableRows.length,headerHeight:C,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),N=null!==(u=t.config.shouldPaginate)&&void 0!==u&&u,q=null!==(p=t.config.rowsPerPage)&&void 0!==p?p:10,V=null!==(f=t.config.serverSidePagination)&&void 0!==f&&f,G=null!==(v=t.config.totalRowCount)&&void 0!==v?v:j.paginatableRows.length,K=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",J=null!==(x=null===(g=j.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==x?x:0;let _=0;if(j.heightOffsets)for(const[,t]of j.heightOffsets)_+=t;const Y=null!==(b=t.config.enableStickyParents)&&void 0!==b&&b,X=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${N}|${V}|${t.customTheme.rowHeight}|${C}|${G}|${Y}|${K}|${j.flattenedRows.length}|${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:o,scrollDirection:i="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=A(o),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,p,f,v,w=0,m=d.length;if(void 0===n)u=d,p=[],f=u,v=[];else{const t=Wt({bufferRowCount:a,contentHeight:n,tableRows:d,rowHeight:o,scrollTop:s,scrollDirection:i,heightMap:h});if(u=t.rendered.rows,w=t.rendered.startIndex,m=t.rendered.endIndex,r)if(l){const e=Dt(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);p=e.stickyParents,f=e.regularRows,v=t.partiallyVisible.rows}else p=[],f=t.rendered.rows,v=[];else p=[],f=u,v=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:p,regularRows:f,partiallyVisibleRows:v,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:o,customTheme:i,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:a,rowHeight:d,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:p,shouldPaginate:f,rowGrouping:v}=t,w=A(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,f,p);let g=0;if(f&&!p){const t=(o-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const x=l&&0!==l.length&&f&&!p?(()=>{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,b=x&&x.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,x,i):void 0;let y,R,C,S,I=0,H=m.length;if(void 0===n)y=m,R=[],C=y,S=[];else{const t=Wt({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:b});if(y=t.rendered.rows,I=t.rendered.startIndex,H=t.rendered.endIndex,s)if(v){const e=Dt(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,v);R=e.stickyParents,C=e.regularRows,S=t.partiallyVisible.rows}else R=[],C=t.rendered.rows,S=[];else R=[],C=y,S=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:I,renderedEndIndex:H,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:x,heightMap:b,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:j.flattenedRows,paginatableRows:j.paginatableRows,parentEndPositions:j.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,shouldPaginate:N,serverSidePagination:V,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:j.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:H,calculatedHeaderHeight:C,maxHeaderDepth:S,flattenResult:j,processedResult:Q}}render(t,e,n,o,i){var s,r,l,a,d,c,h,u,p;const f=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,v=this.buildRowModelSnapshot(n,o);if(!v)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:x,maxHeaderDepth:b,flattenResult:y,processedResult:R}=v;this.lastProcessedResult=R;const C=!0===n.positionOnlyBody;if(C&&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:S,leftWidth:I,rightWidth:H,leftContentWidth:M,rightContentWidth:k}=pn({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),E=m-I-H;if(!C){const e=t=>"number"==typeof t?t+"px":t,i=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);i.maxHeight=t,i.height=void 0===w.contentHeight?"auto":t}else i.removeProperty("max-height"),n.config.height?i.height=e(n.config.height):i.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:s}=n;i.setProperty("--st-main-section-width",E+"px"),i.setProperty("--st-scrollbar-width",o.scrollbarWidth+"px"),i.setProperty("--st-editor-width",(n.config.editColumns?W:0)+"px"),i.setProperty("--st-border-width",s.borderWidth+"px"),i.setProperty("--st-footer-height",s.footerHeight+"px"),i.setProperty("--st-calculated-header-height",x+"px");const r=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(r?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%",this.renderHeader(t.headerContainer,x,b,g,n)}this.renderBody(t.bodyContainer,R,g,n,o),this.lastScrollRafPaintedRange=C?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const T=n.sectionScrollController;T&&(T.setSectionScrollLeft("main",f),null!=n.pinnedLeftRef.current&&T.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&T.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),T.restoreAll()),C||(this.renderFooter(t.footerContainer,null!==(p=n.config.totalRowCount)&&void 0!==p?p:y.paginatableRows.length,o.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,o.columnEditorOpen,i,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,S,I,H,M,k,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||!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,draggedHeaderRef:e.draggedHeaderRef,hoveredHeaderRef:e.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.pinnedRightHeaderRef,dimensionManager:e.dimensionManager,sectionScrollController:e.sectionScrollController,sortManager:e.sortManager,filterManager:e.filterManager,selectionManager:e.selectionManager,rowSelectionManager:e.rowSelectionManager,rowStateMap:e.rowStateMap,onRender:e.onRender,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const Zn=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class to{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||Yn({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})},n=new Map;let o=!1;const i=()=>{o=!1,0!==n.size&&(n.forEach((e,n)=>{var o;const i=null===(o=t.cellRegistry)||void 0===o?void 0:o.get(n);i&&i.updateContent(e)}),n.clear())};let s=null;return{updateData:e=>{const{rowIndex:r,accessor:l,newValue:a}=e;if(r>=0&&t.localRows.length>r){const e=t.localRows[r];e[l]=a;const d=(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(!s||s.rowsRef!==i){const t=new WeakMap;for(const e of i)e.row&&t.set(e.row,e);s={rowsRef:i,map:t}}return s.map.get(e)}})(e);let c;if(d)c=d.rowId;else{const n=[r];c=t.config.getRowId?[r,t.config.getRowId({row:e,depth:0,index:r,rowPath:n,rowIndexPath:n})]:[r]}const h=`${c.join("-")}-${l}`;n.set(h,a),o||(o=!0,queueMicrotask(i))}},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=>Zn(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const i=U(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 Zn(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i});return Zn(s)}return Zn(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:()=>me(t.headers),applyPinnedState:async e=>{const n=xe(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(ee(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,o;const 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.config.rowGrouping)||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.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},toggleColumnEditor:e=>{t.config.editColumns&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const i=o.accessor+"";let s=i in e?!e[i]:o.hide;return pe(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)}}}}const eo=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},no=(t,e)=>{if(!t||!e)return null;const n=(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}})(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.max(0,Math.min(n.bottom,o.bottom)-s);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 oo{constructor(t,e){var n,o;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.resolvedScrollParent=null,this.externalScrollListener=null,this.externalWindowResizeListener=null,this.externalParentResizeObserver=null,this.externalViewportHeight=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=e,this.customTheme=ye.mergeCustomTheme(e),this.mergedColumnEditorConfig=ye.mergeColumnEditorConfig(e),this.resolvedIcons=ye.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=ye.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(o=e.isLoading)&&void 0!==o&&o,this.collapsedHeaders=ye.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=ye.getInitialExpandedDepths(e),this.domManager=new Re,this.renderOrchestrator=new Qn,this.animationCoordinator=new M,this.applyAnimationsConfig(e.animations),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=Y({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=X(n);this.rowIndexMap.set(o,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,o)=>{var i,s;if(t.hide||t.excludeFromRender)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.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.animationCoordinator.captureSnapshot({containers:this.getAnimatableContainers(),preLayouts:t})}beginAccordionAnimation(t){var e,n;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;this.captureAnimationSnapshot(),this.pendingAccordionAxis=t;const o=this.animationCoordinator.getDuration(),i=this.animationCoordinator.getEasing(),s=null!==(n=null===(e=this.domManager.getElements())||void 0===e?void 0:e.rootElement)&&void 0!==n?n:this.container;s.style.setProperty(ie,o+"ms"),s.style.setProperty(se,i),s.classList.add(oe),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{s.classList.remove(oe),s.style.removeProperty(ie),s.style.removeProperty(se),this.accordionCleanupTimerId=null},o+80)}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new Zt,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new Qt(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new Ht({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(t=>{this.captureAnimationSnapshot(),this.render("sortManager")}),this.filterManager=new Tt({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:o}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new Gt({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t,e;const n=this.domManager.getRefs(),o=this.domManager.getElements();if(!n.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=te(n.tableBodyContainerRef.current);const i=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new bt({effectiveHeaders:i,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:this.localRows.length,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:n.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.config.onGridReady&&this.config.onGridReady())}),this.scrollManager=new yt({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(t=this.config.infiniteScrollThreshold)&&void 0!==t?t:200});const s=t=>{var e;const n=this.domManager.getRefs().mainHeaderRef.current,o=this.selectionManager,i=o&&(this.config.selectableCells||this.config.selectableColumns)?{columnsWithSelectedCells:o.getColumnsWithSelectedCells(),selectedColumns:o.getSelectedColumns()}:void 0;null===(e=null==n?void 0:n.__renderHeaderCells)||void 0===e||e.call(n,t,i)};this.sectionScrollController=new Rt({onMainSectionHeaderFrame:t=>{s(t)},onMainSectionScrollLeft:t=>{var e;s(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 xt({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:n.mainBodyRef,isResizing:this.isResizing},()=>{this.render("autoScaleManager")})),n.headerContainerRef.current&&n.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new Yt({headerContainer:n.headerContainerRef.current,mainSection:n.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,n.tableBodyContainerRef.current&&(this.scrollbarWidth=te(n.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Jt,this.windowResizeManager.addCallback(()=>{var t;if(n.tableBodyContainerRef.current){const e=te(n.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new Ut({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new _t({selectableColumns:null!==(e=this.config.selectableColumns)&&void 0!==e&&e,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(){const t=this.domManager.getElements();if(!(null==t?void 0:t.bodyContainer))return;var e,n;const o=(n=this.config.maxHeight,null!=(e=this.config.height)&&""!==e||null!=n&&""!==n||null===eo(this.config.scrollParent)?null:eo(this.config.scrollParent));o!==this.resolvedScrollParent&&this.detachExternalScrollWiring(),o?(this.attachExternalScrollWiring(o),this.ensureBodyScrollListenerDetached(t.bodyContainer),this.recomputeExternalViewportHeight()):(this.ensureBodyScrollListenerAttached(t.bodyContainer),this.externalViewportHeight=0,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:void 0}))}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,o=no(this.resolvedScrollParent,n);if(!o)return;const i=o.visibleViewportHeight;i!==this.externalViewportHeight&&(this.externalViewportHeight=i,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:i}))}handleExternalResize(){this.recomputeExternalViewportHeight(),this.recomputeExternalScrollPaddingTop(),this.render("external-scroll-resize")}handleExternalScroll(t){var e;const n=this.resolvedScrollParent;if(!n)return;const o=this.domManager.getElements(),i=null!==(e=null==o?void 0:o.rootElement)&&void 0!==e?e:this.container,s=no(n,i);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)}getRenderContext(){const t=this.domManager.getRefs();return{accordionAxis:this.pendingAccordionAxis,config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,externalViewportHeight:this.resolvedScrollParent&&this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),setIsResizing:t=>{var e,n,o,i,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(o=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:null===(s=null===(i=t.mainBodyRef)||void 0===i?void 0:i.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=ee(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,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}render(t){if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;this._positionOnlyBody="scroll-raf"===t&&!0===this.isScrolling;const e=this.domManager.getElements(),n=this.domManager.getRefs();e&&(this.renderOrchestrator.render(e,n,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),this.pendingAccordionAxis=null,this.lastRenderedVisibilityKey=this.buildVisibilityKey(this.headers),"scroll-raf"!==t&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}))}update(e){var n,o,i,s;if(this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),e),void 0!==e.animations&&this.applyAnimationsConfig(e.animations),void 0!==e.rows&&(this.firstRenderDone&&this.captureAnimationSnapshot(),this.localRows=[...e.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows})),void 0!==e.defaultHeaders&&(this.captureAnimationSnapshot(),this.headers=[...e.defaultHeaders],this.essentialAccessors=ye.buildEssentialAccessors(this.headers),this.filterManager&&this.filterManager.updateConfig({headers:this.headers}),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers})),void 0!==e.isLoading&&(this.internalIsLoading=e.isLoading),void 0!==e.theme&&this.domManager.updateTheme(e.theme),void 0!==e.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0!==e.customTheme){const e=this.customTheme;this.customTheme=ye.mergeCustomTheme(this.config),function(e,n){for(const o of Object.keys(t))if(e[o]!==n[o])return!1;return!0}(e,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(n=this.dimensionManager)||void 0===n||n.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.shouldPaginate&&e.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}void 0===e.selectableColumns&&void 0===e.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(o=this.config.selectableColumns)&&void 0!==o&&o,selectableCells:null!==(i=this.config.selectableCells)&&void 0!==i&&i}),void 0===e.scrollParent&&void 0===e.height&&void 0===e.maxHeight||this.syncExternalScrollWiring(),void 0===e.onLoadMore&&void 0===e.infiniteScrollThreshold||!this.scrollManager||this.scrollManager.updateConfig({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(s=this.config.infiniteScrollThreshold)&&void 0!==s?s:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,o,i,s,r,l,a,d,c,h,u,p,f;this.mounted=!1,this.firstRenderDone=!1,null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),this.detachExternalScrollWiring();const v=this.domManager.getElements();(null==v?void 0:v.bodyContainer)&&(this.ensureBodyScrollListenerDetached(v.bodyContainer),this.bodyContainerMouseLeaveListener&&(v.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const w=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;w.classList.remove(oe),w.style.removeProperty(ie),w.style.removeProperty(se),null===(n=this.dimensionManager)||void 0===n||n.destroy(),null===(o=this.scrollManager)||void 0===o||o.destroy(),null===(i=this.sectionScrollController)||void 0===i||i.destroy(),null===(s=this.sortManager)||void 0===s||s.destroy(),null===(r=this.filterManager)||void 0===r||r.destroy(),null===(l=this.rowSelectionManager)||void 0===l||l.destroy(),null===(a=this.selectionManager)||void 0===a||a.destroy(),null===(d=this.autoScaleManager)||void 0===d||d.destroy(),null===(c=this.windowResizeManager)||void 0===c||c.destroy(),null===(h=this.handleOutsideClickManager)||void 0===h||h.destroy(),null===(u=this.scrollbarVisibilityManager)||void 0===u||u.destroy(),null===(p=this.expandedDepthsManager)||void 0===p||p.destroy(),null===(f=this.ariaAnnouncementManager)||void 0===f||f.destroy(),this.animationCoordinator.destroy(),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return to.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,get expandedRows(){return e.expandedRows},get collapsedRows(){return e.collapsedRows},get expandedDepths(){return e.expandedDepths},clearExpandedRows:()=>{e.expandedRows=new Map},clearCollapsedRows:()=>{e.collapsedRows=new Map},rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,columnEditorOpen:this.columnEditorOpen,getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=ee(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=oo,exports.asRows=function(t){return t};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={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},e=new WeakMap,n=(t,n,o)=>{const i=(t=>{let n=e.get(t);return n||(n=new Map,e.set(t,n)),n})(t);let s=i.get(n);s||(s=document.createElement("div"),s.className="st-aria-row",s.setAttribute("role","row"),s.style.display="contents",t.appendChild(s),i.set(n,s));const r=o+"";return s.getAttribute("aria-rowindex")!==r&&s.setAttribute("aria-rowindex",r),s},o=t=>{const n=e.get(t);n&&n.forEach((t,e)=>{0===t.childElementCount&&(t.remove(),n.delete(e))})},i=t=>{const n=e.get(t);n&&(n.forEach(t=>t.remove()),n.clear())},s=new WeakMap,r=(t,e,n,o)=>{t.addEventListener(e,n,o),s.has(t)||s.set(t,[]),s.get(t).push({event:e,handler:n,options:o})},l=new WeakMap,a=t=>(l.has(t)||l.set(t,new Map),l.get(t)),d=new WeakMap;let c=0,h=Date.now(),u={screenX:0,screenY:0},p=null;const f=t=>{h=t},v=new WeakMap,w=t=>(v.has(t)||v.set(t,new Map),v.get(t)),m=new WeakMap,g=t=>(m.has(t)||m.set(t,new Map),m.get(t)),x=(t,e)=>{const n=Date.now();0!==c&&e>n-c||(c=n,t())},b=(t,e,n,o)=>{t.addEventListener(e,n,o),d.has(t)||d.set(t,[]),d.get(t).push({event:e,handler:n,options:o})},y=t=>{const e=t.closest(".simple-table-root");null==e||e.querySelectorAll(".st-tooltip").forEach(t=>t.remove())},R=.5,C="st-cell-animating-out",S="data-animating-out",I="data-shrinking-out",H=t=>{const e=a(t),n=w(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 M{constructor(t={}){var e,n;this.enabled=!1,this.snapshot=null,this.incomingOrigins=null,this.inFlight=new Map,this.retainedCells=new Map,this.scrollerMetricsCache=new WeakMap,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=O()}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)}getDuration(){return this.duration}getEasing(){return this.easing}setIncomingOrigins(t){this.incomingOrigins=this.isEnabled()&&t&&t.size>0?t:null}getScrollerMetrics(t){let e=this.scrollerMetricsCache.get(t);return e||(e=E(t),this.scrollerMetricsCache.set(t,e)),e}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;H(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)}retainCell(t){const{cellId:e,element:n,container:o,newPosition:i}=t,s=k(n.style.top),r=k(n.style.left),l=this.getScrollerMetrics(o),a=T(i.top,s,i.height,l,"y"),d=T(i.left,r,i.width,l,"x");let c=this.retainedCells.get(o);c||(c=new Map,this.retainedCells.set(o,c));const h=c.get(e);h&&h!==n&&(this.cancelInFlight(e),h.remove()),n.id&&n.removeAttribute("id"),n.classList.add(C),n.setAttribute(S,"true"),n.style.left=d+"px",n.style.top=a+"px",n.style.width=i.width+"px",n.style.height=i.height+"px",n.style.pointerEvents="none",c.set(e,n)}claimRetainedForReuse(t,e){var n;const o=this.retainedCells.get(e);if(!o)return null;const i=o.get(t);return i?i.hasAttribute(I)?(this.cancelInFlight(t),o.delete(t),null===(n=this.snapshot)||void 0===n||n.delete(t),i.remove(),null):(this.cancelInFlight(t),o.delete(t),i.classList.remove(C),i.removeAttribute(S),i.id=t,i.style.pointerEvents="",i):null}shrinkOutCell(t){const{cellId:e,element:n,container:o,axis:i}=t;this.cancelInFlight(e);let s=this.retainedCells.get(o);s||(s=new Map,this.retainedCells.set(o,s));const r=s.get(e);r&&r!==n&&(this.cancelInFlight(e),r.remove()),n.id&&n.removeAttribute("id"),n.classList.add(C),n.setAttribute(S,"true"),n.setAttribute(I,"true"),n.style.pointerEvents="none","horizontal"===i?n.style.width="0px":n.style.height="0px",s.set(e,n);const l=window.setTimeout(()=>{const t=this.retainedCells.get(o);t&&t.get(e)===n&&t.delete(e),n.remove()},this.duration+80);this.inFlight.set(e,{element:n,cleanupTimeout:l,transitionEndHandler:()=>{},isRetained:!0})}discardRetainedIfPresent(t,e){const n=this.retainedCells.get(e);if(!n)return;const o=n.get(t);o&&(this.cancelInFlight(t),n.delete(t),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)=>{this.inFlight.has(n)||(e.remove(),t.delete(n))})});const o=[],i=new Set,s=new Map,r=(t,r,l,a)=>{if(i.has(r))return;if(l&&t.hasAttribute(I))return void i.add(r);let d=e.get(r);if(!d&&!l&&n){const t=n.get(r);t&&(d={sourceContainer:null,sourceContainerLeft:0,sourceContainerTop:0,left:t.left,top:t.top,styleTop:t.top,styleLeft:t.left,fromDom:!1})}if(!d)return;if(!l&&null!==d.sourceContainer&&d.sourceContainer!==a)return void i.add(r);if(t.querySelector(".st-cell-editing"))return;const c=k(t.style.left),h=k(t.style.top);if(!l&&this.inFlight.has(r)&&R>Math.abs(d.styleTop-h)&&R>Math.abs(d.styleLeft-c))return void i.add(r);const u=l||d.fromDom,p=u?0:k(t.style.height)||t.offsetHeight||0,f=u?0:k(t.style.width)||t.offsetWidth||0,v=u?null:this.getScrollerMetrics(a),w=u||!v?d.top:T(d.top,h,p,v,"y"),m=u||!v?d.left:T(d.left,c,f,v,"x");let g=0;if(null!==d.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);g=t.left-d.sourceContainerLeft}const x=m-c-g,b=w-h-0;R>Math.abs(x)&&R>Math.abs(b)?l&&t.remove():(o.push({cellId:r,element:t,dx:x,dy:b,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)}),H(e).forEach((t,n)=>{r(t,n,!1,e)})}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";0!==o.length&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{cellId:t,element:e,isRetained:n}of o)e.isConnected&&this.startTransition(t,e,n)})})}cancel(){this.snapshot=null,this.incomingOrigins=null,this.clearScrollerMetricsCache();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=>t.remove()),t.clear()}),this.retainedCells.clear()}destroy(){this.cancel()}readPosition(t,e,n,o,i){const s=k(e.style.top),r=k(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){if(n)return this.retainedCells.forEach(n=>{n.get(t)===e&&n.delete(t)}),void e.remove();e.style.transition="",e.style.transform="",e.style.willChange="",e.style.pointerEvents=""}isCellRetained(t){return t.hasAttribute(S)}}const k=t=>{if(!t)return 0;const e=parseFloat(t);return Number.isFinite(e)?e:0},E=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}},T=(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 h=l-c,u=c+s*h/(h+10*c);return e+Math.sign(r)*u},O=()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}},A=t=>Math.ceil(800/(t+1)),W=29.5,P=150,$=["lineAreaChart","barChart"],F=40,L=(t,e,n)=>e&&n?480>t?.25:768>t?.3:.4:(t=>480>t?.4:768>t?.5:.6)(t),D="parentExpanded",B=(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},j=t=>t.flatMap(t=>t.children&&0!==t.children.length?j(t.children):[t]),z=t=>t.flatMap(t=>{const e=[t];return t.children&&t.children.length>0&&e.push(...z(t.children)),e}),N=(t=0)=>t?t+1:0,q=(t,e)=>{const n=z(t);for(const t of n)if(t.children&&t.children.length>0&&t.children.some(t=>t.accessor===e))return t;return null},V=(t,e,n)=>{const o=q(e,t.accessor);if(o){const e=n.has(o.accessor),i=t.showWhen||D;return e?"parentExpanded"===i:"parentCollapsed"===i}return!1},G=t=>{var e;return!(!(null===(e=t.children)||void 0===e?void 0:e.length)||!t.collapsible)},K=(t,e,n)=>{if(!t.children||0===t.children.length)return 1;const o=j(t.children);let i=0;for(const t of o)t.hide||V(t,e,n)||(i+=1);return i},U=({accessor:t,rowId:e})=>`${e}-${t}`,J=({calculatedHeight:t,customHeight:e,customTheme:n})=>e?("string"==typeof e?parseFloat(e):e)+n.nestedGridPaddingTop+n.nestedGridPaddingBottom:t,_=t=>{const e=t.match(/^(.+?)\[(\d+)\]$/);return e?{key:e[1],index:parseInt(e[2],10)}:{key:t,index:null}},Y=(t,e)=>{const n=e+"";return n.includes(".")||n.includes("[")?n.split(".").reduce((t,e)=>{if(null==t)return;const{key:n,index:o}=_(e);let i=t[n];return null!==o&&Array.isArray(i)&&(i=i[o]),i},t):t[e]},X=(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}=_(i[t]);if(null==s[e]){const n=_(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}=_(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},Q=t=>Array.isArray(t)&&t.length>0&&"object"==typeof t[0]&&null!==t[0],Z=t=>{const{getRowId:e,rowPath:n}=t,o=[...n];if(e){const n=e({row:t.row,depth:t.depth,index:t.index,rowPath:t.rowPath,rowIndexPath:t.rowIndexPath,groupingKey:t.groupingKey});o.push(n)}return o},tt=t=>t.join("-"),et=new WeakMap;let nt=0;const ot=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})+"":(t=>{if(t&&"object"==typeof t){const e=et.get(t);if(void 0!==e)return e;const n="__row_"+ ++nt;return et.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(n),o.join("/")},it=t=>t.stableRowKey?t.stableRowKey:tt(t.rowId),st=(t,e)=>`${t+""}nested-chrome${(null!=e?e:"")+""}`,rt=(t,e)=>!!e&&Q(t[e]),lt=(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},at=(t,e)=>{if(t.hide)return[];if(!t.children||0===t.children.length)return[t];if(e&&e.has(t.accessor)){const n=t.children.filter(t=>{const e=t.showWhen||D;return"parentCollapsed"===e||"always"===e});return t.singleRowChildren?0===n.length?[t]:[t,...n.flatMap(t=>at(t,e))]:0===n.length?[t]:n.flatMap(t=>at(t,e))}const n=t.children.filter(t=>{const e=t.showWhen||D;return"parentExpanded"===e||"always"===e});return t.singleRowChildren?[t,...n.flatMap(t=>at(t,e))]:n.flatMap(t=>at(t,e))};function dt(t){if(t.hide)return null;if("number"==typeof t.width)return{type:"px",value:t.width};if("string"!=typeof t.width)return null;const e=t.width.trim();return e.endsWith("px")?{type:"px",value:parseFloat(e)||0}:e.endsWith("fr")?{type:"fr",value:parseFloat(e)||1}:e.endsWith("%")?{type:"pct",value:parseFloat(e)||0}:null}function ct(t){const e=[],n=t=>{t.hide||(t.children&&0!==t.children.length?t.children.forEach(n):e.push(t))};return t.forEach(n),e}function ht(t,e){const n=t.map(t=>dt(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("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:P);else a.set(t.accessor,P)}),a}function ut(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=ct(t);o=ht(e,n)}else{const e=ct(t),n=e.map(t=>dt(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=ht(e,s)}return t.map(function t(e){const n=Object.assign({},e);if(e.children&&e.children.length>0)return n.children=e.children.map(t),n;const i=o.get(e.accessor);return null!=i&&(n.width=i),n})}const pt=t=>{if(t.hide)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(U({accessor:t.accessor,rowId:"header"}));return(null==e?void 0:e.offsetWidth)||P}},ft=t=>{var e;const n=t.width;"string"==typeof n&&n.includes("fr")&&(t.width=(null===(e=document.getElementById(U({accessor:t.accessor,rowId:"header"})))||void 0===e?void 0:e.offsetWidth)||P),t.children&&t.children.length>0&&t.children.forEach(t=>{ft(t)})},vt=t=>"number"==typeof t.minWidth?t.minWidth:F,wt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||n.push(...at(t,e))}),n},mt=(t,e)=>{const{rows:n,header:o,maxWidth:i=500,sampleSize:s=50,styleRoot:r}=e||{},l=null!=r?r:document,a=document.getElementById(U({accessor:t,rowId:"header"}));if(!a)return P;const d=window.getComputedStyle(a),c=parseFloat(d.paddingLeft)||0,h=parseFloat(d.paddingRight)||0,u=parseFloat(d.gap)||0;let p=c+h;const f=a.querySelector(".st-header-label");if(f){const t=f.querySelector(".st-header-label-text");if(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto";const n=window.getComputedStyle(t);e.style.font=n.font,e.style.fontSize=n.fontSize,e.style.fontWeight=n.fontWeight,e.style.fontFamily=n.fontFamily,e.style.letterSpacing=n.letterSpacing,e.style.padding=n.padding,e.textContent=t.textContent,document.body.appendChild(e);const o=e.offsetWidth;document.body.removeChild(e),p+=o}}const v=Array.from(a.children);let w=1;for(let t=0;v.length>t;t++){const e=v[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),w++)}u>0&&w>1&&(p+=u*(w-1));let m=0;const g=o&&o.type&&$.includes(o.type);if(n&&n.length>0&&!g){const e=Math.min(n.length,s),i=document.createElement("div");i.style.visibility="hidden",i.style.position="absolute",i.style.whiteSpace="nowrap",i.style.width="auto";let r=0,a=0;const d=l.querySelector(".st-cell-content");if(d){const t=window.getComputedStyle(d);i.style.font=t.font,i.style.fontSize=t.fontSize,i.style.fontFamily=t.fontFamily,r=parseFloat(t.paddingLeft)||0,a=parseFloat(t.paddingRight)||0}document.body.appendChild(i);for(let s=0;e>s;s++){const e=n[s];let l;l=(null==o?void 0:o.valueGetter)?o.valueGetter({accessor:t,row:e,rowIndex:s}):Y(e,t);let d=l;(null==o?void 0:o.valueFormatter)&&null!=l&&(d=o.valueFormatter({accessor:t,colIndex:0,row:e,rowIndex:s,value:l})),i.textContent=null!=d?d+"":"";const c=i.offsetWidth+r+a;c>m&&(m=c)}document.body.removeChild(i)}let x=Math.max(p,m);return g&&(x=Math.max(x,150)),x>i&&(x=i),Math.max(x+2,F)};class gt{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 xt=(t,e)=>{const n=[];return t.forEach(t=>{t.hide||(t.children&&t.children.length>0?n.push(...xt(t.children,null!=e?e:t.pinned)):n.push(t))}),n},bt=(t,e)=>e>=t.reduce((t,e)=>t+vt(e),0),yt=(t,e)=>{const n=new Map,o=t.reduce((t,e)=>t+("number"==typeof e.width?e.width:"string"==typeof e.width&&e.width.endsWith("px")?parseFloat(e.width):150),0);if(0===o)return n;const i=e/o;if(i>=1&&.01>i-1)return n;let s=0;return t.forEach((o,r)=>{const l="number"==typeof o.width?o.width:"string"==typeof o.width&&o.width.endsWith("px")?parseFloat(o.width):150;let a;r===t.length-1?a=e-s:(a=Math.round(l*i),s+=a),n.set(o.accessor,a)}),n},Rt=(t,e)=>{const{autoExpandColumns:n,containerWidth:o,pinnedLeftWidth:i,pinnedRightWidth:s,isResizing:r}=e;if(!n||0===o||r)return t;const l=Math.max(0,o-i-s),a=t.filter(t=>"left"===t.pinned),d=t.filter(t=>"right"===t.pinned),c=t.filter(t=>!t.pinned),h=xt(a,"left"),u=xt(d,"right"),p=xt(c,void 0),f=h.length>0&&bt(h,i),v=u.length>0&&bt(u,s),w=p.length>0&&l>0&&bt(p,l),m=new Map;if(f&&yt(h,i).forEach((t,e)=>m.set(e,t)),v&&yt(u,s).forEach((t,e)=>m.set(e,t)),w&&yt(p,l).forEach((t,e)=>m.set(e,t)),0===m.size)return t;const g=(t,e)=>{var n;if(t.hide)return t;const o=null!=e?e:t.pinned,i=null===(n=t.children)||void 0===n?void 0:n.map(t=>g(t,o));if(!t.children||0===t.children.length){const e=m.get(t.accessor);return Object.assign(Object.assign({},t),void 0!==e?{width:e,children:i}:{children:i})}return Object.assign(Object.assign({},t),{children:i})};return t.map(t=>g(t,t.pinned))};class Ct{constructor(t,e){var n;this.config=t,this.onHeadersUpdate=e,this.isResizingTracker=new gt(null!==(n=t.isResizing)&&void 0!==n&&n),this.containerWidthTracker=new gt(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 Rt(t,this.config)}setHeaders(t,e){const n="function"==typeof t?t(e):t;return this.applyAutoScale(n)}destroy(){this.onHeadersUpdate=()=>{}}}class St{constructor(t){this.subscribers=new Set,this.resizeObserver=null,this.rafId=null,this.initialNotifyPending=!1,this.config=t;const e=this.calculateMaxHeaderDepth(),n=this.calculateHeaderHeight(e),o=this.calculateContentHeight();this.state={containerWidth:0,calculatedHeaderHeight:n,maxHeaderDepth:e,contentHeight:o},t.containerElement&&this.observeContainer(t.containerElement)}getHeaderDepth(t){var e,n;return t.singleRowChildren&&(null===(e=t.children)||void 0===e?void 0:e.length)?1:(null===(n=t.children)||void 0===n?void 0:n.length)?1+Math.max(...t.children.map(t=>this.getHeaderDepth(t))):1}calculateMaxHeaderDepth(){let t=0;return this.config.effectiveHeaders.forEach(e=>{const n=this.getHeaderDepth(e);t=Math.max(t,n)}),t}calculateHeaderHeight(t){var e;return t*(null!==(e=this.config.headerHeight)&&void 0!==e?e:this.config.rowHeight)}convertHeightToPixels(t){var e;const n=this.config.containerElement||document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t}calculateContentHeight(){const{height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight: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}observeContainer(t){this.resizeObserver=new ResizeObserver(()=>{null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const e=t.clientWidth,n=e!==this.state.containerWidth;n&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e})),(n||this.initialNotifyPending)&&(this.initialNotifyPending=!1,this.notifySubscribers())})}),this.resizeObserver.observe(t),this.applyContainerWidthSync(t)}applyContainerWidthSync(t){const e=t.clientWidth;e>0&&e!==this.state.containerWidth&&(this.state=Object.assign(Object.assign({},this.state),{containerWidth:e}),this.initialNotifyPending=!0)}updateConfig(t){const e=this.config.effectiveHeaders,n=this.config.containerElement;this.config=Object.assign(Object.assign({},this.config),t);let o=!1;if(t.effectiveHeaders&&t.effectiveHeaders!==e){const t=this.calculateMaxHeaderDepth(),e=this.calculateHeaderHeight(t);this.state=Object.assign(Object.assign({},this.state),{maxHeaderDepth:t,calculatedHeaderHeight:e}),o=!0}if(t.height||t.maxHeight||void 0!==t.totalRowCount||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.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.subscribers.clear()}}class It{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 Ht{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))}}const Mt={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)=>Mt.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?Mt.string(t,e,n):"number"==typeof t&&"number"==typeof e?Mt.number(t,e,n):"boolean"==typeof t&&"boolean"==typeof e?Mt.boolean(t,e,n):Mt.string(t+"",e+"",n)},kt=({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=Y(e,l),a=Y(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 Mt.number(i,s,o)}return"date"===n?Mt.date(t+"",e+"",o):"boolean"===n?Mt.boolean(!!t,!!e,o):"enum"===n?Mt.enum(t+"",e+"",o):Mt.string(t+"",e+"",o)})(o,a,s,r)})})({rows:e,sortColumn:n,headers:t}),Et=t=>{const{rows:e=[],headers:n=[],rowGrouping:o,rowManager:i}=t;if(i)return i.getAggregatedRows();if(!o||0===o.length)return e;const s=(t=>z(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=o[e],i=o[e+1],r=t[n];if(r&&Q(r)){const o=l(r,e+1),a=Object.assign({},t);return a[n]=o,s.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&&Q(n))s(n);else{const n=Y(t,e);null!=n&&i.push(n)}})};if(s(t),0===i.length)return;if("custom"===n.type&&n.customFn)return n.customFn(i);const r=n.parseValue?i.map(n.parseValue).filter(t=>!isNaN(t)):i.map(t=>"number"==typeof t?t:"string"==typeof t?parseFloat(t):NaN).filter(t=>!isNaN(t));if(0===r.length)return"count"===n.type?i.length:void 0;let l;switch(n.type){case"sum":l=r.reduce((t,e)=>t+e,0);break;case"average":l=r.reduce((t,e)=>t+e,0)/r.length;break;case"count":l=i.length;break;case"min":l=Math.min(...r);break;case"max":l=Math.max(...r);break;default:return}return n.formatResult?n.formatResult(l):l})(o,t.accessor,t.aggregation,i);void 0!==e&&X(a,t.accessor,e)}),a}return t});return l(r)};class Tt{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=z(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=kt({headers:e,rows:n,sortColumn:o});return t&&0!==t.length?i.map(n=>{const i=t[0],s=n[i];if(Q(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=Et({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}):kt({headers:this.config.headers,rows:n,sortColumn:e}):n}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeSortedRows(this.config.tableRows,this.state.sort);n!==this.state.sortedRows&&(this.state=Object.assign(Object.assign({},this.state),{sortedRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateSort(t){var e,n,o,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()}}const Ot=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)},At=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),Wt=t=>{if(!t)return new Date;if("string"==typeof t)return Ot(t);if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?new Date:At(e)}return t instanceof Date?At(t):new Date};class Pt{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=z(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=Wt(t),s=Wt((o||"")+""),r=At(e),l=At(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=>At(Wt((t||"")+"")));return r>=t&&e>=r}return!1;case"notBetween":if(i&&2===i.length){const[t,e]=i.map(t=>At(Wt((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}})(Y(t,e.accessor),e)}catch(t){return console.warn(`Filter error for accessor ${e.accessor}:`,t),!0}})):t}updateConfig(t){const e=this.config.headers;this.config=Object.assign(Object.assign({},this.config),t),t.headers&&t.headers!==e&&this.updateHeaderLookup();const n=this.computeFilteredRows(this.config.rows,this.state.filters);n!==this.state.filteredRows&&(this.state=Object.assign(Object.assign({},this.state),{filteredRows:n}),this.notifySubscribers())}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}updateFilter(t){var e,n;const o=Object.assign(Object.assign({},this.state.filters),{[t.accessor]:t}),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 $t=(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},Ft=(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},Lt=({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)),h=Math.min(i.length,Math.ceil(d/l)),u=o+e,p=Math.max(0,Math.ceil(o/l)),f=Math.min(i.length,Math.floor(u/l)),v=o+e,w=Math.max(0,Math.floor(o/l)),m=Math.min(i.length,Math.ceil(v/l));return{rendered:{startIndex:c,endIndex:h,rows:i.slice(c,h)},fullyVisible:{startIndex:p,endIndex:f,rows:i.slice(p,f)},partiallyVisible:{startIndex:w,endIndex:m,rows:i.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=o+e+h,p=$t(Math.max(0,o-c),r);let f=$t(u,r)+1;f=Math.min(i.length,f);const v=o,w=o+e;let m=$t(v,r);v>a[m]&&(m=Math.min(m+1,i.length));let g=$t(w,r);g=Math.min(i.length,g);const x=o+e,b=$t(o,r);let y=$t(x,r)+1;return y=Math.min(i.length,y),{rendered:{startIndex:p,endIndex:f,rows:i.slice(p,f)},fullyVisible:{startIndex:m,endIndex:g,rows:i.slice(m,g)},partiallyVisible:{startIndex:b,endIndex:y,rows:i.slice(b,y)}}},Dt=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)-o.rowSeparatorWidth+Ft(t,n),Bt=({position:t,rowHeight:e,heightOffsets:n,customTheme:o})=>t*(e+o.rowSeparatorWidth)+Ft(t,n),jt=(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},zt=new Map,Nt=(t,e,n,o,i)=>{var s,r,l,a,d,c;const h=null!==(r=null===(s=o[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,p=null!==(c=null===(d=e[e.length-1])||void 0===d?void 0:d.position)&&void 0!==c?c:-1,f=`${h}:${u}:${p}:${i.join(",")}`,v=zt.get(f);if(v&&v.firstVisiblePosition===h&&v.renderedStartPosition===u&&v.renderedEndPosition===p)return v.result;const w=qt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:0,recursionDepth:0,stickyParents:[],rowGrouping:i});if(zt.set(f,{result:w,firstVisiblePosition:h,renderedStartPosition:u,renderedEndPosition:p}),zt.size>50){const t=zt.keys().next().value;void 0!==t&&zt.delete(t)}return w},qt=({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=>tt(t.rowId)===tt(o.rowId))||(r.push(o),d++)}}if(r.length>0){jt(a,t)&&(r.push(a),d++);const e=o[i+=d];e&&(a=e)}}else if(jt(a,t))return r.push(a),i++,qt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l});return jt(a,t)?qt({allTableRows:t,renderedRows:e,fullyVisibleRows:n,partiallyVisibleRows:o,partiallyVisibleRowIndex:i,recursionDepth:s+1,stickyParents:r,rowGrouping:l}):{stickyParents:r,regularRows:e}},Vt=(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)}},Gt=(t,e,n,o)=>{const i=document.querySelector(".st-body-container"),s=document.querySelector(".st-body-main");if(!i)return;const r=o?o.findIndex(e=>tt(e.rowId)===t.rowId+""):-1,l=0>r?t.rowIndex:r,a=e+n.rowSeparatorWidth,d=i.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);if(d&&o){const t=((t,e,n,o)=>{const i=Lt({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})(l,i,e,o);if(t)return void Vt(d,i,s)}if(!d)return i.scrollTop=Math.max(0,l*a-i.clientHeight/3),void setTimeout(()=>{const e=i.querySelector(`.st-cell[data-row-id="${t.rowId}"][data-col-index="${t.colIndex}"]`);e&&Vt(e,i,s)},100);Vt(d,i,s)},Kt=({rowIndex:t,colIndex:e,rowId:n})=>`${t}-${e}-${n}`;function Ut(t,e,n,o){const i=new Set,s=new Map;n.forEach((t,e)=>{const n=tt(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),p=Math.max(t.colIndex,e.colIndex);for(let t=c;h>=t;t++)for(let e=u;p>=e;e++)if(t>=0&&n.length>t){if(o&&0===e)continue;const s=tt(n[t].rowId);i.add(Kt({colIndex:e,rowIndex:t,rowId:s}))}return i}function Jt(t,e,n=document){var o,i,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"),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 p=[];u.forEach((t,e)=>{const n=t[0].getBoundingClientRect();p.push({key:e,top:n.top,bottom:n.bottom})}),p.sort((t,e)=>t.top-e.top);let f=null,v=1/0;for(let t=0;p.length>t;t++){const{key:e,top:n,bottom:o}=p[t];if(c>=n&&o>=c){f=e,v=0;break}const i=Math.abs(c-(n+o)/2);v>i&&(v=i,f=e)}if(null===f)return null;const w=u.get(f);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!==(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(),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 _t{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=>at(t,this.config.collapsedHeaders)),this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(tt(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(tt(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(`${tt(e.rowId)}\t${t}`),this.rowsWithSelectedCells.add(tt(e.rowId))})})}updateRowIdAndSelectionLookupOnly(){this.rowIdToTableIndex.clear(),this.config.tableRows.forEach((t,e)=>{this.rowIdToTableIndex.set(tt(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(`${tt(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?tt(i.rowId):null)!==o){const t=this.config.tableRows.findIndex(t=>tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(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=tt(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=tt(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=tt(this.config.tableRows[o].rowId);this.selectCellRange(this.startCell,{rowIndex:o,colIndex:n,rowId:t})}else{const t=tt(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=>!t.hide&&!t.excludeFromRender),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=Y(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=>!t.hide&&!t.excludeFromRender),c=o.findIndex(t=>tt(t.rowId)===e.rowId+""),h=0>c?e.rowIndex:c,u=e.colIndex;return a.forEach((t,e)=>{t.split("\t").forEach((t,n)=>{const a=h+e,c=u+n;if(a>=o.length||c>=d.length)return;const p=o[a],f=d[c],v=tt(p.rowId);if(!(null==f?void 0:f.isEditable))return void l.add(`${a}-${c}-${v}`);let w=t;if("number"===f.type){const e=+t;isNaN(e)||(w=e)}else if("boolean"===f.type)w="true"===t.toLowerCase()||"1"===t;else if("date"===f.type){const e=new Date(t);isNaN(e.getTime())||(w=e)}else"lineAreaChart"!==f.type&&"barChart"!==f.type||(w=t.split(",").map(t=>{const e=+t.trim();return isNaN(e)?0:e}));if(X(p.row,f.accessor,w),s){const t=s.get(`${v}-${f.accessor}`);t&&t.updateContent(w)}null==i||i({accessor:f.accessor,newValue:w,row:p.row,rowIndex:a}),r.add(`${a}-${c}-${v}`)})}),{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=>!t.hide&&!t.excludeFromRender),a=new Map;return l.forEach((t,e)=>{a.set(e,t.accessor)}),Array.from(t).forEach(t=>{const[e,a]=t.split("-").map(Number);if(e>=n.length||a>=l.length)return;const d=n[e],c=l[a],h=tt(d.rowId);if(!(null==c?void 0:c.isEditable))return void r.add(t);let u=null;if(u="string"===c.type?"":"number"===c.type?null:"boolean"!==c.type&&("date"===c.type?null:"lineAreaChart"===c.type||"barChart"===c.type||Array.isArray(Y(d.row,c.accessor))?[]:""),X(d.row,c.accessor,u),i){const t=i.get(`${h}-${c.accessor}`);t&&t.updateContent(u)}null==o||o({accessor:c.accessor,newValue:u,row:d.row,rowIndex:e}),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=tt(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(()=>{document.querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=parseInt(t.getAttribute("data-row-index")||"-1",10),n=parseInt(t.getAttribute("data-col-index")||"-1",10),o=t.getAttribute("data-row-id");if(0>e||0>n||!o)return;const i=Kt({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(){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 z(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 _t.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}if(l.isSelectionColumn&&this.config.enableRowSelection){for(const t of _t.HEADER_SELECTION_CLASSES)o.classList.remove(t);continue}const a=B(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 _t.HEADER_SELECTION_CLASSES)o.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 _t.HEADER_SELECTION_CLASSES)n.classList.remove(t)}}syncAllCellClasses(){var t;const e=(null!==(t=this.config.tableRoot)&&void 0!==t?t:document).querySelectorAll(".st-cell[data-row-index][data-col-index][data-row-id]");if(this.fullTableSelected||0!==this.selectedCells.size||0!==this.selectedColumns.size){for(let t=0;e.length>t;t++){const n=e[t];if(!(n instanceof HTMLElement))continue;const o=parseInt(n.getAttribute("data-row-index")||"-1",10),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),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 _t.SELECTION_CLASSES){const e=u.has(t),o=n.classList.contains(t);e&&!o?n.classList.add(t):!e&&o&&n.classList.remove(t)}const p=c?"0":"-1";if(n.getAttribute("tabindex")!==p&&n.setAttribute("tabindex",p),c&&document.activeElement!==n){const t=document.activeElement;t&&n.contains(t)||n.focus({preventScroll:!0})}}this.syncHeaderSelectionClasses()}else{for(let t=0;e.length>t;t++){const n=e[t];if(n instanceof HTMLElement){for(const t of _t.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=Kt({rowIndex:i,colIndex:t,rowId:o});if(this.selectedCells.has(e))return!0}const s=Kt({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?tt(r.rowId):null,a=this.config.tableRows[i+1],d=a?tt(a.rowId):null,c=null!==l&&this.isSelected({colIndex:t,rowIndex:i-1,rowId:l}),h=null!==d&&this.isSelected({colIndex:t,rowIndex:i+1,rowId:d}),u=this.isSelected({colIndex:t-1,rowIndex:i,rowId:n}),p=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||!h||this.selectedColumns.has(t)&&i===this.config.tableRows.length-1)&&s.push("st-selected-bottom-border"),u||s.push("st-selected-left-border"),p||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=Kt({colIndex:t,rowIndex:e,rowId:n});return this.copyFlashCells.has(o)}isWarningFlashing({colIndex:t,rowIndex:e,rowId:n}){const o=Kt({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=Kt(t);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=new Set([e]),this.initialFocusedCell=t,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Gt(t,this.config.rowHeight,this.config.customTheme,this.config.tableRows),0)}}selectCellRange(t,e){this.fullTableSelected=!1;const n=Ut(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedColumns=new Set,this.lastSelectedColumnIndex=null,this.selectedCells=n,this.initialFocusedCell=e,this.updateDerivedState(),this.updateAllCellClasses(),setTimeout(()=>Gt(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=Ut(t,e,this.config.tableRows,!!this.config.enableRowSelection);this.selectedCells.size===n.size&&Array.from(n).every(t=>this.selectedCells.has(t))||(this.selectedCells=n,this.updateDerivedState(),this.updateAllCellClasses())}getCellFromMousePosition(t,e){var n;return function(t,e,n=document){const o=document.elementFromPoint(t,e);if(!o)return null;const i=o.closest(".st-cell");if(i instanceof HTMLElement){if(!n.contains(i))return Jt(t,e,n);const o=parseInt(i.getAttribute("data-row-index")||"-1",10),s=parseInt(i.getAttribute("data-col-index")||"-1",10),r=i.getAttribute("data-row-id");if(o>=0&&s>=0&&null!==r)return{rowIndex:o,colIndex:s,rowId:r}}return Jt(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 o=n.querySelector(".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=n.querySelector(".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:document)}continuousScroll(){if(this.isSelecting&&this.startCell){if(null!==this.currentMouseX&&null!==this.currentMouseY){this.handleAutoScroll(this.currentMouseX,this.currentMouseY);const t=Date.now();if(t-this.lastSelectionUpdate>=this.selectionThrottleMs){const e=this.getCellFromMousePosition(this.currentMouseX,this.currentMouseY);e&&(this.updateSelectionRange(this.startCell,e),this.lastSelectionUpdate=t)}}this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll())}else null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null)}handleMouseDown({colIndex:t,rowIndex:e,rowId:n}){this.config.selectableCells&&(this.fullTableSelected=!1,this.isSelecting=!0,this.startCell={rowIndex:e,colIndex:t,rowId:n},setTimeout(()=>{this.selectedColumns=new Set,this.lastSelectedColumnIndex=null;const o=Kt({colIndex:t,rowIndex:e,rowId:n});this.selectedCells=new Set([o]),this.initialFocusedCell={rowIndex:e,colIndex:t,rowId:n},this.updateDerivedState(),this.updateAllCellClasses()},0),this.currentMouseX=null,this.currentMouseY=null,this.lastSelectionUpdate=0,this.globalMouseMoveHandler=t=>{this.isSelecting&&this.startCell&&(this.currentMouseX=t.clientX,this.currentMouseY=t.clientY)},this.globalMouseUpHandler=()=>{var t,e;this.isSelecting=!1,null!==this.scrollAnimationFrame&&(cancelAnimationFrame(this.scrollAnimationFrame),this.scrollAnimationFrame=null),this.globalMouseMoveHandler&&(document.removeEventListener("mousemove",this.globalMouseMoveHandler),this.globalMouseMoveHandler=null),this.globalMouseUpHandler&&(document.removeEventListener("mouseup",this.globalMouseUpHandler),this.globalMouseUpHandler=null),null===(e=(t=this.config).onSelectionDragEnd)||void 0===e||e.call(t),this.syncAllCellClasses(),requestAnimationFrame(()=>this.syncAllCellClasses())},document.addEventListener("mousemove",this.globalMouseMoveHandler),document.addEventListener("mouseup",this.globalMouseUpHandler),this.scrollAnimationFrame=requestAnimationFrame(()=>this.continuousScroll()))}handleMouseOver(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)}}}_t.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"],_t.HEADER_SELECTION_CLASSES=["st-header-selected","st-header-has-highlighted-cell"];const Yt=(t,e)=>t.filter(t=>!(!t||!t.rowId)&&e.has(tt(t.rowId))).map(t=>t.row);class Xt{constructor(t){this.subscribers=new Set,this.config=t,this.state={selectedRows:new Set,selectedRowCount:0,selectedRowsData:[]}}updateConfig(t){this.config=Object.assign(Object.assign({},this.config),t),t.tableRows&&this.updateDerivedState()}updateDerivedState(){var t;this.state=Object.assign(Object.assign({},this.state),{selectedRowCount:(t=this.state.selectedRows,t.size),selectedRowsData:Yt(this.config.tableRows,this.state.selectedRows)})}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}notifySubscribers(){this.subscribers.forEach(t=>t(this.state))}isRowSelected(t){return!!this.config.enableRowSelection&&(t=>this.state.selectedRows.has(t))(t)}areAllRowsSelected(){return!!this.config.enableRowSelection&&(e=this.state.selectedRows,0!==(t=this.config.tableRows).length&&t.filter(t=>t&&t.rowId).every(t=>e.has(tt(t.rowId))));var t,e}getSelectedRows(){return this.state.selectedRows}getSelectedRowCount(){return this.state.selectedRowCount}getSelectedRowsData(){return this.state.selectedRowsData}setSelectedRows(t){this.state=Object.assign(Object.assign({},this.state),{selectedRows:t}),this.updateDerivedState(),this.notifySubscribers()}handleRowSelect(t,e){if(!this.config.enableRowSelection)return;const n=(t=>{const e=new Set(this.state.selectedRows);return e.has(t)?e.delete(t):e.add(t),e})(t);if(this.state=Object.assign(Object.assign({},this.state),{selectedRows:n}),this.updateDerivedState(),this.config.onRowSelectionChange){const o=this.config.tableRows.find(e=>tt(e.rowId)===t);o&&this.config.onRowSelectionChange({row:o.row,isSelected:e,selectedRows:n})}this.notifySubscribers()}handleSelectAll(t){if(!this.config.enableRowSelection)return;let e;t?(e=new Set(this.config.tableRows.filter(t=>t&&t.rowId).map(t=>tt(t.rowId))),this.config.onRowSelectionChange&&this.config.tableRows.forEach(t=>this.config.onRowSelectionChange({row:t.row,isSelected:!0,selectedRows:e}))):(e=new Set,this.config.onRowSelectionChange&&this.state.selectedRows.forEach(t=>{const n=this.config.tableRows.find(e=>tt(e.rowId)===t);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:e})})),this.state=Object.assign(Object.assign({},this.state),{selectedRows:e}),this.updateDerivedState(),this.notifySubscribers()}handleToggleRow(t){if(!this.config.enableRowSelection)return;const e=this.isRowSelected(t);this.handleRowSelect(t,!e)}clearSelection(){if(this.config.enableRowSelection){if(this.config.onRowSelectionChange){const t=new Set;this.state.selectedRows.forEach(e=>{const n=this.config.tableRows.find(t=>tt(t.rowId)===e);n&&this.config.onRowSelectionChange({row:n.row,isSelected:!1,selectedRows:t})})}this.state=Object.assign(Object.assign({},this.state),{selectedRows:new Set}),this.updateDerivedState(),this.notifySubscribers()}}getState(){return this.state}destroy(){this.subscribers.clear()}}class Qt{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 Zt{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 te{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 ee=(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 ne{constructor(t,e){this.observers=new Set,this.expandedDepths=ee(t,e)}updateRowGrouping(t){if(!t||0===t.length)return void this.setExpandedDepths(new Set);const e=t.length,n=Array.from(this.expandedDepths).filter(t=>e>t);this.setExpandedDepths(new Set(n))}getExpandedDepths(){return this.expandedDepths}setExpandedDepths(t){this.expandedDepths=t,this.notifyObservers()}subscribe(t){return this.observers.add(t),()=>{this.observers.delete(t)}}notifyObservers(){this.observers.forEach(t=>t(this.expandedDepths))}expandAll(){const t=new Set;for(let e=0;10>e;e++)t.add(e);this.setExpandedDepths(t)}collapseAll(){this.setExpandedDepths(new Set)}expandDepth(t){const e=new Set(this.expandedDepths);e.add(t),this.setExpandedDepths(e)}collapseDepth(t){const e=new Set(this.expandedDepths);e.delete(t),this.setExpandedDepths(e)}toggleDepth(t){this.expandedDepths.has(t)?this.collapseDepth(t):this.expandDepth(t)}destroy(){this.observers.clear()}}class oe{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 ie(t){return t?t.offsetWidth-t.clientWidth:0}const se=t=>{if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(se);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=se(t[n]));return e},re=(t,e)=>t.filter(t=>t.pinned===e).some(t=>!t.hide&&!t.excludeFromRender),le="st-accordion-animating",ae="--st-accordion-duration",de="--st-accordion-easing",ce=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},he=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","24"),e.setAttribute("height","24"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},ue=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M298 177.5c3.8-8.8 2-19-4.6-26l-116-144C172.9 2.7 166.6 0 160 0s-12.9 2.7-17.4 7.5l-116 144c-6.6 7-8.4 17.2-4.6 26S34.4 192 44 192l72 0 0 288c0 17.7 14.3 32 32 32l24 0c17.7 0 32-14.3 32-32l0-288 72 0c9.6 0 18.2-5.7 22-14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},pe=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 320 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M22 334.5c-3.8 8.8-2 19 4.6 26l116 144c4.5 4.8 10.8 7.5 17.4 7.5s12.9-2.7 17.4-7.5l116-144c6.6-7 8.4-17.2 4.6-26s-12.5-14.5-22-14.5l-72 0 0-288c0-17.7-14.3-32-32-32L148 0C130.3 0 116 14.3 116 32l0 288-72 0c-9.6 0-18.2 5.7-22 14.5z"),n.setAttribute("fill","inherit"),e.appendChild(n),e},fe=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 16 10"),e.setAttribute("width","16px"),e.setAttribute("height","10px"),t&&e.setAttribute("class",t),[{cx:"3",cy:"3"},{cx:"8",cy:"3"},{cx:"13",cy:"3"},{cx:"3",cy:"7"},{cx:"8",cy:"7"},{cx:"13",cy:"7"}].forEach(({cx:t,cy:n})=>{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("cx",t),o.setAttribute("cy",n),o.setAttribute("r","1.5"),o.setAttribute("fill","currentColor"),e.appendChild(o)}),e},ve=t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.setAttribute("role","img"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("viewBox","0 0 512 512"),e.setAttribute("height","1em"),t&&e.setAttribute("class",t);const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"),n.setAttribute("fill","inherit"),e.appendChild(n),e};function we(t){return{pinnedLeft:t.filter(t=>"left"===t.pinned),unpinned:t.filter(t=>!t.pinned),pinnedRight:t.filter(t=>"right"===t.pinned)}}function me(t,e){return!0===t.isEssential||e.has(t.accessor+"")}function ge(t,e){let n=!1;for(const o of t){if(o.isSelectionColumn||o.excludeFromRender)continue;const t=me(o,e);if(t&&n)return!1;t||(n=!0)}return!0}function xe(t,e){var n;const{pinnedLeft:o,unpinned:i,pinnedRight:s}=we(t);if(!ge(o,e))return!1;if(!ge(i,e))return!1;if(!ge(s,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!be(o.children,e))return!1;return!0}function be(t,e){var n;if(!ge(t,e))return!1;for(const o of t)if((null===(n=o.children)||void 0===n?void 0:n.length)&&!be(o.children,e))return!1;return!0}function ye(t){const{pinnedLeft:e,unpinned:n,pinnedRight:o}=we(t);return{left:e.map(t=>t.accessor),main:n.map(t=>t.accessor),right:o.map(t=>t.accessor)}}function Re(t,e,n){return[...t.filter(t=>me(e.get(t+""),n)),...t.filter(t=>!me(e.get(t+""),n))]}function Ce(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=Re(e.left,s,n),l=Re(e.main,s,n),a=Re(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 Se(t,e,n,o){const i=e+"",s=ye(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&&(!me(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),Ce(t,{left:r,main:l,right:a},o)):null}class Ie{static resolveIcons(t){var e,n,o,i,s,r,l,a,d,c,h,u,p,f,v,w,m,g;const x={drag:fe("st-drag-icon"),expand:he("st-expand-icon"),filter:ve("st-header-icon"),headerCollapse:he("st-header-icon"),headerExpand:ce("st-header-icon"),next:he("st-next-prev-icon"),prev:ce("st-next-prev-icon"),sortDown:pe("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:x.drag,expand:null!==(i=null===(o=t.icons)||void 0===o?void 0:o.expand)&&void 0!==i?i:x.expand,filter:null!==(r=null===(s=t.icons)||void 0===s?void 0:s.filter)&&void 0!==r?r:x.filter,headerCollapse:null!==(a=null===(l=t.icons)||void 0===l?void 0:l.headerCollapse)&&void 0!==a?a:x.headerCollapse,headerExpand:null!==(c=null===(d=t.icons)||void 0===d?void 0:d.headerExpand)&&void 0!==c?c:x.headerExpand,next:null!==(u=null===(h=t.icons)||void 0===h?void 0:h.next)&&void 0!==u?u:x.next,prev:null!==(f=null===(p=t.icons)||void 0===p?void 0:p.prev)&&void 0!==f?f:x.prev,sortDown:null!==(w=null===(v=t.icons)||void 0===v?void 0:v.sortDown)&&void 0!==w?w:x.sortDown,sortUp:null!==(g=null===(m=t.icons)||void 0===m?void 0:m.sortUp)&&void 0!==g?g:x.sortUp}}static mergeCustomTheme(e){return Object.assign(Object.assign({},t),e.customTheme)}static mergeColumnEditorConfig(t){var e,n,o,i,s,r,l,a,d,c,h;return{text:null!==(n=null===(e=t.columnEditorConfig)||void 0===e?void 0:e.text)&&void 0!==n?n:"Columns",searchEnabled:null===(i=null===(o=t.columnEditorConfig)||void 0===o?void 0:o.searchEnabled)||void 0===i||i,searchPlaceholder:null!==(r=null===(s=t.columnEditorConfig)||void 0===s?void 0:s.searchPlaceholder)&&void 0!==r?r:"Search columns...",allowColumnPinning:null===(a=null===(l=t.columnEditorConfig)||void 0===l?void 0:l.allowColumnPinning)||void 0===a||a,searchFunction:null===(d=t.columnEditorConfig)||void 0===d?void 0:d.searchFunction,rowRenderer:null===(c=t.columnEditorConfig)||void 0===c?void 0:c.rowRenderer,customRenderer:null===(h=t.columnEditorConfig)||void 0===h?void 0:h.customRenderer}}static buildEssentialAccessors(t){return function(t){const e=new Set,n=t=>{var o;for(const i of t)i.isEssential&&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 ee(null===(e=t.expandAll)||void 0===e||e,t.rowGrouping)}}class He{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;const s=null!==(n=e.theme)&&void 0!==n?n:"modern-light",r=null!==(o=e.className)&&void 0!==o?o:"",l=null!==(i=e.columnBorders)&&void 0!==i&&i,a=document.createElement("div");a.className=`simple-table-root st-wrapper theme-${s} ${r} ${l?"st-column-borders":""}`;const d=document.createElement("div");d.className="st-wrapper-container";const c=document.createElement("div");c.className="st-content-wrapper";const h=document.createElement("div");h.className="st-content",h.setAttribute("role",Array.isArray(e.rowGrouping)&&e.rowGrouping.length>0?"treegrid":"grid"),h.style.width=e.editColumns?"calc(100% - 29.5px)":"100%";const u=document.createElement("div");u.className="st-header-container",u.setAttribute("role","rowgroup"),this.refs.headerContainerRef.current=u;const p=document.createElement("div");p.className="st-body-container",p.setAttribute("role","rowgroup"),p.setAttribute("tabindex","0"),this.refs.tableBodyContainerRef.current=p;const f=document.createElement("div");f.id="st-footer-container";const v="top"===e.footerPosition;v&&a.classList.add("st-footer-position-top");const w=document.createElement("div");return w.setAttribute("aria-live","polite"),w.setAttribute("aria-atomic","true"),w.className="st-sr-only",h.appendChild(u),h.appendChild(p),c.appendChild(h),v?(d.appendChild(f),d.appendChild(c)):(d.appendChild(c),d.appendChild(f)),a.appendChild(d),a.appendChild(w),t.appendChild(a),this.elements={rootElement:a,wrapperContainer:d,contentWrapper:c,content:h,headerContainer:u,bodyContainer:p,footerContainer:f,ariaLiveRegion:w},this.elements}updateTheme(t){if(!this.elements)return;const e=this.elements.rootElement,n=e.className.replace(/\btheme-\S+/g,"").trim();e.className=`${n} theme-${t}`}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 Me=(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))),b(i,"click",n=>{n.stopPropagation(),e.onSort(t.accessor)}),b(i,"keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.onSort(t.accessor))}),i},ke={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"},Ee=t=>{switch(t){case"string":return["equals","notEquals","contains","notContains","startsWith","endsWith","isEmpty","isNotEmpty"];case"number":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","between","notBetween","isEmpty","isNotEmpty"];case"boolean":return["equals","isEmpty","isNotEmpty"];case"date":return["equals","notEquals","before","after","between","notBetween","isEmpty","isNotEmpty"];case"enum":return["in","notIn","isEmpty","isNotEmpty"];default:return["equals","notEquals","isEmpty","isNotEmpty"]}},Te=t=>!["between","notBetween","in","notIn","isEmpty","isNotEmpty"].includes(t),Oe=t=>["between","notBetween","in","notIn"].includes(t),Ae=t=>["isEmpty","isNotEmpty"].includes(t),We=t=>{var e;return null!==(e=null==t?void 0:t.closest(".simple-table-root"))&&void 0!==e?e:null},Pe=t=>{var e,n,o;let{children:i,containerRef:s,mainBodyRef:r,anchorElement:l,onClose:a,open:d,overflow:c="auto",width:h,maxWidth:u,positioning:p="fixed",allowDescendantOverflow:f=!1}=t,v=f;const w="st-dropdown-content--allow-descendant-overflow",m=document.createElement("div");m.className="st-dropdown-content",v&&m.classList.add(w),m.style.position=p,m.style.overflow=v?"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(i);let g=l;if("fixed"===p){const t=null!==(o=null!==(n=null!==(e=We(g))&&void 0!==e?e:We(null!=r?r:null))&&void 0!==n?n:We(null!=s?s:null))&&void 0!==o?o:document.querySelector(".simple-table-root");(null!=t?t:document.body).appendChild(m)}const x=t=>{d&&m&&!m.contains(t.target)&&(C(!1),null==a||a())},b=t=>{const e=t.target;if(!m.contains(e)&&!(null==g?void 0:g.contains(e))){if("absolute"===p){const t=m.parentElement;if(null==t?void 0:t.contains(e))return}C(!1),null==a||a()}},y=t=>{"Escape"===t.key&&d&&(C(!1),null==a||a())},R=t=>{"Enter"===t.key&&b(t)},C=t=>{d=t,d?(m.style.display="flex",(()=>{if(!d)return;if("absolute"===p&&!m.parentElement)return;if("fixed"===p&&!m.parentElement)return;m.style.visibility="hidden";const t=g||m.parentElement;t&&requestAnimationFrame(()=>{const e=t.getBoundingClientRect(),n=m.offsetHeight,o=h||m.offsetWidth;let i;i=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=i.bottom-e.bottom,a=e.top-i.top;let d="bottom";(n>l&&a>=n||n>l&&a>l)&&(d="top");let c="left";if(o>i.right-e.right+e.width&&(c="right"),"fixed"===p)"bottom"===d?(m.style.top=e.bottom+4+"px",m.style.bottom="auto"):(m.style.bottom=window.innerHeight-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left+"px",m.style.right="auto"):(m.style.right=window.innerWidth-e.right+"px",m.style.left="auto");else{const t=m.parentElement;if(!t)return;const n=t.getBoundingClientRect();"bottom"===d?(m.style.top=e.bottom-n.top+4+"px",m.style.bottom="auto"):(m.style.bottom=n.bottom-e.top+4+"px",m.style.top="auto"),"left"===c?(m.style.left=e.left-n.left+"px",m.style.right="auto"):(m.style.right=n.right-e.right+"px",m.style.left="auto")}m.className=`st-dropdown-content st-dropdown-${d}-${c}${v?" "+w:""}`,m.style.visibility="visible"})})(),window.addEventListener("scroll",x,!0),document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",R,!0),document.addEventListener("keydown",y)):(m.style.display="none",window.removeEventListener("scroll",x,!0),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",R,!0),document.removeEventListener("keydown",y))};return d?C(!0):m.style.display="none",{element:m,update:t=>{void 0!==t.anchorElement&&(g=t.anchorElement),void 0!==t.open&&C(t.open),void 0!==t.children&&(m.innerHTML="",m.appendChild(t.children)),void 0!==t.width&&(h=t.width,m.style.width=h?h+"px":"auto"),void 0!==t.maxWidth&&(u=t.maxWidth,m.style.maxWidth=u?u+"px":""),void 0!==t.overflow&&(c=t.overflow,m.style.overflow=v?"visible":c),void 0!==t.allowDescendantOverflow&&(v=t.allowDescendantOverflow,m.classList.toggle(w,v),m.style.overflow=v?"visible":c)},destroy:()=>{C(!1),m.remove()},setOpen:C}},$e=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 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 p=document.createElement("span");p.className="st-custom-select-value";const f=o.find(t=>t.value===e);p.textContent=f?f.label:i;const v=document.createElement("template");v.innerHTML='<svg\n class="st-custom-select-arrow"\n width="12"\n height="12"\n viewBox="0 0 12 12"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M3 4.5L6 7.5L9 4.5"\n stroke="currentColor"\n stroke-width="1.5"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>';const w=v.content.firstElementChild;u.appendChild(p),u.appendChild(w),h.appendChild(u);const m=document.createElement("div");m.className="st-custom-select-options",m.setAttribute("role","listbox");const g=()=>{m.innerHTML="",o.forEach((t,n)=>{const o=document.createElement("div");o.className=`st-custom-select-option ${t.value===e?"st-custom-select-option-selected":""} ${n===c?"st-custom-select-option-focused":""}`.trim(),o.setAttribute("role","option"),o.setAttribute("aria-selected",""+(t.value===e)),o.setAttribute("tabindex","0"),o.textContent=t.label,o.addEventListener("click",()=>y(t.value)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t.value))}),m.appendChild(o)})};g();const x=Pe({children:m,containerRef:l,mainBodyRef:a,anchorElement:u,onClose:()=>{S(!1)},open:d,overflow:"auto",positioning:"absolute"});h.appendChild(x.element);const b=t=>{e=t;const n=o.find(t=>t.value===e);p.textContent=n?n.label:i},y=t=>{b(t),n(t),S(!1),c=-1,g()},R=()=>{if(!r){if(S(!d),d)c=-1;else{const t=o.findIndex(t=>t.value===e);c=0>t?0:t}g()}},C=t=>{if(d)switch(t.key){case"ArrowDown":t.preventDefault(),c=o.length-1>c?c+1:0,g();break;case"ArrowUp":t.preventDefault(),c=c>0?c-1:o.length-1,g();break;case"Enter":if(t.preventDefault(),c>=0){const t=o[c].value;b(t),n(t),S(!1),c=-1,g()}break;case"Escape":t.preventDefault(),S(!1),c=-1,g()}},S=t=>{d=t,u.setAttribute("aria-expanded",""+d),d?(h.classList.add("st-custom-select-open"),document.addEventListener("keydown",C)):(h.classList.remove("st-custom-select-open"),document.removeEventListener("keydown",C)),x.setOpen(d)};return u.addEventListener("click",R),{element:h,update:t=>{if(void 0!==t.value){e=t.value;const n=o.find(t=>t.value===e);p.textContent=n?n.label:i,g()}void 0!==t.options&&(o=t.options,g()),void 0!==t.disabled&&(r=t.disabled,u.disabled=r,r?h.classList.add("st-custom-select-disabled"):h.classList.remove("st-custom-select-disabled")),void 0!==t.onChange&&(n=t.onChange)},destroy:()=>{u.removeEventListener("click",R),document.removeEventListener("keydown",C),x.destroy(),h.remove()},setOpen:S}},Fe=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&&setTimeout(()=>c.focus(),0);const h=t=>{o(t.target.value)},u=t=>{"Enter"===t.key&&i&&(t.preventDefault(),i())};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&&(o=t.onChange),void 0!==t.onEnter&&(i=t.onEnter)},destroy:()=>{c.removeEventListener("input",h),c.removeEventListener("keydown",u),c.remove()}}},Le=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()},h=()=>{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 h(),{element:s,update:t=>{void 0!==t.canApply&&(o=t.canApply,l()),void 0!==t.showClear&&(i=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()}}},De=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),f()},d=()=>{i=new Date(i.getFullYear(),i.getMonth()+1,1),f()},c=t=>{i=new Date(t,i.getMonth(),1),s="months",f()},h=t=>{const o=i.getFullYear(),s=i.getMonth(),r=new Date(o,s,t,12,0,0);i=r,e(r),null==n||n()},u=t=>{const o=new Date(i.getFullYear(),i.getMonth()-1,t,12,0,0);i=o,e(o),null==n||n()},p=t=>{const o=new Date(i.getFullYear(),i.getMonth()+1,t,12,0,0);i=o,e(o),null==n||n()},f=()=>{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.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',e.addEventListener("click",a);const n=document.createElement("div");n.className="st-datepicker-header-label",n.textContent=`${v=i,v.toLocaleString("default",{month:"long"})} ${i.getFullYear()}`,n.addEventListener("click",()=>{s="months",f()});const o=document.createElement("button");o.className="st-datepicker-nav-btn",o.innerHTML='<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',o.addEventListener("click",d),t.appendChild(e),t.appendChild(n),t.appendChild(o)}else if("months"===s){const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent=""+i.getFullYear(),e.addEventListener("click",()=>{s="years",f()}),t.appendChild(e)}else{const e=document.createElement("div");e.className="st-datepicker-header-label",e.textContent="Select Year",t.appendChild(e)}var v;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",()=>u(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",()=>h(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",()=>p(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",f()})(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 x=document.createElement("button");x.className="st-datepicker-today-btn",x.textContent="Today",x.addEventListener("click",()=>{const t=new Date,o=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);i=o,e(o),null==n||n()}),g.appendChild(x),r.appendChild(g)};return f(),{element:r,update:t=>{void 0!==t.value&&(o=t.value,i=o||new Date,f()),void 0!==t.onChange&&(e=t.onChange),void 0!==t.onClose&&(n=t.onClose)},destroy:()=>{r.remove()}}},Be=()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("role","img"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("viewBox","0 0 448 512"),t.setAttribute("class","st-checkbox-checkmark"),t.style.height="10px";const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"),t.appendChild(e),t},je=(t,e)=>{const n=t.querySelector(".st-checkbox-input"),o=t.querySelector(".st-checkbox-custom");n&&o&&n.checked!==e&&(n.checked=e,n.setAttribute("aria-checked",e+""),o.className="st-checkbox-custom "+(e?"st-checked":""),o.setAttribute("aria-hidden","true"),o.innerHTML="",e&&o.appendChild(Be()))},ze=({checked:t,onChange:e,ariaLabel:n})=>{const o=document.createElement("label");o.className="st-checkbox-label";const i=document.createElement("input");i.type="checkbox",i.checked=t,i.className="st-checkbox-input",n&&i.setAttribute("aria-label",n),i.setAttribute("aria-checked",""+t);const s=document.createElement("span");s.className="st-checkbox-custom "+(t?"st-checked":""),s.setAttribute("aria-hidden","true"),t&&s.appendChild(Be());const r=()=>{const t=i.checked;i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.appendChild(Be())):(s.classList.remove("st-checked"),s.innerHTML=""),e(t)};return i.addEventListener("change",r),i.addEventListener("keydown",t=>{" "===t.key&&t.stopPropagation()}),o.addEventListener("mousedown",t=>{t.stopPropagation()}),o.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),o.appendChild(i),o.appendChild(s),{element:o,update:t=>{i.checked!==t&&(i.checked=t,i.setAttribute("aria-checked",""+t),t?(s.classList.add("st-checked"),s.innerHTML="",s.appendChild(Be())):(s.classList.remove("st-checked"),s.innerHTML=""))},destroy:()=>{i.removeEventListener("change",r)}}},Ne=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,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"";const d=Ee("string"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=$e({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:ke[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,v=null;const w=()=>{const t=Object.assign({accessor:e.accessor,operator:l},Te(l)&&{value:a});o(t)},m=()=>Ae(l)||""!==a.trim(),g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Te(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=Fe({type:"text",value:a,onChange:t=>{a=t,v&&v.update({canApply:m()})},onEnter:w,placeholder:"Filter...",autoFocus:!0}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),v&&v.update({canApply:m()})};return v=Le({onApply:w,onClear:i,canApply:m(),showClear:!!n}),c.appendChild(v.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"contains",a=((null==n?void 0:n.value)||"")+"",u.update({value:l}),f&&f.update({value:a}),v&&v.update({showClear:!!n,canApply:m()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),v&&v.destroy(),c.remove()}}})(t);case"number":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==i?void 0:i.operator)||"equals",c=((null==i?void 0:i.value)||"")+"",h=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=Ee("number"),f=document.createElement("div");f.className="st-filter-container";const v=document.createElement("div");v.className="st-filter-section";const w=$e({value:d,onChange:t=>{d=t,S()},options:p.map(t=>({value:t,label:ke[t]})),containerRef:l,mainBodyRef:a});v.appendChild(w.element),f.appendChild(v);let m=null,g=null,x=null,b=null,y=null;const R=()=>{const t={accessor:o.accessor,operator:d};Te(d)?t.value=parseFloat(c):Oe(d)&&(t.values=[parseFloat(h),parseFloat(u)]),s(t)},C=()=>!!Ae(d)||(Te(d)?""!==c.trim():!!Oe(d)&&""!==h.trim()&&""!==u.trim()),S=()=>{m&&(m.remove(),m=null),g&&(g.destroy(),g=null),x&&(x.destroy(),x=null),b&&(b.destroy(),b=null),Te(d)?(m=document.createElement("div"),m.className="st-filter-section",g=Fe({type:"number",value:c,onChange:t=>{c=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"Enter number...",autoFocus:!0}),m.appendChild(g.element),f.insertBefore(m,f.lastChild)):Oe(d)&&(m=document.createElement("div"),m.className="st-filter-section",x=Fe({type:"number",value:h,onChange:t=>{h=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"From...",autoFocus:!0}),x.element.classList.add("st-filter-input-range-from"),b=Fe({type:"number",value:u,onChange:t=>{u=t,y&&y.update({canApply:C()})},onEnter:R,placeholder:"To..."}),m.appendChild(x.element),m.appendChild(b.element),f.insertBefore(m,f.lastChild)),y&&y.update({canApply:C()})};return y=Le({onApply:R,onClear:r,canApply:C(),showClear:!!i}),f.appendChild(y.element),S(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,d=(null==i?void 0:i.operator)||"equals",c=((null==i?void 0:i.value)||"")+"",h=((null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||"")+"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",w.update({value:d}),g&&g.update({value:c}),x&&x.update({value:h}),b&&b.update({value:u}),y&&y.update({showClear:!!i,canApply:C()}),S())},destroy:()=>{w.destroy(),g&&g.destroy(),x&&x.destroy(),b&&b.destroy(),y&&y.destroy(),f.remove()}}})(t);case"boolean":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter:i,containerRef:s,mainBodyRef:r}=t,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true";const d=Ee("boolean"),c=document.createElement("div");c.className="st-filter-container";const h=document.createElement("div");h.className="st-filter-section";const u=$e({value:l,onChange:t=>{l=t,g()},options:d.map(t=>({value:t,label:ke[t]})),containerRef:s,mainBodyRef:r});h.appendChild(u.element),c.appendChild(h);let p=null,f=null,v=null;const w=()=>Ae(l)||""!==a,m=[{value:"true",label:"True"},{value:"false",label:"False"}],g=()=>{p&&(p.remove(),p=null),f&&(f.destroy(),f=null),Te(l)&&(p=document.createElement("div"),p.className="st-filter-section",f=$e({value:a,onChange:t=>{a=t,v&&v.update({canApply:w()})},options:m,containerRef:s,mainBodyRef:r}),p.appendChild(f.element),c.insertBefore(p,c.lastChild)),v&&v.update({canApply:w()})};return v=Le({onApply:()=>{const t={accessor:e.accessor,operator:l};Te(l)&&(t.value="true"===a),o(t)},onClear:i,canApply:w(),showClear:!!n}),c.appendChild(v.element),g(),{element:c,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.operator)||"equals",a=void 0!==(null==n?void 0:n.value)?n.value+"":"true",u.update({value:l}),f&&f.update({value:a}),v&&v.update({showClear:!!n,canApply:w()}),g())},destroy:()=>{u.destroy(),f&&f.destroy(),v&&v.destroy(),c.remove()}}})(t);case"date":return(t=>{var e,n;let{header:o,currentFilter:i,onApplyFilter:s,onClearFilter:r,containerRef:l,mainBodyRef:a}=t,d=(null==i?void 0:i.operator)||"equals",c=(null==i?void 0:i.value)?i.value+"":"",h=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"";const p=Ee("date"),f=document.createElement("div");f.className="st-filter-container";const v=document.createElement("div");v.className="st-filter-section";const w=$e({value:d,onChange:t=>{d=t,O()},options:p.map(t=>({value:t,label:ke[t]})),containerRef:l,mainBodyRef:a});v.appendChild(w.element),f.appendChild(v);let m=null,g=null,x=null,b=null,y=null,R=null,C=null,S=null,I=null,H=null,M=null;const k=()=>!!Ae(d)||(Te(d)?""!==c.trim():!!Oe(d)&&""!==h.trim()&&""!==u.trim()),E=t=>{if(!t)return"";const e=Wt(t);return isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},T=(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=E(t),s.placeholder=n,s.readOnly=!0,s.style.cursor="pointer",o&&setTimeout(()=>s.focus(),0);let r=!1;const d=t?Wt(t):new Date,c=De({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=Pe({children:c.element,containerRef:l,mainBodyRef:a,anchorElement:s,onClose:()=>{r=!1},open:!1,overflow:"hidden",positioning:"absolute",width:240});i.appendChild(s),i.appendChild(h.element);const u=()=>{r=!r,h.setOpen(r)},p=t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),r=!r,h.setOpen(r)):"Escape"===t.key&&(r=!1,h.setOpen(!1))};return s.addEventListener("click",u),s.addEventListener("keydown",p),{container:i,input:s,picker:c,dropdown:h,destroy:()=>{s.removeEventListener("click",u),s.removeEventListener("keydown",p),c.destroy(),h.destroy(),i.remove()}}},O=()=>{if(m&&(m.remove(),m=null),g&&(g=null),x&&(x=null),b&&(b=null),y&&(y.destroy(),y=null),R&&(R.destroy(),R=null),C&&(C.destroy(),C=null),S&&(S.destroy(),S=null),I&&(I.destroy(),I=null),H&&(H.destroy(),H=null),Te(d)){m=document.createElement("div"),m.className="st-filter-section";const t=T(c,t=>{c=t,M&&M.update({canApply:k()})},"Select date...",!0);g=t.container,y=t.picker,S=t.dropdown,m.appendChild(g),f.insertBefore(m,f.lastChild)}else if(Oe(d)){m=document.createElement("div"),m.className="st-filter-section";const t=T(h,t=>{h=t,M&&M.update({canApply:k()})},"From date...",!0);t.input.classList.add("st-filter-input-range-from");const e=T(u,t=>{u=t,M&&M.update({canApply:k()})},"To date...",!1);x=t.container,R=t.picker,I=t.dropdown,b=e.container,C=e.picker,H=e.dropdown,m.appendChild(x),m.appendChild(b),f.insertBefore(m,f.lastChild)}M&&M.update({canApply:k()})};return M=Le({onApply:()=>{const t={accessor:o.accessor,operator:d};Te(d)?t.value=c:Oe(d)&&(t.values=[h,u]),s(t)},onClear:r,canApply:k(),showClear:!!i}),f.appendChild(M.element),O(),{element:f,update:t=>{var e,n;void 0!==t.currentFilter&&(i=t.currentFilter,d=(null==i?void 0:i.operator)||"equals",c=(null==i?void 0:i.value)?i.value+"":"",h=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])?i.values[0]+"":"",u=((null===(n=null==i?void 0:i.values)||void 0===n?void 0:n[1])||"")+"",w.update({value:d}),M&&M.update({showClear:!!i,canApply:k()}),O())},destroy:()=>{w.destroy(),y&&y.destroy(),R&&R.destroy(),C&&C.destroy(),S&&S.destroy(),I&&I.destroy(),H&&H.destroy(),M&&M.destroy(),f.remove()}}})(t);case"enum":return(t=>{let{header:e,currentFilter:n,onApplyFilter:o,onClearFilter: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 h=document.createElement("div");h.className="st-enum-filter-options";const u=document.createElement("div");u.className="st-enum-select-all";const p=ze({checked:l.length===r.length,onChange:t=>{l=t?[...r]:[],x(),y&&y.update({canApply:b()})}}),f=document.createElement("span");f.className="st-enum-option-label st-enum-select-all-label",f.textContent="Select All",p.element.appendChild(f),u.appendChild(p.element),h.appendChild(u);let v=null,w=null;s.length>10&&(v=document.createElement("div"),v.className="st-enum-search",w=Fe({type:"text",value:a,onChange:t=>{a=t,x()},placeholder:"Search..."}),v.appendChild(w.element),h.appendChild(v));const m=document.createElement("div");h.appendChild(m);const g=[],x=()=>{m.innerHTML="",g.forEach(t=>t.checkbox.destroy()),g.length=0;const t=a?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=ze({checked:l.includes(t.value),onChange:()=>{l=l.includes(t.value)?l.filter(e=>e!==t.value):[...l,t.value];const e=l.length===r.length;p.element.querySelector("input").checked=e,y&&y.update({canApply:b()})}}),n=document.createElement("span");n.className="st-enum-option-label",n.textContent=t.label,e.element.appendChild(n),m.appendChild(e.element),g.push({container:e.element,checkbox:e,value:t.value})});const e=l.length===r.length;p.element.querySelector("input").checked=e};x(),c.appendChild(h),d.appendChild(c);const b=()=>0!==l.length&&l.length!==r.length,y=Le({onApply:()=>{l.length!==r.length?o({accessor:e.accessor,operator:"in",values:l}):i()},onClear:i,canApply:b(),showClear:!!n});return d.appendChild(y.element),{element:d,update:t=>{void 0!==t.currentFilter&&(n=t.currentFilter,l=(null==n?void 0:n.values)?n.values.map(String):r,a="",w&&w.update({value:a}),x(),y&&y.update({showClear:!!n,canApply:b()}))},destroy:()=>{p.destroy(),w&&w.destroy(),g.forEach(t=>t.checkbox.destroy()),y&&y.destroy(),d.remove()}}})(t)}},qe=(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}d&&(d.style.fill=r?"var(--st-button-active-background-color)":"var(--st-header-icon-color)");let c=!1,h=null,u=null;const p=n=>{if(n.stopPropagation(),c=!c,l.setAttribute("aria-expanded",c+""),c){const n=t=>{o(t),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-button-active-background-color)")},s=()=>{i(t.accessor),c=!1,l.setAttribute("aria-expanded","false"),u&&(u.destroy(),u=null),h&&(h.destroy(),h=null),d&&(d.style.fill="var(--st-header-icon-color)")},a=e.mainBodyRef.current||void 0;h=Ne({header:t,currentFilter:r,onApplyFilter:n,onClearFilter:s,containerRef:a,mainBodyRef:a}),u=Pe({children:h.element,containerRef:a,mainBodyRef:a,anchorElement:l,onClose:()=>{c=!1,l.setAttribute("aria-expanded","false"),h&&(h.destroy(),h=null)},open:!0,positioning:"fixed",maxWidth:280,allowDescendantOverflow:!0})}else u&&(u.destroy(),u=null),h&&(h.destroy(),h=null)};return b(l,"click",p),b(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p(t))}),l},Ve=(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")||document.querySelector(".simple-table-root");"fixed"===n.positioning?s?s.appendChild(i):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 l=e=>{const n=e.target;i.contains(n)||t.contains(n)||c()},a=t=>{"Escape"===t.key&&(t.preventDefault(),c())},d=t=>{i.contains(t.target)||c()},c=()=>{i.remove(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",d,!0),n.onClose()};return setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",a,!0),window.addEventListener("scroll",d,!0)},0),r(i,"mousedown",t=>{t.stopPropagation()}),i},Ge=(t,e)=>new Date(t,e+1,0).getDate(),Ke=["January","February","March","April","May","June","July","August","September","October","November","December"],Ue=["Su","Mo","Tu","We","Th","Fr","Sa"],Je=(t,e,n)=>{const{header:o,row:i}=t,s=Y(i,o.accessor);return"boolean"===o.type?((t,e,n,o)=>{var i;const{header:s,row:l,rowIndex:a}=t;let d;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 h=document.createElement("div");h.className="st-dropdown-item "+(!1===n?"selected":""),h.textContent="False",h.setAttribute("role","option"),h.setAttribute("aria-selected",(!1===n)+""),h.setAttribute("aria-disabled","false");const u=t=>{X(l,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:l,rowIndex:a}),d.remove(),o()};r(c,"click",()=>u(!0)),r(h,"click",()=>u(!1));const p=t=>{const e=t;"ArrowDown"===e.key||"ArrowUp"===e.key?(e.preventDefault(),document.activeElement===c?h.focus():c.focus()):"Enter"===e.key&&(e.preventDefault(),document.activeElement===c?u(!0):document.activeElement===h&&u(!1))};c.setAttribute("tabindex","0"),h.setAttribute("tabindex","0"),r(c,"keydown",p),r(h,"keydown",p);const f=document.createDocumentFragment();f.appendChild(c),f.appendChild(h);const v=U({accessor:s.accessor,rowId:null!==(i=t.stableRowKey)&&void 0!==i?i:t.rowId}),w=document.getElementById(v);return d=Ve(w||document.body,f,{width:120,positioning:"fixed",onClose:o}),d})(t,e,!!s,n):"enum"===o.type?((t,e,n,o)=>{var i;const{header:s,row:l,rowIndex:a}=t,d=s.enumOptions||[];let c;const h=t=>{X(l,s.accessor,t),e.onCellEdit&&e.onCellEdit({accessor:s.accessor,newValue:t,row:l,rowIndex:a}),c.remove(),o()},u=[];d.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,r(o,"click",()=>h(t.value)),u.push(o)});const p=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&&h(t)}};u.forEach(t=>{r(t,"keydown",p)});const f=document.createElement("div");f.className="st-enum-dropdown-content",u.forEach(t=>f.appendChild(t));const v=U({accessor:s.accessor,rowId:null!==(i=t.stableRowKey)&&void 0!==i?i:t.rowId}),w=document.getElementById(v);return c=Ve(w||document.body,f,{width:150,maxHeight:300,positioning:"fixed",onClose:o}),setTimeout(()=>{const t=d.findIndex(t=>t.value===n);t>=0&&u[t]?(u[t].focus(),u[t].scrollIntoView({block:"nearest"})):u.length>0&&u[0].focus()},0),c})(t,e,(s||"")+"",n):"date"===o.type?((t,e,n,o)=>{var i,s,l;const{header:a,row:d,rowIndex:c}=t;let h,u;try{u=n?Ot(n+""):new Date}catch(t){u=new Date}let p=u.getFullYear(),f=u.getMonth();const v=document.createElement("div");v.className="st-datepicker";const w=document.createElement("div");w.className="st-datepicker-header";const m=document.createElement("button");m.className="st-datepicker-nav-btn",m.setAttribute("aria-label","Previous month");const g=null!==(i=e.icons.prev)&&void 0!==i?i:ce("st-next-prev-icon");"string"==typeof g?m.innerHTML=g:m.appendChild(g.cloneNode(!0));const x=document.createElement("div");x.className="st-datepicker-header-label",x.setAttribute("aria-hidden","true");const b=document.createElement("button");b.className="st-datepicker-nav-btn",b.setAttribute("aria-label","Next month");const y=null!==(s=e.icons.next)&&void 0!==s?s:he("st-next-prev-icon");"string"==typeof y?b.innerHTML=y:b.appendChild(y.cloneNode(!0)),w.appendChild(m),w.appendChild(x),w.appendChild(b);const R=document.createElement("div");R.className="st-datepicker-grid st-datepicker-days-grid",Ue.forEach(t=>{const e=document.createElement("div");e.className="st-datepicker-weekday",e.textContent=t,R.appendChild(e)});const C=document.createElement("div");C.className="st-datepicker-footer";const S=document.createElement("button");S.className="st-datepicker-today-btn",S.textContent="Today",r(S,"click",()=>{const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);I(e)}),C.appendChild(S),v.appendChild(w),v.appendChild(R),v.appendChild(C);const I=t=>{const n=t.toISOString().split("T")[0];X(d,a.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:a.accessor,newValue:n,row:d,rowIndex:c}),h.remove(),o()},H=()=>{var t,e,n;for(x.textContent=`${Ke[f]} ${p}`;R.children.length>7;)null===(t=R.lastElementChild)||void 0===t||t.remove();const o=Ge(p,f),i=new Date(p,f,1).getDay(),s=Ge(p,f-1),l=new Date;for(let t=0;i>t;t++){const n=s-i+t+1,o=new Date(p,f-1,n),l=document.createElement("div");l.className="st-datepicker-day other-month",l.textContent=n+"",l.setAttribute("tabindex","0"),l.setAttribute("role","button"),l.setAttribute("aria-label",`${null!==(e=Ke[f-1])&&void 0!==e?e:Ke[11]} ${n}, ${o.getFullYear()}`),r(l,"click",()=>I(o)),r(l,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(o))}),R.appendChild(l)}const a=u.getFullYear()===p&&u.getMonth()===f;for(let t=1;o>=t;t++){const e=document.createElement("div");e.className="st-datepicker-day",e.textContent=t+"",e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label",`${Ke[f]} ${t}, ${p}`),l.getFullYear()===p&&l.getMonth()===f&&l.getDate()===t&&e.classList.add("today"),a&&u.getDate()===t&&e.classList.add("selected");const n=new Date(p,f,t);r(e,"click",()=>I(n)),r(e,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(n))}),R.appendChild(e)}const d=i+o,c=Math.max(35,7*Math.ceil(d/7))-d;for(let t=1;c>=t;t++){const e=new Date(p,f+1,t),o=document.createElement("div");o.className="st-datepicker-day other-month",o.textContent=t+"",o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${null!==(n=Ke[f+1])&&void 0!==n?n:Ke[0]} ${t}, ${e.getFullYear()}`),r(o,"click",()=>I(e)),r(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I(e))}),R.appendChild(o)}};r(m,"click",()=>{f--,0>f&&(f=11,p--),H()}),r(b,"click",()=>{f++,f>11&&(f=0,p++),H()}),H();const M=U({accessor:a.accessor,rowId:null!==(l=t.stableRowKey)&&void 0!==l?l:t.rowId}),k=document.getElementById(M);return h=Ve(k||document.body,v,{width:240,overflow:"hidden",positioning:"fixed",onClose:o}),h})(t,e,s,n):((t,e,n,o)=>{const{header:i,row:s,rowIndex:l}=t,a=document.createElement("input");a.className="editable-cell-input","number"===i.type?(a.type="text",a.inputMode="decimal"):a.type="text",a.value=null!=n?n+"":"",a.setAttribute("autofocus","true"),setTimeout(()=>{a.focus(),a.select()},0);let d=!0;if("number"===i.type){const t=()=>{const t=a.value;/^-?\d*\.?\d*$/.test(t)||(a.value=t.slice(0,-1))};r(a,"input",t)}return r(a,"blur",t=>{if(!d)return void o();let n=a.value;if("number"===i.type){const t=parseFloat(a.value);n=isNaN(t)?0:t}X(s,i.accessor,n),e.onCellEdit&&e.onCellEdit({accessor:i.accessor,newValue:n,row:s,rowIndex:l}),o()}),r(a,"keydown",t=>{const e=t;e.stopPropagation(),"Enter"===e.key?(d=!0,a.blur()):"Escape"===e.key&&(d=!1,a.blur())}),r(a,"mousedown",t=>{t.stopPropagation()}),a})(t,e,s,n)},_e=(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)?Wt(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null==t?"":t+""},Ye=(t,e,n)=>{var o;const{header:i,row:s,rowIndex:r,colIndex:l,depth:a,rowId:d}=t,c=Y(s,i.accessor),h=i.isSelectionColumn&&e.enableRowSelection;if(e.isLoading||t.tableRow.isLoadingSkeleton){const t=document.createElement("div");return t.className="st-loading-skeleton",void n.appendChild(t)}if(h){const o=document.createElement("div");o.className="st-selection-cell-content";const i=document.createElement("div");i.className="st-selection-control";const s=!!e.isRowSelected&&e.isRowSelected(d+""),r=((t,e,n)=>ze({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 u=e.rowGrouping&&e.rowGrouping[a],p=!!u&&rt(s,u),f=e.rowGrouping&&e.rowGrouping.length>a,v=!e.canExpandRowGroup||e.canExpandRowGroup(s);if(i.expandable&&(p&&f&&v||i.nestedTable||e.onRowGroupExpand&&f&&v)){const o=new Set(e.expandedDepths),i=it(t.tableRow),s=lt(i,a,o,e.expandedRows,e.collapsedRows),r=an(t,e,s);n.appendChild(r)}if("lineAreaChart"===i.type&&Array.isArray(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color: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 h=void 0!==d?d:Math.min(...e),u=(void 0!==c?c:Math.max(...e))-h||1,p=o,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n+""),f.setAttribute("height",o+""),f.setAttribute("viewBox","0 0 100 "+p),f.setAttribute("preserveAspectRatio","none"),f.setAttribute("class",("st-line-area-chart "+a).trim()),f.setAttribute("shape-rendering","geometricPrecision"),f.style.display="block";const v=()=>{f.innerHTML="";const t=e.map((t,n)=>({x:n/(e.length-1)*100,y:p-(t-h)/u*p})).map((t,e)=>`${0===e?"M":"L"} ${t.x},${t.y}`).join(" "),n=`\n ${t}\n L 100,${p}\n L 0,${p}\n Z\n `,o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",n),o.setAttribute("fill",s||"var(--st-chart-fill-color)"),o.setAttribute("fill-opacity",r+""),o.setAttribute("stroke","none");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",t),a.setAttribute("fill","none"),a.setAttribute("stroke",i||"var(--st-chart-color)"),a.setAttribute("stroke-width",l+""),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),f.appendChild(o),f.appendChild(a)};return v(),{element:f,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,f.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,f.setAttribute("height",o+"")),void 0!==t.color&&(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,f.setAttribute("class",("st-line-area-chart "+a).trim())),void 0!==t.min&&(d=t.min),void 0!==t.max&&(c=t.max),v()):f.innerHTML=""},destroy:()=>{f.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(c)){const t=c.filter(t=>"number"==typeof t);if(t.length>0){const e=(t=>{let{data:e,width:n="100%",height:o=30,color:i,gap:s=2,className:r="",min:l,max:a}=t;if(!e||0===e.length)return null;const d=void 0!==l?l:Math.min(...e),c=void 0!==a?a:Math.max(...e),h=c-d||1,u=o,p=(100-s*(e.length-1))/e.length,f=0>d,v=f?u*(c/h):u,w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",n+""),w.setAttribute("height",o+""),w.setAttribute("viewBox","0 0 100 "+u),w.setAttribute("preserveAspectRatio","none"),w.setAttribute("class",("st-bar-chart "+r).trim()),w.setAttribute("shape-rendering","crispEdges"),w.style.display="block";const m=()=>{w.innerHTML="",e.forEach((t,e)=>{const n=e*(p+s),o=(t-d)/h*u;let r=u-o,l=o;f&&(0>t?(l=Math.abs(t)/h*u,r=v):(l=t/h*u,r=v-l));const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",n+""),a.setAttribute("y",r+""),a.setAttribute("width",p+""),a.setAttribute("height",l+""),a.setAttribute("fill",i||"var(--st-chart-color)"),a.setAttribute("rx","0.5"),w.appendChild(a)})};return m(),{element:w,update:t=>{void 0===t.data||(e=t.data,e&&0!==e.length)?(void 0!==t.width&&(n=t.width,w.setAttribute("width",n+"")),void 0!==t.height&&(o=t.height,w.setAttribute("height",o+"")),void 0!==t.color&&(i=t.color),void 0!==t.gap&&(s=t.gap),void 0!==t.className&&(r=t.className,w.setAttribute("class",("st-bar-chart "+r).trim())),void 0!==t.min&&(l=t.min),void 0!==t.max&&(a=t.max),m()):w.innerHTML=""},destroy:()=>{w.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:c,formattedValue:null===(o=i.valueFormatter)||void 0===o?void 0:o.call(i,{accessor:i.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=_e(c,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=_e(c,i,l,s,r);if(null!==e){const t=document.createTextNode(e);n.appendChild(t)}}return}const w=_e(c,i,l,s,r);if(null!==w){const t=document.createTextNode(w);n.appendChild(t)}},Xe=new Map,Qe=new WeakMap,Ze=new WeakMap;let tn=null;const en=(t,e)=>{Xe.has(t)||Xe.set(t,new Set),Xe.get(t).add(e)},nn=(t,e)=>{const n=Xe.get(t);n&&(n.delete(e),0===n.size&&Xe.delete(t))},on=(t,e)=>{const n=Xe.get(t);n&&n.forEach(t=>{e?t.classList.add("st-row-hovered"):t.classList.remove("st-row-hovered")})},sn=(t,e)=>{var n;const{header:o,rowIndex:i,colIndex:s,rowId:r,depth:l,isOdd:a}=t,d=o.isSelectionColumn&&e.enableRowSelection,c=!!(null==o?void 0:o.isEditable)||!(!e.onCellClick||d),h={rowIndex:i,colIndex:s,rowId:r},u=e.getBorderClass(h),p=e.isSelected(h),f=e.isInitialFocusedCell(h),v=e.isCopyFlashing(h),w=e.isWarningFlashing(h),m=e.selectedColumns.has(s),g=p&&!m,x=d&&e.rowsWithSelectedCells.has(r+""),b=(()=>{var t,n,i;if(!e.columnBorders)return!1;const s=e.headers.filter(t=>"left"===t.pinned),r=e.headers.filter(t=>!t.pinned),l=e.headers.filter(t=>"right"===t.pinned);return"left"===o.pinned?(null===(t=s[s.length-1])||void 0===t?void 0:t.accessor)===o.accessor:"right"===o.pinned?(null===(n=l[l.length-1])||void 0===n?void 0:n.accessor)===o.accessor:(null===(i=r[r.length-1])||void 0===i?void 0:i.accessor)===o.accessor})();return["st-cell","st-row-position-"+t.tableRow.position,l>0&&o.expandable?"st-cell-depth-"+l:"",g?f?"st-cell-selected-first "+u:"st-cell-selected "+u:"",m?f?"st-cell-column-selected-first":"st-cell-column-selected":"",c?"clickable":"",v?f?"st-cell-copy-flash-first":"st-cell-copy-flash":"",w?f?"st-cell-warning-flash-first":"st-cell-warning-flash":"",e.useOddColumnBackground?s%2==0?"even-column":"odd-column":"",d?"st-selection-cell":"",x?"st-selection-has-highlighted-cell":"",b?"st-last-column":"","",e.useOddEvenRowBackground?a?"st-cell-even-row":"st-cell-odd-row":"",(null===(n=e.isRowSelected)||void 0===n?void 0:n.call(e,r))?"st-cell-selected-row":""].filter(Boolean).join(" ")},rn=(t,e)=>{var n,o,i;const{header:s,row:l,rowIndex:a,colIndex:d,rowId:c}=t,h=s.isSelectionColumn&&e.enableRowSelection,u={rowIndex:a,colIndex:d,rowId:c},p=e.isInitialFocusedCell(u),f=sn(t,e),v=document.createElement("div");v.className=f,v.id=U({accessor:s.accessor,rowId:null!==(n=t.stableRowKey)&&void 0!==n?n:c}),v.setAttribute("role",void 0!==e.rowHeaderAccessor&&s.accessor===e.rowHeaderAccessor?"rowheader":"gridcell"),v.setAttribute("tabindex",p?"0":"-1");const w=null!==(o=e.maxHeaderDepth)&&void 0!==o?o:1;v.setAttribute("aria-rowindex",t.tableRow.position+w+1+""),v.setAttribute("aria-colindex",d+1+""),e.enableRowSelection&&v.setAttribute("aria-selected",(null===(i=e.isRowSelected)||void 0===i?void 0:i.call(e,c))?"true":"false"),v.setAttribute("data-row-index",a+""),v.setAttribute("data-col-index",d+""),v.setAttribute("data-row-id",c+""),v.setAttribute("data-accessor",s.accessor+""),v.style.position="absolute",v.style.left=t.left+"px",v.style.top=t.top+"px",v.style.width=t.width+"px",v.style.height=t.height+"px";let m=!1;const g="boolean"===s.type||"date"===s.type||"enum"===s.type,x=()=>{var n,o;const i=null!==(o=null===(n=Qe.get(v))||void 0===n?void 0:n.context)&&void 0!==o?o:e;if(m&&!g){v.innerHTML="",v.setAttribute("tabindex","-1");const e=Je(t,i,()=>{m=!1,v.setAttribute("tabindex",p?"0":"-1"),x(),y()});if(e){const t=document.createElement("div");t.className="st-cell-editing",t.appendChild(e),v.appendChild(t)}}else if(m&&g)Je(t,i,()=>{m=!1,x(),y()});else{v.innerHTML="";const e=document.createElement("span");e.className="st-cell-content "+("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"left-aligned"),Ye(t,i,e),v.appendChild(e)}};x();const b={row:l,tableRow:t.tableRow,context:e};Qe.set(v,b);const y=()=>{if(e.cellRegistry&&!h){const t=`${c}-${s.accessor}`;Ze.set(v,t),e.cellRegistry.set(t,{updateContent:t=>{m||(X(b.row,s.accessor,t),x(),e.cellUpdateFlash&&(v.classList.add(p?"st-cell-updating-first":"st-cell-updating"),setTimeout(()=>{v.classList.remove("st-cell-updating-first","st-cell-updating")},800)))}})}};if(y(),!m&&!h){const t=t=>{var n,o;if(t.preventDefault(),t.target.closest(".st-expand-icon-container"))return;const i=parseInt(null!==(n=v.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),s=parseInt(null!==(o=v.getAttribute("data-col-index"))&&void 0!==o?o:"-1",10),r=v.getAttribute("data-row-id");0>i||0>s||null===r||e.handleMouseDown({rowIndex:i,colIndex:s,rowId:r})},n=t=>{var n,o;const i=t,s=parseInt(null!==(n=v.getAttribute("data-row-index"))&&void 0!==n?n:"-1",10),r=parseInt(null!==(o=v.getAttribute("data-col-index"))&&void 0!==o?o:"-1",10),l=v.getAttribute("data-row-id");e.handleMouseOver(0>s||0>r||null===l?u:{rowIndex:s,colIndex:r,rowId:l},i.clientX,i.clientY)};r(v,"mousedown",t),r(v,"mouseover",n)}if(r(v,"keydown",t=>{m||h||"F2"!==t.key&&"Enter"!==t.key||!s.isEditable||m||(t.preventDefault(),m=!0,x())}),r(v,"dblclick",t=>{!s.isEditable||h||m||(m=!0,x())}),e.onCellClick&&!h){const t=t=>{var n,o,i,r,c;if(t.target.closest(".st-expand-icon-container"))return;const h=null!==(o=null===(n=Qe.get(v))||void 0===n?void 0:n.row)&&void 0!==o?o:l,u=Y(h,s.accessor),p=parseInt(null!==(i=v.getAttribute("data-row-index"))&&void 0!==i?i:a+"",10),f=parseInt(null!==(r=v.getAttribute("data-col-index"))&&void 0!==r?r:d+"",10);null===(c=e.onCellClick)||void 0===c||c.call(e,{accessor:s.accessor,colIndex:f,row:h,rowIndex:p,value:u})};r(v,"click",t)}if(e.useHoverRowBackground){const t=c+"";en(t,v);const e=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;null!==tn&&tn!==n&&on(tn,!1),on(n,!0),tn=n},n=()=>{var e;const n=null!==(e=v.getAttribute("data-row-id"))&&void 0!==e?e:t;on(n,!1),tn===n&&(tn=null)};r(v,"mouseenter",e),r(v,"mouseleave",n)}return v},ln=(t,e,n)=>{var o,i;const{rowIndex:s,colIndex:r,rowId:l}=e,a={rowIndex:s,colIndex:r,rowId:l};t.className=sn(e,n);const d=n.isInitialFocusedCell(a);t.setAttribute("tabindex",d?"0":"-1"),t.style.left=e.left+"px",t.style.top=e.top+"px";const c=t.dataset.stAccordionGrow;"horizontal"!==c&&(t.style.width=e.width+"px"),"vertical"!==c&&(t.style.height=e.height+"px"),t.setAttribute("data-row-index",s+""),t.setAttribute("data-col-index",r+"");const h=null!==(o=n.maxHeaderDepth)&&void 0!==o?o:1;t.setAttribute("aria-rowindex",e.tableRow.position+h+1+""),t.setAttribute("aria-colindex",r+1+""),n.enableRowSelection?t.setAttribute("aria-selected",(null===(i=n.isRowSelected)||void 0===i?void 0:i.call(n,l))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected");const u=void 0!==n.rowHeaderAccessor&&e.header.accessor===n.rowHeaderAccessor?"rowheader":"gridcell";t.getAttribute("role")!==u&&t.setAttribute("role",u);const p=t.getAttribute("data-row-id"),f=l+"";p&&p!==f&&(nn(p,t),en(f,t)),t.setAttribute("data-row-id",f),t.setAttribute("data-accessor",e.header.accessor+"");const v=Qe.get(t);if(v?(v.row=e.row,v.tableRow=e.tableRow,v.context=n):Qe.set(t,{row:e.row,tableRow:e.tableRow,context:n}),n.cellRegistry&&!e.header.isSelectionColumn){const o=Ze.get(t),i=`${e.rowId}-${e.header.accessor}`;if(o!==i){if(o){const t=n.cellRegistry.get(o);t&&(n.cellRegistry.delete(o),n.cellRegistry.set(i,t))}Ze.set(t,i)}}if(!e.header.expandable){const o=t.querySelector(".st-cell-content");o&&(o.innerHTML="",Ye(e,n,o))}},an=(t,e,n)=>{const o=document.createElement("div");o.className="st-icon-container st-expand-icon-container "+(n?"expanded":"collapsed"),o.setAttribute("role","button"),o.setAttribute("aria-label",n?"Collapse row":"Expand row"),o.setAttribute("aria-expanded",n+""),o.setAttribute("tabindex","0");const i=e.icons.expand;i&&("string"==typeof i?o.innerHTML=i:(i instanceof HTMLElement||i instanceof SVGSVGElement)&&o.appendChild(i.cloneNode(!0)));const s=n=>{var i;n.stopPropagation();const s=o.closest("[data-row-id]"),r=s?Qe.get(s):void 0,l=null!==(i=null==r?void 0:r.tableRow)&&void 0!==i?i:t.tableRow,a=it(l),d=l.depth,c=new Set(e.expandedDepths),h=e.getExpandedRows?e.getExpandedRows():e.expandedRows,u=e.getCollapsedRows?e.getCollapsedRows():e.collapsedRows,p=lt(a,d,c,h,u),f=!p;if(p?(e.setCollapsedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setExpandedRows(t=>{const e=new Map(t);return e.delete(a),e}),e.setRowStateMap(t=>{const e=new Map(t);return e.delete(a),e})):(e.setExpandedRows(t=>{const e=new Map(t);return e.set(a,d),e}),e.setCollapsedRows(t=>{const e=new Map(t);return e.delete(a),e})),e.onRowGroupExpand&&t.tableRow.rowIndexPath&&e.rowGrouping){const n=t.header.pinned,o=t=>{setTimeout(()=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(a)||{};return o.set(a,Object.assign(Object.assign({},i),{loading:t,triggerSection:n})),o})},0)},i=t=>{e.setRowStateMap(e=>{const o=new Map(e),i=o.get(a)||{};return o.set(a,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(a)||{};return o.set(a,Object.assign(Object.assign({},i),{isEmpty:t,loading:!1,triggerSection:n})),o})};e.onRowGroupExpand({row:t.row,depth:d,event:{stopPropagation:()=>{},preventDefault:()=>{}},groupingKey:e.rowGrouping[d],isExpanded:f,rowIndexPath:t.tableRow.rowIndexPath,rowIdPath:t.tableRow.rowPath,groupingKeys:e.rowGrouping,setLoading:o,setError:i,setEmpty:s})}};return r(o,"click",s),r(o,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s(t))}),o},dn=(t,e,n)=>{var o,i;const s=t.querySelector(".st-expand-icon-container");if(!(s&&s instanceof HTMLElement))return;if(s.classList.contains("expanded")===e)return;const r=null!==(o=null==n?void 0:n.ariaLabelWhenExpanded)&&void 0!==o?o:"Collapse row",l=null!==(i=null==n?void 0:n.ariaLabelWhenCollapsed)&&void 0!==i?i:"Expand row";requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.classList.toggle("expanded",e),s.classList.toggle("collapsed",!e),s.setAttribute("aria-label",e?r:l),s.setAttribute("aria-expanded",e+"")})})},cn=(t,e)=>{var n,o;const{icons:i}=e;if(!G(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 b(r,"click",a),b(r,"keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(t))}),r},hn=(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=hn(i.children,e,[...n,o]);if(t)return t}}return null},un=(t,e)=>{if(t.pinned)return t.pinned;const n=q(e,t.accessor);return n?un(n,e):void 0},pn=(t,e)=>{const n=un(t,e);return"left"===n?"left":"right"===n?"right":"main"};function fn(t,e,n){const o=se(t);let i=!1;function s(t,e){let n,o=t;for(let t=0;e.length-1>t;t++)o=o[e[t]].children;return n=o[e[e.length-1]],n}function r(t,e,n){let o=t;for(let t=0;e.length-1>t;t++){if(!o[e[t]].children){i=!0;break}o=o[e[t]].children}o[e[e.length-1]]=n}const l=s(o,e);return r(o,e,s(o,n)),r(o,n,l),{newHeaders:o,emergencyBreak:i}}const vn=(t,e)=>{const{mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a}=e,d=a?W:0,c=(a?i+1:i)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),h=t.querySelector(".st-horizontal-scrollbar-left"),u=null==h?void 0:h.firstElementChild;o>0&&h&&u&&(h.style.width=o+"px",u.style.width=s+"px");const p=t.querySelector(".st-horizontal-scrollbar-middle"),f=null==p?void 0:p.firstElementChild;n>0&&p&&f&&(f.style.width=n+"px");const v=t.querySelector(".st-horizontal-scrollbar-right"),w=null==v?void 0:v.firstElementChild;if(i>0&&v&&w&&(v.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")}},wn=(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()},mn=({headers:t,containerWidth:e,collapsedHeaders:n})=>{let o=0,i=0,s=0;t.forEach(t=>{if(t.hide)return;const e=at(t,n).reduce((t,e)=>t+pt(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*L(e,o>0,i>0);o>t&&(o=t),i>t&&(i=t)}return{leftWidth:N(o),rightWidth:N(i),mainWidth:s,leftContentWidth:r,rightContentWidth:l}},gn=(t,e)=>{if(t.pinned)return t.pinned;const n=q(e,t.accessor);return n?gn(n,e):void 0},xn=(t,e,n)=>{var o;const i=[],s=[],r=[];t.forEach(e=>{if(e.hide)return;const n=gn(e,t);"left"===n?i.push(e):"right"===n?r.push(e):s.push(e)});const l=(t,o,i)=>{var s,r;const a=o;if(t.children&&t.children.length>0){const r=null==e?void 0:e.has(t.accessor),d=t.children.filter(t=>{if(t.hide)return!1;const e=t.showWhen||D;return r?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const e=null!==(s=null==n?void 0:n.get(t.accessor))&&void 0!==s?s:"number"==typeof t.width?t.width:pt(t);return i.set(t.accessor,{left:a,width:e}),o=a+e,d.forEach(t=>{o=l(t,o,i)}),o}d.forEach(t=>{o=l(t,o,i)}),i.set(t.accessor,{left:a,width:o-a})}else{const e=null!==(r=null==n?void 0:n.get(t.accessor))&&void 0!==r?r:"number"==typeof t.width?t.width:pt(t);i.set(t.accessor,{left:o,width:e}),o+=e}return o},a=t=>{const e=new Map;let n=0;return t.forEach(t=>{n=l(t,n,e)}),e},d=a(i),c=a(s),h=a(r),u=new Map;d.forEach((t,e)=>u.set(e,t)),c.forEach((t,e)=>u.set(e,t)),h.forEach((t,e)=>u.set(e,t)),u.forEach((t,e)=>{const{left:n,width:o}=t,i=U({accessor:e,rowId:"header"}),s=document.getElementById(i);d.has(e),h.has(e),s&&(s.style.left=n+"px",s.style.width=o+"px"),document.querySelectorAll(`[id$="-${e}"]`).forEach(t=>{t instanceof HTMLElement&&!t.id.endsWith("-header")&&(t.style.left=n+"px",t.style.width=o+"px")})});const p=document.querySelector(".st-body-container"),f=null!==(o=null==p?void 0:p.clientWidth)&&void 0!==o?o:0,v=mn({headers:t,containerWidth:f>0?f:void 0,collapsedHeaders:e}),{leftWidth:w,rightWidth:m,mainWidth:g,leftContentWidth:x,rightContentWidth:b}=v;if(w>0){const t=document.querySelector(".st-header-pinned-left"),e=document.querySelector(".st-body-pinned-left");t&&(t.style.width=w+"px"),e&&(e.style.width=w+"px")}if(m>0){const t=document.querySelector(".st-header-pinned-right"),e=document.querySelector(".st-body-pinned-right");t&&(t.style.width=m+"px"),e&&(e.style.width=m+"px")}const y=null==p?void 0:p.closest(".simple-table-root"),R=null==y?void 0:y.querySelector(".st-horizontal-scrollbar-container"),C=null==y?void 0:y.querySelector(".st-body-main"),S=!!(null==y?void 0:y.querySelector(".st-column-editor"));R&&C&&p&&C.scrollWidth-C.clientWidth>1&&vn(R,{mainBodyRef:C,mainBodyWidth:g,pinnedLeftWidth:w,pinnedRightWidth:m,pinnedLeftContentWidth:x,pinnedRightContentWidth:b,tableBodyContainerRef:p,editColumns:S})},bn=({columnsToShrink:t,totalCompensation:e,initialWidthsMap:n})=>{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 o=e;for(;o>.5;){const e=F,i=t.map(t=>{const o=n.get(t.accessor)||100;return{column:t,headroom:Math.max(0,o-e),initialWidth:o,minWidth:e}}).filter(t=>t.headroom>0);if(0>=i.length)break;{const t=i.reduce((t,e)=>t+e.headroom,0);let e=0;const n=o;i.forEach((o,s)=>{let r=n*(o.headroom/t);r=Math.min(r,o.headroom),s===i.length-1&&(r=Math.min(n-e,o.headroom)),o.column.width=o.initialWidth-r,e+=r}),o-=e}}},yn=({childrenToResize:t=[],collapsedHeaders:e,containerWidth:n,delta:o,headers:i,initialWidthsMap:s,isParentResize:r=!1,resizedHeader:l,reverse:a,rootPinned:d,sectionHeaders:c,sectionWidth:h,startWidth:u})=>{const p=t=>{if(!d||0>=n||0>=t)return t;const e=i.some(t=>"left"===t.pinned&&!t.hide),o=i.some(t=>"right"===t.pinned&&!t.hide),r=((t,e,n)=>t*L(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=wt(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,f=r===n.length-1;let v;v="left"===d&&f||"right"===d&&l?[]:l?n.slice(r+1):f||a?n.slice(0,i):n.slice(r+1);const w=Array.from(s.values()).reduce((t,e)=>t+e,0);if(o>0){let e=o,n=!1;if(v.length>0&&w+o>(h>0?Math.max(h,w):w+Math.abs(o)+1)){n=!0;const t=v.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-F)},0);e=Math.min(o,t)}o>0&&!n&&(e=p(e));const i=(u+e)/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*i,40)}),n&&e>0&&v.length>0&&bn({columnsToShrink:v,totalCompensation:e,initialWidthsMap:s})}else{const e=t.reduce((t,e)=>t+(s.get(e.accessor)||100),0),n=Math.max(u+o,F*t.length),i=n/e;t.forEach(t=>{const e=s.get(t.accessor)||100;t.width=Math.max(e*i,40)});const r=u-n;r>0&&v.length>0&&bn({columnsToShrink:v,totalCompensation:-r,initialWidthsMap:s})}return}const f=wt(c,e),v=f.findIndex(t=>t.accessor===l.accessor);if(-1===v)return;const w=0===v,m=v===f.length-1;let g;if(g="left"===d&&m||"right"===d&&w?[]:w?f.slice(v+1):m||a?f.slice(0,v):f.slice(v+1),0===g.length){const t=F,e=o>0?p(o):o;return void(l.width=Math.max(u+e,t))}const x=Array.from(s.values()).reduce((t,e)=>t+e,0);if(o>0){if((h>0?Math.max(h,x):x+Math.abs(o)+1)>=x+o){const t=o>0?p(o):o;return void(l.width=u+t)}const t=g.reduce((t,e)=>{const n=s.get(e.accessor)||100;return t+Math.max(0,n-F)},0),e=Math.min(o,t);l.width=u+e,e>0&&bn({columnsToShrink:g,totalCompensation:e,initialWidthsMap:s})}else{const t=Math.max(u+o,40),e=u-t;l.width=t,e>0&&bn({columnsToShrink:g,totalCompensation:-e,initialWidthsMap:s})}},Rn=(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},Cn=({autoExpandColumns:t,collapsedHeaders:e,containerWidth:n,event:o,header:i,headers:s,mainBodyRef:r,onColumnWidthChange:l,reverse:a=!1,setHeaders:d,setIsResizing:c,startWidth:h})=>{o.preventDefault();const u="clientX"in o?o.clientX:o.touches[0].clientX,p="touches"in o;if(!i||i.hide)return;const f=Rn(n,r);c(!0);const v=gn(i,s),w=vt(i);let m;if(i.children&&i.children.length>0){const t=at(i,e);m=t.length>0?t:[i]}else m=[i];const g=new Map;let x=0,b=0;if(t){const t=s.filter(t=>t.pinned===v);if(wt(t,e).forEach(t=>{const e=pt(t);g.set(t.accessor,e)}),f>0){const{leftWidth:t,rightWidth:n,mainWidth:o}=mn({headers:s,containerWidth:f,collapsedHeaders:e});x="left"===v?t:"right"===v?n:o;const i=Math.max(0,f-t-n),l=null!=(null==r?void 0:r.current)&&r.current.clientWidth>0?r.current.clientWidth:0;b=l>0?Math.min(i,l):i}}let y=!1;const R=new Map;let C=[];if(t&&v&&f>0){const t=wt(s.filter(t=>t.pinned===v),e);if(t.length>0){let n=!1;if(m.length>1){const e=t.findIndex(t=>t.accessor===m[0].accessor),o=t.findIndex(t=>t.accessor===m[m.length-1].accessor);n="left"===v&&o===t.length-1||"right"===v&&0===e}else{const e=m[0]||i,o=t.findIndex(t=>t.accessor===e.accessor);n="left"===v&&o===t.length-1||"right"===v&&0===o}if(n){y=!0;const t=s.filter(t=>!t.pinned);C=wt(t,e),C.forEach(t=>{R.set(t.accessor,pt(t))})}}}const S=(n,o=!1)=>{const r="right"===v?u-n:n-u;if(t){const t=s.filter(t=>t.pinned===v);if(yn({childrenToResize:m,collapsedHeaders:e,containerWidth:f,delta:r,headers:s,initialWidthsMap:g,isParentResize:m.length>1,resizedHeader:m.length>0?m[m.length-1]:i,reverse:a,rootPinned:v,sectionHeaders:t,sectionWidth:x,startWidth:h}),y&&C.length>0){const t=m.reduce((t,e)=>{const n=g.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,b-t),n=Array.from(R.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;C.forEach((n,i)=>{const s=R.get(n.accessor)||100;i===C.length-1?n.width=e-o:(n.width=Math.round(s*t),o+=n.width)})}}}else{const t=(({header:t,headers:e,collapsedHeaders:n})=>{const o=document.querySelector(".st-body-container");if(!o||0===o.clientWidth)return 1e3;const i=o.clientWidth;if(!t.pinned)return 1/0;const s=e.some(t=>"left"===t.pinned&&!t.hide),r=e.some(t=>"right"===t.pinned&&!t.hide),l=i*L(i,s,r)-e.filter(e=>e.pinned===t.pinned&&e.accessor!==t.accessor).reduce((t,e)=>e.hide?t:t+at(e,n).reduce((t,e)=>t+pt(e),0),0),a=vt(t);return a>l?(console.warn(`Header ${t.accessor} exceeds pinned section width limit`),a):l})({header:i,headers:s,collapsedHeaders:e});m.length>1?(({delta:t,leafHeaders:e,minWidth:n,startWidth:o,maxWidth:i})=>{const s=e.reduce((t,e)=>Math.min(t,vt(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:m,minWidth:w,startWidth:h,maxWidth:t}):m[0].width=Math.max(Math.min(h+r,t),w),s.forEach(t=>{ft(t)})}if(o){const t=[...s];d(t);const n=new Map;m.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),y&&C.forEach(t=>{"number"==typeof t.width&&n.set(t.accessor,t.width)}),xn(s,e,n)}else xn(s,e)};let I=null,H=null,M=u;const k=t=>{M=t,H=t,null===I&&(I=requestAnimationFrame(()=>{null!==H&&(S(H,!1),H=null),I=null}))};if(p){const t=t=>{k(t.touches[0].clientX)},e=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("touchmove",t),document.addEventListener("touchend",e)}else{const t=t=>{k(t.clientX)},e=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),null!==I&&(cancelAnimationFrame(I),I=null),S(M,!0),c(!1),l&&l([...s])};document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)}},Sn=t=>{var e,n;const o=null===(e=t.mainBodyRef)||void 0===e?void 0:e.current;return o?null!==(n=o.closest(".simple-table-root"))&&void 0!==n?n:o:null},In=(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=In(o.children,e);if(t)return t}}},Hn=(t,e,n)=>{const{columnResizing:o}=e;if(!o||t.isSelectionColumn&&e.enableRowSelection||n)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 s=document.createElement("div");s.className="st-header-resize-handle",i.appendChild(s);const r=t=>({rows:e.rows,header:t,maxWidth:500,sampleSize:50,styleRoot:Sn(e)}),l=()=>{var n;if(e.autoExpandColumns){const o=e.getHeaders();return((t,e)=>{const n=wt(t,e);for(const t of n){const e=document.getElementById(U({accessor:t.accessor,rowId:"header"})),n=null==e?void 0:e.offsetWidth;null!=n&&n>0&&(t.width=n)}})(o,e.collapsedHeaders),{headers:o,header:null!==(n=In(o,t.accessor))&&void 0!==n?n:t}}return{headers:e.headers,header:t}};let a=0;const d=()=>{const n=Date.now();120>n-a||(a=n,(()=>{const n=document.getElementById(U({accessor:t.accessor,rowId:"header"}));if(e.autoExpandColumns){const{headers:t,header:o}=l();(({header:t,headers:e,collapsedHeaders:n,containerWidth:o,mainBodyRef:i,reverse:s,headerCellElement:r,getTargetLeafWidth:l})=>{var a;if(!t||t.hide)return;const d=Rn(o,i),c=gn(t,e);let h;if(t.children&&t.children.length>0){const e=at(t,n);h=e.length>0?e:[t]}else h=[t];const u=new Map;let p=0,f=0;const v=e.filter(t=>t.pinned===c);if(wt(v,n).forEach(t=>{const e=pt(t);u.set(t.accessor,e)}),d>0){const{leftWidth:t,rightWidth:o,mainWidth:s}=mn({headers:e,containerWidth:d,collapsedHeaders:n});p="left"===c?t:"right"===c?o:s;const r=Math.max(0,d-t-o),l=null!=(null==i?void 0:i.current)&&i.current.clientWidth>0?i.current.clientWidth:0;f=l>0?Math.min(r,l):r}let w=!1;const m=new Map;let g=[];if(c&&d>0){const o=wt(e.filter(t=>t.pinned===c),n);if(o.length>0){let i=!1;if(h.length>1){const t=o.findIndex(t=>t.accessor===h[0].accessor),e=o.findIndex(t=>t.accessor===h[h.length-1].accessor);i="left"===c&&e===o.length-1||"right"===c&&0===t}else{const e=h[0]||t,n=o.findIndex(t=>t.accessor===e.accessor);i="left"===c&&n===o.length-1||"right"===c&&0===n}if(i){w=!0;const t=e.filter(t=>!t.pinned);g=wt(t,n),g.forEach(t=>{m.set(t.accessor,pt(t))})}}}const x=h.reduce((t,e)=>t+l(e),0),b=null!==(a=null==r?void 0:r.offsetWidth)&&void 0!==a?a:h.reduce((t,e)=>t+pt(e),0);if(yn({childrenToResize:h,collapsedHeaders:n,containerWidth:d,delta:x-b,headers:e,initialWidthsMap:u,isParentResize:h.length>1,resizedHeader:h.length>0?h[h.length-1]:t,reverse:s,rootPinned:c,sectionHeaders:v,sectionWidth:p,startWidth:b}),w&&g.length>0){const t=h.reduce((t,e)=>{const n=u.get(e.accessor)||0;return t+(("number"==typeof e.width?e.width:n)-n)},0),e=Math.max(0,f-t),n=Array.from(m.values()).reduce((t,e)=>t+e,0);if(e>0&&n>0){const t=e/n;let o=0;g.forEach((n,i)=>{const s=m.get(n.accessor)||100;i===g.length-1?n.width=e-o:(n.width=Math.round(s*t),o+=n.width)})}}const y=new Map;h.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),w&&g.forEach(t=>{"number"==typeof t.width&&y.set(t.accessor,t.width)}),xn(e,n,y)})({header:o,headers:t,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,mainBodyRef:e.mainBodyRef,reverse:e.reverse,headerCellElement:n,getTargetLeafWidth:t=>mt(t.accessor,r(t))});const i=[...t];return e.setHeaders(i),void(e.onColumnWidthChange&&e.onColumnWidthChange(i))}const o=mt(t.accessor,r(t)),i=hn(e.headers,t.accessor);if(!i)return;const s=((t,e)=>{let n=t;for(let t=0;e.length-1>t;t++)n=n[e[t]].children;return n})(e.headers,i),a=i[i.length-1],d=s.map((t,e)=>e===a?Object.assign(Object.assign({},t),{width:o}):t),c=((t,e,n)=>{if(1===e.length)return n;let o=t;for(let t=0;e.length-2>t;t++)o=o[e[t]].children;return o[e[e.length-2]].children=n,t})(e.headers,i,d);c.forEach(t=>ft(t));const h=d[a],u=new Map;h&&"number"==typeof h.width&&u.set(h.accessor+"",h.width),xn(c,e.collapsedHeaders,u),e.setHeaders(c),e.onColumnWidthChange&&e.onColumnWidthChange(c)})())};return b(i,"mousedown",n=>{var o;if(n.detail>=2)return n.preventDefault(),void d();const i=null===(o=document.getElementById(U({accessor:t.accessor,rowId:"header"})))||void 0===o?void 0:o.offsetWidth;x(()=>{const{headers:t,header:o}=l();Cn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:n,forceUpdate:e.forceUpdate,header:o,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=i?i:P})},10)}),b(i,"touchstart",n=>{var o;const i=n,s=null===(o=document.getElementById(U({accessor:t.accessor,rowId:"header"})))||void 0===o?void 0:o.offsetWidth;x(()=>{const{headers:t,header:n}=l();Cn({autoExpandColumns:e.autoExpandColumns,collapsedHeaders:e.collapsedHeaders,containerWidth:e.containerWidth,event:i,forceUpdate:e.forceUpdate,header:n,headers:t,mainBodyRef:e.mainBodyRef,onColumnWidthChange:e.onColumnWidthChange,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,reverse:e.reverse,setHeaders:e.setHeaders,setIsResizing:e.setIsResizing,startWidth:null!=s?s:P})},10)}),b(i,"dblclick",d),i},Mn=(t,e,n)=>{const o=document.createElement("input");return o.type="text",o.className="st-header-edit-input",o.value=t.label||"",b(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=kn(t,e,i);s.replaceChild(o,n)}if(e.headerRegistry&&!t.isSelectionColumn){const n=e.headerRegistry.get(t.accessor+"");n&&n.setEditing(!1)}}),b(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},kn=(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){const t=(t=>{const e=!!t.areAllRowsSelected&&t.areAllRowsSelected();return ze({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 o;n&&(clearTimeout(n),n=null),e&&(null===(o=e.parentElement)||void 0===o||o.removeChild(e),e=null),n=setTimeout(()=>{if(!s.isConnected)return void(n=null);const o=s.getBoundingClientRect();if(o.width>0&&o.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,i=40;let r=o.left+o.width/2-n/2,l=o.bottom+8;8>r?r=8:r+n>window.innerWidth-8&&(r=window.innerWidth-n-8),l+i>window.innerHeight-8&&(l=o.top-i-8),e.style.top=l+"px",e.style.left=r+"px",(s.closest(".simple-table-root")||document.body).appendChild(e)}n=null},500)},i=()=>{var t;n&&(clearTimeout(n),n=null),e&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e),e=null)};b(s,"mouseenter",o),b(s,"mouseleave",i)}return s},En=(t,e,n,o)=>{const{columnReordering:i,draggedHeaderRef:s,hoveredHeaderRef:r}=o;!i||n.disableReorder||n.isSelectionColumn&&o.enableRowSelection||(t.setAttribute("draggable","true"),b(t,"dragstart",t=>{s.current=n,f(Date.now()),e.classList.add("st-dragging")}),b(t,"dragend",t=>{t.preventDefault(),s.current=null,r.current=null,e.classList.remove("st-dragging"),setTimeout(()=>{o.setHeaders(t=>[...t]),o.onColumnOrderChange&&o.onColumnOrderChange(se(o.getHeaders()))},10)}),b(e,"dragover",t=>{const e=t;e.preventDefault(),s.current&&x(()=>{const t=o.getHeaders();if(!t)return;const{screenX:i,screenY:l}=e,a=Math.sqrt(Math.pow(i-u.screenX,2)+Math.pow(l-u.screenY,2));r.current=n;const d=s.current;if(!d)return;let c,v=!1;if(pn(d,t)!==pn(n,t)){const e=function({headers:t,draggedHeader:e,hoveredHeader:n}){const o=se(t);let i=!1;try{const t=pn(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:d,hoveredHeader:n});c=e.newHeaders,v=e.emergencyBreak}else{const e=hn(t,d.accessor),o=hn(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((w=e).length!==(m=r).length||1!==w.length&&!w.slice(0,-1).every((t,e)=>t===m[e]))return;const l=fn(t,e,r);c=l.newHeaders,v=l.emergencyBreak}var w,m;if(n.accessor===d.accessor||10>a||JSON.stringify(c)===JSON.stringify(t)||v)return;const g=o.essentialAccessors;if(g&&g.size>0&&!xe(c,g))return;const x=Date.now();JSON.stringify(c)===JSON.stringify(p)&&(150>x-h||40>a)||(f(x),u={screenX:i,screenY:l},p=t,o.onTableHeaderDragEnd(c))},50)}),b(document.documentElement,"dragover",t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")}))},Tn=(t,e,n)=>{var o,i;const{header:s,colIndex:r,parentHeader:l}=t,{collapsedHeaders:a,columnBorders:d,columnReordering:c,enableHeaderEditing:h,selectedColumns:u,columnsWithSelectedCells:p,draggedHeaderRef:f,hoveredHeaderRef:v}=e,w=s.isSelectionColumn&&e.enableRowSelection,m=!!(null==s?void 0:s.isSortable),g=a.has(s.accessor),x=!(!s.children||0===s.children.length)&&(!g||s.children.some(t=>{const e=t.showWhen||D;return"parentCollapsed"===e||"always"===e})),b=null==l?void 0:l.singleRowChildren,y=x&&!s.singleRowChildren,R=!!d&&(s.children&&0!==s.children.length?B(s,r).includes(e.lastHeaderIndex):r===e.lastHeaderIndex),C=!(!e.selectableColumns||w)&&B(s,r).some(t=>u.has(t)),S=!w&&B(s,r).some(t=>p.has(t));return["st-header-cell",s.accessor===(null===(o=v.current)||void 0===o?void 0:o.accessor)?"st-hovered":"",(null===(i=f.current)||void 0===i?void 0:i.accessor)===s.accessor?"st-dragging":"",m?"clickable":"",c&&!m?"columnReordering":"",y?"parent":"",b?"st-sub-header":"",R?"st-last-column":"",h&&!w?"st-header-editable":"",C?"st-header-selected":"",S&&!C?"st-header-has-highlighted-cell":"",n?"st-no-resize":""].filter(Boolean).join(" ")},On=(t,e,n,o,i)=>{const s=kn(e,o),r=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:s}});t.innerHTML="",r instanceof HTMLElement?t.appendChild(r):t.appendChild(s)},An=(t,e,i,s=0)=>{var r,l;const a=i.pinned?i.containerWidth:null!==(r=i.mainSectionContainerWidth)&&void 0!==r?r:i.containerWidth||(null===(l=t.parentElement)||void 0===l?void 0:l.clientWidth)||t.clientWidth||0,d=i.pinned?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,s,a),c=(t=>0===t.length?-1:Math.max(...t.map(t=>t.colIndex)))(e),h=w(t),u=new Set(d.map(t=>U({accessor:t.header.accessor,rowId:"header"}))),p=new Map,f=Array.from(new Set(e.map(t=>Math.round(t.top)))).sort((t,e)=>t-e);f.forEach((t,e)=>p.set(t,e));const v=t=>"header-band-"+Math.round(t.top),m=t=>{var e;return(null!==(e=p.get(Math.round(t.top)))&&void 0!==e?e:0)+1},x=g(t),R=i.animationCoordinator&&i.accordionAxis?i.accordionAxis:null,C="horizontal"===R?(t=>{const e=new Set,n=t=>{var o;for(const i of t)i.hide||i.excludeFromRender||(e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children))};return n(t),e})(i.headers):null;let S=!1;h.forEach((e,n)=>{var o,s;if(!u.has(n)){x.delete(n);const r=null!==(o=e.getAttribute("data-accessor"))&&void 0!==o?o:"",l=null!==(s=null==C?void 0:C.has(r))&&void 0!==s&&s;"horizontal"===R&&i.animationCoordinator&&!l&&i.animationCoordinator.shouldRetain(n)?i.animationCoordinator.shrinkOutCell({cellId:n,element:e,container:t,axis:R}):e.remove(),h.delete(n),S=!0}}),S&&y(t);const I=[];d.forEach(e=>{const o=U({accessor:e.header.accessor,rowId:"header"}),s=!(!i.autoExpandColumns||i.pinned||e.colIndex!==c);if(h.has(o)){const r=h.get(o);n(t,v(e),m(e)),r.setAttribute("aria-colindex",e.colIndex+1+""),e.header.children&&e.header.children.length>0&&r.setAttribute("aria-colspan",K(e.header,i.headers,i.collapsedHeaders)+"");const l=x.get(o);if(!l||l.left!==e.left||l.top!==e.top||l.width!==e.width||l.height!==e.height){r.style.left=e.left+"px",r.style.top=e.top+"px";const t=r.dataset.stAccordionGrow;"horizontal"!==t&&(r.style.width=e.width+"px"),"vertical"!==t&&(r.style.height=e.height+"px"),x.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}e.header.isSelectionColumn&&i.enableRowSelection&&"function"==typeof i.areAllRowsSelected&&((t,e)=>{je(t,e)})(r,i.areAllRowsSelected());const a=Tn(e,i,s);if(r.className!==a&&(r.className=a),G(e.header)){const t=i.collapsedHeaders.has(e.header.accessor);r.setAttribute("aria-expanded",!t+""),((t,e,n)=>{dn(t,!e,{ariaLabelWhenExpanded:n?`Collapse ${n} column`:"Collapse column",ariaLabelWhenCollapsed:n?`Expand ${n} column`:"Expand column",syncAriaExpanded:!0})})(r,t,e.header.label)}const d=`${i.sort&&i.sort.key.accessor===e.header.accessor?i.sort.direction:"none"}|${i.filters&&i.filters[e.header.accessor]?"1":"0"}`;r.dataset.stIconState!==d&&(((t,e,n,o)=>{const i=Me(e,n),s=qe(e,n),r=cn(e,n);if(e.headerRenderer){const l=t.querySelector(".st-header-label");return void(l&&On(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))}})(r,e.header,i,e.colIndex),r.dataset.stIconState=d)}else I.push({cell:e,cellId:o,isLastMainAutoExpandColumn:s})});const H=i.animationCoordinator&&i.accordionAxis?i.accordionAxis:null,M=[];I.forEach(({cell:e,cellId:o,isLastMainAutoExpandColumn:s})=>{const r=((t,e,n)=>{var o,i,s;const{header:r,colIndex:l}=t,{reverse:a}=e,d=r.isSelectionColumn&&e.enableRowSelection,c=Tn(t,e,n),h=document.createElement("div");if(h.className=c,h.id=U({accessor:r.accessor,rowId:"header"}),h.setAttribute("data-accessor",r.accessor+""),h.setAttribute("role","columnheader"),h.setAttribute("aria-colindex",l+1+""),r.children&&r.children.length>0){const t=K(r,e.headers,e.collapsedHeaders);h.setAttribute("aria-colspan",t+"")}if(G(r)){const t=null!==(i=null===(o=e.getCollapsedHeaders)||void 0===o?void 0:o.call(e))&&void 0!==i?i:e.collapsedHeaders;h.setAttribute("aria-expanded",!t.has(r.accessor)+"")}r.isSortable&&((null===(s=e.sort)||void 0===s?void 0:s.key.accessor)===r.accessor?h.setAttribute("aria-sort","asc"===e.sort.direction?"ascending":"descending"):h.setAttribute("aria-sort","none"));const u=((t,e)=>{const n=[];return t.type&&"other"!==t.type&&n.push(t.type+" column"),t.isSortable&&n.push("sortable"),e&&n.push("filterable"),t.tooltip&&n.push(t.tooltip),n.join(", ")})(r,!!r.filterable);if(u){const t="header-desc-"+r.accessor;h.setAttribute("aria-describedby",t);const e=document.createElement("span");e.id=t,e.className="st-sr-only",e.textContent=u,h.appendChild(e)}h.style.position="absolute",h.style.left=t.left+"px",h.style.top=t.top+"px",h.style.width=t.width+"px",h.style.height=t.height+"px";const p=Me(r,e),f=qe(r,e),v=cn(r,e),w=a!==("right"===e.pinned);if(w){const t=Hn(r,e,n);t&&h.appendChild(t)}r.headerRenderer||"right"!==r.align||(v&&h.appendChild(v),f&&h.appendChild(f),p&&h.appendChild(p));const m=document.createElement("div");if(m.className="st-header-label",r.headerRenderer)On(m,r,l,e,{sortIcon:p,filterIcon:f,collapseIcon:v});else{const t=kn(r,e);m.appendChild(t)}if(b(m,"click",t=>{d||((t,e,n,o)=>{if(!e.isSelectionColumn){if(o.selectableColumns){const i=B(e,n),s=i.some(t=>o.selectedColumns.has(t));if(o.enableHeaderEditing&&s&&!t.shiftKey){const t=document.getElementById(U({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=Mn(e,o,t);if(t.appendChild(n),o.headerRegistry&&!e.isSelectionColumn){const t=o.headerRegistry.get(e.accessor+"");t&&t.setEditing(!0)}}}}return}t.shiftKey&&o.selectColumns?o.setSelectedColumns(t=>{if(0===t.size)return new Set(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.isSortable&&o.onSort(e.accessor)}})(t,r,l,e)}),b(m,"dblclick",t=>{d||((t,e,n)=>{e.isSelectionColumn||n.selectableColumns&&e.isSortable&&n.onSort(e.accessor)})(0,r,e)}),En(m,h,r,e),h.appendChild(m),r.headerRenderer||"right"===r.align||(v&&h.appendChild(v),f&&h.appendChild(f),p&&h.appendChild(p)),!w){const t=Hn(r,e,n);t&&h.appendChild(t)}return e.headerRegistry&&!r.isSelectionColumn&&e.headerRegistry.set(r.accessor+"",{setEditing:t=>{if(t){const t=m.querySelector(".st-header-label-text");if(t){t.innerHTML="";const n=Mn(r,e,t);t.appendChild(n)}}}}),h})(e,i,s);r.dataset.stIconState=`${i.sort&&i.sort.key.accessor===e.header.accessor?i.sort.direction:"none"}|${i.filters&&i.filters[e.header.accessor]?"1":"0"}`,H&&i.animationCoordinator&&!i.animationCoordinator.hasSnapshotEntry(o)&&("vertical"===H?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=H,M.push({element:r,cell:e})),n(t,v(e),m(e)).appendChild(r),h.set(o,r),x.set(o,{left:e.left,top:e.top,width:e.width,height:e.height})}),H&&M.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of M)t.isConnected&&("vertical"===H?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),i.pinned||(t.dataset.lastScrollLeft=s+""),d.forEach(t=>{const e=h.get(U({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")}),o(t)},Wn=(t,e)=>{t.style.left="0",t.style.width="number"!=typeof e||0>e?"100%":e+"px"},Pn=e=>{const{position:n,rowHeight:o,displayStrongBorder:i,heightOffsets:s,customTheme:r=t,isSticky:l=!1,sectionWidthPx:a}=e,d=document.createElement("div");d.className="st-row-separator "+(i?"st-last-group-row":"");const c=l?n:Dt({position:n,rowHeight:o,heightOffsets:s,customTheme:r});Wn(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 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)}}),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},$n=new WeakMap,Fn=new WeakMap,Ln=t=>(Fn.has(t)||Fn.set(t,new Map),Fn.get(t)),Dn=(e,i,s,r=0,l,d,c,h)=>{var u,p,f,v,w,m,g,x;const b=s.pinned?null!==(p=null!==(u=s.containerWidth)&&void 0!==u?u:e.clientWidth)&&void 0!==p?p:0:null!==(w=null!==(v=null!==(f=s.mainSectionContainerWidth)&&void 0!==f?f:s.containerWidth)&&void 0!==v?v:e.clientWidth)&&void 0!==w?w:0,y=s.pinned?i:((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)})(i,r,b),R=a(e),C=(t=>($n.has(t)||$n.set(t,new Map),$n.get(t)))(e),S=new Set(y.map(t=>{var e;return U({accessor:t.header.accessor,rowId:null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId})}));let I=null;if(c)if(h)I=h;else{I=new Map;for(const t of i){const e=U({accessor:t.header.accessor,rowId:null!==(m=t.stableRowKey)&&void 0!==m?m:t.rowId});I.set(e,{left:t.left,top:t.top,width:t.width,height:t.height})}}const H=c&&s.accordionAxis?s.accordionAxis:null,M="horizontal"===H?(t=>{const e=new Set,n=t=>{var o;for(const i of t)i.hide||i.excludeFromRender||(e.add(i.accessor+""),(null===(o=i.children)||void 0===o?void 0:o.length)&&n(i.children))};return n(t),e})(s.headers):null,k=(null==l?void 0:l.length)?new Set(l.map(t=>t.position)):new Set(y.map(t=>t.rowIndex));R.forEach((t,n)=>{var o,i;if(!S.has(n)){const s=t.getAttribute("data-row-id");s&&nn(s,t);const r=null==I?void 0:I.get(n);if(c&&c.shouldRetain(n)&&r)return c.retainCell({cellId:n,element:t,container:e,newPosition:r}),void R.delete(n);if(c&&"horizontal"===H&&c.shouldRetain(n)){const s=null!==(o=t.getAttribute("data-accessor"))&&void 0!==o?o:"";if(null===(i=null==M?void 0:M.has(s))||void 0===i||!i)return c.shrinkOutCell({cellId:n,element:t,container:e,axis:H}),void R.delete(n)}t.remove(),R.delete(n)}});const E=Ln(e);C.forEach((t,e)=>{k.has(e)||(t.remove(),C.delete(e),E.delete(e))});const T=null!==(g=s.maxHeaderDepth)&&void 0!==g?g:1,O=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:t.rowId)+""},A=t=>t.tableRow.position+T+1,W=(t,e)=>{var n;s.enableRowSelection?t.setAttribute("aria-selected",(null===(n=s.isRowSelected)||void 0===n?void 0:n.call(s,e.rowId))?"true":"false"):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected")},P=!!s.rowGrouping&&s.rowGrouping.length>0,$=t=>{var e;return(null!==(e=t.stableRowKey)&&void 0!==e?e:tt(t.rowId))+""},F=new Map;if(P&&l&&l.length>0){const t=new Map;for(const e of l){const n=null!==(x=e.rowIndexPath)&&void 0!==x?x:[],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)=>{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:i,expanded:r}=(t=>{var e;const n=t.depth,o=null===(e=s.rowGrouping)||void 0===e?void 0:e[n],i=!!o&&rt(t.row,o),r=!!s.rowGrouping&&s.rowGrouping.length>n,l=!s.canExpandRowGroup||s.canExpandRowGroup(t.row);return i&&r&&l||s.onRowGroupExpand&&r&&l?{expandable:!0,expanded:lt(it(t),n,new Set(s.expandedDepths),s.expandedRows,s.collapsedRows)}:{expandable:!1,expanded:!1}})(n);i?t.setAttribute("aria-expanded",r+""):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")},D=[];y.forEach(t=>{var o,i,r,l,a;const c=U({accessor:t.header.accessor,rowId:null!==(o=t.stableRowKey)&&void 0!==o?o:t.rowId});if(R.has(c)){const o=R.get(c),h=n(e,O(t),A(t));if(W(h,t),L(h,t),d)((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")})(o,t);else{if(ln(o,t,s),t.header.isSelectionColumn&&s.enableRowSelection&&s.isRowSelected){const e=s.isRowSelected(t.rowId);je(o,e)}if(t.header.expandable){const e=new Set(s.expandedDepths),n=null!==(r=null===(i=s.getExpandedRows)||void 0===i?void 0:i.call(s))&&void 0!==r?r:s.expandedRows,d=null!==(a=null===(l=s.getCollapsedRows)||void 0===l?void 0:l.call(s))&&void 0!==a?a:s.collapsedRows,c=lt(it(t.tableRow),t.depth,e,n,d);dn(o,c)}}}else D.push({cell:t,cellId:c})});const B=[];D.forEach(({cell:t,cellId:o})=>{const i=null==c?void 0:c.claimRetainedForReuse(o,e);if(i){ln(i,t,s);const r=n(e,O(t),A(t));return W(r,t),L(r,t),i.parentElement!==r&&r.appendChild(i),void R.set(o,i)}const r=rn(t,s);H&&c&&!c.hasSnapshotEntry(o)&&("vertical"===H?r.style.height="0px":r.style.width="0px",r.dataset.stAccordionGrow=H,B.push({element:r,cell:t}));const l=n(e,O(t),A(t));W(l,t),L(l,t),l.appendChild(r),R.set(o,r)}),H&&B.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{element:t,cell:e}of B)t.isConnected&&("vertical"===H?t.style.height=e.height+"px":t.style.width=e.width+"px",delete t.dataset.stAccordionGrow)})}),((e,n,o,i,s)=>{const r=Ln(e),l=o.pinned&&n.length>0?n.reduce((t,e)=>Math.max(t,e.left+e.width),0):0,a=(()=>{var t,n,i;if(o.pinned){const t=Math.max("number"==typeof o.pinnedSectionWidthPx&&o.pinnedSectionWidthPx>0?o.pinnedSectionWidthPx:e.clientWidth,l);return t>0?t:void 0}const s=null!==(i=null!==(n=null!==(t=o.mainSectionContainerWidth)&&void 0!==t?t:o.containerWidth)&&void 0!==n?n:e.clientWidth)&&void 0!==i?i: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,o=-1,i=null;n.forEach(n=>{n.rowIndex!==o&&(i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:e}),e=i||void 0,o=n.rowIndex,i=n)}),i&&o>0&&t.push({rowIndex:o,firstCell:i,prevCell:e}),d=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!==d.length&&d.forEach(({rowIndex:n,position:s,displayStrongBorder:l})=>{var d;const c=r.get(n),h=Dt({position:s,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(d=o.customTheme)&&void 0!==d?d:t});if(i.has(n)){const t=i.get(n);(!c||c.topPx!==h||c.displayStrongBorder!==l||c.sectionWidthPx!==a)&&(Wn(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 t=Pn({position:s,rowHeight:o.rowHeight,displayStrongBorder:l,heightOffsets:o.heightOffsets,customTheme:o.customTheme,isSticky:!1,sectionWidthPx:a});e.appendChild(t),i.set(n,t),r.set(n,{position:s,topPx:h,displayStrongBorder:l,sectionWidthPx:a})}})})(e,y,s,C,l),o(e)};function Bn(t,e){return t?"string"==typeof t?t:t instanceof HTMLElement?t.cloneNode(!0):"function"==typeof t?t(e):null:null}function jn(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?Bt({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:tt(r.rowId);for(const e of t.headerPositions){const n=U({accessor:e.accessor,rowId:l});o.set(n,{left:e.left,top:i,width:e.width,height:t.rowHeight})}}return o}class zn{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: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 h=e.filter(t=>"left"===o?"left"===t.pinned:"right"===o?"right"===t.pinned:!t.pinned);if(0===h.length)return c.style.display="none",c;c.style.display="",c.style.cssText=`\n position: relative;\n ${void 0!==l?`width: ${l}px;`:""}\n height: ${i*s}px;\n `;const u=this.getCachedHeaderCells(d,h,n,i,s,a),p=u.length>0?Math.max(...u.map(t=>t.colIndex))+1:a;this.nextColIndexMap.set(d,p);const f=this.getCachedContext("header-"+d,r,o,l),v=c.scrollLeft;return An(c,u,f,v),o||v===c.scrollLeft||(c.scrollLeft=v),!o&&c&&(c.__renderHeaderCells=(t,e)=>{if(!c)return;const n=void 0!==e?Object.assign(Object.assign({},f),{columnsWithSelectedCells:e.columnsWithSelectedCells,selectedColumns:e.selectedColumns}):f;An(c,u,n,t)}),c}renderBodySection(e){var n,o,i,s;const{headers:r,rows:l,collapsedHeaders:a,pinned:d,context:c,sectionWidth:h,rowHeight:u,heightOffsets:p,totalRowCount:f,startColIndex:v=0,positionOnly:w=!1,fullTableRows:m,renderedStartIndex:g,renderedEndIndex:x,allFlattenedRows:b,pageStartIndex:y,animationCoordinator:R}=e,C=d||"main";let S=this.bodySections.get(C);S||(S=document.createElement("div"),S.className="left"===d?"st-body-pinned-left":"right"===d?"st-body-pinned-right":"st-body-main",this.bodySections.set(C,S));const I=r.filter(t=>"left"===d?"left"===t.pinned:"right"===d?"right"===t.pinned:!t.pinned);if(0===I.length)return S.style.display="none",S;S.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!==f?f:l.length,u,p,null!==(n=c.customTheme)&&void 0!==n?n:t);S.style.cssText=`\n position: relative;\n ${void 0!==h?`width: ${h}px;`:""}\n ${d?"":"flex-grow: 1;"}\n height: ${H}px;\n `;const M=this.getCachedBodyCells(C,I,l,a,u,p,null!==(o=c.customTheme)&&void 0!==o?o:t,v,m,g,x),k=null!==(i=null!=b?b:m)&&void 0!==i?i:l;this.captureSnapshotConfig(C,I,a,k,u,p,null!==(s=c.customTheme)&&void 0!==s?s:t,void 0!==b?null!=y?y:0:void 0);const E=R?this.getFullSectionLayout(C):null,T=l.filter(t=>!t.nestedTable&&!t.stateIndicator).length;this.nextColIndexMap.set(C,M.length>0&&T>0?v+M.length/T:v);const O=this.getCachedContext("body-"+C,c,d,h);return Dn(S,M,O,S.scrollLeft,l,w,R,null!=E?E:void 0),this.renderNestedGridRows(S,C,l,d,O,R),d||this.renderStateRows(S,C,l,O,R),!d&&S&&(S.__renderBodyCells=t=>{S&&Dn(S,M,O,t,l,!0)}),S}renderNestedGridRows(t,e,n,o,i,s){var r,l;const a=null!==(r=null==s?void 0:s.isEnabled())&&void 0!==r&&r,d=a?`transform ${s.getDuration()}ms ${s.getEasing()}, height ${s.getDuration()}ms ${s.getEasing()}`:"",c=n.filter(t=>t.nestedTable),h=new Set(c.map(t=>it(t)));let u=this.nestedGridRowsMap.get(e);u||(u=new Map,this.nestedGridRowsMap.set(e,u)),u.forEach((t,e)=>{var n;h.has(e)||(null===(n=t.cleanup)||void 0===n||n.call(t),t.element.remove(),u.delete(e))});const p={rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(l=i.customTheme)&&void 0!==l?l:{},theme:i.theme,rowGrouping:i.rowGrouping,depth:0,loadingStateRenderer:i.loadingStateRenderer,errorStateRenderer:i.errorStateRenderer,emptyStateRenderer:i.emptyStateRenderer,icons:i.icons};c.forEach(n=>{var s,r,l,c,h,f,v;const w=it(n),m=u.get(w);if(m){const t=Bt({position:n.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(s=i.customTheme)&&void 0!==s?s:{}}),e=J({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(r=n.nestedTable.expandableHeader.nestedTable)||void 0===r?void 0:r.height,customTheme:null!==(l=i.customTheme)&&void 0!==l?l:{}}),o=m.lastTop!==t,a=m.lastWrapperHeight!==e;return(o||a)&&(m.element.style.transition=d,o&&(m.element.style.transform=`translate3d(0, ${t}px, 0)`),a&&(m.element.style.height=e+"px"),m.lastTop=t,m.lastWrapperHeight=e),m.element.dataset.index=n.position+"",void(m.lastPosition=n.position)}const g=this.stateRowsMap.get(e),x=g&&g.has(w)?i.rowHeight:0,b=J({calculatedHeight:n.nestedTable.calculatedHeight,customHeight:null===(c=n.nestedTable.expandableHeader.nestedTable)||void 0===c?void 0:c.height,customTheme:null!==(h=i.customTheme)&&void 0!==h?h:{}}),y=Bt({position:n.position,rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(f=i.customTheme)&&void 0!==f?f:{}});if(o){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=J({calculatedHeight:n.calculatedHeight,customHeight:null==o?void 0:o.height,customTheme:e.customTheme}),s=Bt({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}(n,{rowHeight:i.rowHeight,heightOffsets:i.heightOffsets,customTheme:null!==(v=i.customTheme)&&void 0!==v?v:{}});a&&x!==b&&(e.style.height=x+"px"),t.appendChild(e),u.set(w,{element:e,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}else{p.depth=n.depth>0?n.depth-1:0;const{element:e,cleanup:o}=function(t,e){const{nestedTable:n}=t;if(!n)throw Error("createNestedGridRow called without tableRow.nestedTable");const{rowHeight:o,heightOffsets:i,customTheme:s,theme:r,rowGrouping:l,depth:a,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u}=e,{parentRow:p,expandableHeader:f,childAccessor:v,calculatedHeight:w}=n,m=f.nestedTable;if(!m)throw Error("createNestedGridRow: expandableHeader.nestedTable is missing");const g=Y(p,v),x=Array.isArray(g)?g:[],b=l&&l[a+1]?l.slice(a+1):void 0,y=m.customTheme?Object.assign(Object.assign({},s),m.customTheme):s,R=(({calculatedHeight:t,customHeight:e,customTheme:n})=>e?"string"==typeof e?e:e+"px":t-n.nestedGridPaddingTop-n.nestedGridPaddingBottom+"px")({calculatedHeight:w,customHeight:m.height,customTheme:s}),C=J({calculatedHeight:w,customHeight:m.height,customTheme:s}),S=Bt({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}),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, ${S}px, 0)`,I.style.height=C+"px",I.style.paddingTop=s.nestedGridPaddingTop+"px",I.style.paddingBottom=s.nestedGridPaddingBottom+"px",I.style.paddingLeft=s.nestedGridPaddingLeft+"px",I.style.paddingRight=s.nestedGridPaddingRight+"px",I.style.boxSizing="border-box";const H=document.createElement("div");H.setAttribute("role","gridcell"),H.style.height="100%",H.style.width="100%",I.appendChild(H);const M=Object.assign(Object.assign({},m),{defaultHeaders:m.defaultHeaders,rows:x,theme:r,customTheme:y,height:R,rowGrouping:b,loadingStateRenderer:d,errorStateRenderer:c,emptyStateRenderer:h,icons:u}),k=new lo(H,M);k.mount();const E=()=>{k.destroy()};return I.__nestedTableCleanup=E,{element:I,cleanup:E}}(n,p);a&&x!==b&&(e.style.height=x+"px",e.style.overflow="hidden"),t.appendChild(e),u.set(w,{element:e,cleanup:o,lastPosition:n.position,lastTop:y,lastWrapperHeight:b}),a&&x!==b&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition=d,e.style.height=b+"px"})})}})}renderStateRows(t,e,n,o,i){var s,r;const l=n.filter(t=>t.stateIndicator),a=new Set(l.map(t=>it(t)));let d=this.stateRowsMap.get(e);d||(d=new Map,this.stateRowsMap.set(e,d));const c=null!==(s=null==i?void 0:i.isEnabled())&&void 0!==s&&s,h=c?`transform ${i.getDuration()}ms ${i.getEasing()}, height ${i.getDuration()}ms ${i.getEasing()}`:"";d.forEach((t,e)=>{a.has(e)||(t.element.remove(),d.delete(e))});const u={index:0,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(r=o.customTheme)&&void 0!==r?r:{},loadingStateRenderer:o.loadingStateRenderer,errorStateRenderer:o.errorStateRenderer,emptyStateRenderer:o.emptyStateRenderer};l.forEach((e,n)=>{var i;const s=it(e),r=Bt({position:e.position,rowHeight:o.rowHeight,heightOffsets:o.heightOffsets,customTheme:null!==(i=o.customTheme)&&void 0!==i?i:{}}),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: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, ${Bt({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=Bn(e.loadingStateRenderer,{parentRow:o.parentRow}):o.state.error&&e.errorStateRenderer?r=Bn(e.errorStateRenderer,{error:o.state.error,parentRow:o.parentRow}):o.state.isEmpty&&e.emptyStateRenderer&&(r=Bn(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({},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=o.rowHeight+"px"})})):t.appendChild(a),d.set(s,{element:a,lastTop:r,lastPosition:e.position})})}calculateAbsoluteHeaderCells(t,e,n,o,i=0){const s=[];let r=i,l=0;const a=(t,i,d)=>{if(t.hide||t.excludeFromRender)return 0;const c=e.has(t.accessor);if(t.children&&t.children.length>0){const e=t.children.filter(t=>{const e=t.showWhen||"parentExpanded";return c?"parentCollapsed"===e||"always"===e:"parentExpanded"===e||"always"===e});if(t.singleRowChildren){const c="number"==typeof t.width?t.width:150;s.push({header:t,left:l,top:i*o,width:c,height:(n-i)*o,colIndex:r,parentHeader:d}),r++,l+=c;let h=0;return e.forEach(e=>{h+=a(e,i,t)}),c+h}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 h=l,u=r;let p=0;return e.forEach(e=>{p+=a(e,i+1,t)}),s.push({header:t,left:h,top:i*o,width:p,height:o,colIndex:u,parentHeader:d}),p}{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}calculateAbsoluteBodyCells(t,e,n,o,i,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?Bt({position:t.position,rowHeight:o,heightOffsets:i,customTheme:s}):e*o,a=t.position%2==1;d.forEach((i,s)=>{var d,h;const u=c.get(i.accessor);l.push({header:i,row:t.row,rowIndex:e,colIndex:r+s,rowId:tt(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:o})})}),l}getLeafHeaders(t,e){const n=[],o=t=>{if(t.hide||t.excludeFromRender)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}createHeadersHash(t){const e=t=>{let n=`${t.accessor}:${t.width}:${t.pinned||""}:${t.hide||""}`;return t.children&&t.children.length>0&&(n+=`:children[${t.children.map(e).join(",")}]`),n};return t.map(e).join("|")}createHeightOffsetsHash(t){return t&&0!==t.length?t.map(([t,e])=>`${t}:${e}`).join("|"):""}createContextHash(t){let e=["columnBorders","enableRowSelection","cellUpdateFlash","useOddColumnBackground","useHoverRowBackground","useOddEvenRowBackground","rowHeight","containerWidth"].map(e=>`${e}:${t[e]}`).join("|");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){const h=this.createHeadersHash(e),u=this.createHeightOffsetsHash(s),p=null!=a&&null!=d&&null!=c,f=this.bodyCellsCache.get(t),v=f&&f.deps.headersHash===h&&f.deps.collapsedHeadersSize===o.size&&f.deps.rowHeight===i&&f.deps.heightOffsetsHash===u&&(p?f.deps.fullTableRowsRef===a&&void 0!==f.deps.bandStart&&void 0!==f.deps.bandEnd&&((t,e)=>d>=t&&e>=c)(f.deps.bandStart,f.deps.bandEnd):f.deps.rowsRef===n);if(v&&f){if(!p)return f.cells;const t=new Map;n.forEach((e,n)=>{t.set(e.position,n)});const e=[];for(const n of f.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}let w,m,g;if(p){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 x=this.calculateAbsoluteBodyCells(e,w,o,i,s,r,l);if(this.bodyCellsCache.set(t,{cells:x,deps:Object.assign({headersHash:h,rowsRef:w,collapsedHeadersSize:o.size,rowHeight:i,heightOffsetsHash:u},p&&{fullTableRowsRef:a,bandStart:m,bandEnd:g})}),!p)return x;const b=new Map;n.forEach((t,e)=>{b.set(t.position,e)});const y=[];for(const t of x){const e=b.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,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=this.calculateAbsoluteHeaderCells(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)}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=>{(t=>{if(t){const e=a(t);e.forEach(t=>{t.remove()}),e.clear(),i(t)}})(t)}),this.headerSections.forEach(t=>{(t=>{if(c=0,t){const e=w(t);e.forEach(t=>{t.remove()}),e.clear(),g(t).clear(),y(t),i(t)}})(t)}))}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,jn(e))}),t}getFullSectionLayout(t){const e=this.bodySectionSnapshots.get(t);return e?jn(e):null}captureSnapshotConfig(t,e,n,o,i,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:o,headerPositions:d,rowHeight:i,heightOffsets:s,customTheme:r,pageStartIndex:l})}cleanup(){this.headerSections.clear(),this.bodySections.clear(),this.bodyCellsCache.clear(),this.headerCellsCache.clear(),this.contextCache.clear(),this.bodySectionSnapshots.clear(),this.nextColIndexMap.clear()}}const Nn=(t,e)=>{"string"==typeof e?t.innerHTML=e:(t.innerHTML="",t.appendChild(e.cloneNode(!0)))},qn=(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(qn([t],e,n),!1===t.hide){i=!0;break}(t||i)&&(o.hide=!1)}},Vn=t=>t.every(t=>t.hide),Gn=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(Gn(t.children),Vn(t.children)&&(t.hide=!0))})},Kn=(t,e)=>{const n=e.toLowerCase();return!!t.label.toLowerCase().includes(n)||!(!t.children||0>=t.children.length)&&t.children.some(t=>Kn(t,e))},Un=(t,e,n)=>{if(!e.trim())return t;const o=n||Kn;return t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender&&o(t,e))};function Jn(t,e,n,o){e&&t.appendChild(e),t.appendChild(n),o&&t.appendChild(o)}function _n(t,e,n,o,i,s,r){const l=e({headers:n,searchSection:o,listSection:i,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 Yn=t=>{let e=t,{headers:n,open:o,searchEnabled:i,searchPlaceholder:s,searchFunction:r,columnEditorConfig:l,icons:a,essentialAccessors:d,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,resetColumns:p}=e,f="",v=null,w=null,m=!1;const g=new Set,x=t=>{t.forEach(t=>{t.children&&t.children.length>0&&(g.add(t.accessor),x(t.children))})};x(n);let b=g;const y=document.createElement("div");y.className="st-column-editor-popout "+(o?"open":"");const R=document.createElement("div");R.className="st-column-editor-popout-content",R.addEventListener("click",t=>t.stopPropagation());let C=null,S=null;if(i){const t=function(t){const e=document.createElement("div");e.className="st-column-editor-search-wrapper";const n=document.createElement("div");n.className="st-column-editor-search";const o=document.createElement("input");return o.type="text",o.value="",o.placeholder=t,o.className="st-filter-input",o.addEventListener("click",t=>t.stopPropagation()),o.addEventListener("input",t=>{f=t.target.value,P()}),n.appendChild(o),e.appendChild(n),{wrapper:e,input:o}}(s);S=t.wrapper,C=t.input}const I=document.createElement("div");I.className="st-column-editor-lists";let H=null;p&&(H=function(t){const e=document.createElement("div");e.className="st-column-editor-footer";const n=document.createElement("button");return n.type="button",n.className="st-column-editor-reset-btn",n.textContent="Reset columns",n.addEventListener("click",e=>{e.stopPropagation(),t()}),e.appendChild(n),e}(p));let M=l.customRenderer;M?_n(R,M,n,S,I,H,p):Jn(R,S,I,H),y.appendChild(R);const k=t=>{v=t,null!==t?m=!0:(m=!1,P())},E=()=>{w=null},T=t=>{w=t,m?A():P()},O=t=>{const e=b;b=t,P(e)},A=()=>{I.querySelectorAll(".st-column-editor-drag-separator").forEach((t,e)=>{const n=t;n.style.opacity=0===e?-1===w?"1":"0":w===e-1?"1":"0"})},W=(t,e,o,s,p)=>{if(0===t.length)return;const m=t.filter(t=>!t.isSelectionColumn&&!t.excludeFromRender);if(0===(i?Un(m,f,r):m).length)return;if(o){const t=document.createElement("div");t.className="st-column-editor-section-label",t.textContent=o,s.appendChild(t)}const g=document.createElement("div");g.className="st-column-editor-list st-column-editor-list-section",s.appendChild(g);const x=((t,e)=>{const n=i?Un(t,f,r):t,o=[],s=i&&f.trim().length>0,l=({headers:t,depth:n=0,parent:i=null,currentPath:r=[]})=>{t.forEach((t,a)=>{if(t.isSelectionColumn||t.excludeFromRender)return;const d=[...r,a];o.push({header:t,visualIndex:o.length,depth:n,parent:i,indexPath:d,panelSection:e});const c=t.children&&t.children.length>0,h=s||b.has(t.accessor);c&&h&&t.children&&l({headers:t.children,depth:n+1,parent:t,currentPath:d})})};return l({headers:n,depth:0,parent:null,currentPath:[]}),o})(t,e),y=(t=>t.some(t=>t.children&&t.children.length>0))(t);x.forEach(t=>{var o;const s=(t=>{var e,n;const{allHeaders:o,clearHoverSeparator:i,depth:s,doesAnyHeaderHaveChildren:r,draggingRow:l,getDraggingRow:a,getHoveredSeparatorIndex:d,expandedHeaders:c,flattenedHeaders:h,forceExpanded:u,header:p,hoveredSeparatorIndex:f,panelSection:v,rowIndex:w,setDraggingRow:m,setExpandedHeaders:g,setHoveredSeparatorIndex:x,headers:b,setHeaders:y,onColumnVisibilityChange:R,onColumnOrderChange:C,previousExpandedHeaders:S}=t,I=null!==(e=t.essentialAccessors)&&void 0!==e?e:new Set,H=!1!==t.columnEditorConfig.allowColumnPinning,M=me(p,I),k=!M,E=document.createDocumentFragment(),T=16*s+"px",O=p.children&&p.children.length>0,A=!(p.hide||O&&p.children&&Vn(p.children)),W=c.has(p.accessor),P=u||W;let $;if(0===w){const t=document.createElement("div");t.className="st-column-editor-drag-separator",t.style.opacity=-1===f?"1":"0",E.appendChild(t)}const F=document.createElement("div");F.className="st-header-checkbox-item",F.style.paddingLeft=T,F.draggable=!0;const L=t=>!(I.size>0&&!xe(t,I)||(null==C||C(t),y(t),0)),D=t=>{if(t.stopPropagation(),u)return;const e=new Set(c);W?e.delete(p.accessor):e.add(p.accessor),g(e)};let B;if(F.addEventListener("dragstart",t=>{t.dataTransfer&&(t.dataTransfer.effectAllowed="move"),null==i||i(),m(h[w])}),F.addEventListener("dragenter",t=>{t.preventDefault()}),F.addEventListener("dragover",t=>{t.preventDefault();const e=a?a():l;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 h=d/2>c;return d%2==1&&c===Math.floor(d/2)&&(h=o),h?s-1:a}return null})({flattenedHeaders:h,draggingRow:e,hoveredRowIndex:w,isTopHalfOfRow:n.top+n.height/2>t.clientY});x(o)}}),F.addEventListener("dragend",()=>{const t=a?a():l,e=d?d():f,n=()=>{m(null),x(null)};if(!t||null===e||t.panelSection!==v)return void n();let o,i=h[e>t.visualIndex?e:e+1];if(i){if(i.depth>t.depth&&i.parent){const t=h.findIndex(t=>t.header.accessor===i.parent.accessor);-1!==t&&(i=h[t])}if(t.header.accessor!==i.header.accessor)if(t.indexPath.length!==i.indexPath.length||1!==t.indexPath.length&&!t.indexPath.slice(0,-1).every((t,e)=>t===i.indexPath[e]))n();else{if(1===t.indexPath.length){const{newHeaders:e,emergencyBreak:s}=fn(b,t.indexPath,i.indexPath);if(s)return void n();o=e}else{const{newHeaders:e,emergencyBreak:s}=fn(b,t.indexPath,i.indexPath);if(s)return void n();o=e}L(o),n()}else n()}else n()}),r){const e=document.createElement("div");if(e.className="st-header-icon-container",O){const t=void 0!==S?u||S.has(p.accessor):P,n=!u&&void 0!==S&&t!==P,o=n?t:P,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 ${p.label} column`:`Expand ${p.label} column`),i.appendChild(he("st-expand-icon")),i.addEventListener("click",D),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),D(t))}),e.appendChild(i),B=i,n&&($=()=>{dn(F,P,{ariaLabelWhenExpanded:`Collapse ${p.label} column`,ariaLabelWhenCollapsed:`Expand ${p.label} column`,syncAriaExpanded:!0})})}t.columnEditorConfig.rowRenderer||F.appendChild(e)}const j=ze({checked:A,onChange:t=>{if(!k)return;p.hide=!t,t?(qn(o,p.accessor),O&&p.children&&p.children.length>0&&p.children.every(t=>!0===t.hide)&&p.children[0]&&(p.children[0].hide=!1,qn(o,p.children[0].accessor))):Gn(o);const e=[...b];if(y(se(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)}}});k||(j.element.classList.add("st-checkbox-disabled"),j.element.style.pointerEvents="none");const z=document.createElement("div");z.className="st-drag-icon-container";const N=null===(n=t.icons)||void 0===n?void 0:n.drag;"string"==typeof N?z.innerHTML=N:N instanceof HTMLElement||N instanceof SVGSVGElement?z.appendChild(N.cloneNode(!0)):z.innerHTML='<svg\n aria-hidden="true"\n role="img"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 10"\n style="height: 10px; width: 16px;"\n>\n <circle cx="3" cy="3" r="1.5" fill="currentColor" />\n <circle cx="8" cy="3" r="1.5" fill="currentColor" />\n <circle cx="13" cy="3" r="1.5" fill="currentColor" />\n <circle cx="3" cy="7" r="1.5" fill="currentColor" />\n <circle cx="8" cy="7" r="1.5" fill="currentColor" />\n <circle cx="13" cy="7" r="1.5" fill="currentColor" />\n</svg>';const q=document.createElement("div");q.className="st-column-label-container",q.textContent=p.label;const V="left"===p.pinned||"right"===p.pinned?p.pinned:null,G=!!V&&!M,K=!V&&"main"===v,U=!V&&"main"===v,J=()=>{const t=Se(b,p.accessor,"left",I);t&&L(t)},_=()=>{const t=Se(b,p.accessor,"right",I);t&&L(t)},Y=()=>{const t=Se(b,p.accessor,"main",I);t&&L(t)},{rowRenderer:X}=t.columnEditorConfig;if(X){const t=X({accessor:p.accessor,header:p,components:{expandIcon:B,checkbox:j.element,dragIcon:z,labelContent:q},panelSection:v,isEssential:M,canToggleVisibility:k,allowColumnPinning:H,pinControl:H&&0===s?{pinnedSide:V,canPinLeft:K,canPinRight:U,canUnpin:G,pinLeft:J,pinRight:_,unpin:Y}:void 0});t instanceof HTMLElement?F.appendChild(t):"string"==typeof t&&(F.innerHTML=t)}else if(F.appendChild(j.element),F.appendChild(z),F.appendChild(q),H&&0===s){const t=document.createElement("div");if(t.className="st-column-pin-side-group",t.addEventListener("mousedown",t=>{t.stopPropagation()}),t.addEventListener("dragstart",t=>{t.preventDefault(),t.stopPropagation()}),V){const e=document.createElement("div"),n=M;e.className="st-column-pin-btn st-column-pin-side st-column-pin-pinned-active"+(n?" st-column-pin-pinned-essential":""),e.textContent="left"===V?"L":"R",e.title=n?"Essential column — cannot be unpinned":"Unpin column",G&&e.addEventListener("click",t=>{t.stopPropagation(),Y()}),t.appendChild(e)}else{if(K){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(),J()}),t.appendChild(e)}if(U){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(),_()}),t.appendChild(e)}}F.appendChild(t)}E.appendChild(F);const Q=document.createElement("div");return Q.className="st-column-editor-drag-separator",Q.style.opacity=f===w?"1":"0",E.appendChild(Q),{fragment:E,scheduleExpandIconAnimation:$}})({allHeaders:n,clearHoverSeparator:E,depth:t.depth,doesAnyHeaderHaveChildren:y,draggingRow:v,getDraggingRow:()=>v,getHoveredSeparatorIndex:()=>w,expandedHeaders:b,flattenedHeaders:x,forceExpanded:i&&f.trim().length>0,header:t.header,hoveredSeparatorIndex:w,panelSection:e,rowIndex:t.visualIndex,setDraggingRow:k,setExpandedHeaders:O,setHoveredSeparatorIndex:T,columnEditorConfig:l,icons:a,essentialAccessors:null!=d?d:new Set,headers:n,setHeaders:c,onColumnVisibilityChange:h,onColumnOrderChange:u,previousExpandedHeaders:p});g.appendChild(s.fragment),null===(o=s.scheduleExpandIconAnimation)||void 0===o||o.call(s)})},P=t=>{I.innerHTML="";const e=!1!==l.allowColumnPinning,{pinnedLeft:o,unpinned:i,pinnedRight:s}=we(n);if(e)W(o,"left","Pinned Left",I,t),W(i,"main","Main",I,t),W(s,"right","Pinned Right",I,t);else{const e=[...o,...i,...s];W(e,"main",null,I,t)}};return P(),{element:y,update:t=>{void 0!==t.headers&&(n=t.headers),void 0!==t.searchEnabled&&(i=t.searchEnabled),void 0!==t.searchPlaceholder&&(s=t.searchPlaceholder),void 0!==t.searchFunction&&(r=t.searchFunction),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&&(p=t.resetColumns);let e=!1;if(void 0!==t.columnEditorConfig){const n=t.columnEditorConfig.customRenderer;n!==M&&(M=n,e=!0),l=t.columnEditorConfig}void 0!==t.open&&(o=t.open,o?y.classList.add("open"):y.classList.remove("open")),C&&void 0!==t.searchPlaceholder&&(C.placeholder=t.searchPlaceholder),e&&(R.innerHTML="",M?_n(R,M,n,S,I,H,p):Jn(R,S,I,H)),P()},destroy:()=>{C&&(C.removeEventListener("input",()=>{}),C.removeEventListener("click",()=>{})),y.removeEventListener("click",()=>{}),y.remove()}}},Xn=t=>{const{sectionHeaders:e,stickyParents:n,stickyHeight:o,offsetStartIndex:i,treeTransitionOffset:s,rowHeight:r,heightOffsets:l,customTheme:a,cellRenderContext:d,collapsedHeaders:c,pinned:h,width:u,scrollSyncGroup:p,sectionScrollController:f,startColIndex:v,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=o+"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=[],o=t=>{if(t.hide||t.excludeFromRender)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),x=new Map;let b=0;g.forEach(t=>{const e="number"==typeof t.width?t.width:150;x.set(t.accessor,{left:b,width:e}),b+=e});const y=h&&"number"==typeof u?u:"number"==typeof d.mainSectionContainerWidth?d.mainSectionContainerWidth:void 0;return n.forEach((t,e)=>{const o=-1!==i&&e>=i,c=o?s:0,h=e*(r+1)+c,u=o?e:n.length-e,p=document.createElement("div");p.className="st-row st-sticky-parent",p.style.position="absolute",p.style.top="0px",p.style.left="0",p.style.right="0",p.style.height=r+"px",p.style.transform=`translateY(${h}px)`,p.style.zIndex=u+"",p.setAttribute("data-index",t.position+""),g.forEach((e,n)=>{var o,i;const s=x.get(e.accessor),l=v+n,a={header:e,row:t.row,rowIndex:w(t),colIndex:l,rowId:tt(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=rn(a,d);p.appendChild(c)}),m.appendChild(p);const f=Pn({position:(e+1)*(r+1)-1+c,rowHeight:r,displayStrongBorder:!1,heightOffsets:l,customTheme:a,isSticky:!0,sectionWidthPx:y});m.appendChild(f)}),f&&p&&f.registerPane("pinned-left"===p?"pinned-left":"pinned-right"===p?"pinned-right":"main",m,"sticky"),m},Qn=(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 Zn{constructor(){this.footerInstance=null,this.columnEditorInstance=null,this.horizontalScrollbarRef={current:null},this.scrollbarTimeoutId=null,this.stickyParentsContainer=null,this.sectionScrollController=null,this.renderScheduled=!1,this.pendingRenderCallback=null,this.sectionRenderer=new zn}scheduleRender(t){this.renderScheduled||(this.renderScheduled=!0,this.pendingRenderCallback=t,queueMicrotask(()=>{this.renderScheduled=!1,this.pendingRenderCallback&&(this.pendingRenderCallback(),this.pendingRenderCallback=null)}))}invalidateCache(t){this.sectionRenderer.invalidateCache(t)}getCurrentBodyLayouts(){return this.sectionRenderer.getCurrentBodyLayouts()}renderHeader(t,e,n,o){var i,s,r,l,a,d,c,h,u,p,f,v;if(!t||o.config.hideHeader)return;t.style.height=e+"px";const w=re(o.effectiveHeaders,"left")||re(o.effectiveHeaders,void 0)||re(o.effectiveHeaders,"right");t.style.minHeight=w?"":e+"px";const m=t.parentElement;m&&(m.setAttribute("aria-rowcount",1+o.localRows.length+""),m.setAttribute("aria-colcount",o.effectiveHeaders.length+""),o.config.enableRowSelection?m.setAttribute("aria-multiselectable","true"):m.removeAttribute("aria-multiselectable"));const g=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:x,leftWidth:b,rightWidth:y}=mn({headers:o.effectiveHeaders,containerWidth:g.containerWidth,collapsedHeaders:o.collapsedHeaders}),R=null===(r=o.sortManager)||void 0===r?void 0:r.getState(),C=null===(l=o.filterManager)||void 0===l?void 0:l.getState(),S=null!==(d=null===(a=o.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,I={reverse:!1,collapsedHeaders:o.collapsedHeaders,getCollapsedHeaders:o.getCollapsedHeaders,columnBorders:null!==(c=o.config.columnBorders)&&void 0!==c&&c,columnReordering:null!==(h=o.config.columnReordering)&&void 0!==h&&h,columnResizing:null!==(u=o.config.columnResizing)&&void 0!==u&&u,containerWidth:g.containerWidth,mainSectionContainerWidth:x,enableHeaderEditing:o.config.enableHeaderEditing,enableRowSelection:o.config.enableRowSelection,selectedRowCount:S,filters:null!==(p=null==C?void 0:C.filters)&&void 0!==p?p:{},icons:o.resolvedIcons,selectedColumns:o.config.selectableColumns&&o.selectionManager?o.selectionManager.getSelectedColumns():new Set,columnsWithSelectedCells:o.selectionManager&&(o.config.selectableCells||o.config.selectableColumns)?o.selectionManager.getColumnsWithSelectedCells():new Set,sort:null!==(f=null==R?void 0:R.sort)&&void 0!==f?f:null,autoExpandColumns:null!==(v=o.config.autoExpandColumns)&&void 0!==v&&v,essentialAccessors:o.essentialAccessors,selectableColumns:o.config.selectableColumns,headers:o.effectiveHeaders,rows:o.localRows,headerHeight:o.customTheme.headerHeight,lastHeaderIndex:o.effectiveHeaders.length-1,onSort:t=>{o.sortManager&&o.sortManager.updateSort({accessor:t})},handleApplyFilter:t=>{o.filterManager&&o.filterManager.updateFilter(t)},handleClearFilter:t=>{o.filterManager&&o.filterManager.clearFilter(t)},getHeaders:()=>o.getHeaders(),handleSelectAll:t=>{var e;null===(e=o.rowSelectionManager)||void 0===e||e.handleSelectAll(t)},setCollapsedHeaders:t=>{o.setCollapsedHeaders("function"==typeof t?t(o.collapsedHeaders):t),o.onRender()},setHeaders:t=>{o.setHeaders("function"==typeof t?t(o.getHeaders()):t),o.onRender()},setIsResizing:t=>{o.setIsResizing("function"==typeof t?t(o.isResizing):t)},onColumnWidthChange:o.config.onColumnWidthChange,onColumnOrderChange:o.config.onColumnOrderChange,onTableHeaderDragEnd:t=>{o.setHeaders(t),o.onRender()},onHeaderEdit:o.config.onHeaderEdit,onColumnSelect:o.config.onColumnSelect,selectColumns:o.selectionManager&&o.config.selectableColumns?(t,e)=>{o.selectionManager.selectColumns(t,e),o.onRender()}:t=>{},setSelectedColumns:o.selectionManager&&o.config.selectableColumns?t=>{const e=o.selectionManager.getSelectedColumns(),n="function"==typeof t?t(e):t;o.selectionManager.setSelectedColumns(n),o.onRender()}:t=>{},setSelectedCells:o.selectionManager?t=>{var e;const n=o.selectionManager.getSelectedCells(),i="function"==typeof t?t(n):t;o.selectionManager.setSelectedCells(i instanceof Set?i:new Set),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},setInitialFocusedCell:o.selectionManager?t=>{var e;o.selectionManager.setInitialFocusedCell(null!=t?t:null),null===(e=o.onRender)||void 0===e||e.call(o)}:t=>{},areAllRowsSelected:()=>{var t,e;return null!==(e=null===(t=o.rowSelectionManager)||void 0===t?void 0:t.areAllRowsSelected())&&void 0!==e&&e},draggedHeaderRef:o.draggedHeaderRef,hoveredHeaderRef:o.hoveredHeaderRef,headerRegistry:o.headerRegistry,forceUpdate:()=>o.onRender(),mainBodyRef:o.mainBodyRef,pinnedLeftRef:o.pinnedLeftRef,pinnedRightRef:o.pinnedRightRef,accordionAxis:o.accordionAxis,animationCoordinator:o.animationCoordinator},H=o.effectiveHeaders.filter(t=>"left"===t.pinned),M=o.effectiveHeaders.filter(t=>!t.pinned),k=o.effectiveHeaders.filter(t=>"right"===t.pinned);let E=0;const T=[];if(H.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"left",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:I,sectionWidth:b,startColIndex:E});o.pinnedLeftHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("left")}if(M.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:I,sectionWidth:x,startColIndex:E});o.mainHeaderRef.current=e,T.push(e),t.appendChild(e),E=this.sectionRenderer.getNextColIndex("main")}if(k.length>0){const e=this.sectionRenderer.renderHeaderSection({headers:o.effectiveHeaders,collapsedHeaders:o.collapsedHeaders,pinned:"right",maxHeaderDepth:n,headerHeight:o.customTheme.headerHeight,context:I,sectionWidth:y,startColIndex:E});o.pinnedRightHeaderRef.current=e,T.push(e),t.appendChild(e)}Array.from(t.children).forEach(t=>{T.includes(t)||t.remove()})}renderBody(t,e,n){var o,i,s,r,l,a,d,c,h,u,p,f,v,w,m,g,x,b,y,R,C,S,I;if(!t)return;if(re(n.effectiveHeaders,"left")||re(n.effectiveHeaders,void 0)||re(n.effectiveHeaders,"right"))t.style.minHeight="";else{const n=null!==(i=null===(o=null==e?void 0:e.heightMap)||void 0===o?void 0:o.totalHeight)&&void 0!==i?i:0;t.style.minHeight=n+"px"}const H=e.rowsToRender||e.currentTableRows,M=!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}),M){t.innerHTML="";const e=document.createElement("div");return e.className="st-empty-state-wrapper","string"==typeof n.config.tableEmptyStateRenderer?e.textContent=n.config.tableEmptyStateRenderer:n.config.tableEmptyStateRenderer instanceof HTMLElement?e.appendChild(n.config.tableEmptyStateRenderer.cloneNode(!0)):e.innerHTML="<div class='st-empty-state'>No rows to display</div>",void t.appendChild(e)}const k=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:E,leftWidth:T,rightWidth:O}=mn({headers:n.effectiveHeaders,containerWidth:k.containerWidth,collapsedHeaders:n.collapsedHeaders}),A=null!==(d=null===(a=n.rowSelectionManager)||void 0===a?void 0:a.getSelectedRowCount())&&void 0!==d?d:0,W=null!==(c=k.maxHeaderDepth)&&void 0!==c?c:1,P=null===(h=j(n.effectiveHeaders).find(t=>!t.isSelectionColumn))||void 0===h?void 0:h.accessor,$={collapsedHeaders:n.collapsedHeaders,collapsedRows:n.getCollapsedRows(),expandedRows:n.getExpandedRows(),expandedDepths:Array.from(n.expandedDepths),selectedColumns:null!==(p=null===(u=n.selectionManager)||void 0===u?void 0:u.getSelectedColumns())&&void 0!==p?p:new Set,rowsWithSelectedCells:null!==(v=null===(f=n.selectionManager)||void 0===f?void 0:f.getRowsWithSelectedCells())&&void 0!==v?v:new Set,columnBorders:null!==(w=n.config.columnBorders)&&void 0!==w&&w,enableRowSelection:n.config.enableRowSelection,selectedRowCount:A,cellUpdateFlash:n.config.cellUpdateFlash,useOddColumnBackground:n.config.useOddColumnBackground,useHoverRowBackground:null===(m=n.config.useHoverRowBackground)||void 0===m||m,useOddEvenRowBackground:n.config.useOddEvenRowBackground,rowGrouping:n.config.rowGrouping,headers:n.effectiveHeaders,rowHeaderAccessor:P,rowHeight:n.customTheme.rowHeight,maxHeaderDepth:W,heightOffsets:e.paginatedHeightOffsets,customTheme:n.customTheme,containerWidth:k.containerWidth,mainSectionContainerWidth:E,onCellEdit:n.config.onCellEdit,onCellClick:n.config.onCellClick,onRowGroupExpand:n.config.onRowGroupExpand,handleRowSelect:(t,e)=>{var o;null===(o=n.rowSelectionManager)||void 0===o||o.handleRowSelect(t,e)},cellRegistry:n.cellRegistry,getCollapsedRows:()=>n.getCollapsedRows(),getExpandedRows:()=>n.getExpandedRows(),setCollapsedRows:t=>{n.setCollapsedRows("function"==typeof t?t(n.getCollapsedRows()):t),this.scheduleRender(n.onRender)},setExpandedRows:t=>{n.setExpandedRows("function"==typeof t?t(n.getExpandedRows()):t),this.scheduleRender(n.onRender)},setRowStateMap:t=>{n.setRowStateMap("function"==typeof t?t(n.getRowStateMap()):t),this.scheduleRender(n.onRender)},icons:n.resolvedIcons,theme:null!==(g=n.config.theme)&&void 0!==g?g:"modern-light",rowButtons:n.config.rowButtons,loadingStateRenderer:n.config.loadingStateRenderer,errorStateRenderer:n.config.errorStateRenderer,emptyStateRenderer:n.config.emptyStateRenderer,getBorderClass:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.getBorderClass(t))||""},isSelected:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isSelected(t))||!1},isInitialFocusedCell:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isInitialFocusedCell(t))||!1},isCopyFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isCopyFlashing(t))||!1},isWarningFlashing:t=>{var e;return(null===(e=n.selectionManager)||void 0===e?void 0:e.isWarningFlashing(t))||!1},handleMouseDown:t=>{var e;return null===(e=n.selectionManager)||void 0===e?void 0:e.handleMouseDown(t)},handleMouseOver:(t,e,o)=>{var i;return null===(i=n.selectionManager)||void 0===i?void 0:i.handleMouseOver(t,e,o)},isRowSelected:t=>{var e,o;return null!==(o=null===(e=n.rowSelectionManager)||void 0===e?void 0:e.isRowSelected(t))&&void 0!==o&&o},canExpandRowGroup:n.config.canExpandRowGroup,isLoading:n.internalIsLoading,accordionAxis:n.accordionAxis},F=n.effectiveHeaders.filter(t=>"left"===t.pinned),L=n.effectiveHeaders.filter(t=>!t.pinned),D=n.effectiveHeaders.filter(t=>"right"===t.pinned);let B=0;const z=[],N=n.positionOnlyBody?void 0:n.animationCoordinator;if(F.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,pinned:"left",context:$,sectionWidth:T,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});n.pinnedLeftRef.current=o,z.push(o),o.parentElement!==t&&t.insertBefore(o,t.firstChild),B=this.sectionRenderer.getNextColIndex("left")}if(L.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,context:$,sectionWidth:E,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});if(n.mainBodyRef.current=o,z.push(o),o.parentElement!==t){const e=n.pinnedRightRef.current;e&&e.parentElement===t?t.insertBefore(o,e):t.appendChild(o)}B=this.sectionRenderer.getNextColIndex("main")}if(D.length>0){const o=this.sectionRenderer.renderBodySection({headers:n.effectiveHeaders,rows:H,collapsedHeaders:n.collapsedHeaders,pinned:"right",context:$,sectionWidth:O,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,totalRowCount:e.currentTableRows.length,startColIndex:B,positionOnly:n.positionOnlyBody,fullTableRows:e.currentTableRows,renderedStartIndex:e.renderedStartIndex,renderedEndIndex:e.renderedEndIndex,allFlattenedRows:e.allFlattenedRows,pageStartIndex:e.pageStartIndex,animationCoordinator:N});n.pinnedRightRef.current=o,z.push(o),o.parentElement!==t&&t.appendChild(o)}if(n.config.enableStickyParents&&e.stickyParents&&e.stickyParents.length>0){this.stickyParentsContainer&&(Qn(this.stickyParentsContainer,null!==(x=n.sectionScrollController)&&void 0!==x?x:null),this.stickyParentsContainer=null);const o=n.externalScrollActive?null!==(b=n.stickyParentsScrollTop)&&void 0!==b?b:0:null!==(R=null===(y=n.mainBodyRef.current)||void 0===y?void 0:y.scrollTop)&&void 0!==R?R:0,i=t.offsetWidth-t.clientWidth,s={left:0,main:F.length>0?this.sectionRenderer.getNextColIndex("left"):0,right:L.length>0?this.sectionRenderer.getNextColIndex("main"):F.length>0?this.sectionRenderer.getNextColIndex("left"):0},r=H.filter(t=>!t.nestedTable&&!t.stateIndicator),l=new Map;if(r.forEach((t,e)=>{var n;const o=null!==(n=t.stableRowKey)&&void 0!==n?n:tt(t.rowId);l.set(o,e)}),this.stickyParentsContainer=((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:tt(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 h=-1;for(let e=0;t.length>e;e++){const n=t[e],o=t[e+1];if(!o)break;if(o.depth===n.depth){h=e;break}if(n.depth>o.depth){h=t.findIndex(t=>t.depth===n.depth);break}}if(-1===h)return{treeTransitionOffset:0,offsetStartIndex:c};const u=null===(r=t[h])||void 0===r?void 0:r.position;if(void 0===u)return{treeTransitionOffset:0,offsetStartIndex:c};let p=0;for(const t of e){if(!(null===(l=t.parentIndices)||void 0===l?void 0:l.includes(u)))break;p++}if(0===p)return{treeTransitionOffset:0,offsetStartIndex:c};const f=e[0];let v;return v=n?n.rowTopPositions[f.position]:f.position*(o+i.rowSeparatorWidth),{treeTransitionOffset:-((h+1-p)*o+Math.max(0,s-v)),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.editColumns?"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 i=Xn({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:o.left,resolveBodyRowIndex:s});c.appendChild(i)}const p=Xn({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:o.main,resolveBodyRowIndex:s});if(c.appendChild(p),t.pinnedRightColumns.length>0){const i=Xn({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:o.right,resolveBodyRowIndex:s});c.appendChild(i)}return c})({calculatedHeaderHeight:k.calculatedHeaderHeight,heightMap:e.heightMap,partiallyVisibleRows:e.partiallyVisibleRows||[],pinnedLeftColumns:F,pinnedLeftWidth:T,pinnedRightColumns:D,pinnedRightWidth:O,scrollTop:o,scrollbarWidth:i,stickyParents:e.stickyParents,stickySectionColStart:s,stickyBodyRowIndexByRowKey:l,externalScrollActive:n.externalScrollActive},{collapsedHeaders:n.collapsedHeaders,customTheme:n.customTheme,editColumns:null!==(C=n.config.editColumns)&&void 0!==C&&C,headers:n.effectiveHeaders,rowHeight:n.customTheme.rowHeight,heightOffsets:e.paginatedHeightOffsets,cellRenderContext:$,sectionScrollController:null!==(S=n.sectionScrollController)&&void 0!==S?S: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&&(Qn(this.stickyParentsContainer,null!==(I=n.sectionScrollController)&&void 0!==I?I:null),this.stickyParentsContainer=null);Array.from(t.children).forEach(t=>{z.includes(t)||t.remove()})}renderFooter(t,e,n,o,i){var s,r,l,a,d,c,h,u,p,f,v;if(!t)return;const w=!!i.config.footerRenderer;if(!w&&(!i.config.shouldPaginate||i.config.hideFooter))return void(t.innerHTML="");const m=null!==(s=i.config.rowsPerPage)&&void 0!==s?s:10,g=Math.ceil(e/m);if(w){const s=(n-1)*m+1,a=i.config.footerRenderer({currentPage:n,endRow:Math.min(n*m,e),hasNextPage:g>n,hasPrevPage:n>1,nextIcon:null===(r=i.resolvedIcons)||void 0===r?void 0:r.next,onNextPage:async()=>{g>n&&(o(n+1),i.config.onNextPage&&await i.config.onNextPage(n+1))},onPageChange:o,onPrevPage:()=>{n>1&&o(n-1)},prevIcon:null===(l=i.resolvedIcons)||void 0===l?void 0:l.prev,rowsPerPage:m,startRow:s,totalPages:g,totalRows:e});return t.innerHTML="",a instanceof HTMLElement?t.appendChild(a):"string"==typeof a&&(t.innerHTML=a),void(this.footerInstance=null)}if(this.footerInstance)this.footerInstance.update({currentPage:n,hideFooter:null!==(a=i.config.hideFooter)&&void 0!==a&&a,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(d=i.config.shouldPaginate)&&void 0!==d&&d,totalPages:g,totalRows:e,prevIcon:null===(c=i.resolvedIcons)||void 0===c?void 0:c.prev,nextIcon:null===(h=i.resolvedIcons)||void 0===h?void 0:h.next});else{t.innerHTML="";const s=(t=>{let{currentPage:e,hideFooter:n,onPageChange:o,onNextPage:i,onUserPageChange:s,rowsPerPage:r,shouldPaginate:l,totalPages:a,totalRows:d,prevIcon:c,nextIcon:h}=t,u=!0;if(n||!l)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const p=document.createElement("div");p.className="st-footer";const f=()=>{p.innerHTML="";const t=e>1,n=a>e,l=e===a,v=Math.min((e-1)*r+1,d),w=Math.min(e*r,d),m=!t,g=!n&&!i||!u&&l,x=document.createElement("div");x.className="st-footer-info";const b=document.createElement("span");b.className="st-footer-results-text",b.textContent=`Showing ${v} to ${w} of ${d.toLocaleString()} results`,x.appendChild(b),p.appendChild(x);const y=document.createElement("div");y.className="st-footer-pagination";const R=((t,e)=>{if(15>=e)return Array.from({length:e},(t,e)=>e+1);const n=[];let o,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),C=[];R.forEach((t,n)=>{if(0>t){const t=document.createElement("span");t.className="st-page-ellipsis",t.textContent="...",y.appendChild(t)}else{const 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),C.push({button:i,page:t,afterEllipsis:r})}}),C.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 S=document.createElement("button");S.className="st-next-prev-btn "+(m?"disabled":""),S.disabled=m,S.setAttribute("aria-label","Go to previous page"),c?Nn(S,c):S.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />\n</svg>',S.addEventListener("click",async()=>{const t=e-1;1>t||(o(t),s&&await s(t))}),y.appendChild(S);const I=document.createElement("button");I.className="st-next-prev-btn "+(g?"disabled":""),I.disabled=g,I.setAttribute("aria-label","Go to next page"),h?Nn(I,h):I.innerHTML='<svg\n class="st-next-prev-icon"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" />\n</svg>',I.addEventListener("click",async()=>{const t=e+1;if(i&&e===a&&!await i(e))return u=!1,void f();t>a&&!i||(o(t),s&&await s(t))}),y.appendChild(I),p.appendChild(y)};return f(),{element:p,update:t=>{void 0!==t.currentPage&&(e=t.currentPage),void 0!==t.hideFooter&&(n=t.hideFooter),void 0!==t.onPageChange&&(o=t.onPageChange),void 0!==t.onNextPage&&(i=t.onNextPage),void 0!==t.onUserPageChange&&(s=t.onUserPageChange),void 0!==t.rowsPerPage&&(r=t.rowsPerPage),void 0!==t.shouldPaginate&&(l=t.shouldPaginate),void 0!==t.totalPages&&(a=t.totalPages),void 0!==t.totalRows&&(d=t.totalRows),void 0!==t.prevIcon&&(c=t.prevIcon),void 0!==t.nextIcon&&(h=t.nextIcon),n||!l?p.style.display="none":(p.style.display="flex",f())},destroy:()=>{p.remove()}}})({currentPage:n,hideFooter:null!==(u=i.config.hideFooter)&&void 0!==u&&u,onPageChange:o,onNextPage:i.config.onNextPage,onUserPageChange:i.config.onPageChange,rowsPerPage:m,shouldPaginate:null!==(p=i.config.shouldPaginate)&&void 0!==p&&p,totalPages:g,totalRows:e,prevIcon:null===(f=i.resolvedIcons)||void 0===f?void 0:f.prev,nextIcon:null===(v=i.resolvedIcons)||void 0===v?void 0:v.next});this.footerInstance=s,t.appendChild(s.element)}}renderColumnEditor(t,e,n,o,i){if(!t)return;if(!i.config.editColumns)return void(this.columnEditorInstance&&(this.columnEditorInstance.destroy(),this.columnEditorInstance=null));const s=()=>{const t=i.config.defaultHeaders;if(t){const e=t.map(t=>Object.assign({},t));i.setHeaders(e),i.onRender()}};if(this.columnEditorInstance)this.columnEditorInstance.update({columnEditorText:o.text,editColumns:i.config.editColumns,headers:i.headers,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:s,setOpen:n});else{const r=(t=>{let{columnEditorText:e,editColumns:n,headers:o,open:i,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f,setOpen:v}=t;if(!n)return{element:document.createElement("div"),update:()=>{},destroy:()=>{}};const w=document.createElement("div");w.className="st-column-editor "+(i?"open":""),w.style.width="29.5px";const m=t=>{v(!i)},g=document.createElement("div");g.className="st-column-editor-text",g.textContent=e,w.addEventListener("click",m),w.appendChild(g);const x=Yn({headers:o,open:i,searchEnabled:s,searchPlaceholder:r,searchFunction:l,columnEditorConfig:a,icons:d,essentialAccessors:c,resetColumns:h,setHeaders:u,onColumnVisibilityChange:p,onColumnOrderChange:f});w.appendChild(x.element);const b={update:t=>{void 0!==t.open&&(i=t.open,t.open?w.classList.add("open"):w.classList.remove("open")),void 0!==t.setOpen&&(v=t.setOpen),void 0!==t.columnEditorText&&(g.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.removeEventListener("click",m),x.destroy(),w.remove()}};return w.__columnEditor=b,Object.assign({element:w},b)})({columnEditorText:o.text,editColumns:i.config.editColumns,headers:i.headers,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:s,setOpen:n});this.columnEditorInstance=r,t.appendChild(r.element)}}renderHorizontalScrollbar(t,e,n,o,i,s,r,l){var a,d;if(t&&l.mainBodyRef.current&&r)return l.mainBodyRef.current.scrollWidth-l.mainBodyRef.current.clientWidth>1?void(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current)?vn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}):(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.scrollbarTimeoutId=window.setTimeout(()=>{var a,d,c,h;if(!l.mainBodyRef.current||!r||!t)return;if(this.horizontalScrollbarRef.current&&t.contains(this.horizontalScrollbarRef.current))return vn(this.horizontalScrollbarRef.current,{mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(a=l.config.editColumns)&&void 0!==a&&a,sectionScrollController:null!==(d=l.sectionScrollController)&&void 0!==d?d:void 0}),void(this.scrollbarTimeoutId=null);this.sectionScrollController=null!==(c=l.sectionScrollController)&&void 0!==c?c:null;const u=(t=>{const{mainBodyRef:e,mainBodyWidth:n,pinnedLeftWidth:o,pinnedRightWidth:i,pinnedLeftContentWidth:s,pinnedRightContentWidth:r,tableBodyContainerRef:l,editColumns:a,sectionScrollController:d}=t;if(1>=e.scrollWidth-e.clientWidth)return null;const c=a?W:0,h=(a?i+1:i)+(l.scrollHeight>l.clientHeight?l.offsetWidth-l.clientWidth:0),u=document.createElement("div");if(u.className="st-horizontal-scrollbar-container",o>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-left",t.style.width=o+"px";const e=document.createElement("div");e.style.width=s+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("pinned-left",t,"scrollbar")}if(n>0){const t=document.createElement("div");t.className="st-horizontal-scrollbar-middle";const e=document.createElement("div");e.style.width=n+"px",t.appendChild(e),u.appendChild(t),null==d||d.registerPane("main",t,"scrollbar")}if(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),u.appendChild(t),null==d||d.registerPane("pinned-right",t,"scrollbar")}if(c>0){const t=document.createElement("div");t.style.width=c-1.5+"px",t.style.height="100%",t.style.flexShrink="0",u.appendChild(t)}return u})({mainBodyRef:l.mainBodyRef.current,mainBodyWidth:e,pinnedLeftWidth:n,pinnedRightWidth:o,pinnedLeftContentWidth:i,pinnedRightContentWidth:s,tableBodyContainerRef:r,editColumns:null!==(h=l.config.editColumns)&&void 0!==h&&h,sectionScrollController:this.sectionScrollController});if(u){const e=t.querySelector(".st-content-wrapper");e&&e.nextSibling?t.insertBefore(u,e.nextSibling):t.appendChild(u),this.horizontalScrollbarRef.current=u}this.scrollbarTimeoutId=null},1))):(this.horizontalScrollbarRef.current&&(wn(this.horizontalScrollbarRef.current,l.sectionScrollController),this.horizontalScrollbarRef.current=null),void(null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null)))}cleanup(){var t,e;this.sectionRenderer.cleanup(),null===(t=this.footerInstance)||void 0===t||t.destroy(),null===(e=this.columnEditorInstance)||void 0===e||e.destroy(),null!==this.scrollbarTimeoutId&&(clearTimeout(this.scrollbarTimeoutId),this.scrollbarTimeoutId=null),this.horizontalScrollbarRef.current&&(wn(this.horizontalScrollbarRef.current,this.sectionScrollController),this.horizontalScrollbarRef.current=null),this.stickyParentsContainer&&(Qn(this.stickyParentsContainer,this.sectionScrollController),this.stickyParentsContainer=null),this.sectionScrollController=null}}function to(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:h=[],rowHeight:u=40,headerHeight:p=40,customTheme:f}=t;if(!n||0===n.length){const t=e.map((t,e)=>{const n=[e],i=[e];return{row:t,depth:0,displayPosition:e,groupingKey:void 0,position:e,rowId:Z({row:t,getRowId:o,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0}),rowPath:n,rowIndexPath:i,absoluteRowIndex:e,isLastGroupRow:!1,stableRowKey:ot({getRowId:o,row:t,depth:0,index:e,rowPath:n,rowIndexPath:i,groupingKey:void 0,parentStableKey:null})}});return{flattenedRows:t,heightOffsets:[],paginatableRows:t,parentEndPositions:e.map((t,e)=>e+1)}}const v=[],w=[],m=[],g=[];let x=0;const b=(t,e,y=[],R=[],C=[],S=null)=>{t.forEach((t,I)=>{var H,M;const k=n[e],E=v.length,T=[...y,I],O=[...R,I],A=Z({row:t,getRowId:o,depth:e,index:I,rowPath:T,rowIndexPath:O,groupingKey:k}),W=ot({getRowId:o,row:t,depth:e,index:I,rowPath:T,rowIndexPath:O,groupingKey:k,parentStableKey:S}),P=v.length,$={row:t,depth:e,displayPosition:x,groupingKey:k,position:E,isLastGroupRow:!1,rowId:A,rowPath:T,rowIndexPath:O,absoluteRowIndex:E,parentIndices:C.length>0?[...C]:void 0,stableRowKey:W};v.push($),w.push($),x++;const F=it({stableRowKey:W,rowId:A});if(lt(F,e,r,i,s)&&n.length>e){const n=null==l?void 0:l.get(F),o=((t,e)=>{const n=t[e];return Q(n)?n:[]})(t,k),i=h.find(t=>t.expandable&&t.nestedTable);if((null==i?void 0:i.nestedTable)&&o.length>0){const n=v.length,s=(null===(H=i.nestedTable.customTheme)||void 0===H?void 0:H.rowHeight)||u,r=(null===(M=i.nestedTable.customTheme)||void 0===M?void 0:M.headerHeight)||p,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:f}),a=J({calculatedHeight:l,customHeight:i.nestedTable.height,customTheme:f});m.push([n,a-u]);const d=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:n,isLastGroupRow:!1,rowId:d,rowPath:d,rowIndexPath:O,stableRowKey:st(F,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=v.length,i=[...T,k];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:o,isLastGroupRow:!1,rowId:i,rowPath:i,rowIndexPath:O,stableRowKey:st(F,k),stateIndicator:{parentRowId:F,parentRow:t,state:n},absoluteRowIndex:o,parentIndices:[...C,P]})}else if(n.loading&&!a){const t=v.length,n=[...T,k,"loading-skeleton"];v.push({row:{},depth:e+1,displayPosition:x-1,groupingKey:k,position:t,isLastGroupRow:!1,rowId:n,rowPath:n,rowIndexPath:O,isLoadingSkeleton:!0,absoluteRowIndex:t,parentIndices:[...C,P]})}}else if(o.length>0){const t=[...T,k],n=[...O];b(o,e+1,t,n,[...C,P],W)}}0===e&&g.push(v.length)})};return b(e,0,[],[],[]),g.forEach((t,e)=>{const n=t-1;n>=0&&v.length>n&&(v[n].isLastGroupRow=!0)}),{flattenedRows:v,heightOffsets:m,paginatableRows:w,parentEndPositions:g}}const eo=t=>{var e;const n=document.querySelector(".simple-table-root");if("string"==typeof t){if(t.endsWith("px"))return parseInt(t,10);if(t.endsWith("vh"))return window.innerHeight*parseInt(t,10)/100;if(t.endsWith("%")){const o=null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight;return!o||50>o?0:o*parseInt(t,10)/100}return window.innerHeight}return t};class no{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 Zn}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()}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)}computeEffectiveHeaders(t,e,n,o){var i;let s=[...t];return e.enableRowSelection&&!(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.isSelectionColumn)&&(s=[{accessor:"__row_selection__",label:"",width:n.selectionColumnWidth,isEditable:!1,type:"boolean",pinned:"left",isSelectionColumn:!0,isSortable:!1,filterable:!1,align:"center"},...s]),null!=o&&o>0?ut(s,{containerWidth:o}):ut(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,h,u,p,f,v,w,m,g,x,b;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:C,maxHeaderDepth:S}=y,I=0===t.collapsedHeaders.size?"":[...t.collapsedHeaders].map(String).sort().join("\0");let H;t.positionOnlyBody&&!0!==t.config.autoExpandColumns&&this.scrollRafHeadersMemo&&this.scrollRafHeadersMemo.headersRef===t.headers&&this.scrollRafHeadersMemo.containerWidth===R&&this.scrollRafHeadersMemo.collapsedKey===I?H=this.scrollRafHeadersMemo.effectiveHeaders:(H=this.computeEffectiveHeaders(t.headers,t.config,t.customTheme,R),this.scrollRafHeadersMemo=!0!==t.config.autoExpandColumns?{headersRef:t.headers,containerWidth:R,collapsedKey:I,effectiveHeaders:H}:null);const{leftWidth:M,rightWidth:k}=mn({headers:H,containerWidth:R,collapsedHeaders:t.collapsedHeaders});t.config.autoExpandColumns&&R>0&&(H=Rt(H,{autoExpandColumns:!0,containerWidth:R,pinnedLeftWidth:M,pinnedRightWidth:k,mainBodyRef:null!==(n=t.mainBodyRef)&&void 0!==n?n:{current:null},isResizing:null!==(o=t.isResizing)&&void 0!==o&&o}));let E=t.localRows;if(t.sortManager?E=t.sortManager.getSortedRows():t.filterManager&&(E=t.filterManager.getFilteredRows()),this.lastRowsRef!==E&&(this.invalidateCache("body"),this.invalidateCache("context"),this.lastRowsRef=E),t.internalIsLoading&&0===E.length){let n=t.config.shouldPaginate&&null!==(i=t.config.rowsPerPage)&&void 0!==i?i:10;e.isMainSectionScrollable&&(n+=1),E=Array.from({length:n},()=>({}))}const T=null===(s=t.sortManager)||void 0===s?void 0:s.getState(),O=null===(r=t.filterManager)||void 0===r?void 0:r.getState(),W=(null==T?void 0:T.sort)?`${T.sort.key.accessor}-${T.sort.direction}`:"none",P=JSON.stringify((null==O?void 0:O.filters)||{}),$=t.config.quickFilter,F=$?`${null!==(l=$.text)&&void 0!==l?l:""}|${null!==(a=$.mode)&&void 0!==a?a:"simple"}`:"",L=this.flattenedRowsCache&&this.flattenedRowsCache.deps.rowsRef===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===W&&this.flattenedRowsCache.deps.filterKey===P;let D,B,j;L&&this.flattenedRowsCache?(D=this.flattenedRowsCache.aggregatedRows,B=this.flattenedRowsCache.quickFilteredRows,j=this.flattenedRowsCache.flattenResult):(D=t.sortManager?E:Et({rows:E,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=>!t.hide&&!t.excludeFromRender&&(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=Y(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=Y(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:D,headers:H,quickFilter:t.config.quickFilter}),j=to({rows:B,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:H,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme}),this.flattenedRowsCache={aggregatedRows:D,quickFilteredRows:B,flattenResult:j,deps:{rowsRef:E,quickFilterKey:F,expandedRowsSize:t.expandedRows.size,collapsedRowsSize:t.collapsedRows.size,expandedDepthsSize:t.expandedDepths.size,rowStateMapSize:t.rowStateMap.size,sortKey:W,filterKey:P}});const z=(({height:t,maxHeight:e,rowHeight:n,totalRowCount:o,headerHeight:i,footerHeight:s,externalViewportHeight:r})=>{if(e){const t=eo(e);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 l=eo(t);return 0!==l?Math.max(0,l-n):void 0})({height:t.config.height,maxHeight:t.config.maxHeight,rowHeight:t.customTheme.rowHeight,shouldPaginate:null!==(d=t.config.shouldPaginate)&&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:j.paginatableRows.length,headerHeight:C,footerHeight:!t.config.shouldPaginate&&!t.config.footerRenderer||t.config.hideFooter?void 0:t.customTheme.footerHeight,externalViewportHeight:t.externalViewportHeight}),N=null!==(u=t.config.shouldPaginate)&&void 0!==u&&u,q=null!==(p=t.config.rowsPerPage)&&void 0!==p?p:10,V=null!==(f=t.config.serverSidePagination)&&void 0!==f&&f,G=null!==(v=t.config.totalRowCount)&&void 0!==v?v:j.paginatableRows.length,K=null!==(m=null===(w=t.config.rowGrouping)||void 0===w?void 0:w.join("\0"))&&void 0!==m?m:"",U=null!==(x=null===(g=j.heightOffsets)||void 0===g?void 0:g.length)&&void 0!==x?x:0;let J=0;if(j.heightOffsets)for(const[,t]of j.heightOffsets)J+=t;const _=null!==(b=t.config.enableStickyParents)&&void 0!==b&&b,X=void 0===z?"":`${L?1:0}|${z}|${e.currentPage}|${q}|${N}|${V}|${t.customTheme.rowHeight}|${C}|${G}|${_}|${K}|${j.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:o,scrollDirection:i="none",scrollTop:s,enableStickyParents:r,rowGrouping:l}=e,a=A(o),{currentTableRows:d,paginatedHeightOffsets:c,heightMap:h}=t;let u,p,f,v,w=0,m=d.length;if(void 0===n)u=d,p=[],f=u,v=[];else{const t=Lt({bufferRowCount:a,contentHeight:n,tableRows:d,rowHeight:o,scrollTop:s,scrollDirection:i,heightMap:h});if(u=t.rendered.rows,w=t.rendered.startIndex,m=t.rendered.endIndex,r)if(l){const e=Nt(d,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,l);p=e.stickyParents,f=e.regularRows,v=t.partiallyVisible.rows}else p=[],f=t.rendered.rows,v=[];else p=[],f=u,v=[]}return{currentTableRows:d,rowsToRender:u,renderedStartIndex:w,renderedEndIndex:m,stickyParents:p,regularRows:f,partiallyVisibleRows:v,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:_,rowGrouping:t.config.rowGrouping}):(Q=function(t){var e;const{contentHeight:n,currentPage:o,customTheme:i,enableStickyParents:s,flattenedRows:r,heightOffsets:l,parentEndPositions:a,rowHeight:d,rowsPerPage:c,scrollDirection:h="none",scrollTop:u,serverSidePagination:p,shouldPaginate:f,rowGrouping:v}=t,w=A(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,f,p);let g=0;if(f&&!p){const t=(o-1)*c;g=0===t?0:null!==(e=a[t-1])&&void 0!==e?e:0}const x=l&&0!==l.length&&f&&!p?(()=>{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,b=x&&x.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,x,i):void 0;let y,R,C,S,I=0,H=m.length;if(void 0===n)y=m,R=[],C=y,S=[];else{const t=Lt({bufferRowCount:w,contentHeight:n,tableRows:m,rowHeight:d,scrollTop:u,scrollDirection:h,heightMap:b});if(y=t.rendered.rows,I=t.rendered.startIndex,H=t.rendered.endIndex,s)if(v){const e=Nt(m,t.rendered.rows,t.fullyVisible.rows,t.partiallyVisible.rows,v);R=e.stickyParents,C=e.regularRows,S=t.partiallyVisible.rows}else R=[],C=t.rendered.rows,S=[];else R=[],C=y,S=[]}return{currentTableRows:m,rowsToRender:y,renderedStartIndex:I,renderedEndIndex:H,stickyParents:R,regularRows:C,partiallyVisibleRows:S,paginatedHeightOffsets:x,heightMap:b,allFlattenedRows:r,pageStartIndex:g}}({flattenedRows:j.flattenedRows,paginatableRows:j.paginatableRows,parentEndPositions:j.parentEndPositions,currentPage:e.currentPage,rowsPerPage:q,shouldPaginate:N,serverSidePagination:V,contentHeight:z,rowHeight:t.customTheme.rowHeight,scrollTop:e.scrollTop,scrollDirection:e.scrollDirection,heightOffsets:j.heightOffsets,customTheme:t.customTheme,enableStickyParents:_,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:H,calculatedHeaderHeight:C,maxHeaderDepth:S,flattenResult:j,processedResult:Q}}render(t,e,n,o,i){var s,r,l,a,d,c,h,u,p;const f=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,v=this.buildRowModelSnapshot(n,o);if(!v)return;const{dimensionState:w,containerWidth:m,effectiveHeaders:g,calculatedHeaderHeight:x,maxHeaderDepth:b,flattenResult:y,processedResult:R}=v;this.lastProcessedResult=R;const C=!0===n.positionOnlyBody;if(C&&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:S,leftWidth:I,rightWidth:H,leftContentWidth:M,rightContentWidth:k}=mn({headers:g,containerWidth:m,collapsedHeaders:n.collapsedHeaders}),E=m-I-H;if(!C){const e=t=>"number"==typeof t?t+"px":t,i=t.rootElement.style;if(n.config.maxHeight){const t=e(n.config.maxHeight);i.maxHeight=t,i.height=void 0===w.contentHeight?"auto":t}else i.removeProperty("max-height"),n.config.height?i.height=e(n.config.height):i.removeProperty("height");t.rootElement.classList.toggle("st-external-scroll",void 0!==n.externalViewportHeight);const{customTheme:s}=n;i.setProperty("--st-main-section-width",E+"px"),i.setProperty("--st-scrollbar-width",o.scrollbarWidth+"px"),i.setProperty("--st-editor-width",(n.config.editColumns?W:0)+"px"),i.setProperty("--st-border-width",s.borderWidth+"px"),i.setProperty("--st-footer-height",s.footerHeight+"px"),i.setProperty("--st-calculated-header-height",x+"px");const r=null!==(u=n.config.columnResizing)&&void 0!==u&&u;t.content.className="st-content "+(r?"st-resizeable":"st-not-resizeable"),t.content.style.width=n.config.editColumns?"calc(100% - 29.5px)":"100%",this.renderHeader(t.headerContainer,x,b,g,n)}this.renderBody(t.bodyContainer,R,g,n,o),this.lastScrollRafPaintedRange=C?{start:R.renderedStartIndex,end:R.renderedEndIndex}:null,this.registerSectionPanes(n);const T=n.sectionScrollController;T&&(T.setSectionScrollLeft("main",f),null!=n.pinnedLeftRef.current&&T.setSectionScrollLeft("pinned-left",n.pinnedLeftRef.current.scrollLeft),null!=n.pinnedRightRef.current&&T.setSectionScrollLeft("pinned-right",n.pinnedRightRef.current.scrollLeft),T.restoreAll()),C||(this.renderFooter(t.footerContainer,null!==(p=n.config.totalRowCount)&&void 0!==p?p:y.paginatableRows.length,o.currentPage,g,n),this.renderColumnEditor(t.contentWrapper,o.columnEditorOpen,i,g,n),this.renderHorizontalScrollbar(t.wrapperContainer,S,I,H,M,k,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||!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,draggedHeaderRef:e.draggedHeaderRef,hoveredHeaderRef:e.hoveredHeaderRef,mainBodyRef:e.mainBodyRef,pinnedLeftRef:e.pinnedLeftRef,pinnedRightRef:e.pinnedRightRef,mainHeaderRef:e.mainHeaderRef,pinnedLeftHeaderRef:e.pinnedLeftHeaderRef,pinnedRightHeaderRef:e.pinnedRightHeaderRef,dimensionManager:e.dimensionManager,sectionScrollController:e.sectionScrollController,sortManager:e.sortManager,filterManager:e.filterManager,selectionManager:e.selectionManager,rowSelectionManager:e.rowSelectionManager,rowStateMap:e.rowStateMap,onRender:e.onRender,setIsResizing:e.setIsResizing,setHeaders:e.setHeaders,setCollapsedHeaders:e.setCollapsedHeaders,setCollapsedRows:e.setCollapsedRows,setExpandedRows:e.setExpandedRows,setRowStateMap:e.setRowStateMap,getCollapsedRows:e.getCollapsedRows,getCollapsedHeaders:e.getCollapsedHeaders,getExpandedRows:e.getExpandedRows,getHeaders:e.getHeaders,getRowStateMap:e.getRowStateMap,positionOnlyBody:e.positionOnlyBody,essentialAccessors:e.essentialAccessors}}cleanup(){this.tableRenderer.cleanup()}}const oo=t=>{if(null==t)return"";const e=t+"";return e.includes(",")||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e};class io{static createAPI(t){const e=()=>{var e;return(null===(e=t.getCachedFlattenResult)||void 0===e?void 0:e.call(t))||to({rows:t.localRows,rowGrouping:t.config.rowGrouping,getRowId:t.config.getRowId,expandedRows:t.expandedRows,collapsedRows:t.collapsedRows,expandedDepths:t.expandedDepths,rowStateMap:t.rowStateMap,hasLoadingRenderer:!!t.config.loadingStateRenderer,hasErrorRenderer:!!t.config.errorStateRenderer,hasEmptyRenderer:!!t.config.emptyStateRenderer,headers:t.effectiveHeaders,rowHeight:t.customTheme.rowHeight,headerHeight:t.customTheme.headerHeight,customTheme:t.customTheme})},n=new Map;let o=!1;const i=()=>{o=!1,0!==n.size&&(n.forEach((e,n)=>{var o;const i=null===(o=t.cellRegistry)||void 0===o?void 0:o.get(n);i&&i.updateContent(e)}),n.clear())};let s=null;return{updateData:e=>{const{rowIndex:r,accessor:l,newValue:a}=e;if(r>=0&&t.localRows.length>r){const e=t.localRows[r];e[l]=a;const d=(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(!s||s.rowsRef!==i){const t=new WeakMap;for(const e of i)e.row&&t.set(e.row,e);s={rowsRef:i,map:t}}return s.map.get(e)}})(e);let c;if(d)c=d.rowId;else{const n=[r];c=t.config.getRowId?[r,t.config.getRowId({row:e,depth:0,index:r,rowPath:n,rowIndexPath:n})]:[r]}const h=`${c.join("-")}-${l}`;n.set(h,a),o||(o=!0,queueMicrotask(i))}},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=>oo(t.label)).join(","),s=t.map((t,e)=>{const n=t.row;return o.map((t,o)=>{const i=Y(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 oo(r)}if(!1!==t.useFormattedValueForCSV&&t.valueFormatter){const s=t.valueFormatter({accessor:t.accessor,colIndex:o,row:n,rowIndex:e,value:i});return oo(s)}return oo(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:()=>ye(t.headers),applyPinnedState:async e=>{const n=Ce(t.headers,e,t.essentialAccessors);n&&(t.setHeaders(n),t.onRender())},resetColumns:()=>{t.setHeaders(se(t.config.defaultHeaders)),t.onRender()},getFilterState:()=>{var e,n;return null!==(n=null===(e=t.filterManager)||void 0===e?void 0:e.getFilters())&&void 0!==n?n:{}},applyFilter:async e=>{t.filterManager&&t.filterManager.updateFilter(e)},clearFilter:async e=>{t.filterManager&&t.filterManager.clearFilter(e)},clearAllFilters:async()=>{t.filterManager&&t.filterManager.clearAllFilters()},getCurrentPage:()=>t.getCurrentPage(),getTotalPages:()=>{var n,o;const 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.config.rowGrouping)||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.config.rowGrouping)||void 0===n?void 0:n[e]},getGroupingDepth:e=>{var n,o;return null!==(o=null===(n=t.config.rowGrouping)||void 0===n?void 0:n.indexOf(e))&&void 0!==o?o:-1},toggleColumnEditor:e=>{t.config.editColumns&&(t.setColumnEditorOpen(void 0!==e?e:!t.columnEditorOpen),t.onRender())},applyColumnVisibility:async e=>{const n=o=>o.map(o=>{const i=o.accessor+"";let s=i in e?!e[i]:o.hide;return me(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)}}}}const so=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},ro=(t,e)=>{if(!t||!e)return null;const n=(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}})(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.max(0,Math.min(n.bottom,o.bottom)-s);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 lo{constructor(t,e){var n,o;this.draggedHeaderRef={current:null},this.hoveredHeaderRef={current:null},this.localRows=[],this.headers=[],this.essentialAccessors=new Set,this.currentPage=1,this.scrollTop=0,this.scrollDirection="none",this.isResizing=!1,this.isScrolling=!1,this._positionOnlyBody=!1,this.firstRenderDone=!1,this.internalIsLoading=!1,this.scrollbarWidth=0,this.isMainSectionScrollable=!1,this.columnEditorOpen=!1,this.collapsedHeaders=new Set,this.expandedDepths=new Set,this.expandedRows=new Map,this.collapsedRows=new Map,this.rowStateMap=new Map,this.announcement="",this.cellRegistry=new Map,this.headerRegistry=new Map,this.rowIndexMap=new Map,this.autoScaleManager=null,this.dimensionManager=null,this.scrollManager=null,this.sectionScrollController=null,this.sortManager=null,this.filterManager=null,this.selectionManager=null,this.rowSelectionManager=null,this.windowResizeManager=null,this.handleOutsideClickManager=null,this.scrollbarVisibilityManager=null,this.expandedDepthsManager=null,this.ariaAnnouncementManager=null,this.mounted=!1,this.scrollRafId=null,this.scrollEndTimeoutId=null,this.lastScrollTop=0,this.isUpdating=!1,this.resolvedScrollParent=null,this.externalScrollListener=null,this.externalWindowResizeListener=null,this.externalParentResizeObserver=null,this.externalViewportHeight=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=e,this.customTheme=Ie.mergeCustomTheme(e),this.mergedColumnEditorConfig=Ie.mergeColumnEditorConfig(e),this.resolvedIcons=Ie.resolveIcons(e),this.localRows=[...e.rows],this.headers=[...e.defaultHeaders],this.essentialAccessors=Ie.buildEssentialAccessors(this.headers),this.columnEditorOpen=null!==(n=e.editColumnsInitOpen)&&void 0!==n&&n,this.internalIsLoading=null!==(o=e.isLoading)&&void 0!==o&&o,this.collapsedHeaders=Ie.getInitialCollapsedHeaders(e.defaultHeaders),this.expandedDepths=Ie.getInitialExpandedDepths(e),this.domManager=new He,this.renderOrchestrator=new no,this.animationCoordinator=new M,this.applyAnimationsConfig(e.animations),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=Z({row:t,getRowId:this.config.getRowId,depth:0,index:e,rowPath:[e],rowIndexPath:[e]}),o=tt(n);this.rowIndexMap.set(o,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,o)=>{var i,s;if(t.hide||t.excludeFromRender)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.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.animationCoordinator.captureSnapshot({containers:this.getAnimatableContainers(),preLayouts:t})}beginAccordionAnimation(t){var e,n;if(!this.animationCoordinator.isEnabled())return;if(null===t)return;this.captureAnimationSnapshot(),this.pendingAccordionAxis=t;const o=this.animationCoordinator.getDuration(),i=this.animationCoordinator.getEasing(),s=null!==(n=null===(e=this.domManager.getElements())||void 0===e?void 0:e.rootElement)&&void 0!==n?n:this.container;s.style.setProperty(ae,o+"ms"),s.style.setProperty(de,i),s.classList.add(le),null!==this.accordionCleanupTimerId&&window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=window.setTimeout(()=>{s.classList.remove(le),s.style.removeProperty(ae),s.style.removeProperty(de),this.accordionCleanupTimerId=null},o+80)}initializeManagers(){var t,e,n;this.ariaAnnouncementManager=new oe,this.ariaAnnouncementManager.subscribe(t=>{this.announcement=t,this.updateAriaLiveRegion()}),this.expandedDepthsManager=new ne(null===(t=this.config.expandAll)||void 0===t||t,this.config.rowGrouping),this.expandedDepthsManager.subscribe(t=>{this.beginAccordionAnimation("vertical"),this.expandedDepths=t,this.render("expandedDepthsManager")});const o=t=>{this.ariaAnnouncementManager&&this.ariaAnnouncementManager.announce(t)};this.sortManager=new Tt({headers:this.headers,tableRows:this.localRows,externalSortHandling:this.config.externalSortHandling||!1,onSortChange:this.config.onSortChange,rowGrouping:this.config.rowGrouping,initialSortColumn:this.config.initialSortColumn,initialSortDirection:this.config.initialSortDirection,announce:o}),this.sortManager.subscribe(t=>{this.captureAnimationSnapshot(),this.render("sortManager")}),this.filterManager=new Pt({rows:this.localRows,headers:this.headers,externalFilterHandling:this.config.externalFilterHandling||!1,onFilterChange:this.config.onFilterChange,announce:o}),this.filterManager.subscribe(t=>{this.sortManager&&this.sortManager.updateConfig({tableRows:t.filteredRows}),this.render("filterManager")}),this.selectionManager=new _t({selectableCells:null!==(e=this.config.selectableCells)&&void 0!==e&&e,selectableColumns:null!==(n=this.config.selectableColumns)&&void 0!==n&&n,headers:this.headers,tableRows:[],onCellEdit:this.config.onCellEdit,cellRegistry:this.cellRegistry,collapsedHeaders:this.collapsedHeaders,rowHeight:this.customTheme.rowHeight,enableRowSelection:this.config.enableRowSelection,copyHeadersToClipboard:this.config.copyHeadersToClipboard,customTheme:this.customTheme,tableRoot:this.container,onSelectionDragEnd:()=>{this.renderOrchestrator.invalidateCache("context"),this.renderOrchestrator.invalidateCache("body"),this.render("selectionDragEnd")}})}mount(){this.mounted?console.warn("SimpleTableVanilla: Table is already mounted"):(this.domManager.createDOMStructure(this.container,this.config),this.mounted=!0,this.setupManagers())}setupManagers(){var t,e;const n=this.domManager.getRefs(),o=this.domManager.getElements();if(!n.tableBodyContainerRef.current||!o)return;this.scrollbarWidth=ie(n.tableBodyContainerRef.current);const i=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme);this.dimensionManager=new St({effectiveHeaders:i,headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,height:this.config.height,maxHeight:this.config.maxHeight,totalRowCount:this.localRows.length,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight,containerElement:n.tableBodyContainerRef.current}),this.dimensionManager.subscribe(()=>{this.render("dimensionManager"),this.firstRenderDone||(this.firstRenderDone=!0,this.config.onGridReady&&this.config.onGridReady())}),this.scrollManager=new It({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(t=this.config.infiniteScrollThreshold)&&void 0!==t?t:200});const s=t=>{var e;const n=this.domManager.getRefs().mainHeaderRef.current,o=this.selectionManager,i=o&&(this.config.selectableCells||this.config.selectableColumns)?{columnsWithSelectedCells:o.getColumnsWithSelectedCells(),selectedColumns:o.getSelectedColumns()}:void 0;null===(e=null==n?void 0:n.__renderHeaderCells)||void 0===e||e.call(n,t,i)};this.sectionScrollController=new Ht({onMainSectionScrollLeft:t=>{var e;s(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 Ct({autoExpandColumns:this.config.autoExpandColumns,containerWidth:this.dimensionManager.getState().containerWidth,pinnedLeftWidth:0,pinnedRightWidth:0,mainBodyRef:n.mainBodyRef,isResizing:this.isResizing},()=>{this.render("autoScaleManager")})),n.headerContainerRef.current&&n.tableBodyContainerRef.current&&(this.scrollbarVisibilityManager=new te({headerContainer:n.headerContainerRef.current,mainSection:n.tableBodyContainerRef.current,scrollbarWidth:this.scrollbarWidth}),this.scrollbarVisibilityManager.subscribe(t=>{this.isMainSectionScrollable=t,n.tableBodyContainerRef.current&&(this.scrollbarWidth=ie(n.tableBodyContainerRef.current)),this.render("scrollbarVisibilityManager")})),this.windowResizeManager=new Qt,this.windowResizeManager.addCallback(()=>{var t;if(n.tableBodyContainerRef.current){const e=ie(n.tableBodyContainerRef.current);this.scrollbarWidth=e,null===(t=this.scrollbarVisibilityManager)||void 0===t||t.setScrollbarWidth(e)}this.render("scrollbarWidth-change")}),this.config.enableRowSelection&&(this.rowSelectionManager=new Xt({tableRows:[],onRowSelectionChange:this.config.onRowSelectionChange,enableRowSelection:!0}),this.rowSelectionManager.subscribe(()=>{this.render("rowSelectionManager")})),this.selectionManager&&(this.handleOutsideClickManager=new Zt({selectableColumns:null!==(e=this.config.selectableColumns)&&void 0!==e&&e,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(){const t=this.domManager.getElements();if(!(null==t?void 0:t.bodyContainer))return;var e,n;const o=(n=this.config.maxHeight,null!=(e=this.config.height)&&""!==e||null!=n&&""!==n||null===so(this.config.scrollParent)?null:so(this.config.scrollParent));o!==this.resolvedScrollParent&&this.detachExternalScrollWiring(),o?(this.attachExternalScrollWiring(o),this.ensureBodyScrollListenerDetached(t.bodyContainer),this.recomputeExternalViewportHeight()):(this.ensureBodyScrollListenerAttached(t.bodyContainer),this.externalViewportHeight=0,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:void 0}))}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,o=ro(this.resolvedScrollParent,n);if(!o)return;const i=o.visibleViewportHeight;i!==this.externalViewportHeight&&(this.externalViewportHeight=i,this.dimensionManager&&this.dimensionManager.updateConfig({externalViewportHeight:i}))}handleExternalResize(){this.recomputeExternalViewportHeight(),this.recomputeExternalScrollPaddingTop(),this.render("external-scroll-resize")}handleExternalScroll(t){var e;const n=this.resolvedScrollParent;if(!n)return;const o=this.domManager.getElements(),i=null!==(e=null==o?void 0:o.rootElement)&&void 0!==e?e:this.container,s=ro(n,i);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)}getRenderContext(){const t=this.domManager.getRefs();return{accordionAxis:this.pendingAccordionAxis,config:this.config,customTheme:this.customTheme,resolvedIcons:this.resolvedIcons,effectiveHeaders:[],essentialAccessors:this.essentialAccessors,headers:this.headers,localRows:this.localRows,collapsedHeaders:this.collapsedHeaders,collapsedRows:this.collapsedRows,expandedRows:this.expandedRows,expandedDepths:this.expandedDepths,isResizing:this.isResizing,internalIsLoading:this.internalIsLoading,cellRegistry:this.cellRegistry,headerRegistry:this.headerRegistry,draggedHeaderRef:this.draggedHeaderRef,hoveredHeaderRef:this.hoveredHeaderRef,mainBodyRef:t.mainBodyRef,pinnedLeftRef:t.pinnedLeftRef,pinnedRightRef:t.pinnedRightRef,mainHeaderRef:t.mainHeaderRef,pinnedLeftHeaderRef:t.pinnedLeftHeaderRef,pinnedRightHeaderRef:t.pinnedRightHeaderRef,dimensionManager:this.dimensionManager,scrollManager:this.scrollManager,sectionScrollController:this.sectionScrollController,sortManager:this.sortManager,filterManager:this.filterManager,selectionManager:this.selectionManager,rowSelectionManager:this.rowSelectionManager,rowStateMap:this.rowStateMap,positionOnlyBody:this._positionOnlyBody,externalViewportHeight:this.resolvedScrollParent&&this.externalViewportHeight>0?this.externalViewportHeight:void 0,onRender:()=>this.render("resizeHandler-onRender"),setIsResizing:t=>{var e,n,o,i,s,r,l,a;if(this.isResizing=t,this.autoScaleManager&&!1===t){const t=this.domManager.getRefs(),d=null!==(a=null!==(r=null!==(o=null===(n=null===(e=t.tableBodyContainerRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:null===(s=null===(i=t.mainBodyRef)||void 0===i?void 0:i.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=se(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,getRowStateMap:()=>this.rowStateMap,setColumnEditorOpen:t=>{this.columnEditorOpen=t},setCurrentPage:t=>{this.currentPage=t}}}getRenderState(){return{currentPage:this.currentPage,scrollTop:this.scrollTop,scrollDirection:this.scrollDirection,scrollbarWidth:this.scrollbarWidth,isMainSectionScrollable:this.isMainSectionScrollable,columnEditorOpen:this.columnEditorOpen}}render(t){if(!this.mounted)return;if(this.isUpdating&&"update"!==t)return;this._positionOnlyBody="scroll-raf"===t&&!0===this.isScrolling;const e=this.domManager.getElements(),n=this.domManager.getRefs();e&&(this.renderOrchestrator.render(e,n,this.getRenderContext(),this.getRenderState(),this.mergedColumnEditorConfig),this.pendingAccordionAxis=null,this.lastRenderedVisibilityKey=this.buildVisibilityKey(this.headers),"scroll-raf"!==t&&this.animationCoordinator.play({containers:this.getAnimatableContainers()}))}update(e){var n,o,i,s;if(this.isUpdating=!0,this.config=Object.assign(Object.assign({},this.config),e),void 0!==e.animations&&this.applyAnimationsConfig(e.animations),void 0!==e.rows&&(this.firstRenderDone&&this.captureAnimationSnapshot(),this.localRows=[...e.rows],this.rebuildRowIndexMap(),this.filterManager&&this.filterManager.updateConfig({rows:this.localRows}),this.sortManager&&this.sortManager.updateConfig({tableRows:this.localRows})),void 0!==e.defaultHeaders&&(this.captureAnimationSnapshot(),this.headers=[...e.defaultHeaders],this.essentialAccessors=Ie.buildEssentialAccessors(this.headers),this.filterManager&&this.filterManager.updateConfig({headers:this.headers}),this.sortManager&&this.sortManager.updateConfig({headers:this.headers}),this.selectionManager&&this.selectionManager.updateConfig({headers:this.headers})),void 0!==e.isLoading&&(this.internalIsLoading=e.isLoading),void 0!==e.theme&&this.domManager.updateTheme(e.theme),void 0!==e.footerPosition&&this.domManager.syncFooterPosition(this.config.footerPosition),void 0!==e.customTheme){const e=this.customTheme;this.customTheme=Ie.mergeCustomTheme(this.config),function(e,n){for(const o of Object.keys(t))if(e[o]!==n[o])return!1;return!0}(e,this.customTheme)||(this.selectionManager&&this.selectionManager.updateConfig({customTheme:this.customTheme,rowHeight:this.customTheme.rowHeight}),null===(n=this.dimensionManager)||void 0===n||n.updateConfig({headerHeight:this.customTheme.headerHeight,rowHeight:this.customTheme.rowHeight,footerHeight:!this.config.shouldPaginate&&!this.config.footerRenderer||this.config.hideFooter?void 0:this.customTheme.footerHeight}),this.config.shouldPaginate&&e.rowHeight!==this.customTheme.rowHeight&&(this.currentPage=1),this.renderOrchestrator.invalidateCache("all"))}void 0===e.selectableColumns&&void 0===e.selectableCells||!this.selectionManager||this.selectionManager.updateConfig({selectableColumns:null!==(o=this.config.selectableColumns)&&void 0!==o&&o,selectableCells:null!==(i=this.config.selectableCells)&&void 0!==i&&i}),void 0===e.scrollParent&&void 0===e.height&&void 0===e.maxHeight||this.syncExternalScrollWiring(),void 0===e.onLoadMore&&void 0===e.infiniteScrollThreshold||!this.scrollManager||this.scrollManager.updateConfig({onLoadMore:this.config.onLoadMore,infiniteScrollThreshold:null!==(s=this.config.infiniteScrollThreshold)&&void 0!==s?s:200}),this.isUpdating=!1,this.render("update")}updateConfig(t){this.update(t)}destroy(){var t,e,n,o,i,s,r,l,a,d,c,h,u,p,f;this.mounted=!1,this.firstRenderDone=!1,null!==this.scrollRafId&&(cancelAnimationFrame(this.scrollRafId),this.scrollRafId=null),null!==this.scrollEndTimeoutId&&(clearTimeout(this.scrollEndTimeoutId),this.scrollEndTimeoutId=null),this.detachExternalScrollWiring();const v=this.domManager.getElements();(null==v?void 0:v.bodyContainer)&&(this.ensureBodyScrollListenerDetached(v.bodyContainer),this.bodyContainerMouseLeaveListener&&(v.bodyContainer.removeEventListener("mouseleave",this.bodyContainerMouseLeaveListener),this.bodyContainerMouseLeaveListener=null)),null!==this.accordionCleanupTimerId&&(window.clearTimeout(this.accordionCleanupTimerId),this.accordionCleanupTimerId=null);const w=null!==(e=null===(t=this.domManager.getElements())||void 0===t?void 0:t.rootElement)&&void 0!==e?e:this.container;w.classList.remove(le),w.style.removeProperty(ae),w.style.removeProperty(de),null===(n=this.dimensionManager)||void 0===n||n.destroy(),null===(o=this.scrollManager)||void 0===o||o.destroy(),null===(i=this.sectionScrollController)||void 0===i||i.destroy(),null===(s=this.sortManager)||void 0===s||s.destroy(),null===(r=this.filterManager)||void 0===r||r.destroy(),null===(l=this.rowSelectionManager)||void 0===l||l.destroy(),null===(a=this.selectionManager)||void 0===a||a.destroy(),null===(d=this.autoScaleManager)||void 0===d||d.destroy(),null===(c=this.windowResizeManager)||void 0===c||c.destroy(),null===(h=this.handleOutsideClickManager)||void 0===h||h.destroy(),null===(u=this.scrollbarVisibilityManager)||void 0===u||u.destroy(),null===(p=this.expandedDepthsManager)||void 0===p||p.destroy(),null===(f=this.ariaAnnouncementManager)||void 0===f||f.destroy(),this.animationCoordinator.destroy(),this.renderOrchestrator.cleanup(),this.domManager.destroy(this.container)}getAPI(){const t=this.renderOrchestrator.computeEffectiveHeaders(this.headers,this.config,this.customTheme),e=this;return io.createAPI({config:this.config,localRows:this.localRows,effectiveHeaders:t,get headers(){return e.headers},essentialAccessors:this.essentialAccessors,customTheme:this.customTheme,currentPage:this.currentPage,getCurrentPage:()=>this.currentPage,get expandedRows(){return e.expandedRows},get collapsedRows(){return e.collapsedRows},get expandedDepths(){return e.expandedDepths},clearExpandedRows:()=>{e.expandedRows=new Map},clearCollapsedRows:()=>{e.collapsedRows=new Map},rowStateMap:this.rowStateMap,headerRegistry:this.headerRegistry,cellRegistry:this.cellRegistry,columnEditorOpen:this.columnEditorOpen,getCachedFlattenResult:()=>this.renderOrchestrator.getCachedFlattenResult(),getCachedProcessedResult:()=>this.renderOrchestrator.getLastProcessedResult(),expandedDepthsManager:this.expandedDepthsManager,selectionManager:this.selectionManager,sortManager:this.sortManager,filterManager:this.filterManager,onRender:()=>this.render("columnEditor-onRender"),setHeaders:t=>{this.didColumnVisibilityChange(t)?this.beginAccordionAnimation("horizontal"):this.captureAnimationSnapshot(),this.headers=se(t),this.renderOrchestrator.invalidateCache("header")},setCurrentPage:t=>{this.currentPage=t},setColumnEditorOpen:t=>{this.columnEditorOpen=t,this.render("columnEditor-toggle")}})}}exports.SimpleTableVanilla=lo,exports.asRows=function(t){return t};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|