@timlassiter11/yatl 1.0.19 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,384 +1,15 @@
1
- "use strict";var yatl=(()=>{var Lt=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var qr=Object.getOwnPropertyNames;var Kr=Object.prototype.hasOwnProperty;var xe=(s,t)=>()=>(s&&(t=s(s=0)),t);var je=(s,t)=>{for(var e in t)Lt(s,e,{get:t[e],enumerable:!0})},Wr=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qr(t))!Kr.call(s,i)&&i!==e&&Lt(s,i,{get:()=>t[i],enumerable:!(r=Ue(t,i))||r.enumerable});return s};var Qr=s=>Wr(Lt({},"__esModule",{value:!0}),s),u=(s,t,e,r)=>{for(var i=r>1?void 0:r?Ue(t,e):t,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(t,e,i):n(i))||i);return r&&i&&Lt(t,e,i),i};var Nt,Tr=xe(()=>{"use strict";Nt=class{constructor(t){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,t?.roundAverageSize===!0&&(this._roundAverageSize=!0)}set(t,e){let r=this._map.get(t)||0;this._map.set(t,e),this.totalSize+=e-r}get averageSize(){if(this._map.size>0){let t=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(t):t}return 0}getSize(t){return this._map.get(t)}clear(){this._map.clear(),this.totalSize=0}}});function Oe(s){return s==="horizontal"?"width":"height"}var be,Rr=xe(()=>{"use strict";be=class{_getDefaultConfig(){return{direction:"vertical"}}constructor(t,e){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then(()=>this.config=e||this._getDefaultConfig())}set config(t){Object.assign(this,Object.assign({},this._getDefaultConfig(),t))}get config(){return{direction:this.direction}}get items(){return this._items}set items(t){this._setItems(t)}_setItems(t){t!==this._items&&(this._items=t,this._scheduleReflow())}get direction(){return this._direction}set direction(t){t=t==="horizontal"?t:"vertical",t!==this._direction&&(this._direction=t,this._sizeDim=t==="horizontal"?"width":"height",this._secondarySizeDim=t==="horizontal"?"height":"width",this._positionDim=t==="horizontal"?"left":"top",this._secondaryPositionDim=t==="horizontal"?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(t){let{_viewDim1:e,_viewDim2:r}=this;Object.assign(this._viewportSize,t),r!==this._viewDim2?this._scheduleLayoutUpdate():e!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(t){Object.assign(this._latestCoords,t);let e=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(e-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(t=!1){(t||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(t){this._pin=t,this._triggerReflow()}get pin(){if(this._pin!==null){let{index:t,block:e}=this._pin;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null}_clampScrollPosition(t){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(t,this.totalScrollSize[Oe(this.direction)]-this._viewDim1))}unpin(){this._pin!==null&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then(()=>this.reflowIfNeeded())}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(this.pin!==null){let t=this._scrollPosition,{index:e,block:r}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:r||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=t-this._scrollPosition}}_calculateScrollIntoViewPosition(t){let{block:e}=t,r=Math.min(this.items.length,Math.max(0,t.index)),i=this._getItemPosition(r)[this._positionDim],o=i;if(e!=="start"){let n=this._getItemSize(r)[this._sizeDim];if(e==="center")o=i-.5*this._viewDim1+.5*n;else{let l=i-this._viewDim1+n;if(e==="end")o=l;else{let a=this._scrollPosition;o=Math.abs(a-i)<Math.abs(a-l)?i:l}}}return o+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(o)}getScrollIntoViewCoordinates(t){return{[this._positionDim]:this._calculateScrollIntoViewPosition(t)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){let t=new Map;if(this._first!==-1&&this._last!==-1)for(let r=this._first;r<=this._last;r++)t.set(r,this._getItemPosition(r));let e={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:t};this._scrollError&&(e.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(e)}get _num(){return this._first===-1||this._last===-1?0:this._last-this._first+1}_checkThresholds(){if(this._viewDim1===0&&this._num>0||this._pin!==null)this._scheduleReflow();else{let t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>t||this._physicalMax<e?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(t){if(this._first===-1||this._last===-1)return;let e=this._first;for(;e<this._last&&Math.round(this._getItemPosition(e)[this._positionDim]+this._getItemSize(e)[this._sizeDim])<=Math.round(this._scrollPosition);)e++;let r=this._last;for(;r>this._first&&Math.round(this._getItemPosition(r)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)r--;(e!==this._firstVisible||r!==this._lastVisible)&&(this._firstVisible=e,this._lastVisible=r,t&&t.emit&&this._sendVisibilityChangedMessage())}}});var $r={};je($r,{FlowLayout:()=>ye,flow:()=>mi});function Mr(s){return s==="horizontal"?"marginLeft":"marginTop"}function gi(s){return s==="horizontal"?"marginRight":"marginBottom"}function _i(s){return s==="horizontal"?"xOffset":"yOffset"}function bi(s,t){let e=[s,t].sort();return e[1]<=0?Math.min(...e):e[0]>=0?Math.max(...e):e[0]+e[1]}var mi,Ne,ye,Ar=xe(()=>{"use strict";Tr();Rr();mi=s=>Object.assign({type:ye},s);Ne=class{constructor(){this._childSizeCache=new Nt,this._marginSizeCache=new Nt,this._metricsCache=new Map}update(t,e){let r=new Set;Object.keys(t).forEach(i=>{let o=Number(i);this._metricsCache.set(o,t[o]),this._childSizeCache.set(o,t[o][Oe(e)]),r.add(o),r.add(o+1)});for(let i of r){let o=this._metricsCache.get(i)?.[Mr(e)]||0,n=this._metricsCache.get(i-1)?.[gi(e)]||0;this._marginSizeCache.set(i,bi(o,n))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(t,e){return this._metricsCache.get(t)?.[Mr(e)]||0}getChildSize(t){return this._childSizeCache.getSize(t)}getMarginSize(t){return this._marginSizeCache.getSize(t)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}},ye=class extends be{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new Ne,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(t){this._metricsCache.update(t,this.direction),this._scheduleReflow()}_getPhysicalItem(t){return this._newPhysicalItems.get(t)??this._physicalItems.get(t)}_getSize(t){return this._getPhysicalItem(t)&&this._metricsCache.getChildSize(t)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(t){let e=this._metricsCache;if(this._first===-1||this._last===-1)return e.averageMarginSize+t*(e.averageMarginSize+this._getAverageSize());if(t<this._first){let r=this._first-t;return this._getPhysicalItem(this._first).pos-(e.getMarginSize(this._first-1)||e.averageMarginSize)-(r*e.averageChildSize+(r-1)*e.averageMarginSize)}else{let r=t-this._last;return this._getPhysicalItem(this._last).pos+(e.getChildSize(this._last)||e.averageChildSize)+(e.getMarginSize(this._last)||e.averageMarginSize)+r*(e.averageChildSize+e.averageMarginSize)}}_getPosition(t){let e=this._getPhysicalItem(t),{averageMarginSize:r}=this._metricsCache;return t===0?this._metricsCache.getMarginSize(0)??r:e?e.pos:this._estimatePosition(t)}_calculateAnchor(t,e){return t<=0?0:e>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((t+e)/2/this._delta)))}_getAnchor(t,e){if(this._physicalItems.size===0)return this._calculateAnchor(t,e);if(this._first<0)return this._calculateAnchor(t,e);if(this._last<0)return this._calculateAnchor(t,e);let r=this._getPhysicalItem(this._first),i=this._getPhysicalItem(this._last),o=r.pos;if(i.pos+this._metricsCache.getChildSize(this._last)<t)return this._calculateAnchor(t,e);if(o>e)return this._calculateAnchor(t,e);let a=this._firstVisible-1,c=-1/0;for(;c<t;)c=this._getPhysicalItem(++a).pos+this._metricsCache.getChildSize(a);return a}_getActiveItems(){this._viewDim1===0||this.items.length===0?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;let t=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t,this._stable=!0}_getItems(){let t=this._newPhysicalItems;this._stable=!0;let e,r;if(this.pin!==null){let{index:c}=this.pin;this._anchorIdx=c,this._anchorPos=this._getPosition(c)}if(e=this._scrollPosition-this._overhang,r=this._scrollPosition+this._viewDim1+this._overhang,r<0||e>this._scrollSize){this._clearItems();return}(this._anchorIdx===null||this._anchorPos===null)&&(this._anchorIdx=this._getAnchor(e,r),this._anchorPos=this._getPosition(this._anchorIdx));let i=this._getSize(this._anchorIdx);i===void 0&&(this._stable=!1,i=this._getAverageSize());let o=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,n=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;this._anchorIdx===0&&(this._anchorPos=o),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-n-i);let l=0;for(this._anchorPos+i+n<e&&(l=e-(this._anchorPos+i+n)),this._anchorPos-o>r&&(l=r-(this._anchorPos-o)),l&&(this._scrollPosition-=l,e-=l,r-=l,this._scrollError+=l),t.set(this._anchorIdx,{pos:this._anchorPos,size:i}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-o,this._physicalMax=this._anchorPos+i+n;this._physicalMin>e&&this._first>0;){let c=this._getSize(--this._first);c===void 0&&(this._stable=!1,c=this._getAverageSize());let h=this._metricsCache.getMarginSize(this._first);h===void 0&&(this._stable=!1,h=this._metricsCache.averageMarginSize),this._physicalMin-=c;let d=this._physicalMin;if(t.set(this._first,{pos:d,size:c}),this._physicalMin-=h,this._stable===!1&&this._estimate===!1)break}for(;this._physicalMax<r&&this._last<this.items.length-1;){let c=this._getSize(++this._last);c===void 0&&(this._stable=!1,c=this._getAverageSize());let h=this._metricsCache.getMarginSize(this._last);h===void 0&&(this._stable=!1,h=this._metricsCache.averageMarginSize);let d=this._physicalMax;if(t.set(this._last,{pos:d,size:c}),this._physicalMax+=c+h,!this._stable&&!this._estimate)break}let a=this._calculateError();a&&(this._physicalMin-=a,this._physicalMax-=a,this._anchorPos-=a,this._scrollPosition-=a,t.forEach(c=>c.pos-=a),this._scrollError+=a),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t)}_calculateError(){return this._first===0?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){let{_first:t,_last:e}=this;super._reflow(),(this._first===-1&&this._last==-1||this._first===t&&this._last===e)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){let{averageMarginSize:t}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(t+this._getAverageSize())+t)}get _delta(){let{averageMarginSize:t}=this._metricsCache;return this._getAverageSize()+t}_getItemPosition(t){return{[this._positionDim]:this._getPosition(t),[this._secondaryPositionDim]:0,[_i(this.direction)]:-(this._metricsCache.getLeadingMarginValue(t,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(t){return{[this._sizeDim]:this._getSize(t)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}});var Ci={};je(Ci,{YatlButton:()=>$,YatlButtonGroup:()=>Z,YatlColumnReorderEvent:()=>Et,YatlColumnReorderRequestEvent:()=>xt,YatlColumnResizeEvent:()=>St,YatlColumnSortEvent:()=>vt,YatlColumnSortRequestEvent:()=>yt,YatlColumnToggleEvent:()=>wt,YatlColumnToggleRequestEvent:()=>ke,YatlDropdown:()=>A,YatlDropdownItem:()=>j,YatlDropdownToggleEvent:()=>Mt,YatlEvent:()=>w,YatlRowClickEvent:()=>gt,YatlRowSelectEvent:()=>bt,YatlRowSelectRequestEvent:()=>_t,YatlTable:()=>m,YatlTableController:()=>Dt,YatlTableSearchEvent:()=>Ct,YatlTableStateChangeEvent:()=>Rt,YatlTableUi:()=>B,YatlTableViewChangeEvent:()=>Tt,YatlToolbar:()=>V,YatlToolbarExportClick:()=>zt,YatlToolbarSearchChange:()=>At,YatlToolbarSearchInput:()=>$t,createRegexTokenizer:()=>ze,createState:()=>P,findColumn:()=>hr,html:()=>f,isDisplayColumn:()=>z,isInternalColumn:()=>dr,noChange:()=>S,nothing:()=>g,svg:()=>rr,unsafeHTML:()=>Fr,whitespaceTokenizer:()=>Xt});var Ut=globalThis,jt=Ut.ShadowRoot&&(Ut.ShadyCSS===void 0||Ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ee=Symbol(),He=new WeakMap,ot=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ee)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(jt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=He.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&He.set(e,t))}return t}toString(){return this.cssText}},Be=s=>new ot(typeof s=="string"?s:s+"",void 0,Ee),x=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1],s[0]);return new ot(e,s,Ee)},Fe=(s,t)=>{if(jt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Ut.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},Ce=jt?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Be(e)})(s):s;var{is:Gr,defineProperty:Xr,getOwnPropertyDescriptor:Jr,getOwnPropertyNames:Zr,getOwnPropertySymbols:Yr,getPrototypeOf:ti}=Object,L=globalThis,qe=L.trustedTypes,ei=qe?qe.emptyScript:"",ri=L.reactiveElementPolyfillSupport,nt=(s,t)=>s,lt={toAttribute(s,t){switch(t){case Boolean:s=s?ei:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Ht=(s,t)=>!Gr(s,t),Ke={attribute:!0,type:String,converter:lt,reflect:!1,useDefault:!1,hasChanged:Ht};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),L.litPropertyMetadata??(L.litPropertyMetadata=new WeakMap);var O=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ke){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&Xr(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:o}=Jr(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let l=i?.call(this);o?.call(this,n),this.requestUpdate(t,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ke}static _$Ei(){if(this.hasOwnProperty(nt("elementProperties")))return;let t=ti(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(nt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(nt("properties"))){let e=this.properties,r=[...Zr(e),...Yr(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(Ce(i))}else t!==void 0&&e.push(Ce(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Fe(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:lt).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:lt;this._$Em=i;let l=n.fromAttribute(e,o.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,e,r,i=!1,o){if(t!==void 0){let n=this.constructor;if(i===!1&&(o=this[t]),r??(r=n.getPropertyOptions(t)),!((r.hasChanged??Ht)(o,e)||r.useDefault&&r.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:o},n){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:n}=o,l=this[i];n!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,o,l)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[nt("elementProperties")]=new Map,O[nt("finalized")]=new Map,ri?.({ReactiveElement:O}),(L.reactiveElementVersions??(L.reactiveElementVersions=[])).push("2.1.2");var ct=globalThis,We=s=>s,Bt=ct.trustedTypes,Qe=Bt?Bt.createPolicy("lit-html",{createHTML:s=>s}):void 0,Re="$lit$",N=`lit$${Math.random().toFixed(9).slice(2)}$`,Me="?"+N,ii=`<${Me}>`,K=document,ht=()=>K.createComment(""),dt=s=>s===null||typeof s!="object"&&typeof s!="function",$e=Array.isArray,tr=s=>$e(s)||typeof s?.[Symbol.iterator]=="function",Te=`[
2
- \f\r]`,at=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ge=/-->/g,Xe=/>/g,F=RegExp(`>|${Te}(?:([^\\s"'>=/]+)(${Te}*=${Te}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Je=/'/g,Ze=/"/g,er=/^(?:script|style|textarea|title)$/i,Ae=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),f=Ae(1),rr=Ae(2),zi=Ae(3),S=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Ye=new WeakMap,q=K.createTreeWalker(K,129);function ir(s,t){if(!$e(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qe!==void 0?Qe.createHTML(t):t}var sr=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=at;for(let l=0;l<e;l++){let a=s[l],c,h,d=-1,_=0;for(;_<a.length&&(n.lastIndex=_,h=n.exec(a),h!==null);)_=n.lastIndex,n===at?h[1]==="!--"?n=Ge:h[1]!==void 0?n=Xe:h[2]!==void 0?(er.test(h[2])&&(i=RegExp("</"+h[2],"g")),n=F):h[3]!==void 0&&(n=F):n===F?h[0]===">"?(n=i??at,d=-1):h[1]===void 0?d=-2:(d=n.lastIndex-h[2].length,c=h[1],n=h[3]===void 0?F:h[3]==='"'?Ze:Je):n===Ze||n===Je?n=F:n===Ge||n===Xe?n=at:(n=F,i=void 0);let b=n===F&&s[l+1].startsWith("/>")?" ":"";o+=n===at?a+ii:d>=0?(r.push(c),a.slice(0,d)+Re+a.slice(d)+N+b):a+N+(d===-2?l:b)}return[ir(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ut=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,l=t.length-1,a=this.parts,[c,h]=sr(t,e);if(this.el=s.createElement(c,r),q.currentNode=this.el.content,e===2||e===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=q.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Re)){let _=h[n++],b=i.getAttribute(d).split(N),y=/([.?@])?(.*)/.exec(_);a.push({type:1,index:o,name:y[2],strings:b,ctor:y[1]==="."?qt:y[1]==="?"?Kt:y[1]==="@"?Wt:Q}),i.removeAttribute(d)}else d.startsWith(N)&&(a.push({type:6,index:o}),i.removeAttribute(d));if(er.test(i.tagName)){let d=i.textContent.split(N),_=d.length-1;if(_>0){i.textContent=Bt?Bt.emptyScript:"";for(let b=0;b<_;b++)i.append(d[b],ht()),q.nextNode(),a.push({type:2,index:++o});i.append(d[_],ht())}}}else if(i.nodeType===8)if(i.data===Me)a.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(N,d+1))!==-1;)a.push({type:7,index:o}),d+=N.length-1}o++}}static createElement(t,e){let r=K.createElement("template");return r.innerHTML=t,r}};function W(s,t,e=s,r){if(t===S)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=dt(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=W(s,i._$AS(s,t.values),i,r)),t}var Ft=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??K).importNode(e,!0);q.currentNode=i;let o=q.nextNode(),n=0,l=0,a=r[0];for(;a!==void 0;){if(n===a.index){let c;a.type===2?c=new J(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new Qt(o,this,t)),this._$AV.push(c),a=r[++l]}n!==a?.index&&(o=q.nextNode(),n++)}return q.currentNode=K,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},J=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=W(this,t,e),dt(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):tr(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==g&&dt(this._$AH)?this._$AA.nextSibling.data=t:this.T(K.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=ut.createElement(ir(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new Ft(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Ye.get(t.strings);return e===void 0&&Ye.set(t.strings,e=new ut(t)),e}k(t){$e(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(ht()),this.O(ht()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=We(t).nextSibling;We(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Q=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=g}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=W(this,t,e,0),n=!dt(t)||t!==this._$AH&&t!==S,n&&(this._$AH=t);else{let l=t,a,c;for(t=o[0],a=0;a<o.length-1;a++)c=W(this,l[r+a],e,a),c===S&&(c=this._$AH[a]),n||(n=!dt(c)||c!==this._$AH[a]),c===g?t=g:t!==g&&(t+=(c??"")+o[a+1]),this._$AH[a]=c}n&&!i&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},qt=class extends Q{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Kt=class extends Q{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},Wt=class extends Q{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=W(this,t,e,0)??g)===S)return;let r=this._$AH,i=t===g&&r!==g||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==g&&(r===g||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Qt=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){W(this,t)}},or={M:Re,P:N,A:Me,C:1,L:sr,R:Ft,D:tr,V:W,I:J,H:Q,N:Kt,U:Wt,B:qt,F:Qt},si=ct.litHtmlPolyfillSupport;si?.(ut,J),(ct.litHtmlVersions??(ct.litHtmlVersions=[])).push("3.3.2");var nr=(s,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new J(t.insertBefore(ht(),o),o,void 0,e??{})}return i._$AI(s),i};var pt=globalThis,v=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=nr(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return S}};v._$litElement$=!0,v.finalized=!0,pt.litElementHydrateSupport?.({LitElement:v});var oi=pt.litElementPolyfillSupport;oi?.({LitElement:v});(pt.litElementVersions??(pt.litElementVersions=[])).push("4.2.2");var E=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};var ni={attribute:!0,type:String,converter:lt,reflect:!1,hasChanged:Ht},li=(s=ni,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((s=Object.create(s)).wrapped=!0),o.set(e.name,s),r==="accessor"){let{name:n}=e;return{set(l){let a=t.get.call(this);t.set.call(this,l),this.requestUpdate(n,a,s,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,s,l),l}}}if(r==="setter"){let{name:n}=e;return function(l){let a=this[n];t.call(this,l),this.requestUpdate(n,a,s,!0,l)}}throw Error("Unsupported decorator location: "+r)};function p(s){return(t,e)=>typeof e=="object"?li(s,t,e):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,t,e)}var G=(s,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(s,t,e),e);function ft(s,t){return(e,r,i)=>{let o=n=>n.renderRoot?.querySelector(s)??null;if(t){let{get:n,set:l}=typeof r=="object"?e:i??(()=>{let a=Symbol();return{get(){return this[a]},set(c){this[a]=c}}})();return G(e,r,{get(){let a=n.call(this);return a===void 0&&(a=o(this),(a!==null||this.hasUpdated)&&l.call(this,a)),a}})}return G(e,r,{get(){return o(this)}})}}var U=x`
4
- /* Theme declarations */
5
- :host {
6
- /* Typography */
7
- --yatl-font-family: var(
8
- --yatl-theme-font,
9
- -apple-system,
10
- BlinkMacSystemFont,
11
- 'Segoe UI',
12
- Roboto,
13
- Helvetica,
14
- Arial,
15
- sans-serif,
16
- 'Apple Color Emoji',
17
- 'Segoe UI Emoji'
18
- );
19
- --yatl-font-size: var(--yatl-theme-font-size, 0.875rem);
20
- --yatl-line-height: var(--yatl-theme-line-height, 1.25rem);
21
-
22
- /* Spacing */
23
- --yatl-spacing-xs: var(--yatl-theme-spacing-xs, 4px);
24
- --yatl-spacing-s: var(--yatl-theme-spacing-s, 8px);
25
- --yatl-spacing-m: var(--yatl-theme-spacing-m, 12px);
26
- --yatl-spacing-l: var(--yatl-theme-spacing-l, 16px);
27
-
28
- /* Radius */
29
- --yatl-radius-xs: var(--yatl-theme-radius-xs, 2px);
30
- --yatl-radius-s: var(--yatl-theme-radius-s, 4px);
31
- --yatl-radius-m: var(--yatl-theme-radius-m, 8px);
32
- --yatl-radius-l: var(--yatl-theme-radius-l, 12px);
33
-
34
- /* Border */
35
- --yatl-border-color-light: var(--yatl-theme-border-color-light, #e2e8f0);
36
- --yatl-border-color-dark: var(--yatl-theme-border-color-dark, #2e2e2e);
37
- --yatl-border-color: light-dark(
38
- var(--yatl-border-color-light),
39
- var(--yatl-border-color-dark)
40
- );
41
-
42
- --yatl-color-brand: var(--yatl-theme-brand, #7531ae);
43
- --yatl-color-danger: var(--yatl-theme-danger, #ef4444);
44
-
45
- --yatl-surface-1-light: #ffffff;
46
- --yatl-surface-1-dark: #101219;
47
- --yatl-surface-1: light-dark(
48
- var(--yatl-surface-1-light),
49
- var(--yatl-surface-1-dark)
50
- );
51
-
52
- --yatl-surface-2-light: #f8fafc;
53
- --yatl-surface-2-dark: #1a1b1e;
54
- --yatl-surface-2: light-dark(
55
- var(--yatl-surface-2-light),
56
- var(--yatl-surface-2-dark)
57
- );
58
-
59
- --yatl-surface-3-light: #f1f5f9;
60
- --yatl-surface-3-dark: #27272a;
61
- --yatl-surface-3: light-dark(
62
- var(--yatl-surface-3-light),
63
- var(--yatl-surface-3-dark)
64
- );
65
-
66
- --yatl-surface-4-light: #e2e8f0;
67
- --yatl-surface-4-dark: #3f3f46;
68
- --yatl-surface-4: light-dark(
69
- var(--yatl-surface-4-light),
70
- var(--yatl-surface-4-dark)
71
- );
72
-
73
- --yatl-text-1-light: #0f172a;
74
- --yatl-text-1-dark: #f1f5f9;
75
- --yatl-text-1: light-dark(
76
- var(--yatl-text-1-light),
77
- var(--yatl-text-1-dark)
78
- );
79
-
80
- --yatl-text-2-light: #475569;
81
- --yatl-text-2-dark: #cbd5e1;
82
- --yatl-text-2: light-dark(
83
- var(--yatl-text-2-light),
84
- var(--yatl-text-2-dark)
85
- );
86
-
87
- --yatl-text-3-light: #94a3b8;
88
- --yatl-text-3-dark: #64748b;
89
- --yatl-text-3: light-dark(
90
- var(--yatl-text-3-light),
91
- var(--yatl-text-3-dark)
92
- );
93
-
94
- --yatl-text-inverse: #ffffff;
95
- --yatl-mix-color: light-dark(black, white);
96
-
97
- font-family: var(--yatl-font-family);
98
- font-size: var(--yatl-font-size);
99
- color: var(--yatl-text);
100
- }
101
- `;var lr=x`
102
- :host {
103
- --button-radius: var(--yatl-button-radius, var(--yatl-radius-s));
104
- --button-border-color: var(--yatl-button-border, var(--yatl-border-color));
105
- --button-border-width: var(--yatl-button-border-width, 1px);
106
- --button-text: var(--yatl-button-text, var(--yatl-text-3));
107
- --button-bg: var(--yatl-button-bg, var(--yatl-surface-3));
108
- --button-hover-text: var(
109
- --yatl-button-hover-text,
110
- var(--yatl-text-inverse)
111
- );
112
- --button-hover-bg: var(--yatl-button-hover-bg, var(--yatl-color-brand));
113
-
114
- display: block;
115
- box-sizing: border-box;
116
- overflow: hidden;
117
- padding: 0;
118
-
119
- color: var(--button-text);
120
- font-size: large;
121
- font-weight: 500;
122
- background: var(--button-bg);
123
- border-radius: var(--button-radius);
124
- border: var(--button-border-width) solid var(--button-border-color);
125
- }
126
-
127
- :host([data-group-position]) {
128
- margin-right: -1px;
129
- }
130
-
131
- :host([data-group-position='middle']) {
132
- --button-radius: 0 !important;
133
- }
134
-
135
- :host([data-group-position='first']) {
136
- --button-radius: var(--button-group-radius) 0 0 var(--button-group-radius) !important;
137
- }
138
-
139
- :host([data-group-position='last']) {
140
- --yatl-button-radius: 0 var(--button-group-radius)
141
- var(--button-group-radius) 0;
142
- margin-right: 0;
143
- }
144
-
145
- .button {
146
- box-sizing: border-box;
147
- width: 100%;
148
- height: 100%;
149
- padding: 8px;
150
- border: none;
151
- cursor: pointer;
152
- background-color: transparent;
153
- /* Helps center the icons */
154
- display: flex;
155
- align-items: center;
156
- }
157
-
158
- .button:not([disabled]):hover {
159
- color: var(--button-hover-text);
160
- background: var(--button-hover-bg);
161
- }
162
-
163
- .button:disabled,
164
- .button[disabled] {
165
- opacity: 0.5;
166
- cursor: not-allowed;
167
- filter: grayscale(100%);
168
- pointer-events: none;
169
- }
170
- `;var $=class extends v{constructor(){super(...arguments);this.disabled=!1;this.type="button"}render(){return f`
171
- <button
172
- class="button"
173
- type=${this.type}
174
- ?disabled=${this.disabled}
175
- part="button"
176
- >
177
- <slot></slot>
178
- </button>
179
- `}};$.styles=[U,lr],u([p({type:Boolean,reflect:!0})],$.prototype,"disabled",2),u([p({type:String,reflect:!0})],$.prototype,"type",2),$=u([E("yatl-button")],$);var ar=x`
180
- :host {
181
- display: inline-flex;
182
- }
183
-
184
- .group-container {
185
- display: flex;
186
- flex-direction: row;
187
- align-items: stretch;
188
- }
189
-
190
- ::slotted(*) {
191
- --button-group-radius: var(
192
- --yatl-button-group-radius,
193
- var(--yatl-radius-m)
194
- );
195
- }
196
- `;var cr=x`
197
- :host {
198
- --dropdown-menu-bg: var(--yatl-dropdown-menu-bg, var(--yatl-surface-3));
199
- --dropdown-menu-padding: var(
200
- --yatl-dropdown-menu-padding,
201
- var(--yatl-spacing-s)
202
- );
203
- --dropdown-menu-radius: var(
204
- --yatl-dropdown-menu-radius,
205
- var(--yatl-radius-m)
206
- );
207
- --dropdown-menu-border: var(
208
- --yatl-dropdown-menu-border,
209
- var(--yatl-border-color)
210
- );
211
- --dropdown-menu-open-bg: var(
212
- --yatl-dropdown-menu-open-bg,
213
- var(--yatl-color-brand)
214
- );
215
-
216
- overflow: visible !important;
217
- }
218
-
219
- .dropdown {
220
- position: relative;
221
- height: 100%;
222
- }
223
-
224
- .dropdown summary {
225
- box-sizing: border-box;
226
- /* Hides the dropdown arrow*/
227
- list-style: none;
228
- height: 100%;
229
- }
230
-
231
- :host([open]) ::slotted([slot='trigger']) {
232
- background-color: var(--dropdown-menu-open-bg);
233
- }
234
-
235
- .dropdown-menu {
236
- position: absolute;
237
- top: 100%;
238
- right: 0;
239
- margin-top: 4px;
240
- background: var(--dropdown-menu-bg);
241
- border: 1px solid var(--dropdown-menu-border);
242
- border-radius: var(--dropdown-menu-radius);
243
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
244
- padding: var(--dropdown-menu-padding);
245
- z-index: 50;
246
-
247
- display: flex;
248
- flex-direction: column;
249
- }
250
- `;var A=class extends v{constructor(){super(...arguments);this.open=!1;this.handleDropdownTriggerClick=e=>{e.preventDefault(),e.stopPropagation(),this.open=!this.open,this.open?document.addEventListener("click",this.handleDocumentClick):document.removeEventListener("click",this.handleDocumentClick)};this.handleDocumentClick=e=>{this.detailsElement&&!e.composedPath().includes(this.detailsElement)&&(this.open=!1)}}render(){return f`
251
- <details part="dropdown" class="dropdown" ?open=${this.open}>
252
- <summary @click=${this.handleDropdownTriggerClick}>
253
- <slot name="trigger"></slot>
254
- </summary>
255
- <div part="dropdown-menu" class="dropdown-menu">
256
- <slot></slot>
257
- </div>
258
- </details>
259
- `}};A.styles=[cr],u([ft("details")],A.prototype,"detailsElement",2),u([p({type:Boolean,reflect:!0})],A.prototype,"open",2),A=u([E("yatl-dropdown")],A);function hr(s,t){return s.find(e=>e.field===t)}function dr(s){return s?.role==="internal"}function z(s){return s?.role!=="internal"}function P(s,t){return{field:s,visible:t?.visible??!0,width:t?.width??null,sort:t?.sort?{...t.sort}:null}}function ur(s,t){if(s&&s.field!==t.field)throw Error(`attempting to compare states for different fields: ${s.field}, ${t.field}`);let e=[];return s?.visible!==t.visible&&e.push("visible"),s?.width!==t.width&&e.push("width"),(s?.sort!==t.sort||s.sort?.order!==t.sort?.order||s.sort?.priority!==t.sort?.priority)&&e.push("sort"),e}function Gt(s){return typeof s=="string"||typeof s=="number"}function pr(s){return s===null||s==="multi"||s==="single"}function ai(s,t){return s in t}function k(s,t){let e=t.split("."),r=s;for(let i of e)if(r&&ai(i,r))r=r[i];else return;return r}function mt(s){if(s instanceof HTMLSlotElement){let t=s.assignedElements({flatten:!0});return t.length>0?t.flatMap(mt):Array.from(s.children).flatMap(mt)}return s instanceof Element?[s]:[]}var ze=(s="\\S+")=>{let t=new RegExp(`"[^"]*"|${s}`,"g");return e=>(e.match(t)||[]).map(i=>(i=i.toLocaleLowerCase().trim(),i.startsWith('"')&&i.endsWith('"')?{value:i.slice(1,-1),quoted:!0}:{value:i,quoted:!1}))},Xt=ze();var Z=class extends v{render(){return f`
260
- <div class="group-container">
261
- <slot @slotchange=${this.handleSlotChange}></slot>
262
- </div>
263
- `}handleSlotChange(t){let e=t.target,r=mt(e),i=r.length;r.forEach((o,n)=>{if(o instanceof A){let a=o.querySelector('[slot="trigger"]');a&&(o=mt(a).find(h=>h instanceof $)??o)}let l="middle";i===1?l="single":n===0?l="first":n===i-1&&(l="last"),o.setAttribute("data-group-position",l)})}};Z.styles=[U,ar],Z=u([E("yatl-button-group")],Z);var fr=x`
264
- :host {
265
- --dropdown-item-text: var(--yatl-dropdown-item-text, var(--yatl-text-1));
266
- --dropdown-item-font-size: var(--yatl-dropdown-item-font-size, 16px);
267
- --dropdown-item-bg: var(--yatl-dropdown-item-bg, transparent);
268
- --dropdown-item-hover-bg: var(
269
- --yatl-dropdown-item-hover-bg,
270
- var(--yatl-color-brand)
271
- );
272
- --dropdown-item-padding: var(
273
- --yatl-dropdown-item-padding,
274
- var(--yatl-spacing-s) var(--yatl-spacing-m)
275
- );
276
- --dropdown-item-gap: var(--yatl-dropdown-item-gap, var(--yatl-spacing-xs));
277
- --dropdown-item-radius: var(
278
- --yatl-dropdown-item-radius,
279
- var(--yatl-radius-s)
280
- );
281
- --dropdown-item-focus-border: var(
282
- --yatl-dropdown-item-focus-border,
283
- var(--yatl-color-brand)
284
- );
285
- }
286
-
287
- .dropdown-item {
288
- display: flex;
289
- align-items: center;
290
- cursor: pointer;
291
- white-space: nowrap;
292
- user-select: none;
293
-
294
- color: var(--dropdown-item-text);
295
- font-size: var(--dropdown-item-font-size);
296
- background-color: var(--dropdown-item-bg);
297
- gap: var(--dropdown-item-gap);
298
- padding: var(--dropdown-item-padding);
299
-
300
- transition: background 0.1s ease;
301
- }
302
-
303
- .dropdown-item:hover {
304
- background-color: var(--dropdown-item-hover-bg);
305
- border-radius: var(--dropdown-item-radius);
306
- }
307
-
308
- .dropdown-item input {
309
- position: absolute;
310
- width: 1px;
311
- height: 1px;
312
- padding: 0;
313
- margin: -1px;
314
- overflow: hidden;
315
- clip: rect(0, 0, 0, 0);
316
- white-space: nowrap;
317
- border: 0;
318
- }
319
-
320
- .check-container {
321
- width: 18px;
322
- height: 18px;
323
- margin-right: 12px;
324
- display: flex;
325
- align-items: center;
326
- justify-content: center;
327
- border: 1px solid transparent;
328
- border-radius: 3px;
329
- transition: all 0.2s ease;
330
- }
331
-
332
- .check-icon {
333
- width: 14px;
334
- height: 14px;
335
- fill: var(--dropdown-item-text);
336
- opacity: 0;
337
- transform: scale(0.5);
338
- transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46);
339
- }
340
-
341
- input:checked ~ .check-container .check-icon {
342
- opacity: 1;
343
- transform: scale(1);
344
- }
345
-
346
- input:focus-visible ~ .check-container {
347
- border-color: var(--dropdown-item-focus-border);
348
- box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
349
- }
350
-
351
- .label-text {
352
- font-size: 14px;
353
- color: var(--dropdown-item-text);
354
- }
355
- `;var w=class extends Event{constructor(t,e={}){super(t,{bubbles:!0,composed:!0,cancelable:!1,...e})}},Jt=class Jt extends w{constructor(e,r,i,o,n){super(Jt.EVENT_NAME);this.row=e;this.rowId=r;this.index=i;this.field=o;this.originalEvent=n}};Jt.EVENT_NAME="yatl-row-click";var gt=Jt,Zt=class Zt extends w{constructor(e,r,i){super(Zt.EVENT_NAME,{cancelable:!0});this.rowId=e;this.selected=r;this.currentlySelectedRows=i}};Zt.EVENT_NAME="yatl-row-select-request";var _t=Zt,Yt=class Yt extends w{constructor(e,r){super(Yt.EVENT_NAME);this.selectedIds=e;this.previouslySelectedRows=r}};Yt.EVENT_NAME="yatl-row-select";var bt=Yt,te=class te extends w{constructor(e,r,i){super(te.EVENT_NAME,{cancelable:!0});this.field=e;this.order=r;this.multisort=i}};te.EVENT_NAME="yatl-column-sort-request";var yt=te,ee=class ee extends w{constructor(e,r,i){super(ee.EVENT_NAME);this.field=e;this.order=r;this.multisort=i}};ee.EVENT_NAME="yatl-column-sort";var vt=ee,re=class re extends w{constructor(e,r){super(re.EVENT_NAME,{cancelable:!0});this.field=e;this.visibility=r}};re.EVENT_NAME="yatl-column-toggle-request";var ke=re,ie=class ie extends w{constructor(e,r){super(ie.EVENT_NAME);this.field=e;this.visible=r}};ie.EVENT_NAME="yatl-column-toggle";var wt=ie,se=class se extends w{constructor(e,r){super(se.EVENT_NAME);this.field=e;this.width=r}};se.EVENT_NAME="yatl-column-resize";var St=se,oe=class oe extends w{constructor(e,r,i){super(oe.EVENT_NAME,{cancelable:!0});this.movedColumn=e;this.originalIndex=r;this.newIndex=i}};oe.EVENT_NAME="yatl-column-reorder-request";var xt=oe,ne=class ne extends w{constructor(e){super(ne.EVENT_NAME);this.order=e}};ne.EVENT_NAME="yatl-column-reorder";var Et=ne,le=class le extends w{constructor(e){super(le.EVENT_NAME);this.query=e}};le.EVENT_NAME="yatl-table-search";var Ct=le,ae=class ae extends w{constructor(e){super(ae.EVENT_NAME);this.data=e}};ae.EVENT_NAME="yatl-table-view-change";var Tt=ae,ce=class ce extends w{constructor(e,r){super(ce.EVENT_NAME);this.state=e;this.triggers=r}};ce.EVENT_NAME="yatl-table-state-change";var Rt=ce,he=class he extends w{constructor(e,r){super(he.EVENT_NAME);this.value=e;this.checked=r}};he.EVENT_NAME="yatl-dropdown-toggle";var Mt=he,de=class de extends w{constructor(e){super(de.EVENT_NAME);this.value=e}};de.EVENT_NAME="yatl-toolbar-search-input";var $t=de,ue=class ue extends w{constructor(e){super(ue.EVENT_NAME);this.value=e}};ue.EVENT_NAME="yatl-toolbar-search-change";var At=ue,pe=class pe extends w{constructor(){super(pe.EVENT_NAME)}};pe.EVENT_NAME="yatl-toolbar-export-click";var zt=pe;var j=class extends v{constructor(){super(...arguments);this.value="on";this.checked=!1;this.handleCheckboxChanged=e=>{let r=e.target;this.checked=r.checked,this.dispatchEvent(new Mt(r.value,r.checked))}}render(){return f`
356
- <label part="dropdown-item" class="dropdown-item">
357
- <input
358
- type="checkbox"
359
- value=${this.value}
360
- .checked=${this.checked}
361
- @change=${this.handleCheckboxChanged}
362
- />
363
- <div class="check-container">
364
- <svg class="check-icon" viewBox="0 0 16 16">
365
- <path
366
- d="M13.485 1.929l-8.485 8.485-3.536-3.536-1.414 1.414 4.95 4.95 9.9-9.9z"
367
- />
368
- </svg>
369
- </div>
370
- <span part="label-text" class="label-text"><slot></slot></span>
371
- </label>
372
- `}};j.styles=[fr],u([p({type:String,reflect:!0})],j.prototype,"value",2),u([p({type:Boolean,reflect:!0})],j.prototype,"checked",2),j=u([E("yatl-dropdown-item")],j);function mr(s,t){if(!s||!t||t.length===0)return s;let e=[...t].sort((l,a)=>l[0]-a[0]),r=[],i=e[0];for(let l=1;l<e.length;l++){let a=e[l];a[0]<i[1]?i[1]=Math.max(i[1],a[1]):(r.push(i),i=a)}r.push(i);let o=[],n=0;for(let[l,a]of r){let c=Math.max(0,Math.min(l,s.length)),h=Math.max(0,Math.min(a,s.length));c>n&&o.push(s.slice(n,c)),o.push(f`<mark class="highlight">${s.slice(c,h)}</mark>`),n=h}return n<s.length&&o.push(s.slice(n)),f`${o}`}var gr=s=>s.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase());var T={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},M=s=>(...t)=>({_$litDirective$:s,values:t}),C=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var kt=M(class extends C{constructor(s){if(super(s),s.type!==T.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=s.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let i=!!t[r];i===this.st.has(r)||this.nt?.has(r)||(i?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return S}});var X=s=>s??g;var{I:ci}=or,_r=s=>s;var yr=s=>s.strings===void 0,br=()=>document.createComment(""),Y=(s,t,e)=>{let r=s._$AA.parentNode,i=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(br(),i),n=r.insertBefore(br(),i);e=new ci(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,l=n!==s;if(l){let a;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(a=s._$AU)!==n._$AU&&e._$AP(a)}if(o!==i||l){let a=e._$AA;for(;a!==o;){let c=_r(a).nextSibling;_r(r).insertBefore(a,i),a=c}}}return e},H=(s,t,e=s)=>(s._$AI(t,e),s),hi={},vr=(s,t=hi)=>s._$AH=t,wr=s=>s._$AH,fe=s=>{s._$AR(),s._$AA.remove()};var Sr=(s,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(s[i],i);return r},tt=M(class extends C{constructor(s){if(super(s),s.type!==T.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],o=[],n=0;for(let l of s)i[n]=r?r(l,n):n,o[n]=e(l,n),n++;return{values:o,keys:i}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,r]){let i=wr(s),{values:o,keys:n}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=n,o;let l=this.ut??(this.ut=[]),a=[],c,h,d=0,_=i.length-1,b=0,y=o.length-1;for(;d<=_&&b<=y;)if(i[d]===null)d++;else if(i[_]===null)_--;else if(l[d]===n[b])a[b]=H(i[d],o[b]),d++,b++;else if(l[_]===n[y])a[y]=H(i[_],o[y]),_--,y--;else if(l[d]===n[y])a[y]=H(i[d],o[y]),Y(s,a[y+1],i[d]),d++,y--;else if(l[_]===n[b])a[b]=H(i[_],o[b]),Y(s,i[d],i[_]),_--,b++;else if(c===void 0&&(c=Sr(n,b,y),h=Sr(l,d,_)),c.has(l[d]))if(c.has(l[_])){let R=h.get(n[b]),st=R!==void 0?i[R]:null;if(st===null){let I=Y(s,i[d]);H(I,o[b]),a[b]=I}else a[b]=H(st,o[b]),Y(s,i[d],st),i[R]=null;b++}else fe(i[_]),_--;else fe(i[d]),d++;for(;b<=y;){let R=Y(s,a[y+1]);H(R,o[b]),a[b++]=R}for(;d<=_;){let R=i[d++];R!==null&&fe(R)}return this.ut=n,vr(s,a),S}});var xr="important",di=" !"+xr,Er=M(class extends C{constructor(s){if(super(s),s.type!==T.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((t,e)=>{let r=s[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(s,[t]){let{style:e}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(di);r.includes("-")||o?e.setProperty(r,o?i.slice(0,-11):i,o?xr:""):e[r]=i}}return S}});function et(s,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,r);else for(var l=s.length-1;l>=0;l--)(n=s[l])&&(o=(i<3?n(o):i>3?n(t,e,o):n(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o}var It=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),It(r,t);return!0},me=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},Cr=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),fi(t)}};function ui(s){this._$AN!==void 0?(me(this),this._$AM=s,Cr(this)):this._$AM=s}function pi(s,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)It(r[o],!1),me(r[o]);else r!=null&&(It(r,!1),me(r));else It(this,s)}var fi=s=>{s.type==T.CHILD&&(s._$AP??(s._$AP=pi),s._$AQ??(s._$AQ=ui))},ge=class extends C{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Cr(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(It(this,t),me(this))}setValue(t){if(yr(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var rt=class s extends Event{constructor(t){super(s.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}};rt.eventName="rangeChanged";var it=class s extends Event{constructor(t){super(s.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}};it.eventName="visibilityChanged";var Ot=class s extends Event{constructor(){super(s.eventName,{bubbles:!1})}};Ot.eventName="unpinned";var Ie=class{constructor(t){this._element=null;let e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}},_e=class extends Ie{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.__destination=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);let r=this._node;this._originalScrollTo=r.scrollTo,this._originalScrollBy=r.scrollBy,this._originalScroll=r.scroll,this._attach(t)}get _destination(){return this.__destination}get scrolling(){return this._destination!==null}scrollTo(t,e){let r=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;this._scrollTo(r)}scrollBy(t,e){let r=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;r.top!==void 0&&(r.top+=this.scrollTop),r.left!==void 0&&(r.left+=this.scrollLeft),this._scrollTo(r)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,r=null){this._end!==null&&this._end(),t.behavior==="smooth"?(this._setDestination(t),this._retarget=e,this._end=r):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:r}=t;return e=e===void 0?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),r=r===void 0?void 0:Math.max(0,Math.min(r,this.maxScrollLeft)),this._destination!==null&&r===this._destination.left&&e===this._destination.top?!1:(this.__destination={top:e,left:r,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,r){return this._scrollTo(t,e,r),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(this._destination!==null){let{scrollTop:t,scrollLeft:e}=this,{top:r,left:i}=this._destination;r=Math.min(r||0,this.maxScrollTop),i=Math.min(i||0,this.maxScrollLeft);let o=Math.abs(r-t),n=Math.abs(i-e);o<1&&n<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),this._clients.size===0&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),this._clients.size===1&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}};var zr=typeof window<"u"?window.ResizeObserver:void 0;var Pt=Symbol("virtualizerRef"),ve="virtualizer-sizer",kr,Se=class{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(t.hostElement)this._init(t);else throw new Error('Virtualizer configuration requires the "hostElement" property')}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);let e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new zr(()=>this._hostElementSizeChanged()),this._childrenRO=new zr(this._childrenSizeChanged.bind(this))}_initHostElement(t){let e=this._hostElement=t.hostElement;this._applyVirtualizerStyles(),e[Pt]=this}connected(){this._initObservers();let t=this._isScroller;this._clippingAncestors=wi(this._hostElement,t),this._scrollerController=new _e(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){let e=this._hostElement.style;e.display=e.display||"block",e.position=e.position||"relative",e.contain=e.contain||"size layout",this._isScroller&&(e.overflow=e.overflow||"auto",e.minHeight=e.minHeight||"150px")}_getSizer(){let t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${ve}]`);e||(e=document.createElement("div"),e.setAttribute(ve,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent="&nbsp;",e.setAttribute(ve,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;let e=t.type||kr;if(typeof e=="function"&&this._layout instanceof e){let r={...t};return delete r.type,this._layout.config=r,!0}return!1}async _initLayout(t){let e,r;if(typeof t.type=="function"){r=t.type;let i={...t};delete i.type,e=i}else e=t;r===void 0&&(kr=r=(await Promise.resolve().then(()=>(Ar(),$r))).FlowLayout),this._layout=new r(i=>this._handleLayoutMessage(i),e),this._layout.measureChildren&&typeof this._layout.updateItemSizes=="function"&&(typeof this._layout.measureChildren=="function"&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){this._benchmarkStart===null&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(this._benchmarkStart!==null){let t=window.performance.now(),e=t-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter(o=>o.startTime>=this._benchmarkStart&&o.startTime<t).reduce((o,n)=>o+n.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:i}}return null}_measureChildren(){let t={},e=this._children,r=this._measureChildOverride||this._measureChild;for(let i=0;i<e.length;i++){let o=e[i],n=this._first+i;(this._itemsChanged||this._toBeMeasured.has(o))&&(t[n]=r.call(this,o,this._items[n]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){let{width:e,height:r}=t.getBoundingClientRect();return Object.assign({width:e,height:r},yi(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;let{_rangeChanged:e,_itemsChanged:r}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||r)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),this._childMeasurements!==null&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(t){switch(t.type){case"scroll":(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();break;default:console.warn("event not handled",t)}}_handleLayoutMessage(t){t.type==="stateChanged"?this._updateDOM(t):t.type==="visibilityChanged"?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):t.type==="unpinned"&&this._hostElement.dispatchEvent(new Ot)}get _children(){let t=[],e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(ve)||t.push(e),e=e.nextElementSibling;return t}_updateView(){let t=this._hostElement,e=this._scrollerController?.element,r=this._layout;if(t&&e&&r){let i,o,n,l,a=t.getBoundingClientRect();i=0,o=0,n=window.innerHeight,l=window.innerWidth;let c=this._clippingAncestors.map(I=>I.getBoundingClientRect());c.unshift(a);for(let I of c)i=Math.max(i,I.top),o=Math.max(o,I.left),n=Math.min(n,I.bottom),l=Math.min(l,I.right);let h=e.getBoundingClientRect(),d={left:a.left-h.left,top:a.top-h.top},_={width:e.scrollWidth,height:e.scrollHeight},b=i-a.top+t.scrollTop,y=o-a.left+t.scrollLeft,R=Math.max(0,n-i),st=Math.max(0,l-o);r.viewportSize={width:st,height:R},r.viewportScroll={top:b,left:y},r.totalScrollSize=_,r.offsetWithinScroller=d}}_sizeHostElement(t){let r=t&&t.width!==null?Math.min(82e5,t.width):0,i=t&&t.height!==null?Math.min(82e5,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${r}px, ${i}px)`;else{let o=this._hostElement.style;o.minWidth=r?`${r}px`:"100%",o.minHeight=i?`${i}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:e,left:r,width:i,height:o,xOffset:n,yOffset:l},a)=>{let c=this._children[a-this._first];c&&(c.style.position="absolute",c.style.boxSizing="border-box",c.style.transform=`translate(${r}px, ${e}px)`,i!==void 0&&(c.style.width=i+"px"),o!==void 0&&(c.style.height=o+"px"),c.style.left=n===void 0?null:n+"px",c.style.top=l===void 0?null:l+"px")})}async _adjustRange(t){let{_first:e,_last:r,_firstVisible:i,_lastVisible:o}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==r,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==i||this._lastVisible!==o}_correctScrollError(){if(this._scrollError){let{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:r,left:i}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-r,left:e-i})}}element(t){return t===1/0&&(t=this._items.length-1),this._items?.[t]===void 0?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),t.behavior==="smooth"){let e=this._layout.getScrollIntoViewCoordinates(t),{behavior:r}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:r}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){let{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new rt({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new it({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&this._pendingLayoutComplete===null&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){this._layoutCompleteResolver!==null&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(let e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}};function yi(s){let t=window.getComputedStyle(s);return{marginTop:we(t.marginTop),marginRight:we(t.marginRight),marginBottom:we(t.marginBottom),marginLeft:we(t.marginLeft)}}function we(s){let t=s?parseFloat(s):NaN;return Number.isNaN(t)?0:t}function Ir(s){if(s.assignedSlot!==null)return s.assignedSlot;if(s.parentElement!==null)return s.parentElement;let t=s.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}function vi(s,t=!1){let e=[],r=t?s:Ir(s);for(;r!==null;)e.push(r),r=Ir(r);return e}function wi(s,t=!1){let e=!1;return vi(s,t).filter(r=>{if(e)return!1;let i=getComputedStyle(r);return e=i.position==="fixed",i.overflow!=="visible"})}var De=s=>s,Ve=(s,t)=>f`${t}: ${JSON.stringify(s,null,2)}`,Pe=class extends ge{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(e,r)=>Ve(e,r+this._first),this._keyFunction=(e,r)=>De(e,r+this._first),this._items=[],t.type!==T.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);let e=[];if(this._first>=0&&this._last>=this._first)for(let r=this._first;r<=this._last;r++)e.push(this._items[r]);return tt(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);let r=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),r?S:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){let i=t.parentNode;this._makeVirtualizer(i,e)}this._virtualizer.items=this._items}_setFunctions(t){let{renderItem:e,keyFunction:r}=t;e&&(this._renderItem=(i,o)=>e(i,o+this._first)),r&&(this._keyFunction=(i,o)=>r(i,o+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();let{layout:r,scroller:i,items:o}=e;this._virtualizer=new Se({hostElement:t,layout:r,scroller:i}),this._virtualizer.items=o,this._virtualizer.connected()}_initialize(t,e){let r=t.parentNode;r&&r.nodeType===1&&(r.addEventListener("rangeChanged",i=>{this._first=i.first,this._last=i.last,this.setValue(this.render())}),this._makeVirtualizer(r,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}},Or=M(Pe);var D=class extends v{constructor(){super(...arguments),this.items=[],this.renderItem=Ve,this.keyFunction=De,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){let{items:t,renderItem:e,keyFunction:r,layout:i,scroller:o}=this;return f`${Or({items:t,renderItem:e,keyFunction:r,layout:i,scroller:o})}`}element(t){return this[Pt]?.element(t)}get layoutComplete(){return this[Pt]?.layoutComplete}scrollToIndex(t,e="start"){this.element(t)?.scrollIntoView({block:e})}};et([p({attribute:!1})],D.prototype,"items",void 0);et([p()],D.prototype,"renderItem",void 0);et([p()],D.prototype,"keyFunction",void 0);et([p({attribute:!1})],D.prototype,"layout",void 0);et([p({reflect:!0,type:Boolean})],D.prototype,"scroller",void 0);customElements.define("lit-virtualizer",D);function Pr(s,t){if(s&&s.field!==t.field)throw Error(`attempting to compare states for different fields: ${s.field}, ${t.field}`);let e=[];return s?.visible!==t.visible&&e.push("visible"),s?.width!==t.width&&e.push("width"),(s?.sort!==t.sort||s.sort?.order!==t.sort?.order||s.sort?.priority!==t.sort?.priority)&&e.push("sort"),e}function Nr(s){return typeof s=="string"||typeof s=="number"||typeof s=="bigint"?s:typeof s=="boolean"?Number(s):s instanceof Date?s.getTime():String(s)}function Dr(s,t){let e=Array.from(new Set(s)),r=new Intl.Collator(t,{numeric:!0,sensitivity:"base"});e.sort(([o,n],[l,a])=>{if(n==null&&a==null)return 0;if(n==null)return-1;if(n==null)return 1;let c=Nr(n),h=Nr(a);return typeof c=="string"&&typeof h=="string"?r.compare(String(c),String(h)):c<h?-1:h<c?1:0});let i=new Map;return e.forEach(([o,n],l)=>i.set(o,l)),i}var Si=1e3,Vr={storage:"local",saveColumnSortOrders:!0,saveColumnVisibility:!0,saveColumnWidths:!0,saveColumnOrder:!0,saveSelectedRows:!0},Le={EXACT:100,PREFIX:50,SUBSTRING:10},Dt=class{constructor(t,e){this.hosts=new Set;this._enableSearchTokenization=!1;this._enableSearchScoring=!1;this._columns=[];this._columnDefinitionMap=new Map;this._columnStateMap=new Map;this._rowSelectionMethod=null;this._selectedRowIds=new Set;this._storageOptions=null;this._rowIdCallback=(t,e)=>"id"in t&&Gt(t.id)?t.id:"key"in t&&Gt(t.key)?t.key:"_id"in t&&Gt(t._id)?t._id:(xi(),e);this._data=[];this._filteredData=[];this._dataUpdateTimestamp=null;this._searchQuery="";this._searchTokenizer=Xt;this._filters=null;this.hasRestoredState=!1;this.saveTimer=0;this.filterDirty=!1;this.sortDirty=!1;this.rowMetadata=new WeakMap;this.idToRowMap=new Map;this.queryTokens=null;t&&this.attach(t),e&&(e.enableSearchScoring!==void 0&&(this.enableSearchScoring=e.enableSearchScoring),e.enableSearchTokenization!==void 0&&(this.enableSearchTokenization=e.enableSearchTokenization),e.searchTokenizer!==void 0&&(this.searchTokenizer=e.searchTokenizer),e.rowIdCallback!==void 0&&(this.rowIdCallback=e.rowIdCallback),e.rowSelectionMethod!==void 0&&(this.rowSelectionMethod=e.rowSelectionMethod),e.storageOptions!==void 0&&(this.storageOptions=e.storageOptions),e.columns!==void 0&&(this.columns=e.columns),e.data!==void 0&&(this.data=e.data))}get enableSearchTokenization(){return this._enableSearchTokenization}set enableSearchTokenization(t){this._enableSearchTokenization!==t&&(this._enableSearchTokenization=t,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("enableSearchTokenization"))}get enableSearchScoring(){return this._enableSearchScoring}set enableSearchScoring(t){this._enableSearchScoring!==t&&(this._enableSearchScoring=t,this.filterDirty=!0,this.requestUpdate("enableSearchScoring"))}get columns(){return[...this._columns]}set columns(t){this._columns=[...t],this.filterDirty=!0,this._columnDefinitionMap=new Map;for(let e of t)this._columnDefinitionMap.set(e.field,e);this.requestUpdate("columns")}get displayColumns(){return this.columns.filter(z)}get columnStates(){return this.columns.map(t=>{let e=this.getColumnState(t.field);return P(t.field,e)})}set columnStates(t){let e=!1;for(let r of t){let i=this.getColumnState(r.field),o=Pr(i,r);if(o.length){e=!0,o.includes("sort")&&(this.sortDirty=!0);let n=P(r.field,r);this._columnStateMap.set(r.field,n)}}e&&this.requestUpdate("columnStates")}get searchQuery(){return this._searchQuery}set searchQuery(t){this._searchQuery!==t&&(this._searchQuery=t,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("searchQuery"))}get searchTokenizer(){return this._searchTokenizer}set searchTokenizer(t){this._searchTokenizer!==t&&(this._searchTokenizer=t,this.filterDirty=!0,this.requestUpdate("searchTokenizer"))}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=t,this.filterDirty=!0,this.requestUpdate("filters"))}get rowSelectionMethod(){return this._rowSelectionMethod}set rowSelectionMethod(t){this._rowSelectionMethod===t||!pr(t)||(this._rowSelectionMethod=t,this.requestUpdate("rowSelectionMethod"))}get selectedRowIds(){let t=[...this._selectedRowIds];return this.rowSelectionMethod==="single"?t=t.slice(0,1):this.rowSelectionMethod||(t=[]),t}set selectedRowIds(t){t.length===this._selectedRowIds.size&&t.every(e=>this._selectedRowIds.has(e))||(this._selectedRowIds=new Set(t),this.requestUpdate("selectedRowIds"))}get storageOptions(){return this._storageOptions?{...this._storageOptions}:null}set storageOptions(t){this._storageOptions!==t&&(this._storageOptions=t?{...t}:null,this.hasRestoredState||(this.loadStateFromStorage(),this.requestUpdate("storageOptions")))}get rowIdCallback(){return this._rowIdCallback}set rowIdCallback(t){if(this._rowIdCallback!==t){this._rowIdCallback=t;for(let e=0;e<this.data.length;++e){let r=this.data[e];this.rowMetadata.get(r).id=this._rowIdCallback(r,e)}this.requestUpdate("rowIdCallback")}}get data(){return[...this._data]}set data(t){this._data=[...t],this.createMetadata(),this._dataUpdateTimestamp=new Date,this.filterDirty=!0,this.requestUpdate("data")}get filteredData(){return this.filterDirty?this.filterRows():this.sortDirty&&this.sortRows(),this.filterDirty=!1,this.sortDirty=!1,[...this._filteredData]}get dataUpdateTimestamp(){return this._dataUpdateTimestamp}attach(t){this.hosts.add(t),t.addController(this),t.requestUpdate()}detach(t){t.removeController(this),this.hosts.delete(t)}getColumn(t){return this._columnDefinitionMap.get(t)}getDisplayColumn(t){let e=this._columnDefinitionMap.get(t);if(z(e))return e}getTableState(){return{searchQuery:this.searchQuery,selectedRows:this.selectedRowIds,columns:this.columnStates.map(t=>{let e=this.getColumnState(t.field);return P(t.field,e)})}}updateTableState(t){if("searchQuery"in t&&t.searchQuery!==void 0&&(this.searchQuery=t.searchQuery),"selectedRows"in t&&t.selectedRows&&(this.selectedRowIds=t.selectedRows),"columns"in t&&t.columns!==void 0)for(let e of t.columns)this.updateColumnState(e.field,e);this.requestUpdate()}getColumnState(t){let e=this._columnStateMap.get(t);if(!e){let r=P(t);return this._columnStateMap.set(t,r),r}return P(t,e)}updateColumnState(t,e){let r=this._columnStateMap.get(t),i=P(t,{...r,...e});this.columnStates=[i]}search(t){this.searchQuery=t,this.dispatchEvent(new Ct(t))}sort(t,e,r=!0){let i=this.getColumnState(t);if(i===void 0)throw new Error(`Cannot get options for non-existent column "${t}"`);if(e===i?.sort?.order)return;if(e&&!i.sort){let l=[...this._columnStateMap.values()].map(h=>h.sort?.priority).filter(h=>h!==void 0),a=this.columns.length+1,c=Math.min(a,...l)-1;i.sort={order:e,priority:c}}else e&&i.sort?i.sort.order=e:i.sort=null;let o=[i];if(r){for(let l of this.columns)if(l.field!==t){let a=this.getColumnState(l.field);a.sort=null,o.push(a)}}this.columnStates=o;let n=new vt(t,e,!r);this.dispatchEvent(n)}toggleColumnVisibility(t,e){let r=this.getColumnState(t),i=e!==void 0?e:!r.visible;if(i===r.visible)return;r.visible=i,this.columnStates=[r];let o=new wt(t,i);this.dispatchEvent(o)}showColumn(t){this.toggleColumnVisibility(t,!0)}hideColumn(t){this.toggleColumnVisibility(t,!1)}moveColumn(t,e){let r=this.displayColumns,i=r.findIndex(n=>n.field===t),o=typeof e=="number"?e:r.findIndex(n=>n.field===e);if(i>-1&&o>-1){let[n]=r.splice(i,1);r.splice(o,0,n),this.columns=r;let l=new Et(r.map(a=>a.field));this.dispatchEvent(l)}}resizeColumn(t,e){let r=this.getColumnState(t);r.width=e,this.updateColumnState(t,r),this.dispatchEvent(new St(t,e))}isRowSelected(t){let e=this.getRowId(t);return this.selectedRowIds.includes(e)}toggleRowSelection(t,e){let r=this.getRowId(t),i=this.isRowSelected(t),o=e!==void 0?e:i;if(o===i)return;let n;o?n=this.rowSelectionMethod==="single"?[r]:[...this.selectedRowIds,r]:n=this.selectedRowIds.filter(c=>c!==r);let l=this.selectedRowIds;this.selectedRowIds=n;let a=new bt(n,l);this.dispatchEvent(a)}selectRow(t){this.toggleRowSelection(t,!0)}deselectRow(t){this.toggleRowSelection(t,!1)}selectAll(){if(this.rowSelectionMethod==="single")return;let t=this.filteredData.map(e=>this.getRowId(e));this.selectedRowIds=t}deselectAll(){this.selectedRowIds=[]}export(t={includeAllRows:!1,includeHiddenColumns:!1,includeInternalColumns:!1}){let e=t.includeAllRows?this.data:this.filteredData,r=t.includeInternalColumns?this.columns:this.displayColumns,i=r.filter(l=>t.includeHiddenColumns?!0:this.getColumnState(l.field).visible).map(l=>z(l)?l.title:l.field).join(","),o=e.map(l=>{let a=[];for(let c of r){let h=this.getColumnState(c.field),d=k(l,c.field);(t.includeHiddenColumns||h.visible)&&(z(c)&&typeof c.valueFormatter=="function"&&(d=c.valueFormatter(d,l)),d=String(d).replace('"','""'),a.push(`"${d}"`))}return a.join(",")}).join(`
373
- `),n=i+`
374
- `+o;return new Blob([n],{type:"text/csv;charset=utf-8,"})}getRow(t){return this.idToRowMap.get(t)}findRow(t,e){return this.data.find(r=>k(r,t)===e)}findRowIndex(t,e){let r=this.findRow(t,e);return r?this.rowMetadata.get(r).index:-1}updateRow(t,e){let r=this.idToRowMap.get(t);r&&(Object.assign(r,e),this.requestUpdate("data"))}updateRowAtIndex(t,e){let r=this.data[t];r&&(Object.assign(r,e),this.requestUpdate("data"))}deleteRow(...t){for(let e of t){let r=this.idToRowMap.get(e);if(r){let i=this.rowMetadata.get(r);this.deleteRowAtIndex(i.index)}}}deleteRowAtIndex(...t){let e=new Set(this.selectedRowIds);for(let r of t){let i=this.data[r];if(i){let o=this.rowMetadata.get(i);this.idToRowMap.delete(o.id),this.rowMetadata.delete(i),e.delete(o.id),this.data=this.data.toSpliced(r,1)}}this.selectedRowIds=[...e]}getRowId(t){let e=this.rowMetadata.get(t);if(!e)throw new Error("The provided row does not exist in the current dataset");return e.id}getRowIndex(t){let e=this.rowMetadata.get(t);if(!e)throw new Error("The provided row does not exist in the current dataset");return e.index}getRowHighlightIndicies(t){let e=this.rowMetadata.get(t);if(!e)throw new Error("The provided row does not exist in the current dataset");return e.highlightIndices}dispatchEvent(t){for(let e of this.hosts)e instanceof m&&e.dispatchEvent(t)}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(...t){let e=["columns","columnStates","searchQuery","selectedRowIds"],r=t.filter(i=>e.includes(i));r.length&&(this.scheduleSave(),this.dispatchEvent(new Rt(this.getTableState(),r)));for(let i of this.hosts)i.requestUpdate()}calculateSearchScore(t,e){let r={score:0,ranges:[]};if(!t||!e)return r;let i=0,o=0;if(e===t)o=Le.EXACT,i=t.length,r.ranges.push([0,e.length]);else if(e.startsWith(t))o=Le.PREFIX,i=t.length,r.ranges.push([0,t.length]);else{let a=e.indexOf(t);if(a!==-1){o=Le.SUBSTRING,i=t.length;let c=a;for(;c!==-1;)r.ranges.push([c,c+t.length]),c=e.indexOf(t,c+1)}else return r}let l=1/(1+(e.length-t.length));return r.score=i*o*l,r}searchField(t,e,r){let i={score:0,ranges:[]},o=n=>{let l=e.indexOf(n);for(;l!==-1;)i.ranges.push([l,l+n.length]),l=e.indexOf(n,l+1)};if(t.quoted||!r){if(!this.enableSearchScoring)e.includes(t.value)&&(i.score=1,o(t.value));else{let n=this.calculateSearchScore(t.value,e);i.score=n.score,i.ranges=n.ranges}return i}if(!this.enableSearchScoring)return r.some(l=>l.includes(t.value))&&(i.score=1,o(t.value)),i;for(let n of r){let l=this.calculateSearchScore(t.value,n);l.score>0&&(i.score+=l.score,o(t.value))}return i}filterField(t,e,r=null){return Array.isArray(e)?e.length===0?!0:e.some(i=>this.filterField(t,i,r)):Array.isArray(t)?t.length===0?!1:t.some(i=>this.filterField(i,e,r)):typeof r=="function"?r(t,e):e instanceof RegExp?e.test(String(t)):e===t}filterRow(t,e){if(!this.filters)return!0;if(typeof this.filters=="function")return this.filters(t,e);for(let r in this.filters){let i=k(this.filters,r),o=k(t,r);if(typeof i=="function"){if(!i(o))return!1}else{let n=this.getColumn(r),l=n?n.filter:void 0;if(!this.filterField(o,i,l))return!1}}return!0}filterRows(){let e=[...this.columns].filter(r=>r.searchable).map(r=>r.field);this._filteredData=this.data.filter((r,i)=>{let o=this.rowMetadata.get(r);if(o.searchScore=0,o.highlightIndices={},!this.filterRow(r,i))return!1;if(!this.queryTokens)return!0;for(let n of e){let l=k(r,n),a=o.searchValues[n],c=o.searchTokens[n];if(typeof l!="string"||typeof a!="string")continue;let h={score:0,ranges:[]};for(let d of this.queryTokens){let _=this.searchField(d,a,c);h.score+=_.score,h.ranges.push(..._.ranges)}h.score>0&&(o.searchScore+=h.score,o.highlightIndices[n]=h.ranges)}return o.searchScore>0}),this.filterDirty=!1,this.sortRows(),this.dispatchEvent(new Tt(this.data))}compareRows(t,e,r){let i,o,n=this.getColumnState(r);if(!n.sort)return 0;let l=this.rowMetadata.get(t),a=this.rowMetadata.get(e);return n.sort?.order==="asc"?(i=l.sortValues[r],o=a.sortValues[r]):(i=a.sortValues[r],o=l.sortValues[r]),i??(i=Number.MIN_SAFE_INTEGER),o??(o=Number.MIN_SAFE_INTEGER),i<o?-1:i>o?1:0}sortRows(){if(this.filterDirty){this.filterRows();return}let t=[...this._columnStateMap.values()].filter(e=>e.visible&&e.sort).sort((e,r)=>r.sort.priority-e.sort.priority);this._filteredData=this._filteredData.toSorted((e,r)=>{let i=this.rowMetadata.get(e),o=this.rowMetadata.get(r);if(this.enableSearchScoring&&this.queryTokens){let n=i.searchScore||0,l=o.searchScore||0;if(n>l)return-1;if(n<l)return 1}for(let n of t){let l=this.compareRows(e,r,n.field);if(l!==0)return l}return i.index-o.index}),this.sortDirty=!1}createMetadata(){this.idToRowMap=new Map,this.rowMetadata=new WeakMap;let t=new Map;for(let r of this.columns){let i=this.data.map(o=>{let n=k(o,r.field),l=r.sorter?.(n)??n;return[n,l]});t.set(r.field,Dr(i))}let e=0;for(let r of this.data){let i=this._rowIdCallback(r,e);(i==null||this.idToRowMap.has(i))&&(Ei(e,i,r),i=`__yatl_fallback_id_${e}`),this.idToRowMap.set(i,r);let o={id:i,index:e++,searchTokens:{},searchValues:{},sortValues:{},selected:!1};this.rowMetadata.set(r,o);for(let n of this.columns){let l=k(r,n.field),a=t.get(n.field);if(o.sortValues[n.field]=a.get(l)??null,typeof l=="string"&&(o.searchValues[n.field]=l.toLocaleLowerCase()),n.searchable&&n.tokenize&&l){let c=n.searchTokenizer??this.searchTokenizer;o.searchTokens[n.field]=c(String(l)).map(h=>h.value)}}}}updateInternalQuery(){if(this.searchQuery.length===0){this.queryTokens=null;return}this.queryTokens=[{value:this.searchQuery.toLocaleLowerCase(),quoted:!0}],this.enableSearchTokenization&&this.queryTokens.push(...this.searchTokenizer(this.searchQuery))}scheduleSave(){window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveStateToStorage()},Si)}saveStateToStorage(){if(!this.storageOptions)return;let t={...Vr,...this.storageOptions},e={columns:[]},r=this.getTableState();t.saveSearchQuery&&(e.searchQuery=r.searchQuery),t.saveSelectedRows&&(e.selectedRows=r.selectedRows);for(let o of r.columns){let n={field:o.field};t.saveColumnSortOrders&&(n.sort=o.sort),t.saveColumnVisibility&&(n.visible=o.visible),t.saveColumnWidths&&(n.width=o.width),e.columns?.push(n)}let i=t.storage==="session"?sessionStorage:localStorage;try{i.setItem(t.key,JSON.stringify(e))}catch(o){console.warn("Failed to save table state",o)}}loadStateFromStorage(){if(!this.storageOptions)return;let t={...Vr,...this.storageOptions},e=localStorage.getItem(t.key);if(e)try{let r=JSON.parse(e),i={};if(t.saveSearchQuery&&(i.searchQuery=r.searchQuery),t.saveSelectedRows&&(i.selectedRows=r.selectedRows),r.columns){i.columns=[];for(let o of r.columns){let n={field:o.field};t.saveColumnVisibility&&(n.visible=o.visible),t.saveColumnWidths&&(n.width=o.width),t.saveColumnSortOrders&&(n.sort=o.sort),i.columns.push(n)}}this.updateTableState(i),this.hasRestoredState=!0}catch(r){console.error("Failed to restore DataTable state:",r)}}},Lr=!1;function xi(){Lr||(Lr=!0,console.warn(`[yatl-table] Data rows are missing a unique 'id' or 'key' property.
1
+ "use strict";var yatl=(()=>{var Se=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var li=Object.getOwnPropertyNames;var ai=Object.prototype.hasOwnProperty;var qe=(r,t)=>()=>(r&&(t=r(r=0)),t);var ut=(r,t)=>{for(var e in t)Se(r,e,{get:t[e],enumerable:!0})},ci=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of li(t))!ai.call(r,s)&&s!==e&&Se(r,s,{get:()=>t[s],enumerable:!(i=dt(t,s))||i.enumerable});return r};var hi=r=>ci(Se({},"__esModule",{value:!0}),r),_=(r,t,e,i)=>{for(var s=i>1?void 0:i?dt(t,e):t,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&Se(t,e,s),s};var ye,Kt=qe(()=>{"use strict";ye=class{constructor(t){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,t?.roundAverageSize===!0&&(this._roundAverageSize=!0)}set(t,e){let i=this._map.get(t)||0;this._map.set(t,e),this.totalSize+=e-i}get averageSize(){if(this._map.size>0){let t=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(t):t}return 0}getSize(t){return this._map.get(t)}clear(){this._map.clear(),this.totalSize=0}}});function nt(r){return r==="horizontal"?"width":"height"}var Ve,Wt=qe(()=>{"use strict";Ve=class{_getDefaultConfig(){return{direction:"vertical"}}constructor(t,e){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then(()=>this.config=e||this._getDefaultConfig())}set config(t){Object.assign(this,Object.assign({},this._getDefaultConfig(),t))}get config(){return{direction:this.direction}}get items(){return this._items}set items(t){this._setItems(t)}_setItems(t){t!==this._items&&(this._items=t,this._scheduleReflow())}get direction(){return this._direction}set direction(t){t=t==="horizontal"?t:"vertical",t!==this._direction&&(this._direction=t,this._sizeDim=t==="horizontal"?"width":"height",this._secondarySizeDim=t==="horizontal"?"height":"width",this._positionDim=t==="horizontal"?"left":"top",this._secondaryPositionDim=t==="horizontal"?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(t){let{_viewDim1:e,_viewDim2:i}=this;Object.assign(this._viewportSize,t),i!==this._viewDim2?this._scheduleLayoutUpdate():e!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(t){Object.assign(this._latestCoords,t);let e=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(e-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(t=!1){(t||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(t){this._pin=t,this._triggerReflow()}get pin(){if(this._pin!==null){let{index:t,block:e}=this._pin;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null}_clampScrollPosition(t){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(t,this.totalScrollSize[nt(this.direction)]-this._viewDim1))}unpin(){this._pin!==null&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then(()=>this.reflowIfNeeded())}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(this.pin!==null){let t=this._scrollPosition,{index:e,block:i}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:i||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=t-this._scrollPosition}}_calculateScrollIntoViewPosition(t){let{block:e}=t,i=Math.min(this.items.length,Math.max(0,t.index)),s=this._getItemPosition(i)[this._positionDim],n=s;if(e!=="start"){let o=this._getItemSize(i)[this._sizeDim];if(e==="center")n=s-.5*this._viewDim1+.5*o;else{let l=s-this._viewDim1+o;if(e==="end")n=l;else{let a=this._scrollPosition;n=Math.abs(a-s)<Math.abs(a-l)?s:l}}}return n+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(n)}getScrollIntoViewCoordinates(t){return{[this._positionDim]:this._calculateScrollIntoViewPosition(t)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){let t=new Map;if(this._first!==-1&&this._last!==-1)for(let i=this._first;i<=this._last;i++)t.set(i,this._getItemPosition(i));let e={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:t};this._scrollError&&(e.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(e)}get _num(){return this._first===-1||this._last===-1?0:this._last-this._first+1}_checkThresholds(){if(this._viewDim1===0&&this._num>0||this._pin!==null)this._scheduleReflow();else{let t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>t||this._physicalMax<e?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(t){if(this._first===-1||this._last===-1)return;let e=this._first;for(;e<this._last&&Math.round(this._getItemPosition(e)[this._positionDim]+this._getItemSize(e)[this._sizeDim])<=Math.round(this._scrollPosition);)e++;let i=this._last;for(;i>this._first&&Math.round(this._getItemPosition(i)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)i--;(e!==this._firstVisible||i!==this._lastVisible)&&(this._firstVisible=e,this._lastVisible=i,t&&t.emit&&this._sendVisibilityChangedMessage())}}});var Yt={};ut(Yt,{FlowLayout:()=>Le,flow:()=>Oi});function Qt(r){return r==="horizontal"?"marginLeft":"marginTop"}function ki(r){return r==="horizontal"?"marginRight":"marginBottom"}function Ni(r){return r==="horizontal"?"xOffset":"yOffset"}function Pi(r,t){let e=[r,t].sort();return e[1]<=0?Math.min(...e):e[0]>=0?Math.max(...e):e[0]+e[1]}var Oi,ot,Le,Gt=qe(()=>{"use strict";Kt();Wt();Oi=r=>Object.assign({type:Le},r);ot=class{constructor(){this._childSizeCache=new ye,this._marginSizeCache=new ye,this._metricsCache=new Map}update(t,e){let i=new Set;Object.keys(t).forEach(s=>{let n=Number(s);this._metricsCache.set(n,t[n]),this._childSizeCache.set(n,t[n][nt(e)]),i.add(n),i.add(n+1)});for(let s of i){let n=this._metricsCache.get(s)?.[Qt(e)]||0,o=this._metricsCache.get(s-1)?.[ki(e)]||0;this._marginSizeCache.set(s,Pi(n,o))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(t,e){return this._metricsCache.get(t)?.[Qt(e)]||0}getChildSize(t){return this._childSizeCache.getSize(t)}getMarginSize(t){return this._marginSizeCache.getSize(t)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}},Le=class extends Ve{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new ot,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(t){this._metricsCache.update(t,this.direction),this._scheduleReflow()}_getPhysicalItem(t){return this._newPhysicalItems.get(t)??this._physicalItems.get(t)}_getSize(t){return this._getPhysicalItem(t)&&this._metricsCache.getChildSize(t)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(t){let e=this._metricsCache;if(this._first===-1||this._last===-1)return e.averageMarginSize+t*(e.averageMarginSize+this._getAverageSize());if(t<this._first){let i=this._first-t;return this._getPhysicalItem(this._first).pos-(e.getMarginSize(this._first-1)||e.averageMarginSize)-(i*e.averageChildSize+(i-1)*e.averageMarginSize)}else{let i=t-this._last;return this._getPhysicalItem(this._last).pos+(e.getChildSize(this._last)||e.averageChildSize)+(e.getMarginSize(this._last)||e.averageMarginSize)+i*(e.averageChildSize+e.averageMarginSize)}}_getPosition(t){let e=this._getPhysicalItem(t),{averageMarginSize:i}=this._metricsCache;return t===0?this._metricsCache.getMarginSize(0)??i:e?e.pos:this._estimatePosition(t)}_calculateAnchor(t,e){return t<=0?0:e>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((t+e)/2/this._delta)))}_getAnchor(t,e){if(this._physicalItems.size===0)return this._calculateAnchor(t,e);if(this._first<0)return this._calculateAnchor(t,e);if(this._last<0)return this._calculateAnchor(t,e);let i=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),n=i.pos;if(s.pos+this._metricsCache.getChildSize(this._last)<t)return this._calculateAnchor(t,e);if(n>e)return this._calculateAnchor(t,e);let a=this._firstVisible-1,c=-1/0;for(;c<t;)c=this._getPhysicalItem(++a).pos+this._metricsCache.getChildSize(a);return a}_getActiveItems(){this._viewDim1===0||this.items.length===0?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;let t=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t,this._stable=!0}_getItems(){let t=this._newPhysicalItems;this._stable=!0;let e,i;if(this.pin!==null){let{index:c}=this.pin;this._anchorIdx=c,this._anchorPos=this._getPosition(c)}if(e=this._scrollPosition-this._overhang,i=this._scrollPosition+this._viewDim1+this._overhang,i<0||e>this._scrollSize){this._clearItems();return}(this._anchorIdx===null||this._anchorPos===null)&&(this._anchorIdx=this._getAnchor(e,i),this._anchorPos=this._getPosition(this._anchorIdx));let s=this._getSize(this._anchorIdx);s===void 0&&(this._stable=!1,s=this._getAverageSize());let n=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,o=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;this._anchorIdx===0&&(this._anchorPos=n),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-o-s);let l=0;for(this._anchorPos+s+o<e&&(l=e-(this._anchorPos+s+o)),this._anchorPos-n>i&&(l=i-(this._anchorPos-n)),l&&(this._scrollPosition-=l,e-=l,i-=l,this._scrollError+=l),t.set(this._anchorIdx,{pos:this._anchorPos,size:s}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-n,this._physicalMax=this._anchorPos+s+o;this._physicalMin>e&&this._first>0;){let c=this._getSize(--this._first);c===void 0&&(this._stable=!1,c=this._getAverageSize());let d=this._metricsCache.getMarginSize(this._first);d===void 0&&(this._stable=!1,d=this._metricsCache.averageMarginSize),this._physicalMin-=c;let h=this._physicalMin;if(t.set(this._first,{pos:h,size:c}),this._physicalMin-=d,this._stable===!1&&this._estimate===!1)break}for(;this._physicalMax<i&&this._last<this.items.length-1;){let c=this._getSize(++this._last);c===void 0&&(this._stable=!1,c=this._getAverageSize());let d=this._metricsCache.getMarginSize(this._last);d===void 0&&(this._stable=!1,d=this._metricsCache.averageMarginSize);let h=this._physicalMax;if(t.set(this._last,{pos:h,size:c}),this._physicalMax+=c+d,!this._stable&&!this._estimate)break}let a=this._calculateError();a&&(this._physicalMin-=a,this._physicalMax-=a,this._anchorPos-=a,this._scrollPosition-=a,t.forEach(c=>c.pos-=a),this._scrollError+=a),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t)}_calculateError(){return this._first===0?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){let{_first:t,_last:e}=this;super._reflow(),(this._first===-1&&this._last==-1||this._first===t&&this._last===e)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){let{averageMarginSize:t}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(t+this._getAverageSize())+t)}get _delta(){let{averageMarginSize:t}=this._metricsCache;return this._getAverageSize()+t}_getItemPosition(t){return{[this._positionDim]:this._getPosition(t),[this._secondaryPositionDim]:0,[Ni(this.direction)]:-(this._metricsCache.getLeadingMarginValue(t,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(t){return{[this._sizeDim]:this._getSize(t)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}});var qi={};ut(qi,{TypedEventTarget:()=>le,YatlColumnReorderEvent:()=>te,YatlColumnReorderRequest:()=>ee,YatlColumnResizeEvent:()=>Z,YatlColumnSortEvent:()=>X,YatlColumnSortRequest:()=>G,YatlColumnToggleEvent:()=>J,YatlColumnToggleRequest:()=>Fe,YatlEvent:()=>v,YatlRowClickEvent:()=>W,YatlRowSelectEvent:()=>Y,YatlRowSelectRequest:()=>Q,YatlTable:()=>f,YatlTableController:()=>we,YatlTableSearchEvent:()=>ie,YatlTableStateChangeEvent:()=>re,YatlTableViewChangeEvent:()=>se,createRegexTokenizer:()=>ft,createState:()=>O,findColumn:()=>di,getColumnStateChanges:()=>ne,getNestedValue:()=>S,isDisplayColumn:()=>M,isInternalColumn:()=>ui,isRowIdType:()=>oe,isRowSelectionMethod:()=>Be,setNestedValue:()=>pi,whitespaceTokenizer:()=>Ke});var v=class extends Event{constructor(t,e={}){super(t,{bubbles:!0,composed:!0,cancelable:!1,...e})}},W=class r extends v{constructor(e,i,s,n,o){super(r.EVENT_NAME);this.row=e;this.rowId=i;this.index=s;this.field=n;this.originalEvent=o}static{this.EVENT_NAME="yatl-row-click"}clone(){return new r(this.row,this.rowId,this.index,this.field,this.originalEvent)}},Q=class r extends v{constructor(e,i,s){super(r.EVENT_NAME,{cancelable:!0});this.rowId=e;this.selected=i;this.currentlySelectedRows=s}static{this.EVENT_NAME="yatl-row-select-request"}clone(){return new r(this.rowId,this.selected,this.currentlySelectedRows)}},Y=class r extends v{constructor(e,i){super(r.EVENT_NAME);this.selectedIds=e;this.previouslySelectedRows=i}static{this.EVENT_NAME="yatl-row-select"}clone(){return new r(this.selectedIds,this.previouslySelectedRows)}},G=class r extends v{constructor(e,i,s){super(r.EVENT_NAME,{cancelable:!0});this.field=e;this.order=i;this.multisort=s}static{this.EVENT_NAME="yatl-column-sort-request"}clone(){return new r(this.field,this.order,this.multisort)}},X=class r extends v{constructor(e,i,s){super(r.EVENT_NAME);this.field=e;this.order=i;this.multisort=s}static{this.EVENT_NAME="yatl-column-sort"}clone(){return new r(this.field,this.order,this.multisort)}},Fe=class r extends v{constructor(e,i){super(r.EVENT_NAME,{cancelable:!0});this.field=e;this.visibility=i}static{this.EVENT_NAME="yatl-column-toggle-request"}clone(){return new r(this.field,this.visibility)}},J=class r extends v{constructor(e,i){super(r.EVENT_NAME);this.field=e;this.visible=i}static{this.EVENT_NAME="yatl-column-toggle"}clone(){return new r(this.field,this.visible)}},Z=class r extends v{constructor(e,i){super(r.EVENT_NAME);this.field=e;this.width=i}static{this.EVENT_NAME="yatl-column-resize"}clone(){return new r(this.field,this.width)}},ee=class r extends v{constructor(e,i,s){super(r.EVENT_NAME,{cancelable:!0});this.movedColumn=e;this.originalIndex=i;this.newIndex=s}static{this.EVENT_NAME="yatl-column-reorder-request"}clone(){return new r(this.movedColumn,this.originalIndex,this.newIndex)}},te=class r extends v{constructor(e){super(r.EVENT_NAME);this.order=e}static{this.EVENT_NAME="yatl-column-reorder"}clone(){return new r(this.order)}},ie=class r extends v{constructor(e){super(r.EVENT_NAME);this.query=e}static{this.EVENT_NAME="yatl-table-search"}clone(){return new r(this.query)}},se=class r extends v{constructor(e){super(r.EVENT_NAME);this.data=e}static{this.EVENT_NAME="yatl-table-view-change"}clone(){return new r(this.data)}},re=class r extends v{constructor(e,i){super(r.EVENT_NAME);this.state=e;this.triggers=i}static{this.EVENT_NAME="yatl-table-state-change"}clone(){return new r(this.state,this.triggers)}};function di(r,t){return r.find(e=>e.field===t)}function ui(r){return r?.role==="internal"}function M(r){return r?.role!=="internal"}function O(r,t){return{field:r,visible:t?.visible??!0,width:t?.width??null,sort:t?.sort?{...t.sort}:null}}function ne(r,t){if(r&&r.field!==t.field)throw Error(`attempting to compare states for different fields: ${r.field}, ${t.field}`);let e=[];return r?.visible!==t.visible&&e.push("visible"),r?.width!==t.width&&e.push("width"),(r?.sort!==t.sort||r.sort?.order!==t.sort?.order||r.sort?.priority!==t.sort?.priority)&&e.push("sort"),e}function oe(r){return typeof r=="string"||typeof r=="number"}function Be(r){return r===null||r==="multi"||r==="single"}function pt(r,t){return r in t}function S(r,t){let e=t.split("."),i=r;for(let s of e)if(i&&pt(s,i))i=i[s];else return;return i}function pi(r,t,e){let i=t.split("."),s=i.at(-1);if(!s)throw new Error("Cannot set nested value with empty path");let n=r;for(let o of i.slice(0,-1))if(pt(o,n))n=n[o];else{let l={};Object.assign(n,{[o]:l}),n=l}Object.assign(n,{[s]:e})}var ft=(r="\\S+")=>{let t=new RegExp(`"[^"]*"|${r}`,"g");return e=>(e.match(t)||[]).map(s=>(s=s.toLocaleLowerCase().trim(),s.startsWith('"')&&s.endsWith('"')?{value:s.slice(1,-1),quoted:!0}:{value:s,quoted:!1}))},Ke=ft();var le=class extends EventTarget{addEventListener(t,e,i){super.addEventListener(t,e,i)}removeEventListener(t,e,i){super.removeEventListener(t,e,i)}dispatchEvent(t){return super.dispatchEvent(t)}};var Ee=globalThis,Ce=Ee.ShadowRoot&&(Ee.ShadyCSS===void 0||Ee.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,We=Symbol(),mt=new WeakMap,ae=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==We)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Ce&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=mt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&mt.set(e,t))}return t}toString(){return this.cssText}},_t=r=>new ae(typeof r=="string"?r:r+"",void 0,We),Qe=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((i,s,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new ae(e,r,We)},gt=(r,t)=>{if(Ce)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),s=Ee.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)}},Ye=Ce?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return _t(e)})(r):r;var{is:fi,defineProperty:mi,getOwnPropertyDescriptor:_i,getOwnPropertyNames:gi,getOwnPropertySymbols:bi,getPrototypeOf:yi}=Object,Te=globalThis,bt=Te.trustedTypes,vi=bt?bt.emptyScript:"",wi=Te.reactiveElementPolyfillSupport,ce=(r,t)=>r,he={toAttribute(r,t){switch(t){case Boolean:r=r?vi:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},xe=(r,t)=>!fi(r,t),yt={attribute:!0,type:String,converter:he,reflect:!1,useDefault:!1,hasChanged:xe};Symbol.metadata??=Symbol("metadata"),Te.litPropertyMetadata??=new WeakMap;var $=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=yt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&mi(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){let{get:s,set:n}=_i(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:s,set(o){let l=s?.call(this);n?.call(this,o),this.requestUpdate(t,l,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??yt}static _$Ei(){if(this.hasOwnProperty(ce("elementProperties")))return;let t=yi(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ce("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ce("properties"))){let e=this.properties,i=[...gi(e),...bi(e)];for(let s of i)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let s of i)e.unshift(Ye(s))}else t!==void 0&&e.push(Ye(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return gt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){let n=(i.converter?.toAttribute!==void 0?i.converter:he).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){let i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let n=i.getPropertyOptions(s),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:he;this._$Em=s;let l=o.fromAttribute(e,n.type);this[s]=l??this._$Ej?.get(s)??l,this._$Em=null}}requestUpdate(t,e,i,s=!1,n){if(t!==void 0){let o=this.constructor;if(s===!1&&(n=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??xe)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),n!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,n]of this._$Ep)this[s]=n;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,n]of i){let{wrapped:o}=n,l=this[s];o!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,n,l)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[ce("elementProperties")]=new Map,$[ce("finalized")]=new Map,wi?.({ReactiveElement:$}),(Te.reactiveElementVersions??=[]).push("2.1.2");var Xe=globalThis,vt=r=>r,Re=Xe.trustedTypes,wt=Re?Re.createPolicy("lit-html",{createHTML:r=>r}):void 0,Je="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,Ze="?"+A,Si=`<${Ze}>`,D=document,ue=()=>D.createComment(""),pe=r=>r===null||typeof r!="object"&&typeof r!="function",et=Array.isArray,Rt=r=>et(r)||typeof r?.[Symbol.iterator]=="function",Ge=`[
2
+ \f\r]`,de=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,St=/-->/g,Et=/>/g,N=RegExp(`>|${Ge}(?:([^\\s"'>=/]+)(${Ge}*=${Ge}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ct=/'/g,Tt=/"/g,Mt=/^(?:script|style|textarea|title)$/i,tt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),g=tt(1),es=tt(2),ts=tt(3),w=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),xt=new WeakMap,P=D.createTreeWalker(D,129);function $t(r,t){if(!et(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return wt!==void 0?wt.createHTML(t):t}var At=(r,t)=>{let e=r.length-1,i=[],s,n=t===2?"<svg>":t===3?"<math>":"",o=de;for(let l=0;l<e;l++){let a=r[l],c,d,h=-1,u=0;for(;u<a.length&&(o.lastIndex=u,d=o.exec(a),d!==null);)u=o.lastIndex,o===de?d[1]==="!--"?o=St:d[1]!==void 0?o=Et:d[2]!==void 0?(Mt.test(d[2])&&(s=RegExp("</"+d[2],"g")),o=N):d[3]!==void 0&&(o=N):o===N?d[0]===">"?(o=s??de,h=-1):d[1]===void 0?h=-2:(h=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?N:d[3]==='"'?Tt:Ct):o===Tt||o===Ct?o=N:o===St||o===Et?o=de:(o=N,s=void 0);let m=o===N&&r[l+1].startsWith("/>")?" ":"";n+=o===de?a+Si:h>=0?(i.push(c),a.slice(0,h)+Je+a.slice(h)+A+m):a+A+(h===-2?l:m)}return[$t(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},fe=class r{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0,l=t.length-1,a=this.parts,[c,d]=At(t,e);if(this.el=r.createElement(c,i),P.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=P.nextNode())!==null&&a.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let h of s.getAttributeNames())if(h.endsWith(Je)){let u=d[o++],m=s.getAttribute(h).split(A),y=/([.?@])?(.*)/.exec(u);a.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?$e:y[1]==="?"?Ae:y[1]==="@"?ze:L}),s.removeAttribute(h)}else h.startsWith(A)&&(a.push({type:6,index:n}),s.removeAttribute(h));if(Mt.test(s.tagName)){let h=s.textContent.split(A),u=h.length-1;if(u>0){s.textContent=Re?Re.emptyScript:"";for(let m=0;m<u;m++)s.append(h[m],ue()),P.nextNode(),a.push({type:2,index:++n});s.append(h[u],ue())}}}else if(s.nodeType===8)if(s.data===Ze)a.push({type:2,index:n});else{let h=-1;for(;(h=s.data.indexOf(A,h+1))!==-1;)a.push({type:7,index:n}),h+=A.length-1}n++}}static createElement(t,e){let i=D.createElement("template");return i.innerHTML=t,i}};function V(r,t,e=r,i){if(t===w)return t;let s=i!==void 0?e._$Co?.[i]:e._$Cl,n=pe(t)?void 0:t._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,i)),i!==void 0?(e._$Co??=[])[i]=s:e._$Cl=s),s!==void 0&&(t=V(r,s._$AS(r,t.values),s,i)),t}var Me=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??D).importNode(e,!0);P.currentNode=s;let n=P.nextNode(),o=0,l=0,a=i[0];for(;a!==void 0;){if(o===a.index){let c;a.type===2?c=new j(n,n.nextSibling,this,t):a.type===1?c=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(c=new Ie(n,this,t)),this._$AV.push(c),a=i[++l]}o!==a?.index&&(n=P.nextNode(),o++)}return P.currentNode=D,s}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},j=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=V(this,t,e),pe(t)?t===b||t==null||t===""?(this._$AH!==b&&this._$AR(),this._$AH=b):t!==this._$AH&&t!==w&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Rt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==b&&pe(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=fe.createElement($t(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{let n=new Me(s,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(t){let e=xt.get(t.strings);return e===void 0&&xt.set(t.strings,e=new fe(t)),e}k(t){et(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,s=0;for(let n of t)s===e.length?e.push(i=new r(this.O(ue()),this.O(ue()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=vt(t).nextSibling;vt(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},L=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,n){this.type=1,this._$AH=b,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=b}_$AI(t,e=this,i,s){let n=this.strings,o=!1;if(n===void 0)t=V(this,t,e,0),o=!pe(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else{let l=t,a,c;for(t=n[0],a=0;a<n.length-1;a++)c=V(this,l[i+a],e,a),c===w&&(c=this._$AH[a]),o||=!pe(c)||c!==this._$AH[a],c===b?t=b:t!==b&&(t+=(c??"")+n[a+1]),this._$AH[a]=c}o&&!s&&this.j(t)}j(t){t===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},$e=class extends L{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===b?void 0:t}},Ae=class extends L{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==b)}},ze=class extends L{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=V(this,t,e,0)??b)===w)return;let i=this._$AH,s=t===b&&i!==b||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==b&&(i===b||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ie=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t)}},zt={M:Je,P:A,A:Ze,C:1,L:At,R:Me,D:Rt,V,I:j,H:L,N:Ae,U:ze,B:$e,F:Ie},Ei=Xe.litHtmlPolyfillSupport;Ei?.(fe,j),(Xe.litHtmlVersions??=[]).push("3.3.2");var It=(r,t,e)=>{let i=e?.renderBefore??t,s=i._$litPart$;if(s===void 0){let n=e?.renderBefore??null;i._$litPart$=s=new j(t.insertBefore(ue(),n),n,void 0,e??{})}return s._$AI(r),s};var it=globalThis,C=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=It(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return w}};C._$litElement$=!0,C.finalized=!0,it.litElementHydrateSupport?.({LitElement:C});var Ci=it.litElementPolyfillSupport;Ci?.({LitElement:C});(it.litElementVersions??=[]).push("4.2.2");function Ot(r,t){if(!r||!t||t.length===0)return r;let e=[...t].sort((l,a)=>l[0]-a[0]),i=[],s=e[0];for(let l=1;l<e.length;l++){let a=e[l];a[0]<s[1]?s[1]=Math.max(s[1],a[1]):(i.push(s),s=a)}i.push(s);let n=[],o=0;for(let[l,a]of i){let c=Math.max(0,Math.min(l,r.length)),d=Math.max(0,Math.min(a,r.length));c>o&&n.push(r.slice(o,c)),n.push(g`<mark class="highlight">${r.slice(c,d)}</mark>`),o=d}return o<r.length&&n.push(r.slice(o)),g`${n}`}var kt=r=>r.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase());var Nt=r=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(r,t)}):customElements.define(r,t)};var Ti={attribute:!0,type:String,converter:he,reflect:!1,hasChanged:xe},xi=(r=Ti,t,e)=>{let{kind:i,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),i==="setter"&&((r=Object.create(r)).wrapped=!0),n.set(e.name,r),i==="accessor"){let{name:o}=e;return{set(l){let a=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,a,r,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,r,l),l}}}if(i==="setter"){let{name:o}=e;return function(l){let a=this[o];t.call(this,l),this.requestUpdate(o,a,r,!0,l)}}throw Error("Unsupported decorator location: "+i)};function p(r){return(t,e)=>typeof e=="object"?xi(r,t,e):((i,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,i),o?Object.getOwnPropertyDescriptor(s,n):void 0})(r,t,e)}function Pt(r){return p({...r,state:!0,attribute:!1})}var U=(r,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(r,t,e),e);function st(r,t){return(e,i,s)=>{let n=o=>o.renderRoot?.querySelector(r)??null;if(t){let{get:o,set:l}=typeof i=="object"?e:s??(()=>{let a=Symbol();return{get(){return this[a]},set(c){this[a]=c}}})();return U(e,i,{get(){let a=o.call(this);return a===void 0&&(a=n(this),(a!==null||this.hasUpdated)&&l.call(this,a)),a}})}return U(e,i,{get(){return n(this)}})}}var x={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},z=r=>(...t)=>({_$litDirective$:r,values:t}),T=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var me=z(class extends T{constructor(r){if(super(r),r.type!==x.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(t=>r[t]).join(" ")+" "}update(r,[t]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let e=r.element.classList;for(let i of this.st)i in t||(e.remove(i),this.st.delete(i));for(let i in t){let s=!!t[i];s===this.st.has(i)||this.nt?.has(i)||(s?(e.add(i),this.st.add(i)):(e.remove(i),this.st.delete(i)))}return w}});var _e=r=>r??b;var{I:Ri}=zt,Dt=r=>r;var Lt=r=>r.strings===void 0,Vt=()=>document.createComment(""),H=(r,t,e)=>{let i=r._$AA.parentNode,s=t===void 0?r._$AB:t._$AA;if(e===void 0){let n=i.insertBefore(Vt(),s),o=i.insertBefore(Vt(),s);e=new Ri(n,o,r,r.options)}else{let n=e._$AB.nextSibling,o=e._$AM,l=o!==r;if(l){let a;e._$AQ?.(r),e._$AM=r,e._$AP!==void 0&&(a=r._$AU)!==o._$AU&&e._$AP(a)}if(n!==s||l){let a=e._$AA;for(;a!==n;){let c=Dt(a).nextSibling;Dt(i).insertBefore(a,s),a=c}}}return e},k=(r,t,e=r)=>(r._$AI(t,e),r),Mi={},Ut=(r,t=Mi)=>r._$AH=t,jt=r=>r._$AH,Oe=r=>{r._$AR(),r._$AA.remove()};var Ht=(r,t,e)=>{let i=new Map;for(let s=t;s<=e;s++)i.set(r[s],s);return i},ke=z(class extends T{constructor(r){if(super(r),r.type!==x.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let s=[],n=[],o=0;for(let l of r)s[o]=i?i(l,o):o,n[o]=e(l,o),o++;return{values:n,keys:s}}render(r,t,e){return this.dt(r,t,e).values}update(r,[t,e,i]){let s=jt(r),{values:n,keys:o}=this.dt(t,e,i);if(!Array.isArray(s))return this.ut=o,n;let l=this.ut??=[],a=[],c,d,h=0,u=s.length-1,m=0,y=n.length-1;for(;h<=u&&m<=y;)if(s[h]===null)h++;else if(s[u]===null)u--;else if(l[h]===o[m])a[m]=k(s[h],n[m]),h++,m++;else if(l[u]===o[y])a[y]=k(s[u],n[y]),u--,y--;else if(l[h]===o[y])a[y]=k(s[h],n[y]),H(r,a[y+1],s[h]),h++,y--;else if(l[u]===o[m])a[m]=k(s[u],n[m]),H(r,s[h],s[u]),u--,m++;else if(c===void 0&&(c=Ht(o,m,y),d=Ht(l,h,u)),c.has(l[h]))if(c.has(l[u])){let E=d.get(o[m]),K=E!==void 0?s[E]:null;if(K===null){let R=H(r,s[h]);k(R,n[m]),a[m]=R}else a[m]=k(K,n[m]),H(r,s[h],K),s[E]=null;m++}else Oe(s[u]),u--;else Oe(s[h]),h++;for(;m<=y;){let E=H(r,a[y+1]);k(E,n[m]),a[m++]=E}for(;h<=u;){let E=s[h++];E!==null&&Oe(E)}return this.ut=o,Ut(r,a),w}});var qt="important",$i=" !"+qt,Ft=z(class extends T{constructor(r){if(super(r),r.type!==x.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((t,e)=>{let i=r[e];return i==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(r,[t]){let{style:e}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let i of this.ft)t[i]==null&&(this.ft.delete(i),i.includes("-")?e.removeProperty(i):e[i]=null);for(let i in t){let s=t[i];if(s!=null){this.ft.add(i);let n=typeof s=="string"&&s.endsWith($i);i.includes("-")||n?e.setProperty(i,n?s.slice(0,-11):s,n?qt:""):e[i]=s}}return w}});function q(r,t,e,i){var s=arguments.length,n=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,e,i);else for(var l=r.length-1;l>=0;l--)(o=r[l])&&(n=(s<3?o(n):s>3?o(t,e,n):o(t,e))||n);return s>3&&n&&Object.defineProperty(t,e,n),n}var ge=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),ge(i,t);return!0},Ne=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},Bt=r=>{for(let t;t=r._$AM;r=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(r))break;e.add(r),Ii(t)}};function Ai(r){this._$AN!==void 0?(Ne(this),this._$AM=r,Bt(this)):this._$AM=r}function zi(r,t=!1,e=0){let i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(i))for(let n=e;n<i.length;n++)ge(i[n],!1),Ne(i[n]);else i!=null&&(ge(i,!1),Ne(i));else ge(this,r)}var Ii=r=>{r.type==x.CHILD&&(r._$AP??=zi,r._$AQ??=Ai)},Pe=class extends T{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Bt(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ge(this,t),Ne(this))}setValue(t){if(Lt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var F=class r extends Event{constructor(t){super(r.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}};F.eventName="rangeChanged";var B=class r extends Event{constructor(t){super(r.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}};B.eventName="visibilityChanged";var be=class r extends Event{constructor(){super(r.eventName,{bubbles:!1})}};be.eventName="unpinned";var rt=class{constructor(t){this._element=null;let e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}},De=class extends rt{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.__destination=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);let i=this._node;this._originalScrollTo=i.scrollTo,this._originalScrollBy=i.scrollBy,this._originalScroll=i.scroll,this._attach(t)}get _destination(){return this.__destination}get scrolling(){return this._destination!==null}scrollTo(t,e){let i=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;this._scrollTo(i)}scrollBy(t,e){let i=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;i.top!==void 0&&(i.top+=this.scrollTop),i.left!==void 0&&(i.left+=this.scrollLeft),this._scrollTo(i)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,i=null){this._end!==null&&this._end(),t.behavior==="smooth"?(this._setDestination(t),this._retarget=e,this._end=i):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:i}=t;return e=e===void 0?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),i=i===void 0?void 0:Math.max(0,Math.min(i,this.maxScrollLeft)),this._destination!==null&&i===this._destination.left&&e===this._destination.top?!1:(this.__destination={top:e,left:i,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,i){return this._scrollTo(t,e,i),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(this._destination!==null){let{scrollTop:t,scrollLeft:e}=this,{top:i,left:s}=this._destination;i=Math.min(i||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);let n=Math.abs(i-t),o=Math.abs(s-e);n<1&&o<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),this._clients.size===0&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),this._clients.size===1&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}};var Xt=typeof window<"u"?window.ResizeObserver:void 0;var ve=Symbol("virtualizerRef"),Ue="virtualizer-sizer",Jt,He=class{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(t.hostElement)this._init(t);else throw new Error('Virtualizer configuration requires the "hostElement" property')}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);let e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new Xt(()=>this._hostElementSizeChanged()),this._childrenRO=new Xt(this._childrenSizeChanged.bind(this))}_initHostElement(t){let e=this._hostElement=t.hostElement;this._applyVirtualizerStyles(),e[ve]=this}connected(){this._initObservers();let t=this._isScroller;this._clippingAncestors=Li(this._hostElement,t),this._scrollerController=new De(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){let e=this._hostElement.style;e.display=e.display||"block",e.position=e.position||"relative",e.contain=e.contain||"size layout",this._isScroller&&(e.overflow=e.overflow||"auto",e.minHeight=e.minHeight||"150px")}_getSizer(){let t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${Ue}]`);e||(e=document.createElement("div"),e.setAttribute(Ue,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent="&nbsp;",e.setAttribute(Ue,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;let e=t.type||Jt;if(typeof e=="function"&&this._layout instanceof e){let i={...t};return delete i.type,this._layout.config=i,!0}return!1}async _initLayout(t){let e,i;if(typeof t.type=="function"){i=t.type;let s={...t};delete s.type,e=s}else e=t;i===void 0&&(Jt=i=(await Promise.resolve().then(()=>(Gt(),Yt))).FlowLayout),this._layout=new i(s=>this._handleLayoutMessage(s),e),this._layout.measureChildren&&typeof this._layout.updateItemSizes=="function"&&(typeof this._layout.measureChildren=="function"&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){this._benchmarkStart===null&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(this._benchmarkStart!==null){let t=window.performance.now(),e=t-this._benchmarkStart,s=performance.getEntriesByName("uv-virtualizing","measure").filter(n=>n.startTime>=this._benchmarkStart&&n.startTime<t).reduce((n,o)=>n+o.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:s}}return null}_measureChildren(){let t={},e=this._children,i=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){let n=e[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(n))&&(t[o]=i.call(this,n,this._items[o]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){let{width:e,height:i}=t.getBoundingClientRect();return Object.assign({width:e,height:i},Di(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;let{_rangeChanged:e,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),this._childMeasurements!==null&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(t){t.type==="scroll"?(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent():console.warn("event not handled",t)}_handleLayoutMessage(t){t.type==="stateChanged"?this._updateDOM(t):t.type==="visibilityChanged"?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):t.type==="unpinned"&&this._hostElement.dispatchEvent(new be)}get _children(){let t=[],e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(Ue)||t.push(e),e=e.nextElementSibling;return t}_updateView(){let t=this._hostElement,e=this._scrollerController?.element,i=this._layout;if(t&&e&&i){let s,n,o,l,a=t.getBoundingClientRect();s=0,n=0,o=window.innerHeight,l=window.innerWidth;let c=this._clippingAncestors.map(R=>R.getBoundingClientRect());c.unshift(a);for(let R of c)s=Math.max(s,R.top),n=Math.max(n,R.left),o=Math.min(o,R.bottom),l=Math.min(l,R.right);let d=e.getBoundingClientRect(),h={left:a.left-d.left,top:a.top-d.top},u={width:e.scrollWidth,height:e.scrollHeight},m=s-a.top+t.scrollTop,y=n-a.left+t.scrollLeft,E=Math.max(0,o-s),K=Math.max(0,l-n);i.viewportSize={width:K,height:E},i.viewportScroll={top:m,left:y},i.totalScrollSize=u,i.offsetWithinScroller=h}}_sizeHostElement(t){let i=t&&t.width!==null?Math.min(82e5,t.width):0,s=t&&t.height!==null?Math.min(82e5,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${s}px)`;else{let n=this._hostElement.style;n.minWidth=i?`${i}px`:"100%",n.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:e,left:i,width:s,height:n,xOffset:o,yOffset:l},a)=>{let c=this._children[a-this._first];c&&(c.style.position="absolute",c.style.boxSizing="border-box",c.style.transform=`translate(${i}px, ${e}px)`,s!==void 0&&(c.style.width=s+"px"),n!==void 0&&(c.style.height=n+"px"),c.style.left=o===void 0?null:o+"px",c.style.top=l===void 0?null:l+"px")})}async _adjustRange(t){let{_first:e,_last:i,_firstVisible:s,_lastVisible:n}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==n}_correctScrollError(){if(this._scrollError){let{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:i,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-i,left:e-s})}}element(t){return t===1/0&&(t=this._items.length-1),this._items?.[t]===void 0?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),t.behavior==="smooth"){let e=this._layout.getScrollIntoViewCoordinates(t),{behavior:i}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:i}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){let{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new F({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new B({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&this._pendingLayoutComplete===null&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){this._layoutCompleteResolver!==null&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(let e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}};function Di(r){let t=window.getComputedStyle(r);return{marginTop:je(t.marginTop),marginRight:je(t.marginRight),marginBottom:je(t.marginBottom),marginLeft:je(t.marginLeft)}}function je(r){let t=r?parseFloat(r):NaN;return Number.isNaN(t)?0:t}function Zt(r){if(r.assignedSlot!==null)return r.assignedSlot;if(r.parentElement!==null)return r.parentElement;let t=r.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}function Vi(r,t=!1){let e=[],i=t?r:Zt(r);for(;i!==null;)e.push(i),i=Zt(i);return e}function Li(r,t=!1){let e=!1;return Vi(r,t).filter(i=>{if(e)return!1;let s=getComputedStyle(i);return e=s.position==="fixed",s.overflow!=="visible"})}var at=r=>r,ct=(r,t)=>g`${t}: ${JSON.stringify(r,null,2)}`,lt=class extends Pe{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(e,i)=>ct(e,i+this._first),this._keyFunction=(e,i)=>at(e,i+this._first),this._items=[],t.type!==x.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);let e=[];if(this._first>=0&&this._last>=this._first)for(let i=this._first;i<=this._last;i++)e.push(this._items[i]);return ke(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);let i=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),i?w:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){let s=t.parentNode;this._makeVirtualizer(s,e)}this._virtualizer.items=this._items}_setFunctions(t){let{renderItem:e,keyFunction:i}=t;e&&(this._renderItem=(s,n)=>e(s,n+this._first)),i&&(this._keyFunction=(s,n)=>i(s,n+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();let{layout:i,scroller:s,items:n}=e;this._virtualizer=new He({hostElement:t,layout:i,scroller:s}),this._virtualizer.items=n,this._virtualizer.connected()}_initialize(t,e){let i=t.parentNode;i&&i.nodeType===1&&(i.addEventListener("rangeChanged",s=>{this._first=s.first,this._last=s.last,this.setValue(this.render())}),this._makeVirtualizer(i,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}},ei=z(lt);var I=class extends C{constructor(){super(...arguments),this.items=[],this.renderItem=ct,this.keyFunction=at,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){let{items:t,renderItem:e,keyFunction:i,layout:s,scroller:n}=this;return g`${ei({items:t,renderItem:e,keyFunction:i,layout:s,scroller:n})}`}element(t){return this[ve]?.element(t)}get layoutComplete(){return this[ve]?.layoutComplete}scrollToIndex(t,e="start"){this.element(t)?.scrollIntoView({block:e})}};q([p({attribute:!1})],I.prototype,"items",void 0);q([p()],I.prototype,"renderItem",void 0);q([p()],I.prototype,"keyFunction",void 0);q([p({attribute:!1})],I.prototype,"layout",void 0);q([p({reflect:!0,type:Boolean})],I.prototype,"scroller",void 0);customElements.define("lit-virtualizer",I);function ti(r){return typeof r=="string"||typeof r=="number"||typeof r=="bigint"?r:typeof r=="boolean"?Number(r):r instanceof Date?r.getTime():String(r)}function ii(r,t){let e=Array.from(new Set(r)),i=new Intl.Collator(t,{numeric:!0,sensitivity:"base"});e.sort(([n,o],[l,a])=>{if(o==null&&a==null)return 0;if(o==null)return-1;if(o==null)return 1;let c=ti(o),d=ti(a);return typeof c=="string"&&typeof d=="string"?i.compare(String(c),String(d)):c<d?-1:d<c?1:0});let s=new Map;return e.forEach(([n,o],l)=>s.set(n,l)),s}var Ui=1e3,si={storage:"local",saveColumnSortOrders:!0,saveColumnVisibility:!0,saveColumnWidths:!0,saveColumnOrder:!0,saveSelectedRows:!0},ht={EXACT:100,PREFIX:50,SUBSTRING:10},we=class extends le{constructor(e,i){super();this.hosts=new Set;this._enableSearchTokenization=!1;this._enableSearchScoring=!1;this._columns=[];this._columnDefinitionMap=new Map;this._columnStateMap=new Map;this._rowSelectionMethod=null;this._selectedRowIds=new Set;this._storageOptions=null;this._rowIdCallback=(e,i)=>"id"in e&&oe(e.id)?e.id:"key"in e&&oe(e.key)?e.key:"_id"in e&&oe(e._id)?e._id:(ji(),i);this._data=[];this._filteredData=[];this._dataUpdateTimestamp=null;this._searchQuery="";this._searchTokenizer=Ke;this._filters=null;this.hasRestoredState=!1;this.saveTimer=0;this.filterDirty=!1;this.sortDirty=!1;this.rowMetadata=new WeakMap;this.idToRowMap=new Map;this.queryTokens=null;e&&this.attach(e),i&&(i.enableSearchScoring!==void 0&&(this.enableSearchScoring=i.enableSearchScoring),i.enableSearchTokenization!==void 0&&(this.enableSearchTokenization=i.enableSearchTokenization),i.searchTokenizer!==void 0&&(this.searchTokenizer=i.searchTokenizer),i.rowIdCallback!==void 0&&(this.rowIdCallback=i.rowIdCallback),i.rowSelectionMethod!==void 0&&(this.rowSelectionMethod=i.rowSelectionMethod),i.storageOptions!==void 0&&(this.storageOptions=i.storageOptions),i.columns!==void 0&&(this.columns=i.columns),i.data!==void 0&&(this.data=i.data))}get enableSearchTokenization(){return this._enableSearchTokenization}set enableSearchTokenization(e){this._enableSearchTokenization!==e&&(this._enableSearchTokenization=e,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("enableSearchTokenization"))}get enableSearchScoring(){return this._enableSearchScoring}set enableSearchScoring(e){this._enableSearchScoring!==e&&(this._enableSearchScoring=e,this.filterDirty=!0,this.requestUpdate("enableSearchScoring"))}get columns(){return[...this._columns]}set columns(e){this._columns=[...e],this.filterDirty=!0,this._columnDefinitionMap=new Map;for(let i of e)this._columnDefinitionMap.set(i.field,i);this.requestUpdate("columns")}get displayColumns(){return this.columns.filter(M)}get columnStates(){return this.columns.map(e=>{let i=this.getColumnState(e.field);return O(e.field,i)})}set columnStates(e){let i=!1;for(let s of e){let n=this.getColumnState(s.field),o=ne(n,s);if(o.length){i=!0,o.includes("sort")&&(this.sortDirty=!0);let l=O(s.field,s);this._columnStateMap.set(s.field,l)}}i&&this.requestUpdate("columnStates")}get searchQuery(){return this._searchQuery}set searchQuery(e){this._searchQuery!==e&&(this._searchQuery=e,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("searchQuery"))}get searchTokenizer(){return this._searchTokenizer}set searchTokenizer(e){this._searchTokenizer!==e&&(this._searchTokenizer=e,this.filterDirty=!0,this.requestUpdate("searchTokenizer"))}get filters(){return this._filters}set filters(e){this._filters!==e&&(this._filters=e,this.filterDirty=!0,this.requestUpdate("filters"))}get rowSelectionMethod(){return this._rowSelectionMethod}set rowSelectionMethod(e){this._rowSelectionMethod===e||!Be(e)||(this._rowSelectionMethod=e,this.requestUpdate("rowSelectionMethod"))}get selectedRowIds(){let e=[...this._selectedRowIds];return this.rowSelectionMethod==="single"?e=e.slice(0,1):this.rowSelectionMethod||(e=[]),e}set selectedRowIds(e){e.length===this._selectedRowIds.size&&e.every(i=>this._selectedRowIds.has(i))||(this._selectedRowIds=new Set(e),this.requestUpdate("selectedRowIds"))}get storageOptions(){return this._storageOptions?{...this._storageOptions}:null}set storageOptions(e){this._storageOptions!==e&&(this._storageOptions=e?{...e}:null,this.hasRestoredState||(this.loadStateFromStorage(),this.requestUpdate("storageOptions")))}get rowIdCallback(){return this._rowIdCallback}set rowIdCallback(e){if(this._rowIdCallback!==e){this._rowIdCallback=e;for(let i=0;i<this.data.length;++i){let s=this.data[i];this.rowMetadata.get(s).id=this._rowIdCallback(s,i)}this.requestUpdate("rowIdCallback")}}get data(){return[...this._data]}set data(e){this._data=[...e],this.createMetadata(),this._dataUpdateTimestamp=new Date,this.filterDirty=!0,this.requestUpdate("data")}get filteredData(){return this.filterDirty?this.filterRows():this.sortDirty&&this.sortRows(),this.filterDirty=!1,this.sortDirty=!1,[...this._filteredData]}get dataUpdateTimestamp(){return this._dataUpdateTimestamp}attach(e){this.hosts.add(e),e.addController(this),e.requestUpdate()}detach(e){e.removeController(this),this.hosts.delete(e)}getColumn(e){return this._columnDefinitionMap.get(e)}getDisplayColumn(e){let i=this._columnDefinitionMap.get(e);if(M(i))return i}getTableState(){return{searchQuery:this.searchQuery,selectedRows:this.selectedRowIds,columns:this.columnStates.map(e=>{let i=this.getColumnState(e.field);return O(e.field,i)})}}updateTableState(e){if("searchQuery"in e&&e.searchQuery!==void 0&&(this.searchQuery=e.searchQuery),"selectedRows"in e&&e.selectedRows&&(this.selectedRowIds=e.selectedRows),"columns"in e&&e.columns!==void 0)for(let i of e.columns)this.updateColumnState(i.field,i);this.requestUpdate()}getColumnState(e){let i=this._columnStateMap.get(e);if(!i){let s=O(e);return this._columnStateMap.set(e,s),s}return O(e,i)}updateColumnState(e,i){let s=this._columnStateMap.get(e),n=O(e,{...s,...i});this.columnStates=[n]}search(e){this.searchQuery=e,this.dispatchEvent(new ie(e))}getColumnFilterValues(e,i=!1){let s=this.getDisplayColumn(e),n=new Map;for(let o of this.filteredData){let l=S(o,e);if(s?.valueFormatter&&(l=s.valueFormatter(l,o)),l!=null||i){let a=n.get(l)??0;n.set(l,a+1)}}return n}sort(e,i,s=!0){let n=this.getColumnState(e);if(n===void 0)throw new Error(`Cannot get options for non-existent column "${e}"`);if(i===n?.sort?.order)return;if(i&&!n.sort){let a=[...this._columnStateMap.values()].map(h=>h.sort?.priority).filter(h=>h!==void 0),c=this.columns.length+1,d=Math.min(c,...a)-1;n.sort={order:i,priority:d}}else i&&n.sort?n.sort.order=i:n.sort=null;let o=[n];if(s){for(let a of this.columns)if(a.field!==e){let c=this.getColumnState(a.field);c.sort=null,o.push(c)}}this.columnStates=o;let l=new X(e,i,!s);this.dispatchEvent(l)}toggleColumnVisibility(e,i){let s=this.getColumnState(e),n=i!==void 0?i:!s.visible;if(n===s.visible)return;s.visible=n,this.columnStates=[s];let o=new J(e,n);this.dispatchEvent(o)}showColumn(e){this.toggleColumnVisibility(e,!0)}hideColumn(e){this.toggleColumnVisibility(e,!1)}moveColumn(e,i){let s=this.displayColumns,n=s.findIndex(l=>l.field===e),o=typeof i=="number"?i:s.findIndex(l=>l.field===i);if(n>-1&&o>-1){let[l]=s.splice(n,1);s.splice(o,0,l),this.columns=s;let a=new te(s.map(c=>c.field));this.dispatchEvent(a)}}resizeColumn(e,i){let s=this.getColumnState(e);s.width=i,this.updateColumnState(e,s),this.dispatchEvent(new Z(e,i))}isRowSelected(e){let i=this.getRowId(e);return this.selectedRowIds.includes(i)}toggleRowSelection(e,i){let s=this.getRowId(e),n=this.isRowSelected(e),o=i!==void 0?i:n;if(o===n)return;let l;o?l=this.rowSelectionMethod==="single"?[s]:[...this.selectedRowIds,s]:l=this.selectedRowIds.filter(d=>d!==s);let a=this.selectedRowIds;this.selectedRowIds=l;let c=new Y(l,a);this.dispatchEvent(c)}selectRow(e){this.toggleRowSelection(e,!0)}deselectRow(e){this.toggleRowSelection(e,!1)}selectAll(){if(this.rowSelectionMethod==="single")return;let e=this.filteredData.map(i=>this.getRowId(i));this.selectedRowIds=e}deselectAll(){this.selectedRowIds=[]}export(e={includeAllRows:!1,includeHiddenColumns:!1,includeInternalColumns:!1}){let i=e.includeAllRows?this.data:this.filteredData,s=e.includeInternalColumns?this.columns:this.displayColumns,n=s.filter(a=>e.includeHiddenColumns?!0:this.getColumnState(a.field).visible).map(a=>M(a)?a.title:a.field).join(","),o=i.map(a=>{let c=[];for(let d of s){let h=this.getColumnState(d.field),u=S(a,d.field);(e.includeHiddenColumns||h.visible)&&(M(d)&&typeof d.valueFormatter=="function"&&(u=d.valueFormatter(u,a)),u=String(u).replace('"','""'),c.push(`"${u}"`))}return c.join(",")}).join(`
4
+ `),l=n+`
5
+ `+o;return new Blob([l],{type:"text/csv;charset=utf-8,"})}getRow(e){return this.idToRowMap.get(e)}findRow(e,i){return this.data.find(s=>S(s,e)===i)}findRowIndex(e,i){let s=this.findRow(e,i);return s?this.rowMetadata.get(s).index:-1}updateRow(e,i){let s=this.idToRowMap.get(e);s&&(Object.assign(s,i),this.requestUpdate("data"))}updateRowAtIndex(e,i){let s=this.data[e];s&&(Object.assign(s,i),this.requestUpdate("data"))}deleteRow(...e){for(let i of e){let s=this.idToRowMap.get(i);if(s){let n=this.rowMetadata.get(s);this.deleteRowAtIndex(n.index)}}}deleteRowAtIndex(...e){let i=new Set(this.selectedRowIds);for(let s of e){let n=this.data[s];if(n){let o=this.rowMetadata.get(n);this.idToRowMap.delete(o.id),this.rowMetadata.delete(n),i.delete(o.id),this.data=this.data.toSpliced(s,1)}}this.selectedRowIds=[...i]}getRowId(e){let i=this.rowMetadata.get(e);if(!i)throw new Error("The provided row does not exist in the current dataset");return i.id}getRowIndex(e){let i=this.rowMetadata.get(e);if(!i)throw new Error("The provided row does not exist in the current dataset");return i.index}getRowHighlightIndicies(e){let i=this.rowMetadata.get(e);if(!i)throw new Error("The provided row does not exist in the current dataset");return i.highlightIndices}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(...e){let i=["columns","columnStates","searchQuery","selectedRowIds"],s=e.filter(n=>i.includes(n));s.length&&(this.scheduleSave(),this.dispatchEvent(new re(this.getTableState(),s)));for(let n of this.hosts)n.requestUpdate()}calculateSearchScore(e,i){let s={score:0,ranges:[]};if(!e||!i)return s;let n=0,o=0;if(i===e)o=ht.EXACT,n=e.length,s.ranges.push([0,i.length]);else if(i.startsWith(e))o=ht.PREFIX,n=e.length,s.ranges.push([0,e.length]);else{let c=i.indexOf(e);if(c!==-1){o=ht.SUBSTRING,n=e.length;let d=c;for(;d!==-1;)s.ranges.push([d,d+e.length]),d=i.indexOf(e,d+1)}else return s}let a=1/(1+(i.length-e.length));return s.score=n*o*a,s}searchField(e,i,s){let n={score:0,ranges:[]},o=l=>{let a=i.indexOf(l);for(;a!==-1;)n.ranges.push([a,a+l.length]),a=i.indexOf(l,a+1)};if(e.quoted||!s){if(!this.enableSearchScoring)i.includes(e.value)&&(n.score=1,o(e.value));else{let l=this.calculateSearchScore(e.value,i);n.score=l.score,n.ranges=l.ranges}return n}if(!this.enableSearchScoring)return s.some(a=>a.includes(e.value))&&(n.score=1,o(e.value)),n;for(let l of s){let a=this.calculateSearchScore(e.value,l);a.score>0&&(n.score+=a.score,o(e.value))}return n}filterField(e,i,s=null){return Array.isArray(i)?i.length===0?!0:i.some(n=>this.filterField(e,n,s)):Array.isArray(e)?e.length===0?!1:e.some(n=>this.filterField(n,i,s)):typeof s=="function"?s(e,i):i instanceof RegExp?i.test(String(e)):i===e}filterRow(e,i){if(!this.filters)return!0;if(typeof this.filters=="function")return this.filters(e,i);for(let s in this.filters){let n=S(this.filters,s),o=S(e,s);if(typeof n=="function"){if(!n(o))return!1}else if(n!==void 0){let l=this.getColumn(s),a=l?l.filter:void 0;if(!this.filterField(o,n,a))return!1}}return!0}filterRows(){let i=[...this.columns].filter(s=>s.searchable).map(s=>s.field);this._filteredData=this.data.filter((s,n)=>{let o=this.rowMetadata.get(s);if(o.searchScore=0,o.highlightIndices={},!this.filterRow(s,n))return!1;if(!this.queryTokens)return!0;for(let l of i){let a=S(s,l),c=o.searchValues[l],d=o.searchTokens[l];if(typeof a!="string"||typeof c!="string")continue;let h={score:0,ranges:[]};for(let u of this.queryTokens){let m=this.searchField(u,c,d);h.score+=m.score,h.ranges.push(...m.ranges)}h.score>0&&(o.searchScore+=h.score,o.highlightIndices[l]=h.ranges)}return o.searchScore>0}),this.filterDirty=!1,this.sortRows(),this.dispatchEvent(new se(this.data))}compareRows(e,i,s){let n,o,l=this.getColumnState(s);if(!l.sort)return 0;let a=this.rowMetadata.get(e),c=this.rowMetadata.get(i);return l.sort?.order==="asc"?(n=a.sortValues[s],o=c.sortValues[s]):(n=c.sortValues[s],o=a.sortValues[s]),n??=Number.MIN_SAFE_INTEGER,o??=Number.MIN_SAFE_INTEGER,n<o?-1:n>o?1:0}sortRows(){if(this.filterDirty){this.filterRows();return}let e=[...this._columnStateMap.values()].filter(i=>i.visible&&i.sort).sort((i,s)=>s.sort.priority-i.sort.priority);this._filteredData=this._filteredData.toSorted((i,s)=>{let n=this.rowMetadata.get(i),o=this.rowMetadata.get(s);if(this.enableSearchScoring&&this.queryTokens){let l=n.searchScore||0,a=o.searchScore||0;if(l>a)return-1;if(l<a)return 1}for(let l of e){let a=this.compareRows(i,s,l.field);if(a!==0)return a}return n.index-o.index}),this.sortDirty=!1}createMetadata(){this.idToRowMap=new Map,this.rowMetadata=new WeakMap;let e=new Map;for(let s of this.columns){let n=this.data.map(o=>{let l=S(o,s.field),a=s.sorter?.(l)??l;return[l,a]});e.set(s.field,ii(n))}let i=0;for(let s of this.data){let n=this._rowIdCallback(s,i);(n==null||this.idToRowMap.has(n))&&(Hi(i,n,s),n=`__yatl_fallback_id_${i}`),this.idToRowMap.set(n,s);let o={id:n,index:i++,searchTokens:{},searchValues:{},sortValues:{},selected:!1};this.rowMetadata.set(s,o);for(let l of this.columns){let a=S(s,l.field),c=e.get(l.field);if(o.sortValues[l.field]=c.get(a)??null,typeof a=="string"&&(o.searchValues[l.field]=a.toLocaleLowerCase()),l.searchable&&l.tokenize&&a){let d=l.searchTokenizer??this.searchTokenizer;o.searchTokens[l.field]=d(String(a)).map(h=>h.value)}}}}updateInternalQuery(){if(this.searchQuery.length===0){this.queryTokens=null;return}this.queryTokens=[{value:this.searchQuery.toLocaleLowerCase(),quoted:!0}],this.enableSearchTokenization&&this.queryTokens.push(...this.searchTokenizer(this.searchQuery))}scheduleSave(){window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveStateToStorage()},Ui)}saveStateToStorage(){if(!this.storageOptions)return;let e={...si,...this.storageOptions},i={columns:[]},s=this.getTableState();e.saveSearchQuery&&(i.searchQuery=s.searchQuery),e.saveSelectedRows&&(i.selectedRows=s.selectedRows);for(let o of s.columns){let l={field:o.field};e.saveColumnSortOrders&&(l.sort=o.sort),e.saveColumnVisibility&&(l.visible=o.visible),e.saveColumnWidths&&(l.width=o.width),i.columns?.push(l)}let n=e.storage==="session"?sessionStorage:localStorage;try{n.setItem(e.key,JSON.stringify(i))}catch(o){console.warn("Failed to save table state",o)}}loadStateFromStorage(){if(!this.storageOptions)return;let e={...si,...this.storageOptions},i=localStorage.getItem(e.key);if(i)try{let s=JSON.parse(i),n={};if(e.saveSearchQuery&&(n.searchQuery=s.searchQuery),e.saveSelectedRows&&(n.selectedRows=s.selectedRows),s.columns){n.columns=[];for(let o of s.columns){let l={field:o.field};e.saveColumnVisibility&&(l.visible=o.visible),e.saveColumnWidths&&(l.width=o.width),e.saveColumnSortOrders&&(l.sort=o.sort),n.columns.push(l)}}this.updateTableState(n),this.hasRestoredState=!0}catch(s){console.error("Failed to restore DataTable state:",s)}}},ri=!1;function ji(){ri||(ri=!0,console.warn(`[yatl-table] Data rows are missing a unique 'id' or 'key' property.
375
6
  Falling back to array index.
376
7
  Selection and sorting may behave unexpectedly.
377
8
  Please provide a unique ID via the 'rowIdCallback' property.
378
- `))}var Ur=!1;function Ei(s,t,e){Ur||(Ur=!0,console.warn(`[yatl-table] rowIdCallback returned non-unique id (${t}) for data at index ${s}.
9
+ `))}var ni=!1;function Hi(r,t,e){ni||(ni=!0,console.warn(`[yatl-table] rowIdCallback returned non-unique id (${t}) for data at index ${r}.
379
10
  Falling back to array index.
380
11
  Selection and sorting may behave unexpectedly.
381
- `),console.debug(e))}var jr=x`
12
+ `),console.debug(e))}var oi=Qe`
382
13
  @layer base, striped, hover, selected;
383
14
 
384
15
  :host {
@@ -401,31 +32,38 @@
401
32
  );
402
33
 
403
34
  --table-header-text: var(--yatl-table-header-text, var(--yatl-text-1));
404
- --table-header-bg: var(--yatl-table-header-bg, var(--yatl-surface-3));
35
+ --table-header-bg: var(
36
+ --yatl-table-header-bg,
37
+ color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-bg))
38
+ );
405
39
  --table-header-hover-bg: var(
406
40
  --yatl-table-header-hover-bg,
407
- color-mix(in srgb, var(--table-header-bg), var(--yatl-mix-color) 5%)
41
+ color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-header-bg))
408
42
  );
409
43
  --table-header-drop-bg: var(
410
44
  --yatl-table-header-drop-bg,
411
- color-mix(in srgb, var(--table-header-bg), var(--yatl-mix-color) 5%)
45
+ color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-header-bg))
412
46
  );
413
47
 
414
48
  --table-row-text: var(--yatl-table-row-text, var(--yatl-text-1));
415
- --table-row-bg: var(--yatl-table-row-bg, var(--yatl-surface-2));
49
+ --table-row-bg: var(
50
+ --yatl-table-row-bg,
51
+ color-mix(in srgb, var(--yatl-color-mix) 2%, var(--table-bg))
52
+ );
416
53
  --table-row-hover-bg: var(
417
54
  --yatl-table-row-hover-bg,
418
- color-mix(in srgb, var(--table-row-bg), var(--yatl-mix-color) 5%)
55
+ var(--table-header-bg)
419
56
  );
420
57
  --table-row-stripe-bg: var(
421
58
  --yatl-table-row-stripe-bg,
422
- var(--yatl-surface-1)
59
+ color-mix(in srbg, var(--yatl-color-mix) 3%, var(--table-bg))
60
+ var(--table-header-bg)
423
61
  );
424
62
  --table-row-selected-bg: var(
425
63
  --yatl-table-row-selected-bg,
426
- color-mix(in srgb, var(--yatl-color-brand) 10%, transparent)
64
+ color-mix(in srgb, var(--yatl-color-brand) 20%, transparent)
427
65
  );
428
- --table-footer-text: var(--yatl-table-footer-text, var(--yatl-tex-3));
66
+ --table-footer-text: var(--yatl-table-footer-text, var(--yatl-text-3));
429
67
  --table-selector-color: var(
430
68
  --yatl-table-selector-color,
431
69
  color-mix(in srgb, var(--table-row-bg), var(--yatl-color-brand, black) 5%)
@@ -446,22 +84,16 @@
446
84
 
447
85
  /* Resize grab handle width */
448
86
  --resizer-width: var(--yatl-table-column-resizer-width, 10px);
87
+
449
88
  /* z-index for the header */
450
89
  --header-z-index: 2;
451
90
  }
452
91
 
453
92
  @layer base {
454
- .wrapper {
455
- overflow: hidden;
456
- border-radius: var(--table-radius);
457
- }
458
-
459
- .scroller {
460
- border: var(--table-border-width) solid var(--table-border-color);
461
- }
462
-
463
93
  .table {
94
+ border-radius: var(--table-radius);
464
95
  background-color: var(--table-bg);
96
+ border: var(--table-border-width) solid var(--table-border-color);
465
97
  }
466
98
 
467
99
  .row {
@@ -478,11 +110,6 @@
478
110
  color: var(--table-header-text);
479
111
  }
480
112
 
481
- .table:not(.resizing) .row {
482
- transition: grid-template-columns
483
- var(--table-column-visibility-transition);
484
- }
485
-
486
113
  .body .row {
487
114
  background-color: var(--table-row-bg);
488
115
  }
@@ -491,6 +118,11 @@
491
118
  border-bottom: none;
492
119
  }
493
120
 
121
+ .table:not(.resizing) .row {
122
+ transition: grid-template-columns
123
+ var(--table-column-visibility-transition);
124
+ }
125
+
494
126
  .cell {
495
127
  align-items: center;
496
128
  padding: var(--table-cell-padding);
@@ -515,7 +147,7 @@
515
147
  .resizer::after {
516
148
  height: 60%;
517
149
  width: 1px;
518
- background-color: color-mix(in srgb, currentColor 30%, transparent);
150
+ background-color: color-mix(in srgb, currentcolor 30%, transparent);
519
151
  transition: background-color 0.2s;
520
152
  }
521
153
 
@@ -523,20 +155,6 @@
523
155
  background-color: var(--table-header-bg);
524
156
  }
525
157
 
526
- .row-checkbox {
527
- width: 1.125rem;
528
- height: 1.125rem;
529
-
530
- cursor: pointer;
531
- margin: 0;
532
-
533
- accent-color: var(--table-selector-color);
534
- transition: transform 0.1s ease-in-out;
535
- }
536
-
537
- .row-checkbox:active {
538
- transform: scale(0.9);
539
- }
540
158
  .message {
541
159
  font-size: large;
542
160
  }
@@ -552,13 +170,16 @@
552
170
  .table:not(.resizing) .header .cell:hover {
553
171
  background-color: var(--table-header-hover-bg);
554
172
  }
173
+
555
174
  .body .row:hover {
556
175
  background-color: var(--table-row-hover-bg);
557
176
  }
177
+
558
178
  .resizer:hover::after {
559
- background-color: currentColor;
179
+ background-color: currentcolor;
560
180
  width: 2px;
561
181
  }
182
+
562
183
  .drop-indicator {
563
184
  background: var(--table-header-drop-bg);
564
185
  }
@@ -582,19 +203,21 @@
582
203
  * for the table to work properly.
583
204
  * Modify with caution!
584
205
  */
206
+ /* stylelint-disable-next-line no-duplicate-selectors */
585
207
  :host {
586
208
  display: block;
587
209
  width: 100%;
588
210
  height: 100%;
589
211
  }
590
212
 
591
- .wrapper {
213
+ .table {
592
214
  display: flex;
593
215
  flex-direction: column;
594
216
  width: 100%;
595
217
  height: 100%;
596
218
  position: relative;
597
219
  overflow: hidden;
220
+ box-sizing: border-box;
598
221
  }
599
222
 
600
223
  .scroller {
@@ -604,14 +227,9 @@
604
227
  height: 100%;
605
228
  }
606
229
 
607
- .table {
608
- box-sizing: border-box;
609
- }
610
-
611
230
  .body {
612
231
  min-width: 100%;
613
232
  width: fit-content;
614
- min-height: 100%;
615
233
  height: fit-content;
616
234
  }
617
235
 
@@ -679,10 +297,7 @@
679
297
  .drop-indicator {
680
298
  display: none;
681
299
  position: absolute;
682
- top: 0;
683
- left: 0;
684
- right: 0;
685
- bottom: 0;
300
+ inset: 0;
686
301
  pointer-events: none;
687
302
  z-index: calc(var(--header-z-index) + 1);
688
303
  }
@@ -701,7 +316,6 @@
701
316
  align-items: center;
702
317
  justify-content: space-between;
703
318
  flex-shrink: 0;
704
-
705
319
  position: sticky;
706
320
  bottom: 0;
707
321
  left: 0;
@@ -713,6 +327,7 @@
713
327
  .row {
714
328
  display: grid;
715
329
  grid-template-columns: var(--grid-template);
330
+
716
331
  /* This is required! Don't remove it. */
717
332
  min-width: 100%;
718
333
  width: fit-content;
@@ -769,25 +384,25 @@
769
384
  white-space: nowrap;
770
385
  overflow: hidden;
771
386
  }
772
- `;var m=class extends v{constructor(){super(...arguments);this.resizeState=null;this.dragColumn=null;this._controller=new Dt(this);this.striped=!0;this.sortable=!0;this.resizable=!0;this.enableVirtualScroll=!1;this.enableSearchHighlight=!0;this.enableColumnReorder=!0;this.enableRowNumberColumn=!0;this.enableFooter=!0;this.nullValuePlaceholder="-";this.emptyMessage="No records to display";this.noResultsMessage="No matching records found";this.rowParts=null;this.handleHeaderClicked=(e,r)=>{if(!e.currentTarget.classList.contains("sortable")||this.resizeState)return;let o=e.shiftKey,n=this.getColumnState(r.field),l=null;n?.sort?n.sort.order==="asc"&&(l="desc"):l="asc";let a=new yt(r.field,l,o);this.dispatchEvent(a)&&this.sort(r.field,l,!o)};this.handleCellClick=(e,r,i)=>{if(window.getSelection()?.toString())return;let o=this.controller.getRowId(r),n=this.controller.getRowIndex(r);this.dispatchEvent(new gt(r,o,n,i,e))};this.handleResizeMouseMove=e=>{this.resizeState?.active&&requestAnimationFrame(()=>{if(!this.resizeState?.active)return;let r=e.pageX-this.resizeState.startX,i=Math.max(50,this.resizeState.startWidth+r);this.resizeState.currentWidths[this.resizeState.columnIndex]=`${i}px`,this.tableElement.style.setProperty("--grid-template",this.resizeState.currentWidths.join(" "))})};this.handleResizeMouseUp=e=>{if(window.removeEventListener("mousemove",this.handleResizeMouseMove),window.removeEventListener("mouseup",this.handleResizeMouseUp),this.tableElement.classList.remove("resizing"),this.resizeState?.active){e.preventDefault(),e.stopPropagation();let r=parseFloat(this.resizeState.currentWidths[this.resizeState.columnIndex]),i=this.getColumnState(this.resizeState.columnField);i.width=r,this.columnStates=[i]}setTimeout(()=>{this.resizeState=null})};this.handleDragColumnStart=(e,r)=>{if(e.target?.classList.contains("resizer")){e.preventDefault();return}e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",r),this.dragColumn=r)};this.handleDragColumnEnter=e=>{e.currentTarget.querySelector(".drop-indicator")?.classList.add("active")};this.handleDragColumnLeave=e=>{let r=e.currentTarget,i=e.relatedTarget;r.contains(i)||r.querySelector(".drop-indicator")?.classList.remove("active")};this.handleDragColumnOver=e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move")};this.handleDragColumnDrop=(e,r)=>{if(!this.dragColumn||this.dragColumn===r)return;e.preventDefault(),e.stopPropagation();let i=this.displayColumns,o=i.findIndex(a=>a.field===this.dragColumn),n=i.findIndex(a=>a.field===r),l=new xt(this.dragColumn,o,n);this.dispatchEvent(l)&&this.moveColumn(this.dragColumn,r)};this.handleDragColumnEnd=()=>{this.dragColumn=null,this.tableElement.querySelectorAll(".drop-indicator.active").forEach(e=>e.classList.remove("active"))};this.handleRowSelectionClicked=(e,r)=>{e.stopPropagation();let o=e.currentTarget.checked,n=this.controller.getRowId(r),l=this.selectedRowIds,a=new _t(n,o,l);this.dispatchEvent(a)&&this.toggleRowSelection(r,o)}}get controller(){return this._controller}set controller(e){this._controller!==e&&(this._controller&&this._controller.detach(this),this._controller=e,e.attach(this))}get enableSearchTokenization(){return this.controller.enableSearchTokenization}set enableSearchTokenization(e){let r=this.enableSearchTokenization;r!==e&&(this.controller.enableSearchTokenization=e,this.requestUpdate("enableSearchTokenization",r))}get enableSearchScoring(){return this.controller.enableSearchScoring}set enableSearchScoring(e){let r=this.enableSearchScoring;r!==e&&(this.controller.enableSearchScoring=e,this.requestUpdate("enableSearchScoring",r))}get columns(){return this.controller.columns}set columns(e){let r=this.columns;if(r!==e){for(let i of e)z(i)&&i.title===void 0&&(i.title=gr(i.field));this.controller.columns=e,this.requestUpdate("columns",r)}}get displayColumns(){return this.controller.displayColumns}get columnStates(){return this.controller.columnStates}set columnStates(e){let r=this.columnStates,i=!1;for(let o of e){let n=this.getColumnState(o.field);if(ur(n,o).length){i=!0;break}}i&&(this.controller.columnStates=e,this.requestUpdate("columnStates",r))}get searchQuery(){return this.controller.searchQuery}set searchQuery(e){let r=this.searchQuery;r!==e&&(this.controller.searchQuery=e,this.requestUpdate("searchQuery",r))}get searchTokenizer(){return this.controller.searchTokenizer}set searchTokenizer(e){let r=this.searchTokenizer;r!==e&&(this.controller.searchTokenizer=e,this.requestUpdate("searchTokenizer",r))}get filters(){return this.controller.filters}set filters(e){let r=this.filters;r!==e&&(this.controller.filters=e,this.requestUpdate("filters",r))}get rowSelectionMethod(){return this.controller.rowSelectionMethod}set rowSelectionMethod(e){let r=this.rowSelectionMethod;r!==e&&(this.controller.rowSelectionMethod=e,this.requestUpdate("rowSelectionMethod",r))}get selectedRowIds(){return this.controller.selectedRowIds}set selectedRowIds(e){let r=new Set(this.selectedRowIds);r.size===e.length&&e.every(i=>r.has(i))||(this.controller.selectedRowIds=e,this.requestUpdate("selectedRows",[...r]))}get storageOptions(){return this.controller.storageOptions}set storageOptions(e){let r=this.storageOptions;this.controller.storageOptions=e,this.requestUpdate("storageOptions",r)}get rowIdCallback(){return this.controller.rowIdCallback}set rowIdCallback(e){let r=this.rowIdCallback;r!==e&&(this.controller.rowIdCallback=e,this.requestUpdate("rowIdCallback",r))}get data(){return this.controller.data}set data(e){let r=this.data;this.controller.data=e,this.requestUpdate("data",r)}get filteredData(){return this.controller.filteredData}get dataUpdateTimestamp(){return this.controller.dataUpdateTimestamp}getColumn(e){return this.controller.getColumn(e)}getDisplayColumn(e){let r=this.getColumn(e);if(r&&z(r))return r}getTableState(){return this.controller.getTableState()}updateTableState(e){return this.controller.updateTableState(e)}getColumnState(e){return this.controller.getColumnState(e)}updateColumnState(e,r){return this.controller.updateColumnState(e,r)}sort(e,r,i=!0){return this.controller.sort(e,r,i)}toggleColumnVisibility(e,r){return this.controller.toggleColumnVisibility(e,r)}showColumn(e){return this.controller.showColumn(e)}hideColumn(e){return this.controller.hideColumn(e)}moveColumn(e,r){return this.controller.moveColumn(e,r)}isRowSelected(e){return this.controller.isRowSelected(e)}toggleRowSelection(e,r){return this.controller.toggleRowSelection(e,r)}selectRow(e){return this.controller.selectRow(e)}deselectRow(e){return this.controller.deselectRow(e)}selectAll(){return this.controller.selectAll()}deselectAll(){return this.controller.deselectAll()}export(e,r={includeAllRows:!1,includeHiddenColumns:!1,includeInternalColumns:!1}){let i=this.controller.export(r),o=document.createElement("a");o.style.display="none",o.href=URL.createObjectURL(i),o.download=`${e}.csv`,document.body.append(o),o.click(),o.remove()}scrollToRow(e){let r=this.data.findIndex(i=>i===e);if(typeof r=="number")return this.scrollToOriginalIndex(r);throw new Error("Row not in table")}scrollToOriginalIndex(e){let r=this.data[e];if(r){let i=this.filteredData.indexOf(r);if(i>=0)return this.scrollToFilteredIndex(i);throw new Error("Cannot scroll to filtered out row")}else throw new RangeError(`Row index ${e} out of range`)}async scrollToFilteredIndex(e){if(!this.filteredData[e])throw new RangeError(`Row index ${e} out of range`);await this.updateComplete,this.virtualizer?this.virtualizer.element(e)?.scrollIntoView({block:"start",behavior:"instant"}):this.tableElement.querySelector(`.row[data-filtered-index="${e}"]`)?.scrollIntoView({block:"start",behavior:"smooth"})}async scrollToPx(e){await this.updateComplete,this.virtualizer?this.virtualizer.scrollTop=e:this.tableElement.scrollTop=e}getRow(e){return this.controller.getRow(e)}findRow(e,r){return this.controller.findRow(e,r)}findRowIndex(e,r){return this.controller.findRowIndex(e,r)}updateRow(e,r){return this.controller.updateRow(e,r)}updateRowAtIndex(e,r){return this.controller.updateRowAtIndex(e,r)}deleteRow(...e){return this.controller.deleteRow(...e)}deleteRowAtIndex(e){return this.controller.deleteRowAtIndex(e)}renderColumnSortIcon(e,r){return e.sortable??this.sortable?f`<div
387
+ `;var f=class extends C{constructor(){super(...arguments);this.resizeState=null;this.dragColumn=null;this.useYatlUi=!1;this._controller=new we(this);this.striped=!0;this.sortable=!0;this.resizable=!0;this.enableVirtualScroll=!1;this.enableSearchHighlight=!0;this.enableColumnReorder=!0;this.enableRowNumberColumn=!0;this.enableFooter=!0;this.nullValuePlaceholder="-";this.emptyMessage="No records to display";this.noResultsMessage="No matching records found";this.rowParts=null;this.eventNames=["yatl-column-reorder","yatl-column-resize","yatl-column-sort","yatl-column-toggle","yatl-row-select","yatl-table-search","yatl-table-state-change","yatl-table-view-change"];this.redispatchControllerEvent=e=>{e instanceof v&&this.dispatchEvent(e.clone())};this.handleHeaderClicked=(e,i)=>{if(!e.currentTarget.classList.contains("sortable")||this.resizeState)return;let n=e.shiftKey,o=this.getColumnState(i.field),l=null;o?.sort?o.sort.order==="asc"&&(l="desc"):l="asc";let a=new G(i.field,l,n);this.dispatchEvent(a)&&this.sort(i.field,l,!n)};this.handleCellClick=(e,i,s)=>{if(window.getSelection()?.toString())return;let n=this.controller.getRowId(i),o=this.controller.getRowIndex(i);this.dispatchEvent(new W(i,n,o,s,e))};this.handleResizeMouseMove=e=>{this.resizeState?.active&&requestAnimationFrame(()=>{if(!this.resizeState?.active)return;let i=e.pageX-this.resizeState.startX,s=Math.max(50,this.resizeState.startWidth+i);this.resizeState.currentWidths[this.resizeState.columnIndex]=`${s}px`,this.tableElement.style.setProperty("--grid-template",this.resizeState.currentWidths.join(" "))})};this.handleResizeMouseUp=e=>{if(window.removeEventListener("mousemove",this.handleResizeMouseMove),window.removeEventListener("mouseup",this.handleResizeMouseUp),this.tableElement.classList.remove("resizing"),this.resizeState?.active){e.preventDefault(),e.stopPropagation();let i=parseFloat(this.resizeState.currentWidths[this.resizeState.columnIndex]),s=this.getColumnState(this.resizeState.columnField);s.width=i,this.columnStates=[s]}setTimeout(()=>{this.resizeState=null})};this.handleDragColumnStart=(e,i)=>{if(e.target?.classList.contains("resizer")){e.preventDefault();return}e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",i),this.dragColumn=i)};this.handleDragColumnEnter=e=>{e.currentTarget.querySelector(".drop-indicator")?.classList.add("active")};this.handleDragColumnLeave=e=>{let i=e.currentTarget,s=e.relatedTarget;i.contains(s)||i.querySelector(".drop-indicator")?.classList.remove("active")};this.handleDragColumnOver=e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move")};this.handleDragColumnDrop=(e,i)=>{if(!this.dragColumn||this.dragColumn===i)return;e.preventDefault(),e.stopPropagation();let s=this.displayColumns,n=s.findIndex(a=>a.field===this.dragColumn),o=s.findIndex(a=>a.field===i),l=new ee(this.dragColumn,n,o);this.dispatchEvent(l)&&this.moveColumn(this.dragColumn,i)};this.handleDragColumnEnd=()=>{this.dragColumn=null,this.tableElement.querySelectorAll(".drop-indicator.active").forEach(e=>e.classList.remove("active"))};this.handleRowSelectionClicked=(e,i)=>{e.stopPropagation();let n=e.currentTarget.checked,o=this.controller.getRowId(i),l=this.selectedRowIds,a=new Q(o,n,l);this.dispatchEvent(a)&&this.toggleRowSelection(i,n)}}get controller(){return this._controller}set controller(e){if(this._controller===e)return;let i=this._controller;this.isConnected&&(this.removeControllerListeners(i),this.addControllerListeners(e)),i.detach(this),e.attach(this),this._controller=e,this.requestUpdate("controller",i)}get enableSearchTokenization(){return this.controller.enableSearchTokenization}set enableSearchTokenization(e){let i=this.enableSearchTokenization;i!==e&&(this.controller.enableSearchTokenization=e,this.requestUpdate("enableSearchTokenization",i))}get enableSearchScoring(){return this.controller.enableSearchScoring}set enableSearchScoring(e){let i=this.enableSearchScoring;i!==e&&(this.controller.enableSearchScoring=e,this.requestUpdate("enableSearchScoring",i))}get columns(){return this.controller.columns}set columns(e){let i=this.columns;if(i!==e){for(let s of e)M(s)&&s.title===void 0&&(s.title=kt(s.field));this.controller.columns=e,this.requestUpdate("columns",i)}}get displayColumns(){return this.controller.displayColumns}get columnStates(){return this.controller.columnStates}set columnStates(e){let i=this.columnStates,s=!1;for(let n of e){let o=this.getColumnState(n.field);if(ne(o,n).length){s=!0;break}}s&&(this.controller.columnStates=e,this.requestUpdate("columnStates",i))}get searchQuery(){return this.controller.searchQuery}set searchQuery(e){let i=this.searchQuery;i!==e&&(this.controller.searchQuery=e,this.requestUpdate("searchQuery",i))}get searchTokenizer(){return this.controller.searchTokenizer}set searchTokenizer(e){let i=this.searchTokenizer;i!==e&&(this.controller.searchTokenizer=e,this.requestUpdate("searchTokenizer",i))}get filters(){return this.controller.filters}set filters(e){let i=this.filters;i!==e&&(this.controller.filters=e,this.requestUpdate("filters",i))}get rowSelectionMethod(){return this.controller.rowSelectionMethod}set rowSelectionMethod(e){let i=this.rowSelectionMethod;i!==e&&(this.controller.rowSelectionMethod=e,this.requestUpdate("rowSelectionMethod",i))}get selectedRowIds(){return this.controller.selectedRowIds}set selectedRowIds(e){let i=new Set(this.selectedRowIds);i.size===e.length&&e.every(s=>i.has(s))||(this.controller.selectedRowIds=e,this.requestUpdate("selectedRows",[...i]))}get storageOptions(){return this.controller.storageOptions}set storageOptions(e){let i=this.storageOptions;this.controller.storageOptions=e,this.requestUpdate("storageOptions",i)}get rowIdCallback(){return this.controller.rowIdCallback}set rowIdCallback(e){let i=this.rowIdCallback;i!==e&&(this.controller.rowIdCallback=e,this.requestUpdate("rowIdCallback",i))}get data(){return this.controller.data}set data(e){let i=this.data;this.controller.data=e,this.requestUpdate("data",i)}get filteredData(){return this.controller.filteredData}get dataUpdateTimestamp(){return this.controller.dataUpdateTimestamp}getColumn(e){return this.controller.getColumn(e)}getDisplayColumn(e){let i=this.getColumn(e);if(i&&M(i))return i}getTableState(){return this.controller.getTableState()}updateTableState(e){return this.controller.updateTableState(e)}getColumnState(e){return this.controller.getColumnState(e)}updateColumnState(e,i){return this.controller.updateColumnState(e,i)}sort(e,i,s=!0){return this.controller.sort(e,i,s)}toggleColumnVisibility(e,i){return this.controller.toggleColumnVisibility(e,i)}showColumn(e){return this.controller.showColumn(e)}hideColumn(e){return this.controller.hideColumn(e)}moveColumn(e,i){return this.controller.moveColumn(e,i)}isRowSelected(e){return this.controller.isRowSelected(e)}toggleRowSelection(e,i){return this.controller.toggleRowSelection(e,i)}selectRow(e){return this.controller.selectRow(e)}deselectRow(e){return this.controller.deselectRow(e)}selectAll(){return this.controller.selectAll()}deselectAll(){return this.controller.deselectAll()}export(e,i={includeAllRows:!1,includeHiddenColumns:!1,includeInternalColumns:!1}){let s=this.controller.export(i),n=document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(s),n.download=`${e}.csv`,document.body.append(n),n.click(),n.remove()}scrollToRow(e){let i=this.data.findIndex(s=>s===e);if(typeof i=="number")return this.scrollToOriginalIndex(i);throw new Error("Row not in table")}scrollToOriginalIndex(e){let i=this.data[e];if(i){let s=this.filteredData.indexOf(i);if(s>=0)return this.scrollToFilteredIndex(s);throw new Error("Cannot scroll to filtered out row")}else throw new RangeError(`Row index ${e} out of range`)}async scrollToFilteredIndex(e){if(!this.filteredData[e])throw new RangeError(`Row index ${e} out of range`);await this.updateComplete,this.virtualizer?this.virtualizer.element(e)?.scrollIntoView({block:"start",behavior:"instant"}):this.tableElement.querySelector(`.row[data-filtered-index="${e}"]`)?.scrollIntoView({block:"start",behavior:"smooth"})}async scrollToPx(e){await this.updateComplete,this.virtualizer?this.virtualizer.scrollTop=e:this.tableElement.scrollTop=e}getRow(e){return this.controller.getRow(e)}findRow(e,i){return this.controller.findRow(e,i)}findRowIndex(e,i){return this.controller.findRowIndex(e,i)}updateRow(e,i){return this.controller.updateRow(e,i)}updateRowAtIndex(e,i){return this.controller.updateRowAtIndex(e,i)}deleteRow(...e){return this.controller.deleteRow(...e)}deleteRowAtIndex(e){return this.controller.deleteRowAtIndex(e)}renderColumnSortIcon(e,i){return e.sortable??this.sortable?g`<div
773
388
  part="header-sort-icon"
774
- class=${kt({"sort-icon":!0,ascending:r.sort?.order==="asc",descending:r.sort?.order==="desc"})}
775
- ></div>`:g}renderColumnResizer(e,r){return e.resizable??this.resizable?f`
389
+ class=${me({"sort-icon":!0,ascending:i.sort?.order==="asc",descending:i.sort?.order==="desc"})}
390
+ ></div>`:b}renderColumnResizer(e,i){return e.resizable??this.resizable?g`
776
391
  <div
777
392
  part="header-resizer"
778
393
  class="resizer"
779
- @click=${i=>i.stopPropagation()}
780
- @mousedown=${i=>this.handleResizeMouseDown(i,e.field)}
394
+ @click=${s=>s.stopPropagation()}
395
+ @mousedown=${s=>this.handleResizeMouseDown(s,e.field)}
781
396
  ></div>
782
- `:g}renderHeaderCell(e){if(!e)return g;let r=this.getColumnState(e.field),i=e.title??e.field,o="none";r.sort?.order==="asc"&&(o="ascending"),r.sort?.order==="desc"&&(o="descending");let n=r.visible?"columnheader":void 0,l=r.visible?!1:void 0,a={cell:!0,sortable:e.sortable??this.sortable};return this.renderCellWrapper(f`
397
+ `:b}renderHeaderCell(e){if(!e)return b;let i=this.getColumnState(e.field),s=e.title??e.field,n="none";i.sort?.order==="asc"&&(n="ascending"),i.sort?.order==="desc"&&(n="descending");let o=i.visible?"columnheader":void 0,l=i.visible?!1:void 0,a={cell:!0,sortable:e.sortable??this.sortable};return this.renderCellWrapper(g`
783
398
  <div
784
- role=${X(n)}
785
- aria-hidden=${X(l)}
786
- aria-sort=${o}
787
- aria-label=${i}
399
+ role=${_e(o)}
400
+ aria-hidden=${_e(l)}
401
+ aria-sort=${n}
402
+ aria-label=${s}
788
403
  part="cell header-cell"
789
- class=${kt(a)}
790
- draggable=${X(this.enableColumnReorder?!0:void 0)}
404
+ class=${me(a)}
405
+ draggable=${_e(this.enableColumnReorder?!0:void 0)}
791
406
  data-field=${e.field}
792
407
  @dragstart=${c=>this.handleDragColumnStart(c,e.field)}
793
408
  @dragenter=${this.handleDragColumnEnter}
@@ -799,245 +414,105 @@
799
414
  >
800
415
  <div class="header-content">
801
416
  <span class="header-title truncate" part="header-title">
802
- ${i}
417
+ ${s}
803
418
  </span>
804
- ${this.renderColumnSortIcon(e,r)}
419
+ ${this.renderColumnSortIcon(e,i)}
805
420
  </div>
806
- ${this.renderColumnResizer(e,r)}
421
+ ${this.renderColumnResizer(e,i)}
807
422
  <div part="drop-indicator" class="drop-indicator"></div>
808
423
  </div>
809
- `)}renderRowNumberHeader(){return this.renderCellWrapper(f`<div part="cell-index" class="cell-index"></div>`)}renderSelectionHeader(){return this.renderCellWrapper(f`<div part="cell-selector" class="cell-selector"></div>`)}renderHeader(){let e={header:!0,reorderable:this.enableColumnReorder};return f`
810
- <div role="rowgroup" part="header" class=${kt(e)}>
424
+ `)}renderRowNumberHeader(){return this.renderCellWrapper(g`<div part="cell-index" class="cell-index"></div>`)}renderSelectionHeader(){return this.renderCellWrapper(g`<div part="cell-selector" class="cell-selector"></div>`)}renderHeader(){let e={header:!0,reorderable:this.enableColumnReorder};return g`
425
+ <div role="rowgroup" part="header" class=${me(e)}>
811
426
  <div role="row" class="row header-row" part="row header-row">
812
427
  ${this.renderRowNumberHeader()} ${this.renderSelectionHeader()}
813
- ${this.displayColumns.map(r=>this.renderHeaderCell(r))}
428
+ ${this.displayColumns.map(i=>this.renderHeaderCell(i))}
814
429
  </div>
815
430
  </div>
816
- `}renderCellContents(e,r,i){if(r.cellRenderer)return r.cellRenderer(e,r.field,i);if(e==null)return this.nullValuePlaceholder;let o=this.controller.getRowHighlightIndicies(i);return this.enableSearchHighlight&&o?mr(String(e),o[r.field]):e}renderCell(e,r){let i=k(r,e.field),o=e.cellParts?.call(this,i,e.field,r);return Array.isArray(o)&&(o=o.join(" ")),typeof e.valueFormatter=="function"&&(i=e.valueFormatter(i,r)),this.renderCellWrapper(f`
431
+ `}renderCellContents(e,i,s){if(i.cellRenderer)return i.cellRenderer(e,i.field,s);if(e==null)return this.nullValuePlaceholder;let n=this.controller.getRowHighlightIndicies(s);return this.enableSearchHighlight&&n?Ot(String(e),n[i.field]):e}renderCell(e,i){let s=S(i,e.field),n=e.cellParts?.call(this,s,e.field,i);return Array.isArray(n)&&(n=n.join(" ")),typeof e.valueFormatter=="function"&&(s=e.valueFormatter(s,i)),this.renderCellWrapper(g`
817
432
  <div
818
433
  role="cell"
819
- part="cell body-cell cell-${e.field} ${o}"
434
+ part="cell body-cell cell-${e.field} ${n}"
820
435
  data-field=${e.field}
821
436
  class="cell"
822
- title=${X(i?String(i):void 0)}
823
- @click=${n=>this.handleCellClick(n,r,e.field)}
437
+ title=${_e(s?String(s):void 0)}
438
+ @click=${o=>this.handleCellClick(o,i,e.field)}
824
439
  >
825
440
  <span class="truncate">
826
- ${this.renderCellContents(i,e,r)}
441
+ ${this.renderCellContents(s,e,i)}
827
442
  </span>
828
443
  </div>
829
- `)}renderRowSelectorCell(e,r){return this.renderCellWrapper(f`
444
+ `)}renderCheckbox(e,i){return this.useYatlUi?g`<yatl-checkbox
445
+ part="row-checkbox"
446
+ class="row-checkbox"
447
+ .checked=${i}
448
+ @change=${s=>this.handleRowSelectionClicked(s,e)}
449
+ ></yatl-checkbox>`:g`<input
450
+ part="row-checkbox"
451
+ class="row-checkbox"
452
+ type="checkbox"
453
+ .checked=${i}
454
+ @change=${s=>this.handleRowSelectionClicked(s,e)}
455
+ />`}renderRowSelectorCell(e,i){return this.renderCellWrapper(g`
830
456
  <div part="cell body-cell" class="cell body-cell">
831
457
  <div part="row-selector-cell" class="row-selector-cell">
832
- <label>
833
- <input
834
- part="row-checkbox"
835
- class="row-checkbox"
836
- type="checkbox"
837
- .checked=${r}
838
- @change=${i=>this.handleRowSelectionClicked(i,e)}
839
- />
840
- </label>
458
+ <label> ${this.renderCheckbox(e,i)} </label>
841
459
  </div>
842
460
  </div>
843
- `)}renderRowNumberCell(e){return this.renderCellWrapper(f`
461
+ `)}renderRowNumberCell(e){return this.renderCellWrapper(g`
844
462
  <div part="cell body-cell" class="cell body-cell">
845
463
  <div part="row-number-cell" class="row-number-cell">${e}</div>
846
464
  </div>
847
- `)}renderRow(e,r){let i=this.isRowSelected(e),o=this.rowParts?.(e)??"";Array.isArray(o)&&(o=o.join(" "));let n={row:!0,selected:i},l=r+1;return f`
465
+ `)}renderRow(e,i){let s=this.isRowSelected(e),n=this.rowParts?.(e)??"";Array.isArray(n)&&(n=n.join(" "));let o={row:!0,selected:s},l=i+1;return g`
848
466
  <div
849
467
  role="row"
850
468
  aria-rowindex=${l}
851
- aria-selected=${i?"true":"false"}
852
- part=${"row "+o}
853
- class=${kt(n)}
469
+ aria-selected=${s?"true":"false"}
470
+ part=${"row "+n}
471
+ class=${me(o)}
854
472
  >
855
473
  ${this.renderRowNumberCell(l)}
856
- ${this.renderRowSelectorCell(e,i)}
474
+ ${this.renderRowSelectorCell(e,s)}
857
475
  ${this.displayColumns.map(a=>this.renderCell(a,e))}
858
476
  </div>
859
- `}renderBodyContents(){return this.hasVisibleColumn()?this.data.length===0?f`
477
+ `}renderBodyContents(){return this.hasVisibleColumn()?this.data.length===0?g`
860
478
  <div part="message" class="message">${this.emptyMessage}</div>
861
- `:this.filteredData.length===0?f`
479
+ `:this.filteredData.length===0?g`
862
480
  <div part="message" class="message">${this.noResultsMessage}</div>
863
- `:this.enableVirtualScroll?f`
481
+ `:this.enableVirtualScroll?g`
864
482
  <lit-virtualizer
865
483
  .items=${this.filteredData}
866
- .renderItem=${(e,r)=>this.renderRow(e,r)}
484
+ .renderItem=${(e,i)=>this.renderRow(e,i)}
867
485
  >
868
486
  </lit-virtualizer>
869
- `:f`
870
- ${tt(this.filteredData,e=>this.controller.getRowId(e),(e,r)=>this.renderRow(e,r))}
871
- `:f`
487
+ `:g`
488
+ ${ke(this.filteredData,e=>this.controller.getRowId(e),(e,i)=>this.renderRow(e,i))}
489
+ `:g`
872
490
  <div part="message" class="message">No visible columns.</div>
873
- `}renderFooter(){if(!this.enableFooter)return g;let e=this.data.length,r=this.filteredData.length,i=new Intl.NumberFormat(void 0),o=i.format(e),n=i.format(r),l=e!==r?`Showing ${n} of ${o} records`:`Total records: ${o}`,a=Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}),c=this.dataUpdateTimestamp?a.format(this.dataUpdateTimestamp):"Never";return f`
491
+ `}renderFooter(){if(!this.enableFooter)return b;let e=this.data.length,i=this.filteredData.length,s=new Intl.NumberFormat(void 0),n=s.format(e),o=s.format(i),l=e!==i?`Showing ${o} of ${n} records`:`Total records: ${n}`,a=Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}),c=this.dataUpdateTimestamp?a.format(this.dataUpdateTimestamp):"Never";return g`
874
492
  <div part="footer" class="footer">
875
493
  <slot name="footer">
876
494
  <span part="row-count">${l}</span>
877
495
  <span part="timestamp">${c}</span>
878
496
  </slot>
879
497
  </div>
880
- `}render(){let r={"--grid-template":this.getGridWidths().join(" ")};return f`
881
- <div class="wrapper">
498
+ `}render(){let i={"--grid-template":this.getGridWidths().join(" ")};return g`
499
+ <div
500
+ role="table"
501
+ aria-label="Data Table"
502
+ aria-rowcount=${this.filteredData.length}
503
+ part="table"
504
+ class="table"
505
+ style=${Ft(i)}
506
+ >
882
507
  <div class="scroller">
883
- <div
884
- role="table"
885
- aria-label="Data Table"
886
- aria-rowcount=${this.filteredData.length}
887
- part="table"
888
- class="table"
889
- style=${Er(r)}
890
- >
891
- ${this.renderHeader()}
892
- <div class="body" role="rowgroup">
893
- <slot name="body">${this.renderBodyContents()}</slot>
894
- </div>
508
+ ${this.renderHeader()}
509
+ <div class="body" role="rowgroup">
510
+ <slot name="body">${this.renderBodyContents()}</slot>
895
511
  </div>
896
512
  </div>
897
513
  ${this.renderFooter()}
898
514
  </div>
899
- `}renderCellWrapper(e){return f` <div class="cell-wrapper">${e}</div> `}disconnectedCallback(){super.disconnectedCallback(),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp)}hasVisibleColumn(){return this.displayColumns.map(e=>this.getColumnState(e.field)).filter(e=>e.visible).length>0}getGridWidths(){let e=[];this.enableRowNumberColumn?e.push("var(--yatl-row-number-column-width, 48px)"):e.push("0"),this.rowSelectionMethod?e.push("var(--yatl-row-selector-column-width, 48px)"):e.push("0");for(let r of this.displayColumns){let i=this.getColumnState(r.field),o=i.width!=null;i.visible?o?e.push(`${i.width}px`):e.push("minmax(0, 1fr)"):o?e.push("0px"):e.push("minmax(0, 0fr)")}return e}handleResizeMouseDown(e,r){e.preventDefault(),e.stopPropagation();let o=e.target.closest(".cell");if(!o)return;let n=this.displayColumns.findIndex(a=>a.field===r);if(n<0)return;this.tableElement.classList.add("resizing"),this.tableElement.querySelectorAll(".header .cell").forEach(a=>{let c=a.dataset.field;if(c){let h=this.getColumnState(c);h.width=a.getBoundingClientRect().width,this.updateColumnState(c,h)}});let l=this.getGridWidths();this.resizeState={active:!0,startX:e.pageX,startWidth:o.getBoundingClientRect().width,columnIndex:n+2,columnField:r,currentWidths:l},this.tableElement.style.setProperty("--grid-template",l.join(" ")),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp)}};m.styles=[U,jr],u([ft(".table")],m.prototype,"tableElement",2),u([ft("lit-virtualizer")],m.prototype,"virtualizer",2),u([p({attribute:!1})],m.prototype,"controller",1),u([p({type:Boolean,reflect:!0})],m.prototype,"striped",2),u([p({type:Boolean,attribute:"sortable"})],m.prototype,"sortable",2),u([p({type:Boolean,attribute:"resizable"})],m.prototype,"resizable",2),u([p({type:Boolean,attribute:"enable-virtual-scroll"})],m.prototype,"enableVirtualScroll",2),u([p({type:Boolean,attribute:"enable-search-highlight"})],m.prototype,"enableSearchHighlight",2),u([p({type:Boolean,attribute:"enable-search-tokenization"})],m.prototype,"enableSearchTokenization",1),u([p({type:Boolean,attribute:"enable-search-scoring"})],m.prototype,"enableSearchScoring",1),u([p({type:Boolean,attribute:"enable-column-reorder"})],m.prototype,"enableColumnReorder",2),u([p({type:Boolean})],m.prototype,"enableRowNumberColumn",2),u([p({type:Boolean,attribute:"enable-footer"})],m.prototype,"enableFooter",2),u([p({type:String,attribute:"null-value-placeholder"})],m.prototype,"nullValuePlaceholder",2),u([p({type:String,attribute:"empty-message"})],m.prototype,"emptyMessage",2),u([p({type:String,attribute:"no-results-message"})],m.prototype,"noResultsMessage",2),u([p({attribute:!1})],m.prototype,"columns",1),u([p({attribute:!1})],m.prototype,"columnStates",1),u([p({type:String,attribute:"search-query"})],m.prototype,"searchQuery",1),u([p({attribute:!1})],m.prototype,"searchTokenizer",1),u([p({attribute:!1})],m.prototype,"filters",1),u([p({attribute:!1})],m.prototype,"rowParts",2),u([p({type:String})],m.prototype,"rowSelectionMethod",1),u([p({attribute:!1})],m.prototype,"selectedRowIds",1),u([p({type:Object,attribute:"storage-options"})],m.prototype,"storageOptions",1),u([p({attribute:!1})],m.prototype,"rowIdCallback",1),u([p({attribute:!1})],m.prototype,"data",1),m=u([E("yatl-table")],m);var Hr=x`
900
- .ui-wrapper {
901
- display: flex;
902
- flex-direction: column;
903
- gap: var(--yatl-spacing-m);
904
- height: 100%;
905
- width: 100%;
906
- }
907
- `;var B=class extends m{constructor(){super(...arguments);this.showColumnPicker=!0;this.showExportButton=!0;this.handleTableExportClicked=()=>{this.export(document.title)}}render(){return f`
908
- <div class="ui-wrapper">
909
- <yatl-toolbar
910
- exportparts="search, "
911
- ?showColumnPicker=${this.showColumnPicker}
912
- ?showExportButton=${this.showExportButton}
913
- .controller=${this.controller}
914
- @yatl-toolbar-export-click=${this.handleTableExportClicked}
915
- ><slot name="toolbar-button-group" slot="button-group"></slot
916
- ><slot name="toolbar"></slot
917
- ></yatl-toolbar>
918
- ${super.render()}
919
- </div>
920
- `}};B.styles=[...m.styles,Hr],u([p({type:Boolean})],B.prototype,"showColumnPicker",2),u([p({type:Boolean})],B.prototype,"showExportButton",2),B=u([E("yatl-table-ui")],B);var Br=x`
921
- :host {
922
- box-sizing: border-box;
923
- --toolbar-search-radius: var(
924
- --yatl-toolbar-search-radius,
925
- var(--yatl-radius-m)
926
- );
927
- --toolbar-search-padding: var(
928
- --yatl-toolbar-search-padding,
929
- var(--yatl-spacing-m)
930
- );
931
- --toolbar-search-bg: var(--yatl-toolbar-search-bg, var(--yatl-surface-2));
932
- --toolbar-search-outline-color: var(
933
- --yatl-toolbar-search-outline-color,
934
- var(--yatl-color-brand)
935
- );
936
- --toolbar-search-outline-width: var(
937
- --yatl-toolbar-search-outline-width,
938
- 3px
939
- );
940
- }
941
-
942
- .toolbar {
943
- display: flex;
944
- flex-direction: row;
945
- gap: 10px;
946
- }
947
-
948
- .search {
949
- flex-grow: 1;
950
- border-radius: var(--toolbar-search-radius);
951
- background-color: var(--toolbar-search-bg);
952
- line-height: 1;
953
- border: none;
954
- font-size: large;
955
- padding: var(--toolbar-search-padding);
956
- }
957
-
958
- .search:focus,
959
- .search:focus-visible {
960
- outline: var(--toolbar-search-outline-width) solid
961
- var(--toolbar-search-outline-color);
962
- outline-offset: calc(var(--toolbar-search-outline-width) * -1);
963
- }
964
-
965
- yatl-button-group yatl-button {
966
- height: 100%;
967
- }
968
- `;var V=class extends v{constructor(){super(...arguments);this.showColumnPicker=!0;this.showExportButton=!0;this.handleDropdownToggle=e=>{this.controller?.toggleColumnVisibility(e.value,e.checked)};this.onSearchInput=e=>{let r=e.currentTarget;this.controller?.search(r.value),this.dispatchEvent(new $t(r.value))};this.onSearchChange=e=>{let r=e.currentTarget;this.dispatchEvent(new At(r.value))};this.onExportClick=e=>{this.dispatchEvent(new zt)}}get controller(){return this._controller}set controller(e){this._controller!==e&&(this._controller=e,e?.attach(this))}render(){return f`
969
- <div class="toolbar">
970
- <input
971
- part="search"
972
- class="search"
973
- type="search"
974
- placeholder="Search"
975
- value=${X(this.controller?.searchQuery)}
976
- @input=${this.onSearchInput}
977
- @change=${this.onSearchChange}
978
- />
979
- <yatl-button-group>
980
- ${this.showColumnPicker?this.renderColumnPicker():g}
981
- ${this.showExportButton?this.renderExportButton():g}
982
- <slot name="button-group"></slot>
983
- </yatl-button-group>
984
- <slot></slot>
985
- </div>
986
- `}renderColumnPicker(){return f`
987
- <yatl-dropdown
988
- part="column-picker"
989
- @yatl-dropdown-toggle=${this.handleDropdownToggle}
990
- >
991
- <yatl-button
992
- slot="trigger"
993
- part="column-picker-trigger"
994
- title="Show/hide columns"
995
- >
996
- <slot name="column-picker-icon">
997
- <svg
998
- width="20"
999
- height="20"
1000
- viewBox="0 0 24 24"
1001
- fill="none"
1002
- stroke="currentColor"
1003
- stroke-width="2"
1004
- >
1005
- <path
1006
- d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"
1007
- />
1008
- </svg>
1009
- </slot>
1010
- </yatl-button>
1011
- ${tt(this.controller?.displayColumns??[],e=>e.field,e=>this.renderColumnVisibilityToggle(e))}
1012
- </yatl-dropdown>
1013
- `}renderColumnVisibilityToggle(e){let r=this.controller.getColumnState(e.field);return f`
1014
- <yatl-dropdown-item
1015
- part="column-picker-item"
1016
- .checked=${r.visible}
1017
- .value=${r.field}
1018
- >${e.title}</yatl-dropdown-item
1019
- >
1020
- `}renderExportButton(){return f`
1021
- <yatl-button type="button" @click=${this.onExportClick}>
1022
- <slot name="export-button-icon">
1023
- <svg
1024
- xmlns="http://www.w3.org/2000/svg"
1025
- width="20"
1026
- height="20"
1027
- viewBox="0 0 24 24"
1028
- fill="none"
1029
- stroke="currentColor"
1030
- stroke-width="2"
1031
- stroke-linecap="round"
1032
- stroke-linejoin="round"
1033
- >
1034
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
1035
- <polyline points="7 10 12 15 17 10"></polyline>
1036
- <line x1="12" y1="15" x2="12" y2="3"></line>
1037
- </svg>
1038
- </slot>
1039
- </yatl-button>
1040
- `}};V.styles=[U,Br],u([p({attribute:!1})],V.prototype,"controller",1),u([p({type:Boolean})],V.prototype,"showColumnPicker",2),u([p({type:Boolean})],V.prototype,"showExportButton",2),V=u([E("yatl-toolbar")],V);var Vt=class extends C{constructor(t){if(super(t),this.it=g,t.type!==T.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===g||t==null)return this._t=void 0,this.it=t;if(t===S)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Vt.directiveName="unsafeHTML",Vt.resultType=1;var Fr=M(Vt);return Qr(Ci);})();
515
+ `}renderCellWrapper(e){return g` <div class="cell-wrapper">${e}</div> `}connectedCallback(){super.connectedCallback(),this.addControllerListeners(this.controller),this.useYatlUi||customElements.whenDefined("yatl-checkbox").then(()=>{this.useYatlUi=!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeControllerListeners(this.controller),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp)}addControllerListeners(e){for(let i of this.eventNames)e.addEventListener(i,this.redispatchControllerEvent)}removeControllerListeners(e){for(let i of this.eventNames)e.removeEventListener(i,this.redispatchControllerEvent)}hasVisibleColumn(){return this.displayColumns.map(e=>this.getColumnState(e.field)).filter(e=>e.visible).length>0}getGridWidths(){let e=[];this.enableRowNumberColumn?e.push("var(--yatl-row-number-column-width, 48px)"):e.push("0"),this.rowSelectionMethod?e.push("var(--yatl-row-selector-column-width, 48px)"):e.push("0");for(let i of this.displayColumns){let s=this.getColumnState(i.field),n=s.width!=null;s.visible?n?e.push(`${s.width}px`):e.push("minmax(0, 1fr)"):n?e.push("0px"):e.push("minmax(0, 0fr)")}return e}handleResizeMouseDown(e,i){e.preventDefault(),e.stopPropagation();let n=e.target.closest(".cell");if(!n)return;let o=this.displayColumns.findIndex(a=>a.field===i);if(o<0)return;this.tableElement.classList.add("resizing"),this.tableElement.querySelectorAll(".header .cell").forEach(a=>{let c=a.dataset.field;if(c){let d=this.getColumnState(c);d.width=a.getBoundingClientRect().width,this.updateColumnState(c,d)}});let l=this.getGridWidths();this.resizeState={active:!0,startX:e.pageX,startWidth:n.getBoundingClientRect().width,columnIndex:o+2,columnField:i,currentWidths:l},this.tableElement.style.setProperty("--grid-template",l.join(" ")),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp)}};f.styles=[oi],_([st(".table")],f.prototype,"tableElement",2),_([st("lit-virtualizer")],f.prototype,"virtualizer",2),_([Pt()],f.prototype,"useYatlUi",2),_([p({attribute:!1})],f.prototype,"controller",1),_([p({type:Boolean,reflect:!0})],f.prototype,"striped",2),_([p({type:Boolean,attribute:"sortable"})],f.prototype,"sortable",2),_([p({type:Boolean,attribute:"resizable"})],f.prototype,"resizable",2),_([p({type:Boolean,attribute:"enable-virtual-scroll"})],f.prototype,"enableVirtualScroll",2),_([p({type:Boolean,attribute:"enable-search-highlight"})],f.prototype,"enableSearchHighlight",2),_([p({type:Boolean,attribute:"enable-search-tokenization"})],f.prototype,"enableSearchTokenization",1),_([p({type:Boolean,attribute:"enable-search-scoring"})],f.prototype,"enableSearchScoring",1),_([p({type:Boolean,attribute:"enable-column-reorder"})],f.prototype,"enableColumnReorder",2),_([p({type:Boolean})],f.prototype,"enableRowNumberColumn",2),_([p({type:Boolean,attribute:"enable-footer"})],f.prototype,"enableFooter",2),_([p({type:String,attribute:"null-value-placeholder"})],f.prototype,"nullValuePlaceholder",2),_([p({type:String,attribute:"empty-message"})],f.prototype,"emptyMessage",2),_([p({type:String,attribute:"no-results-message"})],f.prototype,"noResultsMessage",2),_([p({attribute:!1})],f.prototype,"columns",1),_([p({attribute:!1})],f.prototype,"columnStates",1),_([p({type:String,attribute:"search-query"})],f.prototype,"searchQuery",1),_([p({attribute:!1})],f.prototype,"searchTokenizer",1),_([p({attribute:!1})],f.prototype,"filters",1),_([p({attribute:!1})],f.prototype,"rowParts",2),_([p({type:String})],f.prototype,"rowSelectionMethod",1),_([p({attribute:!1})],f.prototype,"selectedRowIds",1),_([p({type:Object,attribute:"storage-options"})],f.prototype,"storageOptions",1),_([p({attribute:!1})],f.prototype,"rowIdCallback",1),_([p({attribute:!1})],f.prototype,"data",1),f=_([Nt("yatl-table")],f);return hi(qi);})();
1041
516
  /*! Bundled license information:
1042
517
 
1043
518
  @lit-labs/virtualizer/layouts/shared/SizeCache.js:
@@ -1078,7 +553,6 @@ lit-element/lit-element.js:
1078
553
  lit-html/directive.js:
1079
554
  lit-html/directives/repeat.js:
1080
555
  lit-html/async-directive.js:
1081
- lit-html/directives/unsafe-html.js:
1082
556
  (**
1083
557
  * @license
1084
558
  * Copyright 2017 Google LLC