@keenmate/web-grid 1.2.0-rc01 → 1.2.0-rc02

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +16 -11
  2. package/ai/fill-handle.txt +1 -1
  3. package/ai/frozen-columns.txt +2 -2
  4. package/ai/row-locking.txt +1 -1
  5. package/ai/styling-theming.txt +13 -12
  6. package/component-variables.manifest.json +8 -7
  7. package/dist/grid.d.ts +3 -0
  8. package/dist/types.d.ts +1 -0
  9. package/dist/web-component.d.ts +10 -0
  10. package/dist/web-grid.js +99 -26
  11. package/dist/web-grid.umd.js +16 -16
  12. package/package.json +1 -1
  13. package/src/css/animations.css +14 -0
  14. package/src/css/{_cells.css → cells.css} +1 -1
  15. package/src/css/controls.css +3 -0
  16. package/src/css/dark-mode.css +67 -0
  17. package/src/css/{_dialogs.css → dialogs.css} +9 -68
  18. package/src/css/{_dirty-indicator.css → dirty-indicator.css} +37 -37
  19. package/src/css/{_dropdown.css → dropdown.css} +1 -1
  20. package/src/css/{_editors.css → editors.css} +14 -8
  21. package/src/css/floating.css +71 -0
  22. package/src/css/{_freeze.css → freeze.css} +5 -5
  23. package/src/css/{_header.css → header.css} +1 -1
  24. package/src/css/main.css +53 -48
  25. package/src/css/{_navigation.css → navigation.css} +3 -3
  26. package/src/css/{_resize.css → resize.css} +1 -1
  27. package/src/css/{_selection.css → selection.css} +1 -1
  28. package/src/css/{_shortcuts.css → shortcuts.css} +4 -4
  29. package/src/css/{_modifiers.css → states.css} +8 -2
  30. package/src/css/{_tree.css → tree.css} +71 -71
  31. package/src/css/{_variables.css → variables.css} +55 -42
  32. package/src/css/_dark-mode.css +0 -93
  33. /package/src/css/{_cell-selection.css → cell-selection.css} +0 -0
  34. /package/src/css/{_fill-handle.css → fill-handle.css} +0 -0
  35. /package/src/css/{_pagination.css → pagination.css} +0 -0
  36. /package/src/css/{_reorder.css → reorder.css} +0 -0
  37. /package/src/css/{_row-locking.css → row-locking.css} +0 -0
  38. /package/src/css/{_table.css → table.css} +0 -0
  39. /package/src/css/{_toolbar.css → toolbar.css} +0 -0
  40. /package/src/css/{_virtual-scroll.css → virtual-scroll.css} +0 -0
@@ -293,7 +293,7 @@
293
293
  .wg-datepicker__today-btn:hover {
294
294
  background-color: color-mix(in srgb, var(--wg-dp-accent-color) 10%, transparent);
295
295
  }
296
- `;let Jo=!1;class Mt{constructor(e={}){b(this,"options");b(this,"state");b(this,"localeStrings");b(this,"formatInfo");b(this,"element",null);b(this,"anchor",null);b(this,"input",null);b(this,"cleanupAutoUpdate",null);b(this,"previousInputValue","");b(this,"boundHandleClickOutside");b(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...e};const o=new Date;this.state={viewMonth:o.getMonth(),viewYear:o.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(e.locale),this.formatInfo=Dt(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}getElement(){return this.element}initLocaleStrings(e){const o=e||navigator.language||"en";try{const i=new Intl.DateTimeFormat(o,{month:"long"}),r=new Intl.DateTimeFormat(o,{month:"short"}),s=new Intl.DateTimeFormat(o,{weekday:"long"}),n=new Intl.DateTimeFormat(o,{weekday:"short"}),l=[],a=[];for(let u=0;u<12;u++){const h=new Date(2024,u,1);l.push(i.format(h)),a.push(r.format(h))}const d=[],c=[];for(let u=0;u<7;u++){const h=new Date(2024,0,7+u);d.push(s.format(h));const g=n.format(h);c.push(g.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:l,monthNamesShort:a,weekdayNames:d,weekdayNamesShort:c}}catch{return Xo}}static injectStyles(){if(Jo)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=Pn,document.head.appendChild(e),Jo=!0}open(e,o=null){Mt.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=le(o);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}xn(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=cn(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Qo(this.element)}close(e=!1){var o,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,e||(i=(o=this.options).onClose)==null||i.call(o))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return io(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=on(this.anchor,e,()=>{if(!this.anchor.isConnected){this.close(!0);return}Be(this.anchor,e,{placement:"bottom-start",middleware:[Rt(4),Ne({fallbackPlacements:["top-start","bottom-end","top-end"]}),lt({padding:8})]}).then(({x:o,y:i})=>{Object.assign(e.style,{left:`${o}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",e=>this.handleClick(e)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(e){var l;const o=e.target,i=(l=o.closest("[data-action]"))==null?void 0:l.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),ro(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),no(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Qo(this.element);return}if(i==="today"){e.preventDefault();const a=In(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){e.preventDefault();const a=kn(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),En(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),Rn(n,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const o=e.composedPath();!o.includes(this.element)&&!o.includes(this.anchor)&&this.close()}handleKeyDown(e){yn(e,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(e,o){var i,r;this.state.selectedDate=e,(r=(i=this.options).onSelect)==null||r.call(i,e,o),this.close(!0)}render(){if(!this.element)return;const e=this.element.querySelector(".wg-datepicker");e&&(bn(e,this.state,this.localeStrings),_n(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?vn(e,this.state):mn(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=Dn(e,this.formatInfo,this.previousInputValue),$n(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",o=>{Tn(o,this.formatInfo)}),e.addEventListener("paste",o=>{Mn(o,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}var Zo=function(){},fe="undefined",An=typeof window!==fe&&typeof window.navigator!==fe&&/Trident\/|MSIE /.test(window.navigator.userAgent),lo=["trace","debug","info","warn","error"],dt={},W=null;function ei(t,e){var o=t[e];if(typeof o.bind=="function")return o.bind(t);try{return Function.prototype.bind.call(o,t)}catch{return function(){return Function.prototype.apply.apply(o,[t,arguments])}}}function Ln(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function zn(t){return t==="debug"&&(t="log"),typeof console===fe?!1:t==="trace"&&An?Ln:console[t]!==void 0?ei(console,t):console.log!==void 0?ei(console,"log"):Zo}function ct(){for(var t=this.getLevel(),e=0;e<lo.length;e++){var o=lo[e];this[o]=e<t?Zo:this.methodFactory(o,t,this.name)}if(this.log=this.debug,typeof console===fe&&t<this.levels.SILENT)return"No console available for logging"}function On(t){return function(){typeof console!==fe&&(ct.call(this),this[t].apply(this,arguments))}}function Hn(t,e,o){return zn(t)||On.apply(this,arguments)}function ti(t,e){var o=this,i,r,s,n="loglevel";typeof t=="string"?n+=":"+t:typeof t=="symbol"&&(n=void 0);function l(h){var g=(lo[h]||"silent").toUpperCase();if(!(typeof window===fe||!n)){try{window.localStorage[n]=g;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+g+";"}catch{}}}function a(){var h;if(!(typeof window===fe||!n)){try{h=window.localStorage[n]}catch{}if(typeof h===fe)try{var g=window.document.cookie,f=encodeURIComponent(n),w=g.indexOf(f+"=");w!==-1&&(h=/^([^;]+)/.exec(g.slice(w+f.length+1))[1])}catch{}return o.levels[h]===void 0&&(h=void 0),h}}function d(){if(!(typeof window===fe||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function c(h){var g=h;if(typeof g=="string"&&o.levels[g.toUpperCase()]!==void 0&&(g=o.levels[g.toUpperCase()]),typeof g=="number"&&g>=0&&g<=o.levels.SILENT)return g;throw new TypeError("log.setLevel() called with invalid level: "+h)}o.name=t,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=e||Hn,o.getLevel=function(){return s??r??i},o.setLevel=function(h,g){return s=c(h),g!==!1&&l(s),ct.call(o)},o.setDefaultLevel=function(h){r=c(h),a()||o.setLevel(h,!1)},o.resetLevel=function(){s=null,d(),ct.call(o)},o.enableAll=function(h){o.setLevel(o.levels.TRACE,h)},o.disableAll=function(h){o.setLevel(o.levels.SILENT,h)},o.rebuild=function(){if(W!==o&&(i=c(W.getLevel())),ct.call(o),W===o)for(var h in dt)dt[h].rebuild()},i=c(W?W.getLevel():"WARN");var u=a();u!=null&&(s=c(u)),ct.call(o)}W=new ti,W.getLogger=function(e){if(typeof e!="symbol"&&typeof e!="string"||e==="")throw new TypeError("You must supply a name when creating a logger.");var o=dt[e];return o||(o=dt[e]=new ti(e,W.methodFactory)),o};var Fn=typeof window!==fe?window.log:void 0;W.noConflict=function(){return typeof window!==fe&&window.log===W&&(window.log=Fn),W},W.getLoggers=function(){return dt},W.default=W;var qn=function(t){for(var e=1,o=arguments.length,i;e<o;e++)for(i in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],i)&&(t[i]=arguments[e][i]);return t},Vn={template:"[%t] %l:",levelFormatter:function(t){return t.toUpperCase()},nameFormatter:function(t){return t||"root"},timestampFormatter:function(t){return t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},oi,We={},Nn=function(t){if(!t||!t.getLogger)throw new TypeError("Argument is not a root logger");oi=t},Bn=function(t,e){if(!t||!t.setLevel)throw new TypeError("Argument is not a logger");var o=t.methodFactory,i=t.name||"",r=We[i]||We[""]||Vn;function s(n,l,a){var d=o(n,l,a),c=We[a]||We[""],u=c.template.indexOf("%t")!==-1,h=c.template.indexOf("%l")!==-1,g=c.template.indexOf("%n")!==-1;return function(){for(var f="",w=arguments.length,p=Array(w),m=0;m<w;m++)p[m]=arguments[m];if(i||!We[a]){var _=c.timestampFormatter(new Date),y=c.levelFormatter(n),C=c.nameFormatter(a);c.format?f+=c.format(y,C,_):(f+=c.template,u&&(f=f.replace(/%t/,_)),h&&(f=f.replace(/%l/,y)),g&&(f=f.replace(/%n/,C))),p.length&&typeof p[0]=="string"?p[0]=f+" "+p[0]:p.unshift(f)}d.apply(void 0,p)}}return We[i]||(t.methodFactory=s),e=e||{},e.template&&(e.format=void 0),We[i]=qn({},r,e),t.setLevel(t.getLevel()),oi||t.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),t},ii={reg:Nn,apply:Bn};ii.reg(W),ii.apply(W,{format(t,e,o){return`[${o}] [${t}]${e?` [${e}]`:""}`},timestampFormatter(t){return t.toTimeString().split(" ")[0]+"."+t.getMilliseconds().toString().padStart(3,"0")}}),W.setLevel("silent");const ao=W.getLogger("GRID:INIT"),gt=W.getLogger("GRID:DATA"),Ee=W.getLogger("GRID:UI"),Le=W.getLogger("GRID:INTERACTION"),$t=W.getLogger("GRID:PERF"),Wn=["GRID:INIT","GRID:DATA","GRID:UI","GRID:INTERACTION","GRID:PERF"];function Un(){W.setLevel("debug")}function Yn(){W.setLevel("silent")}function Kn(t){W.setLevel(t)}function jn(t,e){W.getLogger(t).setLevel(e)}const ie={counters:{displayItems:0,displayItemsMs:0,paginatedItems:0,paginatedItemsMs:0,treeSorted:0,treeSortedMs:0,treeVisible:0,treeVisibleMs:0,cellDisplayItemsLookup:0},reset(){const t=this.counters;t.displayItems=0,t.displayItemsMs=0,t.paginatedItems=0,t.paginatedItemsMs=0,t.treeSorted=0,t.treeSortedMs=0,t.treeVisible=0,t.treeVisibleMs=0,t.cellDisplayItemsLookup=0},summary(){const t=this.counters;return[`displayItems=${t.displayItems} (${t.displayItemsMs.toFixed(1)}ms)`,`paginatedItems=${t.paginatedItems} (${t.paginatedItemsMs.toFixed(1)}ms)`,`treeSorted=${t.treeSorted} (${t.treeSortedMs.toFixed(1)}ms)`,`treeVisible=${t.treeVisible} (${t.treeVisibleMs.toFixed(1)}ms)`,`cellDisplayItemsLookup=${t.cellDisplayItemsLookup}`].join(" | ")}},ri={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching...",contextMenu:{sortAsc:"Sort Ascending",sortDesc:"Sort Descending",clearSort:"Clear Sort",hideColumn:"Hide Column",freezeColumn:"Freeze Column",unfreezeColumn:"Unfreeze Column",columnVisibility:"Column Visibility",showAll:"Show all"}};class ni{constructor(){b(this,"_items",[]);b(this,"_columns",[]);b(this,"_sortMode","none");b(this,"_isFilterable",!1);b(this,"_isPageable",!1);b(this,"_pageSize",10);b(this,"_pageSizes",[10,25,50,100]);b(this,"_paginationMode","client");b(this,"_isStriped",!0);b(this,"_isHoverable",!0);b(this,"_isEditable",!1);b(this,"_isRowEditable");b(this,"_editTrigger","dblclick");b(this,"_editStartSelection","mousePosition");b(this,"_mode","excel");b(this,"_dropdownToggleVisibility","always");b(this,"_shouldShowDropdownOnFocus",!0);b(this,"_shouldOpenDropdownOnEnter",!1);b(this,"_isCheckboxAlwaysEditable",!1);b(this,"_isRowNumbersVisible",!1);b(this,"_isStickyRowNumbers",!1);b(this,"_freezeColumns",0);b(this,"_invalidCells",[]);b(this,"_isDirtyIndicatorVisible",!0);b(this,"_isRowToolbarVisible",!1);b(this,"_rowToolbar",["add","delete","duplicate"]);b(this,"_toolbarVerticalAlign","bottom");b(this,"_toolbarHorizontalAlign","center");b(this,"_toolbarTrigger","hover");b(this,"_toolbarPosition","auto");b(this,"_toolbarColumn");b(this,"_toolbarFollowsCursor",!1);b(this,"_cellToolbar");b(this,"_cellToolbarOffset",.2);b(this,"_toolbarBtnMinWidth");b(this,"_inlineActionsTitle","");b(this,"_contextMenu");b(this,"_contextMenuXOffset",8);b(this,"_contextMenuYOffset",0);b(this,"_headerContextMenu");b(this,"_rowShortcuts");b(this,"_isShortcutsHelpVisible",!1);b(this,"_shortcutsHelpPosition","top-right");b(this,"_shortcutsHelpContentCallback");b(this,"_idValueMember");b(this,"_idValueCallback");b(this,"_rowLocking");b(this,"_externalLocks",new Map);b(this,"_onrowlockchange");b(this,"_gridName",null);b(this,"_shouldPersistColumnWidths",!1);b(this,"_columnWidths",new Map);b(this,"_oncolumnresize");b(this,"_isColumnReorderAllowed",!1);b(this,"_shouldPersistColumnOrder",!1);b(this,"_columnOrder",new Map);b(this,"_oncolumnreorder");b(this,"_fillDirection","vertical");b(this,"_fillDragCallback");b(this,"_onrowchange");b(this,"_onroweditstart");b(this,"_onroweditcancel");b(this,"_onvalidationerror");b(this,"_validationTooltipCallback");b(this,"_ontoolbarclick");b(this,"_onrowaction");b(this,"_oncontextmenuopen");b(this,"_onheadercontextmenuopen");b(this,"_ondatarequest");b(this,"_onrowdelete");b(this,"_sort",[]);b(this,"_filters",{});b(this,"_onfilterchange");b(this,"_columnMinWidth");b(this,"_currentPage",1);b(this,"_totalItems",null);b(this,"_showPagination",!0);b(this,"_paginationPosition","bottom-center");b(this,"_paginationLabelsCallback");b(this,"_paginationLayout","pageSize|previous|pageInfo|next");b(this,"_summaryPosition");b(this,"_summaryContentCallback");b(this,"_summaryMetadata");b(this,"_isSummaryInline",!0);b(this,"_customStylesCallback");b(this,"_rowClassCallback");b(this,"_labels",{...ri});b(this,"_isScrollable",!1);b(this,"_scrollMaxHeight","100vh");b(this,"_tableBorderOnly",!1);b(this,"_isVirtualScrollEnabled",!1);b(this,"_virtualScrollThreshold",100);b(this,"_virtualScrollRowHeight",38);b(this,"_virtualScrollBuffer",10);b(this,"_isInfiniteScrollEnabled",!1);b(this,"_infiniteScrollThreshold",100);b(this,"_hasMoreItems",!0);b(this,"_isLoadingMore",!1);b(this,"_editingCell",null);b(this,"_currentCellError",null);b(this,"_isValidating",!1);b(this,"_draftRows",new Map);b(this,"_focusedCell",null);b(this,"_isCommittingFromKeyboard",!1);b(this,"_skipNextDropdownAutoEdit",!1);b(this,"_tabTraversalStartColIndex",null);b(this,"_hoveredRowIndex",null);b(this,"_focusedRowIndex",null);b(this,"_onrowfocus");b(this,"_onInteractionChange",null);b(this,"_selectedRows",new Set);b(this,"_lastSelectedRowIndex",null);b(this,"_rangeShortcuts",[]);b(this,"_cellSelectionMode","click");b(this,"_selectedCellRange",null);b(this,"_lastClickedCell",null);b(this,"_shouldCopyWithHeaders",!1);b(this,"_oncellselectionchange",null);b(this,"_selectedColumns",new Set);b(this,"_lastSelectedColumnIndex",-1);b(this,"_pasteMode","skip-non-editable");b(this,"_shouldValidateOnPaste",!0);b(this,"_createRowCallback");b(this,"_onbeforepaste");b(this,"_onpaste");b(this,"_isNewRowEnabled",!1);b(this,"_newRowPosition","bottom");b(this,"_newRowIndicator","+");b(this,"_createEmptyRowCallback");b(this,"_emptyRowDraft",null);b(this,"_treePathMember",null);b(this,"_treeLevelMember",null);b(this,"_treeParentMember",null);b(this,"_idMember",null);b(this,"_hasWarnedAboutMissingRowId",!1);b(this,"_treeSeparator",null);b(this,"_treeDataSorted",!1);b(this,"_expandedPaths",new Set);b(this,"_expandedPathsExternal",null);b(this,"_defaultExpandDepth",null);b(this,"_treeIndex",null);b(this,"_onexpandedpathschange");b(this,"_treeDoubleClickBehavior","none");b(this,"_treeExpandedGlyph","▶");b(this,"_treeCollapsedGlyph","▶");b(this,"_treeChevronCallback");b(this,"_treeChevronCache",new WeakMap);b(this,"_paginatedItemsCache",null);b(this,"_displayItemsCache",null)}get items(){return this._items}set items(e){gt.debug("items set:",e.length,"rows"),this._items=e,this._treeChevronCache=new WeakMap,this.rebuildTreeState(),this.requestUpdate()}get columns(){return this._columns}set columns(e){ao.debug("columns set:",e.length,"columns",e.map(o=>String(o.field))),this._columns=e,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(e){this._sortMode=e,this.requestUpdate()}get isFilterable(){return this._isFilterable}set isFilterable(e){this._isFilterable=e,this.requestUpdate()}get onfilterchange(){return this._onfilterchange}set onfilterchange(e){this._onfilterchange=e}get columnMinWidth(){return this._columnMinWidth}set columnMinWidth(e){this._columnMinWidth=e||void 0,this.requestUpdate()}get isPageable(){return this._isPageable}set isPageable(e){this._isPageable=e,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(e){this._pageSize=e,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(e){this._pageSizes=e,this.requestUpdate()}get paginationMode(){return this._paginationMode}set paginationMode(e){this._paginationMode=e,this.requestUpdate()}get isStriped(){return this._isStriped}set isStriped(e){this._isStriped=e,this.requestUpdate()}get isHoverable(){return this._isHoverable}set isHoverable(e){this._isHoverable=e,this.requestUpdate()}get isEditable(){return this._isEditable}set isEditable(e){this._isEditable=e,this.checkEditTriggerConflicts(),this.maybeWarnAboutRowIdentity(),this.requestUpdate()}get isRowEditable(){return this._isRowEditable}set isRowEditable(e){this._isRowEditable=e,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,this.checkSelectionConflicts(),this.checkEditTriggerConflicts(),this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(e){this._editStartSelection=e}get mode(){return this._mode}set mode(e){this._mode=e,this.applyModeDefaults(),this.checkEditTriggerConflicts(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get shouldShowDropdownOnFocus(){return this._shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(e){this._shouldShowDropdownOnFocus=e}get shouldOpenDropdownOnEnter(){return this._shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(e){this._shouldOpenDropdownOnEnter=e}getEffectiveShouldOpenDropdownOnEnter(e){return e.shouldOpenDropdownOnEnter??this._shouldOpenDropdownOnEnter}get isCheckboxAlwaysEditable(){return this._isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(e){this._isCheckboxAlwaysEditable=e,this.requestUpdate()}get isRowNumbersVisible(){return this._isRowNumbersVisible}set isRowNumbersVisible(e){this._isRowNumbersVisible=e,this.requestUpdate()}get isDirtyIndicatorVisible(){return this._isDirtyIndicatorVisible}set isDirtyIndicatorVisible(e){this._isDirtyIndicatorVisible=e,this.requestUpdate()}get isStickyRowNumbers(){return this._isStickyRowNumbers}set isStickyRowNumbers(e){this._isStickyRowNumbers=e,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(e){this._freezeColumns=Math.max(0,Math.floor(e)),this.requestUpdate()}get visualColumns(){const e=[],o=[];this._columns.filter(s=>s.isFrozen&&!s.isHidden).length,this._columns.forEach((s,n)=>{if(s.isHidden)return;const l={column:s,originalIndex:n};s.isFrozen?e.push(l):o.push(l)});const i=[],r=[];return o.forEach((s,n)=>{n<this._freezeColumns?i.push(s):r.push(s)}),this._columnOrder.size>0&&r.sort((s,n)=>{const l=String(s.column.field),a=String(n.column.field),d=this._columnOrder.get(l)??s.originalIndex,c=this._columnOrder.get(a)??n.originalIndex;return d-c}),[...e,...i,...r]}get totalFrozenColumns(){return this._columns.filter(o=>o.isFrozen).length+this._freezeColumns}isColumnFrozen(e){return e<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(e){this._invalidCells=e,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get isRowToolbarVisible(){return this._isRowToolbarVisible}set isRowToolbarVisible(e){this._isRowToolbarVisible=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(e){this._toolbarVerticalAlign=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(e){this._toolbarHorizontalAlign=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(e){this.toolbarVerticalAlign=e}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(e){this.toolbarHorizontalAlign=e}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(e){this._toolbarTrigger=e,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(e){this._toolbarPosition=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarColumn(){return this._toolbarColumn}set toolbarColumn(e){this._toolbarColumn=e,this.checkToolbarConflicts()}get toolbarFollowsCursor(){return this._toolbarFollowsCursor}set toolbarFollowsCursor(e){this._toolbarFollowsCursor=e,this.checkToolbarConflicts()}get cellToolbar(){return this._cellToolbar}set cellToolbar(e){this._cellToolbar=e,this.checkToolbarConflicts()}get cellToolbarOffset(){return this._cellToolbarOffset}set cellToolbarOffset(e){typeof e=="number"?this._cellToolbarOffset=Math.max(0,Math.min(1,e)):this._cellToolbarOffset=e}get toolbarBtnMinWidth(){return this._toolbarBtnMinWidth}set toolbarBtnMinWidth(e){this._toolbarBtnMinWidth=e}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(e){this._inlineActionsTitle=e,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(e){this._contextMenuXOffset=e}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(e){this._contextMenuYOffset=e}get headerContextMenu(){return this._headerContextMenu}set headerContextMenu(e){this._headerContextMenu=e}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(e){this._rowShortcuts=e,this.requestUpdate()}get isShortcutsHelpVisible(){return this._isShortcutsHelpVisible}set isShortcutsHelpVisible(e){this._isShortcutsHelpVisible=e,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(e){this._shortcutsHelpPosition=e,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(e){this._shortcutsHelpContentCallback=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){gt.debug("sort changed:",e.map(o=>`${o.column} ${o.direction}`).join(", ")||"none"),this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(e){gt.debug("page changed:",e),this._currentPage=e,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(e){this._totalItems=e,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(e){this._showPagination=e,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(e){this._paginationPosition=e,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(e){this._paginationLabelsCallback=e,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(e){this._paginationLayout=e,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(e){this._summaryPosition=e,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(e){this._summaryContentCallback=e,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(e){this._summaryMetadata=e,this.requestUpdate()}get isSummaryInline(){return this._isSummaryInline}set isSummaryInline(e){this._isSummaryInline=e,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(e){this._customStylesCallback=e}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(e){this._rowClassCallback=e,this.requestUpdate()}get labels(){return this._labels}set labels(e){this._labels={...ri,...e},this.requestUpdate()}get isScrollable(){return this._isScrollable}set isScrollable(e){this._isScrollable=e,this.requestUpdate()}get scrollMaxHeight(){return this._scrollMaxHeight}set scrollMaxHeight(e){this._scrollMaxHeight=e,this.requestUpdate()}get tableBorderOnly(){return this._tableBorderOnly}set tableBorderOnly(e){this._tableBorderOnly=e,this.requestUpdate()}get isVirtualScrollEnabled(){return this._isVirtualScrollEnabled}set isVirtualScrollEnabled(e){this._isVirtualScrollEnabled=e,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(e){this._virtualScrollThreshold=e,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(e){this._virtualScrollRowHeight=e,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(e){this._virtualScrollBuffer=e,this.requestUpdate()}get isInfiniteScrollEnabled(){return this._isInfiniteScrollEnabled}set isInfiniteScrollEnabled(e){this._isInfiniteScrollEnabled=e,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(e){this._infiniteScrollThreshold=e}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(e){this._hasMoreItems=e}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(e){this._isLoadingMore=e}shouldUseVirtualScroll(){return this._isVirtualScrollEnabled===!1?!1:this._isVirtualScrollEnabled===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}set onrowchange(e){this._onrowchange=e}set onroweditstart(e){this._onroweditstart=e}set onroweditcancel(e){this._onroweditcancel=e}set onvalidationerror(e){this._onvalidationerror=e}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(e){this._validationTooltipCallback=e}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(e){this._ontoolbarclick=e}set onrowaction(e){this._onrowaction=e}get oncontextmenuopen(){return this._oncontextmenuopen}set oncontextmenuopen(e){this._oncontextmenuopen=e}get onheadercontextmenuopen(){return this._onheadercontextmenuopen}set onheadercontextmenuopen(e){this._onheadercontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get idValueMember(){return this._idValueMember}set idValueMember(e){this._idValueMember=e}get idValueCallback(){return this._idValueCallback}set idValueCallback(e){this._idValueCallback=e}get rowLocking(){return this._rowLocking}set rowLocking(e){this._rowLocking=e,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(e){this._onrowlockchange=e}get gridName(){return this._gridName}set gridName(e){this._gridName=e}get shouldPersistColumnWidths(){return this._shouldPersistColumnWidths}set shouldPersistColumnWidths(e){this._shouldPersistColumnWidths=e}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(e){this._oncolumnresize=e}get isColumnReorderAllowed(){return this._isColumnReorderAllowed}set isColumnReorderAllowed(e){this._isColumnReorderAllowed=e}get shouldPersistColumnOrder(){return this._shouldPersistColumnOrder}set shouldPersistColumnOrder(e){this._shouldPersistColumnOrder=e}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(e){this._oncolumnreorder=e}get fillDirection(){return this._fillDirection}set fillDirection(e){this._fillDirection=e}get fillDragCallback(){return this._fillDragCallback}set fillDragCallback(e){this._fillDragCallback=e}get selectedRows(){return Array.from(this._selectedRows).sort((e,o)=>e-o)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(e){this._rangeShortcuts=e}isRowSelected(e){return this._selectedRows.has(e)}selectRow(e,o="replace"){switch(Le.debug("selectRow:",{rowIndex:e,mode:o}),this._selectedCellRange&&(this._selectedCellRange=null),this._selectedColumns.clear(),o){case"replace":this._selectedRows.clear(),this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"toggle":this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,e),r=Math.max(this._lastSelectedRowIndex,e);for(let s=i;s<=r;s++)this._selectedRows.add(s)}else this._selectedRows.add(e),this._lastSelectedRowIndex=e;break}this.requestUpdate()}selectRowRange(e,o){this._selectedColumns.clear(),this._selectedCellRange=null,this._selectedRows.clear();const i=Math.min(e,o),r=Math.max(e,o);for(let s=i;s<=r;s++)this._selectedRows.add(s);this._lastSelectedRowIndex=o,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}clearSelection_noRender(){this._selectedRows.clear(),this._lastSelectedRowIndex=null}getSelectedRowsData(){return this.selectedRows.map(e=>this.displayItems[e]).filter(Boolean)}async copySelectedRowsToClipboard(){const e=this.selectedRows;if(e.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of this.visualColumns){const n=s.column.title??s.column.field??"";r.push(String(n))}o.push(r.join(" "))}for(const r of e){const s=this.displayItems[r];if(!s)continue;const n=[];for(const l of this.visualColumns){const a=String(l.column.field),d=s[a],c=d==null?"":String(d);n.push(c)}o.push(n.join(" "))}const i=o.join(`
296
+ `;let Jo=!1;class Mt{constructor(e={}){b(this,"options");b(this,"state");b(this,"localeStrings");b(this,"formatInfo");b(this,"element",null);b(this,"anchor",null);b(this,"input",null);b(this,"cleanupAutoUpdate",null);b(this,"previousInputValue","");b(this,"boundHandleClickOutside");b(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...e};const o=new Date;this.state={viewMonth:o.getMonth(),viewYear:o.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(e.locale),this.formatInfo=Dt(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}getElement(){return this.element}initLocaleStrings(e){const o=e||navigator.language||"en";try{const i=new Intl.DateTimeFormat(o,{month:"long"}),r=new Intl.DateTimeFormat(o,{month:"short"}),s=new Intl.DateTimeFormat(o,{weekday:"long"}),n=new Intl.DateTimeFormat(o,{weekday:"short"}),l=[],a=[];for(let u=0;u<12;u++){const h=new Date(2024,u,1);l.push(i.format(h)),a.push(r.format(h))}const d=[],c=[];for(let u=0;u<7;u++){const h=new Date(2024,0,7+u);d.push(s.format(h));const g=n.format(h);c.push(g.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:l,monthNamesShort:a,weekdayNames:d,weekdayNamesShort:c}}catch{return Xo}}static injectStyles(){if(Jo)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=Pn,document.head.appendChild(e),Jo=!0}open(e,o=null){Mt.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=le(o);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}xn(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=cn(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Qo(this.element)}close(e=!1){var o,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,e||(i=(o=this.options).onClose)==null||i.call(o))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return io(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=on(this.anchor,e,()=>{if(!this.anchor.isConnected){this.close(!0);return}Be(this.anchor,e,{placement:"bottom-start",middleware:[Rt(4),Ne({fallbackPlacements:["top-start","bottom-end","top-end"]}),lt({padding:8})]}).then(({x:o,y:i})=>{Object.assign(e.style,{left:`${o}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",e=>this.handleClick(e)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(e){var l;const o=e.target,i=(l=o.closest("[data-action]"))==null?void 0:l.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),ro(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),no(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Qo(this.element);return}if(i==="today"){e.preventDefault();const a=In(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){e.preventDefault();const a=kn(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),En(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),Rn(n,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const o=e.composedPath();!o.includes(this.element)&&!o.includes(this.anchor)&&this.close()}handleKeyDown(e){yn(e,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(e,o){var i,r;this.state.selectedDate=e,(r=(i=this.options).onSelect)==null||r.call(i,e,o),this.close(!0)}render(){if(!this.element)return;const e=this.element.querySelector(".wg-datepicker");e&&(bn(e,this.state,this.localeStrings),_n(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?vn(e,this.state):mn(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=Dn(e,this.formatInfo,this.previousInputValue),$n(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",o=>{Tn(o,this.formatInfo)}),e.addEventListener("paste",o=>{Mn(o,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}var Zo=function(){},fe="undefined",An=typeof window!==fe&&typeof window.navigator!==fe&&/Trident\/|MSIE /.test(window.navigator.userAgent),lo=["trace","debug","info","warn","error"],dt={},W=null;function ei(t,e){var o=t[e];if(typeof o.bind=="function")return o.bind(t);try{return Function.prototype.bind.call(o,t)}catch{return function(){return Function.prototype.apply.apply(o,[t,arguments])}}}function Ln(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function zn(t){return t==="debug"&&(t="log"),typeof console===fe?!1:t==="trace"&&An?Ln:console[t]!==void 0?ei(console,t):console.log!==void 0?ei(console,"log"):Zo}function ct(){for(var t=this.getLevel(),e=0;e<lo.length;e++){var o=lo[e];this[o]=e<t?Zo:this.methodFactory(o,t,this.name)}if(this.log=this.debug,typeof console===fe&&t<this.levels.SILENT)return"No console available for logging"}function On(t){return function(){typeof console!==fe&&(ct.call(this),this[t].apply(this,arguments))}}function Hn(t,e,o){return zn(t)||On.apply(this,arguments)}function ti(t,e){var o=this,i,r,s,n="loglevel";typeof t=="string"?n+=":"+t:typeof t=="symbol"&&(n=void 0);function l(h){var g=(lo[h]||"silent").toUpperCase();if(!(typeof window===fe||!n)){try{window.localStorage[n]=g;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+g+";"}catch{}}}function a(){var h;if(!(typeof window===fe||!n)){try{h=window.localStorage[n]}catch{}if(typeof h===fe)try{var g=window.document.cookie,f=encodeURIComponent(n),w=g.indexOf(f+"=");w!==-1&&(h=/^([^;]+)/.exec(g.slice(w+f.length+1))[1])}catch{}return o.levels[h]===void 0&&(h=void 0),h}}function d(){if(!(typeof window===fe||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function c(h){var g=h;if(typeof g=="string"&&o.levels[g.toUpperCase()]!==void 0&&(g=o.levels[g.toUpperCase()]),typeof g=="number"&&g>=0&&g<=o.levels.SILENT)return g;throw new TypeError("log.setLevel() called with invalid level: "+h)}o.name=t,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=e||Hn,o.getLevel=function(){return s??r??i},o.setLevel=function(h,g){return s=c(h),g!==!1&&l(s),ct.call(o)},o.setDefaultLevel=function(h){r=c(h),a()||o.setLevel(h,!1)},o.resetLevel=function(){s=null,d(),ct.call(o)},o.enableAll=function(h){o.setLevel(o.levels.TRACE,h)},o.disableAll=function(h){o.setLevel(o.levels.SILENT,h)},o.rebuild=function(){if(W!==o&&(i=c(W.getLevel())),ct.call(o),W===o)for(var h in dt)dt[h].rebuild()},i=c(W?W.getLevel():"WARN");var u=a();u!=null&&(s=c(u)),ct.call(o)}W=new ti,W.getLogger=function(e){if(typeof e!="symbol"&&typeof e!="string"||e==="")throw new TypeError("You must supply a name when creating a logger.");var o=dt[e];return o||(o=dt[e]=new ti(e,W.methodFactory)),o};var Fn=typeof window!==fe?window.log:void 0;W.noConflict=function(){return typeof window!==fe&&window.log===W&&(window.log=Fn),W},W.getLoggers=function(){return dt},W.default=W;var qn=function(t){for(var e=1,o=arguments.length,i;e<o;e++)for(i in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],i)&&(t[i]=arguments[e][i]);return t},Vn={template:"[%t] %l:",levelFormatter:function(t){return t.toUpperCase()},nameFormatter:function(t){return t||"root"},timestampFormatter:function(t){return t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},oi,We={},Nn=function(t){if(!t||!t.getLogger)throw new TypeError("Argument is not a root logger");oi=t},Bn=function(t,e){if(!t||!t.setLevel)throw new TypeError("Argument is not a logger");var o=t.methodFactory,i=t.name||"",r=We[i]||We[""]||Vn;function s(n,l,a){var d=o(n,l,a),c=We[a]||We[""],u=c.template.indexOf("%t")!==-1,h=c.template.indexOf("%l")!==-1,g=c.template.indexOf("%n")!==-1;return function(){for(var f="",w=arguments.length,p=Array(w),m=0;m<w;m++)p[m]=arguments[m];if(i||!We[a]){var _=c.timestampFormatter(new Date),y=c.levelFormatter(n),C=c.nameFormatter(a);c.format?f+=c.format(y,C,_):(f+=c.template,u&&(f=f.replace(/%t/,_)),h&&(f=f.replace(/%l/,y)),g&&(f=f.replace(/%n/,C))),p.length&&typeof p[0]=="string"?p[0]=f+" "+p[0]:p.unshift(f)}d.apply(void 0,p)}}return We[i]||(t.methodFactory=s),e=e||{},e.template&&(e.format=void 0),We[i]=qn({},r,e),t.setLevel(t.getLevel()),oi||t.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),t},ii={reg:Nn,apply:Bn};ii.reg(W),ii.apply(W,{format(t,e,o){return`[${o}] [${t}]${e?` [${e}]`:""}`},timestampFormatter(t){return t.toTimeString().split(" ")[0]+"."+t.getMilliseconds().toString().padStart(3,"0")}}),W.setLevel("silent");const ao=W.getLogger("GRID:INIT"),gt=W.getLogger("GRID:DATA"),Ee=W.getLogger("GRID:UI"),Le=W.getLogger("GRID:INTERACTION"),$t=W.getLogger("GRID:PERF"),Wn=["GRID:INIT","GRID:DATA","GRID:UI","GRID:INTERACTION","GRID:PERF"];function Un(){W.setLevel("debug")}function Yn(){W.setLevel("silent")}function Kn(t){W.setLevel(t)}function jn(t,e){W.getLogger(t).setLevel(e)}const ie={counters:{displayItems:0,displayItemsMs:0,paginatedItems:0,paginatedItemsMs:0,treeSorted:0,treeSortedMs:0,treeVisible:0,treeVisibleMs:0,cellDisplayItemsLookup:0},reset(){const t=this.counters;t.displayItems=0,t.displayItemsMs=0,t.paginatedItems=0,t.paginatedItemsMs=0,t.treeSorted=0,t.treeSortedMs=0,t.treeVisible=0,t.treeVisibleMs=0,t.cellDisplayItemsLookup=0},summary(){const t=this.counters;return[`displayItems=${t.displayItems} (${t.displayItemsMs.toFixed(1)}ms)`,`paginatedItems=${t.paginatedItems} (${t.paginatedItemsMs.toFixed(1)}ms)`,`treeSorted=${t.treeSorted} (${t.treeSortedMs.toFixed(1)}ms)`,`treeVisible=${t.treeVisible} (${t.treeVisibleMs.toFixed(1)}ms)`,`cellDisplayItemsLookup=${t.cellDisplayItemsLookup}`].join(" | ")}},ri={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching...",contextMenu:{sortAsc:"Sort Ascending",sortDesc:"Sort Descending",clearSort:"Clear Sort",hideColumn:"Hide Column",freezeColumn:"Freeze Column",unfreezeColumn:"Unfreeze Column",columnVisibility:"Column Visibility",showAll:"Show all"}};class ni{constructor(){b(this,"_items",[]);b(this,"_columns",[]);b(this,"_sortMode","none");b(this,"_isFilterable",!1);b(this,"_isPageable",!1);b(this,"_pageSize",10);b(this,"_pageSizes",[10,25,50,100]);b(this,"_paginationMode","client");b(this,"_isStriped",!0);b(this,"_isHoverable",!0);b(this,"_isEditable",!1);b(this,"_isRowEditable");b(this,"_editTrigger","dblclick");b(this,"_editStartSelection","mousePosition");b(this,"_shouldCommitOnClickAway",!0);b(this,"_mode","excel");b(this,"_dropdownToggleVisibility","always");b(this,"_shouldShowDropdownOnFocus",!0);b(this,"_shouldOpenDropdownOnEnter",!1);b(this,"_isCheckboxAlwaysEditable",!1);b(this,"_isRowNumbersVisible",!1);b(this,"_isStickyRowNumbers",!1);b(this,"_freezeColumns",0);b(this,"_invalidCells",[]);b(this,"_isDirtyIndicatorVisible",!0);b(this,"_isRowToolbarVisible",!1);b(this,"_rowToolbar",["add","delete","duplicate"]);b(this,"_toolbarVerticalAlign","bottom");b(this,"_toolbarHorizontalAlign","center");b(this,"_toolbarTrigger","hover");b(this,"_toolbarPosition","auto");b(this,"_toolbarColumn");b(this,"_toolbarFollowsCursor",!1);b(this,"_cellToolbar");b(this,"_cellToolbarOffset",.2);b(this,"_toolbarBtnMinWidth");b(this,"_inlineActionsTitle","");b(this,"_contextMenu");b(this,"_contextMenuXOffset",8);b(this,"_contextMenuYOffset",0);b(this,"_headerContextMenu");b(this,"_rowShortcuts");b(this,"_isShortcutsHelpVisible",!1);b(this,"_shortcutsHelpPosition","top-right");b(this,"_shortcutsHelpContentCallback");b(this,"_idValueMember");b(this,"_idValueCallback");b(this,"_rowLocking");b(this,"_externalLocks",new Map);b(this,"_onrowlockchange");b(this,"_gridName",null);b(this,"_shouldPersistColumnWidths",!1);b(this,"_columnWidths",new Map);b(this,"_oncolumnresize");b(this,"_isColumnReorderAllowed",!1);b(this,"_shouldPersistColumnOrder",!1);b(this,"_columnOrder",new Map);b(this,"_oncolumnreorder");b(this,"_fillDirection","vertical");b(this,"_fillDragCallback");b(this,"_onrowchange");b(this,"_onroweditstart");b(this,"_onroweditcancel");b(this,"_onvalidationerror");b(this,"_validationTooltipCallback");b(this,"_ontoolbarclick");b(this,"_onrowaction");b(this,"_oncontextmenuopen");b(this,"_onheadercontextmenuopen");b(this,"_ondatarequest");b(this,"_onrowdelete");b(this,"_sort",[]);b(this,"_filters",{});b(this,"_onfilterchange");b(this,"_columnMinWidth");b(this,"_currentPage",1);b(this,"_totalItems",null);b(this,"_showPagination",!0);b(this,"_paginationPosition","bottom-center");b(this,"_paginationLabelsCallback");b(this,"_paginationLayout","pageSize|previous|pageInfo|next");b(this,"_summaryPosition");b(this,"_summaryContentCallback");b(this,"_summaryMetadata");b(this,"_isSummaryInline",!0);b(this,"_customStylesCallback");b(this,"_rowClassCallback");b(this,"_labels",{...ri});b(this,"_isScrollable",!1);b(this,"_scrollMaxHeight","100vh");b(this,"_tableBorderOnly",!1);b(this,"_isVirtualScrollEnabled",!1);b(this,"_virtualScrollThreshold",100);b(this,"_virtualScrollRowHeight",38);b(this,"_virtualScrollBuffer",10);b(this,"_isInfiniteScrollEnabled",!1);b(this,"_infiniteScrollThreshold",100);b(this,"_hasMoreItems",!0);b(this,"_isLoadingMore",!1);b(this,"_editingCell",null);b(this,"_currentCellError",null);b(this,"_isValidating",!1);b(this,"_draftRows",new Map);b(this,"_focusedCell",null);b(this,"_isCommittingFromKeyboard",!1);b(this,"_skipNextDropdownAutoEdit",!1);b(this,"_tabTraversalStartColIndex",null);b(this,"_hoveredRowIndex",null);b(this,"_focusedRowIndex",null);b(this,"_onrowfocus");b(this,"_onInteractionChange",null);b(this,"_selectedRows",new Set);b(this,"_lastSelectedRowIndex",null);b(this,"_rangeShortcuts",[]);b(this,"_cellSelectionMode","click");b(this,"_selectedCellRange",null);b(this,"_lastClickedCell",null);b(this,"_shouldCopyWithHeaders",!1);b(this,"_oncellselectionchange",null);b(this,"_selectedColumns",new Set);b(this,"_lastSelectedColumnIndex",-1);b(this,"_pasteMode","skip-non-editable");b(this,"_shouldValidateOnPaste",!0);b(this,"_createRowCallback");b(this,"_onbeforepaste");b(this,"_onpaste");b(this,"_isNewRowEnabled",!1);b(this,"_newRowPosition","bottom");b(this,"_newRowIndicator","+");b(this,"_createEmptyRowCallback");b(this,"_emptyRowDraft",null);b(this,"_treePathMember",null);b(this,"_treeLevelMember",null);b(this,"_treeParentMember",null);b(this,"_idMember",null);b(this,"_hasWarnedAboutMissingRowId",!1);b(this,"_treeSeparator",null);b(this,"_treeDataSorted",!1);b(this,"_expandedPaths",new Set);b(this,"_expandedPathsExternal",null);b(this,"_defaultExpandDepth",null);b(this,"_treeIndex",null);b(this,"_onexpandedpathschange");b(this,"_treeDoubleClickBehavior","none");b(this,"_treeExpandedGlyph","▶");b(this,"_treeCollapsedGlyph","▶");b(this,"_treeChevronCallback");b(this,"_treeChevronCache",new WeakMap);b(this,"_paginatedItemsCache",null);b(this,"_displayItemsCache",null)}get items(){return this._items}set items(e){gt.debug("items set:",e.length,"rows"),this._items=e,this._treeChevronCache=new WeakMap,this.rebuildTreeState(),this.requestUpdate()}get columns(){return this._columns}set columns(e){ao.debug("columns set:",e.length,"columns",e.map(o=>String(o.field))),this._columns=e,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(e){this._sortMode=e,this.requestUpdate()}get isFilterable(){return this._isFilterable}set isFilterable(e){this._isFilterable=e,this.requestUpdate()}get onfilterchange(){return this._onfilterchange}set onfilterchange(e){this._onfilterchange=e}get columnMinWidth(){return this._columnMinWidth}set columnMinWidth(e){this._columnMinWidth=e||void 0,this.requestUpdate()}get isPageable(){return this._isPageable}set isPageable(e){this._isPageable=e,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(e){this._pageSize=e,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(e){this._pageSizes=e,this.requestUpdate()}get paginationMode(){return this._paginationMode}set paginationMode(e){this._paginationMode=e,this.requestUpdate()}get isStriped(){return this._isStriped}set isStriped(e){this._isStriped=e,this.requestUpdate()}get isHoverable(){return this._isHoverable}set isHoverable(e){this._isHoverable=e,this.requestUpdate()}get isEditable(){return this._isEditable}set isEditable(e){this._isEditable=e,this.checkEditTriggerConflicts(),this.maybeWarnAboutRowIdentity(),this.requestUpdate()}get isRowEditable(){return this._isRowEditable}set isRowEditable(e){this._isRowEditable=e,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,this.checkSelectionConflicts(),this.checkEditTriggerConflicts(),this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(e){this._editStartSelection=e}get shouldCommitOnClickAway(){return this._shouldCommitOnClickAway}set shouldCommitOnClickAway(e){this._shouldCommitOnClickAway=e}get mode(){return this._mode}set mode(e){this._mode=e,this.applyModeDefaults(),this.checkEditTriggerConflicts(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get shouldShowDropdownOnFocus(){return this._shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(e){this._shouldShowDropdownOnFocus=e}get shouldOpenDropdownOnEnter(){return this._shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(e){this._shouldOpenDropdownOnEnter=e}getEffectiveShouldOpenDropdownOnEnter(e){return e.shouldOpenDropdownOnEnter??this._shouldOpenDropdownOnEnter}get isCheckboxAlwaysEditable(){return this._isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(e){this._isCheckboxAlwaysEditable=e,this.requestUpdate()}get isRowNumbersVisible(){return this._isRowNumbersVisible}set isRowNumbersVisible(e){this._isRowNumbersVisible=e,this.requestUpdate()}get isDirtyIndicatorVisible(){return this._isDirtyIndicatorVisible}set isDirtyIndicatorVisible(e){this._isDirtyIndicatorVisible=e,this.requestUpdate()}get isStickyRowNumbers(){return this._isStickyRowNumbers}set isStickyRowNumbers(e){this._isStickyRowNumbers=e,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(e){this._freezeColumns=Math.max(0,Math.floor(e)),this.requestUpdate()}get visualColumns(){const e=[],o=[];this._columns.filter(s=>s.isFrozen&&!s.isHidden).length,this._columns.forEach((s,n)=>{if(s.isHidden)return;const l={column:s,originalIndex:n};s.isFrozen?e.push(l):o.push(l)});const i=[],r=[];return o.forEach((s,n)=>{n<this._freezeColumns?i.push(s):r.push(s)}),this._columnOrder.size>0&&r.sort((s,n)=>{const l=String(s.column.field),a=String(n.column.field),d=this._columnOrder.get(l)??s.originalIndex,c=this._columnOrder.get(a)??n.originalIndex;return d-c}),[...e,...i,...r]}get totalFrozenColumns(){return this._columns.filter(o=>o.isFrozen).length+this._freezeColumns}isColumnFrozen(e){return e<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(e){this._invalidCells=e,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get isRowToolbarVisible(){return this._isRowToolbarVisible}set isRowToolbarVisible(e){this._isRowToolbarVisible=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(e){this._toolbarVerticalAlign=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(e){this._toolbarHorizontalAlign=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(e){this.toolbarVerticalAlign=e}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(e){this.toolbarHorizontalAlign=e}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(e){this._toolbarTrigger=e,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(e){this._toolbarPosition=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarColumn(){return this._toolbarColumn}set toolbarColumn(e){this._toolbarColumn=e,this.checkToolbarConflicts()}get toolbarFollowsCursor(){return this._toolbarFollowsCursor}set toolbarFollowsCursor(e){this._toolbarFollowsCursor=e,this.checkToolbarConflicts()}get cellToolbar(){return this._cellToolbar}set cellToolbar(e){this._cellToolbar=e,this.checkToolbarConflicts()}get cellToolbarOffset(){return this._cellToolbarOffset}set cellToolbarOffset(e){typeof e=="number"?this._cellToolbarOffset=Math.max(0,Math.min(1,e)):this._cellToolbarOffset=e}get toolbarBtnMinWidth(){return this._toolbarBtnMinWidth}set toolbarBtnMinWidth(e){this._toolbarBtnMinWidth=e}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(e){this._inlineActionsTitle=e,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(e){this._contextMenuXOffset=e}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(e){this._contextMenuYOffset=e}get headerContextMenu(){return this._headerContextMenu}set headerContextMenu(e){this._headerContextMenu=e}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(e){this._rowShortcuts=e,this.requestUpdate()}get isShortcutsHelpVisible(){return this._isShortcutsHelpVisible}set isShortcutsHelpVisible(e){this._isShortcutsHelpVisible=e,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(e){this._shortcutsHelpPosition=e,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(e){this._shortcutsHelpContentCallback=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){gt.debug("sort changed:",e.map(o=>`${o.column} ${o.direction}`).join(", ")||"none"),this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(e){gt.debug("page changed:",e),this._currentPage=e,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(e){this._totalItems=e,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(e){this._showPagination=e,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(e){this._paginationPosition=e,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(e){this._paginationLabelsCallback=e,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(e){this._paginationLayout=e,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(e){this._summaryPosition=e,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(e){this._summaryContentCallback=e,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(e){this._summaryMetadata=e,this.requestUpdate()}get isSummaryInline(){return this._isSummaryInline}set isSummaryInline(e){this._isSummaryInline=e,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(e){this._customStylesCallback=e}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(e){this._rowClassCallback=e,this.requestUpdate()}get labels(){return this._labels}set labels(e){this._labels={...ri,...e},this.requestUpdate()}get isScrollable(){return this._isScrollable}set isScrollable(e){this._isScrollable=e,this.requestUpdate()}get scrollMaxHeight(){return this._scrollMaxHeight}set scrollMaxHeight(e){this._scrollMaxHeight=e,this.requestUpdate()}get tableBorderOnly(){return this._tableBorderOnly}set tableBorderOnly(e){this._tableBorderOnly=e,this.requestUpdate()}get isVirtualScrollEnabled(){return this._isVirtualScrollEnabled}set isVirtualScrollEnabled(e){this._isVirtualScrollEnabled=e,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(e){this._virtualScrollThreshold=e,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(e){this._virtualScrollRowHeight=e,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(e){this._virtualScrollBuffer=e,this.requestUpdate()}get isInfiniteScrollEnabled(){return this._isInfiniteScrollEnabled}set isInfiniteScrollEnabled(e){this._isInfiniteScrollEnabled=e,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(e){this._infiniteScrollThreshold=e}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(e){this._hasMoreItems=e}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(e){this._isLoadingMore=e}shouldUseVirtualScroll(){return this._isVirtualScrollEnabled===!1?!1:this._isVirtualScrollEnabled===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}set onrowchange(e){this._onrowchange=e}set onroweditstart(e){this._onroweditstart=e}set onroweditcancel(e){this._onroweditcancel=e}set onvalidationerror(e){this._onvalidationerror=e}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(e){this._validationTooltipCallback=e}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(e){this._ontoolbarclick=e}set onrowaction(e){this._onrowaction=e}get oncontextmenuopen(){return this._oncontextmenuopen}set oncontextmenuopen(e){this._oncontextmenuopen=e}get onheadercontextmenuopen(){return this._onheadercontextmenuopen}set onheadercontextmenuopen(e){this._onheadercontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get idValueMember(){return this._idValueMember}set idValueMember(e){this._idValueMember=e}get idValueCallback(){return this._idValueCallback}set idValueCallback(e){this._idValueCallback=e}get rowLocking(){return this._rowLocking}set rowLocking(e){this._rowLocking=e,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(e){this._onrowlockchange=e}get gridName(){return this._gridName}set gridName(e){this._gridName=e}get shouldPersistColumnWidths(){return this._shouldPersistColumnWidths}set shouldPersistColumnWidths(e){this._shouldPersistColumnWidths=e}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(e){this._oncolumnresize=e}get isColumnReorderAllowed(){return this._isColumnReorderAllowed}set isColumnReorderAllowed(e){this._isColumnReorderAllowed=e}get shouldPersistColumnOrder(){return this._shouldPersistColumnOrder}set shouldPersistColumnOrder(e){this._shouldPersistColumnOrder=e}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(e){this._oncolumnreorder=e}get fillDirection(){return this._fillDirection}set fillDirection(e){this._fillDirection=e}get fillDragCallback(){return this._fillDragCallback}set fillDragCallback(e){this._fillDragCallback=e}get selectedRows(){return Array.from(this._selectedRows).sort((e,o)=>e-o)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(e){this._rangeShortcuts=e}isRowSelected(e){return this._selectedRows.has(e)}selectRow(e,o="replace"){switch(Le.debug("selectRow:",{rowIndex:e,mode:o}),this._selectedCellRange&&(this._selectedCellRange=null),this._selectedColumns.clear(),o){case"replace":this._selectedRows.clear(),this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"toggle":this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,e),r=Math.max(this._lastSelectedRowIndex,e);for(let s=i;s<=r;s++)this._selectedRows.add(s)}else this._selectedRows.add(e),this._lastSelectedRowIndex=e;break}this.requestUpdate()}selectRowRange(e,o){this._selectedColumns.clear(),this._selectedCellRange=null,this._selectedRows.clear();const i=Math.min(e,o),r=Math.max(e,o);for(let s=i;s<=r;s++)this._selectedRows.add(s);this._lastSelectedRowIndex=o,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}clearSelection_noRender(){this._selectedRows.clear(),this._lastSelectedRowIndex=null}getSelectedRowsData(){return this.selectedRows.map(e=>this.displayItems[e]).filter(Boolean)}async copySelectedRowsToClipboard(){const e=this.selectedRows;if(e.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of this.visualColumns){const n=s.column.title??s.column.field??"";r.push(String(n))}o.push(r.join(" "))}for(const r of e){const s=this.displayItems[r];if(!s)continue;const n=[];for(const l of this.visualColumns){const a=String(l.column.field),d=s[a],c=d==null?"":String(d);n.push(c)}o.push(n.join(" "))}const i=o.join(`
297
297
  `);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}async copySelectedColumnsToClipboard(){const e=this.selectedColumns;if(e.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of e){const n=this.visualColumns[s];if(!n)continue;const l=n.column.title??n.column.field??"";r.push(String(l))}o.push(r.join(" "))}for(let r=0;r<this.displayItems.length;r++){const s=this.displayItems[r];if(!s)continue;const n=[];for(const l of e){const a=this.visualColumns[l];if(!a)continue;const d=String(a.column.field),c=s[d],u=c==null?"":String(c);n.push(u)}o.push(n.join(" "))}const i=o.join(`
298
298
  `);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}get cellSelectionMode(){return this._cellSelectionMode}set cellSelectionMode(e){this._cellSelectionMode=e,this.checkSelectionConflicts(),this.requestUpdate()}get shouldCopyWithHeaders(){return this._shouldCopyWithHeaders}set shouldCopyWithHeaders(e){this._shouldCopyWithHeaders=e}get selectedCellRange(){return this._selectedCellRange}get lastClickedCell(){return this._lastClickedCell}set lastClickedCell(e){this._lastClickedCell=e}get oncellselectionchange(){return this._oncellselectionchange}set oncellselectionchange(e){this._oncellselectionchange=e}get pasteMode(){return this._pasteMode}set pasteMode(e){this._pasteMode=e}get shouldValidateOnPaste(){return this._shouldValidateOnPaste}set shouldValidateOnPaste(e){this._shouldValidateOnPaste=e}get createRowCallback(){return this._createRowCallback}set createRowCallback(e){this._createRowCallback=e}get onbeforepaste(){return this._onbeforepaste}set onbeforepaste(e){this._onbeforepaste=e}get onpaste(){return this._onpaste}set onpaste(e){this._onpaste=e}get isNewRowEnabled(){return this._isNewRowEnabled}set isNewRowEnabled(e){e&&!this.isNavigateMode&&console.warn('[WebGrid] Empty row requires navigate mode (editTrigger: "navigate"). Tab navigation will not work correctly without it.'),this._isNewRowEnabled=e,this._emptyRowDraft=null,this.requestUpdate()}get newRowPosition(){return this._newRowPosition}set newRowPosition(e){this._newRowPosition=e,this.requestUpdate()}get newRowIndicator(){return this._newRowIndicator}set newRowIndicator(e){this._newRowIndicator=e,this.requestUpdate()}get createEmptyRowCallback(){return this._createEmptyRowCallback}set createEmptyRowCallback(e){this._createEmptyRowCallback=e}get idMember(){return this._idMember}set idMember(e){this._idMember=e||null,this.maybeWarnAboutRowIdentity()}getStableRowKey(e,o){if(this._idMember){const i=e[this._idMember];if(i!=null)return String(i)}if(this._treePathMember){const i=e[this._treePathMember];if(i!=null)return String(i)}return String(o)}maybeWarnAboutRowIdentity(){this._hasWarnedAboutMissingRowId||this._isEditable&&(this._idMember||this._treePathMember||(this._hasWarnedAboutMissingRowId=!0,console.warn("[WebGrid] editable grid has no `idMember` (and no `treePathMember`). Internal state (drafts, invalid-cell markers) will be keyed by displayed index, so re-ordering (sort, filter, pagination) can move state to the wrong row. Set `idMember` to the field that uniquely identifies each row.")))}get treePathMember(){return this._treePathMember}set treePathMember(e){this._treePathMember=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeLevelMember(){return this._treeLevelMember}set treeLevelMember(e){this._treeLevelMember=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeParentMember(){return this._treeParentMember}set treeParentMember(e){this._treeParentMember=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeSeparator(){return this._treeSeparator}set treeSeparator(e){this._treeSeparator=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeDataSorted(){return this._treeDataSorted}set treeDataSorted(e){this._treeDataSorted=e,this.requestUpdate()}get expandedPaths(){return this._expandedPaths}set expandedPaths(e){this._expandedPathsExternal=e instanceof Set?e:null,this.rebuildExpandedPaths(),this.requestUpdate()}get defaultExpandDepth(){return this._defaultExpandDepth}set defaultExpandDepth(e){this._defaultExpandDepth=typeof e=="number"&&e>=0?e:null,this._expandedPathsExternal||(this.rebuildExpandedPaths(),this.requestUpdate())}get onexpandedpathschange(){return this._onexpandedpathschange}set onexpandedpathschange(e){this._onexpandedpathschange=e}get isTreeMode(){return!!this._treePathMember&&!!this._treeIndex}isPathExpanded(e){return this._expandedPaths.has(e)}toggleExpandedPath(e){var i,r;const o=this._expandedPaths.has(e);$t.debug("toggleExpandedPath start:",e,"| willExpand:",!o,"| _items.length:",this._items.length,"| treeNodes:",((i=this._treeIndex)==null?void 0:i.nodes.size)??0),o?this._expandedPaths.delete(e):this._expandedPaths.add(e),Le.debug("tree toggle:",e,o?"expanded → collapsed":"collapsed → expanded","| set size now:",this._expandedPaths.size),(r=this._onexpandedpathschange)==null||r.call(this,{path:e,expanded:!o,expandedPaths:this._expandedPaths}),this.requestUpdate()}expandAll(){if(this._treeIndex){this._expandedPaths.clear();for(const e of this._treeIndex.nodes.keys())this._expandedPaths.add(e);Le.debug("tree expandAll: size =",this._expandedPaths.size),this.requestUpdate()}}collapseAll(){this._expandedPaths.clear(),Le.debug("tree collapseAll"),this.requestUpdate()}expandSubtree(e){if(!this._treeIndex||!this._treeIndex.nodes.get(e))return;const i=[e];for(;i.length;){const r=i.shift();this._expandedPaths.add(r);const s=this._treeIndex.nodes.get(r);s&&i.push(...s.childPaths)}this.requestUpdate()}collapseSubtree(e){if(!this._treeIndex||!this._treeIndex.nodes.get(e))return;const i=[e];for(;i.length;){const r=i.shift();this._expandedPaths.delete(r);const s=this._treeIndex.nodes.get(r);s&&i.push(...s.childPaths)}this.requestUpdate()}findNearestExpandedAncestor(e){var i,r;if(!this._treeIndex)return null;let o=((i=this._treeIndex.nodes.get(e))==null?void 0:i.parent)??null;for(;o!==null;){if(this._expandedPaths.has(o))return o;o=((r=this._treeIndex.nodes.get(o))==null?void 0:r.parent)??null}return null}getRowTreeInfo(e){if(!this.isTreeMode)return null;const o=this.getRowTreePath(e);if(!o)return null;const i=this._treeIndex.nodes.get(o);return i?{path:o,level:i.level,hasChildren:i.childPaths.length>0}:null}get treeDoubleClickBehavior(){return this._treeDoubleClickBehavior}set treeDoubleClickBehavior(e){this._treeDoubleClickBehavior=e||"none"}get treeExpandedGlyph(){return this._treeExpandedGlyph}set treeExpandedGlyph(e){this._treeExpandedGlyph=e??"▶",this.requestUpdate()}get treeCollapsedGlyph(){return this._treeCollapsedGlyph}set treeCollapsedGlyph(e){this._treeCollapsedGlyph=e??"▶",this.requestUpdate()}get treeChevronCallback(){return this._treeChevronCallback}set treeChevronCallback(e){this._treeChevronCallback=e,this._treeChevronCache=new WeakMap,this.requestUpdate()}getTreeChevronHtml(e,o,i,r,s){const n=this._treeChevronCallback;if(!n)return i?o?this._treeExpandedGlyph:this._treeCollapsedGlyph:"";const l=e;let a=this._treeChevronCache.get(l);a||(a=new Map,this._treeChevronCache.set(l,a));const d=`${o?"e":"c"}|${i?"1":"0"}`;let c=a.get(d);return c===void 0&&(c=n({expanded:o,hasChildren:i,row:e,level:r,path:s}),a.set(d,c)),c}getRowTreePath(e){if(!this._treePathMember)return null;const o=e[this._treePathMember];if(o==null)return null;const i=String(o);return i===""?null:i}detectTreeSeparator(e){return e.includes("/")?"/":e.includes("\\")?"\\":(e.includes("."),".")}rebuildTreeState(){if(!this._treePathMember||this._items.length===0){this._treeIndex=null,this.rebuildExpandedPaths();return}let e=this._treeSeparator;if(!e){for(const r of this._items){const s=this.getRowTreePath(r);if(s){e=this.detectTreeSeparator(s);break}}e=e||"."}const o=new Map;for(let r=0;r<this._items.length;r++){const s=this._items[r],n=this.getRowTreePath(s);if(!n)continue;let l=0;if(this._treeLevelMember){const d=s[this._treeLevelMember];typeof d=="number"&&(l=d)}else l=Math.max(0,n.split(e).filter(Boolean).length-1);let a=null;if(this._treeParentMember){const d=s[this._treeParentMember];a=d==null||d===""?null:String(d)}else{const d=n.endsWith(e)?n.slice(0,-e.length):n,c=d.lastIndexOf(e);a=c<0?null:d.slice(0,c)||null}o.set(n,{path:n,parent:a,level:l,rowIndex:r,childPaths:[]})}const i=[];for(const r of o.values())r.parent&&o.has(r.parent)?o.get(r.parent).childPaths.push(r.path):i.push(r.path);this._treeIndex={separator:e,nodes:o,rootPaths:i},this.rebuildExpandedPaths()}rebuildExpandedPaths(){if(this._expandedPathsExternal){this._expandedPaths=this._expandedPathsExternal;return}const e=new Set;if(this._treeIndex)if(this._defaultExpandDepth!==null)for(const o of this._treeIndex.nodes.values())o.level<this._defaultExpandDepth&&e.add(o.path);else for(const o of this._treeIndex.nodes.keys())e.add(o);this._expandedPaths=e}compareTreeNodes(e,o){const i=this._items[e.rowIndex],r=this._items[o.rowIndex];for(const s of this._sort){const n=i[s.column],l=r[s.column];if(n===l)continue;let a=0;return typeof n=="string"&&typeof l=="string"?a=n.localeCompare(l):typeof n=="number"&&typeof l=="number"?a=n-l:a=String(n??"").localeCompare(String(l??"")),s.direction==="asc"?a:-a}return e.path.localeCompare(o.path)}getTreeFilterAllowedPaths(){var r,s;if(!this._treeIndex||!this._isFilterable)return null;const e=Object.entries(this._filters).filter(([,n])=>!!n);if(e.length===0)return null;const o=new Set;for(const n of this._treeIndex.nodes.values()){const l=this._items[n.rowIndex];let a=!0;for(const[d,c]of e)if(!String(l[d]??"").toLowerCase().includes(c.toLowerCase())){a=!1;break}a&&o.add(n.path)}const i=new Set(o);for(const n of o){let l=((r=this._treeIndex.nodes.get(n))==null?void 0:r.parent)??null;for(;l&&!i.has(l);)i.add(l),l=((s=this._treeIndex.nodes.get(l))==null?void 0:s.parent)??null}return i}getTreeSortedItems(){const e=performance.now();if(ie.counters.treeSorted++,!this._treeIndex)return ie.counters.treeSortedMs+=performance.now()-e,this._items;const o=this.getTreeFilterAllowedPaths();if(this._treeDataSorted){const n=[];for(let l=0;l<this._items.length;l++){const a=this._items[l],d=this.getRowTreePath(a);d&&(o&&!o.has(d)||n.push(a))}return ie.counters.treeSortedMs+=performance.now()-e,n}const i=this._treeIndex,r=[],s=n=>{const l=o?n.filter(a=>o.has(a)):[...n];l.sort((a,d)=>this.compareTreeNodes(i.nodes.get(a),i.nodes.get(d)));for(const a of l){const d=i.nodes.get(a);r.push(this._items[d.rowIndex]),d.childPaths.length>0&&s(d.childPaths)}};return s(i.rootPaths),ie.counters.treeSortedMs+=performance.now()-e,r}getTreeVisibleItems(){const e=performance.now();if(ie.counters.treeVisible++,!this._treeIndex)return ie.counters.treeVisibleMs+=performance.now()-e,this._items;const o=this.getTreeSortedItems(),i=this._treeIndex,r=this.getTreeFilterAllowedPaths()!==null,s=[];for(const n of o){const l=this.getRowTreePath(n);if(!l){s.push(n);continue}const a=i.nodes.get(l);if(!a){s.push(n);continue}let d=!0,c=a.parent;for(;c;){if(!this.isPathExpanded(c)&&!r){d=!1;break}const u=i.nodes.get(c);c=u?u.parent:null}d&&s.push(n)}return ie.counters.treeVisibleMs+=performance.now()-e,s}selectCellRange(e){if(Le.debug("selectCellRange:",{startRow:e.startRowIndex,startCol:e.startColIndex,endRow:e.endRowIndex,endCol:e.endColIndex}),this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null),this._selectedColumns.clear(),this._selectedCellRange=e,this.requestUpdate(),this._oncellselectionchange){const o=this.getSelectedCells();this._oncellselectionchange({range:e,cellCount:o.length})}}clearCellSelection(){this._selectedCellRange&&(this._selectedCellRange=null,this.requestUpdate(),this._oncellselectionchange&&this._oncellselectionchange({range:null,cellCount:0}))}clearCellSelection_noRender(){this._selectedCellRange&&(this._selectedCellRange=null,this._oncellselectionchange&&this._oncellselectionchange({range:null,cellCount:0}))}selectAll(){const e=this.displayItems.length,o=this.visualColumns.length;if(e===0||o===0)return;const i=this.visualColumns[0],r=this.visualColumns[o-1],s={startRowIndex:0,startColIndex:0,endRowIndex:e-1,endColIndex:o-1,startField:String(i.column.field),endField:String(r.column.field)};this.selectCellRange(s)}selectColumn(e,o="replace"){const i=this.visualColumns.length;if(!(e<0||e>=i)){if(this._selectedRows.clear(),this._selectedCellRange=null,o==="replace")this._selectedColumns.clear(),this._selectedColumns.add(e),this._lastSelectedColumnIndex=e;else if(o==="toggle")this._selectedColumns.has(e)?this._selectedColumns.delete(e):this._selectedColumns.add(e),this._lastSelectedColumnIndex=e;else if(o==="range"){const r=this._lastSelectedColumnIndex>=0?this._lastSelectedColumnIndex:e,s=Math.min(r,e),n=Math.max(r,e);for(let l=s;l<=n;l++)this._selectedColumns.add(l)}this.requestUpdate()}}clearColumnSelection(){this._selectedColumns.clear(),this._lastSelectedColumnIndex=-1,this.requestUpdate()}clearColumnSelection_noRender(){this._selectedColumns.clear(),this._lastSelectedColumnIndex=-1}selectColumnRange(e,o){this._selectedRows.clear(),this._selectedCellRange=null,this._selectedColumns.clear();const i=Math.min(e,o),r=Math.max(e,o);for(let s=i;s<=r;s++)this._selectedColumns.add(s);this._lastSelectedColumnIndex=o,this.requestUpdate()}get selectedColumns(){return Array.from(this._selectedColumns).sort((e,o)=>e-o)}isColumnSelected(e){return this._selectedColumns.has(e)}getSelectedCells(){var c;if(!this._selectedCellRange)return[];const{startRowIndex:e,endRowIndex:o,startColIndex:i,endColIndex:r}=this._selectedCellRange,s=Math.min(e,o),n=Math.max(e,o),l=Math.min(i,r),a=Math.max(i,r),d=[];for(let u=s;u<=n;u++)for(let h=l;h<=a;h++){const g=(c=this.visualColumns[h])==null?void 0:c.column;if(!g)continue;const f=this.displayItems[u];if(!f)continue;const w=String(g.field),p=f[w];d.push({row:f,rowIndex:u,colIndex:h,field:w,value:p})}return d}isCellInSelectedRange(e,o){if(!this._selectedCellRange)return!1;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=this._selectedCellRange,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);return e>=l&&e<=a&&o>=d&&o<=c}async copyCellSelectionToClipboard(){var u,h;if(!this._selectedCellRange)return!1;const{startRowIndex:e,endRowIndex:o,startColIndex:i,endColIndex:r}=this._selectedCellRange,s=Math.min(e,o),n=Math.max(e,o),l=Math.min(i,r),a=Math.max(i,r),d=[];if(this._shouldCopyWithHeaders){const g=[];for(let f=l;f<=a;f++){const w=(u=this.visualColumns[f])==null?void 0:u.column,p=(w==null?void 0:w.title)??(w==null?void 0:w.field)??"";g.push(String(p))}d.push(g.join(" "))}for(let g=s;g<=n;g++){const f=this.displayItems[g];if(!f)continue;const w=[];for(let p=l;p<=a;p++){const m=(h=this.visualColumns[p])==null?void 0:h.column;if(!m){w.push("");continue}const _=String(m.field),y=f[_],C=y==null?"":String(y);w.push(C)}d.push(w.join(" "))}const c=d.join(`
299
299
  `);try{return await navigator.clipboard.writeText(c),!0}catch{return!1}}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(e=>e.editTrigger==="navigate")}get filteredItems(){return this._onfilterchange?this._items:!this._isFilterable||Object.keys(this._filters).length===0?this._items:this._items.filter(e=>Object.entries(this._filters).every(([o,i])=>{if(!i)return!0;const r=this._columns.find(n=>String(n.field)===o);if(r!=null&&r.filter){const n=r.filter(i,e);return n===null?!0:n}return String(e[o]??"").toLowerCase().includes(i.toLowerCase())}))}getInvalidFilterFields(){const e=new Set,o=this._items[0];if(!o)return e;for(const[i,r]of Object.entries(this._filters)){if(!r)continue;const s=this._columns.find(n=>String(n.field)===i);s!=null&&s.filter&&s.filter(r,o)===null&&e.add(i)}return e}get filters(){return{...this._filters}}set filters(e){var o;this._filters={...e},(o=this._onfilterchange)==null||o.call(this,{...this._filters}),this.requestUpdate()}setFilter(e,o){var i;if(o)this._filters={...this._filters,[e]:o};else{const r={...this._filters};delete r[e],this._filters=r}(i=this._onfilterchange)==null||i.call(this,{...this._filters}),this.requestUpdate()}get sortedItems(){return this.isTreeMode?this.getTreeSortedItems():this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((e,o)=>{for(const i of this._sort){const r=e[i.column],s=o[i.column];if(r===s)continue;let n=0;return typeof r=="string"&&typeof s=="string"?n=r.localeCompare(s):typeof r=="number"&&typeof s=="number"?n=r-s:n=String(r??"").localeCompare(String(s??"")),i.direction==="asc"?n:-n}return 0})}get paginatedItems(){if(this._paginatedItemsCache!==null)return this._paginatedItemsCache;const e=performance.now();ie.counters.paginatedItems++;const o=this.isTreeMode?this.getTreeVisibleItems():this.sortedItems;let i;if(!this._isPageable)i=o;else if(this._paginationMode==="server")i=o;else{const r=(this._currentPage-1)*this._pageSize,s=r+this._pageSize;i=o.slice(r,s)}return this._paginatedItemsCache=i,ie.counters.paginatedItemsMs+=performance.now()-e,i}get totalPages(){let e;return this._totalItems!==null?e=this._totalItems:this.isTreeMode?e=this.getTreeVisibleItems().length:e=this.sortedItems.length,Math.max(1,Math.ceil(e/this._pageSize))}get displayItems(){if(this._displayItemsCache!==null)return this._displayItemsCache;const e=performance.now();ie.counters.displayItems++;const o=this.paginatedItems;let i;if(!this._isNewRowEnabled)i=o;else{const r=this.getEmptyRow();i=this._newRowPosition==="top"?[r,...o]:[...o,r]}return this._displayItemsCache=i,ie.counters.displayItemsMs+=performance.now()-e,i}getEmptyRow(){if(this._emptyRowDraft)return this._emptyRowDraft;const e=this.createNewEmptyRow();return this._emptyRowDraft=e,e}createNewEmptyRow(){if(this._createEmptyRowCallback){const o=this._createEmptyRowCallback();return o instanceof Promise?(o.then(i=>{this._emptyRowDraft=i,this.requestUpdate()}).catch(i=>{console.warn("WebGrid: createEmptyRowCallback failed",i)}),{}):o}const e={};for(const o of this._columns)e[String(o.field)]=null;return e}isEmptyRowIndex(e){return this._isNewRowEnabled?this._newRowPosition==="top"?e===0:e===this.paginatedItems.length:!1}getDataIndexFromDisplayIndex(e){return this._isNewRowEnabled&&this._newRowPosition==="top"?e-1:e}emptyRowHasData(e){for(const o of this._columns){const i=e[String(o.field)];if(i!=null&&i!=="")return!0}return!1}fireDataRequest(e){if(this._ondatarequest){const o=e==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:e,mode:e==="loadMore"?"append":"replace",skip:o};gt.debug("fireDataRequest:",e,i),this._ondatarequest(i)}}getColumnSortState(e){return this._sort.find(o=>o.column===e)}getColumnSortPriority(e){const o=this._sort.findIndex(i=>i.column===e);return o>=0?o+1:0}applyModeDefaults(){switch(this._mode){case"read-only":this._isEditable=!1,this._dropdownToggleVisibility="on-focus",this._cellSelectionMode="click";break;case"excel":this._isEditable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._shouldShowDropdownOnFocus=!1,this._cellSelectionMode="click";break;case"input-matrix":this._isEditable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._shouldShowDropdownOnFocus=!0,this._cellSelectionMode="shift";break}}checkSelectionConflicts(){this._cellSelectionMode==="click"&&this._editTrigger==="click"&&console.warn('WebGrid: cellSelectionMode="click" conflicts with editTrigger="click". Cell range selection takes priority. Use Shift+click to enter edit mode, or change to cellSelectionMode="shift" to avoid confusion.')}checkEditTriggerConflicts(){!this._isEditable&&this._editTrigger==="always"&&console.warn(`%cWebGrid: editTrigger="always" is not supported in read-only mode (isEditable=false).
@@ -304,7 +304,7 @@ horizontalAlign only applies to toolbarPosition="top".`,r),this._toolbarColumn!=
304
304
  toolbarColumn only applies to toolbarPosition="top".`,r),this._toolbarFollowsCursor&&!i&&console.warn(`%cWebGrid: toolbarFollowsCursor has no effect with toolbarPosition="${e}".
305
305
  toolbarFollowsCursor only applies to toolbarPosition="top".`,r),this._cellToolbar!==void 0&&!i&&console.warn(`%cWebGrid: cellToolbar has no effect with toolbarPosition="${e}".
306
306
  cellToolbar requires toolbarPosition="top".`,r),this._toolbarFollowsCursor&&this._toolbarColumn!==void 0&&console.warn(`%cWebGrid: toolbarColumn and toolbarFollowsCursor are both set.
307
- toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate(){}invalidateDisplayCache(){this._paginatedItemsCache=null,this._displayItemsCache=null}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}isCellDirty(e,o){const i=this._draftRows.get(e);if(!i)return!1;const r=this.displayItems[e];if(!r)return!1;const s=i[o],n=r[o];return s!==n}isRowDirty(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e);const o=this.rowKeyForIndex(e);o!==null&&(this._invalidCells=this._invalidCells.filter(i=>i.rowKey!==o)),this.requestUpdate()}discardCellDraft(e,o){const i=this._draftRows.get(e);if(!i)return;const r=this.displayItems[e];if(!r)return;const s=r[o];i[o]=s;const n=Object.keys(i);let l=!1;for(const d of n){const c=i[d],u=r[d];if(c!==u){l=!0;break}}l||this._draftRows.delete(e);const a=this.rowKeyForIndex(e);a!==null&&(this._invalidCells=this._invalidCells.filter(d=>!(d.rowKey===a&&d.field===o)))}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,o,i){if(!this.isEmptyRowIndex(o)){const r=this._draftRows.get(o);if(r)return r[i]}return e[i]}getCellValue(e,o,i){var s;if(o.templateCallback)return o.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(o.field)):e[String(o.field)];if(o.formatCallback)return o.formatCallback(r,e);if(o.editor==="date"&&((s=o.editorOptions)!=null&&s.dateFormat)&&r)try{const n=r instanceof Date?r:new Date(r);if(!isNaN(n.getTime())){const l=Dt(o.editorOptions.dateFormat);return io(n,l)}}catch{}return String(r??"")}rowKeyForIndex(e){const o=this.displayItems[e];return o===void 0?null:this.getStableRowKey(o,e)}isCellInvalid(e,o){const i=this.rowKeyForIndex(e);return i===null?!1:this._invalidCells.some(r=>r.rowKey===i&&r.field===o)}getCellValidationError(e,o){const i=this.rowKeyForIndex(e);if(i===null)return null;const r=this._invalidCells.find(s=>s.rowKey===i&&s.field===o);return(r==null?void 0:r.error)||null}addInvalidCell(e,o,i){const r=this.rowKeyForIndex(e);if(r===null)return;const s=this._invalidCells.findIndex(n=>n.rowKey===r&&n.field===o);s>=0?this._invalidCells[s]={rowKey:r,field:o,error:i}:this._invalidCells=[...this._invalidCells,{rowKey:r,field:o,error:i}]}removeInvalidCell(e,o){const i=this.rowKeyForIndex(e);i!==null&&(this._invalidCells=this._invalidCells.filter(r=>!(r.rowKey===i&&r.field===o)))}isEditing(e,o){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===e&&((r=this._editingCell)==null?void 0:r.field)===o}shouldShowEditor(e,o){const i=this._columns[o];if(!i)return!1;const r=String(i.field);return!!(this.isEditing(e,r)||(i.editTrigger??this._editTrigger)==="always"&&this.isCellEditable(i))}startEdit(e,o,i){var n,l;if(!this.canEditCell(e,o)){Le.debug("startEdit blocked (locked):",{rowIndex:e,field:o});return}Le.debug("startEdit:",{rowIndex:e,field:o,options:i});const r=this.displayItems[e];if(!r)return;this._draftRows.has(e)||this._draftRows.set(e,{...r});const s=this._editingCell;this._editingCell={rowIndex:e,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(n=this._onInteractionChange)==null||n.call(this,"editingCell",{prev:s,current:this._editingCell}),this._currentCellError=null,(l=this._onroweditstart)==null||l.call(this,{row:r,rowIndex:e,field:o})}cancelEdit(){var e,o;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:s}=i,n=this.displayItems[r];n&&((e=this._onroweditcancel)==null||e.call(this,{row:n,rowIndex:r,field:s})),this._editingCell=null,(o=this._onInteractionChange)==null||o.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(e,o){return e==null||e===!0?{valid:!0,finalValue:o}:e===!1?{valid:!1,message:"Validation failed",finalValue:o}:typeof e=="string"?{valid:!1,message:e,finalValue:o}:{valid:e.valid,message:e.message,finalValue:e.transformedValue!==void 0?e.transformedValue:o}}async commitEdit(e,o,i,r=!1){var w,p,m,_,y,C,S;gt.debug("commitEdit:",{rowIndex:e,field:o,newValue:i});const s=this._columns.find(v=>String(v.field)===o);if(!s)return;const n=this.displayItems[e];if(!n)return;const l=this.isEmptyRowIndex(e),a=n[o];let d=i,c=null,u=!0;this._isValidating=!0;try{if(s.beforeCommitCallback){const v={value:i,oldValue:a,row:n,rowIndex:e,field:o},x=await Promise.resolve(s.beforeCommitCallback(v)),k=this.normalizeValidationResult(x,i);u=k.valid,c=k.message||null,d=k.finalValue}else if(s.validateCallback){const v=await Promise.resolve(s.validateCallback(i,n));v&&(u=!1,c=v)}}catch(v){u=!1,c=v instanceof Error?v.message:"Validation failed"}if(this._isValidating=!1,l){if(this._emptyRowDraft||(this._emptyRowDraft={...n}),this._emptyRowDraft[o]=d,u?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,c||"Invalid value"),this._currentCellError=c,(w=this._onvalidationerror)==null||w.call(this,{row:n,rowIndex:e,field:o,error:c||"Invalid value"})),r&&this.emptyRowHasData(this._emptyRowDraft)){const k={...this._emptyRowDraft},E=this._newRowPosition==="top"?0:this._items.length,I=this.getStableRowKey(this._emptyRowDraft,e);this._newRowPosition==="top"?this._items=[k,...this._items]:this._items=[...this._items,k];const R=this.getStableRowKey(k,E),P=!this._idMember&&!this._treePathMember;this._invalidCells=this._invalidCells.map(A=>{if(A.rowKey===I)return{...A,rowKey:R};if(P&&this._newRowPosition==="top"){const F=Number(A.rowKey);if(!Number.isNaN(F))return{...A,rowKey:String(F+1)}}return A});const D=this._invalidCells.some(A=>A.rowKey===R);(p=this._onrowchange)==null||p.call(this,{row:k,draftRow:k,rowIndex:E,field:o,oldValue:null,newValue:d,isValid:!D,validationError:D?"Row has invalid cells":null}),this._emptyRowDraft=null;const M=this._editingCell;this._editingCell=null,(m=this._onInteractionChange)==null||m.call(this,"editingCell",{prev:M,current:null}),this.requestUpdate();return}const v=this._editingCell;this._editingCell=null,(_=this._onInteractionChange)==null||_.call(this,"editingCell",{prev:v,current:null});return}let h=this._draftRows.get(e);h||(h={...n},this._draftRows.set(e,h)),h[o]=d,u?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,c||"Invalid value"),this._currentCellError=c,(y=this._onvalidationerror)==null||y.call(this,{row:n,rowIndex:e,field:o,error:c||"Invalid value"})),(d!==a||!u)&&((C=this._onrowchange)==null||C.call(this,{row:n,draftRow:h,rowIndex:e,field:o,oldValue:a,newValue:d,isValid:u,validationError:c}));const f=this._editingCell;this._editingCell=null,(S=this._onInteractionChange)==null||S.call(this,"editingCell",{prev:f,current:null})}updateDraftValue(e,o,i){var l;if(!this._columns.find(a=>String(a.field)===o))return;const s=this.displayItems[e];if(!s)return;const n=this.getCellRawValue(s,e,o);if(this.isEmptyRowIndex(e))this._emptyRowDraft||(this._emptyRowDraft={...s}),this._emptyRowDraft[o]=i;else{let a=this._draftRows.get(e);a||(a={...s},this._draftRows.set(e,a)),a[o]=i}if(i!==n){const a=this._draftRows.get(e)||this._emptyRowDraft||s;(l=this._onrowchange)==null||l.call(this,{row:s,draftRow:a,rowIndex:e,field:o,oldValue:n,newValue:i,isValid:!0,validationError:null})}}isCellEditable(e,o){return this.isTreeMode&&e.isTree||e.isEditable===!1||typeof e.isEditable=="function"&&o!==void 0&&!e.isEditable(o)||this._isRowEditable!==void 0&&o!==void 0&&!(typeof this._isRowEditable=="function"?this._isRowEditable(o):this._isRowEditable)?!1:e.isEditable===!0||typeof e.isEditable=="function"&&o!==void 0?!0:this._isEditable}getEditableColumns(e){return this._columns.map((o,i)=>({index:i,column:o})).filter(({column:o})=>this.isCellEditable(o,e))}findNextEditableCell(e,o,i){const r=this.displayItems,s=i==="forward"?1:-1,n=r[e];if(n!==void 0){const a=this.getEditableColumns(n),d=o+s;if(d>=0&&d<a.length)return{rowIndex:e,colIndex:a[d].index}}let l=e+s;for(;l>=0&&l<r.length;){const a=r[l],d=this.getEditableColumns(a);if(d.length>0){const c=i==="forward"?d[0]:d[d.length-1];return{rowIndex:l,colIndex:c.index}}l+=s}return null}isCellFocused(e,o){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===e&&((r=this._focusedCell)==null?void 0:r.colIndex)===o}get focusedCell(){return this._focusedCell}setFocusedCell(e,o){var s;const i=this._focusedCell,r={rowIndex:e,colIndex:o};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(s=this._onInteractionChange)==null||s.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var o;const e=this._focusedCell;e!==null&&(this._focusedCell=null,(o=this._onInteractionChange)==null||o.call(this,"focusedCell",{prev:e,current:null}))}get tabTraversalStartColIndex(){return this._tabTraversalStartColIndex}set tabTraversalStartColIndex(e){this._tabTraversalStartColIndex=e}setHoveredRow(e){var i;if(this._hoveredRowIndex===e)return;const o=this._hoveredRowIndex;this._hoveredRowIndex=e,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:o,current:e})}get focusedRowIndex(){return this._focusedRowIndex}set focusedRowIndex(e){e===null?this.clearRowFocus():this.setFocusedRow(e),this.requestUpdate()}get onrowfocus(){return this._onrowfocus}set onrowfocus(e){this._onrowfocus=e}isRowFocused(e){return this._focusedRowIndex===e}clearRowFocus(){var o;if(this._focusedRowIndex===null)return;const e=this._focusedRowIndex;this._focusedRowIndex=null,(o=this._onInteractionChange)==null||o.call(this,"focusedRow",{prev:e,current:null})}setFocusedRow(e){var r;if(this._focusedRowIndex===e)return;Le.debug("setFocusedRow:",e,"(prev:",this._focusedRowIndex,")");const o=this._focusedRowIndex;this._focusedRowIndex=e,(r=this._onInteractionChange)==null||r.call(this,"focusedRow",{prev:o,current:e});const i=this.displayItems[e];i&&this._onrowfocus&&this._onrowfocus({rowIndex:e,row:i,previousRowIndex:o})}getRowId(e){if(this._idValueCallback)return this._idValueCallback(e);if(this._idValueMember)return e[String(this._idValueMember)]}findRowById(e){const o=this._items.findIndex(i=>this.getRowId(i)===e);return o===-1?null:{row:this._items[o],index:o}}getRowLockInfo(e){let o,i,r=-1;if(typeof e=="object"&&e!==null)o=e,i=this.getRowId(o),r=this._items.indexOf(o),r===-1&&(r=this.displayItems.indexOf(o));else{i=e;const n=this.findRowById(i);n&&(o=n.row,r=n.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!o)return null;const s=this._rowLocking;if(!s)return null;if(s.getLockInfoCallback){const n=s.getLockInfoCallback(o,r);if(n!=null&&n.isLocked)return n}if(s.isLockedCallback&&s.isLockedCallback(o,r))return{isLocked:!0};if(s.lockInfoMember){const n=o[String(s.lockInfoMember)];if(n!=null&&n.isLocked)return n}return s.lockedMember&&o[String(s.lockedMember)]?{isLocked:!0}:null}isRowLocked(e){const o=this.getRowLockInfo(e);return(o==null?void 0:o.isLocked)===!0}lockRowById(e,o){var s;const i={isLocked:!0,lockedBy:o==null?void 0:o.lockedBy,lockedAt:(o==null?void 0:o.lockedAt)??new Date,reason:o==null?void 0:o.reason,...o};this._externalLocks.set(e,i);const r=this.findRowById(e);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(s=this._onrowlockchange)==null||s.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(e){var i;const o=this._externalLocks.has(e);if(this._externalLocks.delete(e),o){this.requestUpdate();const r=this.findRowById(e);(i=this._onrowlockchange)==null||i.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return o}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(e,o){const i=this.findRowById(e);if(!i)return!1;Object.assign(this._items[i.index],o);const r=this._draftRows.get(i.index);return r&&Object.assign(r,o),this.requestUpdate(),!0}replaceRowById(e,o){const i=this.findRowById(e);return i?(this._items[i.index]=o,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(e,o){var a;const i=this._columns.find(d=>String(d.field)===o);if(!i)return!1;const r=this.displayItems[e];if(!r||!this.isCellEditable(i,r))return!1;const s=this.getRowLockInfo(r);if(!(s!=null&&s.isLocked))return!0;const n=this._rowLocking;switch((n==null?void 0:n.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((a=n==null?void 0:n.canEditLockedCallback)==null?void 0:a.call(n,r,s))??!1;case"block":default:return!1}}getColumnWidth(e){return this._columnWidths.get(e)}setColumnWidth(e,o,i=!1){this._columnWidths.set(e,o),i||this.requestUpdate()}setColumnWidths(e){for(const{field:o,width:i}of e)o&&i&&this._columnWidths.set(o,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(e=>{const o=String(e.field),i=this._columnWidths.get(o)||e.width||"";return{field:o,width:i}}).filter(e=>e.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,o=localStorage.getItem(e);if(!o)return;const i=JSON.parse(o),r=new Set(this._columns.map(n=>String(n.field)));let s=!1;if(i.columnWidths){this._columnWidths.clear();for(const n of i.columnWidths)r.has(n.field)?this._columnWidths.set(n.field,n.width):s=!0}if(i.columnOrder){this._columnOrder.clear();for(const n of i.columnOrder)r.has(n.field)?this._columnOrder.set(n.field,n.order):s=!0}s&&this.savePersistedState()}catch(e){console.warn("WebGrid: Failed to load persisted state",e)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,o={};this._shouldPersistColumnWidths&&(o.columnWidths=this.getColumnWidthsState()),this._shouldPersistColumnOrder&&(o.columnOrder=this.getColumnOrderState()),localStorage.setItem(e,JSON.stringify(o))}catch(e){console.warn("WebGrid: Failed to save persisted state",e)}}getColumnOrder(e){return this._columnOrder.get(e)}setColumnOrder(e){this._columnOrder.clear();for(const{field:o,order:i}of e)o!==void 0&&i!==void 0&&this._columnOrder.set(o,i);this.requestUpdate()}getColumnOrderState(){const e=this.visualColumns,o=this.totalFrozenColumns;return e.slice(o).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(e,o){const i=this.visualColumns,r=this.totalFrozenColumns,s=i.slice(r),n=s.findIndex(d=>String(d.column.field)===e);if(n===-1||n===o)return;this._columnOrder.clear();const l=[...s],[a]=l.splice(n,1);l.splice(o,0,a),l.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const Xn=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;position:relative;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, color-mix(in srgb, var(--wg-accent-color) 15%, transparent));--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-row-number-width: calc(4 * var(--wg-rem));--wg-actions-column-width: calc(3.2 * var(--wg-rem));--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-header-min-height: auto;--wg-cell-padding: var(--wg-spacing-sm);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-sm);--wg-row-min-height: auto;--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-splitter-color: var(--wg-border-color);--wg-cell-splitter-width: 1px;--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-dirty-indicator-color: #ed8b00;--wg-dirty-indicator-size: 6px;--wg-dirty-cell-bg: rgba(237, 139, 0, .08);--wg-dirty-row-number-border-color: #ed8b00;--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-sm);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-editor-hitbox-height: calc(4.8 * var(--wg-rem));--wg-checkbox-scale: 1.2;--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-divider-height: calc(1.6 * var(--wg-rem));--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-icon-size: calc(1.6 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-overlay-bg: rgba(0, 0, 0, .4);--wg-dialog-shadow: 0 4px 20px rgba(0, 0, 0, .15);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-tooltip-max-width: 300px;--wg-tooltip-arrow-size: 8px;--wg-context-menu-z-index: var(--wg-z-context-menu);--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-border-width: 2px;--wg-focus-border-color: var(--wg-accent-color);--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-cell-highlight: 1;--wg-z-selection-border: 1;--wg-z-frozen: 2;--wg-z-header: 3;--wg-z-frozen-header: 4;--wg-z-fill-handle: 5;--wg-z-fill-handle-area: 4;--wg-z-resize-handle: 6;--wg-z-shortcuts-help: 10;--wg-z-reorder-indicator: 100;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-dropdown: 9999;--wg-z-reorder-ghost: 10000;--wg-z-tooltip: 10000;--wg-row-locked-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-locked-opacity: .7;--wg-frozen-column-bg: var(--wg-surface-1);--wg-frozen-header-bg: color-mix(in srgb, var(--wg-accent-color) 8%, var(--wg-header-bg));--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-frozen-column-shadow-gradient: linear-gradient(to right, rgba(0, 0, 0, .15), transparent);--wg-frozen-column-shadow-width: 8px;--wg-resize-handle-width: 12px;--wg-resize-handle-offset: -6px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-surface-1);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff);--wg-selection-border-width: 2px;--wg-selection-border-color: var(--wg-accent-color);--wg-row-focus-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-row-focus-row-number-bg: color-mix(in srgb, var(--wg-accent-color) 30%, transparent);--wg-cell-selection-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-cell-selection-border: var(--wg-accent-color);--wg-cell-selection-border-width: 2px;--wg-dropdown-max-height: 200px;--wg-dropdown-option-gap: var(--wg-spacing-sm);--wg-dropdown-option-padding: calc(.6 * var(--wg-rem)) var(--wg-spacing-sm) calc(.6 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-dropdown-empty-padding: calc(.8 * var(--wg-rem)) var(--wg-spacing-sm) calc(.8 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-inline-actions-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-inline-actions-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-label-font-size: var(--wg-font-size-sm);--wg-toolbar-btn-gap: calc(.4 * var(--wg-rem));--wg-tooltip-padding: calc(.6 * var(--wg-rem)) calc(1 * var(--wg-rem));--wg-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .2)}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg--scrollable{max-height:var(--wg-scroll-max-height, 100vh)}.wg--table-border-only{border:none;overflow:visible;display:flex;flex-direction:column}.wg--table-border-only .wg__table-container{border:var(--wg-table-border);overflow:auto;max-height:inherit;flex:1;min-height:0}.wg--table-border-only .wg__table-container .wg__header{position:sticky;top:0;z-index:var(--wg-z-header)}.wg__table{width:100%;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__filler{width:auto;min-width:0;padding:0!important;border:none!important;box-shadow:none!important}th.wg__filler{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)!important}td.wg__filler{background:transparent}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:var(--wg-row-number-width);min-width:var(--wg-row-number-width);max-width:var(--wg-row-number-width);box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number-header{cursor:pointer}.wg__row-number-header:hover{background:var(--wg-hover-bg)}.wg__row-number{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__actions-column{width:var(--wg-actions-column-width);min-width:var(--wg-actions-column-width);max-width:var(--wg-actions-column-width);padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);height:var(--wg-header-min-height);box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color),inset 0 -2px 0 var(--wg-border-color);box-sizing:border-box;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__header:last-child{box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header--selected,.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__header-container{display:flex;align-items:stretch;gap:var(--wg-spacing-xs);height:100%}.wg__header-content{flex:1;min-width:0;display:flex;align-items:center;justify-content:flex-start}.wg__header-content--align-left{justify-content:flex-start}.wg__header-content--align-center{justify-content:center}.wg__header-content--align-right{justify-content:flex-end}.wg__header-content--align-justify{justify-content:flex-start}.wg__header-content--valign-top{align-items:flex-start}.wg__header-content--valign-middle{align-items:center}.wg__header-content--valign-bottom{align-items:flex-end}.wg__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__header-controls{flex-shrink:0;display:flex;align-items:center}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:var(--wg-font-weight-semibold);margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:var(--wg-spacing-xs);vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:var(--wg-z-resize-handle);opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg__resize-handle--disabled{cursor:not-allowed}.wg__resize-handle--disabled:after{display:none}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}.wg__header--dragging{opacity:1;background:var(--wg-header-bg)!important;outline:2px dashed var(--wg-accent-color);outline-offset:-2px}.wg__reorder-ghost{position:fixed;z-index:var(--wg-z-reorder-ghost);background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:var(--wg-dialog-shadow);opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;width:3px;background:var(--wg-accent-color);z-index:var(--wg-z-reorder-indicator);pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:var(--wg-z-fill-handle);pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:var(--wg-z-fill-handle-area);box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__cell.wg__row-number,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__cell.wg__row-number:hover,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__cell--column-selected{background:var(--wg-selection-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}.wg__cell--in-range{background:var(--wg-cell-selection-bg)!important;position:relative;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing.wg__cell--in-range{background:var(--wg-input-bg)!important}.wg__cell--editable.wg__cell--in-range:hover{background:var(--wg-cell-selection-bg)!important}.wg__cell--editable.wg__cell--in-range:hover:after{display:none}.wg__cell-range-border{position:absolute;border:var(--wg-cell-selection-border-width) solid var(--wg-cell-selection-border);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-cells,.wg--selecting-cells *{cursor:crosshair!important;-webkit-user-select:none;user-select:none}.wg--selecting-cells .wg__cell{cursor:crosshair!important}.wg:has(.wg__cell-range-border) .wg__fill-handle{display:none}.wg__row-selection-border,.wg__column-selection-border{position:absolute;border:var(--wg-selection-border-width) solid var(--wg-selection-border-color);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-columns,.wg--selecting-columns *{cursor:col-resize!important;-webkit-user-select:none;user-select:none}.wg--selecting-columns .wg__header{cursor:col-resize!important}.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg));z-index:var(--wg-z-frozen-header)!important}.wg__header--frozen.wg__header--selected,.wg__header--frozen.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number-header.wg__header--frozen{z-index:var(--wg-z-frozen-header)!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-surface-1))}.wg__cell--frozen-last{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:var(--wg-z-frozen)!important}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__row--selected>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__row--selected>.wg__row-number.wg__cell--frozen{background:var(--wg-selection-row-number-bg)!important;color:var(--wg-selection-row-number-color)}.wg__cell--frozen.wg__cell--column-selected{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__cell--frozen.wg__cell--in-range{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:calc(-1 * var(--wg-frozen-column-shadow-width));bottom:0;width:var(--wg-frozen-column-shadow-width);background:var(--wg-frozen-column-shadow-gradient);pointer-events:none}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);height:var(--wg-row-min-height);box-sizing:border-box;position:relative;scroll-margin-top:calc(3 * var(--wg-rem));scroll-margin-bottom:calc(.5 * var(--wg-rem));-webkit-user-select:none;user-select:none;overflow:hidden;box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell-text{-webkit-user-select:none;user-select:none;pointer-events:none}.wg__cell--ellipsis .wg__cell-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--line-clamp .wg__cell-text{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.wg__cell--editable{cursor:pointer}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light);box-shadow:inset 0 0 0 2px var(--wg-danger-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg--editable.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg)}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__cell--dirty{background:var(--wg-dirty-cell-bg)!important}.wg__cell--dirty:before{content:"";position:absolute;top:0;left:0;width:0;height:0;border-style:solid;border-width:var(--wg-dirty-indicator-size) var(--wg-dirty-indicator-size) 0 0;border-color:var(--wg-dirty-indicator-color) transparent transparent transparent;pointer-events:none}.wg__cell--dirty.wg__cell--editing:before{display:none}.wg__row-number--dirty{box-shadow:inset 3px 0 0 var(--wg-dirty-row-number-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--valign-top{top:0;bottom:auto}.wg__editor--valign-middle{top:0;bottom:0}.wg__editor--valign-bottom{top:auto;bottom:0}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:transparent;padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color);background:var(--wg-hover-bg)}.wg__editor--checkbox{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer}.wg__checkbox-display{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer;pointer-events:none}.wg__checkbox-display--readonly{cursor:default;opacity:.5}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0;padding-right:var(--wg-dropdown-toggle-hitbox);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-font-size-sm);animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:var(--wg-spacing-xs);flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit;pointer-events:auto}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-toolbar-shadow);max-height:var(--wg-dropdown-max-height);overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-dropdown-option-gap);padding:var(--wg-dropdown-option-padding);cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg);box-shadow:inset 0 0 0 2px var(--wg-accent-color)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:var(--wg-dropdown-empty-padding);color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg__dropdown-option--align-left{justify-content:flex-start}.wg__dropdown-option--align-left .wg__dropdown-option-content{text-align:left}.wg__dropdown-option--align-center{justify-content:center}.wg__dropdown-option--align-center .wg__dropdown-option-content{text-align:center}.wg__dropdown-option--align-right{justify-content:flex-end}.wg__dropdown-option--align-right .wg__dropdown-option-content{text-align:right}.wg__dropdown-option--align-justify{justify-content:flex-start}.wg__dropdown-option--align-justify .wg__dropdown-option-content{text-align:justify}.wg--navigate-mode .wg__cell{cursor:cell}.wg__cell:focus{outline:none;box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell.wg__cell--focused,.wg__cell.wg__cell--always-edit-focused{box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell--focused:after,.wg__cell--always-edit-focused:after{display:none}.wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:var(--wg-spacing-xs)}.wg__pagination-pagesize{display:flex;align-items:center;gap:calc(.6 * var(--wg-rem))}.wg__pagination-select{padding:var(--wg-spacing-xs) var(--wg-spacing-sm);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:var(--wg-toolbar-row-gap);align-items:center;height:var(--wg-toolbar-row-height);padding:var(--wg-toolbar-row-padding)}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:var(--wg-toolbar-divider-height);background:var(--wg-toolbar-divider-color);margin:0 var(--wg-spacing-xs);flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--wg-toolbar-btn-gap);font-family:inherit;font-size:var(--wg-font-size-base);font-weight:var(--wg-font-weight-normal);padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:var(--wg-toolbar-label-font-size);white-space:nowrap}.wg__actions-column{width:var(--wg-toolbar-btn-min-width);min-width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{white-space:nowrap;text-align:start;padding:var(--wg-inline-actions-padding);overflow:visible}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:var(--wg-inline-actions-gap);align-items:flex-start}.wg__inline-actions-row{display:flex;gap:var(--wg-inline-actions-gap);align-items:center;justify-content:flex-start}.wg__inline-action-btn{width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;box-sizing:border-box;font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__inline-action-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:var(--wg-z-shortcuts-help)}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:var(--wg-spacing-xl);height:var(--wg-spacing-xl);padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size)}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:var(--wg-dialog-shadow);min-width:200px;max-width:var(--wg-tooltip-max-width);z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px calc(.6 * var(--wg-rem));font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:absolute;z-index:var(--wg-z-tooltip);max-width:var(--wg-tooltip-max-width);padding:var(--wg-tooltip-padding);background:var(--wg-tooltip-bg);color:var(--wg-tooltip-color);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-tooltip-shadow);pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:var(--wg-tooltip-arrow-size);height:var(--wg-tooltip-arrow-size);background:var(--wg-tooltip-bg);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:var(--wg-overlay-bg);display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:var(--wg-dialog-shadow);min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--wg-accent-color) 20%,transparent)}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:var(--wg-text-on-accent)}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}:host{--wg-tree-indent: 1.25rem;--wg-tree-chevron-size: 1rem;--wg-tree-chevron-color: var(--wg-text-color-2);--wg-tree-chevron-gap: 4px}.wg__tree-cell{display:inline-flex;align-items:center;gap:var(--wg-tree-chevron-gap)}.wg__tree-cell-body{min-width:0;overflow:hidden;text-overflow:inherit;white-space:inherit}.wg__tree-chevron{all:unset;display:inline-flex;align-items:center;justify-content:center;width:var(--wg-tree-chevron-size);height:var(--wg-tree-chevron-size);border-radius:2px;font-size:.85em;line-height:1;color:var(--wg-tree-chevron-color);cursor:pointer;flex-shrink:0;transition:transform .12s ease,background .1s ease}.wg__tree-chevron:hover:not(.wg__tree-chevron--leaf){background:var(--wg-hover-bg)}.wg__tree-chevron--expanded{transform:rotate(90deg)}.wg__tree-leaf-spacer{display:inline-block;width:var(--wg-tree-chevron-size);height:var(--wg-tree-chevron-size);flex-shrink:0}.wg__cell--editing .wg__tree-chevron,.wg__cell--editing .wg__tree-leaf-spacer{display:none}.wg__cell--editing .wg__tree-cell{display:contents}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86;--wg-dirty-indicator-color: #ffa940;--wg-dirty-cell-bg: rgba(255, 169, 64, .12);--wg-dirty-row-number-border-color: #ffa940}}:host([data-theme="dark"]),:host-context([data-theme="dark"]),:host([data-bs-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86;--wg-dirty-indicator-color: #ffa940;--wg-dirty-row-number-border-color: #ffa940}:host([data-theme="light"]),:host-context([data-theme="light"]),:host([data-bs-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-danger-color: var(--base-danger-color, #d13438)}';function ut(t,e,o){const i=o.valueMember||"value",r=e.find(s=>s[i]===t);return r?Ue(r,o):t!=null?String(t):""}function Ue(t,e){if(e.getDisplayCallback)return e.getDisplayCallback(t);const o=e.displayMember||"label";return String(t[o]??t.label??"")}function ze(t,e){if(e.getValueCallback)return e.getValueCallback(t);const o=e.valueMember||"value";return t[o]??t.value}function Gn(t,e){return e.getIconCallback?e.getIconCallback(t):e.iconMember&&t[e.iconMember]||null}function Qn(t,e){return e.getSubtitleCallback?e.getSubtitleCallback(t):e.subtitleMember&&t[e.subtitleMember]||null}function de(t,e){return e.getDisabledCallback?e.getDisabledCallback(t):e.disabledMember?!!t[e.disabledMember]:!1}function co(t,e,o,i,r,s,n=!0){const l=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",d=i.editor==="checkbox",c=String(i.field);if(d){if(i.formatCallback)return`<span class="wg__cell-text">${t.escapeHtml(r)}</span>`;ie.counters.cellDisplayItemsLookup++;const h=t.grid.displayItems[e],g=h?t.grid.getCellRawValue(h,e,c):!1,f=i.editorOptions||{},w=f.trueValue!==void 0?f.trueValue:!0;return`
307
+ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate(){}invalidateDisplayCache(){this._paginatedItemsCache=null,this._displayItemsCache=null}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}isCellDirty(e,o){const i=this._draftRows.get(e);if(!i)return!1;const r=this.displayItems[e];if(!r)return!1;const s=i[o],n=r[o];return s!==n}isRowDirty(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e);const o=this.rowKeyForIndex(e);o!==null&&(this._invalidCells=this._invalidCells.filter(i=>i.rowKey!==o)),this.requestUpdate()}discardCellDraft(e,o){const i=this._draftRows.get(e);if(!i)return;const r=this.displayItems[e];if(!r)return;const s=r[o];i[o]=s;const n=Object.keys(i);let l=!1;for(const d of n){const c=i[d],u=r[d];if(c!==u){l=!0;break}}l||this._draftRows.delete(e);const a=this.rowKeyForIndex(e);a!==null&&(this._invalidCells=this._invalidCells.filter(d=>!(d.rowKey===a&&d.field===o)))}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,o,i){if(!this.isEmptyRowIndex(o)){const r=this._draftRows.get(o);if(r)return r[i]}return e[i]}getCellValue(e,o,i){var s;if(o.templateCallback)return o.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(o.field)):e[String(o.field)];if(o.formatCallback)return o.formatCallback(r,e);if(o.editor==="date"&&((s=o.editorOptions)!=null&&s.dateFormat)&&r)try{const n=r instanceof Date?r:new Date(r);if(!isNaN(n.getTime())){const l=Dt(o.editorOptions.dateFormat);return io(n,l)}}catch{}return String(r??"")}rowKeyForIndex(e){const o=this.displayItems[e];return o===void 0?null:this.getStableRowKey(o,e)}isCellInvalid(e,o){const i=this.rowKeyForIndex(e);return i===null?!1:this._invalidCells.some(r=>r.rowKey===i&&r.field===o)}getCellValidationError(e,o){const i=this.rowKeyForIndex(e);if(i===null)return null;const r=this._invalidCells.find(s=>s.rowKey===i&&s.field===o);return(r==null?void 0:r.error)||null}addInvalidCell(e,o,i){const r=this.rowKeyForIndex(e);if(r===null)return;const s=this._invalidCells.findIndex(n=>n.rowKey===r&&n.field===o);s>=0?this._invalidCells[s]={rowKey:r,field:o,error:i}:this._invalidCells=[...this._invalidCells,{rowKey:r,field:o,error:i}]}removeInvalidCell(e,o){const i=this.rowKeyForIndex(e);i!==null&&(this._invalidCells=this._invalidCells.filter(r=>!(r.rowKey===i&&r.field===o)))}isEditing(e,o){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===e&&((r=this._editingCell)==null?void 0:r.field)===o}shouldShowEditor(e,o){const i=this._columns[o];if(!i)return!1;const r=String(i.field);return!!(this.isEditing(e,r)||(i.editTrigger??this._editTrigger)==="always"&&this.isCellEditable(i))}startEdit(e,o,i){var n,l;if(!this.canEditCell(e,o)){Le.debug("startEdit blocked (locked):",{rowIndex:e,field:o});return}Le.debug("startEdit:",{rowIndex:e,field:o,options:i});const r=this.displayItems[e];if(!r)return;this._draftRows.has(e)||this._draftRows.set(e,{...r});const s=this._editingCell;this._editingCell={rowIndex:e,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(n=this._onInteractionChange)==null||n.call(this,"editingCell",{prev:s,current:this._editingCell}),this._currentCellError=null,(l=this._onroweditstart)==null||l.call(this,{row:r,rowIndex:e,field:o})}cancelEdit(){var e,o;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:s}=i,n=this.displayItems[r];n&&((e=this._onroweditcancel)==null||e.call(this,{row:n,rowIndex:r,field:s})),this._editingCell=null,(o=this._onInteractionChange)==null||o.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(e,o){return e==null||e===!0?{valid:!0,finalValue:o}:e===!1?{valid:!1,message:"Validation failed",finalValue:o}:typeof e=="string"?{valid:!1,message:e,finalValue:o}:{valid:e.valid,message:e.message,finalValue:e.transformedValue!==void 0?e.transformedValue:o}}async commitEdit(e,o,i,r=!1){var w,p,m,_,y,C,S;gt.debug("commitEdit:",{rowIndex:e,field:o,newValue:i});const s=this._columns.find(v=>String(v.field)===o);if(!s)return;const n=this.displayItems[e];if(!n)return;const l=this.isEmptyRowIndex(e),a=n[o];let d=i,c=null,u=!0;this._isValidating=!0;try{if(s.beforeCommitCallback){const v={value:i,oldValue:a,row:n,rowIndex:e,field:o},x=await Promise.resolve(s.beforeCommitCallback(v)),k=this.normalizeValidationResult(x,i);u=k.valid,c=k.message||null,d=k.finalValue}else if(s.validateCallback){const v=await Promise.resolve(s.validateCallback(i,n));v&&(u=!1,c=v)}}catch(v){u=!1,c=v instanceof Error?v.message:"Validation failed"}if(this._isValidating=!1,l){if(this._emptyRowDraft||(this._emptyRowDraft={...n}),this._emptyRowDraft[o]=d,u?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,c||"Invalid value"),this._currentCellError=c,(w=this._onvalidationerror)==null||w.call(this,{row:n,rowIndex:e,field:o,error:c||"Invalid value"})),r&&this.emptyRowHasData(this._emptyRowDraft)){const k={...this._emptyRowDraft},E=this._newRowPosition==="top"?0:this._items.length,I=this.getStableRowKey(this._emptyRowDraft,e);this._newRowPosition==="top"?this._items=[k,...this._items]:this._items=[...this._items,k];const R=this.getStableRowKey(k,E),P=!this._idMember&&!this._treePathMember;this._invalidCells=this._invalidCells.map(A=>{if(A.rowKey===I)return{...A,rowKey:R};if(P&&this._newRowPosition==="top"){const F=Number(A.rowKey);if(!Number.isNaN(F))return{...A,rowKey:String(F+1)}}return A});const D=this._invalidCells.some(A=>A.rowKey===R);(p=this._onrowchange)==null||p.call(this,{row:k,draftRow:k,rowIndex:E,field:o,oldValue:null,newValue:d,isValid:!D,validationError:D?"Row has invalid cells":null}),this._emptyRowDraft=null;const M=this._editingCell;this._editingCell=null,(m=this._onInteractionChange)==null||m.call(this,"editingCell",{prev:M,current:null}),this.requestUpdate();return}const v=this._editingCell;this._editingCell=null,(_=this._onInteractionChange)==null||_.call(this,"editingCell",{prev:v,current:null});return}let h=this._draftRows.get(e);h||(h={...n},this._draftRows.set(e,h)),h[o]=d,u?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,c||"Invalid value"),this._currentCellError=c,(y=this._onvalidationerror)==null||y.call(this,{row:n,rowIndex:e,field:o,error:c||"Invalid value"})),(d!==a||!u)&&((C=this._onrowchange)==null||C.call(this,{row:n,draftRow:h,rowIndex:e,field:o,oldValue:a,newValue:d,isValid:u,validationError:c}));const f=this._editingCell;this._editingCell=null,(S=this._onInteractionChange)==null||S.call(this,"editingCell",{prev:f,current:null})}updateDraftValue(e,o,i){var l;if(!this._columns.find(a=>String(a.field)===o))return;const s=this.displayItems[e];if(!s)return;const n=this.getCellRawValue(s,e,o);if(this.isEmptyRowIndex(e))this._emptyRowDraft||(this._emptyRowDraft={...s}),this._emptyRowDraft[o]=i;else{let a=this._draftRows.get(e);a||(a={...s},this._draftRows.set(e,a)),a[o]=i}if(i!==n){const a=this._draftRows.get(e)||this._emptyRowDraft||s;(l=this._onrowchange)==null||l.call(this,{row:s,draftRow:a,rowIndex:e,field:o,oldValue:n,newValue:i,isValid:!0,validationError:null})}}isCellEditable(e,o){return this.isTreeMode&&e.isTree||e.isEditable===!1||typeof e.isEditable=="function"&&o!==void 0&&!e.isEditable(o)||this._isRowEditable!==void 0&&o!==void 0&&!(typeof this._isRowEditable=="function"?this._isRowEditable(o):this._isRowEditable)?!1:e.isEditable===!0||typeof e.isEditable=="function"&&o!==void 0?!0:this._isEditable}getEditableColumns(e){return this._columns.map((o,i)=>({index:i,column:o})).filter(({column:o})=>this.isCellEditable(o,e))}findNextEditableCell(e,o,i){const r=this.displayItems,s=i==="forward"?1:-1,n=r[e];if(n!==void 0){const a=this.getEditableColumns(n),d=o+s;if(d>=0&&d<a.length)return{rowIndex:e,colIndex:a[d].index}}let l=e+s;for(;l>=0&&l<r.length;){const a=r[l],d=this.getEditableColumns(a);if(d.length>0){const c=i==="forward"?d[0]:d[d.length-1];return{rowIndex:l,colIndex:c.index}}l+=s}return null}isCellFocused(e,o){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===e&&((r=this._focusedCell)==null?void 0:r.colIndex)===o}get focusedCell(){return this._focusedCell}setFocusedCell(e,o){var s;const i=this._focusedCell,r={rowIndex:e,colIndex:o};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(s=this._onInteractionChange)==null||s.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var o;const e=this._focusedCell;e!==null&&(this._focusedCell=null,(o=this._onInteractionChange)==null||o.call(this,"focusedCell",{prev:e,current:null}))}get tabTraversalStartColIndex(){return this._tabTraversalStartColIndex}set tabTraversalStartColIndex(e){this._tabTraversalStartColIndex=e}setHoveredRow(e){var i;if(this._hoveredRowIndex===e)return;const o=this._hoveredRowIndex;this._hoveredRowIndex=e,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:o,current:e})}get focusedRowIndex(){return this._focusedRowIndex}set focusedRowIndex(e){e===null?this.clearRowFocus():this.setFocusedRow(e),this.requestUpdate()}get onrowfocus(){return this._onrowfocus}set onrowfocus(e){this._onrowfocus=e}isRowFocused(e){return this._focusedRowIndex===e}clearRowFocus(){var o;if(this._focusedRowIndex===null)return;const e=this._focusedRowIndex;this._focusedRowIndex=null,(o=this._onInteractionChange)==null||o.call(this,"focusedRow",{prev:e,current:null})}setFocusedRow(e){var r;if(this._focusedRowIndex===e)return;Le.debug("setFocusedRow:",e,"(prev:",this._focusedRowIndex,")");const o=this._focusedRowIndex;this._focusedRowIndex=e,(r=this._onInteractionChange)==null||r.call(this,"focusedRow",{prev:o,current:e});const i=this.displayItems[e];i&&this._onrowfocus&&this._onrowfocus({rowIndex:e,row:i,previousRowIndex:o})}getRowId(e){if(this._idValueCallback)return this._idValueCallback(e);if(this._idValueMember)return e[String(this._idValueMember)]}findRowById(e){const o=this._items.findIndex(i=>this.getRowId(i)===e);return o===-1?null:{row:this._items[o],index:o}}getRowLockInfo(e){let o,i,r=-1;if(typeof e=="object"&&e!==null)o=e,i=this.getRowId(o),r=this._items.indexOf(o),r===-1&&(r=this.displayItems.indexOf(o));else{i=e;const n=this.findRowById(i);n&&(o=n.row,r=n.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!o)return null;const s=this._rowLocking;if(!s)return null;if(s.getLockInfoCallback){const n=s.getLockInfoCallback(o,r);if(n!=null&&n.isLocked)return n}if(s.isLockedCallback&&s.isLockedCallback(o,r))return{isLocked:!0};if(s.lockInfoMember){const n=o[String(s.lockInfoMember)];if(n!=null&&n.isLocked)return n}return s.lockedMember&&o[String(s.lockedMember)]?{isLocked:!0}:null}isRowLocked(e){const o=this.getRowLockInfo(e);return(o==null?void 0:o.isLocked)===!0}lockRowById(e,o){var s;const i={isLocked:!0,lockedBy:o==null?void 0:o.lockedBy,lockedAt:(o==null?void 0:o.lockedAt)??new Date,reason:o==null?void 0:o.reason,...o};this._externalLocks.set(e,i);const r=this.findRowById(e);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(s=this._onrowlockchange)==null||s.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(e){var i;const o=this._externalLocks.has(e);if(this._externalLocks.delete(e),o){this.requestUpdate();const r=this.findRowById(e);(i=this._onrowlockchange)==null||i.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return o}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(e,o){const i=this.findRowById(e);if(!i)return!1;Object.assign(this._items[i.index],o);const r=this._draftRows.get(i.index);return r&&Object.assign(r,o),this.requestUpdate(),!0}replaceRowById(e,o){const i=this.findRowById(e);return i?(this._items[i.index]=o,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(e,o){var a;const i=this._columns.find(d=>String(d.field)===o);if(!i)return!1;const r=this.displayItems[e];if(!r||!this.isCellEditable(i,r))return!1;const s=this.getRowLockInfo(r);if(!(s!=null&&s.isLocked))return!0;const n=this._rowLocking;switch((n==null?void 0:n.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((a=n==null?void 0:n.canEditLockedCallback)==null?void 0:a.call(n,r,s))??!1;case"block":default:return!1}}getColumnWidth(e){return this._columnWidths.get(e)}setColumnWidth(e,o,i=!1){this._columnWidths.set(e,o),i||this.requestUpdate()}setColumnWidths(e){for(const{field:o,width:i}of e)o&&i&&this._columnWidths.set(o,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(e=>{const o=String(e.field),i=this._columnWidths.get(o)||e.width||"";return{field:o,width:i}}).filter(e=>e.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,o=localStorage.getItem(e);if(!o)return;const i=JSON.parse(o),r=new Set(this._columns.map(n=>String(n.field)));let s=!1;if(i.columnWidths){this._columnWidths.clear();for(const n of i.columnWidths)r.has(n.field)?this._columnWidths.set(n.field,n.width):s=!0}if(i.columnOrder){this._columnOrder.clear();for(const n of i.columnOrder)r.has(n.field)?this._columnOrder.set(n.field,n.order):s=!0}s&&this.savePersistedState()}catch(e){console.warn("WebGrid: Failed to load persisted state",e)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,o={};this._shouldPersistColumnWidths&&(o.columnWidths=this.getColumnWidthsState()),this._shouldPersistColumnOrder&&(o.columnOrder=this.getColumnOrderState()),localStorage.setItem(e,JSON.stringify(o))}catch(e){console.warn("WebGrid: Failed to save persisted state",e)}}getColumnOrder(e){return this._columnOrder.get(e)}setColumnOrder(e){this._columnOrder.clear();for(const{field:o,order:i}of e)o!==void 0&&i!==void 0&&this._columnOrder.set(o,i);this.requestUpdate()}getColumnOrderState(){const e=this.visualColumns,o=this.totalFrozenColumns;return e.slice(o).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(e,o){const i=this.visualColumns,r=this.totalFrozenColumns,s=i.slice(r),n=s.findIndex(d=>String(d.column.field)===e);if(n===-1||n===o)return;this._columnOrder.clear();const l=[...s],[a]=l.splice(n,1);l.splice(o,0,a),l.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const Xn='@layer variables,component,overrides;@layer variables{:host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;position:relative;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, color-mix(in srgb, var(--wg-accent-color) 15%, transparent));--wg-text-color-1: var(--base-text-color-1, light-dark(#242424, #f5f5f5));--wg-text-color-2: var(--base-text-color-2, light-dark(#424242, #d4d4d4));--wg-text-color-3: var(--base-text-color-3, light-dark(#707070, #a3a3a3));--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-main-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--wg-elevated-bg: var(--base-elevated-bg, light-dark(#f5f5f5, #2b2b2b));--wg-dropdown-bg: var(--base-dropdown-bg, var(--base-elevated-bg, var(--base-main-bg, light-dark(#ffffff, #2b2b2b))));--wg-border-color: var(--base-border-color, light-dark(#e0e0e0, #3d3d3d));--wg-border-color-hover: var(--base-border-color, light-dark(#d1d1d1, #5a5a5a));--wg-input-bg: var(--base-input-bg, light-dark(#ffffff, #1f1f1f));--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid light-dark(#d1d1d1, #5a5a5a));--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, light-dark(#707070, #a3a3a3));--wg-danger-color: var(--base-danger-color, light-dark(#d13438, #f87c86));--wg-danger-bg-light: var(--base-danger-bg-light, light-dark(#fde7e9, #442726));--wg-hover-bg: var(--base-hover-bg, color-mix(in srgb, var(--wg-text-color-1) 8%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--wg-active-bg: var(--base-active-bg, color-mix(in srgb, var(--wg-text-color-1) 14%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-main-bg);--wg-table-border: 1px solid var(--wg-border-color);--wg-row-number-width: calc(4 * var(--wg-rem));--wg-actions-column-width: calc(3.2 * var(--wg-rem));--wg-header-bg: var(--wg-elevated-bg);--wg-header-bg-hover: var(--wg-hover-bg);--wg-header-bg-sorted: var(--wg-hover-bg);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-header-min-height: auto;--wg-cell-padding: var(--wg-spacing-sm);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-sm);--wg-row-min-height: auto;--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-splitter-color: var(--wg-border-color);--wg-cell-splitter-width: 1px;--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-main-bg);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-elevated-bg));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-elevated-bg);--wg-row-bg-hover: var(--wg-hover-bg);--wg-filter-bg: var(--wg-main-bg);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-main-bg);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-main-bg);--wg-pagination-btn-bg-hover: var(--wg-elevated-bg);--wg-pagination-btn-bg-active: var(--wg-hover-bg);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-dirty-indicator-color: light-dark(#ed8b00, #ffa940);--wg-dirty-indicator-size: 6px;--wg-dirty-cell-bg: light-dark(rgba(237, 139, 0, .08), rgba(255, 169, 64, .12));--wg-dirty-row-number-border-color: light-dark(#ed8b00, #ffa940);--wg-editor-bg: var(--wg-main-bg);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-sm);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-editor-hitbox-height: calc(4.8 * var(--wg-rem));--wg-checkbox-scale: 1.2;--wg-toolbar-bg: var(--wg-dropdown-bg);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-divider-height: calc(1.6 * var(--wg-rem));--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-icon-size: calc(1.6 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-overlay-bg: rgba(0, 0, 0, .4);--wg-dialog-shadow: 0 4px 20px rgba(0, 0, 0, .15);--wg-tooltip-bg: var(--base-tooltip-bg, var(--base-inverse-bg, light-dark(#333333, #f5f5f5)));--wg-tooltip-color: var(--base-tooltip-color, light-dark(#ffffff, #1a1a1a));--wg-tooltip-max-width: 300px;--wg-tooltip-arrow-size: 8px;--wg-context-menu-z-index: var(--wg-z-context-menu);--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-border-width: 2px;--wg-focus-border-color: var(--wg-accent-color);--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-cell-highlight: 1;--wg-z-selection-border: 1;--wg-z-frozen: 2;--wg-z-header: 3;--wg-z-frozen-header: 4;--wg-z-fill-handle: 5;--wg-z-fill-handle-area: 4;--wg-z-resize-handle: 6;--wg-z-shortcuts-help: 10;--wg-z-reorder-indicator: 100;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-dropdown: 9999;--wg-z-reorder-ghost: 10000;--wg-z-tooltip: 10000;--wg-row-locked-bg: var(--base-disabled-bg, var(--wg-elevated-bg));--wg-row-locked-opacity: .7;--wg-frozen-column-bg: var(--wg-main-bg);--wg-frozen-header-bg: color-mix(in srgb, var(--wg-accent-color) 8%, var(--wg-header-bg));--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-frozen-column-shadow-gradient: linear-gradient(to right, rgba(0, 0, 0, .15), transparent);--wg-frozen-column-shadow-width: 8px;--wg-resize-handle-width: 12px;--wg-resize-handle-offset: -6px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-main-bg);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff);--wg-selection-border-width: 2px;--wg-selection-border-color: var(--wg-accent-color);--wg-row-focus-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-row-focus-row-number-bg: color-mix(in srgb, var(--wg-accent-color) 30%, transparent);--wg-cell-selection-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-cell-selection-border: var(--wg-accent-color);--wg-cell-selection-border-width: 2px;--wg-dropdown-max-height: 200px;--wg-dropdown-option-gap: var(--wg-spacing-sm);--wg-dropdown-option-padding: calc(.6 * var(--wg-rem)) var(--wg-spacing-sm) calc(.6 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-dropdown-empty-padding: calc(.8 * var(--wg-rem)) var(--wg-spacing-sm) calc(.8 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-inline-actions-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-inline-actions-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-label-font-size: var(--wg-font-size-sm);--wg-toolbar-btn-gap: calc(.4 * var(--wg-rem));--wg-tooltip-padding: calc(.6 * var(--wg-rem)) calc(1 * var(--wg-rem));--wg-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .2)}}@layer component{web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg--scrollable{max-height:var(--wg-scroll-max-height, 100vh)}.wg--table-border-only{border:none;overflow:visible;display:flex;flex-direction:column}.wg--table-border-only .wg__table-container{border:var(--wg-table-border);overflow:auto;max-height:inherit;flex:1;min-height:0}.wg--table-border-only .wg__table-container .wg__header{position:sticky;top:0;z-index:var(--wg-z-header)}.wg__table{width:100%;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__filler{width:auto;min-width:0;padding:0!important;border:none!important;box-shadow:none!important}th.wg__filler{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)!important}td.wg__filler{background:transparent}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:var(--wg-row-number-width);min-width:var(--wg-row-number-width);max-width:var(--wg-row-number-width);box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number-header{cursor:pointer}.wg__row-number-header:hover{background:var(--wg-hover-bg)}.wg__row-number{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__actions-column{width:var(--wg-actions-column-width);min-width:var(--wg-actions-column-width);max-width:var(--wg-actions-column-width);padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}}@layer component;@layer component{.wg__tooltip{position:absolute;z-index:var(--wg-z-tooltip);max-width:var(--wg-tooltip-max-width);padding:var(--wg-tooltip-padding);background:var(--wg-tooltip-bg);color:var(--wg-tooltip-color);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-tooltip-shadow);pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:var(--wg-tooltip-arrow-size);height:var(--wg-tooltip-arrow-size);background:var(--wg-tooltip-bg);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}}@layer component{.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}}@layer component{@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}}@layer component{.wg__header{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);height:var(--wg-header-min-height);box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color),inset 0 -2px 0 var(--wg-border-color);box-sizing:border-box;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__header:last-child{box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header--selected,.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__header-container{display:flex;align-items:stretch;gap:var(--wg-spacing-xs);height:100%}.wg__header-content{flex:1;min-width:0;display:flex;align-items:center;justify-content:flex-start}.wg__header-content--align-left{justify-content:flex-start}.wg__header-content--align-center{justify-content:center}.wg__header-content--align-right{justify-content:flex-end}.wg__header-content--align-justify{justify-content:flex-start}.wg__header-content--valign-top{align-items:flex-start}.wg__header-content--valign-middle{align-items:center}.wg__header-content--valign-bottom{align-items:flex-end}.wg__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__header-controls{flex-shrink:0;display:flex;align-items:center}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:var(--wg-font-weight-semibold);margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:var(--wg-spacing-xs);vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-main-bg);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}}@layer component{.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:var(--wg-z-resize-handle);opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg__resize-handle--disabled{cursor:not-allowed}.wg__resize-handle--disabled:after{display:none}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}}@layer component{.wg__header--dragging{opacity:1;background:var(--wg-header-bg)!important;outline:2px dashed var(--wg-accent-color);outline-offset:-2px}.wg__reorder-ghost{position:fixed;z-index:var(--wg-z-reorder-ghost);background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:var(--wg-dialog-shadow);opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;width:3px;background:var(--wg-accent-color);z-index:var(--wg-z-reorder-indicator);pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}}@layer component{.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:var(--wg-z-fill-handle);pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:var(--wg-z-fill-handle-area);box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}}@layer component{.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__cell.wg__row-number,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__cell.wg__row-number:hover,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__cell--column-selected{background:var(--wg-selection-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}}@layer component{.wg__cell--in-range{background:var(--wg-cell-selection-bg)!important;position:relative;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing.wg__cell--in-range{background:var(--wg-input-bg)!important}.wg__cell--editable.wg__cell--in-range:hover{background:var(--wg-cell-selection-bg)!important}.wg__cell--editable.wg__cell--in-range:hover:after{display:none}.wg__cell-range-border{position:absolute;border:var(--wg-cell-selection-border-width) solid var(--wg-cell-selection-border);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-cells,.wg--selecting-cells *{cursor:crosshair!important;-webkit-user-select:none;user-select:none}.wg--selecting-cells .wg__cell{cursor:crosshair!important}.wg:has(.wg__cell-range-border) .wg__fill-handle{display:none}.wg__row-selection-border,.wg__column-selection-border{position:absolute;border:var(--wg-selection-border-width) solid var(--wg-selection-border-color);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-columns,.wg--selecting-columns *{cursor:col-resize!important;-webkit-user-select:none;user-select:none}.wg--selecting-columns .wg__header{cursor:col-resize!important}}@layer component{.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg));z-index:var(--wg-z-frozen-header)!important}.wg__header--frozen.wg__header--selected,.wg__header--frozen.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number-header.wg__header--frozen{z-index:var(--wg-z-frozen-header)!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-main-bg))}.wg__cell--frozen-last{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:var(--wg-z-frozen)!important}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-main-bg)))!important}.wg__row--selected>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-main-bg)))!important}.wg__row--selected>.wg__row-number.wg__cell--frozen{background:var(--wg-selection-row-number-bg)!important;color:var(--wg-selection-row-number-color)}.wg__cell--frozen.wg__cell--column-selected{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-main-bg)))!important}.wg__cell--frozen.wg__cell--in-range{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-main-bg)))!important}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:calc(-1 * var(--wg-frozen-column-shadow-width));bottom:0;width:var(--wg-frozen-column-shadow-width);background:var(--wg-frozen-column-shadow-gradient);pointer-events:none}}@layer component{.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);height:var(--wg-row-min-height);box-sizing:border-box;position:relative;scroll-margin-top:calc(3 * var(--wg-rem));scroll-margin-bottom:calc(.5 * var(--wg-rem));-webkit-user-select:none;user-select:none;overflow:hidden;box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell-text{-webkit-user-select:none;user-select:none;pointer-events:none}.wg__cell--ellipsis .wg__cell-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--line-clamp .wg__cell-text{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.wg__cell--editable{cursor:pointer}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-main-bg);outline:2px solid var(--wg-accent-color);outline-offset:-2px;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light);box-shadow:inset 0 0 0 2px var(--wg-danger-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg--editable.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg)}}@layer component{.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}}@layer component{.wg__cell--dirty{background:var(--wg-dirty-cell-bg)!important}.wg__cell--dirty:before{content:"";position:absolute;top:0;left:0;width:0;height:0;border-style:solid;border-width:var(--wg-dirty-indicator-size) var(--wg-dirty-indicator-size) 0 0;border-color:var(--wg-dirty-indicator-color) transparent transparent transparent;pointer-events:none}.wg__cell--dirty.wg__cell--editing:before{display:none}.wg__row-number--dirty{box-shadow:inset 3px 0 0 var(--wg-dirty-row-number-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}}@layer component{.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--valign-top{top:0;bottom:auto}.wg__editor--valign-middle{top:0;bottom:0}.wg__editor--valign-bottom{top:auto;bottom:0}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:transparent;padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color);background:var(--wg-hover-bg)}.wg__editor--checkbox{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer}.wg__checkbox-display{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer;pointer-events:none}.wg__checkbox-display--readonly{cursor:default;opacity:.5}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0;padding-right:var(--wg-dropdown-toggle-hitbox);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-font-size-sm);animation:wg-pulse 1s infinite}}@layer component{.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:var(--wg-spacing-xs);flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit;pointer-events:auto}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-dropdown-bg);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-toolbar-shadow);max-height:var(--wg-dropdown-max-height);overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-dropdown-option-gap);padding:var(--wg-dropdown-option-padding);cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg);box-shadow:inset 0 0 0 2px var(--wg-accent-color)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:var(--wg-dropdown-empty-padding);color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg__dropdown-option--align-left{justify-content:flex-start}.wg__dropdown-option--align-left .wg__dropdown-option-content{text-align:left}.wg__dropdown-option--align-center{justify-content:center}.wg__dropdown-option--align-center .wg__dropdown-option-content{text-align:center}.wg__dropdown-option--align-right{justify-content:flex-end}.wg__dropdown-option--align-right .wg__dropdown-option-content{text-align:right}.wg__dropdown-option--align-justify{justify-content:flex-start}.wg__dropdown-option--align-justify .wg__dropdown-option-content{text-align:justify}}@layer component{.wg--navigate-mode .wg__cell{cursor:cell}.wg__cell:focus{outline:none;box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell.wg__cell--focused,.wg__cell.wg__cell--always-edit-focused{box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell--focused:after,.wg__cell--always-edit-focused:after{display:none}.wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}}@layer component{.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:var(--wg-spacing-xs)}.wg__pagination-pagesize{display:flex;align-items:center;gap:calc(.6 * var(--wg-rem))}.wg__pagination-select{padding:var(--wg-spacing-xs) var(--wg-spacing-sm);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}}@layer component{.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:var(--wg-toolbar-row-gap);align-items:center;height:var(--wg-toolbar-row-height);padding:var(--wg-toolbar-row-padding)}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:var(--wg-toolbar-divider-height);background:var(--wg-toolbar-divider-color);margin:0 var(--wg-spacing-xs);flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--wg-toolbar-btn-gap);font-family:inherit;font-size:var(--wg-font-size-base);font-weight:var(--wg-font-weight-normal);padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:var(--wg-toolbar-label-font-size);white-space:nowrap}.wg__actions-column{width:var(--wg-toolbar-btn-min-width);min-width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{white-space:nowrap;text-align:start;padding:var(--wg-inline-actions-padding);overflow:visible}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:var(--wg-inline-actions-gap);align-items:flex-start}.wg__inline-actions-row{display:flex;gap:var(--wg-inline-actions-gap);align-items:center;justify-content:flex-start}.wg__inline-action-btn{width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;box-sizing:border-box;font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__inline-action-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}}@layer component{.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:var(--wg-z-shortcuts-help)}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:var(--wg-spacing-xl);height:var(--wg-spacing-xl);padding:0;border:none;border-radius:50%;background:var(--wg-main-bg);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-elevated-bg)}.wg__shortcuts-help-icon svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size)}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-main-bg);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:var(--wg-dialog-shadow);min-width:200px;max-width:var(--wg-tooltip-max-width);z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px calc(.6 * var(--wg-rem));font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-elevated-bg);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}}@layer component{.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:var(--wg-overlay-bg);display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-main-bg);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:var(--wg-dialog-shadow);min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--wg-accent-color) 20%,transparent)}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-main-bg);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-elevated-bg)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:var(--wg-text-on-accent)}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover)}}@layer component{.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}}@layer component{:host{--wg-tree-indent: 1.25rem;--wg-tree-chevron-size: 1rem;--wg-tree-chevron-color: var(--wg-text-color-2);--wg-tree-chevron-gap: 4px}.wg__tree-cell{display:inline-flex;align-items:center;gap:var(--wg-tree-chevron-gap)}.wg__tree-cell-body{min-width:0;overflow:hidden;text-overflow:inherit;white-space:inherit}.wg__tree-chevron{all:unset;display:inline-flex;align-items:center;justify-content:center;width:var(--wg-tree-chevron-size);height:var(--wg-tree-chevron-size);border-radius:2px;font-size:.85em;line-height:1;color:var(--wg-tree-chevron-color);cursor:pointer;flex-shrink:0;transition:transform .12s ease,background .1s ease}.wg__tree-chevron:hover:not(.wg__tree-chevron--leaf){background:var(--wg-hover-bg)}.wg__tree-chevron--expanded{transform:rotate(90deg)}.wg__tree-leaf-spacer{display:inline-block;width:var(--wg-tree-chevron-size);height:var(--wg-tree-chevron-size);flex-shrink:0}.wg__cell--editing .wg__tree-chevron,.wg__cell--editing .wg__tree-leaf-spacer{display:none}.wg__cell--editing .wg__tree-cell{display:contents}}@layer overrides{:host-context([data-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){color-scheme:dark}:host-context([data-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){color-scheme:light}:host([data-theme="dark"]),:host([data-bs-theme="dark"]){color-scheme:dark}:host([data-theme="light"]),:host([data-bs-theme="light"]){color-scheme:light}}';function ut(t,e,o){const i=o.valueMember||"value",r=e.find(s=>s[i]===t);return r?Ue(r,o):t!=null?String(t):""}function Ue(t,e){if(e.getDisplayCallback)return e.getDisplayCallback(t);const o=e.displayMember||"label";return String(t[o]??t.label??"")}function ze(t,e){if(e.getValueCallback)return e.getValueCallback(t);const o=e.valueMember||"value";return t[o]??t.value}function Gn(t,e){return e.getIconCallback?e.getIconCallback(t):e.iconMember&&t[e.iconMember]||null}function Qn(t,e){return e.getSubtitleCallback?e.getSubtitleCallback(t):e.subtitleMember&&t[e.subtitleMember]||null}function de(t,e){return e.getDisabledCallback?e.getDisabledCallback(t):e.disabledMember?!!t[e.disabledMember]:!1}function co(t,e,o,i,r,s,n=!0){const l=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",d=i.editor==="checkbox",c=String(i.field);if(d){if(i.formatCallback)return`<span class="wg__cell-text">${t.escapeHtml(r)}</span>`;ie.counters.cellDisplayItemsLookup++;const h=t.grid.displayItems[e],g=h?t.grid.getCellRawValue(h,e,c):!1,f=i.editorOptions||{},w=f.trueValue!==void 0?f.trueValue:!0;return`
308
308
  <input
309
309
  type="checkbox"
310
310
  class="wg__checkbox-display${n?"":" wg__checkbox-display--readonly"}"
@@ -537,28 +537,28 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
537
537
  z-index: var(--wg-cm-z-index, 10000);
538
538
 
539
539
  /* Colors */
540
- --wg-cm-background: var(--base-layer-01, #fff);
541
- --wg-cm-border-color: var(--base-stroke-default, #e0e0e0);
542
- --wg-cm-text-color: var(--base-text-color-primary, #1a1a1a);
543
- --wg-cm-text-secondary: var(--base-text-color-secondary, #666);
544
- --wg-cm-text-danger: var(--base-error-color, #d32f2f);
545
- --wg-cm-hover-bg: var(--base-layer-hover, #f5f5f5);
540
+ --wg-cm-background: var(--base-dropdown-bg, var(--base-main-bg, #fff));
541
+ --wg-cm-border-color: var(--base-border-color, #e0e0e0);
542
+ --wg-cm-text-color: var(--base-text-color-1, #1a1a1a);
543
+ --wg-cm-text-secondary: var(--base-text-color-2, #666);
544
+ --wg-cm-text-danger: var(--base-danger-color, #d32f2f);
545
+ --wg-cm-hover-bg: var(--base-hover-bg, #f5f5f5);
546
546
  --wg-cm-disabled-opacity: 0.5;
547
547
 
548
548
  /* Typography */
549
549
  --wg-cm-font-family: var(--base-font-family, inherit);
550
- --wg-cm-font-size: var(--base-font-size-sm, 13px);
550
+ --wg-cm-font-size: 13px;
551
551
 
552
552
  /* Sizing */
553
553
  --wg-cm-padding: 4px;
554
554
  --wg-cm-item-padding: 8px 12px;
555
555
  --wg-cm-min-width: 160px;
556
- --wg-cm-border-radius: var(--base-border-radius-sm, 4px);
556
+ --wg-cm-border-radius: 4px;
557
557
  --wg-cm-icon-size: 16px;
558
558
  --wg-cm-icon-gap: 8px;
559
559
 
560
560
  /* Shadow */
561
- --wg-cm-shadow: var(--base-shadow-lg, 0 4px 16px rgba(0, 0, 0, 0.15));
561
+ --wg-cm-shadow: var(--base-dropdown-box-shadow, 0 4px 16px rgba(0, 0, 0, 0.15));
562
562
  }
563
563
 
564
564
  .wg-context-menu {
@@ -655,11 +655,11 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
655
655
  }
656
656
  `;let ki=!1;function Ii(){if(ki)return;const t=document.createElement("style");t.id="wg-context-menu-styles",t.textContent=Vs,document.head.appendChild(t),ki=!0}function Ns(t,e){const o=t.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((r,s)=>{const n=typeof r.label=="function"?r.label(e):r.label,l=typeof r.icon=="function"?r.icon(e):r.icon,a=r.shortcut,d=typeof r.disabled=="function"?r.disabled(e):r.disabled,c=r.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),h=r.dividerBefore&&s>0?'<div class="wg-context-menu__divider"></div>':"",g=l?`<span class="wg-context-menu__icon">${l}</span>`:"",f=a?`<span class="wg-context-menu__shortcut">${a}</span>`:"";return`${h}<div class="${u}" data-item-id="${r.id}" data-disabled="${d?"true":"false"}" data-shortcut="${a||""}">${g}<span class="wg-context-menu__label">${n}</span>${f}</div>`}).join("")}</div>`}function Bs(t,e,o,i,r,s,n,l,a){Ii();const d=Ns(s,n);if(!d)return null;const c=document.createElement("div");c.className="wg-context-menu-container",c.innerHTML=d,document.body.appendChild(c);const u=c.querySelector(".wg-context-menu");Be({getBoundingClientRect:()=>({width:0,height:0,x:e,y:o,top:o,left:e,right:e,bottom:o})},u,{placement:"bottom-start",strategy:"fixed",middleware:[Rt({mainAxis:r,alignmentAxis:i}),Ne({fallbackPlacements:["top-start","bottom-end","top-end"]}),lt({padding:8})]}).then(({x:_,y})=>{Object.assign(u.style,{left:`${_}px`,top:`${y}px`})}),c.addEventListener("click",_=>{const y=_.target.closest(".wg-context-menu__item");if(y&&y.dataset.disabled!=="true"){const C=y.dataset.itemId||"";l(C)}});const g=t.scrollEvents.subscribe("window",()=>{w(),a()}),f=t.scrollEvents.subscribe("container",()=>{w(),a()}),w=()=>{g.unsubscribe(),f.unsubscribe(),document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m),c.remove()},p=_=>{c.contains(_.target)||(w(),a())},m=_=>{if(_.key==="Escape"){_.preventDefault(),w(),a();return}const y=_.key.toLowerCase(),C=c.querySelectorAll(".wg-context-menu__item");for(const S of C){const v=S.dataset.shortcut;if(S.dataset.disabled==="true"||!v)continue;if(v.toLowerCase()===y||v===_.key){_.preventDefault();const E=S.dataset.itemId||"";l(E),w(),a();return}}};return setTimeout(()=>{document.addEventListener("mousedown",p),document.addEventListener("keydown",m)},0),c._cleanup=w,c}function ce(t,e,o){const i=t._cleanup;if(typeof i=="function"){i();return}t.remove()}const Ws={sortAsc:{icon:"↑",labelKey:"sortAsc"},sortDesc:{icon:"↓",labelKey:"sortDesc"},clearSort:{icon:"✕",labelKey:"clearSort"},hideColumn:{icon:"👁",labelKey:"hideColumn"},freezeColumn:{icon:"❄",labelKey:"freezeColumn"},unfreezeColumn:{icon:"☀",labelKey:"unfreezeColumn"},columnVisibility:{icon:"👁",labelKey:"columnVisibility",hasSubmenu:!0}};function Ei(t,e){const o=[];let i=!1;for(let r=0;r<t.length;r++){const s=t[r];if(typeof s=="string"){const n=Ws[s];if(!n){console.warn(`Unknown predefined header menu action: ${s}`);continue}let l=!0;s==="sortAsc"||s==="sortDesc"?l=d=>d.column.isSortable!==!1:s==="clearSort"?l=d=>d.sortDirection!==null:s==="hideColumn"?l=d=>{var c;return!(d.isTreeMode&&((c=d.column)!=null&&c.isTree))}:s==="freezeColumn"?l=d=>!d.isFrozen:s==="unfreezeColumn"&&(l=d=>d.isFrozen);let a;s==="columnVisibility"&&(a=d=>{const c=d.allColumns.filter(g=>!(d.isTreeMode&&g.isTree)),h=[{id:"show-all-columns",icon:c.every(g=>!g.isHidden)?"☑":"☐",label:d.labels.contextMenu.showAll,onclick:()=>{c.forEach(g=>{g.isHidden=!1})}}];return c.forEach(g=>{h.push({id:`toggle-col-${String(g.field)}`,icon:g.isHidden?"☐":"☑",label:g.title||String(g.field),onclick:()=>{g.isHidden=!g.isHidden}})}),h}),o.push({id:s,icon:n.icon,label:e.labels.contextMenu[n.labelKey],danger:n.danger,visible:l,dividerBefore:i,submenu:a}),i=!1}else s.dividerBefore&&!s.id&&!s.label?i=!0:(o.push({id:s.id||`header-menu-item-${r}`,...s,dividerBefore:i||s.dividerBefore}),i=!1)}return o}function Ri(t,e,o,i=!1){var _,y;const r=typeof t.label=="function"?t.label(e):t.label,s=typeof t.icon=="function"?t.icon(e):t.icon,n=t.shortcut,l=typeof t.disabled=="function"?t.disabled(e):t.disabled,a=t.danger===!0,d=((_=t.children)==null?void 0:_.length)||t.submenu,c=t.children||(t.submenu?t.submenu(e):[]);let u="";d&&c.length>0&&(u=`<div class="wg-context-menu wg-context-menu--submenu">${c.map((S,v)=>Ri(S,e,v,!0)).join("")}</div>`);const h=i&&((y=t.id)==null?void 0:y.startsWith("toggle-col-")),f=["wg-context-menu__item",l?"wg-context-menu__item--disabled":"",a?"wg-context-menu__item--danger":"",d?"wg-context-menu__item--has-submenu":"",h?"wg-context-menu__item--toggle":"",h&&s==="☑"?"wg-context-menu__item--checked":""].filter(Boolean).join(" "),w=t.dividerBefore&&o>0?'<div class="wg-context-menu__divider"></div>':"",p=s?`<span class="wg-context-menu__icon">${s}</span>`:"",m=n?`<span class="wg-context-menu__shortcut">${n}</span>`:"";return`${w}<div class="${f}" data-item-id="${t.id}" data-disabled="${l?"true":"false"}" data-shortcut="${n||""}">${p}<span class="wg-context-menu__label">${r}</span>${m}${u}</div>`}function Di(t,e){const o=t.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((r,s)=>Ri(r,e,s)).join("")}</div>`}function Us(t,e,o,i=!1){const{field:r,columnIndex:s}=o;switch(e){case"sortAsc":case"sortDesc":{const n=e==="sortAsc"?"asc":"desc",l=[...t.grid.sort];if(i&&t.grid.sortMode==="multi"){const a=l.findIndex(d=>d.column===r);a>=0?l[a]={column:r,direction:n}:l.push({column:r,direction:n}),t.grid.sort=l}else t.grid.sort=[{column:r,direction:n}];break}case"clearSort":t.grid.sort=t.grid.sort.filter(n=>n.column!==r);break;case"hideColumn":{const n=t.grid.columns.find(l=>String(l.field)===r);n&&!(t.grid.isTreeMode&&n.isTree)&&(n.isHidden=!0,t.grid.columns=[...t.grid.columns]);break}case"freezeColumn":t.grid.freezeColumns=s+1;break;case"unfreezeColumn":t.grid.freezeColumns=Math.max(0,s);break}}function Ti(t,e){e.style.display="block",Be(t,e,{placement:"right-start",strategy:"fixed",middleware:[Ne({fallbackPlacements:["left-start","right-end","left-end"]}),lt({padding:8})]}).then(({x:o,y:i})=>{e.style.left=`${o}px`,e.style.top=`${i}px`})}function Mi(t){t.querySelectorAll(".wg-context-menu__item--has-submenu").forEach(o=>{const i=o,r=i.querySelector(":scope > .wg-context-menu--submenu");if(!r)return;let s=null;const n=()=>{s!==null&&(clearTimeout(s),s=null)},l=()=>{s=window.setTimeout(()=>{r.style.display="none",s=null},150)};i.addEventListener("mouseenter",()=>{n(),Ti(i,r)}),i.addEventListener("mouseleave",l),r.addEventListener("mouseenter",n),r.addEventListener("mouseleave",l)})}function $i(t,e,o,i,r,s,n){Ii();const l=Di(i,r);if(!l)return null;const a=document.createElement("div");a.className="wg-context-menu-container",a.innerHTML=l,document.body.appendChild(a);let d=a.querySelector(".wg-context-menu");Mi(d),Be({getBoundingClientRect:()=>({width:0,height:0,x:e,y:o,top:o,left:e,right:e,bottom:o})},d,{placement:"bottom-start",strategy:"fixed",middleware:[Ne({fallbackPlacements:["top-start","bottom-end","top-end"]}),lt({padding:8})]}).then(({x:p,y:m})=>{Object.assign(d.style,{left:`${p}px`,top:`${m}px`})}),a.addEventListener("click",p=>{const m=p.target.closest(".wg-context-menu__item");if(!m||m.dataset.disabled==="true")return;const _=m.dataset.itemId||"",y=p.ctrlKey;if(!m.classList.contains("wg-context-menu__item--has-submenu")){if(_.startsWith("toggle-col-")||_==="show-all-columns"){s(_,!0,y);const C=Di(i,r),S=document.createElement("div");S.innerHTML=C;const v=S.querySelector(".wg-context-menu");if(v&&d.parentNode){v.style.left=d.style.left,v.style.top=d.style.top,d.parentNode.replaceChild(v,d),d=v,Mi(v);const x=v.querySelector(".wg-context-menu__item--has-submenu"),k=x==null?void 0:x.querySelector(":scope > .wg-context-menu--submenu");x&&k&&Ti(x,k)}return}s(_,!1,y)}});const u=t.scrollEvents.subscribe("window",()=>{g(),n()}),h=t.scrollEvents.subscribe("container",()=>{g(),n()}),g=()=>{u.unsubscribe(),h.unsubscribe(),document.removeEventListener("mousedown",f),document.removeEventListener("keydown",w),a.remove()},f=p=>{a.contains(p.target)||(g(),n())},w=p=>{if(p.key==="Escape"){p.preventDefault(),g(),n();return}const m=p.key.toLowerCase(),_=a.querySelectorAll(".wg-context-menu__item");for(const y of _){const C=y.dataset.shortcut;if(y.dataset.disabled==="true"||!C)continue;if(C.toLowerCase()===m||C===p.key){p.preventDefault();const x=y.dataset.itemId||"";s(x),g(),n();return}}};return setTimeout(()=>{document.addEventListener("mousedown",f),document.addEventListener("keydown",w)},0),a._cleanup=g,a}function pt(t){const e=t.split("+").map(i=>i.trim()),o={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of e){const r=i.toLowerCase();r==="ctrl"||r==="control"?o.ctrl=!0:r==="shift"?o.shift=!0:r==="alt"?o.alt=!0:r==="meta"||r==="cmd"||r==="command"?o.meta=!0:o.key=i}return o}function mt(t,e){if(e.ctrl!==t.ctrlKey||e.shift!==t.shiftKey||e.alt!==t.altKey||e.meta!==t.metaKey)return!1;const o=t.key.toLowerCase(),i=e.key.toLowerCase();return o===i}function Ys(t){return t.split("+").map(e=>{const o=e.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(o.toLowerCase())?o.charAt(0).toUpperCase()+o.slice(1).toLowerCase():o}).join("+")}function Ks(t){const{scrollTop:e,viewportHeight:o,rowHeight:i,buffer:r,totalItems:s,editingRowIndex:n}=t;let l=Math.max(0,Math.floor(e/i)-r);const a=Math.ceil(o/i)+r*2;let d=Math.min(s,l+a);return n!==void 0&&(n<l&&(l=n),n>=d&&(d=n+1)),{startIndex:l,endIndex:d}}function js(t){const{targetRow:e,rowHeight:o,buffer:i,totalItems:r,viewportHeight:s,scrollHeight:n,clientHeight:l}=t,a=Math.max(0,(e-1)*o),d=Math.max(0,n-l),c=Math.min(a,d);let u=Math.max(0,Math.floor(c/o)-i);const h=Math.ceil(s/o)+i*2;let g=Math.min(r,u+h);return e<u&&(u=e),e>=g&&(g=e+1),{scrollTop:c,startIndex:u,endIndex:g}}function Xs(t,e,o,i){return e-(t+o)<=i}function Gs(t,e,o){if(!o){const l=e.target.closest(".wg__header--sortable");if(!l||(o=l.dataset.field,!o))return}const i=[...t.grid.sort],r=i.findIndex(n=>n.column===o);(e.ctrlKey||e.metaKey)&&t.grid.sortMode==="multi"?r>=0?i[r].direction==="asc"?i[r]={column:o,direction:"desc"}:i.splice(r,1):i.push({column:o,direction:"asc"}):r>=0&&i.length===1?i[0].direction==="asc"?i[0]={column:o,direction:"desc"}:i.length=0:(i.length=0,i.push({column:o,direction:"asc"})),t.grid.sort=i,t.grid.isPageable&&(t.grid.currentPage=1),t.grid.fireDataRequest("sort")}function Qs(t,e){const i=e.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const r=i.dataset.action;let s=!1;return r==="first"&&t.grid.currentPage!==1?(t.grid.currentPage=1,s=!0):r==="prev"&&t.grid.currentPage>1?(t.grid.currentPage--,s=!0):r==="next"&&t.grid.currentPage<t.grid.totalPages?(t.grid.currentPage++,s=!0):r==="last"&&t.grid.currentPage!==t.grid.totalPages&&(t.grid.currentPage=t.grid.totalPages,s=!0),s&&t.grid.fireDataRequest("page"),s}function Js(t,e){const o=parseInt(e.value,10);return o!==t.grid.pageSize?(t.grid.pageSize=o,t.grid.currentPage=1,t.grid.fireDataRequest("pageSize"),!0):!1}let j={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},De=null;function Pi(t,e){if(!t)return e;const o=parseFloat(t);return isNaN(o)?e:o}function Zs(t,e,o){const i=e.target,r=i.closest(".wg__header");if(!r)return;const s=t.grid.columns.find(a=>String(a.field)===o);if(!s||s.isResizable===!1)return;const n=r.getBoundingClientRect().width;j={isResizing:!0,startX:e.clientX,startWidth:n,field:o,headerCell:r,minWidth:Pi(s.minWidth,30),maxWidth:s.maxWidth?Pi(s.maxWidth,1/0):null},De=t,s.minWidth?r.style.minWidth=s.minWidth:r.style.minWidth=`${j.minWidth}px`;const l=t.shadow.querySelector(".wg");l==null||l.classList.add("wg--resizing"),i.classList.add("wg__resize-handle--active"),document.addEventListener("mousemove",Ai),document.addEventListener("mouseup",Li),e.preventDefault()}function Ai(t){if(!j.isResizing||!De)return;const e=t.clientX-j.startX;let o=j.startWidth+e;o=Math.max(o,j.minWidth),j.maxWidth!==null&&(o=Math.min(o,j.maxWidth)),j.headerCell&&(j.headerCell.style.width=`${o}px`,j.headerCell.style.maxWidth=`${o}px`),el(De,j.field,`${o}px`),(De.grid.freezeColumns>0||De.grid.isStickyRowNumbers)&&ol(De)}function Li(t){if(!j.isResizing||!De)return;const e=De,o=j.field,i=`${j.startWidth}px`,r=t.clientX-j.startX;let s=j.startWidth+r;s=Math.max(s,j.minWidth),j.maxWidth!==null&&(s=Math.min(s,j.maxWidth));const n=`${s}px`;e.grid.setColumnWidth(o,n,!0);const l=e.shadow.querySelector(`col[data-field="${o}"]`);l&&(l.style.width=n);const a=e.shadow.querySelector(".wg");a==null||a.classList.remove("wg--resizing");const d=e.shadow.querySelector(".wg__resize-handle--active");d==null||d.classList.remove("wg__resize-handle--active"),e.grid.oncolumnresize&&e.grid.oncolumnresize({field:o,oldWidth:i,newWidth:n,allWidths:e.grid.getColumnWidthsState()}),e.grid.shouldPersistColumnWidths&&e.grid.gridName&&e.grid.savePersistedWidths(),document.removeEventListener("mousemove",Ai),document.removeEventListener("mouseup",Li),j={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},De=null}function el(t,e,o){t.shadow.querySelectorAll(`td[data-field="${e}"]`).forEach(r=>{r.style.width=o,r.style.maxWidth=o})}const tl=40;function ol(t){const e=t.grid.freezeColumns;let i=t.grid.isRowNumbersVisible&&t.grid.isStickyRowNumbers?tl:0;const r=t.grid.visualColumns;for(let s=0;s<e&&s<r.length;s++){const{column:n}=r[s],l=String(n.field),a=t.shadow.querySelector(`th[data-field="${l}"]`);a&&(a.style.left=`${i}px`,t.shadow.querySelectorAll(`td[data-field="${l}"]`).forEach(c=>{c.style.left=`${i}px`}),i+=a.getBoundingClientRect().width)}}const il=5;let H={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},Te=null,qt=!1;function zi(){return qt?(qt=!1,!0):H.isReordering}function rl(t,e,o){var c;const i=e.target,r=i.closest(".wg__header");if(!r||i.classList.contains("wg__resize-handle"))return;const s=t.grid.visualColumns,n=t.grid.totalFrozenColumns,l=s.findIndex(u=>String(u.column.field)===o);if(l<n)return;const a=(c=s[l])==null?void 0:c.column;if((a==null?void 0:a.isMovable)===!1)return;const d=l-n;H={isPending:!0,isReordering:!1,field:o,startX:e.clientX,startY:e.clientY,headerCell:r,ghost:null,dropIndicator:null,fromIndex:d,currentDropIndex:d},Te=t,document.addEventListener("mousemove",Oi),document.addEventListener("mouseup",Hi),e.preventDefault()}function nl(t,e,o){var r;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((r=e.querySelector(".wg__header-title"))==null?void 0:r.textContent)||"",i.style.left=`${o.clientX+10}px`,i.style.top=`${o.clientY-10}px`,t.shadow.appendChild(i),H.ghost=i}function sl(t){var o;const e=document.createElement("div");e.className="wg__drop-indicator",(o=t.shadow.querySelector(".wg"))==null||o.appendChild(e),H.dropIndicator=e}function ll(t,e){H.isPending=!1,H.isReordering=!0;const o=t.shadow.querySelector(".wg");o==null||o.classList.add("wg--reordering"),H.headerCell&&H.headerCell.classList.add("wg__header--dragging"),H.headerCell&&nl(t,H.headerCell,e),sl(t)}function Oi(t){if(!Te)return;if(H.isPending){const i=t.clientX-H.startX,r=t.clientY-H.startY;Math.sqrt(i*i+r*r)>=il&&ll(Te,t);return}if(!H.isReordering||!Te.shadow.querySelector(".wg"))return;H.ghost&&(H.ghost.style.left=`${t.clientX+10}px`,H.ghost.style.top=`${t.clientY-10}px`);const o=dl(Te,t.clientX);o!==H.currentDropIndex&&(H.currentDropIndex=o,cl(Te,o))}function al(t){const e=t.grid.visualColumns,o=t.grid.totalFrozenColumns,i=e.slice(o);let r=0;for(let s=0;s<i.length;s++)i[s].column.isMovable===!1&&(r=s+1);return r}function dl(t,e){const o=t.grid.visualColumns,i=t.grid.totalFrozenColumns,r=o.slice(i);if(r.length===0)return 0;const s=al(t),n=String(r[0].column.field),l=t.shadow.querySelector(`th[data-field="${n}"]`);if(l){const a=l.getBoundingClientRect();if(e<a.left)return s}for(let a=0;a<r.length;a++){const d=String(r[a].column.field),c=t.shadow.querySelector(`th[data-field="${d}"]`);if(c){const u=c.getBoundingClientRect(),h=u.left+u.width/2;if(e<h)return Math.max(a,s)}}return r.length}function cl(t,e){const o=H.dropIndicator;if(!o)return;const i=t.grid.visualColumns,r=t.grid.totalFrozenColumns,s=i.slice(r),n=t.shadow.querySelector(".wg"),l=n==null?void 0:n.getBoundingClientRect();if(!l||!n)return;let a;if(e>=s.length){const u=String(s[s.length-1].column.field),h=t.shadow.querySelector(`th[data-field="${u}"]`);if(h)a=h.getBoundingClientRect().right-l.left+n.scrollLeft;else return}else{const u=String(s[e].column.field),h=t.shadow.querySelector(`th[data-field="${u}"]`);if(h)a=h.getBoundingClientRect().left-l.left+n.scrollLeft;else return}const d=n.scrollTop,c=n.clientHeight;o.style.left=`${a}px`,o.style.top=`${d}px`,o.style.height=`${c}px`,o.style.display="block"}function Hi(t){if(!Te)return;const e=Te;if(H.isPending){Fi(e);return}if(!H.isReordering)return;const o=H.field,i=H.fromIndex,r=H.currentDropIndex;if(i!==r&&r!==i+1){const s=r>i?r-1:r;e.grid.moveColumn(o,s),e.grid.oncolumnreorder&&e.grid.oncolumnreorder({field:o,fromIndex:i,toIndex:s,allOrder:e.grid.getColumnOrderState()}),e.grid.shouldPersistColumnOrder&&e.grid.gridName&&e.grid.savePersistedState()}qt=!0,requestAnimationFrame(()=>{qt=!1}),Fi(e)}function Fi(t){H.ghost&&H.ghost.remove(),H.dropIndicator&&H.dropIndicator.remove();const e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--reordering"),H.headerCell&&H.headerCell.classList.remove("wg__header--dragging"),document.removeEventListener("mousemove",Oi),document.removeEventListener("mouseup",Hi),H={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},Te=null}function gl(){const t=new Set,e=new Set;let o=null,i=!1;const r=()=>{t.forEach(n=>n())},s=()=>{e.forEach(n=>n())};return{subscribe(n,l){const a=n==="container"?t:e;return a.add(l),{unsubscribe:()=>{a.delete(l)}}},init(n){o=n,n.addEventListener("scroll",r),i||(window.addEventListener("scroll",s,{capture:!0,passive:!0}),i=!0)},destroy(){o&&(o.removeEventListener("scroll",r),o=null),i&&(window.removeEventListener("scroll",s,!0),i=!1),t.clear(),e.clear()}}}function ul(t,e){const o=new Set,i=new Set;let r=null;const s=l=>{const a=l.target,d=l.relatedTarget;o.forEach(c=>c(a,d))},n=l=>{const a=l.target,d=l.relatedTarget;i.forEach(c=>c(a,d))};return{subscribe(l,a){const d=l==="blur"?o:i;return d.add(a),{unsubscribe:()=>{d.delete(a)}}},shouldSkipBlur(){const l=t();return l.isClosingViaToggle?(e(),!0):l.isCommittingFromKeyboard||l.isTransitioningCells||l.isOpeningDropdown},init(l){r=l,l.addEventListener("blur",s,!0),l.addEventListener("focusout",n)},destroy(){r&&(r.removeEventListener("blur",s,!0),r.removeEventListener("focusout",n),r=null),o.clear(),i.clear()}}}function hl(){const t={outsideClick:new Set,cellClick:new Set,rowNumberClick:new Set,headerClick:new Set,sortClick:new Set,emptyAreaClick:new Set};let e=null,o=!1,i=null,r=!1;const s=(d,c)=>{for(const u of t[d])if(u(c)===!0)return!0;return!1},n=()=>{setTimeout(()=>{r&&(r=!1)},10)},l=d=>{r=!0;const c=d,h=c.composedPath()[0]||c.target,g={target:h,event:c},f=h.closest(".wg__cell"),w=h.closest(".wg__row-number[data-row-number]"),p=h.closest(".wg__header:not(.wg__row-number-header)"),m=h.closest(".wg__sort-indicator");if(m){const _=m.closest(".wg__header--sortable");if(_){g.field=_.dataset.field,g.colIndex=parseInt(_.dataset.colIndex||"-1",10),s("sortClick",g);return}}w?(g.rowIndex=parseInt(w.dataset.rowNumber||"-1",10),s("rowNumberClick",g)):p&&!h.closest(".wg__resize-handle")?(g.field=p.dataset.field,g.colIndex=parseInt(p.dataset.colIndex||"-1",10),s("headerClick",g)):f&&!f.classList.contains("wg__row-number")?(g.rowIndex=parseInt(f.dataset.row||"-1",10),g.colIndex=parseInt(f.dataset.col||"-1",10),s("cellClick",g)):h.closest(".wg__toolbar, button, input, select, textarea")||s("emptyAreaClick",g)},a=d=>{if(!e)return;if(r){r=!1;return}const c=d,u=c.target,h=c.composedPath?c.composedPath():[],g=h.includes(e),f=!g&&(i==null?void 0:i(h))===!0;!g&&!f&&s("outsideClick",{target:u,event:c})};return{subscribe(d,c){return t[d].add(c),{unsubscribe:()=>{t[d].delete(c)}}},init(d,c,u){e=c,i=u??null,c.addEventListener("mousedown",l),c.addEventListener("mouseup",n),o||(document.addEventListener("click",a,!0),o=!0)},destroy(){e&&(e.removeEventListener("mousedown",l),e.removeEventListener("mouseup",n)),o&&(document.removeEventListener("click",a,!0),o=!1),e=null,i=null,r=!1,Object.values(t).forEach(d=>d.clear())}}}const fl=5;let L={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:null},ae=null,bt=null,ot=null;function qi(){return L.isDragging}function ko(){return L.isPending}function Vi(t,e,o,i){var l;const r=i.shiftKey&&t.grid.cellSelectionMode==="shift";t.grid.selectedCellRange&&!r&&(t.grid.clearCellSelection(),Q()),(l=t.grid.visualColumns[o])!=null&&l.column&&(L={...L,isPending:!0,isDragging:!1,startRowIndex:e,startColIndex:o,startX:i.clientX,startY:i.clientY,currentRowIndex:e,currentColIndex:o},ae=t,document.addEventListener("mousemove",Ni),document.addEventListener("mouseup",Wi),document.addEventListener("keydown",Ui))}function wl(t,e,o){var i,r;if(Q(),t.grid.lastClickedCell){const{rowIndex:s,colIndex:n}=t.grid.lastClickedCell,l=t.grid.visualColumns,a=(i=l[n])==null?void 0:i.column,d=(r=l[o])==null?void 0:r.column;if(a&&d){const c={startRowIndex:s,startColIndex:n,endRowIndex:e,endColIndex:o,startField:String(a.field),endField:String(d.field)};t.grid.clearFocusedCell(),t.grid.selectCellRange(c),Vt(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=t.shadow.querySelector(".wg");u==null||u.focus({preventScroll:!0})})})}}else t.grid.lastClickedCell={rowIndex:e,colIndex:o}}function Ni(t){if(ae){if(L.isPending){const e=t.clientX-L.startX,o=t.clientY-L.startY;Math.sqrt(e*e+o*o)>=fl&&ml(ae);return}L.isDragging&&(bt=t,ot||(ot=requestAnimationFrame(pl)))}}function pl(){if(ot=null,!bt||!ae)return;const t=bt;bt=null;const e=bl(ae,t.clientX,t.clientY);if(e&&(e.rowIndex!==L.currentRowIndex||e.colIndex!==L.currentColIndex)){L.currentRowIndex=e.rowIndex,L.currentColIndex=e.colIndex;const o=Yi(ae);Bi(ae),Ki(ae,o)}}function ml(t){L.isPending=!1,L.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting-cells");const o=t.grid.focusedCell;t.grid.clearFocusedCell(),ee(t,o,null);const i=t.shadow.querySelector(".wg__cell:focus");i==null||i.blur();const r=t.grid.focusedRowIndex;if(r!==null){const s=t.shadow.querySelector(`tr[data-row-index="${r}"]`);s==null||s.classList.remove("wg__row--focused"),t.grid.clearRowFocus()}Bi(t),ji(t)}function Bi(t){const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r}=L,s=Math.min(e,i),n=Math.max(e,i),l=Math.min(o,r),a=Math.max(o,r);t.shadow.querySelectorAll(".wg__cell--in-range").forEach(c=>c.classList.remove("wg__cell--in-range"));for(let c=s;c<=n;c++)for(let u=l;u<=a;u++){const h=t.shadow.querySelector(`[data-row="${c}"][data-col="${u}"]`);h&&h.classList.add("wg__cell--in-range")}}function Wi(t){if(!ae)return;const e=ae;if(L.isPending){t.shiftKey&&e.grid.cellSelectionMode==="shift"&&e.grid.lastClickedCell?wl(e,L.startRowIndex,L.startColIndex):e.grid.lastClickedCell={rowIndex:L.startRowIndex,colIndex:L.startColIndex},Nt(e);return}if(!L.isDragging)return;if(L.startRowIndex===L.currentRowIndex&&L.startColIndex===L.currentColIndex){e.shadow.querySelectorAll(".wg__cell--in-range").forEach(n=>n.classList.remove("wg__cell--in-range")),Q();const{startRowIndex:r,startColIndex:s}=L;e.grid.setFocusedCell(r,s),ee(e,null,{rowIndex:r,colIndex:s}),ft(e,r,s),Nt(e)}else _l(e),Nt(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})})}function Ui(t){if(t.key==="Escape"&&ae){t.preventDefault();const e=ae;if(L.isDragging){e.shadow.querySelectorAll(".wg__cell--in-range").forEach(s=>s.classList.remove("wg__cell--in-range")),Q();const{startRowIndex:i,startColIndex:r}=L;e.grid.setFocusedCell(i,r),ee(e,null,{rowIndex:i,colIndex:r}),ft(e,i,r)}Nt(e)}}function bl(t,e,o){const i=t.shadow.elementFromPoint(e,o);if(!i)return null;const r=i.closest(".wg__cell[data-row][data-col]");if(!r)return null;const s=parseInt(r.dataset.row||"-1",10),n=parseInt(r.dataset.col||"-1",10);return s>=0&&n>=0?{rowIndex:s,colIndex:n}:null}function _l(t){var d,c;const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r}=L,s=t.grid.visualColumns,n=(d=s[o])==null?void 0:d.column,l=(c=s[r])==null?void 0:c.column;if(!n||!l)return;const a={startRowIndex:e,startColIndex:o,endRowIndex:i,endColIndex:r,startField:String(n.field),endField:String(l.field)};t.grid.clearFocusedCell(),t.grid.selectCellRange(a),Vt(t)}function Yi(t){const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r}=L,s=t.shadow.querySelector(".wg");if(!s)return null;const n=Math.min(e,i),l=Math.max(e,i),a=Math.min(o,r),d=Math.max(o,r),c=t.shadow.querySelector(`[data-row="${n}"][data-col="${a}"]`),u=t.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`);if(!c||!u)return null;const h=s.getBoundingClientRect(),g=c.getBoundingClientRect(),f=u.getBoundingClientRect(),w=s.scrollLeft,p=s.scrollTop;return{container:s,left:g.left-h.left+w-s.clientLeft,top:g.top-h.top+p-s.clientTop,width:f.right-g.left,height:f.bottom-g.top}}function Ki(t,e){if(!e){Q();return}let o=L.rangeBorder;o||(o=document.createElement("div"),o.className="wg__cell-range-border",e.container.appendChild(o),L.rangeBorder=o),o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.width}px`,o.style.height=`${e.height}px`}function ji(t){const e=Yi(t);Ki(t,e)}function Vt(t){Q();const e=t.grid.selectedCellRange;if(!e)return;const o=t.shadow.querySelector(".wg");if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=e,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n),u=t.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`),h=t.shadow.querySelector(`[data-row="${a}"][data-col="${c}"]`);if(!u||!h)return;const g=o.getBoundingClientRect(),f=u.getBoundingClientRect(),w=h.getBoundingClientRect(),p=o.scrollLeft,m=o.scrollTop,_=f.left-g.left+p-o.clientLeft,y=f.top-g.top+m-o.clientTop,C=w.right-f.left,S=w.bottom-f.top,v=document.createElement("div");v.className="wg__cell-range-border",v.style.left=`${_}px`,v.style.top=`${y}px`,v.style.width=`${C}px`,v.style.height=`${S}px`,o.appendChild(v),L.rangeBorder=v}function Xi(t){L.rangeBorder&&(Q(),L.isDragging?ji(t):Vt(t))}function Q(){L.rangeBorder&&(L.rangeBorder.remove(),L.rangeBorder=null)}function Nt(t){const e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting-cells"),ot&&(cancelAnimationFrame(ot),ot=null),bt=null,document.removeEventListener("mousemove",Ni),document.removeEventListener("mouseup",Wi),document.removeEventListener("keydown",Ui),L={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:L.rangeBorder},ae=null}const vl=5;let me={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Fe=null;function yl(t,e,o){if(o.preventDefault(),o.stopPropagation(),wi(t),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q()),t.grid.focusedCell){const{rowIndex:i,colIndex:r}=t.grid.focusedCell,s=t.shadow.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`);s==null||s.classList.remove("wg__cell--focused"),t.grid.clearFocusedCell()}if(o.ctrlKey||o.metaKey){t.grid.selectRow(e,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}if(o.shiftKey){t.grid.selectRow(e,"range"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}me={isPending:!0,isDragging:!1,startRowIndex:e,startX:o.clientX,startY:o.clientY,currentRowIndex:e},Fe=t,t.grid.selectRow(e,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",Gi),document.addEventListener("mouseup",Qi)}function Gi(t){if(!Fe)return;if(me.isPending){const o=t.clientX-me.startX,i=t.clientY-me.startY;Math.sqrt(o*o+i*i)>=vl&&Cl(Fe);return}if(!me.isDragging)return;const e=Sl(Fe,t.clientY);e!==null&&e!==me.currentRowIndex&&(me.currentRowIndex=e,Fe.grid.selectRowRange(me.startRowIndex,e))}function Cl(t){me.isPending=!1,me.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting")}function Qi(){if(!Fe)return;const t=Fe,e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=t.shadow.querySelector(".wg");o==null||o.focus({preventScroll:!0})})}),document.removeEventListener("mousemove",Gi),document.removeEventListener("mouseup",Qi),me={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Fe=null}function Sl(t,e){const o=t.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of o){const r=i.getBoundingClientRect();if(e>=r.top&&e<=r.bottom){const s=parseInt(i.dataset.rowIndex||"-1",10);if(s>=0)return s}}if(o.length>0){const i=o[0],r=o[o.length-1],s=i.getBoundingClientRect(),n=r.getBoundingClientRect();if(e<s.top)return parseInt(i.dataset.rowIndex||"0",10);if(e>n.bottom)return parseInt(r.dataset.rowIndex||"0",10)}return null}let Bt=[],Wt=[];function Ji(t){if(t.length===0)return[];const e=[...t].sort((s,n)=>s-n),o=[];let i=e[0],r=e[0];for(let s=1;s<e.length;s++)e[s]===r+1||(o.push({start:i,end:r}),i=e[s]),r=e[s];return o.push({start:i,end:r}),o}function Zi(t,e,o,i,r,s){const n=document.createElement("div");return n.className=s,n.style.left=`${e}px`,n.style.top=`${o}px`,n.style.width=`${i}px`,n.style.height=`${r}px`,t.appendChild(n),n}function er(t){it();const e=t.grid.selectedRows;if(e.length===0)return;const o=t.shadow.querySelector(".wg");if(!o)return;const i=Ji(e),r=t.grid.visualColumns;if(r.length===0)return;const s=o.getBoundingClientRect(),n=o.scrollLeft,l=o.scrollTop;for(const a of i){const d=t.shadow.querySelector(`.wg__cell[data-row="${a.start}"][data-col="0"]`),c=r.length-1,u=t.shadow.querySelector(`.wg__cell[data-row="${a.end}"][data-col="${c}"]`);if(!d||!u)continue;const h=d.getBoundingClientRect(),g=u.getBoundingClientRect(),f=h.left-s.left+n-o.clientLeft,w=h.top-s.top+l-o.clientTop,p=g.right-h.left,m=g.bottom-h.top,_=Zi(o,f,w,p,m,"wg__row-selection-border");Bt.push(_)}}function tr(t){rt();const e=t.grid.selectedColumns;if(e.length===0)return;const o=t.shadow.querySelector(".wg");if(!o)return;const i=Ji(e),r=t.grid.displayItems,s=t.grid.visualColumns;if(r.length===0||s.length===0)return;const n=o.getBoundingClientRect(),l=o.scrollLeft,a=o.scrollTop;for(const d of i){const c=s[d.start],u=s[d.end];if(!c||!u)continue;const h=String(c.column.field),g=String(u.column.field),f=t.shadow.querySelector(`.wg__header[data-field="${h}"]`),w=r.length-1,p=t.shadow.querySelector(`.wg__cell[data-row="${w}"][data-col="${u.originalIndex}"]`);if(!f||!p)continue;const m=t.shadow.querySelector(`.wg__header[data-field="${g}"]`);if(!m)continue;const _=f.getBoundingClientRect(),y=m.getBoundingClientRect(),C=p.getBoundingClientRect(),S=_.left-n.left+l-o.clientLeft,v=_.top-n.top+a-o.clientTop,x=y.right-_.left,k=C.bottom-_.top,E=Zi(o,S,v,x,k,"wg__column-selection-border");Wt.push(E)}}function xl(t){Bt.length>0&&er(t),Wt.length>0&&tr(t)}function it(){for(const t of Bt)t.remove();Bt=[]}function rt(){for(const t of Wt)t.remove();Wt=[]}function kl(){it(),rt()}const Il=5;let be={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},qe=null;function El(t,e,o){if(o.preventDefault(),o.stopPropagation(),wi(t),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q()),o.ctrlKey||o.metaKey){t.grid.selectColumn(e,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}be={isPending:!0,isDragging:!1,startColIndex:e,startX:o.clientX,startY:o.clientY,currentColIndex:e},qe=t,o.shiftKey?t.grid.selectColumn(e,"range"):t.grid.selectColumn(e,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",or),document.addEventListener("mouseup",ir)}function or(t){if(!qe)return;if(be.isPending){const o=t.clientX-be.startX,i=t.clientY-be.startY;Math.sqrt(o*o+i*i)>=Il&&Rl(qe);return}if(!be.isDragging)return;const e=Dl(qe,t.clientX);e!==null&&e!==be.currentColIndex&&(be.currentColIndex=e,qe.grid.selectColumnRange(be.startColIndex,e))}function Rl(t){be.isPending=!1,be.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting-columns")}function ir(){if(!qe)return;const t=qe,e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting-columns"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=t.shadow.querySelector(".wg");o==null||o.focus({preventScroll:!0})})}),document.removeEventListener("mousemove",or),document.removeEventListener("mouseup",ir),be={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},qe=null}function Dl(t,e){const o=t.shadow.querySelectorAll(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)"),i=t.grid.visualColumns;for(const r of o){const s=r.getBoundingClientRect();if(e>=s.left&&e<=s.right){const n=r.dataset.field;if(n){const l=i.findIndex(a=>String(a.column.field)===n);if(l>=0)return l}}}if(o.length>0){const r=o[0],s=o[o.length-1],n=r.getBoundingClientRect(),l=s.getBoundingClientRect();if(e<n.left){const a=r.dataset.field;if(a){const d=i.findIndex(c=>String(c.column.field)===a);if(d>=0)return d}return 0}if(e>l.right){const a=s.dataset.field;if(a){const d=i.findIndex(c=>String(c.column.field)===a);if(d>=0)return d}return i.length-1}}return null}function Tl(t){const e=[];let o=[],i="",r=!1;for(let s=0;s<t.length;s++){const n=t[s],l=t[s+1];r?n==='"'?l==='"'?(i+='"',s++):r=!1:i+=n:n==='"'?r=!0:n===" "?(o.push(i),i=""):n===`
657
657
  `||n==="\r"&&l===`
658
- `?(o.push(i),o.some(a=>a!=="")&&e.push(o),o=[],i="",n==="\r"&&s++):n!=="\r"&&(i+=n)}return(i!==""||o.length>0)&&(o.push(i),o.some(s=>s!=="")&&e.push(o)),e}function Ml(t,e){const o=new Map,i=new Map;e.forEach((a,d)=>{var h;if(a.isHidden)return;const c=String(a.field),u=((h=a.title)==null?void 0:h.toLowerCase().trim())||"";u&&o.set(u,{field:c,colIndex:d}),i.set(c.toLowerCase(),{field:c,colIndex:d})});const r=[];let s=0;for(const a of t){const d=a.trim().toLowerCase();if(!d)continue;const c=o.get(d)||i.get(d);c&&(s++,r.push({pastedHeader:a,gridField:c.field,colIndex:c.colIndex}))}const n=t.filter(a=>a.trim()!=="").length,l=Math.max(2,Math.floor(n*.5));return s>=l?r:null}async function $l(t,e,o,i){var v;const r=t.grid,s=Tl(e);if(s.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:!1};const n=Ml(s[0],r.columns),l=n!==null,a=l?s.slice(1):s;if(a.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:l};const d=r.visualColumns,c=r.isEmptyRowIndex(o),u=r.items.length;let h;if(c)h=a.length;else{const x=o+a.length-1;h=Math.max(0,x-u+1)}const g={rawText:e,parsedRows:s,hasHeaders:l,headerMapping:n,targetRowIndex:o,targetColIndex:i,newRowsCount:h,cancel:!1,skipCells:new Set};if(r.onbeforepaste&&(r.onbeforepaste(g),g.cancel))return{totalCells:a.reduce((x,k)=>x+k.length,0),successfulCells:0,failedCells:0,skippedCells:a.reduce((x,k)=>x+k.length,0),newRowsCreated:0,cellResults:[],hadHeaders:l};let f=0,w=u;if(h>0){const x=[];for(let k=0;k<h;k++){const E=c?k:u+k-o,I=a[E],R={};l&&n?I==null||I.forEach((D,M)=>{const A=n[M];A&&(R[A.gridField]=D)}):I==null||I.forEach((D,M)=>{const A=i+M;if(A<d.length){const F=String(d[A].column.field);R[F]=D}});let P;r.createRowCallback?P=r.createRowCallback(R,u+k):P=R,x.push(P),f++}c&&r.newRowPosition==="top"?(r.items=[...x,...r.items],w=0):(r.items=[...r.items,...x],w=u)}const p=[],m=r.pasteMode;for(let x=0;x<a.length;x++){const k=a[x],E=c?w+x:o+x,I=c?r.newRowPosition==="top"?1+x:r.items.length-a.length+x:o+x,R=E;for(let P=0;P<k.length;P++){const D=k[P];let M,A;if(l&&n){const K=n[P];if(!K)continue;M=K.gridField,A=K.colIndex}else{if(A=i+P,A>=d.length){p.push({rowIndex:I,field:"",value:D,isValid:!1,wasSkipped:!0,skipReason:"out-of-bounds"});continue}M=String(d[A].column.field)}const F=`${x}-${P}`;if(g.skipCells.has(F)){p.push({rowIndex:I,field:M,value:D,isValid:!0,wasSkipped:!0,skipReason:"user-canceled"});continue}const T=r.columns.find(K=>String(K.field)===M);if(!T)continue;const $=r.displayItems[I];if(!r.isCellEditable(T,$)){if(m==="editable-only"){p.push({rowIndex:I,field:M,value:D,isValid:!1,wasSkipped:!0,skipReason:"non-editable"});continue}else if(m==="skip-non-editable"){p.push({rowIndex:I,field:M,value:D,isValid:!0,wasSkipped:!0,skipReason:"non-editable"});continue}}const U=c?r.items[R]:r.displayItems[R];if(U&&r.isRowLocked(U)){p.push({rowIndex:I,field:M,value:D,isValid:!0,wasSkipped:!0,skipReason:"locked"});continue}let ge=D;if(T.beforePasteCallback&&U&&(ge=T.beforePasteCallback(D,U)),c){const K=r.items[R];if(K&&r.shouldValidateOnPaste&&T.beforeCommitCallback){const _e={value:ge,oldValue:void 0,row:K,rowIndex:R,field:M},J=await Promise.resolve(T.beforeCommitCallback(_e)),Me=J===!0||J===void 0||typeof J=="object"&&J!==null&&J.valid!==!1,te=typeof J=="object"&&J!==null?J.error||J.message:typeof J=="string"?J:void 0;Me||(r.addInvalidCell(I,M,te||"Invalid value"),(v=r.onvalidationerror)==null||v.call(r,{row:K,rowIndex:I,field:M,error:te||"Invalid value"})),p.push({rowIndex:I,field:M,value:ge,isValid:Me,validationError:Me?void 0:te,wasSkipped:!1})}else p.push({rowIndex:I,field:M,value:ge,isValid:!0,wasSkipped:!1})}else if(r.shouldValidateOnPaste){await r.commitEdit(I,M,ge);const K=r.displayItems[I]!==void 0?r.getStableRowKey(r.displayItems[I],I):null,_e=K!==null?r.invalidCells.find(J=>J.rowKey===K&&J.field===M):void 0;p.push({rowIndex:I,field:M,value:ge,isValid:!_e,validationError:_e==null?void 0:_e.error,wasSkipped:!1})}else{const K=r.items[R];K&&(K[M]=ge),p.push({rowIndex:I,field:M,value:ge,isValid:!0,wasSkipped:!1})}}}const _=p.filter(x=>!x.wasSkipped&&x.isValid).length,y=p.filter(x=>!x.wasSkipped&&!x.isValid).length,C=p.filter(x=>x.wasSkipped).length,S={totalCells:p.length,successfulCells:_,failedCells:y,skippedCells:C,newRowsCreated:f,cellResults:p,hadHeaders:l};return r.onpaste&&r.onpaste(S),S}class Pl{constructor(e){b(this,"executors",new Map);b(this,"ctx");this.ctx=e}registerExecutor(e){for(const o of e.handles)this.executors.set(o,e)}dispatch(e){const o=[e];for(;o.length>0;){const i=o.shift(),r=this.executors.get(i.type);if(!r){console.warn(`[ActionPipeline] No executor for action type: ${i.type}`);continue}const s=new Proxy(this.ctx,{get:(l,a)=>a==="dispatch"?d=>this.dispatch(d):l[a],set:(l,a,d)=>(l[a]=d,!0)}),n=r.execute(s,i);n&&n.length>0&&o.unshift(...n)}}}function Al(t){return new Pl(t)}const Ll={handles:["focusCell","blurCell"],execute(t,e){switch(e.type){case"focusCell":return zl(t,e);case"blurCell":return Ol(t)}}};function zl(t,e){const{rowIndex:o,colIndex:i}=e.target,r=t.grid.columns[i];if(!r)return;const s=r.editTrigger??t.grid.editTrigger,n=s==="always",l=t.grid.focusedCell;(!l||l.rowIndex!==o||l.colIndex!==i)&&(t.filterText="",t.searchDebounceTimer&&(clearTimeout(t.searchDebounceTimer),t.searchDebounceTimer=null),t.searchAbortController&&(t.searchAbortController.abort(),t.searchAbortController=null)),t.grid.setFocusedCell(o,i),ee(t,l,{rowIndex:o,colIndex:i});const d=t.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);if(!d)return;if(n){let g=d.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");g||(g=d.querySelector(".wg__editor")),g&&(g.focus({preventScroll:!0}),e.selectText!==!1&&g instanceof HTMLInputElement&&g.type==="text"&&g.select())}else d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0});d.scrollIntoView({block:"nearest",inline:"nearest"}),Ht(t);const c=r.editor,u=c==="select"||c==="combobox"||c==="autocomplete",h=s==="navigate";if(n&&t.grid.shouldShowDropdownOnFocus&&!t.justSelected&&u)return[{type:"openDropdown"}];if(h&&t.grid.shouldShowDropdownOnFocus&&u)return[{type:"startEdit",target:{rowIndex:o,colIndex:i}},{type:"openDropdown"}]}function Ol(t,e){const o=t.grid.focusedCell;t.grid.clearFocusedCell(),ee(t,o,null)}const Hl={handles:["navigate"],execute(t,e){if(e.type==="navigate")return Fl(t,e)}};function Fl(t,e){const o=e.from??t.grid.focusedCell;if(!o)return;const i=ql(t,o,e),r=t.grid.columns[o.colIndex],s=r?String(r.field):"",n=t.grid.editingCell&&t.grid.editingCell.rowIndex===o.rowIndex&&t.grid.editingCell.field===s;return i?i.rowIndex===o.rowIndex&&i.colIndex===o.colIndex?void 0:[{type:"transitionCell",from:o,to:i,selectText:!0}]:n?[{type:"commitEdit"},{type:"renderCell",target:o},{type:"focusCell",target:o,selectText:!1}]:void 0}function ql(t,e,o){const{direction:i,ctrlKey:r}=o,{rowIndex:s,colIndex:n}=e,l=t.grid.columns,a=t.grid.displayItems,d=a.length-1,c=l.length-1,u=a[s],h=t.grid.getEditableColumns(u);switch(i!=="tab"&&i!=="tab-back"&&i!=="enter"&&(t.grid.tabTraversalStartColIndex=null),i){case"up":if(s>0)return{rowIndex:s-1,colIndex:n};break;case"down":if(s<d)return{rowIndex:s+1,colIndex:n};break;case"left":if(n>0)return{rowIndex:s,colIndex:n-1};break;case"right":if(n<c)return{rowIndex:s,colIndex:n+1};break;case"tab":{if(h.length===0){const w=t.grid.findNextEditableCell(s,-1,"forward");if(w)return w;if(n<c)return{rowIndex:s,colIndex:n+1};if(s<d)return{rowIndex:s+1,colIndex:0};break}t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=n);const g=h.findIndex(w=>w.index===n);if(g===-1){const w=h.find(m=>m.index>n);if(w)return{rowIndex:s,colIndex:w.index};const p=t.grid.findNextEditableCell(s,h.length-1,"forward");if(p)return p;break}const f=t.grid.findNextEditableCell(s,g,"forward");if(f)return f;if(t.grid.isEmptyRowIndex(s))return{rowIndex:s,colIndex:h[0].index};break}case"tab-back":{if(h.length===0){const w=t.grid.findNextEditableCell(s,0,"backward");if(w)return w;if(n>0)return{rowIndex:s,colIndex:n-1};if(s>0)return{rowIndex:s-1,colIndex:c};break}t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=n);const g=h.findIndex(w=>w.index===n);if(g===-1){const w=[...h].reverse().find(m=>m.index<n);if(w)return{rowIndex:s,colIndex:w.index};const p=t.grid.findNextEditableCell(s,0,"backward");if(p)return p;break}const f=t.grid.findNextEditableCell(s,g,"backward");if(f)return f;break}case"enter":{const g=t.grid.tabTraversalStartColIndex??n;if(t.grid.tabTraversalStartColIndex=null,s<d)return{rowIndex:s+1,colIndex:g};break}case"home":return r?{rowIndex:0,colIndex:0}:{rowIndex:s,colIndex:0};case"end":return r?{rowIndex:d,colIndex:c}:{rowIndex:s,colIndex:c};case"page-up":return r?{rowIndex:0,colIndex:n}:{rowIndex:Math.max(0,s-10),colIndex:n};case"page-down":return r?{rowIndex:d,colIndex:n}:{rowIndex:Math.min(d,s+10),colIndex:n}}return null}const Vl={handles:["transitionCell"],execute(t,e){if(e.type==="transitionCell")return Nl(t,e)}};function Nl(t,e){const{from:o,to:i,selectText:r}=e,s=[],n=t.grid.editingCell,l=n&&n.rowIndex===o.rowIndex&&t.grid.columns.findIndex(h=>String(h.field)===n.field)===o.colIndex,a=t.grid.columns[o.colIndex],c=((a==null?void 0:a.editTrigger)??t.grid.editTrigger)==="always";if(o.rowIndex!==i.rowIndex||o.colIndex!==i.colIndex)if(l)s.push({type:"commitEdit"});else if(c)s.push({type:"commitEdit",target:o});else{const h={type:"renderCell",target:o};s.push(h)}const u={type:"focusCell",target:i,selectText:r};return s.push(u),s}const Bl={handles:["renderCell"],execute(t,e){e.type==="renderCell"&&Wl(t,e)}};function Wl(t,e){const{target:o,focusEditor:i,cursorPosition:r,initialSearchQuery:s}=e;O(t,o.rowIndex,o.colIndex,{focusEditor:i,cursorPosition:r,initialSearchQuery:s})}const Ul={handles:["openDropdown","closeDropdown","toggleDropdown","dropdownNavigate","dropdownSelect"],execute(t,e){switch(e.type){case"openDropdown":pe(t);break;case"closeDropdown":V(t);break;case"toggleDropdown":t.dropdownOpen?V(t):pe(t);break;case"dropdownNavigate":return Yl(t,e);case"dropdownSelect":return Kl(t,e)}}},rr=10;function Yl(t,e){if(!t.dropdownOpen)return;const o=t.getCurrentEditorOptions();let i=t.highlightedIndex;const r=t.dropdownOptions.length;switch(e.direction){case"up":for(i=t.highlightedIndex-1;i>=0&&de(t.dropdownOptions[i],o);)i--;if(i<0)return;break;case"down":for(i=t.highlightedIndex+1;i<r&&de(t.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"page-up":for(i=Math.max(0,t.highlightedIndex-rr);i<t.highlightedIndex&&de(t.dropdownOptions[i],o);)i++;if(i>=t.highlightedIndex)return;break;case"page-down":for(i=Math.min(r-1,t.highlightedIndex+rr);i>t.highlightedIndex&&de(t.dropdownOptions[i],o);)i--;if(i<=t.highlightedIndex)return;break;case"home":for(i=0;i<r&&de(t.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"end":for(i=r-1;i>=0&&de(t.dropdownOptions[i],o);)i--;if(i<0)return;break}t.highlightedIndex=i,t.dropdownUserInteracted=!0,we(t),Co(t)}function Kl(t,e){var g;if(!t.dropdownOpen||t.highlightedIndex<0)return V(t),e.thenNavigate?[{type:"navigate",direction:e.thenNavigate}]:void 0;const o=t.dropdownOptions[t.highlightedIndex];if(!o)return;const i=t.grid.editingCell,r=t.grid.focusedCell,s=i?{rowIndex:i.rowIndex,field:i.field,colIndex:t.grid.columns.findIndex(f=>String(f.field)===i.field)}:r?{rowIndex:r.rowIndex,field:String((g=t.grid.columns[r.colIndex])==null?void 0:g.field),colIndex:r.colIndex}:null;if(!s)return;const{rowIndex:n,field:l,colIndex:a}=s,d=t.grid.columns[a],c=(d==null?void 0:d.editorOptions)||{};if(de(o,c))return;const u=ze(o,c),h=t.grid.displayItems[n];if(c.onselect&&h&&c.onselect(o,h),t.justSelected=!0,t.isCommittingFromKeyboard=!0,V(t),t.grid.commitEdit(n,l,u,e.commitEmptyRow??!1),e.thenNavigate)return O(t,n,a),t.justSelected=!1,[{type:"navigate",direction:e.thenNavigate,from:{rowIndex:n,colIndex:a}}];e.moveAfterSelect?t.moveFocusAfterCommit(n,l,"down"):O(t,n,a),requestAnimationFrame(()=>{t.justSelected=!1})}const jl={handles:["noop"],execute(){}},Xl={handles:["toggleCheckbox"],execute(t,e){e.type==="toggleCheckbox"&&Gl(t,e)}};function Gl(t,e){const{rowIndex:o,colIndex:i}=e.target,r=t.grid.columns[i];if(!r)return;const s=t.grid.displayItems[o];if(!s||!t.grid.isCellEditable(r,s))return;const n=String(r.field),l=r.editorOptions||{},a=l.trueValue??!0,d=l.falseValue??!1,u=t.grid.getCellRawValue(s,o,n)===a?d:a;t.grid.startEdit(o,n),t.grid.updateDraftValue(o,n,u),O(t,o,i,{focusEditor:!0})}const Ql={handles:["openDatePicker","closeDatePicker","toggleDatePicker"],execute(t,e){switch(e.type){case"openDatePicker":nr(t);break;case"closeDatePicker":ea(t);break;case"toggleDatePicker":ta(t);break}}};function nr(t){const e=t.grid.focusedCell;if(!e)return;const{rowIndex:o,colIndex:i}=e,r=t.grid.columns[i];if(!r||r.editor!=="date")return;const s=String(r.field),n=t.shadow.querySelector(`.wg__cell[data-row="${o}"][data-col="${i}"]`);if(!n)return;const l=n.querySelector(".wg__editor--date"),a=n.querySelector(".wg__date-input");if(!l||!a)return;t.datepicker&&(t.datepicker.close(!0),t.datepicker=null);const d=a.dataset.dateFormat||"YYYY-MM-DD",c=a.dataset.minDate,u=a.dataset.maxDate,h=a.dataset.dateValue||"",g=o,f=i,w=s;t.datepicker=new Mt({dateFormat:d,minDate:c||void 0,maxDate:u||void 0,onSelect:(p,m)=>{Jl(t,g,f,w,p,m)},onClose:()=>{Zl(t,g,f)}}),t.datepicker.open(l,h||null)}function Jl(t,e,o,i,r,s){var c;t.datepicker=null;const n=t.grid.columns[o],l=((c=n==null?void 0:n.editorOptions)==null?void 0:c.outputFormat)??"iso";let a;switch(l){case"date":a=r;break;case"timestamp":a=r.getTime();break;case"iso":default:a=Tt(r);break}t.grid.commitEdit(e,i,a),O(t,e,o);const d=t.shadow.querySelector(`.wg__cell[data-row="${e}"][data-col="${o}"]`);d&&d.focus(),s==="down"?t.dispatch({type:"navigate",direction:"down"}):s==="next"&&t.dispatch({type:"navigate",direction:"tab"})}function Zl(t,e,o){t.datepicker=null;const i=t.grid.columns[o];if(!i)return;if((i.editTrigger??t.grid.editTrigger)==="always")O(t,e,o);else{G(t),t.grid.cancelEdit(),O(t,e,o);const s=t.shadow.querySelector(`.wg__cell[data-row="${e}"][data-col="${o}"]`);s&&s.focus()}}function ea(t){t.datepicker&&(t.datepicker.close(!0),t.datepicker=null)}function ta(t){t.datepicker?t.datepicker.close(!1):nr(t)}const oa={handles:["startEdit","commitEdit","cancelEdit","escapeEdit","deleteCell"],execute(t,e){switch(e.type){case"startEdit":ia(t,e);break;case"commitEdit":ra(t,e.commitEmptyRow,e.target);break;case"cancelEdit":na(t);break;case"escapeEdit":return sa(t,e);case"deleteCell":la(t,e);break}}};function ia(t,e){const{rowIndex:o,colIndex:i}=e.target;re(t,o,i,{initialSearchQuery:e.initialSearchQuery,cursorPosition:e.cursorPosition})}async function ra(t,e,o){const i=t.grid.editingCell;let r,s,n;if(o){r=o.rowIndex,s=o.colIndex;const c=t.grid.columns[s];if(!c)return;n=String(c.field)}else if(i){if(r=i.rowIndex,n=i.field,s=t.grid.columns.findIndex(c=>String(c.field)===n),s<0)return}else return;const l=t.shadow.querySelector(`.wg__cell[data-row="${r}"][data-col="${s}"]`);if(!l)return;let a=l.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(a||(a=l.querySelector(".wg__editor")),!a)return;let d;if(t.grid.columns[s],a instanceof HTMLInputElement)if(a.type==="checkbox"){const c=t.grid.displayItems[r];d=t.grid.getCellRawValue(c,r,n)}else if(a.classList.contains("wg__date-input"))d=a.dataset.dateValue||a.value;else if(a.classList.contains("wg__editor--number")){const c=a.value.trim();if(c==="")d=null;else{const u=parseFloat(c);d=isNaN(u)?c:u}}else d=a.value;else a instanceof HTMLSelectElement?d=a.value:d=a.dataset.value||"";t.dropdownOpen&&V(t),G(t),await t.grid.commitEdit(r,n,d,e),O(t,r,s)}function na(t){const e=t.grid.editingCell;if(!e)return;const{rowIndex:o,field:i}=e,r=t.grid.columns.findIndex(n=>String(n.field)===i),s=t.grid.columns[r];t.dropdownOpen&&V(t),G(t),(s==null?void 0:s.editor)==="checkbox"&&t.grid.discardCellDraft(o,i),t.grid.cancelEdit(),r>=0&&O(t,o,r)}function sa(t,e){const o=t.grid.editingCell,i=t.grid.focusedCell;if(e.phase==="dropdown"){const r=o||i;if(!r)return;const s=o?t.grid.columns.findIndex(a=>String(a.field)===o.field):(i==null?void 0:i.colIndex)??-1,n=t.grid.columns[s],l=n==null?void 0:n.editor;if(l==="select"&&t.filterText){t.filterText="",V(t),t.dispatch({type:"openDropdown"});return}if(l==="autocomplete"||l==="combobox"){const a=t.shadow.querySelector(`.wg__cell[data-row="${r.rowIndex}"][data-col="${s}"]`),d=a==null?void 0:a.querySelector(".wg__combobox-input, .wg__autocomplete-input"),c=t.grid.displayItems[r.rowIndex],u=n==null?void 0:n.field,h=c&&u?c[u]:void 0,g=(n==null?void 0:n.editorOptions)||{},f=g.initialOptions||g.options||[],w=ut(h,f,g),p=(d==null?void 0:d.value)??"";if(d&&p!==w){t.filterText="",d.value=w,d.focus(),d.select(),V(t),t.dispatch({type:"openDropdown"});return}}V(t),o&&(G(t),l==="checkbox"&&t.grid.discardCellDraft(r.rowIndex,o.field),t.grid.cancelEdit(),O(t,r.rowIndex,s),ft(t,r.rowIndex,s));return}if(o){const{rowIndex:r,field:s}=o,n=t.grid.columns.findIndex(a=>String(a.field)===s),l=t.grid.columns[n];t.dropdownOpen&&V(t),t.datepicker&&(t.datepicker.close(!0),t.datepicker=null),G(t),(l==null?void 0:l.editor)==="checkbox"&&t.grid.discardCellDraft(r,s),t.grid.cancelEdit(),n>=0&&(O(t,r,n),ft(t,r,n))}else if(i){const{rowIndex:r,colIndex:s}=i;t.grid.clearFocusedCell(),O(t,r,s)}}function la(t,e){const o=e.target||t.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:r}=o,s=t.grid.columns[r];if(!s)return;const n=t.grid.displayItems[i];if(!t.grid.isCellEditable(s,n))return;const l=String(s.field);t.grid.commitEdit(i,l,null),O(t,i,r)}const aa={handles:["selectRow","selectColumn","clearSelection"],execute(t,e){switch(e.type){case"selectRow":da(t,e);break;case"selectColumn":ca(t,e);break;case"clearSelection":ga(t);break}}};function da(t,e){const{rowIndex:o,addToSelection:i,extendSelection:r}=e;t.grid.selectedColumns.length>0&&t.grid.clearColumnSelection(),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q(),Re(),Io(t)),r&&t.grid.selectedRows.length>0?t.grid.selectRow(o,"range"):i?t.grid.selectRow(o,"toggle"):t.grid.selectRow(o,"replace"),sr(t)}function ca(t,e){const{colIndex:o,addToSelection:i,extendSelection:r}=e;t.grid.selectedRows.length>0&&t.grid.clearSelection(),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q(),Re(),Io(t)),r&&t.grid.selectedColumns.length>0?t.grid.selectColumn(o,"range"):i?t.grid.selectColumn(o,"toggle"):t.grid.selectColumn(o,"replace"),lr(t)}function ga(t){if(console.log("[clearSelection] rows:",t.grid.selectedRows.length,"cols:",t.grid.selectedColumns.length,"cellRange:",!!t.grid.selectedCellRange),t.grid.selectedRows.length>0&&(console.log("[clearSelection] clearing rows"),t.grid.clearSelection_noRender(),it(),sr(t)),t.grid.selectedColumns.length>0){console.log("[clearSelection] clearing columns, removing visual classes"),t.grid.clearColumnSelection_noRender(),rt(),lr(t),console.log("[clearSelection] after clear, selectedColumns:",t.grid.selectedColumns.length);const e=t.shadow.querySelectorAll(".wg__header--selected");console.log("[clearSelection] remaining header--selected elements:",e.length)}t.grid.selectedCellRange&&(t.grid.clearCellSelection_noRender(),Q(),Re(),Io(t))}function sr(t){t.shadow.querySelectorAll(".wg__row--selected").forEach(o=>o.classList.remove("wg__row--selected"));for(const o of t.grid.selectedRows){const i=t.shadow.querySelector(`tr[data-row="${o}"]`);i&&i.classList.add("wg__row--selected")}}function lr(t){t.shadow.querySelectorAll(".wg__cell--column-selected").forEach(i=>i.classList.remove("wg__cell--column-selected")),t.shadow.querySelectorAll(".wg__header--selected").forEach(i=>i.classList.remove("wg__header--selected"));for(const i of t.grid.selectedColumns){t.shadow.querySelectorAll(`.wg__cell[data-col="${i}"]`).forEach(n=>n.classList.add("wg__cell--column-selected"));const s=t.shadow.querySelector(`.wg__header[data-col="${i}"]`);s&&s.classList.add("wg__header--selected")}}function Io(t){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(u=>u.classList.remove("wg__cell--in-range"));const o=t.grid.selectedCellRange;if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=o,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);for(let u=l;u<=a;u++)for(let h=d;h<=c;h++){const g=t.shadow.querySelector(`.wg__cell[data-row="${u}"][data-col="${h}"]`);g&&g.classList.add("wg__cell--in-range")}}const ua={handles:["copy","paste"],execute(t,e){switch(e.type){case"copy":ha(t);break}}};async function ha(t){var o,i;let e="";if(t.grid.selectedCellRange){const r=t.grid.selectedCellRange,{startRowIndex:s,endRowIndex:n,startColIndex:l,endColIndex:a}=r,d=Math.min(s,n),c=Math.max(s,n),u=Math.min(l,a),h=Math.max(l,a),g=[];for(let f=d;f<=c;f++){const w=[];for(let p=u;p<=h;p++){const m=t.grid.displayItems[f],_=(o=t.grid.visualColumns[p])==null?void 0:o.column;if(m&&_){const y=m[String(_.field)];w.push(Ut(y))}else w.push("")}g.push(w.join(" "))}e=g.join(`
658
+ `?(o.push(i),o.some(a=>a!=="")&&e.push(o),o=[],i="",n==="\r"&&s++):n!=="\r"&&(i+=n)}return(i!==""||o.length>0)&&(o.push(i),o.some(s=>s!=="")&&e.push(o)),e}function Ml(t,e){const o=new Map,i=new Map;e.forEach((a,d)=>{var h;if(a.isHidden)return;const c=String(a.field),u=((h=a.title)==null?void 0:h.toLowerCase().trim())||"";u&&o.set(u,{field:c,colIndex:d}),i.set(c.toLowerCase(),{field:c,colIndex:d})});const r=[];let s=0;for(const a of t){const d=a.trim().toLowerCase();if(!d)continue;const c=o.get(d)||i.get(d);c&&(s++,r.push({pastedHeader:a,gridField:c.field,colIndex:c.colIndex}))}const n=t.filter(a=>a.trim()!=="").length,l=Math.max(2,Math.floor(n*.5));return s>=l?r:null}async function $l(t,e,o,i){var v;const r=t.grid,s=Tl(e);if(s.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:!1};const n=Ml(s[0],r.columns),l=n!==null,a=l?s.slice(1):s;if(a.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:l};const d=r.visualColumns,c=r.isEmptyRowIndex(o),u=r.items.length;let h;if(c)h=a.length;else{const x=o+a.length-1;h=Math.max(0,x-u+1)}const g={rawText:e,parsedRows:s,hasHeaders:l,headerMapping:n,targetRowIndex:o,targetColIndex:i,newRowsCount:h,cancel:!1,skipCells:new Set};if(r.onbeforepaste&&(r.onbeforepaste(g),g.cancel))return{totalCells:a.reduce((x,k)=>x+k.length,0),successfulCells:0,failedCells:0,skippedCells:a.reduce((x,k)=>x+k.length,0),newRowsCreated:0,cellResults:[],hadHeaders:l};let f=0,w=u;if(h>0){const x=[];for(let k=0;k<h;k++){const E=c?k:u+k-o,I=a[E],R={};l&&n?I==null||I.forEach((D,M)=>{const A=n[M];A&&(R[A.gridField]=D)}):I==null||I.forEach((D,M)=>{const A=i+M;if(A<d.length){const F=String(d[A].column.field);R[F]=D}});let P;r.createRowCallback?P=r.createRowCallback(R,u+k):P=R,x.push(P),f++}c&&r.newRowPosition==="top"?(r.items=[...x,...r.items],w=0):(r.items=[...r.items,...x],w=u)}const p=[],m=r.pasteMode;for(let x=0;x<a.length;x++){const k=a[x],E=c?w+x:o+x,I=c?r.newRowPosition==="top"?1+x:r.items.length-a.length+x:o+x,R=E;for(let P=0;P<k.length;P++){const D=k[P];let M,A;if(l&&n){const K=n[P];if(!K)continue;M=K.gridField,A=K.colIndex}else{if(A=i+P,A>=d.length){p.push({rowIndex:I,field:"",value:D,isValid:!1,wasSkipped:!0,skipReason:"out-of-bounds"});continue}M=String(d[A].column.field)}const F=`${x}-${P}`;if(g.skipCells.has(F)){p.push({rowIndex:I,field:M,value:D,isValid:!0,wasSkipped:!0,skipReason:"user-canceled"});continue}const T=r.columns.find(K=>String(K.field)===M);if(!T)continue;const $=r.displayItems[I];if(!r.isCellEditable(T,$)){if(m==="editable-only"){p.push({rowIndex:I,field:M,value:D,isValid:!1,wasSkipped:!0,skipReason:"non-editable"});continue}else if(m==="skip-non-editable"){p.push({rowIndex:I,field:M,value:D,isValid:!0,wasSkipped:!0,skipReason:"non-editable"});continue}}const U=c?r.items[R]:r.displayItems[R];if(U&&r.isRowLocked(U)){p.push({rowIndex:I,field:M,value:D,isValid:!0,wasSkipped:!0,skipReason:"locked"});continue}let ge=D;if(T.beforePasteCallback&&U&&(ge=T.beforePasteCallback(D,U)),c){const K=r.items[R];if(K&&r.shouldValidateOnPaste&&T.beforeCommitCallback){const _e={value:ge,oldValue:void 0,row:K,rowIndex:R,field:M},J=await Promise.resolve(T.beforeCommitCallback(_e)),Me=J===!0||J===void 0||typeof J=="object"&&J!==null&&J.valid!==!1,te=typeof J=="object"&&J!==null?J.error||J.message:typeof J=="string"?J:void 0;Me||(r.addInvalidCell(I,M,te||"Invalid value"),(v=r.onvalidationerror)==null||v.call(r,{row:K,rowIndex:I,field:M,error:te||"Invalid value"})),p.push({rowIndex:I,field:M,value:ge,isValid:Me,validationError:Me?void 0:te,wasSkipped:!1})}else p.push({rowIndex:I,field:M,value:ge,isValid:!0,wasSkipped:!1})}else if(r.shouldValidateOnPaste){await r.commitEdit(I,M,ge);const K=r.displayItems[I]!==void 0?r.getStableRowKey(r.displayItems[I],I):null,_e=K!==null?r.invalidCells.find(J=>J.rowKey===K&&J.field===M):void 0;p.push({rowIndex:I,field:M,value:ge,isValid:!_e,validationError:_e==null?void 0:_e.error,wasSkipped:!1})}else{const K=r.items[R];K&&(K[M]=ge),p.push({rowIndex:I,field:M,value:ge,isValid:!0,wasSkipped:!1})}}}const _=p.filter(x=>!x.wasSkipped&&x.isValid).length,y=p.filter(x=>!x.wasSkipped&&!x.isValid).length,C=p.filter(x=>x.wasSkipped).length,S={totalCells:p.length,successfulCells:_,failedCells:y,skippedCells:C,newRowsCreated:f,cellResults:p,hadHeaders:l};return r.onpaste&&r.onpaste(S),S}class Pl{constructor(e){b(this,"executors",new Map);b(this,"ctx");this.ctx=e}registerExecutor(e){for(const o of e.handles)this.executors.set(o,e)}dispatch(e){const o=[e];for(;o.length>0;){const i=o.shift(),r=this.executors.get(i.type);if(!r){console.warn(`[ActionPipeline] No executor for action type: ${i.type}`);continue}const s=new Proxy(this.ctx,{get:(l,a)=>a==="dispatch"?d=>this.dispatch(d):l[a],set:(l,a,d)=>(l[a]=d,!0)}),n=r.execute(s,i);n&&n.length>0&&o.unshift(...n)}}}function Al(t){return new Pl(t)}const Ll={handles:["focusCell","blurCell"],execute(t,e){switch(e.type){case"focusCell":return zl(t,e);case"blurCell":return Ol(t)}}};function zl(t,e){const{rowIndex:o,colIndex:i}=e.target,r=t.grid.columns[i];if(!r)return;const s=r.editTrigger??t.grid.editTrigger,n=s==="always",l=t.grid.focusedCell;(!l||l.rowIndex!==o||l.colIndex!==i)&&(t.filterText="",t.searchDebounceTimer&&(clearTimeout(t.searchDebounceTimer),t.searchDebounceTimer=null),t.searchAbortController&&(t.searchAbortController.abort(),t.searchAbortController=null)),t.grid.setFocusedCell(o,i),ee(t,l,{rowIndex:o,colIndex:i});const d=t.grid.focusedRowIndex;if(d!==o){if(t.grid.setFocusedRow(o),d!==null){const w=t.shadow.querySelector(`tr[data-row-index="${d}"]`);w==null||w.classList.remove("wg__row--focused")}const f=t.shadow.querySelector(`tr[data-row-index="${o}"]`);f==null||f.classList.add("wg__row--focused")}const c=t.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);if(!c)return;if(n){let f=c.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");f||(f=c.querySelector(".wg__editor")),f&&(f.focus({preventScroll:!0}),e.selectText!==!1&&f instanceof HTMLInputElement&&f.type==="text"&&f.select())}else c.hasAttribute("tabindex")||c.setAttribute("tabindex","-1"),c.focus({preventScroll:!0});c.scrollIntoView({block:"nearest",inline:"nearest"}),Ht(t);const u=r.editor,h=u==="select"||u==="combobox"||u==="autocomplete",g=s==="navigate";if(n&&t.grid.shouldShowDropdownOnFocus&&!t.justSelected&&h)return[{type:"openDropdown"}];if(g&&t.grid.shouldShowDropdownOnFocus&&h)return[{type:"startEdit",target:{rowIndex:o,colIndex:i}},{type:"openDropdown"}]}function Ol(t,e){const o=t.grid.focusedCell;t.grid.clearFocusedCell(),ee(t,o,null)}const Hl={handles:["navigate"],execute(t,e){if(e.type==="navigate")return Fl(t,e)}};function Fl(t,e){const o=e.from??t.grid.focusedCell;if(!o)return;const i=ql(t,o,e),r=t.grid.columns[o.colIndex],s=r?String(r.field):"",n=t.grid.editingCell&&t.grid.editingCell.rowIndex===o.rowIndex&&t.grid.editingCell.field===s;return i?i.rowIndex===o.rowIndex&&i.colIndex===o.colIndex?void 0:[{type:"transitionCell",from:o,to:i,selectText:!0}]:n?[{type:"commitEdit"},{type:"renderCell",target:o},{type:"focusCell",target:o,selectText:!1}]:void 0}function ql(t,e,o){const{direction:i,ctrlKey:r}=o,{rowIndex:s,colIndex:n}=e,l=t.grid.columns,a=t.grid.displayItems,d=a.length-1,c=l.length-1,u=a[s],h=t.grid.getEditableColumns(u);switch(i!=="tab"&&i!=="tab-back"&&i!=="enter"&&(t.grid.tabTraversalStartColIndex=null),i){case"up":if(s>0)return{rowIndex:s-1,colIndex:n};break;case"down":if(s<d)return{rowIndex:s+1,colIndex:n};break;case"left":if(n>0)return{rowIndex:s,colIndex:n-1};break;case"right":if(n<c)return{rowIndex:s,colIndex:n+1};break;case"tab":{if(h.length===0){const w=t.grid.findNextEditableCell(s,-1,"forward");if(w)return w;if(n<c)return{rowIndex:s,colIndex:n+1};if(s<d)return{rowIndex:s+1,colIndex:0};break}t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=n);const g=h.findIndex(w=>w.index===n);if(g===-1){const w=h.find(m=>m.index>n);if(w)return{rowIndex:s,colIndex:w.index};const p=t.grid.findNextEditableCell(s,h.length-1,"forward");if(p)return p;break}const f=t.grid.findNextEditableCell(s,g,"forward");if(f)return f;if(t.grid.isEmptyRowIndex(s))return{rowIndex:s,colIndex:h[0].index};break}case"tab-back":{if(h.length===0){const w=t.grid.findNextEditableCell(s,0,"backward");if(w)return w;if(n>0)return{rowIndex:s,colIndex:n-1};if(s>0)return{rowIndex:s-1,colIndex:c};break}t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=n);const g=h.findIndex(w=>w.index===n);if(g===-1){const w=[...h].reverse().find(m=>m.index<n);if(w)return{rowIndex:s,colIndex:w.index};const p=t.grid.findNextEditableCell(s,0,"backward");if(p)return p;break}const f=t.grid.findNextEditableCell(s,g,"backward");if(f)return f;break}case"enter":{const g=t.grid.tabTraversalStartColIndex??n;if(t.grid.tabTraversalStartColIndex=null,s<d)return{rowIndex:s+1,colIndex:g};break}case"home":return r?{rowIndex:0,colIndex:0}:{rowIndex:s,colIndex:0};case"end":return r?{rowIndex:d,colIndex:c}:{rowIndex:s,colIndex:c};case"page-up":return r?{rowIndex:0,colIndex:n}:{rowIndex:Math.max(0,s-10),colIndex:n};case"page-down":return r?{rowIndex:d,colIndex:n}:{rowIndex:Math.min(d,s+10),colIndex:n}}return null}const Vl={handles:["transitionCell"],execute(t,e){if(e.type==="transitionCell")return Nl(t,e)}};function Nl(t,e){const{from:o,to:i,selectText:r}=e,s=[],n=t.grid.editingCell,l=n&&n.rowIndex===o.rowIndex&&t.grid.columns.findIndex(h=>String(h.field)===n.field)===o.colIndex,a=t.grid.columns[o.colIndex],c=((a==null?void 0:a.editTrigger)??t.grid.editTrigger)==="always";if(o.rowIndex!==i.rowIndex||o.colIndex!==i.colIndex)if(l)s.push({type:"commitEdit"});else if(c)s.push({type:"commitEdit",target:o});else{const h={type:"renderCell",target:o};s.push(h)}const u={type:"focusCell",target:i,selectText:r};return s.push(u),s}const Bl={handles:["renderCell"],execute(t,e){e.type==="renderCell"&&Wl(t,e)}};function Wl(t,e){const{target:o,focusEditor:i,cursorPosition:r,initialSearchQuery:s}=e;O(t,o.rowIndex,o.colIndex,{focusEditor:i,cursorPosition:r,initialSearchQuery:s})}const Ul={handles:["openDropdown","closeDropdown","toggleDropdown","dropdownNavigate","dropdownSelect"],execute(t,e){switch(e.type){case"openDropdown":pe(t);break;case"closeDropdown":V(t);break;case"toggleDropdown":t.dropdownOpen?V(t):pe(t);break;case"dropdownNavigate":return Yl(t,e);case"dropdownSelect":return Kl(t,e)}}},rr=10;function Yl(t,e){if(!t.dropdownOpen)return;const o=t.getCurrentEditorOptions();let i=t.highlightedIndex;const r=t.dropdownOptions.length;switch(e.direction){case"up":for(i=t.highlightedIndex-1;i>=0&&de(t.dropdownOptions[i],o);)i--;if(i<0)return;break;case"down":for(i=t.highlightedIndex+1;i<r&&de(t.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"page-up":for(i=Math.max(0,t.highlightedIndex-rr);i<t.highlightedIndex&&de(t.dropdownOptions[i],o);)i++;if(i>=t.highlightedIndex)return;break;case"page-down":for(i=Math.min(r-1,t.highlightedIndex+rr);i>t.highlightedIndex&&de(t.dropdownOptions[i],o);)i--;if(i<=t.highlightedIndex)return;break;case"home":for(i=0;i<r&&de(t.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"end":for(i=r-1;i>=0&&de(t.dropdownOptions[i],o);)i--;if(i<0)return;break}t.highlightedIndex=i,t.dropdownUserInteracted=!0,we(t),Co(t)}function Kl(t,e){var g;if(!t.dropdownOpen||t.highlightedIndex<0)return V(t),e.thenNavigate?[{type:"navigate",direction:e.thenNavigate}]:void 0;const o=t.dropdownOptions[t.highlightedIndex];if(!o)return;const i=t.grid.editingCell,r=t.grid.focusedCell,s=i?{rowIndex:i.rowIndex,field:i.field,colIndex:t.grid.columns.findIndex(f=>String(f.field)===i.field)}:r?{rowIndex:r.rowIndex,field:String((g=t.grid.columns[r.colIndex])==null?void 0:g.field),colIndex:r.colIndex}:null;if(!s)return;const{rowIndex:n,field:l,colIndex:a}=s,d=t.grid.columns[a],c=(d==null?void 0:d.editorOptions)||{};if(de(o,c))return;const u=ze(o,c),h=t.grid.displayItems[n];if(c.onselect&&h&&c.onselect(o,h),t.justSelected=!0,t.isCommittingFromKeyboard=!0,V(t),t.grid.commitEdit(n,l,u,e.commitEmptyRow??!1),e.thenNavigate)return O(t,n,a),t.justSelected=!1,[{type:"navigate",direction:e.thenNavigate,from:{rowIndex:n,colIndex:a}}];e.moveAfterSelect?t.moveFocusAfterCommit(n,l,"down"):O(t,n,a),requestAnimationFrame(()=>{t.justSelected=!1})}const jl={handles:["noop"],execute(){}},Xl={handles:["toggleCheckbox"],execute(t,e){e.type==="toggleCheckbox"&&Gl(t,e)}};function Gl(t,e){const{rowIndex:o,colIndex:i}=e.target,r=t.grid.columns[i];if(!r)return;const s=t.grid.displayItems[o];if(!s||!t.grid.isCellEditable(r,s))return;const n=String(r.field),l=r.editorOptions||{},a=l.trueValue??!0,d=l.falseValue??!1,u=t.grid.getCellRawValue(s,o,n)===a?d:a;t.grid.startEdit(o,n),t.grid.updateDraftValue(o,n,u),O(t,o,i,{focusEditor:!0})}const Ql={handles:["openDatePicker","closeDatePicker","toggleDatePicker"],execute(t,e){switch(e.type){case"openDatePicker":nr(t);break;case"closeDatePicker":ea(t);break;case"toggleDatePicker":ta(t);break}}};function nr(t){const e=t.grid.focusedCell;if(!e)return;const{rowIndex:o,colIndex:i}=e,r=t.grid.columns[i];if(!r||r.editor!=="date")return;const s=String(r.field),n=t.shadow.querySelector(`.wg__cell[data-row="${o}"][data-col="${i}"]`);if(!n)return;const l=n.querySelector(".wg__editor--date"),a=n.querySelector(".wg__date-input");if(!l||!a)return;t.datepicker&&(t.datepicker.close(!0),t.datepicker=null);const d=a.dataset.dateFormat||"YYYY-MM-DD",c=a.dataset.minDate,u=a.dataset.maxDate,h=a.dataset.dateValue||"",g=o,f=i,w=s;t.datepicker=new Mt({dateFormat:d,minDate:c||void 0,maxDate:u||void 0,onSelect:(p,m)=>{Jl(t,g,f,w,p,m)},onClose:()=>{Zl(t,g,f)}}),t.datepicker.open(l,h||null)}function Jl(t,e,o,i,r,s){var c;t.datepicker=null;const n=t.grid.columns[o],l=((c=n==null?void 0:n.editorOptions)==null?void 0:c.outputFormat)??"iso";let a;switch(l){case"date":a=r;break;case"timestamp":a=r.getTime();break;case"iso":default:a=Tt(r);break}t.grid.commitEdit(e,i,a),O(t,e,o);const d=t.shadow.querySelector(`.wg__cell[data-row="${e}"][data-col="${o}"]`);d&&d.focus(),s==="down"?t.dispatch({type:"navigate",direction:"down"}):s==="next"&&t.dispatch({type:"navigate",direction:"tab"})}function Zl(t,e,o){t.datepicker=null;const i=t.grid.columns[o];if(!i)return;if((i.editTrigger??t.grid.editTrigger)==="always")O(t,e,o);else{G(t),t.grid.cancelEdit(),O(t,e,o);const s=t.shadow.querySelector(`.wg__cell[data-row="${e}"][data-col="${o}"]`);s&&s.focus()}}function ea(t){t.datepicker&&(t.datepicker.close(!0),t.datepicker=null)}function ta(t){t.datepicker?t.datepicker.close(!1):nr(t)}const oa={handles:["startEdit","commitEdit","cancelEdit","escapeEdit","deleteCell"],execute(t,e){switch(e.type){case"startEdit":ia(t,e);break;case"commitEdit":ra(t,e.commitEmptyRow,e.target);break;case"cancelEdit":na(t);break;case"escapeEdit":return sa(t,e);case"deleteCell":la(t,e);break}}};function ia(t,e){const{rowIndex:o,colIndex:i}=e.target;re(t,o,i,{initialSearchQuery:e.initialSearchQuery,cursorPosition:e.cursorPosition})}async function ra(t,e,o){const i=t.grid.editingCell;let r,s,n;if(o){r=o.rowIndex,s=o.colIndex;const c=t.grid.columns[s];if(!c)return;n=String(c.field)}else if(i){if(r=i.rowIndex,n=i.field,s=t.grid.columns.findIndex(c=>String(c.field)===n),s<0)return}else return;const l=t.shadow.querySelector(`.wg__cell[data-row="${r}"][data-col="${s}"]`);if(!l)return;let a=l.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(a||(a=l.querySelector(".wg__editor")),!a)return;let d;if(t.grid.columns[s],a instanceof HTMLInputElement)if(a.type==="checkbox"){const c=t.grid.displayItems[r];d=t.grid.getCellRawValue(c,r,n)}else if(a.classList.contains("wg__date-input"))d=a.dataset.dateValue||a.value;else if(a.classList.contains("wg__editor--number")){const c=a.value.trim();if(c==="")d=null;else{const u=parseFloat(c);d=isNaN(u)?c:u}}else d=a.value;else a instanceof HTMLSelectElement?d=a.value:d=a.dataset.value||"";t.dropdownOpen&&V(t),G(t),await t.grid.commitEdit(r,n,d,e),O(t,r,s)}function na(t){const e=t.grid.editingCell;if(!e)return;const{rowIndex:o,field:i}=e,r=t.grid.columns.findIndex(n=>String(n.field)===i),s=t.grid.columns[r];t.dropdownOpen&&V(t),G(t),(s==null?void 0:s.editor)==="checkbox"&&t.grid.discardCellDraft(o,i),t.grid.cancelEdit(),r>=0&&O(t,o,r)}function sa(t,e){const o=t.grid.editingCell,i=t.grid.focusedCell;if(e.phase==="dropdown"){const r=o||i;if(!r)return;const s=o?t.grid.columns.findIndex(a=>String(a.field)===o.field):(i==null?void 0:i.colIndex)??-1,n=t.grid.columns[s],l=n==null?void 0:n.editor;if(l==="select"&&t.filterText){t.filterText="",V(t),t.dispatch({type:"openDropdown"});return}if(l==="autocomplete"||l==="combobox"){const a=t.shadow.querySelector(`.wg__cell[data-row="${r.rowIndex}"][data-col="${s}"]`),d=a==null?void 0:a.querySelector(".wg__combobox-input, .wg__autocomplete-input"),c=t.grid.displayItems[r.rowIndex],u=n==null?void 0:n.field,h=c&&u?c[u]:void 0,g=(n==null?void 0:n.editorOptions)||{},f=g.initialOptions||g.options||[],w=ut(h,f,g),p=(d==null?void 0:d.value)??"";if(d&&p!==w){t.filterText="",d.value=w,d.focus(),d.select(),V(t),t.dispatch({type:"openDropdown"});return}}V(t),o&&(G(t),l==="checkbox"&&t.grid.discardCellDraft(r.rowIndex,o.field),t.grid.cancelEdit(),O(t,r.rowIndex,s),ft(t,r.rowIndex,s));return}if(o){const{rowIndex:r,field:s}=o,n=t.grid.columns.findIndex(a=>String(a.field)===s),l=t.grid.columns[n];t.dropdownOpen&&V(t),t.datepicker&&(t.datepicker.close(!0),t.datepicker=null),G(t),(l==null?void 0:l.editor)==="checkbox"&&t.grid.discardCellDraft(r,s),t.grid.cancelEdit(),n>=0&&(O(t,r,n),ft(t,r,n))}else if(i){const{rowIndex:r,colIndex:s}=i;t.grid.clearFocusedCell(),O(t,r,s)}}function la(t,e){const o=e.target||t.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:r}=o,s=t.grid.columns[r];if(!s)return;const n=t.grid.displayItems[i];if(!t.grid.isCellEditable(s,n))return;const l=String(s.field);t.grid.commitEdit(i,l,null),O(t,i,r)}const aa={handles:["selectRow","selectColumn","clearSelection"],execute(t,e){switch(e.type){case"selectRow":da(t,e);break;case"selectColumn":ca(t,e);break;case"clearSelection":ga(t);break}}};function da(t,e){const{rowIndex:o,addToSelection:i,extendSelection:r}=e;t.grid.selectedColumns.length>0&&t.grid.clearColumnSelection(),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q(),Re(),Io(t)),r&&t.grid.selectedRows.length>0?t.grid.selectRow(o,"range"):i?t.grid.selectRow(o,"toggle"):t.grid.selectRow(o,"replace"),sr(t)}function ca(t,e){const{colIndex:o,addToSelection:i,extendSelection:r}=e;t.grid.selectedRows.length>0&&t.grid.clearSelection(),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q(),Re(),Io(t)),r&&t.grid.selectedColumns.length>0?t.grid.selectColumn(o,"range"):i?t.grid.selectColumn(o,"toggle"):t.grid.selectColumn(o,"replace"),lr(t)}function ga(t){if(console.log("[clearSelection] rows:",t.grid.selectedRows.length,"cols:",t.grid.selectedColumns.length,"cellRange:",!!t.grid.selectedCellRange),t.grid.selectedRows.length>0&&(console.log("[clearSelection] clearing rows"),t.grid.clearSelection_noRender(),it(),sr(t)),t.grid.selectedColumns.length>0){console.log("[clearSelection] clearing columns, removing visual classes"),t.grid.clearColumnSelection_noRender(),rt(),lr(t),console.log("[clearSelection] after clear, selectedColumns:",t.grid.selectedColumns.length);const e=t.shadow.querySelectorAll(".wg__header--selected");console.log("[clearSelection] remaining header--selected elements:",e.length)}t.grid.selectedCellRange&&(t.grid.clearCellSelection_noRender(),Q(),Re(),Io(t))}function sr(t){t.shadow.querySelectorAll(".wg__row--selected").forEach(o=>o.classList.remove("wg__row--selected"));for(const o of t.grid.selectedRows){const i=t.shadow.querySelector(`tr[data-row="${o}"]`);i&&i.classList.add("wg__row--selected")}}function lr(t){t.shadow.querySelectorAll(".wg__cell--column-selected").forEach(i=>i.classList.remove("wg__cell--column-selected")),t.shadow.querySelectorAll(".wg__header--selected").forEach(i=>i.classList.remove("wg__header--selected"));for(const i of t.grid.selectedColumns){t.shadow.querySelectorAll(`.wg__cell[data-col="${i}"]`).forEach(n=>n.classList.add("wg__cell--column-selected"));const s=t.shadow.querySelector(`.wg__header[data-col="${i}"]`);s&&s.classList.add("wg__header--selected")}}function Io(t){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(u=>u.classList.remove("wg__cell--in-range"));const o=t.grid.selectedCellRange;if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=o,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);for(let u=l;u<=a;u++)for(let h=d;h<=c;h++){const g=t.shadow.querySelector(`.wg__cell[data-row="${u}"][data-col="${h}"]`);g&&g.classList.add("wg__cell--in-range")}}const ua={handles:["copy","paste"],execute(t,e){switch(e.type){case"copy":ha(t);break}}};async function ha(t){var o,i;let e="";if(t.grid.selectedCellRange){const r=t.grid.selectedCellRange,{startRowIndex:s,endRowIndex:n,startColIndex:l,endColIndex:a}=r,d=Math.min(s,n),c=Math.max(s,n),u=Math.min(l,a),h=Math.max(l,a),g=[];for(let f=d;f<=c;f++){const w=[];for(let p=u;p<=h;p++){const m=t.grid.displayItems[f],_=(o=t.grid.visualColumns[p])==null?void 0:o.column;if(m&&_){const y=m[String(_.field)];w.push(Ut(y))}else w.push("")}g.push(w.join(" "))}e=g.join(`
659
659
  `)}else if(t.grid.selectedColumns.length>0){const r=[],s=t.grid.displayItems;for(let n=0;n<s.length;n++){const l=[];for(const a of t.grid.selectedColumns){const d=s[n],c=(i=t.grid.visualColumns[a])==null?void 0:i.column;if(d&&c){const u=d[String(c.field)];l.push(Ut(u))}else l.push("")}r.push(l.join(" "))}e=r.join(`
660
660
  `)}else if(t.grid.selectedRows.length>0){const r=[],s=t.grid.visualColumns;for(const n of t.grid.selectedRows){const l=t.grid.displayItems[n];if(l){const a=[];for(const d of s){const c=l[String(d.column.field)];a.push(Ut(c))}r.push(a.join(" "))}}e=r.join(`
661
- `)}else if(t.grid.focusedCell){const{rowIndex:r,colIndex:s}=t.grid.focusedCell,n=t.grid.displayItems[r],l=t.grid.columns[s];if(n&&l){const a=n[String(l.field)];e=Ut(a)}}if(e)try{await navigator.clipboard.writeText(e)}catch{console.warn("Failed to copy to clipboard")}}function Ut(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}const fa={handles:["openContextMenu","closeContextMenu"],execute(t,e){switch(e.type){case"openContextMenu":wa(t,e);break;case"closeContextMenu":pa(t);break}}};function wa(t,e){e.target&&t.dispatch({type:"focusCell",target:e.target,selectText:!1})}function pa(t){t.contextMenuElement&&(ce(t.contextMenuElement),t.contextMenuElement=null),t.headerContextMenuElement&&(ce(t.headerContextMenuElement),t.headerContextMenuElement=null)}const ma={handles:["startFillDrag","updateFillDrag","completeFillDrag"],execute(t,e){switch(e.type){}}},ba={handles:["startCellSelection"],execute(t,e){if(e.type==="startCellSelection")return _a(t,e)}};function _a(t,e){Vi(t,e.rowIndex,e.colIndex,{clientX:e.clientX,clientY:e.clientY,shiftKey:e.shiftKey})}const va={handles:["resetState"],execute(t,e){if(e.type==="resetState")return ya(t,e)}};function ya(t,e){const o=e.edit!==!1,i=e.selections!==!1,r=e.overlays!==!1,s=e.focus===!0,n=[];return r&&((t.contextMenuElement||t.headerContextMenuElement)&&n.push({type:"closeContextMenu"}),t.datepicker&&n.push({type:"closeDatePicker"})),o&&t.grid.editingCell&&n.push({type:"cancelEdit"}),i&&(t.grid.selectedRows.length>0||t.grid.selectedColumns.length>0||t.grid.selectedCellRange)&&n.push({type:"clearSelection"}),s&&t.grid.focusedCell&&n.push({type:"blurCell"}),n}const Ca={handles:["openCustomEditor"],execute(t,e){if(e.type!=="openCustomEditor")return;const{rowIndex:o,colIndex:i}=e.target;t.openCustomEditor(o,i)}};function Eo(t,e){const{currentCell:o,dropdownOpen:i,isDropdownEditor:r}=e;if(!o)return null;const s=t.ctrlKey||t.metaKey;if(i)switch(t.key){case"ArrowUp":return{type:"dropdownNavigate",direction:"up"};case"ArrowDown":return{type:"dropdownNavigate",direction:"down"};case"ArrowLeft":case"ArrowRight":return e.editorType==="autocomplete"?null:{type:"noop"};case"Home":return e.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"home"};case"End":return e.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"end"};case"PageUp":return{type:"dropdownNavigate",direction:"page-up"};case"PageDown":return{type:"dropdownNavigate",direction:"page-down"};case"Enter":return{type:"dropdownSelect",moveAfterSelect:!0,commitEmptyRow:!0};case"Tab":return{type:"dropdownSelect",moveAfterSelect:!1,commitEmptyRow:!1,thenNavigate:t.shiftKey?"tab-back":"tab"};case"Escape":return{type:"escapeEdit",phase:"dropdown"}}if(t.key==="Escape")return{type:"escapeEdit",phase:"edit"};if(e.isCheckboxEditor){if(t.key===" ")return{type:"toggleCheckbox",target:o};if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")return{type:"noop"}}if(r&&!i)switch(t.key){case" ":case"F2":return{type:"openDropdown"};case"Enter":return{type:"openDropdown"}}let n=null;switch(t.key){case"Tab":n=t.shiftKey?"tab-back":"tab";break;case"Enter":n="enter";break;case"ArrowUp":n="up";break;case"ArrowDown":n="down";break;case"ArrowLeft":n="left";break;case"ArrowRight":n="right";break;case"Home":n="home";break;case"End":n="end";break;case"PageUp":n="page-up";break;case"PageDown":n="page-down";break;default:return null}return n?{type:"navigate",direction:n,from:o,ctrlKey:s}:null}function ar(t,e,o,i=!1){return!!(["Tab","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(t)||t==="Escape"||o&&!e&&(t===" "||t==="F2")||i&&t===" ")}function dr(t,e){const{cell:o,dropdownOpen:i,isToggleClick:r,isDateTriggerClick:s,isCheckboxClick:n,isCellClick:l}=e,a=[];if(n)return a.push({type:"toggleCheckbox",target:o}),a;if(s)return a.push({type:"focusCell",target:o,selectText:!1}),a.push({type:"startEdit",target:o}),a.push({type:"toggleDatePicker"}),a;i&&!r&&a.push({type:"closeDropdown"});const{isDropdownEditor:d}=e,c=!r&&(!l||d);return a.push({type:"focusCell",target:o,selectText:c}),r&&(i?a.push({type:"closeDropdown"}):(a.push({type:"startEdit",target:o}),a.push({type:"openDropdown"}))),a}class Sa{constructor(e){b(this,"pipeline");b(this,"ctx");this.ctx=e,this.pipeline=Al(e),this.pipeline.registerExecutor(Ll),this.pipeline.registerExecutor(Hl),this.pipeline.registerExecutor(Vl),this.pipeline.registerExecutor(Bl),this.pipeline.registerExecutor(Ul),this.pipeline.registerExecutor(Xl),this.pipeline.registerExecutor(Ql),this.pipeline.registerExecutor(oa),this.pipeline.registerExecutor(aa),this.pipeline.registerExecutor(ua),this.pipeline.registerExecutor(fa),this.pipeline.registerExecutor(ma),this.pipeline.registerExecutor(ba),this.pipeline.registerExecutor(va),this.pipeline.registerExecutor(Ca),this.pipeline.registerExecutor(jl)}getEditTrigger(e){const o=this.ctx.grid.columns[e];return o?o.editTrigger??this.ctx.grid.editTrigger:"navigate"}isAlwaysMode(e){return this.ctx.grid.isEditable?this.getEditTrigger(e)==="always":!1}isEditingCell(e,o){const i=this.ctx.grid.editingCell;if(!i)return!1;const r=this.ctx.grid.columns[o];return r?i.rowIndex===e&&i.field===String(r.field):!1}isDropdownEditor(e){const o=this.ctx.grid.columns[e];if(!o)return!1;const i=o.editor;return i==="select"||i==="combobox"||i==="autocomplete"}isCheckboxEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="checkbox":!1}isDateEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="date":!1}isCustomEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="custom":!1}getDropdownEditorType(e){const o=this.ctx.grid.columns[e];if(!o)return;const i=o.editor;if(i==="select"||i==="combobox"||i==="autocomplete")return i}getCellFromTarget(e){const o=e.closest(".wg__cell");if(!o)return null;const i=parseInt(o.dataset.row||"",10),r=parseInt(o.dataset.col||"",10);return isNaN(i)||isNaN(r)?null:{rowIndex:i,colIndex:r}}tryHandleKeyDown(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||this.ctx.datepicker&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key))return!1;const r=this.getEditTrigger(i.colIndex),s=this.isAlwaysMode(i.colIndex),n=this.isEditingCell(i.rowIndex,i.colIndex),l=this.ctx.dropdownOpen,a=this.isDropdownEditor(i.colIndex),d=this.isCheckboxEditor(i.colIndex),c=this.isDateEditor(i.colIndex);if(s){if(!ar(e.key,l,a,d))return!1;const h=Eo(e,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return h?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(h),!0):!1}if(n){const h=e.key==="ArrowLeft"||e.key==="ArrowRight";if(h&&r==="navigate"&&a)return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:e.key==="ArrowLeft"?"left":"right",from:i}),!0;if(e.key==="Tab"&&r==="navigate"&&l)return e.preventDefault(),e.stopPropagation(),this.ctx.dropdownUserInteracted?this.pipeline.dispatch({type:"dropdownSelect",moveAfterSelect:!1,thenNavigate:e.shiftKey?"tab-back":"tab"}):(this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:e.shiftKey?"tab-back":"tab",from:i})),!0;if(!ar(e.key,l,a,d)||!a&&!d&&!c&&h&&!l)return!1;const w=Eo(e,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return w?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(w),!0):!1}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"].includes(e.key)){const h=Eo(e,{currentCell:i,dropdownOpen:!1,isDropdownEditor:!1,isCheckboxEditor:!1});return h?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(h),!0):!1}if(e.key==="F2"){const h=this.isCustomEditor(i.colIndex);return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):h&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}if(e.key==="Enter"){if(c)return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(a){const h=this.ctx.grid.columns[i.colIndex];return h&&this.ctx.grid.getEffectiveShouldOpenDropdownOnEnter(h)?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDropdown"}),!0):!1}return!1}if(e.key===" "){const h=this.isCustomEditor(i.colIndex);if(a||c||d||h)return e.preventDefault(),e.stopPropagation(),d?this.pipeline.dispatch({type:"toggleCheckbox",target:i}):(this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):h&&this.pipeline.dispatch({type:"openCustomEditor",target:i})),!0}if(e.key==="Delete")return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"deleteCell",target:i}),!0;if((e.ctrlKey||e.metaKey)&&e.key==="c")return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"copy"}),!0;if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault(),e.stopPropagation();const h=this.isCustomEditor(i.colIndex);return this.pipeline.dispatch({type:"startEdit",target:i,initialSearchQuery:e.key}),a?this.pipeline.dispatch({type:"openDropdown"}):h&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}return!1}tryHandleFocus(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||!this.isAlwaysMode(i.colIndex)||!o.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger"))return!1;const s=this.ctx.grid.focusedCell;return(!s||s.rowIndex!==i.rowIndex||s.colIndex!==i.colIndex)&&this.pipeline.dispatch({type:"focusCell",target:i,selectText:!1}),!0}tryHandleMouseDown(e){const o=e.target,i=o.matches(".wg__combobox-toggle, .wg__select-toggle"),r=!!o.closest(".wg__date-trigger"),s=o.matches('.wg__checkbox-input, input[type="checkbox"]'),n=!i&&!r&&!s&&(o.matches(".wg__cell")||o.closest(".wg__cell")!==null);let l=null;if(i){const w=o.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete")||o.closest(".wg__cell-dropdown-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",_=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&_>=0&&(l={rowIndex:p,colIndex:_})}}else if(r){const w=o.closest(".wg__editor--date")||o.closest(".wg__cell-date-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",_=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&_>=0&&(l={rowIndex:p,colIndex:_})}}else l=this.getCellFromTarget(o);if(!l)return!1;this.ctx.grid.tabTraversalStartColIndex=null;const a=this.isAlwaysMode(l.colIndex),d=this.isEditingCell(l.rowIndex,l.colIndex);if(!i&&!r&&!s&&!n)return!1;const c=this.ctx.grid.cellSelectionMode,u=e.shiftKey;if(c==="shift"&&u&&n)return this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:e.clientX,clientY:e.clientY,shiftKey:!0}),e.preventDefault(),!0;if(a||d){const w=o.matches(".wg__editor--text, .wg__editor--number, .wg__date-input"),p=o.matches(".wg__combobox-input, .wg__autocomplete-input"),m=this.ctx.grid.focusedCell,_=m&&m.rowIndex===l.rowIndex&&m.colIndex===l.colIndex;if((w||p)&&_&&n)return!0;const y=n&&this.ctx.grid.selectedCellRange;n&&(y||this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0)&&(y&&(this.ctx.isTransitioningCells=!0),this.pipeline.dispatch({type:"clearSelection"}));const S=this.ctx.dropdownOpen,v=this.isDropdownEditor(l.colIndex),x=dr(e,{cell:l,dropdownOpen:S,isDropdownEditor:v,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(x.length===0)return y&&(this.ctx.isTransitioningCells=!1),!1;w||(e.preventDefault(),e.stopPropagation());for(const k of x)this.pipeline.dispatch(k);return y&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}if(i)return e.preventDefault(),e.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDropdown"}),!0;if(r)return e.preventDefault(),e.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(n&&!i&&!s){e.preventDefault(),this.ctx.grid.editingCell&&(this.ctx.isTransitioningCells=!0,this.pipeline.dispatch({type:"cancelEdit"})),(this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0||this.ctx.grid.selectedCellRange)&&this.pipeline.dispatch({type:"clearSelection"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1});const w=this.ctx.grid.cellSelectionMode,p=e.shiftKey;return w!=="disabled"&&(w==="click"&&!p||w==="shift"&&p)&&this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:e.clientX,clientY:e.clientY,shiftKey:e.shiftKey}),this.ctx.isTransitioningCells&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}const h=this.ctx.dropdownOpen,g=this.isDropdownEditor(l.colIndex),f=dr(e,{cell:l,dropdownOpen:h,isDropdownEditor:g,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(f.length===0)return!1;e.preventDefault(),e.stopPropagation();for(const w of f)this.pipeline.dispatch(w);return!0}tryHandleClick(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||this.getEditTrigger(i.colIndex)!=="click"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex);(s||n||l)&&e.stopImmediatePropagation();const a=o.closest(".wg__cell"),d=a?tt(e,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}tryHandleDblClick(e){const o=e.target,i=this.getCellFromTarget(o);if(!i)return!1;const r=this.getEditTrigger(i.colIndex);if(r!=="dblclick"&&r!=="navigate"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex),a=o.closest(".wg__cell"),d=a?tt(e,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}isDatepickerOpen(){return!!this.ctx.datepicker}clearSelection(){this.pipeline.dispatch({type:"clearSelection"})}}function xa(t){return new Sa(t)}class Ro extends HTMLElement{constructor(){super();b(this,"grid");b(this,"shadow");b(this,"styleElement");b(this,"customStyleElement",null);b(this,"updatePending",!1);b(this,"isCommittingFromKeyboard",!1);b(this,"isTransitioningCells",!1);b(this,"toolbarOutsideClickAdded",!1);b(this,"clickEventsSubscribed",!1);b(this,"focusEventsSubscribed",!1);b(this,"toolbarMoveInProgress",!1);b(this,"toolbarHideTimeout",null);b(this,"toolbarHovered",!1);b(this,"toolbarShortcutHandler",null);b(this,"hoveredCell",null);b(this,"currentCellToolbarItems",null);b(this,"toolbarMousemoveHandler",null);b(this,"inlineShortcutHandler",null);b(this,"dropdownOpen",!1);b(this,"dropdownOptions",[]);b(this,"highlightedIndex",-1);b(this,"filterText","");b(this,"isUserFiltering",!1);b(this,"justSelected",!1);b(this,"isOpeningDropdown",!1);b(this,"dropdownUserInteracted",!1);b(this,"isClosingViaToggle",!1);b(this,"isProgrammaticScroll",!1);b(this,"searchDebounceTimer",null);b(this,"searchAbortController",null);b(this,"isSearching",!1);b(this,"tooltipElement",null);b(this,"tooltipArrowElement",null);b(this,"tooltipAnchor",null);b(this,"tooltipShowTimer",null);b(this,"tooltipHideTimer",null);b(this,"_tooltipShowDelay",200);b(this,"_tooltipHideDelay",100);b(this,"datepicker",null);b(this,"contextMenuElement",null);b(this,"headerContextMenuElement",null);b(this,"virtualScrollStart",0);b(this,"virtualScrollEnd",0);b(this,"isLoadingMoreItems",!1);b(this,"scrollEvents");b(this,"focusEvents");b(this,"clickEvents");b(this,"pipelineAdapter",null);b(this,"_isMouseDown",!1);b(this,"handlePaste",async o=>{var l;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,s=((l=o.clipboardData)==null?void 0:l.getData("text"))||"";if(!s)return;if(s.includes(" ")||s.includes(`
662
- `))o.preventDefault(),await $l(this,s,i,r),this.render();else{const a=this.grid.columns[r],d=this.grid.displayItems[i];if(!a||!d||!this.grid.isCellEditable(a,d))return;o.preventDefault();let c=s;a.beforePasteCallback&&(c=a.beforePasteCallback(s,d));const u=String(a.field);await this.grid.commitEdit(i,u,c),this.render()}});this.shadow=this.attachShadow({mode:"open"}),this.grid=new ni,Object.defineProperty(this,"onpaste",{configurable:!0,enumerable:!0,get:()=>this.grid.onpaste,set:o=>{this.grid.onpaste=o}}),this.scrollEvents=gl(),this.clickEvents=hl(),this.focusEvents=ul(()=>({isCommittingFromKeyboard:this.isCommittingFromKeyboard,isTransitioningCells:this.isTransitioningCells,isClosingViaToggle:this.isClosingViaToggle,isOpeningDropdown:this.isOpeningDropdown}),()=>{this.isClosingViaToggle=!1}),this.styleElement=document.createElement("style"),this.styleElement.textContent=Xn,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>{this.grid.invalidateDisplayCache(),this.requestUpdate()},this.grid._onInteractionChange=(o,i)=>{o==="editingCell"&&i.current===null&&V(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(o){this._tooltipShowDelay=o}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(o){this._tooltipHideDelay=o}connectedCallback(){ao.debug("connectedCallback — grid attached to DOM"),this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.pipelineAdapter=xa(this),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){ao.debug("disconnectedCallback — grid removed from DOM"),this.scrollEvents.destroy(),this.focusEvents.destroy(),this.clickEvents.destroy(),this.clickEventsSubscribed=!1,this.focusEventsSubscribed=!1,this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null),At(),this.removeInlineShortcuts(),kl()}get items(){return this.grid.items}set items(o){this.grid.items=o,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(o){this.grid.columns=o}get isFilterable(){return this.grid.isFilterable}set isFilterable(o){this.grid.isFilterable=o}get onfilterchange(){return this.grid.onfilterchange}set onfilterchange(o){this.grid.onfilterchange=o}get columnMinWidth(){return this.grid.columnMinWidth}set columnMinWidth(o){this.grid.columnMinWidth=o}get filters(){return this.grid.filters}set filters(o){this.grid.filters=o}setFilter(o,i){this.grid.setFilter(o,i)}get isPageable(){return this.grid.isPageable}set isPageable(o){this.grid.isPageable=o}get pageSize(){return this.grid.pageSize}set pageSize(o){this.grid.pageSize=o}get pageSizes(){return this.grid.pageSizes}set pageSizes(o){this.grid.pageSizes=o}get paginationMode(){return this.grid.paginationMode}set paginationMode(o){this.grid.paginationMode=o}get isStriped(){return this.grid.isStriped}set isStriped(o){this.grid.isStriped=o}get isHoverable(){return this.grid.isHoverable}set isHoverable(o){this.grid.isHoverable=o}get isEditable(){return this.grid.isEditable}set isEditable(o){this.grid.isEditable=o}get isRowEditable(){return this.grid.isRowEditable}set isRowEditable(o){this.grid.isRowEditable=o}get editTrigger(){return this.grid.editTrigger}set editTrigger(o){this.grid.editTrigger=o}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(o){this.grid.editStartSelection=o}get mode(){return this.grid.mode}set mode(o){this.grid.mode=o}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(o){this.grid.dropdownToggleVisibility=o}get shouldShowDropdownOnFocus(){return this.grid.shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(o){this.grid.shouldShowDropdownOnFocus=o}get shouldOpenDropdownOnEnter(){return this.grid.shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(o){this.grid.shouldOpenDropdownOnEnter=o}get isCheckboxAlwaysEditable(){return this.grid.isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(o){this.grid.isCheckboxAlwaysEditable=o}get isRowNumbersVisible(){return this.grid.isRowNumbersVisible}set isRowNumbersVisible(o){this.grid.isRowNumbersVisible=o}get isDirtyIndicatorVisible(){return this.grid.isDirtyIndicatorVisible}set isDirtyIndicatorVisible(o){this.grid.isDirtyIndicatorVisible=o}isCellDirty(o,i){return this.grid.isCellDirty(o,i)}isRowDirty(o){return this.grid.isRowDirty(o)}get isStickyRowNumbers(){return this.grid.isStickyRowNumbers}set isStickyRowNumbers(o){this.grid.isStickyRowNumbers=o}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(o){this.grid.freezeColumns=o}get invalidCells(){return this.grid.invalidCells}set invalidCells(o){this.grid.invalidCells=o}get isRowToolbarVisible(){return this.grid.isRowToolbarVisible}set isRowToolbarVisible(o){this.grid.isRowToolbarVisible=o}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(o){this.grid.rowToolbar=o}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(o){this.grid.toolbarHorizontalAlign=o}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(o){this.grid.toolbarHorizontalAlign=o}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(o){this.grid.toolbarTrigger=o}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(o){this.grid.toolbarPosition=o}get toolbarColumn(){return this.grid.toolbarColumn}set toolbarColumn(o){this.grid.toolbarColumn=o}get toolbarFollowsCursor(){return this.grid.toolbarFollowsCursor}set toolbarFollowsCursor(o){this.grid.toolbarFollowsCursor=o}get cellToolbar(){return this.grid.cellToolbar}set cellToolbar(o){this.grid.cellToolbar=o}get cellToolbarOffset(){return this.grid.cellToolbarOffset}set cellToolbarOffset(o){this.grid.cellToolbarOffset=o}get toolbarBtnMinWidth(){return this.grid.toolbarBtnMinWidth}set toolbarBtnMinWidth(o){this.grid.toolbarBtnMinWidth=o}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(o){this.grid.inlineActionsTitle=o}get contextMenu(){return this.grid.contextMenu}set contextMenu(o){this.grid.contextMenu=o}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(o){this.grid.contextMenuXOffset=o}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(o){this.grid.contextMenuYOffset=o}get headerContextMenu(){return this.grid.headerContextMenu}set headerContextMenu(o){this.grid.headerContextMenu=o}set onheadercontextmenuopen(o){this.grid.onheadercontextmenuopen=o}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(o){this.grid.rowShortcuts=o}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(o){this.grid.rangeShortcuts=o}get selectedRows(){return this.grid.selectedRows}selectRow(o,i="replace"){this.grid.selectRow(o,i)}selectRowRange(o,i){this.grid.selectRowRange(o,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(o){return this.grid.isRowSelected(o)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}copySelectedRowsToClipboard(){return this.grid.copySelectedRowsToClipboard()}get cellSelectionMode(){return this.grid.cellSelectionMode}set cellSelectionMode(o){this.grid.cellSelectionMode=o}get selectedCellRange(){return this.grid.selectedCellRange}selectCellRange(o){this.grid.selectCellRange(o)}clearCellSelection(){this.grid.clearCellSelection()}getSelectedCells(){return this.grid.getSelectedCells()}copyCellSelectionToClipboard(){return this.grid.copyCellSelectionToClipboard()}get shouldCopyWithHeaders(){return this.grid.shouldCopyWithHeaders}set shouldCopyWithHeaders(o){this.grid.shouldCopyWithHeaders=o}get oncellselectionchange(){return this.grid.oncellselectionchange}set oncellselectionchange(o){this.grid.oncellselectionchange=o}get isNewRowEnabled(){return this.grid.isNewRowEnabled}set isNewRowEnabled(o){this.grid.isNewRowEnabled=o}get newRowPosition(){return this.grid.newRowPosition}set newRowPosition(o){this.grid.newRowPosition=o}get newRowIndicator(){return this.grid.newRowIndicator}set newRowIndicator(o){this.grid.newRowIndicator=o}get createEmptyRowCallback(){return this.grid.createEmptyRowCallback}set createEmptyRowCallback(o){this.grid.createEmptyRowCallback=o}get idMember(){return this.grid.idMember}set idMember(o){this.grid.idMember=o}get treePathMember(){return this.grid.treePathMember}set treePathMember(o){this.grid.treePathMember=o}get treeLevelMember(){return this.grid.treeLevelMember}set treeLevelMember(o){this.grid.treeLevelMember=o}get treeParentMember(){return this.grid.treeParentMember}set treeParentMember(o){this.grid.treeParentMember=o}get treeSeparator(){return this.grid.treeSeparator}set treeSeparator(o){this.grid.treeSeparator=o}get treeDataSorted(){return this.grid.treeDataSorted}set treeDataSorted(o){this.grid.treeDataSorted=o}get expandedPaths(){return this.grid.expandedPaths}set expandedPaths(o){this.grid.expandedPaths=o}get defaultExpandDepth(){return this.grid.defaultExpandDepth}set defaultExpandDepth(o){this.grid.defaultExpandDepth=o}set onexpandedpathschange(o){this.grid.onexpandedpathschange=o}get onexpandedpathschange(){return this.grid.onexpandedpathschange}isPathExpanded(o){return this.grid.isPathExpanded(o)}toggleExpandedPath(o){this.grid.toggleExpandedPath(o)}expandAll(){this.grid.expandAll()}collapseAll(){this.grid.collapseAll()}get treeDoubleClickBehavior(){return this.grid.treeDoubleClickBehavior}set treeDoubleClickBehavior(o){this.grid.treeDoubleClickBehavior=o}get treeExpandedGlyph(){return this.grid.treeExpandedGlyph}set treeExpandedGlyph(o){this.grid.treeExpandedGlyph=o}get treeCollapsedGlyph(){return this.grid.treeCollapsedGlyph}set treeCollapsedGlyph(o){this.grid.treeCollapsedGlyph=o}get treeChevronCallback(){return this.grid.treeChevronCallback}set treeChevronCallback(o){this.grid.treeChevronCallback=o}get isShortcutsHelpVisible(){return this.grid.isShortcutsHelpVisible}set isShortcutsHelpVisible(o){this.grid.isShortcutsHelpVisible=o}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(o){this.grid.shortcutsHelpPosition=o}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(o){this.grid.shortcutsHelpContentCallback=o}set onrowchange(o){this.grid.onrowchange=o}set onroweditstart(o){this.grid.onroweditstart=o}set onroweditcancel(o){this.grid.onroweditcancel=o}set onvalidationerror(o){this.grid.onvalidationerror=o}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(o){this.grid.validationTooltipCallback=o}set ontoolbarclick(o){this.grid.ontoolbarclick=o}set onrowaction(o){this.grid.onrowaction=o}get oncontextmenuopen(){return this.grid.oncontextmenuopen}set oncontextmenuopen(o){this.grid.oncontextmenuopen=o}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(o){this.grid.ondatarequest=o}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(o){this.grid.onrowdelete=o}get onrowfocus(){return this.grid.onrowfocus}set onrowfocus(o){this.grid.onrowfocus=o}get focusedRowIndex(){return this.grid.focusedRowIndex}set focusedRowIndex(o){this.grid.focusedRowIndex=o}get sort(){return this.grid.sort}set sort(o){this.grid.sort=o}get sortMode(){return this.grid.sortMode}set sortMode(o){this.grid.sortMode=o}get currentPage(){return this.grid.currentPage}set currentPage(o){this.grid.currentPage=o}get totalItems(){return this.grid.totalItems}set totalItems(o){this.grid.totalItems=o}get showPagination(){return this.grid.showPagination}set showPagination(o){this.grid.showPagination=o}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(o){this.grid.paginationPosition=o}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(o){this.grid.paginationLabelsCallback=o}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(o){this.grid.paginationLayout=o}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(o){this.grid.summaryPosition=o}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(o){this.grid.summaryContentCallback=o}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(o){this.grid.customStylesCallback=o,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(o){this.grid.rowClassCallback=o}get labels(){return this.grid.labels}set labels(o){this.grid.labels=o}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(o){this.grid.summaryMetadata=o}get isSummaryInline(){return this.grid.isSummaryInline}set isSummaryInline(o){this.grid.isSummaryInline=o}get idValueMember(){return this.grid.idValueMember}set idValueMember(o){this.grid.idValueMember=o}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(o){this.grid.idValueCallback=o}get rowLocking(){return this.grid.rowLocking}set rowLocking(o){this.grid.rowLocking=o}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(o){this.grid.onrowlockchange=o}get gridName(){return this.grid.gridName}set gridName(o){this.grid.gridName=o,this.tryLoadPersistedWidths()}get shouldPersistColumnWidths(){return this.grid.shouldPersistColumnWidths}set shouldPersistColumnWidths(o){this.grid.shouldPersistColumnWidths=o,this.tryLoadPersistedState()}get isColumnReorderAllowed(){return this.grid.isColumnReorderAllowed}set isColumnReorderAllowed(o){this.grid.isColumnReorderAllowed=o}get shouldPersistColumnOrder(){return this.grid.shouldPersistColumnOrder}set shouldPersistColumnOrder(o){this.grid.shouldPersistColumnOrder=o,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.shouldPersistColumnWidths||this.grid.shouldPersistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(o){this.grid.oncolumnresize=o}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(o){this.grid.oncolumnreorder=o}get fillDragCallback(){return this.grid.fillDragCallback}set fillDragCallback(o){this.grid.fillDragCallback=o}get isScrollable(){return this.grid.isScrollable}set isScrollable(o){this.grid.isScrollable=o}get scrollMaxHeight(){return this.grid.scrollMaxHeight}set scrollMaxHeight(o){this.grid.scrollMaxHeight=o}get tableBorderOnly(){return this.grid.tableBorderOnly}set tableBorderOnly(o){this.grid.tableBorderOnly=o}get isVirtualScrollEnabled(){return this.grid.isVirtualScrollEnabled}set isVirtualScrollEnabled(o){this.grid.isVirtualScrollEnabled=o}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(o){this.grid.virtualScrollThreshold=o}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(o){this.grid.virtualScrollRowHeight=o}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(o){this.grid.virtualScrollBuffer=o}get isInfiniteScrollEnabled(){return this.grid.isInfiniteScrollEnabled}set isInfiniteScrollEnabled(o){this.grid.isInfiniteScrollEnabled=o}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(o){this.grid.infiniteScrollThreshold=o}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(o){this.grid.hasMoreItems=o}get onbeforepaste(){return this.grid.onbeforepaste}set onbeforepaste(o){this.grid.onbeforepaste=o}get pasteMode(){return this.grid.pasteMode}set pasteMode(o){this.grid.pasteMode=o}get shouldValidateOnPaste(){return this.grid.shouldValidateOnPaste}set shouldValidateOnPaste(o){this.grid.shouldValidateOnPaste=o}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(o){return this.grid.getRowDraft(o)}hasRowDraft(o){return this.grid.hasRowDraft(o)}discardRowDraft(o){this.grid.discardRowDraft(o)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(o,i){return this.grid.isCellInvalid(o,i)}getCellValidationError(o,i){return this.grid.getCellValidationError(o,i)}getRowId(o){return this.grid.getRowId(o)}findRowById(o){return this.grid.findRowById(o)}isRowLocked(o){return this.grid.isRowLocked(o)}getRowLockInfo(o){return this.grid.getRowLockInfo(o)}lockRowById(o,i){return this.grid.lockRowById(o,i)}unlockRowById(o){return this.grid.unlockRowById(o)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(o,i){return this.grid.updateRowById(o,i)}replaceRowById(o,i){return this.grid.replaceRowById(o,i)}canEditCell(o,i){return this.grid.canEditCell(o,i)}setColumnWidth(o,i){this.grid.setColumnWidth(o,i)}setColumnWidths(o){this.grid.setColumnWidths(o)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(o){this.grid.setColumnOrder(o)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(o,i){const r=this.grid.columns,s=this.grid.displayItems;o<0||o>=s.length||i<0||i>=r.length||(this.grid.setFocusedCell(o,i),requestAnimationFrame(()=>{N(this,o,i)}))}startEditing(o,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const s=r[i],n=String(s.field);this.grid.startEdit(o,n);const l=this.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);l&&(l.classList.remove("wg__cell--focused"),l.classList.add("wg__cell--editing"),l.innerHTML=Ot(this,o,i,s))}escapeHtml(o){const i=document.createElement("div");return i.textContent=o,i.innerHTML}getCurrentEditingColumn(){const o=this.grid.editingCell;return o&&this.grid.columns.find(i=>String(i.field)===o.field)||null}getCurrentEditorOptions(){const o=this.getCurrentEditingColumn();return(o==null?void 0:o.editorOptions)||{}}moveFocusAfterCommit(o,i,r){_o(this,o,i,r)}requestUpdate(){if(this.updatePending)return;Ee.debug("requestUpdate: scheduling render"),this.updatePending=!0;const o=performance.now();queueMicrotask(()=>{this.updatePending=!1;const i=performance.now();$t.debug("microtask delay:",(i-o).toFixed(2),"ms"),this.render(),$t.debug("render() total:",(performance.now()-i).toFixed(2),"ms")})}updateCustomStyles(){const o=this.grid.customStylesCallback;if(o){const i=o();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(o,i,r){var h;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,n=this.grid.displayItems,l=n[i],a=this.grid.getEditableColumns(l),d=a.findIndex(g=>g.index===r);if((o.ctrlKey||o.metaKey)&&o.key==="c"){if(this.grid.selectedCellRange){o.preventDefault(),this.grid.copyCellSelectionToClipboard();return}const g=s[r],f=n[i];if(g&&f){let w=this.grid.getCellRawValue(f,i,String(g.field));g.beforeCopyCallback&&(w=g.beforeCopyCallback(w,f));const p=w!=null?String(w):"";navigator.clipboard.writeText(p)}return}const c=this.grid.selectedRows;if(c.length>0){const g=this.grid.rangeShortcuts;if(g&&g.length>0)for(const f of g){const w=pt(f.key);if(mt(o,w)){const p={rows:this.grid.getSelectedRowsData(),rowIndices:c};if(!(typeof f.disabled=="function"?f.disabled(p):f.disabled===!0)){o.preventDefault(),f.action(p);return}}}}const u=this.grid.rowShortcuts;if(u&&u.length>0){const g=s[r],f=n[i];if(g&&f)for(const w of u){const p=pt(w.key);if(mt(o,p)){const m={row:f,rowIndex:i,colIndex:r,column:g,cellValue:this.grid.getCellRawValue(f,i,String(g.field))};if(!(typeof w.disabled=="function"?w.disabled(m):w.disabled===!0)){o.preventDefault(),w.action(m);return}}}}switch(o.key){case"ArrowUp":o.preventDefault(),i>0&&N(this,i-1,r);break;case"ArrowDown":o.preventDefault(),i<n.length-1&&N(this,i+1,r);break;case"ArrowLeft":o.preventDefault(),r>0&&N(this,i,r-1);break;case"ArrowRight":o.preventDefault(),r<s.length-1&&N(this,i,r+1);break;case"Tab":{o.preventDefault();const g=o.shiftKey?"backward":"forward";let f=d;if(f===-1&&a.length>0)if(g==="forward"){const p=a.find(m=>m.index>r);if(p){N(this,i,p.index);break}f=a.length-1}else{const p=[...a].reverse().find(m=>m.index<r);if(p){N(this,i,p.index);break}f=0}const w=this.grid.findNextEditableCell(i,f,g);w?N(this,w.rowIndex,w.colIndex):g==="forward"&&this.grid.isEmptyRowIndex(i)&&a.length>0&&N(this,i,a[0].index);break}case"Home":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const f=this.shadow.querySelector('td[data-row="0"][data-col="0"]');f&&(f.focus({preventScroll:!0}),ee(this,g,{rowIndex:0,colIndex:0}))}else N(this,0,0);else N(this,i,0);break;case"End":if(o.preventDefault(),o.ctrlKey){const g=n.length-1,f=s.length-1;if(this.grid.shouldUseVirtualScroll()){const w=this.grid.focusedCell;this.grid.setFocusedCell(g,f),this.scrollToRowProgrammatically(g);const p=this.shadow.querySelector(`td[data-row="${g}"][data-col="${f}"]`);p&&(p.focus({preventScroll:!0}),ee(this,w,{rowIndex:g,colIndex:f}))}else N(this,g,f)}else N(this,i,s.length-1);break;case"PageUp":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const f=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),ee(this,g,{rowIndex:0,colIndex:r}))}else N(this,0,r);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);w&&(w.focus({preventScroll:!0}),ee(this,f,{rowIndex:g,colIndex:r}))}else N(this,g,r)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const g=n.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);w&&(w.focus({preventScroll:!0}),ee(this,f,{rowIndex:g,colIndex:r}))}else N(this,g,r)}else{const g=Math.min(n.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);w&&(w.focus({preventScroll:!0}),ee(this,f,{rowIndex:g,colIndex:r}))}else N(this,g,r)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{o.preventDefault();const g=s[r],f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",w=this.grid.isEmptyRowIndex(i);if(f&&this.grid.getEffectiveShouldOpenDropdownOnEnter(g))re(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||pe(this)});else if(w&&g&&this.grid.isCellEditable(g))re(this,i,r);else if(i<n.length-1){const p=this.grid.tabTraversalStartColIndex??r;this.grid.tabTraversalStartColIndex=null,N(this,i+1,p)}break}case"F2":{o.preventDefault();const g=s[r],f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",w=(g==null?void 0:g.editor)==="custom";re(this,i,r),f?requestAnimationFrame(()=>{this.dropdownOpen||pe(this)}):w&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{o.preventDefault();const g=s[r],f=(g==null?void 0:g.editor)==="checkbox",w=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",p=(g==null?void 0:g.editor)==="date",m=(g==null?void 0:g.editor)==="custom";f&&g&&this.grid.isCellEditable(g,n[i])?fs(this,i,r):w?(re(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||pe(this)})):p?(re(this,i,r),requestAnimationFrame(()=>{var S;const _=(S=this.shadowRoot)==null?void 0:S.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),y=_==null?void 0:_.querySelector(".wg__date-input"),C=_==null?void 0:_.querySelector(".wg__editor--date");y&&C&&this.openDatePicker(y,C)})):m&&(re(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)G(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),ee(this,g,null),(h=o.target)==null||h.blur()}break;case"Delete":{o.preventDefault();const g=s[r],f=n[i];if(o.ctrlKey){if(f){const w={rowIndex:i,row:f};this.grid.onrowdelete&&this.grid.onrowdelete(w),this.dispatchEvent(new CustomEvent("rowdelete",{detail:w}))}}else g&&this.grid.isCellEditable(g,f)&&(this.grid.commitEdit(i,String(g.field),null),this.render(),requestAnimationFrame(()=>{const w=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);w==null||w.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const g=s[r];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(o.key))return;re(this,i,r,{initialSearchQuery:o.key}),o.preventDefault()}break}}async handleEditorKeyDown(o,i){const r=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",n=this.grid.columns.find(c=>c.field===s),l=(n==null?void 0:n.editor)||"text",a=l==="select"||l==="combobox"||l==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&d.includes(o.key)){o.preventDefault(),o.stopPropagation();const c=this.grid.columns.findIndex(m=>m.field===s),u=this.grid.columns.map((m,_)=>({index:_,column:m})).filter(m=>m.column.isEditable!==!1),h=u.findIndex(m=>m.index===c),g=this.grid.displayItems;let f=r,w=c,p=!1;switch(o.key){case"ArrowUp":r>0&&(f=r-1,p=!0);break;case"ArrowDown":r<g.length-1&&(f=r+1,p=!0);break;case"ArrowLeft":h>0&&(w=u[h-1].index,p=!0);break;case"ArrowRight":h<u.length-1&&(w=u[h+1].index,p=!0);break;case"PageUp":f=Math.max(0,r-10),p=!0;break;case"PageDown":f=Math.min(g.length-1,r+10),p=!0;break;case"Home":o.ctrlKey&&(f=0),w=0,p=!0;break;case"End":o.ctrlKey?(f=g.length-1,w=this.grid.columns.length-1):w=this.grid.columns.length-1,p=!0;break}p&&(G(this),this.grid.cancelEdit(),queueMicrotask(()=>{N(this,f,w)}));return}switch(o.key){case"ArrowDown":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const m=this.getCurrentEditorOptions();let _=this.highlightedIndex+1;for(;_<this.dropdownOptions.length&&de(this.dropdownOptions[_],m);)_++;_<this.dropdownOptions.length&&(this.highlightedIndex=_,we(this),Co(this))}break;case"ArrowUp":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const m=this.getCurrentEditorOptions();let _=this.highlightedIndex-1;for(;_>=0&&de(this.dropdownOptions[_],m);)_--;_>=0&&(this.highlightedIndex=_,we(this),Co(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Ci(this,this.highlightedIndex,!0,!0):a&&!this.dropdownOpen?pe(this):(this.isCommittingFromKeyboard=!0,V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,!0):await zt(this,i,!0),_o(this,r,s,"down"));break;case"Tab":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.isCommittingFromKeyboard=!0;const c=this.grid.displayItems[r],u=this.grid.getEditableColumns(c),h=this.grid.columns.findIndex(m=>String(m.field)===s),g=u.findIndex(m=>m.index===h),f=this.grid.isEmptyRowIndex(r),w=g===u.length-1,p=f&&w&&!o.shiftKey;if(this.dropdownOpen&&this.highlightedIndex>=0&&a){const m=this.dropdownOptions[this.highlightedIndex],_=this.getCurrentEditorOptions();if(m&&!de(m,_)){const y=ze(m,_);await this.grid.commitEdit(r,s,y,p)}V(this)}else V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,p):a||await zt(this,i,p);if(p){Lt(this,r,h);const m=u.length>0?u[0].index:0;queueMicrotask(()=>{const _=this.grid.newRowPosition==="top"?0:this.grid.displayItems.length-1;N(this,_,m),this.isCommittingFromKeyboard=!1})}else _o(this,r,s,o.shiftKey?"prev":"next");break;case"Escape":if(o.preventDefault(),o.stopPropagation(),this.dropdownOpen){V(this),(l==="autocomplete"||l==="combobox")&&(this.filterText="",i instanceof HTMLInputElement&&(i.value="",i.focus()));return}if(this.datepicker){this.datepicker.close(!0),this.datepicker=null;return}this.isCommittingFromKeyboard=!0,G(this),this.grid.cancelEdit(),ps(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&pe(this);break;case"Backspace":l==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),Si(this,n.editorOptions||{})));break;default:l==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,Si(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("mousedown",()=>{this._isMouseDown=!0},!0),document.addEventListener("mouseup",()=>{this._isMouseDown=!1},!0),o.addEventListener("focus",n=>{const l=n.target;if(l.matches(".wg__cell")){const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10);if(cs(this,a,d),Ht(this),!this._isMouseDown&&!ko()&&!qi()){const c=this.grid.focusedRowIndex;this.grid.setFocusedRow(a),this.updateRowFocusVisual(c,a)}bo(this,l,a)}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.row||"0",10),c=parseInt(a.dataset.col||"0",10),u=this.grid.columns[c];if(((u==null?void 0:u.editTrigger)??this.grid.editTrigger)==="always"){const g=this.grid.focusedCell;if(!g||g.rowIndex!==d||g.colIndex!==c){if(this.grid.setFocusedCell(d,c),g){const f=this.shadow.querySelector(`td[data-row="${g.rowIndex}"][data-col="${g.colIndex}"]`);f&&f.classList.remove("wg__cell--always-edit-focused")}if(a.classList.add("wg__cell--always-edit-focused"),!this._isMouseDown){const f=this.grid.focusedRowIndex;this.grid.setFocusedRow(d),this.updateRowFocusVisual(f,d)}}}}}},!0),o.addEventListener("keydown",n=>{var d;const l=n.target,a=n;if(this.grid.isTreeMode&&this.grid.focusedCell&&!this.grid.editingCell&&(a.ctrlKey||a.metaKey)&&(a.key==="ArrowLeft"||a.key==="ArrowRight")){const{rowIndex:c,colIndex:u}=this.grid.focusedCell,h=this.grid.displayItems[c],g=h?this.grid.getRowTreeInfo(h):null;if(g){n.preventDefault(),n.stopPropagation();let f=null;if(a.key==="ArrowRight")g.hasChildren&&!this.grid.isPathExpanded(g.path)&&(this.grid.toggleExpandedPath(g.path),f=g.path);else if(g.hasChildren&&this.grid.isPathExpanded(g.path))this.grid.toggleExpandedPath(g.path),f=g.path;else{const w=this.grid.findNearestExpandedAncestor(g.path);w!==null&&(this.grid.toggleExpandedPath(w),f=w)}if(f!==null){const w=f;queueMicrotask(()=>{const p=this.grid.displayItems.findIndex(m=>{var _;return((_=this.grid.getRowTreeInfo(m))==null?void 0:_.path)===w});p>=0&&N(this,p,u)})}return}}if(!((d=this.pipelineAdapter)!=null&&d.tryHandleKeyDown(n))){if(this.datepicker){const c=n.key;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(c))return}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,l);return}if(l.matches(".wg__cell")){const c=parseInt(l.dataset.row||"0",10),u=parseInt(l.dataset.col||"0",10);this.handleCellKeyDown(n,c,u)}}}),this.focusEvents.init(o),this.focusEvents.subscribe("focusout",(n,l)=>{(!l||!o.contains(l))&&gs(this,{relatedTarget:l})}),o.addEventListener("dblclick",n=>{var d;const l=n.target;if((d=this.pipelineAdapter)!=null&&d.tryHandleDblClick(n))return;n.preventDefault();const a=l.closest(".wg__cell");if(a){const c=parseInt(a.dataset.row||"0",10),u=parseInt(a.dataset.col||"0",10),h=this.grid.columns[u];if(h){const g=h.editTrigger||this.grid.editTrigger;if(g==="dblclick"||g==="navigate"){const f=tt(n,a);re(this,c,u,{cursorPosition:f??void 0});const w=h.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||pe(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}}),Ee.debug("attaching click handler on table"),o.addEventListener("click",n=>{var c;const l=n.target;Ee.debug("CLICK fired | target:",l.tagName,l.className,"| connected:",l.isConnected);const a=l.closest(".wg__tree-chevron[data-tree-toggle]");if(a){n.preventDefault(),n.stopPropagation();const u=a.getAttribute("data-tree-toggle");Ee.debug("chevron click:",u,"| target:",l.tagName,l.className),u!==null&&this.grid.toggleExpandedPath(u);return}if((c=this.pipelineAdapter)!=null&&c.tryHandleClick(n))return;const d=l.closest(".wg__cell");if(d&&!d.classList.contains("wg__cell--editing")){const u=parseInt(d.dataset.row||"0",10),h=parseInt(d.dataset.col||"0",10),g=this.grid.columns[h];if(g&&(g.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const w=tt(n,d);re(this,u,h,{cursorPosition:w??void 0});const p=g.editor;p==="select"||p==="combobox"||p==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||pe(this)}):p==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(u,h)})}}}),o.addEventListener("mousedown",n=>{var h,g;const l=n.target,a=n;if(Ee.debug("MOUSEDOWN fired | target:",l.tagName,l.className,"| connected:",l.isConnected,"| detail:",a.detail,"| button:",a.button),l.closest(".wg__tree-chevron[data-tree-toggle]")){Ee.debug("chevron mousedown intercepted (suppress focus/selection)"),n.preventDefault(),n.stopPropagation();return}if(a.detail===2&&a.button===0&&this.grid.isTreeMode){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__tree-chevron")){const w=parseInt(f.dataset.col||"-1",10),p=parseInt(f.dataset.row||"-1",10),m=w>=0?this.grid.columns[w]:null;if(m!=null&&m.isTree&&p>=0){if(this.grid.treeDoubleClickBehavior==="toggle"){const y=this.grid.displayItems[p],C=y?this.grid.getRowTreeInfo(y):null;if(C!=null&&C.hasChildren){Ee.debug("tree dblclick (mousedown.detail=2) toggle:",C.path),n.preventDefault(),n.stopPropagation(),this.grid.toggleExpandedPath(C.path);return}}const _=m.editTrigger||this.grid.editTrigger;if((_==="dblclick"||_==="navigate")&&this.grid.canEditCell(p,String(m.field))){const y=tt(a,f);Ee.debug("tree dblclick (mousedown.detail=2) start edit:",String(m.field),"| trigger:",_),n.preventDefault(),n.stopPropagation(),re(this,p,w,{cursorPosition:y??void 0});return}}}}if((h=this.pipelineAdapter)!=null&&h.tryHandleMouseDown(a))return;const d=l.closest(".wg__cell"),c=l.closest(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(d&&!d.classList.contains("wg__cell--editing")&&!l.closest(".wg__row-number")&&!c){const f=parseInt(d.dataset.row||"0",10),w=parseInt(d.dataset.col||"0",10),p=(g=this.grid.visualColumns[w])==null?void 0:g.column;if(p){const m=this.grid.cellSelectionMode,_=a.shiftKey;if(p.editTrigger||this.grid.editTrigger,m!=="disabled"&&(m==="click"&&!_||m==="shift"&&_)){if(this.grid.editingCell){const C=this.grid.editingCell,S=this.grid.columns.findIndex(v=>String(v.field)===C.field);V(this),G(this),this.grid.cancelEdit(),S>=0&&O(this,C.rowIndex,S)}this.grid.selectedRows.length>0&&this.grid.clearSelection(),this.grid.selectedColumns.length>0&&this.grid.clearColumnSelection(),Vi(this,f,w,a);return}else this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q())}}if(l.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-date-display"),w=l.closest(".wg__editor--date");if(w){const p=w.querySelector(".wg__date-input");p&&this.openDatePicker(p,w)}else if(f){const p=parseInt(f.dataset.row||"0",10),m=f.dataset.field||"",_=this.grid.columns.findIndex(y=>String(y.field)===m);if(_>=0){if(this.clearAllSelections(),this.isTransitioningCells=!0,this.grid.editingCell){const y=this.grid.editingCell,C=this.grid.columns.findIndex(S=>String(S.field)===y.field);V(this),G(this),this.grid.cancelEdit(),this.grid.setFocusedCell(p,_),C>=0&&O(this,y.rowIndex,C)}re(this,p,_),requestAnimationFrame(()=>{var v;this.isTransitioningCells=!1;const y=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${p}"][data-field="${m}"]`),C=y==null?void 0:y.querySelector(".wg__date-input"),S=y==null?void 0:y.querySelector(".wg__editor--date");C&&S&&this.openDatePicker(C,S)})}}return}if(this.dropdownOpen||this.grid.editingCell){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const w=parseInt(f.dataset.row||"0",10),p=parseInt(f.dataset.col||"0",10),m=this.grid.editingCell,_=l.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(m&&!_){const y=this.grid.columns.findIndex(C=>String(C.field)===m.field);if(w!==m.rowIndex||p!==y){n.preventDefault(),this.isTransitioningCells=!0;const C=m.rowIndex,S=y;V(this),G(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,p),S>=0&&O(this,C,S);const v=this.grid.columns[p],x=(v==null?void 0:v.editTrigger)||this.grid.editTrigger,E=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,x==="click"&&v&&this.grid.isCellEditable(v,this.grid.displayItems[w])){const I=this.shadow.querySelector(`td[data-row="${w}"][data-col="${p}"]`),R=I?tt({clientX:E},I):void 0;re(this,w,p,{cursorPosition:R??void 0})}else N(this,w,p)});return}}}}if(l.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-dropdown-display");if(f){const w=parseInt(f.dataset.row||"0",10),p=f.dataset.field||"",m=this.grid.columns.findIndex(_=>String(_.field)===p);if(m>=0){this.isTransitioningCells=!0;const _=this.grid.editingCell,y=_?this.grid.columns.findIndex(C=>String(C.field)===_.field):-1;_&&(V(this),G(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,m),y>=0&&O(this,_.rowIndex,y)),re(this,w,m),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||pe(this)})}}}}),o.addEventListener("click",n=>{const l=n.target;if(l.matches(".wg__select-trigger, .wg__select-value")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.col||"",10),c=this.grid.columns[d];if(((c==null?void 0:c.editTrigger)??this.grid.editTrigger)==="always")return}n.preventDefault(),n.stopPropagation(),Ls(this)}}),o.addEventListener("mousedown",n=>{const l=n.target,a=l.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation(),this.clearAllSelections();const h=a.dataset.field;h&&Zs(this,n,h);return}if(this.grid.isColumnReorderAllowed){const h=n;if(!h.ctrlKey&&!h.metaKey&&!h.shiftKey){const g=l.closest(".wg__header");if(g&&!g.classList.contains("wg__header--frozen")&&!g.classList.contains("wg__row-number-header")){this.clearAllSelections();const f=g.dataset.field;f&&rl(this,n,f)}}}if((!this.grid.isColumnReorderAllowed||n.shiftKey)&&n.button===0){const h=l.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(h&&!l.closest(".wg__resize-handle")&&!l.closest(".wg__sort-indicator")){const g=h.dataset.field;if(g){const f=this.grid.visualColumns.findIndex(w=>String(w.column.field)===g);f>=0&&El(this,f,n)}}}const d=l.closest(".wg__row-number[data-row-number]");if(d&&n.button===0){const h=parseInt(d.dataset.rowNumber||"-1",10);h>=0&&yl(this,h,n)}l.closest(".wg__row-number-header")&&n.button===0&&(n.preventDefault(),this.grid.selectAll(),this.grid.selectedCellRange&&Vt(this),this.render(),requestAnimationFrame(()=>{const h=this.shadow.querySelector(".wg");h==null||h.focus({preventScroll:!0})}));const u=l.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(u&&!l.closest(".wg__header")&&!ko()&&!qi()){const h=parseInt(u.dataset.row||"-1",10);if(h>=0){const g=this.grid.focusedRowIndex;this.grid.setFocusedRow(h),this.updateRowFocusVisual(g,h)}}if(l.closest(".wg__cell")&&!l.closest(".wg__row-number, .wg__header")&&!ko()){let h=!1;this.grid.selectedRows.length>0&&(this.grid.clearSelection(),h=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),h=!0),h&&this.render()}if(!l.closest(".wg__cell, .wg__row-number, .wg__header, .wg__toolbar, button, input, select, textarea")){let h=!1;this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q(),h=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),h=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),h=!0),h&&this.render()}}),o.addEventListener("click",n=>{const l=n,a=l.target;if(a.closest(".wg__resize-handle")||a.closest(".wg__sort-indicator")||zi()||!this.grid.isColumnReorderAllowed)return;const d=a.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(d){n.preventDefault();const c=d.dataset.field;if(!c)return;const u=this.grid.visualColumns.findIndex(h=>String(h.column.field)===c);if(u===-1)return;Q(),l.ctrlKey||l.metaKey?this.grid.selectColumn(u,"toggle"):l.shiftKey?this.grid.selectColumn(u,"range"):this.grid.selectColumn(u,"replace"),this.render(),requestAnimationFrame(()=>{const h=this.shadow.querySelector(".wg");h==null||h.focus({preventScroll:!0})})}}),o.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),o.addEventListener("change",n=>{const l=n.target;l.matches(".wg__editor--checkbox")&&hs(this,l)}),o.addEventListener("input",n=>{const l=n.target;l.matches(".wg__combobox-input")?zs(this,n):l.matches(".wg__autocomplete-input")&&Os(this,n)}),this.focusEventsSubscribed||(this.focusEvents.subscribe("blur",(n,l)=>{this.focusEvents.shouldSkipBlur()||!l||!this.shadow.contains(l)||(n.matches(".wg__editor--text, .wg__editor--number")?ws(this,n):n.matches(".wg__date-input")?this.datepicker||this.commitDateEditor(n):n.matches(".wg__select-trigger")?this.handleSelectBlur(l):n.matches(".wg__combobox-input, .wg__autocomplete-input")&&this.handleComboboxBlur(n))}),this.focusEventsSubscribed=!0);const i=this.shadow.querySelector(".wg"),r=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||i;if(i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const l=this.grid.selectedRows,a=this.grid.selectedColumns,d=!!this.grid.selectedCellRange;if(l.length===0&&a.length===0&&!d||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.selectedCellRange?(this.grid.clearCellSelection(),Q()):a.length>0?this.grid.clearColumnSelection():this.grid.clearSelection();return}if((n.ctrlKey||n.metaKey)&&n.key==="c"){n.preventDefault(),d?this.grid.copyCellSelectionToClipboard():a.length>0?this.grid.copySelectedColumnsToClipboard():l.length>0&&this.grid.copySelectedRowsToClipboard();return}const u=this.grid.rangeShortcuts;if(u!=null&&u.length)for(const h of u){const g=pt(h.key);if(mt(n,g)){const f=d?{rows:[],rowIndices:[],cellRange:this.grid.selectedCellRange,cells:this.grid.getSelectedCells()}:{rows:this.grid.getSelectedRowsData(),rowIndices:l};if(!(typeof h.disabled=="function"?h.disabled(f):h.disabled===!0)){n.preventDefault(),h.action(f);return}}}}),this.scrollEvents.init(r),this.scrollEvents.subscribe("container",()=>{const n=r.scrollLeft>0;i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&this.handleScrollCloseDropdown(),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(r),this.grid.isInfiniteScrollEnabled&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(r),Ye()!==null&&(ai(this,this.grid.displayItems),this.renderConnector()),Ht(this),this.grid.selectedCellRange&&Xi(this),xl(this)}),this.scrollEvents.subscribe("window",()=>{this.dropdownOpen&&!this.isTransitioningCells&&this.handleScrollCloseDropdown(),Ye()!==null&&this.closeToolbarAndReset()}),!this.clickEventsSubscribed)){const n=l=>{var d;const a=((d=this.datepicker)==null?void 0:d.getElement())??null;for(const c of l)if(a&&a===c||this.contextMenuElement&&this.contextMenuElement===c||this.headerContextMenuElement&&this.headerContextMenuElement===c)return!0;return!1};this.clickEvents.init(i,this,n),this.clickEvents.subscribe("outsideClick",()=>{let l=!1;if(this.grid.focusedCell){const{rowIndex:a,colIndex:d}=this.grid.focusedCell,c=this.shadow.querySelector(`.wg__cell[data-row="${a}"][data-col="${d}"]`);c==null||c.classList.remove("wg__cell--focused","wg__cell--always-edit-focused"),this.grid.clearFocusedCell()}if(this.grid.focusedRowIndex!==null&&(this.grid.clearRowFocus(),l=!0),this.dropdownOpen||this.grid.editingCell){const a=this.grid.editingCell,d=a?this.grid.columns.findIndex(c=>String(c.field)===a.field):-1;V(this),G(this),this.grid.cancelEdit(),a&&d>=0&&O(this,a.rowIndex,d)}this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q(),l=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),l=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),l=!0),l&&this.render()}),this.clickEvents.subscribe("sortClick",l=>{zi()||(this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q()),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),it()),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),rt()),Gs(this,l.event,l.field),this.render())}),this.clickEventsSubscribed=!0}o.addEventListener("mouseenter",n=>{const l=n.target,a=l.closest("[data-tooltip-html]");if(a){const c=a.getAttribute("data-tooltip-html");xo(this,a,c,this._tooltipShowDelay,!0);return}const d=l.closest("[data-tooltip]");if(d){const c=d.getAttribute("data-tooltip");xo(this,d,c,this._tooltipShowDelay,!1)}},!0),o.addEventListener("mouseleave",n=>{const l=n,a=l.target,d=l.relatedTarget,c=a.closest("[data-tooltip], [data-tooltip-html]");c&&(d==null?void 0:d.closest("[data-tooltip], [data-tooltip-html]"))===c||c&&Ft(this,this._tooltipHideDelay)},!0),o.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const d=parseInt(a.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${d}"]`);c&&(uo(d)?this.closeToolbarAndReset():this.showToolbarForRow(c,d))}}),o.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const d=a.dataset.actionId,c=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(d,c,n,a)}}),o.addEventListener("mouseenter",n=>{const l=n,d=l.target.closest(".wg__row");if(d){const c=parseInt(d.dataset.rowIndex||"0",10);this.grid.setHoveredRow(c),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),uo(c)||this.showToolbarForRow(d,c,l.clientX))}},!0),o.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{o.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const c=this.shadow.querySelector(".wg__toolbar-container"),u=c==null?void 0:c.matches(":hover"),h=o.matches(":hover");!u&&!h&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),o.addEventListener("mousemove",n=>{const l=n,a=l.target,d=a.closest(".wg__row");if(!d)return;const c=parseInt(d.dataset.rowIndex||"0",10);if(!(Ye()!==c||this.grid.toolbarPosition!=="top")){if(this.grid.toolbarFollowsCursor&&!this.grid.cellToolbar&&this.grid.toolbarColumn===void 0){const h=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(h){const g=h.getBoundingClientRect(),f=go(g,this.grid.cellToolbarOffset);ho(f,d,"start")}else ho(l.clientX)}if(this.grid.cellToolbar){const h=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(h){const g=h.dataset.field||"",f=this.grid.visualColumns.findIndex(p=>String(p.column.field)===g);if(!this.hoveredCell||this.hoveredCell.rowIndex!==c||this.hoveredCell.field!==g){this.hoveredCell={rowIndex:c,colIndex:f,field:g};const p=this.grid.displayItems[c];if(p){const _=this.grid.cellToolbar(p,c,g,f)||this.grid.rowToolbar,y=JSON.stringify(_);y!==this.currentCellToolbarItems&&(this.currentCellToolbarItems=y,this.updateToolbarWithCellItems(c,_));const C=h.getBoundingClientRect(),S=go(C,this.grid.cellToolbarOffset);ho(S,d,"start")}}}}}}),o.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const l=n,a=l.target,d=a.closest(".wg__row");if(d&&!a.closest(".wg__cell--editing")){const c=parseInt(d.dataset.rowIndex||"0",10);uo(c)?this.closeToolbarAndReset():this.showToolbarForRow(d,c,l.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!li(this.shadow))return;const l=n.composedPath(),a=l.some(u=>{var h;return(h=u.classList)==null?void 0:h.contains("wg__toolbar-container")}),d=l.some(u=>{var h;return(h=u.classList)==null?void 0:h.contains("wg__toolbar-trigger")});a||d||l.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Ye()!==null&&this.closeToolbarAndReset()}));const s=this.shadow.querySelector(".wg");s&&(s.addEventListener("click",n=>{n.target.closest(".wg__pagination-btn")&&Qs(this,n)&&this.render()}),s.addEventListener("change",n=>{const l=n.target;l.matches(".wg__pagination-select")&&Js(this,l)&&this.render()}))}scrollToRowProgrammatically(o){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:s,endIndex:n}=js({targetRow:o,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(s!==this.virtualScrollStart||n!==this.virtualScrollEnd)&&(this.virtualScrollStart=s,this.virtualScrollEnd=n,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(o){var s;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=Ks({scrollTop:o.scrollTop,viewportHeight:o.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(s=this.grid.editingCell)==null?void 0:s.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(o))}renderVirtualRows(o){const i=o.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,s={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},n=this.grid.focusedCell;if(i.innerHTML=ui(this,s),n){this.grid.setFocusedCell(n.rowIndex,n.colIndex);const l=i.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);l&&(l.focus({preventScroll:!0}),ee(this,null,n))}}handleInfiniteScroll(o){Xs(o.scrollTop,o.scrollHeight,o.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var n,l,a;if(!this.grid.isShortcutsHelpVisible||!((n=this.grid.rowShortcuts)!=null&&n.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
661
+ `)}else if(t.grid.focusedCell){const{rowIndex:r,colIndex:s}=t.grid.focusedCell,n=t.grid.displayItems[r],l=t.grid.columns[s];if(n&&l){const a=n[String(l.field)];e=Ut(a)}}if(e)try{await navigator.clipboard.writeText(e)}catch{console.warn("Failed to copy to clipboard")}}function Ut(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}const fa={handles:["openContextMenu","closeContextMenu"],execute(t,e){switch(e.type){case"openContextMenu":wa(t,e);break;case"closeContextMenu":pa(t);break}}};function wa(t,e){e.target&&t.dispatch({type:"focusCell",target:e.target,selectText:!1})}function pa(t){t.contextMenuElement&&(ce(t.contextMenuElement),t.contextMenuElement=null),t.headerContextMenuElement&&(ce(t.headerContextMenuElement),t.headerContextMenuElement=null)}const ma={handles:["startFillDrag","updateFillDrag","completeFillDrag"],execute(t,e){switch(e.type){}}},ba={handles:["startCellSelection"],execute(t,e){if(e.type==="startCellSelection")return _a(t,e)}};function _a(t,e){Vi(t,e.rowIndex,e.colIndex,{clientX:e.clientX,clientY:e.clientY,shiftKey:e.shiftKey})}const va={handles:["resetState"],execute(t,e){if(e.type==="resetState")return ya(t,e)}};function ya(t,e){const o=e.edit!==!1,i=e.selections!==!1,r=e.overlays!==!1,s=e.focus===!0,n=[];return r&&((t.contextMenuElement||t.headerContextMenuElement)&&n.push({type:"closeContextMenu"}),t.datepicker&&n.push({type:"closeDatePicker"})),o&&t.grid.editingCell&&n.push({type:"cancelEdit"}),i&&(t.grid.selectedRows.length>0||t.grid.selectedColumns.length>0||t.grid.selectedCellRange)&&n.push({type:"clearSelection"}),s&&t.grid.focusedCell&&n.push({type:"blurCell"}),n}const Ca={handles:["openCustomEditor"],execute(t,e){if(e.type!=="openCustomEditor")return;const{rowIndex:o,colIndex:i}=e.target;t.openCustomEditor(o,i)}};function Eo(t,e){const{currentCell:o,dropdownOpen:i,isDropdownEditor:r}=e;if(!o)return null;const s=t.ctrlKey||t.metaKey;if(i)switch(t.key){case"ArrowUp":return{type:"dropdownNavigate",direction:"up"};case"ArrowDown":return{type:"dropdownNavigate",direction:"down"};case"ArrowLeft":case"ArrowRight":return e.editorType==="autocomplete"?null:{type:"noop"};case"Home":return e.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"home"};case"End":return e.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"end"};case"PageUp":return{type:"dropdownNavigate",direction:"page-up"};case"PageDown":return{type:"dropdownNavigate",direction:"page-down"};case"Enter":return{type:"dropdownSelect",moveAfterSelect:!0,commitEmptyRow:!0};case"Tab":return{type:"dropdownSelect",moveAfterSelect:!1,commitEmptyRow:!1,thenNavigate:t.shiftKey?"tab-back":"tab"};case"Escape":return{type:"escapeEdit",phase:"dropdown"}}if(t.key==="Escape")return{type:"escapeEdit",phase:"edit"};if(e.isCheckboxEditor){if(t.key===" ")return{type:"toggleCheckbox",target:o};if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")return{type:"noop"}}if(r&&!i)switch(t.key){case" ":case"F2":return{type:"openDropdown"};case"Enter":return{type:"openDropdown"}}let n=null;switch(t.key){case"Tab":n=t.shiftKey?"tab-back":"tab";break;case"Enter":n="enter";break;case"ArrowUp":n="up";break;case"ArrowDown":n="down";break;case"ArrowLeft":n="left";break;case"ArrowRight":n="right";break;case"Home":n="home";break;case"End":n="end";break;case"PageUp":n="page-up";break;case"PageDown":n="page-down";break;default:return null}return n?{type:"navigate",direction:n,from:o,ctrlKey:s}:null}function ar(t,e,o,i=!1){return!!(["Tab","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(t)||t==="Escape"||o&&!e&&(t===" "||t==="F2")||i&&t===" ")}function dr(t,e){const{cell:o,dropdownOpen:i,isToggleClick:r,isDateTriggerClick:s,isCheckboxClick:n,isCellClick:l}=e,a=[];if(n)return a.push({type:"toggleCheckbox",target:o}),a;if(s)return a.push({type:"focusCell",target:o,selectText:!1}),a.push({type:"startEdit",target:o}),a.push({type:"toggleDatePicker"}),a;i&&!r&&a.push({type:"closeDropdown"});const{isDropdownEditor:d}=e,c=!r&&(!l||d);return a.push({type:"focusCell",target:o,selectText:c}),r&&(i?a.push({type:"closeDropdown"}):(a.push({type:"startEdit",target:o}),a.push({type:"openDropdown"}))),a}class Sa{constructor(e){b(this,"pipeline");b(this,"ctx");this.ctx=e,this.pipeline=Al(e),this.pipeline.registerExecutor(Ll),this.pipeline.registerExecutor(Hl),this.pipeline.registerExecutor(Vl),this.pipeline.registerExecutor(Bl),this.pipeline.registerExecutor(Ul),this.pipeline.registerExecutor(Xl),this.pipeline.registerExecutor(Ql),this.pipeline.registerExecutor(oa),this.pipeline.registerExecutor(aa),this.pipeline.registerExecutor(ua),this.pipeline.registerExecutor(fa),this.pipeline.registerExecutor(ma),this.pipeline.registerExecutor(ba),this.pipeline.registerExecutor(va),this.pipeline.registerExecutor(Ca),this.pipeline.registerExecutor(jl)}getEditTrigger(e){const o=this.ctx.grid.columns[e];return o?o.editTrigger??this.ctx.grid.editTrigger:"navigate"}isAlwaysMode(e){return this.ctx.grid.isEditable?this.getEditTrigger(e)==="always":!1}isEditingCell(e,o){const i=this.ctx.grid.editingCell;if(!i)return!1;const r=this.ctx.grid.columns[o];return r?i.rowIndex===e&&i.field===String(r.field):!1}isDropdownEditor(e){const o=this.ctx.grid.columns[e];if(!o)return!1;const i=o.editor;return i==="select"||i==="combobox"||i==="autocomplete"}isCheckboxEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="checkbox":!1}isDateEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="date":!1}isCustomEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="custom":!1}getDropdownEditorType(e){const o=this.ctx.grid.columns[e];if(!o)return;const i=o.editor;if(i==="select"||i==="combobox"||i==="autocomplete")return i}getCellFromTarget(e){const o=e.closest(".wg__cell");if(!o)return null;const i=parseInt(o.dataset.row||"",10),r=parseInt(o.dataset.col||"",10);return isNaN(i)||isNaN(r)?null:{rowIndex:i,colIndex:r}}tryHandleKeyDown(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||this.ctx.datepicker&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key))return!1;const r=this.getEditTrigger(i.colIndex),s=this.isAlwaysMode(i.colIndex),n=this.isEditingCell(i.rowIndex,i.colIndex),l=this.ctx.dropdownOpen,a=this.isDropdownEditor(i.colIndex),d=this.isCheckboxEditor(i.colIndex),c=this.isDateEditor(i.colIndex);if(s){if(!ar(e.key,l,a,d))return!1;const h=Eo(e,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return h?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(h),!0):!1}if(n){const h=e.key==="ArrowLeft"||e.key==="ArrowRight";if(h&&r==="navigate"&&a)return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:e.key==="ArrowLeft"?"left":"right",from:i}),!0;if(e.key==="Tab"&&r==="navigate"&&l)return e.preventDefault(),e.stopPropagation(),this.ctx.dropdownUserInteracted?this.pipeline.dispatch({type:"dropdownSelect",moveAfterSelect:!1,thenNavigate:e.shiftKey?"tab-back":"tab"}):(this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:e.shiftKey?"tab-back":"tab",from:i})),!0;if(!ar(e.key,l,a,d)||!a&&!d&&!c&&h&&!l)return!1;const w=Eo(e,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return w?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(w),!0):!1}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"].includes(e.key)){const h=Eo(e,{currentCell:i,dropdownOpen:!1,isDropdownEditor:!1,isCheckboxEditor:!1});return h?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(h),!0):!1}if(e.key==="F2"){const h=this.isCustomEditor(i.colIndex);return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):h&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}if(e.key==="Enter"){if(c)return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(a){const h=this.ctx.grid.columns[i.colIndex];return h&&this.ctx.grid.getEffectiveShouldOpenDropdownOnEnter(h)?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDropdown"}),!0):!1}return!1}if(e.key===" "){const h=this.isCustomEditor(i.colIndex);if(a||c||d||h)return e.preventDefault(),e.stopPropagation(),d?this.pipeline.dispatch({type:"toggleCheckbox",target:i}):(this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):h&&this.pipeline.dispatch({type:"openCustomEditor",target:i})),!0}if(e.key==="Delete")return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"deleteCell",target:i}),!0;if((e.ctrlKey||e.metaKey)&&e.key==="c")return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"copy"}),!0;if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault(),e.stopPropagation();const h=this.isCustomEditor(i.colIndex);return this.pipeline.dispatch({type:"startEdit",target:i,initialSearchQuery:e.key}),a?this.pipeline.dispatch({type:"openDropdown"}):h&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}return!1}tryHandleFocus(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||!this.isAlwaysMode(i.colIndex)||!o.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger"))return!1;const s=this.ctx.grid.focusedCell;return(!s||s.rowIndex!==i.rowIndex||s.colIndex!==i.colIndex)&&this.pipeline.dispatch({type:"focusCell",target:i,selectText:!1}),!0}tryHandleMouseDown(e){const o=e.target,i=o.matches(".wg__combobox-toggle, .wg__select-toggle"),r=!!o.closest(".wg__date-trigger"),s=o.matches('.wg__checkbox-input, input[type="checkbox"]'),n=!i&&!r&&!s&&(o.matches(".wg__cell")||o.closest(".wg__cell")!==null);let l=null;if(i){const w=o.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete")||o.closest(".wg__cell-dropdown-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",_=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&_>=0&&(l={rowIndex:p,colIndex:_})}}else if(r){const w=o.closest(".wg__editor--date")||o.closest(".wg__cell-date-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",_=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&_>=0&&(l={rowIndex:p,colIndex:_})}}else l=this.getCellFromTarget(o);if(!l)return!1;this.ctx.grid.tabTraversalStartColIndex=null;const a=this.isAlwaysMode(l.colIndex),d=this.isEditingCell(l.rowIndex,l.colIndex);if(!i&&!r&&!s&&!n)return!1;const c=this.ctx.grid.cellSelectionMode,u=e.shiftKey;if(c==="shift"&&u&&n)return this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:e.clientX,clientY:e.clientY,shiftKey:!0}),e.preventDefault(),!0;if(a||d){const w=o.matches(".wg__editor--text, .wg__editor--number, .wg__date-input"),p=o.matches(".wg__combobox-input, .wg__autocomplete-input"),m=this.ctx.grid.focusedCell,_=m&&m.rowIndex===l.rowIndex&&m.colIndex===l.colIndex;if((w||p)&&_&&n)return!0;const y=n&&this.ctx.grid.selectedCellRange;n&&(y||this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0)&&(y&&(this.ctx.isTransitioningCells=!0),this.pipeline.dispatch({type:"clearSelection"}));const S=this.ctx.dropdownOpen,v=this.isDropdownEditor(l.colIndex),x=dr(e,{cell:l,dropdownOpen:S,isDropdownEditor:v,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(x.length===0)return y&&(this.ctx.isTransitioningCells=!1),!1;w||(e.preventDefault(),e.stopPropagation());for(const k of x)this.pipeline.dispatch(k);return y&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}if(i)return e.preventDefault(),e.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDropdown"}),!0;if(r)return e.preventDefault(),e.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(n&&!i&&!s){e.preventDefault(),this.ctx.grid.editingCell&&(this.ctx.isTransitioningCells=!0,this.pipeline.dispatch({type:this.ctx.grid.shouldCommitOnClickAway?"commitEdit":"cancelEdit"})),(this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0||this.ctx.grid.selectedCellRange)&&this.pipeline.dispatch({type:"clearSelection"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1});const w=this.ctx.grid.cellSelectionMode,p=e.shiftKey;return w!=="disabled"&&(w==="click"&&!p||w==="shift"&&p)&&this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:e.clientX,clientY:e.clientY,shiftKey:e.shiftKey}),this.ctx.isTransitioningCells&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}const h=this.ctx.dropdownOpen,g=this.isDropdownEditor(l.colIndex),f=dr(e,{cell:l,dropdownOpen:h,isDropdownEditor:g,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(f.length===0)return!1;e.preventDefault(),e.stopPropagation();for(const w of f)this.pipeline.dispatch(w);return!0}tryHandleClick(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||this.getEditTrigger(i.colIndex)!=="click"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex);(s||n||l)&&e.stopImmediatePropagation();const a=o.closest(".wg__cell"),d=a?tt(e,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}tryHandleDblClick(e){const o=e.target,i=this.getCellFromTarget(o);if(!i)return!1;const r=this.getEditTrigger(i.colIndex);if(r!=="dblclick"&&r!=="navigate"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex),a=o.closest(".wg__cell"),d=a?tt(e,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}isDatepickerOpen(){return!!this.ctx.datepicker}clearSelection(){this.pipeline.dispatch({type:"clearSelection"})}}function xa(t){return new Sa(t)}class Ro extends HTMLElement{constructor(){super();b(this,"grid");b(this,"shadow");b(this,"styleElement");b(this,"customStyleElement",null);b(this,"updatePending",!1);b(this,"isCommittingFromKeyboard",!1);b(this,"isTransitioningCells",!1);b(this,"toolbarOutsideClickAdded",!1);b(this,"clickEventsSubscribed",!1);b(this,"focusEventsSubscribed",!1);b(this,"toolbarMoveInProgress",!1);b(this,"toolbarHideTimeout",null);b(this,"toolbarHovered",!1);b(this,"toolbarShortcutHandler",null);b(this,"hoveredCell",null);b(this,"currentCellToolbarItems",null);b(this,"toolbarMousemoveHandler",null);b(this,"inlineShortcutHandler",null);b(this,"dropdownOpen",!1);b(this,"dropdownOptions",[]);b(this,"highlightedIndex",-1);b(this,"filterText","");b(this,"isUserFiltering",!1);b(this,"justSelected",!1);b(this,"isOpeningDropdown",!1);b(this,"dropdownUserInteracted",!1);b(this,"isClosingViaToggle",!1);b(this,"isProgrammaticScroll",!1);b(this,"searchDebounceTimer",null);b(this,"searchAbortController",null);b(this,"isSearching",!1);b(this,"tooltipElement",null);b(this,"tooltipArrowElement",null);b(this,"tooltipAnchor",null);b(this,"tooltipShowTimer",null);b(this,"tooltipHideTimer",null);b(this,"_tooltipShowDelay",200);b(this,"_tooltipHideDelay",100);b(this,"datepicker",null);b(this,"contextMenuElement",null);b(this,"headerContextMenuElement",null);b(this,"virtualScrollStart",0);b(this,"virtualScrollEnd",0);b(this,"isLoadingMoreItems",!1);b(this,"scrollEvents");b(this,"focusEvents");b(this,"clickEvents");b(this,"pipelineAdapter",null);b(this,"_isMouseDown",!1);b(this,"handlePaste",async o=>{var l;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,s=((l=o.clipboardData)==null?void 0:l.getData("text"))||"";if(!s)return;if(s.includes(" ")||s.includes(`
662
+ `))o.preventDefault(),await $l(this,s,i,r),this.render();else{const a=this.grid.columns[r],d=this.grid.displayItems[i];if(!a||!d||!this.grid.isCellEditable(a,d))return;o.preventDefault();let c=s;a.beforePasteCallback&&(c=a.beforePasteCallback(s,d));const u=String(a.field);await this.grid.commitEdit(i,u,c),this.render()}});this.shadow=this.attachShadow({mode:"open"}),this.grid=new ni,Object.defineProperty(this,"onpaste",{configurable:!0,enumerable:!0,get:()=>this.grid.onpaste,set:o=>{this.grid.onpaste=o}}),this.scrollEvents=gl(),this.clickEvents=hl(),this.focusEvents=ul(()=>({isCommittingFromKeyboard:this.isCommittingFromKeyboard,isTransitioningCells:this.isTransitioningCells,isClosingViaToggle:this.isClosingViaToggle,isOpeningDropdown:this.isOpeningDropdown}),()=>{this.isClosingViaToggle=!1}),this.styleElement=document.createElement("style"),this.styleElement.textContent=Xn,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>{this.grid.invalidateDisplayCache(),this.requestUpdate()},this.grid._onInteractionChange=(o,i)=>{o==="editingCell"&&i.current===null&&V(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(o){this._tooltipShowDelay=o}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(o){this._tooltipHideDelay=o}connectedCallback(){ao.debug("connectedCallback — grid attached to DOM"),this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.pipelineAdapter=xa(this),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){ao.debug("disconnectedCallback — grid removed from DOM"),this.scrollEvents.destroy(),this.focusEvents.destroy(),this.clickEvents.destroy(),this.clickEventsSubscribed=!1,this.focusEventsSubscribed=!1,this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null),At(),this.removeInlineShortcuts(),kl()}get items(){return this.grid.items}set items(o){this.grid.items=o,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(o){this.grid.columns=o}get isFilterable(){return this.grid.isFilterable}set isFilterable(o){this.grid.isFilterable=o}get onfilterchange(){return this.grid.onfilterchange}set onfilterchange(o){this.grid.onfilterchange=o}get columnMinWidth(){return this.grid.columnMinWidth}set columnMinWidth(o){this.grid.columnMinWidth=o}get filters(){return this.grid.filters}set filters(o){this.grid.filters=o}setFilter(o,i){this.grid.setFilter(o,i)}get isPageable(){return this.grid.isPageable}set isPageable(o){this.grid.isPageable=o}get pageSize(){return this.grid.pageSize}set pageSize(o){this.grid.pageSize=o}get pageSizes(){return this.grid.pageSizes}set pageSizes(o){this.grid.pageSizes=o}get paginationMode(){return this.grid.paginationMode}set paginationMode(o){this.grid.paginationMode=o}get isStriped(){return this.grid.isStriped}set isStriped(o){this.grid.isStriped=o}get isHoverable(){return this.grid.isHoverable}set isHoverable(o){this.grid.isHoverable=o}get isEditable(){return this.grid.isEditable}set isEditable(o){this.grid.isEditable=o}get isRowEditable(){return this.grid.isRowEditable}set isRowEditable(o){this.grid.isRowEditable=o}get editTrigger(){return this.grid.editTrigger}set editTrigger(o){this.grid.editTrigger=o}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(o){this.grid.editStartSelection=o}get shouldCommitOnClickAway(){return this.grid.shouldCommitOnClickAway}set shouldCommitOnClickAway(o){this.grid.shouldCommitOnClickAway=o}get mode(){return this.grid.mode}set mode(o){this.grid.mode=o}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(o){this.grid.dropdownToggleVisibility=o}get shouldShowDropdownOnFocus(){return this.grid.shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(o){this.grid.shouldShowDropdownOnFocus=o}get shouldOpenDropdownOnEnter(){return this.grid.shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(o){this.grid.shouldOpenDropdownOnEnter=o}get isCheckboxAlwaysEditable(){return this.grid.isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(o){this.grid.isCheckboxAlwaysEditable=o}get isRowNumbersVisible(){return this.grid.isRowNumbersVisible}set isRowNumbersVisible(o){this.grid.isRowNumbersVisible=o}get isDirtyIndicatorVisible(){return this.grid.isDirtyIndicatorVisible}set isDirtyIndicatorVisible(o){this.grid.isDirtyIndicatorVisible=o}isCellDirty(o,i){return this.grid.isCellDirty(o,i)}isRowDirty(o){return this.grid.isRowDirty(o)}get isStickyRowNumbers(){return this.grid.isStickyRowNumbers}set isStickyRowNumbers(o){this.grid.isStickyRowNumbers=o}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(o){this.grid.freezeColumns=o}get invalidCells(){return this.grid.invalidCells}set invalidCells(o){this.grid.invalidCells=o}get isRowToolbarVisible(){return this.grid.isRowToolbarVisible}set isRowToolbarVisible(o){this.grid.isRowToolbarVisible=o}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(o){this.grid.rowToolbar=o}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(o){this.grid.toolbarHorizontalAlign=o}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(o){this.grid.toolbarHorizontalAlign=o}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(o){this.grid.toolbarTrigger=o}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(o){this.grid.toolbarPosition=o}get toolbarColumn(){return this.grid.toolbarColumn}set toolbarColumn(o){this.grid.toolbarColumn=o}get toolbarFollowsCursor(){return this.grid.toolbarFollowsCursor}set toolbarFollowsCursor(o){this.grid.toolbarFollowsCursor=o}get cellToolbar(){return this.grid.cellToolbar}set cellToolbar(o){this.grid.cellToolbar=o}get cellToolbarOffset(){return this.grid.cellToolbarOffset}set cellToolbarOffset(o){this.grid.cellToolbarOffset=o}get toolbarBtnMinWidth(){return this.grid.toolbarBtnMinWidth}set toolbarBtnMinWidth(o){this.grid.toolbarBtnMinWidth=o}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(o){this.grid.inlineActionsTitle=o}get contextMenu(){return this.grid.contextMenu}set contextMenu(o){this.grid.contextMenu=o}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(o){this.grid.contextMenuXOffset=o}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(o){this.grid.contextMenuYOffset=o}get headerContextMenu(){return this.grid.headerContextMenu}set headerContextMenu(o){this.grid.headerContextMenu=o}set onheadercontextmenuopen(o){this.grid.onheadercontextmenuopen=o}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(o){this.grid.rowShortcuts=o}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(o){this.grid.rangeShortcuts=o}get selectedRows(){return this.grid.selectedRows}selectRow(o,i="replace"){this.grid.selectRow(o,i)}selectRowRange(o,i){this.grid.selectRowRange(o,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(o){return this.grid.isRowSelected(o)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}copySelectedRowsToClipboard(){return this.grid.copySelectedRowsToClipboard()}get cellSelectionMode(){return this.grid.cellSelectionMode}set cellSelectionMode(o){this.grid.cellSelectionMode=o}get selectedCellRange(){return this.grid.selectedCellRange}selectCellRange(o){this.grid.selectCellRange(o)}clearCellSelection(){this.grid.clearCellSelection()}getSelectedCells(){return this.grid.getSelectedCells()}copyCellSelectionToClipboard(){return this.grid.copyCellSelectionToClipboard()}get shouldCopyWithHeaders(){return this.grid.shouldCopyWithHeaders}set shouldCopyWithHeaders(o){this.grid.shouldCopyWithHeaders=o}get oncellselectionchange(){return this.grid.oncellselectionchange}set oncellselectionchange(o){this.grid.oncellselectionchange=o}get isNewRowEnabled(){return this.grid.isNewRowEnabled}set isNewRowEnabled(o){this.grid.isNewRowEnabled=o}get newRowPosition(){return this.grid.newRowPosition}set newRowPosition(o){this.grid.newRowPosition=o}get newRowIndicator(){return this.grid.newRowIndicator}set newRowIndicator(o){this.grid.newRowIndicator=o}get createEmptyRowCallback(){return this.grid.createEmptyRowCallback}set createEmptyRowCallback(o){this.grid.createEmptyRowCallback=o}get idMember(){return this.grid.idMember}set idMember(o){this.grid.idMember=o}get treePathMember(){return this.grid.treePathMember}set treePathMember(o){this.grid.treePathMember=o}get treeLevelMember(){return this.grid.treeLevelMember}set treeLevelMember(o){this.grid.treeLevelMember=o}get treeParentMember(){return this.grid.treeParentMember}set treeParentMember(o){this.grid.treeParentMember=o}get treeSeparator(){return this.grid.treeSeparator}set treeSeparator(o){this.grid.treeSeparator=o}get treeDataSorted(){return this.grid.treeDataSorted}set treeDataSorted(o){this.grid.treeDataSorted=o}get expandedPaths(){return this.grid.expandedPaths}set expandedPaths(o){this.grid.expandedPaths=o}get defaultExpandDepth(){return this.grid.defaultExpandDepth}set defaultExpandDepth(o){this.grid.defaultExpandDepth=o}set onexpandedpathschange(o){this.grid.onexpandedpathschange=o}get onexpandedpathschange(){return this.grid.onexpandedpathschange}isPathExpanded(o){return this.grid.isPathExpanded(o)}toggleExpandedPath(o){this.grid.toggleExpandedPath(o)}expandAll(){this.grid.expandAll()}collapseAll(){this.grid.collapseAll()}get treeDoubleClickBehavior(){return this.grid.treeDoubleClickBehavior}set treeDoubleClickBehavior(o){this.grid.treeDoubleClickBehavior=o}get treeExpandedGlyph(){return this.grid.treeExpandedGlyph}set treeExpandedGlyph(o){this.grid.treeExpandedGlyph=o}get treeCollapsedGlyph(){return this.grid.treeCollapsedGlyph}set treeCollapsedGlyph(o){this.grid.treeCollapsedGlyph=o}get treeChevronCallback(){return this.grid.treeChevronCallback}set treeChevronCallback(o){this.grid.treeChevronCallback=o}get isShortcutsHelpVisible(){return this.grid.isShortcutsHelpVisible}set isShortcutsHelpVisible(o){this.grid.isShortcutsHelpVisible=o}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(o){this.grid.shortcutsHelpPosition=o}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(o){this.grid.shortcutsHelpContentCallback=o}set onrowchange(o){this.grid.onrowchange=o}set onroweditstart(o){this.grid.onroweditstart=o}set onroweditcancel(o){this.grid.onroweditcancel=o}set onvalidationerror(o){this.grid.onvalidationerror=o}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(o){this.grid.validationTooltipCallback=o}set ontoolbarclick(o){this.grid.ontoolbarclick=o}set onrowaction(o){this.grid.onrowaction=o}get oncontextmenuopen(){return this.grid.oncontextmenuopen}set oncontextmenuopen(o){this.grid.oncontextmenuopen=o}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(o){this.grid.ondatarequest=o}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(o){this.grid.onrowdelete=o}get onrowfocus(){return this.grid.onrowfocus}set onrowfocus(o){this.grid.onrowfocus=o}get focusedRowIndex(){return this.grid.focusedRowIndex}set focusedRowIndex(o){this.grid.focusedRowIndex=o}get sort(){return this.grid.sort}set sort(o){this.grid.sort=o}get sortMode(){return this.grid.sortMode}set sortMode(o){this.grid.sortMode=o}get currentPage(){return this.grid.currentPage}set currentPage(o){this.grid.currentPage=o}get totalItems(){return this.grid.totalItems}set totalItems(o){this.grid.totalItems=o}get showPagination(){return this.grid.showPagination}set showPagination(o){this.grid.showPagination=o}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(o){this.grid.paginationPosition=o}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(o){this.grid.paginationLabelsCallback=o}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(o){this.grid.paginationLayout=o}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(o){this.grid.summaryPosition=o}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(o){this.grid.summaryContentCallback=o}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(o){this.grid.customStylesCallback=o,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(o){this.grid.rowClassCallback=o}get labels(){return this.grid.labels}set labels(o){this.grid.labels=o}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(o){this.grid.summaryMetadata=o}get isSummaryInline(){return this.grid.isSummaryInline}set isSummaryInline(o){this.grid.isSummaryInline=o}get idValueMember(){return this.grid.idValueMember}set idValueMember(o){this.grid.idValueMember=o}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(o){this.grid.idValueCallback=o}get rowLocking(){return this.grid.rowLocking}set rowLocking(o){this.grid.rowLocking=o}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(o){this.grid.onrowlockchange=o}get gridName(){return this.grid.gridName}set gridName(o){this.grid.gridName=o,this.tryLoadPersistedWidths()}get shouldPersistColumnWidths(){return this.grid.shouldPersistColumnWidths}set shouldPersistColumnWidths(o){this.grid.shouldPersistColumnWidths=o,this.tryLoadPersistedState()}get isColumnReorderAllowed(){return this.grid.isColumnReorderAllowed}set isColumnReorderAllowed(o){this.grid.isColumnReorderAllowed=o}get shouldPersistColumnOrder(){return this.grid.shouldPersistColumnOrder}set shouldPersistColumnOrder(o){this.grid.shouldPersistColumnOrder=o,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.shouldPersistColumnWidths||this.grid.shouldPersistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(o){this.grid.oncolumnresize=o}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(o){this.grid.oncolumnreorder=o}get fillDragCallback(){return this.grid.fillDragCallback}set fillDragCallback(o){this.grid.fillDragCallback=o}get isScrollable(){return this.grid.isScrollable}set isScrollable(o){this.grid.isScrollable=o}get scrollMaxHeight(){return this.grid.scrollMaxHeight}set scrollMaxHeight(o){this.grid.scrollMaxHeight=o}get tableBorderOnly(){return this.grid.tableBorderOnly}set tableBorderOnly(o){this.grid.tableBorderOnly=o}get isVirtualScrollEnabled(){return this.grid.isVirtualScrollEnabled}set isVirtualScrollEnabled(o){this.grid.isVirtualScrollEnabled=o}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(o){this.grid.virtualScrollThreshold=o}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(o){this.grid.virtualScrollRowHeight=o}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(o){this.grid.virtualScrollBuffer=o}get isInfiniteScrollEnabled(){return this.grid.isInfiniteScrollEnabled}set isInfiniteScrollEnabled(o){this.grid.isInfiniteScrollEnabled=o}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(o){this.grid.infiniteScrollThreshold=o}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(o){this.grid.hasMoreItems=o}get onbeforepaste(){return this.grid.onbeforepaste}set onbeforepaste(o){this.grid.onbeforepaste=o}get pasteMode(){return this.grid.pasteMode}set pasteMode(o){this.grid.pasteMode=o}get shouldValidateOnPaste(){return this.grid.shouldValidateOnPaste}set shouldValidateOnPaste(o){this.grid.shouldValidateOnPaste=o}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(o){return this.grid.getRowDraft(o)}hasRowDraft(o){return this.grid.hasRowDraft(o)}discardRowDraft(o){this.grid.discardRowDraft(o)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(o,i){return this.grid.isCellInvalid(o,i)}getCellValidationError(o,i){return this.grid.getCellValidationError(o,i)}getRowId(o){return this.grid.getRowId(o)}findRowById(o){return this.grid.findRowById(o)}isRowLocked(o){return this.grid.isRowLocked(o)}getRowLockInfo(o){return this.grid.getRowLockInfo(o)}lockRowById(o,i){return this.grid.lockRowById(o,i)}unlockRowById(o){return this.grid.unlockRowById(o)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(o,i){return this.grid.updateRowById(o,i)}replaceRowById(o,i){return this.grid.replaceRowById(o,i)}canEditCell(o,i){return this.grid.canEditCell(o,i)}setColumnWidth(o,i){this.grid.setColumnWidth(o,i)}setColumnWidths(o){this.grid.setColumnWidths(o)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(o){this.grid.setColumnOrder(o)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(o,i){const r=this.grid.columns,s=this.grid.displayItems;o<0||o>=s.length||i<0||i>=r.length||(this.grid.setFocusedCell(o,i),requestAnimationFrame(()=>{N(this,o,i)}))}startEditing(o,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const s=r[i],n=String(s.field);this.grid.startEdit(o,n);const l=this.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);l&&(l.classList.remove("wg__cell--focused"),l.classList.add("wg__cell--editing"),l.innerHTML=Ot(this,o,i,s))}escapeHtml(o){const i=document.createElement("div");return i.textContent=o,i.innerHTML}getCurrentEditingColumn(){const o=this.grid.editingCell;return o&&this.grid.columns.find(i=>String(i.field)===o.field)||null}getCurrentEditorOptions(){const o=this.getCurrentEditingColumn();return(o==null?void 0:o.editorOptions)||{}}moveFocusAfterCommit(o,i,r){_o(this,o,i,r)}requestUpdate(){if(this.updatePending)return;Ee.debug("requestUpdate: scheduling render"),this.updatePending=!0;const o=performance.now();queueMicrotask(()=>{this.updatePending=!1;const i=performance.now();$t.debug("microtask delay:",(i-o).toFixed(2),"ms"),this.render(),$t.debug("render() total:",(performance.now()-i).toFixed(2),"ms")})}updateCustomStyles(){const o=this.grid.customStylesCallback;if(o){const i=o();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(o,i,r){var h;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,n=this.grid.displayItems,l=n[i],a=this.grid.getEditableColumns(l),d=a.findIndex(g=>g.index===r);if((o.ctrlKey||o.metaKey)&&o.key==="c"){if(this.grid.selectedCellRange){o.preventDefault(),this.grid.copyCellSelectionToClipboard();return}const g=s[r],f=n[i];if(g&&f){let w=this.grid.getCellRawValue(f,i,String(g.field));g.beforeCopyCallback&&(w=g.beforeCopyCallback(w,f));const p=w!=null?String(w):"";navigator.clipboard.writeText(p)}return}const c=this.grid.selectedRows;if(c.length>0){const g=this.grid.rangeShortcuts;if(g&&g.length>0)for(const f of g){const w=pt(f.key);if(mt(o,w)){const p={rows:this.grid.getSelectedRowsData(),rowIndices:c};if(!(typeof f.disabled=="function"?f.disabled(p):f.disabled===!0)){o.preventDefault(),f.action(p);return}}}}const u=this.grid.rowShortcuts;if(u&&u.length>0){const g=s[r],f=n[i];if(g&&f)for(const w of u){const p=pt(w.key);if(mt(o,p)){const m={row:f,rowIndex:i,colIndex:r,column:g,cellValue:this.grid.getCellRawValue(f,i,String(g.field))};if(!(typeof w.disabled=="function"?w.disabled(m):w.disabled===!0)){o.preventDefault(),w.action(m);return}}}}switch(o.key){case"ArrowUp":o.preventDefault(),i>0&&N(this,i-1,r);break;case"ArrowDown":o.preventDefault(),i<n.length-1&&N(this,i+1,r);break;case"ArrowLeft":o.preventDefault(),r>0&&N(this,i,r-1);break;case"ArrowRight":o.preventDefault(),r<s.length-1&&N(this,i,r+1);break;case"Tab":{o.preventDefault();const g=o.shiftKey?"backward":"forward";let f=d;if(f===-1&&a.length>0)if(g==="forward"){const p=a.find(m=>m.index>r);if(p){N(this,i,p.index);break}f=a.length-1}else{const p=[...a].reverse().find(m=>m.index<r);if(p){N(this,i,p.index);break}f=0}const w=this.grid.findNextEditableCell(i,f,g);w?N(this,w.rowIndex,w.colIndex):g==="forward"&&this.grid.isEmptyRowIndex(i)&&a.length>0&&N(this,i,a[0].index);break}case"Home":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const f=this.shadow.querySelector('td[data-row="0"][data-col="0"]');f&&(f.focus({preventScroll:!0}),ee(this,g,{rowIndex:0,colIndex:0}))}else N(this,0,0);else N(this,i,0);break;case"End":if(o.preventDefault(),o.ctrlKey){const g=n.length-1,f=s.length-1;if(this.grid.shouldUseVirtualScroll()){const w=this.grid.focusedCell;this.grid.setFocusedCell(g,f),this.scrollToRowProgrammatically(g);const p=this.shadow.querySelector(`td[data-row="${g}"][data-col="${f}"]`);p&&(p.focus({preventScroll:!0}),ee(this,w,{rowIndex:g,colIndex:f}))}else N(this,g,f)}else N(this,i,s.length-1);break;case"PageUp":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const f=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),ee(this,g,{rowIndex:0,colIndex:r}))}else N(this,0,r);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);w&&(w.focus({preventScroll:!0}),ee(this,f,{rowIndex:g,colIndex:r}))}else N(this,g,r)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const g=n.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);w&&(w.focus({preventScroll:!0}),ee(this,f,{rowIndex:g,colIndex:r}))}else N(this,g,r)}else{const g=Math.min(n.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);w&&(w.focus({preventScroll:!0}),ee(this,f,{rowIndex:g,colIndex:r}))}else N(this,g,r)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{o.preventDefault();const g=s[r],f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",w=this.grid.isEmptyRowIndex(i);if(f&&this.grid.getEffectiveShouldOpenDropdownOnEnter(g))re(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||pe(this)});else if(w&&g&&this.grid.isCellEditable(g))re(this,i,r);else if(i<n.length-1){const p=this.grid.tabTraversalStartColIndex??r;this.grid.tabTraversalStartColIndex=null,N(this,i+1,p)}break}case"F2":{o.preventDefault();const g=s[r],f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",w=(g==null?void 0:g.editor)==="custom";re(this,i,r),f?requestAnimationFrame(()=>{this.dropdownOpen||pe(this)}):w&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{o.preventDefault();const g=s[r],f=(g==null?void 0:g.editor)==="checkbox",w=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",p=(g==null?void 0:g.editor)==="date",m=(g==null?void 0:g.editor)==="custom";f&&g&&this.grid.isCellEditable(g,n[i])?fs(this,i,r):w?(re(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||pe(this)})):p?(re(this,i,r),requestAnimationFrame(()=>{var S;const _=(S=this.shadowRoot)==null?void 0:S.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),y=_==null?void 0:_.querySelector(".wg__date-input"),C=_==null?void 0:_.querySelector(".wg__editor--date");y&&C&&this.openDatePicker(y,C)})):m&&(re(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)G(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),ee(this,g,null),(h=o.target)==null||h.blur()}break;case"Delete":{o.preventDefault();const g=s[r],f=n[i];if(o.ctrlKey){if(f){const w={rowIndex:i,row:f};this.grid.onrowdelete&&this.grid.onrowdelete(w),this.dispatchEvent(new CustomEvent("rowdelete",{detail:w}))}}else g&&this.grid.isCellEditable(g,f)&&(this.grid.commitEdit(i,String(g.field),null),this.render(),requestAnimationFrame(()=>{const w=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);w==null||w.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const g=s[r];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(o.key))return;re(this,i,r,{initialSearchQuery:o.key}),o.preventDefault()}break}}async handleEditorKeyDown(o,i){const r=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",n=this.grid.columns.find(c=>c.field===s),l=(n==null?void 0:n.editor)||"text",a=l==="select"||l==="combobox"||l==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&d.includes(o.key)){o.preventDefault(),o.stopPropagation();const c=this.grid.columns.findIndex(m=>m.field===s),u=this.grid.columns.map((m,_)=>({index:_,column:m})).filter(m=>m.column.isEditable!==!1),h=u.findIndex(m=>m.index===c),g=this.grid.displayItems;let f=r,w=c,p=!1;switch(o.key){case"ArrowUp":r>0&&(f=r-1,p=!0);break;case"ArrowDown":r<g.length-1&&(f=r+1,p=!0);break;case"ArrowLeft":h>0&&(w=u[h-1].index,p=!0);break;case"ArrowRight":h<u.length-1&&(w=u[h+1].index,p=!0);break;case"PageUp":f=Math.max(0,r-10),p=!0;break;case"PageDown":f=Math.min(g.length-1,r+10),p=!0;break;case"Home":o.ctrlKey&&(f=0),w=0,p=!0;break;case"End":o.ctrlKey?(f=g.length-1,w=this.grid.columns.length-1):w=this.grid.columns.length-1,p=!0;break}p&&(G(this),this.grid.cancelEdit(),queueMicrotask(()=>{N(this,f,w)}));return}switch(o.key){case"ArrowDown":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const m=this.getCurrentEditorOptions();let _=this.highlightedIndex+1;for(;_<this.dropdownOptions.length&&de(this.dropdownOptions[_],m);)_++;_<this.dropdownOptions.length&&(this.highlightedIndex=_,we(this),Co(this))}break;case"ArrowUp":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const m=this.getCurrentEditorOptions();let _=this.highlightedIndex-1;for(;_>=0&&de(this.dropdownOptions[_],m);)_--;_>=0&&(this.highlightedIndex=_,we(this),Co(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Ci(this,this.highlightedIndex,!0,!0):a&&!this.dropdownOpen?pe(this):(this.isCommittingFromKeyboard=!0,V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,!0):await zt(this,i,!0),_o(this,r,s,"down"));break;case"Tab":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.isCommittingFromKeyboard=!0;const c=this.grid.displayItems[r],u=this.grid.getEditableColumns(c),h=this.grid.columns.findIndex(m=>String(m.field)===s),g=u.findIndex(m=>m.index===h),f=this.grid.isEmptyRowIndex(r),w=g===u.length-1,p=f&&w&&!o.shiftKey;if(this.dropdownOpen&&this.highlightedIndex>=0&&a){const m=this.dropdownOptions[this.highlightedIndex],_=this.getCurrentEditorOptions();if(m&&!de(m,_)){const y=ze(m,_);await this.grid.commitEdit(r,s,y,p)}V(this)}else V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,p):a||await zt(this,i,p);if(p){Lt(this,r,h);const m=u.length>0?u[0].index:0;queueMicrotask(()=>{const _=this.grid.newRowPosition==="top"?0:this.grid.displayItems.length-1;N(this,_,m),this.isCommittingFromKeyboard=!1})}else _o(this,r,s,o.shiftKey?"prev":"next");break;case"Escape":if(o.preventDefault(),o.stopPropagation(),this.dropdownOpen){V(this),(l==="autocomplete"||l==="combobox")&&(this.filterText="",i instanceof HTMLInputElement&&(i.value="",i.focus()));return}if(this.datepicker){this.datepicker.close(!0),this.datepicker=null;return}this.isCommittingFromKeyboard=!0,G(this),this.grid.cancelEdit(),ps(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&pe(this);break;case"Backspace":l==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),Si(this,n.editorOptions||{})));break;default:l==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,Si(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("mousedown",()=>{this._isMouseDown=!0},!0),document.addEventListener("mouseup",()=>{this._isMouseDown=!1},!0),o.addEventListener("focus",n=>{const l=n.target;if(l.matches(".wg__cell")){const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10);if(cs(this,a,d),Ht(this),!this._isMouseDown&&!ko()&&!qi()){const c=this.grid.focusedRowIndex;this.grid.setFocusedRow(a),this.updateRowFocusVisual(c,a)}bo(this,l,a)}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.row||"0",10),c=parseInt(a.dataset.col||"0",10),u=this.grid.columns[c];if(((u==null?void 0:u.editTrigger)??this.grid.editTrigger)==="always"){const g=this.grid.focusedCell;if(!g||g.rowIndex!==d||g.colIndex!==c){if(this.grid.setFocusedCell(d,c),g){const f=this.shadow.querySelector(`td[data-row="${g.rowIndex}"][data-col="${g.colIndex}"]`);f&&f.classList.remove("wg__cell--always-edit-focused")}if(a.classList.add("wg__cell--always-edit-focused"),!this._isMouseDown){const f=this.grid.focusedRowIndex;this.grid.setFocusedRow(d),this.updateRowFocusVisual(f,d)}}}}}},!0),o.addEventListener("keydown",n=>{var d;const l=n.target,a=n;if(this.grid.isTreeMode&&this.grid.focusedCell&&!this.grid.editingCell&&(a.ctrlKey||a.metaKey)&&(a.key==="ArrowLeft"||a.key==="ArrowRight")){const{rowIndex:c,colIndex:u}=this.grid.focusedCell,h=this.grid.displayItems[c],g=h?this.grid.getRowTreeInfo(h):null;if(g){n.preventDefault(),n.stopPropagation();let f=null;if(a.key==="ArrowRight")g.hasChildren&&!this.grid.isPathExpanded(g.path)&&(this.grid.toggleExpandedPath(g.path),f=g.path);else if(g.hasChildren&&this.grid.isPathExpanded(g.path))this.grid.toggleExpandedPath(g.path),f=g.path;else{const w=this.grid.findNearestExpandedAncestor(g.path);w!==null&&(this.grid.toggleExpandedPath(w),f=w)}if(f!==null){const w=f;queueMicrotask(()=>{const p=this.grid.displayItems.findIndex(m=>{var _;return((_=this.grid.getRowTreeInfo(m))==null?void 0:_.path)===w});p>=0&&N(this,p,u)})}return}}if(!((d=this.pipelineAdapter)!=null&&d.tryHandleKeyDown(n))){if(this.datepicker){const c=n.key;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(c))return}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,l);return}if(l.matches(".wg__cell")){const c=parseInt(l.dataset.row||"0",10),u=parseInt(l.dataset.col||"0",10);this.handleCellKeyDown(n,c,u)}}}),this.focusEvents.init(o),this.focusEvents.subscribe("focusout",(n,l)=>{(!l||!o.contains(l))&&gs(this,{relatedTarget:l})}),o.addEventListener("dblclick",n=>{var d;const l=n.target;if((d=this.pipelineAdapter)!=null&&d.tryHandleDblClick(n))return;n.preventDefault();const a=l.closest(".wg__cell");if(a){const c=parseInt(a.dataset.row||"0",10),u=parseInt(a.dataset.col||"0",10),h=this.grid.columns[u];if(h){const g=h.editTrigger||this.grid.editTrigger;if(g==="dblclick"||g==="navigate"){const f=tt(n,a);re(this,c,u,{cursorPosition:f??void 0});const w=h.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||pe(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}}),Ee.debug("attaching click handler on table"),o.addEventListener("click",n=>{var c;const l=n.target;Ee.debug("CLICK fired | target:",l.tagName,l.className,"| connected:",l.isConnected);const a=l.closest(".wg__tree-chevron[data-tree-toggle]");if(a){n.preventDefault(),n.stopPropagation();const u=a.getAttribute("data-tree-toggle");Ee.debug("chevron click:",u,"| target:",l.tagName,l.className),u!==null&&this.grid.toggleExpandedPath(u);return}if((c=this.pipelineAdapter)!=null&&c.tryHandleClick(n))return;const d=l.closest(".wg__cell");if(d&&!d.classList.contains("wg__cell--editing")){const u=parseInt(d.dataset.row||"0",10),h=parseInt(d.dataset.col||"0",10),g=this.grid.columns[h];if(g&&(g.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const w=tt(n,d);re(this,u,h,{cursorPosition:w??void 0});const p=g.editor;p==="select"||p==="combobox"||p==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||pe(this)}):p==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(u,h)})}}}),o.addEventListener("mousedown",n=>{var h,g;const l=n.target,a=n;if(Ee.debug("MOUSEDOWN fired | target:",l.tagName,l.className,"| connected:",l.isConnected,"| detail:",a.detail,"| button:",a.button),l.closest(".wg__tree-chevron[data-tree-toggle]")){Ee.debug("chevron mousedown intercepted (suppress focus/selection)"),n.preventDefault(),n.stopPropagation();return}if(a.detail===2&&a.button===0&&this.grid.isTreeMode){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__tree-chevron")){const w=parseInt(f.dataset.col||"-1",10),p=parseInt(f.dataset.row||"-1",10),m=w>=0?this.grid.columns[w]:null;if(m!=null&&m.isTree&&p>=0){if(this.grid.treeDoubleClickBehavior==="toggle"){const y=this.grid.displayItems[p],C=y?this.grid.getRowTreeInfo(y):null;if(C!=null&&C.hasChildren){Ee.debug("tree dblclick (mousedown.detail=2) toggle:",C.path),n.preventDefault(),n.stopPropagation(),this.grid.toggleExpandedPath(C.path);return}}const _=m.editTrigger||this.grid.editTrigger;if((_==="dblclick"||_==="navigate")&&this.grid.canEditCell(p,String(m.field))){const y=tt(a,f);Ee.debug("tree dblclick (mousedown.detail=2) start edit:",String(m.field),"| trigger:",_),n.preventDefault(),n.stopPropagation(),re(this,p,w,{cursorPosition:y??void 0});return}}}}if((h=this.pipelineAdapter)!=null&&h.tryHandleMouseDown(a))return;const d=l.closest(".wg__cell"),c=l.closest(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(d&&!d.classList.contains("wg__cell--editing")&&!l.closest(".wg__row-number")&&!c){const f=parseInt(d.dataset.row||"0",10),w=parseInt(d.dataset.col||"0",10),p=(g=this.grid.visualColumns[w])==null?void 0:g.column;if(p){const m=this.grid.cellSelectionMode,_=a.shiftKey;if(p.editTrigger||this.grid.editTrigger,m!=="disabled"&&(m==="click"&&!_||m==="shift"&&_)){if(this.grid.editingCell){const C=this.grid.editingCell,S=this.grid.columns.findIndex(v=>String(v.field)===C.field);V(this),G(this),this.commitOrCancelEditOnTransition(),S>=0&&O(this,C.rowIndex,S)}this.grid.selectedRows.length>0&&this.grid.clearSelection(),this.grid.selectedColumns.length>0&&this.grid.clearColumnSelection(),Vi(this,f,w,a);return}else this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q())}}if(l.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-date-display"),w=l.closest(".wg__editor--date");if(w){const p=w.querySelector(".wg__date-input");p&&this.openDatePicker(p,w)}else if(f){const p=parseInt(f.dataset.row||"0",10),m=f.dataset.field||"",_=this.grid.columns.findIndex(y=>String(y.field)===m);if(_>=0){if(this.clearAllSelections(),this.isTransitioningCells=!0,this.grid.editingCell){const y=this.grid.editingCell,C=this.grid.columns.findIndex(S=>String(S.field)===y.field);V(this),G(this),this.commitOrCancelEditOnTransition(),this.grid.setFocusedCell(p,_),C>=0&&O(this,y.rowIndex,C)}re(this,p,_),requestAnimationFrame(()=>{var v;this.isTransitioningCells=!1;const y=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${p}"][data-field="${m}"]`),C=y==null?void 0:y.querySelector(".wg__date-input"),S=y==null?void 0:y.querySelector(".wg__editor--date");C&&S&&this.openDatePicker(C,S)})}}return}if(this.dropdownOpen||this.grid.editingCell){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const w=parseInt(f.dataset.row||"0",10),p=parseInt(f.dataset.col||"0",10),m=this.grid.editingCell,_=l.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(m&&!_){const y=this.grid.columns.findIndex(C=>String(C.field)===m.field);if(w!==m.rowIndex||p!==y){n.preventDefault(),this.isTransitioningCells=!0;const C=m.rowIndex,S=y;V(this),G(this),this.commitOrCancelEditOnTransition(),this.grid.setFocusedCell(w,p),S>=0&&O(this,C,S);const v=this.grid.columns[p],x=(v==null?void 0:v.editTrigger)||this.grid.editTrigger,E=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,x==="click"&&v&&this.grid.isCellEditable(v,this.grid.displayItems[w])){const I=this.shadow.querySelector(`td[data-row="${w}"][data-col="${p}"]`),R=I?tt({clientX:E},I):void 0;re(this,w,p,{cursorPosition:R??void 0})}else N(this,w,p)});return}}}}if(l.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-dropdown-display");if(f){const w=parseInt(f.dataset.row||"0",10),p=f.dataset.field||"",m=this.grid.columns.findIndex(_=>String(_.field)===p);if(m>=0){this.isTransitioningCells=!0;const _=this.grid.editingCell,y=_?this.grid.columns.findIndex(C=>String(C.field)===_.field):-1;_&&(V(this),G(this),this.commitOrCancelEditOnTransition(),this.grid.setFocusedCell(w,m),y>=0&&O(this,_.rowIndex,y)),re(this,w,m),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||pe(this)})}}}}),o.addEventListener("click",n=>{const l=n.target;if(l.matches(".wg__select-trigger, .wg__select-value")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.col||"",10),c=this.grid.columns[d];if(((c==null?void 0:c.editTrigger)??this.grid.editTrigger)==="always")return}n.preventDefault(),n.stopPropagation(),Ls(this)}}),o.addEventListener("mousedown",n=>{const l=n.target,a=l.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation(),this.clearAllSelections();const h=a.dataset.field;h&&Zs(this,n,h);return}if(this.grid.isColumnReorderAllowed){const h=n;if(!h.ctrlKey&&!h.metaKey&&!h.shiftKey){const g=l.closest(".wg__header");if(g&&!g.classList.contains("wg__header--frozen")&&!g.classList.contains("wg__row-number-header")){this.clearAllSelections();const f=g.dataset.field;f&&rl(this,n,f)}}}if((!this.grid.isColumnReorderAllowed||n.shiftKey)&&n.button===0){const h=l.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(h&&!l.closest(".wg__resize-handle")&&!l.closest(".wg__sort-indicator")){const g=h.dataset.field;if(g){const f=this.grid.visualColumns.findIndex(w=>String(w.column.field)===g);f>=0&&El(this,f,n)}}}const d=l.closest(".wg__row-number[data-row-number]");if(d&&n.button===0){const h=parseInt(d.dataset.rowNumber||"-1",10);h>=0&&yl(this,h,n)}l.closest(".wg__row-number-header")&&n.button===0&&(n.preventDefault(),this.grid.selectAll(),this.grid.selectedCellRange&&Vt(this),this.render(),requestAnimationFrame(()=>{const h=this.shadow.querySelector(".wg");h==null||h.focus({preventScroll:!0})}));const u=l.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(u&&!l.closest(".wg__header")&&!ko()&&!qi()){const h=parseInt(u.dataset.row||"-1",10);if(h>=0){const g=this.grid.focusedRowIndex;this.grid.setFocusedRow(h),this.updateRowFocusVisual(g,h)}}if(l.closest(".wg__cell")&&!l.closest(".wg__row-number, .wg__header")&&!ko()){let h=!1;this.grid.selectedRows.length>0&&(this.grid.clearSelection(),h=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),h=!0),h&&this.render()}if(!l.closest(".wg__cell, .wg__row-number, .wg__header, .wg__toolbar, button, input, select, textarea")){let h=!1;this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q(),h=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),h=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),h=!0),h&&this.render()}}),o.addEventListener("click",n=>{const l=n,a=l.target;if(a.closest(".wg__resize-handle")||a.closest(".wg__sort-indicator")||zi()||!this.grid.isColumnReorderAllowed)return;const d=a.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(d){n.preventDefault();const c=d.dataset.field;if(!c)return;const u=this.grid.visualColumns.findIndex(h=>String(h.column.field)===c);if(u===-1)return;Q(),l.ctrlKey||l.metaKey?this.grid.selectColumn(u,"toggle"):l.shiftKey?this.grid.selectColumn(u,"range"):this.grid.selectColumn(u,"replace"),this.render(),requestAnimationFrame(()=>{const h=this.shadow.querySelector(".wg");h==null||h.focus({preventScroll:!0})})}}),o.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),o.addEventListener("change",n=>{const l=n.target;l.matches(".wg__editor--checkbox")&&hs(this,l)}),o.addEventListener("input",n=>{const l=n.target;l.matches(".wg__combobox-input")?zs(this,n):l.matches(".wg__autocomplete-input")&&Os(this,n)}),this.focusEventsSubscribed||(this.focusEvents.subscribe("blur",(n,l)=>{this.focusEvents.shouldSkipBlur()||!l||!this.shadow.contains(l)||(n.matches(".wg__editor--text, .wg__editor--number")?ws(this,n):n.matches(".wg__date-input")?this.datepicker||this.commitDateEditor(n):n.matches(".wg__select-trigger")?this.handleSelectBlur(l):n.matches(".wg__combobox-input, .wg__autocomplete-input")&&this.handleComboboxBlur(n))}),this.focusEventsSubscribed=!0);const i=this.shadow.querySelector(".wg"),r=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||i;if(i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const l=this.grid.selectedRows,a=this.grid.selectedColumns,d=!!this.grid.selectedCellRange;if(l.length===0&&a.length===0&&!d||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.selectedCellRange?(this.grid.clearCellSelection(),Q()):a.length>0?this.grid.clearColumnSelection():this.grid.clearSelection();return}if((n.ctrlKey||n.metaKey)&&n.key==="c"){n.preventDefault(),d?this.grid.copyCellSelectionToClipboard():a.length>0?this.grid.copySelectedColumnsToClipboard():l.length>0&&this.grid.copySelectedRowsToClipboard();return}const u=this.grid.rangeShortcuts;if(u!=null&&u.length)for(const h of u){const g=pt(h.key);if(mt(n,g)){const f=d?{rows:[],rowIndices:[],cellRange:this.grid.selectedCellRange,cells:this.grid.getSelectedCells()}:{rows:this.grid.getSelectedRowsData(),rowIndices:l};if(!(typeof h.disabled=="function"?h.disabled(f):h.disabled===!0)){n.preventDefault(),h.action(f);return}}}}),this.scrollEvents.init(r),this.scrollEvents.subscribe("container",()=>{const n=r.scrollLeft>0;i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&this.handleScrollCloseDropdown(),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(r),this.grid.isInfiniteScrollEnabled&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(r),Ye()!==null&&(ai(this,this.grid.displayItems),this.renderConnector()),Ht(this),this.grid.selectedCellRange&&Xi(this),xl(this)}),this.scrollEvents.subscribe("window",()=>{this.dropdownOpen&&!this.isTransitioningCells&&this.handleScrollCloseDropdown(),Ye()!==null&&this.closeToolbarAndReset()}),!this.clickEventsSubscribed)){const n=l=>{var d;const a=((d=this.datepicker)==null?void 0:d.getElement())??null;for(const c of l)if(a&&a===c||this.contextMenuElement&&this.contextMenuElement===c||this.headerContextMenuElement&&this.headerContextMenuElement===c)return!0;return!1};this.clickEvents.init(i,this,n),this.clickEvents.subscribe("outsideClick",()=>{let l=!1;if(this.grid.focusedCell){const{rowIndex:a,colIndex:d}=this.grid.focusedCell,c=this.shadow.querySelector(`.wg__cell[data-row="${a}"][data-col="${d}"]`);c==null||c.classList.remove("wg__cell--focused","wg__cell--always-edit-focused"),this.grid.clearFocusedCell()}if(this.grid.focusedRowIndex!==null&&(this.grid.clearRowFocus(),l=!0),this.dropdownOpen||this.grid.editingCell){const a=this.grid.editingCell,d=a?this.grid.columns.findIndex(c=>String(c.field)===a.field):-1;V(this),G(this),this.grid.cancelEdit(),a&&d>=0&&O(this,a.rowIndex,d)}this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q(),l=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),l=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),l=!0),l&&this.render()}),this.clickEvents.subscribe("sortClick",l=>{zi()||(this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q()),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),it()),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),rt()),Gs(this,l.event,l.field),this.render())}),this.clickEventsSubscribed=!0}o.addEventListener("mouseenter",n=>{const l=n.target,a=l.closest("[data-tooltip-html]");if(a){const c=a.getAttribute("data-tooltip-html");xo(this,a,c,this._tooltipShowDelay,!0);return}const d=l.closest("[data-tooltip]");if(d){const c=d.getAttribute("data-tooltip");xo(this,d,c,this._tooltipShowDelay,!1)}},!0),o.addEventListener("mouseleave",n=>{const l=n,a=l.target,d=l.relatedTarget,c=a.closest("[data-tooltip], [data-tooltip-html]");c&&(d==null?void 0:d.closest("[data-tooltip], [data-tooltip-html]"))===c||c&&Ft(this,this._tooltipHideDelay)},!0),o.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const d=parseInt(a.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${d}"]`);c&&(uo(d)?this.closeToolbarAndReset():this.showToolbarForRow(c,d))}}),o.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const d=a.dataset.actionId,c=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(d,c,n,a)}}),o.addEventListener("mouseenter",n=>{const l=n,d=l.target.closest(".wg__row");if(d){const c=parseInt(d.dataset.rowIndex||"0",10);this.grid.setHoveredRow(c),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),uo(c)||this.showToolbarForRow(d,c,l.clientX))}},!0),o.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{o.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const c=this.shadow.querySelector(".wg__toolbar-container"),u=c==null?void 0:c.matches(":hover"),h=o.matches(":hover");!u&&!h&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),o.addEventListener("mousemove",n=>{const l=n,a=l.target,d=a.closest(".wg__row");if(!d)return;const c=parseInt(d.dataset.rowIndex||"0",10);if(!(Ye()!==c||this.grid.toolbarPosition!=="top")){if(this.grid.toolbarFollowsCursor&&!this.grid.cellToolbar&&this.grid.toolbarColumn===void 0){const h=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(h){const g=h.getBoundingClientRect(),f=go(g,this.grid.cellToolbarOffset);ho(f,d,"start")}else ho(l.clientX)}if(this.grid.cellToolbar){const h=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(h){const g=h.dataset.field||"",f=this.grid.visualColumns.findIndex(p=>String(p.column.field)===g);if(!this.hoveredCell||this.hoveredCell.rowIndex!==c||this.hoveredCell.field!==g){this.hoveredCell={rowIndex:c,colIndex:f,field:g};const p=this.grid.displayItems[c];if(p){const _=this.grid.cellToolbar(p,c,g,f)||this.grid.rowToolbar,y=JSON.stringify(_);y!==this.currentCellToolbarItems&&(this.currentCellToolbarItems=y,this.updateToolbarWithCellItems(c,_));const C=h.getBoundingClientRect(),S=go(C,this.grid.cellToolbarOffset);ho(S,d,"start")}}}}}}),o.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const l=n,a=l.target,d=a.closest(".wg__row");if(d&&!a.closest(".wg__cell--editing")){const c=parseInt(d.dataset.rowIndex||"0",10);uo(c)?this.closeToolbarAndReset():this.showToolbarForRow(d,c,l.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!li(this.shadow))return;const l=n.composedPath(),a=l.some(u=>{var h;return(h=u.classList)==null?void 0:h.contains("wg__toolbar-container")}),d=l.some(u=>{var h;return(h=u.classList)==null?void 0:h.contains("wg__toolbar-trigger")});a||d||l.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Ye()!==null&&this.closeToolbarAndReset()}));const s=this.shadow.querySelector(".wg");s&&(s.addEventListener("click",n=>{n.target.closest(".wg__pagination-btn")&&Qs(this,n)&&this.render()}),s.addEventListener("change",n=>{const l=n.target;l.matches(".wg__pagination-select")&&Js(this,l)&&this.render()}))}scrollToRowProgrammatically(o){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:s,endIndex:n}=js({targetRow:o,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(s!==this.virtualScrollStart||n!==this.virtualScrollEnd)&&(this.virtualScrollStart=s,this.virtualScrollEnd=n,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(o){var s;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=Ks({scrollTop:o.scrollTop,viewportHeight:o.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(s=this.grid.editingCell)==null?void 0:s.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(o))}renderVirtualRows(o){const i=o.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,s={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},n=this.grid.focusedCell;if(i.innerHTML=ui(this,s),n){this.grid.setFocusedCell(n.rowIndex,n.colIndex);const l=i.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);l&&(l.focus({preventScroll:!0}),ee(this,null,n))}}handleInfiniteScroll(o){Xs(o.scrollTop,o.scrollHeight,o.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var n,l,a;if(!this.grid.isShortcutsHelpVisible||!((n=this.grid.rowShortcuts)!=null&&n.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
663
663
  <span class="wg__shortcuts-help-key">${Ys(d.key)}</span>
664
664
  <span class="wg__shortcuts-help-label">${d.label}</span>
665
665
  </div>`).join(""),s=((a=(l=this.grid).shortcutsHelpContentCallback)==null?void 0:a.call(l))||"";return`
@@ -697,7 +697,7 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
697
697
  `,this.shadow.appendChild(E);const D=this.grid.tableBorderOnly&&E.querySelector(".wg__table-container")||E;if(g){const M=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-D.clientHeight);D.scrollTop=Math.min(s,M)}else D.scrollTop=s;D.scrollLeft=n,this.attachEventListeners()}if(this.grid.editingCell){const{rowIndex:R,field:P}=this.grid.editingCell;let D=this.shadow.querySelector(`.wg__combobox-input[data-row="${R}"][data-field="${P}"],
698
698
  .wg__autocomplete-input[data-row="${R}"][data-field="${P}"],
699
699
  .wg__select-trigger[data-row="${R}"][data-field="${P}"],
700
- .wg__date-input[data-row="${R}"][data-field="${P}"]`);if(D||(D=this.shadow.querySelector(`.wg__editor[data-row="${R}"][data-field="${P}"]`)),D&&(D.focus(),D instanceof HTMLInputElement&&D.type==="text")){const M=this.grid.editingCell.cursorPosition,A=this.getCurrentEditingColumn(),F=((I=A==null?void 0:A.editorOptions)==null?void 0:I.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const T=D.value.length;D.setSelectionRange(T,T)}else switch(F){case"mousePosition":if(M!==void 0){const T=Math.min(M,D.value.length);D.setSelectionRange(T,T)}else D.setSelectionRange(D.value.length,D.value.length);break;case"cursorAtStart":D.setSelectionRange(0,0);break;case"cursorAtEnd":D.setSelectionRange(D.value.length,D.value.length);break;case"selectAll":default:D.select();break}}}else if(l&&!this.grid.editingCell){const R=E.querySelector(`td[data-row="${l.rowIndex}"][data-col="${l.colIndex}"]`);R&&setTimeout(()=>R.focus(),0)}g&&requestAnimationFrame(()=>{E.style.pointerEvents="none",requestAnimationFrame(()=>{E.style.pointerEvents=""})}),this.renderConnector(),Ht(this),this.grid.selectedCellRange&&Xi(this),this.grid.selectedRows.length>0?er(this):it(),this.grid.selectedColumns.length>0?tr(this):rt(),$t.debug("render() body:",(performance.now()-o).toFixed(2),"ms |",ie.summary())}renderConnector(){const o=this.shadow.querySelector(".wg__connector");o&&o.remove();const i=is();if(!i.path||!i.arrowPos)return;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","wg__connector"),r.setAttribute("style","position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999;");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",i.path),s.setAttribute("stroke","var(--wg-accent-color, #0078d4)"),s.setAttribute("stroke-width","2"),s.setAttribute("fill","none"),r.appendChild(s);const n=document.createElementNS("http://www.w3.org/2000/svg","polygon"),l=i.arrowDir==="down"?"-4,0 4,0 0,8":i.arrowDir==="up"?"-4,0 4,0 0,-8":i.arrowDir==="left"?"0,-4 -8,0 0,4":"0,-4 8,0 0,4";n.setAttribute("points",l),n.setAttribute("fill","var(--wg-accent-color, #0078d4)"),n.setAttribute("transform",`translate(${i.arrowPos.x}, ${i.arrowPos.y})`),r.appendChild(n),this.shadow.appendChild(r)}clearAllSelections(){this.grid.selectedCellRange&&(this.grid.clearCellSelection_noRender(),Q(),this.shadow.querySelectorAll(".wg__cell--in-range").forEach(i=>i.classList.remove("wg__cell--in-range"))),this.grid.selectedRows.length>0&&(this.grid.clearSelection_noRender(),it(),this.shadow.querySelectorAll(".wg__row--selected").forEach(i=>i.classList.remove("wg__row--selected"))),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection_noRender(),rt(),this.shadow.querySelectorAll(".wg__cell--column-selected").forEach(r=>r.classList.remove("wg__cell--column-selected")),this.shadow.querySelectorAll(".wg__header--selected").forEach(r=>r.classList.remove("wg__header--selected")))}updateRowFocusVisual(o,i){if(o!==i){if(o!==null){const r=this.shadow.querySelector(`tr[data-row-index="${o}"]`);r==null||r.classList.remove("wg__row--focused")}if(i!==null){const r=this.shadow.querySelector(`tr[data-row-index="${i}"]`);r==null||r.classList.add("wg__row--focused")}}}openDatePicker(o,i){this.datepicker&&(this.datepicker.close(!0),this.datepicker=null);const r=o.dataset.dateFormat||"YYYY-MM-DD",s=o.dataset.minDate,n=o.dataset.maxDate,l=o.dataset.dateValue||"";this.datepicker=new Mt({dateFormat:r,minDate:s||void 0,maxDate:n||void 0,onSelect:(a,d)=>{this.handleDatePickerSelect(o,a,d)},onClose:()=>{const a=this.grid.editingCell,d=a?this.grid.columns.findIndex(u=>String(u.field)===a.field):-1,c=(a==null?void 0:a.rowIndex)??-1;if(this.datepicker=null,G(this),this.grid.cancelEdit(),c>=0&&d>=0){ds(this,c,d);const u=this.shadow.querySelector(`.wg__cell[data-row="${c}"][data-col="${d}"]`);u&&u.focus()}}}),this.datepicker.open(i,l||null)}handleDatePickerSelect(o,i,r){const s=o.dataset.dateFormat||"YYYY-MM-DD",n=Dt(s);o.value=io(i,n),o.dataset.dateValue=Tt(i),this.datepicker=null,this.isCommittingFromKeyboard=!0;const l=r==="down"||r===void 0;this.commitDateEditor(o,l);const a=parseInt(o.dataset.row||"0",10),d=o.dataset.field||"";this.moveFocusAfterCommit(a,d,r||"down")}async commitDateEditor(o,i=!1){if(!this.grid.editingCell)return;const r=parseInt(o.dataset.row||"0",10),s=o.dataset.field||"",n=o.dataset.outputFormat||"iso",l=o.dataset.dateFormat||"YYYY-MM-DD",a=Dt(l),d=o.value?this.parseDateInput(o.value,a):null;let c=null;if(d)switch(n){case"date":c=d;break;case"timestamp":c=d.getTime();break;case"iso":default:c=Tt(d);break}await this.grid.commitEdit(r,s,c,i)}parseDateInput(o,i){if(!o)return null;const r=o.split(i.separator);let s=null,n=null,l=null;if(r.forEach((d,c)=>{var h,g,f;if(!d)return;const u=parseInt(d,10);((h=i.parts.year)==null?void 0:h.index)===c?s=u<100?u+2e3:u:((g=i.parts.month)==null?void 0:g.index)===c?n=u:((f=i.parts.day)==null?void 0:f.index)===c&&(l=u)}),s===null||n===null||l===null)return null;const a=new Date(s,n-1,l);return a.getMonth()!==n-1||a.getDate()!==l?null:a}showGoToRowDialog(o){const i=this.grid.displayItems;if(i.length===0)return;const r=document.createElement("div");r.className="wg__goto-overlay",r.innerHTML=`
700
+ .wg__date-input[data-row="${R}"][data-field="${P}"]`);if(D||(D=this.shadow.querySelector(`.wg__editor[data-row="${R}"][data-field="${P}"]`)),D&&(D.focus(),D instanceof HTMLInputElement&&D.type==="text")){const M=this.grid.editingCell.cursorPosition,A=this.getCurrentEditingColumn(),F=((I=A==null?void 0:A.editorOptions)==null?void 0:I.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const T=D.value.length;D.setSelectionRange(T,T)}else switch(F){case"mousePosition":if(M!==void 0){const T=Math.min(M,D.value.length);D.setSelectionRange(T,T)}else D.setSelectionRange(D.value.length,D.value.length);break;case"cursorAtStart":D.setSelectionRange(0,0);break;case"cursorAtEnd":D.setSelectionRange(D.value.length,D.value.length);break;case"selectAll":default:D.select();break}}}else if(l&&!this.grid.editingCell){const R=E.querySelector(`td[data-row="${l.rowIndex}"][data-col="${l.colIndex}"]`);R&&setTimeout(()=>R.focus(),0)}g&&requestAnimationFrame(()=>{E.style.pointerEvents="none",requestAnimationFrame(()=>{E.style.pointerEvents=""})}),this.renderConnector(),Ht(this),this.grid.selectedCellRange&&Xi(this),this.grid.selectedRows.length>0?er(this):it(),this.grid.selectedColumns.length>0?tr(this):rt(),$t.debug("render() body:",(performance.now()-o).toFixed(2),"ms |",ie.summary())}renderConnector(){const o=this.shadow.querySelector(".wg__connector");o&&o.remove();const i=is();if(!i.path||!i.arrowPos)return;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","wg__connector"),r.setAttribute("style","position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999;");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",i.path),s.setAttribute("stroke","var(--wg-accent-color, #0078d4)"),s.setAttribute("stroke-width","2"),s.setAttribute("fill","none"),r.appendChild(s);const n=document.createElementNS("http://www.w3.org/2000/svg","polygon"),l=i.arrowDir==="down"?"-4,0 4,0 0,8":i.arrowDir==="up"?"-4,0 4,0 0,-8":i.arrowDir==="left"?"0,-4 -8,0 0,4":"0,-4 8,0 0,4";n.setAttribute("points",l),n.setAttribute("fill","var(--wg-accent-color, #0078d4)"),n.setAttribute("transform",`translate(${i.arrowPos.x}, ${i.arrowPos.y})`),r.appendChild(n),this.shadow.appendChild(r)}clearAllSelections(){this.grid.selectedCellRange&&(this.grid.clearCellSelection_noRender(),Q(),this.shadow.querySelectorAll(".wg__cell--in-range").forEach(i=>i.classList.remove("wg__cell--in-range"))),this.grid.selectedRows.length>0&&(this.grid.clearSelection_noRender(),it(),this.shadow.querySelectorAll(".wg__row--selected").forEach(i=>i.classList.remove("wg__row--selected"))),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection_noRender(),rt(),this.shadow.querySelectorAll(".wg__cell--column-selected").forEach(r=>r.classList.remove("wg__cell--column-selected")),this.shadow.querySelectorAll(".wg__header--selected").forEach(r=>r.classList.remove("wg__header--selected")))}commitOrCancelEditOnTransition(){const o=this.grid.editingCell;if(!o)return;if(!this.grid.shouldCommitOnClickAway){this.grid.cancelEdit();return}const{rowIndex:i,field:r}=o,s=this.grid.columns.findIndex(d=>String(d.field)===r);if(s<0){this.grid.cancelEdit();return}const n=this.shadow.querySelector(`.wg__cell[data-row="${i}"][data-col="${s}"]`);let l=n==null?void 0:n.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(l||(l=n==null?void 0:n.querySelector(".wg__editor")),!l){this.grid.cancelEdit();return}let a;if(l instanceof HTMLInputElement)if(l.type==="checkbox"){const d=this.grid.displayItems[i];a=this.grid.getCellRawValue(d,i,r)}else if(l.classList.contains("wg__date-input"))a=l.dataset.dateValue||l.value;else if(l.classList.contains("wg__editor--number")){const d=l.value.trim();if(d==="")a=null;else{const c=parseFloat(d);a=isNaN(c)?d:c}}else a=l.value;else l instanceof HTMLSelectElement?a=l.value:a=l.dataset.value||"";this.grid.commitEdit(i,r,a)}updateRowFocusVisual(o,i){if(o!==i){if(o!==null){const r=this.shadow.querySelector(`tr[data-row-index="${o}"]`);r==null||r.classList.remove("wg__row--focused")}if(i!==null){const r=this.shadow.querySelector(`tr[data-row-index="${i}"]`);r==null||r.classList.add("wg__row--focused")}}}openDatePicker(o,i){this.datepicker&&(this.datepicker.close(!0),this.datepicker=null);const r=o.dataset.dateFormat||"YYYY-MM-DD",s=o.dataset.minDate,n=o.dataset.maxDate,l=o.dataset.dateValue||"";this.datepicker=new Mt({dateFormat:r,minDate:s||void 0,maxDate:n||void 0,onSelect:(a,d)=>{this.handleDatePickerSelect(o,a,d)},onClose:()=>{const a=this.grid.editingCell,d=a?this.grid.columns.findIndex(u=>String(u.field)===a.field):-1,c=(a==null?void 0:a.rowIndex)??-1;if(this.datepicker=null,G(this),this.grid.cancelEdit(),c>=0&&d>=0){ds(this,c,d);const u=this.shadow.querySelector(`.wg__cell[data-row="${c}"][data-col="${d}"]`);u&&u.focus()}}}),this.datepicker.open(i,l||null)}handleDatePickerSelect(o,i,r){const s=o.dataset.dateFormat||"YYYY-MM-DD",n=Dt(s);o.value=io(i,n),o.dataset.dateValue=Tt(i),this.datepicker=null,this.isCommittingFromKeyboard=!0;const l=r==="down"||r===void 0;this.commitDateEditor(o,l);const a=parseInt(o.dataset.row||"0",10),d=o.dataset.field||"";this.moveFocusAfterCommit(a,d,r||"down")}async commitDateEditor(o,i=!1){if(!this.grid.editingCell)return;const r=parseInt(o.dataset.row||"0",10),s=o.dataset.field||"",n=o.dataset.outputFormat||"iso",l=o.dataset.dateFormat||"YYYY-MM-DD",a=Dt(l),d=o.value?this.parseDateInput(o.value,a):null;let c=null;if(d)switch(n){case"date":c=d;break;case"timestamp":c=d.getTime();break;case"iso":default:c=Tt(d);break}await this.grid.commitEdit(r,s,c,i)}parseDateInput(o,i){if(!o)return null;const r=o.split(i.separator);let s=null,n=null,l=null;if(r.forEach((d,c)=>{var h,g,f;if(!d)return;const u=parseInt(d,10);((h=i.parts.year)==null?void 0:h.index)===c?s=u<100?u+2e3:u:((g=i.parts.month)==null?void 0:g.index)===c?n=u:((f=i.parts.day)==null?void 0:f.index)===c&&(l=u)}),s===null||n===null||l===null)return null;const a=new Date(s,n-1,l);return a.getMonth()!==n-1||a.getDate()!==l?null:a}showGoToRowDialog(o){const i=this.grid.displayItems;if(i.length===0)return;const r=document.createElement("div");r.className="wg__goto-overlay",r.innerHTML=`
701
701
  <div class="wg__goto-dialog">
702
702
  <label class="wg__goto-label">Go to row (1-${i.length}):</label>
703
703
  <input type="number" class="wg__goto-input" min="1" max="${i.length}" value="1" />
@@ -706,4 +706,4 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
706
706
  <button type="button" class="wg__goto-btn wg__goto-btn--go">Go</button>
707
707
  </div>
708
708
  </div>
709
- `;const s=r.querySelector(".wg__goto-input"),n=r.querySelector(".wg__goto-btn--go"),l=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},d=()=>{const c=parseInt(s.value,10);if(isNaN(c)||c<1||c>i.length){s.focus(),s.select();return}a();const u=c-1,h=this.grid.focusedCell;if(this.grid.setFocusedCell(u,o),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const g=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);g==null||g.focus()})});else{const g=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);g&&(g.scrollIntoView({block:"nearest",behavior:"auto"}),g.focus(),ee(this,h,{rowIndex:u,colIndex:o}))}};n.addEventListener("click",d),l.addEventListener("click",a),r.addEventListener("click",c=>{c.target===r&&a()}),s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),a())}),this.shadow.appendChild(r),s.focus(),s.select()}openCustomEditor(o,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const s=String(r.field),n=this.grid.displayItems[o];if(!n)return;const a={value:this.grid.getCellRawValue(n,o,s),row:n,rowIndex:o,field:s,commit:async d=>{G(this),await this.grid.commitEdit(o,s,d),O(this,o,i),requestAnimationFrame(()=>{N(this,o,i)})},cancel:()=>{G(this),this.grid.cancelEdit(),O(this,o,i),requestAnimationFrame(()=>{N(this,o,i)})}};r.cellEditCallback(a)}handleContextMenu(o){const i=o.target,r=i.closest(".wg__header");if(r){this.handleHeaderContextMenu(o,r);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(o);return}const n=this.grid.contextMenu;if(!n||n.length===0)return;const l=qs(n,this.grid),a=i.closest(".wg__cell");if(!a)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null);const d=parseInt(a.dataset.row||"0",10),c=parseInt(a.dataset.col||"0",10),u=this.grid.columns[c];if(!u)return;const h=this.grid.displayItems[d];if(!h)return;const g=String(u.field),f=this.grid.getCellRawValue(h,d,g),w={row:h,rowIndex:d,colIndex:c,column:u,cellValue:f};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(w);const p=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),m=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");p&&"value"in p&&(this.grid.contextMenuXOffset=p.value,delete this.contextMenuXOffset),m&&"value"in m&&(this.grid.contextMenuYOffset=m.value,delete this.contextMenuYOffset),this.contextMenuElement=Bs(this,o.clientX,o.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,l,w,_=>{const y=l.find(C=>C.id===_);y!=null&&y.onclick&&y.onclick(w),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(o,i){const r=this.grid.headerContextMenu;if(!r||r.length===0)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null);const s=i.dataset.field;if(!s)return;const n=this.grid.columns.findIndex(f=>String(f.field)===s);if(n===-1)return;const l=this.grid.columns[n],a=this.grid.freezeColumns,d=n<a,c=this.grid.sort.find(f=>f.column===s),u=(c==null?void 0:c.direction)??null,h={column:l,field:s,columnIndex:n,sortDirection:u,isFrozen:d,isTreeMode:this.grid.isTreeMode,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(h);const g=Ei(r,h);g.length!==0&&(this.headerContextMenuElement=$i(this,o.clientX,o.clientY,g,h,(f,w,p)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&Us(this,f,h,p),f==="show-all-columns"){this.grid.columns.forEach(y=>{y.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const y=f.replace("toggle-col-",""),C=this.grid.columns.find(S=>String(S.field)===y);C&&(C.isHidden=!C.isHidden,this.grid.columns=[...this.grid.columns]);return}const _=g.find(y=>y.id===f);_!=null&&_.onclick&&_.onclick(h),!w&&this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}handleFillerContextMenu(o){const i=this.grid.headerContextMenu;if(!i||i.length===0)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null);const r=i.filter(l=>l==="columnVisibility"?!0:typeof l=="object"&&l.id?!(typeof l.label=="function"||typeof l.icon=="function"):(typeof l=="string"||typeof l=="object"&&l.dividerBefore&&!l.id&&!l.label,!1));if(r.length===0)return;const s={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,isTreeMode:this.grid.isTreeMode,allColumns:this.grid.columns,labels:this.grid.labels},n=Ei(r,s);n.length!==0&&(this.headerContextMenuElement=$i(this,o.clientX,o.clientY,n,s,(l,a,d)=>{if(l==="show-all-columns"){this.grid.columns.forEach(u=>{u.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(l.startsWith("toggle-col-")){const u=l.replace("toggle-col-",""),h=this.grid.columns.find(g=>String(g.field)===u);h&&(h.isHidden=!h.isHidden,this.grid.columns=[...this.grid.columns]);return}const c=n.find(u=>u.id===l);c!=null&&c.onclick&&c.onclick(s),!a&&this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const o=this.grid.rowShortcuts;o!=null&&o.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=Ye();if(s===null||!li(this.shadow))return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=pt(a.key);if(mt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const o=this.grid.rowShortcuts;!(o!=null&&o.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=this.grid.hoveredRowIndex;if(s===null)return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=pt(a.key);if(mt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(o,i,r){const s=this.shadow.querySelector(".wg__toolbar-container");if(!s)return;s.querySelectorAll(".wg__toolbar-btn").forEach(l=>{var h;const a=l,d=a.dataset.toolbarItem,c=o.find(g=>g.id===d);if(!c)return;const u=(h=this.grid.rowShortcuts)==null?void 0:h.find(g=>g.id===c.id);a.addEventListener("mouseenter",()=>{const g=c.tooltipCallback?c.tooltipCallback(i,r):ts(c,u==null?void 0:u.key);xo(this,a,g,0,!0)}),a.addEventListener("mouseleave",()=>{Ft(this)})})}showToolbarForRow(o,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const s=et(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),Ft(this,0),this.currentCellToolbarItems=null,os(this,o,i,s,n,(a,d,c)=>{this.handleToolbarItemClick(a,i,n,d,c)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(s,n,i),this.grid.toolbarTrigger==="hover"){const a=this.shadow.querySelector(".wg__toolbar-container");a&&(a.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),a.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),c=d==null?void 0:d.matches(":hover"),u=a.matches(":hover");!c&&!u&&this.closeToolbarAndReset()},150))}))}const l=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);l&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),l.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.hoveredCell=null,this.currentCellToolbarItems=null,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),Ft(this,0),At()}updateToolbarWithCellItems(o,i){const r=this.grid.displayItems[o];if(!r)return;const s=et(this.grid.rowToolbar),n=et(i),l=new Map(n.map(f=>[f.id,f])),a=[...n];for(const f of s)l.has(f.id)||a.push(f);a.sort((f,w)=>f.row!==w.row?f.row-w.row:f.group-w.group);const d=this.grid.toolbarVerticalAlign!=="top",c=rs();if(!c)return;const u=si(a,r,o,d),h=document.createElement("div");h.innerHTML=u;const g=h.querySelector(".wg__toolbar");if(g){const{left:f,top:w,position:p,visibility:m}=c.toolbar.style;c.toolbar.innerHTML=g.innerHTML,c.toolbar.style.left=f,c.toolbar.style.top=w,c.toolbar.style.position=p,c.toolbar.style.visibility=m,this.setupToolbarTooltips(a,r,o)}}handleScrollCloseDropdown(){const o=this.grid.editingCell,i=o?this.grid.columns.findIndex(r=>String(r.field)===o.field):-1;V(this),G(this),this.grid.cancelEdit(),o&&i>=0&&O(this,o.rowIndex,i)}handleSelectBlur(o){if(this.isOpeningDropdown||o!=null&&o.closest(".wg__dropdown"))return;const i=this.grid.editingCell,r=i?this.grid.columns.findIndex(s=>String(s.field)===i.field):-1;V(this),G(this),this.grid.cancelEdit(),i&&r>=0&&O(this,i.rowIndex,r)}handleComboboxBlur(o){if(V(this),this.grid.editingCell){const i=this.grid.editingCell,r=this.grid.columns.findIndex(n=>String(n.field)===i.field),s=this.getCurrentEditingColumn();if(s){const n=s.editorOptions||{},a=(n.options||n.initialOptions||[]).find(c=>Ue(c,n).toLowerCase()===o.value.toLowerCase()),d=a?ze(a,n):o.value;G(this),this.grid.commitEdit(i.rowIndex,i.field,d),r>=0&&O(this,i.rowIndex,r)}}}handleToolbarItemClick(o,i,r,s,n){var d;(d=this.pipelineAdapter)==null||d.clearSelection();const l=this.grid.displayItems.findIndex(c=>c===r);if(l===-1){this.closeToolbarAndReset();return}const a=o.id==="moveUp"||o.id==="moveDown";if(a&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:r,rowIndex:l}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:l,row:r,event:s,triggerElement:n}),o.id==="delete"){this.closeToolbarAndReset();return}a?(this.render(),ai(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(o,i,r,s){var d;if(!o)return;(d=this.pipelineAdapter)==null||d.clearSelection();const l=et(this.grid.rowToolbar).find(c=>c.id===o),a=this.grid.displayItems[i];!l||!a||(l.onclick&&l.onclick({row:a,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:l,rowIndex:i,row:a,event:r,triggerElement:s}))}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",Ro),typeof window<"u"&&(window.components=window.components||{},window.components["web-grid"]={version:()=>"1.2.0-rc01",config:{name:"@keenmate/web-grid",version:"1.2.0-rc01",author:"KeenMate",license:"MIT",repository:"git+https://github.com/KeenMate/web-grid.git",homepage:"https://github.com/KeenMate/web-grid#readme"},logging:{enableLogging:Un,disableLogging:Yn,setLogLevel:Kn,setCategoryLevel:jn,getCategories:()=>[...Wn]}}),ne.GridElement=Ro,ne.WebGrid=ni,ne.default=Ro,Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
709
+ `;const s=r.querySelector(".wg__goto-input"),n=r.querySelector(".wg__goto-btn--go"),l=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},d=()=>{const c=parseInt(s.value,10);if(isNaN(c)||c<1||c>i.length){s.focus(),s.select();return}a();const u=c-1,h=this.grid.focusedCell;if(this.grid.setFocusedCell(u,o),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const g=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);g==null||g.focus()})});else{const g=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);g&&(g.scrollIntoView({block:"nearest",behavior:"auto"}),g.focus(),ee(this,h,{rowIndex:u,colIndex:o}))}};n.addEventListener("click",d),l.addEventListener("click",a),r.addEventListener("click",c=>{c.target===r&&a()}),s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),a())}),this.shadow.appendChild(r),s.focus(),s.select()}openCustomEditor(o,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const s=String(r.field),n=this.grid.displayItems[o];if(!n)return;const a={value:this.grid.getCellRawValue(n,o,s),row:n,rowIndex:o,field:s,commit:async d=>{G(this),await this.grid.commitEdit(o,s,d),O(this,o,i),requestAnimationFrame(()=>{N(this,o,i)})},cancel:()=>{G(this),this.grid.cancelEdit(),O(this,o,i),requestAnimationFrame(()=>{N(this,o,i)})}};r.cellEditCallback(a)}handleContextMenu(o){const i=o.target,r=i.closest(".wg__header");if(r){this.handleHeaderContextMenu(o,r);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(o);return}const n=this.grid.contextMenu;if(!n||n.length===0)return;const l=qs(n,this.grid),a=i.closest(".wg__cell");if(!a)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null);const d=parseInt(a.dataset.row||"0",10),c=parseInt(a.dataset.col||"0",10),u=this.grid.columns[c];if(!u)return;const h=this.grid.displayItems[d];if(!h)return;const g=String(u.field),f=this.grid.getCellRawValue(h,d,g),w={row:h,rowIndex:d,colIndex:c,column:u,cellValue:f};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(w);const p=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),m=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");p&&"value"in p&&(this.grid.contextMenuXOffset=p.value,delete this.contextMenuXOffset),m&&"value"in m&&(this.grid.contextMenuYOffset=m.value,delete this.contextMenuYOffset),this.contextMenuElement=Bs(this,o.clientX,o.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,l,w,_=>{const y=l.find(C=>C.id===_);y!=null&&y.onclick&&y.onclick(w),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(o,i){const r=this.grid.headerContextMenu;if(!r||r.length===0)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null);const s=i.dataset.field;if(!s)return;const n=this.grid.columns.findIndex(f=>String(f.field)===s);if(n===-1)return;const l=this.grid.columns[n],a=this.grid.freezeColumns,d=n<a,c=this.grid.sort.find(f=>f.column===s),u=(c==null?void 0:c.direction)??null,h={column:l,field:s,columnIndex:n,sortDirection:u,isFrozen:d,isTreeMode:this.grid.isTreeMode,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(h);const g=Ei(r,h);g.length!==0&&(this.headerContextMenuElement=$i(this,o.clientX,o.clientY,g,h,(f,w,p)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&Us(this,f,h,p),f==="show-all-columns"){this.grid.columns.forEach(y=>{y.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const y=f.replace("toggle-col-",""),C=this.grid.columns.find(S=>String(S.field)===y);C&&(C.isHidden=!C.isHidden,this.grid.columns=[...this.grid.columns]);return}const _=g.find(y=>y.id===f);_!=null&&_.onclick&&_.onclick(h),!w&&this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}handleFillerContextMenu(o){const i=this.grid.headerContextMenu;if(!i||i.length===0)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null);const r=i.filter(l=>l==="columnVisibility"?!0:typeof l=="object"&&l.id?!(typeof l.label=="function"||typeof l.icon=="function"):(typeof l=="string"||typeof l=="object"&&l.dividerBefore&&!l.id&&!l.label,!1));if(r.length===0)return;const s={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,isTreeMode:this.grid.isTreeMode,allColumns:this.grid.columns,labels:this.grid.labels},n=Ei(r,s);n.length!==0&&(this.headerContextMenuElement=$i(this,o.clientX,o.clientY,n,s,(l,a,d)=>{if(l==="show-all-columns"){this.grid.columns.forEach(u=>{u.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(l.startsWith("toggle-col-")){const u=l.replace("toggle-col-",""),h=this.grid.columns.find(g=>String(g.field)===u);h&&(h.isHidden=!h.isHidden,this.grid.columns=[...this.grid.columns]);return}const c=n.find(u=>u.id===l);c!=null&&c.onclick&&c.onclick(s),!a&&this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const o=this.grid.rowShortcuts;o!=null&&o.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=Ye();if(s===null||!li(this.shadow))return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=pt(a.key);if(mt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const o=this.grid.rowShortcuts;!(o!=null&&o.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=this.grid.hoveredRowIndex;if(s===null)return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=pt(a.key);if(mt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(o,i,r){const s=this.shadow.querySelector(".wg__toolbar-container");if(!s)return;s.querySelectorAll(".wg__toolbar-btn").forEach(l=>{var h;const a=l,d=a.dataset.toolbarItem,c=o.find(g=>g.id===d);if(!c)return;const u=(h=this.grid.rowShortcuts)==null?void 0:h.find(g=>g.id===c.id);a.addEventListener("mouseenter",()=>{const g=c.tooltipCallback?c.tooltipCallback(i,r):ts(c,u==null?void 0:u.key);xo(this,a,g,0,!0)}),a.addEventListener("mouseleave",()=>{Ft(this)})})}showToolbarForRow(o,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const s=et(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),Ft(this,0),this.currentCellToolbarItems=null,os(this,o,i,s,n,(a,d,c)=>{this.handleToolbarItemClick(a,i,n,d,c)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(s,n,i),this.grid.toolbarTrigger==="hover"){const a=this.shadow.querySelector(".wg__toolbar-container");a&&(a.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),a.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),c=d==null?void 0:d.matches(":hover"),u=a.matches(":hover");!c&&!u&&this.closeToolbarAndReset()},150))}))}const l=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);l&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),l.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.hoveredCell=null,this.currentCellToolbarItems=null,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),Ft(this,0),At()}updateToolbarWithCellItems(o,i){const r=this.grid.displayItems[o];if(!r)return;const s=et(this.grid.rowToolbar),n=et(i),l=new Map(n.map(f=>[f.id,f])),a=[...n];for(const f of s)l.has(f.id)||a.push(f);a.sort((f,w)=>f.row!==w.row?f.row-w.row:f.group-w.group);const d=this.grid.toolbarVerticalAlign!=="top",c=rs();if(!c)return;const u=si(a,r,o,d),h=document.createElement("div");h.innerHTML=u;const g=h.querySelector(".wg__toolbar");if(g){const{left:f,top:w,position:p,visibility:m}=c.toolbar.style;c.toolbar.innerHTML=g.innerHTML,c.toolbar.style.left=f,c.toolbar.style.top=w,c.toolbar.style.position=p,c.toolbar.style.visibility=m,this.setupToolbarTooltips(a,r,o)}}handleScrollCloseDropdown(){const o=this.grid.editingCell,i=o?this.grid.columns.findIndex(r=>String(r.field)===o.field):-1;V(this),G(this),this.grid.cancelEdit(),o&&i>=0&&O(this,o.rowIndex,i)}handleSelectBlur(o){if(this.isOpeningDropdown||o!=null&&o.closest(".wg__dropdown"))return;const i=this.grid.editingCell,r=i?this.grid.columns.findIndex(s=>String(s.field)===i.field):-1;V(this),G(this),this.grid.cancelEdit(),i&&r>=0&&O(this,i.rowIndex,r)}handleComboboxBlur(o){if(V(this),this.grid.editingCell){const i=this.grid.editingCell,r=this.grid.columns.findIndex(n=>String(n.field)===i.field),s=this.getCurrentEditingColumn();if(s){const n=s.editorOptions||{},a=(n.options||n.initialOptions||[]).find(c=>Ue(c,n).toLowerCase()===o.value.toLowerCase()),d=a?ze(a,n):o.value;G(this),this.grid.commitEdit(i.rowIndex,i.field,d),r>=0&&O(this,i.rowIndex,r)}}}handleToolbarItemClick(o,i,r,s,n){var d;(d=this.pipelineAdapter)==null||d.clearSelection();const l=this.grid.displayItems.findIndex(c=>c===r);if(l===-1){this.closeToolbarAndReset();return}const a=o.id==="moveUp"||o.id==="moveDown";if(a&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:r,rowIndex:l}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:l,row:r,event:s,triggerElement:n}),o.id==="delete"){this.closeToolbarAndReset();return}a?(this.render(),ai(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(o,i,r,s){var d;if(!o)return;(d=this.pipelineAdapter)==null||d.clearSelection();const l=et(this.grid.rowToolbar).find(c=>c.id===o),a=this.grid.displayItems[i];!l||!a||(l.onclick&&l.onclick({row:a,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:l,rowIndex:i,row:a,event:r,triggerElement:s}))}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",Ro),typeof window<"u"&&(window.components=window.components||{},window.components["web-grid"]={version:()=>"1.2.0-rc02",config:{name:"@keenmate/web-grid",version:"1.2.0-rc02",author:"KeenMate",license:"MIT",repository:"git+https://github.com/KeenMate/web-grid.git",homepage:"https://github.com/KeenMate/web-grid#readme"},logging:{enableLogging:Un,disableLogging:Yn,setLogLevel:Kn,setCategoryLevel:jn,getCategories:()=>[...Wn]}}),ne.GridElement=Ro,ne.WebGrid=ni,ne.default=Ro,Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});