@keenmate/web-grid 1.0.0-rc02 → 1.0.0-rc05

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.
@@ -1,17 +1,17 @@
1
- (function(I,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(I=typeof globalThis<"u"?globalThis:I||self,L(I.WebGrid={}))})(this,function(I){"use strict";var Gi=Object.defineProperty;var Ji=(I,L,ut)=>L in I?Gi(I,L,{enumerable:!0,configurable:!0,writable:!0,value:ut}):I[L]=ut;var w=(I,L,ut)=>Ji(I,typeof L!="symbol"?L+"":L,ut);class L{constructor(){w(this,"_items",[]);w(this,"_columns",[]);w(this,"_sortable",!1);w(this,"_filterable",!1);w(this,"_pageable",!1);w(this,"_pageSize",10);w(this,"_pageSizes",[10,25,50,100]);w(this,"_striped",!0);w(this,"_hoverable",!0);w(this,"_editable",!1);w(this,"_editTrigger","dblclick");w(this,"_mode","excel");w(this,"_dropdownToggleVisibility","always");w(this,"_dropdownShowOnFocus",!0);w(this,"_openDropdownOnEnter",!1);w(this,"_checkboxAlwaysEditable",!1);w(this,"_showRowNumbers",!1);w(this,"_invalidCells",[]);w(this,"_showRowToolbar",!1);w(this,"_rowToolbar",["add","delete","duplicate"]);w(this,"_toolbarAlign","center");w(this,"_toolbarTopPosition","center");w(this,"_toolbarTrigger","hover");w(this,"_contextMenu");w(this,"_onrowchange");w(this,"_onroweditstart");w(this,"_onroweditcancel");w(this,"_onvalidationerror");w(this,"_ontoolbarclick");w(this,"_onrowaction");w(this,"_oncontextmenuopen");w(this,"_ondatarequest");w(this,"_onrowdelete");w(this,"_sort",[]);w(this,"_filters",{});w(this,"_currentPage",1);w(this,"_totalItems",null);w(this,"_showPagination",!0);w(this,"_paginationPosition","bottom-center");w(this,"_paginationLabelsCallback");w(this,"_paginationLayout","pageSize|previous|pageInfo|next");w(this,"_summaryPosition");w(this,"_summaryContentCallback");w(this,"_summaryMetadata");w(this,"_summaryInline",!0);w(this,"_customStylesCallback");w(this,"_rowClassCallback");w(this,"_virtualScroll",!1);w(this,"_virtualScrollThreshold",100);w(this,"_virtualScrollRowHeight",38);w(this,"_virtualScrollBuffer",10);w(this,"_infiniteScroll",!1);w(this,"_infiniteScrollThreshold",100);w(this,"_hasMoreItems",!0);w(this,"_isLoadingMore",!1);w(this,"_editingCell",null);w(this,"_currentCellError",null);w(this,"_isValidating",!1);w(this,"_draftRows",new Map);w(this,"_focusedCell",null);w(this,"_isCommittingFromKeyboard",!1);w(this,"_skipNextDropdownAutoEdit",!1)}get items(){return this._items}set items(e){this._items=e,this.requestUpdate()}get columns(){return this._columns}set columns(e){this._columns=e,this.requestUpdate()}get sortable(){return this._sortable}set sortable(e){this._sortable=e,this.requestUpdate()}get filterable(){return this._filterable}set filterable(e){this._filterable=e,this.requestUpdate()}get pageable(){return this._pageable}set pageable(e){this._pageable=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 striped(){return this._striped}set striped(e){this._striped=e,this.requestUpdate()}get hoverable(){return this._hoverable}set hoverable(e){this._hoverable=e,this.requestUpdate()}get editable(){return this._editable}set editable(e){this._editable=e,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,this.requestUpdate()}get mode(){return this._mode}set mode(e){this._mode=e,this.applyModeDefaults(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get dropdownShowOnFocus(){return this._dropdownShowOnFocus}set dropdownShowOnFocus(e){this._dropdownShowOnFocus=e}get openDropdownOnEnter(){return this._openDropdownOnEnter}set openDropdownOnEnter(e){this._openDropdownOnEnter=e}getEffectiveOpenDropdownOnEnter(e){return e.openDropdownOnEnter??this._openDropdownOnEnter}get checkboxAlwaysEditable(){return this._checkboxAlwaysEditable}set checkboxAlwaysEditable(e){this._checkboxAlwaysEditable=e,this.requestUpdate()}get showRowNumbers(){return this._showRowNumbers}set showRowNumbers(e){this._showRowNumbers=e,this.requestUpdate()}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 showRowToolbar(){return this._showRowToolbar}set showRowToolbar(e){this._showRowToolbar=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarAlign(){return this._toolbarAlign}set toolbarAlign(e){this._toolbarAlign=e,this.requestUpdate()}get toolbarTopPosition(){return this._toolbarTopPosition}set toolbarTopPosition(e){this._toolbarTopPosition=e}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(e){this._toolbarTrigger=e,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(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 summaryInline(){return this._summaryInline}set summaryInline(e){this._summaryInline=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 virtualScroll(){return this._virtualScroll}set virtualScroll(e){this._virtualScroll=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 infiniteScroll(){return this._infiniteScroll}set infiniteScroll(e){this._infiniteScroll=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._virtualScroll===!1?!1:this._virtualScroll===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}get showRowActions(){return this._showRowToolbar}set showRowActions(e){this.showRowToolbar=e}get rowActions(){return this._rowToolbar}set rowActions(e){this.rowToolbar=e}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 ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(e){this._ontoolbarclick=e}set onrowaction(e){this._onrowaction=e}set oncontextmenuopen(e){this._oncontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(e=>e.editTrigger==="navigate")}get filteredItems(){return!this._filterable||Object.keys(this._filters).length===0?this._items:this._items.filter(e=>Object.entries(this._filters).every(([o,i])=>i?String(e[o]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return 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._pageable)return this.sortedItems;const e=(this._currentPage-1)*this._pageSize,o=e+this._pageSize;return this.sortedItems.slice(e,o)}get totalPages(){const e=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(e/this._pageSize))}get displayItems(){return this.paginatedItems}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};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._editable=!1,this._dropdownToggleVisibility="on-focus";break;case"excel":this._editable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!1;break;case"input-matrix":this._editable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!0;break}}requestUpdate(){}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e),this._invalidCells=this._invalidCells.filter(o=>o.rowIndex!==e),this.requestUpdate()}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,o,i){const r=this._draftRows.get(o);return r?r[i]:e[i]}getCellValue(e,o,i){if(o.templateCallback)return o.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(o.field)):e[String(o.field)];return o.formatCallback?o.formatCallback(r,e):String(r??"")}isCellInvalid(e,o){return this._invalidCells.some(i=>i.rowIndex===e&&i.field===o)}getCellValidationError(e,o){const i=this._invalidCells.find(r=>r.rowIndex===e&&r.field===o);return(i==null?void 0:i.error)||null}addInvalidCell(e,o,i){const r=this._invalidCells.findIndex(s=>s.rowIndex===e&&s.field===o);r>=0?this._invalidCells[r]={rowIndex:e,field:o,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:e,field:o,error:i}]}removeInvalidCell(e,o){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===e&&i.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}startEdit(e,o,i){var s;const r=this.displayItems[e];r&&(this._draftRows.has(e)||this._draftRows.set(e,{...r}),this._editingCell={rowIndex:e,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},this._currentCellError=null,this.requestUpdate(),(s=this._onroweditstart)==null||s.call(this,{row:r,rowIndex:e,field:o}))}cancelEdit(){var e;if(this._editingCell){const{rowIndex:o,field:i}=this._editingCell,r=this.displayItems[o];r&&((e=this._onroweditcancel)==null||e.call(this,{row:r,rowIndex:o,field:i})),this._editingCell=null,this._currentCellError=null,this.requestUpdate()}}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){var g,h;const r=this._columns.find(u=>String(u.field)===o);if(!r)return;const s=this.displayItems[e];if(!s)return;const n=s[o];let d=i,a=null,c=!0;this._isValidating=!0;try{if(r.beforeCommitCallback){const u={value:i,oldValue:n,row:s,rowIndex:e,field:o},p=await Promise.resolve(r.beforeCommitCallback(u)),m=this.normalizeValidationResult(p,i);c=m.valid,a=m.message||null,d=m.finalValue}else if(r.validateCallback){const u=await Promise.resolve(r.validateCallback(i,s));u&&(c=!1,a=u)}}catch(u){c=!1,a=u instanceof Error?u.message:"Validation failed"}this._isValidating=!1;let l=this._draftRows.get(e);l||(l={...s},this._draftRows.set(e,l)),l[o]=d,c?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,a||"Invalid value"),this._currentCellError=a,(g=this._onvalidationerror)==null||g.call(this,{row:s,rowIndex:e,field:o,error:a||"Invalid value"})),(h=this._onrowchange)==null||h.call(this,{row:s,draftRow:l,rowIndex:e,field:o,oldValue:n,newValue:d,isValid:c,validationError:a}),this._editingCell=null,this.requestUpdate()}isCellEditable(e){return e.editable===!1?!1:this._editable||e.editor!==void 0}getEditableColumns(){return this._columns.map((e,o)=>({index:o,column:e})).filter(({column:e})=>this.isCellEditable(e))}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){this._focusedCell={rowIndex:e,colIndex:o}}clearFocusedCell(){this._focusedCell=null}}const ut=':host{--wg-rem: 10px;font-family:var(--wg-font-family, var(--base-font-family, system-ui, -apple-system, sans-serif));display:block;--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, #e6f2ff);--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-on-accent, #ffffff);--wg-surface-1: var(--base-surface-1, #ffffff);--wg-surface-2: var(--base-surface-2, #f5f5f5);--wg-surface-3: var(--base-surface-3, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-surface-1, #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-surface-3, #f0f0f0);--wg-active-bg: var(--base-surface-3, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-base, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-sm, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-lg, 1.6) * var(--wg-rem));--wg-line-height-base: calc(var(--base-line-height-normal, 2) * var(--wg-rem));--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--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-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-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-cell-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-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-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-md);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--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-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-tooltip-bg: var(--base-tooltip-bg, #333);--wg-context-menu-z-index: 1001;--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-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001}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__table{width:max-content;min-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__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:40px;min-width:40px;max-width:40px;text-align:center;color:var(--wg-text-color-secondary);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number{border-right:var(--wg-cell-border)}.wg__actions-column{width:32px;min-width:32px;max-width:32px;padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);border-bottom:var(--wg-header-border)}.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:1;background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);border-bottom:var(--wg-header-border);text-align:left;-webkit-user-select:none;user-select:none}.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-content{display:flex;align-items:center;gap:4px;justify-content:space-between}.wg__header-title{flex:1}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center;display:inline-flex;align-items:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:600;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:4px;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-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__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);scroll-margin-top:3rem;scroll-margin-bottom:.5rem}.wg__cell-text{-webkit-user-select:none;user-select:none}.wg__cell--ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--editable{cursor:pointer;position:relative}.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}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light, #fee);box-shadow:inset 0 0 0 2px var(--wg-danger-color, #c00)}.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg, #f5f5f5)}.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--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size, 28px);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-secondary, #666);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color, #0078d4);background:var(--wg-hover-bg, rgba(0, 0, 0, .05))}.wg__editor--checkbox{width:auto;height:auto;margin:0 auto}.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 24px 0 0;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:48px}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:12px;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:4px;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:48px}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.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%;cursor:pointer}.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}.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:48px}.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, #fff);border:1px solid var(--wg-border-color, #d1d1d1);border-radius:4px;box-shadow:var(--wg-toolbar-shadow);max-height:200px;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-spacing-sm);padding:6px 12px;cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg, #f0f0f0)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light, #e6f2ff)}.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:8px 12px;color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg--navigate-mode .wg__cell{cursor:cell}.wg--navigate-mode .wg__cell:focus{outline:none}.wg--navigate-mode .wg__cell.wg__cell--focused{outline:2px solid var(--wg-focus-border-color, #217346);outline-offset:-2px}.wg__cell--focused:after{display:none}.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-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:4px}.wg__pagination-pagesize{display:flex;align-items:center;gap:6px}.wg__pagination-select{padding:4px 8px;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-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, 1000)}.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:2px;align-items:center;height:calc(var(--wg-design-unit, 4) * 4px + 21px);padding:0 4px}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:16px;background:var(--wg-toolbar-divider-color);margin:0 4px;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:4px;font-size:var(--wg-font-size-base);font-weight:500;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--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:12px;white-space:nowrap}.wg__actions-column{width:24px;min-width:24px;max-width:24px;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:48px}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.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:fixed;z-index:var(--wg-z-tooltip, 10000);max-width:300px;padding:6px 10px;background:var(--wg-tooltip-bg, #333);color:var(--wg-tooltip-color, #fff);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:0 2px 8px #0003;pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:8px;height:8px;background:var(--wg-tooltip-bg, #333);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:-4px}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:-4px}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:-4px}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:-4px}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;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);padding:var(--wg-spacing-lg);box-shadow:0 4px 20px #00000026;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-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 #0078d433}.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-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:#fff}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover, #106ebe)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@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}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.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}';function Vt(t,e,o){const i=o.valueMember||"value",r=o.displayMember||"label",s=e.find(n=>n[i]===t);return s?String(s[r]??""):t!=null?String(t):""}function vt(t,e){if(e.getDisplayCallback)return e.getDisplayCallback(t);const o=e.displayMember||"label";return String(t[o]??t.label??"")}function at(t,e){if(e.getValueCallback)return e.getValueCallback(t);const o=e.valueMember||"value";return t[o]??t.value}function Ye(t,e){return e.getIconCallback?e.getIconCallback(t):e.iconMember&&t[e.iconMember]||null}function Ne(t,e){return e.getSubtitleCallback?e.getSubtitleCallback(t):e.subtitleMember&&t[e.subtitleMember]||null}function _t(t,e){return e.getDisabledCallback?e.getDisabledCallback(t):e.disabledMember?!!t[e.disabledMember]:!1}const rt=Math.min,P=Math.max,Dt=Math.round,Tt=Math.floor,X=t=>({x:t,y:t}),Ue={left:"right",right:"left",bottom:"top",top:"bottom"},je={start:"end",end:"start"};function qt(t,e,o){return P(t,rt(e,o))}function ht(t,e){return typeof t=="function"?t(e):t}function nt(t){return t.split("-")[0]}function pt(t){return t.split("-")[1]}function de(t){return t==="x"?"y":"x"}function Yt(t){return t==="y"?"height":"width"}const Be=new Set(["top","bottom"]);function et(t){return Be.has(nt(t))?"y":"x"}function Nt(t){return de(et(t))}function Ke(t,e,o){o===void 0&&(o=!1);const i=pt(t),r=Nt(t),s=Yt(r);let n=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(n=Et(n)),[n,Et(n)]}function We(t){const e=Et(t);return[Ut(t),e,Ut(e)]}function Ut(t){return t.replace(/start|end/g,e=>je[e])}const ce=["left","right"],ge=["right","left"],Xe=["top","bottom"],Qe=["bottom","top"];function Ge(t,e,o){switch(t){case"top":case"bottom":return o?e?ge:ce:e?ce:ge;case"left":case"right":return e?Xe:Qe;default:return[]}}function Je(t,e,o,i){const r=pt(t);let s=Ge(nt(t),o==="start",i);return r&&(s=s.map(n=>n+"-"+r),e&&(s=s.concat(s.map(Ut)))),s}function Et(t){return t.replace(/left|right|bottom|top/g,e=>Ue[e])}function Ze(t){return{top:0,right:0,bottom:0,left:0,...t}}function ue(t){return typeof t!="number"?Ze(t):{top:t,right:t,bottom:t,left:t}}function $t(t){const{x:e,y:o,width:i,height:r}=t;return{width:i,height:r,top:o,left:e,right:e+i,bottom:o+r,x:e,y:o}}function he(t,e,o){let{reference:i,floating:r}=t;const s=et(e),n=Nt(e),d=Yt(n),a=nt(e),c=s==="y",l=i.x+i.width/2-r.width/2,g=i.y+i.height/2-r.height/2,h=i[d]/2-r[d]/2;let u;switch(a){case"top":u={x:l,y:i.y-r.height};break;case"bottom":u={x:l,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:g};break;case"left":u={x:i.x-r.width,y:g};break;default:u={x:i.x,y:i.y}}switch(pt(e)){case"start":u[n]-=h*(o&&c?-1:1);break;case"end":u[n]+=h*(o&&c?-1:1);break}return u}const to=async(t,e,o)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:n}=o,d=s.filter(Boolean),a=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:t,floating:e,strategy:r}),{x:l,y:g}=he(c,i,a),h=i,u={},p=0;for(let m=0;m<d.length;m++){const{name:f,fn:b}=d[m],{x:v,y:_,data:C,reset:y}=await b({x:l,y:g,initialPlacement:i,placement:h,strategy:r,middlewareData:u,rects:c,platform:n,elements:{reference:t,floating:e}});l=v??l,g=_??g,u={...u,[f]:{...u[f],...C}},y&&p<=50&&(p++,typeof y=="object"&&(y.placement&&(h=y.placement),y.rects&&(c=y.rects===!0?await n.getElementRects({reference:t,floating:e,strategy:r}):y.rects),{x:l,y:g}=he(c,h,a)),m=-1)}return{x:l,y:g,placement:h,strategy:r,middlewareData:u}};async function jt(t,e){var o;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:n,elements:d,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:l="viewport",elementContext:g="floating",altBoundary:h=!1,padding:u=0}=ht(e,t),p=ue(u),f=d[h?g==="floating"?"reference":"floating":g],b=$t(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(f)))==null||o?f:f.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(d.floating)),boundary:c,rootBoundary:l,strategy:a})),v=g==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d.floating)),C=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},y=$t(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:v,offsetParent:_,strategy:a}):v);return{top:(b.top-y.top+p.top)/C.y,bottom:(y.bottom-b.bottom+p.bottom)/C.y,left:(b.left-y.left+p.left)/C.x,right:(y.right-b.right+p.right)/C.x}}const eo=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:i,placement:r,rects:s,platform:n,elements:d,middlewareData:a}=e,{element:c,padding:l=0}=ht(t,e)||{};if(c==null)return{};const g=ue(l),h={x:o,y:i},u=Nt(r),p=Yt(u),m=await n.getDimensions(c),f=u==="y",b=f?"top":"left",v=f?"bottom":"right",_=f?"clientHeight":"clientWidth",C=s.reference[p]+s.reference[u]-h[u]-s.floating[p],y=h[u]-s.reference[u],k=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c));let x=k?k[_]:0;(!x||!await(n.isElement==null?void 0:n.isElement(k)))&&(x=d.floating[_]||s.floating[p]);const S=C/2-y/2,T=x/2-m[p]/2-1,D=rt(g[b],T),U=rt(g[v],T),R=D,tt=x-m[p]-U,M=x/2-m[p]/2+S,O=qt(R,M,tt),j=!a.arrow&&pt(r)!=null&&M!==O&&s.reference[p]/2-(M<R?D:U)-m[p]/2<0,q=j?M<R?M-R:M-tt:0;return{[u]:h[u]+q,data:{[u]:O,centerOffset:M-O-q,...j&&{alignmentOffset:q}},reset:j}}}),oo=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,i;const{placement:r,middlewareData:s,rects:n,initialPlacement:d,platform:a,elements:c}=e,{mainAxis:l=!0,crossAxis:g=!0,fallbackPlacements:h,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...f}=ht(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const b=nt(r),v=et(d),_=nt(d)===d,C=await(a.isRTL==null?void 0:a.isRTL(c.floating)),y=h||(_||!m?[Et(d)]:We(d)),k=p!=="none";!h&&k&&y.push(...Je(d,m,p,C));const x=[d,...y],S=await jt(e,f),T=[];let D=((i=s.flip)==null?void 0:i.overflows)||[];if(l&&T.push(S[b]),g){const M=Ke(r,n,C);T.push(S[M[0]],S[M[1]])}if(D=[...D,{placement:r,overflows:T}],!T.every(M=>M<=0)){var U,R;const M=(((U=s.flip)==null?void 0:U.index)||0)+1,O=x[M];if(O&&(!(g==="alignment"?v!==et(O):!1)||D.every(Y=>et(Y.placement)===v?Y.overflows[0]>0:!0)))return{data:{index:M,overflows:D},reset:{placement:O}};let j=(R=D.filter(q=>q.overflows[0]<=0).sort((q,Y)=>q.overflows[1]-Y.overflows[1])[0])==null?void 0:R.placement;if(!j)switch(u){case"bestFit":{var tt;const q=(tt=D.filter(Y=>{if(k){const B=et(Y.placement);return B===v||B==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(B=>B>0).reduce((B,it)=>B+it,0)]).sort((Y,B)=>Y[1]-B[1])[0])==null?void 0:tt[0];q&&(j=q);break}case"initialPlacement":j=d;break}if(r!==j)return{reset:{placement:j}}}return{}}}},io=new Set(["left","top"]);async function ro(t,e){const{placement:o,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=nt(o),d=pt(o),a=et(o)==="y",c=io.has(n)?-1:1,l=s&&a?-1:1,g=ht(e,t);let{mainAxis:h,crossAxis:u,alignmentAxis:p}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof p=="number"&&(u=d==="end"?p*-1:p),a?{x:u*l,y:h*c}:{x:h*c,y:u*l}}const no=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,i;const{x:r,y:s,placement:n,middlewareData:d}=e,a=await ro(e,t);return n===((o=d.offset)==null?void 0:o.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:n}}}}},so=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:n=!1,limiter:d={fn:f=>{let{x:b,y:v}=f;return{x:b,y:v}}},...a}=ht(t,e),c={x:o,y:i},l=await jt(e,a),g=et(nt(r)),h=de(g);let u=c[h],p=c[g];if(s){const f=h==="y"?"top":"left",b=h==="y"?"bottom":"right",v=u+l[f],_=u-l[b];u=qt(v,u,_)}if(n){const f=g==="y"?"top":"left",b=g==="y"?"bottom":"right",v=p+l[f],_=p-l[b];p=qt(v,p,_)}const m=d.fn({...e,[h]:u,[g]:p});return{...m,data:{x:m.x-o,y:m.y-i,enabled:{[h]:s,[g]:n}}}}}},ao=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var o,i;const{placement:r,rects:s,platform:n,elements:d}=e,{apply:a=()=>{},...c}=ht(t,e),l=await jt(e,c),g=nt(r),h=pt(r),u=et(r)==="y",{width:p,height:m}=s.floating;let f,b;g==="top"||g==="bottom"?(f=g,b=h===(await(n.isRTL==null?void 0:n.isRTL(d.floating))?"start":"end")?"left":"right"):(b=g,f=h==="end"?"top":"bottom");const v=m-l.top-l.bottom,_=p-l.left-l.right,C=rt(m-l[f],v),y=rt(p-l[b],_),k=!e.middlewareData.shift;let x=C,S=y;if((o=e.middlewareData.shift)!=null&&o.enabled.x&&(S=_),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(x=v),k&&!h){const D=P(l.left,0),U=P(l.right,0),R=P(l.top,0),tt=P(l.bottom,0);u?S=p-2*(D!==0||U!==0?D+U:P(l.left,l.right)):x=m-2*(R!==0||tt!==0?R+tt:P(l.top,l.bottom))}await a({...e,availableWidth:S,availableHeight:x});const T=await n.getDimensions(d.floating);return p!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function Mt(){return typeof window<"u"}function ft(t){return pe(t)?(t.nodeName||"").toLowerCase():"#document"}function H(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Q(t){var e;return(e=(pe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function pe(t){return Mt()?t instanceof Node||t instanceof H(t).Node:!1}function K(t){return Mt()?t instanceof Element||t instanceof H(t).Element:!1}function G(t){return Mt()?t instanceof HTMLElement||t instanceof H(t).HTMLElement:!1}function fe(t){return!Mt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof H(t).ShadowRoot}const lo=new Set(["inline","contents"]);function yt(t){const{overflow:e,overflowX:o,overflowY:i,display:r}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+o)&&!lo.has(r)}const co=new Set(["table","td","th"]);function go(t){return co.has(ft(t))}const uo=[":popover-open",":modal"];function At(t){return uo.some(e=>{try{return t.matches(e)}catch{return!1}})}const ho=["transform","translate","scale","rotate","perspective"],po=["transform","translate","scale","rotate","perspective","filter"],fo=["paint","layout","strict","content"];function Bt(t){const e=Kt(),o=K(t)?W(t):t;return ho.some(i=>o[i]?o[i]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||po.some(i=>(o.willChange||"").includes(i))||fo.some(i=>(o.contain||"").includes(i))}function wo(t){let e=st(t);for(;G(e)&&!wt(e);){if(Bt(e))return e;if(At(e))return null;e=st(e)}return null}function Kt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const mo=new Set(["html","body","#document"]);function wt(t){return mo.has(ft(t))}function W(t){return H(t).getComputedStyle(t)}function Ot(t){return K(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function st(t){if(ft(t)==="html")return t;const e=t.assignedSlot||t.parentNode||fe(t)&&t.host||Q(t);return fe(e)?e.host:e}function we(t){const e=st(t);return wt(e)?t.ownerDocument?t.ownerDocument.body:t.body:G(e)&&yt(e)?e:we(e)}function Ct(t,e,o){var i;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=we(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),n=H(r);if(s){const d=Wt(n);return e.concat(n,n.visualViewport||[],yt(r)?r:[],d&&o?Ct(d):[])}return e.concat(r,Ct(r,[],o))}function Wt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function me(t){const e=W(t);let o=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=G(t),s=r?t.offsetWidth:o,n=r?t.offsetHeight:i,d=Dt(o)!==s||Dt(i)!==n;return d&&(o=s,i=n),{width:o,height:i,$:d}}function Xt(t){return K(t)?t:t.contextElement}function mt(t){const e=Xt(t);if(!G(e))return X(1);const o=e.getBoundingClientRect(),{width:i,height:r,$:s}=me(e);let n=(s?Dt(o.width):o.width)/i,d=(s?Dt(o.height):o.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!d||!Number.isFinite(d))&&(d=1),{x:n,y:d}}const bo=X(0);function be(t){const e=H(t);return!Kt()||!e.visualViewport?bo:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vo(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==H(t)?!1:e}function lt(t,e,o,i){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Xt(t);let n=X(1);e&&(i?K(i)&&(n=mt(i)):n=mt(t));const d=vo(s,o,i)?be(s):X(0);let a=(r.left+d.x)/n.x,c=(r.top+d.y)/n.y,l=r.width/n.x,g=r.height/n.y;if(s){const h=H(s),u=i&&K(i)?H(i):i;let p=h,m=Wt(p);for(;m&&i&&u!==p;){const f=mt(m),b=m.getBoundingClientRect(),v=W(m),_=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*f.x,C=b.top+(m.clientTop+parseFloat(v.paddingTop))*f.y;a*=f.x,c*=f.y,l*=f.x,g*=f.y,a+=_,c+=C,p=H(m),m=Wt(p)}}return $t({width:l,height:g,x:a,y:c})}function Rt(t,e){const o=Ot(t).scrollLeft;return e?e.left+o:lt(Q(t)).left+o}function ve(t,e){const o=t.getBoundingClientRect(),i=o.left+e.scrollLeft-Rt(t,o),r=o.top+e.scrollTop;return{x:i,y:r}}function _o(t){let{elements:e,rect:o,offsetParent:i,strategy:r}=t;const s=r==="fixed",n=Q(i),d=e?At(e.floating):!1;if(i===n||d&&s)return o;let a={scrollLeft:0,scrollTop:0},c=X(1);const l=X(0),g=G(i);if((g||!g&&!s)&&((ft(i)!=="body"||yt(n))&&(a=Ot(i)),G(i))){const u=lt(i);c=mt(i),l.x=u.x+i.clientLeft,l.y=u.y+i.clientTop}const h=n&&!g&&!s?ve(n,a):X(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-a.scrollLeft*c.x+l.x+h.x,y:o.y*c.y-a.scrollTop*c.y+l.y+h.y}}function yo(t){return Array.from(t.getClientRects())}function Co(t){const e=Q(t),o=Ot(t),i=t.ownerDocument.body,r=P(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=P(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-o.scrollLeft+Rt(t);const d=-o.scrollTop;return W(i).direction==="rtl"&&(n+=P(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:n,y:d}}const _e=25;function So(t,e){const o=H(t),i=Q(t),r=o.visualViewport;let s=i.clientWidth,n=i.clientHeight,d=0,a=0;if(r){s=r.width,n=r.height;const l=Kt();(!l||l&&e==="fixed")&&(d=r.offsetLeft,a=r.offsetTop)}const c=Rt(i);if(c<=0){const l=i.ownerDocument,g=l.body,h=getComputedStyle(g),u=l.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(i.clientWidth-g.clientWidth-u);p<=_e&&(s-=p)}else c<=_e&&(s+=c);return{width:s,height:n,x:d,y:a}}const xo=new Set(["absolute","fixed"]);function ko(t,e){const o=lt(t,!0,e==="fixed"),i=o.top+t.clientTop,r=o.left+t.clientLeft,s=G(t)?mt(t):X(1),n=t.clientWidth*s.x,d=t.clientHeight*s.y,a=r*s.x,c=i*s.y;return{width:n,height:d,x:a,y:c}}function ye(t,e,o){let i;if(e==="viewport")i=So(t,o);else if(e==="document")i=Co(Q(t));else if(K(e))i=ko(e,o);else{const r=be(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return $t(i)}function Ce(t,e){const o=st(t);return o===e||!K(o)||wt(o)?!1:W(o).position==="fixed"||Ce(o,e)}function Do(t,e){const o=e.get(t);if(o)return o;let i=Ct(t,[],!1).filter(d=>K(d)&&ft(d)!=="body"),r=null;const s=W(t).position==="fixed";let n=s?st(t):t;for(;K(n)&&!wt(n);){const d=W(n),a=Bt(n);!a&&d.position==="fixed"&&(r=null),(s?!a&&!r:!a&&d.position==="static"&&!!r&&xo.has(r.position)||yt(n)&&!a&&Ce(t,n))?i=i.filter(l=>l!==n):r=d,n=st(n)}return e.set(t,i),i}function To(t){let{element:e,boundary:o,rootBoundary:i,strategy:r}=t;const n=[...o==="clippingAncestors"?At(e)?[]:Do(e,this._c):[].concat(o),i],d=n[0],a=n.reduce((c,l)=>{const g=ye(e,l,r);return c.top=P(g.top,c.top),c.right=rt(g.right,c.right),c.bottom=rt(g.bottom,c.bottom),c.left=P(g.left,c.left),c},ye(e,d,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Eo(t){const{width:e,height:o}=me(t);return{width:e,height:o}}function $o(t,e,o){const i=G(e),r=Q(e),s=o==="fixed",n=lt(t,!0,s,e);let d={scrollLeft:0,scrollTop:0};const a=X(0);function c(){a.x=Rt(r)}if(i||!i&&!s)if((ft(e)!=="body"||yt(r))&&(d=Ot(e)),i){const u=lt(e,!0,s,e);a.x=u.x+e.clientLeft,a.y=u.y+e.clientTop}else r&&c();s&&!i&&r&&c();const l=r&&!i&&!s?ve(r,d):X(0),g=n.left+d.scrollLeft-a.x-l.x,h=n.top+d.scrollTop-a.y-l.y;return{x:g,y:h,width:n.width,height:n.height}}function Qt(t){return W(t).position==="static"}function Se(t,e){if(!G(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return Q(t)===o&&(o=o.ownerDocument.body),o}function xe(t,e){const o=H(t);if(At(t))return o;if(!G(t)){let r=st(t);for(;r&&!wt(r);){if(K(r)&&!Qt(r))return r;r=st(r)}return o}let i=Se(t,e);for(;i&&go(i)&&Qt(i);)i=Se(i,e);return i&&wt(i)&&Qt(i)&&!Bt(i)?o:i||wo(t)||o}const Mo=async function(t){const e=this.getOffsetParent||xe,o=this.getDimensions,i=await o(t.floating);return{reference:$o(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Ao(t){return W(t).direction==="rtl"}const Oo={convertOffsetParentRelativeRectToViewportRelativeRect:_o,getDocumentElement:Q,getClippingRect:To,getOffsetParent:xe,getElementRects:Mo,getClientRects:yo,getDimensions:Eo,getScale:mt,isElement:K,isRTL:Ao};function ke(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ro(t,e){let o=null,i;const r=Q(t);function s(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function n(d,a){d===void 0&&(d=!1),a===void 0&&(a=1),s();const c=t.getBoundingClientRect(),{left:l,top:g,width:h,height:u}=c;if(d||e(),!h||!u)return;const p=Tt(g),m=Tt(r.clientWidth-(l+h)),f=Tt(r.clientHeight-(g+u)),b=Tt(l),_={rootMargin:-p+"px "+-m+"px "+-f+"px "+-b+"px",threshold:P(0,rt(1,a))||1};let C=!0;function y(k){const x=k[0].intersectionRatio;if(x!==a){if(!C)return n();x?n(!1,x):i=setTimeout(()=>{n(!1,1e-7)},1e3)}x===1&&!ke(c,t.getBoundingClientRect())&&n(),C=!1}try{o=new IntersectionObserver(y,{..._,root:r.ownerDocument})}catch{o=new IntersectionObserver(y,_)}o.observe(t)}return n(!0),s}function Io(t,e,o,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,c=Xt(t),l=r||s?[...c?Ct(c):[],...Ct(e)]:[];l.forEach(b=>{r&&b.addEventListener("scroll",o,{passive:!0}),s&&b.addEventListener("resize",o)});const g=c&&d?Ro(c,o):null;let h=-1,u=null;n&&(u=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&u&&(u.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=u)==null||_.observe(e)})),o()}),c&&!a&&u.observe(c),u.observe(e));let p,m=a?lt(t):null;a&&f();function f(){const b=lt(t);m&&!ke(m,b)&&o(),m=b,p=requestAnimationFrame(f)}return o(),()=>{var b;l.forEach(v=>{r&&v.removeEventListener("scroll",o),s&&v.removeEventListener("resize",o)}),g==null||g(),(b=u)==null||b.disconnect(),u=null,a&&cancelAnimationFrame(p)}}const It=no,De=so,Lt=oo,Lo=ao,Po=eo,Pt=(t,e,o)=>{const i=new Map,r={platform:Oo,...o},s={...r.platform,_c:i};return to(t,e,{...r,platform:s})};function dt(t,e,o,i){var s;A(t);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
1
+ (function(H,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(H=typeof globalThis<"u"?globalThis:H||self,z(H.WebGrid={}))})(this,function(H){"use strict";var Zi=Object.defineProperty;var tr=(H,z,ht)=>z in H?Zi(H,z,{enumerable:!0,configurable:!0,writable:!0,value:ht}):H[z]=ht;var w=(H,z,ht)=>tr(H,typeof z!="symbol"?z+"":z,ht);class z{constructor(){w(this,"_items",[]);w(this,"_columns",[]);w(this,"_sortMode","none");w(this,"_filterable",!1);w(this,"_pageable",!1);w(this,"_pageSize",10);w(this,"_pageSizes",[10,25,50,100]);w(this,"_striped",!0);w(this,"_hoverable",!0);w(this,"_editable",!1);w(this,"_editTrigger","dblclick");w(this,"_editStartSelection","mousePosition");w(this,"_mode","excel");w(this,"_dropdownToggleVisibility","always");w(this,"_dropdownShowOnFocus",!0);w(this,"_openDropdownOnEnter",!1);w(this,"_checkboxAlwaysEditable",!1);w(this,"_showRowNumbers",!1);w(this,"_invalidCells",[]);w(this,"_showRowToolbar",!1);w(this,"_rowToolbar",["add","delete","duplicate"]);w(this,"_toolbarAlign","center");w(this,"_toolbarTopPosition","center");w(this,"_toolbarTrigger","hover");w(this,"_toolbarPosition","auto");w(this,"_contextMenu");w(this,"_onrowchange");w(this,"_onroweditstart");w(this,"_onroweditcancel");w(this,"_onvalidationerror");w(this,"_validationTooltipCallback");w(this,"_ontoolbarclick");w(this,"_onrowaction");w(this,"_oncontextmenuopen");w(this,"_ondatarequest");w(this,"_onrowdelete");w(this,"_sort",[]);w(this,"_filters",{});w(this,"_currentPage",1);w(this,"_totalItems",null);w(this,"_showPagination",!0);w(this,"_paginationPosition","bottom-center");w(this,"_paginationLabelsCallback");w(this,"_paginationLayout","pageSize|previous|pageInfo|next");w(this,"_summaryPosition");w(this,"_summaryContentCallback");w(this,"_summaryMetadata");w(this,"_summaryInline",!0);w(this,"_customStylesCallback");w(this,"_rowClassCallback");w(this,"_virtualScroll",!1);w(this,"_virtualScrollThreshold",100);w(this,"_virtualScrollRowHeight",38);w(this,"_virtualScrollBuffer",10);w(this,"_infiniteScroll",!1);w(this,"_infiniteScrollThreshold",100);w(this,"_hasMoreItems",!0);w(this,"_isLoadingMore",!1);w(this,"_editingCell",null);w(this,"_currentCellError",null);w(this,"_isValidating",!1);w(this,"_draftRows",new Map);w(this,"_focusedCell",null);w(this,"_isCommittingFromKeyboard",!1);w(this,"_skipNextDropdownAutoEdit",!1)}get items(){return this._items}set items(e){this._items=e,this.requestUpdate()}get columns(){return this._columns}set columns(e){this._columns=e,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(e){this._sortMode=e,this.requestUpdate()}get sortable(){return this._sortMode!=="none"}set sortable(e){this._sortMode=e?"multi":"none",this.requestUpdate()}get filterable(){return this._filterable}set filterable(e){this._filterable=e,this.requestUpdate()}get pageable(){return this._pageable}set pageable(e){this._pageable=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 striped(){return this._striped}set striped(e){this._striped=e,this.requestUpdate()}get hoverable(){return this._hoverable}set hoverable(e){this._hoverable=e,this.requestUpdate()}get editable(){return this._editable}set editable(e){this._editable=e,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,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.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get dropdownShowOnFocus(){return this._dropdownShowOnFocus}set dropdownShowOnFocus(e){this._dropdownShowOnFocus=e}get openDropdownOnEnter(){return this._openDropdownOnEnter}set openDropdownOnEnter(e){this._openDropdownOnEnter=e}getEffectiveOpenDropdownOnEnter(e){return e.openDropdownOnEnter??this._openDropdownOnEnter}get checkboxAlwaysEditable(){return this._checkboxAlwaysEditable}set checkboxAlwaysEditable(e){this._checkboxAlwaysEditable=e,this.requestUpdate()}get showRowNumbers(){return this._showRowNumbers}set showRowNumbers(e){this._showRowNumbers=e,this.requestUpdate()}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 showRowToolbar(){return this._showRowToolbar}set showRowToolbar(e){this._showRowToolbar=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarAlign(){return this._toolbarAlign}set toolbarAlign(e){this._toolbarAlign=e,this.requestUpdate()}get toolbarTopPosition(){return this._toolbarTopPosition}set toolbarTopPosition(e){this._toolbarTopPosition=e,this.requestUpdate()}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.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(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 summaryInline(){return this._summaryInline}set summaryInline(e){this._summaryInline=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 virtualScroll(){return this._virtualScroll}set virtualScroll(e){this._virtualScroll=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 infiniteScroll(){return this._infiniteScroll}set infiniteScroll(e){this._infiniteScroll=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._virtualScroll===!1?!1:this._virtualScroll===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}get showRowActions(){return this._showRowToolbar}set showRowActions(e){this.showRowToolbar=e}get rowActions(){return this._rowToolbar}set rowActions(e){this.rowToolbar=e}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}set oncontextmenuopen(e){this._oncontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(e=>e.editTrigger==="navigate")}get filteredItems(){return!this._filterable||Object.keys(this._filters).length===0?this._items:this._items.filter(e=>Object.entries(this._filters).every(([o,i])=>i?String(e[o]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return 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._pageable)return this.sortedItems;const e=(this._currentPage-1)*this._pageSize,o=e+this._pageSize;return this.sortedItems.slice(e,o)}get totalPages(){const e=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(e/this._pageSize))}get displayItems(){return this.paginatedItems}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};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._editable=!1,this._dropdownToggleVisibility="on-focus";break;case"excel":this._editable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!1;break;case"input-matrix":this._editable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!0;break}}requestUpdate(){}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e),this._invalidCells=this._invalidCells.filter(o=>o.rowIndex!==e),this.requestUpdate()}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,o,i){const r=this._draftRows.get(o);return r?r[i]:e[i]}getCellValue(e,o,i){if(o.templateCallback)return o.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(o.field)):e[String(o.field)];return o.formatCallback?o.formatCallback(r,e):String(r??"")}isCellInvalid(e,o){return this._invalidCells.some(i=>i.rowIndex===e&&i.field===o)}getCellValidationError(e,o){const i=this._invalidCells.find(r=>r.rowIndex===e&&r.field===o);return(i==null?void 0:i.error)||null}addInvalidCell(e,o,i){const r=this._invalidCells.findIndex(s=>s.rowIndex===e&&s.field===o);r>=0?this._invalidCells[r]={rowIndex:e,field:o,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:e,field:o,error:i}]}removeInvalidCell(e,o){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===e&&i.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}startEdit(e,o,i){var s;const r=this.displayItems[e];r&&(this._draftRows.has(e)||this._draftRows.set(e,{...r}),this._editingCell={rowIndex:e,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},this._currentCellError=null,this.requestUpdate(),(s=this._onroweditstart)==null||s.call(this,{row:r,rowIndex:e,field:o}))}cancelEdit(){var e;if(this._editingCell){const{rowIndex:o,field:i}=this._editingCell,r=this.displayItems[o];r&&((e=this._onroweditcancel)==null||e.call(this,{row:r,rowIndex:o,field:i})),this._editingCell=null,this._currentCellError=null,this.requestUpdate()}}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){var g,h;const r=this._columns.find(u=>String(u.field)===o);if(!r)return;const s=this.displayItems[e];if(!s)return;const n=s[o];let d=i,a=null,c=!0;this._isValidating=!0;try{if(r.beforeCommitCallback){const u={value:i,oldValue:n,row:s,rowIndex:e,field:o},p=await Promise.resolve(r.beforeCommitCallback(u)),m=this.normalizeValidationResult(p,i);c=m.valid,a=m.message||null,d=m.finalValue}else if(r.validateCallback){const u=await Promise.resolve(r.validateCallback(i,s));u&&(c=!1,a=u)}}catch(u){c=!1,a=u instanceof Error?u.message:"Validation failed"}this._isValidating=!1;let l=this._draftRows.get(e);l||(l={...s},this._draftRows.set(e,l)),l[o]=d,c?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,a||"Invalid value"),this._currentCellError=a,(g=this._onvalidationerror)==null||g.call(this,{row:s,rowIndex:e,field:o,error:a||"Invalid value"})),(h=this._onrowchange)==null||h.call(this,{row:s,draftRow:l,rowIndex:e,field:o,oldValue:n,newValue:d,isValid:c,validationError:a}),this._editingCell=null,this.requestUpdate()}isCellEditable(e){return e.editable===!1?!1:this._editable||e.editor!==void 0}getEditableColumns(){return this._columns.map((e,o)=>({index:o,column:e})).filter(({column:e})=>this.isCellEditable(e))}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){this._focusedCell={rowIndex:e,colIndex:o}}clearFocusedCell(){this._focusedCell=null}}const ht=':host{--wg-rem: 10px;font-family:var(--wg-font-family, var(--base-font-family, system-ui, -apple-system, sans-serif));display:block;--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, #e6f2ff);--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-base, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-sm, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-lg, 1.6) * var(--wg-rem));--wg-line-height-base: calc(var(--base-line-height-normal, 2) * var(--wg-rem));--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--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-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-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-cell-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--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-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-md);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--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-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-tooltip-bg: var(--base-tooltip-bg, #333);--wg-context-menu-z-index: 1001;--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-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001}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__table{width:max-content;min-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__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:40px;min-width:40px;max-width:40px;text-align:center;color:var(--wg-text-color-secondary);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number{border-right:var(--wg-cell-border)}.wg__actions-column{width:32px;min-width:32px;max-width:32px;padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);border-bottom:var(--wg-header-border)}.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:1;background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);border-bottom:var(--wg-header-border);text-align:left;-webkit-user-select:none;user-select:none}.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-content{display:flex;align-items:center;gap:4px;justify-content:space-between}.wg__header-title{flex:1}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center;display:inline-flex;align-items:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:600;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:4px;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-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__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);scroll-margin-top:3rem;scroll-margin-bottom:.5rem}.wg__cell-text{-webkit-user-select:none;user-select:none}.wg__cell--ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--editable{cursor:pointer;position:relative}.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}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light, #fee);box-shadow:inset 0 0 0 2px var(--wg-danger-color, #c00)}.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg, #f5f5f5)}.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--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size, 28px);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-secondary, #666);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color, #0078d4);background:var(--wg-hover-bg, rgba(0, 0, 0, .05))}.wg__editor--checkbox{width:auto;height:auto;margin:0 auto}.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 24px 0 0;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:48px}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:12px;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:4px;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:48px}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.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%;cursor:pointer}.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}.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:48px}.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, #fff);border:1px solid var(--wg-border-color, #d1d1d1);border-radius:4px;box-shadow:var(--wg-toolbar-shadow);max-height:200px;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-spacing-sm);padding:6px 12px;cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg, #f0f0f0)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light, #e6f2ff)}.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:8px 12px;color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg--navigate-mode .wg__cell{cursor:cell}.wg--navigate-mode .wg__cell:focus{outline:none}.wg--navigate-mode .wg__cell.wg__cell--focused{outline:2px solid var(--wg-focus-border-color, #217346);outline-offset:-2px}.wg__cell--focused:after{display:none}.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-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:4px}.wg__pagination-pagesize{display:flex;align-items:center;gap:6px}.wg__pagination-select{padding:4px 8px;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-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, 1000)}.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:2px;align-items:center;height:calc(var(--wg-design-unit, 4) * 4px + 21px);padding:0 4px}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:16px;background:var(--wg-toolbar-divider-color);margin:0 4px;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:4px;font-size:var(--wg-font-size-base);font-weight:500;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--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:12px;white-space:nowrap}.wg__actions-column{width:24px;min-width:24px;max-width:24px;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:48px}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.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:fixed;z-index:var(--wg-z-tooltip, 10000);max-width:300px;padding:6px 10px;background:var(--wg-tooltip-bg, #333);color:var(--wg-tooltip-color, #fff);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:0 2px 8px #0003;pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:8px;height:8px;background:var(--wg-tooltip-bg, #333);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:-4px}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:-4px}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:-4px}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:-4px}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;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);padding:var(--wg-spacing-lg);box-shadow:0 4px 20px #00000026;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-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 #0078d433}.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-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:#fff}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover, #106ebe)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@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}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.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}';function Vt(t,e,o){const i=o.valueMember||"value",r=o.displayMember||"label",s=e.find(n=>n[i]===t);return s?String(s[r]??""):t!=null?String(t):""}function _t(t,e){if(e.getDisplayCallback)return e.getDisplayCallback(t);const o=e.displayMember||"label";return String(t[o]??t.label??"")}function lt(t,e){if(e.getValueCallback)return e.getValueCallback(t);const o=e.valueMember||"value";return t[o]??t.value}function Be(t,e){return e.getIconCallback?e.getIconCallback(t):e.iconMember&&t[e.iconMember]||null}function Ke(t,e){return e.getSubtitleCallback?e.getSubtitleCallback(t):e.subtitleMember&&t[e.subtitleMember]||null}function yt(t,e){return e.getDisabledCallback?e.getDisabledCallback(t):e.disabledMember?!!t[e.disabledMember]:!1}const rt=Math.min,F=Math.max,$t=Math.round,Mt=Math.floor,Z=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},Xe={start:"end",end:"start"};function qt(t,e,o){return F(t,rt(e,o))}function pt(t,e){return typeof t=="function"?t(e):t}function nt(t){return t.split("-")[0]}function ft(t){return t.split("-")[1]}function ge(t){return t==="x"?"y":"x"}function Yt(t){return t==="y"?"height":"width"}const Qe=new Set(["top","bottom"]);function ot(t){return Qe.has(nt(t))?"y":"x"}function Nt(t){return ge(ot(t))}function Ge(t,e,o){o===void 0&&(o=!1);const i=ft(t),r=Nt(t),s=Yt(r);let n=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(n=At(n)),[n,At(n)]}function Je(t){const e=At(t);return[Ut(t),e,Ut(e)]}function Ut(t){return t.replace(/start|end/g,e=>Xe[e])}const ue=["left","right"],he=["right","left"],Ze=["top","bottom"],to=["bottom","top"];function eo(t,e,o){switch(t){case"top":case"bottom":return o?e?he:ue:e?ue:he;case"left":case"right":return e?Ze:to;default:return[]}}function oo(t,e,o,i){const r=ft(t);let s=eo(nt(t),o==="start",i);return r&&(s=s.map(n=>n+"-"+r),e&&(s=s.concat(s.map(Ut)))),s}function At(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function io(t){return{top:0,right:0,bottom:0,left:0,...t}}function pe(t){return typeof t!="number"?io(t):{top:t,right:t,bottom:t,left:t}}function Ot(t){const{x:e,y:o,width:i,height:r}=t;return{width:i,height:r,top:o,left:e,right:e+i,bottom:o+r,x:e,y:o}}function fe(t,e,o){let{reference:i,floating:r}=t;const s=ot(e),n=Nt(e),d=Yt(n),a=nt(e),c=s==="y",l=i.x+i.width/2-r.width/2,g=i.y+i.height/2-r.height/2,h=i[d]/2-r[d]/2;let u;switch(a){case"top":u={x:l,y:i.y-r.height};break;case"bottom":u={x:l,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:g};break;case"left":u={x:i.x-r.width,y:g};break;default:u={x:i.x,y:i.y}}switch(ft(e)){case"start":u[n]-=h*(o&&c?-1:1);break;case"end":u[n]+=h*(o&&c?-1:1);break}return u}const ro=async(t,e,o)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:n}=o,d=s.filter(Boolean),a=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:t,floating:e,strategy:r}),{x:l,y:g}=fe(c,i,a),h=i,u={},p=0;for(let m=0;m<d.length;m++){const{name:f,fn:b}=d[m],{x:v,y:_,data:S,reset:y}=await b({x:l,y:g,initialPlacement:i,placement:h,strategy:r,middlewareData:u,rects:c,platform:n,elements:{reference:t,floating:e}});l=v??l,g=_??g,u={...u,[f]:{...u[f],...S}},y&&p<=50&&(p++,typeof y=="object"&&(y.placement&&(h=y.placement),y.rects&&(c=y.rects===!0?await n.getElementRects({reference:t,floating:e,strategy:r}):y.rects),{x:l,y:g}=fe(c,h,a)),m=-1)}return{x:l,y:g,placement:h,strategy:r,middlewareData:u}};async function jt(t,e){var o;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:n,elements:d,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:l="viewport",elementContext:g="floating",altBoundary:h=!1,padding:u=0}=pt(e,t),p=pe(u),f=d[h?g==="floating"?"reference":"floating":g],b=Ot(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(f)))==null||o?f:f.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(d.floating)),boundary:c,rootBoundary:l,strategy:a})),v=g==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d.floating)),S=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},y=Ot(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:v,offsetParent:_,strategy:a}):v);return{top:(b.top-y.top+p.top)/S.y,bottom:(y.bottom-b.bottom+p.bottom)/S.y,left:(b.left-y.left+p.left)/S.x,right:(y.right-b.right+p.right)/S.x}}const no=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:i,placement:r,rects:s,platform:n,elements:d,middlewareData:a}=e,{element:c,padding:l=0}=pt(t,e)||{};if(c==null)return{};const g=pe(l),h={x:o,y:i},u=Nt(r),p=Yt(u),m=await n.getDimensions(c),f=u==="y",b=f?"top":"left",v=f?"bottom":"right",_=f?"clientHeight":"clientWidth",S=s.reference[p]+s.reference[u]-h[u]-s.floating[p],y=h[u]-s.reference[u],D=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c));let x=D?D[_]:0;(!x||!await(n.isElement==null?void 0:n.isElement(D)))&&(x=d.floating[_]||s.floating[p]);const C=S/2-y/2,T=x/2-m[p]/2-1,k=rt(g[b],T),$=rt(g[v],T),A=k,N=x-m[p]-$,O=x/2-m[p]/2+C,R=qt(A,O,N),U=!a.arrow&&ft(r)!=null&&O!==R&&s.reference[p]/2-(O<A?k:$)-m[p]/2<0,j=U?O<A?O-A:O-N:0;return{[u]:h[u]+j,data:{[u]:R,centerOffset:O-R-j,...U&&{alignmentOffset:j}},reset:U}}}),so=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,i;const{placement:r,middlewareData:s,rects:n,initialPlacement:d,platform:a,elements:c}=e,{mainAxis:l=!0,crossAxis:g=!0,fallbackPlacements:h,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...f}=pt(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const b=nt(r),v=ot(d),_=nt(d)===d,S=await(a.isRTL==null?void 0:a.isRTL(c.floating)),y=h||(_||!m?[At(d)]:Je(d)),D=p!=="none";!h&&D&&y.push(...oo(d,m,p,S));const x=[d,...y],C=await jt(e,f),T=[];let k=((i=s.flip)==null?void 0:i.overflows)||[];if(l&&T.push(C[b]),g){const O=Ge(r,n,S);T.push(C[O[0]],C[O[1]])}if(k=[...k,{placement:r,overflows:T}],!T.every(O=>O<=0)){var $,A;const O=((($=s.flip)==null?void 0:$.index)||0)+1,R=x[O];if(R&&(!(g==="alignment"?v!==ot(R):!1)||k.every(B=>ot(B.placement)===v?B.overflows[0]>0:!0)))return{data:{index:O,overflows:k},reset:{placement:R}};let U=(A=k.filter(j=>j.overflows[0]<=0).sort((j,B)=>j.overflows[1]-B.overflows[1])[0])==null?void 0:A.placement;if(!U)switch(u){case"bestFit":{var N;const j=(N=k.filter(B=>{if(D){const L=ot(B.placement);return L===v||L==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(L=>L>0).reduce((L,K)=>L+K,0)]).sort((B,L)=>B[1]-L[1])[0])==null?void 0:N[0];j&&(U=j);break}case"initialPlacement":U=d;break}if(r!==U)return{reset:{placement:U}}}return{}}}},ao=new Set(["left","top"]);async function lo(t,e){const{placement:o,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=nt(o),d=ft(o),a=ot(o)==="y",c=ao.has(n)?-1:1,l=s&&a?-1:1,g=pt(e,t);let{mainAxis:h,crossAxis:u,alignmentAxis:p}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof p=="number"&&(u=d==="end"?p*-1:p),a?{x:u*l,y:h*c}:{x:h*c,y:u*l}}const co=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,i;const{x:r,y:s,placement:n,middlewareData:d}=e,a=await lo(e,t);return n===((o=d.offset)==null?void 0:o.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:n}}}}},go=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:n=!1,limiter:d={fn:f=>{let{x:b,y:v}=f;return{x:b,y:v}}},...a}=pt(t,e),c={x:o,y:i},l=await jt(e,a),g=ot(nt(r)),h=ge(g);let u=c[h],p=c[g];if(s){const f=h==="y"?"top":"left",b=h==="y"?"bottom":"right",v=u+l[f],_=u-l[b];u=qt(v,u,_)}if(n){const f=g==="y"?"top":"left",b=g==="y"?"bottom":"right",v=p+l[f],_=p-l[b];p=qt(v,p,_)}const m=d.fn({...e,[h]:u,[g]:p});return{...m,data:{x:m.x-o,y:m.y-i,enabled:{[h]:s,[g]:n}}}}}},uo=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var o,i;const{placement:r,rects:s,platform:n,elements:d}=e,{apply:a=()=>{},...c}=pt(t,e),l=await jt(e,c),g=nt(r),h=ft(r),u=ot(r)==="y",{width:p,height:m}=s.floating;let f,b;g==="top"||g==="bottom"?(f=g,b=h===(await(n.isRTL==null?void 0:n.isRTL(d.floating))?"start":"end")?"left":"right"):(b=g,f=h==="end"?"top":"bottom");const v=m-l.top-l.bottom,_=p-l.left-l.right,S=rt(m-l[f],v),y=rt(p-l[b],_),D=!e.middlewareData.shift;let x=S,C=y;if((o=e.middlewareData.shift)!=null&&o.enabled.x&&(C=_),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(x=v),D&&!h){const k=F(l.left,0),$=F(l.right,0),A=F(l.top,0),N=F(l.bottom,0);u?C=p-2*(k!==0||$!==0?k+$:F(l.left,l.right)):x=m-2*(A!==0||N!==0?A+N:F(l.top,l.bottom))}await a({...e,availableWidth:C,availableHeight:x});const T=await n.getDimensions(d.floating);return p!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function Rt(){return typeof window<"u"}function wt(t){return we(t)?(t.nodeName||"").toLowerCase():"#document"}function V(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function tt(t){var e;return(e=(we(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function we(t){return Rt()?t instanceof Node||t instanceof V(t).Node:!1}function Q(t){return Rt()?t instanceof Element||t instanceof V(t).Element:!1}function et(t){return Rt()?t instanceof HTMLElement||t instanceof V(t).HTMLElement:!1}function me(t){return!Rt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof V(t).ShadowRoot}const ho=new Set(["inline","contents"]);function Ct(t){const{overflow:e,overflowX:o,overflowY:i,display:r}=G(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+o)&&!ho.has(r)}const po=new Set(["table","td","th"]);function fo(t){return po.has(wt(t))}const wo=[":popover-open",":modal"];function Pt(t){return wo.some(e=>{try{return t.matches(e)}catch{return!1}})}const mo=["transform","translate","scale","rotate","perspective"],bo=["transform","translate","scale","rotate","perspective","filter"],vo=["paint","layout","strict","content"];function Bt(t){const e=Kt(),o=Q(t)?G(t):t;return mo.some(i=>o[i]?o[i]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||bo.some(i=>(o.willChange||"").includes(i))||vo.some(i=>(o.contain||"").includes(i))}function _o(t){let e=st(t);for(;et(e)&&!mt(e);){if(Bt(e))return e;if(Pt(e))return null;e=st(e)}return null}function Kt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yo=new Set(["html","body","#document"]);function mt(t){return yo.has(wt(t))}function G(t){return V(t).getComputedStyle(t)}function It(t){return Q(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function st(t){if(wt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||me(t)&&t.host||tt(t);return me(e)?e.host:e}function be(t){const e=st(t);return mt(e)?t.ownerDocument?t.ownerDocument.body:t.body:et(e)&&Ct(e)?e:be(e)}function St(t,e,o){var i;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=be(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),n=V(r);if(s){const d=Wt(n);return e.concat(n,n.visualViewport||[],Ct(r)?r:[],d&&o?St(d):[])}return e.concat(r,St(r,[],o))}function Wt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ve(t){const e=G(t);let o=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=et(t),s=r?t.offsetWidth:o,n=r?t.offsetHeight:i,d=$t(o)!==s||$t(i)!==n;return d&&(o=s,i=n),{width:o,height:i,$:d}}function Xt(t){return Q(t)?t:t.contextElement}function bt(t){const e=Xt(t);if(!et(e))return Z(1);const o=e.getBoundingClientRect(),{width:i,height:r,$:s}=ve(e);let n=(s?$t(o.width):o.width)/i,d=(s?$t(o.height):o.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!d||!Number.isFinite(d))&&(d=1),{x:n,y:d}}const Co=Z(0);function _e(t){const e=V(t);return!Kt()||!e.visualViewport?Co:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function So(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==V(t)?!1:e}function dt(t,e,o,i){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Xt(t);let n=Z(1);e&&(i?Q(i)&&(n=bt(i)):n=bt(t));const d=So(s,o,i)?_e(s):Z(0);let a=(r.left+d.x)/n.x,c=(r.top+d.y)/n.y,l=r.width/n.x,g=r.height/n.y;if(s){const h=V(s),u=i&&Q(i)?V(i):i;let p=h,m=Wt(p);for(;m&&i&&u!==p;){const f=bt(m),b=m.getBoundingClientRect(),v=G(m),_=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*f.x,S=b.top+(m.clientTop+parseFloat(v.paddingTop))*f.y;a*=f.x,c*=f.y,l*=f.x,g*=f.y,a+=_,c+=S,p=V(m),m=Wt(p)}}return Ot({width:l,height:g,x:a,y:c})}function Lt(t,e){const o=It(t).scrollLeft;return e?e.left+o:dt(tt(t)).left+o}function ye(t,e){const o=t.getBoundingClientRect(),i=o.left+e.scrollLeft-Lt(t,o),r=o.top+e.scrollTop;return{x:i,y:r}}function xo(t){let{elements:e,rect:o,offsetParent:i,strategy:r}=t;const s=r==="fixed",n=tt(i),d=e?Pt(e.floating):!1;if(i===n||d&&s)return o;let a={scrollLeft:0,scrollTop:0},c=Z(1);const l=Z(0),g=et(i);if((g||!g&&!s)&&((wt(i)!=="body"||Ct(n))&&(a=It(i)),et(i))){const u=dt(i);c=bt(i),l.x=u.x+i.clientLeft,l.y=u.y+i.clientTop}const h=n&&!g&&!s?ye(n,a):Z(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-a.scrollLeft*c.x+l.x+h.x,y:o.y*c.y-a.scrollTop*c.y+l.y+h.y}}function ko(t){return Array.from(t.getClientRects())}function Do(t){const e=tt(t),o=It(t),i=t.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=F(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-o.scrollLeft+Lt(t);const d=-o.scrollTop;return G(i).direction==="rtl"&&(n+=F(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:n,y:d}}const Ce=25;function To(t,e){const o=V(t),i=tt(t),r=o.visualViewport;let s=i.clientWidth,n=i.clientHeight,d=0,a=0;if(r){s=r.width,n=r.height;const l=Kt();(!l||l&&e==="fixed")&&(d=r.offsetLeft,a=r.offsetTop)}const c=Lt(i);if(c<=0){const l=i.ownerDocument,g=l.body,h=getComputedStyle(g),u=l.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(i.clientWidth-g.clientWidth-u);p<=Ce&&(s-=p)}else c<=Ce&&(s+=c);return{width:s,height:n,x:d,y:a}}const Eo=new Set(["absolute","fixed"]);function $o(t,e){const o=dt(t,!0,e==="fixed"),i=o.top+t.clientTop,r=o.left+t.clientLeft,s=et(t)?bt(t):Z(1),n=t.clientWidth*s.x,d=t.clientHeight*s.y,a=r*s.x,c=i*s.y;return{width:n,height:d,x:a,y:c}}function Se(t,e,o){let i;if(e==="viewport")i=To(t,o);else if(e==="document")i=Do(tt(t));else if(Q(e))i=$o(e,o);else{const r=_e(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ot(i)}function xe(t,e){const o=st(t);return o===e||!Q(o)||mt(o)?!1:G(o).position==="fixed"||xe(o,e)}function Mo(t,e){const o=e.get(t);if(o)return o;let i=St(t,[],!1).filter(d=>Q(d)&&wt(d)!=="body"),r=null;const s=G(t).position==="fixed";let n=s?st(t):t;for(;Q(n)&&!mt(n);){const d=G(n),a=Bt(n);!a&&d.position==="fixed"&&(r=null),(s?!a&&!r:!a&&d.position==="static"&&!!r&&Eo.has(r.position)||Ct(n)&&!a&&xe(t,n))?i=i.filter(l=>l!==n):r=d,n=st(n)}return e.set(t,i),i}function Ao(t){let{element:e,boundary:o,rootBoundary:i,strategy:r}=t;const n=[...o==="clippingAncestors"?Pt(e)?[]:Mo(e,this._c):[].concat(o),i],d=n[0],a=n.reduce((c,l)=>{const g=Se(e,l,r);return c.top=F(g.top,c.top),c.right=rt(g.right,c.right),c.bottom=rt(g.bottom,c.bottom),c.left=F(g.left,c.left),c},Se(e,d,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Oo(t){const{width:e,height:o}=ve(t);return{width:e,height:o}}function Ro(t,e,o){const i=et(e),r=tt(e),s=o==="fixed",n=dt(t,!0,s,e);let d={scrollLeft:0,scrollTop:0};const a=Z(0);function c(){a.x=Lt(r)}if(i||!i&&!s)if((wt(e)!=="body"||Ct(r))&&(d=It(e)),i){const u=dt(e,!0,s,e);a.x=u.x+e.clientLeft,a.y=u.y+e.clientTop}else r&&c();s&&!i&&r&&c();const l=r&&!i&&!s?ye(r,d):Z(0),g=n.left+d.scrollLeft-a.x-l.x,h=n.top+d.scrollTop-a.y-l.y;return{x:g,y:h,width:n.width,height:n.height}}function Qt(t){return G(t).position==="static"}function ke(t,e){if(!et(t)||G(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return tt(t)===o&&(o=o.ownerDocument.body),o}function De(t,e){const o=V(t);if(Pt(t))return o;if(!et(t)){let r=st(t);for(;r&&!mt(r);){if(Q(r)&&!Qt(r))return r;r=st(r)}return o}let i=ke(t,e);for(;i&&fo(i)&&Qt(i);)i=ke(i,e);return i&&mt(i)&&Qt(i)&&!Bt(i)?o:i||_o(t)||o}const Po=async function(t){const e=this.getOffsetParent||De,o=this.getDimensions,i=await o(t.floating);return{reference:Ro(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Io(t){return G(t).direction==="rtl"}const Lo={convertOffsetParentRelativeRectToViewportRelativeRect:xo,getDocumentElement:tt,getClippingRect:Ao,getOffsetParent:De,getElementRects:Po,getClientRects:ko,getDimensions:Oo,getScale:bt,isElement:Q,isRTL:Io};function Te(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ho(t,e){let o=null,i;const r=tt(t);function s(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function n(d,a){d===void 0&&(d=!1),a===void 0&&(a=1),s();const c=t.getBoundingClientRect(),{left:l,top:g,width:h,height:u}=c;if(d||e(),!h||!u)return;const p=Mt(g),m=Mt(r.clientWidth-(l+h)),f=Mt(r.clientHeight-(g+u)),b=Mt(l),_={rootMargin:-p+"px "+-m+"px "+-f+"px "+-b+"px",threshold:F(0,rt(1,a))||1};let S=!0;function y(D){const x=D[0].intersectionRatio;if(x!==a){if(!S)return n();x?n(!1,x):i=setTimeout(()=>{n(!1,1e-7)},1e3)}x===1&&!Te(c,t.getBoundingClientRect())&&n(),S=!1}try{o=new IntersectionObserver(y,{..._,root:r.ownerDocument})}catch{o=new IntersectionObserver(y,_)}o.observe(t)}return n(!0),s}function zo(t,e,o,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,c=Xt(t),l=r||s?[...c?St(c):[],...St(e)]:[];l.forEach(b=>{r&&b.addEventListener("scroll",o,{passive:!0}),s&&b.addEventListener("resize",o)});const g=c&&d?Ho(c,o):null;let h=-1,u=null;n&&(u=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&u&&(u.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=u)==null||_.observe(e)})),o()}),c&&!a&&u.observe(c),u.observe(e));let p,m=a?dt(t):null;a&&f();function f(){const b=dt(t);m&&!Te(m,b)&&o(),m=b,p=requestAnimationFrame(f)}return o(),()=>{var b;l.forEach(v=>{r&&v.removeEventListener("scroll",o),s&&v.removeEventListener("resize",o)}),g==null||g(),(b=u)==null||b.disconnect(),u=null,a&&cancelAnimationFrame(p)}}const Ht=co,Gt=go,xt=so,Fo=uo,Vo=no,kt=(t,e,o)=>{const i=new Map,r={platform:Lo,...o},s={...r.platform,_c:i};return ro(t,e,{...r,platform:s})};function ct(t,e,o,i){var s;P(t);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
5
5
  max-height: 200px;
6
6
  overflow-y: auto;
7
7
  z-index: 1000;
8
- `,o.length===0)r.innerHTML=`<div class="wg__dropdown-empty">${t.isSearching?"Searching...":"No options"}</div>`;else{const n=t.grid.editingCell,d=n?(s=t.grid.displayItems[n.rowIndex])==null?void 0:s[n.field]:void 0;r.innerHTML=o.map((a,c)=>{const l=c===t.highlightedIndex,g=at(a,i)===d,h=_t(a,i);if(i.renderOptionCallback){const _={index:c,isHighlighted:l,isSelected:g,isDisabled:h};return i.renderOptionCallback(a,_)}const u=vt(a,i),p=Ye(a,i),m=Ne(a,i),f=["wg__dropdown-option"];l&&f.push("wg__dropdown-option--highlighted"),g&&f.push("wg__dropdown-option--selected"),h&&f.push("wg__dropdown-option--disabled");const b=p?`<span class="wg__dropdown-option-icon">${t.escapeHtml(p)}</span>`:"",v=m?`<span class="wg__dropdown-option-subtitle">${t.escapeHtml(m)}</span>`:"";return`<div class="${f.join(" ")}" data-index="${c}" ${h?'data-disabled="true"':""}>
8
+ `,o.length===0)r.innerHTML=`<div class="wg__dropdown-empty">${t.isSearching?"Searching...":"No options"}</div>`;else{const n=t.grid.editingCell,d=n?(s=t.grid.displayItems[n.rowIndex])==null?void 0:s[n.field]:void 0;r.innerHTML=o.map((a,c)=>{const l=c===t.highlightedIndex,g=lt(a,i)===d,h=yt(a,i);if(i.renderOptionCallback){const _={index:c,isHighlighted:l,isSelected:g,isDisabled:h};return i.renderOptionCallback(a,_)}const u=_t(a,i),p=Be(a,i),m=Ke(a,i),f=["wg__dropdown-option"];l&&f.push("wg__dropdown-option--highlighted"),g&&f.push("wg__dropdown-option--selected"),h&&f.push("wg__dropdown-option--disabled");const b=p?`<span class="wg__dropdown-option-icon">${t.escapeHtml(p)}</span>`:"",v=m?`<span class="wg__dropdown-option-subtitle">${t.escapeHtml(m)}</span>`:"";return`<div class="${f.join(" ")}" data-index="${c}" ${h?'data-disabled="true"':""}>
9
9
  ${b}
10
10
  <div class="wg__dropdown-option-content">
11
11
  <span class="wg__dropdown-option-label">${t.escapeHtml(u)}</span>
12
12
  ${v}
13
13
  </div>
14
- </div>`}).join("")}return t.shadow.appendChild(r),t.dropdownOpen=!0,Pt(e,r,{strategy:"fixed",placement:"bottom-start",middleware:[It(1),Lt({fallbackPlacements:["top-start"]}),Lo({apply({rects:n}){Object.assign(r.style,{width:`${n.reference.width}px`})}})]}).then(({x:n,y:d})=>{Object.assign(r.style,{left:`${n}px`,top:`${d}px`})}),r}function A(t){const e=t.shadow.querySelector(".wg__dropdown");e==null||e.remove(),t.dropdownOpen=!1,t.highlightedIndex=-1,t.filterText=""}function Te(t,e,o=!0){const i=t.dropdownOptions[e];if(!i)return;const r=t.grid.editingCell;if(!r)return;const s=t.getCurrentEditorOptions();if(_t(i,s))return;const n=at(i,s),d=t.grid.columns.findIndex(c=>String(c.field)===r.field),a=t.grid.displayItems[r.rowIndex];if(s.onselect&&a&&s.onselect(i,a),t.justSelected=!0,t.isCommittingFromKeyboard=!0,A(t),t.grid.commitEdit(r.rowIndex,r.field,n),o)t.moveFocusAfterCommit(r.rowIndex,r.field,"down");else{const c=t.shadow.querySelector(`[data-row="${r.rowIndex}"][data-col="${d}"]`);c&&(c.classList.remove("wg__cell--editing"),c.classList.add("wg__cell--focused"))}requestAnimationFrame(()=>{t.justSelected=!1})}function ot(t){const e=t.shadow.querySelector(".wg__dropdown");if(!e)return;e.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===t.highlightedIndex)})}function Ee(t){const e=t.shadow.querySelector(".wg__dropdown-option--highlighted");e==null||e.scrollIntoView({block:"nearest"})}function $e(t,e){const o=t.shadow.querySelector(".wg__loading-indicator");o&&(o.style.display=e?"inline":"none");const i=t.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=e?"none":"inline")}function J(t){if(t.justSelected)return;const e=t.getCurrentEditingColumn();if(!e)return;const o=e.editorOptions||{},i=e.editor;let r=0;if(i==="select"){const n=o.options||[];if(t.filterText){const d=t.filterText.toLowerCase();t.dropdownOptions=n.filter(a=>vt(a,o).toLowerCase().includes(d)),r=t.dropdownOptions.length>0?0:-1}else{t.dropdownOptions=n;const d=t.grid.editingCell;if(d){const a=t.grid.displayItems[d.rowIndex],c=a?a[d.field]:void 0,l=t.dropdownOptions.findIndex(g=>at(g,o)===c);r=l>=0?l:0}else r=t.dropdownOptions.length>0?0:-1}}else if(i==="combobox"||i==="autocomplete"){const n=i==="autocomplete"?o.initialOptions||o.options||[]:o.options||[],d=t.grid.editingCell;let a;if(d){const l=t.grid.displayItems[d.rowIndex];a=l?l[d.field]:void 0}const c=n.findIndex(l=>at(l,o)===a);if(c>=0)t.dropdownOptions=n,r=c;else if(a!=null&&a!==""){const l=o.valueMember||"value",g=o.displayMember||"label",h=String(a),u={value:a,label:h,[l]:a,[g]:h};t.dropdownOptions=[u,...n],r=0}else t.dropdownOptions=n,r=n.length>0?0:-1}const s=t.shadow.querySelector(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete");if(s&&t.dropdownOptions.length>0){const n=t.filterText;t.isOpeningDropdown=!0;const d=dt(t,s,t.dropdownOptions,o);ct(t,d),t.filterText=n,t.highlightedIndex=r,ot(t);const a=t.shadow.querySelector(".wg__select-trigger"),c=t.shadow.querySelector(".wg__combobox-input, .wg__autocomplete-input"),l=a||c;l&&l.focus(),requestAnimationFrame(()=>{t.isOpeningDropdown=!1})}}function Me(t){t.dropdownOpen?A(t):J(t)}function ct(t,e){e.addEventListener("mousedown",o=>{o.preventDefault();const i=o.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);Te(t,r,!1)}}),e.addEventListener("mouseover",o=>{const i=o.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(t.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),ot(t))})}function Ae(t,e){const o=e.options||[],i=t.filterText.toLowerCase(),r=t.filterText;t.dropdownOptions=o.filter(n=>vt(n,e).toLowerCase().includes(i)),t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const s=t.shadow.querySelector(".wg__editor--select");if(s)if(t.dropdownOptions.length>0){const n=dt(t,s,t.dropdownOptions,e);ct(t,n),t.filterText=r,t.highlightedIndex=0,ot(t)}else A(t)}function Ho(t,e){const o=e.target;t.filterText=o.value,t.isUserFiltering=!0;const i=t.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},s=r.options||[];if(t.filterText.trim()){const d=t.filterText.toLowerCase();t.dropdownOptions=s.filter(a=>vt(a,r).toLowerCase().includes(d))}else t.dropdownOptions=s;t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const n=o.closest(".wg__editor--combobox");if(n){const d=dt(t,n,t.dropdownOptions,r);ct(t,d),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,ot(t)}}function zo(t,e){const o=e.target;t.filterText=o.value;const i=t.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},s=r.debounceMs??300,n=r.minSearchLength??1;t.searchDebounceTimer&&clearTimeout(t.searchDebounceTimer);const d=o.closest(".wg__editor--autocomplete");if(!t.dropdownOpen&&d){t.dropdownOptions=r.initialOptions||[];const a=dt(t,d,t.dropdownOptions,r);ct(t,a),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,ot(t)}if(t.filterText.length<n){if(t.dropdownOptions=r.initialOptions||[],d){const a=dt(t,d,t.dropdownOptions,r);ct(t,a),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,ot(t)}return}t.searchDebounceTimer=setTimeout(()=>{Fo(t,t.filterText,i)},s)}async function Fo(t,e,o){const i=o.editorOptions||{};if(!i.onSearchCallback)return;t.searchAbortController&&t.searchAbortController.abort(),t.searchAbortController=new AbortController;const r=t.searchAbortController.signal;t.isSearching=!0,$e(t,!0);try{const s=t.grid.editingCell;if(!s)return;const n=t.grid.displayItems[s.rowIndex],d=await i.onSearchCallback(e,n,r);if(!r.aborted){t.dropdownOptions=d;const a=t.shadow.querySelector(".wg__editor--autocomplete");if(a){const c=dt(t,a,t.dropdownOptions,i);ct(t,c),t.highlightedIndex=d.length>0?0:-1,ot(t)}}}catch(s){if(s instanceof Error&&s.name==="AbortError")return;console.error("Autocomplete search failed:",s),t.dropdownOptions=[];const n=t.shadow.querySelector(".wg__editor--autocomplete");if(n){const d=dt(t,n,t.dropdownOptions,i);ct(t,d)}}finally{r.aborted||(t.isSearching=!1,$e(t,!1))}}function Vo(t,e,o,i){const r=i??t.tooltipShowDelay;t.tooltipHideTimer&&(clearTimeout(t.tooltipHideTimer),t.tooltipHideTimer=null),!(t.tooltipElement&&t.tooltipAnchor===e)&&(t.tooltipShowTimer&&clearTimeout(t.tooltipShowTimer),t.tooltipShowTimer=setTimeout(()=>{Yo(t,e,o)},r))}function qo(t,e){const o=e??t.tooltipHideDelay;t.tooltipShowTimer&&(clearTimeout(t.tooltipShowTimer),t.tooltipShowTimer=null),t.tooltipElement&&(t.tooltipHideTimer=setTimeout(()=>{t.tooltipElement&&(t.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=t.tooltipElement)==null||i.remove(),t.tooltipElement=null,t.tooltipArrowElement=null,t.tooltipAnchor=null},100))},o))}function Yo(t,e,o){var s;(s=t.tooltipElement)==null||s.remove();const i=document.createElement("div");i.className="wg__tooltip",i.textContent=o;const r=document.createElement("div");r.className="wg__tooltip-arrow",i.appendChild(r),t.shadow.appendChild(i),t.tooltipElement=i,t.tooltipArrowElement=r,t.tooltipAnchor=e,Pt(e,i,{strategy:"fixed",placement:"top",middleware:[It(8),Lt({fallbackPlacements:["bottom","left","right"]}),Po({element:r})]}).then(({x:n,y:d,placement:a,middlewareData:c})=>{if(i.style.left=`${n}px`,i.style.top=`${d}px`,i.setAttribute("data-placement",a),c.arrow){const{x:l,y:g}=c.arrow;l!=null&&(r.style.left=`${l}px`),g!=null&&(r.style.top=`${g}px`)}requestAnimationFrame(()=>{i.classList.add("wg__tooltip--visible")})})}function No(t,e,o){if(t.grid.shouldUseVirtualScroll()){Uo(t,e);const n=t.shadow.querySelector(`[data-row="${e}"][data-col="${o}"]`);n&&n.focus({preventScroll:!0});return}const i=t.shadow.querySelector(`[data-row="${e}"][data-col="${o}"]`);if(!i)return;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});const r=t.shadow.querySelector(".wg__header"),s=t.shadow.querySelector(".wg");if(r&&s){const n=r.getBoundingClientRect(),d=i.getBoundingClientRect();if(d.top<n.bottom){const a=d.top-n.bottom-4;s.scrollBy({top:a,behavior:"instant"})}}}function Uo(t,e){const o=t.shadow.querySelector(".wg");if(!o)return;const i=t.grid.virtualScrollRowHeight,r=o.scrollTop,s=o.clientHeight,n=t.shadow.querySelector(".wg__header"),d=(n==null?void 0:n.offsetHeight)||0,a=e*i,c=a+i,l=r+d,g=r+s;a<l?o.scrollTop=a-d:c>g&&(o.scrollTop=c-s)}function gt(t,e){const o=t.shadow.querySelector(".wg");if(!o)return;const i=t.grid.virtualScrollRowHeight,r=Math.max(0,(e-1)*i),s=Math.max(0,o.scrollHeight-o.clientHeight);o.scrollTop=Math.min(r,s)}function N(t,e,o){if(e){const i=t.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${e.colIndex}"]`);i==null||i.classList.remove("wg__cell--focused")}if(o){const i=t.shadow.querySelector(`[data-row="${o.rowIndex}"][data-col="${o.colIndex}"]`);i==null||i.classList.add("wg__cell--focused")}}function z(t){const e=t.grid.editingCell;if(e){const o=t.grid.columns.findIndex(r=>String(r.field)===e.field),i=t.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${o}"]`);i&&i.classList.remove("wg__cell--editing")}}function jo(t,e,o){if(!t.grid.isNavigateMode)return;const i=t.grid.focusedCell,r={rowIndex:e,colIndex:o};t.grid.setFocusedCell(e,o),N(t,i,r)}function E(t,e,o){const i=t.grid.focusedCell,r={rowIndex:e,colIndex:o};t.grid.setFocusedCell(e,o),N(t,i,r),No(t,e,o)}function Z(t,e,o,i){const s=t.grid.columns[o];if(!s||!t.grid.isCellEditable(s))return;const n=String(s.field);t.grid.startEdit(e,n,i)}function Bo(t,e){const o=e.querySelector(".wg__cell-text");if(!o)return null;const i=o.textContent||"";if(!i.length)return 0;const r=t.clientX,s=o.getBoundingClientRect();if(r<=s.left)return 0;if(r>=s.right)return i.length;const n=o.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)return null;const d=document.createRange();let a=0,c=i.length;try{for(;a<c;){const l=Math.floor((a+c)/2);d.setStart(n,0),d.setEnd(n,l),d.getBoundingClientRect().right<r?a=l+1:c=l}if(a>0&&a<i.length){d.setStart(n,a-1),d.setEnd(n,a);const l=d.getBoundingClientRect(),g=l.left+l.width/2;r<g&&a--}}catch{return i.length}return a}function Ko(t,e){const o=e.relatedTarget,i=t.shadow.querySelector(".wg__table");if(!o||!(i!=null&&i.contains(o))){const r=t.grid.focusedCell;t.grid.clearFocusedCell(),N(t,r,null)}}function Wo(t,e){if(!t)return null;const[o,i,r]=t.split("-").map(Number),s=new Date(o,i-1,r);if(isNaN(s.getTime()))return null;switch(e){case"date":return s;case"timestamp":return s.getTime();case"iso":default:return t}}function Ht(t,e){const o=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"";let r;if(e instanceof HTMLInputElement)if(e.type==="checkbox"){const s=JSON.parse(e.dataset.trueValue||"true"),n=JSON.parse(e.dataset.falseValue||"false");r=e.checked?s:n}else e.classList.contains("wg__editor--number")?r=e.value===""?null:parseFloat(e.value):e.type==="date"?r=Wo(e.value,e.dataset.outputFormat||"iso"):r=e.value;else e instanceof HTMLSelectElement&&(r=e.value);t.grid.commitEdit(o,i,r)}function Xo(t,e){Ht(t,e)}function Qo(t,e,o){const i=t.grid.columns[o];if(!i)return;const r=String(i.field),s=t.grid.displayItems[e];if(!s)return;const n=i.editorOptions||{},d=n.trueValue??!0,a=n.falseValue??!1,l=s[r]===d?a:d;t.grid.commitEdit(e,r,l);const g=t.grid.displayItems;e<g.length-1&&requestAnimationFrame(()=>{E(t,e+1,o)})}function Go(t,e){t.isCommittingFromKeyboard||t.grid.editingCell&&Ht(t,e)}function Gt(t,e,o,i){const s=t.grid.columns.findIndex(c=>String(c.field)===o),n=t.grid.displayItems;let d=e,a=s;if(i==="down")d=Math.min(e+1,n.length-1);else if(i==="up")d=Math.max(e-1,0);else{const c=t.grid.getEditableColumns(),l=c.findIndex(g=>g.index===s);i==="next"?l>=0&&l<c.length-1?a=c[l+1].index:e<n.length-1&&(d=e+1,a=c[0].index):l>0?a=c[l-1].index:e>0&&(d=e-1,a=c[c.length-1].index)}requestAnimationFrame(()=>{E(t,d,a),t.isCommittingFromKeyboard=!1})}function Jo(t,e,o){const r=t.grid.columns.findIndex(s=>String(s.field)===o);r>=0&&requestAnimationFrame(()=>{E(t,e,r),t.isCommittingFromKeyboard=!1})}function Oe(t,e,o,i){const r=String(i.field),s=t.grid.displayItems[e],n=t.grid.getCellRawValue(s,e,r);switch(i.editor||"text"){case"checkbox":return ii(t,e,r,n,i);case"number":return ti(t,e,r,n,i);case"date":return ei(t,e,r,n,i);case"select":return ri(t,e,r,n,i);case"combobox":return ni(t,e,r,n,i);case"autocomplete":return si(t,e,r,n,i);case"custom":return ai(t,e,r,n,i);case"text":default:return Zo(t,e,r,n,i)}}function Zo(t,e,o,i,r){var a;const s=r.editorOptions||{},n=(a=t.grid.editingCell)==null?void 0:a.initialSearchQuery,d=n!==void 0?n:i!=null?String(i):"";return`
14
+ </div>`}).join("")}return t.shadow.appendChild(r),t.dropdownOpen=!0,kt(e,r,{strategy:"fixed",placement:"bottom-start",middleware:[Ht(1),xt({fallbackPlacements:["top-start"]}),Fo({apply({rects:n}){Object.assign(r.style,{width:`${n.reference.width}px`})}})]}).then(({x:n,y:d})=>{Object.assign(r.style,{left:`${n}px`,top:`${d}px`})}),r}function P(t){const e=t.shadow.querySelector(".wg__dropdown");e==null||e.remove(),t.dropdownOpen=!1,t.highlightedIndex=-1,t.filterText=""}function Ee(t,e,o=!0){const i=t.dropdownOptions[e];if(!i)return;const r=t.grid.editingCell;if(!r)return;const s=t.getCurrentEditorOptions();if(yt(i,s))return;const n=lt(i,s),d=t.grid.columns.findIndex(c=>String(c.field)===r.field),a=t.grid.displayItems[r.rowIndex];if(s.onselect&&a&&s.onselect(i,a),t.justSelected=!0,t.isCommittingFromKeyboard=!0,P(t),t.grid.commitEdit(r.rowIndex,r.field,n),o)t.moveFocusAfterCommit(r.rowIndex,r.field,"down");else{const c=t.shadow.querySelector(`[data-row="${r.rowIndex}"][data-col="${d}"]`);c&&(c.classList.remove("wg__cell--editing"),c.classList.add("wg__cell--focused"))}requestAnimationFrame(()=>{t.justSelected=!1})}function it(t){const e=t.shadow.querySelector(".wg__dropdown");if(!e)return;e.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===t.highlightedIndex)})}function $e(t){const e=t.shadow.querySelector(".wg__dropdown-option--highlighted");e==null||e.scrollIntoView({block:"nearest"})}function Me(t,e){const o=t.shadow.querySelector(".wg__loading-indicator");o&&(o.style.display=e?"inline":"none");const i=t.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=e?"none":"inline")}function J(t){if(t.justSelected)return;const e=t.getCurrentEditingColumn();if(!e)return;const o=e.editorOptions||{},i=e.editor;let r=0;if(i==="select"){const n=o.options||[];if(t.filterText){const d=t.filterText.toLowerCase();t.dropdownOptions=n.filter(a=>_t(a,o).toLowerCase().includes(d)),r=t.dropdownOptions.length>0?0:-1}else{t.dropdownOptions=n;const d=t.grid.editingCell;if(d){const a=t.grid.displayItems[d.rowIndex],c=a?a[d.field]:void 0,l=t.dropdownOptions.findIndex(g=>lt(g,o)===c);r=l>=0?l:0}else r=t.dropdownOptions.length>0?0:-1}}else if(i==="combobox"||i==="autocomplete"){const n=i==="autocomplete"?o.initialOptions||o.options||[]:o.options||[],d=t.grid.editingCell;let a;if(d){const l=t.grid.displayItems[d.rowIndex];a=l?l[d.field]:void 0}const c=n.findIndex(l=>lt(l,o)===a);if(c>=0)t.dropdownOptions=n,r=c;else if(a!=null&&a!==""){const l=o.valueMember||"value",g=o.displayMember||"label",h=String(a),u={value:a,label:h,[l]:a,[g]:h};t.dropdownOptions=[u,...n],r=0}else t.dropdownOptions=n,r=n.length>0?0:-1}const s=t.shadow.querySelector(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete");if(s&&t.dropdownOptions.length>0){const n=t.filterText;t.isOpeningDropdown=!0;const d=ct(t,s,t.dropdownOptions,o);gt(t,d),t.filterText=n,t.highlightedIndex=r,it(t);const a=t.shadow.querySelector(".wg__select-trigger"),c=t.shadow.querySelector(".wg__combobox-input, .wg__autocomplete-input"),l=a||c;l&&l.focus(),requestAnimationFrame(()=>{t.isOpeningDropdown=!1})}}function Ae(t){t.dropdownOpen?P(t):J(t)}function gt(t,e){e.addEventListener("mousedown",o=>{o.preventDefault();const i=o.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);Ee(t,r,!1)}}),e.addEventListener("mouseover",o=>{const i=o.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(t.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),it(t))})}function Oe(t,e){const o=e.options||[],i=t.filterText.toLowerCase(),r=t.filterText;t.dropdownOptions=o.filter(n=>_t(n,e).toLowerCase().includes(i)),t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const s=t.shadow.querySelector(".wg__editor--select");if(s)if(t.dropdownOptions.length>0){const n=ct(t,s,t.dropdownOptions,e);gt(t,n),t.filterText=r,t.highlightedIndex=0,it(t)}else P(t)}function qo(t,e){const o=e.target;t.filterText=o.value,t.isUserFiltering=!0;const i=t.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},s=r.options||[];if(t.filterText.trim()){const d=t.filterText.toLowerCase();t.dropdownOptions=s.filter(a=>_t(a,r).toLowerCase().includes(d))}else t.dropdownOptions=s;t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const n=o.closest(".wg__editor--combobox");if(n){const d=ct(t,n,t.dropdownOptions,r);gt(t,d),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,it(t)}}function Yo(t,e){const o=e.target;t.filterText=o.value;const i=t.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},s=r.debounceMs??300,n=r.minSearchLength??1;t.searchDebounceTimer&&clearTimeout(t.searchDebounceTimer);const d=o.closest(".wg__editor--autocomplete");if(!t.dropdownOpen&&d){t.dropdownOptions=r.initialOptions||[];const a=ct(t,d,t.dropdownOptions,r);gt(t,a),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,it(t)}if(t.filterText.length<n){if(t.dropdownOptions=r.initialOptions||[],d){const a=ct(t,d,t.dropdownOptions,r);gt(t,a),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,it(t)}return}t.searchDebounceTimer=setTimeout(()=>{No(t,t.filterText,i)},s)}async function No(t,e,o){const i=o.editorOptions||{};if(!i.onSearchCallback)return;t.searchAbortController&&t.searchAbortController.abort(),t.searchAbortController=new AbortController;const r=t.searchAbortController.signal;t.isSearching=!0,Me(t,!0);try{const s=t.grid.editingCell;if(!s)return;const n=t.grid.displayItems[s.rowIndex],d=await i.onSearchCallback(e,n,r);if(!r.aborted){t.dropdownOptions=d;const a=t.shadow.querySelector(".wg__editor--autocomplete");if(a){const c=ct(t,a,t.dropdownOptions,i);gt(t,c),t.highlightedIndex=d.length>0?0:-1,it(t)}}}catch(s){if(s instanceof Error&&s.name==="AbortError")return;console.error("Autocomplete search failed:",s),t.dropdownOptions=[];const n=t.shadow.querySelector(".wg__editor--autocomplete");if(n){const d=ct(t,n,t.dropdownOptions,i);gt(t,d)}}finally{r.aborted||(t.isSearching=!1,Me(t,!1))}}function Re(t,e,o,i,r){const s=i??t.tooltipShowDelay;t.tooltipHideTimer&&(clearTimeout(t.tooltipHideTimer),t.tooltipHideTimer=null),!(t.tooltipElement&&t.tooltipAnchor===e)&&(t.tooltipShowTimer&&clearTimeout(t.tooltipShowTimer),t.tooltipShowTimer=setTimeout(()=>{jo(t,e,o,r)},s))}function Uo(t,e){const o=e??t.tooltipHideDelay;t.tooltipShowTimer&&(clearTimeout(t.tooltipShowTimer),t.tooltipShowTimer=null),t.tooltipElement&&(t.tooltipHideTimer=setTimeout(()=>{t.tooltipElement&&(t.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=t.tooltipElement)==null||i.remove(),t.tooltipElement=null,t.tooltipArrowElement=null,t.tooltipAnchor=null},100))},o))}function jo(t,e,o,i){var d;(d=t.tooltipElement)==null||d.remove();const r=document.createElement("div");r.className="wg__tooltip";const s=document.createElement("div");s.className="wg__tooltip-content",i?s.innerHTML=o:s.textContent=o,r.appendChild(s);const n=document.createElement("div");n.className="wg__tooltip-arrow",r.appendChild(n),t.shadow.appendChild(r),t.tooltipElement=r,t.tooltipArrowElement=n,t.tooltipAnchor=e,kt(e,r,{strategy:"fixed",placement:"top",middleware:[Ht(8),xt({fallbackPlacements:["bottom","left","right"]}),Vo({element:n})]}).then(({x:a,y:c,placement:l,middlewareData:g})=>{if(r.style.left=`${a}px`,r.style.top=`${c}px`,r.setAttribute("data-placement",l),g.arrow){const{x:h,y:u}=g.arrow;h!=null&&(n.style.left=`${h}px`),u!=null&&(n.style.top=`${u}px`)}requestAnimationFrame(()=>{r.classList.add("wg__tooltip--visible")})})}function Bo(t,e,o){if(t.grid.shouldUseVirtualScroll()){Ko(t,e);const n=t.shadow.querySelector(`[data-row="${e}"][data-col="${o}"]`);n&&n.focus({preventScroll:!0});return}const i=t.shadow.querySelector(`[data-row="${e}"][data-col="${o}"]`);if(!i)return;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});const r=t.shadow.querySelector(".wg__header"),s=t.shadow.querySelector(".wg");if(r&&s){const n=r.getBoundingClientRect(),d=i.getBoundingClientRect();if(d.top<n.bottom){const a=d.top-n.bottom-4;s.scrollBy({top:a,behavior:"instant"})}}}function Ko(t,e){const o=t.shadow.querySelector(".wg");if(!o)return;const i=t.grid.virtualScrollRowHeight,r=o.scrollTop,s=o.clientHeight,n=t.shadow.querySelector(".wg__header"),d=(n==null?void 0:n.offsetHeight)||0,a=e*i,c=a+i,l=r+d,g=r+s;a<l?o.scrollTop=a-d:c>g&&(o.scrollTop=c-s)}function ut(t,e){const o=t.shadow.querySelector(".wg");if(!o)return;const i=t.grid.virtualScrollRowHeight,r=Math.max(0,(e-1)*i),s=Math.max(0,o.scrollHeight-o.clientHeight);o.scrollTop=Math.min(r,s)}function W(t,e,o){if(e){const i=t.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${e.colIndex}"]`);i==null||i.classList.remove("wg__cell--focused")}if(o){const i=t.shadow.querySelector(`[data-row="${o.rowIndex}"][data-col="${o.colIndex}"]`);i==null||i.classList.add("wg__cell--focused")}}function q(t){const e=t.grid.editingCell;if(e){const o=t.grid.columns.findIndex(r=>String(r.field)===e.field),i=t.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${o}"]`);i&&i.classList.remove("wg__cell--editing")}}function Wo(t,e,o){if(!t.grid.isNavigateMode)return;const i=t.grid.focusedCell,r={rowIndex:e,colIndex:o};t.grid.setFocusedCell(e,o),W(t,i,r)}function E(t,e,o){const i=t.grid.focusedCell,r={rowIndex:e,colIndex:o};t.grid.setFocusedCell(e,o),W(t,i,r),Bo(t,e,o)}function X(t,e,o,i){const s=t.grid.columns[o];if(!s||!t.grid.isCellEditable(s))return;const n=String(s.field);t.grid.startEdit(e,n,i)}function Jt(t,e){const o=e.querySelector(".wg__cell-text");if(!o)return null;const i=o.textContent||"";if(!i.length)return 0;const r=t.clientX,s=o.getBoundingClientRect();if(r<=s.left)return 0;if(r>=s.right)return i.length;const n=o.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)return null;const d=document.createRange();let a=0,c=i.length;try{for(;a<c;){const l=Math.floor((a+c)/2);d.setStart(n,0),d.setEnd(n,l),d.getBoundingClientRect().right<r?a=l+1:c=l}if(a>0&&a<i.length){d.setStart(n,a-1),d.setEnd(n,a);const l=d.getBoundingClientRect(),g=l.left+l.width/2;r<g&&a--}}catch{return i.length}return a}function Xo(t,e){const o=e.relatedTarget,i=t.shadow.querySelector(".wg__table");if(!o||!(i!=null&&i.contains(o))){const r=t.grid.focusedCell;t.grid.clearFocusedCell(),W(t,r,null)}}function Qo(t,e){if(!t)return null;const[o,i,r]=t.split("-").map(Number),s=new Date(o,i-1,r);if(isNaN(s.getTime()))return null;switch(e){case"date":return s;case"timestamp":return s.getTime();case"iso":default:return t}}function zt(t,e){const o=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"";let r;if(e instanceof HTMLInputElement)if(e.type==="checkbox"){const s=JSON.parse(e.dataset.trueValue||"true"),n=JSON.parse(e.dataset.falseValue||"false");r=e.checked?s:n}else e.classList.contains("wg__editor--number")?r=e.value===""?null:parseFloat(e.value):e.type==="date"?r=Qo(e.value,e.dataset.outputFormat||"iso"):r=e.value;else e instanceof HTMLSelectElement&&(r=e.value);t.grid.commitEdit(o,i,r)}function Go(t,e){zt(t,e)}function Jo(t,e,o){const i=t.grid.columns[o];if(!i)return;const r=String(i.field),s=t.grid.displayItems[e];if(!s)return;const n=i.editorOptions||{},d=n.trueValue??!0,a=n.falseValue??!1,l=s[r]===d?a:d;t.grid.commitEdit(e,r,l);const g=t.grid.displayItems;e<g.length-1&&requestAnimationFrame(()=>{E(t,e+1,o)})}function Zo(t,e){t.isCommittingFromKeyboard||t.grid.editingCell&&zt(t,e)}function Zt(t,e,o,i){const s=t.grid.columns.findIndex(c=>String(c.field)===o),n=t.grid.displayItems;let d=e,a=s;if(i==="down")d=Math.min(e+1,n.length-1);else if(i==="up")d=Math.max(e-1,0);else{const c=t.grid.getEditableColumns(),l=c.findIndex(g=>g.index===s);i==="next"?l>=0&&l<c.length-1?a=c[l+1].index:e<n.length-1&&(d=e+1,a=c[0].index):l>0?a=c[l-1].index:e>0&&(d=e-1,a=c[c.length-1].index)}requestAnimationFrame(()=>{E(t,d,a),t.isCommittingFromKeyboard=!1})}function ti(t,e,o){const r=t.grid.columns.findIndex(s=>String(s.field)===o);r>=0&&requestAnimationFrame(()=>{E(t,e,r),t.isCommittingFromKeyboard=!1})}function Pe(t,e,o,i){const r=String(i.field),s=t.grid.displayItems[e],n=t.grid.getCellRawValue(s,e,r);switch(i.editor||"text"){case"checkbox":return ni(t,e,r,n,i);case"number":return oi(t,e,r,n,i);case"date":return ii(t,e,r,n,i);case"select":return si(t,e,r,n,i);case"combobox":return ai(t,e,r,n,i);case"autocomplete":return li(t,e,r,n,i);case"custom":return di(t,e,r,n,i);case"text":default:return ei(t,e,r,n,i)}}function ei(t,e,o,i,r){var a;const s=r.editorOptions||{},n=(a=t.grid.editingCell)==null?void 0:a.initialSearchQuery,d=n!==void 0?n:i!=null?String(i):"";return`
15
15
  <input
16
16
  type="text"
17
17
  class="wg__editor wg__editor--text"
@@ -22,7 +22,7 @@
22
22
  ${s.placeholder?`placeholder="${t.escapeHtml(s.placeholder)}"`:""}
23
23
  ${s.pattern?`pattern="${t.escapeHtml(s.pattern)}"`:""}
24
24
  />
25
- `}function ti(t,e,o,i,r){var d;r.editorOptions;const s=(d=t.grid.editingCell)==null?void 0:d.initialSearchQuery;return`
25
+ `}function oi(t,e,o,i,r){var d;r.editorOptions;const s=(d=t.grid.editingCell)==null?void 0:d.initialSearchQuery;return`
26
26
  <input
27
27
  type="text"
28
28
  inputmode="numeric"
@@ -31,7 +31,7 @@
31
31
  data-row="${e}"
32
32
  data-field="${o}"
33
33
  />
34
- `}function ei(t,e,o,i,r){var c;const s=r.editorOptions||{},n=(c=t.grid.editingCell)==null?void 0:c.initialSearchQuery,d=Jt(i),a=n!==void 0?n:oi(i,s.dateFormat);return`
34
+ `}function ii(t,e,o,i,r){var c;const s=r.editorOptions||{},n=(c=t.grid.editingCell)==null?void 0:c.initialSearchQuery,d=te(i),a=n!==void 0?n:ri(i,s.dateFormat);return`
35
35
  <div class="wg__editor wg__editor--date" data-row="${e}" data-field="${o}">
36
36
  <input
37
37
  type="text"
@@ -42,15 +42,15 @@
42
42
  data-date-value="${d}"
43
43
  data-output-format="${s.outputFormat||"iso"}"
44
44
  data-date-format="${s.dateFormat||"YYYY-MM-DD"}"
45
- ${s.minDate?`data-min-date="${Jt(s.minDate)}"`:""}
46
- ${s.maxDate?`data-max-date="${Jt(s.maxDate)}"`:""}
45
+ ${s.minDate?`data-min-date="${te(s.minDate)}"`:""}
46
+ ${s.maxDate?`data-max-date="${te(s.maxDate)}"`:""}
47
47
  placeholder="${t.escapeHtml(s.dateFormat||"YYYY-MM-DD")}"
48
48
  />
49
49
  <button type="button" class="wg__date-trigger" tabindex="-1">
50
50
  <svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
51
51
  </button>
52
52
  </div>
53
- `}function oi(t,e){if(!t)return"";let o=null;if(t instanceof Date?o=t:typeof t=="number"?o=new Date(t):typeof t=="string"&&(o=new Date(t)),!o||isNaN(o.getTime()))return"";const i=e||"YYYY-MM-DD",r=o.getFullYear(),s=String(o.getMonth()+1).padStart(2,"0"),n=String(o.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",s).replace("DD",n)}function Jt(t){if(!t)return"";let e=null;if(t instanceof Date?e=t:typeof t=="number"?e=new Date(t):typeof t=="string"&&(e=new Date(t)),!e||isNaN(e.getTime()))return"";const o=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${o}-${i}-${r}`}function ii(t,e,o,i,r){const s=r.editorOptions||{},n=s.trueValue!==void 0?s.trueValue:!0;return`
53
+ `}function ri(t,e){if(!t)return"";let o=null;if(t instanceof Date?o=t:typeof t=="number"?o=new Date(t):typeof t=="string"&&(o=new Date(t)),!o||isNaN(o.getTime()))return"";const i=e||"YYYY-MM-DD",r=o.getFullYear(),s=String(o.getMonth()+1).padStart(2,"0"),n=String(o.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",s).replace("DD",n)}function te(t){if(!t)return"";let e=null;if(t instanceof Date?e=t:typeof t=="number"?e=new Date(t):typeof t=="string"&&(e=new Date(t)),!e||isNaN(e.getTime()))return"";const o=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${o}-${i}-${r}`}function ni(t,e,o,i,r){const s=r.editorOptions||{},n=s.trueValue!==void 0?s.trueValue:!0;return`
54
54
  <input
55
55
  type="checkbox"
56
56
  class="wg__editor wg__editor--checkbox"
@@ -60,7 +60,7 @@
60
60
  data-true-value="${t.escapeHtml(JSON.stringify(s.trueValue??!0))}"
61
61
  data-false-value="${t.escapeHtml(JSON.stringify(s.falseValue??!1))}"
62
62
  />
63
- `}function ri(t,e,o,i,r){var c;const s=r.editorOptions||{},n=s.options||[],d=Vt(i,n,s),a=(c=t.grid.editingCell)==null?void 0:c.initialSearchQuery;return t.dropdownOptions=n,t.filterText=a||"",t.highlightedIndex=n.findIndex(l=>at(l,s)===i),t.highlightedIndex<0&&n.length>0&&(t.highlightedIndex=0),`
63
+ `}function si(t,e,o,i,r){var c;const s=r.editorOptions||{},n=s.options||[],d=Vt(i,n,s),a=(c=t.grid.editingCell)==null?void 0:c.initialSearchQuery;return t.dropdownOptions=n,t.filterText=a||"",t.highlightedIndex=n.findIndex(l=>lt(l,s)===i),t.highlightedIndex<0&&n.length>0&&(t.highlightedIndex=0),`
64
64
  <div
65
65
  class="wg__editor wg__editor--select wg__select-trigger"
66
66
  tabindex="0"
@@ -72,7 +72,7 @@
72
72
  <span class="wg__select-value">${t.escapeHtml(d)}</span>
73
73
  <span class="wg__select-toggle">▼</span>
74
74
  </div>
75
- `}function ni(t,e,o,i,r){var l;const s=r.editorOptions||{},n=s.options||[],d=Vt(i,n,s),a=(l=t.grid.editingCell)==null?void 0:l.initialSearchQuery,c=a!==void 0?a:d;return t.dropdownOptions=n,t.filterText=c,t.highlightedIndex=n.length>0?0:-1,`
75
+ `}function ai(t,e,o,i,r){var l;const s=r.editorOptions||{},n=s.options||[],d=Vt(i,n,s),a=(l=t.grid.editingCell)==null?void 0:l.initialSearchQuery,c=a!==void 0?a:d;return t.dropdownOptions=n,t.filterText=c,t.highlightedIndex=n.length>0?0:-1,`
76
76
  <div class="wg__editor wg__editor--combobox" data-row="${e}" data-field="${o}">
77
77
  <input
78
78
  type="text"
@@ -83,7 +83,7 @@
83
83
  />
84
84
  <span class="wg__combobox-toggle">▼</span>
85
85
  </div>
86
- `}function si(t,e,o,i,r){var l;const s=r.editorOptions||{},n=s.initialOptions||s.options||[],d=Vt(i,n,s),a=(l=t.grid.editingCell)==null?void 0:l.initialSearchQuery,c=a!==void 0?a:d;return t.dropdownOptions=n,t.filterText=c,t.highlightedIndex=n.length>0?0:-1,`
86
+ `}function li(t,e,o,i,r){var l;const s=r.editorOptions||{},n=s.initialOptions||s.options||[],d=Vt(i,n,s),a=(l=t.grid.editingCell)==null?void 0:l.initialSearchQuery,c=a!==void 0?a:d;return t.dropdownOptions=n,t.filterText=c,t.highlightedIndex=n.length>0?0:-1,`
87
87
  <div class="wg__editor wg__editor--autocomplete" data-row="${e}" data-field="${o}">
88
88
  <input
89
89
  type="text"
@@ -96,7 +96,7 @@
96
96
  <span class="wg__combobox-toggle">▼</span>
97
97
  <span class="wg__loading-indicator" style="display: none;">⏳</span>
98
98
  </div>
99
- `}function ai(t,e,o,i,r){const s=r.formatCallback?r.formatCallback(i,t.grid.displayItems[e]):i!=null?String(i):"";return`
99
+ `}function di(t,e,o,i,r){const s=r.formatCallback?r.formatCallback(i,t.grid.displayItems[e]):i!=null?String(i):"";return`
100
100
  <div
101
101
  class="wg__editor wg__editor--custom"
102
102
  tabindex="0"
@@ -105,7 +105,7 @@
105
105
  >
106
106
  <span class="wg__custom-value">${t.escapeHtml(s)}</span>
107
107
  </div>
108
- `}function Re(t,e,o,i,r,s){const n=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",d=i.editor==="date",a=String(i.field);return n?`
108
+ `}function Ie(t,e,o,i,r,s){const n=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",d=i.editor==="date",a=String(i.field);return n?`
109
109
  <div class="wg__cell-dropdown-display ${t.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":""}" data-row="${e}" data-field="${a}">
110
110
  <span class="wg__select-value">${t.escapeHtml(r)}</span>
111
111
  <span class="wg__select-toggle">▼</span>
@@ -117,16 +117,16 @@
117
117
  <svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
118
118
  </button>
119
119
  </div>
120
- `:i.templateCallback?`<span class="wg__cell-text">${r}</span>`:`<span class="wg__cell-text">${t.escapeHtml(r)}</span>`}let F={path:null,arrowPos:null,arrowDir:"right"};const li={add:{icon:"+",title:"Add row"},delete:{icon:"−",title:"Delete row",danger:!0},duplicate:{icon:"⧉",title:"Duplicate row"},moveUp:{icon:"↑",title:"Move up"},moveDown:{icon:"↓",title:"Move down"}};function di(t){return t.map((e,o)=>{if(typeof e=="string"){const i=li[e];return i?{id:e,icon:i.icon,title:i.title,row:1,group:1,type:e,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${e}`),null)}return{id:e.id||`toolbar-item-${o}`,icon:e.icon,title:e.title,label:e.label,row:e.row??1,group:e.group??1,type:e.type,danger:e.danger,disabled:e.disabled,onclick:e.onclick}}).filter(e=>e!==null)}function ci(t){const e=new Map;for(const r of t){const s=r.row;e.has(s)||e.set(s,[]),e.get(s).push(r)}const o=[],i=[...e.keys()].sort((r,s)=>r-s);for(const r of i){const s=e.get(r),n=new Map;for(const a of s){const c=a.group;n.has(c)||n.set(c,[]),n.get(c).push(a)}const d=[...n.keys()].sort((a,c)=>a-c);o.push({rowNum:r,groups:d.map(a=>({groupNum:a,items:n.get(a)}))})}return o}function gi(t,e,o){return`<div class="wg__toolbar">${ci(t).map(({groups:s})=>`<div class="wg__toolbar-row">${s.map(({items:d},a)=>{const c=a>0?'<div class="wg__toolbar-divider"></div>':"",l=d.map(g=>{const h=typeof g.disabled=="function"?g.disabled(e,o):g.disabled,u=["wg__toolbar-btn",g.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),p=g.label?`<span class="wg__toolbar-label">${g.label}</span>`:"";return`<button
120
+ `:i.templateCallback?`<span class="wg__cell-text">${r}</span>`:`<span class="wg__cell-text">${t.escapeHtml(r)}</span>`}let I={path:null,arrowPos:null,arrowDir:"right"};const ci={add:{icon:"+",title:"Add row"},delete:{icon:"−",title:"Delete row",danger:!0},duplicate:{icon:"⧉",title:"Duplicate row"},moveUp:{icon:"↑",title:"Move up"},moveDown:{icon:"↓",title:"Move down"}};function gi(t){return t.map((e,o)=>{if(typeof e=="string"){const i=ci[e];return i?{id:e,icon:i.icon,title:i.title,row:1,group:1,type:e,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${e}`),null)}return{id:e.id||`toolbar-item-${o}`,icon:e.icon,title:e.title,label:e.label,row:e.row??1,group:e.group??1,type:e.type,danger:e.danger,disabled:e.disabled,onclick:e.onclick}}).filter(e=>e!==null)}function ui(t){const e=new Map;for(const r of t){const s=r.row;e.has(s)||e.set(s,[]),e.get(s).push(r)}const o=[],i=[...e.keys()].sort((r,s)=>r-s);for(const r of i){const s=e.get(r),n=new Map;for(const a of s){const c=a.group;n.has(c)||n.set(c,[]),n.get(c).push(a)}const d=[...n.keys()].sort((a,c)=>a-c);o.push({rowNum:r,groups:d.map(a=>({groupNum:a,items:n.get(a)}))})}return o}function hi(t,e,o){return`<div class="wg__toolbar">${ui(t).map(({groups:s})=>`<div class="wg__toolbar-row">${s.map(({items:d},a)=>{const c=a>0?'<div class="wg__toolbar-divider"></div>':"",l=d.map(g=>{const h=typeof g.disabled=="function"?g.disabled(e,o):g.disabled,u=["wg__toolbar-btn",g.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),p=g.label?`<span class="wg__toolbar-label">${g.label}</span>`:"";return`<button
121
121
  class="${u}"
122
122
  data-toolbar-item="${g.id}"
123
123
  title="${g.title}"
124
124
  ${h?"disabled":""}
125
- >${g.icon}${p}</button>`}).join("");return c+l}).join("")}</div>`).join("")}</div>`}let $=null;function ui(t,e,o,i,r,s,n){zt();const d=gi(i,r,o),a=document.createElement("div");a.className="wg__toolbar-container",a.innerHTML=d,t.shadow.appendChild(a);const c=a.querySelector(".wg__toolbar");let l="left";requestAnimationFrame(()=>{const h=t.shadow.querySelector(`tr[data-row-index="${o}"]`);if(!h){zt();return}const u=h.getBoundingClientRect(),p=c.getBoundingClientRect(),m=t.shadow.querySelector(".wg__table"),f=m==null?void 0:m.getBoundingClientRect(),b=100;f&&(f.left>=b?l="left":window.innerWidth-f.right>=b?l="right":l="top");let v,_;if(l==="left")v=u.left-p.width,_=u.top+(u.height-p.height)/2;else if(l==="right")v=u.right,_=u.top+(u.height-p.height)/2;else{_=u.top-p.height;const C=t.grid.toolbarTopPosition;C==="start"?v=u.left:C==="end"?v=u.right-p.width:C==="cursor"&&n!==void 0?v=n-p.width/2:v=u.left+(u.width-p.width)/2}l!=="top"&&t.grid.toolbarAlign==="top"&&(_=u.top),v+p.width>window.innerWidth-8&&(v=window.innerWidth-p.width-8),v<8&&(v=8),_+p.height>window.innerHeight-8&&(_=window.innerHeight-p.height-8),_<8&&(_=8),Object.assign(c.style,{position:"fixed",left:`${v}px`,top:`${_}px`}),$&&($.position=l)});const g=h=>{const u=h.target.closest(".wg__toolbar-btn");if(u&&!u.disabled){const p=u.dataset.toolbarItem||"",m=i.find(f=>f.id===p);m&&s(m)}};a.addEventListener("click",g),$={container:a,toolbar:c,rowIndex:o,rowItem:r,position:l,hasRowMoved:!1,cursorX:n,cleanup:()=>{a.removeEventListener("click",g),a.remove()}},F={path:null,arrowPos:null,arrowDir:"right"}}function zt(){$&&($.cleanup(),$=null),F={path:null,arrowPos:null,arrowDir:"right"}}function Ft(){return($==null?void 0:$.rowIndex)??null}function hi(t){return($==null?void 0:$.container.getRootNode())===t}function Zt(t){return($==null?void 0:$.rowIndex)===t}function pi(){return F}function fi(t,e){if(!$){F={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:o,rowItem:i,position:r}=$,s=e.findIndex(v=>v===i);if(s===-1){F={path:null,arrowPos:null,arrowDir:"right"};return}const n=t.shadow.querySelector(`tr[data-row-index="${s}"]`);if(!n){F={path:null,arrowPos:null,arrowDir:"right"};return}if(s===$.rowIndex||($.hasRowMoved=!0),!$.hasRowMoved){F={path:null,arrowPos:null,arrowDir:"right"};return}const a=o.getBoundingClientRect(),c=n.getBoundingClientRect(),l=t.shadow.querySelector(".wg__table"),g=l==null?void 0:l.getBoundingClientRect();if(!g){F={path:null,arrowPos:null,arrowDir:"right"};return}const h=document.dir==="rtl"||document.documentElement.dir==="rtl";c.bottom<a.top||c.top>a.bottom;const u=h?g.right+15:g.left-15,p=h?c.right+8:c.left-8,m=c.top+c.height/2;let f,b=h?"left":"right";if(r==="left"){const v=a.right,_=a.top+a.height/2;f=`M ${v} ${_} H ${u} V ${m} H ${p}`}else if(r==="right"){const v=a.left,_=a.top+a.height/2;f=`M ${v} ${_} H ${u} V ${m} H ${p}`}else{const _=a.right,C=a.top+a.height/2,y=_+48,k=s-$.rowIndex,x=8;if(k===0){const S=c.top-x;f=`M ${_} ${C} H ${y} V ${S}`,F={path:f,arrowPos:{x:y,y:S},arrowDir:"down"};return}else if(k===-1){const T=a.top+a.height*.25,D=a.top+a.height*.75,U=a.right+24,R=a.right+x;f=`M ${a.right} ${T} H ${U} V ${D} H ${R}`,F={path:f,arrowPos:{x:R,y:D},arrowDir:"left"};return}else if(k<0){const S=c.bottom+x;f=`M ${_} ${C} H ${y} V ${S}`,F={path:f,arrowPos:{x:y,y:S},arrowDir:"up"};return}else{const S=c.top-x;f=`M ${_} ${C} H ${y} V ${S}`,F={path:f,arrowPos:{x:y,y:S},arrowDir:"down"};return}}F={path:f,arrowPos:{x:p,y:m},arrowDir:b}}function Ie(t,e){return`<button
125
+ >${g.icon}${p}</button>`}).join("");return c+l}).join("")}</div>`).join("")}</div>`}let M=null;function pi(t,e,o,i,r,s,n){Ft();const d=hi(i,r,o),a=document.createElement("div");a.className="wg__toolbar-container",a.innerHTML=d,t.shadow.appendChild(a);const c=a.querySelector(".wg__toolbar");let l="left";c.style.position="fixed",c.style.visibility="hidden",requestAnimationFrame(()=>{const h=t.shadow.querySelector(`tr[data-row-index="${o}"]`);if(!h){Ft();return}const u=t.grid.toolbarPosition,p=t.grid.toolbarAlign,m=t.grid.toolbarTopPosition;let f,b;const v=p==="top"?"-start":"",_=()=>m==="start"?"top-start":m==="end"?"top-end":"top";u==="left"?(f=`left${v}`,b=[`right${v}`,_()]):u==="right"?(f=`right${v}`,b=[`left${v}`,_()]):u==="top"?(f=_(),b=[`left${v}`,`right${v}`]):(f=`left${v}`,b=[`right${v}`,_()]);let S=h;if(m==="cursor"&&n!==void 0&&u==="top"){const y=h.getBoundingClientRect();S={getBoundingClientRect:()=>({x:n,y:y.top,top:y.top,left:n,bottom:y.bottom,right:n,width:0,height:y.height,toJSON:()=>({})})}}kt(S,c,{strategy:"fixed",placement:f,middleware:[xt({fallbackPlacements:b}),Gt({padding:8})]}).then(({x:y,y:D,placement:x})=>{Object.assign(c.style,{left:`${y}px`,top:`${D}px`,visibility:"visible"}),l=x.split("-")[0],M&&(M.position=l)}).catch(()=>{c.style.visibility="visible"})});const g=h=>{const u=h.target.closest(".wg__toolbar-btn");if(u&&!u.disabled){const p=u.dataset.toolbarItem||"",m=i.find(f=>f.id===p);m&&s(m)}};a.addEventListener("click",g),M={container:a,toolbar:c,rowIndex:o,rowItem:r,position:l,hasRowMoved:!1,cursorX:n,cleanup:()=>{a.removeEventListener("click",g),a.remove()}},I={path:null,arrowPos:null,arrowDir:"right"}}function Ft(){M&&(M.cleanup(),M=null),I={path:null,arrowPos:null,arrowDir:"right"}}function Dt(){return(M==null?void 0:M.rowIndex)??null}function fi(t){return(M==null?void 0:M.container.getRootNode())===t}function ee(t){return(M==null?void 0:M.rowIndex)===t}function wi(){return I}function Le(t,e){if(!M){I={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:o,rowItem:i,position:r}=M,s=e.findIndex(y=>y===i);if(s===-1){I={path:null,arrowPos:null,arrowDir:"right"};return}const n=t.shadow.querySelector(`tr[data-row-index="${s}"]`);if(!n){I={path:null,arrowPos:null,arrowDir:"right"};return}if(s===M.rowIndex||(M.hasRowMoved=!0),!M.hasRowMoved){I={path:null,arrowPos:null,arrowDir:"right"};return}const a=o.getBoundingClientRect(),c=n.getBoundingClientRect(),l=t.shadow.querySelector(".wg__table"),g=l==null?void 0:l.getBoundingClientRect(),h=t.shadow.querySelector(".wg"),u=h==null?void 0:h.getBoundingClientRect();if(!g||!u){I={path:null,arrowPos:null,arrowDir:"right"};return}const p=document.dir==="rtl"||document.documentElement.dir==="rtl",m=c.top+c.height/2,f=c.bottom<=u.top,b=c.top>=u.bottom,v=!f&&!b;let _,S="right";if(f?(_=u.top+8,S="up"):b?(_=u.bottom-8,S="down"):_=m,r==="left"){const y=a.right,D=a.top+a.height/2,x=p?u.right+15:u.left-15;if(!v){I={path:`M ${y} ${D} H ${x} V ${_}`,arrowPos:{x,y:_},arrowDir:S};return}const C=p?u.right-8:u.left+8;S=p?"left":"right",I={path:`M ${y} ${D} H ${x} V ${_} H ${C}`,arrowPos:{x:C,y:_},arrowDir:S};return}else if(r==="right"){const y=a.left,D=a.top+a.height/2,x=p?u.left-15:u.right+15;if(!v){I={path:`M ${y} ${D} H ${x} V ${_}`,arrowPos:{x,y:_},arrowDir:S};return}const C=p?u.left+8:u.right-8;S=p?"right":"left",I={path:`M ${y} ${D} H ${x} V ${_} H ${C}`,arrowPos:{x:C,y:_},arrowDir:S};return}else{const D=a.right,x=a.top+a.height/2,C=D+48,T=s-M.rowIndex,k=8;if(T===0){let $=c.top-k;b&&($=u.bottom-k),I={path:`M ${D} ${x} H ${C} V ${$}`,arrowPos:{x:C,y:$},arrowDir:"down"};return}else if(T===-1){const A=a.top+a.height*.25,N=a.top+a.height*.75,O=a.right+24,R=a.right+k;I={path:`M ${a.right} ${A} H ${O} V ${N} H ${R}`,arrowPos:{x:R,y:N},arrowDir:"left"};return}else if(T<0){let $=c.bottom+k;f&&($=u.top+k),I={path:`M ${D} ${x} H ${C} V ${$}`,arrowPos:{x:C,y:$},arrowDir:"up"};return}else{let $=c.top-k;b&&($=u.bottom-k),I={path:`M ${D} ${x} H ${C} V ${$}`,arrowPos:{x:C,y:$},arrowDir:"down"};return}}}function He(t,e){return`<button
126
126
  class="wg__toolbar-trigger ${e?"wg__toolbar-trigger--active":""}"
127
127
  data-toolbar-trigger="${t}"
128
128
  title="Row actions"
129
- >⋮</button>`}function wi(t){const e=["wg"];return t.grid.striped&&e.push("wg--striped"),t.grid.hoverable&&e.push("wg--hoverable"),t.grid.editable&&e.push("wg--editable"),t.grid.isNavigateMode&&e.push("wg--navigate-mode"),e.join(" ")}function mi(t){const e=t.grid.columns;if(e.length===0)return"";const o=t.grid.showRowNumbers?'<th class="wg__header wg__row-number-header">#</th>':"",r=t.grid.showRowToolbar&&t.grid.toolbarTrigger==="button"?'<th class="wg__header wg__actions-column"></th>':"",s=e.map(n=>{const d=String(n.field),a=n.sortable!==!1&&t.grid.sortable,c=t.grid.getColumnSortState(d),l=t.grid.getColumnSortPriority(d),g=c!==void 0,h=["wg__header"];a&&h.push("wg__header--sortable"),g&&h.push("wg__header--sorted");const u=n.width||n.maxWidth,m=`style="${[u?`width: ${u}`:"",n.minWidth?`min-width: ${n.minWidth}`:"",`text-align: ${n.align||"left"}`].filter(Boolean).join("; ")}"`;let f="";if(a)if(g){const v=c.direction==="asc"?"▲":"▼",_=t.grid.sort.length>1?`<sup class="wg__sort-priority">${l}</sup>`:"";f=`<span class="wg__sort-indicator">${v}${_}</span>`}else f='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let b="";return n.headerInfo&&(b=`<span class="wg__header-info" data-tooltip="${t.escapeHtml(n.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`),`
129
+ >⋮</button>`}function mi(t){const e=["wg"];return t.grid.striped&&e.push("wg--striped"),t.grid.hoverable&&e.push("wg--hoverable"),t.grid.editable&&e.push("wg--editable"),t.grid.isNavigateMode&&e.push("wg--navigate-mode"),e.join(" ")}function bi(t){const e=t.grid.columns;if(e.length===0)return"";const o=t.grid.showRowNumbers?'<th class="wg__header wg__row-number-header">#</th>':"",r=t.grid.showRowToolbar&&t.grid.toolbarTrigger==="button"?'<th class="wg__header wg__actions-column"></th>':"",s=e.map(n=>{const d=String(n.field),a=n.sortable!==!1&&t.grid.sortMode!=="none",c=t.grid.getColumnSortState(d),l=t.grid.getColumnSortPriority(d),g=c!==void 0,h=["wg__header"];a&&h.push("wg__header--sortable"),g&&h.push("wg__header--sorted");const u=n.width||n.maxWidth,m=`style="${[u?`width: ${u}`:"",n.minWidth?`min-width: ${n.minWidth}`:"",`text-align: ${n.align||"left"}`].filter(Boolean).join("; ")}"`;let f="";if(a)if(g){const v=c.direction==="asc"?"▲":"▼",_=t.grid.sort.length>1?`<sup class="wg__sort-priority">${l}</sup>`:"";f=`<span class="wg__sort-indicator">${v}${_}</span>`}else f='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let b="";return n.headerInfo&&(b=`<span class="wg__header-info" data-tooltip="${t.escapeHtml(n.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`),`
130
130
  <th class="${h.join(" ")}" ${m} data-field="${d}">
131
131
  <div class="wg__header-content">
132
132
  <span class="wg__header-title">${t.escapeHtml(n.title)}</span>
@@ -134,51 +134,51 @@
134
134
  ${f}
135
135
  </div>
136
136
  </th>
137
- `}).join("");return`<tr>${o}${r}${s}</tr>`}function bi(t){const e=t.grid.displayItems,o=t.grid.columns,i=t.grid.showRowNumbers,r=t.grid.showRowToolbar&&t.grid.toolbarTrigger==="button",s=o.length+(r?1:0)+(i?1:0);if(e.length===0)return`
137
+ `}).join("");return`<tr>${o}${r}${s}</tr>`}function vi(t){const e=t.grid.displayItems,o=t.grid.columns,i=t.grid.showRowNumbers,r=t.grid.showRowToolbar&&t.grid.toolbarTrigger==="button",s=o.length+(r?1:0)+(i?1:0);if(e.length===0)return`
138
138
  <tr>
139
139
  <td class="wg__empty" colspan="${s}">
140
140
  No items to display
141
141
  </td>
142
142
  </tr>
143
- `;const n=Ft();return e.map((d,a)=>{const c=i?`<td class="wg__cell wg__row-number">${a+1}</td>`:"";let l="";r&&(l=`
143
+ `;const n=Dt();return e.map((d,a)=>{const c=i?`<td class="wg__cell wg__row-number">${a+1}</td>`:"";let l="";r&&(l=`
144
144
  <td class="wg__cell wg__actions-column">
145
- ${Ie(a,n===a)}
145
+ ${He(a,n===a)}
146
146
  </td>
147
- `);const g=o.map((u,p)=>{const m=String(u.field),f=t.grid.getCellValue(d,u,a),b=u.align||"left",v=t.grid.isCellEditable(u),_=t.grid.isCellFocused(a,p),C=["wg__cell"],y=t.grid.isEditing(a,m);if(v&&C.push("wg__cell--editable"),_&&!y&&C.push("wg__cell--focused"),u.textOverflow==="ellipsis"&&C.push("wg__cell--ellipsis"),y&&C.push("wg__cell--editing"),t.grid.isCellInvalid(a,m)&&C.push("wg__cell--invalid"),u.cellClass&&C.push(u.cellClass),u.cellClassCallback){const T=t.grid.getCellRawValue(d,a,m),D=u.cellClassCallback(T,d);D&&C.push(D)}const k=[`text-align: ${b}`,u.width?`width: ${u.width}`:"",u.minWidth?`min-width: ${u.minWidth}`:"",u.maxWidth?`max-width: ${u.maxWidth}`:""].filter(Boolean).join("; "),x=t.grid.isNavigateMode?'tabindex="0"':"";let S="";if(u.tooltipCallback){const T=t.grid.getCellRawValue(d,a,m),D=u.tooltipCallback(T,d);D&&(S=`data-tooltip="${t.escapeHtml(D)}"`)}else if(u.tooltipMember){const T=d[u.tooltipMember];T&&typeof T=="string"&&(S=`data-tooltip="${t.escapeHtml(T)}"`)}return`
147
+ `);const g=o.map((u,p)=>{const m=String(u.field),f=t.grid.getCellValue(d,u,a),b=u.align||"left",v=t.grid.isCellEditable(u),_=t.grid.isCellFocused(a,p),S=["wg__cell"],y=t.grid.isEditing(a,m);if(v&&S.push("wg__cell--editable"),_&&!y&&S.push("wg__cell--focused"),u.textOverflow==="ellipsis"&&S.push("wg__cell--ellipsis"),y&&S.push("wg__cell--editing"),t.grid.isCellInvalid(a,m)&&S.push("wg__cell--invalid"),u.cellClass&&S.push(u.cellClass),u.cellClassCallback){const T=t.grid.getCellRawValue(d,a,m),k=u.cellClassCallback(T,d);k&&S.push(k)}const D=[`text-align: ${b}`,u.width?`width: ${u.width}`:"",u.minWidth?`min-width: ${u.minWidth}`:"",u.maxWidth?`max-width: ${u.maxWidth}`:""].filter(Boolean).join("; "),x=t.grid.isNavigateMode?'tabindex="0"':"";let C="";if(u.tooltipCallback){const T=t.grid.getCellRawValue(d,a,m),k=u.tooltipCallback(T,d);k&&(C=`data-tooltip="${t.escapeHtml(k)}"`)}else if(u.tooltipMember){const T=d[u.tooltipMember];T&&typeof T=="string"&&(C=`data-tooltip="${t.escapeHtml(T)}"`)}if(!C&&t.grid.isCellInvalid(a,m)){const T=t.grid.getCellValidationError(a,m);if(T){const k=u.validationTooltipCallback||t.grid.validationTooltipCallback;if(k){const $=t.grid.getCellRawValue(d,a,m),A=k({field:m,error:T,value:$,row:d,rowIndex:a});A&&(C=`data-tooltip-html="${t.escapeHtml(A)}"`)}C||(C=`data-tooltip="${t.escapeHtml(T)}"`)}}return`
148
148
  <td
149
- class="${C.join(" ")}"
150
- style="${k}"
149
+ class="${S.join(" ")}"
150
+ style="${D}"
151
151
  data-row="${a}"
152
152
  data-col="${p}"
153
153
  data-field="${m}"
154
154
  ${x}
155
- ${S}
155
+ ${C}
156
156
  >
157
- ${t.grid.isEditing(a,m)?Oe(t,a,p,u):Re(t,a,p,u,f)}
157
+ ${t.grid.isEditing(a,m)?Pe(t,a,p,u):Ie(t,a,p,u,f)}
158
158
  </td>
159
- `}).join(""),h=["wg__row"];if(t.grid.rowClassCallback){const u=t.grid.rowClassCallback(d,a);u&&h.push(u)}return`<tr class="${h.join(" ")}" data-row-index="${a}">${c}${l}${g}</tr>`}).join("")}function Le(t,e){const o=t.grid.displayItems,i=t.grid.columns,{startIndex:r,endIndex:s,rowHeight:n,totalItems:d}=e,a=t.grid.showRowNumbers,c=t.grid.showRowToolbar&&t.grid.toolbarTrigger==="button",l=i.length+(c?1:0)+(a?1:0);if(o.length===0)return`
159
+ `}).join(""),h=["wg__row"];if(t.grid.rowClassCallback){const u=t.grid.rowClassCallback(d,a);u&&h.push(u)}return`<tr class="${h.join(" ")}" data-row-index="${a}">${c}${l}${g}</tr>`}).join("")}function ze(t,e){const o=t.grid.displayItems,i=t.grid.columns,{startIndex:r,endIndex:s,rowHeight:n,totalItems:d}=e,a=t.grid.showRowNumbers,c=t.grid.showRowToolbar&&t.grid.toolbarTrigger==="button",l=i.length+(c?1:0)+(a?1:0);if(o.length===0)return`
160
160
  <tr>
161
161
  <td class="wg__empty" colspan="${l}">
162
162
  No items to display
163
163
  </td>
164
164
  </tr>
165
- `;const g=Ft(),h=r*n,u=(d-s)*n,p=h>0?`<tr class="wg__spacer-top"><td colspan="${l}" style="height: ${h}px"></td></tr>`:"",m=[];for(let b=r;b<s&&b<o.length;b++){const v=o[b],_=b,C=a?`<td class="wg__cell wg__row-number">${_+1}</td>`:"";let y="";c&&(y=`
165
+ `;const g=Dt(),h=r*n,u=(d-s)*n,p=h>0?`<tr class="wg__spacer-top"><td colspan="${l}" style="height: ${h}px"></td></tr>`:"",m=[];for(let b=r;b<s&&b<o.length;b++){const v=o[b],_=b,S=a?`<td class="wg__cell wg__row-number">${_+1}</td>`:"";let y="";c&&(y=`
166
166
  <td class="wg__cell wg__actions-column">
167
- ${Ie(_,g===_)}
167
+ ${He(_,g===_)}
168
168
  </td>
169
- `);const k=i.map((S,T)=>{const D=String(S.field),U=t.grid.getCellValue(v,S,_),R=S.align||"left",tt=t.grid.isCellEditable(S),M=t.grid.isCellFocused(_,T),O=["wg__cell"],j=t.grid.isEditing(_,D);if(tt&&O.push("wg__cell--editable"),M&&!j&&O.push("wg__cell--focused"),S.textOverflow==="ellipsis"&&O.push("wg__cell--ellipsis"),j&&O.push("wg__cell--editing"),t.grid.isCellInvalid(_,D)&&O.push("wg__cell--invalid"),S.cellClass&&O.push(S.cellClass),S.cellClassCallback){const it=t.grid.getCellRawValue(v,_,D),kt=S.cellClassCallback(it,v);kt&&O.push(kt)}const q=[`text-align: ${R}`,S.width?`width: ${S.width}`:"",S.minWidth?`min-width: ${S.minWidth}`:"",S.maxWidth?`max-width: ${S.maxWidth}`:""].filter(Boolean).join("; "),Y=t.grid.isNavigateMode?'tabindex="0"':"";let B="";if(S.tooltipCallback){const it=t.grid.getCellRawValue(v,_,D),kt=S.tooltipCallback(it,v);kt&&(B=`data-tooltip="${t.escapeHtml(kt)}"`)}else if(S.tooltipMember){const it=v[S.tooltipMember];it&&typeof it=="string"&&(B=`data-tooltip="${t.escapeHtml(it)}"`)}return`
169
+ `);const D=i.map((C,T)=>{const k=String(C.field),$=t.grid.getCellValue(v,C,_),A=C.align||"left",N=t.grid.isCellEditable(C),O=t.grid.isCellFocused(_,T),R=["wg__cell"],U=t.grid.isEditing(_,k);if(N&&R.push("wg__cell--editable"),O&&!U&&R.push("wg__cell--focused"),C.textOverflow==="ellipsis"&&R.push("wg__cell--ellipsis"),U&&R.push("wg__cell--editing"),t.grid.isCellInvalid(_,k)&&R.push("wg__cell--invalid"),C.cellClass&&R.push(C.cellClass),C.cellClassCallback){const K=t.grid.getCellRawValue(v,_,k),at=C.cellClassCallback(K,v);at&&R.push(at)}const j=[`text-align: ${A}`,C.width?`width: ${C.width}`:"",C.minWidth?`min-width: ${C.minWidth}`:"",C.maxWidth?`max-width: ${C.maxWidth}`:""].filter(Boolean).join("; "),B=t.grid.isNavigateMode?'tabindex="0"':"";let L="";if(C.tooltipCallback){const K=t.grid.getCellRawValue(v,_,k),at=C.tooltipCallback(K,v);at&&(L=`data-tooltip="${t.escapeHtml(at)}"`)}else if(C.tooltipMember){const K=v[C.tooltipMember];K&&typeof K=="string"&&(L=`data-tooltip="${t.escapeHtml(K)}"`)}if(!L&&t.grid.isCellInvalid(_,k)){const K=t.grid.getCellValidationError(_,k);if(K){const at=C.validationTooltipCallback||t.grid.validationTooltipCallback;if(at){const Ji=t.grid.getCellRawValue(v,_,k),je=at({field:k,error:K,value:Ji,row:v,rowIndex:_});je&&(L=`data-tooltip-html="${t.escapeHtml(je)}"`)}L||(L=`data-tooltip="${t.escapeHtml(K)}"`)}}return`
170
170
  <td
171
- class="${O.join(" ")}"
172
- style="${q}"
171
+ class="${R.join(" ")}"
172
+ style="${j}"
173
173
  data-row="${_}"
174
174
  data-col="${T}"
175
- data-field="${D}"
176
- ${Y}
175
+ data-field="${k}"
177
176
  ${B}
177
+ ${L}
178
178
  >
179
- ${t.grid.isEditing(_,D)?Oe(t,_,T,S):Re(t,_,T,S,U)}
179
+ ${t.grid.isEditing(_,k)?Pe(t,_,T,C):Ie(t,_,T,C,$)}
180
180
  </td>
181
- `}).join(""),x=["wg__row"];if(t.grid.rowClassCallback){const S=t.grid.rowClassCallback(v,_);S&&x.push(S)}m.push(`<tr class="${x.join(" ")}" data-row-index="${_}">${C}${y}${k}</tr>`)}const f=u>0?`<tr class="wg__spacer-bottom"><td colspan="${l}" style="height: ${u}px"></td></tr>`:"";return p+m.join("")+f}function te(t,e="bottom-center"){const o=t.grid.showPagination;if(!t.grid.pageable||o===!1||o==="auto"&&t.grid.totalPages<=1)return"";const i=t.grid.currentPage,r=t.grid.totalPages,s=t.grid.pageSize,n=t.grid.pageSizes,d=t.grid.totalItems!==null?t.grid.totalItems:t.grid.sortedItems.length,a={first:"First",previous:"Previous",next:"Next",last:"Last",pageInfo:`Page ${i} of ${r}`,itemCount:`(${d} item${d!==1?"s":""})`,perPage:"per page"},c=t.grid.paginationLabelsCallback,l=c?c({currentPage:i,totalPages:r,totalItems:d,pageSize:s}):{},g={...a,...l},h=e.startsWith("top-"),u=e.replace("top-","").replace("bottom-",""),p=["wg__pagination"];u==="left"?p.push("wg__pagination--left"):u==="right"&&p.push("wg__pagination--right"),h&&p.push("wg__pagination--top");const m={first:`
181
+ `}).join(""),x=["wg__row"];if(t.grid.rowClassCallback){const C=t.grid.rowClassCallback(v,_);C&&x.push(C)}m.push(`<tr class="${x.join(" ")}" data-row-index="${_}">${S}${y}${D}</tr>`)}const f=u>0?`<tr class="wg__spacer-bottom"><td colspan="${l}" style="height: ${u}px"></td></tr>`:"";return p+m.join("")+f}function oe(t,e="bottom-center"){const o=t.grid.showPagination;if(!t.grid.pageable||o===!1||o==="auto"&&t.grid.totalPages<=1)return"";const i=t.grid.currentPage,r=t.grid.totalPages,s=t.grid.pageSize,n=t.grid.pageSizes,d=t.grid.totalItems!==null?t.grid.totalItems:t.grid.sortedItems.length,a={first:"First",previous:"Previous",next:"Next",last:"Last",pageInfo:`Page ${i} of ${r}`,itemCount:`(${d} item${d!==1?"s":""})`,perPage:"per page"},c=t.grid.paginationLabelsCallback,l=c?c({currentPage:i,totalPages:r,totalItems:d,pageSize:s}):{},g={...a,...l},h=e.startsWith("top-"),u=e.replace("top-","").replace("bottom-",""),p=["wg__pagination"];u==="left"?p.push("wg__pagination--left"):u==="right"&&p.push("wg__pagination--right"),h&&p.push("wg__pagination--top");const m={first:`
182
182
  <button class="wg__pagination-btn" data-action="first" ${i===1?"disabled":""}>
183
183
  ${g.first}
184
184
  </button>
@@ -206,7 +206,7 @@
206
206
  </select>
207
207
  <span class="wg__pagination-label">${g.perPage}</span>
208
208
  </div>
209
- `:""},b=t.grid.paginationLayout.split("|").map(v=>v.trim()).map(v=>m[v]||"").join("");return`<div class="${p.join(" ")}">${b}</div>`}function ee(t,e){const o=t.grid.summaryContentCallback;if(!o)return"";const i=t.grid.currentPage,r=t.grid.pageSize,s=t.grid.sortedItems,n=t.grid.displayItems,d=t.grid.totalItems!==null?t.grid.totalItems:s.length,a=o({items:n,allItems:s,totalItems:d,currentPage:i,pageSize:r,metadata:t.grid.summaryMetadata}),c=e.startsWith("top-"),l=e.replace("top-","").replace("bottom-",""),g=["wg__summary"];return l==="left"?g.push("wg__summary--left"):l==="right"&&g.push("wg__summary--right"),c&&g.push("wg__summary--top"),`<div class="${g.join(" ")}">${a}</div>`}const Pe={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function oe(t){const e={};let o="";return t.includes("-")?o="-":t.includes("/")?o="/":t.includes(".")&&(o="."),t.split(o).forEach((r,s)=>{r==="YYYY"||r==="YY"?e.year={index:s,length:r.length}:r==="MM"||r==="M"?e.month={index:s,length:2}:(r==="DD"||r==="D")&&(e.day={index:s,length:2})}),{format:t,separator:o,parts:e,maxLength:t.length}}function He(t,e){if(!t||isNaN(t.getTime()))return"";const o=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),{separator:s,parts:n}=e,d=[];for(let a=0;a<3;a++)n.year&&n.year.index===a?d.push(n.year.length===2?String(o).slice(-2):o):n.month&&n.month.index===a?d.push(i):n.day&&n.day.index===a&&d.push(r);return d.join(s)}function vi(t,e){if(!t)return null;const{separator:o,parts:i}=e,r=t.split(o);let s=null,n=null,d=null;if(r.forEach((c,l)=>{if(c){if(i.year&&i.year.index===l){const g=parseInt(c,10);i.year.length===4&&c.length===4?s=g:i.year.length===2&&c.length===2&&(s=g<100?g+2e3:g)}else if(i.month&&i.month.index===l){const g=parseInt(c,10);c.length===2&&g>=1&&g<=12&&(n=g)}else if(i.day&&i.day.index===l){const g=parseInt(c,10);c.length===2&&g>=1&&g<=31&&(d=g)}}}),s===null||n===null||d===null)return null;const a=new Date(s,n-1,d);return a.getMonth()!==n-1||a.getDate()!==d?null:a}function V(t){if(!t)return null;let e;if(typeof t=="string"){const[o,i,r]=t.split("-").map(Number);!o||!i||!r?e=new Date(t):e=new Date(o,i-1,r)}else e=new Date(t);return e.setHours(0,0,0,0),isNaN(e.getTime())?null:e}function ie(t){const e=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${o}-${i}`}function St(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function _i(t){return St(t,new Date)}function bt(t,e){return new Date(t,e+1,0).getDate()}function yi(t,e){return new Date(t,e,1).getDay()}function Ci(t,e){if(!t)return{min:e-10,max:e+10};if(t.includes("-")){const[i,r]=t.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const o=parseInt(t,10);return{min:o,max:o}}function Si(t,e,o=Pe){const i=xi(t,o),r=ki(t,e,o),s=Di(t,e,o),n=e.showTodayButton!==!1?$i(o):"";return`
209
+ `:""},b=t.grid.paginationLayout.split("|").map(v=>v.trim()).map(v=>m[v]||"").join("");return`<div class="${p.join(" ")}">${b}</div>`}function ie(t,e){const o=t.grid.summaryContentCallback;if(!o)return"";const i=t.grid.currentPage,r=t.grid.pageSize,s=t.grid.sortedItems,n=t.grid.displayItems,d=t.grid.totalItems!==null?t.grid.totalItems:s.length,a=o({items:n,allItems:s,totalItems:d,currentPage:i,pageSize:r,metadata:t.grid.summaryMetadata}),c=e.startsWith("top-"),l=e.replace("top-","").replace("bottom-",""),g=["wg__summary"];return l==="left"?g.push("wg__summary--left"):l==="right"&&g.push("wg__summary--right"),c&&g.push("wg__summary--top"),`<div class="${g.join(" ")}">${a}</div>`}const Fe={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function re(t){const e={};let o="";return t.includes("-")?o="-":t.includes("/")?o="/":t.includes(".")&&(o="."),t.split(o).forEach((r,s)=>{r==="YYYY"||r==="YY"?e.year={index:s,length:r.length}:r==="MM"||r==="M"?e.month={index:s,length:2}:(r==="DD"||r==="D")&&(e.day={index:s,length:2})}),{format:t,separator:o,parts:e,maxLength:t.length}}function Ve(t,e){if(!t||isNaN(t.getTime()))return"";const o=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),{separator:s,parts:n}=e,d=[];for(let a=0;a<3;a++)n.year&&n.year.index===a?d.push(n.year.length===2?String(o).slice(-2):o):n.month&&n.month.index===a?d.push(i):n.day&&n.day.index===a&&d.push(r);return d.join(s)}function _i(t,e){if(!t)return null;const{separator:o,parts:i}=e,r=t.split(o);let s=null,n=null,d=null;if(r.forEach((c,l)=>{if(c){if(i.year&&i.year.index===l){const g=parseInt(c,10);i.year.length===4&&c.length===4?s=g:i.year.length===2&&c.length===2&&(s=g<100?g+2e3:g)}else if(i.month&&i.month.index===l){const g=parseInt(c,10);c.length===2&&g>=1&&g<=12&&(n=g)}else if(i.day&&i.day.index===l){const g=parseInt(c,10);c.length===2&&g>=1&&g<=31&&(d=g)}}}),s===null||n===null||d===null)return null;const a=new Date(s,n-1,d);return a.getMonth()!==n-1||a.getDate()!==d?null:a}function Y(t){if(!t)return null;let e;if(typeof t=="string"){const[o,i,r]=t.split("-").map(Number);!o||!i||!r?e=new Date(t):e=new Date(o,i-1,r)}else e=new Date(t);return e.setHours(0,0,0,0),isNaN(e.getTime())?null:e}function ne(t){const e=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${o}-${i}`}function Tt(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function yi(t){return Tt(t,new Date)}function vt(t,e){return new Date(t,e+1,0).getDate()}function Ci(t,e){return new Date(t,e,1).getDay()}function Si(t,e){if(!t)return{min:e-10,max:e+10};if(t.includes("-")){const[i,r]=t.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const o=parseInt(t,10);return{min:o,max:o}}function xi(t,e,o=Fe){const i=ki(t,o),r=Di(t,e,o),s=Ti(t,e,o),n=e.showTodayButton!==!1?Mi(o):"";return`
210
210
  <div class="wg-datepicker">
211
211
  <div class="wg-datepicker__header">
212
212
  ${i}
@@ -219,7 +219,7 @@
219
219
  </div>
220
220
  ${n}
221
221
  </div>
222
- `}function xi(t,e){return`
222
+ `}function ki(t,e){return`
223
223
  <button type="button" class="wg-datepicker__nav wg-datepicker__nav--prev" data-action="prev-month">
224
224
  <svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
225
225
  </button>
@@ -229,7 +229,7 @@
229
229
  <button type="button" class="wg-datepicker__nav wg-datepicker__nav--next" data-action="next-month">
230
230
  <svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>
231
231
  </button>
232
- `}function ki(t,e,o){const i=Ci(e.rollingYearRange,new Date().getFullYear());let r="";for(let n=i.min;n<=i.max;n++){const d=n===t.viewYear?" wg-datepicker__rolling-item--selected":"";r+=`<div class="wg-datepicker__rolling-item${d}" data-year="${n}">${n}</div>`}let s="";for(let n=0;n<12;n++){const d=n===t.viewMonth?" wg-datepicker__rolling-item--selected":"";s+=`<div class="wg-datepicker__rolling-item${d}" data-month="${n}">${o.monthNamesShort[n]}</div>`}return`
232
+ `}function Di(t,e,o){const i=Si(e.rollingYearRange,new Date().getFullYear());let r="";for(let n=i.min;n<=i.max;n++){const d=n===t.viewYear?" wg-datepicker__rolling-item--selected":"";r+=`<div class="wg-datepicker__rolling-item${d}" data-year="${n}">${n}</div>`}let s="";for(let n=0;n<12;n++){const d=n===t.viewMonth?" wg-datepicker__rolling-item--selected":"";s+=`<div class="wg-datepicker__rolling-item${d}" data-month="${n}">${o.monthNamesShort[n]}</div>`}return`
233
233
  <div class="wg-datepicker__rolling-lists">
234
234
  <div class="wg-datepicker__rolling-list" data-list="months">
235
235
  ${s}
@@ -238,20 +238,20 @@
238
238
  ${r}
239
239
  </div>
240
240
  </div>
241
- `}function Di(t,e,o){const i=Ti(o),r=ze(t,e);return`
241
+ `}function Ti(t,e,o){const i=Ei(o),r=qe(t,e);return`
242
242
  <div class="wg-datepicker__weekdays">
243
243
  ${i}
244
244
  </div>
245
245
  <div class="wg-datepicker__days">
246
246
  ${r}
247
247
  </div>
248
- `}function Ti(t){return t.weekdayNamesShort.map(e=>`<div class="wg-datepicker__weekday">${e}</div>`).join("")}function ze(t,e){const{viewYear:o,viewMonth:i,selectedDate:r,focusedDate:s}=t,n=e.minDate?V(e.minDate):null,d=e.maxDate?V(e.maxDate):null,a=yi(o,i),c=bt(o,i),l=bt(o,i-1),g=new Date(o,i-1,1),h=g.getFullYear(),u=g.getMonth(),p=new Date(o,i+1,1),m=p.getFullYear(),f=p.getMonth(),b=[];for(let y=a-1;y>=0;y--){const k=l-y;b.push({date:new Date(h,u,k),day:k,isOtherMonth:!0})}for(let y=1;y<=c;y++)b.push({date:new Date(o,i,y),day:y,isOtherMonth:!1});const _=Math.ceil((a+c)/7)*7-b.length;for(let y=1;y<=_;y++)b.push({date:new Date(m,f,y),day:y,isOtherMonth:!0});let C="";for(const y of b){const k=["wg-datepicker__day"];y.isOtherMonth&&k.push("wg-datepicker__day--other-month"),Ei(y.date,n,d)&&k.push("wg-datepicker__day--disabled"),_i(y.date)&&k.push("wg-datepicker__day--today"),St(y.date,r)&&k.push("wg-datepicker__day--selected"),St(y.date,s)&&k.push("wg-datepicker__day--focused");const S=ie(y.date);C+=`<div class="${k.join(" ")}" data-date="${S}">${y.day}</div>`}return C}function Ei(t,e,o){return!!(e&&t<e||o&&t>o)}function $i(t){return`
248
+ `}function Ei(t){return t.weekdayNamesShort.map(e=>`<div class="wg-datepicker__weekday">${e}</div>`).join("")}function qe(t,e){const{viewYear:o,viewMonth:i,selectedDate:r,focusedDate:s}=t,n=e.minDate?Y(e.minDate):null,d=e.maxDate?Y(e.maxDate):null,a=Ci(o,i),c=vt(o,i),l=vt(o,i-1),g=new Date(o,i-1,1),h=g.getFullYear(),u=g.getMonth(),p=new Date(o,i+1,1),m=p.getFullYear(),f=p.getMonth(),b=[];for(let y=a-1;y>=0;y--){const D=l-y;b.push({date:new Date(h,u,D),day:D,isOtherMonth:!0})}for(let y=1;y<=c;y++)b.push({date:new Date(o,i,y),day:y,isOtherMonth:!1});const _=Math.ceil((a+c)/7)*7-b.length;for(let y=1;y<=_;y++)b.push({date:new Date(m,f,y),day:y,isOtherMonth:!0});let S="";for(const y of b){const D=["wg-datepicker__day"];y.isOtherMonth&&D.push("wg-datepicker__day--other-month"),$i(y.date,n,d)&&D.push("wg-datepicker__day--disabled"),yi(y.date)&&D.push("wg-datepicker__day--today"),Tt(y.date,r)&&D.push("wg-datepicker__day--selected"),Tt(y.date,s)&&D.push("wg-datepicker__day--focused");const C=ne(y.date);S+=`<div class="${D.join(" ")}" data-date="${C}">${y.day}</div>`}return S}function $i(t,e,o){return!!(e&&t<e||o&&t>o)}function Mi(t){return`
249
249
  <div class="wg-datepicker__footer">
250
250
  <button type="button" class="wg-datepicker__today-btn" data-action="today">
251
251
  ${t.today}
252
252
  </button>
253
253
  </div>
254
- `}function Mi(t,e,o){const i=t.querySelector(".wg-datepicker__days");i&&(i.innerHTML=ze(e,o))}function Ai(t,e,o){const i=t.querySelector(".wg-datepicker__month-year");if(i){const r=o.monthNames[e.viewMonth];i.textContent=`${r} ${e.viewYear}`}}function Oi(t,e){const o=t.querySelector(".wg-datepicker__rolling-selector"),i=t.querySelector(".wg-datepicker__calendar");o&&o.classList.toggle("wg-datepicker__rolling-selector--visible",e),i&&i.classList.toggle("wg-datepicker__calendar--hidden",e)}function Ri(t,e){t.querySelectorAll("[data-year]").forEach(r=>{const s=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===e.viewYear)}),t.querySelectorAll("[data-month]").forEach(r=>{const s=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===e.viewMonth)})}function Fe(t){const e=t.querySelector("[data-year].wg-datepicker__rolling-item--selected"),o=t.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(e){const i=e.parentElement;if(i){const r=e.offsetTop-i.clientHeight/2+e.clientHeight/2;i.scrollTop=r}}if(o){const i=o.parentElement;if(i){const r=o.offsetTop-i.clientHeight/2+o.clientHeight/2;i.scrollTop=r}}}function re(t){t.viewMonth===0?(t.viewMonth=11,t.viewYear--):t.viewMonth--}function ne(t){t.viewMonth===11?(t.viewMonth=0,t.viewYear++):t.viewMonth++}function Ii(t,e,o,i){var s,n,d,a;const{key:r}=t;if(r==="Escape")return(s=i.onClose)==null||s.call(i),!0;if(e.rollingSelectorOpen)return Pi(t,e);if((r==="ArrowLeft"||r==="ArrowRight")&&(t.ctrlKey||t.metaKey)){if(t.preventDefault(),r==="ArrowLeft"?re(e):ne(e),e.focusedDate){const c=Math.min(e.focusedDate.getDate(),bt(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return t.preventDefault(),Li(e,r,o),!0;if(r==="Enter")return t.preventDefault(),e.focusedDate&&((n=i.onSelect)==null||n.call(i,e.focusedDate,"down")),!0;if(r==="Tab")return e.focusedDate?(d=i.onSelect)==null||d.call(i,e.focusedDate,"next"):(a=i.onClose)==null||a.call(i),!1;if(r==="Home"){if(t.preventDefault(),t.ctrlKey||t.metaKey){let c=e.viewYear;const l=new Date(c,0,1);if(e.focusedDate&&St(e.focusedDate,l)&&c--,o.minDate){const g=V(o.minDate);g&&c<g.getFullYear()&&(c=g.getFullYear())}e.viewMonth=0,e.viewYear=c,e.focusedDate=new Date(c,0,1)}else e.focusedDate=new Date(e.viewYear,e.viewMonth,1);return!0}if(r==="End"){if(t.preventDefault(),t.ctrlKey||t.metaKey){let c=e.viewYear;const l=new Date(c,11,31);if(e.focusedDate&&St(e.focusedDate,l)&&c++,o.maxDate){const g=V(o.maxDate);g&&c>g.getFullYear()&&(c=g.getFullYear())}e.viewMonth=11,e.viewYear=c,e.focusedDate=new Date(c,11,31)}else{const c=bt(e.viewYear,e.viewMonth);e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}if(r==="PageUp"){if(t.preventDefault(),re(e),e.focusedDate){const c=Math.min(e.focusedDate.getDate(),bt(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}if(r==="PageDown"){if(t.preventDefault(),ne(e),e.focusedDate){const c=Math.min(e.focusedDate.getDate(),bt(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}return!1}function Li(t,e,o){if(!t.focusedDate){t.focusedDate=t.selectedDate?new Date(t.selectedDate):new Date(t.viewYear,t.viewMonth,1);return}const i=new Date(t.focusedDate),r=o.minDate?V(o.minDate):null,s=o.maxDate?V(o.maxDate):null;switch(e){case"ArrowLeft":i.setDate(i.getDate()-1);break;case"ArrowRight":i.setDate(i.getDate()+1);break;case"ArrowUp":i.setDate(i.getDate()-7);break;case"ArrowDown":i.setDate(i.getDate()+7);break}r&&i<r||s&&i>s||(t.focusedDate=i,(i.getMonth()!==t.viewMonth||i.getFullYear()!==t.viewYear)&&(t.viewMonth=i.getMonth(),t.viewYear=i.getFullYear()))}function Pi(t,e){const{key:o}=t;if(o==="ArrowUp"||o==="ArrowDown"){t.preventDefault();const i=o==="ArrowUp"?-1:1;if(e.rollingSelectorMode==="month"){const r=e.viewMonth+i;r>=0&&r<=11&&(e.viewMonth=r)}else e.viewYear+=i;return!0}return o==="ArrowLeft"||o==="ArrowRight"?(t.preventDefault(),e.rollingSelectorMode=e.rollingSelectorMode==="month"?"year":"month",!0):o==="Enter"||o==="Escape"?(t.preventDefault(),e.rollingSelectorOpen=!1,!0):!1}function Hi(t){if(t.selectedDate)t.focusedDate=new Date(t.selectedDate),t.viewYear=t.selectedDate.getFullYear(),t.viewMonth=t.selectedDate.getMonth();else{const e=new Date;t.focusedDate=new Date(t.viewYear,t.viewMonth,e.getDate())}}function zi(t,e,o){const i=t.dataset.date;if(!i||t.classList.contains("wg-datepicker__day--disabled"))return null;const[r,s,n]=i.split("-").map(Number),d=new Date(r,s-1,n),a=o.minDate?V(o.minDate):null,c=o.maxDate?V(o.maxDate):null;return a&&d<a||c&&d>c?null:(e.selectedDate=d,e.focusedDate=d,d)}function Fi(t,e){const o=new Date;o.setHours(0,0,0,0);const i=e.minDate?V(e.minDate):null,r=e.maxDate?V(e.maxDate):null;return i&&o<i||r&&o>r?null:(t.selectedDate=o,t.focusedDate=o,t.viewYear=o.getFullYear(),t.viewMonth=o.getMonth(),o)}function Vi(t,e){const o=t.dataset.month;o!==void 0&&(e.viewMonth=parseInt(o,10))}function qi(t,e){const o=t.dataset.year;o!==void 0&&(e.viewYear=parseInt(o,10))}function se(t,e){var g,h,u,p;const{separator:o,parts:i,maxLength:r}=e,s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=t.replace(new RegExp(s,"g"),""),d=((g=i.year)==null?void 0:g.length)??4,a=[{type:"year",pos:((h=i.year)==null?void 0:h.index)??0,length:d},{type:"month",pos:((u=i.month)==null?void 0:u.index)??1,length:2},{type:"day",pos:((p=i.day)==null?void 0:p.index)??2,length:2}].sort((m,f)=>m.pos-f.pos);let c="",l=0;for(let m=0;m<a.length;m++){const f=a[m],b=n.substring(l,l+f.length);if(!b)break;c+=b,l+=b.length,m<a.length-1&&b.length===f.length&&(c+=o)}return c.substring(0,r)}function Yi(t,e,o){const i=t.value,r=t.selectionStart||0,s=i.length<o.length,{separator:n}=e,d=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=i.replace(new RegExp(`[^0-9${d}]`,"g"),""),c=se(a,e);if(c!==i){t.value=c;let l=r;if(s)l=r;else if(c.length>i.length&&c[r]===n)l=r+1;else if(c.length>i.length){const g=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=(i.substring(0,r).match(new RegExp(g,"g"))||[]).length,p=(c.substring(0,r).match(new RegExp(g,"g"))||[]).length-h;l=r+p}t.setSelectionRange(l,l)}return c}function Ni(t,e){const{key:o,ctrlKey:i,metaKey:r}=t,{separator:s}=e;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(o)||i||r)return!1;if(o===s){const d=t.target,a=d.selectionStart||0,c=d.value;let l=0;for(let h=a-1;h>=0;h--)if(c[h]===s){l=h+1;break}const g=c.substring(l,a);if(/^\d$/.test(g)){t.preventDefault();const h=c.substring(0,l)+"0"+g+s+c.substring(a);d.value=h;const u=l+2+s.length;return d.setSelectionRange(u,u),!0}}return!/^\d$/.test(o)&&o!==s?(t.preventDefault(),!0):!1}function Ui(t,e,o){var u;t.preventDefault();const i=((u=t.clipboardData)==null?void 0:u.getData("text"))||"",{separator:r}=o,s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=i.replace(new RegExp(`[^0-9${s}]`,"g"),""),d=se(n,o),a=e.selectionStart||0,c=e.selectionEnd||0,l=e.value,g=l.substring(0,a)+d+l.substring(c);e.value=se(g,o);const h=a+d.length;e.setSelectionRange(h,h)}function ji(t,e,o,i){if(!t||t.length<e.maxLength)return!1;const r=vi(t,e);if(!r)return!1;const s=i.minDate?V(i.minDate):null,n=i.maxDate?V(i.maxDate):null;return s&&r<s||n&&r>n?!1:(o.selectedDate=r,o.focusedDate=r,o.viewYear=r.getFullYear(),o.viewMonth=r.getMonth(),!0)}const Bi=`
254
+ `}function Ai(t,e,o){const i=t.querySelector(".wg-datepicker__days");i&&(i.innerHTML=qe(e,o))}function Oi(t,e,o){const i=t.querySelector(".wg-datepicker__month-year");if(i){const r=o.monthNames[e.viewMonth];i.textContent=`${r} ${e.viewYear}`}}function Ri(t,e){const o=t.querySelector(".wg-datepicker__rolling-selector"),i=t.querySelector(".wg-datepicker__calendar");o&&o.classList.toggle("wg-datepicker__rolling-selector--visible",e),i&&i.classList.toggle("wg-datepicker__calendar--hidden",e)}function Pi(t,e){t.querySelectorAll("[data-year]").forEach(r=>{const s=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===e.viewYear)}),t.querySelectorAll("[data-month]").forEach(r=>{const s=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===e.viewMonth)})}function Ye(t){const e=t.querySelector("[data-year].wg-datepicker__rolling-item--selected"),o=t.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(e){const i=e.parentElement;if(i){const r=e.offsetTop-i.clientHeight/2+e.clientHeight/2;i.scrollTop=r}}if(o){const i=o.parentElement;if(i){const r=o.offsetTop-i.clientHeight/2+o.clientHeight/2;i.scrollTop=r}}}function se(t){t.viewMonth===0?(t.viewMonth=11,t.viewYear--):t.viewMonth--}function ae(t){t.viewMonth===11?(t.viewMonth=0,t.viewYear++):t.viewMonth++}function Ii(t,e,o,i){var s,n,d,a;const{key:r}=t;if(r==="Escape")return(s=i.onClose)==null||s.call(i),!0;if(e.rollingSelectorOpen)return Hi(t,e);if((r==="ArrowLeft"||r==="ArrowRight")&&(t.ctrlKey||t.metaKey)){if(t.preventDefault(),r==="ArrowLeft"?se(e):ae(e),e.focusedDate){const c=Math.min(e.focusedDate.getDate(),vt(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return t.preventDefault(),Li(e,r,o),!0;if(r==="Enter")return t.preventDefault(),e.focusedDate&&((n=i.onSelect)==null||n.call(i,e.focusedDate,"down")),!0;if(r==="Tab")return e.focusedDate?(d=i.onSelect)==null||d.call(i,e.focusedDate,"next"):(a=i.onClose)==null||a.call(i),!1;if(r==="Home"){if(t.preventDefault(),t.ctrlKey||t.metaKey){let c=e.viewYear;const l=new Date(c,0,1);if(e.focusedDate&&Tt(e.focusedDate,l)&&c--,o.minDate){const g=Y(o.minDate);g&&c<g.getFullYear()&&(c=g.getFullYear())}e.viewMonth=0,e.viewYear=c,e.focusedDate=new Date(c,0,1)}else e.focusedDate=new Date(e.viewYear,e.viewMonth,1);return!0}if(r==="End"){if(t.preventDefault(),t.ctrlKey||t.metaKey){let c=e.viewYear;const l=new Date(c,11,31);if(e.focusedDate&&Tt(e.focusedDate,l)&&c++,o.maxDate){const g=Y(o.maxDate);g&&c>g.getFullYear()&&(c=g.getFullYear())}e.viewMonth=11,e.viewYear=c,e.focusedDate=new Date(c,11,31)}else{const c=vt(e.viewYear,e.viewMonth);e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}if(r==="PageUp"){if(t.preventDefault(),se(e),e.focusedDate){const c=Math.min(e.focusedDate.getDate(),vt(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}if(r==="PageDown"){if(t.preventDefault(),ae(e),e.focusedDate){const c=Math.min(e.focusedDate.getDate(),vt(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,c)}return!0}return!1}function Li(t,e,o){if(!t.focusedDate){t.focusedDate=t.selectedDate?new Date(t.selectedDate):new Date(t.viewYear,t.viewMonth,1);return}const i=new Date(t.focusedDate),r=o.minDate?Y(o.minDate):null,s=o.maxDate?Y(o.maxDate):null;switch(e){case"ArrowLeft":i.setDate(i.getDate()-1);break;case"ArrowRight":i.setDate(i.getDate()+1);break;case"ArrowUp":i.setDate(i.getDate()-7);break;case"ArrowDown":i.setDate(i.getDate()+7);break}r&&i<r||s&&i>s||(t.focusedDate=i,(i.getMonth()!==t.viewMonth||i.getFullYear()!==t.viewYear)&&(t.viewMonth=i.getMonth(),t.viewYear=i.getFullYear()))}function Hi(t,e){const{key:o}=t;if(o==="ArrowUp"||o==="ArrowDown"){t.preventDefault();const i=o==="ArrowUp"?-1:1;if(e.rollingSelectorMode==="month"){const r=e.viewMonth+i;r>=0&&r<=11&&(e.viewMonth=r)}else e.viewYear+=i;return!0}return o==="ArrowLeft"||o==="ArrowRight"?(t.preventDefault(),e.rollingSelectorMode=e.rollingSelectorMode==="month"?"year":"month",!0):o==="Enter"||o==="Escape"?(t.preventDefault(),e.rollingSelectorOpen=!1,!0):!1}function zi(t){if(t.selectedDate)t.focusedDate=new Date(t.selectedDate),t.viewYear=t.selectedDate.getFullYear(),t.viewMonth=t.selectedDate.getMonth();else{const e=new Date;t.focusedDate=new Date(t.viewYear,t.viewMonth,e.getDate())}}function Fi(t,e,o){const i=t.dataset.date;if(!i||t.classList.contains("wg-datepicker__day--disabled"))return null;const[r,s,n]=i.split("-").map(Number),d=new Date(r,s-1,n),a=o.minDate?Y(o.minDate):null,c=o.maxDate?Y(o.maxDate):null;return a&&d<a||c&&d>c?null:(e.selectedDate=d,e.focusedDate=d,d)}function Vi(t,e){const o=new Date;o.setHours(0,0,0,0);const i=e.minDate?Y(e.minDate):null,r=e.maxDate?Y(e.maxDate):null;return i&&o<i||r&&o>r?null:(t.selectedDate=o,t.focusedDate=o,t.viewYear=o.getFullYear(),t.viewMonth=o.getMonth(),o)}function qi(t,e){const o=t.dataset.month;o!==void 0&&(e.viewMonth=parseInt(o,10))}function Yi(t,e){const o=t.dataset.year;o!==void 0&&(e.viewYear=parseInt(o,10))}function le(t,e){var g,h,u,p;const{separator:o,parts:i,maxLength:r}=e,s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=t.replace(new RegExp(s,"g"),""),d=((g=i.year)==null?void 0:g.length)??4,a=[{type:"year",pos:((h=i.year)==null?void 0:h.index)??0,length:d},{type:"month",pos:((u=i.month)==null?void 0:u.index)??1,length:2},{type:"day",pos:((p=i.day)==null?void 0:p.index)??2,length:2}].sort((m,f)=>m.pos-f.pos);let c="",l=0;for(let m=0;m<a.length;m++){const f=a[m],b=n.substring(l,l+f.length);if(!b)break;c+=b,l+=b.length,m<a.length-1&&b.length===f.length&&(c+=o)}return c.substring(0,r)}function Ni(t,e,o){const i=t.value,r=t.selectionStart||0,s=i.length<o.length,{separator:n}=e,d=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=i.replace(new RegExp(`[^0-9${d}]`,"g"),""),c=le(a,e);if(c!==i){t.value=c;let l=r;if(s)l=r;else if(c.length>i.length&&c[r]===n)l=r+1;else if(c.length>i.length){const g=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=(i.substring(0,r).match(new RegExp(g,"g"))||[]).length,p=(c.substring(0,r).match(new RegExp(g,"g"))||[]).length-h;l=r+p}t.setSelectionRange(l,l)}return c}function Ui(t,e){const{key:o,ctrlKey:i,metaKey:r}=t,{separator:s}=e;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(o)||i||r)return!1;if(o===s){const d=t.target,a=d.selectionStart||0,c=d.value;let l=0;for(let h=a-1;h>=0;h--)if(c[h]===s){l=h+1;break}const g=c.substring(l,a);if(/^\d$/.test(g)){t.preventDefault();const h=c.substring(0,l)+"0"+g+s+c.substring(a);d.value=h;const u=l+2+s.length;return d.setSelectionRange(u,u),!0}}return!/^\d$/.test(o)&&o!==s?(t.preventDefault(),!0):!1}function ji(t,e,o){var u;t.preventDefault();const i=((u=t.clipboardData)==null?void 0:u.getData("text"))||"",{separator:r}=o,s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=i.replace(new RegExp(`[^0-9${s}]`,"g"),""),d=le(n,o),a=e.selectionStart||0,c=e.selectionEnd||0,l=e.value,g=l.substring(0,a)+d+l.substring(c);e.value=le(g,o);const h=a+d.length;e.setSelectionRange(h,h)}function Bi(t,e,o,i){if(!t||t.length<e.maxLength)return!1;const r=_i(t,e);if(!r)return!1;const s=i.minDate?Y(i.minDate):null,n=i.maxDate?Y(i.maxDate):null;return s&&r<s||n&&r>n?!1:(o.selectedDate=r,o.focusedDate=r,o.viewYear=r.getFullYear(),o.viewMonth=r.getMonth(),!0)}const Ki=`
255
255
  .wg-datepicker-container {
256
256
  position: fixed;
257
257
  z-index: var(--wg-dp-z-index, 9999);
@@ -501,7 +501,7 @@
501
501
  .wg-datepicker__today-btn:hover {
502
502
  background-color: color-mix(in srgb, var(--wg-dp-accent-color) 10%, transparent);
503
503
  }
504
- `;let Ve=!1;class ae{constructor(e={}){w(this,"options");w(this,"state");w(this,"localeStrings");w(this,"formatInfo");w(this,"element",null);w(this,"anchor",null);w(this,"input",null);w(this,"cleanupAutoUpdate",null);w(this,"previousInputValue","");w(this,"boundHandleClickOutside");w(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=oe(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}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"}),d=[],a=[];for(let g=0;g<12;g++){const h=new Date(2024,g,1);d.push(i.format(h)),a.push(r.format(h))}const c=[],l=[];for(let g=0;g<7;g++){const h=new Date(2024,0,7+g);c.push(s.format(h));const u=n.format(h);l.push(u.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:d,monthNamesShort:a,weekdayNames:c,weekdayNamesShort:l}}catch{return Pe}}static injectStyles(){if(Ve)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=Bi,document.head.appendChild(e),Ve=!0}open(e,o=null){ae.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=V(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()}Hi(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=Si(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Fe(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 He(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=Io(this.anchor,e,()=>{Pt(this.anchor,e,{placement:"bottom-start",middleware:[It(4),Lt({fallbackPlacements:["top-start","bottom-end","top-end"]}),De({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 d;const o=e.target,i=(d=o.closest("[data-action]"))==null?void 0:d.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),re(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),ne(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Fe(this.element);return}if(i==="today"){e.preventDefault();const a=Fi(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){e.preventDefault();const a=zi(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),Vi(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),qi(n,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const o=e.target;!this.element.contains(o)&&!this.anchor.contains(o)&&this.close()}handleKeyDown(e){Ii(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&&(Ai(e,this.state,this.localeStrings),Oi(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Ri(e,this.state):Mi(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=Yi(e,this.formatInfo,this.previousInputValue),ji(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",o=>{Ni(o,this.formatInfo)}),e.addEventListener("paste",o=>{Ui(o,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}const Ki=`
504
+ `;let Ne=!1;class de{constructor(e={}){w(this,"options");w(this,"state");w(this,"localeStrings");w(this,"formatInfo");w(this,"element",null);w(this,"anchor",null);w(this,"input",null);w(this,"cleanupAutoUpdate",null);w(this,"previousInputValue","");w(this,"boundHandleClickOutside");w(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=re(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}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"}),d=[],a=[];for(let g=0;g<12;g++){const h=new Date(2024,g,1);d.push(i.format(h)),a.push(r.format(h))}const c=[],l=[];for(let g=0;g<7;g++){const h=new Date(2024,0,7+g);c.push(s.format(h));const u=n.format(h);l.push(u.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:d,monthNamesShort:a,weekdayNames:c,weekdayNamesShort:l}}catch{return Fe}}static injectStyles(){if(Ne)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=Ki,document.head.appendChild(e),Ne=!0}open(e,o=null){de.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=Y(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()}zi(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=xi(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Ye(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 Ve(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=zo(this.anchor,e,()=>{kt(this.anchor,e,{placement:"bottom-start",middleware:[Ht(4),xt({fallbackPlacements:["top-start","bottom-end","top-end"]}),Gt({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 d;const o=e.target,i=(d=o.closest("[data-action]"))==null?void 0:d.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),se(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),ae(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Ye(this.element);return}if(i==="today"){e.preventDefault();const a=Vi(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){e.preventDefault();const a=Fi(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),qi(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),Yi(n,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const o=e.target;!this.element.contains(o)&&!this.anchor.contains(o)&&this.close()}handleKeyDown(e){Ii(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&&(Oi(e,this.state,this.localeStrings),Ri(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Pi(e,this.state):Ai(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=Ni(e,this.formatInfo,this.previousInputValue),Bi(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",o=>{Ui(o,this.formatInfo)}),e.addEventListener("paste",o=>{ji(o,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}const Wi=`
505
505
  .wg-context-menu-container {
506
506
  position: fixed;
507
507
  z-index: var(--wg-cm-z-index, 10000);
@@ -589,24 +589,24 @@
589
589
  background: var(--wg-cm-border-color);
590
590
  margin: var(--wg-cm-padding) 0;
591
591
  }
592
- `;let qe=!1;function Wi(){if(qe)return;const t=document.createElement("style");t.id="wg-context-menu-styles",t.textContent=Ki,document.head.appendChild(t),qe=!0}function Xi(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,d=typeof r.icon=="function"?r.icon(e):r.icon,a=typeof r.disabled=="function"?r.disabled(e):r.disabled,c=r.danger===!0,l=["wg-context-menu__item",a?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=r.dividerBefore&&s>0?'<div class="wg-context-menu__divider"></div>':"",h=d?`<span class="wg-context-menu__icon">${d}</span>`:"";return`${g}<div class="${l}" data-item-id="${r.id}" data-disabled="${a?"true":"false"}">${h}<span class="wg-context-menu__label">${n}</span></div>`}).join("")}</div>`}function Qi(t,e,o,i,r,s,n){Wi();const d=Xi(i,r);if(!d)return null;const a=document.createElement("div");a.className="wg-context-menu-container",a.innerHTML=d,document.body.appendChild(a);const c=a.querySelector(".wg-context-menu");Pt({getBoundingClientRect:()=>({width:0,height:0,x:e,y:o,top:o,left:e,right:e,bottom:o})},c,{placement:"bottom-start",middleware:[It(4),Lt({fallbackPlacements:["top-start","bottom-end","top-end"]}),De({padding:8})]}).then(({x:u,y:p})=>{Object.assign(c.style,{left:`${u}px`,top:`${p}px`})}),a.addEventListener("click",u=>{const p=u.target.closest(".wg-context-menu__item");if(p&&p.dataset.disabled!=="true"){const m=p.dataset.itemId||"";s(m)}});const g=u=>{a.contains(u.target)||(xt(a,g,h),n())},h=u=>{u.key==="Escape"&&(u.preventDefault(),xt(a,g,h),n())};return setTimeout(()=>{document.addEventListener("mousedown",g),document.addEventListener("keydown",h)},0),a._cleanup={handleOutsideClick:g,handleKeyDown:h},a}function xt(t,e,o){e&&document.removeEventListener("mousedown",e),o&&document.removeEventListener("keydown",o);const i=t._cleanup;i&&(i.handleOutsideClick&&document.removeEventListener("mousedown",i.handleOutsideClick),i.handleKeyDown&&document.removeEventListener("keydown",i.handleKeyDown)),t.remove()}class le extends HTMLElement{constructor(){super();w(this,"grid");w(this,"shadow");w(this,"styleElement");w(this,"customStyleElement",null);w(this,"updatePending",!1);w(this,"isCommittingFromKeyboard",!1);w(this,"isTransitioningCells",!1);w(this,"wheelListenerAdded",!1);w(this,"toolbarOutsideClickAdded",!1);w(this,"toolbarScrollListenerAdded",!1);w(this,"toolbarMoveInProgress",!1);w(this,"toolbarHideTimeout",null);w(this,"toolbarHovered",!1);w(this,"dropdownOpen",!1);w(this,"dropdownOptions",[]);w(this,"highlightedIndex",-1);w(this,"filterText","");w(this,"isUserFiltering",!1);w(this,"justSelected",!1);w(this,"isOpeningDropdown",!1);w(this,"searchDebounceTimer",null);w(this,"searchAbortController",null);w(this,"isSearching",!1);w(this,"tooltipElement",null);w(this,"tooltipArrowElement",null);w(this,"tooltipAnchor",null);w(this,"tooltipShowTimer",null);w(this,"tooltipHideTimer",null);w(this,"_tooltipShowDelay",400);w(this,"_tooltipHideDelay",100);w(this,"datepicker",null);w(this,"contextMenuElement",null);w(this,"virtualScrollStart",0);w(this,"virtualScrollEnd",0);w(this,"scrollListenerAdded",!1);w(this,"isLoadingMoreItems",!1);w(this,"handlePaste",o=>{var c;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,s=this.grid.columns[r],n=this.grid.displayItems[i];if(!s||!n||!this.grid.isCellEditable(s))return;o.preventDefault();let d=((c=o.clipboardData)==null?void 0:c.getData("text"))||"";if(s.beforePasteCallback){const l=s.beforePasteCallback(d,n);d=l!=null?String(l):""}const a=String(s.field);this.grid.commitEdit(i,a,d),this.render()});this.shadow=this.attachShadow({mode:"open"}),this.grid=new L,this.styleElement=document.createElement("style"),this.styleElement.textContent=ut,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate()}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(o){this._tooltipShowDelay=o}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(o){this._tooltipHideDelay=o}connectedCallback(){this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(xt(this.contextMenuElement),this.contextMenuElement=null),zt()}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 sortable(){return this.grid.sortable}set sortable(o){this.grid.sortable=o}get filterable(){return this.grid.filterable}set filterable(o){this.grid.filterable=o}get pageable(){return this.grid.pageable}set pageable(o){this.grid.pageable=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 striped(){return this.grid.striped}set striped(o){this.grid.striped=o}get hoverable(){return this.grid.hoverable}set hoverable(o){this.grid.hoverable=o}get editable(){return this.grid.editable}set editable(o){this.grid.editable=o}get editTrigger(){return this.grid.editTrigger}set editTrigger(o){this.grid.editTrigger=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 dropdownShowOnFocus(){return this.grid.dropdownShowOnFocus}set dropdownShowOnFocus(o){this.grid.dropdownShowOnFocus=o}get openDropdownOnEnter(){return this.grid.openDropdownOnEnter}set openDropdownOnEnter(o){this.grid.openDropdownOnEnter=o}get checkboxAlwaysEditable(){return this.grid.checkboxAlwaysEditable}set checkboxAlwaysEditable(o){this.grid.checkboxAlwaysEditable=o}get showRowNumbers(){return this.grid.showRowNumbers}set showRowNumbers(o){this.grid.showRowNumbers=o}get invalidCells(){return this.grid.invalidCells}set invalidCells(o){this.grid.invalidCells=o}get showRowToolbar(){return this.grid.showRowToolbar}set showRowToolbar(o){this.grid.showRowToolbar=o}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(o){this.grid.rowToolbar=o}get toolbarAlign(){return this.grid.toolbarAlign}set toolbarAlign(o){this.grid.toolbarAlign=o}get toolbarTopPosition(){return this.grid.toolbarTopPosition}set toolbarTopPosition(o){this.grid.toolbarTopPosition=o}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(o){this.grid.toolbarTrigger=o}get contextMenu(){return this.grid.contextMenu}set contextMenu(o){this.grid.contextMenu=o}get showRowActions(){return this.grid.showRowActions}set showRowActions(o){this.grid.showRowActions=o}get rowActions(){return this.grid.rowActions}set rowActions(o){this.grid.rowActions=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}set ontoolbarclick(o){this.grid.ontoolbarclick=o}set onrowaction(o){this.grid.onrowaction=o}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 sort(){return this.grid.sort}set sort(o){this.grid.sort=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 summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(o){this.grid.summaryMetadata=o}get summaryInline(){return this.grid.summaryInline}set summaryInline(o){this.grid.summaryInline=o}get virtualScroll(){return this.grid.virtualScroll}set virtualScroll(o){this.grid.virtualScroll=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 infiniteScroll(){return this.grid.infiniteScroll}set infiniteScroll(o){this.grid.infiniteScroll=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 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)}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){Gt(this,o,i,r)}requestUpdate(){this.updatePending||(this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}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 c;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,n=this.grid.displayItems,d=this.grid.getEditableColumns(),a=d.findIndex(l=>l.index===r);if((o.ctrlKey||o.metaKey)&&o.key==="c"){const l=s[r],g=n[i];if(l&&g){let h=this.grid.getCellRawValue(g,i,String(l.field));l.beforeCopyCallback&&(h=l.beforeCopyCallback(h,g));const u=h!=null?String(h):"";navigator.clipboard.writeText(u)}return}switch(o.key){case"ArrowUp":o.preventDefault(),i>0&&E(this,i-1,r);break;case"ArrowDown":o.preventDefault(),i<n.length-1&&E(this,i+1,r);break;case"ArrowLeft":o.preventDefault(),r>0&&E(this,i,r-1);break;case"ArrowRight":o.preventDefault(),r<s.length-1&&E(this,i,r+1);break;case"Tab":if(o.preventDefault(),o.shiftKey){if(a>0){const l=d[a-1].index;E(this,i,l)}else if(i>0){const l=d[d.length-1].index;E(this,i-1,l)}}else if(a>=0&&a<d.length-1){const l=d[a+1].index;E(this,i,l)}else if(a===-1&&d.length>0)E(this,i,d[0].index);else if(i<n.length-1){const l=d[0].index;E(this,i+1,l)}break;case"Home":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const l=this.grid.focusedCell;this.grid.setFocusedCell(0,0),gt(this,0);const g=this.shadow.querySelector('td[data-row="0"][data-col="0"]');g&&(g.focus({preventScroll:!0}),N(this,l,{rowIndex:0,colIndex:0}))}else E(this,0,0);else E(this,i,0);break;case"End":if(o.preventDefault(),o.ctrlKey){const l=n.length-1,g=s.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(l,g),gt(this,l);const u=this.shadow.querySelector(`td[data-row="${l}"][data-col="${g}"]`);u&&(u.focus({preventScroll:!0}),N(this,h,{rowIndex:l,colIndex:g}))}else E(this,l,g)}else E(this,i,s.length-1);break;case"PageUp":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const l=this.grid.focusedCell;this.grid.setFocusedCell(0,r),gt(this,0);const g=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);g&&(g.focus({preventScroll:!0}),N(this,l,{rowIndex:0,colIndex:r}))}else E(this,0,r);else{const l=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(l,r),gt(this,l);const h=this.shadow.querySelector(`td[data-row="${l}"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),N(this,g,{rowIndex:l,colIndex:r}))}else E(this,l,r)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const l=n.length-1;if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(l,r),gt(this,l);const h=this.shadow.querySelector(`td[data-row="${l}"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),N(this,g,{rowIndex:l,colIndex:r}))}else E(this,l,r)}else{const l=Math.min(n.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(l,r),gt(this,l);const h=this.shadow.querySelector(`td[data-row="${l}"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),N(this,g,{rowIndex:l,colIndex:r}))}else E(this,l,r)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{o.preventDefault();const l=s[r];((l==null?void 0:l.editor)==="select"||(l==null?void 0:l.editor)==="combobox"||(l==null?void 0:l.editor)==="autocomplete")&&this.grid.getEffectiveOpenDropdownOnEnter(l)?(Z(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||J(this)})):i<n.length-1&&E(this,i+1,r);break}case"F2":{o.preventDefault();const l=s[r],g=(l==null?void 0:l.editor)==="select"||(l==null?void 0:l.editor)==="combobox"||(l==null?void 0:l.editor)==="autocomplete",h=(l==null?void 0:l.editor)==="custom";Z(this,i,r),g?requestAnimationFrame(()=>{this.dropdownOpen||J(this)}):h&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{o.preventDefault();const l=s[r],g=(l==null?void 0:l.editor)==="checkbox",h=(l==null?void 0:l.editor)==="select"||(l==null?void 0:l.editor)==="combobox"||(l==null?void 0:l.editor)==="autocomplete",u=(l==null?void 0:l.editor)==="date",p=(l==null?void 0:l.editor)==="custom";g?Qo(this,i,r):h?(Z(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||J(this)})):u?(Z(this,i,r),requestAnimationFrame(()=>{var v;const m=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),f=m==null?void 0:m.querySelector(".wg__date-input"),b=m==null?void 0:m.querySelector(".wg__editor--date");f&&b&&this.openDatePicker(f,b)})):p&&(Z(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)z(this),this.grid.cancelEdit();else{const l=this.grid.focusedCell;this.grid.clearFocusedCell(),N(this,l,null),(c=o.target)==null||c.blur()}break;case"Delete":{o.preventDefault();const l=s[r],g=n[i];if(o.ctrlKey){if(g){const h={rowIndex:i,row:g};this.grid.onrowdelete&&this.grid.onrowdelete(h),this.dispatchEvent(new CustomEvent("rowdelete",{detail:h}))}}else l&&this.grid.isCellEditable(l)&&(this.grid.commitEdit(i,String(l.field),null),this.render(),requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);h==null||h.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const l=s[r];if((l==null?void 0:l.editor)==="number"&&!/[\d.\-]/.test(o.key))return;Z(this,i,r,{initialSearchQuery:o.key}),o.preventDefault()}break}}handleEditorKeyDown(o,i){const r=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",n=this.grid.columns.find(l=>l.field===s),d=(n==null?void 0:n.editor)||"text",a=d==="select"||d==="combobox"||d==="autocomplete",c=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&c.includes(o.key)){o.preventDefault(),o.stopPropagation();const l=this.grid.columns.findIndex(b=>b.field===s),g=this.grid.columns.map((b,v)=>({index:v,column:b})).filter(b=>b.column.editable!==!1),h=g.findIndex(b=>b.index===l),u=this.grid.displayItems;let p=r,m=l,f=!1;switch(o.key){case"ArrowUp":r>0&&(p=r-1,f=!0);break;case"ArrowDown":r<u.length-1&&(p=r+1,f=!0);break;case"ArrowLeft":h>0&&(m=g[h-1].index,f=!0);break;case"ArrowRight":h<g.length-1&&(m=g[h+1].index,f=!0);break;case"PageUp":p=Math.max(0,r-10),f=!0;break;case"PageDown":p=Math.min(u.length-1,r+10),f=!0;break;case"Home":o.ctrlKey&&(p=0),m=0,f=!0;break;case"End":o.ctrlKey?(p=u.length-1,m=this.grid.columns.length-1):m=this.grid.columns.length-1,f=!0;break}f&&(z(this),this.grid.cancelEdit(),queueMicrotask(()=>{E(this,p,m)}));return}switch(o.key){case"ArrowDown":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const l=this.getCurrentEditorOptions();let g=this.highlightedIndex+1;for(;g<this.dropdownOptions.length&&_t(this.dropdownOptions[g],l);)g++;g<this.dropdownOptions.length&&(this.highlightedIndex=g,ot(this),Ee(this))}break;case"ArrowUp":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const l=this.getCurrentEditorOptions();let g=this.highlightedIndex-1;for(;g>=0&&_t(this.dropdownOptions[g],l);)g--;g>=0&&(this.highlightedIndex=g,ot(this),Ee(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Te(this,this.highlightedIndex):a&&!this.dropdownOpen?J(this):(this.isCommittingFromKeyboard=!0,A(this),d==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):Ht(this,i),Gt(this,r,s,"down"));break;case"Tab":if(this.datepicker)return;if(o.preventDefault(),o.stopPropagation(),this.isCommittingFromKeyboard=!0,this.dropdownOpen&&this.highlightedIndex>=0&&a){const l=this.dropdownOptions[this.highlightedIndex],g=this.getCurrentEditorOptions();if(l&&!_t(l,g)){const h=at(l,g);this.grid.commitEdit(r,s,h)}A(this)}else A(this),d==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):a||Ht(this,i);Gt(this,r,s,o.shiftKey?"prev":"next");break;case"Escape":o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&A(this),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null),this.isCommittingFromKeyboard=!0,z(this),this.grid.cancelEdit(),Jo(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&J(this);break;case"Backspace":d==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),Ae(this,n.editorOptions||{})));break;default:d==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,Ae(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("focus",s=>{var d;const n=s.target;if(n.matches(".wg__cell")){const a=parseInt(n.dataset.row||"0",10),c=parseInt(n.dataset.col||"0",10);jo(this,a,c)}if(n.matches(".wg__select-trigger, .wg__combobox-input, .wg__autocomplete-input")&&!this.justSelected&&!this.dropdownOpen){const a=n.dataset.field||"",c=this.grid.columns.find(h=>h.field===a),l=(c==null?void 0:c.editorOptions)||{};(((d=this.grid.editingCell)==null?void 0:d.initialSearchQuery)!==void 0||l.showOnFocus!==!1)&&J(this)}},!0),o.addEventListener("keydown",s=>{const n=s.target;if(n.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(s,n);return}if(n.matches(".wg__cell")){const d=parseInt(n.dataset.row||"0",10),a=parseInt(n.dataset.col||"0",10);this.handleCellKeyDown(s,d,a)}}),o.addEventListener("focusout",s=>{Ko(this,s)}),o.addEventListener("dblclick",s=>{s.preventDefault();const d=s.target.closest(".wg__cell");if(d){const a=parseInt(d.dataset.row||"0",10),c=parseInt(d.dataset.col||"0",10),l=this.grid.columns[c];if(l){const g=l.editTrigger||this.grid.editTrigger;if(g==="dblclick"||g==="navigate"){const h=Bo(s,d);Z(this,a,c,{cursorPosition:h??void 0});const u=l.editor;u==="select"||u==="combobox"||u==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||J(this)}):u==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(a,c)})}}}}),o.addEventListener("mousedown",s=>{const n=s.target;if(n.closest(".wg__date-trigger")){s.preventDefault(),s.stopPropagation();const a=n.closest(".wg__cell-date-display"),c=n.closest(".wg__editor--date");if(c){const l=c.querySelector(".wg__date-input");l&&this.openDatePicker(l,c)}else if(a){const l=parseInt(a.dataset.row||"0",10),g=a.dataset.field||"",h=this.grid.columns.findIndex(u=>String(u.field)===g);h>=0&&(this.isTransitioningCells=!0,this.grid.editingCell&&(A(this),z(this),this.grid.cancelEdit()),Z(this,l,h),requestAnimationFrame(()=>{var f;this.isTransitioningCells=!1;const u=(f=this.shadowRoot)==null?void 0:f.querySelector(`.wg__cell[data-row="${l}"][data-field="${g}"]`),p=u==null?void 0:u.querySelector(".wg__date-input"),m=u==null?void 0:u.querySelector(".wg__editor--date");p&&m&&this.openDatePicker(p,m)}))}return}if(this.dropdownOpen||this.grid.editingCell){const a=n.closest(".wg__cell");if(a&&!n.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const c=parseInt(a.dataset.row||"0",10),l=parseInt(a.dataset.col||"0",10),g=this.grid.editingCell,h=n.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(g&&!h){const u=this.grid.columns.findIndex(p=>String(p.field)===g.field);if(c!==g.rowIndex||l!==u){s.preventDefault(),this.isTransitioningCells=!0,A(this),z(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{this.isTransitioningCells=!1,E(this,c,l)});return}}}}if(n.matches(".wg__combobox-toggle, .wg__select-toggle")){s.preventDefault(),s.stopPropagation();const a=n.closest(".wg__cell-dropdown-display");if(n.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete"))Me(this);else if(a){const l=parseInt(a.dataset.row||"0",10),g=a.dataset.field||"",h=this.grid.columns.findIndex(u=>String(u.field)===g);h>=0&&(this.isTransitioningCells=!0,this.grid.editingCell&&(A(this),z(this),this.grid.cancelEdit()),Z(this,l,h),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||J(this)}))}}if(n.matches(".wg__cell-dropdown-display")){s.preventDefault(),s.stopPropagation();const a=n.closest(".wg__cell-dropdown-display");if(a){const c=parseInt(a.dataset.row||"0",10),l=a.dataset.field||"",g=this.grid.columns.findIndex(h=>String(h.field)===l);g>=0&&(this.isTransitioningCells=!0,this.grid.editingCell&&(A(this),z(this),this.grid.cancelEdit()),Z(this,c,g),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||J(this)}))}}}),o.addEventListener("click",s=>{s.target.matches(".wg__select-trigger, .wg__select-value")&&(s.preventDefault(),s.stopPropagation(),Me(this))}),o.addEventListener("click",s=>{const n=s,a=n.target.closest(".wg__header--sortable");if(a){const c=a.dataset.field;if(!c)return;const l=[...this.grid.sort],g=l.findIndex(u=>u.column===c);n.ctrlKey||n.metaKey?g>=0?l[g].direction==="asc"?l[g]={column:c,direction:"desc"}:l.splice(g,1):l.push({column:c,direction:"asc"}):g>=0&&l.length===1?l[0].direction==="asc"?l[0]={column:c,direction:"desc"}:l.length=0:(l.length=0,l.push({column:c,direction:"asc"})),this.grid.sort=l,this.grid.pageable&&(this.grid.currentPage=1),this.grid.fireDataRequest("sort"),this.render()}}),o.addEventListener("contextmenu",s=>{this.handleContextMenu(s)}),o.addEventListener("change",s=>{const n=s.target;n.matches(".wg__editor--checkbox")&&Xo(this,n)}),o.addEventListener("input",s=>{const n=s.target;n.matches(".wg__combobox-input")?Ho(this,s):n.matches(".wg__autocomplete-input")&&zo(this,s)}),o.addEventListener("blur",s=>{const n=s.target;if(n.matches(".wg__editor--text, .wg__editor--number")&&Go(this,n),n.matches(".wg__date-input")&&!this.datepicker&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&this.commitDateEditor(n),n.matches(".wg__select-trigger")&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&!this.dropdownOpen&&!this.isOpeningDropdown&&(A(this),z(this),this.grid.cancelEdit()),n.matches(".wg__combobox-input, .wg__autocomplete-input")){if(this.isCommittingFromKeyboard||this.isTransitioningCells)return;if(A(this),this.grid.editingCell){const d=n,a=this.getCurrentEditingColumn();if(a){const c=a.editorOptions||{},g=(c.options||c.initialOptions||[]).find(h=>vt(h,c).toLowerCase()===d.value.toLowerCase());g?this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,at(g,c)):this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,d.value)}}}},!0);const i=this.shadow.querySelector(".wg");i&&i.addEventListener("scroll",()=>{this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&(A(this),z(this),this.grid.cancelEdit()),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(i),this.grid.infiniteScroll&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(i)}),this.wheelListenerAdded||(this.wheelListenerAdded=!0,window.addEventListener("scroll",()=>{this.dropdownOpen&&!this.isTransitioningCells&&(A(this),z(this),this.grid.cancelEdit())},{passive:!0,capture:!0})),o.addEventListener("mouseenter",s=>{const d=s.target.closest("[data-tooltip]");if(d){const a=d.getAttribute("data-tooltip");Vo(this,d,a,this._tooltipShowDelay)}},!0),o.addEventListener("mouseleave",s=>{const n=s,d=n.target,a=n.relatedTarget,c=d.closest("[data-tooltip]");c&&(a==null?void 0:a.closest("[data-tooltip]"))===c||c&&qo(this,this._tooltipHideDelay)},!0),o.addEventListener("click",s=>{const d=s.target.closest(".wg__toolbar-trigger");if(d&&this.grid.toolbarTrigger==="button"){s.preventDefault(),s.stopPropagation();const a=parseInt(d.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${a}"]`);c&&(Zt(a)?(this.closeToolbarAndReset(),this.render()):this.showToolbarForRow(c,a))}}),o.addEventListener("mouseenter",s=>{if(this.grid.toolbarTrigger!=="hover")return;this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null);const n=s,a=n.target.closest(".wg__row");if(a){const c=parseInt(a.dataset.rowIndex||"0",10);Zt(c)||this.showToolbarForRow(a,c,n.clientX)}},!0),o.addEventListener("mouseleave",s=>{if(this.grid.toolbarTrigger!=="hover")return;if(s.target.closest(".wg__row")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const c=this.shadow.querySelector(".wg__toolbar-container"),l=c==null?void 0:c.matches(":hover"),g=o.matches(":hover");!l&&!g&&(this.closeToolbarAndReset(),this.grid.editingCell||this.render())},150)}},!0),o.addEventListener("click",s=>{if(this.grid.toolbarTrigger!=="click")return;const n=s,d=n.target,a=d.closest(".wg__row");if(a&&!d.closest(".wg__cell--editing")){const c=parseInt(a.dataset.rowIndex||"0",10);Zt(c)?(this.closeToolbarAndReset(),this.render()):this.showToolbarForRow(a,c,n.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",s=>{if(!hi(this.shadow))return;const n=s.composedPath(),d=n.some(l=>{var g;return(g=l.classList)==null?void 0:g.contains("wg__toolbar-container")}),a=n.some(l=>{var g;return(g=l.classList)==null?void 0:g.contains("wg__toolbar-trigger")});d||a||n.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Ft()!==null&&(this.closeToolbarAndReset(),this.render())})),this.toolbarScrollListenerAdded||(this.toolbarScrollListenerAdded=!0,window.addEventListener("scroll",()=>{Ft()!==null&&(this.closeToolbarAndReset(),this.render())},!0)),this.shadow.querySelectorAll(".wg__pagination").forEach(s=>{s.addEventListener("click",d=>{const c=d.target.closest(".wg__pagination-btn");if(!c||c.hasAttribute("disabled"))return;const l=c.dataset.action;let g=!1;l==="first"&&this.grid.currentPage!==1?(this.grid.currentPage=1,g=!0):l==="prev"&&this.grid.currentPage>1?(this.grid.currentPage--,g=!0):l==="next"&&this.grid.currentPage<this.grid.totalPages?(this.grid.currentPage++,g=!0):l==="last"&&this.grid.currentPage!==this.grid.totalPages&&(this.grid.currentPage=this.grid.totalPages,g=!0),g&&(this.grid.fireDataRequest("page"),this.render())});const n=s.querySelector(".wg__pagination-select");n&&n.addEventListener("change",()=>{const d=parseInt(n.value,10);d!==this.grid.pageSize&&(this.grid.pageSize=d,this.grid.currentPage=1,this.grid.fireDataRequest("pageSize"),this.render())})})}handleVirtualScroll(o){const i=this.grid.displayItems,r=this.grid.virtualScrollRowHeight,s=this.grid.virtualScrollBuffer,n=o.scrollTop,d=o.clientHeight;let a=Math.max(0,Math.floor(n/r)-s);const c=Math.ceil(d/r)+s*2;let l=Math.min(i.length,a+c);const g=this.grid.editingCell;if(g){const h=g.rowIndex;h<a&&(a=h),h>=l&&(l=h+1)}(a!==this.virtualScrollStart||l!==this.virtualScrollEnd)&&(this.virtualScrollStart=a,this.virtualScrollEnd=l,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=Le(this,s),n){this.grid.setFocusedCell(n.rowIndex,n.colIndex);const d=i.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);d&&(d.focus({preventScroll:!0}),N(this,null,n))}}handleInfiniteScroll(o){const i=o.scrollTop,r=o.scrollHeight,s=o.clientHeight,n=this.grid.infiniteScrollThreshold;r-(i+s)<=n&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}render(){var m;const o=this.shadow.querySelector(".wg"),i=(o==null?void 0:o.scrollTop)||0,r=(o==null?void 0:o.scrollLeft)||0,s=this.grid.focusedCell;o&&o.remove();const n=document.createElement("div");n.className=wi(this);const d=this.grid.paginationPosition.split("|").map(f=>f.trim()),a=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(f=>f.trim()):[],c=(f,b)=>{const v=d.filter(x=>b?x.startsWith("top-"):x.startsWith("bottom-")),_=a.filter(x=>b?x.startsWith("top-"):x.startsWith("bottom-")),C=v.length>0,y=_.length>0;return!C&&!y?"":y&&C&&this.grid.summaryInline?`<div class="wg__footer${b?" wg__footer--top":""}">
593
- ${ee(this,_[0])}
594
- ${te(this,v[0])}
595
- </div>`:[...new Set([...v,..._])].map(x=>{const S=v.includes(x),T=_.includes(x);return T&&S?`<div class="wg__footer${b?" wg__footer--top":""}">
596
- ${ee(this,x)}
597
- ${te(this,x)}
598
- </div>`:T?ee(this,x):te(this,x)}).join("")},l=c(d,!0),g=c(d,!1),h=this.grid.shouldUseVirtualScroll();let u;if(h){const f=this.grid.displayItems,b=this.grid.virtualScrollRowHeight,v=this.grid.virtualScrollBuffer,_=(o==null?void 0:o.clientHeight)||400,C=Math.max(0,Math.floor(i/b)-v),y=Math.ceil(_/b)+v*2,k=Math.min(f.length,C+y);this.virtualScrollStart=C,this.virtualScrollEnd=k;const x={startIndex:C,endIndex:k,rowHeight:b,totalItems:f.length};u=Le(this,x)}else u=bi(this);h&&n.classList.add("wg--virtual-scroll");const p=`
592
+ `;let Ue=!1;function Xi(){if(Ue)return;const t=document.createElement("style");t.id="wg-context-menu-styles",t.textContent=Wi,document.head.appendChild(t),Ue=!0}function Qi(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,d=typeof r.icon=="function"?r.icon(e):r.icon,a=typeof r.disabled=="function"?r.disabled(e):r.disabled,c=r.danger===!0,l=["wg-context-menu__item",a?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=r.dividerBefore&&s>0?'<div class="wg-context-menu__divider"></div>':"",h=d?`<span class="wg-context-menu__icon">${d}</span>`:"";return`${g}<div class="${l}" data-item-id="${r.id}" data-disabled="${a?"true":"false"}">${h}<span class="wg-context-menu__label">${n}</span></div>`}).join("")}</div>`}function Gi(t,e,o,i,r,s,n){Xi();const d=Qi(i,r);if(!d)return null;const a=document.createElement("div");a.className="wg-context-menu-container",a.innerHTML=d,document.body.appendChild(a);const c=a.querySelector(".wg-context-menu");kt({getBoundingClientRect:()=>({width:0,height:0,x:e,y:o,top:o,left:e,right:e,bottom:o})},c,{placement:"bottom-start",middleware:[Ht(4),xt({fallbackPlacements:["top-start","bottom-end","top-end"]}),Gt({padding:8})]}).then(({x:u,y:p})=>{Object.assign(c.style,{left:`${u}px`,top:`${p}px`})}),a.addEventListener("click",u=>{const p=u.target.closest(".wg-context-menu__item");if(p&&p.dataset.disabled!=="true"){const m=p.dataset.itemId||"";s(m)}});const g=u=>{a.contains(u.target)||(Et(a,g,h),n())},h=u=>{u.key==="Escape"&&(u.preventDefault(),Et(a,g,h),n())};return setTimeout(()=>{document.addEventListener("mousedown",g),document.addEventListener("keydown",h)},0),a._cleanup={handleOutsideClick:g,handleKeyDown:h},a}function Et(t,e,o){e&&document.removeEventListener("mousedown",e),o&&document.removeEventListener("keydown",o);const i=t._cleanup;i&&(i.handleOutsideClick&&document.removeEventListener("mousedown",i.handleOutsideClick),i.handleKeyDown&&document.removeEventListener("keydown",i.handleKeyDown)),t.remove()}class ce extends HTMLElement{constructor(){super();w(this,"grid");w(this,"shadow");w(this,"styleElement");w(this,"customStyleElement",null);w(this,"updatePending",!1);w(this,"isCommittingFromKeyboard",!1);w(this,"isTransitioningCells",!1);w(this,"wheelListenerAdded",!1);w(this,"toolbarOutsideClickAdded",!1);w(this,"toolbarScrollListenerAdded",!1);w(this,"toolbarMoveInProgress",!1);w(this,"toolbarHideTimeout",null);w(this,"toolbarHovered",!1);w(this,"dropdownOpen",!1);w(this,"dropdownOptions",[]);w(this,"highlightedIndex",-1);w(this,"filterText","");w(this,"isUserFiltering",!1);w(this,"justSelected",!1);w(this,"isOpeningDropdown",!1);w(this,"searchDebounceTimer",null);w(this,"searchAbortController",null);w(this,"isSearching",!1);w(this,"tooltipElement",null);w(this,"tooltipArrowElement",null);w(this,"tooltipAnchor",null);w(this,"tooltipShowTimer",null);w(this,"tooltipHideTimer",null);w(this,"_tooltipShowDelay",400);w(this,"_tooltipHideDelay",100);w(this,"datepicker",null);w(this,"contextMenuElement",null);w(this,"virtualScrollStart",0);w(this,"virtualScrollEnd",0);w(this,"scrollListenerAdded",!1);w(this,"isLoadingMoreItems",!1);w(this,"handlePaste",o=>{var c;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,s=this.grid.columns[r],n=this.grid.displayItems[i];if(!s||!n||!this.grid.isCellEditable(s))return;o.preventDefault();let d=((c=o.clipboardData)==null?void 0:c.getData("text"))||"";if(s.beforePasteCallback){const l=s.beforePasteCallback(d,n);d=l!=null?String(l):""}const a=String(s.field);this.grid.commitEdit(i,a,d),this.render()});this.shadow=this.attachShadow({mode:"open"}),this.grid=new z,this.styleElement=document.createElement("style"),this.styleElement.textContent=ht,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate()}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(o){this._tooltipShowDelay=o}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(o){this._tooltipHideDelay=o}connectedCallback(){this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(Et(this.contextMenuElement),this.contextMenuElement=null),Ft()}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 sortable(){return this.grid.sortable}set sortable(o){this.grid.sortable=o}get filterable(){return this.grid.filterable}set filterable(o){this.grid.filterable=o}get pageable(){return this.grid.pageable}set pageable(o){this.grid.pageable=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 striped(){return this.grid.striped}set striped(o){this.grid.striped=o}get hoverable(){return this.grid.hoverable}set hoverable(o){this.grid.hoverable=o}get editable(){return this.grid.editable}set editable(o){this.grid.editable=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 dropdownShowOnFocus(){return this.grid.dropdownShowOnFocus}set dropdownShowOnFocus(o){this.grid.dropdownShowOnFocus=o}get openDropdownOnEnter(){return this.grid.openDropdownOnEnter}set openDropdownOnEnter(o){this.grid.openDropdownOnEnter=o}get checkboxAlwaysEditable(){return this.grid.checkboxAlwaysEditable}set checkboxAlwaysEditable(o){this.grid.checkboxAlwaysEditable=o}get showRowNumbers(){return this.grid.showRowNumbers}set showRowNumbers(o){this.grid.showRowNumbers=o}get invalidCells(){return this.grid.invalidCells}set invalidCells(o){this.grid.invalidCells=o}get showRowToolbar(){return this.grid.showRowToolbar}set showRowToolbar(o){this.grid.showRowToolbar=o}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(o){this.grid.rowToolbar=o}get toolbarAlign(){return this.grid.toolbarAlign}set toolbarAlign(o){this.grid.toolbarAlign=o}get toolbarTopPosition(){return this.grid.toolbarTopPosition}set toolbarTopPosition(o){this.grid.toolbarTopPosition=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 contextMenu(){return this.grid.contextMenu}set contextMenu(o){this.grid.contextMenu=o}get showRowActions(){return this.grid.showRowActions}set showRowActions(o){this.grid.showRowActions=o}get rowActions(){return this.grid.rowActions}set rowActions(o){this.grid.rowActions=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}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 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 summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(o){this.grid.summaryMetadata=o}get summaryInline(){return this.grid.summaryInline}set summaryInline(o){this.grid.summaryInline=o}get virtualScroll(){return this.grid.virtualScroll}set virtualScroll(o){this.grid.virtualScroll=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 infiniteScroll(){return this.grid.infiniteScroll}set infiniteScroll(o){this.grid.infiniteScroll=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 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)}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){Zt(this,o,i,r)}requestUpdate(){this.updatePending||(this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}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 c;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,n=this.grid.displayItems,d=this.grid.getEditableColumns(),a=d.findIndex(l=>l.index===r);if((o.ctrlKey||o.metaKey)&&o.key==="c"){const l=s[r],g=n[i];if(l&&g){let h=this.grid.getCellRawValue(g,i,String(l.field));l.beforeCopyCallback&&(h=l.beforeCopyCallback(h,g));const u=h!=null?String(h):"";navigator.clipboard.writeText(u)}return}switch(o.key){case"ArrowUp":o.preventDefault(),i>0&&E(this,i-1,r);break;case"ArrowDown":o.preventDefault(),i<n.length-1&&E(this,i+1,r);break;case"ArrowLeft":o.preventDefault(),r>0&&E(this,i,r-1);break;case"ArrowRight":o.preventDefault(),r<s.length-1&&E(this,i,r+1);break;case"Tab":if(o.preventDefault(),o.shiftKey){if(a>0){const l=d[a-1].index;E(this,i,l)}else if(i>0){const l=d[d.length-1].index;E(this,i-1,l)}}else if(a>=0&&a<d.length-1){const l=d[a+1].index;E(this,i,l)}else if(a===-1&&d.length>0)E(this,i,d[0].index);else if(i<n.length-1){const l=d[0].index;E(this,i+1,l)}break;case"Home":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const l=this.grid.focusedCell;this.grid.setFocusedCell(0,0),ut(this,0);const g=this.shadow.querySelector('td[data-row="0"][data-col="0"]');g&&(g.focus({preventScroll:!0}),W(this,l,{rowIndex:0,colIndex:0}))}else E(this,0,0);else E(this,i,0);break;case"End":if(o.preventDefault(),o.ctrlKey){const l=n.length-1,g=s.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(l,g),ut(this,l);const u=this.shadow.querySelector(`td[data-row="${l}"][data-col="${g}"]`);u&&(u.focus({preventScroll:!0}),W(this,h,{rowIndex:l,colIndex:g}))}else E(this,l,g)}else E(this,i,s.length-1);break;case"PageUp":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const l=this.grid.focusedCell;this.grid.setFocusedCell(0,r),ut(this,0);const g=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);g&&(g.focus({preventScroll:!0}),W(this,l,{rowIndex:0,colIndex:r}))}else E(this,0,r);else{const l=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(l,r),ut(this,l);const h=this.shadow.querySelector(`td[data-row="${l}"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),W(this,g,{rowIndex:l,colIndex:r}))}else E(this,l,r)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const l=n.length-1;if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(l,r),ut(this,l);const h=this.shadow.querySelector(`td[data-row="${l}"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),W(this,g,{rowIndex:l,colIndex:r}))}else E(this,l,r)}else{const l=Math.min(n.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(l,r),ut(this,l);const h=this.shadow.querySelector(`td[data-row="${l}"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),W(this,g,{rowIndex:l,colIndex:r}))}else E(this,l,r)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{o.preventDefault();const l=s[r];((l==null?void 0:l.editor)==="select"||(l==null?void 0:l.editor)==="combobox"||(l==null?void 0:l.editor)==="autocomplete")&&this.grid.getEffectiveOpenDropdownOnEnter(l)?(X(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||J(this)})):i<n.length-1&&E(this,i+1,r);break}case"F2":{o.preventDefault();const l=s[r],g=(l==null?void 0:l.editor)==="select"||(l==null?void 0:l.editor)==="combobox"||(l==null?void 0:l.editor)==="autocomplete",h=(l==null?void 0:l.editor)==="custom";X(this,i,r),g?requestAnimationFrame(()=>{this.dropdownOpen||J(this)}):h&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{o.preventDefault();const l=s[r],g=(l==null?void 0:l.editor)==="checkbox",h=(l==null?void 0:l.editor)==="select"||(l==null?void 0:l.editor)==="combobox"||(l==null?void 0:l.editor)==="autocomplete",u=(l==null?void 0:l.editor)==="date",p=(l==null?void 0:l.editor)==="custom";g?Jo(this,i,r):h?(X(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||J(this)})):u?(X(this,i,r),requestAnimationFrame(()=>{var v;const m=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),f=m==null?void 0:m.querySelector(".wg__date-input"),b=m==null?void 0:m.querySelector(".wg__editor--date");f&&b&&this.openDatePicker(f,b)})):p&&(X(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)q(this),this.grid.cancelEdit();else{const l=this.grid.focusedCell;this.grid.clearFocusedCell(),W(this,l,null),(c=o.target)==null||c.blur()}break;case"Delete":{o.preventDefault();const l=s[r],g=n[i];if(o.ctrlKey){if(g){const h={rowIndex:i,row:g};this.grid.onrowdelete&&this.grid.onrowdelete(h),this.dispatchEvent(new CustomEvent("rowdelete",{detail:h}))}}else l&&this.grid.isCellEditable(l)&&(this.grid.commitEdit(i,String(l.field),null),this.render(),requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);h==null||h.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const l=s[r];if((l==null?void 0:l.editor)==="number"&&!/[\d.\-]/.test(o.key))return;X(this,i,r,{initialSearchQuery:o.key}),o.preventDefault()}break}}handleEditorKeyDown(o,i){const r=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",n=this.grid.columns.find(l=>l.field===s),d=(n==null?void 0:n.editor)||"text",a=d==="select"||d==="combobox"||d==="autocomplete",c=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&c.includes(o.key)){o.preventDefault(),o.stopPropagation();const l=this.grid.columns.findIndex(b=>b.field===s),g=this.grid.columns.map((b,v)=>({index:v,column:b})).filter(b=>b.column.editable!==!1),h=g.findIndex(b=>b.index===l),u=this.grid.displayItems;let p=r,m=l,f=!1;switch(o.key){case"ArrowUp":r>0&&(p=r-1,f=!0);break;case"ArrowDown":r<u.length-1&&(p=r+1,f=!0);break;case"ArrowLeft":h>0&&(m=g[h-1].index,f=!0);break;case"ArrowRight":h<g.length-1&&(m=g[h+1].index,f=!0);break;case"PageUp":p=Math.max(0,r-10),f=!0;break;case"PageDown":p=Math.min(u.length-1,r+10),f=!0;break;case"Home":o.ctrlKey&&(p=0),m=0,f=!0;break;case"End":o.ctrlKey?(p=u.length-1,m=this.grid.columns.length-1):m=this.grid.columns.length-1,f=!0;break}f&&(q(this),this.grid.cancelEdit(),queueMicrotask(()=>{E(this,p,m)}));return}switch(o.key){case"ArrowDown":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const l=this.getCurrentEditorOptions();let g=this.highlightedIndex+1;for(;g<this.dropdownOptions.length&&yt(this.dropdownOptions[g],l);)g++;g<this.dropdownOptions.length&&(this.highlightedIndex=g,it(this),$e(this))}break;case"ArrowUp":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const l=this.getCurrentEditorOptions();let g=this.highlightedIndex-1;for(;g>=0&&yt(this.dropdownOptions[g],l);)g--;g>=0&&(this.highlightedIndex=g,it(this),$e(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Ee(this,this.highlightedIndex):a&&!this.dropdownOpen?J(this):(this.isCommittingFromKeyboard=!0,P(this),d==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):zt(this,i),Zt(this,r,s,"down"));break;case"Tab":if(this.datepicker)return;if(o.preventDefault(),o.stopPropagation(),this.isCommittingFromKeyboard=!0,this.dropdownOpen&&this.highlightedIndex>=0&&a){const l=this.dropdownOptions[this.highlightedIndex],g=this.getCurrentEditorOptions();if(l&&!yt(l,g)){const h=lt(l,g);this.grid.commitEdit(r,s,h)}P(this)}else P(this),d==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):a||zt(this,i);Zt(this,r,s,o.shiftKey?"prev":"next");break;case"Escape":o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&P(this),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null),this.isCommittingFromKeyboard=!0,q(this),this.grid.cancelEdit(),ti(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&J(this);break;case"Backspace":d==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),Oe(this,n.editorOptions||{})));break;default:d==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,Oe(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("focus",s=>{var d;const n=s.target;if(n.matches(".wg__cell")){const a=parseInt(n.dataset.row||"0",10),c=parseInt(n.dataset.col||"0",10);Wo(this,a,c)}if(n.matches(".wg__select-trigger, .wg__combobox-input, .wg__autocomplete-input")&&!this.justSelected&&!this.dropdownOpen){const a=n.dataset.field||"",c=this.grid.columns.find(h=>h.field===a),l=(c==null?void 0:c.editorOptions)||{};(((d=this.grid.editingCell)==null?void 0:d.initialSearchQuery)!==void 0||l.showOnFocus!==!1)&&J(this)}},!0),o.addEventListener("keydown",s=>{const n=s.target;if(n.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(s,n);return}if(n.matches(".wg__cell")){const d=parseInt(n.dataset.row||"0",10),a=parseInt(n.dataset.col||"0",10);this.handleCellKeyDown(s,d,a)}}),o.addEventListener("focusout",s=>{Xo(this,s)}),o.addEventListener("dblclick",s=>{s.preventDefault();const d=s.target.closest(".wg__cell");if(d){const a=parseInt(d.dataset.row||"0",10),c=parseInt(d.dataset.col||"0",10),l=this.grid.columns[c];if(l){const g=l.editTrigger||this.grid.editTrigger;if(g==="dblclick"||g==="navigate"){const h=Jt(s,d);X(this,a,c,{cursorPosition:h??void 0});const u=l.editor;u==="select"||u==="combobox"||u==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||J(this)}):u==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(a,c)})}}}}),o.addEventListener("click",s=>{const d=s.target.closest(".wg__cell");if(d&&!d.classList.contains("wg__cell--editing")){const a=parseInt(d.dataset.row||"0",10),c=parseInt(d.dataset.col||"0",10),l=this.grid.columns[c];if(l&&(l.editTrigger||this.grid.editTrigger)==="click"){s.preventDefault();const h=Jt(s,d);X(this,a,c,{cursorPosition:h??void 0});const u=l.editor;u==="select"||u==="combobox"||u==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||J(this)}):u==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(a,c)})}}}),o.addEventListener("mousedown",s=>{const n=s.target;if(n.closest(".wg__date-trigger")){s.preventDefault(),s.stopPropagation();const a=n.closest(".wg__cell-date-display"),c=n.closest(".wg__editor--date");if(c){const l=c.querySelector(".wg__date-input");l&&this.openDatePicker(l,c)}else if(a){const l=parseInt(a.dataset.row||"0",10),g=a.dataset.field||"",h=this.grid.columns.findIndex(u=>String(u.field)===g);h>=0&&(this.isTransitioningCells=!0,this.grid.editingCell&&(P(this),q(this),this.grid.cancelEdit()),X(this,l,h),requestAnimationFrame(()=>{var f;this.isTransitioningCells=!1;const u=(f=this.shadowRoot)==null?void 0:f.querySelector(`.wg__cell[data-row="${l}"][data-field="${g}"]`),p=u==null?void 0:u.querySelector(".wg__date-input"),m=u==null?void 0:u.querySelector(".wg__editor--date");p&&m&&this.openDatePicker(p,m)}))}return}if(this.dropdownOpen||this.grid.editingCell){const a=n.closest(".wg__cell");if(a&&!n.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const c=parseInt(a.dataset.row||"0",10),l=parseInt(a.dataset.col||"0",10),g=this.grid.editingCell,h=n.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(g&&!h){const u=this.grid.columns.findIndex(p=>String(p.field)===g.field);if(c!==g.rowIndex||l!==u){s.preventDefault(),this.isTransitioningCells=!0,P(this),q(this),this.grid.cancelEdit();const p=this.grid.columns[l],m=(p==null?void 0:p.editTrigger)||this.grid.editTrigger,b=s.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,m==="click"&&p&&this.grid.isCellEditable(p)){const v=this.shadow.querySelector(`td[data-row="${c}"][data-col="${l}"]`),_=v?Jt({clientX:b},v):void 0;X(this,c,l,{cursorPosition:_??void 0})}else E(this,c,l)});return}}}}if(n.matches(".wg__combobox-toggle, .wg__select-toggle")){s.preventDefault(),s.stopPropagation();const a=n.closest(".wg__cell-dropdown-display");if(n.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete"))Ae(this);else if(a){const l=parseInt(a.dataset.row||"0",10),g=a.dataset.field||"",h=this.grid.columns.findIndex(u=>String(u.field)===g);h>=0&&(this.isTransitioningCells=!0,this.grid.editingCell&&(P(this),q(this),this.grid.cancelEdit()),X(this,l,h),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||J(this)}))}}if(n.matches(".wg__cell-dropdown-display")){s.preventDefault(),s.stopPropagation();const a=n.closest(".wg__cell-dropdown-display");if(a){const c=parseInt(a.dataset.row||"0",10),l=a.dataset.field||"",g=this.grid.columns.findIndex(h=>String(h.field)===l);g>=0&&(this.isTransitioningCells=!0,this.grid.editingCell&&(P(this),q(this),this.grid.cancelEdit()),X(this,c,g),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||J(this)}))}}}),o.addEventListener("click",s=>{s.target.matches(".wg__select-trigger, .wg__select-value")&&(s.preventDefault(),s.stopPropagation(),Ae(this))}),o.addEventListener("click",s=>{const n=s,a=n.target.closest(".wg__header--sortable");if(a){const c=a.dataset.field;if(!c)return;const l=[...this.grid.sort],g=l.findIndex(u=>u.column===c);(n.ctrlKey||n.metaKey)&&this.grid.sortMode==="multi"?g>=0?l[g].direction==="asc"?l[g]={column:c,direction:"desc"}:l.splice(g,1):l.push({column:c,direction:"asc"}):g>=0&&l.length===1?l[0].direction==="asc"?l[0]={column:c,direction:"desc"}:l.length=0:(l.length=0,l.push({column:c,direction:"asc"})),this.grid.sort=l,this.grid.pageable&&(this.grid.currentPage=1),this.grid.fireDataRequest("sort"),this.render()}}),o.addEventListener("contextmenu",s=>{this.handleContextMenu(s)}),o.addEventListener("change",s=>{const n=s.target;n.matches(".wg__editor--checkbox")&&Go(this,n)}),o.addEventListener("input",s=>{const n=s.target;n.matches(".wg__combobox-input")?qo(this,s):n.matches(".wg__autocomplete-input")&&Yo(this,s)}),o.addEventListener("blur",s=>{const n=s.target;if(n.matches(".wg__editor--text, .wg__editor--number")&&Zo(this,n),n.matches(".wg__date-input")&&!this.datepicker&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&this.commitDateEditor(n),n.matches(".wg__select-trigger")&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&!this.dropdownOpen&&!this.isOpeningDropdown&&(P(this),q(this),this.grid.cancelEdit()),n.matches(".wg__combobox-input, .wg__autocomplete-input")){if(this.isCommittingFromKeyboard||this.isTransitioningCells)return;if(P(this),this.grid.editingCell){const d=n,a=this.getCurrentEditingColumn();if(a){const c=a.editorOptions||{},g=(c.options||c.initialOptions||[]).find(h=>_t(h,c).toLowerCase()===d.value.toLowerCase());g?this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,lt(g,c)):this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,d.value)}}}},!0);const i=this.shadow.querySelector(".wg");i&&i.addEventListener("scroll",()=>{this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&(P(this),q(this),this.grid.cancelEdit()),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(i),this.grid.infiniteScroll&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(i),Dt()!==null&&(Le(this,this.grid.displayItems),this.renderConnector())}),this.wheelListenerAdded||(this.wheelListenerAdded=!0,window.addEventListener("scroll",()=>{this.dropdownOpen&&!this.isTransitioningCells&&(P(this),q(this),this.grid.cancelEdit())},{passive:!0,capture:!0})),o.addEventListener("mouseenter",s=>{const n=s.target,d=n.closest("[data-tooltip-html]");if(d){const c=d.getAttribute("data-tooltip-html");Re(this,d,c,this._tooltipShowDelay,!0);return}const a=n.closest("[data-tooltip]");if(a){const c=a.getAttribute("data-tooltip");Re(this,a,c,this._tooltipShowDelay,!1)}},!0),o.addEventListener("mouseleave",s=>{const n=s,d=n.target,a=n.relatedTarget,c=d.closest("[data-tooltip], [data-tooltip-html]");c&&(a==null?void 0:a.closest("[data-tooltip], [data-tooltip-html]"))===c||c&&Uo(this,this._tooltipHideDelay)},!0),o.addEventListener("click",s=>{const d=s.target.closest(".wg__toolbar-trigger");if(d&&this.grid.toolbarTrigger==="button"){s.preventDefault(),s.stopPropagation();const a=parseInt(d.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${a}"]`);c&&(ee(a)?(this.closeToolbarAndReset(),this.render()):this.showToolbarForRow(c,a))}}),o.addEventListener("mouseenter",s=>{if(this.grid.toolbarTrigger!=="hover")return;this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null);const n=s,a=n.target.closest(".wg__row");if(a){const c=parseInt(a.dataset.rowIndex||"0",10);ee(c)||this.showToolbarForRow(a,c,n.clientX)}},!0),o.addEventListener("mouseleave",s=>{if(this.grid.toolbarTrigger!=="hover")return;if(s.target.closest(".wg__row")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const c=this.shadow.querySelector(".wg__toolbar-container"),l=c==null?void 0:c.matches(":hover"),g=o.matches(":hover");!l&&!g&&(this.closeToolbarAndReset(),this.grid.editingCell||this.render())},150)}},!0),o.addEventListener("click",s=>{if(this.grid.toolbarTrigger!=="click")return;const n=s,d=n.target,a=d.closest(".wg__row");if(a&&!d.closest(".wg__cell--editing")){const c=parseInt(a.dataset.rowIndex||"0",10);ee(c)?(this.closeToolbarAndReset(),this.render()):this.showToolbarForRow(a,c,n.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",s=>{if(!fi(this.shadow))return;const n=s.composedPath(),d=n.some(l=>{var g;return(g=l.classList)==null?void 0:g.contains("wg__toolbar-container")}),a=n.some(l=>{var g;return(g=l.classList)==null?void 0:g.contains("wg__toolbar-trigger")});d||a||n.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Dt()!==null&&(this.closeToolbarAndReset(),this.render())})),this.toolbarScrollListenerAdded||(this.toolbarScrollListenerAdded=!0,window.addEventListener("scroll",()=>{Dt()!==null&&(this.closeToolbarAndReset(),this.render())},!0)),this.shadow.querySelectorAll(".wg__pagination").forEach(s=>{s.addEventListener("click",d=>{const c=d.target.closest(".wg__pagination-btn");if(!c||c.hasAttribute("disabled"))return;const l=c.dataset.action;let g=!1;l==="first"&&this.grid.currentPage!==1?(this.grid.currentPage=1,g=!0):l==="prev"&&this.grid.currentPage>1?(this.grid.currentPage--,g=!0):l==="next"&&this.grid.currentPage<this.grid.totalPages?(this.grid.currentPage++,g=!0):l==="last"&&this.grid.currentPage!==this.grid.totalPages&&(this.grid.currentPage=this.grid.totalPages,g=!0),g&&(this.grid.fireDataRequest("page"),this.render())});const n=s.querySelector(".wg__pagination-select");n&&n.addEventListener("change",()=>{const d=parseInt(n.value,10);d!==this.grid.pageSize&&(this.grid.pageSize=d,this.grid.currentPage=1,this.grid.fireDataRequest("pageSize"),this.render())})})}handleVirtualScroll(o){const i=this.grid.displayItems,r=this.grid.virtualScrollRowHeight,s=this.grid.virtualScrollBuffer,n=o.scrollTop,d=o.clientHeight;let a=Math.max(0,Math.floor(n/r)-s);const c=Math.ceil(d/r)+s*2;let l=Math.min(i.length,a+c);const g=this.grid.editingCell;if(g){const h=g.rowIndex;h<a&&(a=h),h>=l&&(l=h+1)}(a!==this.virtualScrollStart||l!==this.virtualScrollEnd)&&(this.virtualScrollStart=a,this.virtualScrollEnd=l,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=ze(this,s),n){this.grid.setFocusedCell(n.rowIndex,n.colIndex);const d=i.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);d&&(d.focus({preventScroll:!0}),W(this,null,n))}}handleInfiniteScroll(o){const i=o.scrollTop,r=o.scrollHeight,s=o.clientHeight,n=this.grid.infiniteScrollThreshold;r-(i+s)<=n&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}render(){var m;const o=this.shadow.querySelector(".wg"),i=(o==null?void 0:o.scrollTop)||0,r=(o==null?void 0:o.scrollLeft)||0,s=this.grid.focusedCell;o&&o.remove();const n=document.createElement("div");n.className=mi(this);const d=this.grid.paginationPosition.split("|").map(f=>f.trim()),a=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(f=>f.trim()):[],c=(f,b)=>{const v=d.filter(x=>b?x.startsWith("top-"):x.startsWith("bottom-")),_=a.filter(x=>b?x.startsWith("top-"):x.startsWith("bottom-")),S=v.length>0,y=_.length>0;return!S&&!y?"":y&&S&&this.grid.summaryInline?`<div class="wg__footer${b?" wg__footer--top":""}">
593
+ ${ie(this,_[0])}
594
+ ${oe(this,v[0])}
595
+ </div>`:[...new Set([...v,..._])].map(x=>{const C=v.includes(x),T=_.includes(x);return T&&C?`<div class="wg__footer${b?" wg__footer--top":""}">
596
+ ${ie(this,x)}
597
+ ${oe(this,x)}
598
+ </div>`:T?ie(this,x):oe(this,x)}).join("")},l=c(d,!0),g=c(d,!1),h=this.grid.shouldUseVirtualScroll();let u;if(h){const f=this.grid.displayItems,b=this.grid.virtualScrollRowHeight,v=this.grid.virtualScrollBuffer,_=(o==null?void 0:o.clientHeight)||400,S=Math.max(0,Math.floor(i/b)-v),y=Math.ceil(_/b)+v*2,D=Math.min(f.length,S+y);this.virtualScrollStart=S,this.virtualScrollEnd=D;const x={startIndex:S,endIndex:D,rowHeight:b,totalItems:f.length};u=ze(this,x)}else u=vi(this);h&&n.classList.add("wg--virtual-scroll");const p=`
599
599
  ${l}
600
600
  <table class="wg__table">
601
601
  <thead>
602
- ${mi(this)}
602
+ ${bi(this)}
603
603
  </thead>
604
604
  <tbody>
605
605
  ${u}
606
606
  </tbody>
607
607
  </table>
608
608
  ${g}
609
- `;if(n.innerHTML=p,this.shadow.appendChild(n),h){const f=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-n.clientHeight);n.scrollTop=Math.min(i,f)}else n.scrollTop=i;if(n.scrollLeft=r,this.attachEventListeners(),this.grid.editingCell){let f=this.shadow.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(f||(f=this.shadow.querySelector(".wg__editor")),f&&(f.focus(),f instanceof HTMLInputElement&&f.type==="text")){const b=this.grid.editingCell.cursorPosition,v=this.getCurrentEditingColumn(),_=((m=v==null?void 0:v.editorOptions)==null?void 0:m.editStartSelection)||"selectAll";if(b!==void 0){const C=Math.min(b,f.value.length);f.setSelectionRange(C,C)}else if(this.grid.editingCell.initialSearchQuery!==void 0){const C=f.value.length;f.setSelectionRange(C,C)}else switch(_){case"cursorAtStart":f.setSelectionRange(0,0);break;case"cursorAtEnd":f.setSelectionRange(f.value.length,f.value.length);break;case"selectAll":default:f.select();break}}}else if(s&&!this.grid.editingCell){const f=n.querySelector(`td[data-row="${s.rowIndex}"][data-col="${s.colIndex}"]`);f&&setTimeout(()=>f.focus(),0)}h&&requestAnimationFrame(()=>{n.style.pointerEvents="none",requestAnimationFrame(()=>{n.style.pointerEvents=""})}),this.renderConnector()}renderConnector(){const o=this.shadow.querySelector(".wg__connector");o&&o.remove();const i=pi();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"),d=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",d),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)}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,d=o.dataset.dateValue||"";this.datepicker=new ae({dateFormat:r,minDate:s||void 0,maxDate:n||void 0,onSelect:(a,c)=>{this.handleDatePickerSelect(o,a,c)},onClose:()=>{this.datepicker=null,z(this),this.grid.cancelEdit()}}),this.datepicker.open(i,d||null)}handleDatePickerSelect(o,i,r){const s=o.dataset.dateFormat||"YYYY-MM-DD",n=oe(s);o.value=He(i,n),o.dataset.dateValue=ie(i),this.isCommittingFromKeyboard=!0,this.commitDateEditor(o);const d=parseInt(o.dataset.row||"0",10),a=o.dataset.field||"";this.moveFocusAfterCommit(d,a,r||"down")}commitDateEditor(o){if(!this.grid.editingCell)return;const i=parseInt(o.dataset.row||"0",10),r=o.dataset.field||"",s=o.dataset.outputFormat||"iso",n=o.dataset.dateFormat||"YYYY-MM-DD",d=oe(n),a=o.value?this.parseDateInput(o.value,d):null;let c=null;if(a)switch(s){case"date":c=a;break;case"timestamp":c=a.getTime();break;case"iso":default:c=ie(a);break}this.grid.commitEdit(i,r,c)}parseDateInput(o,i){if(!o)return null;const r=o.split(i.separator);let s=null,n=null,d=null;if(r.forEach((c,l)=>{var h,u,p;if(!c)return;const g=parseInt(c,10);((h=i.parts.year)==null?void 0:h.index)===l?s=g<100?g+2e3:g:((u=i.parts.month)==null?void 0:u.index)===l?n=g:((p=i.parts.day)==null?void 0:p.index)===l&&(d=g)}),s===null||n===null||d===null)return null;const a=new Date(s,n-1,d);return a.getMonth()!==n-1||a.getDate()!==d?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=`
609
+ `;if(n.innerHTML=p,this.shadow.appendChild(n),h){const f=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-n.clientHeight);n.scrollTop=Math.min(i,f)}else n.scrollTop=i;if(n.scrollLeft=r,this.attachEventListeners(),this.grid.editingCell){let f=this.shadow.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(f||(f=this.shadow.querySelector(".wg__editor")),f&&(f.focus(),f instanceof HTMLInputElement&&f.type==="text")){const b=this.grid.editingCell.cursorPosition,v=this.getCurrentEditingColumn(),_=((m=v==null?void 0:v.editorOptions)==null?void 0:m.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const S=f.value.length;f.setSelectionRange(S,S)}else switch(_){case"mousePosition":if(b!==void 0){const S=Math.min(b,f.value.length);f.setSelectionRange(S,S)}else f.setSelectionRange(f.value.length,f.value.length);break;case"cursorAtStart":f.setSelectionRange(0,0);break;case"cursorAtEnd":f.setSelectionRange(f.value.length,f.value.length);break;case"selectAll":default:f.select();break}}}else if(s&&!this.grid.editingCell){const f=n.querySelector(`td[data-row="${s.rowIndex}"][data-col="${s.colIndex}"]`);f&&setTimeout(()=>f.focus(),0)}h&&requestAnimationFrame(()=>{n.style.pointerEvents="none",requestAnimationFrame(()=>{n.style.pointerEvents=""})}),this.renderConnector()}renderConnector(){const o=this.shadow.querySelector(".wg__connector");o&&o.remove();const i=wi();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"),d=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",d),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)}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,d=o.dataset.dateValue||"";this.datepicker=new de({dateFormat:r,minDate:s||void 0,maxDate:n||void 0,onSelect:(a,c)=>{this.handleDatePickerSelect(o,a,c)},onClose:()=>{this.datepicker=null,q(this),this.grid.cancelEdit()}}),this.datepicker.open(i,d||null)}handleDatePickerSelect(o,i,r){const s=o.dataset.dateFormat||"YYYY-MM-DD",n=re(s);o.value=Ve(i,n),o.dataset.dateValue=ne(i),this.isCommittingFromKeyboard=!0,this.commitDateEditor(o);const d=parseInt(o.dataset.row||"0",10),a=o.dataset.field||"";this.moveFocusAfterCommit(d,a,r||"down")}commitDateEditor(o){if(!this.grid.editingCell)return;const i=parseInt(o.dataset.row||"0",10),r=o.dataset.field||"",s=o.dataset.outputFormat||"iso",n=o.dataset.dateFormat||"YYYY-MM-DD",d=re(n),a=o.value?this.parseDateInput(o.value,d):null;let c=null;if(a)switch(s){case"date":c=a;break;case"timestamp":c=a.getTime();break;case"iso":default:c=ne(a);break}this.grid.commitEdit(i,r,c)}parseDateInput(o,i){if(!o)return null;const r=o.split(i.separator);let s=null,n=null,d=null;if(r.forEach((c,l)=>{var h,u,p;if(!c)return;const g=parseInt(c,10);((h=i.parts.year)==null?void 0:h.index)===l?s=g<100?g+2e3:g:((u=i.parts.month)==null?void 0:u.index)===l?n=g:((p=i.parts.day)==null?void 0:p.index)===l&&(d=g)}),s===null||n===null||d===null)return null;const a=new Date(s,n-1,d);return a.getMonth()!==n-1||a.getDate()!==d?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=`
610
610
  <div class="wg__goto-dialog">
611
611
  <label class="wg__goto-label">Go to row (1-${i.length}):</label>
612
612
  <input type="number" class="wg__goto-input" min="1" max="${i.length}" value="1" />
@@ -615,4 +615,4 @@
615
615
  <button type="button" class="wg__goto-btn wg__goto-btn--go">Go</button>
616
616
  </div>
617
617
  </div>
618
- `;const s=r.querySelector(".wg__goto-input"),n=r.querySelector(".wg__goto-btn--go"),d=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},c=()=>{const l=parseInt(s.value,10);if(isNaN(l)||l<1||l>i.length){s.focus(),s.select();return}a();const g=l-1,h=this.grid.focusedCell;if(this.grid.setFocusedCell(g,o),this.grid.shouldUseVirtualScroll())gt(this,g),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=this.shadow.querySelector(`td[data-row="${g}"][data-col="${o}"]`);u==null||u.focus()})});else{const u=this.shadow.querySelector(`td[data-row="${g}"][data-col="${o}"]`);u&&(u.scrollIntoView({block:"nearest",behavior:"auto"}),u.focus(),N(this,h,{rowIndex:g,colIndex:o}))}};n.addEventListener("click",c),d.addEventListener("click",a),r.addEventListener("click",l=>{l.target===r&&a()}),s.addEventListener("keydown",l=>{l.key==="Enter"?(l.preventDefault(),c()):l.key==="Escape"&&(l.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:c=>{this.grid.commitEdit(o,s,c),z(this),requestAnimationFrame(()=>{E(this,o,i)})},cancel:()=>{z(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{E(this,o,i)})}};r.cellEditCallback(a)}handleContextMenu(o){const i=this.grid.contextMenu;if(!i||i.length===0)return;const s=o.target.closest(".wg__cell");if(!s)return;o.preventDefault(),this.contextMenuElement&&(xt(this.contextMenuElement),this.contextMenuElement=null);const n=parseInt(s.dataset.row||"0",10),d=parseInt(s.dataset.col||"0",10),a=this.grid.columns[d];if(!a)return;const c=this.grid.displayItems[n];if(!c)return;const l=String(a.field),g=this.grid.getCellRawValue(c,n,l),h={row:c,rowIndex:n,colIndex:d,column:a,cellValue:g};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(h),this.contextMenuElement=Qi(this,o.clientX,o.clientY,i,h,u=>{const p=i.find(m=>m.id===u);p!=null&&p.onclick&&p.onclick(h),this.contextMenuElement&&(xt(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}showToolbarForRow(o,i,r){if(!this.grid.showRowToolbar||!this.grid.rowToolbar.length)return;const s=di(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),ui(this,o,i,s,n,a=>{this.handleToolbarItemClick(a,i,n)},r),this.renderConnector(),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 c=this.shadow.querySelector(".wg__table"),l=c==null?void 0:c.matches(":hover"),g=a.matches(":hover");!l&&!g&&(this.closeToolbarAndReset(),this.render())},150))}))}const d=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);d&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),d.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),zt()}handleToolbarItemClick(o,i,r){const s=this.grid.displayItems.findIndex(d=>d===r);if(s===-1){this.closeToolbarAndReset(),this.render();return}const n=o.id==="moveUp"||o.id==="moveDown";if(n&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:r,rowIndex:s}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:s,row:r}),o.id==="delete"){this.closeToolbarAndReset(),this.render();return}n?(this.render(),fi(this,this.grid.displayItems),this.renderConnector()):this.render()}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",le),I.GridElement=le,I.WebGrid=L,I.default=le,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
618
+ `;const s=r.querySelector(".wg__goto-input"),n=r.querySelector(".wg__goto-btn--go"),d=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},c=()=>{const l=parseInt(s.value,10);if(isNaN(l)||l<1||l>i.length){s.focus(),s.select();return}a();const g=l-1,h=this.grid.focusedCell;if(this.grid.setFocusedCell(g,o),this.grid.shouldUseVirtualScroll())ut(this,g),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=this.shadow.querySelector(`td[data-row="${g}"][data-col="${o}"]`);u==null||u.focus()})});else{const u=this.shadow.querySelector(`td[data-row="${g}"][data-col="${o}"]`);u&&(u.scrollIntoView({block:"nearest",behavior:"auto"}),u.focus(),W(this,h,{rowIndex:g,colIndex:o}))}};n.addEventListener("click",c),d.addEventListener("click",a),r.addEventListener("click",l=>{l.target===r&&a()}),s.addEventListener("keydown",l=>{l.key==="Enter"?(l.preventDefault(),c()):l.key==="Escape"&&(l.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:c=>{this.grid.commitEdit(o,s,c),q(this),requestAnimationFrame(()=>{E(this,o,i)})},cancel:()=>{q(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{E(this,o,i)})}};r.cellEditCallback(a)}handleContextMenu(o){const i=this.grid.contextMenu;if(!i||i.length===0)return;const s=o.target.closest(".wg__cell");if(!s)return;o.preventDefault(),this.contextMenuElement&&(Et(this.contextMenuElement),this.contextMenuElement=null);const n=parseInt(s.dataset.row||"0",10),d=parseInt(s.dataset.col||"0",10),a=this.grid.columns[d];if(!a)return;const c=this.grid.displayItems[n];if(!c)return;const l=String(a.field),g=this.grid.getCellRawValue(c,n,l),h={row:c,rowIndex:n,colIndex:d,column:a,cellValue:g};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(h),this.contextMenuElement=Gi(this,o.clientX,o.clientY,i,h,u=>{const p=i.find(m=>m.id===u);p!=null&&p.onclick&&p.onclick(h),this.contextMenuElement&&(Et(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}showToolbarForRow(o,i,r){if(!this.grid.showRowToolbar||!this.grid.rowToolbar.length)return;const s=gi(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),pi(this,o,i,s,n,a=>{this.handleToolbarItemClick(a,i,n)},r),this.renderConnector(),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 c=this.shadow.querySelector(".wg__table"),l=c==null?void 0:c.matches(":hover"),g=a.matches(":hover");!l&&!g&&(this.closeToolbarAndReset(),this.render())},150))}))}const d=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);d&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),d.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),Ft()}handleToolbarItemClick(o,i,r){const s=this.grid.displayItems.findIndex(d=>d===r);if(s===-1){this.closeToolbarAndReset(),this.render();return}const n=o.id==="moveUp"||o.id==="moveDown";if(n&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:r,rowIndex:s}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:s,row:r}),o.id==="delete"){this.closeToolbarAndReset(),this.render();return}n?(this.render(),Le(this,this.grid.displayItems),this.renderConnector()):this.render()}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",ce),H.GridElement=ce,H.WebGrid=z,H.default=ce,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});