@coreui/data-grid 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -0
- package/README.md +37 -0
- package/dist/css/data-grid.css +444 -0
- package/dist/css/data-grid.css.map +1 -0
- package/dist/css/data-grid.min.css +5 -0
- package/dist/css/data-grid.min.css.map +1 -0
- package/dist/js/csv.cjs +68 -0
- package/dist/js/csv.cjs.map +1 -0
- package/dist/js/csv.mjs +63 -0
- package/dist/js/csv.mjs.map +1 -0
- package/dist/js/data-grid.esm.js +9618 -0
- package/dist/js/data-grid.esm.js.map +1 -0
- package/dist/js/data-grid.esm.min.js +8 -0
- package/dist/js/data-grid.esm.min.js.map +1 -0
- package/dist/js/data-grid.js +9635 -0
- package/dist/js/data-grid.js.map +1 -0
- package/dist/js/data-grid.min.js +8 -0
- package/dist/js/data-grid.min.js.map +1 -0
- package/dist/js/data-grid.mjs +9618 -0
- package/dist/js/data-grid.mjs.map +1 -0
- package/dist/js/filters.cjs +143 -0
- package/dist/js/filters.cjs.map +1 -0
- package/dist/js/filters.mjs +137 -0
- package/dist/js/filters.mjs.map +1 -0
- package/dist/js/labels.cjs +76 -0
- package/dist/js/labels.cjs.map +1 -0
- package/dist/js/labels.mjs +71 -0
- package/dist/js/labels.mjs.map +1 -0
- package/dist/types/base-component.d.ts +19 -0
- package/dist/types/data-grid.d.ts +128 -0
- package/dist/types/dom/event-handler.d.ts +11 -0
- package/dist/types/dom/manipulator.d.ts +9 -0
- package/dist/types/engine/active-cell.d.ts +32 -0
- package/dist/types/engine/data-source.d.ts +19 -0
- package/dist/types/engine/scheduler.d.ts +11 -0
- package/dist/types/engine/table.d.ts +9 -0
- package/dist/types/engine/virtualizer.d.ts +21 -0
- package/dist/types/filters.d.mts +1 -0
- package/dist/types/filters.d.ts +13 -0
- package/dist/types/icons.d.ts +21 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/labels.d.mts +1 -0
- package/dist/types/labels.d.ts +9 -0
- package/dist/types/types.d.ts +262 -0
- package/dist/types/ui/body.d.ts +34 -0
- package/dist/types/ui/column-chooser.d.ts +27 -0
- package/dist/types/ui/editor.d.ts +8 -0
- package/dist/types/ui/filter-menu.d.ts +21 -0
- package/dist/types/ui/header.d.ts +50 -0
- package/dist/types/ui/loading.d.ts +12 -0
- package/dist/types/ui/menu.d.ts +17 -0
- package/dist/types/ui/pagination.d.ts +17 -0
- package/dist/types/ui/pinning.d.ts +17 -0
- package/dist/types/ui/toolbar.d.ts +34 -0
- package/dist/types/ui/tooltip.d.ts +10 -0
- package/dist/types/util/config.d.ts +11 -0
- package/dist/types/util/csv.d.mts +1 -0
- package/dist/types/util/csv.d.ts +19 -0
- package/dist/types/util/debounce.d.ts +7 -0
- package/dist/types/util/index.d.ts +10 -0
- package/dist/types/util/sanitizer.d.ts +11 -0
- package/package.json +147 -0
- package/scss/data-grid.scss +559 -0
- package/src/base-component.d.ts +19 -0
- package/src/base-component.js +90 -0
- package/src/data-grid.ts +2208 -0
- package/src/dom/data.js +59 -0
- package/src/dom/event-handler.d.ts +11 -0
- package/src/dom/event-handler.js +331 -0
- package/src/dom/manipulator.d.ts +9 -0
- package/src/dom/manipulator.js +75 -0
- package/src/engine/active-cell.ts +195 -0
- package/src/engine/data-source.ts +63 -0
- package/src/engine/scheduler.ts +42 -0
- package/src/engine/table.ts +122 -0
- package/src/engine/virtualizer.ts +57 -0
- package/src/filters.ts +176 -0
- package/src/icons.ts +60 -0
- package/src/index.ts +56 -0
- package/src/labels.ts +70 -0
- package/src/types.ts +334 -0
- package/src/ui/body.ts +348 -0
- package/src/ui/column-chooser.ts +183 -0
- package/src/ui/editor.ts +98 -0
- package/src/ui/filter-menu.ts +398 -0
- package/src/ui/header.ts +441 -0
- package/src/ui/loading.ts +39 -0
- package/src/ui/menu.ts +218 -0
- package/src/ui/pagination.ts +150 -0
- package/src/ui/pinning.ts +53 -0
- package/src/ui/toolbar.ts +144 -0
- package/src/ui/tooltip.ts +113 -0
- package/src/util/config.d.ts +11 -0
- package/src/util/config.js +69 -0
- package/src/util/csv.ts +85 -0
- package/src/util/debounce.ts +18 -0
- package/src/util/index.d.ts +10 -0
- package/src/util/index.js +310 -0
- package/src/util/sanitizer.d.ts +11 -0
- package/src/util/sanitizer.js +162 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* CoreUI PRO data-grid v0.1.0-rc.0 (https://coreui.io)
|
|
3
|
+
* Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* Bundles @tanstack/table-core and @tanstack/virtual-core, MIT (https://github.com/TanStack/table/blob/main/LICENSE)
|
|
6
|
+
*/
|
|
7
|
+
const elementMap=new Map,Data={set(e,t,n){elementMap.has(e)||elementMap.set(e,new Map);const o=elementMap.get(e);o.has(t)||0===o.size?o.set(t,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(o.keys())[0]}.`)},get:(e,t)=>elementMap.has(e)&&elementMap.get(e).get(t)||null,remove(e,t){if(!elementMap.has(e))return;const n=elementMap.get(e);n.delete(t),0===n.size&&elementMap.delete(e)}},MILLISECONDS_MULTIPLIER=1e3,TRANSITION_END="transitionend",parseSelector=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,(e,t)=>`#${CSS.escape(t)}`)),e),toType=e=>null==e?`${e}`:Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),getTransitionDurationFromElement=e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);const o=Number.parseFloat(t),i=Number.parseFloat(n);return o||i?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0},triggerTransitionEnd=e=>{e.dispatchEvent(new Event(TRANSITION_END))},isElement=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),getElement=e=>isElement(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(parseSelector(e)):null,getjQuery=()=>window.jQuery&&!document.body.hasAttribute("data-coreui-no-jquery")?window.jQuery:null,DOMContentLoadedCallbacks=[],onDOMContentLoaded=e=>{"loading"===document.readyState?(DOMContentLoadedCallbacks.length||document.addEventListener("DOMContentLoaded",()=>{for(const e of DOMContentLoadedCallbacks)e()}),DOMContentLoadedCallbacks.push(e)):e()},defineJQueryPlugin=e=>{onDOMContentLoaded(()=>{const t=getjQuery();if(t){const n=e.NAME,o=t.fn[n];t.fn[n]=e.jQueryInterface,t.fn[n].Constructor=e,t.fn[n].noConflict=()=>(t.fn[n]=o,e.jQueryInterface)}})},execute=(e,t=[],n=e)=>"function"==typeof e?e.call(...t):n,executeAfterTransition=(e,t,n=!0)=>{if(!n)return void execute(e);const o=getTransitionDurationFromElement(t)+5;let i=!1;const l=({target:n})=>{n===t&&(i=!0,t.removeEventListener(TRANSITION_END,l),execute(e))};t.addEventListener(TRANSITION_END,l),setTimeout(()=>{i||triggerTransitionEnd(t)},o)},namespaceRegex=/[^.]*(?=\..*)\.|.*/,stripNameRegex=/\..*/,stripUidRegex=/::\d+$/,eventRegistry={};let uidEvent=1;const customEvents={mouseenter:"mouseover",mouseleave:"mouseout"},nativeEvents=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","gesturestart","gesturechange","gestureend","focus","blur","change","input","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function makeEventUid(e,t){return t&&`${t}::${uidEvent++}`||e.uidEvent||uidEvent++}function getElementEvents(e){const t=makeEventUid(e);return e.uidEvent=t,eventRegistry[t]=eventRegistry[t]||{},eventRegistry[t]}function bootstrapHandler(e,t){return function n(o){return hydrateObj(o,{delegateTarget:e}),n.oneOff&&EventHandler.off(e,o.type,t),t.apply(e,[o])}}function bootstrapDelegationHandler(e,t,n){return function o(i){const l=e.querySelectorAll(t);for(let{target:s}=i;s&&s!==this;s=s.parentNode)for(const r of l)if(r===s)return hydrateObj(i,{delegateTarget:s}),o.oneOff&&EventHandler.off(e,i.type,t,n),n.apply(s,[i])}}function findHandler(e,t,n=null){return Object.values(e).find(e=>e.callable===t&&e.delegationSelector===n)}function normalizeParameters(e,t,n){const o="string"==typeof t,i=o?n:t||n;let l=getTypeEvent(e);return nativeEvents.has(l)||(l=e),[o,i,l]}function addHandler(e,t,n,o,i){if("string"!=typeof t||!e)return;let[l,s,r]=normalizeParameters(t,n,o);if(t in customEvents){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};s=e(s)}const a=getElementEvents(e),u=a[r]||(a[r]={}),d=findHandler(u,s,l?n:null);if(d)return void(d.oneOff=d.oneOff&&i);const c=makeEventUid(s,t.replace(namespaceRegex,"")),g=l?bootstrapDelegationHandler(e,n,s):bootstrapHandler(e,s);g.delegationSelector=l?n:null,g.callable=s,g.oneOff=i,g.uidEvent=c,u[c]=g,e.addEventListener(r,g,l)}function removeHandler(e,t,n,o,i){const l=findHandler(t[n],o,i);l&&(e.removeEventListener(n,l,Boolean(i)),delete t[n][l.uidEvent])}function removeNamespacedHandlers(e,t,n,o){const i=t[n]||{};for(const[l,s]of Object.entries(i))l.includes(o)&&removeHandler(e,t,n,s.callable,s.delegationSelector)}function getTypeEvent(e){return e=e.replace(stripNameRegex,""),customEvents[e]||e}const EventHandler={on(e,t,n,o){addHandler(e,t,n,o,!1)},one(e,t,n,o){addHandler(e,t,n,o,!0)},off(e,t,n,o){if("string"!=typeof t||!e)return;const[i,l,s]=normalizeParameters(t,n,o),r=s!==t,a=getElementEvents(e),u=a[s]||{},d=t.startsWith(".");if(void 0===l){if(d)for(const n of Object.keys(a))removeNamespacedHandlers(e,a,n,t.slice(1));for(const[n,o]of Object.entries(u)){const i=n.replace(stripUidRegex,"");r&&!t.includes(i)||removeHandler(e,a,s,o.callable,o.delegationSelector)}}else{if(!Object.keys(u).length)return;removeHandler(e,a,s,l,i?n:null)}},trigger(e,t,n){if("string"!=typeof t||!e)return null;const o=getjQuery();let i=null,l=!0,s=!0,r=!1;t!==getTypeEvent(t)&&o&&(i=o.Event(t,n),o(e).trigger(i),l=!i.isPropagationStopped(),s=!i.isImmediatePropagationStopped(),r=i.isDefaultPrevented());const a=hydrateObj(new Event(t,{bubbles:l,cancelable:!0}),n);return r&&a.preventDefault(),s&&e.dispatchEvent(a),a.defaultPrevented&&i&&i.preventDefault(),a}};function hydrateObj(e,t={}){for(const[n,o]of Object.entries(t))try{e[n]=o}catch{Object.defineProperty(e,n,{configurable:!0,get:()=>o})}return e}function normalizeData(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch{return e}}function normalizeDataKey(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const Manipulator={setDataAttribute(e,t,n){e.setAttribute(`data-coreui-${normalizeDataKey(t)}`,n)},removeDataAttribute(e,t){e.removeAttribute(`data-coreui-${normalizeDataKey(t)}`)},getDataAttributes(e){if(!e)return{};const t={},n=Object.keys(e.dataset).filter(e=>e.startsWith("coreui")&&!e.startsWith("coreuiConfig"));for(const o of n){let n=o.replace(/^coreui/,"");n=n.charAt(0).toLowerCase()+n.slice(1),t[n]=normalizeData(e.dataset[o])}return t},getDataAttribute:(e,t)=>normalizeData(e.getAttribute(`data-coreui-${normalizeDataKey(t)}`))};class Config{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const n=isElement(t)?Manipulator.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof n?n:{},...isElement(t)?Manipulator.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[n,o]of Object.entries(t)){const t=e[n],i=isElement(t)?"element":toType(t);if(!new RegExp(o).test(i))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${i}" but expected type "${o}".`)}}}const VERSION="0.1.0";class BaseComponent extends Config{constructor(e,t){super(),(e=getElement(e))&&(this._element=e,this._config=this._getConfig(t),Data.set(this._element,this.constructor.DATA_KEY,this))}dispose(){Data.remove(this._element,this.constructor.DATA_KEY),EventHandler.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,n=!0){executeAfterTransition(e,t,n)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return Data.get(getElement(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"0.1.0"}static get DATA_KEY(){return`coreui.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const HEADER_ROW_INDEX=-1,clampColumn=(e,t)=>t.includes(e)?e:t.length>0?t[0]:null,clampActiveCell=(e,t)=>{if(!e)return null;const n=clampColumn(e.columnId,t.columnIds);if(null===n)return null;const o=t.rowCount-1,i=e.rowIndex<0?-1:Math.max(0,Math.min(e.rowIndex,Math.max(o,0)));return i>=0&&o<0?{rowIndex:-1,columnId:n}:{rowIndex:i,columnId:n}},resolveNavigation=(e,t,n,o)=>{const{columnIds:i,rowCount:l,pageStep:s,paginated:r}=o,a=i.indexOf(n.columnId);if(-1===a||0===i.length)return null;const u=l-1,d=i.length-1,c=(e,t)=>({cell:{rowIndex:e,columnId:i[t]}});switch(e){case"ArrowLeft":return c(n.rowIndex,Math.max(a-1,0));case"ArrowRight":return c(n.rowIndex,Math.min(a+1,d));case"ArrowUp":return c(Math.max(n.rowIndex-1,-1),a);case"ArrowDown":return c(Math.min(n.rowIndex+1,u),a);case"Home":return c(t?l>0?0:-1:n.rowIndex,0);case"End":return c(t?l>0?u:-1:n.rowIndex,d);case"PageUp":return r&&0===n.rowIndex?{...c(0,a),pageDelta:-1}:c(Math.max(n.rowIndex-s,0),a);case"PageDown":return r&&n.rowIndex===u?{...c(u,a),pageDelta:1}:c(Math.min(n.rowIndex+s,u),a);default:return null}},createActiveCellManager=e=>{let t=null,n=!1;return{get:()=>t,set(o,i={}){const l=!t||t.rowIndex!==o.rowIndex||t.columnId!==o.columnId;t=o,i.focus&&(n=!0),(l||i.focus)&&e()},clamp(n){const o=clampActiveCell(t,n),i=Boolean(t)!==Boolean(o)||t&&o&&(t.rowIndex!==o.rowIndex||t.columnId!==o.columnId);t=o,i&&e()},reset(){t&&(t=null,n=!1,e())},consumeFocusRequest:()=>!!n&&(n=!1,!0)}},FETCH_DEBOUNCE_MS=100,createDataSource=e=>{let t,n=0;return{load(){clearTimeout(t);const o=++n;t=setTimeout(async()=>{e.onLoadingChange(!0);try{const t=await e.provider(e.getRequest());if(o!==n)return;e.onLoad(t)}catch(t){if(o!==n)return;e.onError(t)}finally{o===n&&e.onLoadingChange(!1)}},100)},dispose(){clearTimeout(t),n++}}},createScheduler=e=>{let t=!1,n=!1;const o=()=>{t=!1,n||e()};return{schedule(){t||n||(t=!0,"function"!=typeof window.requestAnimationFrame?setTimeout(o,16):window.requestAnimationFrame(o))},dispose(){n=!0}}};function functionalUpdate(e,t){return"function"==typeof e?e(t):e}function makeStateUpdater(e,t){return n=>{t.setState(t=>({...t,[e]:functionalUpdate(n,t[e])}))}}function isFunction(e){return e instanceof Function}function isNumberArray(e){return Array.isArray(e)&&e.every(e=>"number"==typeof e)}function flattenBy(e,t){const n=[],o=e=>{e.forEach(e=>{n.push(e);const i=t(e);null!=i&&i.length&&o(i)})};return o(e),n}function memo$1(e,t,n){let o,i=[];return l=>{let s;n.key&&n.debug&&(s=Date.now());const r=e(l);if(r.length===i.length&&!r.some((e,t)=>i[t]!==e))return o;let a;if(i=r,n.key&&n.debug&&(a=Date.now()),o=t(...r),null==n||null==n.onChange||n.onChange(o),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-s))/100,t=Math.round(100*(Date.now()-a))/100,o=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*o,120))}deg 100% 31%);`,null==n?void 0:n.key)}return o}}function getMemoOptions(e,t,n,o){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:o}}function createCell(e,t,n,o){const i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(o),renderValue:()=>{var t;return null!=(t=i.getValue())?t:e.options.renderFallbackValue},getContext:memo$1(()=>[e,n,t,i],(e,t,n,o)=>({table:e,column:t,row:n,cell:o,getValue:o.getValue,renderValue:o.renderValue}),getMemoOptions(e.options,"debugCells"))};return e._features.forEach(o=>{null==o.createCell||o.createCell(i,n,t,e)},{}),i}function createColumn(e,t,n,o){var i,l;const s={...e._getDefaultColumnDef(),...t},r=s.accessorKey;let a,u=null!=(i=null!=(l=s.id)?l:r?"function"==typeof String.prototype.replaceAll?r.replaceAll(".","_"):r.replace(/\./g,"_"):void 0)?i:"string"==typeof s.header?s.header:void 0;if(s.accessorFn?a=s.accessorFn:r&&(a=r.includes(".")?e=>{let t=e;for(const e of r.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[s.accessorKey]),!u)throw new Error;let d={id:`${String(u)}`,accessorFn:a,parent:o,depth:n,columnDef:s,columns:[],getFlatColumns:memo$1(()=>[!0],()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},getMemoOptions(e.options,"debugColumns")),getLeafColumns:memo$1(()=>[e._getOrderColumnsFn()],e=>{var t;if(null!=(t=d.columns)&&t.length){let t=d.columns.flatMap(e=>e.getLeafColumns());return e(t)}return[d]},getMemoOptions(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(d,e);return d}const debug="debugHeaders";function createHeader$1(e,t,n){var o;let i={id:null!=(o=n.id)?o:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(i),e},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(i,e)}),i}const Headers={createTable:e=>{e.getHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o,i)=>{var l,s;const r=null!=(l=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?l:[],a=null!=(s=null==i?void 0:i.map(e=>n.find(t=>t.id===e)).filter(Boolean))?s:[];return buildHeaderGroups(t,[...r,...n.filter(e=>!(null!=o&&o.includes(e.id)||null!=i&&i.includes(e.id))),...a],e)},getMemoOptions(e.options,debug)),e.getCenterHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o,i)=>buildHeaderGroups(t,n=n.filter(e=>!(null!=o&&o.includes(e.id)||null!=i&&i.includes(e.id))),e,"center"),getMemoOptions(e.options,debug)),e.getLeftHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,o)=>{var i;return buildHeaderGroups(t,null!=(i=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"left")},getMemoOptions(e.options,debug)),e.getRightHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,o)=>{var i;return buildHeaderGroups(t,null!=(i=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"right")},getMemoOptions(e.options,debug)),e.getFooterGroups=memo$1(()=>[e.getHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,debug)),e.getLeftFooterGroups=memo$1(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,debug)),e.getCenterFooterGroups=memo$1(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,debug)),e.getRightFooterGroups=memo$1(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,debug)),e.getFlatHeaders=memo$1(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,debug)),e.getLeftFlatHeaders=memo$1(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,debug)),e.getCenterFlatHeaders=memo$1(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,debug)),e.getRightFlatHeaders=memo$1(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,debug)),e.getCenterLeafHeaders=memo$1(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),getMemoOptions(e.options,debug)),e.getLeftLeafHeaders=memo$1(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),getMemoOptions(e.options,debug)),e.getRightLeafHeaders=memo$1(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),getMemoOptions(e.options,debug)),e.getLeafHeaders=memo$1(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var o,i,l,s,r,a;return[...null!=(o=null==(i=e[0])?void 0:i.headers)?o:[],...null!=(l=null==(s=t[0])?void 0:s.headers)?l:[],...null!=(r=null==(a=n[0])?void 0:a.headers)?r:[]].map(e=>e.getLeafHeaders()).flat()},getMemoOptions(e.options,debug))}};function buildHeaderGroups(e,t,n,o){var i,l;let s=0;const r=function(e,t){void 0===t&&(t=1),s=Math.max(s,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&r(e.columns,t+1)},0)};r(e);let a=[];const u=(e,t)=>{const i={depth:t,id:[o,`${t}`].filter(Boolean).join("_"),headers:[]},l=[];e.forEach(e=>{const s=[...l].reverse()[0];let r,a=!1;if(e.column.depth===i.depth&&e.column.parent?r=e.column.parent:(r=e.column,a=!0),s&&(null==s?void 0:s.column)===r)s.subHeaders.push(e);else{const i=createHeader$1(n,r,{id:[o,t,r.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:a,placeholderId:a?`${l.filter(e=>e.column===r).length}`:void 0,depth:t,index:l.length});i.subHeaders.push(e),l.push(i)}i.headers.push(e),e.headerGroup=i}),a.push(i),t>0&&u(l,t-1)},d=t.map((e,t)=>createHeader$1(n,e,{depth:s,index:t}));u(d,s-1),a.reverse();const c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,o=[0];return e.subHeaders&&e.subHeaders.length?(o=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,o.push(i)})):t=1,n+=Math.min(...o),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(null!=(i=null==(l=a[0])?void 0:l.headers)?i:[]),a}const createRow=(e,t,n,o,i,l,s)=>{let r={id:t,index:o,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(r._valuesCache.hasOwnProperty(t))return r._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(r._valuesCache[t]=n.accessorFn(r.original,o),r._valuesCache[t]):void 0},getUniqueValues:t=>{if(r._uniqueValuesCache.hasOwnProperty(t))return r._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(r._uniqueValuesCache[t]=n.columnDef.getUniqueValues(r.original,o),r._uniqueValuesCache[t]):(r._uniqueValuesCache[t]=[r.getValue(t)],r._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=r.getValue(t))?n:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>flattenBy(r.subRows,e=>e.subRows),getParentRow:()=>r.parentId?e.getRow(r.parentId,!0):void 0,getParentRows:()=>{let e=[],t=r;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:memo$1(()=>[e.getAllLeafColumns()],t=>t.map(t=>createCell(e,r,t,t.id)),getMemoOptions(e.options,"debugRows")),_getAllCellsByColumnId:memo$1(()=>[r.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),getMemoOptions(e.options,"debugRows"))};for(let t=0;t<e._features.length;t++){const n=e._features[t];null==n||null==n.createRow||n.createRow(r,e)}return r},ColumnFaceting={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},includesString=(e,t,n)=>{var o,i;const l=null==n||null==(o=n.toString())?void 0:o.toLowerCase();return Boolean(null==(i=e.getValue(t))||null==(i=i.toString())||null==(i=i.toLowerCase())?void 0:i.includes(l))};includesString.autoRemove=e=>testFalsey(e);const includesStringSensitive=(e,t,n)=>{var o;return Boolean(null==(o=e.getValue(t))||null==(o=o.toString())?void 0:o.includes(n))};includesStringSensitive.autoRemove=e=>testFalsey(e);const equalsString=(e,t,n)=>{var o;return(null==(o=e.getValue(t))||null==(o=o.toString())?void 0:o.toLowerCase())===(null==n?void 0:n.toLowerCase())};equalsString.autoRemove=e=>testFalsey(e);const arrIncludes=(e,t,n)=>{var o;return null==(o=e.getValue(t))?void 0:o.includes(n)};arrIncludes.autoRemove=e=>testFalsey(e);const arrIncludesAll=(e,t,n)=>!n.some(n=>{var o;return!(null!=(o=e.getValue(t))&&o.includes(n))});arrIncludesAll.autoRemove=e=>testFalsey(e)||!(null!=e&&e.length);const arrIncludesSome=(e,t,n)=>n.some(n=>{var o;return null==(o=e.getValue(t))?void 0:o.includes(n)});arrIncludesSome.autoRemove=e=>testFalsey(e)||!(null!=e&&e.length);const equals=(e,t,n)=>e.getValue(t)===n;equals.autoRemove=e=>testFalsey(e);const weakEquals=(e,t,n)=>e.getValue(t)==n;weakEquals.autoRemove=e=>testFalsey(e);const inNumberRange=(e,t,n)=>{let[o,i]=n;const l=e.getValue(t);return l>=o&&l<=i};inNumberRange.resolveFilterValue=e=>{let[t,n]=e,o="number"!=typeof t?parseFloat(t):t,i="number"!=typeof n?parseFloat(n):n,l=null===t||Number.isNaN(o)?-1/0:o,s=null===n||Number.isNaN(i)?1/0:i;if(l>s){const e=l;l=s,s=e}return[l,s]},inNumberRange.autoRemove=e=>testFalsey(e)||testFalsey(e[0])&&testFalsey(e[1]);const filterFns={includesString:includesString,includesStringSensitive:includesStringSensitive,equalsString:equalsString,arrIncludes:arrIncludes,arrIncludesAll:arrIncludesAll,arrIncludesSome:arrIncludesSome,equals:equals,weakEquals:weakEquals,inNumberRange:inNumberRange};function testFalsey(e){return null==e||""===e}const ColumnFiltering={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:makeStateUpdater("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],o=null==n?void 0:n.getValue(e.id);return"string"==typeof o?filterFns.includesString:"number"==typeof o?filterFns.inNumberRange:"boolean"==typeof o||null!==o&&"object"==typeof o?filterFns.equals:Array.isArray(o)?filterFns.arrIncludes:filterFns.weakEquals},e.getFilterFn=()=>{var n,o;return isFunction(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(o=t.options.filterFns)?void 0:o[e.columnDef.filterFn])?n:filterFns[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,o,i;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(o=t.options.enableColumnFilters)||o)&&(null==(i=t.options.enableFilters)||i)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,o;return null!=(n=null==(o=t.getState().columnFilters)?void 0:o.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{const o=e.getFilterFn(),i=null==t?void 0:t.find(t=>t.id===e.id),l=functionalUpdate(n,i?i.value:void 0);var s;if(shouldAutoRemoveFilter(o,l,e))return null!=(s=null==t?void 0:t.filter(t=>t.id!==e.id))?s:[];const r={id:e.id,value:l};var a;return i?null!=(a=null==t?void 0:t.map(t=>t.id===e.id?r:t))?a:[]:null!=t&&t.length?[...t,r]:[r]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var o;return null==(o=functionalUpdate(t,e))?void 0:o.filter(e=>{const t=n.find(t=>t.id===e.id);return!t||!shouldAutoRemoveFilter(t.getFilterFn(),e.value,t)})})},e.resetColumnFilters=t=>{var n,o;e.setColumnFilters(t?[]:null!=(n=null==(o=e.initialState)?void 0:o.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function shouldAutoRemoveFilter(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const sum=(e,t,n)=>n.reduce((t,n)=>{const o=n.getValue(e);return t+("number"==typeof o?o:0)},0),min=(e,t,n)=>{let o;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(o>n||void 0===o&&n>=n)&&(o=n)}),o},max=(e,t,n)=>{let o;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(o<n||void 0===o&&n>=n)&&(o=n)}),o},extent=(e,t,n)=>{let o,i;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(void 0===o?n>=n&&(o=i=n):(o>n&&(o=n),i<n&&(i=n)))}),[o,i]},mean=(e,t)=>{let n=0,o=0;if(t.forEach(t=>{let i=t.getValue(e);null!=i&&(i=+i)>=i&&(++n,o+=i)}),n)return o/n},median=(e,t)=>{if(!t.length)return;const n=t.map(t=>t.getValue(e));if(!isNumberArray(n))return;if(1===n.length)return n[0];const o=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2!=0?i[o]:(i[o-1]+i[o])/2},unique=(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount=(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count=(e,t)=>t.length,aggregationFns={sum:sum,min:min,max:max,extent:extent,mean:mean,median:median,unique:unique,uniqueCount:uniqueCount,count:count},ColumnGrouping={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:makeStateUpdater("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,o;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(o=t.options.enableGrouping)||o)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],o=null==n?void 0:n.getValue(e.id);return"number"==typeof o?aggregationFns.sum:"[object Date]"===Object.prototype.toString.call(o)?aggregationFns.extent:void 0},e.getAggregationFn=()=>{var n,o;if(!e)throw new Error;return isFunction(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(o=t.options.aggregationFns)?void 0:o[e.columnDef.aggregationFn])?n:aggregationFns[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,o;e.setGrouping(t?[]:null!=(n=null==(o=e.initialState)?void 0:o.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const o=t.getColumn(n);return null!=o&&o.columnDef.getGroupingValue?(e._groupingValuesCache[n]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,o)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}};function orderColumns(e,t,n){if(null==t||!t.length||!n)return e;const o=e.filter(e=>!t.includes(e.id));return"remove"===n?o:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...o]}const ColumnOrdering={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:makeStateUpdater("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=memo$1(e=>[_getVisibleLeafColumns(t,e)],t=>t.findIndex(t=>t.id===e.id),getMemoOptions(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var o;return(null==(o=_getVisibleLeafColumns(t,n)[0])?void 0:o.id)===e.id},e.getIsLastColumn=n=>{var o;const i=_getVisibleLeafColumns(t,n);return(null==(o=i[i.length-1])?void 0:o.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=memo$1(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>o=>{let i=[];if(null!=e&&e.length){const t=[...e],n=[...o];for(;n.length&&t.length;){const e=t.shift(),o=n.findIndex(t=>t.id===e);o>-1&&i.push(n.splice(o,1)[0])}i=[...i,...n]}else i=o;return orderColumns(i,t,n)},getMemoOptions(e.options,"debugTable"))}},getDefaultColumnPinningState=()=>({left:[],right:[]}),ColumnPinning={getInitialState:e=>({columnPinning:getDefaultColumnPinningState(),...e}),getDefaultOptions:e=>({onColumnPinningChange:makeStateUpdater("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const o=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,i,l,s,r,a;return"right"===n?{left:(null!=(l=null==e?void 0:e.left)?l:[]).filter(e=>!(null!=o&&o.includes(e))),right:[...(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=o&&o.includes(e))),...o]}:"left"===n?{left:[...(null!=(r=null==e?void 0:e.left)?r:[]).filter(e=>!(null!=o&&o.includes(e))),...o],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter(e=>!(null!=o&&o.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=o&&o.includes(e))),right:(null!=(i=null==e?void 0:e.right)?i:[]).filter(e=>!(null!=o&&o.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,o,i;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(o=null!=(i=t.options.enableColumnPinning)?i:t.options.enablePinning)||o)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(e=>e.id),{left:o,right:i}=t.getState().columnPinning,l=n.some(e=>null==o?void 0:o.includes(e)),s=n.some(e=>null==i?void 0:i.includes(e));return l?"left":!!s&&"right"},e.getPinnedIndex=()=>{var n,o;const i=e.getIsPinned();return i?null!=(n=null==(o=t.getState().columnPinning)||null==(o=o[i])?void 0:o.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=memo$1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{const o=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!o.includes(e.column.id))},getMemoOptions(t.options,"debugRows")),e.getLeftVisibleCells=memo$1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),getMemoOptions(t.options,"debugRows")),e.getRightVisibleCells=memo$1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),getMemoOptions(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,o;return e.setColumnPinning(t?getDefaultColumnPinningState():null!=(n=null==(o=e.initialState)?void 0:o.columnPinning)?n:getDefaultColumnPinningState())},e.getIsSomeColumnsPinned=t=>{var n;const o=e.getState().columnPinning;var i,l;return t?Boolean(null==(n=o[t])?void 0:n.length):Boolean((null==(i=o.left)?void 0:i.length)||(null==(l=o.right)?void 0:l.length))},e.getLeftLeafColumns=memo$1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),getMemoOptions(e.options,"debugColumns")),e.getRightLeafColumns=memo$1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),getMemoOptions(e.options,"debugColumns")),e.getCenterLeafColumns=memo$1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{const o=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!o.includes(e.id))},getMemoOptions(e.options,"debugColumns"))}};function safelyAccessDocument(e){return e||("undefined"!=typeof document?document:null)}const defaultColumnSizing={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},getDefaultColumnSizingInfoState=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),ColumnSizing={getDefaultColumnDef:()=>defaultColumnSizing,getInitialState:e=>({columnSizing:{},columnSizingInfo:getDefaultColumnSizingInfoState(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:makeStateUpdater("columnSizing",e),onColumnSizingInfoChange:makeStateUpdater("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,o,i;const l=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:defaultColumnSizing.minSize,null!=(o=null!=l?l:e.columnDef.size)?o:defaultColumnSizing.size),null!=(i=e.columnDef.maxSize)?i:defaultColumnSizing.maxSize)},e.getStart=memo$1(e=>[e,_getVisibleLeafColumns(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),getMemoOptions(t.options,"debugColumns")),e.getAfter=memo$1(e=>[e,_getVisibleLeafColumns(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),getMemoOptions(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...o}=t;return o})},e.getCanResize=()=>{var n,o;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(o=t.options.enableColumnResizing)||o)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var o;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(o=e.column.getSize())?o:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const o=t.getColumn(e.column.id),i=null==o?void 0:o.getCanResize();return l=>{if(!o||!i)return;if(null==l.persist||l.persist(),isTouchStartEvent(l)&&l.touches&&l.touches.length>1)return;const s=e.getSize(),r=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[o.id,o.getSize()]],a=isTouchStartEvent(l)?Math.round(l.touches[0].clientX):l.clientX,u={},d=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var o,i;const l="rtl"===t.options.columnResizeDirection?-1:1,s=(n-(null!=(o=null==e?void 0:e.startOffset)?o:0))*l,r=Math.max(s/(null!=(i=null==e?void 0:e.startSize)?i:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;u[t]=Math.round(100*Math.max(n+n*r,0))/100}),{...e,deltaOffset:s,deltaPercentage:r}}),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing(e=>({...e,...u})))},c=e=>d("move",e),g=e=>{d("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=safelyAccessDocument(n),m={moveHandler:e=>c(e.clientX),upHandler:e=>{null==h||h.removeEventListener("mousemove",m.moveHandler),null==h||h.removeEventListener("mouseup",m.upHandler),g(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),c(e.touches[0].clientX),!1),upHandler:e=>{var t;null==h||h.removeEventListener("touchmove",p.moveHandler),null==h||h.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),g(null==(t=e.touches[0])?void 0:t.clientX)}},f=!!passiveEventSupported()&&{passive:!1};isTouchStartEvent(l)?(null==h||h.addEventListener("touchmove",p.moveHandler,f),null==h||h.addEventListener("touchend",p.upHandler,f)):(null==h||h.addEventListener("mousemove",m.moveHandler,f),null==h||h.addEventListener("mouseup",m.upHandler,f)),t.setColumnSizingInfo(e=>({...e,startOffset:a,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:r,isResizingColumn:o.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?getDefaultColumnSizingInfoState():null!=(n=e.initialState.columnSizingInfo)?n:getDefaultColumnSizingInfoState())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}};let passiveSupported=null;function passiveEventSupported(){if("boolean"==typeof passiveSupported)return passiveSupported;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return passiveSupported=e,passiveSupported}function isTouchStartEvent(e){return"touchstart"===e.type}const ColumnVisibility={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:makeStateUpdater("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,o;const i=e.columns;return null==(n=i.length?i.some(e=>e.getIsVisible()):null==(o=t.getState().columnVisibility)?void 0:o[e.id])||n},e.getCanHide=()=>{var n,o;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(o=t.options.enableHiding)||o)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=memo$1(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),getMemoOptions(t.options,"debugRows")),e.getVisibleCells=memo$1(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],getMemoOptions(t.options,"debugRows"))},createTable:e=>{const t=(t,n)=>memo$1(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),getMemoOptions(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(0,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(0,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(0,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(0,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function _getVisibleLeafColumns(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const GlobalFaceting={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},GlobalFiltering={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:makeStateUpdater("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const o=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof o||"number"==typeof o}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,o,i,l;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(o=t.options.enableGlobalFilter)||o)&&(null==(i=t.options.enableFilters)||i)&&(null==(l=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||l)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>filterFns.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:o}=e.options;return isFunction(o)?o:"auto"===o?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[o])?t:filterFns[o]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},RowExpanding={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:makeStateUpdater("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var o,i;if(t){if(null!=(o=null!=(i=e.options.autoResetAll)?i:e.options.autoResetExpanded)?o:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}}else e._queue(()=>{t=!0})},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,o;e.setExpanded(t?{}:null!=(n=null==(o=e.initialState)?void 0:o.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some(e=>!e.getIsExpanded())},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{const n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(o=>{var i;const l=!0===o||!(null==o||!o[e.id]);let s={};if(!0===o?Object.keys(t.getRowModel().rowsById).forEach(e=>{s[e]=!0}):s=o,n=null!=(i=n)?i:!l,!l&&n)return{...s,[e.id]:!0};if(l&&!n){const{[e.id]:t,...n}=s;return n}return o})},e.getIsExpanded=()=>{var n;const o=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===o||(null==o?void 0:o[e.id]))},e.getCanExpand=()=>{var n,o,i;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(o=t.options.enableExpanding)||o)&&!(null==(i=e.subRows)||!i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,o=e;for(;n&&o.parentId;)o=t.getRow(o.parentId,!0),n=o.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},defaultPageIndex=0,defaultPageSize=10,getDefaultPaginationState=()=>({pageIndex:0,pageSize:10}),RowPagination={getInitialState:e=>({...e,pagination:{...getDefaultPaginationState(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:makeStateUpdater("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var o,i;if(t){if(null!=(o=null!=(i=e.options.autoResetAll)?i:e.options.autoResetPageIndex)?o:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}}else e._queue(()=>{t=!0})},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>functionalUpdate(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?getDefaultPaginationState():null!=(n=e.initialState.pagination)?n:getDefaultPaginationState())},e.setPageIndex=t=>{e.setPagination(n=>{let o=functionalUpdate(t,n.pageIndex);const i=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...n,pageIndex:o}})},e.resetPageIndex=t=>{var n,o;e.setPageIndex(t?0:null!=(n=null==(o=e.initialState)||null==(o=o.pagination)?void 0:o.pageIndex)?n:0)},e.resetPageSize=t=>{var n,o;e.setPageSize(t?10:null!=(n=null==(o=e.initialState)||null==(o=o.pagination)?void 0:o.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{const n=Math.max(1,functionalUpdate(t,e.pageSize)),o=e.pageSize*e.pageIndex,i=Math.floor(o/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var o;let i=functionalUpdate(t,null!=(o=e.options.pageCount)?o:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}}),e.getPageOptions=memo$1(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map((e,t)=>t)),t},getMemoOptions(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},getDefaultRowPinningState=()=>({top:[],bottom:[]}),RowPinning={getInitialState:e=>({rowPinning:getDefaultRowPinningState(),...e}),getDefaultOptions:e=>({onRowPinningChange:makeStateUpdater("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,o,i)=>{const l=o?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],s=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],r=new Set([...s,e.id,...l]);t.setRowPinning(e=>{var t,o,i,l,s,a;return"bottom"===n?{top:(null!=(i=null==e?void 0:e.top)?i:[]).filter(e=>!(null!=r&&r.has(e))),bottom:[...(null!=(l=null==e?void 0:e.bottom)?l:[]).filter(e=>!(null!=r&&r.has(e))),...Array.from(r)]}:"top"===n?{top:[...(null!=(s=null==e?void 0:e.top)?s:[]).filter(e=>!(null!=r&&r.has(e))),...Array.from(r)],bottom:(null!=(a=null==e?void 0:e.bottom)?a:[]).filter(e=>!(null!=r&&r.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=r&&r.has(e))),bottom:(null!=(o=null==e?void 0:e.bottom)?o:[]).filter(e=>!(null!=r&&r.has(e)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:o,enablePinning:i}=t.options;return"function"==typeof o?o(e):null==(n=null!=o?o:i)||n},e.getIsPinned=()=>{const n=[e.id],{top:o,bottom:i}=t.getState().rowPinning,l=n.some(e=>null==o?void 0:o.includes(e)),s=n.some(e=>null==i?void 0:i.includes(e));return l?"top":!!s&&"bottom"},e.getPinnedIndex=()=>{var n,o;const i=e.getIsPinned();if(!i)return-1;const l=null==(n="top"===i?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(o=null==l?void 0:l.indexOf(e.id))?o:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,o;return e.setRowPinning(t?getDefaultRowPinningState():null!=(n=null==(o=e.initialState)?void 0:o.rowPinning)?n:getDefaultRowPinningState())},e.getIsSomeRowsPinned=t=>{var n;const o=e.getState().rowPinning;var i,l;return t?Boolean(null==(n=o[t])?void 0:n.length):Boolean((null==(i=o.top)?void 0:i.length)||(null==(l=o.bottom)?void 0:l.length))},e._getPinnedRows=(t,n,o)=>{var i;return(null==(i=e.options.keepPinnedRows)||i?(null!=n?n:[]).map(t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:o}))},e.getTopRows=memo$1(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),getMemoOptions(e.options,"debugRows")),e.getBottomRows=memo$1(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),getMemoOptions(e.options,"debugRows")),e.getCenterRows=memo$1(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{const o=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!o.has(e.id))},getMemoOptions(e.options,"debugRows"))}},RowSelection={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:makeStateUpdater("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const o={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(o[e.id]=!0)}):i.forEach(e=>{delete o[e.id]}),o})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const o=void 0!==t?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(t=>{mutateRowIsSelected(i,t.id,o,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=memo$1(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?selectRowsFn(e,n):{rows:[],flatRows:[],rowsById:{}},getMemoOptions(e.options,"debugTable")),e.getFilteredSelectedRowModel=memo$1(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?selectRowsFn(e,n):{rows:[],flatRows:[],rowsById:{}},getMemoOptions(e.options,"debugTable")),e.getGroupedSelectedRowModel=memo$1(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?selectRowsFn(e,n):{rows:[],flatRows:[],rowsById:{}},getMemoOptions(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let o=Boolean(t.length&&Object.keys(n).length);return o&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(o=!1),o},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState();let o=!!t.length;return o&&t.some(e=>!n[e.id])&&(o=!1),o},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,o)=>{const i=e.getIsSelected();t.setRowSelection(l=>{var s;if(n=void 0!==n?n:!i,e.getCanSelect()&&i===n)return l;const r={...l};return mutateRowIsSelected(r,e.id,n,null==(s=null==o?void 0:o.selectChildren)||s,t),r})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return isRowSelected(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===isSubRowSelected(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===isSubRowSelected(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var o;t&&e.toggleSelected(null==(o=n.target)?void 0:o.checked)}}}},mutateRowIsSelected=(e,t,n,o,i)=>{var l;const s=i.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),s.getCanSelect()&&(e[t]=!0)):delete e[t],o&&null!=(l=s.subRows)&&l.length&&s.getCanSelectSubRows()&&s.subRows.forEach(t=>mutateRowIsSelected(e,t.id,n,o,i))};function selectRowsFn(e,t){const n=e.getState().rowSelection,o=[],i={},l=function(e,t){return e.map(e=>{var t;const s=isRowSelected(e,n);if(s&&(o.push(e),i[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:l(e.subRows)}),s)return e}).filter(Boolean)};return{rows:l(t.rows),flatRows:o,rowsById:i}}function isRowSelected(e,t){var n;return null!=(n=t[e.id])&&n}function isSubRowSelected(e,t,n){var o;if(null==(o=e.subRows)||!o.length)return!1;let i=!0,l=!1;return e.subRows.forEach(e=>{if((!l||i)&&(e.getCanSelect()&&(isRowSelected(e,t)?l=!0:i=!1),e.subRows&&e.subRows.length)){const n=isSubRowSelected(e,t);"all"===n?l=!0:"some"===n?(l=!0,i=!1):i=!1}}),i?"all":!!l&&"some"}const reSplitAlphaNumeric=/([0-9]+)/gm,alphanumeric=(e,t,n)=>compareAlphanumeric(toString(e.getValue(n)).toLowerCase(),toString(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive=(e,t,n)=>compareAlphanumeric(toString(e.getValue(n)),toString(t.getValue(n))),text=(e,t,n)=>compareBasic(toString(e.getValue(n)).toLowerCase(),toString(t.getValue(n)).toLowerCase()),textCaseSensitive=(e,t,n)=>compareBasic(toString(e.getValue(n)),toString(t.getValue(n))),datetime=(e,t,n)=>{const o=e.getValue(n),i=t.getValue(n);return o>i?1:o<i?-1:0},basic=(e,t,n)=>compareBasic(e.getValue(n),t.getValue(n));function compareBasic(e,t){return e===t?0:e>t?1:-1}function toString(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function compareAlphanumeric(e,t){const n=e.split(reSplitAlphaNumeric).filter(Boolean),o=t.split(reSplitAlphaNumeric).filter(Boolean);for(;n.length&&o.length;){const e=n.shift(),t=o.shift(),i=parseInt(e,10),l=parseInt(t,10),s=[i,l].sort();if(isNaN(s[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(s[1]))return isNaN(i)?-1:1;if(i>l)return 1;if(l>i)return-1}}return n.length-o.length}const sortingFns={alphanumeric:alphanumeric,alphanumericCaseSensitive:alphanumericCaseSensitive,text:text,textCaseSensitive:textCaseSensitive,datetime:datetime,basic:basic},RowSorting={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:makeStateUpdater("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return sortingFns.datetime;if("string"==typeof n&&(o=!0,n.split(reSplitAlphaNumeric).length>1))return sortingFns.alphanumeric}return o?sortingFns.text:sortingFns.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,o;if(!e)throw new Error;return isFunction(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(o=t.options.sortingFns)?void 0:o[e.columnDef.sortingFn])?n:sortingFns[e.columnDef.sortingFn]},e.toggleSorting=(n,o)=>{const i=e.getNextSortingOrder(),l=null!=n;t.setSorting(s=>{const r=null==s?void 0:s.find(t=>t.id===e.id),a=null==s?void 0:s.findIndex(t=>t.id===e.id);let u,d=[],c=l?n:"desc"===i;var g;return u=null!=s&&s.length&&e.getCanMultiSort()&&o?r?"toggle":"add":null!=s&&s.length&&a!==s.length-1?"replace":r?"toggle":"replace","toggle"===u&&(l||i||(u="remove")),"add"===u?(d=[...s,{id:e.id,desc:c}],d.splice(0,d.length-(null!=(g=t.options.maxMultiSortColCount)?g:Number.MAX_SAFE_INTEGER))):d="toggle"===u?s.map(t=>t.id===e.id?{...t,desc:c}:t):"remove"===u?s.filter(t=>t.id!==e.id):[{id:e.id,desc:c}],d})},e.getFirstSortDir=()=>{var n,o;return(null!=(n=null!=(o=e.columnDef.sortDescFirst)?o:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var o,i;const l=e.getFirstSortDir(),s=e.getIsSorted();return s?!!(s===l||null!=(o=t.options.enableSortingRemoval)&&!o||n&&null!=(i=t.options.enableMultiRemove)&&!i)&&("desc"===s?"asc":"desc"):l},e.getCanSort=()=>{var n,o;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(o=t.options.enableSorting)||o)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,o;return null!=(n=null!=(o=e.columnDef.enableMultiSort)?o:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const o=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!o&&(o.desc?"desc":"asc")},e.getSortIndex=()=>{var n,o;return null!=(n=null==(o=t.getState().sorting)?void 0:o.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return o=>{n&&(null==o.persist||o.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(o))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,o;e.setSorting(t?[]:null!=(n=null==(o=e.initialState)?void 0:o.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},builtInFeatures=[Headers,ColumnVisibility,ColumnOrdering,ColumnPinning,ColumnFaceting,ColumnFiltering,GlobalFaceting,GlobalFiltering,RowSorting,ColumnGrouping,RowExpanding,RowPagination,RowPinning,RowSelection,ColumnSizing];function createTable(e){var t,n;const o=[...builtInFeatures,...null!=(t=e._features)?t:[]];let i={_features:o};const l=i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i)),{});let s={...null!=(n=e.initialState)?n:{}};i._features.forEach(e=>{var t;s=null!=(t=null==e.getInitialState?void 0:e.getInitialState(s))?t:s});const r=[];let a=!1;const u={_features:o,options:{...l,...e},initialState:s,_queue:e=>{r.push(e),a||(a=!0,Promise.resolve().then(()=>{for(;r.length;)r.shift()();a=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{const t=functionalUpdate(e,i.options);i.options=(e=>i.options.mergeOptions?i.options.mergeOptions(l,e):{...l,...e})(t)},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var o;return null!=(o=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?o:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&(n=i.getCoreRowModel().rowsById[e],!n))throw new Error;return n},_getDefaultColumnDef:memo$1(()=>[i.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},getMemoOptions(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:memo$1(()=>[i._getColumnDefs()],e=>{const t=function(e,n,o){return void 0===o&&(o=0),e.map(e=>{const l=createColumn(i,e,o,n),s=e;return l.columns=s.columns?t(s.columns,l,o+1):[],l})};return t(e)},getMemoOptions(e,"debugColumns")),getAllFlatColumns:memo$1(()=>[i.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),getMemoOptions(e,"debugColumns")),_getAllFlatColumnsById:memo$1(()=>[i.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),getMemoOptions(e,"debugColumns")),getAllLeafColumns:memo$1(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),getMemoOptions(e,"debugColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,u);for(let e=0;e<i._features.length;e++){const t=i._features[e];null==t||null==t.createTable||t.createTable(i)}return i}function getCoreRowModel(){return e=>memo$1(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},o=function(t,i,l){void 0===i&&(i=0);const s=[];for(let a=0;a<t.length;a++){const u=createRow(e,e._getRowId(t[a],a,l),t[a],a,i,0,null==l?void 0:l.id);var r;n.flatRows.push(u),n.rowsById[u.id]=u,s.push(u),e.options.getSubRows&&(u.originalSubRows=e.options.getSubRows(t[a],a),null!=(r=u.originalSubRows)&&r.length&&(u.subRows=o(u.originalSubRows,i+1,u)))}return s};return n.rows=o(t),n},getMemoOptions(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function expandRows(e){const t=[],n=e=>{var o;t.push(e),null!=(o=e.subRows)&&o.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function filterRows(e,t,n){return n.options.filterFromLeafRows?filterRowModelFromLeafs(e,t,n):filterRowModelFromRoot(e,t,n)}function filterRowModelFromLeafs(e,t,n){var o;const i=[],l={},s=null!=(o=n.options.maxLeafRowFilterDepth)?o:100,r=function(e,o){void 0===o&&(o=0);const a=[];for(let d=0;d<e.length;d++){var u;let c=e[d];const g=createRow(n,c.id,c.original,c.index,c.depth,0,c.parentId);if(g.columnFilters=c.columnFilters,null!=(u=c.subRows)&&u.length&&o<s){if(g.subRows=r(c.subRows,o+1),c=g,t(c)&&!g.subRows.length){a.push(c),l[c.id]=c,i.push(c);continue}if(t(c)||g.subRows.length){a.push(c),l[c.id]=c,i.push(c);continue}}else c=g,t(c)&&(a.push(c),l[c.id]=c,i.push(c))}return a};return{rows:r(e),flatRows:i,rowsById:l}}function filterRowModelFromRoot(e,t,n){var o;const i=[],l={},s=null!=(o=n.options.maxLeafRowFilterDepth)?o:100,r=function(e,o){void 0===o&&(o=0);const a=[];for(let d=0;d<e.length;d++){let c=e[d];if(t(c)){var u;if(null!=(u=c.subRows)&&u.length&&o<s){const e=createRow(n,c.id,c.original,c.index,c.depth,0,c.parentId);e.subRows=r(c.subRows,o+1),c=e}a.push(c),i.push(c),l[c.id]=c}}return a};return{rows:r(e),flatRows:i,rowsById:l}}function getFacetedRowModel(){return(e,t)=>memo$1(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,o,i)=>{if(!n.rows.length||(null==o||!o.length)&&!i)return n;const l=[...o.map(e=>e.id).filter(e=>e!==t),i?"__global__":void 0].filter(Boolean);return filterRows(n.rows,e=>{for(let t=0;t<l.length;t++)if(!1===e.columnFilters[l[t]])return!1;return!0},e)},getMemoOptions(e.options,"debugTable"))}function getFacetedUniqueValues(){return(e,t)=>memo$1(()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]},e=>{if(!e)return new Map;let n=new Map;for(let i=0;i<e.flatRows.length;i++){const l=e.flatRows[i].getUniqueValues(t);for(let e=0;e<l.length;e++){const t=l[e];var o;n.has(t)?n.set(t,(null!=(o=n.get(t))?o:0)+1):n.set(t,1)}}return n},getMemoOptions(e.options,"debugTable"))}function getFilteredRowModel(){return e=>memo$1(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,o)=>{if(!t.rows.length||(null==n||!n.length)&&!o){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const i=[],l=[];(null!=n?n:[]).forEach(t=>{var n;const o=e.getColumn(t.id);if(!o)return;const l=o.getFilterFn();l&&i.push({id:t.id,filterFn:l,resolvedValue:null!=(n=null==l.resolveFilterValue?void 0:l.resolveFilterValue(t.value))?n:t.value})});const s=(null!=n?n:[]).map(e=>e.id),r=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());let u,d;o&&r&&a.length&&(s.push("__global__"),a.forEach(e=>{var t;l.push({id:e.id,filterFn:r,resolvedValue:null!=(t=null==r.resolveFilterValue?void 0:r.resolveFilterValue(o))?t:o})}));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},i.length)for(let e=0;e<i.length;e++){u=i[e];const t=u.id;n.columnFilters[t]=u.filterFn(n,t,u.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(l.length){for(let e=0;e<l.length;e++){d=l[e];const t=d.id;if(d.filterFn(n,t,d.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return filterRows(t.rows,e=>{for(let t=0;t<s.length;t++)if(!1===e.columnFilters[s[t]])return!1;return!0},e)},getMemoOptions(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function getPaginationRowModel(e){return e=>memo$1(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:o,pageIndex:i}=t;let{rows:l,flatRows:s,rowsById:r}=n;const a=o*i,u=a+o;let d;l=l.slice(a,u),d=e.options.paginateExpandedRows?{rows:l,flatRows:s,rowsById:r}:expandRows({rows:l,flatRows:s,rowsById:r}),d.flatRows=[];const c=e=>{d.flatRows.push(e),e.subRows.length&&e.subRows.forEach(c)};return d.rows.forEach(c),d},getMemoOptions(e.options,"debugTable"))}function getSortedRowModel(){return e=>memo$1(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const o=e.getState().sorting,i=[],l=o.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),s={};l.forEach(t=>{const n=e.getColumn(t.id);n&&(s[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});const r=e=>{const t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let o=0;o<l.length;o+=1){var n;const i=l[o],r=s[i.id],a=r.sortUndefined,u=null!=(n=null==i?void 0:i.desc)&&n;let d=0;if(a){const n=void 0===e.getValue(i.id),o=void 0===t.getValue(i.id);if(n||o){if("first"===a)return n?-1:1;if("last"===a)return n?1:-1;d=n&&o?0:n?a:-a}}if(0===d&&(d=r.sortingFn(e,t,i.id)),0!==d)return u&&(d*=-1),r.invertSorting&&(d*=-1),d}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=r(e.subRows))}),t};return{rows:r(n.rows),flatRows:i,rowsById:n.rowsById}},getMemoOptions(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}const FILTER_OPERATORS={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","blank","notBlank"],date:["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","blank","notBlank"]},VALUELESS_OPERATORS=new Set(["blank","notBlank"]),isBlank=e=>null==e||""===String(e).trim(),toComparable=(e,t)=>{if("date"===t){const t=e instanceof Date?e.getTime():new Date(String(e)).getTime();return Number.isNaN(t)?null:t}const n="number"==typeof e?e:Number(e);return Number.isFinite(n)?n:null},evaluateCondition=(e,t,n)=>{const{operator:o}=t;if("blank"===o)return isBlank(e);if("notBlank"===o)return!isBlank(e);if(isBlank(t.value))return!0;if("number"===n||"date"===n){const i=toComparable(e,n),l=toComparable(t.value,n);if(null===i||null===l)return!1;switch(o){case"equals":return i===l;case"notEquals":return i!==l;case"greaterThan":return i>l;case"greaterThanOrEqual":return i>=l;case"lessThan":return i<l;case"lessThanOrEqual":return i<=l;case"between":{const e=toComparable(t.value2,n);return null===e?i>=l:i>=l&&i<=e}default:return!1}}const i=String(null!=e?e:"").toLowerCase(),l=String(t.value).toLowerCase();switch(o){case"contains":return i.includes(l);case"notContains":return!i.includes(l);case"equals":return i===l;case"notEquals":return i!==l;case"startsWith":return i.startsWith(l);case"endsWith":return i.endsWith(l);default:return!1}},evaluateColumnFilter=(e,t,n="text")=>{if("string"==typeof t)return String(null!=e?e:"").toLowerCase().includes(t.toLowerCase());if("conditions"in t){const o=t.conditions.map(t=>evaluateCondition(e,t,n));return"or"===t.join?o.some(Boolean):o.every(Boolean)}return t.value.some(t=>String(t)===String(e))},CLASS_NAME_TOOLBAR="data-grid-toolbar",CLASS_NAME_ACTIONS="data-grid-toolbar-actions",CLASS_NAME_SEARCH="data-grid-toolbar-search",resolveToolbar=e=>{var t,n,o,i;const{toolbar:l}=e,s=Boolean(e.columnVisibility);if(!0===l)return{columns:s,export:!0,exportOptions:{},history:e.history,search:!0};if("object"==typeof l){const r=null!==(t=l.export)&&void 0!==t&&t;return{columns:null!==(n=l.columns)&&void 0!==n&&n&&s,export:Boolean(r),exportOptions:"object"==typeof r?r:{},history:null!==(o=l.history)&&void 0!==o&&o&&e.history,search:null!==(i=l.search)&&void 0!==i&&i||Boolean(e.globalFilter)}}return{columns:!1,export:!1,exportOptions:{},history:!1,search:Boolean(e.globalFilter)}},isGlobalFilterEnabled=e=>resolveToolbar(e).search,createActionButton=(e,t,n)=>{const o=document.createElement("button");o.type="button",o.classList.add("btn","btn-ghost","btn-sm"),o.innerHTML=e,o.setAttribute(n,""),o.setAttribute("data-coreui-tooltip",t);const i=document.createElement("span");return i.classList.add("visually-hidden"),i.textContent=t,o.append(i),o},createToolbar=e=>{const t=document.createElement("div");if(t.classList.add(CLASS_NAME_TOOLBAR),e.columns||e.export||e.history){const n=document.createElement("div");if(n.classList.add(CLASS_NAME_ACTIONS),e.columns&&n.append(createActionButton(e.icons.columns,e.labels.toolbarColumns,"data-coreui-toolbar-columns")),e.export&&n.append(createActionButton(e.icons.export,e.labels.toolbarExport,"data-coreui-toolbar-export")),e.history){const t=createActionButton(e.icons.undo,e.labels.toolbarUndo,"data-coreui-toolbar-undo"),o=createActionButton(e.icons.redo,e.labels.toolbarRedo,"data-coreui-toolbar-redo");t.disabled=!0,o.disabled=!0,n.append(t,o)}t.append(n)}if(e.search){const n=document.createElement("div");n.classList.add(CLASS_NAME_SEARCH);const o=document.createElement("input");o.type="search",o.classList.add("form-control","form-control-sm"),o.placeholder=e.labels.globalFilterPlaceholder,o.setAttribute("aria-label",e.labels.globalFilterLabel),o.dataset.coreuiGlobalFilter="",n.append(o),t.append(n)}return{element:t}},toTanStackFilterFn=e=>{const{filterFn:t}=e;return t?(e,n,o)=>t(e.getValue(n),o,e.original):(t,n,o)=>evaluateColumnFilter(t.getValue(n),o,e.filterType)},createGridTable=(e,t)=>{var n,o;const i="object"==typeof e.sorting?e.sorting:{},l="object"==typeof e.columnSizing?e.columnSizing:{},s="object"==typeof e.pagination?e.pagination:{},r=Boolean(e.dataProvider),a=Boolean(e.columnSizing),u=Boolean(e.columnPinning),d=a||u,c=Boolean(e.pagination)||r,g={...c&&{pagination:{pageIndex:0,pageSize:null!==(n=s.pageSize)&&void 0!==n?n:10}},..."object"==typeof e.columnPinning&&{columnPinning:e.columnPinning},...Array.isArray(e.columnOrder)&&{columnOrder:e.columnOrder},..."object"==typeof e.columnVisibility&&{columnVisibility:e.columnVisibility}},h=createTable({columns:e.columns.map(e=>{var t;const n=null!==(t=e.width)&&void 0!==t?t:null;return{accessorKey:e.key,enableColumnFilter:!1!==e.filterable,enableHiding:!1!==e.hideable,enableResizing:!1!==e.resizable,enableSorting:!1!==e.sortable,filterFn:toTanStackFilterFn(e),id:e.key,meta:{label:e.label,formatter:e.formatter},...d&&null!==n&&{size:n}}}),columnResizeMode:null!==(o=l.mode)&&void 0!==o?o:"onChange",data:r?[]:e.items,enableColumnFilters:Boolean(e.columnFilters),enableColumnPinning:u,enableColumnResizing:a,enableGlobalFilter:isGlobalFilterEnabled(e),enableHiding:Boolean(e.columnVisibility),enableMultiSort:!1!==i.multiple,enableRowSelection:Boolean(e.rowSelection),enableSorting:Boolean(e.sorting),enableSortingRemoval:Boolean(i.resetable),getCoreRowModel:getCoreRowModel(),getFacetedRowModel:getFacetedRowModel(),getFacetedUniqueValues:getFacetedUniqueValues(),getFilteredRowModel:getFilteredRowModel(),getSortedRowModel:getSortedRowModel(),globalFilterFn:"includesString",...r&&{manualFiltering:!0,manualPagination:!0,manualSorting:!0,rowCount:0},...c&&{getPaginationRowModel:getPaginationRowModel()},...e.itemKey&&{getRowId:e.itemKey},initialState:g,onStateChange(){},renderFallbackValue:null,state:{}});let m=h.initialState;return h.setOptions(e=>({...e,state:m,onStateChange(e){const n=m;m="function"==typeof e?e(m):e,h.setOptions(e=>({...e,state:m})),t(n,m)}})),h};function createLazyMeasurementsView(e,t,n){const o=new Array(e);return new Proxy(o,{get(o,i,l){if("string"==typeof i){const l=i.charCodeAt(0);if(l>=48&&l<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&l<e){let e=o[l];if(!e){const i=t[2*l];e=o[l]={index:l,key:n(l),start:i,size:t[2*l+1],end:i+t[2*l+1],lane:0}}return e}}if("length"===i)return e}return Reflect.get(o,i,l)}})}function memo(e,t,n){let o,i=n.initialDeps??[],l=!0;function s(){const s=e();return s.length!==i.length||s.some((e,t)=>i[t]!==e)?(i=s,o=t(...s),!(null==n?void 0:n.onChange)||l&&n.skipInitialOnChange||n.onChange(o),l=!1,o):o}return s.updateDeps=e=>{i=e},s}function notUndefined(e,t){if(void 0===e)throw new Error("Unexpected undefined");return e}const approxEqual=(e,t)=>Math.abs(e-t)<1.01,debounce$1=(e,t,n)=>{let o;return function(...i){e.clearTimeout(o),o=e.setTimeout(()=>t.apply(this,i),n)}};let _isIOSResult;const isIOSWebKit=()=>{if(void 0!==_isIOSResult)return _isIOSResult;if("undefined"==typeof navigator)return _isIOSResult=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return _isIOSResult=!0;const e=navigator.maxTouchPoints;return _isIOSResult="MacIntel"===navigator.platform&&void 0!==e&&e>0},getRect=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},defaultKeyExtractor=e=>e,defaultRangeExtractor=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(n);for(let e=0;e<n;e++)o[e]=t+e;return o},observeElementRect=(e,t)=>{const n=e.scrollElement;if(!n)return;const o=e.targetWindow;if(!o)return;const i=e=>{const{width:n,height:o}=e;t({width:Math.round(n),height:Math.round(o)})};if(i(getRect(n)),!o.ResizeObserver)return()=>{};const l=new o.ResizeObserver(t=>{const o=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(getRect(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},addEventListenerOptions={passive:!0},supportsScrollend="undefined"==typeof window||"onscrollend"in window,observeOffset=(e,t,n)=>{const o=e.scrollElement;if(!o)return;const i=e.targetWindow;if(!i)return;const l=e.options.useScrollendEvent&&supportsScrollend;let s=0;const r=l?null:debounce$1(i,()=>t(s,!1),e.options.isScrollingResetDelay),a=e=>()=>{s=n(o),null==r||r(),t(s,e)},u=a(!0),d=a(!1);return o.addEventListener("scroll",u,addEventListenerOptions),l&&o.addEventListener("scrollend",d,addEventListenerOptions),()=>{o.removeEventListener("scroll",u),l&&o.removeEventListener("scrollend",d)}},observeElementOffset=(e,t)=>observeOffset(e,t,t=>{const{horizontal:n,isRtl:o}=e.options;return n?t.scrollLeft*(o?-1:1):t.scrollTop}),measureElement=(e,t,n)=>{if(n.options.useCachedMeasurements){const t=n.indexFromElement(e),o=n.options.getItemKey(t);return n.itemSizeCache.get(o)??n.options.estimateSize(t)}if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const t=n.indexFromElement(e),o=n.options.getItemKey(t),i=n.itemSizeCache.get(o);if(void 0!==i)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},scrollWithAdjustments=(e,{adjustments:t=0,behavior:n},o)=>{var i,l;null==(l=null==(i=o.scrollElement)?void 0:i.scrollTo)||l.call(i,{[o.options.horizontal?"left":"top"]:e+t,behavior:n})},elementScroll=scrollWithAdjustments;class Virtualizer{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,t,n;return(null==(n=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:n.call(t))??Date.now()},this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{const t=()=>{const t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(const[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{var t,n;const o={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:defaultKeyExtractor,rangeExtractor:defaultRangeExtractor,onChange:()=>{},measureElement:measureElement,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const t in e){const n=e[t];void 0!==n&&(o[t]=n)}const i=this.options;let l=null,s=null,r=!1;if(void 0!==i&&i.enabled&&o.enabled&&"end"===o.anchorTo&&null!==this.scrollElement){const e=i.count,a=o.count,u=this.getMeasurements(),d=e>0?(null==(t=u[0])?void 0:t.key)??i.getItemKey(0):null,c=e>0?(null==(n=u[e-1])?void 0:n.key)??i.getItemKey(e-1):null;if(a!==e||e>0&&a>0&&(o.getItemKey(0)!==d||o.getItemKey(a-1)!==c)){r=!0;const t=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??u[0]:null;t&&(l=[t.key,this.getScrollOffset()-t.start]);const n=!0===o.followOnAppend?"auto":o.followOnAppend||null;n&&a>e&&this.isAtEnd(i.scrollEndThreshold)&&(0===e||o.getItemKey(a-1)!==c)&&(s=n)}}this.options=o,r&&(this.pendingMin=0,this.itemSizeCacheVersion++);let a=!1,u=0;if(l&&null!==this.scrollOffset){const[e,t]=l,n=this.getMeasurements(),{count:o,getItemKey:i}=this.options;let s=0;for(;s<o&&i(s)!==e;)s++;if(s<o){const e=n[s];if(e){const n=e.start+t;n!==this.scrollOffset&&(u=n-this.scrollOffset,this.scrollOffset=n,a=!0)}}}(a||s)&&(this.pendingScrollAnchor=[a?l[0]:null,a?l[1]:0,s,u])},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=memo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&null===this._intendedScrollOffset&&e===this.scrollOffset)return;null!==this._intendedScrollOffset&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,isIOSWebKit()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener("touchstart",t,addEventListenerOptions),e.addEventListener("touchend",n,addEventListenerOptions),this.unsubs.push(()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[e,t,o,i]=n;null===e||o||(isIOSWebKit()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?0!==i&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;const e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=memo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,o,i,l,s,r)=>(void 0!==this.prevLanes&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:o,enabled:i,lanes:l,laneAssignmentMode:s,gap:r}),{key:!1}),this.getMeasurements=memo(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:o,enabled:i,lanes:l,laneAssignmentMode:s,gap:r},a)=>{const u=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===l){const i=2*e;let l,s=this._flatMeasurements;if(!s||s.length<i){const e=new Float64Array(i);s&&d>0&&e.set(s.subarray(0,2*d)),s=e,this._flatMeasurements=s}if(0===d)l=t+n;else{const e=d-1;l=s[2*e]+s[2*e+1]+r}for(let t=d;t<e;t++){const e=o(t),n=u.get(e),i="number"==typeof n?n:this.options.estimateSize(t);s[2*t]=l,s[2*t+1]=i,l+=i+r}const a=createLazyMeasurementsView(e,s,o);return this.measurementsCache=a,a}const c=this.measurementsCache.slice(0,d),g=new Array(l).fill(void 0),h=new Float64Array(l);let m=0;for(let e=0;e<d;e++){const t=c[e];t&&(void 0===g[t.lane]&&m++,g[t.lane]=e,h[t.lane]=t.end)}for(let i=d;i<e;i++){const e=o(i),a=this.laneAssignments.get(i);let d,p;const f="estimate"===s||u.has(e);if(void 0!==a&&this.options.lanes>1){d=a;const e=g[d],o=void 0!==e?c[e]:void 0;p=o?o.end+r:t+n}else if(m===l){let e=0,t=h[0],n=g[0];for(let o=1;o<l;o++){const i=h[o];(i<t||i===t&&g[o]<n)&&(e=o,t=i,n=g[o])}d=e,p=t+r,f&&this.laneAssignments.set(i,d)}else d=i%this.options.lanes,p=t+n,f&&this.laneAssignments.set(i,d);const _=u.get(e),v="number"==typeof _?_:this.options.estimateSize(i),E=p+v;c[i]={index:i,start:p,size:v,end:E,key:e,lane:d},void 0===g[d]&&m++,g[d]=i,h[d]=E}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=memo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,o)=>0===e.length||0===t?(this.range=null,null):(this.range=calculateRangeImpl(e,t,n,o,1===o&&null!=this._flatMeasurements?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=memo(()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,o,i)=>null===o||null===i?[]:e({startIndex:o,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;const n=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==n&&this.range){const t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,n-t),i=Math.min(this.options.count-1,n+t);return e>=o&&e<=i}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});const t=this.indexFromElement(e),n=this.options.getItemKey(t),o=this.elementsCache.get(n);o!==e&&(o&&this.observer.unobserve(o),this.observer.observe(e),this.elementsCache.set(n,e)),this.isScrolling&&!this.scrollState||!this.shouldMeasureDuringScroll(t)||this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n,o;if(e<0||e>=this.options.count)return;let i,l,s;const r=this._flatMeasurements;if(1===this.options.lanes&&null!==r)s=this.options.getItemKey(e),l=r[2*e],i=r[2*e+1];else{const t=this.measurementsCache[e];if(!t)return;s=t.key,l=t.start,i=t.size}const a=t-(this.itemSizeCache.get(s)??i);if(0!==a){const r="end"===this.options.anchorTo&&"smooth"!==(null==(n=this.scrollState)?void 0:n.behavior)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,u=r?this.getTotalSize():0,d="smooth"!==(null==(o=this.scrollState)?void 0:o.behavior)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:s,start:l,size:i,end:l+i,lane:0},a,this):l<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(s)||"backward"!==this.scrollDirection));(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(s,t),this.itemSizeCacheVersion++,r?this.applyScrollAdjustment(this.getTotalSize()-u):d&&this.applyScrollAdjustment(a),this.notify(!1)}},this.getVirtualItems=memo(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const n=[];for(let o=0,i=e.length;o<i;o++){const i=t[e[o]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0===t.length)return;const n=this._flatMeasurements,o=1===this.options.lanes&&null!=n,i=findNearestBinarySearch(0,t.length-1,o?e=>n[2*e]:e=>notUndefined(t[e]).start,e);return notUndefined(t[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();"auto"===t&&(t=e>=i+o?"end":"start"),"center"===t?e+=(n-o)/2:"end"===t&&(e-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.getSize(),o=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if("auto"===t)if(i.end>=o+n-this.options.scrollPaddingEnd)t="end";else{if(!(i.start<=o+this.options.scrollPaddingStart))return[o,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];const l="end"===t?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,t,i.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:n="auto"}={})=>{const o=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.getOffsetForIndex(e,t);if(!o)return;const[i,l]=o,s=this.now();this.scrollState={index:e,align:l,behavior:n,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{const n=this.getScrollOffset()+e,o=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:e}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let n;if(0===t.length)n=this.options.paddingStart;else if(1===this.options.lanes){const o=t.length-1,i=this._flatMeasurements;n=null!=i?i[2*o]+i[2*o+1]:(null==(e=t[o])?void 0:e.end)??0}else{const e=Array(this.options.lanes).fill(null);let o=t.length-1;for(;o>=0&&e.some(e=>null===e);){const n=t[o];null===e[n.lane]&&(e[n.lane]=n.end),o--}n=Math.max(...e.filter(e=>null!==e))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const e=[];if(0===this.itemSizeCache.size)return e;const t=this.getMeasurements();for(const n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){0!==e&&(isIOSWebKit()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),null!==this.scrollOffset&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){this.targetWindow?null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})):this.scrollState=null}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3)return void(this.scrollState=null);const e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&approxEqual(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1)return this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),void(this.scrollState=null)}else if(this.scrollState.stableFrames=0,n){const e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),o="smooth"===this.scrollState.behavior&&n>e;this.scrollState.lastTargetOffset=t,o||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:o?"smooth":"auto"})}this.scheduleScrollReconcile()}}const findNearestBinarySearch=(e,t,n,o)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<o)e=i+1;else{if(!(l>o))return i;t=i-1}}return e>0?e-1:0};function findNearestBinarySearchFlat(e,t,n){let o=0;for(;o<=t;){const i=(o+t)/2|0,l=e[2*i];if(l<n)o=i+1;else{if(!(l>n))return i;t=i-1}}return o>0?o-1:0}function calculateRangeImpl(e,t,n,o,i){const l=e.length-1;if(e.length<=o)return{startIndex:0,endIndex:l};if(1===o&&null!==i){const e=findNearestBinarySearchFlat(i,l,n);let o=e;const s=n+t;for(;o<l&&i[2*o]+i[2*o+1]<s;)o++;return{startIndex:e,endIndex:o}}let s=findNearestBinarySearch(0,l,t=>e[t].start,n),r=s;if(1===o)for(;r<l&&e[r].end<n+t;)r++;else if(o>1){const i=Array(o).fill(0);for(;r<l&&i.some(e=>e<n+t);){const t=e[r];i[t.lane]=t.end,r++}const a=Array(o).fill(n+t);for(;s>=0&&a.some(e=>e>=n);){const t=e[s];a[t.lane]=t.start,s--}s=Math.max(0,s-s%o),r=Math.min(l,r+(o-1-r%o))}return{startIndex:s,endIndex:r}}const createGridVirtualizer=e=>{const t=new Virtualizer({count:e.count,estimateSize:()=>e.rowHeight,getScrollElement:e.getScrollElement,observeElementOffset:observeElementOffset,observeElementRect:observeElementRect,onChange:e.onChange,overscan:e.overscan,scrollToFn:elementScroll}),n=t._didMount();return t._willUpdate(),{instance:t,setCount(e){e!==t.options.count&&t.setOptions({...t.options,count:e})},destroy(){n()}}},DEFAULT_COLUMN_MENU_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M204 148a52 52 0 1 0 104 0 52 52 0 1 0-104 0m78 0a26 26 0 1 1-26-26 26.03 26.03 0 0 1 26 26M204 264a52 52 0 1 0 104 0 52 52 0 1 0-104 0m78 0a26 26 0 1 1-26-26 26.03 26.03 0 0 1 26 26M204 380a52 52 0 1 0 104 0 52 52 0 1 0-104 0m78 0a26 26 0 1 1-26-26 26.03 26.03 0 0 1 26 26"/></svg>',DEFAULT_FILTER_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M96 197.333h320v32H96zm72 101.334h176v32H168zM216 400h80v32h-80zM48 96h416v32H48z"/></svg>',DEFAULT_TOOLBAR_COLUMNS_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M16 64v384h480V64Zm304 32v320H192V96ZM48 96h112v320H48Zm416 320H352V96h112Z"/></svg>',DEFAULT_TOOLBAR_EXPORT_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M16 464h480v32H16zm379.313-164.687-22.626-22.626L280 369.373V16h-32v353.373l-92.687-92.686-22.626 22.626L264 430.627z"/></svg>',DEFAULT_TOOLBAR_UNDO_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M495.473 197.262c0-73.061-43.651-136.118-106.242-164.462q-2-.9-4.021-1.762-4.046-1.715-8.19-3.235-2.071-.761-4.167-1.47-4.19-1.422-8.468-2.64a180.95 180.95 0 0 0-98.675 0q-4.278 1.218-8.469 2.64-2.094.71-4.166 1.47-4.143 1.519-8.19 3.235-2.023.857-4.021 1.762c-62.592 28.344-106.242 91.4-106.242 164.462v237.483L38.627 338.75 16 361.377 150.623 496l134.623-134.623-22.627-22.627-96 96V197.263c0-72.891 52.814-133.678 122.186-146.1a149.4 149.4 0 0 1 52.479 0c69.371 12.426 122.186 73.213 122.186 146.1h32Z"/></svg>',DEFAULT_TOOLBAR_REDO_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M361.376 495.163 226.753 360.54l22.627-22.627 111.996 111.996 111.997-111.996L496 360.54z"/><path fill="currentColor" d="M377.377 472.52h-32V196.426C345.377 114.584 278.794 48 196.952 48c-83.229 0-148.426 63.106-148.426 143.667h-32c0-48.024 18.85-92.569 53.079-125.429C103.35 33.842 148.576 16 196.952 16c99.487 0 180.425 80.938 180.425 180.426Z"/></svg>',DEFAULT_SORT_ASCENDING_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M390.624 150.625 256 16 121.376 150.625l22.628 22.627 95.997-95.998v417.982h32V77.257l95.995 95.995z"/></svg>',DEFAULT_SORT_DESCENDING_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="m367.997 338.75-95.998 95.997V17.503h-32v417.242l-95.996-95.995-22.627 22.627L256 496l134.624-134.623z"/></svg>',DEFAULT_SORT_NEUTRAL_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M384 433.373V160h-32v274.51l-69.823-69.823-22.627 22.626 107.882 107.883 107.881-107.883-22.626-22.626zM159.432 17.372 51.55 125.255l22.627 22.627L144 78.059V352h32V79.195l68.687 68.687 22.626-22.627z"/></svg>',PIN_PATH="m477.8 140.2-106-106a62.132 62.132 0 0 0-93.617 81.24l-4.913 5.533-97.654 42.9-42.611-23.026a24.04 24.04 0 0 0-28.86 4.638L62.6 189.487a23.88 23.88 0 0 0 .479 33.449l101.68 101.679L16 473.373V496h22.627l148.758-148.758L288.6 448.457a23.93 23.93 0 0 0 33.275.642l44.425-41.128a23.98 23.98 0 0 0 4.773-29.092l-23.344-42.858 42.131-90.515 8.6-10.318A62.134 62.134 0 0 0 477.8 140.2m-22.628 65.231a30.125 30.125 0 0 1-42.6 0l-16.885-16.886-33.08 39.678-50.7 108.933 28.087 51.566-34.209 31.669L91.2 205.806l32-33.89 50.969 27.543 118.386-52.008 29.177-32.863-15.158-15.161a30.126 30.126 0 0 1 42.6-42.6l106 106a30.126 30.126 0 0 1 0 42.6Z",SVG_512='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false">',DEFAULT_PIN_LEFT_ICON=`${SVG_512}<path fill="currentColor" d="${PIN_PATH}"/></svg>`,DEFAULT_PIN_RIGHT_ICON=`${SVG_512}<g transform="translate(512 0) scale(-1 1)"><path fill="currentColor" d="${PIN_PATH}"/></g></svg>`,DEFAULT_UNPIN_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="m427.314 107.313-22.628-22.626L256 233.373 107.314 84.687l-22.628 22.626L233.373 256 84.686 404.687l22.628 22.626L256 278.627l148.686 148.686 22.628-22.626L278.627 256z"/></svg>',DEFAULT_MOVE_LEFT_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M254.625 56h-38.632L16 256.2 216 456h38.623V336h144V176h-144Zm112 152v96h-144v113.384l-161.37-161.21 161.37-161.535V208Zm96-152h32v400h-32z"/></svg>',DEFAULT_MOVE_RIGHT_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M296.007 56h-38.632v120h-144v160h144v120H296l200-199.8Zm-6.632 361.384V304h-144v-96h144V94.639l161.37 161.535ZM17.375 56h32v400h-32z"/></svg>',DEFAULT_HIDE_COLUMN_ICON='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="m397.222 131.1-.218-.223c-63.173-63.17-158.534-75.015-233.776-35.531l23.938 23.939c61.571-27.691 136.573-16.327 187.105 34.115L464 246.683v3.107l-71.744 74.585 22.63 22.63L496 262.683V233.79Z"/><path fill="currentColor" d="M352.8 284.33a103.307 103.307 0 0 0-132.893-132.892L246.1 177.63a71.228 71.228 0 0 1 80.507 80.508Zm17.1 62.938-33.831-33.831c.088-.108.179-.212.266-.32l-22.805-22.806q-.126.168-.253.334l-99.681-99.681.334-.253-22.81-22.805c-.108.087-.213.179-.321.266L38.627 16H16v22.627l95.689 95.689L16 233.79v28.893l98.778 102.689.218.222A199.73 199.73 0 0 0 367.372 390l106 106H496v-22.627L392.537 369.911Zm-177.157-131.9 96.128 96.132a71.28 71.28 0 0 1-96.133-96.133Zm-55.014 127.705L48 249.79v-3.107l86.319-89.737 35.065 35.064a103.248 103.248 0 0 0 142.842 142.843l32.007 32.007c-64.51 40.015-150.522 32.095-206.504-23.787"/></svg>',DEFAULT_LABELS={addCondition:"Add condition",applyFilter:"Apply",clearFilter:"Clear filter",clearSort:"Unsort",columnMenu:"Column options for {column}",filterAction:"Filter…",filterColumn:"Filter {column}",firstPage:"First page",globalFilterLabel:"Search",globalFilterPlaceholder:"Search",hideColumn:"Hide column",itemsInfo:"{first}–{last} of {total}",joinAnd:"AND",joinOr:"OR",lastPage:"Last page",loadError:"Failed to load data",loading:"Loading…",moveLeft:"Move left",moveRight:"Move right",nextPage:"Next page",operatorBetween:"Between",operatorBlank:"Blank",operatorContains:"Contains",operatorEndsWith:"Ends with",operatorEquals:"Equals",operatorGreaterThan:"Greater than",operatorGreaterThanOrEqual:"Greater than or equal",operatorLessThan:"Less than",operatorLessThanOrEqual:"Less than or equal",operatorNotBlank:"Not blank",operatorNotContains:"Does not contain",operatorNotEquals:"Not equals",operatorStartsWith:"Starts with",pageSizeLabel:"Rows per page",paginationLabel:"Pagination",pinLeft:"Pin left",pinRight:"Pin right",previousPage:"Previous page",redoneAnnouncement:"Change redone",resetColumns:"Reset",resultsAnnouncement:"{count} results",searchValues:"Search values",selectAllRows:"Select all rows",selectAllValues:"Select all",selectRow:"Select row",showAllColumns:"Show all",sortAscending:"Sort ascending",sortDescending:"Sort descending",toolbarColumns:"Columns",toolbarExport:"Export",toolbarRedo:"Redo",toolbarUndo:"Undo",undoneAnnouncement:"Change undone",unpin:"Unpin"},interpolate=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),CLASS_LEFT="data-grid-cell-pinned-left",CLASS_RIGHT="data-grid-cell-pinned-right",CLASS_LEFT_LAST="data-grid-cell-pinned-left-last",CLASS_RIGHT_FIRST="data-grid-cell-pinned-right-first",applyPinnedCell=(e,t)=>{e.classList.remove(CLASS_LEFT,CLASS_RIGHT,CLASS_LEFT_LAST,CLASS_RIGHT_FIRST),e.style.left="",e.style.right="",t&&("left"===t.side?(e.classList.add(CLASS_LEFT),t.edge&&e.classList.add(CLASS_LEFT_LAST),e.style.left=t.afterSelect?`calc(var(--cui-data-grid-select-cell-width) + ${t.offset}px)`:`${t.offset}px`):(e.classList.add(CLASS_RIGHT),t.edge&&e.classList.add(CLASS_RIGHT_FIRST),e.style.right=`${t.offset}px`))},CLASS_NAME_EMPTY="data-grid-empty",FOCUSABLE_SELECTOR$1="a[href], button, input, select, textarea, [tabindex]",CLASS_NAME_ROW_ODD="data-grid-row-odd",CLASS_NAME_ROW_SELECTED="table-active",CLASS_NAME_SELECT_CELL$1="data-grid-select-cell",CLASS_NAME_SPACER="data-grid-spacer",setCellContent=(e,t,n)=>{"string"!=typeof t?1===e.childNodes.length&&e.firstChild===t||e.replaceChildren(t):e.innerHTML=n(t)},createBody=e=>{const t=document.createElement("tbody");let n=e.getVisibleColumns(),o=n.map(e=>e.key).join("|"),i=n.length+(e.selection?1:0);const l=t=>{t.replaceChildren(),e.cellNavigation&&t.setAttribute("role","row");const i=e.selection?1:0;if(e.selection){const n=document.createElement("td");n.classList.add("data-grid-select-cell");const o=document.createElement("input");o.type="checkbox",o.classList.add("form-check-input"),o.setAttribute("aria-label",e.labels.selectRow),o.dataset.coreuiRowSelect="",e.cellNavigation&&(n.setAttribute("role","gridcell"),n.setAttribute("aria-colindex","1"),o.tabIndex=-1),n.append(o),t.append(n)}for(const[o,l]of n.entries()){const n=document.createElement("td");e.cellNavigation&&(n.setAttribute("role","gridcell"),n.setAttribute("aria-colindex",String(i+o+1)),n.dataset.coreuiColumn=l.key,n.tabIndex=-1),t.append(n)}t.dataset.coreuiLayout=o},s=()=>{const e=document.createElement("tr");return l(e),e},r=(t,i,s)=>{var r;if(t.dataset.coreuiLayout!==o&&(l(t),delete t.dataset.coreuiRow),e.selection){const e=t.firstElementChild.firstElementChild,n=i.getIsSelected();e.checked=n,t.classList.toggle("table-active",n),t.setAttribute("aria-selected",String(n))}const a=`${e.getDataVersion()}:${i.id}`;if(t.dataset.coreuiRow===a&&t.dataset.coreuiIndex===String(s)||(((t,o,i)=>{const l=e.selection?1:0,s=e.getEditingCell();for(const[r,a]of n.entries()){const n=t.children[r+l];if(s&&s.rowId===o.id&&s.columnId===a.key){const t=e.getEditorElement();if(t){n.replaceChildren(t);continue}}if(a.render){if(setCellContent(n,a.render(o.original,i),e.sanitizeContent),e.cellNavigation)for(const e of n.querySelectorAll(FOCUSABLE_SELECTOR$1))e.tabIndex=-1;continue}const u=o.getValue(a.key);n.textContent=a.formatter?a.formatter(u,o.original):String(null!=u?u:"")}})(t,i,s),t.dataset.coreuiRow=a),t.dataset.coreuiIndex=String(s),t.setAttribute("aria-rowindex",String(e.headerRowCount+e.getRowIndexOffset()+s+1)),t.classList.toggle(CLASS_NAME_ROW_ODD,s%2==1),p){const o=p,i=e.selection?1:0;e.selection&&applyPinnedCell(t.children[0],o.select);for(const[e,l]of n.entries())applyPinnedCell(t.children[e+i],null!==(r=o.columns[l.key])&&void 0!==r?r:null)}},a=()=>{const e=document.createElement("tr");e.classList.add(CLASS_NAME_SPACER),e.setAttribute("aria-hidden","true");const t=document.createElement("td");return t.colSpan=Math.max(i,1),e.append(t),e},u=(e,t)=>{e.style.height=`${t}px`,e.firstElementChild.style.height=`${t}px`,e.style.display=t>0?"":"none"},d=a(),c=a();let g=!1,h=null,m=[],p=null;const f=[];let _=null;return{element:t,update(){const l=e.getRows();p=e.getPinning();const a=e.getEditingCell(),v=a?`${a.rowId}:${a.columnId}`:null;if(v!==_){_=v;for(const e of m)delete e.dataset.coreuiRow}const E=e.getVisibleColumns(),S=E.map(e=>e.key).join("|");if(S!==o&&(n=E,o=S,i=n.length+(e.selection?1:0),d.firstElementChild.colSpan=Math.max(i,1),c.firstElementChild.colSpan=Math.max(i,1)),0===l.length)return void(()=>{g=!1,f.push(...m),m=[],h||(h=document.createElement("tr"),h.classList.add(CLASS_NAME_EMPTY),h.append(document.createElement("td")));const n=h.firstElementChild;n.colSpan=Math.max(i,1),setCellContent(n,e.renderEmpty(),e.sanitizeContent),t.replaceChildren(h)})();const b=e.getVirtualizer();b?((e,n)=>{var o;g||(t.replaceChildren(d,c),g=!0,m=[]);const i=n.getVirtualItems(),l=n.getTotalSize(),a=i.length>0?i[0].start:0,h=i.length>0?l-i[i.length-1].end:l;for(u(d,a),u(c,h);m.length>i.length;){const e=m.pop();e.remove(),f.push(e)}for(;m.length<i.length;){const e=null!==(o=f.pop())&&void 0!==o?o:s();c.before(e),m.push(e)}for(const[t,n]of i.entries())r(m[t],e[n.index],n.index)})(l,b):(e=>{var n;for(h&&h.remove();m.length>e.length;){const e=m.pop();e.remove(),f.push(e)}for(;m.length<e.length;){const e=null!==(n=f.pop())&&void 0!==n?n:s();t.append(e),m.push(e)}for(const[t,n]of e.entries())r(m[t],n,t)})(l)}}},CLASS_NAME_EDITOR="data-grid-cell-editor",createTextEditor=e=>{var t;const n=document.createElement("input");return n.type="text",n.classList.add("form-control","form-control-sm",CLASS_NAME_EDITOR),n.value=String(null!==(t=e.value)&&void 0!==t?t:""),{element:n,focus(){n.focus(),n.select()},getValue:()=>n.value}},createNumberEditor=(e,t)=>{const n=document.createElement("input");return n.type="number",n.classList.add("form-control","form-control-sm",CLASS_NAME_EDITOR),void 0!==t.min&&(n.min=String(t.min)),void 0!==t.max&&(n.max=String(t.max)),void 0!==t.step&&(n.step=String(t.step)),n.value=void 0===e.value||null===e.value?"":String(e.value),{element:n,focus(){n.focus(),n.select()},getValue:()=>""===n.value?void 0:Number(n.value)}},createSelectEditor=(e,t)=>{var n;const o=document.createElement("select");o.classList.add("form-select","form-select-sm",CLASS_NAME_EDITOR);const i=[];for(const l of null!==(n=t.options)&&void 0!==n?n:[]){const t=document.createElement("option"),n="object"==typeof l&&null!==l?l.value:l;t.textContent="object"==typeof l&&null!==l?l.label:String(l),t.value=String(i.length),n===e.value&&(t.selected=!0),i.push(n),o.append(t)}return{element:o,focus:()=>o.focus(),getValue:()=>i[Number(o.value)]}},createBuiltInEditor=(e,t)=>"number"===e.type?createNumberEditor(t,e):"select"===e.type?createSelectEditor(t,e):createTextEditor(t),CLASS_NAME_HEADER="data-grid-header",CLASS_NAME_HEADER_CELL="data-grid-header-cell",CLASS_NAME_HEADER_LABEL="data-grid-header-label",CLASS_NAME_FILTER_ROW="data-grid-filter-row",CLASS_NAME_RESIZER="data-grid-resizer",CLASS_NAME_RESIZER_ACTIVE="data-grid-resizer-active",CLASS_NAME_SELECT_CELL="data-grid-select-cell",CLASS_NAME_SORTABLE="data-grid-sortable",CLASS_NAME_SORT_BUTTON="data-grid-sort-button",CLASS_NAME_SORT_ICON="data-grid-sort-icon",sortDirection=e=>e?e.desc?"descending":"ascending":"neutral",iconForDirection=(e,t)=>"ascending"===e?t.sortAscending:"descending"===e?t.sortDescending:t.sortNeutral,createSelectAllCell=e=>{const t=document.createElement("th");if(t.classList.add(CLASS_NAME_SELECT_CELL),t.setAttribute("scope","col"),!e.selectAll)return{cell:t,input:null};const n=document.createElement("input");return n.type="checkbox",n.classList.add("form-check-input"),n.setAttribute("aria-label",e.labels.selectAllRows),n.dataset.coreuiSelectAll="",t.append(n),{cell:t,input:n}},createResizer=()=>{const e=document.createElement("span");return e.classList.add(CLASS_NAME_RESIZER),e.setAttribute("aria-hidden","true"),e.dataset.coreuiResizer="",e},createLabelRow=(e,t,n,o)=>{var i,l,s,r;const a=document.createElement("tr");let u=null,d=null;if(e.cellNavigation&&a.setAttribute("role","row"),e.selection){const{cell:t,input:n}=createSelectAllCell(e);u=n,d=t,e.cellNavigation&&(t.setAttribute("role","columnheader"),n&&(n.tabIndex=-1)),a.append(t)}for(const u of e.columns){const d=document.createElement("th");d.setAttribute("scope","col"),d.dataset.coreuiColumn=u.key,e.cellNavigation&&(d.setAttribute("role","columnheader"),d.tabIndex=-1),u.style&&Object.assign(d.style,u.style),void 0!==u.width&&(d.style.width=`${u.width}px`);const c=document.createElement("div");if(c.classList.add(CLASS_NAME_HEADER_CELL),e.isSortable(u)){d.classList.add(CLASS_NAME_SORTABLE);const t=document.createElement("button");t.type="button",t.classList.add(CLASS_NAME_SORT_BUTTON),t.append(null!==(i=u.label)&&void 0!==i?i:u.key);const n=document.createElement("span");n.classList.add(CLASS_NAME_SORT_ICON),n.setAttribute("aria-hidden","true"),n.innerHTML=e.icons.sortNeutral,n.dataset.coreuiSort="neutral",t.append(n),o.set(u.key,n),c.append(t)}else{const e=document.createElement("span");e.classList.add(CLASS_NAME_HEADER_LABEL),e.textContent=null!==(l=u.label)&&void 0!==l?l:u.key,c.append(e)}if(e.hasFilterMenu(u)){const t=document.createElement("button");t.type="button",t.classList.add("btn","btn-ghost","btn-sm","data-grid-filter-button"),t.innerHTML=e.icons.filter,t.dataset.coreuiFilter=u.key,t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false");const n=interpolate(e.labels.filterColumn,{column:null!==(s=u.label)&&void 0!==s?s:u.key});t.setAttribute("aria-label",n),t.setAttribute("data-coreui-tooltip",n),c.append(t)}if(e.hasMenu(u)){const t=document.createElement("button");t.type="button",t.classList.add("btn","btn-ghost","btn-sm","data-grid-menu-button"),t.innerHTML=e.icons.columnMenu,t.dataset.coreuiMenu=u.key,t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","false");const n=interpolate(e.labels.columnMenu,{column:null!==(r=u.label)&&void 0!==r?r:u.key});t.setAttribute("aria-label",n),t.setAttribute("data-coreui-tooltip",n),c.append(t)}if(d.append(c),e.cellNavigation)for(const e of c.querySelectorAll("button"))e.tabIndex=-1;if(e.resizable&&e.isResizable(u)){const e=createResizer();n.set(u.key,e),d.append(e)}t.set(u.key,d),a.append(d)}return{row:a,selectAllInput:u,selectCell:d}},createFilterRow=(e,t,n)=>{const o=document.createElement("tr");o.classList.add(CLASS_NAME_FILTER_ROW),e.cellNavigation&&o.setAttribute("role","row");let i=null;e.selection&&(i=document.createElement("th"),o.append(i));for(const i of e.columns){const l=document.createElement("th"),s=e.table.getColumn(i.key);if(e.isFilterable(i)&&i.filter&&s){const t=i.filter({column:s,table:e.table,labels:e.labels});n.push(t),l.append(t.element)}t.set(i.key,l),o.append(l)}return{row:o,selectCell:i}},createHeader=e=>{const t=document.createElement("thead");t.classList.add(CLASS_NAME_HEADER);const n=new Map,o=new Map,i=new Map,l=new Map,s=[],r=new Map(e.columns.map(e=>[e.key,!1!==e.movable])),{row:a,selectAllInput:u,selectCell:d}=createLabelRow(e,n,o,i);t.append(a);let c=null,g=null;if(e.filterRow){const n=createFilterRow(e,l,s);g=n.selectCell,c=n.row,t.append(n.row)}let h=null;return{element:t,rowCount:e.filterRow?2:1,update(t){var m,p,f,_,v,E;const S=t.order.join("|");S!==h&&(h=S,(t=>{const o=new Set(t),i=(n,i,l)=>{const s=l?[l]:[];for(const e of t){const t=i.get(e);t&&s.push(t)}if(n.append(...s),e.cellNavigation)for(const[e,t]of s.entries())t.setAttribute("aria-colindex",String(e+1));for(const[e,t]of i)o.has(e)||t.remove()};i(a,n,d),c&&i(c,l,g)})(t.order));for(const[o,l]of n){const n=t.sorting.find(e=>e.id===o),s=sortDirection(n);"neutral"===s?l.removeAttribute("aria-sort"):l.setAttribute("aria-sort",s);const r=i.get(o);r&&r.dataset.coreuiSort!==s&&(r.dataset.coreuiSort=s,r.innerHTML=iconForDirection(s,e.icons)),t.sizes&&void 0!==t.sizes[o]&&(l.style.width=`${t.sizes[o]}px`),t.pinning&&applyPinnedCell(l,null!==(m=t.pinning.columns[o])&&void 0!==m?m:null)}if(e.draggable){const e=e=>{var n,o,i;return null!==(i=null===(o=null===(n=t.pinning)||void 0===n?void 0:n.columns[e])||void 0===o?void 0:o.side)&&void 0!==i?i:"center"},o=new Map;for(const n of t.order)if(r.get(n)){const t=e(n);o.set(t,(null!==(p=o.get(t))&&void 0!==p?p:0)+1)}for(const[t,i]of n){const n=Boolean(r.get(t))&&(null!==(f=o.get(e(t)))&&void 0!==f?f:0)>1;i.draggable=n,n?i.dataset.coreuiDraggable="":delete i.dataset.coreuiDraggable}}for(const[e,n]of o)n.classList.toggle(CLASS_NAME_RESIZER_ACTIVE,t.resizingColumn===e);if(t.filteredColumns)for(const[e,o]of n)null===(_=o.querySelector("[data-coreui-filter]"))||void 0===_||_.classList.toggle("data-grid-filter-button-filtered",t.filteredColumns.includes(e));if(t.pinning){for(const[e,n]of l)applyPinnedCell(n,null!==(v=t.pinning.columns[e])&&void 0!==v?v:null);d&&applyPinnedCell(d,t.pinning.select),g&&applyPinnedCell(g,t.pinning.select)}u&&t.selectAll&&(u.checked=t.selectAll.checked,u.indeterminate=t.selectAll.indeterminate);for(const e of s)null===(E=e.update)||void 0===E||E.call(e)},dispose(){var e;for(const t of s)null===(e=t.dispose)||void 0===e||e.call(t)}}},CLASS_NAME_LOADING="data-grid-loading",createLoading=e=>{const t=document.createElement("div");t.classList.add(CLASS_NAME_LOADING),t.hidden=!0;const n=document.createElement("div");n.classList.add("spinner-border"),n.setAttribute("role","status");const o=document.createElement("span");return o.classList.add("visually-hidden"),o.textContent=e.loading,n.append(o),t.append(n),{element:t,setVisible(e){t.hidden=!e}}},CLASS_NAME_FILTER_MENU="data-grid-filter-menu",CLASS_NAME_CONDITION="data-grid-filter-menu-condition",CLASS_NAME_JOIN="data-grid-filter-menu-join",CLASS_NAME_FOOTER$1="data-grid-filter-menu-footer",CLASS_NAME_VALUES="data-grid-filter-menu-values",SEARCH_THRESHOLD=10,MAX_CONDITIONS=2,OPERATOR_LABEL_KEYS={contains:"operatorContains",notContains:"operatorNotContains",equals:"operatorEquals",notEquals:"operatorNotEquals",startsWith:"operatorStartsWith",endsWith:"operatorEndsWith",blank:"operatorBlank",notBlank:"operatorNotBlank",greaterThan:"operatorGreaterThan",greaterThanOrEqual:"operatorGreaterThanOrEqual",lessThan:"operatorLessThan",lessThanOrEqual:"operatorLessThanOrEqual",between:"operatorBetween"};let filterMenuCount=0;const inputTypeFor=e=>"number"===e?"number":"date"===e?"date":"text",createFilterMenu=e=>{const t=document.createElement("div");t.classList.add(CLASS_NAME_FILTER_MENU),t.setAttribute("role","dialog"),t.id="data-grid-filter-menu-"+ ++filterMenuCount;let n=null;const o=(e=!1)=>{n&&(n.setAttribute("aria-expanded","false"),n.removeAttribute("aria-controls"),e&&n.focus(),n=null,t.remove(),document.removeEventListener("pointerdown",i,!0),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l))},i=e=>{const i=e.target;t.contains(i)||(null==n?void 0:n.contains(i))||o()},l=e=>{(null==e?void 0:e.target)instanceof Node&&t.contains(e.target)||o()},s=e=>{"Escape"===e.key&&(e.stopPropagation(),o(!0))};t.addEventListener("keydown",s);const r=(t,n)=>{var o;const i=document.createElement("div");i.classList.add(CLASS_NAME_CONDITION);const l=document.createElement("select");l.classList.add("form-select","form-select-sm"),l.setAttribute("aria-label",e.labels.filterAction);for(const n of FILTER_OPERATORS[t]){const t=document.createElement("option");t.value=n,t.textContent=e.labels[OPERATOR_LABEL_KEYS[n]],l.append(t)}l.value=null!==(o=null==n?void 0:n.operator)&&void 0!==o?o:FILTER_OPERATORS[t][0];const s=document.createElement("input");s.type=inputTypeFor(t),s.classList.add("form-control","form-control-sm"),s.dataset.coreuiFilterValue="",s.value=void 0===(null==n?void 0:n.value)?"":String(n.value);const r=document.createElement("input");r.type=inputTypeFor(t),r.classList.add("form-control","form-control-sm"),r.dataset.coreuiFilterValue2="",r.value=void 0===(null==n?void 0:n.value2)?"":String(n.value2);const a=()=>{const e=l.value;s.hidden=VALUELESS_OPERATORS.has(e),r.hidden="between"!==e};return l.addEventListener("change",a),i.append(l,s,r),a(),i},a=(t,n)=>{const i=document.createElement("div");i.classList.add(CLASS_NAME_FOOTER$1);const l=document.createElement("button");l.type="button",l.classList.add("btn","btn-primary","btn-sm"),l.textContent=e.labels.applyFilter,l.addEventListener("click",t);const s=document.createElement("button");return s.type="button",s.classList.add("btn","btn-outline-secondary","btn-sm"),s.textContent=e.labels.clearFilter,s.addEventListener("click",()=>{e.applyFilter(n),o(!0)}),i.append(l,s),i},u=(s,u)=>{var d,c,g;o();const h=e.getColumn(u);if(!h)return;t.setAttribute("aria-label",interpolate(e.labels.filterColumn,{column:null!==(d=h.label)&&void 0!==d?d:h.key}));const m=null!==(c=h.filterType)&&void 0!==c?c:"text";t.replaceChildren("select"===m?(t=>{const n=e.getFacetedValues(t),i=e.getFilterValue(t),l=i&&"string"!=typeof i&&"operator"in i?new Set(i.value.map(String)):null,s=document.createElement("div"),r=document.createElement("div");r.classList.add(CLASS_NAME_VALUES);const u=[],d=(e,t)=>{const n=document.createElement("label");n.classList.add("form-check");const o=document.createElement("input");o.type="checkbox",o.classList.add("form-check-input"),o.checked=t;const i=document.createElement("span");return i.classList.add("form-check-label"),i.textContent=e,n.append(o,i),r.append(n),o},c=d(e.labels.selectAllValues,null===l);c.dataset.coreuiSelectAllValues="";for(const e of n){const t=d(String(e),null===l||l.has(String(e)));t.dataset.coreuiFilterOption=String(e),u.push(t)}const g=()=>{c.checked=u.every(e=>e.checked)};if(c.addEventListener("change",()=>{for(const e of u)e.checked=c.checked}),r.addEventListener("change",e=>{e.target!==c&&g()}),g(),n.length>10){const t=document.createElement("input");t.type="text",t.classList.add("form-control","form-control-sm"),t.setAttribute("aria-label",e.labels.searchValues),t.placeholder=e.labels.searchValues,t.addEventListener("input",()=>{const e=t.value.toLowerCase();for(const t of u)t.closest("label").hidden=!t.dataset.coreuiFilterOption.toLowerCase().includes(e)}),s.append(t)}return s.append(r),s.append(a(()=>{const n=u.filter(e=>e.checked);e.applyFilter(t,n.length===u.length?void 0:{operator:"in",value:n.map(e=>e.dataset.coreuiFilterOption)}),o(!0)},t)),s})(u):((n,i)=>{var l;const s=e.getFilterValue(n),u=s&&"string"!=typeof s&&"conditions"in s?s.conditions:[],d=s&&"string"!=typeof s&&"conditions"in s?s.join:"and",c=[r(i,null!==(l=u[0])&&void 0!==l?l:null)],g=document.createElement("div");g.append(c[0]);const h=document.createElement("div");h.classList.add(CLASS_NAME_JOIN);const m=`${t.id}-join`;for(const t of["and","or"]){const n=document.createElement("label"),o=document.createElement("input");o.type="radio",o.classList.add("form-check-input"),o.name=m,o.value=t,o.checked=d===t,n.append(o,` ${"and"===t?e.labels.joinAnd:e.labels.joinOr}`),h.append(n)}const p=document.createElement("button");p.type="button",p.classList.add("btn","btn-link","btn-sm"),p.textContent=e.labels.addCondition;const f=()=>{var e;c.length>=2||(c.push(r(i,null!==(e=u[1])&&void 0!==e?e:null)),p.before(h,c[1]),p.hidden=!0)};return p.addEventListener("click",f),g.append(p),u.length>1&&f(),g.append(a(()=>{var t,i;const l=c.map(e=>(e=>{const t=e.querySelector("select").value,{value:n}=e.querySelector("[data-coreui-filter-value]"),o=e.querySelector("[data-coreui-filter-value2]").value;return VALUELESS_OPERATORS.has(t)?{operator:t}:""===n.trim()?null:{operator:t,value:n,..."between"===t&&""!==o.trim()&&{value2:o}}})(e)).filter(e=>null!==e),s=null!==(i=null===(t=h.querySelector("input:checked"))||void 0===t?void 0:t.value)&&void 0!==i?i:"and";e.applyFilter(n,0===l.length?void 0:{conditions:l,join:s}),o(!0)},n)),g})(u,m)),n=s,s.setAttribute("aria-expanded","true"),s.setAttribute("aria-controls",t.id),e.root.append(t);const p=e.root.getBoundingClientRect(),f=s.getBoundingClientRect();t.style.top=f.bottom-p.top+"px",t.style.left=`${Math.max(f.right-p.left-t.offsetWidth,0)}px`,document.addEventListener("pointerdown",i,!0),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),null===(g=t.querySelector("select, input"))||void 0===g||g.focus()};return{toggle(e,t){n!==e?(o(),u(e,t)):o(!0)},close(){o()},dispose(){o(),t.removeEventListener("keydown",s)}}},CLASS_NAME_MENU="data-grid-menu",CLASS_NAME_MENU_ITEM="data-grid-menu-item",CLASS_NAME_MENU_ITEM_ICON="data-grid-menu-item-icon",CLASS_NAME_MENU_DIVIDER="data-grid-menu-divider";let menuCount=0;const createMenu=e=>{const t=document.createElement("div");t.classList.add(CLASS_NAME_MENU),t.setAttribute("role","menu"),t.id="data-grid-menu-"+ ++menuCount;let n=null;const o=()=>[...t.querySelectorAll(`.${CLASS_NAME_MENU_ITEM}`)],i=(e=!1)=>{n&&(n.setAttribute("aria-expanded","false"),n.removeAttribute("aria-controls"),e&&n.focus(),n=null,t.remove(),document.removeEventListener("pointerdown",l,!0),window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s))},l=e=>{const o=e.target;t.contains(o)||(null==n?void 0:n.contains(o))||i()},s=e=>{(null==e?void 0:e.target)instanceof Node&&t.contains(e.target)||i()},r=e=>{var t,n,l,s;const r=o(),a=r.indexOf(document.activeElement);switch(e.key){case"Escape":e.stopPropagation(),i(!0);break;case"Tab":i();break;case"ArrowDown":e.preventDefault(),null===(t=r[(a+1)%r.length])||void 0===t||t.focus();break;case"ArrowUp":e.preventDefault(),null===(n=r[(a-1+r.length)%r.length])||void 0===n||n.focus();break;case"Home":e.preventDefault(),null===(l=r[0])||void 0===l||l.focus();break;case"End":e.preventDefault(),null===(s=r[r.length-1])||void 0===s||s.focus()}};return t.addEventListener("keydown",r),{toggle(r,a){n!==r?(i(),((r,a)=>{var u;const d=e.getActions(a);if(0===d.length)return;const c=[];for(const[t,o]of d.entries()){if(t>0&&o.group!==d[t-1].group){const e=document.createElement("div");e.classList.add(CLASS_NAME_MENU_DIVIDER),e.setAttribute("role","separator"),c.push(e)}const l=document.createElement("button");if(l.type="button",l.classList.add(CLASS_NAME_MENU_ITEM),l.setAttribute("role","menuitem"),o.icon){const e=document.createElement("span");e.classList.add(CLASS_NAME_MENU_ITEM_ICON),e.setAttribute("aria-hidden","true"),e.innerHTML=o.icon,l.append(e)}l.append(o.label),o.disabled&&l.setAttribute("aria-disabled","true"),l.addEventListener("click",()=>{if(o.disabled)return;const t=n;i(),o.run(),requestAnimationFrame(()=>{var n;const o=document.activeElement;o&&o!==document.body&&e.root.contains(o)||((null==t?void 0:t.isConnected)?t.focus():null===(n=e.root.querySelector("[data-coreui-menu]"))||void 0===n||n.focus())})}),c.push(l)}t.replaceChildren(...c),n=r,r.setAttribute("aria-expanded","true"),r.setAttribute("aria-controls",t.id),e.root.append(t);const g=e.root.getBoundingClientRect(),h=r.getBoundingClientRect();t.style.top=h.bottom-g.top+"px",t.style.left=`${Math.max(h.right-g.left-t.offsetWidth,0)}px`,document.addEventListener("pointerdown",l,!0),window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),null===(u=o()[0])||void 0===u||u.focus()})(r,a)):i(!0)},close(){i()},dispose(){i(),t.removeEventListener("keydown",r)}}},CLASS_NAME_PAGINATION="data-grid-pagination",CLASS_NAME_PAGINATION_INFO="data-grid-pagination-info",PAGE_WINDOW=5,createPageItem=(e,t,n={})=>{const o=document.createElement("li");o.classList.add("page-item"),n.active&&(o.classList.add("active"),o.setAttribute("aria-current","page")),n.disabled&&o.classList.add("disabled");const i=document.createElement("button");return i.type="button",i.classList.add("page-link"),i.textContent=e,i.disabled=Boolean(n.disabled),i.dataset.coreuiPage=t,n.ariaLabel&&i.setAttribute("aria-label",n.ariaLabel),o.append(i),o},createPagination=e=>{const t=document.createElement("div");t.classList.add(CLASS_NAME_PAGINATION);const n=document.createElement("nav");n.setAttribute("aria-label",e.labels.paginationLabel);const o=document.createElement("ul");o.classList.add("pagination","pagination-sm"),n.append(o);const i=!1===e.info?null:document.createElement("span");i&&i.classList.add(CLASS_NAME_PAGINATION_INFO);const l=document.createElement("select");l.classList.add("form-select","form-select-sm"),l.setAttribute("aria-label",e.labels.pageSizeLabel),l.dataset.coreuiPageSize="";for(const t of e.pageSizeOptions){const e=document.createElement("option");e.value=String(t),e.textContent=String(t),l.append(e)}return t.append(n,...i?[i]:[],l),{element:t,update(t){var n;const s=Math.max(t.pageCount-1,0),r=Math.max(Math.min(t.pageIndex-Math.floor(2.5),t.pageCount-5),0),a=0===t.pageCount?-1:Math.min(r+5-1,s),u=[createPageItem("«","first",{ariaLabel:e.labels.firstPage,disabled:0===t.pageIndex}),createPageItem("‹","prev",{ariaLabel:e.labels.previousPage,disabled:0===t.pageIndex})];for(let e=r;e<=a;e++)u.push(createPageItem(String(e+1),String(e),{active:e===t.pageIndex}));if(u.push(createPageItem("›","next",{ariaLabel:e.labels.nextPage,disabled:t.pageIndex>=s}),createPageItem("»","last",{ariaLabel:e.labels.lastPage,disabled:t.pageIndex>=s})),o.replaceChildren(...u),i)if("function"==typeof e.info)i.textContent=e.info(t);else{const n=0===t.totalRows?0:t.pageIndex*t.pageSize+1,o=Math.min((t.pageIndex+1)*t.pageSize,t.totalRows);i.textContent=interpolate(e.labels.itemsInfo,{first:n,last:o,total:t.totalRows})}if(![...l.options].some(e=>e.value===String(t.pageSize))){const e=document.createElement("option");e.value=String(t.pageSize),e.textContent=String(t.pageSize),l.insertBefore(e,null!==(n=[...l.options].find(e=>Number(e.value)>t.pageSize))&&void 0!==n?n:null)}l.value=String(t.pageSize)}}},CLASS_NAME_COLUMN_CHOOSER="data-grid-column-chooser",CLASS_NAME_OPTION="data-grid-column-chooser-option",CLASS_NAME_FOOTER="data-grid-column-chooser-footer";let columnChooserCount=0;const createColumnChooser=e=>{const t=document.createElement("div");t.classList.add(CLASS_NAME_COLUMN_CHOOSER),t.setAttribute("role","dialog"),t.setAttribute("aria-label",e.labels.toolbarColumns),t.id="data-grid-column-chooser-"+ ++columnChooserCount;let n=null;const o=(e=!1)=>{n&&(n.setAttribute("aria-expanded","false"),n.removeAttribute("aria-controls"),e&&n.focus(),n=null,t.remove(),document.removeEventListener("pointerdown",i,!0),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l))},i=e=>{const i=e.target;t.contains(i)||(null==n?void 0:n.contains(i))||o()},l=e=>{(null==e?void 0:e.target)instanceof Node&&t.contains(e.target)||o()},s=e=>{"Escape"===e.key&&(e.stopPropagation(),o(!0))};t.addEventListener("keydown",s);const r=()=>{const n=document.createElement("div");for(const t of e.getColumns()){const o=document.createElement("label");o.classList.add("form-check",CLASS_NAME_OPTION);const i=document.createElement("input");i.type="checkbox",i.classList.add("form-check-input"),i.checked=t.visible,i.dataset.coreuiColumnChooserOption=t.id,t.canHide||(i.disabled=!0,i.setAttribute("aria-disabled","true")),i.addEventListener("change",()=>{e.toggleVisibility(t.id,i.checked)});const l=document.createElement("span");l.classList.add("form-check-label"),l.textContent=t.label,o.append(i,l),n.append(o)}const o=document.createElement("div");o.classList.add(CLASS_NAME_FOOTER);const i=document.createElement("button");i.type="button",i.classList.add("btn","btn-link","btn-sm"),i.textContent=e.labels.showAllColumns,i.dataset.coreuiColumnChooserShowAll="",i.addEventListener("click",()=>{e.showAll(),t.replaceChildren(r())});const l=document.createElement("button");l.type="button",l.classList.add("btn","btn-link","btn-sm"),l.textContent=e.labels.resetColumns,l.dataset.coreuiColumnChooserReset="",l.addEventListener("click",()=>{e.reset(),t.replaceChildren(r())}),o.append(i,l);const s=document.createDocumentFragment();return s.append(n,o),s};return{toggle(s){n!==s?(o(),(s=>{var a;o(),t.replaceChildren(r()),n=s,s.setAttribute("aria-expanded","true"),s.setAttribute("aria-controls",t.id),e.root.append(t);const u=e.root.getBoundingClientRect(),d=s.getBoundingClientRect();t.style.top=d.bottom-u.top+"px",t.style.left=`${Math.max(d.left-u.left,0)}px`,document.addEventListener("pointerdown",i,!0),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),null===(a=t.querySelector("input:not(:disabled)"))||void 0===a||a.focus()})(s)):o(!0)},close(){o()},dispose(){o(),t.removeEventListener("keydown",s)}}},CLASS_NAME_TOOLTIP="data-grid-tooltip",ATTRIBUTE="data-coreui-tooltip",SELECTOR=`[${ATTRIBUTE}]`,SHOW_DELAY=200,GAP=6,EDGE=4,createTooltip=e=>{const t=document.createElement("div");t.className=CLASS_NAME_TOOLTIP,t.setAttribute("role","tooltip"),t.setAttribute("aria-hidden","true"),t.hidden=!0,e.append(t);let n,o=null;const i=e=>{const t=e instanceof Element?e.closest(SELECTOR):null;return t instanceof HTMLElement&&t.getAttribute(ATTRIBUTE)?t:null},l=e=>{o=e,t.textContent=e.getAttribute(ATTRIBUTE),t.style.visibility="hidden",t.hidden=!1,(()=>{if(!o)return;const e=o.getBoundingClientRect(),n=t.offsetWidth,i=t.offsetHeight,l=e.top-i-6,s=l>=0?l:e.bottom+6,r=Math.max(4,Math.min(e.left+(e.width-n)/2,window.innerWidth-n-4));t.style.top=`${s}px`,t.style.left=`${r}px`,t.style.visibility="visible"})()},s=()=>{clearTimeout(n),o=null,t.hidden=!0},r=e=>{const t=i(e.target);t&&t!==o&&(clearTimeout(n),n=setTimeout(()=>l(t),200))},a=e=>{o&&e.relatedTarget instanceof Node&&o.contains(e.relatedTarget)||s()},u=e=>{const t=i(e.target);t&&l(t)};return e.addEventListener("pointerover",r),e.addEventListener("pointerout",a),e.addEventListener("pointerdown",s),e.addEventListener("focusin",u),e.addEventListener("focusout",s),window.addEventListener("scroll",s,!0),{dispose(){clearTimeout(n),e.removeEventListener("pointerover",r),e.removeEventListener("pointerout",a),e.removeEventListener("pointerdown",s),e.removeEventListener("focusin",u),e.removeEventListener("focusout",s),window.removeEventListener("scroll",s,!0),t.remove()}}},escapeField=(e,t)=>/["\r\n]/.test(e)||e.includes(t)?`"${e.replace(/"/g,'""')}"`:e,sanitizeField=e=>/^[=+\-@\t\r]/.test(e)?`'${e}`:e,rowsFor=(e,t)=>"all"===t?e.getCoreRowModel().rows:"selected"===t?e.getSelectedRowModel().rows:e.getSortedRowModel().rows,exportCsv=(e,t={})=>{var n;const o=null!==(n=t.delimiter)&&void 0!==n?n:",",i=[...e.getLeftVisibleLeafColumns(),...e.getCenterVisibleLeafColumns(),...e.getRightVisibleLeafColumns()],l=e=>escapeField(t.sanitize?sanitizeField(e):e,o),s=e=>e.map(l).join(o),r=s(i.map(e=>{var t,n;return String(null!==(n=null===(t=e.columnDef.meta)||void 0===t?void 0:t.label)&&void 0!==n?n:e.id)})),a=rowsFor(e,t.scope).map(e=>s(i.map(t=>{var n;const o=e.getValue(t.id),i=t.columnDef.meta;return(null==i?void 0:i.formatter)?String(null!==(n=i.formatter(o,e.original))&&void 0!==n?n:""):String(null!=o?o:"")}))),u=[r,...a].join("\r\n");return t.bom?`\ufeff${u}`:u},downloadCsv=(e,t={})=>{var n;const o=new Blob([exportCsv(e,t)],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(o),l=document.createElement("a");l.href=i,l.download=null!==(n=t.filename)&&void 0!==n?n:"export.csv",l.style.display="none",document.body.append(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(i))},debounce=(e,t)=>{let n;return(...o)=>{clearTimeout(n),n=setTimeout(()=>e(...o),t)}},ARIA_ATTRIBUTE_PATTERN=/^aria-[\w-]*$/i,DefaultAllowlist={"*":["class","dir","id","lang","role",ARIA_ATTRIBUTE_PATTERN],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},SVGAllowlist={...DefaultAllowlist,svg:["xmlns","version","baseprofile","width","height","viewbox","preserveaspectratio","aria-hidden","role","focusable","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin"],g:["id","class","transform","style"],path:["id","class","d","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity"],circle:["id","class","cx","cy","r","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],rect:["id","class","x","y","width","height","rx","ry","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],ellipse:["id","class","cx","cy","rx","ry","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],line:["id","class","x1","y1","x2","y2","stroke","stroke-width","stroke-linecap","stroke-opacity"],polygon:["id","class","points","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],polyline:["id","class","points","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],text:["id","class","x","y","dx","dy","text-anchor","font-family","font-size","font-weight","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],tspan:["id","class","x","y","dx","dy","text-anchor","font-family","font-size","font-weight","fill","fill-opacity","stroke","stroke-width","stroke-opacity"],defs:[],symbol:["id","class","viewbox","preserveaspectratio"],use:["id","class","x","y","width","height","href"],image:["id","class","x","y","width","height","href","preserveaspectratio","xlink:href"],pattern:["id","class","x","y","width","height","patternunits","patterncontentunits","patterntransform","preserveaspectratio"],lineargradient:["id","class","gradientunits","x1","y1","x2","y2","spreadmethod","gradienttransform"],radialgradient:["id","class","gradientunits","cx","cy","r","fx","fy","spreadmethod","gradienttransform"],mask:["id","class","x","y","width","height","maskunits","maskcontentunits","masktransform"],clippath:["id","class","clippathunits"],marker:["id","class","markerunits","markerwidth","markerheight","orient","preserveaspectratio","viewbox","refx","refy"],title:[],desc:[]},uriAttributes=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),SAFE_URL_PATTERN=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,allowedAttribute=(e,t)=>{const n=e.nodeName.toLowerCase();return t.includes(n)?!uriAttributes.has(n)||Boolean(SAFE_URL_PATTERN.test(e.nodeValue)):t.filter(e=>e instanceof RegExp).some(e=>e.test(n))};function sanitizeHtml(e,t,n){if(!e.length)return e;if(n&&"function"==typeof n)return n(e);const o=(new window.DOMParser).parseFromString(e,"text/html"),i=[].concat(...o.body.querySelectorAll("*"));for(const e of i){const n=e.nodeName.toLowerCase();if(!Object.keys(t).includes(n)){e.remove();continue}const o=[].concat(...e.attributes),i=[].concat(t["*"]||[],t[n]||[]);for(const t of o)allowedAttribute(t,i)||e.removeAttribute(t.nodeName)}return o.body.innerHTML}const NAME="data-grid",DATA_KEY="coreui.data-grid",EVENT_KEY=`.${DATA_KEY}`,EVENT_CHANGE=`change${EVENT_KEY}`,EVENT_CLICK=`click${EVENT_KEY}`,EVENT_DATA_ERROR=`dataError${EVENT_KEY}`,EVENT_DATA_LOAD=`dataLoad${EVENT_KEY}`,EVENT_DBLCLICK=`dblclick${EVENT_KEY}`,EVENT_EDIT_CANCEL=`editCancel${EVENT_KEY}`,EVENT_EDIT_COMMIT=`editCommit${EVENT_KEY}`,EVENT_EDIT_START=`editStart${EVENT_KEY}`,EVENT_FILTER_CHANGE=`filterChange${EVENT_KEY}`,EVENT_INPUT=`input${EVENT_KEY}`,EVENT_ORDER_CHANGE=`orderChange${EVENT_KEY}`,EVENT_PAGINATION_CHANGE=`paginationChange${EVENT_KEY}`,EVENT_PINNING_CHANGE=`pinningChange${EVENT_KEY}`,EVENT_SELECTION_CHANGE=`selectionChange${EVENT_KEY}`,EVENT_SIZING_CHANGE=`sizingChange${EVENT_KEY}`,EVENT_SORTING_CHANGE=`sortingChange${EVENT_KEY}`,EVENT_VISIBILITY_CHANGE=`visibilityChange${EVENT_KEY}`,EVENT_FOCUSIN=`focusin${EVENT_KEY}`,EVENT_FOCUSOUT=`focusout${EVENT_KEY}`,EVENT_KEYDOWN=`keydown${EVENT_KEY}`,EVENT_DRAGEND=`dragend${EVENT_KEY}`,EVENT_DRAGLEAVE=`dragleave${EVENT_KEY}`,EVENT_DRAGOVER=`dragover${EVENT_KEY}`,EVENT_DRAGSTART=`dragstart${EVENT_KEY}`,EVENT_DROP=`drop${EVENT_KEY}`,EVENT_MOUSEDOWN=`mousedown${EVENT_KEY}`,EVENT_POINTERDOWN=`pointerdown${EVENT_KEY}`,EVENT_TOUCHSTART=`touchstart${EVENT_KEY}`,CLASS_NAME_DATA_GRID="data-grid",CLASS_NAME_DRAGGING="data-grid-dragging",CLASS_NAME_EDITOR_POPUP="data-grid-editor-popup",CLASS_NAME_DROP_TARGET="data-grid-drop-target",CLASS_NAME_PAGINATION_TOP="data-grid-pagination-top",CLASS_NAME_PINNED="data-grid-pinned",CLASS_NAME_RESIZABLE="data-grid-resizable",CLASS_NAME_TABLE="table",CLASS_NAME_VIEWPORT="data-grid-viewport",SELECTOR_COLUMN_FILTER="input[data-coreui-column-filter]",SELECTOR_DRAGGABLE="th[data-coreui-draggable]",SELECTOR_MENU_BUTTON="button[data-coreui-menu]",SELECTOR_FILTER_BUTTON="button[data-coreui-filter]",SELECTOR_GLOBAL_FILTER="input[data-coreui-global-filter]",SELECTOR_PAGE="button[data-coreui-page]",SELECTOR_PAGE_SIZE="select[data-coreui-page-size]",SELECTOR_RESIZER="[data-coreui-resizer]",SELECTOR_ROW_SELECT="input[data-coreui-row-select]",SELECTOR_SELECT_ALL="input[data-coreui-select-all]",SELECTOR_SORT_BUTTON=".data-grid-sort-button",SELECTOR_TOOLBAR_COLUMNS="button[data-coreui-toolbar-columns]",SELECTOR_TOOLBAR_EXPORT="button[data-coreui-toolbar-export]",SELECTOR_TOOLBAR_REDO="button[data-coreui-toolbar-redo]",SELECTOR_TOOLBAR_UNDO="button[data-coreui-toolbar-undo]",FILTER_DEBOUNCE_MS=250,DEFAULT_PAGE_SIZE_OPTIONS=[5,10,20,50];let editorErrorCount=0;const STATE_STORAGE_PREFIX="coreui-data-grid:",STATE_AUTOSAVE_DEBOUNCE_MS=250,HISTORY_LIMIT=100,FOCUSABLE_SELECTOR="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]",applyTabIndex=(e,t)=>{const n=t?0:-1;e.tabIndex!==n&&(e.tabIndex=n)},Default={cellNavigation:!1,columnFilters:!1,columnMenu:!1,columnMenuIcon:DEFAULT_COLUMN_MENU_ICON,columnOrder:!1,columnPinning:!1,columnSizing:!1,columnVisibility:!1,columns:[],dataProvider:null,editing:!1,empty:"No items found",filterIcon:DEFAULT_FILTER_ICON,globalFilter:!1,hideColumnIcon:DEFAULT_HIDE_COLUMN_ICON,history:!1,itemKey:null,items:[],labels:{},moveLeftIcon:DEFAULT_MOVE_LEFT_ICON,moveRightIcon:DEFAULT_MOVE_RIGHT_ICON,overscan:10,pagination:!1,pinLeftIcon:DEFAULT_PIN_LEFT_ICON,pinRightIcon:DEFAULT_PIN_RIGHT_ICON,rowHeight:44,rowSelection:!1,sanitize:!0,sanitizeFn:null,slots:{},sortAscendingIcon:DEFAULT_SORT_ASCENDING_ICON,sortDescendingIcon:DEFAULT_SORT_DESCENDING_ICON,sortNeutralIcon:DEFAULT_SORT_NEUTRAL_ICON,sorterVisibility:!1,sorting:!0,stateKey:null,toolbar:!1,toolbarColumnsIcon:DEFAULT_TOOLBAR_COLUMNS_ICON,toolbarExportIcon:DEFAULT_TOOLBAR_EXPORT_ICON,toolbarRedoIcon:DEFAULT_TOOLBAR_REDO_ICON,toolbarUndoIcon:DEFAULT_TOOLBAR_UNDO_ICON,unpinIcon:DEFAULT_UNPIN_ICON,virtualization:!0},DefaultType={cellNavigation:"boolean",columnFilters:"boolean",columnMenu:"(boolean|function)",columnMenuIcon:"string",columnOrder:"(boolean|array)",columnPinning:"(boolean|object)",columnSizing:"(boolean|object)",columnVisibility:"(boolean|object)",columns:"array",dataProvider:"(function|null)",editing:"boolean",empty:"(string|function)",filterIcon:"string",globalFilter:"boolean",hideColumnIcon:"string",history:"boolean",itemKey:"(function|null)",items:"array",labels:"object",moveLeftIcon:"string",moveRightIcon:"string",overscan:"number",pagination:"(boolean|object)",pinLeftIcon:"string",pinRightIcon:"string",rowHeight:"number",rowSelection:"(boolean|object)",sanitize:"boolean",sanitizeFn:"(function|null)",slots:"object",sortAscendingIcon:"string",sortDescendingIcon:"string",sortNeutralIcon:"string",sorterVisibility:"(string|boolean)",sorting:"(boolean|object)",stateKey:"(string|null)",toolbar:"(boolean|object)",toolbarColumnsIcon:"string",toolbarExportIcon:"string",toolbarRedoIcon:"string",toolbarUndoIcon:"string",unpinIcon:"string",virtualization:"boolean"};class DataGrid extends BaseComponent{constructor(e,t){super(e,t),this._virtualizer=null,this._toolbar=null,this._paginations=[],this._emptySlot=null,this._dataSource=null,this._loading=null,this._loadFailed=!1,this._dataVersion=0,this._liveRegion=null,this._selectionAnchorIndex=null,this._activeCell=null,this._containsFocus=!1,this._editingCell=null,this._undoStack=[],this._redoStack=[],this._persistState=null,this._editor=null,this._editorPointerdownHandler=null,this._editorPopup=null,this._editorErrorElement=null,this._editorFocusPending=!1,this._columnsByKey=new Map,this._dragColumn=null,this._menu=null,this._tooltip=null,this._filterMenu=null,this._columnChooser=null,this._toolbarConfig=null,this._element&&(this._labels={...DEFAULT_LABELS,...this._config.labels},this._scheduler=createScheduler(()=>this._update()),this._table=this._createTable(),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("visually-hidden"),this._liveRegion.setAttribute("aria-live","polite"),this._element.append(this._liveRegion),this._render(),this._addEventListeners(),this._tooltip=createTooltip(this._element),this._restorePersistedState(),this._initDataSource())}get table(){return this._table}static get Default(){return Default}static get DefaultType(){return DefaultType}static get NAME(){return NAME}static getInstance(e){return super.getInstance(e)}static getOrCreateInstance(e,t){return super.getOrCreateInstance(e,t)}getSelectedItems(){return this._table.getSelectedRowModel().rows.map(e=>e.original)}getCsv(e){return exportCsv(this._table,e)}downloadCsv(e){downloadCsv(this._table,e)}getState(){var e;const t=this._table.getState();return{columnFilters:t.columnFilters,columnOrder:t.columnOrder,columnPinning:t.columnPinning,columnSizing:t.columnSizing,columnVisibility:t.columnVisibility,globalFilter:null!==(e=t.globalFilter)&&void 0!==e?e:"",pagination:t.pagination,rowSelection:t.rowSelection,sorting:t.sorting}}restoreState(e){if(this._table.setState(t=>({...t,...e})),void 0!==e.globalFilter){const t=this._element.querySelector(SELECTOR_GLOBAL_FILTER);t&&(t.value=e.globalFilter)}this._scheduler.schedule()}undo(){this._applyHistoryEntry(this._undoStack,this._redoStack,!0)}redo(){this._applyHistoryEntry(this._redoStack,this._undoStack,!1)}_applyHistoryEntry(e,t,n){const o=e.pop();if(!o)return;const i=this._table.getCoreRowModel().rowsById[o.rowId];i?(t.push(o),EventHandler.trigger(this._element,EVENT_EDIT_COMMIT,{item:i.original,columnId:o.columnId,value:n?o.previousValue:o.value,previousValue:n?o.value:o.previousValue}),this._announce(n?this._labels.undoneAnnouncement:this._labels.redoneAnnouncement),this._updateHistoryButtons()):this._updateHistoryButtons()}setItems(e){this._config.dataProvider||(this._stopEditing({commit:!1}),this._config.items=e,this._dataVersion++,this._table.setOptions(t=>({...t,data:e})),this._scheduler.schedule())}update(e){this._config=this._getConfig({...this._config,...e}),this._labels={...DEFAULT_LABELS,...this._config.labels},this._teardownUi(),this._selectionAnchorIndex=null,this._loadFailed=!1,this._dataVersion++,this._table=this._createTable(),this._render(),this._initDataSource()}dispose(){var e;this._teardownUi(),this._scheduler.dispose(),null===(e=this._tooltip)||void 0===e||e.dispose(),this._tooltip=null,this._liveRegion&&this._liveRegion.remove(),this._element.classList.remove("data-grid"),this._element.removeAttribute("data-coreui-sorter-visibility"),super.dispose()}_configAfterMerge(e){return e.editing&&(e.cellNavigation=!0),e}_createTable(){return createGridTable(this._config,(e,t)=>{this._notifyStateChange(e,t),this._scheduler.schedule()})}_teardownUi(){var e,t,n,o,i,l;this._stopEditing({commit:!1}),this._dataSource&&(this._dataSource.dispose(),this._dataSource=null),null===(e=this._header)||void 0===e||e.dispose(),this._menu&&(this._menu.dispose(),this._menu=null),this._filterMenu&&(this._filterMenu.dispose(),this._filterMenu=null),this._columnChooser&&(this._columnChooser.dispose(),this._columnChooser=null),this._loading&&(this._loading.element.remove(),this._loading=null),this._virtualizer&&(this._virtualizer.destroy(),this._virtualizer=null),this._toolbar&&(null===(n=(t=this._toolbar).dispose)||void 0===n||n.call(t),this._toolbar.element.remove(),this._toolbar=null);for(const e of this._paginations)null===(o=e.dispose)||void 0===o||o.call(e),e.element.remove();this._paginations=[],this._emptySlot&&(null===(l=(i=this._emptySlot).dispose)||void 0===l||l.call(i),this._emptySlot=null),this._viewportElement&&this._viewportElement.remove()}_slotContext(){return{table:this._table,labels:this._labels}}_isColumnSortable(e){return Boolean(this._config.sorting)&&!1!==e.sortable}_isColumnFilterable(e){return this._config.columnFilters&&!1!==e.filterable}_isColumnResizable(e){return Boolean(this._config.columnSizing)&&!1!==e.resizable}_sanitizeIcon(e){return this._config.sanitize?sanitizeHtml(e,SVGAllowlist,this._config.sanitizeFn):e}_hasColumnMenu(e){return!!this._config.columnMenu&&("function"==typeof this._config.columnMenu?this._getMenuActions(e.key).length>0:this._isColumnSortable(e)||Boolean(this._config.columnPinning)||Boolean(this._config.columnVisibility)&&!1!==e.hideable||Boolean(this._config.columnOrder)&&!1!==e.movable)}_renderToolbar(){const e=resolveToolbar(this._config);if(this._toolbarConfig=e,this._config.slots.toolbar)return this._toolbar=this._config.slots.toolbar(this._slotContext()),void this._element.append(this._toolbar.element);(e.columns||e.export||e.search||e.history)&&(this._toolbar=createToolbar({columns:e.columns,export:e.export,icons:{columns:this._sanitizeIcon(this._config.toolbarColumnsIcon),export:this._sanitizeIcon(this._config.toolbarExportIcon),redo:this._sanitizeIcon(this._config.toolbarRedoIcon),undo:this._sanitizeIcon(this._config.toolbarUndoIcon)},history:e.history,labels:this._labels,search:e.search}),this._element.append(this._toolbar.element),e.columns&&(this._columnChooser=createColumnChooser({root:this._element,labels:this._labels,getColumns:()=>this._chooserColumns(),toggleVisibility:(e,t)=>{var n;null===(n=this._table.getColumn(e))||void 0===n||n.toggleVisibility(t)},showAll:()=>this._table.toggleAllColumnsVisible(!0),reset:()=>{var e;return this._table.setColumnVisibility(null!==(e=this._table.initialState.columnVisibility)&&void 0!==e?e:{})}})))}_render(){var e;this._columnsByKey=new Map(this._config.columns.map(e=>[e.key,e])),this._activeCell=this._config.cellNavigation?createActiveCellManager(()=>this._scheduler.schedule()):null,this._element.classList.add("data-grid"),this._element.classList.toggle(CLASS_NAME_RESIZABLE,Boolean(this._config.columnSizing)),this._element.classList.toggle(CLASS_NAME_PINNED,Boolean(this._config.columnPinning)),this._config.sorterVisibility?this._element.setAttribute("data-coreui-sorter-visibility",this._config.sorterVisibility):this._element.removeAttribute("data-coreui-sorter-visibility");const{slots:t}=this._config;this._renderToolbar(),t.empty&&(this._emptySlot=t.empty(this._slotContext()));const n=Boolean(this._config.rowSelection),o="object"==typeof this._config.rowSelection?this._config.rowSelection:{},i=Boolean(this._config.pagination)||Boolean(this._config.dataProvider),l="object"==typeof this._config.pagination?this._config.pagination:{};if(this._config.columnMenu&&(this._menu=createMenu({root:this._element,getActions:e=>this._getMenuActions(e)})),this._config.columnFilters&&(this._filterMenu=createFilterMenu({root:this._element,labels:this._labels,getColumn:e=>{var t;return null!==(t=this._columnsByKey.get(e))&&void 0!==t?t:null},getFacetedValues:e=>{var t,n;return[...null!==(n=null===(t=this._table.getColumn(e))||void 0===t?void 0:t.getFacetedUniqueValues().keys())&&void 0!==n?n:[]]},getFilterValue:e=>{var t;return null===(t=this._table.getColumn(e))||void 0===t?void 0:t.getFilterValue()},applyFilter:(e,t)=>{var n;null===(n=this._table.getColumn(e))||void 0===n||n.setFilterValue(t)}})),this._header=createHeader({cellNavigation:this._config.cellNavigation,columns:this._config.columns,draggable:Boolean(this._config.columnOrder),filterRow:this._config.columnFilters&&this._config.columns.some(e=>e.filter&&this._isColumnFilterable(e)),hasMenu:e=>this._hasColumnMenu(e),hasFilterMenu:e=>Boolean(this._filterMenu)&&this._isColumnFilterable(e)&&!e.filter,icons:{columnMenu:this._sanitizeIcon(this._config.columnMenuIcon),filter:this._sanitizeIcon(this._config.filterIcon),sortAscending:this._sanitizeIcon(this._config.sortAscendingIcon),sortDescending:this._sanitizeIcon(this._config.sortDescendingIcon),sortNeutral:this._sanitizeIcon(this._config.sortNeutralIcon)},isFilterable:e=>this._isColumnFilterable(e),isResizable:e=>this._isColumnResizable(e),isSortable:e=>this._isColumnSortable(e),labels:this._labels,resizable:Boolean(this._config.columnSizing),selection:n,selectAll:n&&!1!==o.selectAll,table:this._table}),this._body=createBody({cellNavigation:this._config.cellNavigation,getDataVersion:()=>this._dataVersion,getEditingCell:()=>this._editingCell?{rowId:this._editingCell.rowId,columnId:this._editingCell.columnId}:null,getEditorElement:()=>this._editor&&!this._editor.popup?this._editor.element:null,getPinning:()=>this._config.columnPinning?this._getPinning():null,getRowIndexOffset:()=>{if(!this._config.pagination&&!this._config.dataProvider)return 0;const{pageIndex:e,pageSize:t}=this._table.getState().pagination;return e*t},getRows:()=>this._table.getRowModel().rows,getVisibleColumns:()=>this._visibleColumns(),getVirtualizer:()=>{var e,t;return null!==(t=null===(e=this._virtualizer)||void 0===e?void 0:e.instance)&&void 0!==t?t:null},headerRowCount:this._header.rowCount,labels:this._labels,renderEmpty:()=>this._emptySlot?this._emptySlot.element:this._loadFailed?this._labels.loadError:"function"==typeof this._config.empty?this._config.empty():this._config.empty,sanitizeContent:e=>this._config.sanitize?sanitizeHtml(e,DefaultAllowlist,this._config.sanitizeFn):e,selection:n}),this._tableElement=document.createElement("table"),this._tableElement.classList.add("table"),this._config.cellNavigation&&this._tableElement.setAttribute("role","grid"),this._tableElement.append(this._header.element,this._body.element),this._viewportElement=document.createElement("div"),this._viewportElement.classList.add(CLASS_NAME_VIEWPORT),this._config.cellNavigation&&(this._viewportElement.tabIndex=-1),this._viewportElement.append(this._tableElement),this._config.dataProvider&&(this._loading=createLoading(this._labels),this._viewportElement.append(this._loading.element)),this._element.append(this._viewportElement),i){const n=null!==(e=l.position)&&void 0!==e?e:"bottom",o=t.pagination,i=()=>{var e,t;if(o){const e=o(this._slotContext());return{element:e.element,refresh:()=>{var t;return null===(t=e.update)||void 0===t?void 0:t.call(e)},dispose:()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}}}const n=createPagination({info:null===(e=l.info)||void 0===e||e,labels:this._labels,pageSizeOptions:null!==(t=l.pageSizeOptions)&&void 0!==t?t:DEFAULT_PAGE_SIZE_OPTIONS});return{element:n.element,refresh:()=>n.update(this._paginationState()),dispose:void 0}};if("top"===n||"both"===n){const e=i();o||e.element.classList.add(CLASS_NAME_PAGINATION_TOP),this._viewportElement.before(e.element),this._paginations.push(e)}if("bottom"===n||"both"===n){const e=i();this._element.append(e.element),this._paginations.push(e)}}else this._config.virtualization&&(this._virtualizer=createGridVirtualizer({count:this._table.getRowModel().rows.length,getScrollElement:()=>this._viewportElement,onChange:()=>this._scheduler.schedule(),overscan:this._config.overscan,rowHeight:this._config.rowHeight}));this._update()}_addEventListeners(){EventHandler.on(this._element,EVENT_KEYDOWN,e=>{this._onCellNavigationKeydown(e)}),EventHandler.on(this._element,EVENT_FOCUSIN,e=>{this._containsFocus=!0,this._onCellFocusIn(e)}),EventHandler.on(this._element,EVENT_FOCUSOUT,e=>{const t=e.relatedTarget;t&&this._element.contains(t)||(this._containsFocus=!1)}),EventHandler.on(this._element,EVENT_DBLCLICK,e=>{var t;if(!this._config.editing)return;const n=this._navigableCellFromTarget(e.target);n&&n.cell.rowIndex>=0&&(null===(t=this._activeCell)||void 0===t||t.set(n.cell),this._startEditing(n.cell))}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_SORT_BUTTON,e=>{this._toggleColumnSorting(e)});const e=debounce((e,t)=>{var n;this._table&&(null===(n=this._table.getColumn(e))||void 0===n||n.setFilterValue(""===t?void 0:t))},250);EventHandler.on(this._element,EVENT_INPUT,SELECTOR_COLUMN_FILTER,t=>{var n;const o=null!==(n=t.delegateTarget)&&void 0!==n?n:t.target;e(o.dataset.coreuiColumnFilter,o.value)});const t=debounce(e=>{this._table&&this._table.setGlobalFilter(""===e?void 0:e)},250);EventHandler.on(this._element,EVENT_INPUT,SELECTOR_GLOBAL_FILTER,e=>{var n;const o=null!==(n=e.delegateTarget)&&void 0!==n?n:e.target;t(o.value)}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_MENU_BUTTON,e=>{var t,n;const o=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target;null===(n=this._menu)||void 0===n||n.toggle(o,o.dataset.coreuiMenu)}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_FILTER_BUTTON,e=>{var t,n;const o=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target;null===(n=this._filterMenu)||void 0===n||n.toggle(o,o.dataset.coreuiFilter)}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_TOOLBAR_COLUMNS,e=>{var t,n;const o=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target;null===(n=this._columnChooser)||void 0===n||n.toggle(o)}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_TOOLBAR_EXPORT,()=>{var e;this.downloadCsv({scope:"filtered",...null===(e=this._toolbarConfig)||void 0===e?void 0:e.exportOptions})}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_TOOLBAR_UNDO,()=>{this.undo()}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_TOOLBAR_REDO,()=>{this.redo()}),EventHandler.on(this._element,EVENT_DRAGSTART,SELECTOR_DRAGGABLE,e=>{this._onColumnDragStart(e)}),EventHandler.on(this._element,EVENT_DRAGOVER,SELECTOR_DRAGGABLE,e=>{var t;if(!this._dragColumn)return;const n=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target,o=n.dataset.coreuiColumn,i=this._table.getColumn(this._dragColumn),l=o?this._table.getColumn(o):void 0;i&&l&&o!==this._dragColumn&&i.getIsPinned()===l.getIsPinned()&&(e.preventDefault(),n.classList.add(CLASS_NAME_DROP_TARGET))}),EventHandler.on(this._element,EVENT_DRAGLEAVE,SELECTOR_DRAGGABLE,e=>{var t;(null!==(t=e.delegateTarget)&&void 0!==t?t:e.target).classList.remove(CLASS_NAME_DROP_TARGET)}),EventHandler.on(this._element,EVENT_DROP,SELECTOR_DRAGGABLE,e=>{this._onColumnDrop(e)}),EventHandler.on(this._element,EVENT_DRAGEND,SELECTOR_DRAGGABLE,()=>{this._endColumnDrag()}),EventHandler.on(this._element,EVENT_MOUSEDOWN,SELECTOR_RESIZER,e=>{this._startColumnResize(e)}),EventHandler.on(this._element,EVENT_TOUCHSTART,SELECTOR_RESIZER,e=>{this._startColumnResize(e)}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_ROW_SELECT,e=>{this._toggleRowSelection(e)}),EventHandler.on(this._element,EVENT_CHANGE,SELECTOR_SELECT_ALL,e=>{var t;const n=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target;this._table.toggleAllRowsSelected(n.checked)}),EventHandler.on(this._element,EVENT_CLICK,SELECTOR_PAGE,e=>{var t;const n=(null!==(t=e.delegateTarget)&&void 0!==t?t:e.target).dataset.coreuiPage;"first"!==n?"prev"!==n?"next"!==n?"last"!==n?this._table.setPageIndex(Number(n)):this._table.lastPage():this._table.nextPage():this._table.previousPage():this._table.firstPage()}),EventHandler.on(this._element,EVENT_CHANGE,SELECTOR_PAGE_SIZE,e=>{var t;const n=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target;this._table.setPageSize(Number(n.value))})}_toggleColumnSorting(e){var t,n,o;const i=null===(n=(null!==(t=e.delegateTarget)&&void 0!==t?t:e.target).closest("th"))||void 0===n?void 0:n.dataset.coreuiColumn;if(!i)return;const l=this._table.getColumn(i);null===(o=null==l?void 0:l.getToggleSortingHandler())||void 0===o||o(e)}_navigableCellFromTarget(e){const t=e.closest("td, th");if(!t||!this._tableElement.contains(t))return null;const n=t.dataset.coreuiColumn;if(!n)return null;const o=t.closest("tr");if(o.parentElement===this._body.element){const e=o.dataset.coreuiIndex;return void 0===e?null:{cellElement:t,cell:{rowIndex:Number(e),columnId:n}}}return o===this._header.element.firstElementChild?{cellElement:t,cell:{rowIndex:-1,columnId:n}}:null}_onCellFocusIn(e){if(!this._activeCell)return;const t=this._navigableCellFromTarget(e.target);t&&this._activeCell.set(t.cell)}_onCellNavigationKeydown(e){var t,n;if(!this._activeCell)return;const o=e.target;if(this._config.history&&(e.ctrlKey||e.metaKey)&&!this._editingCell&&!o.matches("input, textarea, select")){const t=e.key.toLowerCase();if("z"===t&&!e.shiftKey)return e.preventDefault(),void this.undo();if("z"===t&&e.shiftKey||"y"===t)return e.preventDefault(),void this.redo()}if(this._editingCell&&this._editScopeContains(o))return"Enter"===e.key?void(e.defaultPrevented||(e.preventDefault(),this._stopEditing({commit:!0}))):"Escape"===e.key?void(e.defaultPrevented||this._cancelEdit()):"Tab"===e.key?(e.preventDefault(),void this._moveEditing(e.shiftKey?-1:1)):void 0;if(o===this._viewportElement){const t=this._activeCell.get();return void(t&&"Tab"!==e.key&&(e.preventDefault(),this._setActiveCell(t)))}const i=this._navigableCellFromTarget(o);if(!i)return;if(o!==i.cellElement)return void("Escape"===e.key&&i.cellElement.focus({preventScroll:!0}));if("Enter"===e.key||"F2"===e.key){e.preventDefault();const o=this._columnsByKey.get(i.cell.columnId);return-1===i.cell.rowIndex?void("Enter"===e.key&&o&&this._isColumnSortable(o)&&(null===(n=null===(t=this._table.getColumn(i.cell.columnId))||void 0===t?void 0:t.getToggleSortingHandler())||void 0===n||n(e))):o&&this._isColumnEditable(o)?void this._startEditing(i.cell):void("Enter"===e.key&&this._descendIntoCell(i.cellElement))}if(" "===e.key){if(this._config.rowSelection&&i.cell.rowIndex>=0){e.preventDefault();const t=this._table.getRowModel().rows[i.cell.rowIndex];null==t||t.toggleSelected(),this._selectionAnchorIndex=i.cell.rowIndex}return}const l=resolveNavigation(e.key,e.ctrlKey||e.metaKey,i.cell,this._activeCellContext());l&&(e.preventDefault(),1===l.pageDelta&&this._table.getCanNextPage()?this._table.nextPage():-1===l.pageDelta&&this._table.getCanPreviousPage()&&this._table.previousPage(),this._setActiveCell(l.cell))}_descendIntoCell(e){var t;null===(t=e.querySelector(FOCUSABLE_SELECTOR))||void 0===t||t.focus({preventScroll:!0})}_isColumnEditable(e){return!!this._config.editing&&(Boolean(e.editor)||!0===e.editable||"object"==typeof e.editable)}_startEditing(e){const t=this._columnsByKey.get(e.columnId);if(!t||!this._isColumnEditable(t))return;this._stopEditing({commit:!0,force:!0});const n=this._table.getRowModel().rows[e.rowIndex];if(!n)return;const o=n.getValue(e.columnId),i={item:n.original,column:t,value:o,commit:e=>this._commitEdit(e),cancel:()=>this._cancelEdit(),labels:this._labels},l="object"==typeof t.editable?t.editable:{},s=t.editor?t.editor(i):createBuiltInEditor(l,i);this._editingCell={rowId:n.id,columnId:e.columnId,rowIndex:e.rowIndex,item:n.original,previousValue:o},this._editor=s,this._editorFocusPending=!0,EventHandler.trigger(this._element,EVENT_EDIT_START,{item:n.original,columnId:e.columnId}),s.popup&&this._mountEditorPopup(e),this._editorPointerdownHandler=e=>{this._editScopeContains(e.target)||this._stopEditing({commit:!0})},EventHandler.on(document,EVENT_POINTERDOWN,this._editorPointerdownHandler),EventHandler.on(s.element,EVENT_FOCUSOUT,e=>{const t=e.relatedTarget;t&&!this._editScopeContains(t)&&this._stopEditing({commit:!0})}),this._scheduler.schedule()}_editScopeContains(e){var t,n,o;if(!e||!this._editingCell||!this._editor)return!1;if((null===(n=(t=this._editor).contains)||void 0===n?void 0:n.call(t,e))||this._editor.element.contains(e)||(null===(o=this._editorPopup)||void 0===o?void 0:o.contains(e)))return!0;const i=this._cellElementFor({rowIndex:this._editingCell.rowIndex,columnId:this._editingCell.columnId});return Boolean(null==i?void 0:i.contains(e))}_mountEditorPopup(e){const t=this._cellElementFor(e),n=document.createElement("div");if(n.classList.add(CLASS_NAME_EDITOR_POPUP),t){const e=this._element.getBoundingClientRect(),o=t.getBoundingClientRect();n.style.top=o.top-e.top+"px",n.style.left=o.left-e.left+"px",n.style.minWidth=`${o.width}px`}n.append(this._editor.element),this._element.append(n),this._editorPopup=n}_commitEdit(e){var t,n;const o=this._editingCell;if(!o)return;const i=null===(t=this._columnsByKey.get(o.columnId))||void 0===t?void 0:t.editValidate;if(i){const t=i(e,o.item);if(!0!==t)return void this._showEditorInvalid("string"==typeof t?t:"")}this._teardownEditor(),this._config.history&&(this._undoStack.push({rowId:o.rowId,columnId:o.columnId,value:e,previousValue:o.previousValue}),this._undoStack.length>100&&this._undoStack.shift(),this._redoStack=[],this._updateHistoryButtons()),EventHandler.trigger(this._element,EVENT_EDIT_COMMIT,{item:o.item,columnId:o.columnId,value:e,previousValue:o.previousValue}),null===(n=this._activeCell)||void 0===n||n.set({rowIndex:o.rowIndex,columnId:o.columnId},{focus:!0})}_cancelEdit(){var e;const t=this._editingCell;t&&(this._teardownEditor(),EventHandler.trigger(this._element,EVENT_EDIT_CANCEL,{item:t.item,columnId:t.columnId}),null===(e=this._activeCell)||void 0===e||e.set({rowIndex:t.rowIndex,columnId:t.columnId},{focus:!0}))}_stopEditing(e){var t;if(this._editingCell)return e.commit&&(null===(t=this._editor)||void 0===t?void 0:t.getValue)?(this._commitEdit(this._editor.getValue()),void(this._editingCell&&e.force&&this._cancelEdit())):void this._cancelEdit()}_showEditorInvalid(e){const t=this._editor;if(!t)return;const n=t.element.matches("input, select, textarea")?t.element:t.element.querySelector("input, select, textarea");n&&(this._editorErrorElement||(this._editorErrorElement=document.createElement("div"),this._editorErrorElement.classList.add("visually-hidden"),this._editorErrorElement.id="data-grid-editor-error-"+ ++editorErrorCount,this._element.append(this._editorErrorElement)),this._editorErrorElement.textContent=e,n.classList.add("is-invalid"),n.setAttribute("aria-invalid","true"),n.setAttribute("aria-errormessage",this._editorErrorElement.id))}_moveEditing(e){var t;const n=this._editingCell;if(!n)return;const o=this._visibleColumns();let i=null;for(let t=o.findIndex(e=>e.key===n.columnId)+e;t>=0&&t<o.length;t+=e)if(this._isColumnEditable(o[t])){i=o[t];break}if(this._stopEditing({commit:!0}),!this._editingCell&&i){const e={rowIndex:n.rowIndex,columnId:i.key};null===(t=this._activeCell)||void 0===t||t.set(e,{focus:!0}),this._startEditing(e)}}_teardownEditor(){var e,t;this._editorPointerdownHandler&&(EventHandler.off(document,EVENT_POINTERDOWN,this._editorPointerdownHandler),this._editorPointerdownHandler=null),this._editor&&(EventHandler.off(this._editor.element,EVENT_FOCUSOUT),null===(t=(e=this._editor).dispose)||void 0===t||t.call(e)),this._editorPopup&&(this._editorPopup.remove(),this._editorPopup=null),this._editorErrorElement&&(this._editorErrorElement.remove(),this._editorErrorElement=null),this._editor=null,this._editingCell=null,this._editorFocusPending=!1,this._scheduler.schedule()}_setActiveCell(e){var t;null===(t=this._activeCell)||void 0===t||t.set(e,{focus:!0}),this._virtualizer&&e.rowIndex>=0&&this._virtualizer.instance.scrollToIndex(e.rowIndex)}_activeCellContext(){var e,t;const n=this._table.getRowModel().rows.length,o=Boolean(this._config.pagination)||Boolean(this._config.dataProvider),i=Math.floor((null!==(t=null===(e=this._viewportElement)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0)/this._config.rowHeight);return{columnIds:this._visibleLeafColumns().map(e=>e.id),rowCount:n,pageStep:o?this._table.getState().pagination.pageSize:Math.max(1,i||n),paginated:o}}_cellElementFor(e){var t;if(-1===e.rowIndex)return this._header.element.querySelector(`tr:first-child th[data-coreui-column="${e.columnId}"]`);const n=this._body.element.querySelector(`tr[data-coreui-index="${e.rowIndex}"]`);return null!==(t=null==n?void 0:n.querySelector(`td[data-coreui-column="${e.columnId}"]`))&&void 0!==t?t:null}_applyCellNavigation(){if(!this._activeCell)return;const e=this._activeCellContext();this._activeCell.clamp(e),this._tableElement.setAttribute("aria-colcount",String(e.columnIds.length+(this._config.rowSelection?1:0)));const t=this._activeCell.get(),n=null!=t?t:e.columnIds.length>0?{rowIndex:e.rowCount>0?0:-1,columnId:e.columnIds[0]}:null;for(const e of this._header.element.querySelectorAll("tr:first-child th[data-coreui-column]"))applyTabIndex(e,null!==n&&-1===n.rowIndex&&e.dataset.coreuiColumn===n.columnId);for(const e of this._body.element.querySelectorAll("tr[data-coreui-index]")){const t=null!==n&&e.dataset.coreuiIndex===String(n.rowIndex);for(const o of e.querySelectorAll("td[data-coreui-column]"))applyTabIndex(o,t&&o.dataset.coreuiColumn===n.columnId)}if(!t)return;const o=this._cellElementFor(t);o?this._activeCell.consumeFocusRequest()&&o.focus({preventScroll:!0}):this._containsFocus&&!this._element.contains(document.activeElement)&&this._viewportElement.focus({preventScroll:!0})}_getMenuActions(e){const t=this._table.getColumn(e),n=this._columnsByKey.get(e);if(!t||!n)return[];const o=[];if(this._isColumnSortable(n)){const e=t.getIsSorted();o.push({key:"sort-asc",label:this._labels.sortAscending,disabled:"asc"===e,group:"sorting",icon:this._sanitizeIcon(this._config.sortAscendingIcon),run:()=>t.toggleSorting(!1)},{key:"sort-desc",label:this._labels.sortDescending,disabled:"desc"===e,group:"sorting",icon:this._sanitizeIcon(this._config.sortDescendingIcon),run:()=>t.toggleSorting(!0)}),e&&o.push({key:"clear-sort",label:this._labels.clearSort,group:"sorting",icon:this._sanitizeIcon(this._config.sortNeutralIcon),run:()=>t.clearSorting()})}if(this._config.columnPinning){const e=t.getIsPinned();"left"!==e&&o.push({key:"pin-left",label:this._labels.pinLeft,group:"pinning",icon:this._sanitizeIcon(this._config.pinLeftIcon),run:()=>t.pin("left")}),"right"!==e&&o.push({key:"pin-right",label:this._labels.pinRight,group:"pinning",icon:this._sanitizeIcon(this._config.pinRightIcon),run:()=>t.pin("right")}),e&&o.push({key:"unpin",label:this._labels.unpin,group:"pinning",icon:this._sanitizeIcon(this._config.unpinIcon),run:()=>t.pin(!1)})}if(this._config.columnOrder&&!1!==n.movable){const n=this._visibleLeafColumns().filter(e=>e.getIsPinned()===t.getIsPinned()),i=n.findIndex(t=>t.id===e);o.push({key:"move-left",label:this._labels.moveLeft,disabled:i<=0,group:"ordering",icon:this._sanitizeIcon(this._config.moveLeftIcon),run:()=>this._moveColumn(e,-1)},{key:"move-right",label:this._labels.moveRight,disabled:i===n.length-1,group:"ordering",icon:this._sanitizeIcon(this._config.moveRightIcon),run:()=>this._moveColumn(e,1)})}this._config.columnVisibility&&t.getCanHide()&&o.push({key:"hide",label:this._labels.hideColumn,group:"visibility",icon:this._sanitizeIcon(this._config.hideColumnIcon),run:()=>t.toggleVisibility(!1)});const i="function"==typeof this._config.columnMenu?this._config.columnMenu:null;return(i?i({column:n,defaultActions:o}):o).map(e=>e.icon?{...e,icon:this._sanitizeIcon(e.icon)}:e)}_orderedLeafIds(){const e=this._table.getAllLeafColumns().map(e=>e.id),t=this._table.getState().columnOrder;if(0===t.length)return e;const n=new Set(e),o=t.filter(e=>n.has(e)),i=new Set(o);return[...o,...e.filter(e=>!i.has(e))]}_moveColumn(e,t){const n=this._table.getColumn(e);if(!n)return;const o=n.getIsPinned(),i=this._orderedLeafIds(),l=this._visibleLeafColumns().filter(e=>e.getIsPinned()===o).map(e=>e.id),s=l[l.indexOf(e)+t];if(!s)return;const r=i.indexOf(e),a=i.indexOf(s);i[r]=s,i[a]=e,this._table.setColumnOrder(i)}_onColumnDragStart(e){var t,n,o,i,l;if(null===(n=(t=e.target).closest)||void 0===n?void 0:n.call(t,SELECTOR_RESIZER))return void e.preventDefault();const s=null!==(o=e.delegateTarget)&&void 0!==o?o:e.target;this._dragColumn=null!==(i=s.dataset.coreuiColumn)&&void 0!==i?i:null,s.classList.add(CLASS_NAME_DRAGGING);const{dataTransfer:r}=e;r&&(r.effectAllowed="move",r.setData("text/plain",null!==(l=this._dragColumn)&&void 0!==l?l:""))}_onColumnDrop(e){var t;e.preventDefault();const n=(null!==(t=e.delegateTarget)&&void 0!==t?t:e.target).dataset.coreuiColumn,o=this._dragColumn;if(this._endColumnDrag(),!o||!n||o===n)return;const i=this._table.getColumn(o),l=this._table.getColumn(n);if(!i||!l||i.getIsPinned()!==l.getIsPinned())return;const s=this._orderedLeafIds(),r=s.indexOf(o),a=s.indexOf(n);-1!==r&&-1!==a&&(s.splice(r,1),s.splice(a,0,o),this._table.setColumnOrder(s))}_endColumnDrag(){this._dragColumn=null;for(const e of this._element.querySelectorAll(`.${CLASS_NAME_DRAGGING}, .${CLASS_NAME_DROP_TARGET}`))e.classList.remove(CLASS_NAME_DRAGGING,CLASS_NAME_DROP_TARGET)}_startColumnResize(e){var t,n,o;const i=null===(n=(null!==(t=e.delegateTarget)&&void 0!==t?t:e.target).closest("th"))||void 0===n?void 0:n.dataset.coreuiColumn;if(!i)return;"mousedown"===e.type&&e.preventDefault();const l=null===(o=this._table.getHeaderGroups()[0])||void 0===o?void 0:o.headers.find(e=>e.column.id===i);null==l||l.getResizeHandler()(e)}_toggleRowSelection(e){var t,n;const o=null!==(t=e.delegateTarget)&&void 0!==t?t:e.target,i=o.closest("tr");if(!i)return;const l=Number(i.dataset.coreuiIndex),{rows:s}=this._table.getRowModel(),r=o.checked;if(e.shiftKey&&null!==this._selectionAnchorIndex){const e=Math.min(this._selectionAnchorIndex,l),t=Math.max(this._selectionAnchorIndex,l);this._table.setRowSelection(n=>{const o={...n};for(const n of s.slice(e,t+1))r?o[n.id]=!0:delete o[n.id];return o})}else null===(n=s[l])||void 0===n||n.toggleSelected(r);this._selectionAnchorIndex=l}_initDataSource(){const{dataProvider:e}=this._config;e&&(this._dataSource=createDataSource({provider:t=>e(t),getRequest:()=>{var e;const t=this._table.getState();return{columnFilters:t.columnFilters,globalFilter:null!==(e=t.globalFilter)&&void 0!==e?e:"",pagination:t.pagination,sorting:t.sorting}},onLoad:e=>{this._stopEditing({commit:!1}),this._loadFailed=!1,this._dataVersion++,this._table.setOptions(t=>({...t,data:e.items,rowCount:e.totalRows})),EventHandler.trigger(this._element,EVENT_DATA_LOAD,{items:e.items,totalRows:e.totalRows}),this._announceResults(e.totalRows),this._scheduler.schedule()},onError:e=>{this._stopEditing({commit:!1}),this._loadFailed=!0,this._dataVersion++,this._table.setOptions(e=>({...e,data:[],rowCount:0})),EventHandler.trigger(this._element,EVENT_DATA_ERROR,{error:e}),this._scheduler.schedule()},onLoadingChange:e=>{this._loading&&this._loading.setVisible(e),this._viewportElement.setAttribute("aria-busy",String(e))}}),this._dataSource.load())}_visibleLeafColumns(){return[...this._table.getLeftVisibleLeafColumns(),...this._table.getCenterVisibleLeafColumns(),...this._table.getRightVisibleLeafColumns()]}_chooserColumns(){var e;const t=[];for(const n of this._orderedLeafIds()){const o=this._table.getColumn(n),i=this._columnsByKey.get(n);o&&i&&t.push({id:n,label:null!==(e=i.label)&&void 0!==e?e:i.key,canHide:o.getCanHide(),visible:o.getIsVisible()})}return t}_visibleColumns(){const e=[];for(const t of this._visibleLeafColumns()){const n=this._columnsByKey.get(t.id);n&&e.push(n)}return e}_getColumnSizes(){var e,t;const n={};for(const o of null!==(t=null===(e=this._table.getHeaderGroups()[0])||void 0===e?void 0:e.headers)&&void 0!==t?t:[])n[o.column.id]=o.getSize();return n}_getFilteredColumns(){return this._table.getState().columnFilters.map(e=>e.id)}_getPinning(){const e=this._table.getLeftLeafColumns().filter(e=>e.getIsVisible()),t=this._table.getRightLeafColumns().filter(e=>e.getIsVisible()),n=Boolean(this._config.rowSelection)&&e.length>0,o={};for(const[t,i]of e.entries())o[i.id]={side:"left",offset:i.getStart("left"),edge:t===e.length-1,afterSelect:n};for(const[e,n]of t.entries())o[n.id]={side:"right",offset:n.getAfter("right"),edge:0===e,afterSelect:!1};return{columns:o,select:n?{side:"left",offset:0,edge:!1,afterSelect:!1}:null}}_storageKey(){return this._config.stateKey?`coreui-data-grid:${this._config.stateKey}`:null}_restorePersistedState(){const e=this._storageKey();if(!e)return;let t=null;try{const n=window.localStorage.getItem(e);t=n?JSON.parse(n):null}catch(e){return}t&&this.restoreState(t)}_updateHistoryButtons(){const e=this._element.querySelector(SELECTOR_TOOLBAR_UNDO);e&&(e.disabled=0===this._undoStack.length);const t=this._element.querySelector(SELECTOR_TOOLBAR_REDO);t&&(t.disabled=0===this._redoStack.length)}_announceResults(e){this._announce(interpolate(this._labels.resultsAnnouncement,{count:e}))}_announce(e){this._liveRegion&&(this._liveRegion.textContent=e)}_getTotalRows(){var e;return this._config.dataProvider?null!==(e=this._table.options.rowCount)&&void 0!==e?e:0:this._table.getFilteredRowModel().rows.length}_notifyStateChange(e,t){var n,o;if(!this._element)return;this._config.stateKey&&(this._persistState||(this._persistState=debounce(()=>{const e=this._storageKey();if(e)try{window.localStorage.setItem(e,JSON.stringify(this.getState()))}catch(e){}},250)),this._persistState()),e.sorting===t.sorting&&e.columnFilters===t.columnFilters&&e.globalFilter===t.globalFilter&&e.pagination.pageIndex===t.pagination.pageIndex&&e.pagination.pageSize===t.pagination.pageSize||(this._stopEditing({commit:!0,force:!0}),this._selectionAnchorIndex=null,null===(n=this._activeCell)||void 0===n||n.reset()),e.sorting!==t.sorting&&EventHandler.trigger(this._element,EVENT_SORTING_CHANGE,{sorting:t.sorting});const i=e.columnFilters!==t.columnFilters||e.globalFilter!==t.globalFilter;if(i&&(EventHandler.trigger(this._element,EVENT_FILTER_CHANGE,{columnFilters:t.columnFilters,globalFilter:null!==(o=t.globalFilter)&&void 0!==o?o:""}),this._config.dataProvider||this._announceResults(this._table.getFilteredRowModel().rows.length)),e.rowSelection!==t.rowSelection&&EventHandler.trigger(this._element,EVENT_SELECTION_CHANGE,{rowSelection:t.rowSelection,selectedItems:this.getSelectedItems()}),e.pagination!==t.pagination&&EventHandler.trigger(this._element,EVENT_PAGINATION_CHANGE,{pagination:t.pagination}),e.columnSizing!==t.columnSizing&&EventHandler.trigger(this._element,EVENT_SIZING_CHANGE,{columnSizing:t.columnSizing}),e.columnPinning!==t.columnPinning&&EventHandler.trigger(this._element,EVENT_PINNING_CHANGE,{columnPinning:t.columnPinning}),e.columnOrder!==t.columnOrder&&EventHandler.trigger(this._element,EVENT_ORDER_CHANGE,{columnOrder:t.columnOrder}),e.columnVisibility!==t.columnVisibility&&EventHandler.trigger(this._element,EVENT_VISIBILITY_CHANGE,{columnVisibility:t.columnVisibility}),this._dataSource){const n=i||e.sorting!==t.sorting;if(n&&0!==t.pagination.pageIndex)return void this._table.setPageIndex(0);(n||e.pagination!==t.pagination)&&this._dataSource.load()}}_update(){var e,t,n,o,i,l;if(this._virtualizer&&(this._virtualizer.setCount(this._table.getRowModel().rows.length),this._virtualizer.instance._willUpdate()),this._editingCell&&this._virtualizer){const{rowIndex:e}=this._editingCell;this._virtualizer.instance.getVirtualItems().some(t=>t.index===e)||this._stopEditing({commit:!0,force:!0})}this._tableElement.setAttribute("aria-rowcount",String(this._header.rowCount+this._getTotalRows())),this._header.update({filteredColumns:this._config.columnFilters?this._getFilteredColumns():null,order:this._visibleLeafColumns().map(e=>e.id),pinning:this._config.columnPinning?this._getPinning():null,resizingColumn:!!this._config.columnSizing&&this._table.getState().columnSizingInfo.isResizingColumn,sizes:this._config.columnSizing||this._config.columnPinning?this._getColumnSizes():null,sorting:this._table.getState().sorting,selectAll:this._config.rowSelection?{checked:this._table.getIsAllRowsSelected(),indeterminate:this._table.getIsSomeRowsSelected()}:null}),this._body.update(),this._applyCellNavigation(),this._editorFocusPending&&(null===(e=this._editor)||void 0===e?void 0:e.element.isConnected)&&(this._editorFocusPending=!1,this._editor.focus?this._editor.focus():(null!==(t=this._editor.element.querySelector(FOCUSABLE_SELECTOR))&&void 0!==t?t:this._editor.element).focus({preventScroll:!0})),null===(o=null===(n=this._toolbar)||void 0===n?void 0:n.update)||void 0===o||o.call(n),null===(l=null===(i=this._emptySlot)||void 0===i?void 0:i.update)||void 0===l||l.call(i);for(const e of this._paginations)e.refresh()}_paginationState(){const{pagination:e}=this._table.getState();return{pageCount:this._table.getPageCount(),pageIndex:e.pageIndex,pageSize:e.pageSize,totalRows:this._getTotalRows()}}static jQueryInterface(e){return this.each(function(){const t=DataGrid.getOrCreateInstance(this,"string"==typeof e?void 0:e);if("string"!=typeof e)return;const n=t;if(void 0===n[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);n[e]()})}}defineJQueryPlugin(DataGrid);export{DEFAULT_LABELS,DataGrid,FILTER_OPERATORS,VALUELESS_OPERATORS,downloadCsv,evaluateColumnFilter,exportCsv,interpolate};
|
|
8
|
+
//# sourceMappingURL=data-grid.esm.min.js.map
|