@topsort/banners
Advanced tools
+10
-0
@@ -0,1 +1,11 @@ | ||
| ### 0.8.0 | ||
| - Add support for fallback banners (`isFallback`) returned by the auction API | ||
| - Omit `data-ts-resolved-bid` attribute on fallback banners to prevent false attribution | ||
| - Add `predefined` attribute to `<topsort-banner>` and `<topsort-banner-slot>` for inline predefined content support | ||
| - When `predefined` is set, child elements annotated with `data-ts-field` are mutated in place on auction success, preserving all existing markup, classes, ARIA attributes, and event listeners | ||
| - Support `data-ts-attr` override for targeting a specific attribute instead of the element-type default | ||
| - On auction failure or no winners, predefined content remains untouched and visible | ||
| - Error (not silent broken image) when a predefined-content winner arrives on a non-predefined component | ||
| ### 0.7.0 | ||
@@ -2,0 +12,0 @@ |
+11
-3
| import { LitElement } from 'lit'; | ||
| import { nothing } from 'lit'; | ||
| import { TemplateResult } from 'lit'; | ||
@@ -28,3 +29,5 @@ | ||
| url: string; | ||
| content?: Record<string, string>; | ||
| }]; | ||
| isFallback?: boolean; | ||
| } | ||
@@ -70,4 +73,6 @@ | ||
| readonly isContext: boolean; | ||
| readonly predefined: boolean; | ||
| private _prevTaskStatus; | ||
| private slots?; | ||
| protected render(): TemplateResult | undefined; | ||
| protected render(): TemplateResult | typeof nothing | undefined; | ||
| updated(changedProperties: Map<string | number | symbol, unknown>): void; | ||
@@ -81,4 +86,7 @@ protected createRenderRoot(): this; | ||
| readonly context?: BannerContext; | ||
| readonly rank = 0; | ||
| protected render(): TemplateResult; | ||
| readonly rank = 1; | ||
| readonly predefined: boolean; | ||
| private _bannerForRank; | ||
| protected render(): TemplateResult | typeof nothing; | ||
| updated(changedProperties: Map<string | number | symbol, unknown>): void; | ||
| protected createRenderRoot(): this; | ||
@@ -85,0 +93,0 @@ } |
@@ -1,4 +0,4 @@ | ||
| var banners=(function(u){"use strict";let et=class extends Event{constructor(t,e,s,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=s,this.subscribe=i??!1}};function Oe(r){return r}let st=class{constructor(t,e,s,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){const o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=s,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new et(this.context,this.host,this.t,this.subscribe))}};let Tt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const s=e||!Object.is(t,this.o);this.o=t,s&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:s}]of this.subscriptions)e(this.o,s)},t!==void 0&&(this.value=t)}addCallback(t,e,s){if(!s)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};let Ut=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},it=class extends Tt{constructor(t,e,s){super(e.context!==void 0?e.initialValue:s),this.onContextRequest=i=>{if(i.context!==this.context)return;const o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;const o=new Set;for(const[n,{consumerHost:h}]of this.subscriptions)o.has(n)||(o.add(n),h.dispatchEvent(new et(this.context,h,n,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ut(this.context,this.host))}};function Ot({context:r}){return(t,e)=>{const s=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return s.get(this).setValue(i),t.set.call(this,i)},init(i){return s.set(this,new it(this,{context:r,initialValue:i})),i}};{t.constructor.addInitializer((n=>{s.set(n,new it(n,{context:r}))}));const i=Object.getOwnPropertyDescriptor(t,e);let o;if(i===void 0){const n=new WeakMap;o={get(){return n.get(this)},set(h){s.get(this).setValue(h),n.set(this,h)},configurable:!0,enumerable:!0}}else{const n=i.set;o={...i,set(h){s.get(this).setValue(h),n?.call(this,h)}}}return void Object.defineProperty(t,e,o)}}}function Rt({context:r,subscribe:t}){return(e,s)=>{typeof s=="object"?s.addInitializer((function(){new st(this,{context:r,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new st(i,{context:r,callback:o=>{i[s]=o},subscribe:t})}))}}const H=globalThis,W=H.ShadowRoot&&(H.ShadyCSS===void 0||H.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rt=Symbol(),ot=new WeakMap;let Nt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==rt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(W&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=ot.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ot.set(e,t))}return t}toString(){return this.cssText}};const kt=r=>new Nt(typeof r=="string"?r:r+"",void 0,rt),Mt=(r,t)=>{if(W)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const s=document.createElement("style"),i=H.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},nt=W?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return kt(e)})(r):r;const{is:Ht,defineProperty:jt,getOwnPropertyDescriptor:Bt,getOwnPropertyNames:It,getOwnPropertySymbols:Lt,getPrototypeOf:qt}=Object,j=globalThis,ht=j.trustedTypes,Dt=ht?ht.emptyScript:"",zt=j.reactiveElementPolyfillSupport,x=(r,t)=>r,V={toAttribute(r,t){switch(t){case Boolean:r=r?Dt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},K=(r,t)=>!Ht(r,t),at={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:K};Symbol.metadata??=Symbol("metadata"),j.litPropertyMetadata??=new WeakMap;let T=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=at){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&jt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=Bt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return i?.call(this)},set(n){const h=i?.call(this);o.call(this,n),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??at}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=qt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const e=this.properties,s=[...It(e),...Lt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(nt(i))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Mt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(s.converter?.toAttribute!==void 0?s.converter:V).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:V;this._$Em=i,this[i]=n.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??K)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s)o.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[x("elementProperties")]=new Map,T[x("finalized")]=new Map,zt?.({ReactiveElement:T}),(j.reactiveElementVersions??=[]).push("2.0.4");const Wt=Symbol();let Vt=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);const i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??Kt,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;const t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){const t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();const i=++this.p;this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){o=!0,s=n}if(this.p===i){if(e===Wt)this.i=0;else{if(o===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}};const Kt=(r,t)=>r===t||r.length===t.length&&r.every(((e,s)=>!K(e,t[s])));const B=globalThis,F=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ct=Symbol(),lt=new WeakMap;let Ft=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ct)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(F&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=lt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&<.set(e,t))}return t}toString(){return this.cssText}};const Jt=r=>new Ft(typeof r=="string"?r:r+"",void 0,ct),Qt=(r,t)=>{if(F)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const s=document.createElement("style"),i=B.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},dt=F?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Jt(e)})(r):r;const{is:Zt,defineProperty:Xt,getOwnPropertyDescriptor:Gt,getOwnPropertyNames:Yt,getOwnPropertySymbols:te,getPrototypeOf:ee}=Object,I=globalThis,ut=I.trustedTypes,se=ut?ut.emptyScript:"",ie=I.reactiveElementPolyfillSupport,U=(r,t)=>r,L={toAttribute(r,t){switch(t){case Boolean:r=r?se:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},J=(r,t)=>!Zt(r,t),pt={attribute:!0,type:String,converter:L,reflect:!1,useDefault:!1,hasChanged:J};Symbol.metadata??=Symbol("metadata"),I.litPropertyMetadata??=new WeakMap;let A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=pt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Xt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=Gt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){const h=i?.call(this);o?.call(this,n),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??pt}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=ee(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const e=this.properties,s=[...Yt(e),...te(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(dt(i))}else t!==void 0&&e.push(dt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(s.converter?.toAttribute!==void 0?s.converter:L).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:L;this._$Em=i;const h=n.fromAttribute(e,o.type);this[i]=h??this._$Ej?.get(i)??h,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??J)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:n}=o,h=this[i];n!==!0||this._$AL.has(i)||h===void 0||this.C(i,void 0,o,h)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[U("elementProperties")]=new Map,A[U("finalized")]=new Map,ie?.({ReactiveElement:A}),(I.reactiveElementVersions??=[]).push("2.1.1");const Q=globalThis,q=Q.trustedTypes,ft=q?q.createPolicy("lit-html",{createHTML:r=>r}):void 0,$t="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,gt="?"+b,re=`<${gt}>`,v=document,O=()=>v.createComment(""),R=r=>r===null||typeof r!="object"&&typeof r!="function",Z=Array.isArray,oe=r=>Z(r)||typeof r?.[Symbol.iterator]=="function",X=`[ | ||
| \f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yt=/-->/g,mt=/>/g,w=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`,"g"),bt=/'/g,_t=/"/g,vt=/^(?:script|style|textarea|title)$/i,ne=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),$=ne(1),P=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),wt=new WeakMap,E=v.createTreeWalker(v,129);function Et(r,t){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ft!==void 0?ft.createHTML(t):t}const he=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",n=N;for(let h=0;h<e;h++){const a=r[h];let c,d,l=-1,y=0;for(;y<a.length&&(n.lastIndex=y,d=n.exec(a),d!==null);)y=n.lastIndex,n===N?d[1]==="!--"?n=yt:d[1]!==void 0?n=mt:d[2]!==void 0?(vt.test(d[2])&&(i=RegExp("</"+d[2],"g")),n=w):d[3]!==void 0&&(n=w):n===w?d[0]===">"?(n=i??N,l=-1):d[1]===void 0?l=-2:(l=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?w:d[3]==='"'?_t:bt):n===_t||n===bt?n=w:n===yt||n===mt?n=N:(n=w,i=void 0);const _=n===w&&r[h+1].startsWith("/>")?" ":"";o+=n===N?a+re:l>=0?(s.push(c),a.slice(0,l)+$t+a.slice(l)+b+_):a+b+(l===-2?h:_)}return[Et(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class k{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const h=t.length-1,a=this.parts,[c,d]=he(t,e);if(this.el=k.createElement(c,s),E.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=E.nextNode())!==null&&a.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const l of i.getAttributeNames())if(l.endsWith($t)){const y=d[n++],_=i.getAttribute(l).split(b),z=/([.?@])?(.*)/.exec(y);a.push({type:1,index:o,name:z[2],strings:_,ctor:z[1]==="."?ce:z[1]==="?"?le:z[1]==="@"?de:D}),i.removeAttribute(l)}else l.startsWith(b)&&(a.push({type:6,index:o}),i.removeAttribute(l));if(vt.test(i.tagName)){const l=i.textContent.split(b),y=l.length-1;if(y>0){i.textContent=q?q.emptyScript:"";for(let _=0;_<y;_++)i.append(l[_],O()),E.nextNode(),a.push({type:2,index:++o});i.append(l[y],O())}}}else if(i.nodeType===8)if(i.data===gt)a.push({type:2,index:o});else{let l=-1;for(;(l=i.data.indexOf(b,l+1))!==-1;)a.push({type:7,index:o}),l+=b.length-1}o++}}static createElement(t,e){const s=v.createElement("template");return s.innerHTML=t,s}}function C(r,t,e=r,s){if(t===P)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl;const o=R(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=C(r,i._$AS(r,t.values),i,s)),t}class ae{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??v).importNode(e,!0);E.currentNode=i;let o=E.nextNode(),n=0,h=0,a=s[0];for(;a!==void 0;){if(n===a.index){let c;a.type===2?c=new M(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new ue(o,this,t)),this._$AV.push(c),a=s[++h]}n!==a?.index&&(o=E.nextNode(),n++)}return E.currentNode=v,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=C(this,t,e),R(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):oe(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!==p&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(v.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=k.createElement(Et(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const o=new ae(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=wt.get(t.strings);return e===void 0&&wt.set(t.strings,e=new k(t)),e}k(t){Z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new M(this.O(O()),this.O(O()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class D{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=C(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==P,n&&(this._$AH=t);else{const h=t;let a,c;for(t=o[0],a=0;a<o.length-1;a++)c=C(this,h[s+a],e,a),c===P&&(c=this._$AH[a]),n||=!R(c)||c!==this._$AH[a],c===p?t=p:t!==p&&(t+=(c??"")+o[a+1]),this._$AH[a]=c}n&&!i&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ce extends D{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class le extends D{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class de extends D{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=C(this,t,e,0)??p)===P)return;const s=this._$AH,i=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==p&&(s===p||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ue{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){C(this,t)}}const pe=Q.litHtmlPolyfillSupport;pe?.(k,M),(Q.litHtmlVersions??=[]).push("3.3.1");const fe=(r,t,e)=>{const s=e?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const o=e?.renderBefore??null;s._$litPart$=i=new M(t.insertBefore(O(),o),o,void 0,e??{})}return i._$AI(r),i};const G=globalThis;class S extends A{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 e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=fe(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}}S._$litElement$=!0,S.finalized=!0,G.litElementHydrateSupport?.({LitElement:S});const $e=G.litElementPolyfillSupport;$e?.({LitElement:S}),(G.litElementVersions??=[]).push("4.2.1");const Y=r=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(r,t)})):customElements.define(r,t)};const ge={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:J},ye=(r=ge,t,e)=>{const{kind:s,metadata:i}=e;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(e.name,r),s==="accessor"){const{name:n}=e;return{set(h){const a=t.get.call(this);t.set.call(this,h),this.requestUpdate(n,a,r)},init(h){return h!==void 0&&this.C(n,void 0,r,h),h}}}if(s==="setter"){const{name:n}=e;return function(h){const a=this[n];t.call(this,h),this.requestUpdate(n,a,r)}}throw Error("Unsupported decorator location: "+s)};function f(r){return(t,e)=>typeof e=="object"?ye(r,t,e):((s,i,o)=>{const n=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),n?Object.getOwnPropertyDescriptor(i,o):void 0})(r,t,e)}class me extends Error{constructor(t,e){super(t),this.name="TopsortRequestError",this.status=e}static isTopsortRequestError(t){return t.name==="TopsortRequestError"}}class be extends Error{constructor(t,e){let s="Missing ";!e&&!t?s+="API Key and Slot ID":e?t||(s+="API Key"):s+="Slot ID",super(s),this.name="TopsortConfigurationError"}static isTopsortConfigurationError(t){return t.name==="TopsortConfigurationError"}}function _e(){if(window.TS?.getUserId&&typeof window.TS.getUserId=="function")return window.TS.getUserId()}const St=()=>{const r=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(r)||/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(r)?"mobile":"desktop"};async function ve(r,{signal:t,logError:e}){const s=St(),i=window.TS.token,o=window.TS.url||"https://api.topsort.com",n=_e();n&&(r.opaqueUserId=n);const h=await fetch(new URL(`${o}/v2/auctions`),{method:"POST",mode:"cors",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-UA":`topsort/banners-0.7.0 (${s})`},body:JSON.stringify({auctions:[r]}),signal:t});if(!h.ok){const d=await h.json();throw new Error(d.message)}const c=(await h.json()).results[0];if(!c)throw new me("No auction results",h.status);if(c.error)throw e(c.error),new Error(c.error);return c.winners}var we=Object.defineProperty,m=(r,t,e,s)=>{for(var i=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=n(t,e,i)||i);return i&&we(t,e,i),i};const Ee=r=>{class t extends r{constructor(){super(...arguments),this.width=0,this.height=0,this.slotId="",this.newTab=!1}buildAuction(s){const i=St(),o={type:"banners",slots:s,device:i,slotId:this.slotId};return this.categoryId?o.category={id:this.categoryId}:this.categoryIds?o.category={ids:this.categoryIds.split(",").map(n=>n.trim())}:this.categoryDisjunctions?o.category={disjunctions:[this.categoryDisjunctions.split(",").map(n=>n.trim())]}:this.searchQuery&&(o.searchQuery=this.searchQuery),this.location&&(o.geoTargeting={location:this.location}),o}emitEvent(s){const i=new CustomEvent("statechange",{detail:{slotId:this.slotId,status:s},bubbles:!0,composed:!0});this.dispatchEvent(i)}}return m([f({type:Number})],t.prototype,"width"),m([f({type:Number})],t.prototype,"height"),m([f({attribute:"id",type:String})],t.prototype,"slotId"),m([f({attribute:"category-id",type:String})],t.prototype,"categoryId"),m([f({attribute:"category-ids",type:String})],t.prototype,"categoryIds"),m([f({attribute:"category-disjunctions",type:String})],t.prototype,"categoryDisjunctions"),m([f({attribute:"search-query",type:String})],t.prototype,"searchQuery"),m([f({attribute:"location",type:String})],t.prototype,"location"),m([f({attribute:"new-tab",type:Boolean})],t.prototype,"newTab"),t};var Se=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,g=(r,t,e,s)=>{for(var i=s>1?void 0:s?Ae(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&Se(t,e,i),i};window.TS_BANNERS=window.TS_BANNERS||{};function Pe(r){}function Ce(r){return window.TS_BANNERS.getLink?window.TS_BANNERS.getLink(r):r.type==="url"?r.id:`${r.type}/${r.id}`}function At(){if(window.TS_BANNERS.getLoadingElement){const r=window.TS_BANNERS.getLoadingElement();return $`${r}`}return $``}function tt(r){if(window.TS_BANNERS.getErrorElement){const t=window.TS_BANNERS.getErrorElement(r);return $`${t}`}return $``}function Pt(){if(window.TS_BANNERS.getNoWinnersElement){const r=window.TS_BANNERS.getNoWinnersElement();return $`${r}`}return $``}function Ct(r,t,e,s){if(window.TS_BANNERS.getBannerElement){const c=window.TS_BANNERS.getBannerElement(r);return $`${c}`}if(!r.asset?.[0]?.url)return $``;const i=r.asset[0].url,n=(()=>{try{const d=new URL(i).pathname.split("/"),l=d.indexOf("manifest");return l>=0?d[l+1]?.startsWith("video")??!1:!1}catch{return!1}})()?$` | ||
| var banners=(function(d){"use strict";let rt=class extends Event{constructor(t,e,s,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=s,this.subscribe=i??!1}};function Me(r){return r}let nt=class{constructor(t,e,s,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,o)),this.unsubscribe=o},this.host=t,e.context!==void 0){const n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=s,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new rt(this.context,this.host,this.t,this.subscribe))}};let Rt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const s=e||!Object.is(t,this.o);this.o=t,s&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:s}]of this.subscriptions)e(this.o,s)},t!==void 0&&(this.value=t)}addCallback(t,e,s){if(!s)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};let kt=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},ot=class extends Rt{constructor(t,e,s){super(e.context!==void 0?e.initialValue:s),this.onContextRequest=i=>{if(i.context!==this.context)return;const n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;const n=new Set;for(const[o,{consumerHost:h}]of this.subscriptions)n.has(o)||(n.add(o),h.dispatchEvent(new rt(this.context,h,o,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new kt(this.context,this.host))}};function Nt({context:r}){return(t,e)=>{const s=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return s.get(this).setValue(i),t.set.call(this,i)},init(i){return s.set(this,new ot(this,{context:r,initialValue:i})),i}};{t.constructor.addInitializer((o=>{s.set(o,new ot(o,{context:r}))}));const i=Object.getOwnPropertyDescriptor(t,e);let n;if(i===void 0){const o=new WeakMap;n={get(){return o.get(this)},set(h){s.get(this).setValue(h),o.set(this,h)},configurable:!0,enumerable:!0}}else{const o=i.set;n={...i,set(h){s.get(this).setValue(h),o?.call(this,h)}}}return void Object.defineProperty(t,e,n)}}}function Mt({context:r,subscribe:t}){return(e,s)=>{typeof s=="object"?s.addInitializer((function(){new nt(this,{context:r,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new nt(i,{context:r,callback:n=>{i[s]=n},subscribe:t})}))}}const j=globalThis,K=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ht=Symbol(),at=new WeakMap;let Bt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ht)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(K&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=at.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&at.set(e,t))}return t}toString(){return this.cssText}};const Ht=r=>new Bt(typeof r=="string"?r:r+"",void 0,ht),It=(r,t)=>{if(K)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const s=document.createElement("style"),i=j.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},ct=K?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Ht(e)})(r):r;const{is:jt,defineProperty:Lt,getOwnPropertyDescriptor:qt,getOwnPropertyNames:Dt,getOwnPropertySymbols:zt,getPrototypeOf:Wt}=Object,L=globalThis,lt=L.trustedTypes,Vt=lt?lt.emptyScript:"",Ft=L.reactiveElementPolyfillSupport,U=(r,t)=>r,Q={toAttribute(r,t){switch(t){case Boolean:r=r?Vt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Z=(r,t)=>!jt(r,t),dt={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:Z};Symbol.metadata??=Symbol("metadata"),L.litPropertyMetadata??=new WeakMap;let O=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=dt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Lt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=qt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i?.call(this)},set(o){const h=i?.call(this);n.call(this,o),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??dt}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=Wt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const e=this.properties,s=[...Dt(e),...zt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(ct(i))}else t!==void 0&&e.push(ct(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return It(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:Q).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Q;this._$Em=i,this[i]=o.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??Z)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s)n.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[U("elementProperties")]=new Map,O[U("finalized")]=new Map,Ft?.({ReactiveElement:O}),(L.reactiveElementVersions??=[]).push("2.0.4");const m={INITIAL:0,COMPLETE:2,ERROR:3},Jt=Symbol();let Kt=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);const i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??Qt,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;const t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){const t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();const i=++this.p;this.q=new AbortController;let n=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(o){n=!0,s=o}if(this.p===i){if(e===Jt)this.i=0;else{if(n===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}};const Qt=(r,t)=>r===t||r.length===t.length&&r.every(((e,s)=>!Z(e,t[s])));const q=globalThis,X=q.ShadowRoot&&(q.ShadyCSS===void 0||q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ut=Symbol(),pt=new WeakMap;let Zt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ut)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(X&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=pt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&pt.set(e,t))}return t}toString(){return this.cssText}};const Xt=r=>new Zt(typeof r=="string"?r:r+"",void 0,ut),Gt=(r,t)=>{if(X)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const s=document.createElement("style"),i=q.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},ft=X?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Xt(e)})(r):r;const{is:Yt,defineProperty:te,getOwnPropertyDescriptor:ee,getOwnPropertyNames:se,getOwnPropertySymbols:ie,getPrototypeOf:re}=Object,D=globalThis,$t=D.trustedTypes,ne=$t?$t.emptyScript:"",oe=D.reactiveElementPolyfillSupport,R=(r,t)=>r,z={toAttribute(r,t){switch(t){case Boolean:r=r?ne:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},G=(r,t)=>!Yt(r,t),gt={attribute:!0,type:String,converter:z,reflect:!1,useDefault:!1,hasChanged:G};Symbol.metadata??=Symbol("metadata"),D.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=gt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&te(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=ee(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){const h=i?.call(this);n?.call(this,o),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(R("elementProperties")))return;const t=re(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(R("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(R("properties"))){const e=this.properties,s=[...se(e),...ie(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(ft(i))}else t!==void 0&&e.push(ft(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Gt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:z).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:z;this._$Em=i;const h=o.fromAttribute(e,n.type);this[i]=h??this._$Ej?.get(i)??h,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){const i=this.constructor,n=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??G)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),n!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,h=this[i];o!==!0||this._$AL.has(i)||h===void 0||this.C(i,void 0,n,h)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[R("elementProperties")]=new Map,x[R("finalized")]=new Map,oe?.({ReactiveElement:x}),(D.reactiveElementVersions??=[]).push("2.1.1");const Y=globalThis,W=Y.trustedTypes,yt=W?W.createPolicy("lit-html",{createHTML:r=>r}):void 0,bt="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,mt="?"+_,he=`<${mt}>`,E=document,k=()=>E.createComment(""),N=r=>r===null||typeof r!="object"&&typeof r!="function",tt=Array.isArray,ae=r=>tt(r)||typeof r?.[Symbol.iterator]=="function",et=`[ | ||
| \f\r]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_t=/-->/g,vt=/>/g,w=RegExp(`>|${et}(?:([^\\s"'>=/]+)(${et}*=${et}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`,"g"),Et=/'/g,wt=/"/g,St=/^(?:script|style|textarea|title)$/i,ce=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),$=ce(1),C=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),At=new WeakMap,S=E.createTreeWalker(E,129);function Tt(r,t){if(!tt(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return yt!==void 0?yt.createHTML(t):t}const le=(r,t)=>{const e=r.length-1,s=[];let i,n=t===2?"<svg>":t===3?"<math>":"",o=M;for(let h=0;h<e;h++){const a=r[h];let c,p,l=-1,y=0;for(;y<a.length&&(o.lastIndex=y,p=o.exec(a),p!==null);)y=o.lastIndex,o===M?p[1]==="!--"?o=_t:p[1]!==void 0?o=vt:p[2]!==void 0?(St.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=w):p[3]!==void 0&&(o=w):o===w?p[0]===">"?(o=i??M,l=-1):p[1]===void 0?l=-2:(l=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?w:p[3]==='"'?wt:Et):o===wt||o===Et?o=w:o===_t||o===vt?o=M:(o=w,i=void 0);const v=o===w&&r[h+1].startsWith("/>")?" ":"";n+=o===M?a+he:l>=0?(s.push(c),a.slice(0,l)+bt+a.slice(l)+_+v):a+_+(l===-2?h:v)}return[Tt(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class B{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const h=t.length-1,a=this.parts,[c,p]=le(t,e);if(this.el=B.createElement(c,s),S.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=S.nextNode())!==null&&a.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const l of i.getAttributeNames())if(l.endsWith(bt)){const y=p[o++],v=i.getAttribute(l).split(_),J=/([.?@])?(.*)/.exec(y);a.push({type:1,index:n,name:J[2],strings:v,ctor:J[1]==="."?ue:J[1]==="?"?pe:J[1]==="@"?fe:V}),i.removeAttribute(l)}else l.startsWith(_)&&(a.push({type:6,index:n}),i.removeAttribute(l));if(St.test(i.tagName)){const l=i.textContent.split(_),y=l.length-1;if(y>0){i.textContent=W?W.emptyScript:"";for(let v=0;v<y;v++)i.append(l[v],k()),S.nextNode(),a.push({type:2,index:++n});i.append(l[y],k())}}}else if(i.nodeType===8)if(i.data===mt)a.push({type:2,index:n});else{let l=-1;for(;(l=i.data.indexOf(_,l+1))!==-1;)a.push({type:7,index:n}),l+=_.length-1}n++}}static createElement(t,e){const s=E.createElement("template");return s.innerHTML=t,s}}function P(r,t,e=r,s){if(t===C)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl;const n=N(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=P(r,i._$AS(r,t.values),i,s)),t}class de{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??E).importNode(e,!0);S.currentNode=i;let n=S.nextNode(),o=0,h=0,a=s[0];for(;a!==void 0;){if(o===a.index){let c;a.type===2?c=new H(n,n.nextSibling,this,t):a.type===1?c=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(c=new $e(n,this,t)),this._$AV.push(c),a=s[++h]}o!==a?.index&&(n=S.nextNode(),o++)}return S.currentNode=E,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class H{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=P(this,t,e),N(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==C&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ae(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!==u&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(E.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(Tt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const n=new de(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(t){let e=At.get(t.strings);return e===void 0&&At.set(t.strings,e=new B(t)),e}k(t){tt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new H(this.O(k()),this.O(k()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class V{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=u}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(n===void 0)t=P(this,t,e,0),o=!N(t)||t!==this._$AH&&t!==C,o&&(this._$AH=t);else{const h=t;let a,c;for(t=n[0],a=0;a<n.length-1;a++)c=P(this,h[s+a],e,a),c===C&&(c=this._$AH[a]),o||=!N(c)||c!==this._$AH[a],c===u?t=u:t!==u&&(t+=(c??"")+n[a+1]),this._$AH[a]=c}o&&!i&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ue extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}}class pe extends V{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}}class fe extends V{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=P(this,t,e,0)??u)===C)return;const s=this._$AH,i=t===u&&s!==u||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==u&&(s===u||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class $e{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const ge=Y.litHtmlPolyfillSupport;ge?.(B,H),(Y.litHtmlVersions??=[]).push("3.3.1");const ye=(r,t,e)=>{const s=e?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const n=e?.renderBefore??null;s._$litPart$=i=new H(t.insertBefore(k(),n),n,void 0,e??{})}return i._$AI(r),i};const st=globalThis;class A extends x{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 e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ye(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return C}}A._$litElement$=!0,A.finalized=!0,st.litElementHydrateSupport?.({LitElement:A});const be=st.litElementPolyfillSupport;be?.({LitElement:A}),(st.litElementVersions??=[]).push("4.2.1");const it=r=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(r,t)})):customElements.define(r,t)};const me={attribute:!0,type:String,converter:z,reflect:!1,hasChanged:G},_e=(r=me,t,e)=>{const{kind:s,metadata:i}=e;let n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),s==="setter"&&((r=Object.create(r)).wrapped=!0),n.set(e.name,r),s==="accessor"){const{name:o}=e;return{set(h){const a=t.get.call(this);t.set.call(this,h),this.requestUpdate(o,a,r)},init(h){return h!==void 0&&this.C(o,void 0,r,h),h}}}if(s==="setter"){const{name:o}=e;return function(h){const a=this[o];t.call(this,h),this.requestUpdate(o,a,r)}}throw Error("Unsupported decorator location: "+s)};function f(r){return(t,e)=>typeof e=="object"?_e(r,t,e):((s,i,n)=>{const o=i.hasOwnProperty(n);return i.constructor.createProperty(n,s),o?Object.getOwnPropertyDescriptor(i,n):void 0})(r,t,e)}const ve=r=>r??u;class xt extends Error{constructor(t,e){super(t),this.name="TopsortRequestError",this.status=e}static isTopsortRequestError(t){return t.name==="TopsortRequestError"}}class Ee extends Error{constructor(t,e){let s="Missing ";!e&&!t?s+="API Key and Slot ID":e?t||(s+="API Key"):s+="Slot ID",super(s),this.name="TopsortConfigurationError"}static isTopsortConfigurationError(t){return t.name==="TopsortConfigurationError"}}function we(){if(window.TS?.getUserId&&typeof window.TS.getUserId=="function")return window.TS.getUserId()}const Se=()=>{const r=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(r)||/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(r)?"mobile":"desktop"};async function Ae(r,{signal:t,logError:e}){const{device:s}=r,i=window.TS.token,n=window.TS.url||"https://api.topsort.com",o=we();o&&(r.opaqueUserId=o);const h=await fetch(new URL(`${n}/v2/auctions`),{method:"POST",mode:"cors",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-UA":`topsort/banners-0.8.0 (${s})`},body:JSON.stringify({auctions:[r]}),signal:t});if(!h.ok){const p=await h.json().catch(()=>({}));throw new xt(p.message??`HTTP ${h.status}`,h.status)}const c=(await h.json()).results[0];if(!c)throw new xt("No auction results",h.status);if(c.error)throw e(c.error),new Error(c.error);return c.winners}var Te=Object.defineProperty,b=(r,t,e,s)=>{for(var i=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(i=o(t,e,i)||i);return i&&Te(t,e,i),i};const xe=r=>{class t extends r{constructor(){super(...arguments),this.width=0,this.height=0,this.slotId="",this.newTab=!1}buildAuction(s){const i=Se(),n={type:"banners",slots:s,device:i,slotId:this.slotId};return this.categoryId?n.category={id:this.categoryId}:this.categoryIds?n.category={ids:this.categoryIds.split(",").map(o=>o.trim())}:this.categoryDisjunctions?n.category={disjunctions:[this.categoryDisjunctions.split(",").map(o=>o.trim())]}:this.searchQuery&&(n.searchQuery=this.searchQuery),this.location&&(n.geoTargeting={location:this.location}),n}emitEvent(s){const i=new CustomEvent("statechange",{detail:{slotId:this.slotId,status:s},bubbles:!0,composed:!0});this.dispatchEvent(i)}}return b([f({type:Number})],t.prototype,"width"),b([f({type:Number})],t.prototype,"height"),b([f({attribute:"id",type:String})],t.prototype,"slotId"),b([f({attribute:"category-id",type:String})],t.prototype,"categoryId"),b([f({attribute:"category-ids",type:String})],t.prototype,"categoryIds"),b([f({attribute:"category-disjunctions",type:String})],t.prototype,"categoryDisjunctions"),b([f({attribute:"search-query",type:String})],t.prototype,"searchQuery"),b([f({attribute:"location",type:String})],t.prototype,"location"),b([f({attribute:"new-tab",type:Boolean})],t.prototype,"newTab"),t};function Ce(r,t,e){if(e){r.setAttribute(e,t);return}const s=r.tagName.toLowerCase();s==="a"?r.setAttribute("href",t):s==="img"||s==="video"||s==="source"?r.setAttribute("src",t):r.textContent=t}function Ct(r,t){const e=t.asset?.[0]?.content;if(e){const i=r.querySelectorAll("[data-ts-field]");for(const n of i){const o=n.dataset.tsField;o&&o in e&&Ce(n,e[o],n.dataset.tsAttr)}}const s=r.querySelector("[data-ts-clickable]")||r.firstElementChild;s&&(s.setAttribute("data-ts-clickable",""),t.isFallback||s.setAttribute("data-ts-resolved-bid",t.resolvedBidId))}var Pe=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,g=(r,t,e,s)=>{for(var i=s>1?void 0:s?Ue(t,e):t,n=r.length-1,o;n>=0;n--)(o=r[n])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&Pe(t,e,i),i};window.TS_BANNERS=window.TS_BANNERS||{};function Oe(r){}function Re(r){return window.TS_BANNERS.getLink?window.TS_BANNERS.getLink(r):r.type==="url"?r.id:`${r.type}/${r.id}`}function Pt(){if(window.TS_BANNERS.getLoadingElement){const r=window.TS_BANNERS.getLoadingElement();return $`${r}`}return $``}function I(r){if(window.TS_BANNERS.getErrorElement){const t=window.TS_BANNERS.getErrorElement(r);return $`${t}`}return $``}function Ut(){if(window.TS_BANNERS.getNoWinnersElement){const r=window.TS_BANNERS.getNoWinnersElement();return $`${r}`}return $``}function F(r,t,e,s){if(window.TS_BANNERS.getBannerElement){const c=window.TS_BANNERS.getBannerElement(r);return $`${c}`}if(!r.asset?.[0]?.url)return $``;const i=r.asset[0].url,o=(()=>{try{const p=new URL(i).pathname.split("/"),l=p.indexOf("manifest");return l>=0?p[l+1]?.startsWith("video")??!1:!1}catch{return!1}})()?$` | ||
| <hls-video | ||
@@ -15,6 +15,6 @@ src="${i}" | ||
| /> | ||
| `,h=Ce(r),a=s?$`<a href="${h}" target="_blank">${n}</a>`:$`<a href="${h}">${n}</a>`;return $` | ||
| `,h=Re(r),a=s?$`<a href="${h}" target="_blank">${o}</a>`:$`<a href="${h}">${o}</a>`;return $` | ||
| <div | ||
| data-ts-clickable | ||
| data-ts-resolved-bid=${r.resolvedBidId} | ||
| data-ts-resolved-bid=${ve(r.isFallback?void 0:r.resolvedBidId)} | ||
| class="ts-banner" | ||
@@ -24,5 +24,6 @@ > | ||
| </div> | ||
| `}const xt=Symbol("banner-context"),xe=(r,t)=>!t&&r?!0:r==null||t==null?!1:r.width!==t.width||r.height!==t.height||r.newTab!==t.newTab||!!r.error!=!!t.error||r.banners?.length!==t.banners?.length;u.TopsortBanner=class extends Ee(S){constructor(){super(...arguments),this.task=new Vt(this,{task:([t],e)=>ve(this.buildAuction(t),{...e,logError:Pe}).then(s=>(e.signal.throwIfAborted(),this.isContext&&(this.context={...this.context,banners:s}),s)).catch(s=>{throw e.signal.throwIfAborted(),this.isContext&&(this.context={...this.context,error:s}),s}),args:()=>[this.slots?.length||1]}),this.context={width:this.width,height:this.height,newTab:this.newTab},this.isContext=!1}render(){return!window.TS.token||!this.slotId?tt(new be(window.TS.token,this.slotId)):this.isContext?$``:this.task.render({pending:()=>At(),complete:t=>(this.emitEvent(t.length?"ready":"nowinners"),t.length?Ct(t[0],this.width,this.height,this.newTab):Pt()),error:t=>tt(t)})}updated(t){super.updated(t),this.isContext&&!t.has("slots")&&Promise.resolve().then(()=>{this.slots=this.renderRoot.querySelectorAll("topsort-banner-slot")}),(t.has("width")||t.has("height")||t.has("newTab"))&&Promise.resolve().then(()=>{this.context={width:this.width,height:this.height,newTab:this.newTab}})}createRenderRoot(){return this}},g([Ot({context:xt}),f({attribute:!1,hasChanged:xe})],u.TopsortBanner.prototype,"context",2),g([f({type:Boolean,attribute:"context"})],u.TopsortBanner.prototype,"isContext",2),g([f({attribute:!1,state:!0})],u.TopsortBanner.prototype,"slots",2),u.TopsortBanner=g([Y("topsort-banner")],u.TopsortBanner),u.TopsortBannerSlot=class extends S{constructor(){super(...arguments),this.rank=0}render(){return this.context?this.context.banners?this.context.error?tt(this.context.error):!this.context.banners.length||this.context.banners.length<this.rank?Pt():Ct(this.context.banners[this.rank-1],this.context.width,this.context.height,this.context.newTab):At():$``}createRenderRoot(){return this}},g([Rt({context:xt,subscribe:!0}),f({attribute:!1})],u.TopsortBannerSlot.prototype,"context",2),g([f({attribute:"rank",type:Number})],u.TopsortBannerSlot.prototype,"rank",2),u.TopsortBannerSlot=g([Y("topsort-banner-slot")],u.TopsortBannerSlot),u.HlsVideo=class extends S{constructor(){super(...arguments),this.src="",this.width="800px",this.height="400px"}get videoId(){try{return new URL(this.src).pathname.split("/")[1]}catch{return"hls-video"}}render(){return $` | ||
| `}const Ot=Symbol("banner-context"),ke=(r,t)=>!t&&r?!0:r==null||t==null?!1:r.width!==t.width||r.height!==t.height||r.newTab!==t.newTab||!!r.error!=!!t.error||r.banners?.length!==t.banners?.length;d.TopsortBanner=class extends xe(A){constructor(){super(...arguments),this.task=new Kt(this,{task:([t],e)=>Ae(this.buildAuction(t),{...e,logError:Oe}).then(s=>(e.signal.throwIfAborted(),this.isContext&&(this.context={...this.context,banners:s}),s)).catch(s=>{throw e.signal.throwIfAborted(),this.isContext&&(this.context={...this.context,error:s}),s}),args:()=>[this.slots?.length||1]}),this.context={width:this.width,height:this.height,newTab:this.newTab},this.isContext=!1,this.predefined=!1,this._prevTaskStatus=m.INITIAL}render(){return!window.TS.token||!this.slotId?I(new Ee(window.TS.token,this.slotId)):this.isContext?$``:this.predefined?this.task.status===m.COMPLETE&&this.task.value?.length&&!this.task.value[0].asset?.[0]?.content?F(this.task.value[0],this.width,this.height,this.newTab):u:this.task.render({pending:()=>Pt(),complete:t=>{if(!t.length)return Ut();if(t[0].asset?.[0]?.content){const e=new Error("Banner has predefined content but component is not in predefined mode");return I(e)}return F(t[0],this.width,this.height,this.newTab)},error:t=>I(t)})}updated(t){super.updated(t);const e=this._prevTaskStatus,s=this.task.status;this._prevTaskStatus=s;const i=this.task.value??[];if(this.predefined&&e!==m.COMPLETE&&s===m.COMPLETE&&i.length&&i[0].asset?.[0]?.content)try{Ct(this,i[0])}catch{}this.isContext||(e!==m.COMPLETE&&s===m.COMPLETE?this.emitEvent(i.length?"ready":"nowinners"):e!==m.ERROR&&s===m.ERROR&&this.emitEvent("error")),this.isContext&&!t.has("slots")&&Promise.resolve().then(()=>{this.slots=this.renderRoot.querySelectorAll("topsort-banner-slot")}),t.has("width")&&this.style.setProperty("--ts-banner-width",`${this.width}px`),t.has("height")&&this.style.setProperty("--ts-banner-height",`${this.height}px`),(t.has("width")||t.has("height")||t.has("newTab"))&&Promise.resolve().then(()=>{this.context={width:this.width,height:this.height,newTab:this.newTab}})}createRenderRoot(){return this}},g([Nt({context:Ot}),f({attribute:!1,hasChanged:ke})],d.TopsortBanner.prototype,"context",2),g([f({type:Boolean,attribute:"context"})],d.TopsortBanner.prototype,"isContext",2),g([f({type:Boolean})],d.TopsortBanner.prototype,"predefined",2),g([f({attribute:!1,state:!0})],d.TopsortBanner.prototype,"slots",2),d.TopsortBanner=g([it("topsort-banner")],d.TopsortBanner),d.TopsortBannerSlot=class extends A{constructor(){super(...arguments),this.rank=1,this.predefined=!1}_bannerForRank(){if(!(!this.context?.banners?.length||this.rank<1||this.context.banners.length<this.rank))return this.context.banners[this.rank-1]}render(){if(this.predefined){const e=this._bannerForRank();return e&&!e.asset?.[0]?.content&&this.context?F(e,this.context.width,this.context.height,this.context.newTab):u}if(!this.context)return $``;if(!this.context.banners)return Pt();if(this.context.error)return I(this.context.error);if(!this.context.banners.length||this.context.banners.length<this.rank)return Ut();const t=this.context.banners[this.rank-1];if(t.asset?.[0]?.content){const e=new Error("Banner has predefined content but component is not in predefined mode");return I(e)}return F(t,this.context.width,this.context.height,this.context.newTab)}updated(t){if(super.updated(t),this.predefined&&t.has("context")&&!t.get("context")?.banners&&!!this.context?.banners){const i=this._bannerForRank();if(i?.asset?.[0]?.content)try{Ct(this,i)}catch{}}}createRenderRoot(){return this}},g([Mt({context:Ot,subscribe:!0}),f({attribute:!1})],d.TopsortBannerSlot.prototype,"context",2),g([f({attribute:"rank",type:Number})],d.TopsortBannerSlot.prototype,"rank",2),g([f({type:Boolean})],d.TopsortBannerSlot.prototype,"predefined",2),d.TopsortBannerSlot=g([it("topsort-banner-slot")],d.TopsortBannerSlot),d.HlsVideo=class extends A{constructor(){super(...arguments),this.src="",this.width="800px",this.height="400px"}get videoId(){try{return new URL(this.src).pathname.split("/")[1]}catch{return"hls-video"}}render(){return $` | ||
| <video | ||
| id="${this.videoId}" | ||
| style="width:${this.width}; height:${this.height}; object-fit:cover;" | ||
| muted | ||
@@ -33,3 +34,3 @@ autoplay | ||
| ></video> | ||
| `}async firstUpdated(){const t=this.shadowRoot?.getElementById(this.videoId);if(!t)return;t.style.width=this.width,t.style.height=this.height,t.style.objectFit="cover";let e;try{e=await Ue.load()}catch(i){console.error("Failed to load HLS.js:",i);return}if(!e){console.error("HLS.js not available after load");return}const s=new e;s.loadSource(this.src),s.attachMedia(t),s.on(e.Events.MANIFEST_PARSED,()=>{t.play().catch(i=>console.warn("Autoplay failed:",i))})}},g([f({type:String})],u.HlsVideo.prototype,"src",2),g([f({type:String})],u.HlsVideo.prototype,"width",2),g([f({type:String})],u.HlsVideo.prototype,"height",2),u.HlsVideo=g([Y("hls-video")],u.HlsVideo);class Te{constructor(){this.loadPromise=null}load(){return this.loadPromise?this.loadPromise:window.Hls?(this.loadPromise=Promise.resolve(window.Hls),this.loadPromise):(this.loadPromise=new Promise((t,e)=>{const s=document.createElement("script");s.src="https://cdn.jsdelivr.net/npm/hls.js@1.6.13/dist/hls.min.js",s.onload=()=>{window.Hls?t(window.Hls):e(new Error("HLS.js loaded but not available"))},s.onerror=()=>{e(new Error("Failed to load HLS.js"))},document.head.appendChild(s)}).catch(t=>{throw this.loadPromise=null,t}),this.loadPromise)}}const Ue=new Te;return Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u})({}); | ||
| `}async firstUpdated(){const t=this.shadowRoot?.getElementById(this.videoId);if(!t)return;let e;try{e=await Ne()}catch(i){console.error("Failed to load HLS.js:",i);return}if(!e){console.error("HLS.js not available after load");return}const s=new e;s.loadSource(this.src),s.attachMedia(t),s.on(e.Events.MANIFEST_PARSED,()=>{t.play().catch(i=>console.warn("Autoplay failed:",i))})}},g([f({type:String})],d.HlsVideo.prototype,"src",2),g([f({type:String})],d.HlsVideo.prototype,"width",2),g([f({type:String})],d.HlsVideo.prototype,"height",2),d.HlsVideo=g([it("hls-video")],d.HlsVideo);let T=null;function Ne(){return T||(window.Hls?(T=Promise.resolve(window.Hls),T):(T=new Promise((r,t)=>{const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/hls.js@1.6.13/dist/hls.min.js",e.onload=()=>window.Hls?r(window.Hls):t(new Error("HLS.js loaded but not available")),e.onerror=()=>t(new Error("Failed to load HLS.js")),document.head.appendChild(e)}).catch(r=>{throw T=null,r}),T))}return Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),d})({}); | ||
| //# sourceMappingURL=banners.iife.js.map |
+496
-426
@@ -1,14 +0,14 @@ | ||
| let _t = class extends Event { | ||
| constructor(t, e, s, i) { | ||
| super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = e, this.callback = s, this.subscribe = i ?? !1; | ||
| let wt = class extends Event { | ||
| constructor(t, e, s, r) { | ||
| super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = e, this.callback = s, this.subscribe = r ?? !1; | ||
| } | ||
| }; | ||
| let it = class { | ||
| constructor(t, e, s, i) { | ||
| if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (o, n) => { | ||
| this.unsubscribe && (this.unsubscribe !== n && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = o, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(o, n)), this.unsubscribe = n; | ||
| let ot = class { | ||
| constructor(t, e, s, r) { | ||
| if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, o) => { | ||
| this.unsubscribe && (this.unsubscribe !== o && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = n, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(n, o)), this.unsubscribe = o; | ||
| }, this.host = t, e.context !== void 0) { | ||
| const o = e; | ||
| this.context = o.context, this.callback = o.callback, this.subscribe = o.subscribe ?? !1; | ||
| } else this.context = e, this.callback = s, this.subscribe = i ?? !1; | ||
| const n = e; | ||
| this.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1; | ||
| } else this.context = e, this.callback = s, this.subscribe = r ?? !1; | ||
| this.host.addController(this); | ||
@@ -23,6 +23,6 @@ } | ||
| dispatchRequest() { | ||
| this.host.dispatchEvent(new _t(this.context, this.host, this.t, this.subscribe)); | ||
| this.host.dispatchEvent(new wt(this.context, this.host, this.t, this.subscribe)); | ||
| } | ||
| }; | ||
| let Ot = class { | ||
| let Nt = class { | ||
| get value() { | ||
@@ -48,4 +48,4 @@ return this.o; | ||
| }, consumerHost: e }); | ||
| const { disposer: i } = this.subscriptions.get(t); | ||
| t(this.value, i); | ||
| const { disposer: r } = this.subscriptions.get(t); | ||
| t(this.value, r); | ||
| } | ||
@@ -56,17 +56,17 @@ clearCallbacks() { | ||
| }; | ||
| let Rt = class extends Event { | ||
| let Mt = class extends Event { | ||
| constructor(t, e) { | ||
| super("context-provider", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = e; | ||
| } | ||
| }, rt = class extends Ot { | ||
| }, ht = class extends Nt { | ||
| constructor(t, e, s) { | ||
| super(e.context !== void 0 ? e.initialValue : s), this.onContextRequest = (i) => { | ||
| if (i.context !== this.context) return; | ||
| const o = i.contextTarget ?? i.composedPath()[0]; | ||
| o !== this.host && (i.stopPropagation(), this.addCallback(i.callback, o, i.subscribe)); | ||
| }, this.onProviderRequest = (i) => { | ||
| if (i.context !== this.context || (i.contextTarget ?? i.composedPath()[0]) === this.host) return; | ||
| const o = /* @__PURE__ */ new Set(); | ||
| for (const [n, { consumerHost: h }] of this.subscriptions) o.has(n) || (o.add(n), h.dispatchEvent(new _t(this.context, h, n, !0))); | ||
| i.stopPropagation(); | ||
| super(e.context !== void 0 ? e.initialValue : s), this.onContextRequest = (r) => { | ||
| if (r.context !== this.context) return; | ||
| const n = r.contextTarget ?? r.composedPath()[0]; | ||
| n !== this.host && (r.stopPropagation(), this.addCallback(r.callback, n, r.subscribe)); | ||
| }, this.onProviderRequest = (r) => { | ||
| if (r.context !== this.context || (r.contextTarget ?? r.composedPath()[0]) === this.host) return; | ||
| const n = /* @__PURE__ */ new Set(); | ||
| for (const [o, { consumerHost: h }] of this.subscriptions) n.has(o) || (n.add(o), h.dispatchEvent(new wt(this.context, h, o, !0))); | ||
| r.stopPropagation(); | ||
| }, this.host = t, e.context !== void 0 ? this.context = e.context : this.context = e, this.attachListeners(), this.host.addController?.(this); | ||
@@ -78,6 +78,6 @@ } | ||
| hostConnected() { | ||
| this.host.dispatchEvent(new Rt(this.context, this.host)); | ||
| this.host.dispatchEvent(new Mt(this.context, this.host)); | ||
| } | ||
| }; | ||
| function Nt({ context: r }) { | ||
| function It({ context: i }) { | ||
| return (t, e) => { | ||
@@ -87,39 +87,39 @@ const s = /* @__PURE__ */ new WeakMap(); | ||
| return t.get.call(this); | ||
| }, set(i) { | ||
| return s.get(this).setValue(i), t.set.call(this, i); | ||
| }, init(i) { | ||
| return s.set(this, new rt(this, { context: r, initialValue: i })), i; | ||
| }, set(r) { | ||
| return s.get(this).setValue(r), t.set.call(this, r); | ||
| }, init(r) { | ||
| return s.set(this, new ht(this, { context: i, initialValue: r })), r; | ||
| } }; | ||
| { | ||
| t.constructor.addInitializer(((n) => { | ||
| s.set(n, new rt(n, { context: r })); | ||
| t.constructor.addInitializer(((o) => { | ||
| s.set(o, new ht(o, { context: i })); | ||
| })); | ||
| const i = Object.getOwnPropertyDescriptor(t, e); | ||
| let o; | ||
| if (i === void 0) { | ||
| const n = /* @__PURE__ */ new WeakMap(); | ||
| o = { get() { | ||
| return n.get(this); | ||
| const r = Object.getOwnPropertyDescriptor(t, e); | ||
| let n; | ||
| if (r === void 0) { | ||
| const o = /* @__PURE__ */ new WeakMap(); | ||
| n = { get() { | ||
| return o.get(this); | ||
| }, set(h) { | ||
| s.get(this).setValue(h), n.set(this, h); | ||
| s.get(this).setValue(h), o.set(this, h); | ||
| }, configurable: !0, enumerable: !0 }; | ||
| } else { | ||
| const n = i.set; | ||
| o = { ...i, set(h) { | ||
| s.get(this).setValue(h), n?.call(this, h); | ||
| const o = r.set; | ||
| n = { ...r, set(h) { | ||
| s.get(this).setValue(h), o?.call(this, h); | ||
| } }; | ||
| } | ||
| return void Object.defineProperty(t, e, o); | ||
| return void Object.defineProperty(t, e, n); | ||
| } | ||
| }; | ||
| } | ||
| function kt({ context: r, subscribe: t }) { | ||
| function jt({ context: i, subscribe: t }) { | ||
| return (e, s) => { | ||
| typeof s == "object" ? s.addInitializer((function() { | ||
| new it(this, { context: r, callback: (i) => { | ||
| e.set.call(this, i); | ||
| new ot(this, { context: i, callback: (r) => { | ||
| e.set.call(this, r); | ||
| }, subscribe: t }); | ||
| })) : e.constructor.addInitializer(((i) => { | ||
| new it(i, { context: r, callback: (o) => { | ||
| i[s] = o; | ||
| })) : e.constructor.addInitializer(((r) => { | ||
| new ot(r, { context: i, callback: (n) => { | ||
| r[s] = n; | ||
| }, subscribe: t }); | ||
@@ -129,6 +129,6 @@ })); | ||
| } | ||
| const I = globalThis, Q = I.ShadowRoot && (I.ShadyCSS === void 0 || I.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, bt = Symbol(), ot = /* @__PURE__ */ new WeakMap(); | ||
| let Mt = class { | ||
| const D = globalThis, G = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, St = Symbol(), at = /* @__PURE__ */ new WeakMap(); | ||
| let Ht = class { | ||
| constructor(t, e, s) { | ||
| if (this._$cssResult$ = !0, s !== bt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| if (this._$cssResult$ = !0, s !== St) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| this.cssText = t, this.t = e; | ||
@@ -139,5 +139,5 @@ } | ||
| const e = this.t; | ||
| if (Q && t === void 0) { | ||
| if (G && t === void 0) { | ||
| const s = e !== void 0 && e.length === 1; | ||
| s && (t = ot.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && ot.set(e, t)); | ||
| s && (t = at.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && at.set(e, t)); | ||
| } | ||
@@ -150,31 +150,31 @@ return t; | ||
| }; | ||
| const jt = (r) => new Mt(typeof r == "string" ? r : r + "", void 0, bt), Ht = (r, t) => { | ||
| if (Q) r.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet)); | ||
| const Lt = (i) => new Ht(typeof i == "string" ? i : i + "", void 0, St), Bt = (i, t) => { | ||
| if (G) i.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet)); | ||
| else for (const e of t) { | ||
| const s = document.createElement("style"), i = I.litNonce; | ||
| i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s); | ||
| const s = document.createElement("style"), r = D.litNonce; | ||
| r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s); | ||
| } | ||
| }, nt = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
| }, ct = G ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => { | ||
| let e = ""; | ||
| for (const s of t.cssRules) e += s.cssText; | ||
| return jt(e); | ||
| })(r) : r; | ||
| const { is: It, defineProperty: Bt, getOwnPropertyDescriptor: Lt, getOwnPropertyNames: qt, getOwnPropertySymbols: Dt, getPrototypeOf: zt } = Object, z = globalThis, ht = z.trustedTypes, Wt = ht ? ht.emptyScript : "", Vt = z.reactiveElementPolyfillSupport, T = (r, t) => r, F = { toAttribute(r, t) { | ||
| return Lt(e); | ||
| })(i) : i; | ||
| const { is: qt, defineProperty: Dt, getOwnPropertyDescriptor: zt, getOwnPropertyNames: Wt, getOwnPropertySymbols: Ft, getPrototypeOf: Vt } = Object, J = globalThis, lt = J.trustedTypes, Jt = lt ? lt.emptyScript : "", Kt = J.reactiveElementPolyfillSupport, O = (i, t) => i, X = { toAttribute(i, t) { | ||
| switch (t) { | ||
| case Boolean: | ||
| r = r ? Wt : null; | ||
| i = i ? Jt : null; | ||
| break; | ||
| case Object: | ||
| case Array: | ||
| r = r == null ? r : JSON.stringify(r); | ||
| i = i == null ? i : JSON.stringify(i); | ||
| } | ||
| return r; | ||
| }, fromAttribute(r, t) { | ||
| let e = r; | ||
| return i; | ||
| }, fromAttribute(i, t) { | ||
| let e = i; | ||
| switch (t) { | ||
| case Boolean: | ||
| e = r !== null; | ||
| e = i !== null; | ||
| break; | ||
| case Number: | ||
| e = r === null ? null : Number(r); | ||
| e = i === null ? null : Number(i); | ||
| break; | ||
@@ -184,3 +184,3 @@ case Object: | ||
| try { | ||
| e = JSON.parse(r); | ||
| e = JSON.parse(i); | ||
| } catch { | ||
@@ -191,5 +191,5 @@ e = null; | ||
| return e; | ||
| } }, Z = (r, t) => !It(r, t), at = { attribute: !0, type: String, converter: F, reflect: !1, hasChanged: Z }; | ||
| Symbol.metadata ??= Symbol("metadata"), z.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| let P = class extends HTMLElement { | ||
| } }, Y = (i, t) => !qt(i, t), dt = { attribute: !0, type: String, converter: X, reflect: !1, hasChanged: Y }; | ||
| Symbol.metadata ??= Symbol("metadata"), J.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| let U = class extends HTMLElement { | ||
| static addInitializer(t) { | ||
@@ -201,34 +201,34 @@ this._$Ei(), (this.l ??= []).push(t); | ||
| } | ||
| static createProperty(t, e = at) { | ||
| static createProperty(t, e = dt) { | ||
| if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) { | ||
| const s = Symbol(), i = this.getPropertyDescriptor(t, s, e); | ||
| i !== void 0 && Bt(this.prototype, t, i); | ||
| const s = Symbol(), r = this.getPropertyDescriptor(t, s, e); | ||
| r !== void 0 && Dt(this.prototype, t, r); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(t, e, s) { | ||
| const { get: i, set: o } = Lt(this.prototype, t) ?? { get() { | ||
| const { get: r, set: n } = zt(this.prototype, t) ?? { get() { | ||
| return this[e]; | ||
| }, set(n) { | ||
| this[e] = n; | ||
| }, set(o) { | ||
| this[e] = o; | ||
| } }; | ||
| return { get() { | ||
| return i?.call(this); | ||
| }, set(n) { | ||
| const h = i?.call(this); | ||
| o.call(this, n), this.requestUpdate(t, h, s); | ||
| return r?.call(this); | ||
| }, set(o) { | ||
| const h = r?.call(this); | ||
| n.call(this, o), this.requestUpdate(t, h, s); | ||
| }, configurable: !0, enumerable: !0 }; | ||
| } | ||
| static getPropertyOptions(t) { | ||
| return this.elementProperties.get(t) ?? at; | ||
| return this.elementProperties.get(t) ?? dt; | ||
| } | ||
| static _$Ei() { | ||
| if (this.hasOwnProperty(T("elementProperties"))) return; | ||
| const t = zt(this); | ||
| if (this.hasOwnProperty(O("elementProperties"))) return; | ||
| const t = Vt(this); | ||
| t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties); | ||
| } | ||
| static finalize() { | ||
| if (this.hasOwnProperty(T("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(T("properties"))) { | ||
| const e = this.properties, s = [...qt(e), ...Dt(e)]; | ||
| for (const i of s) this.createProperty(i, e[i]); | ||
| if (this.hasOwnProperty(O("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(O("properties"))) { | ||
| const e = this.properties, s = [...Wt(e), ...Ft(e)]; | ||
| for (const r of s) this.createProperty(r, e[r]); | ||
| } | ||
@@ -238,8 +238,8 @@ const t = this[Symbol.metadata]; | ||
| const e = litPropertyMetadata.get(t); | ||
| if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i); | ||
| if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (const [e, s] of this.elementProperties) { | ||
| const i = this._$Eu(e, s); | ||
| i !== void 0 && this._$Eh.set(i, e); | ||
| const r = this._$Eu(e, s); | ||
| r !== void 0 && this._$Eh.set(r, e); | ||
| } | ||
@@ -252,4 +252,4 @@ this.elementStyles = this.finalizeStyles(this.styles); | ||
| const s = new Set(t.flat(1 / 0).reverse()); | ||
| for (const i of s) e.unshift(nt(i)); | ||
| } else t !== void 0 && e.push(nt(t)); | ||
| for (const r of s) e.unshift(ct(r)); | ||
| } else t !== void 0 && e.push(ct(t)); | ||
| return e; | ||
@@ -280,3 +280,3 @@ } | ||
| const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); | ||
| return Ht(t, this.constructor.elementStyles), t; | ||
| return Bt(t, this.constructor.elementStyles), t; | ||
| } | ||
@@ -295,13 +295,13 @@ connectedCallback() { | ||
| _$EC(t, e) { | ||
| const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s); | ||
| if (i !== void 0 && s.reflect === !0) { | ||
| const o = (s.converter?.toAttribute !== void 0 ? s.converter : F).toAttribute(e, s.type); | ||
| this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null; | ||
| const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s); | ||
| if (r !== void 0 && s.reflect === !0) { | ||
| const n = (s.converter?.toAttribute !== void 0 ? s.converter : X).toAttribute(e, s.type); | ||
| this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null; | ||
| } | ||
| } | ||
| _$AK(t, e) { | ||
| const s = this.constructor, i = s._$Eh.get(t); | ||
| if (i !== void 0 && this._$Em !== i) { | ||
| const o = s.getPropertyOptions(i), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : F; | ||
| this._$Em = i, this[i] = n.fromAttribute(e, o.type), this._$Em = null; | ||
| const s = this.constructor, r = s._$Eh.get(t); | ||
| if (r !== void 0 && this._$Em !== r) { | ||
| const n = s.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : X; | ||
| this._$Em = r, this[r] = o.fromAttribute(e, n.type), this._$Em = null; | ||
| } | ||
@@ -311,3 +311,3 @@ } | ||
| if (t !== void 0) { | ||
| if (s ??= this.constructor.getPropertyOptions(t), !(s.hasChanged ?? Z)(this[t], e)) return; | ||
| if (s ??= this.constructor.getPropertyOptions(t), !(s.hasChanged ?? Y)(this[t], e)) return; | ||
| this.P(t, e, s); | ||
@@ -337,7 +337,7 @@ } | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (const [i, o] of this._$Ep) this[i] = o; | ||
| for (const [r, n] of this._$Ep) this[r] = n; | ||
| this._$Ep = void 0; | ||
| } | ||
| const s = this.constructor.elementProperties; | ||
| if (s.size > 0) for (const [i, o] of s) o.wrapped !== !0 || this._$AL.has(i) || this[i] === void 0 || this.P(i, this[i], o); | ||
| if (s.size > 0) for (const [r, n] of s) n.wrapped !== !0 || this._$AL.has(r) || this[r] === void 0 || this.P(r, this[r], n); | ||
| } | ||
@@ -378,5 +378,5 @@ let t = !1; | ||
| }; | ||
| P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[T("elementProperties")] = /* @__PURE__ */ new Map(), P[T("finalized")] = /* @__PURE__ */ new Map(), Vt?.({ ReactiveElement: P }), (z.reactiveElementVersions ??= []).push("2.0.4"); | ||
| const Kt = Symbol(); | ||
| let Ft = class { | ||
| U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[O("elementProperties")] = /* @__PURE__ */ new Map(), U[O("finalized")] = /* @__PURE__ */ new Map(), Kt?.({ ReactiveElement: U }), (J.reactiveElementVersions ??= []).push("2.0.4"); | ||
| const m = { INITIAL: 0, COMPLETE: 2, ERROR: 3 }, Qt = Symbol(); | ||
| let Zt = class { | ||
| get taskComplete() { | ||
@@ -389,4 +389,4 @@ return this.t || (this.i === 1 ? this.t = new Promise(((t, e) => { | ||
| this.p = 0, this.i = 0, (this._ = t).addController(this); | ||
| const i = typeof e == "object" ? e : { task: e, args: s }; | ||
| this.v = i.task, this.j = i.args, this.m = i.argsEqual ?? Jt, this.k = i.onComplete, this.A = i.onError, this.autoRun = i.autoRun ?? !0, "initialValue" in i && (this.u = i.initialValue, this.i = 2, this.O = this.T?.()); | ||
| const r = typeof e == "object" ? e : { task: e, args: s }; | ||
| this.v = r.task, this.j = r.args, this.m = r.argsEqual ?? Xt, this.k = r.onComplete, this.A = r.onError, this.autoRun = r.autoRun ?? !0, "initialValue" in r && (this.u = r.initialValue, this.i = 2, this.O = this.T?.()); | ||
| } | ||
@@ -412,14 +412,14 @@ hostUpdate() { | ||
| t ??= this.T(), this.O = t, this.i === 1 ? this.q?.abort() : (this.t = void 0, this.o = void 0, this.h = void 0), this.i = 1, this.autoRun === "afterUpdate" ? queueMicrotask((() => this._.requestUpdate())) : this._.requestUpdate(); | ||
| const i = ++this.p; | ||
| const r = ++this.p; | ||
| this.q = new AbortController(); | ||
| let o = !1; | ||
| let n = !1; | ||
| try { | ||
| e = await this.v(t, { signal: this.q.signal }); | ||
| } catch (n) { | ||
| o = !0, s = n; | ||
| } catch (o) { | ||
| n = !0, s = o; | ||
| } | ||
| if (this.p === i) { | ||
| if (e === Kt) this.i = 0; | ||
| if (this.p === r) { | ||
| if (e === Qt) this.i = 0; | ||
| else { | ||
| if (o === !1) { | ||
| if (n === !1) { | ||
| try { | ||
@@ -469,7 +469,7 @@ this.k?.(e); | ||
| }; | ||
| const Jt = (r, t) => r === t || r.length === t.length && r.every(((e, s) => !Z(e, t[s]))); | ||
| const B = globalThis, X = B.ShadowRoot && (B.ShadyCSS === void 0 || B.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, vt = Symbol(), ct = /* @__PURE__ */ new WeakMap(); | ||
| let Qt = class { | ||
| const Xt = (i, t) => i === t || i.length === t.length && i.every(((e, s) => !Y(e, t[s]))); | ||
| const z = globalThis, tt = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, At = Symbol(), ut = /* @__PURE__ */ new WeakMap(); | ||
| let Gt = class { | ||
| constructor(t, e, s) { | ||
| if (this._$cssResult$ = !0, s !== vt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| if (this._$cssResult$ = !0, s !== At) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| this.cssText = t, this.t = e; | ||
@@ -480,5 +480,5 @@ } | ||
| const e = this.t; | ||
| if (X && t === void 0) { | ||
| if (tt && t === void 0) { | ||
| const s = e !== void 0 && e.length === 1; | ||
| s && (t = ct.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && ct.set(e, t)); | ||
| s && (t = ut.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && ut.set(e, t)); | ||
| } | ||
@@ -491,31 +491,31 @@ return t; | ||
| }; | ||
| const Zt = (r) => new Qt(typeof r == "string" ? r : r + "", void 0, vt), Xt = (r, t) => { | ||
| if (X) r.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet)); | ||
| const Yt = (i) => new Gt(typeof i == "string" ? i : i + "", void 0, At), te = (i, t) => { | ||
| if (tt) i.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet)); | ||
| else for (const e of t) { | ||
| const s = document.createElement("style"), i = B.litNonce; | ||
| i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s); | ||
| const s = document.createElement("style"), r = z.litNonce; | ||
| r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s); | ||
| } | ||
| }, lt = X ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
| }, pt = tt ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => { | ||
| let e = ""; | ||
| for (const s of t.cssRules) e += s.cssText; | ||
| return Zt(e); | ||
| })(r) : r; | ||
| const { is: Gt, defineProperty: Yt, getOwnPropertyDescriptor: te, getOwnPropertyNames: ee, getOwnPropertySymbols: se, getPrototypeOf: ie } = Object, W = globalThis, dt = W.trustedTypes, re = dt ? dt.emptyScript : "", oe = W.reactiveElementPolyfillSupport, U = (r, t) => r, L = { toAttribute(r, t) { | ||
| return Yt(e); | ||
| })(i) : i; | ||
| const { is: ee, defineProperty: se, getOwnPropertyDescriptor: ie, getOwnPropertyNames: re, getOwnPropertySymbols: ne, getPrototypeOf: oe } = Object, K = globalThis, ft = K.trustedTypes, he = ft ? ft.emptyScript : "", ae = K.reactiveElementPolyfillSupport, k = (i, t) => i, W = { toAttribute(i, t) { | ||
| switch (t) { | ||
| case Boolean: | ||
| r = r ? re : null; | ||
| i = i ? he : null; | ||
| break; | ||
| case Object: | ||
| case Array: | ||
| r = r == null ? r : JSON.stringify(r); | ||
| i = i == null ? i : JSON.stringify(i); | ||
| } | ||
| return r; | ||
| }, fromAttribute(r, t) { | ||
| let e = r; | ||
| return i; | ||
| }, fromAttribute(i, t) { | ||
| let e = i; | ||
| switch (t) { | ||
| case Boolean: | ||
| e = r !== null; | ||
| e = i !== null; | ||
| break; | ||
| case Number: | ||
| e = r === null ? null : Number(r); | ||
| e = i === null ? null : Number(i); | ||
| break; | ||
@@ -525,3 +525,3 @@ case Object: | ||
| try { | ||
| e = JSON.parse(r); | ||
| e = JSON.parse(i); | ||
| } catch { | ||
@@ -532,5 +532,5 @@ e = null; | ||
| return e; | ||
| } }, G = (r, t) => !Gt(r, t), ut = { attribute: !0, type: String, converter: L, reflect: !1, useDefault: !1, hasChanged: G }; | ||
| Symbol.metadata ??= Symbol("metadata"), W.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| let S = class extends HTMLElement { | ||
| } }, et = (i, t) => !ee(i, t), $t = { attribute: !0, type: String, converter: W, reflect: !1, useDefault: !1, hasChanged: et }; | ||
| Symbol.metadata ??= Symbol("metadata"), K.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| let x = class extends HTMLElement { | ||
| static addInitializer(t) { | ||
@@ -542,32 +542,32 @@ this._$Ei(), (this.l ??= []).push(t); | ||
| } | ||
| static createProperty(t, e = ut) { | ||
| static createProperty(t, e = $t) { | ||
| if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) { | ||
| const s = Symbol(), i = this.getPropertyDescriptor(t, s, e); | ||
| i !== void 0 && Yt(this.prototype, t, i); | ||
| const s = Symbol(), r = this.getPropertyDescriptor(t, s, e); | ||
| r !== void 0 && se(this.prototype, t, r); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(t, e, s) { | ||
| const { get: i, set: o } = te(this.prototype, t) ?? { get() { | ||
| const { get: r, set: n } = ie(this.prototype, t) ?? { get() { | ||
| return this[e]; | ||
| }, set(n) { | ||
| this[e] = n; | ||
| }, set(o) { | ||
| this[e] = o; | ||
| } }; | ||
| return { get: i, set(n) { | ||
| const h = i?.call(this); | ||
| o?.call(this, n), this.requestUpdate(t, h, s); | ||
| return { get: r, set(o) { | ||
| const h = r?.call(this); | ||
| n?.call(this, o), this.requestUpdate(t, h, s); | ||
| }, configurable: !0, enumerable: !0 }; | ||
| } | ||
| static getPropertyOptions(t) { | ||
| return this.elementProperties.get(t) ?? ut; | ||
| return this.elementProperties.get(t) ?? $t; | ||
| } | ||
| static _$Ei() { | ||
| if (this.hasOwnProperty(U("elementProperties"))) return; | ||
| const t = ie(this); | ||
| if (this.hasOwnProperty(k("elementProperties"))) return; | ||
| const t = oe(this); | ||
| t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties); | ||
| } | ||
| static finalize() { | ||
| if (this.hasOwnProperty(U("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) { | ||
| const e = this.properties, s = [...ee(e), ...se(e)]; | ||
| for (const i of s) this.createProperty(i, e[i]); | ||
| if (this.hasOwnProperty(k("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(k("properties"))) { | ||
| const e = this.properties, s = [...re(e), ...ne(e)]; | ||
| for (const r of s) this.createProperty(r, e[r]); | ||
| } | ||
@@ -577,8 +577,8 @@ const t = this[Symbol.metadata]; | ||
| const e = litPropertyMetadata.get(t); | ||
| if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i); | ||
| if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (const [e, s] of this.elementProperties) { | ||
| const i = this._$Eu(e, s); | ||
| i !== void 0 && this._$Eh.set(i, e); | ||
| const r = this._$Eu(e, s); | ||
| r !== void 0 && this._$Eh.set(r, e); | ||
| } | ||
@@ -591,4 +591,4 @@ this.elementStyles = this.finalizeStyles(this.styles); | ||
| const s = new Set(t.flat(1 / 0).reverse()); | ||
| for (const i of s) e.unshift(lt(i)); | ||
| } else t !== void 0 && e.push(lt(t)); | ||
| for (const r of s) e.unshift(pt(r)); | ||
| } else t !== void 0 && e.push(pt(t)); | ||
| return e; | ||
@@ -619,3 +619,3 @@ } | ||
| const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); | ||
| return Xt(t, this.constructor.elementStyles), t; | ||
| return te(t, this.constructor.elementStyles), t; | ||
| } | ||
@@ -634,15 +634,15 @@ connectedCallback() { | ||
| _$ET(t, e) { | ||
| const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s); | ||
| if (i !== void 0 && s.reflect === !0) { | ||
| const o = (s.converter?.toAttribute !== void 0 ? s.converter : L).toAttribute(e, s.type); | ||
| this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null; | ||
| const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s); | ||
| if (r !== void 0 && s.reflect === !0) { | ||
| const n = (s.converter?.toAttribute !== void 0 ? s.converter : W).toAttribute(e, s.type); | ||
| this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null; | ||
| } | ||
| } | ||
| _$AK(t, e) { | ||
| const s = this.constructor, i = s._$Eh.get(t); | ||
| if (i !== void 0 && this._$Em !== i) { | ||
| const o = s.getPropertyOptions(i), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : L; | ||
| this._$Em = i; | ||
| const h = n.fromAttribute(e, o.type); | ||
| this[i] = h ?? this._$Ej?.get(i) ?? h, this._$Em = null; | ||
| const s = this.constructor, r = s._$Eh.get(t); | ||
| if (r !== void 0 && this._$Em !== r) { | ||
| const n = s.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : W; | ||
| this._$Em = r; | ||
| const h = o.fromAttribute(e, n.type); | ||
| this[r] = h ?? this._$Ej?.get(r) ?? h, this._$Em = null; | ||
| } | ||
@@ -652,4 +652,4 @@ } | ||
| if (t !== void 0) { | ||
| const i = this.constructor, o = this[t]; | ||
| if (s ??= i.getPropertyOptions(t), !((s.hasChanged ?? G)(o, e) || s.useDefault && s.reflect && o === this._$Ej?.get(t) && !this.hasAttribute(i._$Eu(t, s)))) return; | ||
| const r = this.constructor, n = this[t]; | ||
| if (s ??= r.getPropertyOptions(t), !((s.hasChanged ?? et)(n, e) || s.useDefault && s.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, s)))) return; | ||
| this.C(t, e, s); | ||
@@ -659,4 +659,4 @@ } | ||
| } | ||
| C(t, e, { useDefault: s, reflect: i, wrapped: o }, n) { | ||
| s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), o !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), i === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); | ||
| C(t, e, { useDefault: s, reflect: r, wrapped: n }, o) { | ||
| s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); | ||
| } | ||
@@ -680,9 +680,9 @@ async _$EP() { | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (const [i, o] of this._$Ep) this[i] = o; | ||
| for (const [r, n] of this._$Ep) this[r] = n; | ||
| this._$Ep = void 0; | ||
| } | ||
| const s = this.constructor.elementProperties; | ||
| if (s.size > 0) for (const [i, o] of s) { | ||
| const { wrapped: n } = o, h = this[i]; | ||
| n !== !0 || this._$AL.has(i) || h === void 0 || this.C(i, void 0, o, h); | ||
| if (s.size > 0) for (const [r, n] of s) { | ||
| const { wrapped: o } = n, h = this[r]; | ||
| o !== !0 || this._$AL.has(r) || h === void 0 || this.C(r, void 0, n, h); | ||
| } | ||
@@ -724,66 +724,66 @@ } | ||
| }; | ||
| S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[U("elementProperties")] = /* @__PURE__ */ new Map(), S[U("finalized")] = /* @__PURE__ */ new Map(), oe?.({ ReactiveElement: S }), (W.reactiveElementVersions ??= []).push("2.1.1"); | ||
| const Y = globalThis, q = Y.trustedTypes, pt = q ? q.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, wt = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, Et = "?" + _, ne = `<${Et}>`, E = document, O = () => E.createComment(""), R = (r) => r === null || typeof r != "object" && typeof r != "function", tt = Array.isArray, he = (r) => tt(r) || typeof r?.[Symbol.iterator] == "function", K = `[ | ||
| \f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ft = /-->/g, $t = />/g, b = RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`, "g"), gt = /'/g, yt = /"/g, St = /^(?:script|style|textarea|title)$/i, ae = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), f = ae(1), A = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), mt = /* @__PURE__ */ new WeakMap(), v = E.createTreeWalker(E, 129); | ||
| function At(r, t) { | ||
| if (!tt(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array"); | ||
| return pt !== void 0 ? pt.createHTML(t) : t; | ||
| x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[k("elementProperties")] = /* @__PURE__ */ new Map(), x[k("finalized")] = /* @__PURE__ */ new Map(), ae?.({ ReactiveElement: x }), (K.reactiveElementVersions ??= []).push("2.1.1"); | ||
| const st = globalThis, F = st.trustedTypes, gt = F ? F.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, xt = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, Ct = "?" + _, ce = `<${Ct}>`, A = document, M = () => A.createComment(""), I = (i) => i === null || typeof i != "object" && typeof i != "function", it = Array.isArray, le = (i) => it(i) || typeof i?.[Symbol.iterator] == "function", Z = `[ | ||
| \f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, yt = /-->/g, bt = />/g, v = RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`, "g"), mt = /'/g, _t = /"/g, Pt = /^(?:script|style|textarea|title)$/i, de = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), f = de(1), C = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), vt = /* @__PURE__ */ new WeakMap(), w = A.createTreeWalker(A, 129); | ||
| function Tt(i, t) { | ||
| if (!it(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array"); | ||
| return gt !== void 0 ? gt.createHTML(t) : t; | ||
| } | ||
| const ce = (r, t) => { | ||
| const e = r.length - 1, s = []; | ||
| let i, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = C; | ||
| const ue = (i, t) => { | ||
| const e = i.length - 1, s = []; | ||
| let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = R; | ||
| for (let h = 0; h < e; h++) { | ||
| const a = r[h]; | ||
| const a = i[h]; | ||
| let c, d, l = -1, g = 0; | ||
| for (; g < a.length && (n.lastIndex = g, d = n.exec(a), d !== null); ) g = n.lastIndex, n === C ? d[1] === "!--" ? n = ft : d[1] !== void 0 ? n = $t : d[2] !== void 0 ? (St.test(d[2]) && (i = RegExp("</" + d[2], "g")), n = b) : d[3] !== void 0 && (n = b) : n === b ? d[0] === ">" ? (n = i ?? C, l = -1) : d[1] === void 0 ? l = -2 : (l = n.lastIndex - d[2].length, c = d[1], n = d[3] === void 0 ? b : d[3] === '"' ? yt : gt) : n === yt || n === gt ? n = b : n === ft || n === $t ? n = C : (n = b, i = void 0); | ||
| const m = n === b && r[h + 1].startsWith("/>") ? " " : ""; | ||
| o += n === C ? a + ne : l >= 0 ? (s.push(c), a.slice(0, l) + wt + a.slice(l) + _ + m) : a + _ + (l === -2 ? h : m); | ||
| for (; g < a.length && (o.lastIndex = g, d = o.exec(a), d !== null); ) g = o.lastIndex, o === R ? d[1] === "!--" ? o = yt : d[1] !== void 0 ? o = bt : d[2] !== void 0 ? (Pt.test(d[2]) && (r = RegExp("</" + d[2], "g")), o = v) : d[3] !== void 0 && (o = v) : o === v ? d[0] === ">" ? (o = r ?? R, l = -1) : d[1] === void 0 ? l = -2 : (l = o.lastIndex - d[2].length, c = d[1], o = d[3] === void 0 ? v : d[3] === '"' ? _t : mt) : o === _t || o === mt ? o = v : o === yt || o === bt ? o = R : (o = v, r = void 0); | ||
| const b = o === v && i[h + 1].startsWith("/>") ? " " : ""; | ||
| n += o === R ? a + ce : l >= 0 ? (s.push(c), a.slice(0, l) + xt + a.slice(l) + _ + b) : a + _ + (l === -2 ? h : b); | ||
| } | ||
| return [At(r, o + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s]; | ||
| return [Tt(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s]; | ||
| }; | ||
| class N { | ||
| class j { | ||
| constructor({ strings: t, _$litType$: e }, s) { | ||
| let i; | ||
| let r; | ||
| this.parts = []; | ||
| let o = 0, n = 0; | ||
| const h = t.length - 1, a = this.parts, [c, d] = ce(t, e); | ||
| if (this.el = N.createElement(c, s), v.currentNode = this.el.content, e === 2 || e === 3) { | ||
| let n = 0, o = 0; | ||
| const h = t.length - 1, a = this.parts, [c, d] = ue(t, e); | ||
| if (this.el = j.createElement(c, s), w.currentNode = this.el.content, e === 2 || e === 3) { | ||
| const l = this.el.content.firstChild; | ||
| l.replaceWith(...l.childNodes); | ||
| } | ||
| for (; (i = v.nextNode()) !== null && a.length < h; ) { | ||
| if (i.nodeType === 1) { | ||
| if (i.hasAttributes()) for (const l of i.getAttributeNames()) if (l.endsWith(wt)) { | ||
| const g = d[n++], m = i.getAttribute(l).split(_), H = /([.?@])?(.*)/.exec(g); | ||
| a.push({ type: 1, index: o, name: H[2], strings: m, ctor: H[1] === "." ? de : H[1] === "?" ? ue : H[1] === "@" ? pe : V }), i.removeAttribute(l); | ||
| } else l.startsWith(_) && (a.push({ type: 6, index: o }), i.removeAttribute(l)); | ||
| if (St.test(i.tagName)) { | ||
| const l = i.textContent.split(_), g = l.length - 1; | ||
| for (; (r = w.nextNode()) !== null && a.length < h; ) { | ||
| if (r.nodeType === 1) { | ||
| if (r.hasAttributes()) for (const l of r.getAttributeNames()) if (l.endsWith(xt)) { | ||
| const g = d[o++], b = r.getAttribute(l).split(_), q = /([.?@])?(.*)/.exec(g); | ||
| a.push({ type: 1, index: n, name: q[2], strings: b, ctor: q[1] === "." ? fe : q[1] === "?" ? $e : q[1] === "@" ? ge : Q }), r.removeAttribute(l); | ||
| } else l.startsWith(_) && (a.push({ type: 6, index: n }), r.removeAttribute(l)); | ||
| if (Pt.test(r.tagName)) { | ||
| const l = r.textContent.split(_), g = l.length - 1; | ||
| if (g > 0) { | ||
| i.textContent = q ? q.emptyScript : ""; | ||
| for (let m = 0; m < g; m++) i.append(l[m], O()), v.nextNode(), a.push({ type: 2, index: ++o }); | ||
| i.append(l[g], O()); | ||
| r.textContent = F ? F.emptyScript : ""; | ||
| for (let b = 0; b < g; b++) r.append(l[b], M()), w.nextNode(), a.push({ type: 2, index: ++n }); | ||
| r.append(l[g], M()); | ||
| } | ||
| } | ||
| } else if (i.nodeType === 8) if (i.data === Et) a.push({ type: 2, index: o }); | ||
| } else if (r.nodeType === 8) if (r.data === Ct) a.push({ type: 2, index: n }); | ||
| else { | ||
| let l = -1; | ||
| for (; (l = i.data.indexOf(_, l + 1)) !== -1; ) a.push({ type: 7, index: o }), l += _.length - 1; | ||
| for (; (l = r.data.indexOf(_, l + 1)) !== -1; ) a.push({ type: 7, index: n }), l += _.length - 1; | ||
| } | ||
| o++; | ||
| n++; | ||
| } | ||
| } | ||
| static createElement(t, e) { | ||
| const s = E.createElement("template"); | ||
| const s = A.createElement("template"); | ||
| return s.innerHTML = t, s; | ||
| } | ||
| } | ||
| function x(r, t, e = r, s) { | ||
| if (t === A) return t; | ||
| let i = s !== void 0 ? e._$Co?.[s] : e._$Cl; | ||
| const o = R(t) ? void 0 : t._$litDirective$; | ||
| return i?.constructor !== o && (i?._$AO?.(!1), o === void 0 ? i = void 0 : (i = new o(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = i : e._$Cl = i), i !== void 0 && (t = x(r, i._$AS(r, t.values), i, s)), t; | ||
| function P(i, t, e = i, s) { | ||
| if (t === C) return t; | ||
| let r = s !== void 0 ? e._$Co?.[s] : e._$Cl; | ||
| const n = I(t) ? void 0 : t._$litDirective$; | ||
| return r?.constructor !== n && (r?._$AO?.(!1), n === void 0 ? r = void 0 : (r = new n(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = r : e._$Cl = r), r !== void 0 && (t = P(i, r._$AS(i, t.values), r, s)), t; | ||
| } | ||
| class le { | ||
| class pe { | ||
| constructor(t, e) { | ||
@@ -799,13 +799,13 @@ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e; | ||
| u(t) { | ||
| const { el: { content: e }, parts: s } = this._$AD, i = (t?.creationScope ?? E).importNode(e, !0); | ||
| v.currentNode = i; | ||
| let o = v.nextNode(), n = 0, h = 0, a = s[0]; | ||
| const { el: { content: e }, parts: s } = this._$AD, r = (t?.creationScope ?? A).importNode(e, !0); | ||
| w.currentNode = r; | ||
| let n = w.nextNode(), o = 0, h = 0, a = s[0]; | ||
| for (; a !== void 0; ) { | ||
| if (n === a.index) { | ||
| if (o === a.index) { | ||
| let c; | ||
| a.type === 2 ? c = new j(o, o.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (c = new fe(o, this, t)), this._$AV.push(c), a = s[++h]; | ||
| a.type === 2 ? c = new B(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new ye(n, this, t)), this._$AV.push(c), a = s[++h]; | ||
| } | ||
| n !== a?.index && (o = v.nextNode(), n++); | ||
| o !== a?.index && (n = w.nextNode(), o++); | ||
| } | ||
| return v.currentNode = E, i; | ||
| return w.currentNode = A, r; | ||
| } | ||
@@ -817,8 +817,8 @@ p(t) { | ||
| } | ||
| class j { | ||
| class B { | ||
| get _$AU() { | ||
| return this._$AM?._$AU ?? this._$Cv; | ||
| } | ||
| constructor(t, e, s, i) { | ||
| this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = i?.isConnected ?? !0; | ||
| constructor(t, e, s, r) { | ||
| this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0; | ||
| } | ||
@@ -837,3 +837,3 @@ get parentNode() { | ||
| _$AI(t, e = this) { | ||
| t = x(this, t, e), R(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== A && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : he(t) ? this.k(t) : this._(t); | ||
| t = P(this, t, e), I(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== C && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : le(t) ? this.k(t) : this._(t); | ||
| } | ||
@@ -847,22 +847,22 @@ O(t) { | ||
| _(t) { | ||
| this._$AH !== u && R(this._$AH) ? this._$AA.nextSibling.data = t : this.T(E.createTextNode(t)), this._$AH = t; | ||
| this._$AH !== u && I(this._$AH) ? this._$AA.nextSibling.data = t : this.T(A.createTextNode(t)), this._$AH = t; | ||
| } | ||
| $(t) { | ||
| const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = N.createElement(At(s.h, s.h[0]), this.options)), s); | ||
| if (this._$AH?._$AD === i) this._$AH.p(e); | ||
| const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = j.createElement(Tt(s.h, s.h[0]), this.options)), s); | ||
| if (this._$AH?._$AD === r) this._$AH.p(e); | ||
| else { | ||
| const o = new le(i, this), n = o.u(this.options); | ||
| o.p(e), this.T(n), this._$AH = o; | ||
| const n = new pe(r, this), o = n.u(this.options); | ||
| n.p(e), this.T(o), this._$AH = n; | ||
| } | ||
| } | ||
| _$AC(t) { | ||
| let e = mt.get(t.strings); | ||
| return e === void 0 && mt.set(t.strings, e = new N(t)), e; | ||
| let e = vt.get(t.strings); | ||
| return e === void 0 && vt.set(t.strings, e = new j(t)), e; | ||
| } | ||
| k(t) { | ||
| tt(this._$AH) || (this._$AH = [], this._$AR()); | ||
| it(this._$AH) || (this._$AH = [], this._$AR()); | ||
| const e = this._$AH; | ||
| let s, i = 0; | ||
| for (const o of t) i === e.length ? e.push(s = new j(this.O(O()), this.O(O()), this, this.options)) : s = e[i], s._$AI(o), i++; | ||
| i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i); | ||
| let s, r = 0; | ||
| for (const n of t) r === e.length ? e.push(s = new B(this.O(M()), this.O(M()), this, this.options)) : s = e[r], s._$AI(n), r++; | ||
| r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r); | ||
| } | ||
@@ -879,3 +879,3 @@ _$AR(t = this._$AA.nextSibling, e) { | ||
| } | ||
| class V { | ||
| class Q { | ||
| get tagName() { | ||
@@ -887,15 +887,15 @@ return this.element.tagName; | ||
| } | ||
| constructor(t, e, s, i, o) { | ||
| this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = u; | ||
| constructor(t, e, s, r, n) { | ||
| this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = u; | ||
| } | ||
| _$AI(t, e = this, s, i) { | ||
| const o = this.strings; | ||
| let n = !1; | ||
| if (o === void 0) t = x(this, t, e, 0), n = !R(t) || t !== this._$AH && t !== A, n && (this._$AH = t); | ||
| _$AI(t, e = this, s, r) { | ||
| const n = this.strings; | ||
| let o = !1; | ||
| if (n === void 0) t = P(this, t, e, 0), o = !I(t) || t !== this._$AH && t !== C, o && (this._$AH = t); | ||
| else { | ||
| const h = t; | ||
| let a, c; | ||
| for (t = o[0], a = 0; a < o.length - 1; a++) c = x(this, h[s + a], e, a), c === A && (c = this._$AH[a]), n ||= !R(c) || c !== this._$AH[a], c === u ? t = u : t !== u && (t += (c ?? "") + o[a + 1]), this._$AH[a] = c; | ||
| for (t = n[0], a = 0; a < n.length - 1; a++) c = P(this, h[s + a], e, a), c === C && (c = this._$AH[a]), o ||= !I(c) || c !== this._$AH[a], c === u ? t = u : t !== u && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c; | ||
| } | ||
| n && !i && this.j(t); | ||
| o && !r && this.j(t); | ||
| } | ||
@@ -906,3 +906,3 @@ j(t) { | ||
| } | ||
| class de extends V { | ||
| class fe extends Q { | ||
| constructor() { | ||
@@ -915,3 +915,3 @@ super(...arguments), this.type = 3; | ||
| } | ||
| class ue extends V { | ||
| class $e extends Q { | ||
| constructor() { | ||
@@ -924,10 +924,10 @@ super(...arguments), this.type = 4; | ||
| } | ||
| class pe extends V { | ||
| constructor(t, e, s, i, o) { | ||
| super(t, e, s, i, o), this.type = 5; | ||
| class ge extends Q { | ||
| constructor(t, e, s, r, n) { | ||
| super(t, e, s, r, n), this.type = 5; | ||
| } | ||
| _$AI(t, e = this) { | ||
| if ((t = x(this, t, e, 0) ?? u) === A) return; | ||
| const s = this._$AH, i = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== u && (s === u || i); | ||
| i && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t; | ||
| if ((t = P(this, t, e, 0) ?? u) === C) return; | ||
| const s = this._$AH, r = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== u && (s === u || r); | ||
| r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t; | ||
| } | ||
@@ -938,3 +938,3 @@ handleEvent(t) { | ||
| } | ||
| class fe { | ||
| class ye { | ||
| constructor(t, e, s) { | ||
@@ -947,18 +947,18 @@ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s; | ||
| _$AI(t) { | ||
| x(this, t); | ||
| P(this, t); | ||
| } | ||
| } | ||
| const $e = Y.litHtmlPolyfillSupport; | ||
| $e?.(N, j), (Y.litHtmlVersions ??= []).push("3.3.1"); | ||
| const ge = (r, t, e) => { | ||
| const be = st.litHtmlPolyfillSupport; | ||
| be?.(j, B), (st.litHtmlVersions ??= []).push("3.3.1"); | ||
| const me = (i, t, e) => { | ||
| const s = e?.renderBefore ?? t; | ||
| let i = s._$litPart$; | ||
| if (i === void 0) { | ||
| const o = e?.renderBefore ?? null; | ||
| s._$litPart$ = i = new j(t.insertBefore(O(), o), o, void 0, e ?? {}); | ||
| let r = s._$litPart$; | ||
| if (r === void 0) { | ||
| const n = e?.renderBefore ?? null; | ||
| s._$litPart$ = r = new B(t.insertBefore(M(), n), n, void 0, e ?? {}); | ||
| } | ||
| return i._$AI(r), i; | ||
| return r._$AI(i), r; | ||
| }; | ||
| const et = globalThis; | ||
| class w extends S { | ||
| const rt = globalThis; | ||
| class S extends x { | ||
| constructor() { | ||
@@ -973,3 +973,3 @@ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; | ||
| const e = this.render(); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = ge(e, this.renderRoot, this.renderOptions); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = me(e, this.renderRoot, this.renderOptions); | ||
| } | ||
@@ -983,31 +983,31 @@ connectedCallback() { | ||
| render() { | ||
| return A; | ||
| return C; | ||
| } | ||
| } | ||
| w._$litElement$ = !0, w.finalized = !0, et.litElementHydrateSupport?.({ LitElement: w }); | ||
| const ye = et.litElementPolyfillSupport; | ||
| ye?.({ LitElement: w }); | ||
| (et.litElementVersions ??= []).push("4.2.1"); | ||
| const st = (r) => (t, e) => { | ||
| S._$litElement$ = !0, S.finalized = !0, rt.litElementHydrateSupport?.({ LitElement: S }); | ||
| const _e = rt.litElementPolyfillSupport; | ||
| _e?.({ LitElement: S }); | ||
| (rt.litElementVersions ??= []).push("4.2.1"); | ||
| const nt = (i) => (t, e) => { | ||
| e !== void 0 ? e.addInitializer((() => { | ||
| customElements.define(r, t); | ||
| })) : customElements.define(r, t); | ||
| customElements.define(i, t); | ||
| })) : customElements.define(i, t); | ||
| }; | ||
| const me = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: G }, _e = (r = me, t, e) => { | ||
| const { kind: s, metadata: i } = e; | ||
| let o = globalThis.litPropertyMetadata.get(i); | ||
| if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), s === "setter" && ((r = Object.create(r)).wrapped = !0), o.set(e.name, r), s === "accessor") { | ||
| const { name: n } = e; | ||
| const ve = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: et }, Ee = (i = ve, t, e) => { | ||
| const { kind: s, metadata: r } = e; | ||
| let n = globalThis.litPropertyMetadata.get(r); | ||
| if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), n.set(e.name, i), s === "accessor") { | ||
| const { name: o } = e; | ||
| return { set(h) { | ||
| const a = t.get.call(this); | ||
| t.set.call(this, h), this.requestUpdate(n, a, r); | ||
| t.set.call(this, h), this.requestUpdate(o, a, i); | ||
| }, init(h) { | ||
| return h !== void 0 && this.C(n, void 0, r, h), h; | ||
| return h !== void 0 && this.C(o, void 0, i, h), h; | ||
| } }; | ||
| } | ||
| if (s === "setter") { | ||
| const { name: n } = e; | ||
| const { name: o } = e; | ||
| return function(h) { | ||
| const a = this[n]; | ||
| t.call(this, h), this.requestUpdate(n, a, r); | ||
| const a = this[o]; | ||
| t.call(this, h), this.requestUpdate(o, a, i); | ||
| }; | ||
@@ -1017,9 +1017,10 @@ } | ||
| }; | ||
| function p(r) { | ||
| return (t, e) => typeof e == "object" ? _e(r, t, e) : ((s, i, o) => { | ||
| const n = i.hasOwnProperty(o); | ||
| return i.constructor.createProperty(o, s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0; | ||
| })(r, t, e); | ||
| function p(i) { | ||
| return (t, e) => typeof e == "object" ? Ee(i, t, e) : ((s, r, n) => { | ||
| const o = r.hasOwnProperty(n); | ||
| return r.constructor.createProperty(n, s), o ? Object.getOwnPropertyDescriptor(r, n) : void 0; | ||
| })(i, t, e); | ||
| } | ||
| class be extends Error { | ||
| const we = (i) => i ?? u; | ||
| class Et extends Error { | ||
| constructor(t, e) { | ||
@@ -1032,3 +1033,3 @@ super(t), this.name = "TopsortRequestError", this.status = e; | ||
| } | ||
| class ve extends Error { | ||
| class Se extends Error { | ||
| constructor(t, e) { | ||
@@ -1042,25 +1043,25 @@ let s = "Missing "; | ||
| } | ||
| function we() { | ||
| function Ae() { | ||
| if (window.TS?.getUserId && typeof window.TS.getUserId == "function") | ||
| return window.TS.getUserId(); | ||
| } | ||
| const xt = () => { | ||
| const r = navigator.userAgent; | ||
| return /(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(r) || /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test( | ||
| r | ||
| const xe = () => { | ||
| const i = navigator.userAgent; | ||
| return /(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(i) || /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test( | ||
| i | ||
| ) ? "mobile" : "desktop"; | ||
| }; | ||
| async function Ee(r, { signal: t, logError: e }) { | ||
| const s = xt(), i = window.TS.token, o = window.TS.url || "https://api.topsort.com", n = we(); | ||
| n && (r.opaqueUserId = n); | ||
| const h = await fetch(new URL(`${o}/v2/auctions`), { | ||
| async function Ce(i, { signal: t, logError: e }) { | ||
| const { device: s } = i, r = window.TS.token, n = window.TS.url || "https://api.topsort.com", o = Ae(); | ||
| o && (i.opaqueUserId = o); | ||
| const h = await fetch(new URL(`${n}/v2/auctions`), { | ||
| method: "POST", | ||
| mode: "cors", | ||
| headers: { | ||
| Authorization: `Bearer ${i}`, | ||
| Authorization: `Bearer ${r}`, | ||
| "Content-Type": "application/json", | ||
| "X-UA": `topsort/banners-0.7.0 (${s})` | ||
| "X-UA": `topsort/banners-0.8.0 (${s})` | ||
| }, | ||
| body: JSON.stringify({ | ||
| auctions: [r] | ||
| auctions: [i] | ||
| }), | ||
@@ -1070,7 +1071,7 @@ signal: t | ||
| if (!h.ok) { | ||
| const d = await h.json(); | ||
| throw new Error(d.message); | ||
| const d = await h.json().catch(() => ({})); | ||
| throw new Et(d.message ?? `HTTP ${h.status}`, h.status); | ||
| } | ||
| const c = (await h.json()).results[0]; | ||
| if (!c) throw new be("No auction results", h.status); | ||
| if (!c) throw new Et("No auction results", h.status); | ||
| if (c.error) | ||
@@ -1080,9 +1081,9 @@ throw e(c.error), new Error(c.error); | ||
| } | ||
| var Se = Object.defineProperty, y = (r, t, e, s) => { | ||
| for (var i = void 0, o = r.length - 1, n; o >= 0; o--) | ||
| (n = r[o]) && (i = n(t, e, i) || i); | ||
| return i && Se(t, e, i), i; | ||
| var Pe = Object.defineProperty, y = (i, t, e, s) => { | ||
| for (var r = void 0, n = i.length - 1, o; n >= 0; n--) | ||
| (o = i[n]) && (r = o(t, e, r) || r); | ||
| return r && Pe(t, e, r), r; | ||
| }; | ||
| const Ae = (r) => { | ||
| class t extends r { | ||
| const Te = (i) => { | ||
| class t extends i { | ||
| constructor() { | ||
@@ -1092,20 +1093,20 @@ super(...arguments), this.width = 0, this.height = 0, this.slotId = "", this.newTab = !1; | ||
| buildAuction(s) { | ||
| const i = xt(), o = { | ||
| const r = xe(), n = { | ||
| type: "banners", | ||
| slots: s, | ||
| device: i, | ||
| device: r, | ||
| slotId: this.slotId | ||
| }; | ||
| return this.categoryId ? o.category = { | ||
| return this.categoryId ? n.category = { | ||
| id: this.categoryId | ||
| } : this.categoryIds ? o.category = { | ||
| ids: this.categoryIds.split(",").map((n) => n.trim()) | ||
| } : this.categoryDisjunctions ? o.category = { | ||
| disjunctions: [this.categoryDisjunctions.split(",").map((n) => n.trim())] | ||
| } : this.searchQuery && (o.searchQuery = this.searchQuery), this.location && (o.geoTargeting = { | ||
| } : this.categoryIds ? n.category = { | ||
| ids: this.categoryIds.split(",").map((o) => o.trim()) | ||
| } : this.categoryDisjunctions ? n.category = { | ||
| disjunctions: [this.categoryDisjunctions.split(",").map((o) => o.trim())] | ||
| } : this.searchQuery && (n.searchQuery = this.searchQuery), this.location && (n.geoTargeting = { | ||
| location: this.location | ||
| }), o; | ||
| }), n; | ||
| } | ||
| emitEvent(s) { | ||
| const i = new CustomEvent("statechange", { | ||
| const r = new CustomEvent("statechange", { | ||
| detail: { slotId: this.slotId, status: s }, | ||
@@ -1115,3 +1116,3 @@ bubbles: !0, | ||
| }); | ||
| this.dispatchEvent(i); | ||
| this.dispatchEvent(r); | ||
| } | ||
@@ -1139,23 +1140,43 @@ } | ||
| }; | ||
| var xe = Object.defineProperty, Pe = Object.getOwnPropertyDescriptor, $ = (r, t, e, s) => { | ||
| for (var i = s > 1 ? void 0 : s ? Pe(t, e) : t, o = r.length - 1, n; o >= 0; o--) | ||
| (n = r[o]) && (i = (s ? n(t, e, i) : n(i)) || i); | ||
| return s && i && xe(t, e, i), i; | ||
| function Ue(i, t, e) { | ||
| if (e) { | ||
| i.setAttribute(e, t); | ||
| return; | ||
| } | ||
| const s = i.tagName.toLowerCase(); | ||
| s === "a" ? i.setAttribute("href", t) : s === "img" || s === "video" || s === "source" ? i.setAttribute("src", t) : i.textContent = t; | ||
| } | ||
| function Ut(i, t) { | ||
| const e = t.asset?.[0]?.content; | ||
| if (e) { | ||
| const r = i.querySelectorAll("[data-ts-field]"); | ||
| for (const n of r) { | ||
| const o = n.dataset.tsField; | ||
| o && o in e && Ue(n, e[o], n.dataset.tsAttr); | ||
| } | ||
| } | ||
| const s = i.querySelector("[data-ts-clickable]") || i.firstElementChild; | ||
| s && (s.setAttribute("data-ts-clickable", ""), t.isFallback || s.setAttribute("data-ts-resolved-bid", t.resolvedBidId)); | ||
| } | ||
| var Re = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, $ = (i, t, e, s) => { | ||
| for (var r = s > 1 ? void 0 : s ? Oe(t, e) : t, n = i.length - 1, o; n >= 0; n--) | ||
| (o = i[n]) && (r = (s ? o(t, e, r) : o(r)) || r); | ||
| return s && r && Re(t, e, r), r; | ||
| }; | ||
| window.TS_BANNERS = window.TS_BANNERS || {}; | ||
| function Ce(r) { | ||
| function ke(i) { | ||
| } | ||
| function Te(r) { | ||
| return window.TS_BANNERS.getLink ? window.TS_BANNERS.getLink(r) : r.type === "url" ? r.id : `${r.type}/${r.id}`; | ||
| function Ne(i) { | ||
| return window.TS_BANNERS.getLink ? window.TS_BANNERS.getLink(i) : i.type === "url" ? i.id : `${i.type}/${i.id}`; | ||
| } | ||
| function Pt() { | ||
| function Rt() { | ||
| if (window.TS_BANNERS.getLoadingElement) { | ||
| const r = window.TS_BANNERS.getLoadingElement(); | ||
| return f`${r}`; | ||
| const i = window.TS_BANNERS.getLoadingElement(); | ||
| return f`${i}`; | ||
| } | ||
| return f``; | ||
| } | ||
| function J(r) { | ||
| function N(i) { | ||
| if (window.TS_BANNERS.getErrorElement) { | ||
| const t = window.TS_BANNERS.getErrorElement(r); | ||
| const t = window.TS_BANNERS.getErrorElement(i); | ||
| return f`${t}`; | ||
@@ -1165,19 +1186,19 @@ } | ||
| } | ||
| function Ct() { | ||
| function Ot() { | ||
| if (window.TS_BANNERS.getNoWinnersElement) { | ||
| const r = window.TS_BANNERS.getNoWinnersElement(); | ||
| return f`${r}`; | ||
| const i = window.TS_BANNERS.getNoWinnersElement(); | ||
| return f`${i}`; | ||
| } | ||
| return f``; | ||
| } | ||
| function Tt(r, t, e, s) { | ||
| function V(i, t, e, s) { | ||
| if (window.TS_BANNERS.getBannerElement) { | ||
| const c = window.TS_BANNERS.getBannerElement(r); | ||
| const c = window.TS_BANNERS.getBannerElement(i); | ||
| return f`${c}`; | ||
| } | ||
| if (!r.asset?.[0]?.url) | ||
| if (!i.asset?.[0]?.url) | ||
| return f``; | ||
| const i = r.asset[0].url, n = (() => { | ||
| const r = i.asset[0].url, o = (() => { | ||
| try { | ||
| const d = new URL(i).pathname.split("/"), l = d.indexOf("manifest"); | ||
| const d = new URL(r).pathname.split("/"), l = d.indexOf("manifest"); | ||
| return l >= 0 ? d[l + 1]?.startsWith("video") ?? !1 : !1; | ||
@@ -1189,3 +1210,3 @@ } catch { | ||
| <hls-video | ||
| src="${i}" | ||
| src="${r}" | ||
| width="${t}px" | ||
@@ -1196,11 +1217,11 @@ height="${e}px" | ||
| <img | ||
| src="${i}" | ||
| src="${r}" | ||
| alt="Topsort banner" | ||
| style="width:${t}px; height:${e}px; object-fit:cover;" | ||
| /> | ||
| `, h = Te(r), a = s ? f`<a href="${h}" target="_blank">${n}</a>` : f`<a href="${h}">${n}</a>`; | ||
| `, h = Ne(i), a = s ? f`<a href="${h}" target="_blank">${o}</a>` : f`<a href="${h}">${o}</a>`; | ||
| return f` | ||
| <div | ||
| data-ts-clickable | ||
| data-ts-resolved-bid=${r.resolvedBidId} | ||
| data-ts-resolved-bid=${we(i.isFallback ? void 0 : i.resolvedBidId)} | ||
| class="ts-banner" | ||
@@ -1212,7 +1233,7 @@ > | ||
| } | ||
| const Ut = Symbol("banner-context"), Ue = (r, t) => !t && r ? !0 : r == null || t == null ? !1 : r.width !== t.width || r.height !== t.height || r.newTab !== t.newTab || !!r.error != !!t.error || r.banners?.length !== t.banners?.length; | ||
| let k = class extends Ae(w) { | ||
| const kt = Symbol("banner-context"), Me = (i, t) => !t && i ? !0 : i == null || t == null ? !1 : i.width !== t.width || i.height !== t.height || i.newTab !== t.newTab || !!i.error != !!t.error || i.banners?.length !== t.banners?.length; | ||
| let T = class extends Te(S) { | ||
| constructor() { | ||
| super(...arguments), this.task = new Ft(this, { | ||
| task: ([r], t) => Ee(this.buildAuction(r), { ...t, logError: Ce }).then((e) => (t.signal.throwIfAborted(), this.isContext && (this.context = { ...this.context, banners: e }), e)).catch((e) => { | ||
| super(...arguments), this.task = new Zt(this, { | ||
| task: ([i], t) => Ce(this.buildAuction(i), { ...t, logError: ke }).then((e) => (t.signal.throwIfAborted(), this.isContext && (this.context = { ...this.context, banners: e }), e)).catch((e) => { | ||
| throw t.signal.throwIfAborted(), this.isContext && (this.context = { ...this.context, error: e }), e; | ||
@@ -1225,15 +1246,34 @@ }), | ||
| newTab: this.newTab | ||
| }, this.isContext = !1; | ||
| }, this.isContext = !1, this.predefined = !1, this._prevTaskStatus = m.INITIAL; | ||
| } | ||
| render() { | ||
| return !window.TS.token || !this.slotId ? J(new ve(window.TS.token, this.slotId)) : this.isContext ? f`` : this.task.render({ | ||
| pending: () => Pt(), | ||
| complete: (r) => (this.emitEvent(r.length ? "ready" : "nowinners"), r.length ? Tt(r[0], this.width, this.height, this.newTab) : Ct()), | ||
| error: (r) => J(r) | ||
| return !window.TS.token || !this.slotId ? N(new Se(window.TS.token, this.slotId)) : this.isContext ? f`` : this.predefined ? this.task.status === m.COMPLETE && this.task.value?.length && !this.task.value[0].asset?.[0]?.content ? V(this.task.value[0], this.width, this.height, this.newTab) : u : this.task.render({ | ||
| pending: () => Rt(), | ||
| complete: (i) => { | ||
| if (!i.length) | ||
| return Ot(); | ||
| if (i[0].asset?.[0]?.content) { | ||
| const t = new Error( | ||
| "Banner has predefined content but component is not in predefined mode" | ||
| ); | ||
| return N(t); | ||
| } | ||
| return V(i[0], this.width, this.height, this.newTab); | ||
| }, | ||
| error: (i) => N(i) | ||
| }); | ||
| } | ||
| updated(r) { | ||
| super.updated(r), this.isContext && !r.has("slots") && Promise.resolve().then(() => { | ||
| updated(i) { | ||
| super.updated(i); | ||
| const t = this._prevTaskStatus, e = this.task.status; | ||
| this._prevTaskStatus = e; | ||
| const s = this.task.value ?? []; | ||
| if (this.predefined && t !== m.COMPLETE && e === m.COMPLETE && s.length && s[0].asset?.[0]?.content) | ||
| try { | ||
| Ut(this, s[0]); | ||
| } catch { | ||
| } | ||
| this.isContext || (t !== m.COMPLETE && e === m.COMPLETE ? this.emitEvent(s.length ? "ready" : "nowinners") : t !== m.ERROR && e === m.ERROR && this.emitEvent("error")), this.isContext && !i.has("slots") && Promise.resolve().then(() => { | ||
| this.slots = this.renderRoot.querySelectorAll("topsort-banner-slot"); | ||
| }), (r.has("width") || r.has("height") || r.has("newTab")) && Promise.resolve().then(() => { | ||
| }), i.has("width") && this.style.setProperty("--ts-banner-width", `${this.width}px`), i.has("height") && this.style.setProperty("--ts-banner-height", `${this.height}px`), (i.has("width") || i.has("height") || i.has("newTab")) && Promise.resolve().then(() => { | ||
| this.context = { | ||
@@ -1252,26 +1292,62 @@ width: this.width, | ||
| $([ | ||
| Nt({ context: Ut }), | ||
| p({ attribute: !1, hasChanged: Ue }) | ||
| ], k.prototype, "context", 2); | ||
| It({ context: kt }), | ||
| p({ attribute: !1, hasChanged: Me }) | ||
| ], T.prototype, "context", 2); | ||
| $([ | ||
| p({ type: Boolean, attribute: "context" }) | ||
| ], k.prototype, "isContext", 2); | ||
| ], T.prototype, "isContext", 2); | ||
| $([ | ||
| p({ type: Boolean }) | ||
| ], T.prototype, "predefined", 2); | ||
| $([ | ||
| p({ attribute: !1, state: !0 }) | ||
| ], k.prototype, "slots", 2); | ||
| k = $([ | ||
| st("topsort-banner") | ||
| ], k); | ||
| let D = class extends w { | ||
| ], T.prototype, "slots", 2); | ||
| T = $([ | ||
| nt("topsort-banner") | ||
| ], T); | ||
| let H = class extends S { | ||
| constructor() { | ||
| super(...arguments), this.rank = 0; | ||
| super(...arguments), this.rank = 1, this.predefined = !1; | ||
| } | ||
| _bannerForRank() { | ||
| if (!(!this.context?.banners?.length || this.rank < 1 || this.context.banners.length < this.rank)) | ||
| return this.context.banners[this.rank - 1]; | ||
| } | ||
| render() { | ||
| return this.context ? this.context.banners ? this.context.error ? J(this.context.error) : !this.context.banners.length || this.context.banners.length < this.rank ? Ct() : Tt( | ||
| this.context.banners[this.rank - 1], | ||
| this.context.width, | ||
| this.context.height, | ||
| this.context.newTab | ||
| ) : Pt() : f``; | ||
| if (this.predefined) { | ||
| const t = this._bannerForRank(); | ||
| return t && !t.asset?.[0]?.content && this.context ? V( | ||
| t, | ||
| this.context.width, | ||
| this.context.height, | ||
| this.context.newTab | ||
| ) : u; | ||
| } | ||
| if (!this.context) | ||
| return f``; | ||
| if (!this.context.banners) | ||
| return Rt(); | ||
| if (this.context.error) | ||
| return N(this.context.error); | ||
| if (!this.context.banners.length || this.context.banners.length < this.rank) | ||
| return Ot(); | ||
| const i = this.context.banners[this.rank - 1]; | ||
| if (i.asset?.[0]?.content) { | ||
| const t = new Error( | ||
| "Banner has predefined content but component is not in predefined mode" | ||
| ); | ||
| return N(t); | ||
| } | ||
| return V(i, this.context.width, this.context.height, this.context.newTab); | ||
| } | ||
| updated(i) { | ||
| if (super.updated(i), this.predefined && i.has("context") && !i.get("context")?.banners && !!this.context?.banners) { | ||
| const s = this._bannerForRank(); | ||
| if (s?.asset?.[0]?.content) | ||
| try { | ||
| Ut(this, s); | ||
| } catch { | ||
| } | ||
| } | ||
| } | ||
| // avoid shadow dom since we cannot attach to events via analytics.js | ||
@@ -1283,12 +1359,15 @@ createRenderRoot() { | ||
| $([ | ||
| kt({ context: Ut, subscribe: !0 }), | ||
| jt({ context: kt, subscribe: !0 }), | ||
| p({ attribute: !1 }) | ||
| ], D.prototype, "context", 2); | ||
| ], H.prototype, "context", 2); | ||
| $([ | ||
| p({ attribute: "rank", type: Number }) | ||
| ], D.prototype, "rank", 2); | ||
| D = $([ | ||
| st("topsort-banner-slot") | ||
| ], D); | ||
| let M = class extends w { | ||
| ], H.prototype, "rank", 2); | ||
| $([ | ||
| p({ type: Boolean }) | ||
| ], H.prototype, "predefined", 2); | ||
| H = $([ | ||
| nt("topsort-banner-slot") | ||
| ], H); | ||
| let L = class extends S { | ||
| constructor() { | ||
@@ -1308,2 +1387,3 @@ super(...arguments), this.src = "", this.width = "800px", this.height = "400px"; | ||
| id="${this.videoId}" | ||
| style="width:${this.width}; height:${this.height}; object-fit:cover;" | ||
| muted | ||
@@ -1317,8 +1397,7 @@ autoplay | ||
| async firstUpdated() { | ||
| const r = this.shadowRoot?.getElementById(this.videoId); | ||
| if (!r) return; | ||
| r.style.width = this.width, r.style.height = this.height, r.style.objectFit = "cover"; | ||
| const i = this.shadowRoot?.getElementById(this.videoId); | ||
| if (!i) return; | ||
| let t; | ||
| try { | ||
| t = await Re.load(); | ||
| t = await Ie(); | ||
| } catch (s) { | ||
@@ -1333,4 +1412,4 @@ console.error("Failed to load HLS.js:", s); | ||
| const e = new t(); | ||
| e.loadSource(this.src), e.attachMedia(r), e.on(t.Events.MANIFEST_PARSED, () => { | ||
| r.play().catch((s) => console.warn("Autoplay failed:", s)); | ||
| e.loadSource(this.src), e.attachMedia(i), e.on(t.Events.MANIFEST_PARSED, () => { | ||
| i.play().catch((s) => console.warn("Autoplay failed:", s)); | ||
| }); | ||
@@ -1341,35 +1420,26 @@ } | ||
| p({ type: String }) | ||
| ], M.prototype, "src", 2); | ||
| ], L.prototype, "src", 2); | ||
| $([ | ||
| p({ type: String }) | ||
| ], M.prototype, "width", 2); | ||
| ], L.prototype, "width", 2); | ||
| $([ | ||
| p({ type: String }) | ||
| ], M.prototype, "height", 2); | ||
| M = $([ | ||
| st("hls-video") | ||
| ], M); | ||
| class Oe { | ||
| constructor() { | ||
| this.loadPromise = null; | ||
| } | ||
| load() { | ||
| return this.loadPromise ? this.loadPromise : window.Hls ? (this.loadPromise = Promise.resolve(window.Hls), this.loadPromise) : (this.loadPromise = new Promise((t, e) => { | ||
| const s = document.createElement("script"); | ||
| s.src = "https://cdn.jsdelivr.net/npm/hls.js@1.6.13/dist/hls.min.js", s.onload = () => { | ||
| window.Hls ? t(window.Hls) : e(new Error("HLS.js loaded but not available")); | ||
| }, s.onerror = () => { | ||
| e(new Error("Failed to load HLS.js")); | ||
| }, document.head.appendChild(s); | ||
| }).catch((t) => { | ||
| throw this.loadPromise = null, t; | ||
| }), this.loadPromise); | ||
| } | ||
| ], L.prototype, "height", 2); | ||
| L = $([ | ||
| nt("hls-video") | ||
| ], L); | ||
| let E = null; | ||
| function Ie() { | ||
| return E || (window.Hls ? (E = Promise.resolve(window.Hls), E) : (E = new Promise((i, t) => { | ||
| const e = document.createElement("script"); | ||
| e.src = "https://cdn.jsdelivr.net/npm/hls.js@1.6.13/dist/hls.min.js", e.onload = () => window.Hls ? i(window.Hls) : t(new Error("HLS.js loaded but not available")), e.onerror = () => t(new Error("Failed to load HLS.js")), document.head.appendChild(e); | ||
| }).catch((i) => { | ||
| throw E = null, i; | ||
| }), E)); | ||
| } | ||
| const Re = new Oe(); | ||
| export { | ||
| M as HlsVideo, | ||
| k as TopsortBanner, | ||
| D as TopsortBannerSlot | ||
| L as HlsVideo, | ||
| T as TopsortBanner, | ||
| H as TopsortBannerSlot | ||
| }; | ||
| //# sourceMappingURL=banners.mjs.map |
+26
-5
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@topsort/banners", | ||
| "version": "0.7.0", | ||
| "version": "0.8.0", | ||
| "description": "A web component for displaying Topsort banner ads.", | ||
@@ -49,10 +49,22 @@ "type": "module", | ||
| "lint:fix": "biome check --apply .", | ||
| "typecheck": "tsc --noEmit" | ||
| "test": "vitest", | ||
| "test:run": "vitest run", | ||
| "test:coverage": "vitest run --coverage", | ||
| "typecheck": "tsc --noEmit", | ||
| "size": "size-limit", | ||
| "e2e": "playwright test --config e2e/playwright.config.ts" | ||
| }, | ||
| "devDependencies": { | ||
| "@biomejs/biome": "2.3.7", | ||
| "@playwright/test": "^1.58.2", | ||
| "@size-limit/file": "^11.1.6", | ||
| "@types/node": "24.10.1", | ||
| "@vitest/coverage-v8": "^4.0.18", | ||
| "jsdom": "^28.1.0", | ||
| "size-limit": "^11.1.6", | ||
| "skeleton-webcomponent-loader": "2.1.4", | ||
| "typescript": "5.9.3", | ||
| "vite": "7.2.4", | ||
| "vite-plugin-dts": "4.5.4" | ||
| "vite-plugin-dts": "4.5.4", | ||
| "vitest": "^4.0.18" | ||
| }, | ||
@@ -62,5 +74,14 @@ "dependencies": { | ||
| "@lit/task": "1.0.3", | ||
| "lit": "3.3.1", | ||
| "skeleton-webcomponent-loader": "2.1.4" | ||
| "lit": "3.3.1" | ||
| }, | ||
| "size-limit": [ | ||
| { | ||
| "path": "dist/banners.iife.js", | ||
| "limit": "13 kB" | ||
| }, | ||
| { | ||
| "path": "dist/banners.mjs", | ||
| "limit": "15 kB" | ||
| } | ||
| ], | ||
| "pnpm": { | ||
@@ -67,0 +88,0 @@ "overrides": { |
+131
-22
@@ -1,3 +0,5 @@ | ||
|  | ||
|  | ||
| [](https://github.com/Topsort/banners.js/actions/workflows/test.yml) | ||
| [](https://codecov.io/gh/Topsort/banners.js) | ||
| [](https://www.npmjs.com/package/@topsort/banners) | ||
| [](https://www.npmjs.com/package/@topsort/banners) | ||
|  | ||
@@ -8,2 +10,4 @@  | ||
| `banners.js` is **Topsort's official Web Component SDK** for rendering sponsored banner ads on merchant storefronts. It handles auction requests, banner rendering, and telemetry automatically. A [Topsort account](https://app.topsort.com) and API token are required. | ||
| # Usage | ||
@@ -14,10 +18,4 @@ | ||
| ```html | ||
| <script | ||
| async | ||
| type="module" | ||
| src="https://unpkg.com/@topsort/banners/dist/banners.mjs" | ||
| ></script> | ||
| <script async type="module" src="https://unpkg.com/@topsort/analytics.js"></script> | ||
| <script> | ||
| // Set API key for auctions and events | ||
| // Must come first — analytics.js reads window.TS on load | ||
| window.TS = { | ||
@@ -46,2 +44,8 @@ token: "<your topsort api key>", | ||
| </script> | ||
| <script | ||
| async | ||
| type="module" | ||
| src="https://unpkg.com/@topsort/banners/dist/banners.mjs" | ||
| ></script> | ||
| <script async type="module" src="https://unpkg.com/@topsort/analytics.js"></script> | ||
| <body> | ||
@@ -60,6 +64,6 @@ <topsort-banner width="600" height="400" id="<your slot id>"></topsort-banner> | ||
| | Bundle | Size | Size (gzip) | | ||
| |--------|------|-------------| | ||
| | `banners.mjs` (ES module) | 38.71 kB | 11.17 kB | | ||
| | `banners.iife.js` (IIFE) | 29.93 kB | 10.13 kB | | ||
| | Bundle | Size (gzip) | Size (brotli) | | ||
| |--------|-------------|---------------| | ||
| | `banners.mjs` (ES module) | 12.40 kB | 11.01 kB | | ||
| | `banners.iife.js` (IIFE) | 11.18 kB | 10.08 kB | | ||
@@ -81,2 +85,59 @@ ## Rendering multiple banners with one slot ID | ||
| ## Predefined content mode | ||
| Instead of replacing a placeholder with Topsort-generated DOM, you can annotate your own markup with `data-ts-field` attributes and have banners.js mutate only the targeted fields in place. All other markup — classes, ARIA attributes, styles, event listeners — is left untouched. If the auction returns no winners or fails, the predefined content is shown as-is with no changes. | ||
| Opt in by adding the `predefined` attribute to `<topsort-banner>` (standalone) or to each `<topsort-banner-slot>` (context mode). | ||
| ### Binding convention | ||
| Add `data-ts-field="<contentKey>"` to any element whose value should be updated from the auction response. The property that gets set is inferred from the element type: | ||
| | Element | Property set | | ||
| |---|---| | ||
| | `<a>` | `href` | | ||
| | `<img>`, `<video>`, `<source>` | `src` | | ||
| | All others | `textContent` | | ||
| Use `data-ts-attr="<attributeName>"` to override the default and target a specific attribute (e.g. `alt` on an `<img>`). | ||
| Add `data-ts-clickable` to the element that should be the click-tracking surface for analytics.js. If omitted, the first child element is used. | ||
| ### Single winner | ||
| ```html | ||
| <topsort-banner predefined width="600" height="400" id="slot-1"> | ||
| <div class="brand-banner" data-ts-clickable> | ||
| <a data-ts-field="target" href="/brands/featured" aria-label="Featured Brand"> | ||
| <img data-ts-field="mainImage" src="/fallbacks/featured.jpg" | ||
| alt="Explore our featured brands" width="600" height="400" loading="lazy" /> | ||
| </a> | ||
| <h2 data-ts-field="default-Headline">Featured Brand</h2> | ||
| </div> | ||
| </topsort-banner> | ||
| ``` | ||
| ### Multiple winners (context mode) | ||
| ```html | ||
| <topsort-banner context="true" width="600" height="400" id="slot-1"> | ||
| <topsort-banner-slot predefined rank="1"> | ||
| <div class="product-card" data-ts-clickable> | ||
| <a data-ts-field="target" href="/default-1"> | ||
| <img data-ts-field="mainImage" src="/default-1.jpg" /> | ||
| </a> | ||
| <h3 data-ts-field="default-Headline">Default Product 1</h3> | ||
| </div> | ||
| </topsort-banner-slot> | ||
| <topsort-banner-slot predefined rank="2"> | ||
| <div class="product-card" data-ts-clickable> | ||
| <a data-ts-field="target" href="/default-2"> | ||
| <img data-ts-field="mainImage" src="/default-2.jpg" /> | ||
| </a> | ||
| <h3 data-ts-field="default-Headline">Default Product 2</h3> | ||
| </div> | ||
| </topsort-banner-slot> | ||
| </topsort-banner> | ||
| ``` | ||
| # Banner Attributes | ||
@@ -96,2 +157,3 @@ | ||
| | context | Optional Boolean | Uses the element as a context provider to render multiple banners | | ||
| | predefined | Optional Boolean | Mutates annotated child elements in place instead of replacing them | | ||
@@ -101,6 +163,49 @@ \* Only one of `[category-id, category-ids, category-disjunctions]` must be set. | ||
| # Styling | ||
| The banner component exposes `--ts-banner-width` and `--ts-banner-height` CSS custom | ||
| properties on the `<topsort-banner>` element. These reflect the `width` and `height` | ||
| attributes set on the element and are useful for sizing child elements to match the | ||
| configured dimensions. | ||
| The inner container uses the class `ts-banner`, making it easy to target with standard | ||
| CSS selectors. | ||
| ```css | ||
| /* Style the inner container */ | ||
| .ts-banner { | ||
| padding: 10px; | ||
| border-radius: 8px; | ||
| overflow: hidden; | ||
| } | ||
| /* Size child elements to match the configured banner dimensions */ | ||
| .ts-banner img { | ||
| width: var(--ts-banner-width); | ||
| height: var(--ts-banner-height); | ||
| object-fit: cover; | ||
| } | ||
| ``` | ||
| For responsive layouts, use standard CSS on the host element and its children rather | ||
| than trying to override the custom properties: | ||
| ```css | ||
| /* Make the banner fill its container */ | ||
| topsort-banner { | ||
| display: block; | ||
| width: 100%; | ||
| } | ||
| .ts-banner img { | ||
| width: 100%; | ||
| height: auto; | ||
| } | ||
| ``` | ||
| # Banner Slot Attributes | ||
| | Name | Type | Description | | ||
| |------|--------|-----------------------------------------------------------------------------------------------------------------------| | ||
| | rank | Number | The ranking of the slot. Ranks should be sorted the same as the winning bids. The lower the rank, the higher the bid | | ||
| | Name | Type | Description | | ||
| |------------|------------------|-----------------------------------------------------------------------------------------------------------------------| | ||
| | rank | Number | The ranking of the slot. Ranks should be sorted the same as the winning bids. The lower the rank, the higher the bid | | ||
| | predefined | Optional Boolean | Mutates annotated child elements in place instead of replacing them | | ||
@@ -124,3 +229,3 @@ # Banner Behaviors | ||
| | `resolvedBidId` | `string` | The corresponding auction ID of the winning entity. | | ||
| | `asset` | `[{ url: string }]` | An array of url linking to the assets of the banner. | | ||
| | `asset` | `[{ url: string; content?: Record<string, string> }]` | An array of assets. `content` is a key-value map used in predefined content mode. | | ||
@@ -157,7 +262,12 @@ ## Custom User ID (Optional) | ||
| # Running the example | ||
| # Playground | ||
| You can play around with the provided index.html file. To run it, you'll need to | ||
| install the dependencies and start a local server. | ||
| Try the library instantly — no setup required — at the live demo: | ||
| **[topsort.github.io/banners.js](https://topsort.github.io/banners.js/)** | ||
| Enter your API token and a slot ID to render a real banner and copy the resulting HTML snippet. | ||
| ## Running locally | ||
| ```bash | ||
@@ -170,3 +280,2 @@ git clone https://github.com/Topsort/banners.js.git | ||
| Remember to add `window.TS.token` and modify the `slot-id` attribute with your | ||
| own values that you can find at [Topsort](https://app.topsort.com/). | ||
| You can find your API token and slot IDs at [app.topsort.com](https://app.topsort.com/). |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Mixed license
LicensePackage contains multiple licenses.
Found 1 instance in 1 package
315020
9.2%3
-25%0
-100%1640
5.67%272
66.87%12
140%7
40%- Removed
- Removed
- Removed
- Removed