@timlassiter11/yatl 1.0.0 → 1.0.1

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,6 +1,6 @@
1
- "use strict";var yatl=(()=>{var dt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var ei=Object.prototype.hasOwnProperty;var Nt=(r,e)=>()=>(r&&(e=r(r=0)),e);var he=(r,e)=>{for(var t in e)dt(r,t,{get:e[t],enumerable:!0})},ii=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ti(e))!ei.call(r,s)&&s!==t&&dt(r,s,{get:()=>e[s],enumerable:!(i=le(e,s))||i.enumerable});return r};var si=r=>ii(dt({},"__esModule",{value:!0}),r),y=(r,e,t,i)=>{for(var s=i>1?void 0:i?le(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&dt(e,t,s),s};var ct,He=Nt(()=>{"use strict";ct=class{constructor(e){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,e?.roundAverageSize===!0&&(this._roundAverageSize=!0)}set(e,t){let i=this._map.get(e)||0;this._map.set(e,t),this.totalSize+=t-i}get averageSize(){if(this._map.size>0){let e=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(e):e}return 0}getSize(e){return this._map.get(e)}clear(){this._map.clear(),this.totalSize=0}}});function ie(r){return r==="horizontal"?"width":"height"}var It,Be=Nt(()=>{"use strict";It=class{_getDefaultConfig(){return{direction:"vertical"}}constructor(e,t){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=e,Promise.resolve().then(()=>this.config=t||this._getDefaultConfig())}set config(e){Object.assign(this,Object.assign({},this._getDefaultConfig(),e))}get config(){return{direction:this.direction}}get items(){return this._items}set items(e){this._setItems(e)}_setItems(e){e!==this._items&&(this._items=e,this._scheduleReflow())}get direction(){return this._direction}set direction(e){e=e==="horizontal"?e:"vertical",e!==this._direction&&(this._direction=e,this._sizeDim=e==="horizontal"?"width":"height",this._secondarySizeDim=e==="horizontal"?"height":"width",this._positionDim=e==="horizontal"?"left":"top",this._secondaryPositionDim=e==="horizontal"?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(e){let{_viewDim1:t,_viewDim2:i}=this;Object.assign(this._viewportSize,e),i!==this._viewDim2?this._scheduleLayoutUpdate():t!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(e){Object.assign(this._latestCoords,e);let t=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(t-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(e=!1){(e||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(e){this._pin=e,this._triggerReflow()}get pin(){if(this._pin!==null){let{index:e,block:t}=this._pin;return{index:Math.max(0,Math.min(e,this.items.length-1)),block:t}}return null}_clampScrollPosition(e){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(e,this.totalScrollSize[ie(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 e=this._scrollPosition,{index:t,block:i}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:t,block:i||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=e-this._scrollPosition}}_calculateScrollIntoViewPosition(e){let{block:t}=e,i=Math.min(this.items.length,Math.max(0,e.index)),s=this._getItemPosition(i)[this._positionDim],n=s;if(t!=="start"){let o=this._getItemSize(i)[this._sizeDim];if(t==="center")n=s-.5*this._viewDim1+.5*o;else{let a=s-this._viewDim1+o;if(t==="end")n=a;else{let l=this._scrollPosition;n=Math.abs(l-s)<Math.abs(l-a)?s:a}}}return n+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(n)}getScrollIntoViewCoordinates(e){return{[this._positionDim]:this._calculateScrollIntoViewPosition(e)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){let e=new Map;if(this._first!==-1&&this._last!==-1)for(let i=this._first;i<=this._last;i++)e.set(i,this._getItemPosition(i));let t={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:e};this._scrollError&&(t.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(t)}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 e=Math.max(0,this._scrollPosition-this._overhang),t=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>e||this._physicalMax<t?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(e){if(this._first===-1||this._last===-1)return;let t=this._first;for(;t<this._last&&Math.round(this._getItemPosition(t)[this._positionDim]+this._getItemSize(t)[this._sizeDim])<=Math.round(this._scrollPosition);)t++;let i=this._last;for(;i>this._first&&Math.round(this._getItemPosition(i)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)i--;(t!==this._firstVisible||i!==this._lastVisible)&&(this._firstVisible=t,this._lastVisible=i,e&&e.emit&&this._sendVisibilityChangedMessage())}}});var We={};he(We,{FlowLayout:()=>kt,flow:()=>Ci});function Ke(r){return r==="horizontal"?"marginLeft":"marginTop"}function xi(r){return r==="horizontal"?"marginRight":"marginBottom"}function Ti(r){return r==="horizontal"?"xOffset":"yOffset"}function $i(r,e){let t=[r,e].sort();return t[1]<=0?Math.min(...t):t[0]>=0?Math.max(...t):t[0]+t[1]}var Ci,se,kt,qe=Nt(()=>{"use strict";He();Be();Ci=r=>Object.assign({type:kt},r);se=class{constructor(){this._childSizeCache=new ct,this._marginSizeCache=new ct,this._metricsCache=new Map}update(e,t){let i=new Set;Object.keys(e).forEach(s=>{let n=Number(s);this._metricsCache.set(n,e[n]),this._childSizeCache.set(n,e[n][ie(t)]),i.add(n),i.add(n+1)});for(let s of i){let n=this._metricsCache.get(s)?.[Ke(t)]||0,o=this._metricsCache.get(s-1)?.[xi(t)]||0;this._marginSizeCache.set(s,$i(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(e,t){return this._metricsCache.get(e)?.[Ke(t)]||0}getChildSize(e){return this._childSizeCache.getSize(e)}getMarginSize(e){return this._marginSizeCache.getSize(e)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}},kt=class extends It{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new se,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(e){this._metricsCache.update(e,this.direction),this._scheduleReflow()}_getPhysicalItem(e){return this._newPhysicalItems.get(e)??this._physicalItems.get(e)}_getSize(e){return this._getPhysicalItem(e)&&this._metricsCache.getChildSize(e)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(e){let t=this._metricsCache;if(this._first===-1||this._last===-1)return t.averageMarginSize+e*(t.averageMarginSize+this._getAverageSize());if(e<this._first){let i=this._first-e;return this._getPhysicalItem(this._first).pos-(t.getMarginSize(this._first-1)||t.averageMarginSize)-(i*t.averageChildSize+(i-1)*t.averageMarginSize)}else{let i=e-this._last;return this._getPhysicalItem(this._last).pos+(t.getChildSize(this._last)||t.averageChildSize)+(t.getMarginSize(this._last)||t.averageMarginSize)+i*(t.averageChildSize+t.averageMarginSize)}}_getPosition(e){let t=this._getPhysicalItem(e),{averageMarginSize:i}=this._metricsCache;return e===0?this._metricsCache.getMarginSize(0)??i:t?t.pos:this._estimatePosition(e)}_calculateAnchor(e,t){return e<=0?0:t>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((e+t)/2/this._delta)))}_getAnchor(e,t){if(this._physicalItems.size===0)return this._calculateAnchor(e,t);if(this._first<0)return this._calculateAnchor(e,t);if(this._last<0)return this._calculateAnchor(e,t);let i=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),n=i.pos;if(s.pos+this._metricsCache.getChildSize(this._last)<e)return this._calculateAnchor(e,t);if(n>t)return this._calculateAnchor(e,t);let l=this._firstVisible-1,h=-1/0;for(;h<e;)h=this._getPhysicalItem(++l).pos+this._metricsCache.getChildSize(l);return l}_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 e=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=e,this._stable=!0}_getItems(){let e=this._newPhysicalItems;this._stable=!0;let t,i;if(this.pin!==null){let{index:h}=this.pin;this._anchorIdx=h,this._anchorPos=this._getPosition(h)}if(t=this._scrollPosition-this._overhang,i=this._scrollPosition+this._viewDim1+this._overhang,i<0||t>this._scrollSize){this._clearItems();return}(this._anchorIdx===null||this._anchorPos===null)&&(this._anchorIdx=this._getAnchor(t,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 a=0;for(this._anchorPos+s+o<t&&(a=t-(this._anchorPos+s+o)),this._anchorPos-n>i&&(a=i-(this._anchorPos-n)),a&&(this._scrollPosition-=a,t-=a,i-=a,this._scrollError+=a),e.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>t&&this._first>0;){let h=this._getSize(--this._first);h===void 0&&(this._stable=!1,h=this._getAverageSize());let u=this._metricsCache.getMarginSize(this._first);u===void 0&&(this._stable=!1,u=this._metricsCache.averageMarginSize),this._physicalMin-=h;let c=this._physicalMin;if(e.set(this._first,{pos:c,size:h}),this._physicalMin-=u,this._stable===!1&&this._estimate===!1)break}for(;this._physicalMax<i&&this._last<this.items.length-1;){let h=this._getSize(++this._last);h===void 0&&(this._stable=!1,h=this._getAverageSize());let u=this._metricsCache.getMarginSize(this._last);u===void 0&&(this._stable=!1,u=this._metricsCache.averageMarginSize);let c=this._physicalMax;if(e.set(this._last,{pos:c,size:h}),this._physicalMax+=h+u,!this._stable&&!this._estimate)break}let l=this._calculateError();l&&(this._physicalMin-=l,this._physicalMax-=l,this._anchorPos-=l,this._scrollPosition-=l,e.forEach(h=>h.pos-=l),this._scrollError+=l),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=e)}_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:e,_last:t}=this;super._reflow(),(this._first===-1&&this._last==-1||this._first===e&&this._last===t)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){let{averageMarginSize:e}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(e+this._getAverageSize())+e)}get _delta(){let{averageMarginSize:e}=this._metricsCache;return this._getAverageSize()+e}_getItemPosition(e){return{[this._positionDim]:this._getPosition(e),[this._secondaryPositionDim]:0,[Ti(this.direction)]:-(this._metricsCache.getLeadingMarginValue(e,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(e){return{[this._sizeDim]:this._getSize(e)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}});var Ri={};he(Ri,{YatlChangeEvent:()=>Q,YatlColumnReorderEvent:()=>Z,YatlColumnResizeEvent:()=>J,YatlColumnToggleEvent:()=>X,YatlEvent:()=>E,YatlRowClickEvent:()=>q,YatlSearchEvent:()=>jt,YatlSortEvent:()=>G,YatlTable:()=>m,createRegexTokenizer:()=>Gt,findColumn:()=>b,whitespaceTokenizer:()=>Xt});var E=class extends CustomEvent{constructor(e,t,i={}){super(e,{bubbles:!0,composed:!0,cancelable:!1,...i,detail:t})}},ft=class ft extends E{constructor(e,t,i,s){super(ft.EVENT_NAME,{row:e,index:t,field:i,originalEvent:s})}};ft.EVENT_NAME="yatl-row-click";var q=ft,pt=class pt extends E{constructor(e){super(pt.EVENT_NAME,{data:e})}};pt.EVENT_NAME="yatl-change";var Q=pt,mt=class mt extends E{constructor(e,t){super(mt.EVENT_NAME,{field:e,order:t},{cancelable:!0})}};mt.EVENT_NAME="yatl-sort";var G=mt,_t=class _t extends E{constructor(e,t){super(_t.EVENT_NAME,{field:e,visible:t},{cancelable:!0})}};_t.EVENT_NAME="yatl-column-toggle";var X=_t,gt=class gt extends E{constructor(e,t){super(gt.EVENT_NAME,{field:e,width:t})}};gt.EVENT_NAME="yatl-column-resize";var J=gt,yt=class yt extends E{constructor(e,t,i){super(yt.EVENT_NAME,{draggedColumn:e,droppedColumn:t,order:i},{cancelable:!0})}};yt.EVENT_NAME="yatl-column-reorder";var Z=yt,bt=class bt extends E{constructor(e){super(bt.EVENT_NAME,{query:e})}};bt.EVENT_NAME="yatl-search";var jt=bt;var vt=globalThis,St=vt.ShadowRoot&&(vt.ShadyCSS===void 0||vt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ut=Symbol(),ce=new WeakMap,Y=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Ut)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(St&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=ce.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&ce.set(t,e))}return e}toString(){return this.cssText}},ue=r=>new Y(typeof r=="string"?r:r+"",void 0,Ut),Ft=(r,...e)=>{let t=r.length===1?r[0]:e.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 Y(t,r,Ut)},de=(r,e)=>{if(St)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let i=document.createElement("style"),s=vt.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},Ht=St?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return ue(t)})(r):r;var{is:ri,defineProperty:ni,getOwnPropertyDescriptor:oi,getOwnPropertyNames:ai,getOwnPropertySymbols:li,getPrototypeOf:hi}=Object,R=globalThis,fe=R.trustedTypes,ci=fe?fe.emptyScript:"",ui=R.reactiveElementPolyfillSupport,tt=(r,e)=>r,et={toAttribute(r,e){switch(e){case Boolean:r=r?ci:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},wt=(r,e)=>!ri(r,e),pe={attribute:!0,type:String,converter:et,reflect:!1,useDefault:!1,hasChanged:wt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),R.litPropertyMetadata??(R.litPropertyMetadata=new WeakMap);var z=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=pe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&ni(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:n}=oi(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){let a=s?.call(this);n?.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??pe}static _$Ei(){if(this.hasOwnProperty(tt("elementProperties")))return;let e=hi(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(tt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(tt("properties"))){let t=this.properties,i=[...ai(t),...li(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[t,i]of this.elementProperties){let s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(Ht(s))}else e!==void 0&&t.push(Ht(e));return t}static _$Eu(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return de(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let n=(i.converter?.toAttribute!==void 0?i.converter:et).toAttribute(t,i.type);this._$Em=e,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(e,t){let i=this.constructor,s=i._$Eh.get(e);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:et;this._$Em=s;let a=o.fromAttribute(t,n.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,i,s=!1,n){if(e!==void 0){let o=this.constructor;if(s===!1&&(n=this[e]),i??(i=o.getPropertyOptions(e)),!((i.hasChanged??wt)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!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[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,a=this[s];o!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,n,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};z.elementStyles=[],z.shadowRootOptions={mode:"open"},z[tt("elementProperties")]=new Map,z[tt("finalized")]=new Map,ui?.({ReactiveElement:z}),(R.reactiveElementVersions??(R.reactiveElementVersions=[])).push("2.1.2");var st=globalThis,me=r=>r,Et=st.trustedTypes,_e=Et?Et.createPolicy("lit-html",{createHTML:r=>r}):void 0,Kt="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,Wt="?"+A,di=`<${Wt}>`,L=document,rt=()=>L.createComment(""),nt=r=>r===null||typeof r!="object"&&typeof r!="function",qt=Array.isArray,we=r=>qt(r)||typeof r?.[Symbol.iterator]=="function",Bt=`[
2
- \f\r]`,it=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ge=/-->/g,ye=/>/g,k=RegExp(`>|${Bt}(?:([^\\s"'>=/]+)(${Bt}*=${Bt}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),be=/'/g,ve=/"/g,Ee=/^(?:script|style|textarea|title)$/i,Qt=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),v=Qt(1),ji=Qt(2),Ui=Qt(3),w=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Se=new WeakMap,D=L.createTreeWalker(L,129);function Ce(r,e){if(!qt(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return _e!==void 0?_e.createHTML(e):e}var xe=(r,e)=>{let t=r.length-1,i=[],s,n=e===2?"<svg>":e===3?"<math>":"",o=it;for(let a=0;a<t;a++){let l=r[a],h,u,c=-1,d=0;for(;d<l.length&&(o.lastIndex=d,u=o.exec(l),u!==null);)d=o.lastIndex,o===it?u[1]==="!--"?o=ge:u[1]!==void 0?o=ye:u[2]!==void 0?(Ee.test(u[2])&&(s=RegExp("</"+u[2],"g")),o=k):u[3]!==void 0&&(o=k):o===k?u[0]===">"?(o=s??it,c=-1):u[1]===void 0?c=-2:(c=o.lastIndex-u[2].length,h=u[1],o=u[3]===void 0?k:u[3]==='"'?ve:be):o===ve||o===be?o=k:o===ge||o===ye?o=it:(o=k,s=void 0);let f=o===k&&r[a+1].startsWith("/>")?" ":"";n+=o===it?l+di:c>=0?(i.push(h),l.slice(0,c)+Kt+l.slice(c)+A+f):l+A+(c===-2?a:f)}return[Ce(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]},ot=class r{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0,a=e.length-1,l=this.parts,[h,u]=xe(e,t);if(this.el=r.createElement(h,i),D.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=D.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(Kt)){let d=u[o++],f=s.getAttribute(c).split(A),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:n,name:g[2],strings:f,ctor:g[1]==="."?xt:g[1]==="?"?Tt:g[1]==="@"?$t:N}),s.removeAttribute(c)}else c.startsWith(A)&&(l.push({type:6,index:n}),s.removeAttribute(c));if(Ee.test(s.tagName)){let c=s.textContent.split(A),d=c.length-1;if(d>0){s.textContent=Et?Et.emptyScript:"";for(let f=0;f<d;f++)s.append(c[f],rt()),D.nextNode(),l.push({type:2,index:++n});s.append(c[d],rt())}}}else if(s.nodeType===8)if(s.data===Wt)l.push({type:2,index:n});else{let c=-1;for(;(c=s.data.indexOf(A,c+1))!==-1;)l.push({type:7,index:n}),c+=A.length-1}n++}}static createElement(e,t){let i=L.createElement("template");return i.innerHTML=e,i}};function V(r,e,t=r,i){if(e===w)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl,n=nt(e)?void 0:e._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=s:t._$Cl=s),s!==void 0&&(e=V(r,s._$AS(r,e.values),s,i)),e}var Ct=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??L).importNode(t,!0);D.currentNode=s;let n=D.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new U(n,n.nextSibling,this,e):l.type===1?h=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(h=new zt(n,this,e)),this._$AV.push(h),l=i[++a]}o!==l?.index&&(n=D.nextNode(),o++)}return D.currentNode=L,s}p(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},U=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=V(this,e,t),nt(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==w&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):we(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==_&&nt(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=ot.createElement(Ce(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{let n=new Ct(s,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Se.get(e.strings);return t===void 0&&Se.set(e.strings,t=new ot(e)),t}k(e){qt(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,s=0;for(let n of e)s===t.length?t.push(i=new r(this.O(rt()),this.O(rt()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let i=me(e).nextSibling;me(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},N=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=t,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=_}_$AI(e,t=this,i,s){let n=this.strings,o=!1;if(n===void 0)e=V(this,e,t,0),o=!nt(e)||e!==this._$AH&&e!==w,o&&(this._$AH=e);else{let a=e,l,h;for(e=n[0],l=0;l<n.length-1;l++)h=V(this,a[i+l],t,l),h===w&&(h=this._$AH[l]),o||(o=!nt(h)||h!==this._$AH[l]),h===_?e=_:e!==_&&(e+=(h??"")+n[l+1]),this._$AH[l]=h}o&&!s&&this.j(e)}j(e){e===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},xt=class extends N{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_?void 0:e}},Tt=class extends N{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==_)}},$t=class extends N{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=V(this,e,t,0)??_)===w)return;let i=this._$AH,s=e===_&&i!==_||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==_&&(i===_||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},zt=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){V(this,e)}},Te={M:Kt,P:A,A:Wt,C:1,L:xe,R:Ct,D:we,V,I:U,H:N,N:Tt,U:$t,B:xt,F:zt},fi=st.litHtmlPolyfillSupport;fi?.(ot,U),(st.litHtmlVersions??(st.litHtmlVersions=[])).push("3.3.2");var $e=(r,e,t)=>{let i=t?.renderBefore??e,s=i._$litPart$;if(s===void 0){let n=t?.renderBefore??null;i._$litPart$=s=new U(e.insertBefore(rt(),n),n,void 0,t??{})}return s._$AI(r),s};var at=globalThis,C=class extends z{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=$e(t,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,at.litElementHydrateSupport?.({LitElement:C});var pi=at.litElementPolyfillSupport;pi?.({LitElement:C});(at.litElementVersions??(at.litElementVersions=[])).push("4.2.2");var ze=r=>r.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,e=>e.toUpperCase()),Gt=(r="\\S+")=>{let e=new RegExp(`"[^"]*"|${r}`,"g");return t=>(t.match(e)||[]).map(s=>(s=s.toLocaleLowerCase().trim(),s.startsWith('"')&&s.endsWith('"')?{value:s.slice(1,-1),quoted:!0}:{value:s,quoted:!1}))},Xt=Gt();function mi(r,e){return r in e}function M(r,e){let t=e.split("."),i=r;for(let s of t)if(i&&mi(s,i))i=i[s];else return;return i}function b(r,e){return e.find(t=>t.field===r)}function Ae(r,e){if(!r||!e||e.length===0)return r;let t=[...e].sort((a,l)=>a[0]-l[0]),i=[],s=t[0];for(let a=1;a<t.length;a++){let l=t[a];l[0]<s[1]?s[1]=Math.max(s[1],l[1]):(i.push(s),s=l)}i.push(s);let n=[],o=0;for(let[a,l]of i){let h=Math.max(0,Math.min(a,r.length)),u=Math.max(0,Math.min(l,r.length));h>o&&n.push(r.slice(o,h)),n.push(v`<mark class="highlight">${r.slice(h,u)}</mark>`),o=u}return o<r.length&&n.push(r.slice(o)),v`${n}`}function Jt(r,e="1fr"){return r.map(t=>t?`${t}px`:e)}function Me(r,e){if(!e)return!0;let t=new Set([...e.map(i=>i.field),...r.map(i=>i.field)]);for(let i of t){let s=b(i,e)?.sortState,n=b(i,r)?.sortState;if(s?.order!==n?.order||s?.priority!==n?.priority)return!0}return!1}function Oe(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r instanceof Date}var Pe=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};var _i={attribute:!0,type:String,converter:et,reflect:!1,hasChanged:wt},gi=(r=_i,e,t)=>{let{kind:i,metadata:s}=t,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(t.name,r),i==="accessor"){let{name:o}=t;return{set(a){let l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,r,a),a}}}if(i==="setter"){let{name:o}=t;return function(a){let l=this[o];e.call(this,a),this.requestUpdate(o,l,r,!0,a)}}throw Error("Unsupported decorator location: "+i)};function p(r){return(e,t)=>typeof t=="object"?gi(r,e,t):((i,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,i),o?Object.getOwnPropertyDescriptor(s,n):void 0})(r,e,t)}function Re(r){return p({...r,state:!0,attribute:!1})}var j=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function Zt(r,e){return(t,i,s)=>{let n=o=>o.renderRoot?.querySelector(r)??null;if(e){let{get:o,set:a}=typeof i=="object"?t:s??(()=>{let l=Symbol();return{get(){return this[l]},set(h){this[l]=h}}})();return j(t,i,{get(){let l=o.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return j(t,i,{get(){return n(this)}})}}var T={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},O=r=>(...e)=>({_$litDirective$:r,values:e}),x=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Yt=O(class extends x{constructor(r){if(super(r),r.type!==T.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(e=>r[e]).join(" ")+" "}update(r,[e]){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 e)e[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(e)}let t=r.element.classList;for(let i of this.st)i in e||(t.remove(i),this.st.delete(i));for(let i in e){let s=!!e[i];s===this.st.has(i)||this.nt?.has(i)||(s?(t.add(i),this.st.add(i)):(t.remove(i),this.st.delete(i)))}return w}});var te=r=>r??_;var{I:yi}=Te,Ie=r=>r;var De=r=>r.strings===void 0,ke=()=>document.createComment(""),F=(r,e,t)=>{let i=r._$AA.parentNode,s=e===void 0?r._$AB:e._$AA;if(t===void 0){let n=i.insertBefore(ke(),s),o=i.insertBefore(ke(),s);t=new yi(n,o,r,r.options)}else{let n=t._$AB.nextSibling,o=t._$AM,a=o!==r;if(a){let l;t._$AQ?.(r),t._$AM=r,t._$AP!==void 0&&(l=r._$AU)!==o._$AU&&t._$AP(l)}if(n!==s||a){let l=t._$AA;for(;l!==n;){let h=Ie(l).nextSibling;Ie(i).insertBefore(l,s),l=h}}}return t},I=(r,e,t=r)=>(r._$AI(e,t),r),bi={},Le=(r,e=bi)=>r._$AH=e,Ve=r=>r._$AH,At=r=>{r._$AR(),r._$AA.remove()};var Ne=(r,e,t)=>{let i=new Map;for(let s=e;s<=t;s++)i.set(r[s],s);return i},Mt=O(class extends x{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);let s=[],n=[],o=0;for(let a of r)s[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:s}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,i]){let s=Ve(r),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(s))return this.ut=o,n;let a=this.ut??(this.ut=[]),l=[],h,u,c=0,d=s.length-1,f=0,g=n.length-1;for(;c<=d&&f<=g;)if(s[c]===null)c++;else if(s[d]===null)d--;else if(a[c]===o[f])l[f]=I(s[c],n[f]),c++,f++;else if(a[d]===o[g])l[g]=I(s[d],n[g]),d--,g--;else if(a[c]===o[g])l[g]=I(s[c],n[g]),F(r,l[g+1],s[c]),c++,g--;else if(a[d]===o[f])l[f]=I(s[d],n[f]),F(r,s[c],s[d]),d--,f++;else if(h===void 0&&(h=Ne(o,f,g),u=Ne(a,c,d)),h.has(a[c]))if(h.has(a[d])){let S=u.get(o[f]),W=S!==void 0?s[S]:null;if(W===null){let $=F(r,s[c]);I($,n[f]),l[f]=$}else l[f]=I(W,n[f]),F(r,s[c],W),s[S]=null;f++}else At(s[d]),d--;else At(s[c]),c++;for(;f<=g;){let S=F(r,l[g+1]);I(S,n[f]),l[f++]=S}for(;c<=d;){let S=s[c++];S!==null&&At(S)}return this.ut=o,Le(r,l),w}});var je="important",vi=" !"+je,Ue=O(class extends x{constructor(r){if(super(r),r.type!==T.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((e,t)=>{let i=r[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(r,[e]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(let i in e){let s=e[i];if(s!=null){this.ft.add(i);let n=typeof s=="string"&&s.endsWith(vi);i.includes("-")||n?t.setProperty(i,n?s.slice(0,-11):s,n?je:""):t[i]=s}}return w}});function H(r,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,i);else for(var a=r.length-1;a>=0;a--)(o=r[a])&&(n=(s<3?o(n):s>3?o(e,t,n):o(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n}var lt=(r,e)=>{let t=r._$AN;if(t===void 0)return!1;for(let i of t)i._$AO?.(e,!1),lt(i,e);return!0},Ot=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},Fe=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),Ei(e)}};function Si(r){this._$AN!==void 0?(Ot(this),this._$AM=r,Fe(this)):this._$AM=r}function wi(r,e=!1,t=0){let i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)lt(i[n],!1),Ot(i[n]);else i!=null&&(lt(i,!1),Ot(i));else lt(this,r)}var Ei=r=>{r.type==T.CHILD&&(r._$AP??(r._$AP=wi),r._$AQ??(r._$AQ=Si))},Pt=class extends x{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),Fe(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(lt(this,e),Ot(this))}setValue(e){if(De(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var B=class r extends Event{constructor(e){super(r.eventName,{bubbles:!1}),this.first=e.first,this.last=e.last}};B.eventName="rangeChanged";var K=class r extends Event{constructor(e){super(r.eventName,{bubbles:!1}),this.first=e.first,this.last=e.last}};K.eventName="visibilityChanged";var ht=class r extends Event{constructor(){super(r.eventName,{bubbles:!1})}};ht.eventName="unpinned";var ee=class{constructor(e){this._element=null;let t=e??window;this._node=t,e&&(this._element=e)}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}},Rt=class extends ee{constructor(e,t){super(t),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(e)}get _destination(){return this.__destination}get scrolling(){return this._destination!==null}scrollTo(e,t){let i=typeof e=="number"&&typeof t=="number"?{left:e,top:t}:e;this._scrollTo(i)}scrollBy(e,t){let i=typeof e=="number"&&typeof t=="number"?{left:e,top:t}:e;i.top!==void 0&&(i.top+=this.scrollTop),i.left!==void 0&&(i.left+=this.scrollLeft),this._scrollTo(i)}_nativeScrollTo(e){this._originalScrollTo.bind(this._element||window)(e)}_scrollTo(e,t=null,i=null){this._end!==null&&this._end(),e.behavior==="smooth"?(this._setDestination(e),this._retarget=t,this._end=i):this._resetScrollState(),this._nativeScrollTo(e)}_setDestination(e){let{top:t,left:i}=e;return t=t===void 0?void 0:Math.max(0,Math.min(t,this.maxScrollTop)),i=i===void 0?void 0:Math.max(0,Math.min(i,this.maxScrollLeft)),this._destination!==null&&i===this._destination.left&&t===this._destination.top?!1:(this.__destination={top:t,left:i,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(e){this._destination&&this._setDestination(e)&&this._nativeScrollTo(this._destination)}managedScrollTo(e,t,i){return this._scrollTo(e,t,i),this._updateManagedScrollTo}correctScrollError(e){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(e),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(this._destination!==null){let{scrollTop:e,scrollLeft:t}=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-e),o=Math.abs(s-t);n<1&&o<1&&(this._end&&this._end(),this._resetScrollState())}}detach(e){return this._clients.delete(e),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(e){this._clients.add(e),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 Qe=typeof window<"u"?window.ResizeObserver:void 0;var ut=Symbol("virtualizerRef"),Dt="virtualizer-sizer",Ge,Vt=class{constructor(e){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,!e)throw new Error("Virtualizer constructor requires a configuration object");if(e.hostElement)this._init(e);else throw new Error('Virtualizer configuration requires the "hostElement" property')}set items(e){Array.isArray(e)&&e!==this._items&&(this._itemsChanged=!0,this._items=e,this._schedule(this._updateLayout))}_init(e){this._isScroller=!!e.scroller,this._initHostElement(e);let t=e.layout||{};this._layoutInitialized=this._initLayout(t)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new Qe(()=>this._hostElementSizeChanged()),this._childrenRO=new Qe(this._childrenSizeChanged.bind(this))}_initHostElement(e){let t=this._hostElement=e.hostElement;this._applyVirtualizerStyles(),t[ut]=this}connected(){this._initObservers();let e=this._isScroller;this._clippingAncestors=Mi(this._hostElement,e),this._scrollerController=new Rt(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(e=>{e.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(e),this._hostElementRO.observe(e)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(e=>this._childrenRO.observe(e)),this._scrollEventListeners.forEach(e=>e.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(e=>e.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 t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){let e=this._hostElement;if(!this._sizer){let t=e.querySelector(`[${Dt}]`);t||(t=document.createElement("div"),t.setAttribute(Dt,""),e.appendChild(t)),Object.assign(t.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),t.textContent="&nbsp;",t.setAttribute(Dt,""),this._sizer=t}return this._sizer}async updateLayoutConfig(e){await this._layoutInitialized;let t=e.type||Ge;if(typeof t=="function"&&this._layout instanceof t){let i={...e};return delete i.type,this._layout.config=i,!0}return!1}async _initLayout(e){let t,i;if(typeof e.type=="function"){i=e.type;let s={...e};delete s.type,t=s}else t=e;i===void 0&&(Ge=i=(await Promise.resolve().then(()=>(qe(),We))).FlowLayout),this._layout=new i(s=>this._handleLayoutMessage(s),t),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 e=window.performance.now(),t=e-this._benchmarkStart,s=performance.getEntriesByName("uv-virtualizing","measure").filter(n=>n.startTime>=this._benchmarkStart&&n.startTime<e).reduce((n,o)=>n+o.duration,0);return this._benchmarkStart=null,{timeElapsed:t,virtualizationTime:s}}return null}_measureChildren(){let e={},t=this._children,i=this._measureChildOverride||this._measureChild;for(let s=0;s<t.length;s++){let n=t[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(n))&&(e[o]=i.call(this,n,this._items[o]))}this._childMeasurements=e,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(e){let{width:t,height:i}=e.getBoundingClientRect();return Object.assign({width:t,height:i},zi(e))}async _schedule(e){this._scheduled.has(e)||(this._scheduled.add(e),await Promise.resolve(),this._scheduled.delete(e),e.call(this))}async _updateDOM(e){this._scrollSize=e.scrollSize,this._adjustRange(e.range),this._childrenPos=e.childPositions,this._scrollError=e.scrollError||null;let{_rangeChanged:t,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(t||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(e=>this._childrenRO.observe(e)),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(e){console.warn("Error measuring performance data: ",e)}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(e){switch(e.type){case"scroll":(e.currentTarget===window||this._clippingAncestors.includes(e.currentTarget))&&this._handleScrollEvent();break;default:console.warn("event not handled",e)}}_handleLayoutMessage(e){e.type==="stateChanged"?this._updateDOM(e):e.type==="visibilityChanged"?(this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._notifyVisibility()):e.type==="unpinned"&&this._hostElement.dispatchEvent(new ht)}get _children(){let e=[],t=this._hostElement.firstElementChild;for(;t;)t.hasAttribute(Dt)||e.push(t),t=t.nextElementSibling;return e}_updateView(){let e=this._hostElement,t=this._scrollerController?.element,i=this._layout;if(e&&t&&i){let s,n,o,a,l=e.getBoundingClientRect();s=0,n=0,o=window.innerHeight,a=window.innerWidth;let h=this._clippingAncestors.map($=>$.getBoundingClientRect());h.unshift(l);for(let $ of h)s=Math.max(s,$.top),n=Math.max(n,$.left),o=Math.min(o,$.bottom),a=Math.min(a,$.right);let u=t.getBoundingClientRect(),c={left:l.left-u.left,top:l.top-u.top},d={width:t.scrollWidth,height:t.scrollHeight},f=s-l.top+e.scrollTop,g=n-l.left+e.scrollLeft,S=Math.max(0,o-s),W=Math.max(0,a-n);i.viewportSize={width:W,height:S},i.viewportScroll={top:f,left:g},i.totalScrollSize=d,i.offsetWithinScroller=c}}_sizeHostElement(e){let i=e&&e.width!==null?Math.min(82e5,e.width):0,s=e&&e.height!==null?Math.min(82e5,e.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(e){e&&e.forEach(({top:t,left:i,width:s,height:n,xOffset:o,yOffset:a},l)=>{let h=this._children[l-this._first];h&&(h.style.position="absolute",h.style.boxSizing="border-box",h.style.transform=`translate(${i}px, ${t}px)`,s!==void 0&&(h.style.width=s+"px"),n!==void 0&&(h.style.height=n+"px"),h.style.left=o===void 0?null:o+"px",h.style.top=a===void 0?null:a+"px")})}async _adjustRange(e){let{_first:t,_last:i,_firstVisible:s,_lastVisible:n}=this;this._first=e.first,this._last=e.last,this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==t||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==n}_correctScrollError(){if(this._scrollError){let{scrollTop:e,scrollLeft:t}=this._scrollerController,{top:i,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:e-i,left:t-s})}}element(e){return e===1/0&&(e=this._items.length-1),this._items?.[e]===void 0?void 0:{scrollIntoView:(t={})=>this._scrollElementIntoView({...t,index:e})}}_scrollElementIntoView(e){if(e.index>=this._first&&e.index<=this._last)this._children[e.index-this._first].scrollIntoView(e);else if(e.index=Math.min(e.index,this._items.length-1),e.behavior==="smooth"){let t=this._layout.getScrollIntoViewCoordinates(e),{behavior:i}=e;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(t,{behavior:i}),()=>this._layout.getScrollIntoViewCoordinates(e),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=e}else this._layout.pin=e}_checkScrollIntoViewTarget(e){let{index:t}=this._scrollIntoViewTarget||{};t&&e?.has(t)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new B({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new K({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((e,t)=>{this._layoutCompleteResolver=e,this._layoutCompleteRejecter=t})),this._layoutCompletePromise}_rejectLayoutCompletePromise(e){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(e),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(e){if(this._layout?.measureChildren){for(let t of e)this._toBeMeasured.set(t.target,t.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}};function zi(r){let e=window.getComputedStyle(r);return{marginTop:Lt(e.marginTop),marginRight:Lt(e.marginRight),marginBottom:Lt(e.marginBottom),marginLeft:Lt(e.marginLeft)}}function Lt(r){let e=r?parseFloat(r):NaN;return Number.isNaN(e)?0:e}function Xe(r){if(r.assignedSlot!==null)return r.assignedSlot;if(r.parentElement!==null)return r.parentElement;let e=r.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}function Ai(r,e=!1){let t=[],i=e?r:Xe(r);for(;i!==null;)t.push(i),i=Xe(i);return t}function Mi(r,e=!1){let t=!1;return Ai(r,e).filter(i=>{if(t)return!1;let s=getComputedStyle(i);return t=s.position==="fixed",s.overflow!=="visible"})}var ne=r=>r,oe=(r,e)=>v`${e}: ${JSON.stringify(r,null,2)}`,re=class extends Pt{constructor(e){if(super(e),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,i)=>oe(t,i+this._first),this._keyFunction=(t,i)=>ne(t,i+this._first),this._items=[],e.type!==T.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(e){e&&this._setFunctions(e);let t=[];if(this._first>=0&&this._last>=this._first)for(let i=this._first;i<=this._last;i++)t.push(this._items[i]);return Mt(t,this._keyFunction,this._renderItem)}update(e,[t]){this._setFunctions(t);let i=this._items!==t.items;return this._items=t.items||[],this._virtualizer?this._updateVirtualizerConfig(e,t):this._initialize(e,t),i?w:this.render()}async _updateVirtualizerConfig(e,t){if(!await this._virtualizer.updateLayoutConfig(t.layout||{})){let s=e.parentNode;this._makeVirtualizer(s,t)}this._virtualizer.items=this._items}_setFunctions(e){let{renderItem:t,keyFunction:i}=e;t&&(this._renderItem=(s,n)=>t(s,n+this._first)),i&&(this._keyFunction=(s,n)=>i(s,n+this._first))}_makeVirtualizer(e,t){this._virtualizer&&this._virtualizer.disconnected();let{layout:i,scroller:s,items:n}=t;this._virtualizer=new Vt({hostElement:e,layout:i,scroller:s}),this._virtualizer.items=n,this._virtualizer.connected()}_initialize(e,t){let i=e.parentNode;i&&i.nodeType===1&&(i.addEventListener("rangeChanged",s=>{this._first=s.first,this._last=s.last,this.setValue(this.render())}),this._makeVirtualizer(i,t))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}},Je=O(re);var P=class extends C{constructor(){super(...arguments),this.items=[],this.renderItem=oe,this.keyFunction=ne,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){let{items:e,renderItem:t,keyFunction:i,layout:s,scroller:n}=this;return v`${Je({items:e,renderItem:t,keyFunction:i,layout:s,scroller:n})}`}element(e){return this[ut]?.element(e)}get layoutComplete(){return this[ut]?.layoutComplete}scrollToIndex(e,t="start"){this.element(e)?.scrollIntoView({block:t})}};H([p({attribute:!1})],P.prototype,"items",void 0);H([p()],P.prototype,"renderItem",void 0);H([p()],P.prototype,"keyFunction",void 0);H([p({attribute:!1})],P.prototype,"layout",void 0);H([p({reflect:!0,type:Boolean})],P.prototype,"scroller",void 0);customElements.define("lit-virtualizer",P);var Ze=Ft`
1
+ "use strict";var yatl=(()=>{var ft=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var ei=Object.getOwnPropertyNames;var ii=Object.prototype.hasOwnProperty;var Ut=(n,e)=>()=>(n&&(e=n(n=0)),e);var ue=(n,e)=>{for(var t in e)ft(n,t,{get:e[t],enumerable:!0})},si=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ei(e))!ii.call(n,s)&&s!==t&&ft(n,s,{get:()=>e[s],enumerable:!(i=ce(e,s))||i.enumerable});return n};var ri=n=>si(ft({},"__esModule",{value:!0}),n),_=(n,e,t,i)=>{for(var s=i>1?void 0:i?ce(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&ft(e,t,s),s};var ut,Ke=Ut(()=>{"use strict";ut=class{constructor(e){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,e?.roundAverageSize===!0&&(this._roundAverageSize=!0)}set(e,t){let i=this._map.get(e)||0;this._map.set(e,t),this.totalSize+=t-i}get averageSize(){if(this._map.size>0){let e=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(e):e}return 0}getSize(e){return this._map.get(e)}clear(){this._map.clear(),this.totalSize=0}}});function re(n){return n==="horizontal"?"width":"height"}var Dt,Be=Ut(()=>{"use strict";Dt=class{_getDefaultConfig(){return{direction:"vertical"}}constructor(e,t){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=e,Promise.resolve().then(()=>this.config=t||this._getDefaultConfig())}set config(e){Object.assign(this,Object.assign({},this._getDefaultConfig(),e))}get config(){return{direction:this.direction}}get items(){return this._items}set items(e){this._setItems(e)}_setItems(e){e!==this._items&&(this._items=e,this._scheduleReflow())}get direction(){return this._direction}set direction(e){e=e==="horizontal"?e:"vertical",e!==this._direction&&(this._direction=e,this._sizeDim=e==="horizontal"?"width":"height",this._secondarySizeDim=e==="horizontal"?"height":"width",this._positionDim=e==="horizontal"?"left":"top",this._secondaryPositionDim=e==="horizontal"?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(e){let{_viewDim1:t,_viewDim2:i}=this;Object.assign(this._viewportSize,e),i!==this._viewDim2?this._scheduleLayoutUpdate():t!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(e){Object.assign(this._latestCoords,e);let t=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(t-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(e=!1){(e||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(e){this._pin=e,this._triggerReflow()}get pin(){if(this._pin!==null){let{index:e,block:t}=this._pin;return{index:Math.max(0,Math.min(e,this.items.length-1)),block:t}}return null}_clampScrollPosition(e){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(e,this.totalScrollSize[re(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 e=this._scrollPosition,{index:t,block:i}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:t,block:i||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=e-this._scrollPosition}}_calculateScrollIntoViewPosition(e){let{block:t}=e,i=Math.min(this.items.length,Math.max(0,e.index)),s=this._getItemPosition(i)[this._positionDim],r=s;if(t!=="start"){let o=this._getItemSize(i)[this._sizeDim];if(t==="center")r=s-.5*this._viewDim1+.5*o;else{let l=s-this._viewDim1+o;if(t==="end")r=l;else{let a=this._scrollPosition;r=Math.abs(a-s)<Math.abs(a-l)?s:l}}}return r+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(r)}getScrollIntoViewCoordinates(e){return{[this._positionDim]:this._calculateScrollIntoViewPosition(e)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){let e=new Map;if(this._first!==-1&&this._last!==-1)for(let i=this._first;i<=this._last;i++)e.set(i,this._getItemPosition(i));let t={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:e};this._scrollError&&(t.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(t)}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 e=Math.max(0,this._scrollPosition-this._overhang),t=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>e||this._physicalMax<t?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(e){if(this._first===-1||this._last===-1)return;let t=this._first;for(;t<this._last&&Math.round(this._getItemPosition(t)[this._positionDim]+this._getItemSize(t)[this._sizeDim])<=Math.round(this._scrollPosition);)t++;let i=this._last;for(;i>this._first&&Math.round(this._getItemPosition(i)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)i--;(t!==this._firstVisible||i!==this._lastVisible)&&(this._firstVisible=t,this._lastVisible=i,e&&e.emit&&this._sendVisibilityChangedMessage())}}});var qe={};ue(qe,{FlowLayout:()=>Vt,flow:()=>xi});function We(n){return n==="horizontal"?"marginLeft":"marginTop"}function Ti(n){return n==="horizontal"?"marginRight":"marginBottom"}function $i(n){return n==="horizontal"?"xOffset":"yOffset"}function zi(n,e){let t=[n,e].sort();return t[1]<=0?Math.min(...t):t[0]>=0?Math.max(...t):t[0]+t[1]}var xi,ne,Vt,Qe=Ut(()=>{"use strict";Ke();Be();xi=n=>Object.assign({type:Vt},n);ne=class{constructor(){this._childSizeCache=new ut,this._marginSizeCache=new ut,this._metricsCache=new Map}update(e,t){let i=new Set;Object.keys(e).forEach(s=>{let r=Number(s);this._metricsCache.set(r,e[r]),this._childSizeCache.set(r,e[r][re(t)]),i.add(r),i.add(r+1)});for(let s of i){let r=this._metricsCache.get(s)?.[We(t)]||0,o=this._metricsCache.get(s-1)?.[Ti(t)]||0;this._marginSizeCache.set(s,zi(r,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(e,t){return this._metricsCache.get(e)?.[We(t)]||0}getChildSize(e){return this._childSizeCache.getSize(e)}getMarginSize(e){return this._marginSizeCache.getSize(e)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}},Vt=class extends Dt{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(e){this._metricsCache.update(e,this.direction),this._scheduleReflow()}_getPhysicalItem(e){return this._newPhysicalItems.get(e)??this._physicalItems.get(e)}_getSize(e){return this._getPhysicalItem(e)&&this._metricsCache.getChildSize(e)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(e){let t=this._metricsCache;if(this._first===-1||this._last===-1)return t.averageMarginSize+e*(t.averageMarginSize+this._getAverageSize());if(e<this._first){let i=this._first-e;return this._getPhysicalItem(this._first).pos-(t.getMarginSize(this._first-1)||t.averageMarginSize)-(i*t.averageChildSize+(i-1)*t.averageMarginSize)}else{let i=e-this._last;return this._getPhysicalItem(this._last).pos+(t.getChildSize(this._last)||t.averageChildSize)+(t.getMarginSize(this._last)||t.averageMarginSize)+i*(t.averageChildSize+t.averageMarginSize)}}_getPosition(e){let t=this._getPhysicalItem(e),{averageMarginSize:i}=this._metricsCache;return e===0?this._metricsCache.getMarginSize(0)??i:t?t.pos:this._estimatePosition(e)}_calculateAnchor(e,t){return e<=0?0:t>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((e+t)/2/this._delta)))}_getAnchor(e,t){if(this._physicalItems.size===0)return this._calculateAnchor(e,t);if(this._first<0)return this._calculateAnchor(e,t);if(this._last<0)return this._calculateAnchor(e,t);let i=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),r=i.pos;if(s.pos+this._metricsCache.getChildSize(this._last)<e)return this._calculateAnchor(e,t);if(r>t)return this._calculateAnchor(e,t);let a=this._firstVisible-1,h=-1/0;for(;h<e;)h=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 e=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=e,this._stable=!0}_getItems(){let e=this._newPhysicalItems;this._stable=!0;let t,i;if(this.pin!==null){let{index:h}=this.pin;this._anchorIdx=h,this._anchorPos=this._getPosition(h)}if(t=this._scrollPosition-this._overhang,i=this._scrollPosition+this._viewDim1+this._overhang,i<0||t>this._scrollSize){this._clearItems();return}(this._anchorIdx===null||this._anchorPos===null)&&(this._anchorIdx=this._getAnchor(t,i),this._anchorPos=this._getPosition(this._anchorIdx));let s=this._getSize(this._anchorIdx);s===void 0&&(this._stable=!1,s=this._getAverageSize());let r=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,o=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;this._anchorIdx===0&&(this._anchorPos=r),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-o-s);let l=0;for(this._anchorPos+s+o<t&&(l=t-(this._anchorPos+s+o)),this._anchorPos-r>i&&(l=i-(this._anchorPos-r)),l&&(this._scrollPosition-=l,t-=l,i-=l,this._scrollError+=l),e.set(this._anchorIdx,{pos:this._anchorPos,size:s}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-r,this._physicalMax=this._anchorPos+s+o;this._physicalMin>t&&this._first>0;){let h=this._getSize(--this._first);h===void 0&&(this._stable=!1,h=this._getAverageSize());let u=this._metricsCache.getMarginSize(this._first);u===void 0&&(this._stable=!1,u=this._metricsCache.averageMarginSize),this._physicalMin-=h;let c=this._physicalMin;if(e.set(this._first,{pos:c,size:h}),this._physicalMin-=u,this._stable===!1&&this._estimate===!1)break}for(;this._physicalMax<i&&this._last<this.items.length-1;){let h=this._getSize(++this._last);h===void 0&&(this._stable=!1,h=this._getAverageSize());let u=this._metricsCache.getMarginSize(this._last);u===void 0&&(this._stable=!1,u=this._metricsCache.averageMarginSize);let c=this._physicalMax;if(e.set(this._last,{pos:c,size:h}),this._physicalMax+=h+u,!this._stable&&!this._estimate)break}let a=this._calculateError();a&&(this._physicalMin-=a,this._physicalMax-=a,this._anchorPos-=a,this._scrollPosition-=a,e.forEach(h=>h.pos-=a),this._scrollError+=a),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=e)}_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:e,_last:t}=this;super._reflow(),(this._first===-1&&this._last==-1||this._first===e&&this._last===t)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){let{averageMarginSize:e}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(e+this._getAverageSize())+e)}get _delta(){let{averageMarginSize:e}=this._metricsCache;return this._getAverageSize()+e}_getItemPosition(e){return{[this._positionDim]:this._getPosition(e),[this._secondaryPositionDim]:0,[$i(this.direction)]:-(this._metricsCache.getLeadingMarginValue(e,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(e){return{[this._sizeDim]:this._getSize(e)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}});var ki={};ue(ki,{YatlChangeEvent:()=>Q,YatlColumnReorderEvent:()=>Z,YatlColumnResizeEvent:()=>J,YatlColumnToggleEvent:()=>X,YatlEvent:()=>E,YatlRowClickEvent:()=>q,YatlSearchEvent:()=>Ft,YatlSortEvent:()=>G,YatlStateChangeEvent:()=>Y,YatlTable:()=>m,createRegexTokenizer:()=>Jt,findColumn:()=>w,whitespaceTokenizer:()=>Zt});var E=class extends CustomEvent{constructor(e,t,i={}){super(e,{bubbles:!0,composed:!0,cancelable:!1,...i,detail:t})}},pt=class pt extends E{constructor(e,t,i,s){super(pt.EVENT_NAME,{row:e,index:t,field:i,originalEvent:s})}};pt.EVENT_NAME="yatl-row-click";var q=pt,mt=class mt extends E{constructor(e){super(mt.EVENT_NAME,{data:e})}};mt.EVENT_NAME="yatl-change";var Q=mt,_t=class _t extends E{constructor(e,t){super(_t.EVENT_NAME,{field:e,order:t},{cancelable:!0})}};_t.EVENT_NAME="yatl-sort";var G=_t,gt=class gt extends E{constructor(e,t){super(gt.EVENT_NAME,{field:e,visible:t},{cancelable:!0})}};gt.EVENT_NAME="yatl-column-toggle";var X=gt,yt=class yt extends E{constructor(e,t){super(yt.EVENT_NAME,{field:e,width:t})}};yt.EVENT_NAME="yatl-column-resize";var J=yt,bt=class bt extends E{constructor(e,t,i){super(bt.EVENT_NAME,{draggedColumn:e,droppedColumn:t,order:i},{cancelable:!0})}};bt.EVENT_NAME="yatl-column-reorder";var Z=bt,vt=class vt extends E{constructor(e){super(vt.EVENT_NAME,{query:e})}};vt.EVENT_NAME="yatl-search";var Ft=vt,St=class St extends E{constructor(t,i){super(St.EVENT_NAME,{state:t,triggers:i});this.triggers=i}};St.EVENT_NAME="yatl-state-change";var Y=St;var wt=globalThis,Et=wt.ShadowRoot&&(wt.ShadyCSS===void 0||wt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ht=Symbol(),de=new WeakMap,tt=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Ht)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Et&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=de.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&de.set(t,e))}return e}toString(){return this.cssText}},fe=n=>new tt(typeof n=="string"?n:n+"",void 0,Ht),Kt=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((i,s,r)=>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)+n[r+1],n[0]);return new tt(t,n,Ht)},pe=(n,e)=>{if(Et)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let i=document.createElement("style"),s=wt.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,n.appendChild(i)}},Bt=Et?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return fe(t)})(n):n;var{is:ni,defineProperty:oi,getOwnPropertyDescriptor:li,getOwnPropertyNames:ai,getOwnPropertySymbols:hi,getPrototypeOf:ci}=Object,R=globalThis,me=R.trustedTypes,ui=me?me.emptyScript:"",di=R.reactiveElementPolyfillSupport,et=(n,e)=>n,it={toAttribute(n,e){switch(e){case Boolean:n=n?ui:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ct=(n,e)=>!ni(n,e),_e={attribute:!0,type:String,converter:it,reflect:!1,useDefault:!1,hasChanged:Ct};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),R.litPropertyMetadata??(R.litPropertyMetadata=new WeakMap);var z=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_e){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&oi(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:r}=li(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){let l=s?.call(this);r?.call(this,o),this.requestUpdate(e,l,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_e}static _$Ei(){if(this.hasOwnProperty(et("elementProperties")))return;let e=ci(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(et("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(et("properties"))){let t=this.properties,i=[...ai(t),...hi(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[t,i]of this.elementProperties){let s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(Bt(s))}else e!==void 0&&t.push(Bt(e));return t}static _$Eu(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return pe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let r=(i.converter?.toAttribute!==void 0?i.converter:it).toAttribute(t,i.type);this._$Em=e,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(e,t){let i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let r=i.getPropertyOptions(s),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:it;this._$Em=s;let l=o.fromAttribute(t,r.type);this[s]=l??this._$Ej?.get(s)??l,this._$Em=null}}requestUpdate(e,t,i,s=!1,r){if(e!==void 0){let o=this.constructor;if(s===!1&&(r=this[e]),i??(i=o.getPropertyOptions(e)),!((i.hasChanged??Ct)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!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[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,r]of i){let{wrapped:o}=r,l=this[s];o!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,r,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};z.elementStyles=[],z.shadowRootOptions={mode:"open"},z[et("elementProperties")]=new Map,z[et("finalized")]=new Map,di?.({ReactiveElement:z}),(R.reactiveElementVersions??(R.reactiveElementVersions=[])).push("2.1.2");var rt=globalThis,ge=n=>n,xt=rt.trustedTypes,ye=xt?xt.createPolicy("lit-html",{createHTML:n=>n}):void 0,qt="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,Qt="?"+A,fi=`<${Qt}>`,V=document,nt=()=>V.createComment(""),ot=n=>n===null||typeof n!="object"&&typeof n!="function",Gt=Array.isArray,Ce=n=>Gt(n)||typeof n?.[Symbol.iterator]=="function",Wt=`[
2
+ \f\r]`,st=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,be=/-->/g,ve=/>/g,I=RegExp(`>|${Wt}(?:([^\\s"'>=/]+)(${Wt}*=${Wt}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Se=/'/g,we=/"/g,xe=/^(?:script|style|textarea|title)$/i,Xt=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),b=Xt(1),Ui=Xt(2),Fi=Xt(3),S=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Ee=new WeakMap,D=V.createTreeWalker(V,129);function Te(n,e){if(!Gt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ye!==void 0?ye.createHTML(e):e}var $e=(n,e)=>{let t=n.length-1,i=[],s,r=e===2?"<svg>":e===3?"<math>":"",o=st;for(let l=0;l<t;l++){let a=n[l],h,u,c=-1,d=0;for(;d<a.length&&(o.lastIndex=d,u=o.exec(a),u!==null);)d=o.lastIndex,o===st?u[1]==="!--"?o=be:u[1]!==void 0?o=ve:u[2]!==void 0?(xe.test(u[2])&&(s=RegExp("</"+u[2],"g")),o=I):u[3]!==void 0&&(o=I):o===I?u[0]===">"?(o=s??st,c=-1):u[1]===void 0?c=-2:(c=o.lastIndex-u[2].length,h=u[1],o=u[3]===void 0?I:u[3]==='"'?we:Se):o===we||o===Se?o=I:o===be||o===ve?o=st:(o=I,s=void 0);let f=o===I&&n[l+1].startsWith("/>")?" ":"";r+=o===st?a+fi:c>=0?(i.push(h),a.slice(0,c)+qt+a.slice(c)+A+f):a+A+(c===-2?l:f)}return[Te(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]},lt=class n{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0,l=e.length-1,a=this.parts,[h,u]=$e(e,t);if(this.el=n.createElement(h,i),D.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=D.nextNode())!==null&&a.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(qt)){let d=u[o++],f=s.getAttribute(c).split(A),y=/([.?@])?(.*)/.exec(d);a.push({type:1,index:r,name:y[2],strings:f,ctor:y[1]==="."?$t:y[1]==="?"?zt:y[1]==="@"?At:N}),s.removeAttribute(c)}else c.startsWith(A)&&(a.push({type:6,index:r}),s.removeAttribute(c));if(xe.test(s.tagName)){let c=s.textContent.split(A),d=c.length-1;if(d>0){s.textContent=xt?xt.emptyScript:"";for(let f=0;f<d;f++)s.append(c[f],nt()),D.nextNode(),a.push({type:2,index:++r});s.append(c[d],nt())}}}else if(s.nodeType===8)if(s.data===Qt)a.push({type:2,index:r});else{let c=-1;for(;(c=s.data.indexOf(A,c+1))!==-1;)a.push({type:7,index:r}),c+=A.length-1}r++}}static createElement(e,t){let i=V.createElement("template");return i.innerHTML=e,i}};function L(n,e,t=n,i){if(e===S)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl,r=ot(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),r===void 0?s=void 0:(s=new r(n),s._$AT(n,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=s:t._$Cl=s),s!==void 0&&(e=L(n,s._$AS(n,e.values),s,i)),e}var Tt=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??V).importNode(t,!0);D.currentNode=s;let r=D.nextNode(),o=0,l=0,a=i[0];for(;a!==void 0;){if(o===a.index){let h;a.type===2?h=new U(r,r.nextSibling,this,e):a.type===1?h=new a.ctor(r,a.name,a.strings,this,e):a.type===6&&(h=new Ot(r,this,e)),this._$AV.push(h),a=i[++l]}o!==a?.index&&(r=D.nextNode(),o++)}return D.currentNode=V,s}p(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},U=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=L(this,e,t),ot(e)?e===g||e==null||e===""?(this._$AH!==g&&this._$AR(),this._$AH=g):e!==this._$AH&&e!==S&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ce(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==g&&ot(this._$AH)?this._$AA.nextSibling.data=e:this.T(V.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=lt.createElement(Te(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{let r=new Tt(s,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Ee.get(e.strings);return t===void 0&&Ee.set(e.strings,t=new lt(e)),t}k(e){Gt(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,s=0;for(let r of e)s===t.length?t.push(i=new n(this.O(nt()),this.O(nt()),this,this.options)):i=t[s],i._$AI(r),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let i=ge(e).nextSibling;ge(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},N=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,r){this.type=1,this._$AH=g,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=g}_$AI(e,t=this,i,s){let r=this.strings,o=!1;if(r===void 0)e=L(this,e,t,0),o=!ot(e)||e!==this._$AH&&e!==S,o&&(this._$AH=e);else{let l=e,a,h;for(e=r[0],a=0;a<r.length-1;a++)h=L(this,l[i+a],t,a),h===S&&(h=this._$AH[a]),o||(o=!ot(h)||h!==this._$AH[a]),h===g?e=g:e!==g&&(e+=(h??"")+r[a+1]),this._$AH[a]=h}o&&!s&&this.j(e)}j(e){e===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},$t=class extends N{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===g?void 0:e}},zt=class extends N{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==g)}},At=class extends N{constructor(e,t,i,s,r){super(e,t,i,s,r),this.type=5}_$AI(e,t=this){if((e=L(this,e,t,0)??g)===S)return;let i=this._$AH,s=e===g&&i!==g||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==g&&(i===g||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ot=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){L(this,e)}},ze={M:qt,P:A,A:Qt,C:1,L:$e,R:Tt,D:Ce,V:L,I:U,H:N,N:zt,U:At,B:$t,F:Ot},pi=rt.litHtmlPolyfillSupport;pi?.(lt,U),(rt.litHtmlVersions??(rt.litHtmlVersions=[])).push("3.3.2");var Ae=(n,e,t)=>{let i=t?.renderBefore??e,s=i._$litPart$;if(s===void 0){let r=t?.renderBefore??null;i._$litPart$=s=new U(e.insertBefore(nt(),r),r,void 0,t??{})}return s._$AI(n),s};var at=globalThis,C=class extends z{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ae(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return S}};C._$litElement$=!0,C.finalized=!0,at.litElementHydrateSupport?.({LitElement:C});var mi=at.litElementPolyfillSupport;mi?.({LitElement:C});(at.litElementVersions??(at.litElementVersions=[])).push("4.2.2");var Oe=n=>n.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,e=>e.toUpperCase()),Jt=(n="\\S+")=>{let e=new RegExp(`"[^"]*"|${n}`,"g");return t=>(t.match(e)||[]).map(s=>(s=s.toLocaleLowerCase().trim(),s.startsWith('"')&&s.endsWith('"')?{value:s.slice(1,-1),quoted:!0}:{value:s,quoted:!1}))},Zt=Jt();function _i(n,e){return n in e}function O(n,e){let t=e.split("."),i=n;for(let s of t)if(i&&_i(s,i))i=i[s];else return;return i}function w(n,e){return e.find(t=>t.field===n)}function Me(n,e){if(!n||!e||e.length===0)return n;let t=[...e].sort((l,a)=>l[0]-a[0]),i=[],s=t[0];for(let l=1;l<t.length;l++){let a=t[l];a[0]<s[1]?s[1]=Math.max(s[1],a[1]):(i.push(s),s=a)}i.push(s);let r=[],o=0;for(let[l,a]of i){let h=Math.max(0,Math.min(l,n.length)),u=Math.max(0,Math.min(a,n.length));h>o&&r.push(n.slice(o,h)),r.push(b`<mark class="highlight">${n.slice(h,u)}</mark>`),o=u}return o<n.length&&r.push(n.slice(o)),b`${r}`}function Yt(n,e="1fr"){return n.map(t=>t?`${t}px`:e)}function Pe(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n instanceof Date}var Re=n=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};var gi={attribute:!0,type:String,converter:it,reflect:!1,hasChanged:Ct},yi=(n=gi,e,t)=>{let{kind:i,metadata:s}=t,r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),i==="setter"&&((n=Object.create(n)).wrapped=!0),r.set(t.name,n),i==="accessor"){let{name:o}=t;return{set(l){let a=e.get.call(this);e.set.call(this,l),this.requestUpdate(o,a,n,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,n,l),l}}}if(i==="setter"){let{name:o}=t;return function(l){let a=this[o];e.call(this,l),this.requestUpdate(o,a,n,!0,l)}}throw Error("Unsupported decorator location: "+i)};function p(n){return(e,t)=>typeof t=="object"?yi(n,e,t):((i,s,r)=>{let o=s.hasOwnProperty(r);return s.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(n,e,t)}function ke(n){return p({...n,state:!0,attribute:!1})}var j=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);function te(n,e){return(t,i,s)=>{let r=o=>o.renderRoot?.querySelector(n)??null;if(e){let{get:o,set:l}=typeof i=="object"?t:s??(()=>{let a=Symbol();return{get(){return this[a]},set(h){this[a]=h}}})();return j(t,i,{get(){let a=o.call(this);return a===void 0&&(a=r(this),(a!==null||this.hasUpdated)&&l.call(this,a)),a}})}return j(t,i,{get(){return r(this)}})}}var T={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},M=n=>(...e)=>({_$litDirective$:n,values:e}),x=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var ee=M(class extends x{constructor(n){if(super(n),n.type!==T.ATTRIBUTE||n.name!=="class"||n.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(e=>n[e]).join(" ")+" "}update(n,[e]){if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in e)e[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(e)}let t=n.element.classList;for(let i of this.st)i in e||(t.remove(i),this.st.delete(i));for(let i in e){let s=!!e[i];s===this.st.has(i)||this.nt?.has(i)||(s?(t.add(i),this.st.add(i)):(t.remove(i),this.st.delete(i)))}return S}});var ie=n=>n??g;var{I:bi}=ze,Ie=n=>n;var Ve=n=>n.strings===void 0,De=()=>document.createComment(""),F=(n,e,t)=>{let i=n._$AA.parentNode,s=e===void 0?n._$AB:e._$AA;if(t===void 0){let r=i.insertBefore(De(),s),o=i.insertBefore(De(),s);t=new bi(r,o,n,n.options)}else{let r=t._$AB.nextSibling,o=t._$AM,l=o!==n;if(l){let a;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(a=n._$AU)!==o._$AU&&t._$AP(a)}if(r!==s||l){let a=t._$AA;for(;a!==r;){let h=Ie(a).nextSibling;Ie(i).insertBefore(a,s),a=h}}}return t},k=(n,e,t=n)=>(n._$AI(e,t),n),vi={},Le=(n,e=vi)=>n._$AH=e,Ne=n=>n._$AH,Mt=n=>{n._$AR(),n._$AA.remove()};var je=(n,e,t)=>{let i=new Map;for(let s=e;s<=t;s++)i.set(n[s],s);return i},Pt=M(class extends x{constructor(n){if(super(n),n.type!==T.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);let s=[],r=[],o=0;for(let l of n)s[o]=i?i(l,o):o,r[o]=t(l,o),o++;return{values:r,keys:s}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,i]){let s=Ne(n),{values:r,keys:o}=this.dt(e,t,i);if(!Array.isArray(s))return this.ut=o,r;let l=this.ut??(this.ut=[]),a=[],h,u,c=0,d=s.length-1,f=0,y=r.length-1;for(;c<=d&&f<=y;)if(s[c]===null)c++;else if(s[d]===null)d--;else if(l[c]===o[f])a[f]=k(s[c],r[f]),c++,f++;else if(l[d]===o[y])a[y]=k(s[d],r[y]),d--,y--;else if(l[c]===o[y])a[y]=k(s[c],r[y]),F(n,a[y+1],s[c]),c++,y--;else if(l[d]===o[f])a[f]=k(s[d],r[f]),F(n,s[c],s[d]),d--,f++;else if(h===void 0&&(h=je(o,f,y),u=je(l,c,d)),h.has(l[c]))if(h.has(l[d])){let v=u.get(o[f]),W=v!==void 0?s[v]:null;if(W===null){let $=F(n,s[c]);k($,r[f]),a[f]=$}else a[f]=k(W,r[f]),F(n,s[c],W),s[v]=null;f++}else Mt(s[d]),d--;else Mt(s[c]),c++;for(;f<=y;){let v=F(n,a[y+1]);k(v,r[f]),a[f++]=v}for(;c<=d;){let v=s[c++];v!==null&&Mt(v)}return this.ut=o,Le(n,a),S}});var Ue="important",Si=" !"+Ue,Fe=M(class extends x{constructor(n){if(super(n),n.type!==T.ATTRIBUTE||n.name!=="style"||n.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(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(let i in e){let s=e[i];if(s!=null){this.ft.add(i);let r=typeof s=="string"&&s.endsWith(Si);i.includes("-")||r?t.setProperty(i,r?s.slice(0,-11):s,r?Ue:""):t[i]=s}}return S}});function H(n,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,t,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r}var ht=(n,e)=>{let t=n._$AN;if(t===void 0)return!1;for(let i of t)i._$AO?.(e,!1),ht(i,e);return!0},Rt=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},He=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),Ci(e)}};function wi(n){this._$AN!==void 0?(Rt(this),this._$AM=n,He(this)):this._$AM=n}function Ei(n,e=!1,t=0){let i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let r=t;r<i.length;r++)ht(i[r],!1),Rt(i[r]);else i!=null&&(ht(i,!1),Rt(i));else ht(this,n)}var Ci=n=>{n.type==T.CHILD&&(n._$AP??(n._$AP=Ei),n._$AQ??(n._$AQ=wi))},kt=class extends x{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),He(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(ht(this,e),Rt(this))}setValue(e){if(Ve(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var K=class n extends Event{constructor(e){super(n.eventName,{bubbles:!1}),this.first=e.first,this.last=e.last}};K.eventName="rangeChanged";var B=class n extends Event{constructor(e){super(n.eventName,{bubbles:!1}),this.first=e.first,this.last=e.last}};B.eventName="visibilityChanged";var ct=class n extends Event{constructor(){super(n.eventName,{bubbles:!1})}};ct.eventName="unpinned";var se=class{constructor(e){this._element=null;let t=e??window;this._node=t,e&&(this._element=e)}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}},It=class extends se{constructor(e,t){super(t),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(e)}get _destination(){return this.__destination}get scrolling(){return this._destination!==null}scrollTo(e,t){let i=typeof e=="number"&&typeof t=="number"?{left:e,top:t}:e;this._scrollTo(i)}scrollBy(e,t){let i=typeof e=="number"&&typeof t=="number"?{left:e,top:t}:e;i.top!==void 0&&(i.top+=this.scrollTop),i.left!==void 0&&(i.left+=this.scrollLeft),this._scrollTo(i)}_nativeScrollTo(e){this._originalScrollTo.bind(this._element||window)(e)}_scrollTo(e,t=null,i=null){this._end!==null&&this._end(),e.behavior==="smooth"?(this._setDestination(e),this._retarget=t,this._end=i):this._resetScrollState(),this._nativeScrollTo(e)}_setDestination(e){let{top:t,left:i}=e;return t=t===void 0?void 0:Math.max(0,Math.min(t,this.maxScrollTop)),i=i===void 0?void 0:Math.max(0,Math.min(i,this.maxScrollLeft)),this._destination!==null&&i===this._destination.left&&t===this._destination.top?!1:(this.__destination={top:t,left:i,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(e){this._destination&&this._setDestination(e)&&this._nativeScrollTo(this._destination)}managedScrollTo(e,t,i){return this._scrollTo(e,t,i),this._updateManagedScrollTo}correctScrollError(e){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(e),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(this._destination!==null){let{scrollTop:e,scrollLeft:t}=this,{top:i,left:s}=this._destination;i=Math.min(i||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);let r=Math.abs(i-e),o=Math.abs(s-t);r<1&&o<1&&(this._end&&this._end(),this._resetScrollState())}}detach(e){return this._clients.delete(e),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(e){this._clients.add(e),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 Ge=typeof window<"u"?window.ResizeObserver:void 0;var dt=Symbol("virtualizerRef"),Lt="virtualizer-sizer",Xe,jt=class{constructor(e){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,!e)throw new Error("Virtualizer constructor requires a configuration object");if(e.hostElement)this._init(e);else throw new Error('Virtualizer configuration requires the "hostElement" property')}set items(e){Array.isArray(e)&&e!==this._items&&(this._itemsChanged=!0,this._items=e,this._schedule(this._updateLayout))}_init(e){this._isScroller=!!e.scroller,this._initHostElement(e);let t=e.layout||{};this._layoutInitialized=this._initLayout(t)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new Ge(()=>this._hostElementSizeChanged()),this._childrenRO=new Ge(this._childrenSizeChanged.bind(this))}_initHostElement(e){let t=this._hostElement=e.hostElement;this._applyVirtualizerStyles(),t[dt]=this}connected(){this._initObservers();let e=this._isScroller;this._clippingAncestors=Mi(this._hostElement,e),this._scrollerController=new It(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(e=>{e.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(e),this._hostElementRO.observe(e)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(e=>this._childrenRO.observe(e)),this._scrollEventListeners.forEach(e=>e.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(e=>e.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 t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){let e=this._hostElement;if(!this._sizer){let t=e.querySelector(`[${Lt}]`);t||(t=document.createElement("div"),t.setAttribute(Lt,""),e.appendChild(t)),Object.assign(t.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),t.textContent="&nbsp;",t.setAttribute(Lt,""),this._sizer=t}return this._sizer}async updateLayoutConfig(e){await this._layoutInitialized;let t=e.type||Xe;if(typeof t=="function"&&this._layout instanceof t){let i={...e};return delete i.type,this._layout.config=i,!0}return!1}async _initLayout(e){let t,i;if(typeof e.type=="function"){i=e.type;let s={...e};delete s.type,t=s}else t=e;i===void 0&&(Xe=i=(await Promise.resolve().then(()=>(Qe(),qe))).FlowLayout),this._layout=new i(s=>this._handleLayoutMessage(s),t),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 e=window.performance.now(),t=e-this._benchmarkStart,s=performance.getEntriesByName("uv-virtualizing","measure").filter(r=>r.startTime>=this._benchmarkStart&&r.startTime<e).reduce((r,o)=>r+o.duration,0);return this._benchmarkStart=null,{timeElapsed:t,virtualizationTime:s}}return null}_measureChildren(){let e={},t=this._children,i=this._measureChildOverride||this._measureChild;for(let s=0;s<t.length;s++){let r=t[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(r))&&(e[o]=i.call(this,r,this._items[o]))}this._childMeasurements=e,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(e){let{width:t,height:i}=e.getBoundingClientRect();return Object.assign({width:t,height:i},Ai(e))}async _schedule(e){this._scheduled.has(e)||(this._scheduled.add(e),await Promise.resolve(),this._scheduled.delete(e),e.call(this))}async _updateDOM(e){this._scrollSize=e.scrollSize,this._adjustRange(e.range),this._childrenPos=e.childPositions,this._scrollError=e.scrollError||null;let{_rangeChanged:t,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(t||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(e=>this._childrenRO.observe(e)),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(e){console.warn("Error measuring performance data: ",e)}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(e){switch(e.type){case"scroll":(e.currentTarget===window||this._clippingAncestors.includes(e.currentTarget))&&this._handleScrollEvent();break;default:console.warn("event not handled",e)}}_handleLayoutMessage(e){e.type==="stateChanged"?this._updateDOM(e):e.type==="visibilityChanged"?(this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._notifyVisibility()):e.type==="unpinned"&&this._hostElement.dispatchEvent(new ct)}get _children(){let e=[],t=this._hostElement.firstElementChild;for(;t;)t.hasAttribute(Lt)||e.push(t),t=t.nextElementSibling;return e}_updateView(){let e=this._hostElement,t=this._scrollerController?.element,i=this._layout;if(e&&t&&i){let s,r,o,l,a=e.getBoundingClientRect();s=0,r=0,o=window.innerHeight,l=window.innerWidth;let h=this._clippingAncestors.map($=>$.getBoundingClientRect());h.unshift(a);for(let $ of h)s=Math.max(s,$.top),r=Math.max(r,$.left),o=Math.min(o,$.bottom),l=Math.min(l,$.right);let u=t.getBoundingClientRect(),c={left:a.left-u.left,top:a.top-u.top},d={width:t.scrollWidth,height:t.scrollHeight},f=s-a.top+e.scrollTop,y=r-a.left+e.scrollLeft,v=Math.max(0,o-s),W=Math.max(0,l-r);i.viewportSize={width:W,height:v},i.viewportScroll={top:f,left:y},i.totalScrollSize=d,i.offsetWithinScroller=c}}_sizeHostElement(e){let i=e&&e.width!==null?Math.min(82e5,e.width):0,s=e&&e.height!==null?Math.min(82e5,e.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${s}px)`;else{let r=this._hostElement.style;r.minWidth=i?`${i}px`:"100%",r.minHeight=s?`${s}px`:"100%"}}_positionChildren(e){e&&e.forEach(({top:t,left:i,width:s,height:r,xOffset:o,yOffset:l},a)=>{let h=this._children[a-this._first];h&&(h.style.position="absolute",h.style.boxSizing="border-box",h.style.transform=`translate(${i}px, ${t}px)`,s!==void 0&&(h.style.width=s+"px"),r!==void 0&&(h.style.height=r+"px"),h.style.left=o===void 0?null:o+"px",h.style.top=l===void 0?null:l+"px")})}async _adjustRange(e){let{_first:t,_last:i,_firstVisible:s,_lastVisible:r}=this;this._first=e.first,this._last=e.last,this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==t||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==r}_correctScrollError(){if(this._scrollError){let{scrollTop:e,scrollLeft:t}=this._scrollerController,{top:i,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:e-i,left:t-s})}}element(e){return e===1/0&&(e=this._items.length-1),this._items?.[e]===void 0?void 0:{scrollIntoView:(t={})=>this._scrollElementIntoView({...t,index:e})}}_scrollElementIntoView(e){if(e.index>=this._first&&e.index<=this._last)this._children[e.index-this._first].scrollIntoView(e);else if(e.index=Math.min(e.index,this._items.length-1),e.behavior==="smooth"){let t=this._layout.getScrollIntoViewCoordinates(e),{behavior:i}=e;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(t,{behavior:i}),()=>this._layout.getScrollIntoViewCoordinates(e),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=e}else this._layout.pin=e}_checkScrollIntoViewTarget(e){let{index:t}=this._scrollIntoViewTarget||{};t&&e?.has(t)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new K({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((e,t)=>{this._layoutCompleteResolver=e,this._layoutCompleteRejecter=t})),this._layoutCompletePromise}_rejectLayoutCompletePromise(e){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(e),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(e){if(this._layout?.measureChildren){for(let t of e)this._toBeMeasured.set(t.target,t.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}};function Ai(n){let e=window.getComputedStyle(n);return{marginTop:Nt(e.marginTop),marginRight:Nt(e.marginRight),marginBottom:Nt(e.marginBottom),marginLeft:Nt(e.marginLeft)}}function Nt(n){let e=n?parseFloat(n):NaN;return Number.isNaN(e)?0:e}function Je(n){if(n.assignedSlot!==null)return n.assignedSlot;if(n.parentElement!==null)return n.parentElement;let e=n.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}function Oi(n,e=!1){let t=[],i=e?n:Je(n);for(;i!==null;)t.push(i),i=Je(i);return t}function Mi(n,e=!1){let t=!1;return Oi(n,e).filter(i=>{if(t)return!1;let s=getComputedStyle(i);return t=s.position==="fixed",s.overflow!=="visible"})}var le=n=>n,ae=(n,e)=>b`${e}: ${JSON.stringify(n,null,2)}`,oe=class extends kt{constructor(e){if(super(e),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,i)=>ae(t,i+this._first),this._keyFunction=(t,i)=>le(t,i+this._first),this._items=[],e.type!==T.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(e){e&&this._setFunctions(e);let t=[];if(this._first>=0&&this._last>=this._first)for(let i=this._first;i<=this._last;i++)t.push(this._items[i]);return Pt(t,this._keyFunction,this._renderItem)}update(e,[t]){this._setFunctions(t);let i=this._items!==t.items;return this._items=t.items||[],this._virtualizer?this._updateVirtualizerConfig(e,t):this._initialize(e,t),i?S:this.render()}async _updateVirtualizerConfig(e,t){if(!await this._virtualizer.updateLayoutConfig(t.layout||{})){let s=e.parentNode;this._makeVirtualizer(s,t)}this._virtualizer.items=this._items}_setFunctions(e){let{renderItem:t,keyFunction:i}=e;t&&(this._renderItem=(s,r)=>t(s,r+this._first)),i&&(this._keyFunction=(s,r)=>i(s,r+this._first))}_makeVirtualizer(e,t){this._virtualizer&&this._virtualizer.disconnected();let{layout:i,scroller:s,items:r}=t;this._virtualizer=new jt({hostElement:e,layout:i,scroller:s}),this._virtualizer.items=r,this._virtualizer.connected()}_initialize(e,t){let i=e.parentNode;i&&i.nodeType===1&&(i.addEventListener("rangeChanged",s=>{this._first=s.first,this._last=s.last,this.setValue(this.render())}),this._makeVirtualizer(i,t))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}},Ze=M(oe);var P=class extends C{constructor(){super(...arguments),this.items=[],this.renderItem=ae,this.keyFunction=le,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){let{items:e,renderItem:t,keyFunction:i,layout:s,scroller:r}=this;return b`${Ze({items:e,renderItem:t,keyFunction:i,layout:s,scroller:r})}`}element(e){return this[dt]?.element(e)}get layoutComplete(){return this[dt]?.layoutComplete}scrollToIndex(e,t="start"){this.element(e)?.scrollIntoView({block:t})}};H([p({attribute:!1})],P.prototype,"items",void 0);H([p()],P.prototype,"renderItem",void 0);H([p()],P.prototype,"keyFunction",void 0);H([p({attribute:!1})],P.prototype,"layout",void 0);H([p({reflect:!0,type:Boolean})],P.prototype,"scroller",void 0);customElements.define("lit-virtualizer",P);var Ye=Kt`
4
4
  /* Style declarations */
5
5
  :host {
6
6
  /* Typography */
@@ -296,93 +296,93 @@
296
296
  overflow: hidden;
297
297
  text-overflow: ellipsis;
298
298
  }
299
- `;var Oi=1e3,Ye={storage:"local",saveColumnSortOrders:!0,saveColumnVisibility:!0,saveColumnWidths:!0,saveColumnOrder:!0},Pi=new Set(["searchQuery","filters","columns","columnStates","storageOptions"]),ae={EXACT:100,PREFIX:50,SUBSTRING:10},m=class extends C{constructor(){super(...arguments);this._enableSearchTokenization=!1;this._enableSearchScoring=!1;this._columns=[];this._columnStates=[];this._storageOptions=null;this._data=[];this._searchQuery="";this._searchIncludedFields=[];this._searchTokenizer=Xt;this._filters=null;this._filteredData=[];this.hasRestoredState=!1;this.saveTimer=0;this.filterDirty=!1;this.sortDirty=!1;this.dataLastUpdate=null;this.rowMetadata=new WeakMap;this.queryTokens=null;this.resizeState=null;this.dragColumn=null;this.enableVirtualScroll=!1;this.enableSearchHighlight=!0;this.enableColumnReorder=!0;this.enableFooter=!1;this.nullValuePlaceholder="-";this.emptyMessage="No records to display";this.noResultsMessage="No matching records found";this.rowParts=null;this.handleHeaderClicked=(t,i)=>{let s=t.target;if(!i.sortable||s.classList.contains("resizer"))return;let n=t.shiftKey,o=b(i.field,this._columnStates);o?.sortState?o.sortState.order==="asc"?this.sort(i.field,"desc",!n):o.sortState.order&&this.sort(i.field,null,!n):this.sort(i.field,"asc",!n)};this.handleCellClick=(t,i,s)=>{if(window.getSelection()?.toString())return;let n=this.rowMetadata.get(i).index;this.dispatchEvent(new q(i,n,s,t))};this.handleResizeMouseMove=t=>{this.resizeState?.active&&requestAnimationFrame(()=>{if(!this.resizeState?.active)return;let i=t.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=t=>{if(window.removeEventListener("mousemove",this.handleResizeMouseMove),window.removeEventListener("mouseup",this.handleResizeMouseUp),document.body.style.cursor="",this.resizeState?.active){let i=parseFloat(this.resizeState.currentWidths[this.resizeState.columnIndex]),s=this.columnStates,n=b(this.resizeState.columnField,s);n.width=i,this.columnStates=s,this.dispatchEvent(new J(n.field,n.width))}this.resizeState=null};this.handleDragColumnStart=(t,i)=>{let s=t.target;if(console.log("Starting drag event"),console.log(s),s?.classList.contains("resizer")){t.preventDefault();return}t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",i),this.dragColumn=i)};this.handleDragColumnEnter=t=>{t.currentTarget.querySelector(".drop-indicator")?.classList.add("active")};this.handleDragColumnLeave=t=>{let i=t.currentTarget,s=t.relatedTarget;i.contains(s)||i.querySelector(".drop-indicator")?.classList.remove("active")};this.handleDragColumnOver=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")};this.handleDragColumnDrop=(t,i)=>{if(!this.dragColumn||this.dragColumn===i)return;t.preventDefault(),t.stopPropagation();let s=[...this.columns],n=s.findIndex(a=>a.field===this.dragColumn),o=s.findIndex(a=>a.field===i);if(n>-1&&o>-1){let[a]=s.splice(n,1),l=b(i,this.columns);if(!l)return;s.splice(o,0,a);let h=s.map(c=>c.field),u=new Z(a.field,l.field,h);if(!this.dispatchEvent(u))return;this.setColumnOrder(h)}};this.handleDragColumnEnd=()=>{this.dragColumn=null,this.tableElement.querySelectorAll(".drop-indicator.active").forEach(t=>t.classList.remove("active"))}}get enableSearchTokenization(){return this._enableSearchTokenization}set enableSearchTokenization(t){if(this._enableSearchTokenization===t)return;let i=this._enableSearchTokenization;this._enableSearchTokenization=t,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("enableSearchTokenization",i)}get enableSearchScoring(){return this._enableSearchScoring}set enableSearchScoring(t){if(this._enableSearchScoring===t)return;let i=this._enableSearchScoring;this._enableSearchScoring=t,this.filterDirty=!0,this.requestUpdate("enableSearchScoring",i)}get columns(){return this._columns}set columns(t){if(this._columns===t)return;let i=this._columns;this._columns=t,this.createColumnStates(),this.filterDirty=!0,this.requestUpdate("columns",i)}get columnStates(){return this._columnStates.map(t=>({...t,sortState:t.sortState?{...t.sortState}:void 0}))}set columnStates(t){if(this._columnStates===t)return;let i=this._columnStates;this._columnStates=t,Me(this._columnStates,i)&&(this.sortDirty=!0),this.requestUpdate("columnStates",i)}get searchQuery(){return this._searchQuery}set searchQuery(t){if(this._searchQuery===t)return;let i=this._searchQuery;this._searchQuery=t,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("searchQuery",i)}get searchIncludedFields(){return this._searchIncludedFields}set searchIncludedFields(t){if(this._searchIncludedFields===t)return;let i=this._searchIncludedFields;this._searchIncludedFields=t,this.filterDirty=!0,this.requestUpdate("searchIncludedFields",i)}get searchTokenizer(){return this._searchTokenizer}set searchTokenizer(t){if(this._searchTokenizer===t)return;let i=this._searchTokenizer;this._searchTokenizer=t,this.filterDirty=!0,this.requestUpdate("searchTokenizer",i)}get filters(){return this._filters}set filters(t){if(this._filters===t)return;let i=this._filters;this._filters=t,this.filterDirty=!0,this.requestUpdate("filters",i)}get storageOptions(){return this._storageOptions}set storageOptions(t){if(this._storageOptions===t)return;let i=this._storageOptions;this._storageOptions=t,this.hasRestoredState||this.loadStateFromStorage(),this.requestUpdate("storageOptions",i)}get data(){return this._data}set data(t){let i=this._data;this._data=t,this.dataLastUpdate=new Date,this.createMetadata(),this.filterDirty=!0,this.requestUpdate("data",i)}get filteredData(){return this.filterDirty?this.filterRows():this.sortDirty&&this.sortRows(),this.filterDirty=!1,this.sortDirty=!1,[...this._filteredData]}getState(){let t=this.columnStates;return{searchQuery:this.searchQuery,filters:this.filters,columnOrder:this.columns.map(i=>i.field),columns:this.columns.map(i=>{let s=b(i.field,t);return{field:i.field,visible:s?.visible??!0,sortState:s?.sortState,width:s?.width}})}}restoreState(t){if("searchQuery"in t&&t.searchQuery!==void 0&&(this.searchQuery=t.searchQuery),"filters"in t&&t.filters!==void 0&&(this.filters=t.filters),"columnOrder"in t&&t.columnOrder!==void 0&&this.setColumnOrder(t.columnOrder),"columns"in t&&t.columns!==void 0){let i=[];for(let s of t.columns){let n=b(s.field,this._columnStates)??{field:s.field,visible:!0};i.push(n),s&&("visible"in s&&s.visible!==void 0&&(n.visible=s.visible),"sortState"in s&&s.sortState!==void 0&&(n.sortState=s.sortState),"width"in s&&s.width!==void 0&&(n.width=s.width))}this.columnStates=i}}sort(t,i,s=!0){let n=this.columnStates,o=b(t,n);if(!o)throw new Error(`Cannot get options for non-existent column "${t}"`);if(i!==o.sortState?.order&&this.dispatchEvent(new G(t,i))){if(i&&!o.sortState){let a=n.map(u=>u.sortState?.priority).filter(u=>u!==void 0),l=this.columns.length+1,h=Math.min(l,...a)-1;o.sortState={order:i,priority:h}}else i&&o.sortState?o.sortState.order=i:o.sortState=null;if(s)for(let a of n)a.field!==t&&(a.sortState=null);this.columnStates=n}}setColumnVisibility(t,i){let s=this.columnStates,n=b(t,s);if(!n)throw new Error(`Cannot get options for non-existent column "${t}"`);n.visible!==i&&this.dispatchEvent(new X(t,i))&&(n.visible=i,this.columnStates=s)}toggleColumnVisibility(t){let i=b(t,this._columnStates);this.setColumnVisibility(t,!i)}showColumn(t){this.setColumnVisibility(t,!0)}hideColumn(t){this.setColumnVisibility(t,!1)}export(t,i=!1){let n=[...(i?this.data:this.filteredData).values()],o=this.columnData,a=o.filter(d=>i||d.state?.visible).map(d=>`"${d.options.title}"`).join(","),l=n.map(d=>{let f=[];for(let g of o){let S=M(d,g.field);(i||g.state.visible)&&(typeof g.options.valueFormatter=="function"&&(S=g.options.valueFormatter(S,d)),S=String(S).replace('"','""'),f.push(`"${S}"`))}return f.join(",")}).join(`
300
- `),h=a+`
301
- `+l,u=new Blob([h],{type:"text/csv;charset=utf-8,"}),c=document.createElement("a");c.style.display="none",c.href=URL.createObjectURL(u),c.download=`${t}.csv`,document.body.append(c),c.click(),c.remove()}scrollToRow(t){let i=this.data.findIndex(s=>s===t);if(typeof i=="number")return this.scrollToOriginalIndex(i);throw new Error("Row not in table")}scrollToOriginalIndex(t){let i=this.data[t];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 ${t} out of range`)}async scrollToFilteredIndex(t){if(!this.filteredData[t])throw new RangeError(`Row index ${t} out of range`);await this.updateComplete,this.virtualizer?this.virtualizer.element(t)?.scrollIntoView({block:"start",behavior:"instant"}):this.tableElement.querySelector(`.row[data-filtered-index="${t}"]`)?.scrollIntoView({block:"start",behavior:"smooth"})}async scrollToPx(t){await this.updateComplete,this.virtualizer?this.virtualizer.scrollTop=t:this.tableElement.scrollTop=t}setColumnOrder(t){let i=[];for(let s of t){let n=b(s,this.columns);n&&i.push(n)}for(let s of this.columns)b(s.field,i)||i.push(s);this.columns=[...i]}findRow(t,i){return this.data.find(s=>M(s,t)===i)}findRowIndex(t,i){let s=this.findRow(t,i);return s?this.rowMetadata.get(s).index:-1}updateRow(t,i){let s=this.data[t];s&&(Object.assign(s,i),this.requestUpdate("data"))}deleteRow(t){this.data=this.data.toSpliced(t,1)}renderColumnSortIcon(t,i){return t.sortable?v`<div
299
+ `;var Pi=1e3,ti={storage:"local",saveColumnSortOrders:!0,saveColumnVisibility:!0,saveColumnWidths:!0,saveColumnOrder:!0},Ri=new Set(["searchQuery","filters","columns","columnSort","columnOrder","columnVisibility","columnWidths","storageOptions"]),he={EXACT:100,PREFIX:50,SUBSTRING:10},m=class extends C{constructor(){super(...arguments);this._enableSearchTokenization=!1;this._enableSearchScoring=!1;this._columns=[];this._columnStates=[];this._columnOrder=[];this._storageOptions=null;this._data=[];this._searchQuery="";this._searchIncludedFields=[];this._searchTokenizer=Zt;this._filters=null;this._filteredData=[];this.hasRestoredState=!1;this.saveTimer=0;this.filterDirty=!1;this.sortDirty=!1;this.dataLastUpdate=null;this.rowMetadata=new WeakMap;this.queryTokens=null;this.resizeState=null;this.dragColumn=null;this.enableVirtualScroll=!1;this.enableSearchHighlight=!0;this.enableColumnReorder=!0;this.enableFooter=!1;this.nullValuePlaceholder="-";this.emptyMessage="No records to display";this.noResultsMessage="No matching records found";this.rowParts=null;this.handleHeaderClicked=(t,i)=>{let s=t.target;if(!i.sortable||s.classList.contains("resizer"))return;let r=t.shiftKey,o=this.getColumnState(i.field);o?.sort?o.sort.order==="asc"?this.sort(i.field,"desc",!r):o.sort.order&&this.sort(i.field,null,!r):this.sort(i.field,"asc",!r)};this.handleCellClick=(t,i,s)=>{if(window.getSelection()?.toString())return;let r=this.rowMetadata.get(i).index;this.dispatchEvent(new q(i,r,s,t))};this.handleResizeMouseMove=t=>{this.resizeState?.active&&requestAnimationFrame(()=>{if(!this.resizeState?.active)return;let i=t.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=t=>{if(window.removeEventListener("mousemove",this.handleResizeMouseMove),window.removeEventListener("mouseup",this.handleResizeMouseUp),document.body.style.cursor="",this.resizeState?.active){let i=parseFloat(this.resizeState.currentWidths[this.resizeState.columnIndex]),s=this.columnWidths,r=w(this.resizeState.columnField,s);r.width=i,this.columnWidths=s,this.dispatchEvent(new J(r.field,r.width))}this.resizeState=null};this.handleDragColumnStart=(t,i)=>{if(t.target?.classList.contains("resizer")){t.preventDefault();return}t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",i),this.dragColumn=i)};this.handleDragColumnEnter=t=>{t.currentTarget.querySelector(".drop-indicator")?.classList.add("active")};this.handleDragColumnLeave=t=>{let i=t.currentTarget,s=t.relatedTarget;i.contains(s)||i.querySelector(".drop-indicator")?.classList.remove("active")};this.handleDragColumnOver=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move")};this.handleDragColumnDrop=(t,i)=>{if(!this.dragColumn||this.dragColumn===i)return;t.preventDefault(),t.stopPropagation();let s=[...this.columnOrder],r=s.findIndex(l=>l===this.dragColumn),o=s.findIndex(l=>l===i);if(r>-1&&o>-1){let[l]=s.splice(r,1),a=w(i,this.columns);if(!a)return;s.splice(o,0,l);let h=new Z(l,a.field,s);if(!this.dispatchEvent(h))return;this.columnOrder=[...s]}};this.handleDragColumnEnd=()=>{this.dragColumn=null,this.tableElement.querySelectorAll(".drop-indicator.active").forEach(t=>t.classList.remove("active"))}}get enableSearchTokenization(){return this._enableSearchTokenization}set enableSearchTokenization(t){if(this._enableSearchTokenization===t)return;let i=this._enableSearchTokenization;this._enableSearchTokenization=t,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("enableSearchTokenization",i)}get enableSearchScoring(){return this._enableSearchScoring}set enableSearchScoring(t){if(this._enableSearchScoring===t)return;let i=this._enableSearchScoring;this._enableSearchScoring=t,this.filterDirty=!0,this.requestUpdate("enableSearchScoring",i)}get columns(){return this._columns}set columns(t){if(this._columns===t)return;let i=this._columns;this._columns=t,this.filterDirty=!0,this.requestUpdate("columns",i)}get columnOrder(){let t=new Set;for(let i of this._columnOrder)w(i,this.columns)&&t.add(i);for(let i of this.columns)t.has(i.field)||t.add(i.field);return[...t]}set columnOrder(t){if(this._columnOrder===t)return;let i=this._columnOrder;this._columnOrder=[...t],this.requestUpdate("columnOrder",i)}get columnVisibility(){return this.columnOrder.map(t=>({field:t,visible:this.getColumnState(t).visible}))}set columnVisibility(t){let i=this.columnVisibility,s=!1;for(let r of t){let o=this.getColumnState(r.field);o&&o.visible!==r.visible&&(s=!0,o.visible=r.visible)}s&&this.requestUpdate("columnVisibility",i)}get columnSort(){return this.columnOrder.map(t=>({field:t,sort:this.getColumnState(t).sort}))}set columnSort(t){let i=this.columnSort,s=!1;for(let r of t){let o=this.getColumnState(r.field);o&&(o.sort?.order!==r.sort?.order||o.sort?.priority!==r.sort?.priority)&&(s=!0,o.sort=r.sort)}s&&(this.sortDirty=!0,this.requestUpdate("columnSort",i))}get columnWidths(){return this.columnOrder.map(t=>({field:t,width:this.getColumnState(t).width}))}set columnWidths(t){let i=this.columnWidths,s=!1;for(let r of t){let o=this.getColumnState(r.field);o&&o.width!==r.width&&(s=!0,o.width=r.width)}s&&this.requestUpdate("columnWidths",i)}get searchQuery(){return this._searchQuery}set searchQuery(t){if(this._searchQuery===t)return;let i=this._searchQuery;this._searchQuery=t,this.updateInternalQuery(),this.filterDirty=!0,this.requestUpdate("searchQuery",i)}get searchIncludedFields(){return this._searchIncludedFields}set searchIncludedFields(t){if(this._searchIncludedFields===t)return;let i=this._searchIncludedFields;this._searchIncludedFields=t,this.filterDirty=!0,this.requestUpdate("searchIncludedFields",i)}get searchTokenizer(){return this._searchTokenizer}set searchTokenizer(t){if(this._searchTokenizer===t)return;let i=this._searchTokenizer;this._searchTokenizer=t,this.filterDirty=!0,this.requestUpdate("searchTokenizer",i)}get filters(){return this._filters}set filters(t){if(this._filters===t)return;let i=this._filters;this._filters=t,this.filterDirty=!0,this.requestUpdate("filters",i)}get storageOptions(){return this._storageOptions}set storageOptions(t){if(this._storageOptions===t)return;let i=this._storageOptions;this._storageOptions=t,this.hasRestoredState||this.loadStateFromStorage(),this.requestUpdate("storageOptions",i)}get data(){return this._data}set data(t){let i=this._data;this._data=t,this.dataLastUpdate=new Date,this.createMetadata(),this.filterDirty=!0,this.requestUpdate("data",i)}get filteredData(){return this.filterDirty?this.filterRows():this.sortDirty&&this.sortRows(),this.filterDirty=!1,this.sortDirty=!1,[...this._filteredData]}getState(){return{searchQuery:this.searchQuery,filters:this.filters,columnOrder:this.columnOrder,columns:this.columns.map(t=>{let i=this.getColumnState(t.field);return{field:t.field,visible:i.visible,sort:i.sort,width:i.width}})}}restoreState(t){if("searchQuery"in t&&t.searchQuery!==void 0&&(this.searchQuery=t.searchQuery),"filters"in t&&t.filters!==void 0&&(this.filters=t.filters),"columnOrder"in t&&t.columnOrder!==void 0&&(this.columnOrder=t.columnOrder),"columns"in t&&t.columns!==void 0){let i=[];for(let s of t.columns){let r=this.getColumnState(s.field);i.push(r),s&&("visible"in s&&s.visible!==void 0&&(r.visible=s.visible),"sort"in s&&s.sort!==void 0&&(r.sort=s.sort),"width"in s&&s.width!==void 0&&(r.width=s.width))}this._columnStates=i,this.requestUpdate()}}sort(t,i,s=!0){let r=this.columnSort,o=w(t,r);if(!o)throw new Error(`Cannot get options for non-existent column "${t}"`);if(i!==o.sort?.order&&this.dispatchEvent(new G(t,i))){if(i&&!o.sort){let l=r.map(u=>u.sort?.priority).filter(u=>u!==void 0),a=this.columns.length+1,h=Math.min(a,...l)-1;o.sort={order:i,priority:h}}else i&&o.sort?o.sort.order=i:o.sort=null;if(s)for(let l of r)l.field!==t&&(l.sort=null);this.columnSort=r}}setColumnVisibility(t,i){let s=this.columnVisibility,r=w(t,s);if(!r)throw new Error(`Cannot get options for non-existent column "${t}"`);r.visible!==i&&this.dispatchEvent(new X(t,i))&&(r.visible=i,this.columnVisibility=s)}toggleColumnVisibility(t){let i=this.getColumnState(t);this.setColumnVisibility(t,!i)}showColumn(t){this.setColumnVisibility(t,!0)}hideColumn(t){this.setColumnVisibility(t,!1)}export(t,i=!1){let r=[...(i?this.data:this.filteredData).values()],o=this.columnData,l=o.filter(d=>i||d.state?.visible).map(d=>`"${d.options.title}"`).join(","),a=r.map(d=>{let f=[];for(let y of o){let v=O(d,y.field);(i||y.state.visible)&&(typeof y.options.valueFormatter=="function"&&(v=y.options.valueFormatter(v,d)),v=String(v).replace('"','""'),f.push(`"${v}"`))}return f.join(",")}).join(`
300
+ `),h=l+`
301
+ `+a,u=new Blob([h],{type:"text/csv;charset=utf-8,"}),c=document.createElement("a");c.style.display="none",c.href=URL.createObjectURL(u),c.download=`${t}.csv`,document.body.append(c),c.click(),c.remove()}scrollToRow(t){let i=this.data.findIndex(s=>s===t);if(typeof i=="number")return this.scrollToOriginalIndex(i);throw new Error("Row not in table")}scrollToOriginalIndex(t){let i=this.data[t];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 ${t} out of range`)}async scrollToFilteredIndex(t){if(!this.filteredData[t])throw new RangeError(`Row index ${t} out of range`);await this.updateComplete,this.virtualizer?this.virtualizer.element(t)?.scrollIntoView({block:"start",behavior:"instant"}):this.tableElement.querySelector(`.row[data-filtered-index="${t}"]`)?.scrollIntoView({block:"start",behavior:"smooth"})}async scrollToPx(t){await this.updateComplete,this.virtualizer?this.virtualizer.scrollTop=t:this.tableElement.scrollTop=t}findRow(t,i){return this.data.find(s=>O(s,t)===i)}findRowIndex(t,i){let s=this.findRow(t,i);return s?this.rowMetadata.get(s).index:-1}updateRow(t,i){let s=this.data[t];s&&(Object.assign(s,i),this.requestUpdate("data"))}deleteRow(t){this.data=this.data.toSpliced(t,1)}renderColumnSortIcon(t,i){return t.sortable?b`<div
302
302
  part="header-sort-icon"
303
- class=${Yt({"sort-icon":!0,ascending:i.sortState?.order==="asc",descending:i.sortState?.order==="desc"})}
304
- ></div>`:_}renderColumnResizer(t,i){return t.resizable?v`<div
303
+ class=${ee({"sort-icon":!0,ascending:i.sort?.order==="asc",descending:i.sort?.order==="desc"})}
304
+ ></div>`:g}renderColumnResizer(t,i){return t.resizable?b`<div
305
305
  part="header-resizer"
306
306
  class="resizer"
307
307
  @click=${s=>s.stopPropagation()}
308
308
  @mousedown=${s=>this.handleResizeMouseDown(s,t.field)}
309
- ></div>`:_}renderHeaderCell(t){let i=b(t.field,this._columnStates);return i.visible==!1?_:v`
309
+ ></div>`:g}renderHeaderCell(t){let i=w(t,this.columns),s=this.getColumnState(i.field);return s.visible==!1?g:b`
310
310
  <div
311
311
  part="cell header-cell"
312
- class=${Yt({cell:!0,sortable:t.sortable??!1})}
313
- draggable=${te(this.enableColumnReorder?!0:void 0)}
314
- data-field=${t.field}
315
- @dragstart=${s=>this.handleDragColumnStart(s,t.field)}
312
+ class=${ee({cell:!0,sortable:i.sortable??!1})}
313
+ draggable=${ie(this.enableColumnReorder?!0:void 0)}
314
+ data-field=${i.field}
315
+ @dragstart=${r=>this.handleDragColumnStart(r,i.field)}
316
316
  @dragenter=${this.handleDragColumnEnter}
317
317
  @dragleave=${this.handleDragColumnLeave}
318
318
  @dragover=${this.handleDragColumnOver}
319
- @drop=${s=>this.handleDragColumnDrop(s,t.field)}
319
+ @drop=${r=>this.handleDragColumnDrop(r,i.field)}
320
320
  @dragend=${this.handleDragColumnEnd}
321
- @click=${s=>this.handleHeaderClicked(s,t)}
321
+ @click=${r=>this.handleHeaderClicked(r,i)}
322
322
  >
323
323
  <div class="header-content">
324
324
  <span class="header-title truncate" part="header-title">
325
- ${t.title??ze(t.field)}
325
+ ${i.title??Oe(i.field)}
326
326
  </span>
327
- ${this.renderColumnSortIcon(t,i)}
327
+ ${this.renderColumnSortIcon(i,s)}
328
328
  </div>
329
- ${this.renderColumnResizer(t,i)}
329
+ ${this.renderColumnResizer(i,s)}
330
330
  <div part="drop-indicator" class="drop-indicator"></div>
331
331
  </div>
332
- `}renderHeader(){return v`
332
+ `}renderHeader(){return b`
333
333
  <div part="header" class="header row">
334
- ${this.columns.map(t=>this.renderHeaderCell(t))}
334
+ ${this.columnOrder.map(t=>this.renderHeaderCell(t))}
335
335
  </div>
336
- `}renderCellContents(t,i,s){if(i.cellRenderer)return i.cellRenderer(t,i.field,s);if(t==null)return this.nullValuePlaceholder;let n=this.rowMetadata.get(s).highlightIndices;return this.enableSearchHighlight&&n?Ae(String(t),n[i.field]):t}renderCell(t,i){if(b(t.field,this._columnStates)?.visible==!1)return _;let n=M(i,t.field),o=t.cellParts?.call(this,n,t.field,i);return Array.isArray(o)&&(o=o.join(" ")),typeof t.valueFormatter=="function"&&(n=t.valueFormatter(n,i)),v`
336
+ `}renderCellContents(t,i,s){if(i.cellRenderer)return i.cellRenderer(t,i.field,s);if(t==null)return this.nullValuePlaceholder;let r=this.rowMetadata.get(s).highlightIndices;return this.enableSearchHighlight&&r?Me(String(t),r[i.field]):t}renderCell(t,i){let s=w(t,this.columns);if(!this.getColumnState(s.field).visible)return g;let o=O(i,s.field),l=s.cellParts?.call(this,o,s.field,i);return Array.isArray(l)&&(l=l.join(" ")),typeof s.valueFormatter=="function"&&(o=s.valueFormatter(o,i)),b`
337
337
  <div
338
- part="cell body-cell cell-${t.field} ${o}"
339
- data-field=${t.field}
338
+ part="cell body-cell cell-${s.field} ${l}"
339
+ data-field=${s.field}
340
340
  class="cell"
341
- title=${te(n?String(n):void 0)}
342
- @click=${a=>this.handleCellClick(a,i,t.field)}
341
+ title=${ie(o?String(o):void 0)}
342
+ @click=${a=>this.handleCellClick(a,i,s.field)}
343
343
  >
344
344
  <span class="truncate">
345
- ${this.renderCellContents(n,t,i)}
345
+ ${this.renderCellContents(o,s,i)}
346
346
  </span>
347
347
  </div>
348
- `}renderRow(t,i){let s=this.rowMetadata.get(t),n=this.rowParts?.(t)??"";return Array.isArray(n)&&(n=n.join(" ")),v`
348
+ `}renderRow(t,i){let s=this.rowMetadata.get(t),r=this.rowParts?.(t)??"";return Array.isArray(r)&&(r=r.join(" ")),b`
349
349
  <div
350
- part=${"row "+n}
350
+ part=${"row "+r}
351
351
  class="row"
352
352
  data-index=${s.index}
353
353
  data-filtered-index=${i}
354
354
  >
355
- ${this.columns.map(o=>this.renderCell(o,t))}
355
+ ${this.columnOrder.map(o=>this.renderCell(o,t))}
356
356
  </div>
357
- `}renderBody(){return this.columnWidths.length===0?v`
357
+ `}renderBody(){return this.columnWidths.length===0?b`
358
358
  <div part="message" class="message">No visible columns.</div>
359
- `:this.data.length===0?v`<div part="message" class="message">
359
+ `:this.data.length===0?b`<div part="message" class="message">
360
360
  ${this.emptyMessage}
361
- </div>`:this.filteredData.length===0?v`<div part="message" class="message">
361
+ </div>`:this.filteredData.length===0?b`<div part="message" class="message">
362
362
  ${this.noResultsMessage}
363
- </div>`:this.enableVirtualScroll?v`
363
+ </div>`:this.enableVirtualScroll?b`
364
364
  <lit-virtualizer
365
365
  .items=${this.filteredData}
366
366
  .renderItem=${(t,i)=>this.renderRow(t,i)}
367
367
  ></lit-virtualizer>
368
- `:v`
369
- ${Mt(this.filteredData,t=>this.rowMetadata.get(t).index,(t,i)=>this.renderRow(t,i))}
370
- `}renderFooter(){if(!this.enableFooter)return _;let t=this.data.length,i=this.filteredData.length,s=new Intl.NumberFormat(void 0),n=s.format(t),o=s.format(i),a=t!==i?`Showing ${o} of ${n} records`:`Total records: ${n}`,l=Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}),h=this.dataLastUpdate?l.format(this.dataLastUpdate):"Never";return v`
368
+ `:b`
369
+ ${Pt(this.filteredData,t=>this.rowMetadata.get(t).index,(t,i)=>this.renderRow(t,i))}
370
+ `}renderFooter(){if(!this.enableFooter)return g;let t=this.data.length,i=this.filteredData.length,s=new Intl.NumberFormat(void 0),r=s.format(t),o=s.format(i),l=t!==i?`Showing ${o} of ${r} records`:`Total records: ${r}`,a=Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}),h=this.dataLastUpdate?a.format(this.dataLastUpdate):"Never";return b`
371
371
  <div part="footer" class="footer">
372
372
  <slot name="footer">
373
- <span part="row-count">${a}</span>
373
+ <span part="row-count">${l}</span>
374
374
  <span part="timestamp">${h}</span>
375
375
  </slot>
376
376
  </div>
377
- `}render(){let t=Jt(this.columnWidths).join(" ");return v`
377
+ `}render(){let t=this.getGridWidths(),i=Yt(t).join(" ");return b`
378
378
  <div
379
379
  part="table"
380
380
  class="table"
381
- style=${Ue({"--grid-template":t})}
381
+ style=${Fe({"--grid-template":i})}
382
382
  >
383
383
  ${this.renderHeader()} ${this.renderBody()} ${this.renderFooter()}
384
384
  </div>
385
- `}updated(t){if(super.updated(t),!this.storageOptions?.key)return;Array.from(t.keys()).some(s=>Pi.has(s))&&this.scheduleSave()}disconnectedCallback(){super.disconnectedCallback(),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp)}calculateSearchScore(t,i){let s={score:0,ranges:[]};if(!t||!i)return s;let n=0,o=0;if(i===t)o=ae.EXACT,n=t.length,s.ranges.push([0,i.length]);else if(i.startsWith(t))o=ae.PREFIX,n=t.length,s.ranges.push([0,t.length]);else{let h=i.indexOf(t);if(h!==-1){o=ae.SUBSTRING,n=t.length;let u=h;for(;u!==-1;)s.ranges.push([u,u+t.length]),u=i.indexOf(t,u+1)}else return s}let l=1/(1+(i.length-t.length));return s.score=n*o*l,s}searchField(t,i,s){let n={score:0,ranges:[]},o=a=>{let l=i.indexOf(a);for(;l!==-1;)n.ranges.push([l,l+a.length]),l=i.indexOf(a,l+1)};if(t.quoted||!s){if(!this.enableSearchScoring)i.includes(t.value)&&(n.score=1,o(t.value));else{let a=this.calculateSearchScore(t.value,i);n.score=a.score,n.ranges=a.ranges}return n}if(!this.enableSearchScoring)return s.some(l=>l.includes(t.value))&&(n.score=1,o(t.value)),n;for(let a of s){let l=this.calculateSearchScore(t.value,a);l.score>0&&(n.score+=l.score,o(t.value))}return n}filterField(t,i,s=null){return Array.isArray(i)?i.length===0?!0:i.some(n=>this.filterField(t,n,s)):Array.isArray(t)?t.length===0?!1:t.some(n=>this.filterField(n,i,s)):typeof s=="function"?s(t,i):i instanceof RegExp?i.test(String(t)):i===t}filterRow(t,i){if(!this.filters)return!0;if(typeof this.filters=="function")return this.filters(t,i);for(let s in this.filters){let n=M(this.filters,s),o=M(t,s);if(typeof n=="function"){if(!n(o))return!1}else{let a=b(s,this.columns),l=a?a.filter:void 0;if(!this.filterField(o,n,l))return!1}}return!0}filterRows(){let i=[...[...this.columnData.values()].filter(s=>s.options.searchable).map(s=>s.field),...this.searchIncludedFields];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 a of i){let l=M(s,a),h=o.searchValues[a],u=o.searchTokens[a];if(typeof l!="string"||typeof h!="string")continue;let c={score:0,ranges:[]};for(let d of this.queryTokens){let f=this.searchField(d,h,u);c.score+=f.score,c.ranges.push(...f.ranges)}c.score>0&&(o.searchScore+=c.score,o.highlightIndices[a]=c.ranges)}return o.searchScore>0}),this.filterDirty=!1,this.sortRows(),this.dispatchEvent(new Q(this.data))}compareRows(t,i,s){let n,o,a=b(s,this.columnData);if(!a.state.sortState)return 0;let l=this.rowMetadata.get(t),h=this.rowMetadata.get(i);if(a.state.sortState?.order==="asc"?(n=l.sortValues[a.field],o=h.sortValues[a.field]):(n=h.sortValues[a.field],o=l.sortValues[a.field]),typeof a.options.sorter=="function"){let d=a.options.sorter(n,o);if(d!==0)return d}let u=n==null,c=o==null;return u&&!c?-1:c&&!u?1:n<o?-1:n>o?1:0}sortRows(){if(this.filterDirty){this.filterRows();return}let t=this.columnData.filter(i=>i.state.visible&&i.state.sortState).sort((i,s)=>s.state.sortState.priority-i.state.sortState.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 a=n.searchScore||0,l=o.searchScore||0;if(a>l)return-1;if(a<l)return 1}for(let a of t){let l=this.compareRows(i,s,a.field);if(l!==0)return l}return n.index-o.index}),this.sortDirty=!1}createColumnStates(){this.columnStates=this.columns.map(t=>{let i=b(t.field,this._columnStates);return{field:t.field,visible:i?.visible??!0,sortState:i?.sortState,width:i?.width}})}createMetadata(){this.rowMetadata=new WeakMap;let t=0;for(let i of this.data){let s={index:t++,searchTokens:{},searchValues:{},sortValues:{}};this.rowMetadata.set(i,s);for(let n of this.columns){let o=M(i,n.field);if(typeof n.sortValue=="function"?s.sortValues[n.field]=n.sortValue(o):typeof o=="string"?s.sortValues[n.field]=o.toLocaleLowerCase():Oe(o)?s.sortValues[n.field]=o:s.sortValues[n.field]=String(o),typeof o=="string"&&(s.searchValues[n.field]=o.toLocaleLowerCase()),n.searchable&&n.tokenize&&o){let a=n.searchTokenizer??this.searchTokenizer;s.searchTokens[n.field]=a(String(o)).map(l=>l.value)}}for(let n of this.searchIncludedFields){let o=M(i,n);typeof o=="string"&&(s.searchValues[n]=o.toLocaleLowerCase())}}}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))}get columnData(){return this.columns.map(t=>({field:t.field,options:t,state:b(t.field,this._columnStates)??{field:t.field,visible:!0}}))}get columnWidths(){return this.columns.map(t=>b(t.field,this._columnStates)).filter(t=>t?t.visible:!0).map(t=>t?.width??null)}scheduleSave(){window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveStateToStorage()},Oi)}saveStateToStorage(){if(!this.storageOptions)return;let t={...Ye,...this.storageOptions},i={columns:[]},s=this.getState();t.saveColumnOrder&&(i.columnOrder=s.columnOrder);for(let o of s.columns){let a={field:o.field};t.saveColumnSortOrders&&(a.sortState=o.sortState),t.saveColumnVisibility&&(a.visible=o.visible),t.saveColumnWidths&&(a.width=o.width),i.columns?.push(a)}let n=t.storage==="session"?sessionStorage:localStorage;try{n.setItem(t.key,JSON.stringify(i))}catch(o){console.warn("Failed to save table state",o)}}loadStateFromStorage(){if(!this.storageOptions)return;let t={...Ye,...this.storageOptions},i=localStorage.getItem(t.key);if(i)try{let s=JSON.parse(i),n={};if(t.saveColumnOrder&&(n.columnOrder=s.columnOrder),s.columns){n.columns=[];for(let o of s.columns){let a={field:o.field};t.saveColumnVisibility&&(a.visible=o.visible),t.saveColumnWidths&&(a.width=o.width),t.saveColumnSortOrders&&(a.sortState=o.sortState),n.columns.push(a)}}this.restoreState(n),this.hasRestoredState=!0}catch(s){console.error("Failed to restore DataTable state:",s)}}handleResizeMouseDown(t,i){t.preventDefault(),t.stopPropagation();let n=t.target.closest(".cell");if(!n)return;let o=this.columns.findIndex(a=>a.field===i);o<0||(this.tableElement.querySelectorAll(".header .cell").forEach(a=>{let l=a.dataset.field;if(l){let h=b(l,this._columnStates);h&&(h.width=a.getBoundingClientRect().width)}}),this.resizeState={active:!0,startX:t.pageX,startWidth:n.getBoundingClientRect().width,columnIndex:o,columnField:i,currentWidths:Jt(this.columnWidths)},this.tableElement.style.setProperty("--grid-template",this.resizeState.currentWidths.join(" ")),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp),document.body.style.cursor="col-resize")}addEventListener(t,i,s){super.addEventListener(t,i,s)}removeEventListener(t,i,s){super.removeEventListener(t,i,s)}dispatchEvent(t){return super.dispatchEvent(t)}};m.styles=[Ze],y([Zt(".table")],m.prototype,"tableElement",2),y([Zt("lit-virtualizer")],m.prototype,"virtualizer",2),y([Re()],m.prototype,"_filteredData",2),y([p({type:Boolean,attribute:"enable-virtual-scroll"})],m.prototype,"enableVirtualScroll",2),y([p({type:Boolean,attribute:"enable-search-highlight"})],m.prototype,"enableSearchHighlight",2),y([p({type:Boolean,attribute:"enable-search-tokenization"})],m.prototype,"enableSearchTokenization",1),y([p({type:Boolean,attribute:"enable-search-scoring"})],m.prototype,"enableSearchScoring",1),y([p({type:Boolean,attribute:"enable-column-reorder"})],m.prototype,"enableColumnReorder",2),y([p({type:Boolean,attribute:"enable-footer"})],m.prototype,"enableFooter",2),y([p({type:String,attribute:"null-value-placeholder"})],m.prototype,"nullValuePlaceholder",2),y([p({type:String,attribute:"empty-message"})],m.prototype,"emptyMessage",2),y([p({type:String,attribute:"no-results-message"})],m.prototype,"noResultsMessage",2),y([p({attribute:!1})],m.prototype,"columns",1),y([p({attribute:!1})],m.prototype,"columnStates",1),y([p({type:String,attribute:"search-query"})],m.prototype,"searchQuery",1),y([p({type:Array,attribute:"search-included-fields"})],m.prototype,"searchIncludedFields",1),y([p({attribute:!1})],m.prototype,"searchTokenizer",1),y([p({attribute:!1})],m.prototype,"filters",1),y([p({attribute:!1})],m.prototype,"rowParts",2),y([p({type:Object,attribute:"storage-options"})],m.prototype,"storageOptions",1),y([p({attribute:!1})],m.prototype,"data",1),m=y([Pe("yatl-table")],m);return si(Ri);})();
385
+ `}updated(t){super.updated(t),super.updated(t);let s=["columnOrder","columnVisibility","columnSort","columnWidths","searchQuery","filters"].filter(r=>t.has(r));s.length&&this.dispatchEvent(new Y(this.getState(),s)),this.storageOptions?.key&&Array.from(t.keys()).some(o=>Ri.has(o))&&this.scheduleSave()}disconnectedCallback(){super.disconnectedCallback(),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp)}calculateSearchScore(t,i){let s={score:0,ranges:[]};if(!t||!i)return s;let r=0,o=0;if(i===t)o=he.EXACT,r=t.length,s.ranges.push([0,i.length]);else if(i.startsWith(t))o=he.PREFIX,r=t.length,s.ranges.push([0,t.length]);else{let h=i.indexOf(t);if(h!==-1){o=he.SUBSTRING,r=t.length;let u=h;for(;u!==-1;)s.ranges.push([u,u+t.length]),u=i.indexOf(t,u+1)}else return s}let a=1/(1+(i.length-t.length));return s.score=r*o*a,s}searchField(t,i,s){let r={score:0,ranges:[]},o=l=>{let a=i.indexOf(l);for(;a!==-1;)r.ranges.push([a,a+l.length]),a=i.indexOf(l,a+1)};if(t.quoted||!s){if(!this.enableSearchScoring)i.includes(t.value)&&(r.score=1,o(t.value));else{let l=this.calculateSearchScore(t.value,i);r.score=l.score,r.ranges=l.ranges}return r}if(!this.enableSearchScoring)return s.some(a=>a.includes(t.value))&&(r.score=1,o(t.value)),r;for(let l of s){let a=this.calculateSearchScore(t.value,l);a.score>0&&(r.score+=a.score,o(t.value))}return r}filterField(t,i,s=null){return Array.isArray(i)?i.length===0?!0:i.some(r=>this.filterField(t,r,s)):Array.isArray(t)?t.length===0?!1:t.some(r=>this.filterField(r,i,s)):typeof s=="function"?s(t,i):i instanceof RegExp?i.test(String(t)):i===t}filterRow(t,i){if(!this.filters)return!0;if(typeof this.filters=="function")return this.filters(t,i);for(let s in this.filters){let r=O(this.filters,s),o=O(t,s);if(typeof r=="function"){if(!r(o))return!1}else{let l=w(s,this.columns),a=l?l.filter:void 0;if(!this.filterField(o,r,a))return!1}}return!0}filterRows(){let i=[...[...this.columnData.values()].filter(s=>s.options.searchable).map(s=>s.field),...this.searchIncludedFields];this._filteredData=this.data.filter((s,r)=>{let o=this.rowMetadata.get(s);if(o.searchScore=0,o.highlightIndices={},!this.filterRow(s,r))return!1;if(!this.queryTokens)return!0;for(let l of i){let a=O(s,l),h=o.searchValues[l],u=o.searchTokens[l];if(typeof a!="string"||typeof h!="string")continue;let c={score:0,ranges:[]};for(let d of this.queryTokens){let f=this.searchField(d,h,u);c.score+=f.score,c.ranges.push(...f.ranges)}c.score>0&&(o.searchScore+=c.score,o.highlightIndices[l]=c.ranges)}return o.searchScore>0}),this.filterDirty=!1,this.sortRows(),this.dispatchEvent(new Q(this.data))}compareRows(t,i,s){let r,o,l=w(s,this.columnData);if(!l.state.sort)return 0;let a=this.rowMetadata.get(t),h=this.rowMetadata.get(i);if(l.state.sort?.order==="asc"?(r=a.sortValues[l.field],o=h.sortValues[l.field]):(r=h.sortValues[l.field],o=a.sortValues[l.field]),typeof l.options.sorter=="function"){let d=l.options.sorter(r,o);if(d!==0)return d}let u=r==null,c=o==null;return u&&!c?-1:c&&!u?1:r<o?-1:r>o?1:0}sortRows(){if(this.filterDirty){this.filterRows();return}let t=this.columnData.filter(i=>i.state.visible&&i.state.sort).sort((i,s)=>s.state.sort.priority-i.state.sort.priority);this._filteredData=this._filteredData.toSorted((i,s)=>{let r=this.rowMetadata.get(i),o=this.rowMetadata.get(s);if(this.enableSearchScoring&&this.queryTokens){let l=r.searchScore||0,a=o.searchScore||0;if(l>a)return-1;if(l<a)return 1}for(let l of t){let a=this.compareRows(i,s,l.field);if(a!==0)return a}return r.index-o.index}),this.sortDirty=!1}createMetadata(){this.rowMetadata=new WeakMap;let t=0;for(let i of this.data){let s={index:t++,searchTokens:{},searchValues:{},sortValues:{}};this.rowMetadata.set(i,s);for(let r of this.columns){let o=O(i,r.field);if(typeof r.sortValue=="function"?s.sortValues[r.field]=r.sortValue(o):typeof o=="string"?s.sortValues[r.field]=o.toLocaleLowerCase():Pe(o)?s.sortValues[r.field]=o:s.sortValues[r.field]=String(o),typeof o=="string"&&(s.searchValues[r.field]=o.toLocaleLowerCase()),r.searchable&&r.tokenize&&o){let l=r.searchTokenizer??this.searchTokenizer;s.searchTokens[r.field]=l(String(o)).map(a=>a.value)}}for(let r of this.searchIncludedFields){let o=O(i,r);typeof o=="string"&&(s.searchValues[r]=o.toLocaleLowerCase())}}}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))}get columnData(){return this.columns.map(t=>({field:t.field,options:t,state:this.getColumnState(t.field)}))}getGridWidths(){return this.columnOrder.map(t=>this.getColumnState(t)).filter(t=>t.visible).map(t=>t.width)}scheduleSave(){window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveStateToStorage()},Pi)}getColumnState(t){let i=w(t,this._columnStates);return i||(i={field:t,visible:!0,sort:null,width:null},this._columnStates.push(i)),i}saveStateToStorage(){if(!this.storageOptions)return;let t={...ti,...this.storageOptions},i={columns:[]},s=this.getState();t.saveColumnOrder&&(i.columnOrder=s.columnOrder);for(let o of s.columns){let l={field:o.field};t.saveColumnSortOrders&&(l.sort=o.sort),t.saveColumnVisibility&&(l.visible=o.visible),t.saveColumnWidths&&(l.width=o.width),i.columns?.push(l)}let r=t.storage==="session"?sessionStorage:localStorage;try{r.setItem(t.key,JSON.stringify(i))}catch(o){console.warn("Failed to save table state",o)}}loadStateFromStorage(){if(!this.storageOptions)return;let t={...ti,...this.storageOptions},i=localStorage.getItem(t.key);if(i)try{let s=JSON.parse(i),r={};if(t.saveColumnOrder&&(r.columnOrder=s.columnOrder),s.columns){r.columns=[];for(let o of s.columns){let l={field:o.field};t.saveColumnVisibility&&(l.visible=o.visible),t.saveColumnWidths&&(l.width=o.width),t.saveColumnSortOrders&&(l.sort=o.sort),r.columns.push(l)}}this.restoreState(r),this.hasRestoredState=!0}catch(s){console.error("Failed to restore DataTable state:",s)}}handleResizeMouseDown(t,i){t.preventDefault(),t.stopPropagation();let r=t.target.closest(".cell");if(!r)return;let o=this.columnOrder.findIndex(l=>l===i);o<0||(this.tableElement.querySelectorAll(".header .cell").forEach(l=>{let a=l.dataset.field;if(a){let h=this.getColumnState(a);h&&(h.width=l.getBoundingClientRect().width)}}),this.resizeState={active:!0,startX:t.pageX,startWidth:r.getBoundingClientRect().width,columnIndex:o,columnField:i,currentWidths:Yt(this.getGridWidths())},this.tableElement.style.setProperty("--grid-template",this.resizeState.currentWidths.join(" ")),window.addEventListener("mousemove",this.handleResizeMouseMove),window.addEventListener("mouseup",this.handleResizeMouseUp),document.body.style.cursor="col-resize")}addEventListener(t,i,s){super.addEventListener(t,i,s)}removeEventListener(t,i,s){super.removeEventListener(t,i,s)}dispatchEvent(t){return super.dispatchEvent(t)}};m.styles=[Ye],_([te(".table")],m.prototype,"tableElement",2),_([te("lit-virtualizer")],m.prototype,"virtualizer",2),_([ke()],m.prototype,"_filteredData",2),_([p({type:Boolean,attribute:"enable-virtual-scroll"})],m.prototype,"enableVirtualScroll",2),_([p({type:Boolean,attribute:"enable-search-highlight"})],m.prototype,"enableSearchHighlight",2),_([p({type:Boolean,attribute:"enable-search-tokenization"})],m.prototype,"enableSearchTokenization",1),_([p({type:Boolean,attribute:"enable-search-scoring"})],m.prototype,"enableSearchScoring",1),_([p({type:Boolean,attribute:"enable-column-reorder"})],m.prototype,"enableColumnReorder",2),_([p({type:Boolean,attribute:"enable-footer"})],m.prototype,"enableFooter",2),_([p({type:String,attribute:"null-value-placeholder"})],m.prototype,"nullValuePlaceholder",2),_([p({type:String,attribute:"empty-message"})],m.prototype,"emptyMessage",2),_([p({type:String,attribute:"no-results-message"})],m.prototype,"noResultsMessage",2),_([p({attribute:!1})],m.prototype,"columns",1),_([p({attribute:!1})],m.prototype,"columnOrder",1),_([p({attribute:!1})],m.prototype,"columnVisibility",1),_([p({attribute:!1})],m.prototype,"columnSort",1),_([p({attribute:!1})],m.prototype,"columnWidths",1),_([p({type:String,attribute:"search-query"})],m.prototype,"searchQuery",1),_([p({type:Array,attribute:"search-included-fields"})],m.prototype,"searchIncludedFields",1),_([p({attribute:!1})],m.prototype,"searchTokenizer",1),_([p({attribute:!1})],m.prototype,"filters",1),_([p({attribute:!1})],m.prototype,"rowParts",2),_([p({type:Object,attribute:"storage-options"})],m.prototype,"storageOptions",1),_([p({attribute:!1})],m.prototype,"data",1),m=_([Re("yatl-table")],m);return ri(ki);})();
386
386
  /*! Bundled license information:
387
387
 
388
388
  @lit-labs/virtualizer/layouts/shared/SizeCache.js: