@topsort/banners
Advanced tools
+8
-0
@@ -0,1 +1,9 @@ | ||
| ### 0.8.1 | ||
| - Support explicit `key:target` syntax in `data-ts-field` (e.g. `data-ts-field="mainImage:src"`) for deterministic bindings without tag-based inference | ||
| - Support comma-separated multiple bindings on a single element (e.g. `data-ts-field="mainImage:src, altText:alt"`) | ||
| - Bare-key `data-ts-field` usage (implicit tag-based inference) now logs a one-time deprecation warning | ||
| - Bindings to attributes that don't exist on the element are skipped with a warning, enforcing fallback values in templates | ||
| - Update Lit to v3.3.2 | ||
| ### 0.8.0 | ||
@@ -2,0 +10,0 @@ |
@@ -1,4 +0,4 @@ | ||
| 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}})()?$` | ||
| var banners=(function(u){"use strict";let it=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 He(r){return r}let rt=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 it(this.context,this.host,this.t,this.subscribe))}};let Nt=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 Mt=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},nt=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 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:a}]of this.subscriptions)n.has(o)||(n.add(o),a.dispatchEvent(new it(this.context,a,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 Mt(this.context,this.host))}};function Bt({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 nt(this,{context:r,initialValue:i})),i}};{t.constructor.addInitializer((o=>{s.set(o,new nt(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(a){s.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{const o=i.set;n={...i,set(a){s.get(this).setValue(a),o?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function It({context:r,subscribe:t}){return(e,s)=>{typeof s=="object"?s.addInitializer((function(){new rt(this,{context:r,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new rt(i,{context:r,callback:n=>{i[s]=n},subscribe:t})}))}}const j=globalThis,J=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ot=Symbol(),at=new WeakMap;let Ht=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ot)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(J&&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 jt=r=>new Ht(typeof r=="string"?r:r+"",void 0,ot),Lt=(r,t)=>{if(J)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)}},ht=J?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:qt,defineProperty:Dt,getOwnPropertyDescriptor:zt,getOwnPropertyNames:Wt,getOwnPropertySymbols:Vt,getPrototypeOf:Ft}=Object,L=globalThis,ct=L.trustedTypes,Jt=ct?ct.emptyScript:"",Kt=L.reactiveElementPolyfillSupport,U=(r,t)=>r,K={toAttribute(r,t){switch(t){case Boolean:r=r?Jt: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}},Q=(r,t)=>!qt(r,t),lt={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:Q};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=lt){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&&Dt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=zt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i?.call(this)},set(o){const a=i?.call(this);n.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??lt}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=Ft(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=[...Wt(e),...Vt(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(ht(i))}else t!==void 0&&e.push(ht(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 Lt(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:K).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:K;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??Q)(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,Kt?.({ReactiveElement:O}),(L.reactiveElementVersions??=[]).push("2.0.4");const v={INITIAL:0,COMPLETE:2,ERROR:3},Qt=Symbol();let Zt=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??Xt,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===Qt)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 Xt=(r,t)=>r===t||r.length===t.length&&r.every(((e,s)=>!Q(e,t[s])));const q=globalThis,Z=q.ShadowRoot&&(q.ShadyCSS===void 0||q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,dt=Symbol(),ut=new WeakMap;let Gt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==dt)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(Z&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=ut.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ut.set(e,t))}return t}toString(){return this.cssText}};const Yt=r=>new Gt(typeof r=="string"?r:r+"",void 0,dt),te=(r,t)=>{if(Z)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)}},pt=Z?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Yt(e)})(r):r;const{is:ee,defineProperty:se,getOwnPropertyDescriptor:ie,getOwnPropertyNames:re,getOwnPropertySymbols:ne,getPrototypeOf:oe}=Object,D=globalThis,ft=D.trustedTypes,ae=ft?ft.emptyScript:"",he=D.reactiveElementPolyfillSupport,R=(r,t)=>r,z={toAttribute(r,t){switch(t){case Boolean:r=r?ae: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}},X=(r,t)=>!ee(r,t),$t={attribute:!0,type:String,converter:z,reflect:!1,useDefault:!1,hasChanged:X};Symbol.metadata??=Symbol("metadata"),D.litPropertyMetadata??=new WeakMap;let C=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=$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&&se(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=ie(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$t}static _$Ei(){if(this.hasOwnProperty(R("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(R("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(R("properties"))){const e=this.properties,s=[...re(e),...ne(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(pt(i))}else t!==void 0&&e.push(pt(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 te(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 a=o.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,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??X)(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,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}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){}};C.elementStyles=[],C.shadowRootOptions={mode:"open"},C[R("elementProperties")]=new Map,C[R("finalized")]=new Map,he?.({ReactiveElement:C}),(D.reactiveElementVersions??=[]).push("2.1.1");const G=globalThis,W=G.trustedTypes,gt=W?W.createPolicy("lit-html",{createHTML:r=>r}):void 0,yt="$lit$",m=`lit$${Math.random().toFixed(9).slice(2)}$`,bt="?"+m,ce=`<${bt}>`,w=document,k=()=>w.createComment(""),N=r=>r===null||typeof r!="object"&&typeof r!="function",Y=Array.isArray,le=r=>Y(r)||typeof r?.[Symbol.iterator]=="function",tt=`[ | ||
| \f\r]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mt=/-->/g,_t=/>/g,E=RegExp(`>|${tt}(?:([^\\s"'>=/]+)(${tt}*=${tt}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`,"g"),vt=/'/g,wt=/"/g,Et=/^(?:script|style|textarea|title)$/i,de=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),$=de(1),T=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),St=new WeakMap,S=w.createTreeWalker(w,129);function At(r,t){if(!Y(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return gt!==void 0?gt.createHTML(t):t}const ue=(r,t)=>{const e=r.length-1,s=[];let i,n=t===2?"<svg>":t===3?"<math>":"",o=M;for(let a=0;a<e;a++){const h=r[a];let l,d,c=-1,g=0;for(;g<h.length&&(o.lastIndex=g,d=o.exec(h),d!==null);)g=o.lastIndex,o===M?d[1]==="!--"?o=mt:d[1]!==void 0?o=_t:d[2]!==void 0?(Et.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=E):d[3]!==void 0&&(o=E):o===E?d[0]===">"?(o=i??M,c=-1):d[1]===void 0?c=-2:(c=o.lastIndex-d[2].length,l=d[1],o=d[3]===void 0?E:d[3]==='"'?wt:vt):o===wt||o===vt?o=E:o===mt||o===_t?o=M:(o=E,i=void 0);const _=o===E&&r[a+1].startsWith("/>")?" ":"";n+=o===M?h+ce:c>=0?(s.push(l),h.slice(0,c)+yt+h.slice(c)+m+_):h+m+(c===-2?a:_)}return[At(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 a=t.length-1,h=this.parts,[l,d]=ue(t,e);if(this.el=B.createElement(l,s),S.currentNode=this.el.content,e===2||e===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=S.nextNode())!==null&&h.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(yt)){const g=d[o++],_=i.getAttribute(c).split(m),F=/([.?@])?(.*)/.exec(g);h.push({type:1,index:n,name:F[2],strings:_,ctor:F[1]==="."?fe:F[1]==="?"?$e:F[1]==="@"?ge:V}),i.removeAttribute(c)}else c.startsWith(m)&&(h.push({type:6,index:n}),i.removeAttribute(c));if(Et.test(i.tagName)){const c=i.textContent.split(m),g=c.length-1;if(g>0){i.textContent=W?W.emptyScript:"";for(let _=0;_<g;_++)i.append(c[_],k()),S.nextNode(),h.push({type:2,index:++n});i.append(c[g],k())}}}else if(i.nodeType===8)if(i.data===bt)h.push({type:2,index:n});else{let c=-1;for(;(c=i.data.indexOf(m,c+1))!==-1;)h.push({type:7,index:n}),c+=m.length-1}n++}}static createElement(t,e){const s=w.createElement("template");return s.innerHTML=t,s}}function P(r,t,e=r,s){if(t===T)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 pe{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??w).importNode(e,!0);S.currentNode=i;let n=S.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let l;h.type===2?l=new I(n,n.nextSibling,this,t):h.type===1?l=new h.ctor(n,h.name,h.strings,this,t):h.type===6&&(l=new ye(n,this,t)),this._$AV.push(l),h=s[++a]}o!==h?.index&&(n=S.nextNode(),o++)}return S.currentNode=w,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 I{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=P(this,t,e),N(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):le(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&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.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(At(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const n=new pe(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(t){let e=St.get(t.strings);return e===void 0&&St.set(t.strings,e=new B(t)),e}k(t){Y(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 I(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=p,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=p}_$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!==T,o&&(this._$AH=t);else{const a=t;let h,l;for(t=n[0],h=0;h<n.length-1;h++)l=P(this,a[s+h],e,h),l===T&&(l=this._$AH[h]),o||=!N(l)||l!==this._$AH[h],l===p?t=p:t!==p&&(t+=(l??"")+n[h+1]),this._$AH[h]=l}o&&!i&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class fe extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class $e extends V{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class ge 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)??p)===T)return;const s=this._$AH,i=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==p&&(s===p||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 ye{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 be=G.litHtmlPolyfillSupport;be?.(B,I),(G.litHtmlVersions??=[]).push("3.3.1");const me=(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 I(t.insertBefore(k(),n),n,void 0,e??{})}return i._$AI(r),i};const et=globalThis;class A extends C{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=me(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return T}}A._$litElement$=!0,A.finalized=!0,et.litElementHydrateSupport?.({LitElement:A});const _e=et.litElementPolyfillSupport;_e?.({LitElement:A}),(et.litElementVersions??=[]).push("4.2.1");const st=r=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(r,t)})):customElements.define(r,t)};const ve={attribute:!0,type:String,converter:z,reflect:!1,hasChanged:X},we=(r=ve,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(a){const h=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,h,r)},init(a){return a!==void 0&&this.C(o,void 0,r,a),a}}}if(s==="setter"){const{name:o}=e;return function(a){const h=this[o];t.call(this,a),this.requestUpdate(o,h,r)}}throw Error("Unsupported decorator location: "+s)};function f(r){return(t,e)=>typeof e=="object"?we(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 Ee=r=>r??p;class xt extends Error{constructor(t,e){super(t),this.name="TopsortRequestError",this.status=e}static isTopsortRequestError(t){return t.name==="TopsortRequestError"}}class Se 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 Ae(){if(window.TS?.getUserId&&typeof window.TS.getUserId=="function")return window.TS.getUserId()}const xe=()=>{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 Ce(r,{signal:t,logError:e}){const{device:s}=r,i=window.TS.token,n=window.TS.url||"https://api.topsort.com",o=Ae();o&&(r.opaqueUserId=o);const a=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.1 (${s})`},body:JSON.stringify({auctions:[r]}),signal:t});if(!a.ok){const d=await a.json().catch(()=>({}));throw new xt(d.message??`HTTP ${a.status}`,a.status)}const l=(await a.json()).results[0];if(!l)throw new xt("No auction results",a.status);if(l.error)throw e(l.error),new Error(l.error);return l.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 Pe=r=>{class t extends r{constructor(){super(...arguments),this.width=0,this.height=0,this.slotId="",this.newTab=!1}buildAuction(s){const i=xe(),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};let Ct=!1;function Ue(r){const t=[];for(const e of r.split(",")){const s=e.trim();if(!s)continue;const i=s.indexOf(":");i===-1?t.push({key:s,target:null}):t.push({key:s.slice(0,i),target:s.slice(i+1)})}return t}function Tt(r,t){if(t)return t;const e=r.tagName.toLowerCase();return e==="a"?"href":e==="img"||e==="video"||e==="source"?"src":"textContent"}function Oe(r,t,e){return e==="textContent"?(r.textContent=t,!0):r.hasAttribute(e)?(r.setAttribute(e,t),!0):!1}function Pt(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;if(!o)continue;const a=Ue(o),h=a.some(l=>l.target!==null);for(const{key:l,target:d}of a){if(!(l in e))continue;let c;if(!h&&d===null){const g=n.dataset.tsAttr;Ct||(Ct=!0,console.warn('[banners.js] Implicit data-ts-field binding is deprecated. Use explicit "key:target" syntax instead (e.g. data-ts-field="image:src").')),c=Tt(n,g??null)}else c=Tt(n,d);if(!Oe(n,e[l],c)){const g=n.tagName.toLowerCase();console.warn(`[banners.js] Binding "${l}" → "${c}" skipped: <${g}> has no "${c}" attribute. Add a fallback value (e.g. ${c}="...") to your template.`)}}}}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 Re=Object.defineProperty,ke=Object.getOwnPropertyDescriptor,y=(r,t,e,s)=>{for(var i=s>1?void 0:s?ke(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&&Re(t,e,i),i};window.TS_BANNERS=window.TS_BANNERS||{};function Ne(r){}function Me(r){return window.TS_BANNERS.getLink?window.TS_BANNERS.getLink(r):r.type==="url"?r.id:`${r.type}/${r.id}`}function Ut(){if(window.TS_BANNERS.getLoadingElement){const r=window.TS_BANNERS.getLoadingElement();return $`${r}`}return $``}function H(r){if(window.TS_BANNERS.getErrorElement){const t=window.TS_BANNERS.getErrorElement(r);return $`${t}`}return $``}function Ot(){if(window.TS_BANNERS.getNoWinnersElement){const r=window.TS_BANNERS.getNoWinnersElement();return $`${r}`}return $``}function Rt(r,t,e,s){if(window.TS_BANNERS.getBannerElement){const l=window.TS_BANNERS.getBannerElement(r);return $`${l}`}if(!r.asset?.[0]?.url)return $``;const i=r.asset[0].url,o=(()=>{try{const d=new URL(i).pathname.split("/"),c=d.indexOf("manifest");return c>=0?d[c+1]?.startsWith("video")??!1:!1}catch{return!1}})()?$` | ||
| <hls-video | ||
@@ -15,11 +15,11 @@ src="${i}" | ||
| /> | ||
| `,h=Re(r),a=s?$`<a href="${h}" target="_blank">${o}</a>`:$`<a href="${h}">${o}</a>`;return $` | ||
| `,a=Me(r),h=s?$`<a href="${a}" target="_blank">${o}</a>`:$`<a href="${a}">${o}</a>`;return $` | ||
| <div | ||
| data-ts-clickable | ||
| data-ts-resolved-bid=${ve(r.isFallback?void 0:r.resolvedBidId)} | ||
| data-ts-resolved-bid=${Ee(r.isFallback?void 0:r.resolvedBidId)} | ||
| class="ts-banner" | ||
| > | ||
| ${a} | ||
| ${h} | ||
| </div> | ||
| `}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 $` | ||
| `}const kt=Symbol("banner-context"),Be=(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 Pe(A){constructor(){super(...arguments),this.task=new Zt(this,{task:([t],e)=>Ce(this.buildAuction(t),{...e,logError:Ne}).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=v.INITIAL}render(){return!window.TS.token||!this.slotId?H(new Se(window.TS.token,this.slotId)):this.isContext?$``:this.predefined?p:this.task.render({pending:()=>Ut(),complete:t=>{if(!t.length)return Ot();if(t[0].asset?.[0]?.content){const e=new Error("Banner has predefined content but component is not in predefined mode");return H(e)}return Rt(t[0],this.width,this.height,this.newTab)},error:t=>H(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!==v.COMPLETE&&s===v.COMPLETE)if(i.length&&i[0].asset?.[0]?.content)try{Pt(this,i[0])}catch{}else i.length&&console.warn(`[topsort-banner] Predefined mode is set but the auction response for slot "${this.slotId}" contains no content map. Template was not mutated.`);this.isContext||(e!==v.COMPLETE&&s===v.COMPLETE?this.emitEvent(i.length?"ready":"nowinners"):e!==v.ERROR&&s===v.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={...this.context,width:this.width,height:this.height,newTab:this.newTab}})}createRenderRoot(){return this}},y([Bt({context:kt}),f({attribute:!1,hasChanged:Be})],u.TopsortBanner.prototype,"context",2),y([f({type:Boolean,attribute:"context"})],u.TopsortBanner.prototype,"isContext",2),y([f({type:Boolean})],u.TopsortBanner.prototype,"predefined",2),y([f({attribute:!1,state:!0})],u.TopsortBanner.prototype,"slots",2),u.TopsortBanner=y([st("topsort-banner")],u.TopsortBanner),u.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)return p;if(!this.context)return $``;if(!this.context.banners)return Ut();if(this.context.error)return H(this.context.error);if(!this.context.banners.length||this.context.banners.length<this.rank)return Ot();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 H(e)}return Rt(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{Pt(this,i)}catch{}else i&&console.warn(`[topsort-banner-slot] Predefined mode is set but the auction response for rank ${this.rank} contains no content map. Template was not mutated.`)}}createRenderRoot(){return this}},y([It({context:kt,subscribe:!0}),f({attribute:!1})],u.TopsortBannerSlot.prototype,"context",2),y([f({attribute:"rank",type:Number})],u.TopsortBannerSlot.prototype,"rank",2),y([f({type:Boolean})],u.TopsortBannerSlot.prototype,"predefined",2),u.TopsortBannerSlot=y([st("topsort-banner-slot")],u.TopsortBannerSlot),u.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 | ||
@@ -33,3 +33,3 @@ id="${this.videoId}" | ||
| ></video> | ||
| `}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})({}); | ||
| `}async firstUpdated(){const t=this.shadowRoot?.getElementById(this.videoId);if(!t)return;let e;try{e=await Ie()}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))})}},y([f({type:String})],u.HlsVideo.prototype,"src",2),y([f({type:String})],u.HlsVideo.prototype,"width",2),y([f({type:String})],u.HlsVideo.prototype,"height",2),u.HlsVideo=y([st("hls-video")],u.HlsVideo);let x=null;function Ie(){return x||(window.Hls?(x=Promise.resolve(window.Hls),x):(x=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 x=null,r}),x))}return Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u})({}); | ||
| //# sourceMappingURL=banners.iife.js.map |
+420
-390
@@ -1,8 +0,8 @@ | ||
| 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 St = 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 ot = class { | ||
| constructor(t, e, s, r) { | ||
| let nt = class { | ||
| constructor(t, e, s, i) { | ||
| if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, o) => { | ||
@@ -13,3 +13,3 @@ 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.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1; | ||
| } else this.context = e, this.callback = s, this.subscribe = r ?? !1; | ||
| } else this.context = e, this.callback = s, this.subscribe = i ?? !1; | ||
| this.host.addController(this); | ||
@@ -24,6 +24,6 @@ } | ||
| dispatchRequest() { | ||
| this.host.dispatchEvent(new wt(this.context, this.host, this.t, this.subscribe)); | ||
| this.host.dispatchEvent(new St(this.context, this.host, this.t, this.subscribe)); | ||
| } | ||
| }; | ||
| let Nt = class { | ||
| let It = class { | ||
| get value() { | ||
@@ -49,4 +49,4 @@ return this.o; | ||
| }, consumerHost: e }); | ||
| const { disposer: r } = this.subscriptions.get(t); | ||
| t(this.value, r); | ||
| const { disposer: i } = this.subscriptions.get(t); | ||
| t(this.value, i); | ||
| } | ||
@@ -57,17 +57,17 @@ clearCallbacks() { | ||
| }; | ||
| let Mt = class extends Event { | ||
| let jt = class extends Event { | ||
| constructor(t, e) { | ||
| super("context-provider", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = e; | ||
| } | ||
| }, ht = class extends Nt { | ||
| }, ot = class extends It { | ||
| constructor(t, e, s) { | ||
| 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; | ||
| 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 = /* @__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(); | ||
| for (const [o, { consumerHost: h }] of this.subscriptions) n.has(o) || (n.add(o), h.dispatchEvent(new St(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); | ||
@@ -79,6 +79,6 @@ } | ||
| hostConnected() { | ||
| this.host.dispatchEvent(new Mt(this.context, this.host)); | ||
| this.host.dispatchEvent(new jt(this.context, this.host)); | ||
| } | ||
| }; | ||
| function It({ context: i }) { | ||
| function Ht({ context: r }) { | ||
| return (t, e) => { | ||
@@ -88,14 +88,14 @@ const s = /* @__PURE__ */ new WeakMap(); | ||
| return t.get.call(this); | ||
| }, 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; | ||
| }, 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 ht(o, { context: i })); | ||
| s.set(o, new ot(o, { context: r })); | ||
| })); | ||
| const r = Object.getOwnPropertyDescriptor(t, e); | ||
| const i = Object.getOwnPropertyDescriptor(t, e); | ||
| let n; | ||
| if (r === void 0) { | ||
| if (i === void 0) { | ||
| const o = /* @__PURE__ */ new WeakMap(); | ||
@@ -108,4 +108,4 @@ n = { get() { | ||
| } else { | ||
| const o = r.set; | ||
| n = { ...r, set(h) { | ||
| const o = i.set; | ||
| n = { ...i, set(h) { | ||
| s.get(this).setValue(h), o?.call(this, h); | ||
@@ -118,11 +118,11 @@ } }; | ||
| } | ||
| function jt({ context: i, subscribe: t }) { | ||
| function Lt({ context: r, subscribe: t }) { | ||
| return (e, s) => { | ||
| typeof s == "object" ? s.addInitializer((function() { | ||
| new ot(this, { context: i, callback: (r) => { | ||
| e.set.call(this, r); | ||
| new nt(this, { context: r, callback: (i) => { | ||
| e.set.call(this, i); | ||
| }, subscribe: t }); | ||
| })) : e.constructor.addInitializer(((r) => { | ||
| new ot(r, { context: i, callback: (n) => { | ||
| r[s] = n; | ||
| })) : e.constructor.addInitializer(((i) => { | ||
| new nt(i, { context: r, callback: (n) => { | ||
| i[s] = n; | ||
| }, subscribe: t }); | ||
@@ -132,6 +132,6 @@ })); | ||
| } | ||
| 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 { | ||
| const D = globalThis, X = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, At = /* @__PURE__ */ Symbol(), ht = /* @__PURE__ */ new WeakMap(); | ||
| let Bt = class { | ||
| constructor(t, e, s) { | ||
| if (this._$cssResult$ = !0, s !== St) 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; | ||
@@ -142,5 +142,5 @@ } | ||
| const e = this.t; | ||
| if (G && t === void 0) { | ||
| if (X && 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)); | ||
| s && (t = ht.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && ht.set(e, t)); | ||
| } | ||
@@ -153,31 +153,31 @@ return t; | ||
| }; | ||
| 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)); | ||
| const qt = (r) => new Bt(typeof r == "string" ? r : r + "", void 0, At), Dt = (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"), r = D.litNonce; | ||
| r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s); | ||
| const s = document.createElement("style"), i = D.litNonce; | ||
| i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s); | ||
| } | ||
| }, ct = G ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => { | ||
| }, at = X ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
| let e = ""; | ||
| for (const s of t.cssRules) e += s.cssText; | ||
| 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) { | ||
| return qt(e); | ||
| })(r) : r; | ||
| const { is: zt, defineProperty: Wt, getOwnPropertyDescriptor: Ft, getOwnPropertyNames: Vt, getOwnPropertySymbols: Jt, getPrototypeOf: Kt } = Object, V = globalThis, ct = V.trustedTypes, Qt = ct ? ct.emptyScript : "", Zt = V.reactiveElementPolyfillSupport, R = (r, t) => r, Z = { toAttribute(r, t) { | ||
| switch (t) { | ||
| case Boolean: | ||
| i = i ? Jt : null; | ||
| r = r ? Qt : null; | ||
| break; | ||
| case Object: | ||
| case Array: | ||
| i = i == null ? i : JSON.stringify(i); | ||
| r = r == null ? r : JSON.stringify(r); | ||
| } | ||
| return i; | ||
| }, fromAttribute(i, t) { | ||
| let e = i; | ||
| return r; | ||
| }, fromAttribute(r, t) { | ||
| let e = r; | ||
| switch (t) { | ||
| case Boolean: | ||
| e = i !== null; | ||
| e = r !== null; | ||
| break; | ||
| case Number: | ||
| e = i === null ? null : Number(i); | ||
| e = r === null ? null : Number(r); | ||
| break; | ||
@@ -187,3 +187,3 @@ case Object: | ||
| try { | ||
| e = JSON.parse(i); | ||
| e = JSON.parse(r); | ||
| } catch { | ||
@@ -194,4 +194,4 @@ e = null; | ||
| return e; | ||
| } }, 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(); | ||
| } }, G = (r, t) => !zt(r, t), lt = { attribute: !0, type: String, converter: Z, reflect: !1, hasChanged: G }; | ||
| Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), V.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| let U = class extends HTMLElement { | ||
@@ -204,10 +204,10 @@ static addInitializer(t) { | ||
| } | ||
| static createProperty(t, e = dt) { | ||
| static createProperty(t, e = lt) { | ||
| if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) { | ||
| const s = Symbol(), r = this.getPropertyDescriptor(t, s, e); | ||
| r !== void 0 && Dt(this.prototype, t, r); | ||
| const s = /* @__PURE__ */ Symbol(), i = this.getPropertyDescriptor(t, s, e); | ||
| i !== void 0 && Wt(this.prototype, t, i); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(t, e, s) { | ||
| const { get: r, set: n } = zt(this.prototype, t) ?? { get() { | ||
| const { get: i, set: n } = Ft(this.prototype, t) ?? { get() { | ||
| return this[e]; | ||
@@ -218,5 +218,5 @@ }, set(o) { | ||
| return { get() { | ||
| return r?.call(this); | ||
| return i?.call(this); | ||
| }, set(o) { | ||
| const h = r?.call(this); | ||
| const h = i?.call(this); | ||
| n.call(this, o), this.requestUpdate(t, h, s); | ||
@@ -226,14 +226,14 @@ }, configurable: !0, enumerable: !0 }; | ||
| static getPropertyOptions(t) { | ||
| return this.elementProperties.get(t) ?? dt; | ||
| return this.elementProperties.get(t) ?? lt; | ||
| } | ||
| static _$Ei() { | ||
| if (this.hasOwnProperty(O("elementProperties"))) return; | ||
| const t = Vt(this); | ||
| if (this.hasOwnProperty(R("elementProperties"))) return; | ||
| const t = Kt(this); | ||
| t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties); | ||
| } | ||
| static finalize() { | ||
| 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]); | ||
| if (this.hasOwnProperty(R("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(R("properties"))) { | ||
| const e = this.properties, s = [...Vt(e), ...Jt(e)]; | ||
| for (const i of s) this.createProperty(i, e[i]); | ||
| } | ||
@@ -243,8 +243,8 @@ const t = this[Symbol.metadata]; | ||
| const e = litPropertyMetadata.get(t); | ||
| if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r); | ||
| if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (const [e, s] of this.elementProperties) { | ||
| const r = this._$Eu(e, s); | ||
| r !== void 0 && this._$Eh.set(r, e); | ||
| const i = this._$Eu(e, s); | ||
| i !== void 0 && this._$Eh.set(i, e); | ||
| } | ||
@@ -257,4 +257,4 @@ this.elementStyles = this.finalizeStyles(this.styles); | ||
| const s = new Set(t.flat(1 / 0).reverse()); | ||
| for (const r of s) e.unshift(ct(r)); | ||
| } else t !== void 0 && e.push(ct(t)); | ||
| for (const i of s) e.unshift(at(i)); | ||
| } else t !== void 0 && e.push(at(t)); | ||
| return e; | ||
@@ -285,3 +285,3 @@ } | ||
| const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); | ||
| return Bt(t, this.constructor.elementStyles), t; | ||
| return Dt(t, this.constructor.elementStyles), t; | ||
| } | ||
@@ -300,13 +300,13 @@ connectedCallback() { | ||
| _$EC(t, e) { | ||
| 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; | ||
| 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, 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; | ||
| 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, this[i] = o.fromAttribute(e, n.type), this._$Em = null; | ||
| } | ||
@@ -316,3 +316,3 @@ } | ||
| if (t !== void 0) { | ||
| if (s ??= this.constructor.getPropertyOptions(t), !(s.hasChanged ?? Y)(this[t], e)) return; | ||
| if (s ??= this.constructor.getPropertyOptions(t), !(s.hasChanged ?? G)(this[t], e)) return; | ||
| this.P(t, e, s); | ||
@@ -342,7 +342,7 @@ } | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (const [r, n] of this._$Ep) this[r] = n; | ||
| 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 [r, n] of s) n.wrapped !== !0 || this._$AL.has(r) || this[r] === void 0 || this.P(r, this[r], n); | ||
| 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); | ||
| } | ||
@@ -383,5 +383,5 @@ let t = !1; | ||
| }; | ||
| 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 { | ||
| U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[R("elementProperties")] = /* @__PURE__ */ new Map(), U[R("finalized")] = /* @__PURE__ */ new Map(), Zt?.({ ReactiveElement: U }), (V.reactiveElementVersions ??= []).push("2.0.4"); | ||
| const _ = { INITIAL: 0, COMPLETE: 2, ERROR: 3 }, Xt = /* @__PURE__ */ Symbol(); | ||
| let Gt = class { | ||
| get taskComplete() { | ||
@@ -394,4 +394,4 @@ return this.t || (this.i === 1 ? this.t = new Promise(((t, e) => { | ||
| this.p = 0, this.i = 0, (this._ = t).addController(this); | ||
| 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?.()); | ||
| const i = typeof e == "object" ? e : { task: e, args: s }; | ||
| this.v = i.task, this.j = i.args, this.m = i.argsEqual ?? Yt, 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?.()); | ||
| } | ||
@@ -417,3 +417,3 @@ 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 r = ++this.p; | ||
| const i = ++this.p; | ||
| this.q = new AbortController(); | ||
@@ -426,4 +426,4 @@ let n = !1; | ||
| } | ||
| if (this.p === r) { | ||
| if (e === Qt) this.i = 0; | ||
| if (this.p === i) { | ||
| if (e === Xt) this.i = 0; | ||
| else { | ||
@@ -475,7 +475,7 @@ if (n === !1) { | ||
| }; | ||
| 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 { | ||
| const Yt = (r, t) => r === t || r.length === t.length && r.every(((e, s) => !G(e, t[s]))); | ||
| const z = globalThis, Y = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, xt = /* @__PURE__ */ Symbol(), dt = /* @__PURE__ */ new WeakMap(); | ||
| let te = class { | ||
| constructor(t, e, s) { | ||
| if (this._$cssResult$ = !0, s !== At) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| if (this._$cssResult$ = !0, s !== xt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| this.cssText = t, this.t = e; | ||
@@ -486,5 +486,5 @@ } | ||
| const e = this.t; | ||
| if (tt && t === void 0) { | ||
| if (Y && t === void 0) { | ||
| const s = e !== void 0 && e.length === 1; | ||
| s && (t = ut.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && ut.set(e, t)); | ||
| s && (t = dt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && dt.set(e, t)); | ||
| } | ||
@@ -497,31 +497,31 @@ return t; | ||
| }; | ||
| 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)); | ||
| const ee = (r) => new te(typeof r == "string" ? r : r + "", void 0, xt), se = (r, t) => { | ||
| if (Y) r.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet)); | ||
| else for (const e of t) { | ||
| const s = document.createElement("style"), r = z.litNonce; | ||
| r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s); | ||
| const s = document.createElement("style"), i = z.litNonce; | ||
| i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s); | ||
| } | ||
| }, pt = tt ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => { | ||
| }, ut = Y ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => { | ||
| let e = ""; | ||
| for (const s of t.cssRules) e += s.cssText; | ||
| 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) { | ||
| return ee(e); | ||
| })(r) : r; | ||
| const { is: ie, defineProperty: re, getOwnPropertyDescriptor: ne, getOwnPropertyNames: oe, getOwnPropertySymbols: he, getPrototypeOf: ae } = Object, J = globalThis, pt = J.trustedTypes, ce = pt ? pt.emptyScript : "", le = J.reactiveElementPolyfillSupport, k = (r, t) => r, W = { toAttribute(r, t) { | ||
| switch (t) { | ||
| case Boolean: | ||
| i = i ? he : null; | ||
| r = r ? ce : null; | ||
| break; | ||
| case Object: | ||
| case Array: | ||
| i = i == null ? i : JSON.stringify(i); | ||
| r = r == null ? r : JSON.stringify(r); | ||
| } | ||
| return i; | ||
| }, fromAttribute(i, t) { | ||
| let e = i; | ||
| return r; | ||
| }, fromAttribute(r, t) { | ||
| let e = r; | ||
| switch (t) { | ||
| case Boolean: | ||
| e = i !== null; | ||
| e = r !== null; | ||
| break; | ||
| case Number: | ||
| e = i === null ? null : Number(i); | ||
| e = r === null ? null : Number(r); | ||
| break; | ||
@@ -531,3 +531,3 @@ case Object: | ||
| try { | ||
| e = JSON.parse(i); | ||
| e = JSON.parse(r); | ||
| } catch { | ||
@@ -538,4 +538,4 @@ e = null; | ||
| return e; | ||
| } }, 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(); | ||
| } }, tt = (r, t) => !ie(r, t), ft = { attribute: !0, type: String, converter: W, reflect: !1, useDefault: !1, hasChanged: tt }; | ||
| Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), J.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| let x = class extends HTMLElement { | ||
@@ -548,10 +548,10 @@ static addInitializer(t) { | ||
| } | ||
| static createProperty(t, e = $t) { | ||
| static createProperty(t, e = ft) { | ||
| 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(), r = this.getPropertyDescriptor(t, s, e); | ||
| r !== void 0 && se(this.prototype, t, r); | ||
| const s = /* @__PURE__ */ Symbol(), i = this.getPropertyDescriptor(t, s, e); | ||
| i !== void 0 && re(this.prototype, t, i); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(t, e, s) { | ||
| const { get: r, set: n } = ie(this.prototype, t) ?? { get() { | ||
| const { get: i, set: n } = ne(this.prototype, t) ?? { get() { | ||
| return this[e]; | ||
@@ -561,4 +561,4 @@ }, set(o) { | ||
| } }; | ||
| return { get: r, set(o) { | ||
| const h = r?.call(this); | ||
| return { get: i, set(o) { | ||
| const h = i?.call(this); | ||
| n?.call(this, o), this.requestUpdate(t, h, s); | ||
@@ -568,7 +568,7 @@ }, configurable: !0, enumerable: !0 }; | ||
| static getPropertyOptions(t) { | ||
| return this.elementProperties.get(t) ?? $t; | ||
| return this.elementProperties.get(t) ?? ft; | ||
| } | ||
| static _$Ei() { | ||
| if (this.hasOwnProperty(k("elementProperties"))) return; | ||
| const t = oe(this); | ||
| const t = ae(this); | ||
| t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties); | ||
@@ -579,4 +579,4 @@ } | ||
| 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]); | ||
| const e = this.properties, s = [...oe(e), ...he(e)]; | ||
| for (const i of s) this.createProperty(i, e[i]); | ||
| } | ||
@@ -586,8 +586,8 @@ const t = this[Symbol.metadata]; | ||
| const e = litPropertyMetadata.get(t); | ||
| if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r); | ||
| if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (const [e, s] of this.elementProperties) { | ||
| const r = this._$Eu(e, s); | ||
| r !== void 0 && this._$Eh.set(r, e); | ||
| const i = this._$Eu(e, s); | ||
| i !== void 0 && this._$Eh.set(i, e); | ||
| } | ||
@@ -600,4 +600,4 @@ this.elementStyles = this.finalizeStyles(this.styles); | ||
| const s = new Set(t.flat(1 / 0).reverse()); | ||
| for (const r of s) e.unshift(pt(r)); | ||
| } else t !== void 0 && e.push(pt(t)); | ||
| for (const i of s) e.unshift(ut(i)); | ||
| } else t !== void 0 && e.push(ut(t)); | ||
| return e; | ||
@@ -628,3 +628,3 @@ } | ||
| const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); | ||
| return te(t, this.constructor.elementStyles), t; | ||
| return se(t, this.constructor.elementStyles), t; | ||
| } | ||
@@ -643,15 +643,15 @@ connectedCallback() { | ||
| _$ET(t, e) { | ||
| const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s); | ||
| if (r !== void 0 && s.reflect === !0) { | ||
| 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 : W).toAttribute(e, s.type); | ||
| this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null; | ||
| this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null; | ||
| } | ||
| } | ||
| _$AK(t, e) { | ||
| 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 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 : W; | ||
| this._$Em = i; | ||
| const h = o.fromAttribute(e, n.type); | ||
| this[r] = h ?? this._$Ej?.get(r) ?? h, this._$Em = null; | ||
| this[i] = h ?? this._$Ej?.get(i) ?? h, this._$Em = null; | ||
| } | ||
@@ -661,4 +661,4 @@ } | ||
| if (t !== void 0) { | ||
| 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; | ||
| const i = this.constructor, n = this[t]; | ||
| if (s ??= i.getPropertyOptions(t), !((s.hasChanged ?? tt)(n, e) || s.useDefault && s.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(i._$Eu(t, s)))) return; | ||
| this.C(t, e, s); | ||
@@ -668,4 +668,4 @@ } | ||
| } | ||
| 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)); | ||
| C(t, e, { useDefault: s, reflect: i, 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)), i === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); | ||
| } | ||
@@ -689,9 +689,9 @@ async _$EP() { | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (const [r, n] of this._$Ep) this[r] = n; | ||
| 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 [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); | ||
| 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); | ||
| } | ||
@@ -733,50 +733,50 @@ } | ||
| }; | ||
| 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; | ||
| x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[k("elementProperties")] = /* @__PURE__ */ new Map(), x[k("finalized")] = /* @__PURE__ */ new Map(), le?.({ ReactiveElement: x }), (J.reactiveElementVersions ??= []).push("2.1.1"); | ||
| const et = globalThis, F = et.trustedTypes, $t = F ? F.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Ct = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, Pt = "?" + m, de = `<${Pt}>`, A = document, M = () => A.createComment(""), I = (r) => r === null || typeof r != "object" && typeof r != "function", st = Array.isArray, ue = (r) => st(r) || typeof r?.[Symbol.iterator] == "function", Q = `[ | ||
| \f\r]`, O = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, gt = /-->/g, yt = />/g, v = RegExp(`>|${Q}(?:([^\\s"'>=/]+)(${Q}*=${Q}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`, "g"), bt = /'/g, mt = /"/g, Tt = /^(?:script|style|textarea|title)$/i, pe = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), f = pe(1), C = /* @__PURE__ */ Symbol.for("lit-noChange"), u = /* @__PURE__ */ Symbol.for("lit-nothing"), _t = /* @__PURE__ */ new WeakMap(), E = A.createTreeWalker(A, 129); | ||
| function Ut(r, t) { | ||
| if (!st(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array"); | ||
| return $t !== void 0 ? $t.createHTML(t) : t; | ||
| } | ||
| const ue = (i, t) => { | ||
| const e = i.length - 1, s = []; | ||
| let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = R; | ||
| const fe = (r, t) => { | ||
| const e = r.length - 1, s = []; | ||
| let i, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = O; | ||
| for (let h = 0; h < e; h++) { | ||
| const a = i[h]; | ||
| let c, d, l = -1, g = 0; | ||
| 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); | ||
| const a = r[h]; | ||
| let l, d, c = -1, $ = 0; | ||
| for (; $ < a.length && (o.lastIndex = $, d = o.exec(a), d !== null); ) $ = o.lastIndex, o === O ? d[1] === "!--" ? o = gt : d[1] !== void 0 ? o = yt : d[2] !== void 0 ? (Tt.test(d[2]) && (i = RegExp("</" + d[2], "g")), o = v) : d[3] !== void 0 && (o = v) : o === v ? d[0] === ">" ? (o = i ?? O, c = -1) : d[1] === void 0 ? c = -2 : (c = o.lastIndex - d[2].length, l = d[1], o = d[3] === void 0 ? v : d[3] === '"' ? mt : bt) : o === mt || o === bt ? o = v : o === gt || o === yt ? o = O : (o = v, i = void 0); | ||
| const b = o === v && r[h + 1].startsWith("/>") ? " " : ""; | ||
| n += o === O ? a + de : c >= 0 ? (s.push(l), a.slice(0, c) + Ct + a.slice(c) + m + b) : a + m + (c === -2 ? h : b); | ||
| } | ||
| return [Tt(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s]; | ||
| return [Ut(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s]; | ||
| }; | ||
| class j { | ||
| constructor({ strings: t, _$litType$: e }, s) { | ||
| let r; | ||
| let i; | ||
| this.parts = []; | ||
| 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); | ||
| const h = t.length - 1, a = this.parts, [l, d] = fe(t, e); | ||
| if (this.el = j.createElement(l, s), E.currentNode = this.el.content, e === 2 || e === 3) { | ||
| const c = this.el.content.firstChild; | ||
| c.replaceWith(...c.childNodes); | ||
| } | ||
| 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) { | ||
| 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()); | ||
| for (; (i = E.nextNode()) !== null && a.length < h; ) { | ||
| if (i.nodeType === 1) { | ||
| if (i.hasAttributes()) for (const c of i.getAttributeNames()) if (c.endsWith(Ct)) { | ||
| const $ = d[o++], b = i.getAttribute(c).split(m), q = /([.?@])?(.*)/.exec($); | ||
| a.push({ type: 1, index: n, name: q[2], strings: b, ctor: q[1] === "." ? ge : q[1] === "?" ? ye : q[1] === "@" ? be : K }), i.removeAttribute(c); | ||
| } else c.startsWith(m) && (a.push({ type: 6, index: n }), i.removeAttribute(c)); | ||
| if (Tt.test(i.tagName)) { | ||
| const c = i.textContent.split(m), $ = c.length - 1; | ||
| if ($ > 0) { | ||
| i.textContent = F ? F.emptyScript : ""; | ||
| for (let b = 0; b < $; b++) i.append(c[b], M()), E.nextNode(), a.push({ type: 2, index: ++n }); | ||
| i.append(c[$], M()); | ||
| } | ||
| } | ||
| } else if (r.nodeType === 8) if (r.data === Ct) a.push({ type: 2, index: n }); | ||
| } else if (i.nodeType === 8) if (i.data === Pt) a.push({ type: 2, index: n }); | ||
| else { | ||
| let l = -1; | ||
| for (; (l = r.data.indexOf(_, l + 1)) !== -1; ) a.push({ type: 7, index: n }), l += _.length - 1; | ||
| let c = -1; | ||
| for (; (c = i.data.indexOf(m, c + 1)) !== -1; ) a.push({ type: 7, index: n }), c += m.length - 1; | ||
| } | ||
@@ -791,9 +791,9 @@ n++; | ||
| } | ||
| function P(i, t, e = i, s) { | ||
| function P(r, t, e = r, s) { | ||
| if (t === C) return t; | ||
| let r = s !== void 0 ? e._$Co?.[s] : e._$Cl; | ||
| let i = 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; | ||
| 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 pe { | ||
| class $e { | ||
| constructor(t, e) { | ||
@@ -809,13 +809,13 @@ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e; | ||
| u(t) { | ||
| 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]; | ||
| const { el: { content: e }, parts: s } = this._$AD, i = (t?.creationScope ?? A).importNode(e, !0); | ||
| E.currentNode = i; | ||
| let n = E.nextNode(), o = 0, h = 0, a = s[0]; | ||
| for (; a !== void 0; ) { | ||
| if (o === a.index) { | ||
| let c; | ||
| 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]; | ||
| let l; | ||
| a.type === 2 ? l = new B(n, n.nextSibling, this, t) : a.type === 1 ? l = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (l = new me(n, this, t)), this._$AV.push(l), a = s[++h]; | ||
| } | ||
| o !== a?.index && (n = w.nextNode(), o++); | ||
| o !== a?.index && (n = E.nextNode(), o++); | ||
| } | ||
| return w.currentNode = A, r; | ||
| return E.currentNode = A, i; | ||
| } | ||
@@ -831,4 +831,4 @@ p(t) { | ||
| } | ||
| 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; | ||
| 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; | ||
| } | ||
@@ -847,3 +847,3 @@ get parentNode() { | ||
| _$AI(t, e = this) { | ||
| 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); | ||
| 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) : ue(t) ? this.k(t) : this._(t); | ||
| } | ||
@@ -860,6 +860,6 @@ O(t) { | ||
| $(t) { | ||
| 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); | ||
| const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = j.createElement(Ut(s.h, s.h[0]), this.options)), s); | ||
| if (this._$AH?._$AD === i) this._$AH.p(e); | ||
| else { | ||
| const n = new pe(r, this), o = n.u(this.options); | ||
| const n = new $e(i, this), o = n.u(this.options); | ||
| n.p(e), this.T(o), this._$AH = n; | ||
@@ -869,11 +869,11 @@ } | ||
| _$AC(t) { | ||
| let e = vt.get(t.strings); | ||
| return e === void 0 && vt.set(t.strings, e = new j(t)), e; | ||
| let e = _t.get(t.strings); | ||
| return e === void 0 && _t.set(t.strings, e = new j(t)), e; | ||
| } | ||
| k(t) { | ||
| it(this._$AH) || (this._$AH = [], this._$AR()); | ||
| st(this._$AH) || (this._$AH = [], this._$AR()); | ||
| const e = this._$AH; | ||
| 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); | ||
| let s, i = 0; | ||
| for (const n of t) i === e.length ? e.push(s = new B(this.O(M()), this.O(M()), this, this.options)) : s = e[i], s._$AI(n), i++; | ||
| i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i); | ||
| } | ||
@@ -890,3 +890,3 @@ _$AR(t = this._$AA.nextSibling, e) { | ||
| } | ||
| class Q { | ||
| class K { | ||
| get tagName() { | ||
@@ -898,6 +898,6 @@ return this.element.tagName; | ||
| } | ||
| 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; | ||
| 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, r) { | ||
| _$AI(t, e = this, s, i) { | ||
| const n = this.strings; | ||
@@ -908,6 +908,6 @@ let o = !1; | ||
| 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 ||= !I(c) || c !== this._$AH[a], c === u ? t = u : t !== u && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c; | ||
| let a, l; | ||
| for (t = n[0], a = 0; a < n.length - 1; a++) l = P(this, h[s + a], e, a), l === C && (l = this._$AH[a]), o ||= !I(l) || l !== this._$AH[a], l === u ? t = u : t !== u && (t += (l ?? "") + n[a + 1]), this._$AH[a] = l; | ||
| } | ||
| o && !r && this.j(t); | ||
| o && !i && this.j(t); | ||
| } | ||
@@ -918,3 +918,3 @@ j(t) { | ||
| } | ||
| class fe extends Q { | ||
| class ge extends K { | ||
| constructor() { | ||
@@ -927,3 +927,3 @@ super(...arguments), this.type = 3; | ||
| } | ||
| class $e extends Q { | ||
| class ye extends K { | ||
| constructor() { | ||
@@ -936,10 +936,10 @@ super(...arguments), this.type = 4; | ||
| } | ||
| class ge extends Q { | ||
| constructor(t, e, s, r, n) { | ||
| super(t, e, s, r, n), this.type = 5; | ||
| class be extends K { | ||
| 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, 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; | ||
| 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; | ||
| } | ||
@@ -950,3 +950,3 @@ handleEvent(t) { | ||
| } | ||
| class ye { | ||
| class me { | ||
| constructor(t, e, s) { | ||
@@ -962,14 +962,14 @@ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s; | ||
| } | ||
| const be = st.litHtmlPolyfillSupport; | ||
| be?.(j, B), (st.litHtmlVersions ??= []).push("3.3.1"); | ||
| const me = (i, t, e) => { | ||
| const _e = et.litHtmlPolyfillSupport; | ||
| _e?.(j, B), (et.litHtmlVersions ??= []).push("3.3.1"); | ||
| const ve = (r, t, e) => { | ||
| const s = e?.renderBefore ?? t; | ||
| let r = s._$litPart$; | ||
| if (r === void 0) { | ||
| let i = s._$litPart$; | ||
| if (i === void 0) { | ||
| const n = e?.renderBefore ?? null; | ||
| s._$litPart$ = r = new B(t.insertBefore(M(), n), n, void 0, e ?? {}); | ||
| s._$litPart$ = i = new B(t.insertBefore(M(), n), n, void 0, e ?? {}); | ||
| } | ||
| return r._$AI(i), r; | ||
| return i._$AI(r), i; | ||
| }; | ||
| const rt = globalThis; | ||
| const it = globalThis; | ||
| class S extends x { | ||
@@ -985,3 +985,3 @@ constructor() { | ||
| const e = this.render(); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = me(e, this.renderRoot, this.renderOptions); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = ve(e, this.renderRoot, this.renderOptions); | ||
| } | ||
@@ -998,21 +998,21 @@ connectedCallback() { | ||
| } | ||
| 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) => { | ||
| S._$litElement$ = !0, S.finalized = !0, it.litElementHydrateSupport?.({ LitElement: S }); | ||
| const we = it.litElementPolyfillSupport; | ||
| we?.({ LitElement: S }); | ||
| (it.litElementVersions ??= []).push("4.2.1"); | ||
| const rt = (r) => (t, e) => { | ||
| e !== void 0 ? e.addInitializer((() => { | ||
| customElements.define(i, t); | ||
| })) : customElements.define(i, t); | ||
| customElements.define(r, t); | ||
| })) : customElements.define(r, t); | ||
| }; | ||
| 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 Ee = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: tt }, Se = (r = Ee, t, e) => { | ||
| const { kind: s, metadata: i } = e; | ||
| let n = globalThis.litPropertyMetadata.get(i); | ||
| if (n === void 0 && globalThis.litPropertyMetadata.set(i, n = /* @__PURE__ */ 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, i); | ||
| t.set.call(this, h), this.requestUpdate(o, a, r); | ||
| }, init(h) { | ||
| return h !== void 0 && this.C(o, void 0, i, h), h; | ||
| return h !== void 0 && this.C(o, void 0, r, h), h; | ||
| } }; | ||
@@ -1024,3 +1024,3 @@ } | ||
| const a = this[o]; | ||
| t.call(this, h), this.requestUpdate(o, a, i); | ||
| t.call(this, h), this.requestUpdate(o, a, r); | ||
| }; | ||
@@ -1030,10 +1030,10 @@ } | ||
| }; | ||
| 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); | ||
| function p(r) { | ||
| return (t, e) => typeof e == "object" ? Se(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 we = (i) => i ?? u; | ||
| class Et extends Error { | ||
| const Ae = (r) => r ?? u; | ||
| class vt extends Error { | ||
| constructor(t, e) { | ||
@@ -1046,3 +1046,3 @@ super(t), this.name = "TopsortRequestError", this.status = e; | ||
| } | ||
| class Se extends Error { | ||
| class xe extends Error { | ||
| constructor(t, e) { | ||
@@ -1056,15 +1056,15 @@ let s = "Missing "; | ||
| } | ||
| function Ae() { | ||
| function Ce() { | ||
| if (window.TS?.getUserId && typeof window.TS.getUserId == "function") | ||
| return window.TS.getUserId(); | ||
| } | ||
| 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 | ||
| const Pe = () => { | ||
| 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 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); | ||
| async function Te(r, { signal: t, logError: e }) { | ||
| const { device: s } = r, i = window.TS.token, n = window.TS.url || "https://api.topsort.com", o = Ce(); | ||
| o && (r.opaqueUserId = o); | ||
| const h = await fetch(new URL(`${n}/v2/auctions`), { | ||
@@ -1074,8 +1074,8 @@ method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${r}`, | ||
| Authorization: `Bearer ${i}`, | ||
| "Content-Type": "application/json", | ||
| "X-UA": `topsort/banners-0.8.0 (${s})` | ||
| "X-UA": `topsort/banners-0.8.1 (${s})` | ||
| }, | ||
| body: JSON.stringify({ | ||
| auctions: [i] | ||
| auctions: [r] | ||
| }), | ||
@@ -1086,17 +1086,17 @@ signal: t | ||
| const d = await h.json().catch(() => ({})); | ||
| throw new Et(d.message ?? `HTTP ${h.status}`, h.status); | ||
| throw new vt(d.message ?? `HTTP ${h.status}`, h.status); | ||
| } | ||
| const c = (await h.json()).results[0]; | ||
| if (!c) throw new Et("No auction results", h.status); | ||
| if (c.error) | ||
| throw e(c.error), new Error(c.error); | ||
| return c.winners; | ||
| const l = (await h.json()).results[0]; | ||
| if (!l) throw new vt("No auction results", h.status); | ||
| if (l.error) | ||
| throw e(l.error), new Error(l.error); | ||
| return l.winners; | ||
| } | ||
| 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; | ||
| var Ue = Object.defineProperty, y = (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 && Ue(t, e, i), i; | ||
| }; | ||
| const Te = (i) => { | ||
| class t extends i { | ||
| const Oe = (r) => { | ||
| class t extends r { | ||
| constructor() { | ||
@@ -1106,6 +1106,6 @@ super(...arguments), this.width = 0, this.height = 0, this.slotId = "", this.newTab = !1; | ||
| buildAuction(s) { | ||
| const r = xe(), n = { | ||
| const i = Pe(), n = { | ||
| type: "banners", | ||
| slots: s, | ||
| device: r, | ||
| device: i, | ||
| slotId: this.slotId | ||
@@ -1124,3 +1124,3 @@ }; | ||
| emitEvent(s) { | ||
| const r = new CustomEvent("statechange", { | ||
| const i = new CustomEvent("statechange", { | ||
| detail: { slotId: this.slotId, status: s }, | ||
@@ -1130,3 +1130,3 @@ bubbles: !0, | ||
| }); | ||
| this.dispatchEvent(r); | ||
| this.dispatchEvent(i); | ||
| } | ||
@@ -1154,43 +1154,72 @@ } | ||
| }; | ||
| function Ue(i, t, e) { | ||
| if (e) { | ||
| i.setAttribute(e, t); | ||
| return; | ||
| let wt = !1; | ||
| function Re(r) { | ||
| const t = []; | ||
| for (const e of r.split(",")) { | ||
| const s = e.trim(); | ||
| if (!s) continue; | ||
| const i = s.indexOf(":"); | ||
| i === -1 ? t.push({ key: s, target: null }) : t.push({ key: s.slice(0, i), target: s.slice(i + 1) }); | ||
| } | ||
| const s = i.tagName.toLowerCase(); | ||
| s === "a" ? i.setAttribute("href", t) : s === "img" || s === "video" || s === "source" ? i.setAttribute("src", t) : i.textContent = t; | ||
| return t; | ||
| } | ||
| function Ut(i, t) { | ||
| function Et(r, t) { | ||
| if (t) return t; | ||
| const e = r.tagName.toLowerCase(); | ||
| return e === "a" ? "href" : e === "img" || e === "video" || e === "source" ? "src" : "textContent"; | ||
| } | ||
| function ke(r, t, e) { | ||
| return e === "textContent" ? (r.textContent = t, !0) : r.hasAttribute(e) ? (r.setAttribute(e, t), !0) : !1; | ||
| } | ||
| function Ot(r, t) { | ||
| const e = t.asset?.[0]?.content; | ||
| if (e) { | ||
| const r = i.querySelectorAll("[data-ts-field]"); | ||
| for (const n of r) { | ||
| const i = r.querySelectorAll("[data-ts-field]"); | ||
| for (const n of i) { | ||
| const o = n.dataset.tsField; | ||
| o && o in e && Ue(n, e[o], n.dataset.tsAttr); | ||
| if (!o) continue; | ||
| const h = Re(o), a = h.some((l) => l.target !== null); | ||
| for (const { key: l, target: d } of h) { | ||
| if (!(l in e)) continue; | ||
| let c; | ||
| if (!a && d === null) { | ||
| const $ = n.dataset.tsAttr; | ||
| wt || (wt = !0, console.warn( | ||
| '[banners.js] Implicit data-ts-field binding is deprecated. Use explicit "key:target" syntax instead (e.g. data-ts-field="image:src").' | ||
| )), c = Et(n, $ ?? null); | ||
| } else | ||
| c = Et(n, d); | ||
| if (!ke(n, e[l], c)) { | ||
| const $ = n.tagName.toLowerCase(); | ||
| console.warn( | ||
| `[banners.js] Binding "${l}" → "${c}" skipped: <${$}> has no "${c}" attribute. Add a fallback value (e.g. ${c}="...") to your template.` | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| const s = i.querySelector("[data-ts-clickable]") || i.firstElementChild; | ||
| 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 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; | ||
| var Ne = Object.defineProperty, Me = Object.getOwnPropertyDescriptor, g = (r, t, e, s) => { | ||
| for (var i = s > 1 ? void 0 : s ? Me(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 && Ne(t, e, i), i; | ||
| }; | ||
| window.TS_BANNERS = window.TS_BANNERS || {}; | ||
| function ke(i) { | ||
| function Ie(r) { | ||
| } | ||
| function Ne(i) { | ||
| return window.TS_BANNERS.getLink ? window.TS_BANNERS.getLink(i) : i.type === "url" ? i.id : `${i.type}/${i.id}`; | ||
| function je(r) { | ||
| return window.TS_BANNERS.getLink ? window.TS_BANNERS.getLink(r) : r.type === "url" ? r.id : `${r.type}/${r.id}`; | ||
| } | ||
| function Rt() { | ||
| if (window.TS_BANNERS.getLoadingElement) { | ||
| const i = window.TS_BANNERS.getLoadingElement(); | ||
| return f`${i}`; | ||
| const r = window.TS_BANNERS.getLoadingElement(); | ||
| return f`${r}`; | ||
| } | ||
| return f``; | ||
| } | ||
| function N(i) { | ||
| function N(r) { | ||
| if (window.TS_BANNERS.getErrorElement) { | ||
| const t = window.TS_BANNERS.getErrorElement(i); | ||
| const t = window.TS_BANNERS.getErrorElement(r); | ||
| return f`${t}`; | ||
@@ -1200,20 +1229,20 @@ } | ||
| } | ||
| function Ot() { | ||
| function kt() { | ||
| if (window.TS_BANNERS.getNoWinnersElement) { | ||
| const i = window.TS_BANNERS.getNoWinnersElement(); | ||
| return f`${i}`; | ||
| const r = window.TS_BANNERS.getNoWinnersElement(); | ||
| return f`${r}`; | ||
| } | ||
| return f``; | ||
| } | ||
| function V(i, t, e, s) { | ||
| function Nt(r, t, e, s) { | ||
| if (window.TS_BANNERS.getBannerElement) { | ||
| const c = window.TS_BANNERS.getBannerElement(i); | ||
| return f`${c}`; | ||
| const l = window.TS_BANNERS.getBannerElement(r); | ||
| return f`${l}`; | ||
| } | ||
| if (!i.asset?.[0]?.url) | ||
| if (!r.asset?.[0]?.url) | ||
| return f``; | ||
| const r = i.asset[0].url, o = (() => { | ||
| const i = r.asset[0].url, o = (() => { | ||
| try { | ||
| const d = new URL(r).pathname.split("/"), l = d.indexOf("manifest"); | ||
| return l >= 0 ? d[l + 1]?.startsWith("video") ?? !1 : !1; | ||
| const d = new URL(i).pathname.split("/"), c = d.indexOf("manifest"); | ||
| return c >= 0 ? d[c + 1]?.startsWith("video") ?? !1 : !1; | ||
| } catch { | ||
@@ -1224,3 +1253,3 @@ return !1; | ||
| <hls-video | ||
| src="${r}" | ||
| src="${i}" | ||
| width="${t}px" | ||
@@ -1231,11 +1260,11 @@ height="${e}px" | ||
| <img | ||
| src="${r}" | ||
| src="${i}" | ||
| alt="Topsort banner" | ||
| style="width:${t}px; height:${e}px; object-fit:cover;" | ||
| /> | ||
| `, h = Ne(i), a = s ? f`<a href="${h}" target="_blank">${o}</a>` : f`<a href="${h}">${o}</a>`; | ||
| `, h = je(r), 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=${we(i.isFallback ? void 0 : i.resolvedBidId)} | ||
| data-ts-resolved-bid=${Ae(r.isFallback ? void 0 : r.resolvedBidId)} | ||
| class="ts-banner" | ||
@@ -1247,7 +1276,7 @@ > | ||
| } | ||
| 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) { | ||
| const Mt = /* @__PURE__ */ Symbol("banner-context"), He = (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 T = class extends Oe(S) { | ||
| constructor() { | ||
| 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) => { | ||
| super(...arguments), this.task = new Gt(this, { | ||
| task: ([r], t) => Te(this.buildAuction(r), { ...t, logError: Ie }).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; | ||
@@ -1260,11 +1289,11 @@ }), | ||
| newTab: this.newTab | ||
| }, this.isContext = !1, this.predefined = !1, this._prevTaskStatus = m.INITIAL; | ||
| }, this.isContext = !1, this.predefined = !1, this._prevTaskStatus = _.INITIAL; | ||
| } | ||
| render() { | ||
| 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({ | ||
| return !window.TS.token || !this.slotId ? N(new xe(window.TS.token, this.slotId)) : this.isContext ? f`` : this.predefined ? u : this.task.render({ | ||
| pending: () => Rt(), | ||
| complete: (i) => { | ||
| if (!i.length) | ||
| return Ot(); | ||
| if (i[0].asset?.[0]?.content) { | ||
| complete: (r) => { | ||
| if (!r.length) | ||
| return kt(); | ||
| if (r[0].asset?.[0]?.content) { | ||
| const t = new Error( | ||
@@ -1275,21 +1304,26 @@ "Banner has predefined content but component is not in predefined mode" | ||
| } | ||
| return V(i[0], this.width, this.height, this.newTab); | ||
| return Nt(r[0], this.width, this.height, this.newTab); | ||
| }, | ||
| error: (i) => N(i) | ||
| error: (r) => N(r) | ||
| }); | ||
| } | ||
| updated(i) { | ||
| super.updated(i); | ||
| updated(r) { | ||
| super.updated(r); | ||
| 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(() => { | ||
| if (this.predefined && t !== _.COMPLETE && e === _.COMPLETE) | ||
| if (s.length && s[0].asset?.[0]?.content) | ||
| try { | ||
| Ot(this, s[0]); | ||
| } catch { | ||
| } | ||
| else s.length && console.warn( | ||
| `[topsort-banner] Predefined mode is set but the auction response for slot "${this.slotId}" contains no content map. Template was not mutated.` | ||
| ); | ||
| this.isContext || (t !== _.COMPLETE && e === _.COMPLETE ? this.emitEvent(s.length ? "ready" : "nowinners") : t !== _.ERROR && e === _.ERROR && this.emitEvent("error")), this.isContext && !r.has("slots") && Promise.resolve().then(() => { | ||
| this.slots = this.renderRoot.querySelectorAll("topsort-banner-slot"); | ||
| }), 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(() => { | ||
| }), r.has("width") && this.style.setProperty("--ts-banner-width", `${this.width}px`), r.has("height") && this.style.setProperty("--ts-banner-height", `${this.height}px`), (r.has("width") || r.has("height") || r.has("newTab")) && Promise.resolve().then(() => { | ||
| this.context = { | ||
| ...this.context, | ||
| width: this.width, | ||
@@ -1306,17 +1340,17 @@ height: this.height, | ||
| }; | ||
| $([ | ||
| It({ context: kt }), | ||
| p({ attribute: !1, hasChanged: Me }) | ||
| g([ | ||
| Ht({ context: Mt }), | ||
| p({ attribute: !1, hasChanged: He }) | ||
| ], T.prototype, "context", 2); | ||
| $([ | ||
| g([ | ||
| p({ type: Boolean, attribute: "context" }) | ||
| ], T.prototype, "isContext", 2); | ||
| $([ | ||
| g([ | ||
| p({ type: Boolean }) | ||
| ], T.prototype, "predefined", 2); | ||
| $([ | ||
| g([ | ||
| p({ attribute: !1, state: !0 }) | ||
| ], T.prototype, "slots", 2); | ||
| T = $([ | ||
| nt("topsort-banner") | ||
| T = g([ | ||
| rt("topsort-banner") | ||
| ], T); | ||
@@ -1332,11 +1366,4 @@ let H = class extends S { | ||
| render() { | ||
| 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.predefined) | ||
| return u; | ||
| if (!this.context) | ||
@@ -1349,5 +1376,5 @@ return f``; | ||
| 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) { | ||
| return kt(); | ||
| const r = this.context.banners[this.rank - 1]; | ||
| if (r.asset?.[0]?.content) { | ||
| const t = new Error( | ||
@@ -1358,12 +1385,15 @@ "Banner has predefined content but component is not in predefined mode" | ||
| } | ||
| return V(i, this.context.width, this.context.height, this.context.newTab); | ||
| return Nt(r, 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) { | ||
| updated(r) { | ||
| if (super.updated(r), this.predefined && r.has("context") && !r.get("context")?.banners && !!this.context?.banners) { | ||
| const s = this._bannerForRank(); | ||
| if (s?.asset?.[0]?.content) | ||
| try { | ||
| Ut(this, s); | ||
| Ot(this, s); | ||
| } catch { | ||
| } | ||
| else s && console.warn( | ||
| `[topsort-banner-slot] Predefined mode is set but the auction response for rank ${this.rank} contains no content map. Template was not mutated.` | ||
| ); | ||
| } | ||
@@ -1376,14 +1406,14 @@ } | ||
| }; | ||
| $([ | ||
| jt({ context: kt, subscribe: !0 }), | ||
| g([ | ||
| Lt({ context: Mt, subscribe: !0 }), | ||
| p({ attribute: !1 }) | ||
| ], H.prototype, "context", 2); | ||
| $([ | ||
| g([ | ||
| p({ attribute: "rank", type: Number }) | ||
| ], H.prototype, "rank", 2); | ||
| $([ | ||
| g([ | ||
| p({ type: Boolean }) | ||
| ], H.prototype, "predefined", 2); | ||
| H = $([ | ||
| nt("topsort-banner-slot") | ||
| H = g([ | ||
| rt("topsort-banner-slot") | ||
| ], H); | ||
@@ -1414,7 +1444,7 @@ let L = class extends S { | ||
| async firstUpdated() { | ||
| const i = this.shadowRoot?.getElementById(this.videoId); | ||
| if (!i) return; | ||
| const r = this.shadowRoot?.getElementById(this.videoId); | ||
| if (!r) return; | ||
| let t; | ||
| try { | ||
| t = await Ie(); | ||
| t = await Le(); | ||
| } catch (s) { | ||
@@ -1429,27 +1459,27 @@ console.error("Failed to load HLS.js:", s); | ||
| const e = new t(); | ||
| e.loadSource(this.src), e.attachMedia(i), e.on(t.Events.MANIFEST_PARSED, () => { | ||
| i.play().catch((s) => console.warn("Autoplay failed:", s)); | ||
| e.loadSource(this.src), e.attachMedia(r), e.on(t.Events.MANIFEST_PARSED, () => { | ||
| r.play().catch((s) => console.warn("Autoplay failed:", s)); | ||
| }); | ||
| } | ||
| }; | ||
| $([ | ||
| g([ | ||
| p({ type: String }) | ||
| ], L.prototype, "src", 2); | ||
| $([ | ||
| g([ | ||
| p({ type: String }) | ||
| ], L.prototype, "width", 2); | ||
| $([ | ||
| g([ | ||
| p({ type: String }) | ||
| ], L.prototype, "height", 2); | ||
| L = $([ | ||
| nt("hls-video") | ||
| L = g([ | ||
| rt("hls-video") | ||
| ], L); | ||
| let E = null; | ||
| function Ie() { | ||
| return E || (window.Hls ? (E = Promise.resolve(window.Hls), E) : (E = new Promise((i, t) => { | ||
| let w = null; | ||
| function Le() { | ||
| return w || (window.Hls ? (w = Promise.resolve(window.Hls), w) : (w = 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 ? 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)); | ||
| 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 w = null, r; | ||
| }), w)); | ||
| } | ||
@@ -1456,0 +1486,0 @@ export { |
+8
-8
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@topsort/banners", | ||
| "version": "0.8.0", | ||
| "version": "0.8.1", | ||
| "description": "A web component for displaying Topsort banner ads.", | ||
| "type": "module", | ||
| "author": "Topsort", | ||
| "packageManager": "pnpm@10.23.0", | ||
| "packageManager": "pnpm@10.30.3", | ||
| "repository": { | ||
@@ -57,12 +57,12 @@ "url": "https://github.com/Topsort/banners.js" | ||
| "devDependencies": { | ||
| "@biomejs/biome": "2.3.7", | ||
| "@biomejs/biome": "2.4.4", | ||
| "@playwright/test": "^1.58.2", | ||
| "@size-limit/file": "^11.1.6", | ||
| "@types/node": "24.10.1", | ||
| "@size-limit/file": "^12.0.0", | ||
| "@types/node": "24.11.0", | ||
| "@vitest/coverage-v8": "^4.0.18", | ||
| "jsdom": "^28.1.0", | ||
| "size-limit": "^11.1.6", | ||
| "size-limit": "^12.0.0", | ||
| "skeleton-webcomponent-loader": "2.1.4", | ||
| "typescript": "5.9.3", | ||
| "vite": "7.2.4", | ||
| "vite": "7.3.1", | ||
| "vite-plugin-dts": "4.5.4", | ||
@@ -74,3 +74,3 @@ "vitest": "^4.0.18" | ||
| "@lit/task": "1.0.3", | ||
| "lit": "3.3.1" | ||
| "lit": "3.3.2" | ||
| }, | ||
@@ -77,0 +77,0 @@ "size-limit": [ |
+46
-12
@@ -85,2 +85,4 @@ [](https://github.com/Topsort/banners.js/actions/workflows/test.yml) | ||
| > **Sizing is your responsibility.** banners.js only fills in content fields and telemetry attributes — it never writes `width`, `height`, or any other style to your template elements. Set dimensions with your own CSS or HTML attributes (see examples below). | ||
| Opt in by adding the `predefined` attribute to `<topsort-banner>` (standalone) or to each `<topsort-banner-slot>` (context mode). | ||
@@ -90,4 +92,32 @@ | ||
| 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: | ||
| Use `data-ts-field` to bind content keys from the auction response to element attributes or text. | ||
| #### Explicit binding (recommended) | ||
| Use `key:target` syntax to specify exactly which content key maps to which attribute: | ||
| ```html | ||
| <img data-ts-field="mainImage:src" src="/fallback.jpg" /> | ||
| <a data-ts-field="target:href" href="/fallback">Click</a> | ||
| <span data-ts-field="headline:textContent">Default headline</span> | ||
| ``` | ||
| Use `textContent` as the target to set the element's text content. | ||
| The target attribute **must already exist** on the element — banners.js only overwrites existing attributes, never creates them. If a binding targets an attribute that doesn't exist, it is skipped and a warning is logged. This catches typos and ensures your template always has fallback values for graceful degradation when the auction fails or returns no winners. | ||
| #### Multiple bindings | ||
| Comma-separate multiple `key:target` pairs to set several attributes on one element: | ||
| ```html | ||
| <img data-ts-field="mainImage:src, altText:alt" src="/fallback.jpg" alt="Fallback" /> | ||
| ``` | ||
| If the auction response only includes some keys, only matching bindings are applied — unmatched attributes keep their original values. | ||
| #### Implicit binding (legacy) | ||
| A bare key (without `:target`) infers the target from the element type: | ||
| | Element | Property set | | ||
@@ -99,4 +129,8 @@ |---|---| | ||
| Use `data-ts-attr="<attributeName>"` to override the default and target a specific attribute (e.g. `alt` on an `<img>`). | ||
| `data-ts-attr="<attributeName>"` can override the default target for bare keys. | ||
| > Implicit binding still works but is deprecated. Prefer explicit `key:target` syntax for clarity and to avoid tag-based inference surprises. | ||
| #### Click tracking | ||
| 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. | ||
@@ -109,7 +143,7 @@ | ||
| <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" | ||
| <a data-ts-field="target:href" href="/brands/featured" aria-label="Featured Brand"> | ||
| <img data-ts-field="mainImage:src, altText:alt" 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> | ||
| <h2 data-ts-field="default-Headline:textContent">Featured Brand</h2> | ||
| </div> | ||
@@ -122,9 +156,9 @@ </topsort-banner> | ||
| ```html | ||
| <topsort-banner context="true" width="600" height="400" id="slot-1"> | ||
| <topsort-banner context 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 data-ts-field="target:href" href="/default-1"> | ||
| <img data-ts-field="mainImage:src" src="/default-1.jpg" width="600" height="400" /> | ||
| </a> | ||
| <h3 data-ts-field="default-Headline">Default Product 1</h3> | ||
| <h3 data-ts-field="default-Headline:textContent">Default Product 1</h3> | ||
| </div> | ||
@@ -134,6 +168,6 @@ </topsort-banner-slot> | ||
| <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 data-ts-field="target:href" href="/default-2"> | ||
| <img data-ts-field="mainImage:src" src="/default-2.jpg" width="600" height="400" /> | ||
| </a> | ||
| <h3 data-ts-field="default-Headline">Default Product 2</h3> | ||
| <h3 data-ts-field="default-Headline:textContent">Default Product 2</h3> | ||
| </div> | ||
@@ -140,0 +174,0 @@ </topsort-banner-slot> |
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
325333
3.27%1672
1.95%306
12.5%6
-14.29%