You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@topsort/banners

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@topsort/banners - npm Package Compare versions

Comparing version
0.6.0
to
0.7.0
+32
dist/banners.iife.js
var banners=(function(u){"use strict";let et=class extends Event{constructor(t,e,s,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=s,this.subscribe=i??!1}};function Oe(r){return r}let st=class{constructor(t,e,s,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){const o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=s,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new et(this.context,this.host,this.t,this.subscribe))}};let Tt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const s=e||!Object.is(t,this.o);this.o=t,s&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:s}]of this.subscriptions)e(this.o,s)},t!==void 0&&(this.value=t)}addCallback(t,e,s){if(!s)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};let Ut=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},it=class extends Tt{constructor(t,e,s){super(e.context!==void 0?e.initialValue:s),this.onContextRequest=i=>{if(i.context!==this.context)return;const o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;const o=new Set;for(const[n,{consumerHost:h}]of this.subscriptions)o.has(n)||(o.add(n),h.dispatchEvent(new et(this.context,h,n,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ut(this.context,this.host))}};function Ot({context:r}){return(t,e)=>{const s=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return s.get(this).setValue(i),t.set.call(this,i)},init(i){return s.set(this,new it(this,{context:r,initialValue:i})),i}};{t.constructor.addInitializer((n=>{s.set(n,new it(n,{context:r}))}));const i=Object.getOwnPropertyDescriptor(t,e);let o;if(i===void 0){const n=new WeakMap;o={get(){return n.get(this)},set(h){s.get(this).setValue(h),n.set(this,h)},configurable:!0,enumerable:!0}}else{const n=i.set;o={...i,set(h){s.get(this).setValue(h),n?.call(this,h)}}}return void Object.defineProperty(t,e,o)}}}function Rt({context:r,subscribe:t}){return(e,s)=>{typeof s=="object"?s.addInitializer((function(){new st(this,{context:r,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new st(i,{context:r,callback:o=>{i[s]=o},subscribe:t})}))}}const H=globalThis,W=H.ShadowRoot&&(H.ShadyCSS===void 0||H.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rt=Symbol(),ot=new WeakMap;let Nt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==rt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(W&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=ot.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ot.set(e,t))}return t}toString(){return this.cssText}};const kt=r=>new Nt(typeof r=="string"?r:r+"",void 0,rt),Mt=(r,t)=>{if(W)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const s=document.createElement("style"),i=H.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},nt=W?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return kt(e)})(r):r;const{is:Ht,defineProperty:jt,getOwnPropertyDescriptor:Bt,getOwnPropertyNames:It,getOwnPropertySymbols:Lt,getPrototypeOf:qt}=Object,j=globalThis,ht=j.trustedTypes,Dt=ht?ht.emptyScript:"",zt=j.reactiveElementPolyfillSupport,x=(r,t)=>r,V={toAttribute(r,t){switch(t){case Boolean:r=r?Dt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},K=(r,t)=>!Ht(r,t),at={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:K};Symbol.metadata??=Symbol("metadata"),j.litPropertyMetadata??=new WeakMap;let T=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=at){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&jt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=Bt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return i?.call(this)},set(n){const h=i?.call(this);o.call(this,n),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??at}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=qt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const e=this.properties,s=[...It(e),...Lt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(nt(i))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Mt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(s.converter?.toAttribute!==void 0?s.converter:V).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:V;this._$Em=i,this[i]=n.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??K)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s)o.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[x("elementProperties")]=new Map,T[x("finalized")]=new Map,zt?.({ReactiveElement:T}),(j.reactiveElementVersions??=[]).push("2.0.4");const Wt=Symbol();let Vt=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);const i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??Kt,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;const t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){const t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();const i=++this.p;this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){o=!0,s=n}if(this.p===i){if(e===Wt)this.i=0;else{if(o===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}};const Kt=(r,t)=>r===t||r.length===t.length&&r.every(((e,s)=>!K(e,t[s])));const B=globalThis,F=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ct=Symbol(),lt=new WeakMap;let Ft=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ct)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(F&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=lt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&lt.set(e,t))}return t}toString(){return this.cssText}};const Jt=r=>new Ft(typeof r=="string"?r:r+"",void 0,ct),Qt=(r,t)=>{if(F)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const s=document.createElement("style"),i=B.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},dt=F?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Jt(e)})(r):r;const{is:Zt,defineProperty:Xt,getOwnPropertyDescriptor:Gt,getOwnPropertyNames:Yt,getOwnPropertySymbols:te,getPrototypeOf:ee}=Object,I=globalThis,ut=I.trustedTypes,se=ut?ut.emptyScript:"",ie=I.reactiveElementPolyfillSupport,U=(r,t)=>r,L={toAttribute(r,t){switch(t){case Boolean:r=r?se:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},J=(r,t)=>!Zt(r,t),pt={attribute:!0,type:String,converter:L,reflect:!1,useDefault:!1,hasChanged:J};Symbol.metadata??=Symbol("metadata"),I.litPropertyMetadata??=new WeakMap;let A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=pt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Xt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=Gt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){const h=i?.call(this);o?.call(this,n),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??pt}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=ee(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const e=this.properties,s=[...Yt(e),...te(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(dt(i))}else t!==void 0&&e.push(dt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(s.converter?.toAttribute!==void 0?s.converter:L).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:L;this._$Em=i;const h=n.fromAttribute(e,o.type);this[i]=h??this._$Ej?.get(i)??h,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??J)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:n}=o,h=this[i];n!==!0||this._$AL.has(i)||h===void 0||this.C(i,void 0,o,h)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[U("elementProperties")]=new Map,A[U("finalized")]=new Map,ie?.({ReactiveElement:A}),(I.reactiveElementVersions??=[]).push("2.1.1");const Q=globalThis,q=Q.trustedTypes,ft=q?q.createPolicy("lit-html",{createHTML:r=>r}):void 0,$t="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,gt="?"+b,re=`<${gt}>`,v=document,O=()=>v.createComment(""),R=r=>r===null||typeof r!="object"&&typeof r!="function",Z=Array.isArray,oe=r=>Z(r)||typeof r?.[Symbol.iterator]=="function",X=`[
\f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yt=/-->/g,mt=/>/g,w=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),bt=/'/g,_t=/"/g,vt=/^(?:script|style|textarea|title)$/i,ne=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),$=ne(1),P=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),wt=new WeakMap,E=v.createTreeWalker(v,129);function Et(r,t){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ft!==void 0?ft.createHTML(t):t}const he=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",n=N;for(let h=0;h<e;h++){const a=r[h];let c,d,l=-1,y=0;for(;y<a.length&&(n.lastIndex=y,d=n.exec(a),d!==null);)y=n.lastIndex,n===N?d[1]==="!--"?n=yt:d[1]!==void 0?n=mt:d[2]!==void 0?(vt.test(d[2])&&(i=RegExp("</"+d[2],"g")),n=w):d[3]!==void 0&&(n=w):n===w?d[0]===">"?(n=i??N,l=-1):d[1]===void 0?l=-2:(l=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?w:d[3]==='"'?_t:bt):n===_t||n===bt?n=w:n===yt||n===mt?n=N:(n=w,i=void 0);const _=n===w&&r[h+1].startsWith("/>")?" ":"";o+=n===N?a+re:l>=0?(s.push(c),a.slice(0,l)+$t+a.slice(l)+b+_):a+b+(l===-2?h:_)}return[Et(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class k{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const h=t.length-1,a=this.parts,[c,d]=he(t,e);if(this.el=k.createElement(c,s),E.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=E.nextNode())!==null&&a.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const l of i.getAttributeNames())if(l.endsWith($t)){const y=d[n++],_=i.getAttribute(l).split(b),z=/([.?@])?(.*)/.exec(y);a.push({type:1,index:o,name:z[2],strings:_,ctor:z[1]==="."?ce:z[1]==="?"?le:z[1]==="@"?de:D}),i.removeAttribute(l)}else l.startsWith(b)&&(a.push({type:6,index:o}),i.removeAttribute(l));if(vt.test(i.tagName)){const l=i.textContent.split(b),y=l.length-1;if(y>0){i.textContent=q?q.emptyScript:"";for(let _=0;_<y;_++)i.append(l[_],O()),E.nextNode(),a.push({type:2,index:++o});i.append(l[y],O())}}}else if(i.nodeType===8)if(i.data===gt)a.push({type:2,index:o});else{let l=-1;for(;(l=i.data.indexOf(b,l+1))!==-1;)a.push({type:7,index:o}),l+=b.length-1}o++}}static createElement(t,e){const s=v.createElement("template");return s.innerHTML=t,s}}function C(r,t,e=r,s){if(t===P)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl;const o=R(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=C(r,i._$AS(r,t.values),i,s)),t}class ae{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??v).importNode(e,!0);E.currentNode=i;let o=E.nextNode(),n=0,h=0,a=s[0];for(;a!==void 0;){if(n===a.index){let c;a.type===2?c=new M(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new ue(o,this,t)),this._$AV.push(c),a=s[++h]}n!==a?.index&&(o=E.nextNode(),n++)}return E.currentNode=v,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=C(this,t,e),R(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):oe(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(v.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=k.createElement(Et(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const o=new ae(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=wt.get(t.strings);return e===void 0&&wt.set(t.strings,e=new k(t)),e}k(t){Z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new M(this.O(O()),this.O(O()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class D{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=C(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==P,n&&(this._$AH=t);else{const h=t;let a,c;for(t=o[0],a=0;a<o.length-1;a++)c=C(this,h[s+a],e,a),c===P&&(c=this._$AH[a]),n||=!R(c)||c!==this._$AH[a],c===p?t=p:t!==p&&(t+=(c??"")+o[a+1]),this._$AH[a]=c}n&&!i&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ce extends D{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}class le extends D{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}}class de extends D{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=C(this,t,e,0)??p)===P)return;const s=this._$AH,i=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==p&&(s===p||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ue{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){C(this,t)}}const pe=Q.litHtmlPolyfillSupport;pe?.(k,M),(Q.litHtmlVersions??=[]).push("3.3.1");const fe=(r,t,e)=>{const s=e?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const o=e?.renderBefore??null;s._$litPart$=i=new M(t.insertBefore(O(),o),o,void 0,e??{})}return i._$AI(r),i};const G=globalThis;class S extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=fe(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}}S._$litElement$=!0,S.finalized=!0,G.litElementHydrateSupport?.({LitElement:S});const $e=G.litElementPolyfillSupport;$e?.({LitElement:S}),(G.litElementVersions??=[]).push("4.2.1");const Y=r=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(r,t)})):customElements.define(r,t)};const ge={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:J},ye=(r=ge,t,e)=>{const{kind:s,metadata:i}=e;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(e.name,r),s==="accessor"){const{name:n}=e;return{set(h){const a=t.get.call(this);t.set.call(this,h),this.requestUpdate(n,a,r)},init(h){return h!==void 0&&this.C(n,void 0,r,h),h}}}if(s==="setter"){const{name:n}=e;return function(h){const a=this[n];t.call(this,h),this.requestUpdate(n,a,r)}}throw Error("Unsupported decorator location: "+s)};function f(r){return(t,e)=>typeof e=="object"?ye(r,t,e):((s,i,o)=>{const n=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),n?Object.getOwnPropertyDescriptor(i,o):void 0})(r,t,e)}class me extends Error{constructor(t,e){super(t),this.name="TopsortRequestError",this.status=e}static isTopsortRequestError(t){return t.name==="TopsortRequestError"}}class be extends Error{constructor(t,e){let s="Missing ";!e&&!t?s+="API Key and Slot ID":e?t||(s+="API Key"):s+="Slot ID",super(s),this.name="TopsortConfigurationError"}static isTopsortConfigurationError(t){return t.name==="TopsortConfigurationError"}}function _e(){if(window.TS?.getUserId&&typeof window.TS.getUserId=="function")return window.TS.getUserId()}const St=()=>{const r=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(r)||/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(r)?"mobile":"desktop"};async function ve(r,{signal:t,logError:e}){const s=St(),i=window.TS.token,o=window.TS.url||"https://api.topsort.com",n=_e();n&&(r.opaqueUserId=n);const h=await fetch(new URL(`${o}/v2/auctions`),{method:"POST",mode:"cors",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-UA":`topsort/banners-0.7.0 (${s})`},body:JSON.stringify({auctions:[r]}),signal:t});if(!h.ok){const d=await h.json();throw new Error(d.message)}const c=(await h.json()).results[0];if(!c)throw new me("No auction results",h.status);if(c.error)throw e(c.error),new Error(c.error);return c.winners}var we=Object.defineProperty,m=(r,t,e,s)=>{for(var i=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=n(t,e,i)||i);return i&&we(t,e,i),i};const Ee=r=>{class t extends r{constructor(){super(...arguments),this.width=0,this.height=0,this.slotId="",this.newTab=!1}buildAuction(s){const i=St(),o={type:"banners",slots:s,device:i,slotId:this.slotId};return this.categoryId?o.category={id:this.categoryId}:this.categoryIds?o.category={ids:this.categoryIds.split(",").map(n=>n.trim())}:this.categoryDisjunctions?o.category={disjunctions:[this.categoryDisjunctions.split(",").map(n=>n.trim())]}:this.searchQuery&&(o.searchQuery=this.searchQuery),this.location&&(o.geoTargeting={location:this.location}),o}emitEvent(s){const i=new CustomEvent("statechange",{detail:{slotId:this.slotId,status:s},bubbles:!0,composed:!0});this.dispatchEvent(i)}}return m([f({type:Number})],t.prototype,"width"),m([f({type:Number})],t.prototype,"height"),m([f({attribute:"id",type:String})],t.prototype,"slotId"),m([f({attribute:"category-id",type:String})],t.prototype,"categoryId"),m([f({attribute:"category-ids",type:String})],t.prototype,"categoryIds"),m([f({attribute:"category-disjunctions",type:String})],t.prototype,"categoryDisjunctions"),m([f({attribute:"search-query",type:String})],t.prototype,"searchQuery"),m([f({attribute:"location",type:String})],t.prototype,"location"),m([f({attribute:"new-tab",type:Boolean})],t.prototype,"newTab"),t};var Se=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,g=(r,t,e,s)=>{for(var i=s>1?void 0:s?Ae(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&Se(t,e,i),i};window.TS_BANNERS=window.TS_BANNERS||{};function Pe(r){}function Ce(r){return window.TS_BANNERS.getLink?window.TS_BANNERS.getLink(r):r.type==="url"?r.id:`${r.type}/${r.id}`}function At(){if(window.TS_BANNERS.getLoadingElement){const r=window.TS_BANNERS.getLoadingElement();return $`${r}`}return $``}function tt(r){if(window.TS_BANNERS.getErrorElement){const t=window.TS_BANNERS.getErrorElement(r);return $`${t}`}return $``}function Pt(){if(window.TS_BANNERS.getNoWinnersElement){const r=window.TS_BANNERS.getNoWinnersElement();return $`${r}`}return $``}function Ct(r,t,e,s){if(window.TS_BANNERS.getBannerElement){const c=window.TS_BANNERS.getBannerElement(r);return $`${c}`}if(!r.asset?.[0]?.url)return $``;const i=r.asset[0].url,n=(()=>{try{const d=new URL(i).pathname.split("/"),l=d.indexOf("manifest");return l>=0?d[l+1]?.startsWith("video")??!1:!1}catch{return!1}})()?$`
<hls-video
src="${i}"
width="${t}px"
height="${e}px"
></hls-video>
`:$`
<img
src="${i}"
alt="Topsort banner"
style="width:${t}px; height:${e}px; object-fit:cover;"
/>
`,h=Ce(r),a=s?$`<a href="${h}" target="_blank">${n}</a>`:$`<a href="${h}">${n}</a>`;return $`
<div
data-ts-clickable
data-ts-resolved-bid=${r.resolvedBidId}
class="ts-banner"
>
${a}
</div>
`}const xt=Symbol("banner-context"),xe=(r,t)=>!t&&r?!0:r==null||t==null?!1:r.width!==t.width||r.height!==t.height||r.newTab!==t.newTab||!!r.error!=!!t.error||r.banners?.length!==t.banners?.length;u.TopsortBanner=class extends Ee(S){constructor(){super(...arguments),this.task=new Vt(this,{task:([t],e)=>ve(this.buildAuction(t),{...e,logError:Pe}).then(s=>(e.signal.throwIfAborted(),this.isContext&&(this.context={...this.context,banners:s}),s)).catch(s=>{throw e.signal.throwIfAborted(),this.isContext&&(this.context={...this.context,error:s}),s}),args:()=>[this.slots?.length||1]}),this.context={width:this.width,height:this.height,newTab:this.newTab},this.isContext=!1}render(){return!window.TS.token||!this.slotId?tt(new be(window.TS.token,this.slotId)):this.isContext?$``:this.task.render({pending:()=>At(),complete:t=>(this.emitEvent(t.length?"ready":"nowinners"),t.length?Ct(t[0],this.width,this.height,this.newTab):Pt()),error:t=>tt(t)})}updated(t){super.updated(t),this.isContext&&!t.has("slots")&&Promise.resolve().then(()=>{this.slots=this.renderRoot.querySelectorAll("topsort-banner-slot")}),(t.has("width")||t.has("height")||t.has("newTab"))&&Promise.resolve().then(()=>{this.context={width:this.width,height:this.height,newTab:this.newTab}})}createRenderRoot(){return this}},g([Ot({context:xt}),f({attribute:!1,hasChanged:xe})],u.TopsortBanner.prototype,"context",2),g([f({type:Boolean,attribute:"context"})],u.TopsortBanner.prototype,"isContext",2),g([f({attribute:!1,state:!0})],u.TopsortBanner.prototype,"slots",2),u.TopsortBanner=g([Y("topsort-banner")],u.TopsortBanner),u.TopsortBannerSlot=class extends S{constructor(){super(...arguments),this.rank=0}render(){return this.context?this.context.banners?this.context.error?tt(this.context.error):!this.context.banners.length||this.context.banners.length<this.rank?Pt():Ct(this.context.banners[this.rank-1],this.context.width,this.context.height,this.context.newTab):At():$``}createRenderRoot(){return this}},g([Rt({context:xt,subscribe:!0}),f({attribute:!1})],u.TopsortBannerSlot.prototype,"context",2),g([f({attribute:"rank",type:Number})],u.TopsortBannerSlot.prototype,"rank",2),u.TopsortBannerSlot=g([Y("topsort-banner-slot")],u.TopsortBannerSlot),u.HlsVideo=class extends S{constructor(){super(...arguments),this.src="",this.width="800px",this.height="400px"}get videoId(){try{return new URL(this.src).pathname.split("/")[1]}catch{return"hls-video"}}render(){return $`
<video
id="${this.videoId}"
muted
autoplay
loop
playsinline
></video>
`}async firstUpdated(){const t=this.shadowRoot?.getElementById(this.videoId);if(!t)return;t.style.width=this.width,t.style.height=this.height,t.style.objectFit="cover";let e;try{e=await Ue.load()}catch(i){console.error("Failed to load HLS.js:",i);return}if(!e){console.error("HLS.js not available after load");return}const s=new e;s.loadSource(this.src),s.attachMedia(t),s.on(e.Events.MANIFEST_PARSED,()=>{t.play().catch(i=>console.warn("Autoplay failed:",i))})}},g([f({type:String})],u.HlsVideo.prototype,"src",2),g([f({type:String})],u.HlsVideo.prototype,"width",2),g([f({type:String})],u.HlsVideo.prototype,"height",2),u.HlsVideo=g([Y("hls-video")],u.HlsVideo);class Te{constructor(){this.loadPromise=null}load(){return this.loadPromise?this.loadPromise:window.Hls?(this.loadPromise=Promise.resolve(window.Hls),this.loadPromise):(this.loadPromise=new Promise((t,e)=>{const s=document.createElement("script");s.src="https://cdn.jsdelivr.net/npm/hls.js@1.6.13/dist/hls.min.js",s.onload=()=>{window.Hls?t(window.Hls):e(new Error("HLS.js loaded but not available"))},s.onerror=()=>{e(new Error("Failed to load HLS.js"))},document.head.appendChild(s)}).catch(t=>{throw this.loadPromise=null,t}),this.loadPromise)}}const Ue=new Te;return Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u})({});
//# sourceMappingURL=banners.iife.js.map

Sorry, the diff of this file is too big to display

+4
-0

@@ -0,1 +1,5 @@

### 0.7.0
- Add IIFE bundle for legacy systems that don't support ES modules (e.g., Magento)
### 0.6.0

@@ -2,0 +6,0 @@

+1
-1

@@ -1012,3 +1012,3 @@ let _t = class extends Event {

"Content-Type": "application/json",
"X-UA": `topsort/banners-0.6.0 (${s})`
"X-UA": `topsort/banners-0.7.0 (${s})`
},

@@ -1015,0 +1015,0 @@ body: JSON.stringify({

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@topsort/banners",
"version": "0.6.0",
"version": "0.7.0",
"description": "A web component for displaying Topsort banner ads.",

@@ -30,2 +30,5 @@ "type": "module",

"types": "./types/index.d.ts"
},
"./iife": {
"default": "./dist/banners.iife.js"
}

@@ -32,0 +35,0 @@ },

@@ -16,3 +16,3 @@ ![version](https://img.shields.io/npm/v/@topsort/banners)

type="module"
src="https://unpkg.com/@topsort/banners@0.6.0/dist/banners.mjs"
src="https://unpkg.com/@topsort/banners/dist/banners.mjs"
></script>

@@ -50,2 +50,15 @@ <script async type="module" src="https://unpkg.com/@topsort/analytics.js"></script>

## Legacy Systems (IIFE Bundle)
For environments that don't support ES modules (e.g., Magento), use the IIFE bundle:
```html
<script src="https://unpkg.com/@topsort/banners/dist/banners.iife.js"></script>
```
| Bundle | Size | Size (gzip) |
|--------|------|-------------|
| `banners.mjs` (ES module) | 38.71 kB | 11.17 kB |
| `banners.iife.js` (IIFE) | 29.93 kB | 10.13 kB |
## Rendering multiple banners with one slot ID

@@ -52,0 +65,0 @@