@internetarchive/ads-table 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32,58 +32,65 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
32
32
  * Copyright 2019 Google LLC
33
33
  * SPDX-License-Identifier: BSD-3-Clause
34
34
  */
35
- const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
35
+ const t$2=globalThis,e$5=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$5&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$5)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$5?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
36
36
 
37
37
  /**
38
38
  * @license
39
39
  * Copyright 2017 Google LLC
40
40
  * SPDX-License-Identifier: BSD-3-Clause
41
- */const{is:i$2,defineProperty:e$3,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$3(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.1");
41
+ */const{is:i$2,defineProperty:e$4,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$4,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b$1={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$4(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$4(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
42
42
 
43
43
  /**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
47
  */
48
- const t$1=globalThis,i$1=t$1.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$1=`<${o$2}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$2.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
48
+ const t$1=globalThis,i$1=t=>t,s$1=t$1.trustedTypes,e$3=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",o$2=`lit$${Math.random().toFixed(9).slice(2)}$`,n$1="?"+o$2,r$3=`<${n$1}>`,l=document,c=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$3?e$3.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r$3:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o$2+x):s+o$2+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o$2),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$2)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$2),i=t.length-1;if(i>0){r.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c());}}}else if(8===r.nodeType)if(r.data===n$1)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$2,t+1));)d.push({type:7,index:l}),t+=o$2.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c()),this.O(c()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$1(t).nextSibling;i$1(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t);}}const B=t$1.litHtmlPolyfillSupport;B?.(S,k),(t$1.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c(),t),t,void 0,s??{});}return h._$AI(t),h};
49
49
 
50
50
  /**
51
51
  * @license
52
52
  * Copyright 2017 Google LLC
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
- */const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.1");
54
+ */const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.2");
55
55
 
56
56
  /**
57
57
  * @license
58
58
  * Copyright 2017 Google LLC
59
59
  * SPDX-License-Identifier: BSD-3-Clause
60
60
  */
61
- const t=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
61
+ const t=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
62
62
 
63
63
  /**
64
64
  * @license
65
65
  * Copyright 2017 Google LLC
66
66
  * SPDX-License-Identifier: BSD-3-Clause
67
- */const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$1=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
67
+ */const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$2=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,true,r);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,true,r);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$2(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
68
68
 
69
69
  /**
70
70
  * @license
71
71
  * Copyright 2017 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */function r(r){return n({...r,state:true,attribute:false})}
73
+ */function r$1(r){return n({...r,state:true,attribute:false})}
74
74
 
75
75
  /**
76
76
  * @license
77
77
  * Copyright 2017 Google LLC
78
78
  * SPDX-License-Identifier: BSD-3-Clause
79
79
  */
80
- const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
80
+ const e$2=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
81
81
 
82
82
  /**
83
83
  * @license
84
84
  * Copyright 2017 Google LLC
85
85
  * SPDX-License-Identifier: BSD-3-Clause
86
- */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
86
+ */function e$1(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$2(n,s,{get(){return o(this)}})}}
87
+
88
+ /**
89
+ * @license
90
+ * Copyright 2017 Google LLC
91
+ * SPDX-License-Identifier: BSD-3-Clause
92
+ */
93
+ let e;function r(r){return (n,o)=>e$2(n,o,{get(){return (this.renderRoot??(e??=document.createDocumentFragment())).querySelectorAll(r)}})}
87
94
 
88
95
  // static class that encapsulates shorthands and utilities for emitting events.
89
96
  class EventHelpers {
@@ -102,6 +109,13 @@ EventHelpers.defaultEventOptions = {
102
109
  };
103
110
 
104
111
  class QuickLRU extends Map {
112
+ #size = 0;
113
+ #cache = new Map();
114
+ #oldCache = new Map();
115
+ #maxSize;
116
+ #maxAge;
117
+ #onEviction;
118
+
105
119
  constructor(options = {}) {
106
120
  super();
107
121
 
@@ -113,30 +127,30 @@ class QuickLRU extends Map {
113
127
  throw new TypeError('`maxAge` must be a number greater than 0');
114
128
  }
115
129
 
116
- // TODO: Use private class fields when ESLint supports them.
117
- this.maxSize = options.maxSize;
118
- this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
119
- this.onEviction = options.onEviction;
120
- this.cache = new Map();
121
- this.oldCache = new Map();
122
- this._size = 0;
130
+ this.#maxSize = options.maxSize;
131
+ this.#maxAge = options.maxAge || Number.POSITIVE_INFINITY;
132
+ this.#onEviction = options.onEviction;
133
+ }
134
+
135
+ // For tests.
136
+ get __oldCache() {
137
+ return this.#oldCache;
123
138
  }
124
139
 
125
- // TODO: Use private class methods when targeting Node.js 16.
126
- _emitEvictions(cache) {
127
- if (typeof this.onEviction !== 'function') {
140
+ #emitEvictions(cache) {
141
+ if (typeof this.#onEviction !== 'function') {
128
142
  return;
129
143
  }
130
144
 
131
145
  for (const [key, item] of cache) {
132
- this.onEviction(key, item.value);
146
+ this.#onEviction(key, item.value);
133
147
  }
134
148
  }
135
149
 
136
- _deleteIfExpired(key, item) {
150
+ #deleteIfExpired(key, item) {
137
151
  if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
138
- if (typeof this.onEviction === 'function') {
139
- this.onEviction(key, item.value);
152
+ if (typeof this.#onEviction === 'function') {
153
+ this.#onEviction(key, item.value);
140
154
  }
141
155
 
142
156
  return this.delete(key);
@@ -145,54 +159,53 @@ class QuickLRU extends Map {
145
159
  return false;
146
160
  }
147
161
 
148
- _getOrDeleteIfExpired(key, item) {
149
- const deleted = this._deleteIfExpired(key, item);
162
+ #getOrDeleteIfExpired(key, item) {
163
+ const deleted = this.#deleteIfExpired(key, item);
150
164
  if (deleted === false) {
151
165
  return item.value;
152
166
  }
153
167
  }
154
168
 
155
- _getItemValue(key, item) {
156
- return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
169
+ #getItemValue(key, item) {
170
+ return item.expiry ? this.#getOrDeleteIfExpired(key, item) : item.value;
157
171
  }
158
172
 
159
- _peek(key, cache) {
173
+ #peek(key, cache) {
160
174
  const item = cache.get(key);
161
-
162
- return this._getItemValue(key, item);
175
+ return this.#getItemValue(key, item);
163
176
  }
164
177
 
165
- _set(key, value) {
166
- this.cache.set(key, value);
167
- this._size++;
178
+ #set(key, value) {
179
+ this.#cache.set(key, value);
180
+ this.#size++;
168
181
 
169
- if (this._size >= this.maxSize) {
170
- this._size = 0;
171
- this._emitEvictions(this.oldCache);
172
- this.oldCache = this.cache;
173
- this.cache = new Map();
182
+ if (this.#size >= this.#maxSize) {
183
+ this.#size = 0;
184
+ this.#emitEvictions(this.#oldCache);
185
+ this.#oldCache = this.#cache;
186
+ this.#cache = new Map();
174
187
  }
175
188
  }
176
189
 
177
- _moveToRecent(key, item) {
178
- this.oldCache.delete(key);
179
- this._set(key, item);
190
+ #moveToRecent(key, item) {
191
+ this.#oldCache.delete(key);
192
+ this.#set(key, item);
180
193
  }
181
194
 
182
- * _entriesAscending() {
183
- for (const item of this.oldCache) {
195
+ * #entriesAscending() {
196
+ for (const item of this.#oldCache) {
184
197
  const [key, value] = item;
185
- if (!this.cache.has(key)) {
186
- const deleted = this._deleteIfExpired(key, value);
198
+ if (!this.#cache.has(key)) {
199
+ const deleted = this.#deleteIfExpired(key, value);
187
200
  if (deleted === false) {
188
201
  yield item;
189
202
  }
190
203
  }
191
204
  }
192
205
 
193
- for (const item of this.cache) {
206
+ for (const item of this.#cache) {
194
207
  const [key, value] = item;
195
- const deleted = this._deleteIfExpired(key, value);
208
+ const deleted = this.#deleteIfExpired(key, value);
196
209
  if (deleted === false) {
197
210
  yield item;
198
211
  }
@@ -200,73 +213,79 @@ class QuickLRU extends Map {
200
213
  }
201
214
 
202
215
  get(key) {
203
- if (this.cache.has(key)) {
204
- const item = this.cache.get(key);
205
-
206
- return this._getItemValue(key, item);
216
+ if (this.#cache.has(key)) {
217
+ const item = this.#cache.get(key);
218
+ return this.#getItemValue(key, item);
207
219
  }
208
220
 
209
- if (this.oldCache.has(key)) {
210
- const item = this.oldCache.get(key);
211
- if (this._deleteIfExpired(key, item) === false) {
212
- this._moveToRecent(key, item);
221
+ if (this.#oldCache.has(key)) {
222
+ const item = this.#oldCache.get(key);
223
+ if (this.#deleteIfExpired(key, item) === false) {
224
+ this.#moveToRecent(key, item);
213
225
  return item.value;
214
226
  }
215
227
  }
216
228
  }
217
229
 
218
- set(key, value, {maxAge = this.maxAge} = {}) {
219
- const expiry =
220
- typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?
221
- Date.now() + maxAge :
222
- undefined;
223
- if (this.cache.has(key)) {
224
- this.cache.set(key, {
230
+ set(key, value, {maxAge = this.#maxAge} = {}) {
231
+ const expiry = typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY
232
+ ? (Date.now() + maxAge)
233
+ : undefined;
234
+
235
+ if (this.#cache.has(key)) {
236
+ this.#cache.set(key, {
225
237
  value,
226
- expiry
238
+ expiry,
227
239
  });
228
240
  } else {
229
- this._set(key, {value, expiry});
241
+ this.#set(key, {value, expiry});
230
242
  }
231
243
 
232
244
  return this;
233
245
  }
234
246
 
235
247
  has(key) {
236
- if (this.cache.has(key)) {
237
- return !this._deleteIfExpired(key, this.cache.get(key));
248
+ if (this.#cache.has(key)) {
249
+ return !this.#deleteIfExpired(key, this.#cache.get(key));
238
250
  }
239
251
 
240
- if (this.oldCache.has(key)) {
241
- return !this._deleteIfExpired(key, this.oldCache.get(key));
252
+ if (this.#oldCache.has(key)) {
253
+ return !this.#deleteIfExpired(key, this.#oldCache.get(key));
242
254
  }
243
255
 
244
256
  return false;
245
257
  }
246
258
 
247
259
  peek(key) {
248
- if (this.cache.has(key)) {
249
- return this._peek(key, this.cache);
260
+ if (this.#cache.has(key)) {
261
+ return this.#peek(key, this.#cache);
250
262
  }
251
263
 
252
- if (this.oldCache.has(key)) {
253
- return this._peek(key, this.oldCache);
264
+ if (this.#oldCache.has(key)) {
265
+ return this.#peek(key, this.#oldCache);
266
+ }
267
+ }
268
+
269
+ expiresIn(key) {
270
+ const item = this.#cache.get(key) ?? this.#oldCache.get(key);
271
+ if (item) {
272
+ return item.expiry ? item.expiry - Date.now() : Number.POSITIVE_INFINITY;
254
273
  }
255
274
  }
256
275
 
257
276
  delete(key) {
258
- const deleted = this.cache.delete(key);
277
+ const deleted = this.#cache.delete(key);
259
278
  if (deleted) {
260
- this._size--;
279
+ this.#size--;
261
280
  }
262
281
 
263
- return this.oldCache.delete(key) || deleted;
282
+ return this.#oldCache.delete(key) || deleted;
264
283
  }
265
284
 
266
285
  clear() {
267
- this.cache.clear();
268
- this.oldCache.clear();
269
- this._size = 0;
286
+ this.#cache.clear();
287
+ this.#oldCache.clear();
288
+ this.#size = 0;
270
289
  }
271
290
 
272
291
  resize(newSize) {
@@ -274,23 +293,41 @@ class QuickLRU extends Map {
274
293
  throw new TypeError('`maxSize` must be a number greater than 0');
275
294
  }
276
295
 
277
- const items = [...this._entriesAscending()];
296
+ const items = [...this.#entriesAscending()];
278
297
  const removeCount = items.length - newSize;
279
298
  if (removeCount < 0) {
280
- this.cache = new Map(items);
281
- this.oldCache = new Map();
282
- this._size = items.length;
299
+ this.#cache = new Map(items);
300
+ this.#oldCache = new Map();
301
+ this.#size = items.length;
283
302
  } else {
284
303
  if (removeCount > 0) {
285
- this._emitEvictions(items.slice(0, removeCount));
304
+ this.#emitEvictions(items.slice(0, removeCount));
286
305
  }
287
306
 
288
- this.oldCache = new Map(items.slice(removeCount));
289
- this.cache = new Map();
290
- this._size = 0;
307
+ this.#oldCache = new Map(items.slice(removeCount));
308
+ this.#cache = new Map();
309
+ this.#size = 0;
310
+ }
311
+
312
+ this.#maxSize = newSize;
313
+ }
314
+
315
+ evict(count = 1) {
316
+ const requested = Number(count);
317
+ if (!requested || requested <= 0) {
318
+ return;
319
+ }
320
+
321
+ const items = [...this.#entriesAscending()];
322
+ const evictCount = Math.trunc(Math.min(requested, Math.max(items.length - 1, 0)));
323
+ if (evictCount <= 0) {
324
+ return;
291
325
  }
292
326
 
293
- this.maxSize = newSize;
327
+ this.#emitEvictions(items.slice(0, evictCount));
328
+ this.#oldCache = new Map(items.slice(evictCount));
329
+ this.#cache = new Map();
330
+ this.#size = 0;
294
331
  }
295
332
 
296
333
  * keys() {
@@ -306,18 +343,18 @@ class QuickLRU extends Map {
306
343
  }
307
344
 
308
345
  * [Symbol.iterator]() {
309
- for (const item of this.cache) {
346
+ for (const item of this.#cache) {
310
347
  const [key, value] = item;
311
- const deleted = this._deleteIfExpired(key, value);
348
+ const deleted = this.#deleteIfExpired(key, value);
312
349
  if (deleted === false) {
313
350
  yield [key, value.value];
314
351
  }
315
352
  }
316
353
 
317
- for (const item of this.oldCache) {
354
+ for (const item of this.#oldCache) {
318
355
  const [key, value] = item;
319
- if (!this.cache.has(key)) {
320
- const deleted = this._deleteIfExpired(key, value);
356
+ if (!this.#cache.has(key)) {
357
+ const deleted = this.#deleteIfExpired(key, value);
321
358
  if (deleted === false) {
322
359
  yield [key, value.value];
323
360
  }
@@ -326,22 +363,22 @@ class QuickLRU extends Map {
326
363
  }
327
364
 
328
365
  * entriesDescending() {
329
- let items = [...this.cache];
366
+ let items = [...this.#cache];
330
367
  for (let i = items.length - 1; i >= 0; --i) {
331
368
  const item = items[i];
332
369
  const [key, value] = item;
333
- const deleted = this._deleteIfExpired(key, value);
370
+ const deleted = this.#deleteIfExpired(key, value);
334
371
  if (deleted === false) {
335
372
  yield [key, value.value];
336
373
  }
337
374
  }
338
375
 
339
- items = [...this.oldCache];
376
+ items = [...this.#oldCache];
340
377
  for (let i = items.length - 1; i >= 0; --i) {
341
378
  const item = items[i];
342
379
  const [key, value] = item;
343
- if (!this.cache.has(key)) {
344
- const deleted = this._deleteIfExpired(key, value);
380
+ if (!this.#cache.has(key)) {
381
+ const deleted = this.#deleteIfExpired(key, value);
345
382
  if (deleted === false) {
346
383
  yield [key, value.value];
347
384
  }
@@ -350,24 +387,32 @@ class QuickLRU extends Map {
350
387
  }
351
388
 
352
389
  * entriesAscending() {
353
- for (const [key, value] of this._entriesAscending()) {
390
+ for (const [key, value] of this.#entriesAscending()) {
354
391
  yield [key, value.value];
355
392
  }
356
393
  }
357
394
 
358
395
  get size() {
359
- if (!this._size) {
360
- return this.oldCache.size;
396
+ if (!this.#size) {
397
+ return this.#oldCache.size;
361
398
  }
362
399
 
363
400
  let oldCacheSize = 0;
364
- for (const key of this.oldCache.keys()) {
365
- if (!this.cache.has(key)) {
401
+ for (const key of this.#oldCache.keys()) {
402
+ if (!this.#cache.has(key)) {
366
403
  oldCacheSize++;
367
404
  }
368
405
  }
369
406
 
370
- return Math.min(this._size + oldCacheSize, this.maxSize);
407
+ return Math.min(this.#size + oldCacheSize, this.#maxSize);
408
+ }
409
+
410
+ get maxSize() {
411
+ return this.#maxSize;
412
+ }
413
+
414
+ get maxAge() {
415
+ return this.#maxAge;
371
416
  }
372
417
 
373
418
  entries() {
@@ -381,7 +426,15 @@ class QuickLRU extends Map {
381
426
  }
382
427
 
383
428
  get [Symbol.toStringTag]() {
384
- return JSON.stringify([...this.entriesAscending()]);
429
+ return 'QuickLRU';
430
+ }
431
+
432
+ toString() {
433
+ return `QuickLRU(${this.size}/${this.maxSize})`;
434
+ }
435
+
436
+ [Symbol.for('nodejs.util.inspect.custom')]() {
437
+ return this.toString();
385
438
  }
386
439
  }
387
440
 
@@ -468,6 +521,9 @@ class AdsTable extends i {
468
521
  this.selectedRowIds = [];
469
522
  this.isLoading = false;
470
523
  }
524
+ getTableRowElementById(id) {
525
+ return Array.from(this.tableRows || []).find((row) => row.id === `row-${id}`);
526
+ }
471
527
  updated(changedProperties) {
472
528
  super.updated(changedProperties);
473
529
  if (changedProperties.has("selectedRowIds")) {
@@ -598,13 +654,13 @@ class AdsTable extends i {
598
654
  }
599
655
  renderArrowIcon(columnKey) {
600
656
  if (columnKey !== this.sortKey) {
601
- return x ``;
657
+ return b ``;
602
658
  }
603
659
  else if (this.sortDirection === "ascending") {
604
- return x `▲`;
660
+ return b `▲`;
605
661
  }
606
662
  else {
607
- return x `▼`;
663
+ return b `▼`;
608
664
  }
609
665
  }
610
666
  get selectedRowIdsSet() {
@@ -682,9 +738,10 @@ class AdsTable extends i {
682
738
  // emit event so users can hook into this event
683
739
  this.emitEvent("row-double-click", { row: clickedRow });
684
740
  }
685
- // All keyboard events implemented through this method.
741
+ // default global keyboard events implemented through this method.
742
+ // event.stopImmediatePropagation() in DOM keyboard event listeners will
743
+ // prevent this method from being called.
686
744
  onKeyDown(event) {
687
- var _a;
688
745
  if (this.disableKeyboardNavigation) {
689
746
  return;
690
747
  }
@@ -692,22 +749,64 @@ class AdsTable extends i {
692
749
  case "ArrowUp":
693
750
  case "ArrowDown":
694
751
  event.preventDefault();
695
- // shift focus to table element when navigating with arrow keys
696
- (_a = this.tableElement) === null || _a === void 0 ? void 0 : _a.focus();
697
- return this.onUpDownArrowKey(event.key);
752
+ return this.onUpDownArrowKey(event);
698
753
  }
699
754
  }
700
- onUpDownArrowKey(key) {
701
- if (this.selectedRowIds.length === 0) {
702
- // select the first row if none are selected
703
- this.selectedRowIds = [this.rows[0].id];
755
+ // listener applies when column has focus
756
+ onColumnKeyDown(event, column) {
757
+ if (this.disableKeyboardNavigation) {
758
+ return;
759
+ }
760
+ switch (event.key) {
761
+ case "Enter":
762
+ return this.onColumnClick(column);
763
+ }
764
+ }
765
+ // listener applies when row has focus
766
+ onRowKeyDown(event, row, index) {
767
+ if (this.disableKeyboardNavigation) {
704
768
  return;
705
769
  }
706
- // offset in the proper direction of the arrow
707
- const indexOffset = key === "ArrowUp" ? -1 : 1;
770
+ switch (event.key) {
771
+ // enter to select, enter again to navigate within, shift + enter to deselect (and select), while in multiselect
772
+ case "Enter":
773
+ if (this.isSelected(row) &&
774
+ !event.shiftKey &&
775
+ this.selectedRows.length === 1) {
776
+ return this.onRowClick(event, row, index);
777
+ }
778
+ else {
779
+ event.stopImmediatePropagation();
780
+ return this.toggleRowSelected(row.id);
781
+ }
782
+ }
783
+ }
784
+ onUpDownArrowKey(event) {
785
+ var _a;
786
+ if (this.rows.length === 0) {
787
+ // there are no rows to navigate or select with arrows. avoids array out of bounds.
788
+ return;
789
+ }
790
+ const indexOffset = event.key === "ArrowUp" ? -1 : 1;
708
791
  const newSelectedRowIndex = this.constrainIndex(this.indexOfLastSelectedRow + indexOffset);
709
792
  const newSelectedRowId = this.rows[newSelectedRowIndex].id;
710
- this.selectedRowIds = [newSelectedRowId];
793
+ if (event.shiftKey) {
794
+ // - focus and (maybe) select and focus the prev or next, if it exists
795
+ this.groupRowSelect(newSelectedRowIndex);
796
+ }
797
+ else if (this.selectedRowIds.length === 0) {
798
+ // select the first row if none are selected
799
+ const firstRowId = this.rows[0] ? this.rows[0].id : undefined;
800
+ if (firstRowId) {
801
+ this.selectedRowIds = [firstRowId];
802
+ }
803
+ }
804
+ else {
805
+ // offset in the proper direction of the arrow
806
+ this.selectedRowIds = [newSelectedRowId];
807
+ }
808
+ // always try to focus the next element in the direction of the arrow if you can
809
+ (_a = this.getTableRowElementById(newSelectedRowId)) === null || _a === void 0 ? void 0 : _a.focus();
711
810
  }
712
811
  // ensures index values are kept to the closest in-bounds index
713
812
  constrainIndex(index) {
@@ -715,23 +814,25 @@ class AdsTable extends i {
715
814
  }
716
815
  connectedCallback() {
717
816
  super.connectedCallback();
718
- // attach keyboard listener
817
+ // attach keyboard listener for arrow keys
719
818
  window.addEventListener("keydown", (e) => this.onKeyDown(e));
720
819
  }
721
820
  render() {
722
- return x `
723
- <table id="main-table" tabindex="0">
821
+ return b `
822
+ <table id="main-table">
724
823
  <thead>
725
824
  <tr>
726
- ${this.visibleColumns.map((column) => x `
825
+ ${this.visibleColumns.map((column) => b `
727
826
  <th
728
827
  @click=${() => this.onColumnClick(column)}
828
+ @keydown=${(e) => this.onColumnKeyDown(e, column)}
729
829
  class=${column.dataType.compare ? "sortable" : ""}
730
830
  style=${`flex: ${column.flexRatio}`}
831
+ tabindex="0"
731
832
  >
732
833
  ${column.label}
733
834
  ${column.dataType.compare
734
- ? x `<span>${this.renderArrowIcon(column.key)}</span>`
835
+ ? b `<span>${this.renderArrowIcon(column.key)}</span>`
735
836
  : ""}
736
837
  </th>
737
838
  `)}
@@ -739,28 +840,31 @@ class AdsTable extends i {
739
840
  </thead>
740
841
  <tbody>
741
842
  ${!this.isLoading
742
- ? this.sortedRows.map((row, index) => x `
843
+ ? this.sortedRows.map((row, index) => b `
743
844
  <tr
744
845
  @click=${(e) => this.onRowClick(e, row, index)}
745
846
  @dblclick=${() => this.onRowDoubleClick(row)}
847
+ @keydown=${(e) => this.onRowKeyDown(e, row, index)}
746
848
  class=${this.isSelected(row) ? "row-selected" : ""}
747
849
  data-row-selected=${this.isSelected(row)}
748
850
  data-id=${row.id}
851
+ id=${"row-" + row.id}
852
+ tabindex="0"
749
853
  >
750
- ${this.visibleColumns.map((column) => x `
854
+ ${this.visibleColumns.map((column) => b `
751
855
  <td style=${`flex: ${column.flexRatio}`}>
752
856
  ${column.dataType.format(row.data)}
753
857
  </td>
754
858
  `)}
755
859
  </tr>
756
860
  `)
757
- : x `
861
+ : b `
758
862
  <tr>
759
863
  <td class="no-data">Loading...</td>
760
864
  </tr>
761
865
  `}
762
866
  ${!this.isLoading && this.sortedRows.length === 0
763
- ? x `
867
+ ? b `
764
868
  <tr>
765
869
  <td class="no-data">${this.noDataText}</td>
766
870
  </tr>
@@ -845,8 +949,11 @@ AdsTable.styles = i$3 `
845
949
  }
846
950
  `;
847
951
  __decorate([
848
- e("#main-table")
952
+ e$1("#main-table")
849
953
  ], AdsTable.prototype, "tableElement", void 0);
954
+ __decorate([
955
+ r("table tr")
956
+ ], AdsTable.prototype, "tableRows", void 0);
850
957
  __decorate([
851
958
  n({ type: Array })
852
959
  ], AdsTable.prototype, "rows", void 0);
@@ -854,13 +961,13 @@ __decorate([
854
961
  n({ type: Boolean })
855
962
  ], AdsTable.prototype, "disableKeyboardNavigation", void 0);
856
963
  __decorate([
857
- r()
964
+ r$1()
858
965
  ], AdsTable.prototype, "sortDirection", void 0);
859
966
  __decorate([
860
- r()
967
+ r$1()
861
968
  ], AdsTable.prototype, "selectedRowIds", void 0);
862
969
  __decorate([
863
- r()
970
+ r$1()
864
971
  ], AdsTable.prototype, "isLoading", void 0);
865
972
  // a simple, generic, out-of-the box implementation of AdsTable
866
973
  let AdsSimpleTable = class AdsSimpleTable extends AdsTable {
@@ -888,7 +995,7 @@ __decorate([
888
995
  n({ type: String })
889
996
  ], AdsSimpleTable.prototype, "secondarySortKey", void 0);
890
997
  __decorate([
891
- r()
998
+ r$1()
892
999
  ], AdsSimpleTable.prototype, "sortKey", void 0);
893
1000
  AdsSimpleTable = __decorate([
894
1001
  t("ads-simple-table")
@@ -906,6 +1013,19 @@ const StringDataType = {
906
1013
  return value;
907
1014
  },
908
1015
  };
1016
+ // for basic boolean comparison
1017
+ const BooleanDataType = {
1018
+ compare: (a, b) => {
1019
+ if (a !== b) {
1020
+ return a ? 1 : -1;
1021
+ }
1022
+ return 0;
1023
+ },
1024
+ format(value) {
1025
+ return value.toString();
1026
+ },
1027
+ defaultSortDirection: "descending",
1028
+ };
909
1029
  // for basic number comparison
910
1030
  const NumberDataType = {
911
1031
  compare: (a, b) => {
@@ -969,5 +1089,5 @@ const NonSortable = (dataType) => ({
969
1089
  compare: undefined,
970
1090
  });
971
1091
 
972
- export { AdsSimpleTable, AdsTable, BytesDataType, DateDataType, FromKey, NonSortable, NumberDataType, StringDataType, UndefinedHelpers };
1092
+ export { AdsSimpleTable, AdsTable, BooleanDataType, BytesDataType, DateDataType, FromKey, NonSortable, NumberDataType, StringDataType, UndefinedHelpers };
973
1093
  //# sourceMappingURL=index.js.map