simple-table-core 0.7.95 → 0.7.96

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.
@@ -4,7 +4,7 @@ interface DateDropdownEditProps {
4
4
  onChange: (value: string) => void;
5
5
  open: boolean;
6
6
  setOpen: (open: boolean) => void;
7
- value: string | Date;
7
+ value: string;
8
8
  }
9
9
  declare const DateDropdownEdit: React.FC<DateDropdownEditProps>;
10
10
  export default DateDropdownEdit;
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as r,useRef as o,useCallback as i,useEffect as a,useMemo as c,createContext as d,useContext as l,forwardRef as s,useLayoutEffect as u,Fragment as h,useReducer as f,createRef as v}from"react";var m=function(){return m=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},m.apply(this,arguments)};function g(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{d(r.next(e))}catch(e){i(e)}}function c(e){try{d(r.throw(e))}catch(e){i(e)}}function d(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,c)}d((r=r.apply(e,n||[])).next())}))}function p(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(d){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,d])}}}function w(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var C=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},I=d(void 0),y=function(n){var t=n.children,r=n.value;return e(I.Provider,m({value:r},{children:t}))},x=function(){var e=l(I);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},b=function(t){var o=t.currentPage,i=t.hideFooter,a=t.onPageChange,c=t.onNextPage,d=t.shouldPaginate,l=t.totalPages,s=x(),u=s.nextIcon,h=s.prevIcon,f=r(!0),v=f[0],w=f[1],C=!(o>1),I=!(o<l)&&!c||!v&&o===l;if(i||!d)return null;var y=function(){if(l<=15)return Array.from({length:l},(function(e,n){return n+1}));var e,n,t=[],r=15;if(o<=Math.ceil(7.5))e=1,n=14;else if(o>=l-Math.floor(7.5))e=Math.max(1,l-r+1),n=l;else{var i=Math.floor(7);e=o-i,n=o+(r-i-1)}for(var a=e;a<=n;a++)t.push(a);return n<l-1&&(t.push(-1),t.push(l)),t}();return n("div",m({className:"st-footer"},{children:[e("button",m({className:"st-next-prev-btn ".concat(C?"disabled":""),onClick:function(){var e=o-1;e>=1&&a(e)},disabled:C},{children:h})),e("button",m({className:"st-next-prev-btn ".concat(I?"disabled":""),onClick:function(){return g(void 0,void 0,void 0,(function(){var e,n;return p(this,(function(t){switch(t.label){case 0:return e=o===l,n=o+1,c&&e?[4,c(o)]:[3,2];case 1:if(!t.sent())return w(!1),[2];t.label=2;case 2:return(n<=l||c)&&a(n),[2]}}))}))},disabled:I},{children:u})),y.map((function(n,t){return n<0?e("span",m({className:"st-page-ellipsis"},{children:"..."}),"ellipsis-".concat(n)):e("button",m({onClick:function(){return function(e){e>=1&&e<=l&&a(e)}(n)},className:"st-page-btn ".concat(o===n?"active":"")},{children:n}),"page-".concat(n))}))]}))},R=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},M=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},E=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},S=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},k=function(e){return e.position*(e.rowHeight+1)-1},D=function(e){return e.position*(e.rowHeight+1)},W=function(e){var n=e.accessor,t=e.rowIndex;return"cell-".concat(n,"-").concat(t)},N=function(e){var n=e.hiddenColumns,t=e.header,r=e.pinned;return n[t.accessor]?null:!r&&!t.pinned||t.pinned===r||null},H=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},L=function(n){var t=n.children,i=n.onClose,c=n.open,d=n.setOpen,l=n.width,s=n.containerRef,u=x(),h=null==u?void 0:u.mainBodyRef,f=o(null),v=o(null),g=r("bottom-left"),p=g[0],w=g[1],C=r({}),I=C[0],y=C[1],b=r(!1),R=b[0],M=b[1];return a((function(){c&&f.current?(M(!1),!v.current&&f.current.parentElement&&(v.current=f.current.parentElement),requestAnimationFrame((function(){if(f.current&&v.current){var e,n=f.current,t=v.current.getBoundingClientRect(),r=n.offsetHeight,o=l||n.offsetWidth,i=(e=(null==s?void 0:s.current)?s.current.getBoundingClientRect():(null==h?void 0:h.current)?h.current.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:function(){}}).bottom-t.bottom,a=t.top-e.top,c="bottom",d={};(r>i&&r<=a||r>i&&a>i)&&(c="top");var u="left";o>e.right-t.right+t.width&&(u="right"),"bottom"===c?d.top=t.bottom+4:d.bottom=window.innerHeight-t.top+4,"left"===u?d.left=t.left:d.right=window.innerWidth-t.right,w("".concat(c,"-").concat(u)),y(d),M(!0)}}))):c||M(!1)}),[c,l,s,h]),a((function(){var e=function(e){if(c&&f.current){var n=e.target;f.current&&!f.current.contains(n)&&(d(!1),null==i||i())}};return c&&window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}}),[c,i,d]),a((function(){var e=function(e){f.current&&!f.current.contains(e.target)&&(d(!1),null==i||i())};return c&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[i,c,d]),a((function(){var e=function(e){"Escape"===e.key&&c&&(d(!1),null==i||i())};return c&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[i,c,d]),c?e("div",m({ref:f,className:"st-dropdown-content st-dropdown-".concat(p),style:m({width:l?"".concat(l,"px"):"auto",visibility:R?"visible":"hidden"},I)},{children:t})):null},T=function(n){var t=n.children,r=n.onClick,o=n.isSelected,i=void 0!==o&&o,a=n.disabled,c=void 0!==a&&a,d=n.className,l=void 0===d?"":d;return e("div",m({className:"st-dropdown-item ".concat(i?"selected":""," ").concat(c?"disabled":""," ").concat(l),onClick:function(){!c&&r&&r()},role:"option","aria-selected":i,"aria-disabled":c},{children:t}))},B=function(t){var o=t.onBlur,i=t.onChange,c=t.open,d=t.setOpen,l=t.value,s=r(l),u=s[0],h=s[1];a((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var f=function(e){h(e),i(e),d(!1),o()};return n(L,m({open:c,onClose:function(){o()},setOpen:d,width:120},{children:[e(T,m({isSelected:!0===u,onClick:function(){return f(!0)}},{children:"True"})),e(T,m({isSelected:!1===u,onClick:function(){return f(!1)}},{children:"False"}))]}))},O=function(n){var t=n.defaultValue,r=n.onBlur,i=n.onChange,a=o(null);return e("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=t?t:"",onBlur:r,onChange:function(e){var n=e.target.value;i(n)}})},P=function(n){var t=n.defaultValue,r=n.onBlur,i=n.onChange,a=o(null);return e("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:t.toString(),onBlur:r,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},F=function(o){var i,a,c=o.value,d=o.onChange,l=o.onClose,s=x(),u=s.nextIcon,h=s.prevIcon,f=r(c||new Date),v=f[0],g=f[1],p=r("days"),w=p[0],C=p[1],I=function(e,n){return new Date(e,n+1,0).getDate()};return n("div",m({className:"st-datepicker"},{children:[n("div",m({className:"st-datepicker-header"},{children:["days"===w&&n(t,{children:[e("button",m({onClick:function(){g(new Date(v.getFullYear(),v.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:h})),n("div",m({className:"st-datepicker-header-label",onClick:function(){return C("months")}},{children:[(a=v,a.toLocaleString("default",{month:"long"}))," ",v.getFullYear()]})),e("button",m({onClick:function(){g(new Date(v.getFullYear(),v.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:u}))]}),"months"===w&&e("div",m({className:"st-datepicker-header-label",onClick:function(){return C("years")}},{children:v.getFullYear()})),"years"===w&&e("div",m({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),n("div",m({className:"st-datepicker-grid st-datepicker-".concat(w,"-grid")},{children:["days"===w&&function(){var n=[],t=v.getFullYear(),r=v.getMonth(),o=I(t,r),i=function(e,n){return new Date(e,n,1).getDay()}(t,r),a=I(t,r-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach((function(t,r){n.push(e("div",m({className:"st-datepicker-weekday"},{children:t}),"header-".concat(r)))}));for(var s=function(t){var r=a-i+t+1;n.push(e("div",m({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()-1,e);g(n),d(n),null==l||l()}(r)}},{children:r}),"prev-".concat(r)))},u=0;u<i;u++)s(u);for(var h=function(o){var i=o===(new Date).getDate()&&r===(new Date).getMonth()&&t===(new Date).getFullYear(),a=o===new Date(c).getDate()&&r===new Date(c).getMonth()&&t===new Date(c).getFullYear();n.push(e("div",m({className:"st-datepicker-day ".concat(i?"today":""," ").concat(a?"selected":""),onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth(),e);g(n),d(n),null==l||l()}(o)}},{children:o}),"day-".concat(o)))},f=1;f<=o;f++)h(f);var p=35-(i+o),w=function(t){n.push(e("div",m({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()+1,e);g(n),d(n),null==l||l()}(t)}},{children:t}),"next-".concat(t)))};for(f=1;f<=p;f++)w(f);return n}(),"months"===w&&(i=[],Array.from({length:12},(function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})})).forEach((function(n,t){var r=t===v.getMonth();i.push(e("div",m({className:"st-datepicker-month ".concat(r?"selected":""),onClick:function(){return function(e){g(new Date(v.getFullYear(),e,1)),C("days")}(t)}},{children:n}),"month-".concat(t)))})),i),"years"===w&&function(){for(var n=[],t=v.getFullYear(),r=t-6,o=function(r){var o=r===t;n.push(e("div",m({className:"st-datepicker-year ".concat(o?"selected":""),onClick:function(){return function(e){g(new Date(e,v.getMonth(),1)),C("months")}(r)}},{children:r}),"year-".concat(r)))},i=r;i<r+12;i++)o(i);return n}()]})),e("div",m({className:"st-datepicker-footer"},{children:e("button",m({className:"st-datepicker-today-btn",onClick:function(){var e=new Date;g(e),d(e),null==l||l()}},{children:"Today"}))}))]}))},A=function(n){var t=n.onBlur,o=n.onChange,i=n.open,c=n.setOpen,d=n.value,l=r(function(e){if(e instanceof Date)return e;if("string"==typeof e&&e.match(/^\d{4}-\d{2}-\d{2}$/)){var n=e.split("-").map(Number),t=n[0],r=n[1],o=n[2];return new Date(t,r-1,o)}var i=new Date(e);return isNaN(i.getTime())?new Date:i}(d)),s=l[0],u=l[1];a((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var h=function(){t()};return e(L,m({open:i,onClose:h,setOpen:c,width:280},{children:e(F,{value:s,onChange:function(e){u(e),o(e.toISOString()),c(!1),t()},onClose:h})}))},z=function(n){var t=n.onBlur,o=n.onChange,i=n.open,c=n.options,d=n.setOpen,l=n.value,s=r(l||""),u=s[0],h=s[1];a((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);return e(L,m({open:i,onClose:function(){t()},setOpen:d,width:150},{children:e("div",m({className:"st-enum-dropdown-content"},{children:c.map((function(n){return e(T,m({isSelected:u===n,onClick:function(){return h(e=n),o(e),d(!1),void t();var e}},{children:n}),n)}))}))}))},j=function(n){var t=n.enumOptions,r=void 0===t?[]:t,o=n.onChange,i=n.setIsEditing,a=n.type,c=void 0===a?"string":a,d=n.value,l=function(){i(!1)};if("boolean"===c&&"boolean"==typeof d)return e(B,{onBlur:l,onChange:function(e){return o(e)},open:!0,setOpen:i,value:d});if("date"===c)return e(A,{onBlur:l,onChange:function(e){return o(e)},open:!0,setOpen:i,value:"string"==typeof d?d:""});if("enum"===c)return e(z,{onBlur:l,onChange:function(e){return o(e)},open:!0,options:r,setOpen:i,value:"string"==typeof d?d:""});if("number"===c&&"number"==typeof d)return e(P,{defaultValue:d,onBlur:l,onChange:function(e){var n=""===e?0:parseFloat(e);o(isNaN(n)?0:n)}});var s=null==d?"":String(d);return e(O,{defaultValue:s,onBlur:l,onChange:function(e){return o(e)}})},U=0,Y=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===U||o-U>=r)&&(U=o,n(t))}},J=Date.now(),q={screenX:0,screenY:0},V=function(e,n,t){void 0===t&&(t=[]);for(var r=0;r<e.length;r++){var o=e[r];if(o.accessor===n)return w(w([],t,!0),[r],!1);if(o.children&&o.children.length>0){var i=V(o.children,n,w(w([],t,!0),[r],!1));if(i)return i}}return null};var K=function(e){var n,t,r=e.draggedHeaderRef,i=e.headersRef,c=e.hoveredHeaderRef,d=e.onColumnOrderChange,l=e.onTableHeaderDragEnd,s=(n=i.current,t=o(n),a((function(){JSON.stringify(t.current)!==JSON.stringify(n)&&(t.current=n)}),[n]),t.current);return{handleDragStart:function(e){r.current=e,J=Date.now()},handleDragOver:function(e){var n,t,o=e.event,a=e.hoveredHeader;if(o.preventDefault(),i.current){var d=o.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=o.screenX,h=o.screenY,f=Math.sqrt(Math.pow(u-q.screenX,2)+Math.pow(h-q.screenY,2));c.current=a;var v=i.current,m=V(v,(null===(n=r.current)||void 0===n?void 0:n.accessor)||""),g=V(v,a.accessor);if(m&&g){var p=m.length,w=g.length,C=g;if(p!==w){var I=w-p;I>0&&(C=g.slice(0,-I))}var y=function(e,n,t){var r=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var t=e,r=0;r<n.length-1;r++)t=t[n[r]].children;return t[n[n.length-1]]}function a(e,n,t){for(var r=e,i=0;i<n.length-1;i++){if(!r[n[i]].children){o=!0;break}r=r[n[i]].children}r[n[n.length-1]]=t}var c=i(r,n);return a(r,n,i(r,t)),a(r,t,c),{newHeaders:r,emergencyBreak:o}}(v,m,C),x=y.newHeaders,b=y.emergencyBreak;if(!(d||a.accessor===(null===(t=r.current)||void 0===t?void 0:t.accessor)||null===r.current||f<10||0===m.length||0===C.length||JSON.stringify(x)===JSON.stringify(i.current)||b)){var R=Date.now();JSON.stringify(x)===JSON.stringify(s)&&(R-J<1500||f<40)||(J=R,q={screenX:u,screenY:h},l(x))}}}},handleDragEnd:function(){r.current=null,c.current=null,null==d||d(i.current)}}},X=s((function(t,c){var d,l,s=t.borderClass,u=t.colIndex,h=t.header,f=t.isHighlighted,v=t.isInitialFocused,g=t.onExpandRowClick,p=t.rowIndex,w=t.visibleRow,C=x(),I=C.cellRegistry,y=C.cellUpdateFlash,b=C.collapseIcon,R=C.draggedHeaderRef,M=C.expandIcon,E=C.handleMouseDown,S=C.handleMouseOver,k=C.headersRef,D=C.hoveredHeaderRef,N=C.onCellEdit,L=C.onTableHeaderDragEnd,T=w.depth,B=w.row,O=r(B.rowData[h.accessor]),P=O[0],F=O[1],A=r(!1),z=A[0],U=A[1],J=r(!1),q=J[0],V=J[1],X=o(null),G=K({draggedHeaderRef:R,headersRef:k,hoveredHeaderRef:D,onTableHeaderDragEnd:L}).handleDragOver,$=Y(),_="cell-".concat(p,"-").concat(u),Q=H({rowId:B.rowMeta.rowId,accessor:h.accessor});a((function(){if(I){var e="".concat(B.rowMeta.rowId,"-").concat(h.accessor);return I.set(e,{updateContent:function(e){P!==e?(F(e),y&&(V(!0),X.current&&clearTimeout(X.current),X.current=setTimeout((function(){V(!1)}),800))):F(e)}}),function(){I.delete(e),X.current&&clearTimeout(X.current)}}}),[I,y,B.rowMeta.rowId,h.accessor,P]),a((function(){if(q){var e=setTimeout((function(){V(!1)}),850);return function(){return clearTimeout(e)}}}),[q]),a((function(){F(B.rowData[h.accessor])}),[B.rowData,h.accessor]),a((function(){f||U(!1)}),[f]);var Z,ee="boolean"===h.type||"date"===h.type||"enum"===h.type,ne=Boolean(null===(l=null===(d=B.rowMeta)||void 0===d?void 0:d.children)||void 0===l?void 0:l.length),te=Boolean(null==h?void 0:h.isEditable),re="st-cell ".concat(T>0&&h.expandable?"st-cell-depth-".concat(T):""," ").concat(f?v?"st-cell-selected-first ".concat(s):"st-cell-selected ".concat(s):""," ").concat(te?"clickable":""," ").concat(q?"st-cell-updating":""),oe=i((function(e){F(e),null==N||N({accessor:h.accessor,newValue:e,row:B})}),[h.accessor,N,B]);return z&&!ee?e("div",m({className:"st-cell-editing",id:W({accessor:h.accessor,rowIndex:p+1})},{children:e(j,{enumOptions:h.enumOptions,onChange:oe,setIsEditing:U,type:h.type,value:P})})):n("div",m({className:re,id:_,onDoubleClick:function(){return h.isEditable&&U(!0)},onMouseDown:function(){return E({rowIndex:p,colIndex:u,rowId:B.rowMeta.rowId})},onMouseOver:function(){return S({rowIndex:p,colIndex:u,rowId:B.rowMeta.rowId})},onDragOver:function(e){return $({callback:G,callbackProps:{event:e,hoveredHeader:h},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!h.isEditable||z||(e.preventDefault(),U(!0))},ref:c,"data-row-index":p,"data-col-index":u,"data-row-id":B.rowMeta.rowId,"data-accessor":h.accessor},{children:[h.expandable&&ne?B.rowMeta.isExpanded?e("div",m({className:"st-sort-icon-container",onClick:function(){return g(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:b})):e("div",m({className:"st-sort-icon-container",onClick:function(){return g(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:M})):null,e("span",m({className:"st-cell-content ".concat("right"===h.align?"right-aligned":"center"===h.align?"center-aligned":"")},{children:h.cellRenderer?h.cellRenderer({accessor:h.accessor,colIndex:u,row:B}):(Z=P,"boolean"==typeof Z?Z?"True":"False":Z)})),z&&ee&&e(j,{enumOptions:h.enumOptions,onChange:oe,setIsEditing:U,type:h.type,value:P})]}),Q)})),G=function(n){var r=n.children,o=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(n,["children"]);return x().allowAnimations?e($,m({},o,{children:r})):e(t,{children:r})},$=function(n){var i=n.children,c=n.isBody,d=n.pauseAnimation,l=n.rowIndex,s=o(!1),h=x(),f=h.draggedHeaderRef,v=h.headersRef,m=h.mainBodyRef,g=h.shouldPaginate,p=r({}),w=p[0],C=p[1],I=o({}),y=v.current;return u((function(){if(y){var e=function(e){var n=e.currentHeaders,t=e.draggedHeaderRef,r=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(W({accessor:e.accessor,rowIndex:r}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),c=i.getBoundingClientRect();a&&(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=c}}})),o}({currentHeaders:y,draggedHeaderRef:f,rowIndex:l});JSON.stringify(e)!==JSON.stringify(w)&&(I.current=w,C(e))}}),[w,y,f,c,l]),u((function(){var e=m.current,n=function(){s.current=!0},t=function(){s.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",t),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",t)}}),[f,m]),a((function(){d||s.current||Object.keys(I.current).length&&y&&y.forEach((function(e){var n=document.getElementById(W({accessor:e.accessor,rowIndex:l}));if(n){var t=I.current[e.accessor],r=w[e.accessor];if(t&&r){var o=t.left-r.left,i=g?0:t.top-r.top,a=Math.abs(o),c=Math.abs(i);(a>10||c>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[w,y,c,d,I,l,g]),e(t,{children:i})},_=function(n){var t=n.columnIndices,r=n.headers,o=n.hiddenColumns,i=n.isWidthDragging,a=n.onExpandRowClick,c=n.pinned,d=n.rowIndex,l=n.rowIndices,s=n.visibleRow,u=r.filter((function(e){return N({hiddenColumns:o,header:e,pinned:c})}));return e(G,m({isBody:!0,pauseAnimation:i,rowIndex:d+1},{children:u.map((function(n){return e(Q,{columnIndices:t,header:n,headers:r,hiddenColumns:o,onExpandRowClick:a,pinned:c,rowIndex:d,rowIndices:l,visibleRow:s},W({accessor:n.accessor,rowIndex:d+1}))}))}))},Q=function(n){var t=n.columnIndices,r=n.header,o=n.headers,i=n.hiddenColumns,a=n.onExpandRowClick,c=n.pinned,d=n.rowIndex,l=n.rowIndices,s=n.visibleRow,u=t[r.accessor],f=x(),v=f.getBorderClass,m=f.isSelected,g=f.isInitialFocusedCell;if(r.children){var p=r.children.filter((function(e){return N({hiddenColumns:i,header:e,pinned:c})}));return e(h,{children:p.map((function(n){return e(Q,{columnIndices:t,header:n,headers:o,hiddenColumns:i,onExpandRowClick:a,pinned:c,rowIndex:d,rowIndices:l,visibleRow:s},W({accessor:n.accessor,rowIndex:d+1}))}))})}var w={rowIndex:d,colIndex:u,rowId:s.row.rowMeta.rowId},C=v(w),I=m(w),y=g(w);return e(X,{borderClass:C,colIndex:u,header:r,isHighlighted:I,isInitialFocused:y,onExpandRowClick:a,rowIndex:d,visibleRow:s},W({accessor:r.accessor,rowIndex:d+1}))},Z=function(n){var t=n.columnIndices,r=n.gridTemplateColumns,o=n.headers,i=n.hiddenColumns,a=n.index,c=n.isWidthDragging,d=n.onExpandRowClick,l=n.pinned,s=n.rowHeight,u=n.rowIndices,h=n.visibleRow,f=h.position;return e("div",m({className:"st-row ".concat(f%2==0?"even":"odd"),style:{gridTemplateColumns:r,top:D({position:f,rowHeight:s}),height:"".concat(s,"px")}},{children:e(_,{columnIndices:t,headers:o,hiddenColumns:i,isWidthDragging:c,onExpandRowClick:d,pinned:l,rowIndex:a,rowIndices:u,visibleRow:h},a)}))},ee=function(n){var t=n.displayStrongBorder,r=n.position,o=n.rowHeight,i=n.templateColumns;return e("div",m({className:"st-row-separator ".concat(t?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:i,position:"absolute",top:k({position:r,rowHeight:o}),minWidth:"100%"}},{children:e("div",{style:{gridColumn:"1 / -1"}})}))},ne=function(t){var r=t.columnIndices,o=t.headers,i=t.hiddenColumns,a=t.isWidthDragging,c=t.onExpandRowClick,d=t.pinned,l=t.ref,s=t.rowHeight,u=t.rowIndices,f=t.templateColumns,v=t.totalHeight,g=t.visibleRows,p=t.width,w=d?"st-body-pinned-".concat(d):"st-body-main";return e("div",m({className:w,ref:l,style:m({position:"relative",height:"".concat(v,"px"),width:p},!d&&{flexGrow:1})},{children:g.map((function(t,l){var v,m,p=g[l-1],w=Boolean((null==p?void 0:p.depth)!==(null==t?void 0:t.depth)&&(null===(m=null===(v=null==t?void 0:t.row.rowMeta)||void 0===v?void 0:v.children)||void 0===m?void 0:m.length)&&0===t.depth);return n(h,{children:[0!==l&&e(ee,{displayStrongBorder:w,position:t.position,rowHeight:s,templateColumns:f}),e(Z,{columnIndices:r,gridTemplateColumns:f,headers:o,hiddenColumns:i,index:l,isWidthDragging:a,onExpandRowClick:c,pinned:d,rowHeight:s,rowIndices:u,visibleRow:t})]},t.position)}))}))};function te(e){var n=e.headersRef,t=e.hiddenColumns,r=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,c=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return N({hiddenColumns:t,header:e})})).forEach((function(e,n){c(e,0===n)}))};return r.forEach((function(e,n){c(e,0===n)})),n.current.filter((function(e){return!e.pinned&&N({hiddenColumns:t,header:e})})).forEach((function(e,n){var t=0===n&&0===r.length;c(e,t)})),o.forEach((function(e){c(e,!1)})),i}var re=function(t){var i=t.flattenedRows,d=t.headerContainerRef,l=t.isWidthDragging,s=t.mainTemplateColumns,u=t.pinnedLeftColumns,h=t.pinnedLeftTemplateColumns,f=t.pinnedLeftWidth,v=t.pinnedRightColumns,g=t.pinnedRightTemplateColumns,p=t.pinnedRightWidth,w=t.setFlattenedRows,C=t.setScrollTop,I=t.visibleRows,y=x(),b=y.headersRef,R=y.hiddenColumns,M=y.mainBodyRef,E=y.rowHeight,S=y.scrollbarWidth,k=y.tableBodyContainerRef;!function(e){var n=e.headerContainerRef,t=e.mainSectionRef,o=e.scrollbarWidth,i=r(!1),c=i[0],d=i[1];a((function(){var e=null==n?void 0:n.current;if(c&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[n,c,o]),a((function(){var e=null==n?void 0:n.current,r=null==t?void 0:t.current;if(r&&e){var o=function(){if(r){var e=r.scrollHeight>r.clientHeight;d(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(r),function(){r&&i.unobserve(r)}}}),[n,t])}({headerContainerRef:d,mainSectionRef:k,scrollbarWidth:S});var D,W,N=o(null),H=(D=0,(W=function(e){e.forEach((function(e){D+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&W(e.rowMeta.children)}))})(i),D)*(E+1)-1,L=c((function(){return te({headersRef:b,hiddenColumns:R,pinnedLeftColumns:u,pinnedRightColumns:v})}),[b,R,u,v]),T=c((function(){var e={};return I.forEach((function(n,t){var r=String(n.row.rowMeta.rowId);e[r]=t})),e}),[I]),B=function(e){var n=function(t){return t.rowMeta.rowId===e&&t.rowMeta.children?m(m({},t),{rowMeta:m(m({},t.rowMeta),{isExpanded:!t.rowMeta.isExpanded})}):t.rowMeta.children?m(m({},t),{rowMeta:m(m({},t.rowMeta),{children:t.rowMeta.children.map(n)})}):t};w((function(e){return e.map(n)}))},O={headerContainerRef:d,headers:b.current,hiddenColumns:R,isWidthDragging:l,rowHeight:E,visibleRows:I,columnIndices:L,rowIndices:T};return n("div",m({className:"st-body-container",ref:k,onScroll:function(e){var n=e.currentTarget.scrollTop;N.current&&cancelAnimationFrame(N.current),N.current=requestAnimationFrame((function(){C(n)}))}},{children:[u.length>0&&e(ne,m({},O,{onExpandRowClick:B,pinned:"left",templateColumns:h,totalHeight:H,width:f})),e(ne,m({},O,{ref:M,onExpandRowClick:B,templateColumns:s,totalHeight:H})),v.length>0&&e(ne,m({},O,{onExpandRowClick:B,pinned:"right",templateColumns:g,totalHeight:H,width:p}))]}))},oe=function(e,n){a((function(){if(e.current){var t=e.current,r=function(){var e,r=null==t?void 0:t.scrollLeft;void 0!==r&&(null===(e=n.current)||void 0===e||e.scrollTo(r,0))};return t.addEventListener("scroll",r),function(){null==t||t.removeEventListener("scroll",r)}}}),[e,n])},ie=function(e){return void 0===e&&(e=0),e?e+1:0},ae=function(e){return e.hide?[]:e.children&&0!==e.children.length?e.children.flatMap((function(e){return ae(e)})):[e]},ce=function(e){if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);var n=document.getElementById(W({accessor:e.accessor,rowIndex:0}));return(null==n?void 0:n.offsetWidth)||150},de=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(W({accessor:e.accessor,rowIndex:0})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.forEach((function(e){de(e)}))},le=function(e){return"number"==typeof e.minWidth?e.minWidth:40},se=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=e.setMainBodyWidth,i=e.setPinnedLeftWidth,a=e.setPinnedRightWidth,c=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=n.pinned,i=0;return t.forEach((function(e){e.hide||e.pinned!==o||(e.accessor===n.accessor?i+=r:ae(e).forEach((function(e){e.hide||(e.accessor===n.accessor?i+=r:i+=ce(e))})))})),n.pinned?ie(i):i}({header:n,headers:t,newWidth:r});"left"===n.pinned?i(c):"right"===n.pinned?a(c):n.pinned||o(c)},ue=function(e){var n=e.event,t=e.forceUpdate,r=e.gridColumnEnd,o=e.gridColumnStart,i=e.header,a=e.headersRef,c=e.setIsWidthDragging,d=e.setMainBodyWidth,l=e.setPinnedLeftWidth,s=e.setPinnedRightWidth,u=e.startWidth;c(!0),n.preventDefault();var h=n.clientX;if(i&&!i.hide){var f=le(i),v=r-o>1,m=v?ae(i):[i],g=function(e){var n="right"===i.pinned?h-e.clientX:e.clientX-h;if(v&&m.length>1)he({delta:n,header:i,headersRef:a,leafHeaders:m,minWidth:f,setMainBodyWidth:d,setPinnedLeftWidth:l,setPinnedRightWidth:s,startWidth:u});else{var r=Math.max(u+n,f);i.width=r,se({header:i,headers:a.current,newWidth:r,setMainBodyWidth:d,setPinnedLeftWidth:l,setPinnedRightWidth:s})}a.current.forEach((function(e){de(e)})),t()},p=function(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p),c(!1)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",p)}},he=function(e){var n=e.delta,t=e.header,r=e.headersRef,o=e.leafHeaders,i=e.minWidth,a=e.setMainBodyWidth,c=e.setPinnedLeftWidth,d=e.setPinnedRightWidth,l=e.startWidth,s=o.reduce((function(e,n){return Math.min(e,le(n))}),40),u=o.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),h=Math.max(l+n,s);se({header:t,headers:r.current,newWidth:h,setMainBodyWidth:a,setPinnedLeftWidth:c,setPinnedRightWidth:d});var f=h-u;o.forEach((function(e){var n="number"==typeof e.width?e.width:150,t=f*(n/u),r=Math.max(n+t,i);e.width=r}))},fe=s((function(t,r){var o,i,c=t.colIndex,d=t.forceHeadersUpdate,l=t.gridColumnEnd,s=t.gridColumnStart,u=t.gridRowEnd,h=t.gridRowStart,f=t.header,v=t.reverse,g=t.sort,p=x(),C=p.columnReordering,I=p.columnResizing,y=p.draggedHeaderRef,b=p.forceUpdate,R=p.headersRef,M=p.hoveredHeaderRef,E=p.onColumnOrderChange,S=p.onSort,k=p.onTableHeaderDragEnd,D=p.rowHeight,N=p.selectColumns,H=p.selectableColumns,L=p.setInitialFocusedCell,T=p.setIsWidthDragging,B=p.setMainBodyWidth,O=p.setPinnedLeftWidth,P=p.setPinnedRightWidth,F=p.setSelectedCells,A=p.setSelectedColumns,z=p.sortDownIcon,j=p.sortUpIcon,U=Boolean(null==f?void 0:f.isSortable),J="st-header-cell ".concat(f.accessor===(null===(o=M.current)||void 0===o?void 0:o.accessor)?"st-hovered":""," ").concat((null===(i=y.current)||void 0===i?void 0:i.accessor)===f.accessor?"st-dragging":""," ").concat(U?"clickable":""," ").concat(C&&!U?"columnReordering":""," ").concat("right"===(null==f?void 0:f.align)?"right-aligned":"center"===(null==f?void 0:f.align)?"center-aligned":""," ").concat(f.children?"parent":""),q=K({draggedHeaderRef:y,headersRef:R,hoveredHeaderRef:M,onColumnOrderChange:E,onTableHeaderDragEnd:k}),V=q.handleDragStart,X=q.handleDragEnd,G=q.handleDragOver,$=Y(),_=function(e){var n=e.event,t=e.header;if(H){var r=function(e,n){if(!e.children||0===e.children.length)return[n];var t=[],r=function(e,n){if(!e.children||0===e.children.length)return t.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var c=a[i];o=r(c,o)}return o};return r(e,n),t}(t,c);return n.shiftKey&&N?A((function(e){if(0===e.size)return new Set(r);var n=r[0],t=Array.from(e).sort((function(e,n){return e-n})),o=t[0],i=Math.abs(n-o);t.forEach((function(e){var t=Math.abs(n-e);t<i&&(i=t,o=e)}));var a,c,d,l,s=w(w([],(a=o,c=n,d=Math.min(a,c),l=Math.max(a,c),Array.from({length:l-d+1},(function(e,n){return d+n}))),!0),r,!0);return new Set(w(w([],Array.from(e),!0),s,!0))})):N&&N(r),F(new Set),void L(null)}t.isSortable&&S(c,t.accessor)};if(a((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!f)return null;var Q=I&&e("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;$({callback:ue,callbackProps:{event:e.nativeEvent,forceUpdate:b,gridColumnEnd:l,gridColumnStart:s,header:f,headersRef:R,setIsWidthDragging:T,setMainBodyWidth:B,setPinnedLeftWidth:O,setPinnedRightWidth:P,startWidth:"object"==typeof r&&null!==r&&"current"in r?null===(n=r.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),Z=g&&g.key.accessor===f.accessor&&n("div",m({className:"st-sort-icon-container",onClick:function(e){return _({event:e,header:f})}},{children:["ascending"===g.direction&&j&&j,"descending"===g.direction&&z&&z]}));return n("div",m({className:J,id:W({accessor:f.accessor,rowIndex:0}),onDragOver:function(e){$({callback:G,callbackProps:{event:e,hoveredHeader:f},limit:50})},ref:r,style:m(m({gridRowStart:h,gridRowEnd:u,gridColumnStart:s,gridColumnEnd:l},l-s>1?{}:{width:f.width}),u-h>1?{}:{height:D})},{children:[v&&Q,n("div",m({className:"st-header-label ".concat("right"===f.align?"right-aligned":"center"===f.align?"center-aligned":""),draggable:C&&!f.disableReorder,onClick:function(e){return _({event:e,header:f})},onDragEnd:function(e){e.preventDefault(),X(),d()},onDragStart:function(e){C&&f&&function(e){V(e)}(f)}},{children:["right"===f.align&&Z,null==f?void 0:f.label,"right"!==f.align&&Z]})),!v&&Q]}))})),ve=function(n){var t=n.columnIndices,r=n.gridTemplateColumns,o=n.handleScroll,i=n.headersRef,a=n.hiddenColumns,d=n.maxDepth,l=n.pinned,s=n.sectionRef,u=n.sort,h=f((function(e){return e+1}),0)[1],g=c((function(){var e=[],n=1,r=function(o,i,c){var s,u;if(void 0===c&&(c=!1),!N({hiddenColumns:a,header:o,pinned:l}))return 0;c||n++;var h=null!==(u=null===(s=o.children)||void 0===s?void 0:s.filter((function(e){return N({hiddenColumns:a,header:e,pinned:l})})).length)&&void 0!==u?u:0,f=n,v=h>0?f+h:f+1,m=i,g=h>0?i+1:d+1;if(e.push({header:o,gridColumnStart:f,gridColumnEnd:v,gridRowStart:m,gridRowEnd:g,colIndex:t[o.accessor]}),o.children){var p=!0;o.children.forEach((function(e){N({hiddenColumns:a,header:e,pinned:l})&&(r(e,i+1,p),p=!1)}))}return v-f},o=i.current.filter((function(e){return N({hiddenColumns:a,header:e,pinned:l})})),c=!0;return o.forEach((function(e){r(e,1,c),c=!1})),e}),[i,a,d,l,t]);return e("div",m({className:"st-header-".concat(l?"pinned-".concat(l):"main")},o&&{onScroll:o},{ref:s,style:{gridTemplateColumns:r,display:"grid",position:"relative"}},{children:e(G,m({rowIndex:0},{children:g.map((function(n){return e(fe,{colIndex:n.colIndex,forceHeadersUpdate:h,gridColumnEnd:n.gridColumnEnd,gridColumnStart:n.gridColumnStart,gridRowEnd:n.gridRowEnd,gridRowStart:n.gridRowStart,header:n.header,ref:v(),reverse:"right"===l,sort:u},n.header.accessor)}))}))}))},me=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(me)):1},ge=function(t){var r=t.centerHeaderRef,o=t.headerContainerRef,i=t.headersRef,a=t.hiddenColumns,d=t.mainTemplateColumns,l=t.pinnedLeftColumns,s=t.pinnedLeftTemplateColumns,h=t.pinnedRightColumns,f=t.pinnedRightTemplateColumns,v=t.sort,g=x(),p=g.mainBodyRef,w=g.pinnedLeftRef,C=g.pinnedRightRef,I=g.setPinnedLeftWidth,y=g.setPinnedRightWidth;oe(p,r);var b=c((function(){return te({headersRef:i,hiddenColumns:a,pinnedLeftColumns:l,pinnedRightColumns:h})}),[i,a,l,h]),R=c((function(){var e=i.current,n=0;return e.forEach((function(e){if(N({hiddenColumns:a,header:e})){var t=me(e);n=Math.max(n,t)}})),{maxDepth:n}}),[i,a]).maxDepth;return u((function(){var e,n;I(ie(null===(e=w.current)||void 0===e?void 0:e.clientWidth)),y(ie(null===(n=C.current)||void 0===n?void 0:n.clientWidth))}),[w,C,I,y]),n("div",m({className:"st-header-container",ref:o},{children:[l.length>0&&e(ve,{columnIndices:b,gridTemplateColumns:s,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:R,pinned:"left",sectionRef:w,sort:v}),e(ve,{columnIndices:b,gridTemplateColumns:d,handleScroll:function(e){var n,t,o=null===(n=r.current)||void 0===n?void 0:n.scrollLeft;void 0!==o&&(null===(t=p.current)||void 0===t||t.scrollTo(o,0))},headersRef:i,hiddenColumns:a,maxDepth:R,sectionRef:r,sort:v}),h.length>0&&e(ve,{columnIndices:b,gridTemplateColumns:f,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:R,pinned:"right",sectionRef:C,sort:v})]}))},pe=function(e){var n=e.headers,t=e.hiddenColumns,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==t[e.accessor]&&(e.children?r({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=r({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,t=e.width;return"number"==typeof t&&(t="".concat(t,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof t&&t.endsWith("fr")?"minmax(".concat(n,", ").concat(t,")"):"max(".concat(n,", ").concat(t,")"):t}(e)})).join(" "))},we=function(t){var r=t.flattenedRows,i=t.isWidthDragging,a=t.pinnedLeftWidth,d=t.pinnedRightWidth,l=t.setFlattenedRows,s=t.setScrollTop,u=t.sort,h=t.visibleRows,f=x(),v=f.editColumns,g=f.headersRef,p=f.hiddenColumns,w=o(null),C=o(null),I=g.current.filter((function(e){return!e.pinned})),y=g.current.filter((function(e){return"left"===e.pinned})),b=g.current.filter((function(e){return"right"===e.pinned})),R=c((function(){return pe({headers:y,hiddenColumns:p})}),[y,p]),M=c((function(){return pe({headers:I,hiddenColumns:p})}),[I,p]),E=c((function(){return pe({headers:b,hiddenColumns:p})}),[b,p]),S={flattenedRows:r,headerContainerRef:w,isWidthDragging:i,mainTemplateColumns:M,pinnedLeftColumns:y,pinnedLeftTemplateColumns:R,pinnedLeftWidth:a,pinnedRightColumns:b,pinnedRightTemplateColumns:E,pinnedRightWidth:d,setFlattenedRows:l,setScrollTop:s,visibleRows:h};return n("div",m({className:"st-content",style:{width:v?"calc(100% - 27.5px)":"100%"}},{children:[e(ge,m({},{centerHeaderRef:C,headerContainerRef:w,headersRef:g,hiddenColumns:p,mainTemplateColumns:M,pinnedLeftColumns:y,pinnedLeftTemplateColumns:R,pinnedRightColumns:b,pinnedRightTemplateColumns:E,sort:u})),e(re,m({},S))]}))},Ce=function(i){var c,d,l=i.mainBodyWidth,s=i.mainBodyRef,u=i.pinnedLeftWidth,h=i.pinnedRightWidth,f=i.setMainBodyWidth,v=i.tableBodyContainerRef,g=x().editColumns,p=r(!1),w=p[0],C=p[1],I=o(null),y=v.current&&v.current.scrollHeight>v.current.clientHeight,b=g?28:0,R=(g?h+1:h)+(v.current&&y?v.current.offsetWidth-v.current.clientWidth:0);return oe(s,I),a((function(){setTimeout((function(){!function(){if(s.current){var e=s.current.scrollWidth;f(e)}}()}),1)}),[s,f]),a((function(){setTimeout((function(){!function(){if(s.current){var e=s.current.clientWidth;C(l>e)}}()}),1)}),[s,l,f]),w?n("div",m({className:"st-horizontal-scrollbar-container"},{children:[u>0&&e("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:u,height:null===(c=I.current)||void 0===c?void 0:c.offsetHeight}}),l>0&&e("div",m({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&s.current&&s.current.scrollTo({left:n,behavior:"auto"})},ref:I,style:{flexGrow:1}},{children:e("div",{style:{width:l,height:".3px"}})})),h>0&&e(t,{children:e("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:R,height:null===(d=I.current)||void 0===d?void 0:d.offsetHeight}})}),b>0&&e("div",{style:{width:b-1.5,height:"100%",flexShrink:0}})]})):null},Ie={string:function(e,n,t){if(e===n)return 0;var r=e.localeCompare(n);return"ascending"===t?r:-r},number:function(e,n,t){if(e===n)return 0;var r=e-n;return"ascending"===t?r:-r},boolean:function(e,n,t){if(e===n)return 0;var r=e===n?0:e?-1:1;return"ascending"===t?r:-r},date:function(e,n,t){var r=new Date(e),o=new Date(n);if(r.getTime()===o.getTime())return 0;var i=r.getTime()-o.getTime();return"ascending"===t?i:-i},enum:function(e,n,t){return Ie.string(e,n,t)},default:function(e,n,t){return e===n?0:null==e?"ascending"===t?-1:1:null==n?"ascending"===t?1:-1:"string"==typeof e&&"string"==typeof n?Ie.string(e,n,t):"number"==typeof e&&"number"==typeof n?Ie.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?Ie.boolean(e,n,t):Ie.string(String(e),String(n),t)}},ye=function(e,n,t,r){if(void 0===t&&(t="string"),null==e||""===e)return"ascending"===r?-1:1;if(null==n||""===n)return"ascending"===r?1:-1;if("number"===t){var o=function(e){var n;if("number"==typeof e)return e;var t=String(e);if("string"==typeof t){var r=t.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(r){var o=parseFloat(r[1]),i=null===(n=r[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(t)||0},i=o(e),a=o(n);return Ie.number(i,a,r)}return"date"===t?Ie.date(String(e),String(n),r):"boolean"===t?Ie.boolean(Boolean(e),Boolean(n),r):"enum"===t?Ie.enum(String(e),String(n),r):Ie.string(String(e),String(n),r)},xe=function(e,n,t){var r,o=(null===(r=n.key)||void 0===r?void 0:r.type)||"string",i=n.direction,a=new Map,c=new Map,d="";e.forEach((function(e){var t;if(e.rowData&&!0===e.rowMeta.isExpanded&&!0===n.key.expandable){var r=(e.rowData.sector||"group_".concat(a.size)).toString();d=r,c.set(d,e),a.has(d)||a.set(d,[])}else if(d){var o=a.get(d)||[];o.push(e),a.set(d,o)}else{var i="default";a.has(i)||a.set(i,[]),null===(t=a.get(i))||void 0===t||t.push(e)}}));var l=[];return a.forEach((function(e,r){if(c.has(r)){var a=c.get(r);a.rowMeta.children&&a.rowMeta.children.length>0&&(a.rowMeta.children=be(a.rowMeta.children,n,t)),l.push(a)}var d=w([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,a=e.rowData[r],c=t.rowData[r];return ye(a,c,o,i)}));l.push.apply(l,d.map((function(e){var r=m({},e);if(r.rowMeta.children&&r.rowMeta.children.length>0){var o=be(r.rowMeta.children,n,t);r.rowMeta=m(m({},r.rowMeta),{children:o})}return r})))})),l},be=function(e,n,t){var r=t.find((function(e){return e.accessor===n.key.accessor})),o=(null==r?void 0:r.type)||"string",i=n.direction;return w([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,a=e.rowData[r],c=t.rowData[r];return ye(a,c,o,i)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?m(m({},e),{rowMeta:m(m({},e.rowMeta),{children:be(e.rowMeta.children,n,t)})}):e}))},Re=function(e){var n=e.headers,t=e.tableRows,o=r(null),i=o[0],a=o[1],d=c((function(){var e={};return n.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[n]),l=r(d),s=l[0],u=l[1],h=c((function(){if(!i)return t;var e=function(e,n,t){return{sortedData:xe(n,t,e),newSortConfig:t}}(n,t,i).sortedData;return e}),[t,i,n]);return{hiddenColumns:s,setHiddenColumns:u,setSort:a,sort:i,sortedRows:h,updateSort:function(e,t){var r=function(e){for(var n=0,o=e;n<o.length;n++){var i=o[n];if(i.accessor===t)return i;if(i.children&&i.children.length>0){var a=r(i.children);if(a)return a}}},o=r(n);o&&a((function(e){return e&&e.key.accessor===t?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))}}},Me=function(t){var r=t.checked,o=void 0!==r&&r,i=t.children,a=t.onChange;return n("label",m({className:"st-checkbox-label"},{children:[e("input",{checked:o,className:"st-checkbox-input",onChange:function(){a&&a(!o)},type:"checkbox"}),e("span",m({className:"st-checkbox-custom ".concat(o?"st-checked":"")},{children:o&&e("span",{className:"st-checkbox-checkmark"})})),i]}))},Ee=function(e,n,t,r){void 0===r&&(r=new Set);for(var o=0,i=e;o<i.length;o++){var a=i[o];if(!r.has(a.accessor)&&(r.add(a.accessor),a.children&&a.children.length>0)){var c=a.children.some((function(e){return e.accessor===n})),d=!1;if(!c)for(var l=0,s=a.children;l<s.length;l++){var u=s[l];if(Ee([u],n,t,r),!1===t[u.accessor]){d=!0;break}}(c||d)&&(t[a.accessor]=!1)}}},Se=function(e,n){return e.every((function(e){return!0===n[e.accessor]}))},ke=function(e,n){e.forEach((function(e){e.children&&e.children.length>0&&(ke(e.children,n),Se(e.children,n)&&(n[e.accessor]=!0))}))},De=function(o){var i=o.allHeaders,a=o.depth,c=void 0===a?0:a,d=o.header,l=o.hiddenColumns,s=o.setHiddenColumns,u=r(!0),h=u[0],f=u[1],v=x(),g=v.expandIcon,p=v.collapseIcon,w=v.headersRef,C=v.setMainBodyWidth,I=v.setPinnedLeftWidth,y=v.setPinnedRightWidth,b="".concat(16*c,"px"),R=d.children&&d.children.length>0,M=l[d.accessor]||R&&d.children&&Se(d.children,l);return n(t,{children:[n("div",m({className:"st-header-checkbox-item",style:{paddingLeft:b}},{children:[e("div",m({className:"st-header-icon-container"},{children:R?e("div",m({className:"st-collapsible-header-icon",onClick:function(e){e.stopPropagation(),f(!h)}},{children:h?p:g})):null})),e(Me,m({checked:M,onChange:function(e){var n=m({},l);(n[d.accessor]=e,e)?ke(i,n):(Ee(i,d.accessor,n),R&&d.children&&d.children.length>0&&d.children.every((function(e){return!0===l[e.accessor]}))&&d.children[0]&&(n[d.children[0].accessor]=!1,Ee(i,d.children[0].accessor,n)));s(n),w.current.forEach((function(e){e.hide=!0===n[e.accessor]})),function(e){var n=e.headers,t=e.setMainBodyWidth,r=e.setPinnedLeftWidth,o=e.setPinnedRightWidth,i=0,a=0,c=0;n.forEach((function(e){if(!e.hide){var n=ae(e).reduce((function(e,n){return e+ce(n)}),0);"left"===e.pinned?i+=n:"right"===e.pinned?a+=n:c+=n}}));var d=ie(i),l=ie(a);r(d),o(l),t(c)}({headers:w.current,setMainBodyWidth:C,setPinnedLeftWidth:I,setPinnedRightWidth:y})}},{children:d.label}))]})),R&&h&&d.children&&e("div",m({className:"st-nested-headers"},{children:d.children.map((function(n,t){return e(De,{allHeaders:i,depth:c+1,header:n,hiddenColumns:l,setHiddenColumns:s},"".concat(n.accessor,"-").concat(t))}))}))]})},We=function(n){var t=n.headers,r=n.open,o=n.position,i=n.setHiddenColumns,a=n.hiddenColumns,c="left"===o?"left":"";return e("div",m({className:"st-column-editor-popout ".concat(r?"open":""," ").concat(c),onClick:function(e){return e.stopPropagation()}},{children:e("div",m({className:"st-column-editor-popout-content"},{children:t.map((function(n,r){return e(De,{header:n,hiddenColumns:a,setHiddenColumns:i,allHeaders:t},"".concat(n.accessor,"-").concat(r))}))}))}))},Ne=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,c=t.headers,d=t.hiddenColumns,l=t.position,s=void 0===l?"right":l,u=t.setHiddenColumns,h=r(a),f=h[0],v=h[1];return i?n("div",m({className:"st-column-editor ".concat(f?"open":""," ").concat(s),onClick:function(){return function(e){v(e)}(!f)},style:{width:28}},{children:[e("div",m({className:"st-column-editor-text"},{children:o})),e(We,{headers:c,open:f,position:s,setHiddenColumns:u,hiddenColumns:d})]})):null},He=function(n){var t=r(!1),o=t[0],i=t[1];return a((function(){i(!0)}),[]),o?e(Le,m({},n)):null},Le=function(t){var d=t.allowAnimations,l=void 0!==d&&d,s=t.cellUpdateFlash,h=void 0!==s&&s,v=t.collapseIcon,g=void 0===v?e(S,{className:"st-sort-icon"}):v,p=t.columnEditorPosition,w=void 0===p?"right":p,I=t.columnEditorText,x=void 0===I?"Columns":I,k=t.columnReordering,D=void 0!==k&&k,W=t.columnResizing,N=void 0!==W&&W,L=t.defaultHeaders,T=t.editColumns,B=void 0!==T&&T,O=t.editColumnsInitOpen,P=void 0!==O&&O,F=t.expandIcon,A=void 0===F?e(M,{className:"st-sort-icon"}):F,z=t.height,j=t.hideFooter,U=void 0!==j&&j,Y=t.nextIcon,J=void 0===Y?e(M,{className:"st-next-prev-icon"}):Y,q=t.onCellEdit,V=t.onColumnOrderChange,K=t.onGridReady,X=t.onNextPage,G=t.prevIcon,$=void 0===G?e(R,{className:"st-next-prev-icon"}):G,_=t.rowHeight,Q=void 0===_?40:_,Z=t.rows,ee=t.rowsPerPage,ne=void 0===ee?10:ee,te=t.selectableCells,re=void 0!==te&&te,oe=t.selectableColumns,ie=void 0!==oe&&oe,ae=t.shouldPaginate,ce=void 0!==ae&&ae,de=t.sortDownIcon,le=void 0===de?e(S,{className:"st-sort-icon"}):de,se=t.sortUpIcon,ue=void 0===se?e(E,{className:"st-sort-icon"}):se,he=t.tableRef,fe=t.theme,ve=void 0===fe?"light":fe,me=o(null),ge=o(L),pe=o(null),Ie=o(null),ye=o(null),xe=o(null),be=o(null),Me=r(1),Ee=Me[0],Se=Me[1],ke=r(!1),De=ke[0],We=ke[1],He=r(0),Le=He[0],Te=He[1],Be=r(0),Oe=Be[0],Pe=Be[1],Fe=r(0),Ae=Fe[0],ze=Fe[1],je=r(0),Ue=je[0],Ye=je[1],Je=r(0),qe=Je[0],Ve=Je[1],Ke=Re({headers:ge.current,tableRows:Z}),Xe=Ke.sort,Ge=Ke.sortedRows,$e=Ke.hiddenColumns,_e=Ke.setHiddenColumns,Qe=Ke.updateSort;a((function(){null==K||K()}),[K]);var Ze=c((function(){if(!ce)return Ge;var e=(Ee-1)*ne,n=e+ne;return Ge.slice(e,n)}),[Ee,ne,ce,Ge]),en=r(Ze),nn=en[0],tn=en[1];a((function(){tn(Ze)}),[Ze]);var rn=c((function(){var e;if(!z)return window.innerHeight-Q;var n=document.querySelector(".simple-table-root"),t=0;if(z.endsWith("px"))t=parseInt(z,10);else if(z.endsWith("vh")){var r=parseInt(z,10);t=window.innerHeight*r/100}else if(z.endsWith("%")){var o=parseInt(z,10);t=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else t=window.innerHeight;return Math.max(0,t-Q)}),[z,Q]),on=c((function(){return function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=o+1,c=[],d=0,l=Math.max(0,i-a*n),s=i+t+a*n,u=function(e,n){for(var t,r=0,o=e;r<o.length;r++){var i=o[r],h=d*a;if(h>=s)break;h+a>l&&c.push({row:i,depth:n,position:d,isLastGroupRow:Boolean(null===(t=i.rowMeta.children)||void 0===t?void 0:t.length)&&n>1}),d+=1,i.rowMeta.isExpanded&&i.rowMeta.children&&u(i.rowMeta.children,n+1)}};return u(r,0),c}({bufferRowCount:5,contentHeight:rn,flattenedRows:nn,rowHeight:Q,scrollTop:Ue})}),[rn,Q,nn,Ue]),an=f((function(e){return e+1}),0)[1],cn=function(e){var n=e.selectableCells,t=e.headers,d=e.visibleRows,l=r(new Set),s=l[0],u=l[1],h=r(new Set),f=h[0],v=h[1],m=r(null),g=m[0],p=m[1],w=r(null),I=w[0],y=w[1],x=o(!1),b=o(null),R=i((function(){var e=Array.from(s).reduce((function(e,n){var r=n.split("-").map(Number),o=r[0],i=r[1];return e[o]||(e[o]=[]),e[o][i]=d[o].row.rowData[t[i].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");s.size>0&&navigator.clipboard.writeText(n)}),[t,s,d]),M=i((function(e,n){for(var t=new Set,r=Math.min(e.rowIndex,n.rowIndex),o=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),a=Math.max(e.colIndex,n.colIndex),c=r;c<=o;c++)for(var l=i;l<=a;l++)if(c>=0&&c<d.length){var s=d[c].row.rowMeta.rowId;t.add(C({colIndex:l,rowIndex:c,rowId:s}))}v(new Set),p(null),u(t)}),[d,v,p,u]),E=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<t.length){var n=C(e);v(new Set),p(null),u(new Set([n])),y(e)}}),[t.length,d.length,v,p,u,y]),S=i((function(e,n){void 0===n&&(n=!1),u(new Set),y(null),v((function(t){var r=new Set(n?t:[]);return e.forEach((function(e){return r.add(e)})),r})),e.length>0&&p(e[e.length-1])}),[u,y,v,p]);a((function(){var e=function(e){if(n&&I){var r=I.rowIndex,o=I.colIndex,i=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(d[r].row.rowMeta.rowId!==i){var a=d.findIndex((function(e){return e.row.rowMeta.rowId===i}));if(-1===a)return;r=a}if("ArrowUp"===e.key){if(e.preventDefault(),r>0){var c={rowIndex:r-1,colIndex:o,rowId:d[r-1].row.rowMeta.rowId};E(c)}}else"ArrowDown"===e.key?(e.preventDefault(),r<d.length-1&&(c={rowIndex:r+1,colIndex:o,rowId:d[r+1].row.rowMeta.rowId},E(c))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(c={rowIndex:r,colIndex:o-1,rowId:d[r].row.rowMeta.rowId},E(c))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<t.length-1&&(c={rowIndex:r,colIndex:o+1,rowId:d[r].row.rowMeta.rowId},E(c))):"Escape"===e.key&&(u(new Set),v(new Set),p(null),b.current=null,y(null))}else R()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[R,t.length,I,M,E,n,d]);var k=i((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=C({colIndex:n,rowIndex:t,rowId:r}),i=s.has(o),a=f.has(n);return i||a}),[s,f]),D=i((function(e){var n,t,r,o,i,a,c=e.colIndex,l=e.rowIndex,s=e.rowId,u=[],h=null===(r=null===(t=null===(n=d[l-1])||void 0===n?void 0:n.row)||void 0===t?void 0:t.rowMeta)||void 0===r?void 0:r.rowId,v={colIndex:c,rowIndex:l+1,rowId:null===(a=null===(i=null===(o=d[l+1])||void 0===o?void 0:o.row)||void 0===i?void 0:i.rowMeta)||void 0===a?void 0:a.rowId},m={colIndex:c-1,rowIndex:l,rowId:s},g={colIndex:c+1,rowIndex:l,rowId:s};return(!k({colIndex:c,rowIndex:l-1,rowId:h})||f.has(c)&&0===l)&&u.push("st-selected-top-border"),(!k(v)||f.has(c)&&l===d.length-1)&&u.push("st-selected-bottom-border"),k(m)||u.push("st-selected-left-border"),k(g)||u.push("st-selected-right-border"),u.join(" ")}),[k,d,f]),W=c((function(){return I?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===I.rowIndex&&t===I.colIndex&&r===I.rowId}:function(){return!1}}),[I]);return{getBorderClass:D,handleMouseDown:function(e){var t=e.colIndex,r=e.rowIndex,o=e.rowId;if(n){x.current=!0,b.current={rowIndex:r,colIndex:t,rowId:o},v(new Set),p(null);var i=C({colIndex:t,rowIndex:r,rowId:o});u(new Set([i])),y({rowIndex:r,colIndex:t,rowId:o})}},handleMouseOver:function(e){var t=e.colIndex,r=e.rowIndex;if(e.rowId,n&&x.current&&b.current){for(var o=new Set,i=Math.min(b.current.rowIndex,r),a=Math.max(b.current.rowIndex,r),c=Math.min(b.current.colIndex,t),l=Math.max(b.current.colIndex,t),s=i;s<=a;s++)for(var h=c;h<=l;h++)if(s>=0&&s<d.length){var f=d[s].row.rowMeta.rowId;o.add(C({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){x.current=!1},isInitialFocusedCell:W,isSelected:k,lastSelectedColumnIndex:g,selectColumns:S,selectedCells:s,selectedColumns:f,setInitialFocusedCell:y,setSelectedCells:u,setSelectedColumns:v}}({selectableCells:re,headers:ge.current,visibleRows:on}),dn=cn.getBorderClass,ln=cn.handleMouseDown,sn=cn.handleMouseOver,un=cn.handleMouseUp,hn=cn.isInitialFocusedCell,fn=cn.isSelected,vn=cn.selectColumns,mn=cn.selectedCells,gn=cn.selectedColumns,pn=cn.setInitialFocusedCell,wn=cn.setSelectedCells,Cn=cn.setSelectedColumns,In=i((function(e,n){Qe(e,n)}),[Qe]),yn=i((function(e){ge.current=e,an()}),[]);a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||ie&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(mn.size>0&&wn(new Set),gn.size>0&&Cn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[ie,mn,gn,wn,Cn]),u((function(){if(be.current){var e=be.current.offsetWidth-be.current.clientWidth;Ve(e)}}),[]),u((function(){var e=function(){if(an(),be.current){var e=be.current.offsetWidth-be.current.clientWidth;Ve(e)}};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var xn=o(new Map);return a((function(){he&&(he.current={updateData:function(e){var n,t,r,o,i=e.accessor,a=e.rowIndex,c=e.newValue,d=null===(t=null===(n=null==Z?void 0:Z[a])||void 0===n?void 0:n.rowMeta)||void 0===t?void 0:t.rowId;if(void 0!==d){var l=H({rowId:d,accessor:i}),s=xn.current.get(l);s&&s.updateContent(c),void 0!==(null===(o=null===(r=null==Z?void 0:Z[a])||void 0===r?void 0:r.rowData)||void 0===o?void 0:o[i])&&(Z[a].rowData[i]=c)}}})}),[he,Z]),e(y,m({value:{allowAnimations:l,cellRegistry:xn.current,cellUpdateFlash:h,collapseIcon:g,columnReordering:D,columnResizing:N,draggedHeaderRef:me,editColumns:B,expandIcon:A,forceUpdate:an,getBorderClass:dn,handleMouseDown:ln,handleMouseOver:sn,headersRef:ge,hiddenColumns:$e,hoveredHeaderRef:pe,isInitialFocusedCell:hn,isSelected:fn,mainBodyRef:Ie,nextIcon:J,onCellEdit:q,onColumnOrderChange:V,onSort:In,onTableHeaderDragEnd:yn,pinnedLeftRef:ye,pinnedRightRef:xe,prevIcon:$,rowHeight:Q,scrollbarWidth:qe,selectColumns:vn,selectableColumns:ie,setInitialFocusedCell:pn,setIsWidthDragging:We,setMainBodyWidth:Te,setPinnedLeftWidth:Pe,setPinnedRightWidth:ze,setSelectedCells:wn,setSelectedColumns:Cn,shouldPaginate:ce,sortDownIcon:le,sortUpIcon:ue,tableBodyContainerRef:be}},{children:e("div",m({className:"simple-table-root st-wrapper theme-".concat(ve),style:z?{height:z}:{}},{children:n("div",m({className:"st-wrapper-container"},{children:[n("div",m({className:"st-content-wrapper",onMouseUp:un,onMouseLeave:un},{children:[e(we,{flattenedRows:nn,isWidthDragging:De,pinnedLeftWidth:Oe,pinnedRightWidth:Ae,setFlattenedRows:tn,setScrollTop:Ye,sort:Xe,visibleRows:on}),e(Ne,{columnEditorText:x,editColumns:B,editColumnsInitOpen:P,headers:ge.current,hiddenColumns:$e,position:w,setHiddenColumns:_e})]})),e(Ce,{mainBodyRef:Ie,mainBodyWidth:Le,pinnedLeftWidth:Oe,pinnedRightWidth:Ae,setMainBodyWidth:Te,tableBodyContainerRef:be}),e(b,{currentPage:Ee,hideFooter:U,onPageChange:Se,onNextPage:X,shouldPaginate:ce,totalPages:Math.ceil(Z.length/ne)})]}))}))}))};export{He as SimpleTable};
1
+ import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as r,useRef as o,useCallback as i,useEffect as a,useMemo as c,createContext as d,useContext as l,forwardRef as s,useLayoutEffect as u,Fragment as h,useReducer as f,createRef as v}from"react";var m=function(){return m=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},m.apply(this,arguments)};function g(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{d(r.next(e))}catch(e){i(e)}}function c(e){try{d(r.throw(e))}catch(e){i(e)}}function d(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,c)}d((r=r.apply(e,n||[])).next())}))}function p(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(d){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,d])}}}function w(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var C=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},I=d(void 0),y=function(n){var t=n.children,r=n.value;return e(I.Provider,m({value:r},{children:t}))},x=function(){var e=l(I);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},b=function(t){var o=t.currentPage,i=t.hideFooter,a=t.onPageChange,c=t.onNextPage,d=t.shouldPaginate,l=t.totalPages,s=x(),u=s.nextIcon,h=s.prevIcon,f=r(!0),v=f[0],w=f[1],C=!(o>1),I=!(o<l)&&!c||!v&&o===l;if(i||!d)return null;var y=function(){if(l<=15)return Array.from({length:l},(function(e,n){return n+1}));var e,n,t=[],r=15;if(o<=Math.ceil(7.5))e=1,n=14;else if(o>=l-Math.floor(7.5))e=Math.max(1,l-r+1),n=l;else{var i=Math.floor(7);e=o-i,n=o+(r-i-1)}for(var a=e;a<=n;a++)t.push(a);return n<l-1&&(t.push(-1),t.push(l)),t}();return n("div",m({className:"st-footer"},{children:[e("button",m({className:"st-next-prev-btn ".concat(C?"disabled":""),onClick:function(){var e=o-1;e>=1&&a(e)},disabled:C},{children:h})),e("button",m({className:"st-next-prev-btn ".concat(I?"disabled":""),onClick:function(){return g(void 0,void 0,void 0,(function(){var e,n;return p(this,(function(t){switch(t.label){case 0:return e=o===l,n=o+1,c&&e?[4,c(o)]:[3,2];case 1:if(!t.sent())return w(!1),[2];t.label=2;case 2:return(n<=l||c)&&a(n),[2]}}))}))},disabled:I},{children:u})),y.map((function(n,t){return n<0?e("span",m({className:"st-page-ellipsis"},{children:"..."}),"ellipsis-".concat(n)):e("button",m({onClick:function(){return function(e){e>=1&&e<=l&&a(e)}(n)},className:"st-page-btn ".concat(o===n?"active":"")},{children:n}),"page-".concat(n))}))]}))},R=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},M=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},E=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},S=function(n){var t=n.className;return e("svg",m({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},k=function(e){return e.position*(e.rowHeight+1)-1},D=function(e){return e.position*(e.rowHeight+1)},W=function(e){var n=e.accessor,t=e.rowIndex;return"cell-".concat(n,"-").concat(t)},N=function(e){var n=e.hiddenColumns,t=e.header,r=e.pinned;return n[t.accessor]?null:!r&&!t.pinned||t.pinned===r||null},H=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},L=function(n){var t=n.children,i=n.onClose,c=n.open,d=n.setOpen,l=n.width,s=n.containerRef,u=x(),h=null==u?void 0:u.mainBodyRef,f=o(null),v=o(null),g=r("bottom-left"),p=g[0],w=g[1],C=r({}),I=C[0],y=C[1],b=r(!1),R=b[0],M=b[1];return a((function(){c&&f.current?(M(!1),!v.current&&f.current.parentElement&&(v.current=f.current.parentElement),requestAnimationFrame((function(){if(f.current&&v.current){var e,n=f.current,t=v.current.getBoundingClientRect(),r=n.offsetHeight,o=l||n.offsetWidth,i=(e=(null==s?void 0:s.current)?s.current.getBoundingClientRect():(null==h?void 0:h.current)?h.current.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:function(){}}).bottom-t.bottom,a=t.top-e.top,c="bottom",d={};(r>i&&r<=a||r>i&&a>i)&&(c="top");var u="left";o>e.right-t.right+t.width&&(u="right"),"bottom"===c?d.top=t.bottom+4:d.bottom=window.innerHeight-t.top+4,"left"===u?d.left=t.left:d.right=window.innerWidth-t.right,w("".concat(c,"-").concat(u)),y(d),M(!0)}}))):c||M(!1)}),[c,l,s,h]),a((function(){var e=function(e){if(c&&f.current){var n=e.target;f.current&&!f.current.contains(n)&&(d(!1),null==i||i())}};return c&&window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}}),[c,i,d]),a((function(){var e=function(e){f.current&&!f.current.contains(e.target)&&(d(!1),null==i||i())};return c&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[i,c,d]),a((function(){var e=function(e){"Escape"===e.key&&c&&(d(!1),null==i||i())};return c&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[i,c,d]),c?e("div",m({ref:f,className:"st-dropdown-content st-dropdown-".concat(p),style:m({width:l?"".concat(l,"px"):"auto",visibility:R?"visible":"hidden"},I)},{children:t})):null},T=function(n){var t=n.children,r=n.onClick,o=n.isSelected,i=void 0!==o&&o,a=n.disabled,c=void 0!==a&&a,d=n.className,l=void 0===d?"":d;return e("div",m({className:"st-dropdown-item ".concat(i?"selected":""," ").concat(c?"disabled":""," ").concat(l),onClick:function(){!c&&r&&r()},role:"option","aria-selected":i,"aria-disabled":c},{children:t}))},B=function(t){var o=t.onBlur,i=t.onChange,c=t.open,d=t.setOpen,l=t.value,s=r(l),u=s[0],h=s[1];a((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var f=function(e){h(e),i(e),d(!1),o()};return n(L,m({open:c,onClose:function(){o()},setOpen:d,width:120},{children:[e(T,m({isSelected:!0===u,onClick:function(){return f(!0)}},{children:"True"})),e(T,m({isSelected:!1===u,onClick:function(){return f(!1)}},{children:"False"}))]}))},O=function(n){var t=n.defaultValue,r=n.onBlur,i=n.onChange,a=o(null);return e("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=t?t:"",onBlur:r,onChange:function(e){var n=e.target.value;i(n)}})},P=function(n){var t=n.defaultValue,r=n.onBlur,i=n.onChange,a=o(null);return e("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:t.toString(),onBlur:r,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},F=function(o){var i,a,c=o.value,d=o.onChange,l=o.onClose,s=x(),u=s.nextIcon,h=s.prevIcon,f=r(c||new Date),v=f[0],g=f[1],p=r("days"),w=p[0],C=p[1],I=function(e,n){return new Date(e,n+1,0).getDate()};return n("div",m({className:"st-datepicker"},{children:[n("div",m({className:"st-datepicker-header"},{children:["days"===w&&n(t,{children:[e("button",m({onClick:function(){g(new Date(v.getFullYear(),v.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:h})),n("div",m({className:"st-datepicker-header-label",onClick:function(){return C("months")}},{children:[(a=v,a.toLocaleString("default",{month:"long"}))," ",v.getFullYear()]})),e("button",m({onClick:function(){g(new Date(v.getFullYear(),v.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:u}))]}),"months"===w&&e("div",m({className:"st-datepicker-header-label",onClick:function(){return C("years")}},{children:v.getFullYear()})),"years"===w&&e("div",m({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),n("div",m({className:"st-datepicker-grid st-datepicker-".concat(w,"-grid")},{children:["days"===w&&function(){var n=[],t=v.getFullYear(),r=v.getMonth(),o=I(t,r),i=function(e,n){return new Date(e,n,1).getDay()}(t,r),a=I(t,r-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach((function(t,r){n.push(e("div",m({className:"st-datepicker-weekday"},{children:t}),"header-".concat(r)))}));for(var s=function(t){var r=a-i+t+1;n.push(e("div",m({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()-1,e);g(n),d(n),null==l||l()}(r)}},{children:r}),"prev-".concat(r)))},u=0;u<i;u++)s(u);for(var h=function(o){var i=o===(new Date).getDate()&&r===(new Date).getMonth()&&t===(new Date).getFullYear(),a=o===new Date(c).getDate()&&r===new Date(c).getMonth()&&t===new Date(c).getFullYear();n.push(e("div",m({className:"st-datepicker-day ".concat(i?"today":""," ").concat(a?"selected":""),onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth(),e);g(n),d(n),null==l||l()}(o)}},{children:o}),"day-".concat(o)))},f=1;f<=o;f++)h(f);var p=35-(i+o),w=function(t){n.push(e("div",m({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()+1,e);g(n),d(n),null==l||l()}(t)}},{children:t}),"next-".concat(t)))};for(f=1;f<=p;f++)w(f);return n}(),"months"===w&&(i=[],Array.from({length:12},(function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})})).forEach((function(n,t){var r=t===v.getMonth();i.push(e("div",m({className:"st-datepicker-month ".concat(r?"selected":""),onClick:function(){return function(e){g(new Date(v.getFullYear(),e,1)),C("days")}(t)}},{children:n}),"month-".concat(t)))})),i),"years"===w&&function(){for(var n=[],t=v.getFullYear(),r=t-6,o=function(r){var o=r===t;n.push(e("div",m({className:"st-datepicker-year ".concat(o?"selected":""),onClick:function(){return function(e){g(new Date(e,v.getMonth(),1)),C("months")}(r)}},{children:r}),"year-".concat(r)))},i=r;i<r+12;i++)o(i);return n}()]})),e("div",m({className:"st-datepicker-footer"},{children:e("button",m({className:"st-datepicker-today-btn",onClick:function(){var e=new Date;g(e),d(e),null==l||l()}},{children:"Today"}))}))]}))},A=function(n){var t=n.onBlur,o=n.onChange,i=n.open,c=n.setOpen,d=n.value,l=r(function(e){var n=e.split("-").map(Number),t=n[0],r=n[1],o=n[2],i=new Date;return i.setUTCFullYear(t),i.setUTCMonth(r-1),i.setUTCDate(o),isNaN(i.getTime())?new Date:i}(d)),s=l[0],u=l[1];a((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var h=function(){t()};return e(L,m({open:i,onClose:h,setOpen:c,width:280},{children:e(F,{value:s,onChange:function(e){u(e),o(e.toISOString()),c(!1),t()},onClose:h})}))},U=function(n){var t=n.onBlur,o=n.onChange,i=n.open,c=n.options,d=n.setOpen,l=n.value,s=r(l||""),u=s[0],h=s[1];a((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);return e(L,m({open:i,onClose:function(){t()},setOpen:d,width:150},{children:e("div",m({className:"st-enum-dropdown-content"},{children:c.map((function(n){return e(T,m({isSelected:u===n,onClick:function(){return h(e=n),o(e),d(!1),void t();var e}},{children:n}),n)}))}))}))},z=function(n){var t=n.enumOptions,r=void 0===t?[]:t,o=n.onChange,i=n.setIsEditing,a=n.type,c=void 0===a?"string":a,d=n.value,l=function(){i(!1)};if("boolean"===c&&"boolean"==typeof d)return e(B,{onBlur:l,onChange:function(e){return o(e)},open:!0,setOpen:i,value:d});if("date"===c)return e(A,{onBlur:l,onChange:function(e){return o(e)},open:!0,setOpen:i,value:"string"==typeof d?d:""});if("enum"===c)return e(U,{onBlur:l,onChange:function(e){return o(e)},open:!0,options:r,setOpen:i,value:"string"==typeof d?d:""});if("number"===c&&"number"==typeof d)return e(P,{defaultValue:d,onBlur:l,onChange:function(e){var n=""===e?0:parseFloat(e);o(isNaN(n)?0:n)}});var s=null==d?"":String(d);return e(O,{defaultValue:s,onBlur:l,onChange:function(e){return o(e)}})},j=0,Y=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===j||o-j>=r)&&(j=o,n(t))}},J=Date.now(),q={screenX:0,screenY:0},V=function(e,n,t){void 0===t&&(t=[]);for(var r=0;r<e.length;r++){var o=e[r];if(o.accessor===n)return w(w([],t,!0),[r],!1);if(o.children&&o.children.length>0){var i=V(o.children,n,w(w([],t,!0),[r],!1));if(i)return i}}return null};var K=function(e){var n,t,r=e.draggedHeaderRef,i=e.headersRef,c=e.hoveredHeaderRef,d=e.onColumnOrderChange,l=e.onTableHeaderDragEnd,s=(n=i.current,t=o(n),a((function(){JSON.stringify(t.current)!==JSON.stringify(n)&&(t.current=n)}),[n]),t.current);return{handleDragStart:function(e){r.current=e,J=Date.now()},handleDragOver:function(e){var n,t,o=e.event,a=e.hoveredHeader;if(o.preventDefault(),i.current){var d=o.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=o.screenX,h=o.screenY,f=Math.sqrt(Math.pow(u-q.screenX,2)+Math.pow(h-q.screenY,2));c.current=a;var v=i.current,m=V(v,(null===(n=r.current)||void 0===n?void 0:n.accessor)||""),g=V(v,a.accessor);if(m&&g){var p=m.length,w=g.length,C=g;if(p!==w){var I=w-p;I>0&&(C=g.slice(0,-I))}var y=function(e,n,t){var r=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var t=e,r=0;r<n.length-1;r++)t=t[n[r]].children;return t[n[n.length-1]]}function a(e,n,t){for(var r=e,i=0;i<n.length-1;i++){if(!r[n[i]].children){o=!0;break}r=r[n[i]].children}r[n[n.length-1]]=t}var c=i(r,n);return a(r,n,i(r,t)),a(r,t,c),{newHeaders:r,emergencyBreak:o}}(v,m,C),x=y.newHeaders,b=y.emergencyBreak;if(!(d||a.accessor===(null===(t=r.current)||void 0===t?void 0:t.accessor)||null===r.current||f<10||0===m.length||0===C.length||JSON.stringify(x)===JSON.stringify(i.current)||b)){var R=Date.now();JSON.stringify(x)===JSON.stringify(s)&&(R-J<1500||f<40)||(J=R,q={screenX:u,screenY:h},l(x))}}}},handleDragEnd:function(){r.current=null,c.current=null,null==d||d(i.current)}}},X=function(e){var n=e.content,t=e.header;return"boolean"==typeof n?n?"True":"False":"date"===t.type&&null!==n&&("string"==typeof n||"number"==typeof n||"object"==typeof n&&n instanceof Date)?new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):n},G=s((function(t,c){var d,l,s=t.borderClass,u=t.colIndex,h=t.header,f=t.isHighlighted,v=t.isInitialFocused,g=t.onExpandRowClick,p=t.rowIndex,w=t.visibleRow,C=x(),I=C.cellRegistry,y=C.cellUpdateFlash,b=C.collapseIcon,R=C.draggedHeaderRef,M=C.expandIcon,E=C.handleMouseDown,S=C.handleMouseOver,k=C.headersRef,D=C.hoveredHeaderRef,N=C.onCellEdit,L=C.onTableHeaderDragEnd,T=w.depth,B=w.row,O=r(B.rowData[h.accessor]),P=O[0],F=O[1],A=r(!1),U=A[0],j=A[1],J=r(!1),q=J[0],V=J[1],G=o(null),$=K({draggedHeaderRef:R,headersRef:k,hoveredHeaderRef:D,onTableHeaderDragEnd:L}).handleDragOver,_=Y(),Q="cell-".concat(p,"-").concat(u),Z=H({rowId:B.rowMeta.rowId,accessor:h.accessor});a((function(){if(I){var e="".concat(B.rowMeta.rowId,"-").concat(h.accessor);return I.set(e,{updateContent:function(e){P!==e?(F(e),y&&(V(!0),G.current&&clearTimeout(G.current),G.current=setTimeout((function(){V(!1)}),800))):F(e)}}),function(){I.delete(e),G.current&&clearTimeout(G.current)}}}),[I,y,B.rowMeta.rowId,h.accessor,P]),a((function(){if(q){var e=setTimeout((function(){V(!1)}),850);return function(){return clearTimeout(e)}}}),[q]),a((function(){F(B.rowData[h.accessor])}),[B.rowData,h.accessor]),a((function(){f||j(!1)}),[f]);var ee="boolean"===h.type||"date"===h.type||"enum"===h.type,ne=Boolean(null===(l=null===(d=B.rowMeta)||void 0===d?void 0:d.children)||void 0===l?void 0:l.length),te=Boolean(null==h?void 0:h.isEditable),re="st-cell ".concat(T>0&&h.expandable?"st-cell-depth-".concat(T):""," ").concat(f?v?"st-cell-selected-first ".concat(s):"st-cell-selected ".concat(s):""," ").concat(te?"clickable":""," ").concat(q?"st-cell-updating":""),oe=i((function(e){F(e),null==N||N({accessor:h.accessor,newValue:e,row:B})}),[h.accessor,N,B]);return U&&!ee?e("div",m({className:"st-cell-editing",id:W({accessor:h.accessor,rowIndex:p+1})},{children:e(z,{enumOptions:h.enumOptions,onChange:oe,setIsEditing:j,type:h.type,value:P})})):n("div",m({className:re,id:Q,onDoubleClick:function(){return h.isEditable&&j(!0)},onMouseDown:function(){return E({rowIndex:p,colIndex:u,rowId:B.rowMeta.rowId})},onMouseOver:function(){return S({rowIndex:p,colIndex:u,rowId:B.rowMeta.rowId})},onDragOver:function(e){return _({callback:$,callbackProps:{event:e,hoveredHeader:h},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!h.isEditable||U||(e.preventDefault(),j(!0))},ref:c,"data-row-index":p,"data-col-index":u,"data-row-id":B.rowMeta.rowId,"data-accessor":h.accessor},{children:[h.expandable&&ne?B.rowMeta.isExpanded?e("div",m({className:"st-sort-icon-container",onClick:function(){return g(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:b})):e("div",m({className:"st-sort-icon-container",onClick:function(){return g(B.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:M})):null,e("span",m({className:"st-cell-content ".concat("right"===h.align?"right-aligned":"center"===h.align?"center-aligned":"")},{children:h.cellRenderer?h.cellRenderer({accessor:h.accessor,colIndex:u,row:B}):X({content:P,header:h})})),U&&ee&&e(z,{enumOptions:h.enumOptions,onChange:oe,setIsEditing:j,type:h.type,value:P})]}),Z)})),$=function(n){var r=n.children,o=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(n,["children"]);return x().allowAnimations?e(_,m({},o,{children:r})):e(t,{children:r})},_=function(n){var i=n.children,c=n.isBody,d=n.pauseAnimation,l=n.rowIndex,s=o(!1),h=x(),f=h.draggedHeaderRef,v=h.headersRef,m=h.mainBodyRef,g=h.shouldPaginate,p=r({}),w=p[0],C=p[1],I=o({}),y=v.current;return u((function(){if(y){var e=function(e){var n=e.currentHeaders,t=e.draggedHeaderRef,r=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(W({accessor:e.accessor,rowIndex:r}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),c=i.getBoundingClientRect();a&&(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=c}}})),o}({currentHeaders:y,draggedHeaderRef:f,rowIndex:l});JSON.stringify(e)!==JSON.stringify(w)&&(I.current=w,C(e))}}),[w,y,f,c,l]),u((function(){var e=m.current,n=function(){s.current=!0},t=function(){s.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",t),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",t)}}),[f,m]),a((function(){d||s.current||Object.keys(I.current).length&&y&&y.forEach((function(e){var n=document.getElementById(W({accessor:e.accessor,rowIndex:l}));if(n){var t=I.current[e.accessor],r=w[e.accessor];if(t&&r){var o=t.left-r.left,i=g?0:t.top-r.top,a=Math.abs(o),c=Math.abs(i);(a>10||c>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[w,y,c,d,I,l,g]),e(t,{children:i})},Q=function(n){var t=n.columnIndices,r=n.headers,o=n.hiddenColumns,i=n.isWidthDragging,a=n.onExpandRowClick,c=n.pinned,d=n.rowIndex,l=n.rowIndices,s=n.visibleRow,u=r.filter((function(e){return N({hiddenColumns:o,header:e,pinned:c})}));return e($,m({isBody:!0,pauseAnimation:i,rowIndex:d+1},{children:u.map((function(n){return e(Z,{columnIndices:t,header:n,headers:r,hiddenColumns:o,onExpandRowClick:a,pinned:c,rowIndex:d,rowIndices:l,visibleRow:s},W({accessor:n.accessor,rowIndex:d+1}))}))}))},Z=function(n){var t=n.columnIndices,r=n.header,o=n.headers,i=n.hiddenColumns,a=n.onExpandRowClick,c=n.pinned,d=n.rowIndex,l=n.rowIndices,s=n.visibleRow,u=t[r.accessor],f=x(),v=f.getBorderClass,m=f.isSelected,g=f.isInitialFocusedCell;if(r.children){var p=r.children.filter((function(e){return N({hiddenColumns:i,header:e,pinned:c})}));return e(h,{children:p.map((function(n){return e(Z,{columnIndices:t,header:n,headers:o,hiddenColumns:i,onExpandRowClick:a,pinned:c,rowIndex:d,rowIndices:l,visibleRow:s},W({accessor:n.accessor,rowIndex:d+1}))}))})}var w={rowIndex:d,colIndex:u,rowId:s.row.rowMeta.rowId},C=v(w),I=m(w),y=g(w);return e(G,{borderClass:C,colIndex:u,header:r,isHighlighted:I,isInitialFocused:y,onExpandRowClick:a,rowIndex:d,visibleRow:s},W({accessor:r.accessor,rowIndex:d+1}))},ee=function(n){var t=n.columnIndices,r=n.gridTemplateColumns,o=n.headers,i=n.hiddenColumns,a=n.index,c=n.isWidthDragging,d=n.onExpandRowClick,l=n.pinned,s=n.rowHeight,u=n.rowIndices,h=n.visibleRow,f=h.position;return e("div",m({className:"st-row ".concat(f%2==0?"even":"odd"),style:{gridTemplateColumns:r,top:D({position:f,rowHeight:s}),height:"".concat(s,"px")}},{children:e(Q,{columnIndices:t,headers:o,hiddenColumns:i,isWidthDragging:c,onExpandRowClick:d,pinned:l,rowIndex:a,rowIndices:u,visibleRow:h},a)}))},ne=function(n){var t=n.displayStrongBorder,r=n.position,o=n.rowHeight,i=n.templateColumns;return e("div",m({className:"st-row-separator ".concat(t?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:i,position:"absolute",top:k({position:r,rowHeight:o}),minWidth:"100%"}},{children:e("div",{style:{gridColumn:"1 / -1"}})}))},te=function(t){var r=t.columnIndices,o=t.headers,i=t.hiddenColumns,a=t.isWidthDragging,c=t.onExpandRowClick,d=t.pinned,l=t.ref,s=t.rowHeight,u=t.rowIndices,f=t.templateColumns,v=t.totalHeight,g=t.visibleRows,p=t.width,w=d?"st-body-pinned-".concat(d):"st-body-main";return e("div",m({className:w,ref:l,style:m({position:"relative",height:"".concat(v,"px"),width:p},!d&&{flexGrow:1})},{children:g.map((function(t,l){var v,m,p=g[l-1],w=Boolean((null==p?void 0:p.depth)!==(null==t?void 0:t.depth)&&(null===(m=null===(v=null==t?void 0:t.row.rowMeta)||void 0===v?void 0:v.children)||void 0===m?void 0:m.length)&&0===t.depth);return n(h,{children:[0!==l&&e(ne,{displayStrongBorder:w,position:t.position,rowHeight:s,templateColumns:f}),e(ee,{columnIndices:r,gridTemplateColumns:f,headers:o,hiddenColumns:i,index:l,isWidthDragging:a,onExpandRowClick:c,pinned:d,rowHeight:s,rowIndices:u,visibleRow:t})]},t.position)}))}))};function re(e){var n=e.headersRef,t=e.hiddenColumns,r=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,c=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return N({hiddenColumns:t,header:e})})).forEach((function(e,n){c(e,0===n)}))};return r.forEach((function(e,n){c(e,0===n)})),n.current.filter((function(e){return!e.pinned&&N({hiddenColumns:t,header:e})})).forEach((function(e,n){var t=0===n&&0===r.length;c(e,t)})),o.forEach((function(e){c(e,!1)})),i}var oe=function(t){var i=t.flattenedRows,d=t.headerContainerRef,l=t.isWidthDragging,s=t.mainTemplateColumns,u=t.pinnedLeftColumns,h=t.pinnedLeftTemplateColumns,f=t.pinnedLeftWidth,v=t.pinnedRightColumns,g=t.pinnedRightTemplateColumns,p=t.pinnedRightWidth,w=t.setFlattenedRows,C=t.setScrollTop,I=t.visibleRows,y=x(),b=y.headersRef,R=y.hiddenColumns,M=y.mainBodyRef,E=y.rowHeight,S=y.scrollbarWidth,k=y.tableBodyContainerRef;!function(e){var n=e.headerContainerRef,t=e.mainSectionRef,o=e.scrollbarWidth,i=r(!1),c=i[0],d=i[1];a((function(){var e=null==n?void 0:n.current;if(c&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[n,c,o]),a((function(){var e=null==n?void 0:n.current,r=null==t?void 0:t.current;if(r&&e){var o=function(){if(r){var e=r.scrollHeight>r.clientHeight;d(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(r),function(){r&&i.unobserve(r)}}}),[n,t])}({headerContainerRef:d,mainSectionRef:k,scrollbarWidth:S});var D,W,N=o(null),H=(D=0,(W=function(e){e.forEach((function(e){D+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&W(e.rowMeta.children)}))})(i),D)*(E+1)-1,L=c((function(){return re({headersRef:b,hiddenColumns:R,pinnedLeftColumns:u,pinnedRightColumns:v})}),[b,R,u,v]),T=c((function(){var e={};return I.forEach((function(n,t){var r=String(n.row.rowMeta.rowId);e[r]=t})),e}),[I]),B=function(e){var n=function(t){return t.rowMeta.rowId===e&&t.rowMeta.children?m(m({},t),{rowMeta:m(m({},t.rowMeta),{isExpanded:!t.rowMeta.isExpanded})}):t.rowMeta.children?m(m({},t),{rowMeta:m(m({},t.rowMeta),{children:t.rowMeta.children.map(n)})}):t};w((function(e){return e.map(n)}))},O={headerContainerRef:d,headers:b.current,hiddenColumns:R,isWidthDragging:l,rowHeight:E,visibleRows:I,columnIndices:L,rowIndices:T};return n("div",m({className:"st-body-container",ref:k,onScroll:function(e){var n=e.currentTarget.scrollTop;N.current&&cancelAnimationFrame(N.current),N.current=requestAnimationFrame((function(){C(n)}))}},{children:[u.length>0&&e(te,m({},O,{onExpandRowClick:B,pinned:"left",templateColumns:h,totalHeight:H,width:f})),e(te,m({},O,{ref:M,onExpandRowClick:B,templateColumns:s,totalHeight:H})),v.length>0&&e(te,m({},O,{onExpandRowClick:B,pinned:"right",templateColumns:g,totalHeight:H,width:p}))]}))},ie=function(e,n){a((function(){if(e.current){var t=e.current,r=function(){var e,r=null==t?void 0:t.scrollLeft;void 0!==r&&(null===(e=n.current)||void 0===e||e.scrollTo(r,0))};return t.addEventListener("scroll",r),function(){null==t||t.removeEventListener("scroll",r)}}}),[e,n])},ae=function(e){return void 0===e&&(e=0),e?e+1:0},ce=function(e){return e.hide?[]:e.children&&0!==e.children.length?e.children.flatMap((function(e){return ce(e)})):[e]},de=function(e){if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);var n=document.getElementById(W({accessor:e.accessor,rowIndex:0}));return(null==n?void 0:n.offsetWidth)||150},le=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(W({accessor:e.accessor,rowIndex:0})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.forEach((function(e){le(e)}))},se=function(e){return"number"==typeof e.minWidth?e.minWidth:40},ue=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=e.setMainBodyWidth,i=e.setPinnedLeftWidth,a=e.setPinnedRightWidth,c=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=n.pinned,i=0;return t.forEach((function(e){e.hide||e.pinned!==o||(e.accessor===n.accessor?i+=r:ce(e).forEach((function(e){e.hide||(e.accessor===n.accessor?i+=r:i+=de(e))})))})),n.pinned?ae(i):i}({header:n,headers:t,newWidth:r});"left"===n.pinned?i(c):"right"===n.pinned?a(c):n.pinned||o(c)},he=function(e){var n=e.event,t=e.forceUpdate,r=e.gridColumnEnd,o=e.gridColumnStart,i=e.header,a=e.headersRef,c=e.setIsWidthDragging,d=e.setMainBodyWidth,l=e.setPinnedLeftWidth,s=e.setPinnedRightWidth,u=e.startWidth;c(!0),n.preventDefault();var h=n.clientX;if(i&&!i.hide){var f=se(i),v=r-o>1,m=v?ce(i):[i],g=function(e){var n="right"===i.pinned?h-e.clientX:e.clientX-h;if(v&&m.length>1)fe({delta:n,header:i,headersRef:a,leafHeaders:m,minWidth:f,setMainBodyWidth:d,setPinnedLeftWidth:l,setPinnedRightWidth:s,startWidth:u});else{var r=Math.max(u+n,f);i.width=r,ue({header:i,headers:a.current,newWidth:r,setMainBodyWidth:d,setPinnedLeftWidth:l,setPinnedRightWidth:s})}a.current.forEach((function(e){le(e)})),t()},p=function(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p),c(!1)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",p)}},fe=function(e){var n=e.delta,t=e.header,r=e.headersRef,o=e.leafHeaders,i=e.minWidth,a=e.setMainBodyWidth,c=e.setPinnedLeftWidth,d=e.setPinnedRightWidth,l=e.startWidth,s=o.reduce((function(e,n){return Math.min(e,se(n))}),40),u=o.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),h=Math.max(l+n,s);ue({header:t,headers:r.current,newWidth:h,setMainBodyWidth:a,setPinnedLeftWidth:c,setPinnedRightWidth:d});var f=h-u;o.forEach((function(e){var n="number"==typeof e.width?e.width:150,t=f*(n/u),r=Math.max(n+t,i);e.width=r}))},ve=s((function(t,r){var o,i,c=t.colIndex,d=t.forceHeadersUpdate,l=t.gridColumnEnd,s=t.gridColumnStart,u=t.gridRowEnd,h=t.gridRowStart,f=t.header,v=t.reverse,g=t.sort,p=x(),C=p.columnReordering,I=p.columnResizing,y=p.draggedHeaderRef,b=p.forceUpdate,R=p.headersRef,M=p.hoveredHeaderRef,E=p.onColumnOrderChange,S=p.onSort,k=p.onTableHeaderDragEnd,D=p.rowHeight,N=p.selectColumns,H=p.selectableColumns,L=p.setInitialFocusedCell,T=p.setIsWidthDragging,B=p.setMainBodyWidth,O=p.setPinnedLeftWidth,P=p.setPinnedRightWidth,F=p.setSelectedCells,A=p.setSelectedColumns,U=p.sortDownIcon,z=p.sortUpIcon,j=Boolean(null==f?void 0:f.isSortable),J="st-header-cell ".concat(f.accessor===(null===(o=M.current)||void 0===o?void 0:o.accessor)?"st-hovered":""," ").concat((null===(i=y.current)||void 0===i?void 0:i.accessor)===f.accessor?"st-dragging":""," ").concat(j?"clickable":""," ").concat(C&&!j?"columnReordering":""," ").concat("right"===(null==f?void 0:f.align)?"right-aligned":"center"===(null==f?void 0:f.align)?"center-aligned":""," ").concat(f.children?"parent":""),q=K({draggedHeaderRef:y,headersRef:R,hoveredHeaderRef:M,onColumnOrderChange:E,onTableHeaderDragEnd:k}),V=q.handleDragStart,X=q.handleDragEnd,G=q.handleDragOver,$=Y(),_=function(e){var n=e.event,t=e.header;if(H){var r=function(e,n){if(!e.children||0===e.children.length)return[n];var t=[],r=function(e,n){if(!e.children||0===e.children.length)return t.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var c=a[i];o=r(c,o)}return o};return r(e,n),t}(t,c);return n.shiftKey&&N?A((function(e){if(0===e.size)return new Set(r);var n=r[0],t=Array.from(e).sort((function(e,n){return e-n})),o=t[0],i=Math.abs(n-o);t.forEach((function(e){var t=Math.abs(n-e);t<i&&(i=t,o=e)}));var a,c,d,l,s=w(w([],(a=o,c=n,d=Math.min(a,c),l=Math.max(a,c),Array.from({length:l-d+1},(function(e,n){return d+n}))),!0),r,!0);return new Set(w(w([],Array.from(e),!0),s,!0))})):N&&N(r),F(new Set),void L(null)}t.isSortable&&S(c,t.accessor)};if(a((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!f)return null;var Q=I&&e("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;$({callback:he,callbackProps:{event:e.nativeEvent,forceUpdate:b,gridColumnEnd:l,gridColumnStart:s,header:f,headersRef:R,setIsWidthDragging:T,setMainBodyWidth:B,setPinnedLeftWidth:O,setPinnedRightWidth:P,startWidth:"object"==typeof r&&null!==r&&"current"in r?null===(n=r.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),Z=g&&g.key.accessor===f.accessor&&n("div",m({className:"st-sort-icon-container",onClick:function(e){return _({event:e,header:f})}},{children:["ascending"===g.direction&&z&&z,"descending"===g.direction&&U&&U]}));return n("div",m({className:J,id:W({accessor:f.accessor,rowIndex:0}),onDragOver:function(e){$({callback:G,callbackProps:{event:e,hoveredHeader:f},limit:50})},ref:r,style:m(m({gridRowStart:h,gridRowEnd:u,gridColumnStart:s,gridColumnEnd:l},l-s>1?{}:{width:f.width}),u-h>1?{}:{height:D})},{children:[v&&Q,"right"===f.align&&Z,e("div",m({className:"st-header-label ".concat("right"===f.align?"right-aligned":"center"===f.align?"center-aligned":""),draggable:C&&!f.disableReorder,onClick:function(e){return _({event:e,header:f})},onDragEnd:function(e){e.preventDefault(),X(),d()},onDragStart:function(e){C&&f&&function(e){V(e)}(f)}},{children:null==f?void 0:f.label})),"right"!==f.align&&Z,!v&&Q]}))})),me=function(n){var t=n.columnIndices,r=n.gridTemplateColumns,o=n.handleScroll,i=n.headersRef,a=n.hiddenColumns,d=n.maxDepth,l=n.pinned,s=n.sectionRef,u=n.sort,h=f((function(e){return e+1}),0)[1],g=c((function(){var e=[],n=1,r=function(o,i,c){var s,u;if(void 0===c&&(c=!1),!N({hiddenColumns:a,header:o,pinned:l}))return 0;c||n++;var h=null!==(u=null===(s=o.children)||void 0===s?void 0:s.filter((function(e){return N({hiddenColumns:a,header:e,pinned:l})})).length)&&void 0!==u?u:0,f=n,v=h>0?f+h:f+1,m=i,g=h>0?i+1:d+1;if(e.push({header:o,gridColumnStart:f,gridColumnEnd:v,gridRowStart:m,gridRowEnd:g,colIndex:t[o.accessor]}),o.children){var p=!0;o.children.forEach((function(e){N({hiddenColumns:a,header:e,pinned:l})&&(r(e,i+1,p),p=!1)}))}return v-f},o=i.current.filter((function(e){return N({hiddenColumns:a,header:e,pinned:l})})),c=!0;return o.forEach((function(e){r(e,1,c),c=!1})),e}),[i,a,d,l,t]);return e("div",m({className:"st-header-".concat(l?"pinned-".concat(l):"main")},o&&{onScroll:o},{ref:s,style:{gridTemplateColumns:r,display:"grid",position:"relative"}},{children:e($,m({rowIndex:0},{children:g.map((function(n){return e(ve,{colIndex:n.colIndex,forceHeadersUpdate:h,gridColumnEnd:n.gridColumnEnd,gridColumnStart:n.gridColumnStart,gridRowEnd:n.gridRowEnd,gridRowStart:n.gridRowStart,header:n.header,ref:v(),reverse:"right"===l,sort:u},n.header.accessor)}))}))}))},ge=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(ge)):1},pe=function(t){var r=t.centerHeaderRef,o=t.headerContainerRef,i=t.headersRef,a=t.hiddenColumns,d=t.mainTemplateColumns,l=t.pinnedLeftColumns,s=t.pinnedLeftTemplateColumns,h=t.pinnedRightColumns,f=t.pinnedRightTemplateColumns,v=t.sort,g=x(),p=g.mainBodyRef,w=g.pinnedLeftRef,C=g.pinnedRightRef,I=g.setPinnedLeftWidth,y=g.setPinnedRightWidth;ie(p,r);var b=c((function(){return re({headersRef:i,hiddenColumns:a,pinnedLeftColumns:l,pinnedRightColumns:h})}),[i,a,l,h]),R=c((function(){var e=i.current,n=0;return e.forEach((function(e){if(N({hiddenColumns:a,header:e})){var t=ge(e);n=Math.max(n,t)}})),{maxDepth:n}}),[i,a]).maxDepth;return u((function(){var e,n;I(ae(null===(e=w.current)||void 0===e?void 0:e.clientWidth)),y(ae(null===(n=C.current)||void 0===n?void 0:n.clientWidth))}),[w,C,I,y]),n("div",m({className:"st-header-container",ref:o},{children:[l.length>0&&e(me,{columnIndices:b,gridTemplateColumns:s,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:R,pinned:"left",sectionRef:w,sort:v}),e(me,{columnIndices:b,gridTemplateColumns:d,handleScroll:function(e){var n,t,o=null===(n=r.current)||void 0===n?void 0:n.scrollLeft;void 0!==o&&(null===(t=p.current)||void 0===t||t.scrollTo(o,0))},headersRef:i,hiddenColumns:a,maxDepth:R,sectionRef:r,sort:v}),h.length>0&&e(me,{columnIndices:b,gridTemplateColumns:f,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:R,pinned:"right",sectionRef:C,sort:v})]}))},we=function(e){var n=e.headers,t=e.hiddenColumns,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==t[e.accessor]&&(e.children?r({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=r({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,t=e.width;return"number"==typeof t&&(t="".concat(t,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof t&&t.endsWith("fr")?"minmax(".concat(n,", ").concat(t,")"):"max(".concat(n,", ").concat(t,")"):t}(e)})).join(" "))},Ce=function(t){var r=t.flattenedRows,i=t.isWidthDragging,a=t.pinnedLeftWidth,d=t.pinnedRightWidth,l=t.setFlattenedRows,s=t.setScrollTop,u=t.sort,h=t.visibleRows,f=x(),v=f.editColumns,g=f.headersRef,p=f.hiddenColumns,w=o(null),C=o(null),I=g.current.filter((function(e){return!e.pinned})),y=g.current.filter((function(e){return"left"===e.pinned})),b=g.current.filter((function(e){return"right"===e.pinned})),R=c((function(){return we({headers:y,hiddenColumns:p})}),[y,p]),M=c((function(){return we({headers:I,hiddenColumns:p})}),[I,p]),E=c((function(){return we({headers:b,hiddenColumns:p})}),[b,p]),S={flattenedRows:r,headerContainerRef:w,isWidthDragging:i,mainTemplateColumns:M,pinnedLeftColumns:y,pinnedLeftTemplateColumns:R,pinnedLeftWidth:a,pinnedRightColumns:b,pinnedRightTemplateColumns:E,pinnedRightWidth:d,setFlattenedRows:l,setScrollTop:s,visibleRows:h};return n("div",m({className:"st-content",style:{width:v?"calc(100% - 27.5px)":"100%"}},{children:[e(pe,m({},{centerHeaderRef:C,headerContainerRef:w,headersRef:g,hiddenColumns:p,mainTemplateColumns:M,pinnedLeftColumns:y,pinnedLeftTemplateColumns:R,pinnedRightColumns:b,pinnedRightTemplateColumns:E,sort:u})),e(oe,m({},S))]}))},Ie=function(i){var c,d,l=i.mainBodyWidth,s=i.mainBodyRef,u=i.pinnedLeftWidth,h=i.pinnedRightWidth,f=i.setMainBodyWidth,v=i.tableBodyContainerRef,g=x().editColumns,p=r(!1),w=p[0],C=p[1],I=o(null),y=v.current&&v.current.scrollHeight>v.current.clientHeight,b=g?28:0,R=(g?h+1:h)+(v.current&&y?v.current.offsetWidth-v.current.clientWidth:0);return ie(s,I),a((function(){setTimeout((function(){!function(){if(s.current){var e=s.current.scrollWidth;f(e)}}()}),1)}),[s,f]),a((function(){setTimeout((function(){!function(){if(s.current){var e=s.current.clientWidth;C(l>e)}}()}),1)}),[s,l,f]),w?n("div",m({className:"st-horizontal-scrollbar-container"},{children:[u>0&&e("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:u,height:null===(c=I.current)||void 0===c?void 0:c.offsetHeight}}),l>0&&e("div",m({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&s.current&&s.current.scrollTo({left:n,behavior:"auto"})},ref:I,style:{flexGrow:1}},{children:e("div",{style:{width:l,height:".3px"}})})),h>0&&e(t,{children:e("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:R,height:null===(d=I.current)||void 0===d?void 0:d.offsetHeight}})}),b>0&&e("div",{style:{width:b-1.5,height:"100%",flexShrink:0}})]})):null},ye={string:function(e,n,t){if(e===n)return 0;var r=e.localeCompare(n);return"ascending"===t?r:-r},number:function(e,n,t){if(e===n)return 0;var r=e-n;return"ascending"===t?r:-r},boolean:function(e,n,t){if(e===n)return 0;var r=e===n?0:e?-1:1;return"ascending"===t?r:-r},date:function(e,n,t){var r=new Date(e),o=new Date(n);if(r.getTime()===o.getTime())return 0;var i=r.getTime()-o.getTime();return"ascending"===t?i:-i},enum:function(e,n,t){return ye.string(e,n,t)},default:function(e,n,t){return e===n?0:null==e?"ascending"===t?-1:1:null==n?"ascending"===t?1:-1:"string"==typeof e&&"string"==typeof n?ye.string(e,n,t):"number"==typeof e&&"number"==typeof n?ye.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?ye.boolean(e,n,t):ye.string(String(e),String(n),t)}},xe=function(e,n,t,r){if(void 0===t&&(t="string"),null==e||""===e)return"ascending"===r?-1:1;if(null==n||""===n)return"ascending"===r?1:-1;if("number"===t){var o=function(e){var n;if("number"==typeof e)return e;var t=String(e);if("string"==typeof t){var r=t.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(r){var o=parseFloat(r[1]),i=null===(n=r[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(t)||0},i=o(e),a=o(n);return ye.number(i,a,r)}return"date"===t?ye.date(String(e),String(n),r):"boolean"===t?ye.boolean(Boolean(e),Boolean(n),r):"enum"===t?ye.enum(String(e),String(n),r):ye.string(String(e),String(n),r)},be=function(e,n,t){var r,o=(null===(r=n.key)||void 0===r?void 0:r.type)||"string",i=n.direction,a=new Map,c=new Map,d="";e.forEach((function(e){var t;if(e.rowData&&!0===e.rowMeta.isExpanded&&!0===n.key.expandable){var r=(e.rowData.sector||"group_".concat(a.size)).toString();d=r,c.set(d,e),a.has(d)||a.set(d,[])}else if(d){var o=a.get(d)||[];o.push(e),a.set(d,o)}else{var i="default";a.has(i)||a.set(i,[]),null===(t=a.get(i))||void 0===t||t.push(e)}}));var l=[];return a.forEach((function(e,r){if(c.has(r)){var a=c.get(r);a.rowMeta.children&&a.rowMeta.children.length>0&&(a.rowMeta.children=Re(a.rowMeta.children,n,t)),l.push(a)}var d=w([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,a=e.rowData[r],c=t.rowData[r];return xe(a,c,o,i)}));l.push.apply(l,d.map((function(e){var r=m({},e);if(r.rowMeta.children&&r.rowMeta.children.length>0){var o=Re(r.rowMeta.children,n,t);r.rowMeta=m(m({},r.rowMeta),{children:o})}return r})))})),l},Re=function(e,n,t){var r=t.find((function(e){return e.accessor===n.key.accessor})),o=(null==r?void 0:r.type)||"string",i=n.direction;return w([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,a=e.rowData[r],c=t.rowData[r];return xe(a,c,o,i)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?m(m({},e),{rowMeta:m(m({},e.rowMeta),{children:Re(e.rowMeta.children,n,t)})}):e}))},Me=function(e){var n=e.headers,t=e.tableRows,o=r(null),i=o[0],a=o[1],d=c((function(){var e={};return n.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[n]),l=r(d),s=l[0],u=l[1],h=c((function(){if(!i)return t;var e=function(e,n,t){return{sortedData:be(n,t,e),newSortConfig:t}}(n,t,i).sortedData;return e}),[t,i,n]);return{hiddenColumns:s,setHiddenColumns:u,setSort:a,sort:i,sortedRows:h,updateSort:function(e,t){var r=function(e){for(var n=0,o=e;n<o.length;n++){var i=o[n];if(i.accessor===t)return i;if(i.children&&i.children.length>0){var a=r(i.children);if(a)return a}}},o=r(n);o&&a((function(e){return e&&e.key.accessor===t?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))}}},Ee=function(t){var r=t.checked,o=void 0!==r&&r,i=t.children,a=t.onChange;return n("label",m({className:"st-checkbox-label"},{children:[e("input",{checked:o,className:"st-checkbox-input",onChange:function(){a&&a(!o)},type:"checkbox"}),e("span",m({className:"st-checkbox-custom ".concat(o?"st-checked":"")},{children:o&&e("span",{className:"st-checkbox-checkmark"})})),i]}))},Se=function(e,n,t,r){void 0===r&&(r=new Set);for(var o=0,i=e;o<i.length;o++){var a=i[o];if(!r.has(a.accessor)&&(r.add(a.accessor),a.children&&a.children.length>0)){var c=a.children.some((function(e){return e.accessor===n})),d=!1;if(!c)for(var l=0,s=a.children;l<s.length;l++){var u=s[l];if(Se([u],n,t,r),!1===t[u.accessor]){d=!0;break}}(c||d)&&(t[a.accessor]=!1)}}},ke=function(e,n){return e.every((function(e){return!0===n[e.accessor]}))},De=function(e,n){e.forEach((function(e){e.children&&e.children.length>0&&(De(e.children,n),ke(e.children,n)&&(n[e.accessor]=!0))}))},We=function(o){var i=o.allHeaders,a=o.depth,c=void 0===a?0:a,d=o.header,l=o.hiddenColumns,s=o.setHiddenColumns,u=r(!0),h=u[0],f=u[1],v=x(),g=v.expandIcon,p=v.collapseIcon,w=v.headersRef,C=v.setMainBodyWidth,I=v.setPinnedLeftWidth,y=v.setPinnedRightWidth,b="".concat(16*c,"px"),R=d.children&&d.children.length>0,M=l[d.accessor]||R&&d.children&&ke(d.children,l);return n(t,{children:[n("div",m({className:"st-header-checkbox-item",style:{paddingLeft:b}},{children:[e("div",m({className:"st-header-icon-container"},{children:R?e("div",m({className:"st-collapsible-header-icon",onClick:function(e){e.stopPropagation(),f(!h)}},{children:h?p:g})):null})),e(Ee,m({checked:M,onChange:function(e){var n=m({},l);(n[d.accessor]=e,e)?De(i,n):(Se(i,d.accessor,n),R&&d.children&&d.children.length>0&&d.children.every((function(e){return!0===l[e.accessor]}))&&d.children[0]&&(n[d.children[0].accessor]=!1,Se(i,d.children[0].accessor,n)));s(n),w.current.forEach((function(e){e.hide=!0===n[e.accessor]})),function(e){var n=e.headers,t=e.setMainBodyWidth,r=e.setPinnedLeftWidth,o=e.setPinnedRightWidth,i=0,a=0,c=0;n.forEach((function(e){if(!e.hide){var n=ce(e).reduce((function(e,n){return e+de(n)}),0);"left"===e.pinned?i+=n:"right"===e.pinned?a+=n:c+=n}}));var d=ae(i),l=ae(a);r(d),o(l),t(c)}({headers:w.current,setMainBodyWidth:C,setPinnedLeftWidth:I,setPinnedRightWidth:y})}},{children:d.label}))]})),R&&h&&d.children&&e("div",m({className:"st-nested-headers"},{children:d.children.map((function(n,t){return e(We,{allHeaders:i,depth:c+1,header:n,hiddenColumns:l,setHiddenColumns:s},"".concat(n.accessor,"-").concat(t))}))}))]})},Ne=function(n){var t=n.headers,r=n.open,o=n.position,i=n.setHiddenColumns,a=n.hiddenColumns,c="left"===o?"left":"";return e("div",m({className:"st-column-editor-popout ".concat(r?"open":""," ").concat(c),onClick:function(e){return e.stopPropagation()}},{children:e("div",m({className:"st-column-editor-popout-content"},{children:t.map((function(n,r){return e(We,{header:n,hiddenColumns:a,setHiddenColumns:i,allHeaders:t},"".concat(n.accessor,"-").concat(r))}))}))}))},He=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,c=t.headers,d=t.hiddenColumns,l=t.position,s=void 0===l?"right":l,u=t.setHiddenColumns,h=r(a),f=h[0],v=h[1];return i?n("div",m({className:"st-column-editor ".concat(f?"open":""," ").concat(s),onClick:function(){return function(e){v(e)}(!f)},style:{width:28}},{children:[e("div",m({className:"st-column-editor-text"},{children:o})),e(Ne,{headers:c,open:f,position:s,setHiddenColumns:u,hiddenColumns:d})]})):null},Le=function(n){var t=r(!1),o=t[0],i=t[1];return a((function(){i(!0)}),[]),o?e(Te,m({},n)):null},Te=function(t){var d=t.allowAnimations,l=void 0!==d&&d,s=t.cellUpdateFlash,h=void 0!==s&&s,v=t.collapseIcon,g=void 0===v?e(S,{className:"st-sort-icon"}):v,p=t.columnEditorPosition,w=void 0===p?"right":p,I=t.columnEditorText,x=void 0===I?"Columns":I,k=t.columnReordering,D=void 0!==k&&k,W=t.columnResizing,N=void 0!==W&&W,L=t.defaultHeaders,T=t.editColumns,B=void 0!==T&&T,O=t.editColumnsInitOpen,P=void 0!==O&&O,F=t.expandIcon,A=void 0===F?e(M,{className:"st-sort-icon"}):F,U=t.height,z=t.hideFooter,j=void 0!==z&&z,Y=t.nextIcon,J=void 0===Y?e(M,{className:"st-next-prev-icon"}):Y,q=t.onCellEdit,V=t.onColumnOrderChange,K=t.onGridReady,X=t.onNextPage,G=t.prevIcon,$=void 0===G?e(R,{className:"st-next-prev-icon"}):G,_=t.rowHeight,Q=void 0===_?40:_,Z=t.rows,ee=t.rowsPerPage,ne=void 0===ee?10:ee,te=t.selectableCells,re=void 0!==te&&te,oe=t.selectableColumns,ie=void 0!==oe&&oe,ae=t.shouldPaginate,ce=void 0!==ae&&ae,de=t.sortDownIcon,le=void 0===de?e(S,{className:"st-sort-icon"}):de,se=t.sortUpIcon,ue=void 0===se?e(E,{className:"st-sort-icon"}):se,he=t.tableRef,fe=t.theme,ve=void 0===fe?"light":fe,me=o(null),ge=o(L),pe=o(null),we=o(null),ye=o(null),xe=o(null),be=o(null),Re=r(1),Ee=Re[0],Se=Re[1],ke=r(!1),De=ke[0],We=ke[1],Ne=r(0),Le=Ne[0],Te=Ne[1],Be=r(0),Oe=Be[0],Pe=Be[1],Fe=r(0),Ae=Fe[0],Ue=Fe[1],ze=r(0),je=ze[0],Ye=ze[1],Je=r(0),qe=Je[0],Ve=Je[1],Ke=Me({headers:ge.current,tableRows:Z}),Xe=Ke.sort,Ge=Ke.sortedRows,$e=Ke.hiddenColumns,_e=Ke.setHiddenColumns,Qe=Ke.updateSort;a((function(){null==K||K()}),[K]);var Ze=c((function(){if(!ce)return Ge;var e=(Ee-1)*ne,n=e+ne;return Ge.slice(e,n)}),[Ee,ne,ce,Ge]),en=r(Ze),nn=en[0],tn=en[1];a((function(){tn(Ze)}),[Ze]);var rn=c((function(){var e;if(!U)return window.innerHeight-Q;var n=document.querySelector(".simple-table-root"),t=0;if(U.endsWith("px"))t=parseInt(U,10);else if(U.endsWith("vh")){var r=parseInt(U,10);t=window.innerHeight*r/100}else if(U.endsWith("%")){var o=parseInt(U,10);t=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else t=window.innerHeight;return Math.max(0,t-Q)}),[U,Q]),on=c((function(){return function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=o+1,c=[],d=0,l=Math.max(0,i-a*n),s=i+t+a*n,u=function(e,n){for(var t,r=0,o=e;r<o.length;r++){var i=o[r],h=d*a;if(h>=s)break;h+a>l&&c.push({row:i,depth:n,position:d,isLastGroupRow:Boolean(null===(t=i.rowMeta.children)||void 0===t?void 0:t.length)&&n>1}),d+=1,i.rowMeta.isExpanded&&i.rowMeta.children&&u(i.rowMeta.children,n+1)}};return u(r,0),c}({bufferRowCount:5,contentHeight:rn,flattenedRows:nn,rowHeight:Q,scrollTop:je})}),[rn,Q,nn,je]),an=f((function(e){return e+1}),0)[1],cn=function(e){var n=e.selectableCells,t=e.headers,d=e.visibleRows,l=r(new Set),s=l[0],u=l[1],h=r(new Set),f=h[0],v=h[1],m=r(null),g=m[0],p=m[1],w=r(null),I=w[0],y=w[1],x=o(!1),b=o(null),R=i((function(){var e=Array.from(s).reduce((function(e,n){var r=n.split("-").map(Number),o=r[0],i=r[1];return e[o]||(e[o]=[]),e[o][i]=d[o].row.rowData[t[i].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");s.size>0&&navigator.clipboard.writeText(n)}),[t,s,d]),M=i((function(e,n){for(var t=new Set,r=Math.min(e.rowIndex,n.rowIndex),o=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),a=Math.max(e.colIndex,n.colIndex),c=r;c<=o;c++)for(var l=i;l<=a;l++)if(c>=0&&c<d.length){var s=d[c].row.rowMeta.rowId;t.add(C({colIndex:l,rowIndex:c,rowId:s}))}v(new Set),p(null),u(t)}),[d,v,p,u]),E=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<t.length){var n=C(e);v(new Set),p(null),u(new Set([n])),y(e)}}),[t.length,d.length,v,p,u,y]),S=i((function(e,n){void 0===n&&(n=!1),u(new Set),y(null),v((function(t){var r=new Set(n?t:[]);return e.forEach((function(e){return r.add(e)})),r})),e.length>0&&p(e[e.length-1])}),[u,y,v,p]);a((function(){var e=function(e){if(n&&I){var r=I.rowIndex,o=I.colIndex,i=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(d[r].row.rowMeta.rowId!==i){var a=d.findIndex((function(e){return e.row.rowMeta.rowId===i}));if(-1===a)return;r=a}if("ArrowUp"===e.key){if(e.preventDefault(),r>0){var c={rowIndex:r-1,colIndex:o,rowId:d[r-1].row.rowMeta.rowId};E(c)}}else"ArrowDown"===e.key?(e.preventDefault(),r<d.length-1&&(c={rowIndex:r+1,colIndex:o,rowId:d[r+1].row.rowMeta.rowId},E(c))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(c={rowIndex:r,colIndex:o-1,rowId:d[r].row.rowMeta.rowId},E(c))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<t.length-1&&(c={rowIndex:r,colIndex:o+1,rowId:d[r].row.rowMeta.rowId},E(c))):"Escape"===e.key&&(u(new Set),v(new Set),p(null),b.current=null,y(null))}else R()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[R,t.length,I,M,E,n,d]);var k=i((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=C({colIndex:n,rowIndex:t,rowId:r}),i=s.has(o),a=f.has(n);return i||a}),[s,f]),D=i((function(e){var n,t,r,o,i,a,c=e.colIndex,l=e.rowIndex,s=e.rowId,u=[],h=null===(r=null===(t=null===(n=d[l-1])||void 0===n?void 0:n.row)||void 0===t?void 0:t.rowMeta)||void 0===r?void 0:r.rowId,v={colIndex:c,rowIndex:l+1,rowId:null===(a=null===(i=null===(o=d[l+1])||void 0===o?void 0:o.row)||void 0===i?void 0:i.rowMeta)||void 0===a?void 0:a.rowId},m={colIndex:c-1,rowIndex:l,rowId:s},g={colIndex:c+1,rowIndex:l,rowId:s};return(!k({colIndex:c,rowIndex:l-1,rowId:h})||f.has(c)&&0===l)&&u.push("st-selected-top-border"),(!k(v)||f.has(c)&&l===d.length-1)&&u.push("st-selected-bottom-border"),k(m)||u.push("st-selected-left-border"),k(g)||u.push("st-selected-right-border"),u.join(" ")}),[k,d,f]),W=c((function(){return I?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===I.rowIndex&&t===I.colIndex&&r===I.rowId}:function(){return!1}}),[I]);return{getBorderClass:D,handleMouseDown:function(e){var t=e.colIndex,r=e.rowIndex,o=e.rowId;if(n){x.current=!0,b.current={rowIndex:r,colIndex:t,rowId:o},v(new Set),p(null);var i=C({colIndex:t,rowIndex:r,rowId:o});u(new Set([i])),y({rowIndex:r,colIndex:t,rowId:o})}},handleMouseOver:function(e){var t=e.colIndex,r=e.rowIndex;if(e.rowId,n&&x.current&&b.current){for(var o=new Set,i=Math.min(b.current.rowIndex,r),a=Math.max(b.current.rowIndex,r),c=Math.min(b.current.colIndex,t),l=Math.max(b.current.colIndex,t),s=i;s<=a;s++)for(var h=c;h<=l;h++)if(s>=0&&s<d.length){var f=d[s].row.rowMeta.rowId;o.add(C({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){x.current=!1},isInitialFocusedCell:W,isSelected:k,lastSelectedColumnIndex:g,selectColumns:S,selectedCells:s,selectedColumns:f,setInitialFocusedCell:y,setSelectedCells:u,setSelectedColumns:v}}({selectableCells:re,headers:ge.current,visibleRows:on}),dn=cn.getBorderClass,ln=cn.handleMouseDown,sn=cn.handleMouseOver,un=cn.handleMouseUp,hn=cn.isInitialFocusedCell,fn=cn.isSelected,vn=cn.selectColumns,mn=cn.selectedCells,gn=cn.selectedColumns,pn=cn.setInitialFocusedCell,wn=cn.setSelectedCells,Cn=cn.setSelectedColumns,In=i((function(e,n){Qe(e,n)}),[Qe]),yn=i((function(e){ge.current=e,an()}),[]);a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||ie&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(mn.size>0&&wn(new Set),gn.size>0&&Cn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[ie,mn,gn,wn,Cn]),u((function(){if(be.current){var e=be.current.offsetWidth-be.current.clientWidth;Ve(e)}}),[]),u((function(){var e=function(){if(an(),be.current){var e=be.current.offsetWidth-be.current.clientWidth;Ve(e)}};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var xn=o(new Map);return a((function(){he&&(he.current={updateData:function(e){var n,t,r,o,i=e.accessor,a=e.rowIndex,c=e.newValue,d=null===(t=null===(n=null==Z?void 0:Z[a])||void 0===n?void 0:n.rowMeta)||void 0===t?void 0:t.rowId;if(void 0!==d){var l=H({rowId:d,accessor:i}),s=xn.current.get(l);s&&s.updateContent(c),void 0!==(null===(o=null===(r=null==Z?void 0:Z[a])||void 0===r?void 0:r.rowData)||void 0===o?void 0:o[i])&&(Z[a].rowData[i]=c)}}})}),[he,Z]),e(y,m({value:{allowAnimations:l,cellRegistry:xn.current,cellUpdateFlash:h,collapseIcon:g,columnReordering:D,columnResizing:N,draggedHeaderRef:me,editColumns:B,expandIcon:A,forceUpdate:an,getBorderClass:dn,handleMouseDown:ln,handleMouseOver:sn,headersRef:ge,hiddenColumns:$e,hoveredHeaderRef:pe,isInitialFocusedCell:hn,isSelected:fn,mainBodyRef:we,nextIcon:J,onCellEdit:q,onColumnOrderChange:V,onSort:In,onTableHeaderDragEnd:yn,pinnedLeftRef:ye,pinnedRightRef:xe,prevIcon:$,rowHeight:Q,scrollbarWidth:qe,selectColumns:vn,selectableColumns:ie,setInitialFocusedCell:pn,setIsWidthDragging:We,setMainBodyWidth:Te,setPinnedLeftWidth:Pe,setPinnedRightWidth:Ue,setSelectedCells:wn,setSelectedColumns:Cn,shouldPaginate:ce,sortDownIcon:le,sortUpIcon:ue,tableBodyContainerRef:be}},{children:e("div",m({className:"simple-table-root st-wrapper theme-".concat(ve),style:U?{height:U}:{}},{children:n("div",m({className:"st-wrapper-container"},{children:[n("div",m({className:"st-content-wrapper",onMouseUp:un,onMouseLeave:un},{children:[e(Ce,{flattenedRows:nn,isWidthDragging:De,pinnedLeftWidth:Oe,pinnedRightWidth:Ae,setFlattenedRows:tn,setScrollTop:Ye,sort:Xe,visibleRows:on}),e(He,{columnEditorText:x,editColumns:B,editColumnsInitOpen:P,headers:ge.current,hiddenColumns:$e,position:w,setHiddenColumns:_e})]})),e(Ie,{mainBodyRef:we,mainBodyWidth:Le,pinnedLeftWidth:Oe,pinnedRightWidth:Ae,setMainBodyWidth:Te,tableBodyContainerRef:be}),e(b,{currentPage:Ee,hideFooter:j,onPageChange:Se,onNextPage:X,shouldPaginate:ce,totalPages:Math.ceil(Z.length/ne)})]}))}))}))};export{Le as SimpleTable};
2
2
  //# sourceMappingURL=index.es.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=function(){return t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,c)}s((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function i(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var a=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},c=n.createContext(void 0),s=function(n){var r=n.children,o=n.value;return e.jsx(c.Provider,t({value:o},{children:r}))},d=function(){var e=n.useContext(c);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},l=function(i){var a=i.currentPage,c=i.hideFooter,s=i.onPageChange,l=i.onNextPage,u=i.shouldPaginate,h=i.totalPages,f=d(),v=f.nextIcon,m=f.prevIcon,g=n.useState(!0),p=g[0],w=g[1],x=!(a>1),C=!(a<h)&&!l||!p&&a===h;if(c||!u)return null;var I=function(){if(h<=15)return Array.from({length:h},(function(e,n){return n+1}));var e,n,t=[],r=15;if(a<=Math.ceil(7.5))e=1,n=14;else if(a>=h-Math.floor(7.5))e=Math.max(1,h-r+1),n=h;else{var o=Math.floor(7);e=a-o,n=a+(r-o-1)}for(var i=e;i<=n;i++)t.push(i);return n<h-1&&(t.push(-1),t.push(h)),t}();return e.jsxs("div",t({className:"st-footer"},{children:[e.jsx("button",t({className:"st-next-prev-btn ".concat(x?"disabled":""),onClick:function(){var e=a-1;e>=1&&s(e)},disabled:x},{children:m})),e.jsx("button",t({className:"st-next-prev-btn ".concat(C?"disabled":""),onClick:function(){return r(void 0,void 0,void 0,(function(){var e,n;return o(this,(function(t){switch(t.label){case 0:return e=a===h,n=a+1,l&&e?[4,l(a)]:[3,2];case 1:if(!t.sent())return w(!1),[2];t.label=2;case 2:return(n<=h||l)&&s(n),[2]}}))}))},disabled:C},{children:v})),I.map((function(n,r){return n<0?e.jsx("span",t({className:"st-page-ellipsis"},{children:"..."}),"ellipsis-".concat(n)):e.jsx("button",t({onClick:function(){return function(e){e>=1&&e<=h&&s(e)}(n)},className:"st-page-btn ".concat(a===n?"active":"")},{children:n}),"page-".concat(n))}))]}))},u=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},h=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},f=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},v=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},m=function(e){return e.position*(e.rowHeight+1)-1},g=function(e){return e.position*(e.rowHeight+1)},p=function(e){var n=e.accessor,t=e.rowIndex;return"cell-".concat(n,"-").concat(t)},w=function(e){var n=e.hiddenColumns,t=e.header,r=e.pinned;return n[t.accessor]?null:!r&&!t.pinned||t.pinned===r||null},x=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},C=function(r){var o=r.children,i=r.onClose,a=r.open,c=r.setOpen,s=r.width,l=r.containerRef,u=d(),h=null==u?void 0:u.mainBodyRef,f=n.useRef(null),v=n.useRef(null),m=n.useState("bottom-left"),g=m[0],p=m[1],w=n.useState({}),x=w[0],C=w[1],I=n.useState(!1),y=I[0],b=I[1];return n.useEffect((function(){a&&f.current?(b(!1),!v.current&&f.current.parentElement&&(v.current=f.current.parentElement),requestAnimationFrame((function(){if(f.current&&v.current){var e,n=f.current,t=v.current.getBoundingClientRect(),r=n.offsetHeight,o=s||n.offsetWidth,i=(e=(null==l?void 0:l.current)?l.current.getBoundingClientRect():(null==h?void 0:h.current)?h.current.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:function(){}}).bottom-t.bottom,a=t.top-e.top,c="bottom",d={};(r>i&&r<=a||r>i&&a>i)&&(c="top");var u="left";o>e.right-t.right+t.width&&(u="right"),"bottom"===c?d.top=t.bottom+4:d.bottom=window.innerHeight-t.top+4,"left"===u?d.left=t.left:d.right=window.innerWidth-t.right,p("".concat(c,"-").concat(u)),C(d),b(!0)}}))):a||b(!1)}),[a,s,l,h]),n.useEffect((function(){var e=function(e){if(a&&f.current){var n=e.target;f.current&&!f.current.contains(n)&&(c(!1),null==i||i())}};return a&&window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}}),[a,i,c]),n.useEffect((function(){var e=function(e){f.current&&!f.current.contains(e.target)&&(c(!1),null==i||i())};return a&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[i,a,c]),n.useEffect((function(){var e=function(e){"Escape"===e.key&&a&&(c(!1),null==i||i())};return a&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[i,a,c]),a?e.jsx("div",t({ref:f,className:"st-dropdown-content st-dropdown-".concat(g),style:t({width:s?"".concat(s,"px"):"auto",visibility:y?"visible":"hidden"},x)},{children:o})):null},I=function(n){var r=n.children,o=n.onClick,i=n.isSelected,a=void 0!==i&&i,c=n.disabled,s=void 0!==c&&c,d=n.className,l=void 0===d?"":d;return e.jsx("div",t({className:"st-dropdown-item ".concat(a?"selected":""," ").concat(s?"disabled":""," ").concat(l),onClick:function(){!s&&o&&o()},role:"option","aria-selected":a,"aria-disabled":s},{children:r}))},y=function(r){var o=r.onBlur,i=r.onChange,a=r.open,c=r.setOpen,s=r.value,d=n.useState(s),l=d[0],u=d[1];n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var h=function(e){u(e),i(e),c(!1),o()};return e.jsxs(C,t({open:a,onClose:function(){o()},setOpen:c,width:120},{children:[e.jsx(I,t({isSelected:!0===l,onClick:function(){return h(!0)}},{children:"True"})),e.jsx(I,t({isSelected:!1===l,onClick:function(){return h(!1)}},{children:"False"}))]}))},b=function(t){var r=t.defaultValue,o=t.onBlur,i=t.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)}})},R=function(t){var r=t.defaultValue,o=t.onBlur,i=t.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},M=function(r){var o,i,a=r.value,c=r.onChange,s=r.onClose,l=d(),u=l.nextIcon,h=l.prevIcon,f=n.useState(a||new Date),v=f[0],m=f[1],g=n.useState("days"),p=g[0],w=g[1],x=function(e,n){return new Date(e,n+1,0).getDate()};return e.jsxs("div",t({className:"st-datepicker"},{children:[e.jsxs("div",t({className:"st-datepicker-header"},{children:["days"===p&&e.jsxs(e.Fragment,{children:[e.jsx("button",t({onClick:function(){m(new Date(v.getFullYear(),v.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:h})),e.jsxs("div",t({className:"st-datepicker-header-label",onClick:function(){return w("months")}},{children:[(i=v,i.toLocaleString("default",{month:"long"}))," ",v.getFullYear()]})),e.jsx("button",t({onClick:function(){m(new Date(v.getFullYear(),v.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:u}))]}),"months"===p&&e.jsx("div",t({className:"st-datepicker-header-label",onClick:function(){return w("years")}},{children:v.getFullYear()})),"years"===p&&e.jsx("div",t({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),e.jsxs("div",t({className:"st-datepicker-grid st-datepicker-".concat(p,"-grid")},{children:["days"===p&&function(){var n=[],r=v.getFullYear(),o=v.getMonth(),i=x(r,o),d=function(e,n){return new Date(e,n,1).getDay()}(r,o),l=x(r,o-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach((function(r,o){n.push(e.jsx("div",t({className:"st-datepicker-weekday"},{children:r}),"header-".concat(o)))}));for(var u=function(r){var o=l-d+r+1;n.push(e.jsx("div",t({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()-1,e);m(n),c(n),null==s||s()}(o)}},{children:o}),"prev-".concat(o)))},h=0;h<d;h++)u(h);for(var f=function(i){var d=i===(new Date).getDate()&&o===(new Date).getMonth()&&r===(new Date).getFullYear(),l=i===new Date(a).getDate()&&o===new Date(a).getMonth()&&r===new Date(a).getFullYear();n.push(e.jsx("div",t({className:"st-datepicker-day ".concat(d?"today":""," ").concat(l?"selected":""),onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth(),e);m(n),c(n),null==s||s()}(i)}},{children:i}),"day-".concat(i)))},g=1;g<=i;g++)f(g);var p=35-(d+i),w=function(r){n.push(e.jsx("div",t({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()+1,e);m(n),c(n),null==s||s()}(r)}},{children:r}),"next-".concat(r)))};for(g=1;g<=p;g++)w(g);return n}(),"months"===p&&(o=[],Array.from({length:12},(function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})})).forEach((function(n,r){var i=r===v.getMonth();o.push(e.jsx("div",t({className:"st-datepicker-month ".concat(i?"selected":""),onClick:function(){return function(e){m(new Date(v.getFullYear(),e,1)),w("days")}(r)}},{children:n}),"month-".concat(r)))})),o),"years"===p&&function(){for(var n=[],r=v.getFullYear(),o=r-6,i=function(o){var i=o===r;n.push(e.jsx("div",t({className:"st-datepicker-year ".concat(i?"selected":""),onClick:function(){return function(e){m(new Date(e,v.getMonth(),1)),w("months")}(o)}},{children:o}),"year-".concat(o)))},a=o;a<o+12;a++)i(a);return n}()]})),e.jsx("div",t({className:"st-datepicker-footer"},{children:e.jsx("button",t({className:"st-datepicker-today-btn",onClick:function(){var e=new Date;m(e),c(e),null==s||s()}},{children:"Today"}))}))]}))},E=function(r){var o=r.onBlur,i=r.onChange,a=r.open,c=r.setOpen,s=r.value,d=n.useState(function(e){if(e instanceof Date)return e;if("string"==typeof e&&e.match(/^\d{4}-\d{2}-\d{2}$/)){var n=e.split("-").map(Number),t=n[0],r=n[1],o=n[2];return new Date(t,r-1,o)}var i=new Date(e);return isNaN(i.getTime())?new Date:i}(s)),l=d[0],u=d[1];n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var h=function(){o()};return e.jsx(C,t({open:a,onClose:h,setOpen:c,width:280},{children:e.jsx(M,{value:l,onChange:function(e){u(e),i(e.toISOString()),c(!1),o()},onClose:h})}))},S=function(r){var o=r.onBlur,i=r.onChange,a=r.open,c=r.options,s=r.setOpen,d=r.value,l=n.useState(d||""),u=l[0],h=l[1];n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);return e.jsx(C,t({open:a,onClose:function(){o()},setOpen:s,width:150},{children:e.jsx("div",t({className:"st-enum-dropdown-content"},{children:c.map((function(n){return e.jsx(I,t({isSelected:u===n,onClick:function(){return h(e=n),i(e),s(!1),void o();var e}},{children:n}),n)}))}))}))},j=function(n){var t=n.enumOptions,r=void 0===t?[]:t,o=n.onChange,i=n.setIsEditing,a=n.type,c=void 0===a?"string":a,s=n.value,d=function(){i(!1)};if("boolean"===c&&"boolean"==typeof s)return e.jsx(y,{onBlur:d,onChange:function(e){return o(e)},open:!0,setOpen:i,value:s});if("date"===c){var l="string"==typeof s?s:"";return e.jsx(E,{onBlur:d,onChange:function(e){return o(e)},open:!0,setOpen:i,value:l})}if("enum"===c){var u="string"==typeof s?s:"";return e.jsx(S,{onBlur:d,onChange:function(e){return o(e)},open:!0,options:r,setOpen:i,value:u})}if("number"===c&&"number"==typeof s)return e.jsx(R,{defaultValue:s,onBlur:d,onChange:function(e){var n=""===e?0:parseFloat(e);o(isNaN(n)?0:n)}});var h=null==s?"":String(s);return e.jsx(b,{defaultValue:h,onBlur:d,onChange:function(e){return o(e)}})},k=0,D=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===k||o-k>=r)&&(k=o,n(t))}},W=Date.now(),N={screenX:0,screenY:0},H=function(e,n,t){void 0===t&&(t=[]);for(var r=0;r<e.length;r++){var o=e[r];if(o.accessor===n)return i(i([],t,!0),[r],!1);if(o.children&&o.children.length>0){var a=H(o.children,n,i(i([],t,!0),[r],!1));if(a)return a}}return null};var L=function(e){var t,r,o=e.draggedHeaderRef,i=e.headersRef,a=e.hoveredHeaderRef,c=e.onColumnOrderChange,s=e.onTableHeaderDragEnd,d=(t=i.current,r=n.useRef(t),n.useEffect((function(){JSON.stringify(r.current)!==JSON.stringify(t)&&(r.current=t)}),[t]),r.current);return{handleDragStart:function(e){o.current=e,W=Date.now()},handleDragOver:function(e){var n,t,r=e.event,c=e.hoveredHeader;if(r.preventDefault(),i.current){var l=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=r.screenX,h=r.screenY,f=Math.sqrt(Math.pow(u-N.screenX,2)+Math.pow(h-N.screenY,2));a.current=c;var v=i.current,m=H(v,(null===(n=o.current)||void 0===n?void 0:n.accessor)||""),g=H(v,c.accessor);if(m&&g){var p=m.length,w=g.length,x=g;if(p!==w){var C=w-p;C>0&&(x=g.slice(0,-C))}var I=function(e,n,t){var r=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var t=e,r=0;r<n.length-1;r++)t=t[n[r]].children;return t[n[n.length-1]]}function a(e,n,t){for(var r=e,i=0;i<n.length-1;i++){if(!r[n[i]].children){o=!0;break}r=r[n[i]].children}r[n[n.length-1]]=t}var c=i(r,n);return a(r,n,i(r,t)),a(r,t,c),{newHeaders:r,emergencyBreak:o}}(v,m,x),y=I.newHeaders,b=I.emergencyBreak;if(!(l||c.accessor===(null===(t=o.current)||void 0===t?void 0:t.accessor)||null===o.current||f<10||0===m.length||0===x.length||JSON.stringify(y)===JSON.stringify(i.current)||b)){var R=Date.now();JSON.stringify(y)===JSON.stringify(d)&&(R-W<1500||f<40)||(W=R,N={screenX:u,screenY:h},s(y))}}}},handleDragEnd:function(){o.current=null,a.current=null,null==c||c(i.current)}}},T=n.forwardRef((function(r,o){var i,a,c=r.borderClass,s=r.colIndex,l=r.header,u=r.isHighlighted,h=r.isInitialFocused,f=r.onExpandRowClick,v=r.rowIndex,m=r.visibleRow,g=d(),w=g.cellRegistry,C=g.cellUpdateFlash,I=g.collapseIcon,y=g.draggedHeaderRef,b=g.expandIcon,R=g.handleMouseDown,M=g.handleMouseOver,E=g.headersRef,S=g.hoveredHeaderRef,k=g.onCellEdit,W=g.onTableHeaderDragEnd,N=m.depth,H=m.row,T=n.useState(H.rowData[l.accessor]),B=T[0],O=T[1],P=n.useState(!1),F=P[0],A=P[1],z=n.useState(!1),U=z[0],Y=z[1],q=n.useRef(null),J=L({draggedHeaderRef:y,headersRef:E,hoveredHeaderRef:S,onTableHeaderDragEnd:W}).handleDragOver,V=D(),K="cell-".concat(v,"-").concat(s),X=x({rowId:H.rowMeta.rowId,accessor:l.accessor});n.useEffect((function(){if(w){var e="".concat(H.rowMeta.rowId,"-").concat(l.accessor);return w.set(e,{updateContent:function(e){B!==e?(O(e),C&&(Y(!0),q.current&&clearTimeout(q.current),q.current=setTimeout((function(){Y(!1)}),800))):O(e)}}),function(){w.delete(e),q.current&&clearTimeout(q.current)}}}),[w,C,H.rowMeta.rowId,l.accessor,B]),n.useEffect((function(){if(U){var e=setTimeout((function(){Y(!1)}),850);return function(){return clearTimeout(e)}}}),[U]),n.useEffect((function(){O(H.rowData[l.accessor])}),[H.rowData,l.accessor]),n.useEffect((function(){u||A(!1)}),[u]);var G,$="boolean"===l.type||"date"===l.type||"enum"===l.type,_=Boolean(null===(a=null===(i=H.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),Q=Boolean(null==l?void 0:l.isEditable),Z="st-cell ".concat(N>0&&l.expandable?"st-cell-depth-".concat(N):""," ").concat(u?h?"st-cell-selected-first ".concat(c):"st-cell-selected ".concat(c):""," ").concat(Q?"clickable":""," ").concat(U?"st-cell-updating":""),ee=n.useCallback((function(e){O(e),null==k||k({accessor:l.accessor,newValue:e,row:H})}),[l.accessor,k,H]);return F&&!$?e.jsx("div",t({className:"st-cell-editing",id:p({accessor:l.accessor,rowIndex:v+1})},{children:e.jsx(j,{enumOptions:l.enumOptions,onChange:ee,setIsEditing:A,type:l.type,value:B})})):e.jsxs("div",t({className:Z,id:K,onDoubleClick:function(){return l.isEditable&&A(!0)},onMouseDown:function(){return R({rowIndex:v,colIndex:s,rowId:H.rowMeta.rowId})},onMouseOver:function(){return M({rowIndex:v,colIndex:s,rowId:H.rowMeta.rowId})},onDragOver:function(e){return V({callback:J,callbackProps:{event:e,hoveredHeader:l},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!l.isEditable||F||(e.preventDefault(),A(!0))},ref:o,"data-row-index":v,"data-col-index":s,"data-row-id":H.rowMeta.rowId,"data-accessor":l.accessor},{children:[l.expandable&&_?H.rowMeta.isExpanded?e.jsx("div",t({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:I})):e.jsx("div",t({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:b})):null,e.jsx("span",t({className:"st-cell-content ".concat("right"===l.align?"right-aligned":"center"===l.align?"center-aligned":"")},{children:l.cellRenderer?l.cellRenderer({accessor:l.accessor,colIndex:s,row:H}):(G=B,"boolean"==typeof G?G?"True":"False":G)})),F&&$&&e.jsx(j,{enumOptions:l.enumOptions,onChange:ee,setIsEditing:A,type:l.type,value:B})]}),X)})),B=function(n){var r=n.children,o=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(n,["children"]);return d().allowAnimations?e.jsx(O,t({},o,{children:r})):e.jsx(e.Fragment,{children:r})},O=function(t){var r=t.children,o=t.isBody,i=t.pauseAnimation,a=t.rowIndex,c=n.useRef(!1),s=d(),l=s.draggedHeaderRef,u=s.headersRef,h=s.mainBodyRef,f=s.shouldPaginate,v=n.useState({}),m=v[0],g=v[1],w=n.useRef({}),x=u.current;return n.useLayoutEffect((function(){if(x){var e=function(e){var n=e.currentHeaders,t=e.draggedHeaderRef,r=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(p({accessor:e.accessor,rowIndex:r}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),c=i.getBoundingClientRect();a&&(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=c}}})),o}({currentHeaders:x,draggedHeaderRef:l,rowIndex:a});JSON.stringify(e)!==JSON.stringify(m)&&(w.current=m,g(e))}}),[m,x,l,o,a]),n.useLayoutEffect((function(){var e=h.current,n=function(){c.current=!0},t=function(){c.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",t),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",t)}}),[l,h]),n.useEffect((function(){i||c.current||Object.keys(w.current).length&&x&&x.forEach((function(e){var n=document.getElementById(p({accessor:e.accessor,rowIndex:a}));if(n){var t=w.current[e.accessor],r=m[e.accessor];if(t&&r){var o=t.left-r.left,i=f?0:t.top-r.top,c=Math.abs(o),s=Math.abs(i);(c>10||s>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[m,x,o,i,w,a,f]),e.jsx(e.Fragment,{children:r})},P=function(n){var r=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.isWidthDragging,c=n.onExpandRowClick,s=n.pinned,d=n.rowIndex,l=n.rowIndices,u=n.visibleRow,h=o.filter((function(e){return w({hiddenColumns:i,header:e,pinned:s})}));return e.jsx(B,t({isBody:!0,pauseAnimation:a,rowIndex:d+1},{children:h.map((function(n){return e.jsx(F,{columnIndices:r,header:n,headers:o,hiddenColumns:i,onExpandRowClick:c,pinned:s,rowIndex:d,rowIndices:l,visibleRow:u},p({accessor:n.accessor,rowIndex:d+1}))}))}))},F=function(t){var r=t.columnIndices,o=t.header,i=t.headers,a=t.hiddenColumns,c=t.onExpandRowClick,s=t.pinned,l=t.rowIndex,u=t.rowIndices,h=t.visibleRow,f=r[o.accessor],v=d(),m=v.getBorderClass,g=v.isSelected,x=v.isInitialFocusedCell;if(o.children){var C=o.children.filter((function(e){return w({hiddenColumns:a,header:e,pinned:s})}));return e.jsx(n.Fragment,{children:C.map((function(n){return e.jsx(F,{columnIndices:r,header:n,headers:i,hiddenColumns:a,onExpandRowClick:c,pinned:s,rowIndex:l,rowIndices:u,visibleRow:h},p({accessor:n.accessor,rowIndex:l+1}))}))})}var I={rowIndex:l,colIndex:f,rowId:h.row.rowMeta.rowId},y=m(I),b=g(I),R=x(I);return e.jsx(T,{borderClass:y,colIndex:f,header:o,isHighlighted:b,isInitialFocused:R,onExpandRowClick:c,rowIndex:l,visibleRow:h},p({accessor:o.accessor,rowIndex:l+1}))},A=function(n){var r=n.columnIndices,o=n.gridTemplateColumns,i=n.headers,a=n.hiddenColumns,c=n.index,s=n.isWidthDragging,d=n.onExpandRowClick,l=n.pinned,u=n.rowHeight,h=n.rowIndices,f=n.visibleRow,v=f.position,m=v%2==0;return e.jsx("div",t({className:"st-row ".concat(m?"even":"odd"),style:{gridTemplateColumns:o,top:g({position:v,rowHeight:u}),height:"".concat(u,"px")}},{children:e.jsx(P,{columnIndices:r,headers:i,hiddenColumns:a,isWidthDragging:s,onExpandRowClick:d,pinned:l,rowIndex:c,rowIndices:h,visibleRow:f},c)}))},z=function(n){var r=n.displayStrongBorder,o=n.position,i=n.rowHeight,a=n.templateColumns;return e.jsx("div",t({className:"st-row-separator ".concat(r?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:a,position:"absolute",top:m({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},U=function(r){var o=r.columnIndices,i=r.headers,a=r.hiddenColumns,c=r.isWidthDragging,s=r.onExpandRowClick,d=r.pinned,l=r.ref,u=r.rowHeight,h=r.rowIndices,f=r.templateColumns,v=r.totalHeight,m=r.visibleRows,g=r.width,p=d?"st-body-pinned-".concat(d):"st-body-main";return e.jsx("div",t({className:p,ref:l,style:t({position:"relative",height:"".concat(v,"px"),width:g},!d&&{flexGrow:1})},{children:m.map((function(t,r){var l,v,g=m[r-1],p=Boolean((null==g?void 0:g.depth)!==(null==t?void 0:t.depth)&&(null===(v=null===(l=null==t?void 0:t.row.rowMeta)||void 0===l?void 0:l.children)||void 0===v?void 0:v.length)&&0===t.depth);return e.jsxs(n.Fragment,{children:[0!==r&&e.jsx(z,{displayStrongBorder:p,position:t.position,rowHeight:u,templateColumns:f}),e.jsx(A,{columnIndices:o,gridTemplateColumns:f,headers:i,hiddenColumns:a,index:r,isWidthDragging:c,onExpandRowClick:s,pinned:d,rowHeight:u,rowIndices:h,visibleRow:t})]},t.position)}))}))};function Y(e){var n=e.headersRef,t=e.hiddenColumns,r=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,c=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return w({hiddenColumns:t,header:e})})).forEach((function(e,n){c(e,0===n)}))};return r.forEach((function(e,n){c(e,0===n)})),n.current.filter((function(e){return!e.pinned&&w({hiddenColumns:t,header:e})})).forEach((function(e,n){var t=0===n&&0===r.length;c(e,t)})),o.forEach((function(e){c(e,!1)})),i}var q=function(r){var o=r.flattenedRows,i=r.headerContainerRef,a=r.isWidthDragging,c=r.mainTemplateColumns,s=r.pinnedLeftColumns,l=r.pinnedLeftTemplateColumns,u=r.pinnedLeftWidth,h=r.pinnedRightColumns,f=r.pinnedRightTemplateColumns,v=r.pinnedRightWidth,m=r.setFlattenedRows,g=r.setScrollTop,p=r.visibleRows,w=d(),x=w.headersRef,C=w.hiddenColumns,I=w.mainBodyRef,y=w.rowHeight,b=w.scrollbarWidth,R=w.tableBodyContainerRef;!function(e){var t=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],c=i[1];n.useEffect((function(){var e=null==t?void 0:t.current;if(a&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[t,a,o]),n.useEffect((function(){var e=null==t?void 0:t.current,n=null==r?void 0:r.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;c(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[t,r])}({headerContainerRef:i,mainSectionRef:R,scrollbarWidth:b});var M,E,S=n.useRef(null),j=(M=0,(E=function(e){e.forEach((function(e){M+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&E(e.rowMeta.children)}))})(o),M)*(y+1)-1,k=n.useMemo((function(){return Y({headersRef:x,hiddenColumns:C,pinnedLeftColumns:s,pinnedRightColumns:h})}),[x,C,s,h]),D=n.useMemo((function(){var e={};return p.forEach((function(n,t){var r=String(n.row.rowMeta.rowId);e[r]=t})),e}),[p]),W=function(e){var n=function(r){return r.rowMeta.rowId===e&&r.rowMeta.children?t(t({},r),{rowMeta:t(t({},r.rowMeta),{isExpanded:!r.rowMeta.isExpanded})}):r.rowMeta.children?t(t({},r),{rowMeta:t(t({},r.rowMeta),{children:r.rowMeta.children.map(n)})}):r};m((function(e){return e.map(n)}))},N={headerContainerRef:i,headers:x.current,hiddenColumns:C,isWidthDragging:a,rowHeight:y,visibleRows:p,columnIndices:k,rowIndices:D};return e.jsxs("div",t({className:"st-body-container",ref:R,onScroll:function(e){var n=e.currentTarget.scrollTop;S.current&&cancelAnimationFrame(S.current),S.current=requestAnimationFrame((function(){g(n)}))}},{children:[s.length>0&&e.jsx(U,t({},N,{onExpandRowClick:W,pinned:"left",templateColumns:l,totalHeight:j,width:u})),e.jsx(U,t({},N,{ref:I,onExpandRowClick:W,templateColumns:c,totalHeight:j})),h.length>0&&e.jsx(U,t({},N,{onExpandRowClick:W,pinned:"right",templateColumns:f,totalHeight:j,width:v}))]}))},J=function(e,t){n.useEffect((function(){if(e.current){var n=e.current,r=function(){var e,r=null==n?void 0:n.scrollLeft;void 0!==r&&(null===(e=t.current)||void 0===e||e.scrollTo(r,0))};return n.addEventListener("scroll",r),function(){null==n||n.removeEventListener("scroll",r)}}}),[e,t])},V=function(e){return void 0===e&&(e=0),e?e+1:0},K=function(e){return e.hide?[]:e.children&&0!==e.children.length?e.children.flatMap((function(e){return K(e)})):[e]},X=function(e){if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);var n=document.getElementById(p({accessor:e.accessor,rowIndex:0}));return(null==n?void 0:n.offsetWidth)||150},G=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(p({accessor:e.accessor,rowIndex:0})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.forEach((function(e){G(e)}))},$=function(e){return"number"==typeof e.minWidth?e.minWidth:40},_=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=e.setMainBodyWidth,i=e.setPinnedLeftWidth,a=e.setPinnedRightWidth,c=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=n.pinned,i=0;return t.forEach((function(e){e.hide||e.pinned!==o||(e.accessor===n.accessor?i+=r:K(e).forEach((function(e){e.hide||(e.accessor===n.accessor?i+=r:i+=X(e))})))})),n.pinned?V(i):i}({header:n,headers:t,newWidth:r});"left"===n.pinned?i(c):"right"===n.pinned?a(c):n.pinned||o(c)},Q=function(e){var n=e.event,t=e.forceUpdate,r=e.gridColumnEnd,o=e.gridColumnStart,i=e.header,a=e.headersRef,c=e.setIsWidthDragging,s=e.setMainBodyWidth,d=e.setPinnedLeftWidth,l=e.setPinnedRightWidth,u=e.startWidth;c(!0),n.preventDefault();var h=n.clientX;if(i&&!i.hide){var f=$(i),v=r-o>1,m=v?K(i):[i],g=function(e){var n="right"===i.pinned?h-e.clientX:e.clientX-h;if(v&&m.length>1)Z({delta:n,header:i,headersRef:a,leafHeaders:m,minWidth:f,setMainBodyWidth:s,setPinnedLeftWidth:d,setPinnedRightWidth:l,startWidth:u});else{var r=Math.max(u+n,f);i.width=r,_({header:i,headers:a.current,newWidth:r,setMainBodyWidth:s,setPinnedLeftWidth:d,setPinnedRightWidth:l})}a.current.forEach((function(e){G(e)})),t()},p=function(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p),c(!1)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",p)}},Z=function(e){var n=e.delta,t=e.header,r=e.headersRef,o=e.leafHeaders,i=e.minWidth,a=e.setMainBodyWidth,c=e.setPinnedLeftWidth,s=e.setPinnedRightWidth,d=e.startWidth,l=o.reduce((function(e,n){return Math.min(e,$(n))}),40),u=o.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),h=Math.max(d+n,l);_({header:t,headers:r.current,newWidth:h,setMainBodyWidth:a,setPinnedLeftWidth:c,setPinnedRightWidth:s});var f=h-u;o.forEach((function(e){var n="number"==typeof e.width?e.width:150,t=f*(n/u),r=Math.max(n+t,i);e.width=r}))},ee=n.forwardRef((function(r,o){var a,c,s=r.colIndex,l=r.forceHeadersUpdate,u=r.gridColumnEnd,h=r.gridColumnStart,f=r.gridRowEnd,v=r.gridRowStart,m=r.header,g=r.reverse,w=r.sort,x=d(),C=x.columnReordering,I=x.columnResizing,y=x.draggedHeaderRef,b=x.forceUpdate,R=x.headersRef,M=x.hoveredHeaderRef,E=x.onColumnOrderChange,S=x.onSort,j=x.onTableHeaderDragEnd,k=x.rowHeight,W=x.selectColumns,N=x.selectableColumns,H=x.setInitialFocusedCell,T=x.setIsWidthDragging,B=x.setMainBodyWidth,O=x.setPinnedLeftWidth,P=x.setPinnedRightWidth,F=x.setSelectedCells,A=x.setSelectedColumns,z=x.sortDownIcon,U=x.sortUpIcon,Y=Boolean(null==m?void 0:m.isSortable),q="st-header-cell ".concat(m.accessor===(null===(a=M.current)||void 0===a?void 0:a.accessor)?"st-hovered":""," ").concat((null===(c=y.current)||void 0===c?void 0:c.accessor)===m.accessor?"st-dragging":""," ").concat(Y?"clickable":""," ").concat(C&&!Y?"columnReordering":""," ").concat("right"===(null==m?void 0:m.align)?"right-aligned":"center"===(null==m?void 0:m.align)?"center-aligned":""," ").concat(m.children?"parent":""),J=L({draggedHeaderRef:y,headersRef:R,hoveredHeaderRef:M,onColumnOrderChange:E,onTableHeaderDragEnd:j}),V=J.handleDragStart,K=J.handleDragEnd,X=J.handleDragOver,G=D(),$=function(e){var n=e.event,t=e.header;if(N){var r=function(e,n){if(!e.children||0===e.children.length)return[n];var t=[],r=function(e,n){if(!e.children||0===e.children.length)return t.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var c=a[i];o=r(c,o)}return o};return r(e,n),t}(t,s);return n.shiftKey&&W?A((function(e){if(0===e.size)return new Set(r);var n=r[0],t=Array.from(e).sort((function(e,n){return e-n})),o=t[0],a=Math.abs(n-o);t.forEach((function(e){var t=Math.abs(n-e);t<a&&(a=t,o=e)}));var c,s,d,l,u=i(i([],(c=o,s=n,d=Math.min(c,s),l=Math.max(c,s),Array.from({length:l-d+1},(function(e,n){return d+n}))),!0),r,!0);return new Set(i(i([],Array.from(e),!0),u,!0))})):W&&W(r),F(new Set),void H(null)}t.isSortable&&S(s,t.accessor)};if(n.useEffect((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!m)return null;var _=I&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;G({callback:Q,callbackProps:{event:e.nativeEvent,forceUpdate:b,gridColumnEnd:u,gridColumnStart:h,header:m,headersRef:R,setIsWidthDragging:T,setMainBodyWidth:B,setPinnedLeftWidth:O,setPinnedRightWidth:P,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),Z=w&&w.key.accessor===m.accessor&&e.jsxs("div",t({className:"st-sort-icon-container",onClick:function(e){return $({event:e,header:m})}},{children:["ascending"===w.direction&&U&&U,"descending"===w.direction&&z&&z]}));return e.jsxs("div",t({className:q,id:p({accessor:m.accessor,rowIndex:0}),onDragOver:function(e){G({callback:X,callbackProps:{event:e,hoveredHeader:m},limit:50})},ref:o,style:t(t({gridRowStart:v,gridRowEnd:f,gridColumnStart:h,gridColumnEnd:u},u-h>1?{}:{width:m.width}),f-v>1?{}:{height:k})},{children:[g&&_,e.jsxs("div",t({className:"st-header-label ".concat("right"===m.align?"right-aligned":"center"===m.align?"center-aligned":""),draggable:C&&!m.disableReorder,onClick:function(e){return $({event:e,header:m})},onDragEnd:function(e){e.preventDefault(),K(),l()},onDragStart:function(e){C&&m&&function(e){V(e)}(m)}},{children:["right"===m.align&&Z,null==m?void 0:m.label,"right"!==m.align&&Z]})),!g&&_]}))})),ne=function(r){var o=r.columnIndices,i=r.gridTemplateColumns,a=r.handleScroll,c=r.headersRef,s=r.hiddenColumns,d=r.maxDepth,l=r.pinned,u=r.sectionRef,h=r.sort,f=n.useReducer((function(e){return e+1}),0)[1],v=n.useMemo((function(){var e=[],n=1,t=function(r,i,a){var c,u;if(void 0===a&&(a=!1),!w({hiddenColumns:s,header:r,pinned:l}))return 0;a||n++;var h=null!==(u=null===(c=r.children)||void 0===c?void 0:c.filter((function(e){return w({hiddenColumns:s,header:e,pinned:l})})).length)&&void 0!==u?u:0,f=n,v=h>0?f+h:f+1,m=i,g=h>0?i+1:d+1;if(e.push({header:r,gridColumnStart:f,gridColumnEnd:v,gridRowStart:m,gridRowEnd:g,colIndex:o[r.accessor]}),r.children){var p=!0;r.children.forEach((function(e){w({hiddenColumns:s,header:e,pinned:l})&&(t(e,i+1,p),p=!1)}))}return v-f},r=c.current.filter((function(e){return w({hiddenColumns:s,header:e,pinned:l})})),i=!0;return r.forEach((function(e){t(e,1,i),i=!1})),e}),[c,s,d,l,o]);return e.jsx("div",t({className:"st-header-".concat(l?"pinned-".concat(l):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i,display:"grid",position:"relative"}},{children:e.jsx(B,t({rowIndex:0},{children:v.map((function(t){return e.jsx(ee,{colIndex:t.colIndex,forceHeadersUpdate:f,gridColumnEnd:t.gridColumnEnd,gridColumnStart:t.gridColumnStart,gridRowEnd:t.gridRowEnd,gridRowStart:t.gridRowStart,header:t.header,ref:n.createRef(),reverse:"right"===l,sort:h},t.header.accessor)}))}))}))},te=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(te)):1},re=function(r){var o=r.centerHeaderRef,i=r.headerContainerRef,a=r.headersRef,c=r.hiddenColumns,s=r.mainTemplateColumns,l=r.pinnedLeftColumns,u=r.pinnedLeftTemplateColumns,h=r.pinnedRightColumns,f=r.pinnedRightTemplateColumns,v=r.sort,m=d(),g=m.mainBodyRef,p=m.pinnedLeftRef,x=m.pinnedRightRef,C=m.setPinnedLeftWidth,I=m.setPinnedRightWidth;J(g,o);var y=n.useMemo((function(){return Y({headersRef:a,hiddenColumns:c,pinnedLeftColumns:l,pinnedRightColumns:h})}),[a,c,l,h]),b=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(w({hiddenColumns:c,header:e})){var t=te(e);n=Math.max(n,t)}})),{maxDepth:n}}),[a,c]).maxDepth;return n.useLayoutEffect((function(){var e,n;C(V(null===(e=p.current)||void 0===e?void 0:e.clientWidth)),I(V(null===(n=x.current)||void 0===n?void 0:n.clientWidth))}),[p,x,C,I]),e.jsxs("div",t({className:"st-header-container",ref:i},{children:[l.length>0&&e.jsx(ne,{columnIndices:y,gridTemplateColumns:u,handleScroll:void 0,headersRef:a,hiddenColumns:c,maxDepth:b,pinned:"left",sectionRef:p,sort:v}),e.jsx(ne,{columnIndices:y,gridTemplateColumns:s,handleScroll:function(e){var n,t,r=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==r&&(null===(t=g.current)||void 0===t||t.scrollTo(r,0))},headersRef:a,hiddenColumns:c,maxDepth:b,sectionRef:o,sort:v}),h.length>0&&e.jsx(ne,{columnIndices:y,gridTemplateColumns:f,handleScroll:void 0,headersRef:a,hiddenColumns:c,maxDepth:b,pinned:"right",sectionRef:x,sort:v})]}))},oe=function(e){var n=e.headers,t=e.hiddenColumns,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==t[e.accessor]&&(e.children?r({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=r({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,t=e.width;return"number"==typeof t&&(t="".concat(t,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof t&&t.endsWith("fr")?"minmax(".concat(n,", ").concat(t,")"):"max(".concat(n,", ").concat(t,")"):t}(e)})).join(" "))},ie=function(r){var o=r.flattenedRows,i=r.isWidthDragging,a=r.pinnedLeftWidth,c=r.pinnedRightWidth,s=r.setFlattenedRows,l=r.setScrollTop,u=r.sort,h=r.visibleRows,f=d(),v=f.editColumns,m=f.headersRef,g=f.hiddenColumns,p=n.useRef(null),w=n.useRef(null),x=m.current.filter((function(e){return!e.pinned})),C=m.current.filter((function(e){return"left"===e.pinned})),I=m.current.filter((function(e){return"right"===e.pinned})),y=n.useMemo((function(){return oe({headers:C,hiddenColumns:g})}),[C,g]),b=n.useMemo((function(){return oe({headers:x,hiddenColumns:g})}),[x,g]),R=n.useMemo((function(){return oe({headers:I,hiddenColumns:g})}),[I,g]),M={centerHeaderRef:w,headerContainerRef:p,headersRef:m,hiddenColumns:g,mainTemplateColumns:b,pinnedLeftColumns:C,pinnedLeftTemplateColumns:y,pinnedRightColumns:I,pinnedRightTemplateColumns:R,sort:u},E={flattenedRows:o,headerContainerRef:p,isWidthDragging:i,mainTemplateColumns:b,pinnedLeftColumns:C,pinnedLeftTemplateColumns:y,pinnedLeftWidth:a,pinnedRightColumns:I,pinnedRightTemplateColumns:R,pinnedRightWidth:c,setFlattenedRows:s,setScrollTop:l,visibleRows:h};return e.jsxs("div",t({className:"st-content",style:{width:v?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(re,t({},M)),e.jsx(q,t({},E))]}))},ae=function(r){var o,i,a=r.mainBodyWidth,c=r.mainBodyRef,s=r.pinnedLeftWidth,l=r.pinnedRightWidth,u=r.setMainBodyWidth,h=r.tableBodyContainerRef,f=d().editColumns,v=n.useState(!1),m=v[0],g=v[1],p=n.useRef(null),w=h.current&&h.current.scrollHeight>h.current.clientHeight,x=f?28:0,C=(f?l+1:l)+(h.current&&w?h.current.offsetWidth-h.current.clientWidth:0);return J(c,p),n.useEffect((function(){setTimeout((function(){!function(){if(c.current){var e=c.current.scrollWidth;u(e)}}()}),1)}),[c,u]),n.useEffect((function(){setTimeout((function(){!function(){if(c.current){var e=c.current.clientWidth;g(a>e)}}()}),1)}),[c,a,u]),m?e.jsxs("div",t({className:"st-horizontal-scrollbar-container"},{children:[s>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s,height:null===(o=p.current)||void 0===o?void 0:o.offsetHeight}}),a>0&&e.jsx("div",t({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&c.current&&c.current.scrollTo({left:n,behavior:"auto"})},ref:p,style:{flexGrow:1}},{children:e.jsx("div",{style:{width:a,height:".3px"}})})),l>0&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:C,height:null===(i=p.current)||void 0===i?void 0:i.offsetHeight}})}),x>0&&e.jsx("div",{style:{width:x-1.5,height:"100%",flexShrink:0}})]})):null},ce={string:function(e,n,t){if(e===n)return 0;var r=e.localeCompare(n);return"ascending"===t?r:-r},number:function(e,n,t){if(e===n)return 0;var r=e-n;return"ascending"===t?r:-r},boolean:function(e,n,t){if(e===n)return 0;var r=e===n?0:e?-1:1;return"ascending"===t?r:-r},date:function(e,n,t){var r=new Date(e),o=new Date(n);if(r.getTime()===o.getTime())return 0;var i=r.getTime()-o.getTime();return"ascending"===t?i:-i},enum:function(e,n,t){return ce.string(e,n,t)},default:function(e,n,t){return e===n?0:null==e?"ascending"===t?-1:1:null==n?"ascending"===t?1:-1:"string"==typeof e&&"string"==typeof n?ce.string(e,n,t):"number"==typeof e&&"number"==typeof n?ce.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?ce.boolean(e,n,t):ce.string(String(e),String(n),t)}},se=function(e,n,t,r){if(void 0===t&&(t="string"),null==e||""===e)return"ascending"===r?-1:1;if(null==n||""===n)return"ascending"===r?1:-1;if("number"===t){var o=function(e){var n;if("number"==typeof e)return e;var t=String(e);if("string"==typeof t){var r=t.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(r){var o=parseFloat(r[1]),i=null===(n=r[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(t)||0},i=o(e),a=o(n);return ce.number(i,a,r)}return"date"===t?ce.date(String(e),String(n),r):"boolean"===t?ce.boolean(Boolean(e),Boolean(n),r):"enum"===t?ce.enum(String(e),String(n),r):ce.string(String(e),String(n),r)},de=function(e,n,r){var o,a=(null===(o=n.key)||void 0===o?void 0:o.type)||"string",c=n.direction,s=new Map,d=new Map,l="";e.forEach((function(e){var t;if(e.rowData&&!0===e.rowMeta.isExpanded&&!0===n.key.expandable){var r=(e.rowData.sector||"group_".concat(s.size)).toString();l=r,d.set(l,e),s.has(l)||s.set(l,[])}else if(l){var o=s.get(l)||[];o.push(e),s.set(l,o)}else{var i="default";s.has(i)||s.set(i,[]),null===(t=s.get(i))||void 0===t||t.push(e)}}));var u=[];return s.forEach((function(e,o){if(d.has(o)){var s=d.get(o);s.rowMeta.children&&s.rowMeta.children.length>0&&(s.rowMeta.children=le(s.rowMeta.children,n,r)),u.push(s)}var l=i([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,o=e.rowData[r],i=t.rowData[r];return se(o,i,a,c)}));u.push.apply(u,l.map((function(e){var o=t({},e);if(o.rowMeta.children&&o.rowMeta.children.length>0){var i=le(o.rowMeta.children,n,r);o.rowMeta=t(t({},o.rowMeta),{children:i})}return o})))})),u},le=function(e,n,r){var o=r.find((function(e){return e.accessor===n.key.accessor})),a=(null==o?void 0:o.type)||"string",c=n.direction;return i([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,o=e.rowData[r],i=t.rowData[r];return se(o,i,a,c)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?t(t({},e),{rowMeta:t(t({},e.rowMeta),{children:le(e.rowMeta.children,n,r)})}):e}))},ue=function(e){var t=e.headers,r=e.tableRows,o=n.useState(null),i=o[0],a=o[1],c=n.useMemo((function(){var e={};return t.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[t]),s=n.useState(c),d=s[0],l=s[1],u=n.useMemo((function(){if(!i)return r;var e=function(e,n,t){return{sortedData:de(n,t,e),newSortConfig:t}}(t,r,i).sortedData;return e}),[r,i,t]);return{hiddenColumns:d,setHiddenColumns:l,setSort:a,sort:i,sortedRows:u,updateSort:function(e,n){var r=function(e){for(var t=0,o=e;t<o.length;t++){var i=o[t];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=r(i.children);if(a)return a}}},o=r(t);o&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))}}},he=function(n){var r=n.checked,o=void 0!==r&&r,i=n.children,a=n.onChange;return e.jsxs("label",t({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:o,className:"st-checkbox-input",onChange:function(){a&&a(!o)},type:"checkbox"}),e.jsx("span",t({className:"st-checkbox-custom ".concat(o?"st-checked":"")},{children:o&&e.jsx("span",{className:"st-checkbox-checkmark"})})),i]}))},fe=function(e,n,t,r){void 0===r&&(r=new Set);for(var o=0,i=e;o<i.length;o++){var a=i[o];if(!r.has(a.accessor)&&(r.add(a.accessor),a.children&&a.children.length>0)){var c=a.children.some((function(e){return e.accessor===n})),s=!1;if(!c)for(var d=0,l=a.children;d<l.length;d++){var u=l[d];if(fe([u],n,t,r),!1===t[u.accessor]){s=!0;break}}(c||s)&&(t[a.accessor]=!1)}}},ve=function(e,n){return e.every((function(e){return!0===n[e.accessor]}))},me=function(e,n){e.forEach((function(e){e.children&&e.children.length>0&&(me(e.children,n),ve(e.children,n)&&(n[e.accessor]=!0))}))},ge=function(r){var o=r.allHeaders,i=r.depth,a=void 0===i?0:i,c=r.header,s=r.hiddenColumns,l=r.setHiddenColumns,u=n.useState(!0),h=u[0],f=u[1],v=d(),m=v.expandIcon,g=v.collapseIcon,p=v.headersRef,w=v.setMainBodyWidth,x=v.setPinnedLeftWidth,C=v.setPinnedRightWidth,I="".concat(16*a,"px"),y=c.children&&c.children.length>0,b=s[c.accessor]||y&&c.children&&ve(c.children,s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",t({className:"st-header-checkbox-item",style:{paddingLeft:I}},{children:[e.jsx("div",t({className:"st-header-icon-container"},{children:y?e.jsx("div",t({className:"st-collapsible-header-icon",onClick:function(e){e.stopPropagation(),f(!h)}},{children:h?g:m})):null})),e.jsx(he,t({checked:b,onChange:function(e){var n=t({},s);(n[c.accessor]=e,e)?me(o,n):(fe(o,c.accessor,n),y&&c.children&&c.children.length>0&&c.children.every((function(e){return!0===s[e.accessor]}))&&c.children[0]&&(n[c.children[0].accessor]=!1,fe(o,c.children[0].accessor,n)));l(n),p.current.forEach((function(e){e.hide=!0===n[e.accessor]})),function(e){var n=e.headers,t=e.setMainBodyWidth,r=e.setPinnedLeftWidth,o=e.setPinnedRightWidth,i=0,a=0,c=0;n.forEach((function(e){if(!e.hide){var n=K(e).reduce((function(e,n){return e+X(n)}),0);"left"===e.pinned?i+=n:"right"===e.pinned?a+=n:c+=n}}));var s=V(i),d=V(a);r(s),o(d),t(c)}({headers:p.current,setMainBodyWidth:w,setPinnedLeftWidth:x,setPinnedRightWidth:C})}},{children:c.label}))]})),y&&h&&c.children&&e.jsx("div",t({className:"st-nested-headers"},{children:c.children.map((function(n,t){return e.jsx(ge,{allHeaders:o,depth:a+1,header:n,hiddenColumns:s,setHiddenColumns:l},"".concat(n.accessor,"-").concat(t))}))}))]})},pe=function(n){var r=n.headers,o=n.open,i=n.position,a=n.setHiddenColumns,c=n.hiddenColumns,s="left"===i?"left":"";return e.jsx("div",t({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(s),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",t({className:"st-column-editor-popout-content"},{children:r.map((function(n,t){return e.jsx(ge,{header:n,hiddenColumns:c,setHiddenColumns:a,allHeaders:r},"".concat(n.accessor,"-").concat(t))}))}))}))},we=function(r){var o=r.columnEditorText,i=r.editColumns,a=r.editColumnsInitOpen,c=r.headers,s=r.hiddenColumns,d=r.position,l=void 0===d?"right":d,u=r.setHiddenColumns,h=n.useState(a),f=h[0],v=h[1];return i?e.jsxs("div",t({className:"st-column-editor ".concat(f?"open":""," ").concat(l),onClick:function(){return function(e){v(e)}(!f)},style:{width:28}},{children:[e.jsx("div",t({className:"st-column-editor-text"},{children:o})),e.jsx(pe,{headers:c,open:f,position:l,setHiddenColumns:u,hiddenColumns:s})]})):null},xe=function(r){var o=r.allowAnimations,i=void 0!==o&&o,c=r.cellUpdateFlash,d=void 0!==c&&c,m=r.collapseIcon,g=void 0===m?e.jsx(v,{className:"st-sort-icon"}):m,p=r.columnEditorPosition,w=void 0===p?"right":p,C=r.columnEditorText,I=void 0===C?"Columns":C,y=r.columnReordering,b=void 0!==y&&y,R=r.columnResizing,M=void 0!==R&&R,E=r.defaultHeaders,S=r.editColumns,j=void 0!==S&&S,k=r.editColumnsInitOpen,D=void 0!==k&&k,W=r.expandIcon,N=void 0===W?e.jsx(h,{className:"st-sort-icon"}):W,H=r.height,L=r.hideFooter,T=void 0!==L&&L,B=r.nextIcon,O=void 0===B?e.jsx(h,{className:"st-next-prev-icon"}):B,P=r.onCellEdit,F=r.onColumnOrderChange,A=r.onGridReady,z=r.onNextPage,U=r.prevIcon,Y=void 0===U?e.jsx(u,{className:"st-next-prev-icon"}):U,q=r.rowHeight,J=void 0===q?40:q,V=r.rows,K=r.rowsPerPage,X=void 0===K?10:K,G=r.selectableCells,$=void 0!==G&&G,_=r.selectableColumns,Q=void 0!==_&&_,Z=r.shouldPaginate,ee=void 0!==Z&&Z,ne=r.sortDownIcon,te=void 0===ne?e.jsx(v,{className:"st-sort-icon"}):ne,re=r.sortUpIcon,oe=void 0===re?e.jsx(f,{className:"st-sort-icon"}):re,ce=r.tableRef,se=r.theme,de=void 0===se?"light":se,le=n.useRef(null),he=n.useRef(E),fe=n.useRef(null),ve=n.useRef(null),me=n.useRef(null),ge=n.useRef(null),pe=n.useRef(null),xe=n.useState(1),Ce=xe[0],Ie=xe[1],ye=n.useState(!1),be=ye[0],Re=ye[1],Me=n.useState(0),Ee=Me[0],Se=Me[1],je=n.useState(0),ke=je[0],De=je[1],We=n.useState(0),Ne=We[0],He=We[1],Le=n.useState(0),Te=Le[0],Be=Le[1],Oe=n.useState(0),Pe=Oe[0],Fe=Oe[1],Ae=ue({headers:he.current,tableRows:V}),ze=Ae.sort,Ue=Ae.sortedRows,Ye=Ae.hiddenColumns,qe=Ae.setHiddenColumns,Je=Ae.updateSort;n.useEffect((function(){null==A||A()}),[A]);var Ve=n.useMemo((function(){if(!ee)return Ue;var e=(Ce-1)*X,n=e+X;return Ue.slice(e,n)}),[Ce,X,ee,Ue]),Ke=n.useState(Ve),Xe=Ke[0],Ge=Ke[1];n.useEffect((function(){Ge(Ve)}),[Ve]);var $e=n.useMemo((function(){var e;if(!H)return window.innerHeight-J;var n=document.querySelector(".simple-table-root"),t=0;if(H.endsWith("px"))t=parseInt(H,10);else if(H.endsWith("vh")){var r=parseInt(H,10);t=window.innerHeight*r/100}else if(H.endsWith("%")){var o=parseInt(H,10);t=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else t=window.innerHeight;return Math.max(0,t-J)}),[H,J]),_e=n.useMemo((function(){return function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=o+1,c=[],s=0,d=Math.max(0,i-a*n),l=i+t+a*n,u=function(e,n){for(var t,r=0,o=e;r<o.length;r++){var i=o[r],h=s*a;if(h>=l)break;h+a>d&&c.push({row:i,depth:n,position:s,isLastGroupRow:Boolean(null===(t=i.rowMeta.children)||void 0===t?void 0:t.length)&&n>1}),s+=1,i.rowMeta.isExpanded&&i.rowMeta.children&&u(i.rowMeta.children,n+1)}};return u(r,0),c}({bufferRowCount:5,contentHeight:$e,flattenedRows:Xe,rowHeight:J,scrollTop:Te})}),[$e,J,Xe,Te]),Qe=n.useReducer((function(e){return e+1}),0)[1],Ze=function(e){var t=e.selectableCells,r=e.headers,o=e.visibleRows,i=n.useState(new Set),c=i[0],s=i[1],d=n.useState(new Set),l=d[0],u=d[1],h=n.useState(null),f=h[0],v=h[1],m=n.useState(null),g=m[0],p=m[1],w=n.useRef(!1),x=n.useRef(null),C=n.useCallback((function(){var e=Array.from(c).reduce((function(e,n){var t=n.split("-").map(Number),i=t[0],a=t[1];return e[i]||(e[i]=[]),e[i][a]=o[i].row.rowData[r[a].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");c.size>0&&navigator.clipboard.writeText(n)}),[r,c,o]),I=n.useCallback((function(e,n){for(var t=new Set,r=Math.min(e.rowIndex,n.rowIndex),i=Math.max(e.rowIndex,n.rowIndex),c=Math.min(e.colIndex,n.colIndex),d=Math.max(e.colIndex,n.colIndex),l=r;l<=i;l++)for(var h=c;h<=d;h++)if(l>=0&&l<o.length){var f=o[l].row.rowMeta.rowId;t.add(a({colIndex:h,rowIndex:l,rowId:f}))}u(new Set),v(null),s(t)}),[o,u,v,s]),y=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<r.length){var n=a(e);u(new Set),v(null),s(new Set([n])),p(e)}}),[r.length,o.length,u,v,s,p]),b=n.useCallback((function(e,n){void 0===n&&(n=!1),s(new Set),p(null),u((function(t){var r=new Set(n?t:[]);return e.forEach((function(e){return r.add(e)})),r})),e.length>0&&v(e[e.length-1])}),[s,p,u,v]);n.useEffect((function(){var e=function(e){if(t&&g){var n=g.rowIndex,i=g.colIndex,a=g.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(o[n].row.rowMeta.rowId!==a){var c=o.findIndex((function(e){return e.row.rowMeta.rowId===a}));if(-1===c)return;n=c}if("ArrowUp"===e.key){if(e.preventDefault(),n>0){var d={rowIndex:n-1,colIndex:i,rowId:o[n-1].row.rowMeta.rowId};y(d)}}else"ArrowDown"===e.key?(e.preventDefault(),n<o.length-1&&(d={rowIndex:n+1,colIndex:i,rowId:o[n+1].row.rowMeta.rowId},y(d))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(d={rowIndex:n,colIndex:i-1,rowId:o[n].row.rowMeta.rowId},y(d))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<r.length-1&&(d={rowIndex:n,colIndex:i+1,rowId:o[n].row.rowMeta.rowId},y(d))):"Escape"===e.key&&(s(new Set),u(new Set),v(null),x.current=null,p(null))}else C()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[C,r.length,g,I,y,t,o]);var R=n.useCallback((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=a({colIndex:n,rowIndex:t,rowId:r}),i=c.has(o),s=l.has(n);return i||s}),[c,l]),M=n.useCallback((function(e){var n,t,r,i,a,c,s=e.colIndex,d=e.rowIndex,u=e.rowId,h=[],f=null===(r=null===(t=null===(n=o[d-1])||void 0===n?void 0:n.row)||void 0===t?void 0:t.rowMeta)||void 0===r?void 0:r.rowId,v={colIndex:s,rowIndex:d+1,rowId:null===(c=null===(a=null===(i=o[d+1])||void 0===i?void 0:i.row)||void 0===a?void 0:a.rowMeta)||void 0===c?void 0:c.rowId},m={colIndex:s-1,rowIndex:d,rowId:u},g={colIndex:s+1,rowIndex:d,rowId:u};return(!R({colIndex:s,rowIndex:d-1,rowId:f})||l.has(s)&&0===d)&&h.push("st-selected-top-border"),(!R(v)||l.has(s)&&d===o.length-1)&&h.push("st-selected-bottom-border"),R(m)||h.push("st-selected-left-border"),R(g)||h.push("st-selected-right-border"),h.join(" ")}),[R,o,l]),E=n.useMemo((function(){return g?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===g.rowIndex&&t===g.colIndex&&r===g.rowId}:function(){return!1}}),[g]);return{getBorderClass:M,handleMouseDown:function(e){var n=e.colIndex,r=e.rowIndex,o=e.rowId;if(t){w.current=!0,x.current={rowIndex:r,colIndex:n,rowId:o},u(new Set),v(null);var i=a({colIndex:n,rowIndex:r,rowId:o});s(new Set([i])),p({rowIndex:r,colIndex:n,rowId:o})}},handleMouseOver:function(e){var n=e.colIndex,r=e.rowIndex;if(e.rowId,t&&w.current&&x.current){for(var i=new Set,c=Math.min(x.current.rowIndex,r),d=Math.max(x.current.rowIndex,r),l=Math.min(x.current.colIndex,n),u=Math.max(x.current.colIndex,n),h=c;h<=d;h++)for(var f=l;f<=u;f++)if(h>=0&&h<o.length){var v=o[h].row.rowMeta.rowId;i.add(a({colIndex:f,rowIndex:h,rowId:v}))}s(i)}},handleMouseUp:function(){w.current=!1},isInitialFocusedCell:E,isSelected:R,lastSelectedColumnIndex:f,selectColumns:b,selectedCells:c,selectedColumns:l,setInitialFocusedCell:p,setSelectedCells:s,setSelectedColumns:u}}({selectableCells:$,headers:he.current,visibleRows:_e}),en=Ze.getBorderClass,nn=Ze.handleMouseDown,tn=Ze.handleMouseOver,rn=Ze.handleMouseUp,on=Ze.isInitialFocusedCell,an=Ze.isSelected,cn=Ze.selectColumns,sn=Ze.selectedCells,dn=Ze.selectedColumns,ln=Ze.setInitialFocusedCell,un=Ze.setSelectedCells,hn=Ze.setSelectedColumns,fn=n.useCallback((function(e,n){Je(e,n)}),[Je]),vn=n.useCallback((function(e){he.current=e,Qe()}),[]);n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||Q&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(sn.size>0&&un(new Set),dn.size>0&&hn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[Q,sn,dn,un,hn]),n.useLayoutEffect((function(){if(pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth;Fe(e)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Qe(),pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth;Fe(e)}};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var mn=n.useRef(new Map);return n.useEffect((function(){ce&&(ce.current={updateData:function(e){var n,t,r,o,i=e.accessor,a=e.rowIndex,c=e.newValue,s=null===(t=null===(n=null==V?void 0:V[a])||void 0===n?void 0:n.rowMeta)||void 0===t?void 0:t.rowId;if(void 0!==s){var d=x({rowId:s,accessor:i}),l=mn.current.get(d);l&&l.updateContent(c),void 0!==(null===(o=null===(r=null==V?void 0:V[a])||void 0===r?void 0:r.rowData)||void 0===o?void 0:o[i])&&(V[a].rowData[i]=c)}}})}),[ce,V]),e.jsx(s,t({value:{allowAnimations:i,cellRegistry:mn.current,cellUpdateFlash:d,collapseIcon:g,columnReordering:b,columnResizing:M,draggedHeaderRef:le,editColumns:j,expandIcon:N,forceUpdate:Qe,getBorderClass:en,handleMouseDown:nn,handleMouseOver:tn,headersRef:he,hiddenColumns:Ye,hoveredHeaderRef:fe,isInitialFocusedCell:on,isSelected:an,mainBodyRef:ve,nextIcon:O,onCellEdit:P,onColumnOrderChange:F,onSort:fn,onTableHeaderDragEnd:vn,pinnedLeftRef:me,pinnedRightRef:ge,prevIcon:Y,rowHeight:J,scrollbarWidth:Pe,selectColumns:cn,selectableColumns:Q,setInitialFocusedCell:ln,setIsWidthDragging:Re,setMainBodyWidth:Se,setPinnedLeftWidth:De,setPinnedRightWidth:He,setSelectedCells:un,setSelectedColumns:hn,shouldPaginate:ee,sortDownIcon:te,sortUpIcon:oe,tableBodyContainerRef:pe}},{children:e.jsx("div",t({className:"simple-table-root st-wrapper theme-".concat(de),style:H?{height:H}:{}},{children:e.jsxs("div",t({className:"st-wrapper-container"},{children:[e.jsxs("div",t({className:"st-content-wrapper",onMouseUp:rn,onMouseLeave:rn},{children:[e.jsx(ie,{flattenedRows:Xe,isWidthDragging:be,pinnedLeftWidth:ke,pinnedRightWidth:Ne,setFlattenedRows:Ge,setScrollTop:Be,sort:ze,visibleRows:_e}),e.jsx(we,{columnEditorText:I,editColumns:j,editColumnsInitOpen:D,headers:he.current,hiddenColumns:Ye,position:w,setHiddenColumns:qe})]})),e.jsx(ae,{mainBodyRef:ve,mainBodyWidth:Ee,pinnedLeftWidth:ke,pinnedRightWidth:Ne,setMainBodyWidth:Se,tableBodyContainerRef:pe}),e.jsx(l,{currentPage:Ce,hideFooter:T,onPageChange:Ie,onNextPage:z,shouldPaginate:ee,totalPages:Math.ceil(V.length/X)})]}))}))}))};exports.SimpleTable=function(r){var o=n.useState(!1),i=o[0],a=o[1];return n.useEffect((function(){a(!0)}),[]),i?e.jsx(xe,t({},r)):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=function(){return t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,c)}s((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function i(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var a=function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return"".concat(n,"-").concat(t,"-").concat(r)},c=n.createContext(void 0),s=function(n){var r=n.children,o=n.value;return e.jsx(c.Provider,t({value:o},{children:r}))},d=function(){var e=n.useContext(c);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},l=function(i){var a=i.currentPage,c=i.hideFooter,s=i.onPageChange,l=i.onNextPage,u=i.shouldPaginate,h=i.totalPages,f=d(),v=f.nextIcon,m=f.prevIcon,g=n.useState(!0),p=g[0],w=g[1],x=!(a>1),C=!(a<h)&&!l||!p&&a===h;if(c||!u)return null;var I=function(){if(h<=15)return Array.from({length:h},(function(e,n){return n+1}));var e,n,t=[],r=15;if(a<=Math.ceil(7.5))e=1,n=14;else if(a>=h-Math.floor(7.5))e=Math.max(1,h-r+1),n=h;else{var o=Math.floor(7);e=a-o,n=a+(r-o-1)}for(var i=e;i<=n;i++)t.push(i);return n<h-1&&(t.push(-1),t.push(h)),t}();return e.jsxs("div",t({className:"st-footer"},{children:[e.jsx("button",t({className:"st-next-prev-btn ".concat(x?"disabled":""),onClick:function(){var e=a-1;e>=1&&s(e)},disabled:x},{children:m})),e.jsx("button",t({className:"st-next-prev-btn ".concat(C?"disabled":""),onClick:function(){return r(void 0,void 0,void 0,(function(){var e,n;return o(this,(function(t){switch(t.label){case 0:return e=a===h,n=a+1,l&&e?[4,l(a)]:[3,2];case 1:if(!t.sent())return w(!1),[2];t.label=2;case 2:return(n<=h||l)&&s(n),[2]}}))}))},disabled:C},{children:v})),I.map((function(n,r){return n<0?e.jsx("span",t({className:"st-page-ellipsis"},{children:"..."}),"ellipsis-".concat(n)):e.jsx("button",t({onClick:function(){return function(e){e>=1&&e<=h&&s(e)}(n)},className:"st-page-btn ".concat(a===n?"active":"")},{children:n}),"page-".concat(n))}))]}))},u=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},h=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},f=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},v=function(n){var r=n.className;return e.jsx("svg",t({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},m=function(e){return e.position*(e.rowHeight+1)-1},g=function(e){return e.position*(e.rowHeight+1)},p=function(e){var n=e.accessor,t=e.rowIndex;return"cell-".concat(n,"-").concat(t)},w=function(e){var n=e.hiddenColumns,t=e.header,r=e.pinned;return n[t.accessor]?null:!r&&!t.pinned||t.pinned===r||null},x=function(e){var n=e.rowId,t=e.accessor;return"".concat(n,"-").concat(t)},C=function(r){var o=r.children,i=r.onClose,a=r.open,c=r.setOpen,s=r.width,l=r.containerRef,u=d(),h=null==u?void 0:u.mainBodyRef,f=n.useRef(null),v=n.useRef(null),m=n.useState("bottom-left"),g=m[0],p=m[1],w=n.useState({}),x=w[0],C=w[1],I=n.useState(!1),y=I[0],b=I[1];return n.useEffect((function(){a&&f.current?(b(!1),!v.current&&f.current.parentElement&&(v.current=f.current.parentElement),requestAnimationFrame((function(){if(f.current&&v.current){var e,n=f.current,t=v.current.getBoundingClientRect(),r=n.offsetHeight,o=s||n.offsetWidth,i=(e=(null==l?void 0:l.current)?l.current.getBoundingClientRect():(null==h?void 0:h.current)?h.current.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0,width:window.innerWidth,height:window.innerHeight,x:0,y:0,toJSON:function(){}}).bottom-t.bottom,a=t.top-e.top,c="bottom",d={};(r>i&&r<=a||r>i&&a>i)&&(c="top");var u="left";o>e.right-t.right+t.width&&(u="right"),"bottom"===c?d.top=t.bottom+4:d.bottom=window.innerHeight-t.top+4,"left"===u?d.left=t.left:d.right=window.innerWidth-t.right,p("".concat(c,"-").concat(u)),C(d),b(!0)}}))):a||b(!1)}),[a,s,l,h]),n.useEffect((function(){var e=function(e){if(a&&f.current){var n=e.target;f.current&&!f.current.contains(n)&&(c(!1),null==i||i())}};return a&&window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}}),[a,i,c]),n.useEffect((function(){var e=function(e){f.current&&!f.current.contains(e.target)&&(c(!1),null==i||i())};return a&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[i,a,c]),n.useEffect((function(){var e=function(e){"Escape"===e.key&&a&&(c(!1),null==i||i())};return a&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[i,a,c]),a?e.jsx("div",t({ref:f,className:"st-dropdown-content st-dropdown-".concat(g),style:t({width:s?"".concat(s,"px"):"auto",visibility:y?"visible":"hidden"},x)},{children:o})):null},I=function(n){var r=n.children,o=n.onClick,i=n.isSelected,a=void 0!==i&&i,c=n.disabled,s=void 0!==c&&c,d=n.className,l=void 0===d?"":d;return e.jsx("div",t({className:"st-dropdown-item ".concat(a?"selected":""," ").concat(s?"disabled":""," ").concat(l),onClick:function(){!s&&o&&o()},role:"option","aria-selected":a,"aria-disabled":s},{children:r}))},y=function(r){var o=r.onBlur,i=r.onChange,a=r.open,c=r.setOpen,s=r.value,d=n.useState(s),l=d[0],u=d[1];n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var h=function(e){u(e),i(e),c(!1),o()};return e.jsxs(C,t({open:a,onClose:function(){o()},setOpen:c,width:120},{children:[e.jsx(I,t({isSelected:!0===l,onClick:function(){return h(!0)}},{children:"True"})),e.jsx(I,t({isSelected:!1===l,onClick:function(){return h(!1)}},{children:"False"}))]}))},b=function(t){var r=t.defaultValue,o=t.onBlur,i=t.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)}})},R=function(t){var r=t.defaultValue,o=t.onBlur,i=t.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},M=function(r){var o,i,a=r.value,c=r.onChange,s=r.onClose,l=d(),u=l.nextIcon,h=l.prevIcon,f=n.useState(a||new Date),v=f[0],m=f[1],g=n.useState("days"),p=g[0],w=g[1],x=function(e,n){return new Date(e,n+1,0).getDate()};return e.jsxs("div",t({className:"st-datepicker"},{children:[e.jsxs("div",t({className:"st-datepicker-header"},{children:["days"===p&&e.jsxs(e.Fragment,{children:[e.jsx("button",t({onClick:function(){m(new Date(v.getFullYear(),v.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:h})),e.jsxs("div",t({className:"st-datepicker-header-label",onClick:function(){return w("months")}},{children:[(i=v,i.toLocaleString("default",{month:"long"}))," ",v.getFullYear()]})),e.jsx("button",t({onClick:function(){m(new Date(v.getFullYear(),v.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:u}))]}),"months"===p&&e.jsx("div",t({className:"st-datepicker-header-label",onClick:function(){return w("years")}},{children:v.getFullYear()})),"years"===p&&e.jsx("div",t({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),e.jsxs("div",t({className:"st-datepicker-grid st-datepicker-".concat(p,"-grid")},{children:["days"===p&&function(){var n=[],r=v.getFullYear(),o=v.getMonth(),i=x(r,o),d=function(e,n){return new Date(e,n,1).getDay()}(r,o),l=x(r,o-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach((function(r,o){n.push(e.jsx("div",t({className:"st-datepicker-weekday"},{children:r}),"header-".concat(o)))}));for(var u=function(r){var o=l-d+r+1;n.push(e.jsx("div",t({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()-1,e);m(n),c(n),null==s||s()}(o)}},{children:o}),"prev-".concat(o)))},h=0;h<d;h++)u(h);for(var f=function(i){var d=i===(new Date).getDate()&&o===(new Date).getMonth()&&r===(new Date).getFullYear(),l=i===new Date(a).getDate()&&o===new Date(a).getMonth()&&r===new Date(a).getFullYear();n.push(e.jsx("div",t({className:"st-datepicker-day ".concat(d?"today":""," ").concat(l?"selected":""),onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth(),e);m(n),c(n),null==s||s()}(i)}},{children:i}),"day-".concat(i)))},g=1;g<=i;g++)f(g);var p=35-(d+i),w=function(r){n.push(e.jsx("div",t({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(v.getFullYear(),v.getMonth()+1,e);m(n),c(n),null==s||s()}(r)}},{children:r}),"next-".concat(r)))};for(g=1;g<=p;g++)w(g);return n}(),"months"===p&&(o=[],Array.from({length:12},(function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})})).forEach((function(n,r){var i=r===v.getMonth();o.push(e.jsx("div",t({className:"st-datepicker-month ".concat(i?"selected":""),onClick:function(){return function(e){m(new Date(v.getFullYear(),e,1)),w("days")}(r)}},{children:n}),"month-".concat(r)))})),o),"years"===p&&function(){for(var n=[],r=v.getFullYear(),o=r-6,i=function(o){var i=o===r;n.push(e.jsx("div",t({className:"st-datepicker-year ".concat(i?"selected":""),onClick:function(){return function(e){m(new Date(e,v.getMonth(),1)),w("months")}(o)}},{children:o}),"year-".concat(o)))},a=o;a<o+12;a++)i(a);return n}()]})),e.jsx("div",t({className:"st-datepicker-footer"},{children:e.jsx("button",t({className:"st-datepicker-today-btn",onClick:function(){var e=new Date;m(e),c(e),null==s||s()}},{children:"Today"}))}))]}))},S=function(r){var o=r.onBlur,i=r.onChange,a=r.open,c=r.setOpen,s=r.value,d=n.useState(function(e){var n=e.split("-").map(Number),t=n[0],r=n[1],o=n[2],i=new Date;return i.setUTCFullYear(t),i.setUTCMonth(r-1),i.setUTCDate(o),isNaN(i.getTime())?new Date:i}(s)),l=d[0],u=d[1];n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);var h=function(){o()};return e.jsx(C,t({open:a,onClose:h,setOpen:c,width:280},{children:e.jsx(M,{value:l,onChange:function(e){u(e),i(e.toISOString()),c(!1),o()},onClose:h})}))},E=function(r){var o=r.onBlur,i=r.onChange,a=r.open,c=r.options,s=r.setOpen,d=r.value,l=n.useState(d||""),u=l[0],h=l[1];n.useEffect((function(){var e=setTimeout((function(){var e=document.querySelector(".st-dropdown-container");e instanceof HTMLElement&&e.focus()}),0);return function(){return clearTimeout(e)}}),[]);return e.jsx(C,t({open:a,onClose:function(){o()},setOpen:s,width:150},{children:e.jsx("div",t({className:"st-enum-dropdown-content"},{children:c.map((function(n){return e.jsx(I,t({isSelected:u===n,onClick:function(){return h(e=n),i(e),s(!1),void o();var e}},{children:n}),n)}))}))}))},j=function(n){var t=n.enumOptions,r=void 0===t?[]:t,o=n.onChange,i=n.setIsEditing,a=n.type,c=void 0===a?"string":a,s=n.value,d=function(){i(!1)};if("boolean"===c&&"boolean"==typeof s)return e.jsx(y,{onBlur:d,onChange:function(e){return o(e)},open:!0,setOpen:i,value:s});if("date"===c){var l="string"==typeof s?s:"";return e.jsx(S,{onBlur:d,onChange:function(e){return o(e)},open:!0,setOpen:i,value:l})}if("enum"===c){var u="string"==typeof s?s:"";return e.jsx(E,{onBlur:d,onChange:function(e){return o(e)},open:!0,options:r,setOpen:i,value:u})}if("number"===c&&"number"==typeof s)return e.jsx(R,{defaultValue:s,onBlur:d,onChange:function(e){var n=""===e?0:parseFloat(e);o(isNaN(n)?0:n)}});var h=null==s?"":String(s);return e.jsx(b,{defaultValue:h,onBlur:d,onChange:function(e){return o(e)}})},k=0,D=function(){return function(e){var n=e.callback,t=e.callbackProps,r=e.limit,o=Date.now();(0===k||o-k>=r)&&(k=o,n(t))}},W=Date.now(),N={screenX:0,screenY:0},H=function(e,n,t){void 0===t&&(t=[]);for(var r=0;r<e.length;r++){var o=e[r];if(o.accessor===n)return i(i([],t,!0),[r],!1);if(o.children&&o.children.length>0){var a=H(o.children,n,i(i([],t,!0),[r],!1));if(a)return a}}return null};var L=function(e){var t,r,o=e.draggedHeaderRef,i=e.headersRef,a=e.hoveredHeaderRef,c=e.onColumnOrderChange,s=e.onTableHeaderDragEnd,d=(t=i.current,r=n.useRef(t),n.useEffect((function(){JSON.stringify(r.current)!==JSON.stringify(t)&&(r.current=t)}),[t]),r.current);return{handleDragStart:function(e){o.current=e,W=Date.now()},handleDragOver:function(e){var n,t,r=e.event,c=e.hoveredHeader;if(r.preventDefault(),i.current){var l=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=r.screenX,h=r.screenY,f=Math.sqrt(Math.pow(u-N.screenX,2)+Math.pow(h-N.screenY,2));a.current=c;var v=i.current,m=H(v,(null===(n=o.current)||void 0===n?void 0:n.accessor)||""),g=H(v,c.accessor);if(m&&g){var p=m.length,w=g.length,x=g;if(p!==w){var C=w-p;C>0&&(x=g.slice(0,-C))}var I=function(e,n,t){var r=JSON.parse(JSON.stringify(e)),o=!1;function i(e,n){for(var t=e,r=0;r<n.length-1;r++)t=t[n[r]].children;return t[n[n.length-1]]}function a(e,n,t){for(var r=e,i=0;i<n.length-1;i++){if(!r[n[i]].children){o=!0;break}r=r[n[i]].children}r[n[n.length-1]]=t}var c=i(r,n);return a(r,n,i(r,t)),a(r,t,c),{newHeaders:r,emergencyBreak:o}}(v,m,x),y=I.newHeaders,b=I.emergencyBreak;if(!(l||c.accessor===(null===(t=o.current)||void 0===t?void 0:t.accessor)||null===o.current||f<10||0===m.length||0===x.length||JSON.stringify(y)===JSON.stringify(i.current)||b)){var R=Date.now();JSON.stringify(y)===JSON.stringify(d)&&(R-W<1500||f<40)||(W=R,N={screenX:u,screenY:h},s(y))}}}},handleDragEnd:function(){o.current=null,a.current=null,null==c||c(i.current)}}},T=function(e){var n=e.content,t=e.header;return"boolean"==typeof n?n?"True":"False":"date"===t.type&&null!==n&&("string"==typeof n||"number"==typeof n||"object"==typeof n&&n instanceof Date)?new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):n},B=n.forwardRef((function(r,o){var i,a,c=r.borderClass,s=r.colIndex,l=r.header,u=r.isHighlighted,h=r.isInitialFocused,f=r.onExpandRowClick,v=r.rowIndex,m=r.visibleRow,g=d(),w=g.cellRegistry,C=g.cellUpdateFlash,I=g.collapseIcon,y=g.draggedHeaderRef,b=g.expandIcon,R=g.handleMouseDown,M=g.handleMouseOver,S=g.headersRef,E=g.hoveredHeaderRef,k=g.onCellEdit,W=g.onTableHeaderDragEnd,N=m.depth,H=m.row,B=n.useState(H.rowData[l.accessor]),O=B[0],P=B[1],F=n.useState(!1),A=F[0],U=F[1],z=n.useState(!1),Y=z[0],q=z[1],J=n.useRef(null),V=L({draggedHeaderRef:y,headersRef:S,hoveredHeaderRef:E,onTableHeaderDragEnd:W}).handleDragOver,K=D(),X="cell-".concat(v,"-").concat(s),G=x({rowId:H.rowMeta.rowId,accessor:l.accessor});n.useEffect((function(){if(w){var e="".concat(H.rowMeta.rowId,"-").concat(l.accessor);return w.set(e,{updateContent:function(e){O!==e?(P(e),C&&(q(!0),J.current&&clearTimeout(J.current),J.current=setTimeout((function(){q(!1)}),800))):P(e)}}),function(){w.delete(e),J.current&&clearTimeout(J.current)}}}),[w,C,H.rowMeta.rowId,l.accessor,O]),n.useEffect((function(){if(Y){var e=setTimeout((function(){q(!1)}),850);return function(){return clearTimeout(e)}}}),[Y]),n.useEffect((function(){P(H.rowData[l.accessor])}),[H.rowData,l.accessor]),n.useEffect((function(){u||U(!1)}),[u]);var _="boolean"===l.type||"date"===l.type||"enum"===l.type,$=Boolean(null===(a=null===(i=H.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),Q=Boolean(null==l?void 0:l.isEditable),Z="st-cell ".concat(N>0&&l.expandable?"st-cell-depth-".concat(N):""," ").concat(u?h?"st-cell-selected-first ".concat(c):"st-cell-selected ".concat(c):""," ").concat(Q?"clickable":""," ").concat(Y?"st-cell-updating":""),ee=n.useCallback((function(e){P(e),null==k||k({accessor:l.accessor,newValue:e,row:H})}),[l.accessor,k,H]);return A&&!_?e.jsx("div",t({className:"st-cell-editing",id:p({accessor:l.accessor,rowIndex:v+1})},{children:e.jsx(j,{enumOptions:l.enumOptions,onChange:ee,setIsEditing:U,type:l.type,value:O})})):e.jsxs("div",t({className:Z,id:X,onDoubleClick:function(){return l.isEditable&&U(!0)},onMouseDown:function(){return R({rowIndex:v,colIndex:s,rowId:H.rowMeta.rowId})},onMouseOver:function(){return M({rowIndex:v,colIndex:s,rowId:H.rowMeta.rowId})},onDragOver:function(e){return K({callback:V,callbackProps:{event:e,hoveredHeader:l},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!l.isEditable||A||(e.preventDefault(),U(!0))},ref:o,"data-row-index":v,"data-col-index":s,"data-row-id":H.rowMeta.rowId,"data-accessor":l.accessor},{children:[l.expandable&&$?H.rowMeta.isExpanded?e.jsx("div",t({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:I})):e.jsx("div",t({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)},onMouseDown:function(e){e.stopPropagation()}},{children:b})):null,e.jsx("span",t({className:"st-cell-content ".concat("right"===l.align?"right-aligned":"center"===l.align?"center-aligned":"")},{children:l.cellRenderer?l.cellRenderer({accessor:l.accessor,colIndex:s,row:H}):T({content:O,header:l})})),A&&_&&e.jsx(j,{enumOptions:l.enumOptions,onChange:ee,setIsEditing:U,type:l.type,value:O})]}),G)})),O=function(n){var r=n.children,o=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(n,["children"]);return d().allowAnimations?e.jsx(P,t({},o,{children:r})):e.jsx(e.Fragment,{children:r})},P=function(t){var r=t.children,o=t.isBody,i=t.pauseAnimation,a=t.rowIndex,c=n.useRef(!1),s=d(),l=s.draggedHeaderRef,u=s.headersRef,h=s.mainBodyRef,f=s.shouldPaginate,v=n.useState({}),m=v[0],g=v[1],w=n.useRef({}),x=u.current;return n.useLayoutEffect((function(){if(x){var e=function(e){var n=e.currentHeaders,t=e.draggedHeaderRef,r=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(p({accessor:e.accessor,rowIndex:r}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),c=i.getBoundingClientRect();a&&(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=c}}})),o}({currentHeaders:x,draggedHeaderRef:l,rowIndex:a});JSON.stringify(e)!==JSON.stringify(m)&&(w.current=m,g(e))}}),[m,x,l,o,a]),n.useLayoutEffect((function(){var e=h.current,n=function(){c.current=!0},t=function(){c.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",t),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",t)}}),[l,h]),n.useEffect((function(){i||c.current||Object.keys(w.current).length&&x&&x.forEach((function(e){var n=document.getElementById(p({accessor:e.accessor,rowIndex:a}));if(n){var t=w.current[e.accessor],r=m[e.accessor];if(t&&r){var o=t.left-r.left,i=f?0:t.top-r.top,c=Math.abs(o),s=Math.abs(i);(c>10||s>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[m,x,o,i,w,a,f]),e.jsx(e.Fragment,{children:r})},F=function(n){var r=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.isWidthDragging,c=n.onExpandRowClick,s=n.pinned,d=n.rowIndex,l=n.rowIndices,u=n.visibleRow,h=o.filter((function(e){return w({hiddenColumns:i,header:e,pinned:s})}));return e.jsx(O,t({isBody:!0,pauseAnimation:a,rowIndex:d+1},{children:h.map((function(n){return e.jsx(A,{columnIndices:r,header:n,headers:o,hiddenColumns:i,onExpandRowClick:c,pinned:s,rowIndex:d,rowIndices:l,visibleRow:u},p({accessor:n.accessor,rowIndex:d+1}))}))}))},A=function(t){var r=t.columnIndices,o=t.header,i=t.headers,a=t.hiddenColumns,c=t.onExpandRowClick,s=t.pinned,l=t.rowIndex,u=t.rowIndices,h=t.visibleRow,f=r[o.accessor],v=d(),m=v.getBorderClass,g=v.isSelected,x=v.isInitialFocusedCell;if(o.children){var C=o.children.filter((function(e){return w({hiddenColumns:a,header:e,pinned:s})}));return e.jsx(n.Fragment,{children:C.map((function(n){return e.jsx(A,{columnIndices:r,header:n,headers:i,hiddenColumns:a,onExpandRowClick:c,pinned:s,rowIndex:l,rowIndices:u,visibleRow:h},p({accessor:n.accessor,rowIndex:l+1}))}))})}var I={rowIndex:l,colIndex:f,rowId:h.row.rowMeta.rowId},y=m(I),b=g(I),R=x(I);return e.jsx(B,{borderClass:y,colIndex:f,header:o,isHighlighted:b,isInitialFocused:R,onExpandRowClick:c,rowIndex:l,visibleRow:h},p({accessor:o.accessor,rowIndex:l+1}))},U=function(n){var r=n.columnIndices,o=n.gridTemplateColumns,i=n.headers,a=n.hiddenColumns,c=n.index,s=n.isWidthDragging,d=n.onExpandRowClick,l=n.pinned,u=n.rowHeight,h=n.rowIndices,f=n.visibleRow,v=f.position,m=v%2==0;return e.jsx("div",t({className:"st-row ".concat(m?"even":"odd"),style:{gridTemplateColumns:o,top:g({position:v,rowHeight:u}),height:"".concat(u,"px")}},{children:e.jsx(F,{columnIndices:r,headers:i,hiddenColumns:a,isWidthDragging:s,onExpandRowClick:d,pinned:l,rowIndex:c,rowIndices:h,visibleRow:f},c)}))},z=function(n){var r=n.displayStrongBorder,o=n.position,i=n.rowHeight,a=n.templateColumns;return e.jsx("div",t({className:"st-row-separator ".concat(r?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:a,position:"absolute",top:m({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},Y=function(r){var o=r.columnIndices,i=r.headers,a=r.hiddenColumns,c=r.isWidthDragging,s=r.onExpandRowClick,d=r.pinned,l=r.ref,u=r.rowHeight,h=r.rowIndices,f=r.templateColumns,v=r.totalHeight,m=r.visibleRows,g=r.width,p=d?"st-body-pinned-".concat(d):"st-body-main";return e.jsx("div",t({className:p,ref:l,style:t({position:"relative",height:"".concat(v,"px"),width:g},!d&&{flexGrow:1})},{children:m.map((function(t,r){var l,v,g=m[r-1],p=Boolean((null==g?void 0:g.depth)!==(null==t?void 0:t.depth)&&(null===(v=null===(l=null==t?void 0:t.row.rowMeta)||void 0===l?void 0:l.children)||void 0===v?void 0:v.length)&&0===t.depth);return e.jsxs(n.Fragment,{children:[0!==r&&e.jsx(z,{displayStrongBorder:p,position:t.position,rowHeight:u,templateColumns:f}),e.jsx(U,{columnIndices:o,gridTemplateColumns:f,headers:i,hiddenColumns:a,index:r,isWidthDragging:c,onExpandRowClick:s,pinned:d,rowHeight:u,rowIndices:h,visibleRow:t})]},t.position)}))}))};function q(e){var n=e.headersRef,t=e.hiddenColumns,r=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,c=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return w({hiddenColumns:t,header:e})})).forEach((function(e,n){c(e,0===n)}))};return r.forEach((function(e,n){c(e,0===n)})),n.current.filter((function(e){return!e.pinned&&w({hiddenColumns:t,header:e})})).forEach((function(e,n){var t=0===n&&0===r.length;c(e,t)})),o.forEach((function(e){c(e,!1)})),i}var J=function(r){var o=r.flattenedRows,i=r.headerContainerRef,a=r.isWidthDragging,c=r.mainTemplateColumns,s=r.pinnedLeftColumns,l=r.pinnedLeftTemplateColumns,u=r.pinnedLeftWidth,h=r.pinnedRightColumns,f=r.pinnedRightTemplateColumns,v=r.pinnedRightWidth,m=r.setFlattenedRows,g=r.setScrollTop,p=r.visibleRows,w=d(),x=w.headersRef,C=w.hiddenColumns,I=w.mainBodyRef,y=w.rowHeight,b=w.scrollbarWidth,R=w.tableBodyContainerRef;!function(e){var t=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],c=i[1];n.useEffect((function(){var e=null==t?void 0:t.current;if(a&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[t,a,o]),n.useEffect((function(){var e=null==t?void 0:t.current,n=null==r?void 0:r.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;c(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[t,r])}({headerContainerRef:i,mainSectionRef:R,scrollbarWidth:b});var M,S,E=n.useRef(null),j=(M=0,(S=function(e){e.forEach((function(e){M+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&S(e.rowMeta.children)}))})(o),M)*(y+1)-1,k=n.useMemo((function(){return q({headersRef:x,hiddenColumns:C,pinnedLeftColumns:s,pinnedRightColumns:h})}),[x,C,s,h]),D=n.useMemo((function(){var e={};return p.forEach((function(n,t){var r=String(n.row.rowMeta.rowId);e[r]=t})),e}),[p]),W=function(e){var n=function(r){return r.rowMeta.rowId===e&&r.rowMeta.children?t(t({},r),{rowMeta:t(t({},r.rowMeta),{isExpanded:!r.rowMeta.isExpanded})}):r.rowMeta.children?t(t({},r),{rowMeta:t(t({},r.rowMeta),{children:r.rowMeta.children.map(n)})}):r};m((function(e){return e.map(n)}))},N={headerContainerRef:i,headers:x.current,hiddenColumns:C,isWidthDragging:a,rowHeight:y,visibleRows:p,columnIndices:k,rowIndices:D};return e.jsxs("div",t({className:"st-body-container",ref:R,onScroll:function(e){var n=e.currentTarget.scrollTop;E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame((function(){g(n)}))}},{children:[s.length>0&&e.jsx(Y,t({},N,{onExpandRowClick:W,pinned:"left",templateColumns:l,totalHeight:j,width:u})),e.jsx(Y,t({},N,{ref:I,onExpandRowClick:W,templateColumns:c,totalHeight:j})),h.length>0&&e.jsx(Y,t({},N,{onExpandRowClick:W,pinned:"right",templateColumns:f,totalHeight:j,width:v}))]}))},V=function(e,t){n.useEffect((function(){if(e.current){var n=e.current,r=function(){var e,r=null==n?void 0:n.scrollLeft;void 0!==r&&(null===(e=t.current)||void 0===e||e.scrollTo(r,0))};return n.addEventListener("scroll",r),function(){null==n||n.removeEventListener("scroll",r)}}}),[e,t])},K=function(e){return void 0===e&&(e=0),e?e+1:0},X=function(e){return e.hide?[]:e.children&&0!==e.children.length?e.children.flatMap((function(e){return X(e)})):[e]},G=function(e){if(e.hide)return 0;if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("px"))return parseFloat(e.width);var n=document.getElementById(p({accessor:e.accessor,rowIndex:0}));return(null==n?void 0:n.offsetWidth)||150},_=function(e){var n,t=e.width;"string"==typeof t&&t.includes("fr")&&(e.width=(null===(n=document.getElementById(p({accessor:e.accessor,rowIndex:0})))||void 0===n?void 0:n.offsetWidth)||150),e.children&&e.children.forEach((function(e){_(e)}))},$=function(e){return"number"==typeof e.minWidth?e.minWidth:40},Q=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=e.setMainBodyWidth,i=e.setPinnedLeftWidth,a=e.setPinnedRightWidth,c=function(e){var n=e.header,t=e.headers,r=e.newWidth,o=n.pinned,i=0;return t.forEach((function(e){e.hide||e.pinned!==o||(e.accessor===n.accessor?i+=r:X(e).forEach((function(e){e.hide||(e.accessor===n.accessor?i+=r:i+=G(e))})))})),n.pinned?K(i):i}({header:n,headers:t,newWidth:r});"left"===n.pinned?i(c):"right"===n.pinned?a(c):n.pinned||o(c)},Z=function(e){var n=e.event,t=e.forceUpdate,r=e.gridColumnEnd,o=e.gridColumnStart,i=e.header,a=e.headersRef,c=e.setIsWidthDragging,s=e.setMainBodyWidth,d=e.setPinnedLeftWidth,l=e.setPinnedRightWidth,u=e.startWidth;c(!0),n.preventDefault();var h=n.clientX;if(i&&!i.hide){var f=$(i),v=r-o>1,m=v?X(i):[i],g=function(e){var n="right"===i.pinned?h-e.clientX:e.clientX-h;if(v&&m.length>1)ee({delta:n,header:i,headersRef:a,leafHeaders:m,minWidth:f,setMainBodyWidth:s,setPinnedLeftWidth:d,setPinnedRightWidth:l,startWidth:u});else{var r=Math.max(u+n,f);i.width=r,Q({header:i,headers:a.current,newWidth:r,setMainBodyWidth:s,setPinnedLeftWidth:d,setPinnedRightWidth:l})}a.current.forEach((function(e){_(e)})),t()},p=function(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p),c(!1)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",p)}},ee=function(e){var n=e.delta,t=e.header,r=e.headersRef,o=e.leafHeaders,i=e.minWidth,a=e.setMainBodyWidth,c=e.setPinnedLeftWidth,s=e.setPinnedRightWidth,d=e.startWidth,l=o.reduce((function(e,n){return Math.min(e,$(n))}),40),u=o.reduce((function(e,n){return e+("number"==typeof n.width?n.width:150)}),0),h=Math.max(d+n,l);Q({header:t,headers:r.current,newWidth:h,setMainBodyWidth:a,setPinnedLeftWidth:c,setPinnedRightWidth:s});var f=h-u;o.forEach((function(e){var n="number"==typeof e.width?e.width:150,t=f*(n/u),r=Math.max(n+t,i);e.width=r}))},ne=n.forwardRef((function(r,o){var a,c,s=r.colIndex,l=r.forceHeadersUpdate,u=r.gridColumnEnd,h=r.gridColumnStart,f=r.gridRowEnd,v=r.gridRowStart,m=r.header,g=r.reverse,w=r.sort,x=d(),C=x.columnReordering,I=x.columnResizing,y=x.draggedHeaderRef,b=x.forceUpdate,R=x.headersRef,M=x.hoveredHeaderRef,S=x.onColumnOrderChange,E=x.onSort,j=x.onTableHeaderDragEnd,k=x.rowHeight,W=x.selectColumns,N=x.selectableColumns,H=x.setInitialFocusedCell,T=x.setIsWidthDragging,B=x.setMainBodyWidth,O=x.setPinnedLeftWidth,P=x.setPinnedRightWidth,F=x.setSelectedCells,A=x.setSelectedColumns,U=x.sortDownIcon,z=x.sortUpIcon,Y=Boolean(null==m?void 0:m.isSortable),q="st-header-cell ".concat(m.accessor===(null===(a=M.current)||void 0===a?void 0:a.accessor)?"st-hovered":""," ").concat((null===(c=y.current)||void 0===c?void 0:c.accessor)===m.accessor?"st-dragging":""," ").concat(Y?"clickable":""," ").concat(C&&!Y?"columnReordering":""," ").concat("right"===(null==m?void 0:m.align)?"right-aligned":"center"===(null==m?void 0:m.align)?"center-aligned":""," ").concat(m.children?"parent":""),J=L({draggedHeaderRef:y,headersRef:R,hoveredHeaderRef:M,onColumnOrderChange:S,onTableHeaderDragEnd:j}),V=J.handleDragStart,K=J.handleDragEnd,X=J.handleDragOver,G=D(),_=function(e){var n=e.event,t=e.header;if(N){var r=function(e,n){if(!e.children||0===e.children.length)return[n];var t=[],r=function(e,n){if(!e.children||0===e.children.length)return t.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var c=a[i];o=r(c,o)}return o};return r(e,n),t}(t,s);return n.shiftKey&&W?A((function(e){if(0===e.size)return new Set(r);var n=r[0],t=Array.from(e).sort((function(e,n){return e-n})),o=t[0],a=Math.abs(n-o);t.forEach((function(e){var t=Math.abs(n-e);t<a&&(a=t,o=e)}));var c,s,d,l,u=i(i([],(c=o,s=n,d=Math.min(c,s),l=Math.max(c,s),Array.from({length:l-d+1},(function(e,n){return d+n}))),!0),r,!0);return new Set(i(i([],Array.from(e),!0),u,!0))})):W&&W(r),F(new Set),void H(null)}t.isSortable&&E(s,t.accessor)};if(n.useEffect((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!m)return null;var $=I&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;G({callback:Z,callbackProps:{event:e.nativeEvent,forceUpdate:b,gridColumnEnd:u,gridColumnStart:h,header:m,headersRef:R,setIsWidthDragging:T,setMainBodyWidth:B,setPinnedLeftWidth:O,setPinnedRightWidth:P,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),Q=w&&w.key.accessor===m.accessor&&e.jsxs("div",t({className:"st-sort-icon-container",onClick:function(e){return _({event:e,header:m})}},{children:["ascending"===w.direction&&z&&z,"descending"===w.direction&&U&&U]}));return e.jsxs("div",t({className:q,id:p({accessor:m.accessor,rowIndex:0}),onDragOver:function(e){G({callback:X,callbackProps:{event:e,hoveredHeader:m},limit:50})},ref:o,style:t(t({gridRowStart:v,gridRowEnd:f,gridColumnStart:h,gridColumnEnd:u},u-h>1?{}:{width:m.width}),f-v>1?{}:{height:k})},{children:[g&&$,"right"===m.align&&Q,e.jsx("div",t({className:"st-header-label ".concat("right"===m.align?"right-aligned":"center"===m.align?"center-aligned":""),draggable:C&&!m.disableReorder,onClick:function(e){return _({event:e,header:m})},onDragEnd:function(e){e.preventDefault(),K(),l()},onDragStart:function(e){C&&m&&function(e){V(e)}(m)}},{children:null==m?void 0:m.label})),"right"!==m.align&&Q,!g&&$]}))})),te=function(r){var o=r.columnIndices,i=r.gridTemplateColumns,a=r.handleScroll,c=r.headersRef,s=r.hiddenColumns,d=r.maxDepth,l=r.pinned,u=r.sectionRef,h=r.sort,f=n.useReducer((function(e){return e+1}),0)[1],v=n.useMemo((function(){var e=[],n=1,t=function(r,i,a){var c,u;if(void 0===a&&(a=!1),!w({hiddenColumns:s,header:r,pinned:l}))return 0;a||n++;var h=null!==(u=null===(c=r.children)||void 0===c?void 0:c.filter((function(e){return w({hiddenColumns:s,header:e,pinned:l})})).length)&&void 0!==u?u:0,f=n,v=h>0?f+h:f+1,m=i,g=h>0?i+1:d+1;if(e.push({header:r,gridColumnStart:f,gridColumnEnd:v,gridRowStart:m,gridRowEnd:g,colIndex:o[r.accessor]}),r.children){var p=!0;r.children.forEach((function(e){w({hiddenColumns:s,header:e,pinned:l})&&(t(e,i+1,p),p=!1)}))}return v-f},r=c.current.filter((function(e){return w({hiddenColumns:s,header:e,pinned:l})})),i=!0;return r.forEach((function(e){t(e,1,i),i=!1})),e}),[c,s,d,l,o]);return e.jsx("div",t({className:"st-header-".concat(l?"pinned-".concat(l):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i,display:"grid",position:"relative"}},{children:e.jsx(O,t({rowIndex:0},{children:v.map((function(t){return e.jsx(ne,{colIndex:t.colIndex,forceHeadersUpdate:f,gridColumnEnd:t.gridColumnEnd,gridColumnStart:t.gridColumnStart,gridRowEnd:t.gridRowEnd,gridRowStart:t.gridRowStart,header:t.header,ref:n.createRef(),reverse:"right"===l,sort:h},t.header.accessor)}))}))}))},re=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(re)):1},oe=function(r){var o=r.centerHeaderRef,i=r.headerContainerRef,a=r.headersRef,c=r.hiddenColumns,s=r.mainTemplateColumns,l=r.pinnedLeftColumns,u=r.pinnedLeftTemplateColumns,h=r.pinnedRightColumns,f=r.pinnedRightTemplateColumns,v=r.sort,m=d(),g=m.mainBodyRef,p=m.pinnedLeftRef,x=m.pinnedRightRef,C=m.setPinnedLeftWidth,I=m.setPinnedRightWidth;V(g,o);var y=n.useMemo((function(){return q({headersRef:a,hiddenColumns:c,pinnedLeftColumns:l,pinnedRightColumns:h})}),[a,c,l,h]),b=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(w({hiddenColumns:c,header:e})){var t=re(e);n=Math.max(n,t)}})),{maxDepth:n}}),[a,c]).maxDepth;return n.useLayoutEffect((function(){var e,n;C(K(null===(e=p.current)||void 0===e?void 0:e.clientWidth)),I(K(null===(n=x.current)||void 0===n?void 0:n.clientWidth))}),[p,x,C,I]),e.jsxs("div",t({className:"st-header-container",ref:i},{children:[l.length>0&&e.jsx(te,{columnIndices:y,gridTemplateColumns:u,handleScroll:void 0,headersRef:a,hiddenColumns:c,maxDepth:b,pinned:"left",sectionRef:p,sort:v}),e.jsx(te,{columnIndices:y,gridTemplateColumns:s,handleScroll:function(e){var n,t,r=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==r&&(null===(t=g.current)||void 0===t||t.scrollTo(r,0))},headersRef:a,hiddenColumns:c,maxDepth:b,sectionRef:o,sort:v}),h.length>0&&e.jsx(te,{columnIndices:y,gridTemplateColumns:f,handleScroll:void 0,headersRef:a,hiddenColumns:c,maxDepth:b,pinned:"right",sectionRef:x,sort:v})]}))},ie=function(e){var n=e.headers,t=e.hiddenColumns,r=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==t[e.accessor]&&(e.children?r({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=r({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,t=e.width;return"number"==typeof t&&(t="".concat(t,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"string"==typeof t&&t.endsWith("fr")?"minmax(".concat(n,", ").concat(t,")"):"max(".concat(n,", ").concat(t,")"):t}(e)})).join(" "))},ae=function(r){var o=r.flattenedRows,i=r.isWidthDragging,a=r.pinnedLeftWidth,c=r.pinnedRightWidth,s=r.setFlattenedRows,l=r.setScrollTop,u=r.sort,h=r.visibleRows,f=d(),v=f.editColumns,m=f.headersRef,g=f.hiddenColumns,p=n.useRef(null),w=n.useRef(null),x=m.current.filter((function(e){return!e.pinned})),C=m.current.filter((function(e){return"left"===e.pinned})),I=m.current.filter((function(e){return"right"===e.pinned})),y=n.useMemo((function(){return ie({headers:C,hiddenColumns:g})}),[C,g]),b=n.useMemo((function(){return ie({headers:x,hiddenColumns:g})}),[x,g]),R=n.useMemo((function(){return ie({headers:I,hiddenColumns:g})}),[I,g]),M={centerHeaderRef:w,headerContainerRef:p,headersRef:m,hiddenColumns:g,mainTemplateColumns:b,pinnedLeftColumns:C,pinnedLeftTemplateColumns:y,pinnedRightColumns:I,pinnedRightTemplateColumns:R,sort:u},S={flattenedRows:o,headerContainerRef:p,isWidthDragging:i,mainTemplateColumns:b,pinnedLeftColumns:C,pinnedLeftTemplateColumns:y,pinnedLeftWidth:a,pinnedRightColumns:I,pinnedRightTemplateColumns:R,pinnedRightWidth:c,setFlattenedRows:s,setScrollTop:l,visibleRows:h};return e.jsxs("div",t({className:"st-content",style:{width:v?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(oe,t({},M)),e.jsx(J,t({},S))]}))},ce=function(r){var o,i,a=r.mainBodyWidth,c=r.mainBodyRef,s=r.pinnedLeftWidth,l=r.pinnedRightWidth,u=r.setMainBodyWidth,h=r.tableBodyContainerRef,f=d().editColumns,v=n.useState(!1),m=v[0],g=v[1],p=n.useRef(null),w=h.current&&h.current.scrollHeight>h.current.clientHeight,x=f?28:0,C=(f?l+1:l)+(h.current&&w?h.current.offsetWidth-h.current.clientWidth:0);return V(c,p),n.useEffect((function(){setTimeout((function(){!function(){if(c.current){var e=c.current.scrollWidth;u(e)}}()}),1)}),[c,u]),n.useEffect((function(){setTimeout((function(){!function(){if(c.current){var e=c.current.clientWidth;g(a>e)}}()}),1)}),[c,a,u]),m?e.jsxs("div",t({className:"st-horizontal-scrollbar-container"},{children:[s>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s,height:null===(o=p.current)||void 0===o?void 0:o.offsetHeight}}),a>0&&e.jsx("div",t({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&c.current&&c.current.scrollTo({left:n,behavior:"auto"})},ref:p,style:{flexGrow:1}},{children:e.jsx("div",{style:{width:a,height:".3px"}})})),l>0&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:C,height:null===(i=p.current)||void 0===i?void 0:i.offsetHeight}})}),x>0&&e.jsx("div",{style:{width:x-1.5,height:"100%",flexShrink:0}})]})):null},se={string:function(e,n,t){if(e===n)return 0;var r=e.localeCompare(n);return"ascending"===t?r:-r},number:function(e,n,t){if(e===n)return 0;var r=e-n;return"ascending"===t?r:-r},boolean:function(e,n,t){if(e===n)return 0;var r=e===n?0:e?-1:1;return"ascending"===t?r:-r},date:function(e,n,t){var r=new Date(e),o=new Date(n);if(r.getTime()===o.getTime())return 0;var i=r.getTime()-o.getTime();return"ascending"===t?i:-i},enum:function(e,n,t){return se.string(e,n,t)},default:function(e,n,t){return e===n?0:null==e?"ascending"===t?-1:1:null==n?"ascending"===t?1:-1:"string"==typeof e&&"string"==typeof n?se.string(e,n,t):"number"==typeof e&&"number"==typeof n?se.number(e,n,t):"boolean"==typeof e&&"boolean"==typeof n?se.boolean(e,n,t):se.string(String(e),String(n),t)}},de=function(e,n,t,r){if(void 0===t&&(t="string"),null==e||""===e)return"ascending"===r?-1:1;if(null==n||""===n)return"ascending"===r?1:-1;if("number"===t){var o=function(e){var n;if("number"==typeof e)return e;var t=String(e);if("string"==typeof t){var r=t.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(r){var o=parseFloat(r[1]),i=null===(n=r[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(t)||0},i=o(e),a=o(n);return se.number(i,a,r)}return"date"===t?se.date(String(e),String(n),r):"boolean"===t?se.boolean(Boolean(e),Boolean(n),r):"enum"===t?se.enum(String(e),String(n),r):se.string(String(e),String(n),r)},le=function(e,n,r){var o,a=(null===(o=n.key)||void 0===o?void 0:o.type)||"string",c=n.direction,s=new Map,d=new Map,l="";e.forEach((function(e){var t;if(e.rowData&&!0===e.rowMeta.isExpanded&&!0===n.key.expandable){var r=(e.rowData.sector||"group_".concat(s.size)).toString();l=r,d.set(l,e),s.has(l)||s.set(l,[])}else if(l){var o=s.get(l)||[];o.push(e),s.set(l,o)}else{var i="default";s.has(i)||s.set(i,[]),null===(t=s.get(i))||void 0===t||t.push(e)}}));var u=[];return s.forEach((function(e,o){if(d.has(o)){var s=d.get(o);s.rowMeta.children&&s.rowMeta.children.length>0&&(s.rowMeta.children=ue(s.rowMeta.children,n,r)),u.push(s)}var l=i([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,o=e.rowData[r],i=t.rowData[r];return de(o,i,a,c)}));u.push.apply(u,l.map((function(e){var o=t({},e);if(o.rowMeta.children&&o.rowMeta.children.length>0){var i=ue(o.rowMeta.children,n,r);o.rowMeta=t(t({},o.rowMeta),{children:i})}return o})))})),u},ue=function(e,n,r){var o=r.find((function(e){return e.accessor===n.key.accessor})),a=(null==o?void 0:o.type)||"string",c=n.direction;return i([],e,!0).sort((function(e,t){if(!(null==e?void 0:e.rowData)||!(null==t?void 0:t.rowData))return 0;var r=n.key.accessor,o=e.rowData[r],i=t.rowData[r];return de(o,i,a,c)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?t(t({},e),{rowMeta:t(t({},e.rowMeta),{children:ue(e.rowMeta.children,n,r)})}):e}))},he=function(e){var t=e.headers,r=e.tableRows,o=n.useState(null),i=o[0],a=o[1],c=n.useMemo((function(){var e={};return t.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[t]),s=n.useState(c),d=s[0],l=s[1],u=n.useMemo((function(){if(!i)return r;var e=function(e,n,t){return{sortedData:le(n,t,e),newSortConfig:t}}(t,r,i).sortedData;return e}),[r,i,t]);return{hiddenColumns:d,setHiddenColumns:l,setSort:a,sort:i,sortedRows:u,updateSort:function(e,n){var r=function(e){for(var t=0,o=e;t<o.length;t++){var i=o[t];if(i.accessor===n)return i;if(i.children&&i.children.length>0){var a=r(i.children);if(a)return a}}},o=r(t);o&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:o,direction:"descending"}:null:{key:o,direction:"ascending"}}))}}},fe=function(n){var r=n.checked,o=void 0!==r&&r,i=n.children,a=n.onChange;return e.jsxs("label",t({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:o,className:"st-checkbox-input",onChange:function(){a&&a(!o)},type:"checkbox"}),e.jsx("span",t({className:"st-checkbox-custom ".concat(o?"st-checked":"")},{children:o&&e.jsx("span",{className:"st-checkbox-checkmark"})})),i]}))},ve=function(e,n,t,r){void 0===r&&(r=new Set);for(var o=0,i=e;o<i.length;o++){var a=i[o];if(!r.has(a.accessor)&&(r.add(a.accessor),a.children&&a.children.length>0)){var c=a.children.some((function(e){return e.accessor===n})),s=!1;if(!c)for(var d=0,l=a.children;d<l.length;d++){var u=l[d];if(ve([u],n,t,r),!1===t[u.accessor]){s=!0;break}}(c||s)&&(t[a.accessor]=!1)}}},me=function(e,n){return e.every((function(e){return!0===n[e.accessor]}))},ge=function(e,n){e.forEach((function(e){e.children&&e.children.length>0&&(ge(e.children,n),me(e.children,n)&&(n[e.accessor]=!0))}))},pe=function(r){var o=r.allHeaders,i=r.depth,a=void 0===i?0:i,c=r.header,s=r.hiddenColumns,l=r.setHiddenColumns,u=n.useState(!0),h=u[0],f=u[1],v=d(),m=v.expandIcon,g=v.collapseIcon,p=v.headersRef,w=v.setMainBodyWidth,x=v.setPinnedLeftWidth,C=v.setPinnedRightWidth,I="".concat(16*a,"px"),y=c.children&&c.children.length>0,b=s[c.accessor]||y&&c.children&&me(c.children,s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",t({className:"st-header-checkbox-item",style:{paddingLeft:I}},{children:[e.jsx("div",t({className:"st-header-icon-container"},{children:y?e.jsx("div",t({className:"st-collapsible-header-icon",onClick:function(e){e.stopPropagation(),f(!h)}},{children:h?g:m})):null})),e.jsx(fe,t({checked:b,onChange:function(e){var n=t({},s);(n[c.accessor]=e,e)?ge(o,n):(ve(o,c.accessor,n),y&&c.children&&c.children.length>0&&c.children.every((function(e){return!0===s[e.accessor]}))&&c.children[0]&&(n[c.children[0].accessor]=!1,ve(o,c.children[0].accessor,n)));l(n),p.current.forEach((function(e){e.hide=!0===n[e.accessor]})),function(e){var n=e.headers,t=e.setMainBodyWidth,r=e.setPinnedLeftWidth,o=e.setPinnedRightWidth,i=0,a=0,c=0;n.forEach((function(e){if(!e.hide){var n=X(e).reduce((function(e,n){return e+G(n)}),0);"left"===e.pinned?i+=n:"right"===e.pinned?a+=n:c+=n}}));var s=K(i),d=K(a);r(s),o(d),t(c)}({headers:p.current,setMainBodyWidth:w,setPinnedLeftWidth:x,setPinnedRightWidth:C})}},{children:c.label}))]})),y&&h&&c.children&&e.jsx("div",t({className:"st-nested-headers"},{children:c.children.map((function(n,t){return e.jsx(pe,{allHeaders:o,depth:a+1,header:n,hiddenColumns:s,setHiddenColumns:l},"".concat(n.accessor,"-").concat(t))}))}))]})},we=function(n){var r=n.headers,o=n.open,i=n.position,a=n.setHiddenColumns,c=n.hiddenColumns,s="left"===i?"left":"";return e.jsx("div",t({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(s),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",t({className:"st-column-editor-popout-content"},{children:r.map((function(n,t){return e.jsx(pe,{header:n,hiddenColumns:c,setHiddenColumns:a,allHeaders:r},"".concat(n.accessor,"-").concat(t))}))}))}))},xe=function(r){var o=r.columnEditorText,i=r.editColumns,a=r.editColumnsInitOpen,c=r.headers,s=r.hiddenColumns,d=r.position,l=void 0===d?"right":d,u=r.setHiddenColumns,h=n.useState(a),f=h[0],v=h[1];return i?e.jsxs("div",t({className:"st-column-editor ".concat(f?"open":""," ").concat(l),onClick:function(){return function(e){v(e)}(!f)},style:{width:28}},{children:[e.jsx("div",t({className:"st-column-editor-text"},{children:o})),e.jsx(we,{headers:c,open:f,position:l,setHiddenColumns:u,hiddenColumns:s})]})):null},Ce=function(r){var o=r.allowAnimations,i=void 0!==o&&o,c=r.cellUpdateFlash,d=void 0!==c&&c,m=r.collapseIcon,g=void 0===m?e.jsx(v,{className:"st-sort-icon"}):m,p=r.columnEditorPosition,w=void 0===p?"right":p,C=r.columnEditorText,I=void 0===C?"Columns":C,y=r.columnReordering,b=void 0!==y&&y,R=r.columnResizing,M=void 0!==R&&R,S=r.defaultHeaders,E=r.editColumns,j=void 0!==E&&E,k=r.editColumnsInitOpen,D=void 0!==k&&k,W=r.expandIcon,N=void 0===W?e.jsx(h,{className:"st-sort-icon"}):W,H=r.height,L=r.hideFooter,T=void 0!==L&&L,B=r.nextIcon,O=void 0===B?e.jsx(h,{className:"st-next-prev-icon"}):B,P=r.onCellEdit,F=r.onColumnOrderChange,A=r.onGridReady,U=r.onNextPage,z=r.prevIcon,Y=void 0===z?e.jsx(u,{className:"st-next-prev-icon"}):z,q=r.rowHeight,J=void 0===q?40:q,V=r.rows,K=r.rowsPerPage,X=void 0===K?10:K,G=r.selectableCells,_=void 0!==G&&G,$=r.selectableColumns,Q=void 0!==$&&$,Z=r.shouldPaginate,ee=void 0!==Z&&Z,ne=r.sortDownIcon,te=void 0===ne?e.jsx(v,{className:"st-sort-icon"}):ne,re=r.sortUpIcon,oe=void 0===re?e.jsx(f,{className:"st-sort-icon"}):re,ie=r.tableRef,se=r.theme,de=void 0===se?"light":se,le=n.useRef(null),ue=n.useRef(S),fe=n.useRef(null),ve=n.useRef(null),me=n.useRef(null),ge=n.useRef(null),pe=n.useRef(null),we=n.useState(1),Ce=we[0],Ie=we[1],ye=n.useState(!1),be=ye[0],Re=ye[1],Me=n.useState(0),Se=Me[0],Ee=Me[1],je=n.useState(0),ke=je[0],De=je[1],We=n.useState(0),Ne=We[0],He=We[1],Le=n.useState(0),Te=Le[0],Be=Le[1],Oe=n.useState(0),Pe=Oe[0],Fe=Oe[1],Ae=he({headers:ue.current,tableRows:V}),Ue=Ae.sort,ze=Ae.sortedRows,Ye=Ae.hiddenColumns,qe=Ae.setHiddenColumns,Je=Ae.updateSort;n.useEffect((function(){null==A||A()}),[A]);var Ve=n.useMemo((function(){if(!ee)return ze;var e=(Ce-1)*X,n=e+X;return ze.slice(e,n)}),[Ce,X,ee,ze]),Ke=n.useState(Ve),Xe=Ke[0],Ge=Ke[1];n.useEffect((function(){Ge(Ve)}),[Ve]);var _e=n.useMemo((function(){var e;if(!H)return window.innerHeight-J;var n=document.querySelector(".simple-table-root"),t=0;if(H.endsWith("px"))t=parseInt(H,10);else if(H.endsWith("vh")){var r=parseInt(H,10);t=window.innerHeight*r/100}else if(H.endsWith("%")){var o=parseInt(H,10);t=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else t=window.innerHeight;return Math.max(0,t-J)}),[H,J]),$e=n.useMemo((function(){return function(e){var n=e.bufferRowCount,t=e.contentHeight,r=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=o+1,c=[],s=0,d=Math.max(0,i-a*n),l=i+t+a*n,u=function(e,n){for(var t,r=0,o=e;r<o.length;r++){var i=o[r],h=s*a;if(h>=l)break;h+a>d&&c.push({row:i,depth:n,position:s,isLastGroupRow:Boolean(null===(t=i.rowMeta.children)||void 0===t?void 0:t.length)&&n>1}),s+=1,i.rowMeta.isExpanded&&i.rowMeta.children&&u(i.rowMeta.children,n+1)}};return u(r,0),c}({bufferRowCount:5,contentHeight:_e,flattenedRows:Xe,rowHeight:J,scrollTop:Te})}),[_e,J,Xe,Te]),Qe=n.useReducer((function(e){return e+1}),0)[1],Ze=function(e){var t=e.selectableCells,r=e.headers,o=e.visibleRows,i=n.useState(new Set),c=i[0],s=i[1],d=n.useState(new Set),l=d[0],u=d[1],h=n.useState(null),f=h[0],v=h[1],m=n.useState(null),g=m[0],p=m[1],w=n.useRef(!1),x=n.useRef(null),C=n.useCallback((function(){var e=Array.from(c).reduce((function(e,n){var t=n.split("-").map(Number),i=t[0],a=t[1];return e[i]||(e[i]=[]),e[i][a]=o[i].row.rowData[r[a].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");c.size>0&&navigator.clipboard.writeText(n)}),[r,c,o]),I=n.useCallback((function(e,n){for(var t=new Set,r=Math.min(e.rowIndex,n.rowIndex),i=Math.max(e.rowIndex,n.rowIndex),c=Math.min(e.colIndex,n.colIndex),d=Math.max(e.colIndex,n.colIndex),l=r;l<=i;l++)for(var h=c;h<=d;h++)if(l>=0&&l<o.length){var f=o[l].row.rowMeta.rowId;t.add(a({colIndex:h,rowIndex:l,rowId:f}))}u(new Set),v(null),s(t)}),[o,u,v,s]),y=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<r.length){var n=a(e);u(new Set),v(null),s(new Set([n])),p(e)}}),[r.length,o.length,u,v,s,p]),b=n.useCallback((function(e,n){void 0===n&&(n=!1),s(new Set),p(null),u((function(t){var r=new Set(n?t:[]);return e.forEach((function(e){return r.add(e)})),r})),e.length>0&&v(e[e.length-1])}),[s,p,u,v]);n.useEffect((function(){var e=function(e){if(t&&g){var n=g.rowIndex,i=g.colIndex,a=g.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(o[n].row.rowMeta.rowId!==a){var c=o.findIndex((function(e){return e.row.rowMeta.rowId===a}));if(-1===c)return;n=c}if("ArrowUp"===e.key){if(e.preventDefault(),n>0){var d={rowIndex:n-1,colIndex:i,rowId:o[n-1].row.rowMeta.rowId};y(d)}}else"ArrowDown"===e.key?(e.preventDefault(),n<o.length-1&&(d={rowIndex:n+1,colIndex:i,rowId:o[n+1].row.rowMeta.rowId},y(d))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(d={rowIndex:n,colIndex:i-1,rowId:o[n].row.rowMeta.rowId},y(d))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<r.length-1&&(d={rowIndex:n,colIndex:i+1,rowId:o[n].row.rowMeta.rowId},y(d))):"Escape"===e.key&&(s(new Set),u(new Set),v(null),x.current=null,p(null))}else C()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[C,r.length,g,I,y,t,o]);var R=n.useCallback((function(e){var n=e.colIndex,t=e.rowIndex,r=e.rowId,o=a({colIndex:n,rowIndex:t,rowId:r}),i=c.has(o),s=l.has(n);return i||s}),[c,l]),M=n.useCallback((function(e){var n,t,r,i,a,c,s=e.colIndex,d=e.rowIndex,u=e.rowId,h=[],f=null===(r=null===(t=null===(n=o[d-1])||void 0===n?void 0:n.row)||void 0===t?void 0:t.rowMeta)||void 0===r?void 0:r.rowId,v={colIndex:s,rowIndex:d+1,rowId:null===(c=null===(a=null===(i=o[d+1])||void 0===i?void 0:i.row)||void 0===a?void 0:a.rowMeta)||void 0===c?void 0:c.rowId},m={colIndex:s-1,rowIndex:d,rowId:u},g={colIndex:s+1,rowIndex:d,rowId:u};return(!R({colIndex:s,rowIndex:d-1,rowId:f})||l.has(s)&&0===d)&&h.push("st-selected-top-border"),(!R(v)||l.has(s)&&d===o.length-1)&&h.push("st-selected-bottom-border"),R(m)||h.push("st-selected-left-border"),R(g)||h.push("st-selected-right-border"),h.join(" ")}),[R,o,l]),S=n.useMemo((function(){return g?function(e){var n=e.rowIndex,t=e.colIndex,r=e.rowId;return n===g.rowIndex&&t===g.colIndex&&r===g.rowId}:function(){return!1}}),[g]);return{getBorderClass:M,handleMouseDown:function(e){var n=e.colIndex,r=e.rowIndex,o=e.rowId;if(t){w.current=!0,x.current={rowIndex:r,colIndex:n,rowId:o},u(new Set),v(null);var i=a({colIndex:n,rowIndex:r,rowId:o});s(new Set([i])),p({rowIndex:r,colIndex:n,rowId:o})}},handleMouseOver:function(e){var n=e.colIndex,r=e.rowIndex;if(e.rowId,t&&w.current&&x.current){for(var i=new Set,c=Math.min(x.current.rowIndex,r),d=Math.max(x.current.rowIndex,r),l=Math.min(x.current.colIndex,n),u=Math.max(x.current.colIndex,n),h=c;h<=d;h++)for(var f=l;f<=u;f++)if(h>=0&&h<o.length){var v=o[h].row.rowMeta.rowId;i.add(a({colIndex:f,rowIndex:h,rowId:v}))}s(i)}},handleMouseUp:function(){w.current=!1},isInitialFocusedCell:S,isSelected:R,lastSelectedColumnIndex:f,selectColumns:b,selectedCells:c,selectedColumns:l,setInitialFocusedCell:p,setSelectedCells:s,setSelectedColumns:u}}({selectableCells:_,headers:ue.current,visibleRows:$e}),en=Ze.getBorderClass,nn=Ze.handleMouseDown,tn=Ze.handleMouseOver,rn=Ze.handleMouseUp,on=Ze.isInitialFocusedCell,an=Ze.isSelected,cn=Ze.selectColumns,sn=Ze.selectedCells,dn=Ze.selectedColumns,ln=Ze.setInitialFocusedCell,un=Ze.setSelectedCells,hn=Ze.setSelectedColumns,fn=n.useCallback((function(e,n){Je(e,n)}),[Je]),vn=n.useCallback((function(e){ue.current=e,Qe()}),[]);n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||Q&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(sn.size>0&&un(new Set),dn.size>0&&hn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[Q,sn,dn,un,hn]),n.useLayoutEffect((function(){if(pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth;Fe(e)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Qe(),pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth;Fe(e)}};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var mn=n.useRef(new Map);return n.useEffect((function(){ie&&(ie.current={updateData:function(e){var n,t,r,o,i=e.accessor,a=e.rowIndex,c=e.newValue,s=null===(t=null===(n=null==V?void 0:V[a])||void 0===n?void 0:n.rowMeta)||void 0===t?void 0:t.rowId;if(void 0!==s){var d=x({rowId:s,accessor:i}),l=mn.current.get(d);l&&l.updateContent(c),void 0!==(null===(o=null===(r=null==V?void 0:V[a])||void 0===r?void 0:r.rowData)||void 0===o?void 0:o[i])&&(V[a].rowData[i]=c)}}})}),[ie,V]),e.jsx(s,t({value:{allowAnimations:i,cellRegistry:mn.current,cellUpdateFlash:d,collapseIcon:g,columnReordering:b,columnResizing:M,draggedHeaderRef:le,editColumns:j,expandIcon:N,forceUpdate:Qe,getBorderClass:en,handleMouseDown:nn,handleMouseOver:tn,headersRef:ue,hiddenColumns:Ye,hoveredHeaderRef:fe,isInitialFocusedCell:on,isSelected:an,mainBodyRef:ve,nextIcon:O,onCellEdit:P,onColumnOrderChange:F,onSort:fn,onTableHeaderDragEnd:vn,pinnedLeftRef:me,pinnedRightRef:ge,prevIcon:Y,rowHeight:J,scrollbarWidth:Pe,selectColumns:cn,selectableColumns:Q,setInitialFocusedCell:ln,setIsWidthDragging:Re,setMainBodyWidth:Ee,setPinnedLeftWidth:De,setPinnedRightWidth:He,setSelectedCells:un,setSelectedColumns:hn,shouldPaginate:ee,sortDownIcon:te,sortUpIcon:oe,tableBodyContainerRef:pe}},{children:e.jsx("div",t({className:"simple-table-root st-wrapper theme-".concat(de),style:H?{height:H}:{}},{children:e.jsxs("div",t({className:"st-wrapper-container"},{children:[e.jsxs("div",t({className:"st-content-wrapper",onMouseUp:rn,onMouseLeave:rn},{children:[e.jsx(ae,{flattenedRows:Xe,isWidthDragging:be,pinnedLeftWidth:ke,pinnedRightWidth:Ne,setFlattenedRows:Ge,setScrollTop:Be,sort:Ue,visibleRows:$e}),e.jsx(xe,{columnEditorText:I,editColumns:j,editColumnsInitOpen:D,headers:ue.current,hiddenColumns:Ye,position:w,setHiddenColumns:qe})]})),e.jsx(ce,{mainBodyRef:ve,mainBodyWidth:Se,pinnedLeftWidth:ke,pinnedRightWidth:Ne,setMainBodyWidth:Ee,tableBodyContainerRef:pe}),e.jsx(l,{currentPage:Ce,hideFooter:T,onPageChange:Ie,onNextPage:U,shouldPaginate:ee,totalPages:Math.ceil(V.length/X)})]}))}))}))};exports.SimpleTable=function(r){var o=n.useState(!1),i=o[0],a=o[1];return n.useEffect((function(){a(!0)}),[]),i?e.jsx(Ce,t({},r)):null};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- export declare const formatDate: (dateString: string) => string;
1
+ export declare const formatDate: (dateString: string | number | Date) => string;
2
2
  export declare const formatCurrency: (value: number) => string;
3
3
  export declare const formatLargeNumber: (value: number) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-table-core",
3
- "version": "0.7.95",
3
+ "version": "0.7.96",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",