@telia-ace/widget-site 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -2,17 +2,17 @@
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const j=globalThis,J=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,at=Symbol(),F=new WeakMap;let ut=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==at)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=F.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&F.set(e,t))}return t}toString(){return this.cssText}};const $t=r=>new ut(typeof r=="string"?r:r+"",void 0,at),_t=(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)}},G=J?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return $t(e)})(r):r;/**
5
+ */const j=globalThis,J=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,at=Symbol(),F=new WeakMap;let ut=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==at)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=F.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&F.set(e,t))}return t}toString(){return this.cssText}};const $t=n=>new ut(typeof n=="string"?n:n+"",void 0,at),_t=(n,t)=>{if(J)n.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,n.appendChild(s)}},G=J?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return $t(e)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:ft,defineProperty:gt,getOwnPropertyDescriptor:mt,getOwnPropertyNames:yt,getOwnPropertySymbols:At,getPrototypeOf:wt}=Object,f=globalThis,Q=f.trustedTypes,vt=Q?Q.emptyScript:"",W=f.reactiveElementPolyfillSupport,C=(r,t)=>r,k={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}},K=(r,t)=>!ft(r,t),Y={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:K};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),f.litPropertyMetadata??(f.litPropertyMetadata=new WeakMap);class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Y){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&&gt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=mt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const a=i==null?void 0:i.call(this);n.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Y}static _$Ei(){if(this.hasOwnProperty(C("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(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){const e=this.properties,s=[...yt(e),...At(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(G(i))}else t!==void 0&&e.push(G(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(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.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 _t(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var n;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(((n=s.converter)==null?void 0:n.toAttribute)!==void 0?s.converter:k).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){var n;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:k;this._$Em=i,this[i]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(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??(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(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(i=>{var n;return(n=i.hostUpdate)==null?void 0:n.call(i)}),this.update(e)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),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=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[C("elementProperties")]=new Map,b[C("finalized")]=new Map,W==null||W({ReactiveElement:b}),(f.reactiveElementVersions??(f.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:ft,defineProperty:gt,getOwnPropertyDescriptor:mt,getOwnPropertyNames:yt,getOwnPropertySymbols:At,getPrototypeOf:wt}=Object,f=globalThis,Q=f.trustedTypes,vt=Q?Q.emptyScript:"",D=f.reactiveElementPolyfillSupport,C=(n,t)=>n,L={toAttribute(n,t){switch(t){case Boolean:n=n?vt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},K=(n,t)=>!ft(n,t),Y={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:K};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),f.litPropertyMetadata??(f.litPropertyMetadata=new WeakMap);class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Y){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&&gt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=mt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const c=i==null?void 0:i.call(this);r.call(this,o),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Y}static _$Ei(){if(this.hasOwnProperty(C("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(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){const e=this.properties,s=[...yt(e),...At(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(G(i))}else t!==void 0&&e.push(G(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(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.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 _t(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var r;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(((r=s.converter)==null?void 0:r.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){var r;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),c=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:L;this._$Em=i,this[i]=c.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(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??(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(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,o]of i)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(e)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),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=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[C("elementProperties")]=new Map,b[C("finalized")]=new Map,D==null||D({ReactiveElement:b}),(f.reactiveElementVersions??(f.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const O=globalThis,z=O.trustedTypes,X=z?z.createPolicy("lit-html",{createHTML:r=>r}):void 0,ct="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,lt="?"+_,bt=`<${lt}>`,y=document,x=()=>y.createComment(""),T=r=>r===null||typeof r!="object"&&typeof r!="function",Z=Array.isArray,Et=r=>Z(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",B=`[
13
+ */const O=globalThis,W=O.trustedTypes,X=W?W.createPolicy("lit-html",{createHTML:n=>n}):void 0,ct="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,lt="?"+_,bt=`<${lt}>`,y=document,x=()=>y.createComment(""),T=n=>n===null||typeof n!="object"&&typeof n!="function",Z=Array.isArray,Et=n=>Z(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",B=`[
14
14
  \f\r]`,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,tt=/-->/g,et=/>/g,g=RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),st=/'/g,it=/"/g,dt=/^(?:script|style|textarea|title)$/i,S=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),rt=new WeakMap,m=y.createTreeWalker(y,129);function pt(r,t){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return X!==void 0?X.createHTML(t):t}const St=(r,t)=>{const e=r.length-1,s=[];let i,n=t===2?"<svg>":t===3?"<math>":"",o=P;for(let a=0;a<e;a++){const h=r[a];let l,p,c=-1,u=0;for(;u<h.length&&(o.lastIndex=u,p=o.exec(h),p!==null);)u=o.lastIndex,o===P?p[1]==="!--"?o=tt:p[1]!==void 0?o=et:p[2]!==void 0?(dt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=g):p[3]!==void 0&&(o=g):o===g?p[0]===">"?(o=i??P,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,l=p[1],o=p[3]===void 0?g:p[3]==='"'?it:st):o===it||o===st?o=g:o===tt||o===et?o=P:(o=g,i=void 0);const $=o===g&&r[a+1].startsWith("/>")?" ":"";n+=o===P?h+bt:c>=0?(s.push(l),h.slice(0,c)+ct+h.slice(c)+_+$):h+_+(c===-2?a:$)}return[pt(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class N{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const a=t.length-1,h=this.parts,[l,p]=St(t,e);if(this.el=N.createElement(l,s),m.currentNode=this.el.content,e===2||e===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=m.nextNode())!==null&&h.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(ct)){const u=p[o++],$=i.getAttribute(c).split(_),I=/([.?@])?(.*)/.exec(u);h.push({type:1,index:n,name:I[2],strings:$,ctor:I[1]==="."?Pt:I[1]==="?"?Ct:I[1]==="@"?Ot:D}),i.removeAttribute(c)}else c.startsWith(_)&&(h.push({type:6,index:n}),i.removeAttribute(c));if(dt.test(i.tagName)){const c=i.textContent.split(_),u=c.length-1;if(u>0){i.textContent=z?z.emptyScript:"";for(let $=0;$<u;$++)i.append(c[$],x()),m.nextNode(),h.push({type:2,index:++n});i.append(c[u],x())}}}else if(i.nodeType===8)if(i.data===lt)h.push({type:2,index:n});else{let c=-1;for(;(c=i.data.indexOf(_,c+1))!==-1;)h.push({type:7,index:n}),c+=_.length-1}n++}}static createElement(t,e){const s=y.createElement("template");return s.innerHTML=t,s}}function U(r,t,e=r,s){var o,a;if(t===S)return t;let i=s!==void 0?(o=e.o)==null?void 0:o[s]:e.l;const n=T(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==n&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,e,s)),s!==void 0?(e.o??(e.o=[]))[s]=i:e.l=i),i!==void 0&&(t=U(r,i._$AS(r,t.values),i,s)),t}class Ut{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==null?void 0:t.creationScope)??y).importNode(e,!0);m.currentNode=i;let n=m.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let l;h.type===2?l=new H(n,n.nextSibling,this,t):h.type===1?l=new h.ctor(n,h.name,h.strings,this,t):h.type===6&&(l=new xt(n,this,t)),this._$AV.push(l),h=s[++a]}o!==(h==null?void 0:h.index)&&(n=m.nextNode(),o++)}return m.currentNode=y,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(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this.v=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=U(this,t,e),T(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Et(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!==d&&T(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=N.createElement(pt(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===i)this._$AH.p(e);else{const o=new Ut(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=rt.get(t.strings);return e===void 0&&rt.set(t.strings,e=new N(t)),e}k(t){Z(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(x()),this.O(x()),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){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class D{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=d,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=d}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(n===void 0)t=U(this,t,e,0),o=!T(t)||t!==this._$AH&&t!==S,o&&(this._$AH=t);else{const a=t;let h,l;for(t=n[0],h=0;h<n.length-1;h++)l=U(this,a[s+h],e,h),l===S&&(l=this._$AH[h]),o||(o=!T(l)||l!==this._$AH[h]),l===d?t=d:t!==d&&(t+=(l??"")+n[h+1]),this._$AH[h]=l}o&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends D{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Ct extends D{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Ot extends D{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=U(this,t,e,0)??d)===S)return;const s=this._$AH,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class xt{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){U(this,t)}}const V=O.litHtmlPolyfillSupport;V==null||V(N,H),(O.litHtmlVersions??(O.litHtmlVersions=[])).push("3.2.0");const Tt=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const n=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new H(t.insertBefore(x(),n),n,void 0,e??{})}return i._$AI(r),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),st=/'/g,it=/"/g,dt=/^(?:script|style|textarea|title)$/i,S=Symbol.for("lit-noChange"),l=Symbol.for("lit-nothing"),nt=new WeakMap,m=y.createTreeWalker(y,129);function pt(n,t){if(!Z(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return X!==void 0?X.createHTML(t):t}const St=(n,t)=>{const e=n.length-1,s=[];let i,r=t===2?"<svg>":t===3?"<math>":"",o=P;for(let c=0;c<e;c++){const h=n[c];let d,p,a=-1,u=0;for(;u<h.length&&(o.lastIndex=u,p=o.exec(h),p!==null);)u=o.lastIndex,o===P?p[1]==="!--"?o=tt:p[1]!==void 0?o=et:p[2]!==void 0?(dt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=g):p[3]!==void 0&&(o=g):o===g?p[0]===">"?(o=i??P,a=-1):p[1]===void 0?a=-2:(a=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?g:p[3]==='"'?it:st):o===it||o===st?o=g:o===tt||o===et?o=P:(o=g,i=void 0);const $=o===g&&n[c+1].startsWith("/>")?" ":"";r+=o===P?h+bt:a>=0?(s.push(d),h.slice(0,a)+ct+h.slice(a)+_+$):h+_+(a===-2?c:$)}return[pt(n,r+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class N{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,o=0;const c=t.length-1,h=this.parts,[d,p]=St(t,e);if(this.el=N.createElement(d,s),m.currentNode=this.el.content,e===2||e===3){const a=this.el.content.firstChild;a.replaceWith(...a.childNodes)}for(;(i=m.nextNode())!==null&&h.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(const a of i.getAttributeNames())if(a.endsWith(ct)){const u=p[o++],$=i.getAttribute(a).split(_),I=/([.?@])?(.*)/.exec(u);h.push({type:1,index:r,name:I[2],strings:$,ctor:I[1]==="."?Pt:I[1]==="?"?Ct:I[1]==="@"?Ot:k}),i.removeAttribute(a)}else a.startsWith(_)&&(h.push({type:6,index:r}),i.removeAttribute(a));if(dt.test(i.tagName)){const a=i.textContent.split(_),u=a.length-1;if(u>0){i.textContent=W?W.emptyScript:"";for(let $=0;$<u;$++)i.append(a[$],x()),m.nextNode(),h.push({type:2,index:++r});i.append(a[u],x())}}}else if(i.nodeType===8)if(i.data===lt)h.push({type:2,index:r});else{let a=-1;for(;(a=i.data.indexOf(_,a+1))!==-1;)h.push({type:7,index:r}),a+=_.length-1}r++}}static createElement(t,e){const s=y.createElement("template");return s.innerHTML=t,s}}function U(n,t,e=n,s){var o,c;if(t===S)return t;let i=s!==void 0?(o=e.o)==null?void 0:o[s]:e.l;const r=T(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==r&&((c=i==null?void 0:i._$AO)==null||c.call(i,!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,e,s)),s!==void 0?(e.o??(e.o=[]))[s]=i:e.l=i),i!==void 0&&(t=U(n,i._$AS(n,t.values),i,s)),t}class Ut{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==null?void 0:t.creationScope)??y).importNode(e,!0);m.currentNode=i;let r=m.nextNode(),o=0,c=0,h=s[0];for(;h!==void 0;){if(o===h.index){let d;h.type===2?d=new H(r,r.nextSibling,this,t):h.type===1?d=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&(d=new xt(r,this,t)),this._$AV.push(d),h=s[++c]}o!==(h==null?void 0:h.index)&&(r=m.nextNode(),o++)}return m.currentNode=y,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(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,s,i){this.type=2,this._$AH=l,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this.v=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=U(this,t,e),T(t)?t===l||t==null||t===""?(this._$AH!==l&&this._$AR(),this._$AH=l):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Et(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!==l&&T(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){var r;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=N.createElement(pt(s.h,s.h[0]),this.options)),s);if(((r=this._$AH)==null?void 0:r._$AD)===i)this._$AH.p(e);else{const o=new Ut(i,this),c=o.u(this.options);o.p(e),this.T(c),this._$AH=o}}_$AC(t){let e=nt.get(t.strings);return e===void 0&&nt.set(t.strings,e=new N(t)),e}k(t){Z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new H(this.O(x()),this.O(x()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=l,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=l}_$AI(t,e=this,s,i){const r=this.strings;let o=!1;if(r===void 0)t=U(this,t,e,0),o=!T(t)||t!==this._$AH&&t!==S,o&&(this._$AH=t);else{const c=t;let h,d;for(t=r[0],h=0;h<r.length-1;h++)d=U(this,c[s+h],e,h),d===S&&(d=this._$AH[h]),o||(o=!T(d)||d!==this._$AH[h]),d===l?t=l:t!==l&&(t+=(d??"")+r[h+1]),this._$AH[h]=d}o&&!i&&this.j(t)}j(t){t===l?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends k{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===l?void 0:t}}class Ct extends k{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==l)}}class Ot extends k{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=U(this,t,e,0)??l)===S)return;const s=this._$AH,i=t===l&&s!==l||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==l&&(s===l||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class xt{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){U(this,t)}}const V=O.litHtmlPolyfillSupport;V==null||V(N,H),(O.litHtmlVersions??(O.litHtmlVersions=[])).push("3.2.0");const Tt=(n,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const r=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new H(t.insertBefore(x(),r),r,void 0,e??{})}return i._$AI(n),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
@@ -20,8 +20,8 @@
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const Nt={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:K},Ht=(r=Nt,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),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.P(o,void 0,r),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 A(r){return(t,e)=>typeof e=="object"?Ht(r,t,e):((s,i,n)=>{const o=i.hasOwnProperty(n);return i.constructor.createProperty(n,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(i,n):void 0})(r,t,e)}/**
23
+ */const Nt={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:K},Ht=(n=Nt,t,e)=>{const{kind:s,metadata:i}=e;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(e.name,n),s==="accessor"){const{name:o}=e;return{set(c){const h=t.get.call(this);t.set.call(this,c),this.requestUpdate(o,h,n)},init(c){return c!==void 0&&this.P(o,void 0,n),c}}}if(s==="setter"){const{name:o}=e;return function(c){const h=this[o];t.call(this,c),this.requestUpdate(o,h,n)}}throw Error("Unsupported decorator location: "+s)};function A(n){return(t,e)=>typeof e=="object"?Ht(n,t,e):((s,i,r)=>{const o=i.hasOwnProperty(r);return i.constructor.createProperty(r,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(i,r):void 0})(n,t,e)}/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */function L(r){return A({...r,state:!0,attribute:!1})}var Mt=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,M=(r,t,e,s)=>{for(var i=s>1?void 0:s?Rt(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&&Mt(t,e,i),i};const nt="https://widgets.ace.teliacompany.net",ot="https://embed.webprovisions.io";class w extends E{constructor(){super(...arguments),this.apiUrl=nt,this.embedUrl=ot,this._site=null,this._widgets={}}async connectedCallback(){super.connectedCallback(),await this.loadSite()}async disconnectedCallback(){super.disconnectedCallback()}async loadSite(){var s;const e=await(await fetch(`${this.apiUrl}/api/site/${this.siteId}`)).json();this._site=e,(((s=this._site)==null?void 0:s.widgets)||[]).forEach(async i=>{this.addWidgetEl(i.widgetId)})}addWidgetEl(t){const e=`ace-widget_${t}`;let s=document.getElementById(e);s||(s=document.createElement("ace-widget-wrapper"),s.setAttribute("id",e),s.setAttribute("widgetId",t),this.apiUrl!==nt&&s.setAttribute("apiUrl",this.apiUrl),this.embedUrl!==ot&&s.setAttribute("embedUrl",this.embedUrl),document.body.appendChild(s)),this._widgets={...this._widgets,[t]:s},window.ace=window.ace||{_c:[],_w:[],widget:function(i,n){window.ace._w.push([i,n])},configure:function(i){window.ace._c.push(i)}}}async render(){if(!this._site)return d;const t=[];(this._site.triggers||[]).filter(e=>e.triggerType==="visit").forEach(e=>{const s=window.location.pathname,i=e.condition.outputs||[];e.condition.type==="url"&&i.forEach(n=>{var h;const o=n.action.type==="render_widget";if((n.value===s||n.value==="*")&&o){let l={widgetId:""};try{l=JSON.parse(n.action.data)}catch{l={widgetId:""}}const p=t.findIndex(u=>u.widgetId===l.widgetId)>-1,c=(((h=this._site)==null?void 0:h.widgets)||[]).find(u=>u.widgetId===l.widgetId);c&&!p&&t.push(c)}})});for await(const e of t){const s=this._widgets[e.widgetId];s&&s.activate()}return d}}M([A({attribute:!0})],w.prototype,"siteId",2);M([A()],w.prototype,"apiUrl",2);M([A()],w.prototype,"embedUrl",2);M([L()],w.prototype,"_site",2);M([L()],w.prototype,"_widgets",2);window.customElements.get("ace-site")||window.customElements.define("ace-site",w);var It=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,R=(r,t,e,s)=>{for(var i=s>1?void 0:s?jt(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&&It(t,e,i),i};const kt="https://widgets.ace.teliacompany.net",zt="https://embed.webprovisions.io";class v extends E{constructor(){super(...arguments),this.apiUrl=kt,this.embedUrl=zt,this.widget=null,this.scriptEl=null}async connectedCallback(){super.connectedCallback(),this.widget=await this._loadWidget(this.widgetId)}async _loadWidget(t){return await(await fetch(`${this.apiUrl}/api/widget/${t}`)).json()}_createEmbedScript(){var e;if(!((e=this.widget)!=null&&e.distributionName))return;let t=document.createElement("script");t.setAttribute("type","module"),t.setAttribute("async","true"),t.setAttribute("src",`${this.embedUrl}/d/${this.widget.organization}/${this.widget.distributionName}@latest/index.js`),this.scriptEl=t}async activate(){this.widget||(this.widget=await this._loadWidget(this.widgetId)),this._createEmbedScript()}render(){return this.scriptEl?this.scriptEl:d}}R([A({attribute:!0})],v.prototype,"widgetId",2);R([A()],v.prototype,"apiUrl",2);R([A()],v.prototype,"embedUrl",2);R([L()],v.prototype,"widget",2);R([L()],v.prototype,"scriptEl",2);customElements.get("ace-widget-wrapper")||customElements.define("ace-widget-wrapper",v);exports.SiteComponent=w;exports.WidgetComponent=v;
27
+ */function z(n){return A({...n,state:!0,attribute:!1})}var Mt=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,M=(n,t,e,s)=>{for(var i=s>1?void 0:s?Rt(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&Mt(t,e,i),i};const rt="https://widgets.ace.teliacompany.net",ot="https://embed.webprovisions.io",It=()=>{if(typeof window<"u"){const n=history.pushState,t=history.replaceState;history.pushState=function(...e){n.apply(history,e),window.dispatchEvent(new Event("locationchange"))},history.replaceState=function(...e){t.apply(history,e),window.dispatchEvent(new Event("locationchange"))}}};class w extends E{constructor(){super(...arguments),this.apiUrl=rt,this.embedUrl=ot,this._site=null,this._widgets={}}async connectedCallback(){super.connectedCallback(),It(),await this.loadSite(),window.addEventListener("locationchange",this.routeChangeListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("locationchange",this.routeChangeListener)}routeChangeListener(){console.log("URL changed:",window.location.href)}async loadSite(){var s;const e=await(await fetch(`${this.apiUrl}/api/site/${this.siteId}`)).json();this._site=e,(((s=this._site)==null?void 0:s.widgets)||[]).forEach(async i=>{this.addWidgetEl(i.widgetId)})}addWidgetEl(t){const e=`ace-widget_${t}`;let s=document.getElementById(e);s||(s=document.createElement("ace-widget-wrapper"),s.setAttribute("id",e),s.setAttribute("widgetId",t),this.apiUrl!==rt&&s.setAttribute("apiUrl",this.apiUrl),this.embedUrl!==ot&&s.setAttribute("embedUrl",this.embedUrl),document.body.appendChild(s)),this._widgets={...this._widgets,[t]:s},window.ace=window.ace||{_c:[],_w:[],widget:function(i,r){window.ace._w.push([i,r])},configure:function(i){window.ace._c.push(i)}}}render(){if(!this._site)return l;const t=jt(this._site);for(const e of t){const s=this._widgets[e.widgetId];s&&s.activate()}return l}}M([A({attribute:!0})],w.prototype,"siteId",2);M([A()],w.prototype,"apiUrl",2);M([A()],w.prototype,"embedUrl",2);M([z()],w.prototype,"_site",2);M([z()],w.prototype,"_widgets",2);const jt=n=>{const t=[];return(n.triggers||[]).filter(e=>e.triggerType==="visit").forEach(e=>{const s=window.location.pathname,i=e.condition.outputs||[];e.condition.type==="url"&&i.forEach(r=>{const o=r.action.type==="render_widget";if((r.value===s||r.value==="*")&&o){let h={widgetId:""};try{h=JSON.parse(r.action.data)}catch{h={widgetId:""}}const d=t.findIndex(a=>a.widgetId===h.widgetId)>-1,p=((n==null?void 0:n.widgets)||[]).find(a=>a.widgetId===h.widgetId);p&&!d&&t.push(p)}})}),t};window.customElements.get("ace-site")||window.customElements.define("ace-site",w);var Lt=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,R=(n,t,e,s)=>{for(var i=s>1?void 0:s?Wt(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&Lt(t,e,i),i};const kt="https://widgets.ace.teliacompany.net",zt="https://embed.webprovisions.io";class v extends E{constructor(){super(...arguments),this.apiUrl=kt,this.embedUrl=zt,this.widget=null,this.scriptEl=null}async connectedCallback(){super.connectedCallback(),this.widget=await this._loadWidget(this.widgetId)}async _loadWidget(t){return await(await fetch(`${this.apiUrl}/api/widget/${t}`)).json()}_createEmbedScript(){var e;if(!((e=this.widget)!=null&&e.distributionName))return;let t=document.createElement("script");t.setAttribute("type","module"),t.setAttribute("async","true"),t.setAttribute("src",`${this.embedUrl}/d/${this.widget.organization}/${this.widget.distributionName}@latest/index.js`),this.scriptEl=t}async activate(){this.widget||(this.widget=await this._loadWidget(this.widgetId)),this._createEmbedScript()}render(){return this.scriptEl?this.scriptEl:l}}R([A({attribute:!0})],v.prototype,"widgetId",2);R([A()],v.prototype,"apiUrl",2);R([A()],v.prototype,"embedUrl",2);R([z()],v.prototype,"widget",2);R([z()],v.prototype,"scriptEl",2);customElements.get("ace-widget-wrapper")||customElements.define("ace-widget-wrapper",v);exports.SiteComponent=w;exports.WidgetComponent=v;
package/index.mjs CHANGED
@@ -23,54 +23,54 @@ let ut = class {
23
23
  return this.cssText;
24
24
  }
25
25
  };
26
- const $t = (r) => new ut(typeof r == "string" ? r : r + "", void 0, at), _t = (r, t) => {
26
+ const $t = (n) => new ut(typeof n == "string" ? n : n + "", void 0, at), _t = (n, t) => {
27
27
  if (J)
28
- r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
28
+ n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
29
29
  else
30
30
  for (const e of t) {
31
31
  const s = document.createElement("style"), i = j.litNonce;
32
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
32
+ i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, n.appendChild(s);
33
33
  }
34
- }, G = J ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
34
+ }, G = J ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
35
35
  let e = "";
36
36
  for (const s of t.cssRules)
37
37
  e += s.cssText;
38
38
  return $t(e);
39
- })(r) : r;
39
+ })(n) : n;
40
40
  /**
41
41
  * @license
42
42
  * Copyright 2017 Google LLC
43
43
  * SPDX-License-Identifier: BSD-3-Clause
44
44
  */
45
- const { is: ft, defineProperty: gt, getOwnPropertyDescriptor: mt, getOwnPropertyNames: yt, getOwnPropertySymbols: At, getPrototypeOf: wt } = Object, f = globalThis, Q = f.trustedTypes, vt = Q ? Q.emptyScript : "", B = f.reactiveElementPolyfillSupport, C = (r, t) => r, k = { toAttribute(r, t) {
45
+ const { is: ft, defineProperty: gt, getOwnPropertyDescriptor: mt, getOwnPropertyNames: yt, getOwnPropertySymbols: At, getPrototypeOf: wt } = Object, f = globalThis, Q = f.trustedTypes, vt = Q ? Q.emptyScript : "", W = f.reactiveElementPolyfillSupport, C = (n, t) => n, L = { toAttribute(n, t) {
46
46
  switch (t) {
47
47
  case Boolean:
48
- r = r ? vt : null;
48
+ n = n ? vt : null;
49
49
  break;
50
50
  case Object:
51
51
  case Array:
52
- r = r == null ? r : JSON.stringify(r);
52
+ n = n == null ? n : JSON.stringify(n);
53
53
  }
54
- return r;
55
- }, fromAttribute(r, t) {
56
- let e = r;
54
+ return n;
55
+ }, fromAttribute(n, t) {
56
+ let e = n;
57
57
  switch (t) {
58
58
  case Boolean:
59
- e = r !== null;
59
+ e = n !== null;
60
60
  break;
61
61
  case Number:
62
- e = r === null ? null : Number(r);
62
+ e = n === null ? null : Number(n);
63
63
  break;
64
64
  case Object:
65
65
  case Array:
66
66
  try {
67
- e = JSON.parse(r);
67
+ e = JSON.parse(n);
68
68
  } catch {
69
69
  e = null;
70
70
  }
71
71
  }
72
72
  return e;
73
- } }, K = (r, t) => !ft(r, t), Y = { attribute: !0, type: String, converter: k, reflect: !1, hasChanged: K };
73
+ } }, K = (n, t) => !ft(n, t), Y = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: K };
74
74
  Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), f.litPropertyMetadata ?? (f.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
75
75
  class w extends HTMLElement {
76
76
  static addInitializer(t) {
@@ -86,7 +86,7 @@ class w extends HTMLElement {
86
86
  }
87
87
  }
88
88
  static getPropertyDescriptor(t, e, s) {
89
- const { get: i, set: n } = mt(this.prototype, t) ?? { get() {
89
+ const { get: i, set: r } = mt(this.prototype, t) ?? { get() {
90
90
  return this[e];
91
91
  }, set(o) {
92
92
  this[e] = o;
@@ -94,8 +94,8 @@ class w extends HTMLElement {
94
94
  return { get() {
95
95
  return i == null ? void 0 : i.call(this);
96
96
  }, set(o) {
97
- const a = i == null ? void 0 : i.call(this);
98
- n.call(this, o), this.requestUpdate(t, a, s);
97
+ const c = i == null ? void 0 : i.call(this);
98
+ r.call(this, o), this.requestUpdate(t, c, s);
99
99
  }, configurable: !0, enumerable: !0 };
100
100
  }
101
101
  static getPropertyOptions(t) {
@@ -188,19 +188,19 @@ class w extends HTMLElement {
188
188
  this._$AK(t, s);
189
189
  }
190
190
  _$EC(t, e) {
191
- var n;
191
+ var r;
192
192
  const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
193
193
  if (i !== void 0 && s.reflect === !0) {
194
- const o = (((n = s.converter) == null ? void 0 : n.toAttribute) !== void 0 ? s.converter : k).toAttribute(e, s.type);
194
+ const o = (((r = s.converter) == null ? void 0 : r.toAttribute) !== void 0 ? s.converter : L).toAttribute(e, s.type);
195
195
  this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null;
196
196
  }
197
197
  }
198
198
  _$AK(t, e) {
199
- var n;
199
+ var r;
200
200
  const s = this.constructor, i = s._$Eh.get(t);
201
201
  if (i !== void 0 && this._$Em !== i) {
202
- const o = s.getPropertyOptions(i), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : k;
203
- this._$Em = i, this[i] = a.fromAttribute(e, o.type), this._$Em = null;
202
+ const o = s.getPropertyOptions(i), c = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((r = o.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? o.converter : L;
203
+ this._$Em = i, this[i] = c.fromAttribute(e, o.type), this._$Em = null;
204
204
  }
205
205
  }
206
206
  requestUpdate(t, e, s) {
@@ -233,21 +233,21 @@ class w extends HTMLElement {
233
233
  return;
234
234
  if (!this.hasUpdated) {
235
235
  if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
236
- for (const [n, o] of this._$Ep)
237
- this[n] = o;
236
+ for (const [r, o] of this._$Ep)
237
+ this[r] = o;
238
238
  this._$Ep = void 0;
239
239
  }
240
240
  const i = this.constructor.elementProperties;
241
241
  if (i.size > 0)
242
- for (const [n, o] of i)
243
- o.wrapped !== !0 || this._$AL.has(n) || this[n] === void 0 || this.P(n, this[n], o);
242
+ for (const [r, o] of i)
243
+ o.wrapped !== !0 || this._$AL.has(r) || this[r] === void 0 || this.P(r, this[r], o);
244
244
  }
245
245
  let t = !1;
246
246
  const e = this._$AL;
247
247
  try {
248
248
  t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
249
- var n;
250
- return (n = i.hostUpdate) == null ? void 0 : n.call(i);
249
+ var r;
250
+ return (r = i.hostUpdate) == null ? void 0 : r.call(i);
251
251
  }), this.update(e)) : this._$EU();
252
252
  } catch (i) {
253
253
  throw t = !1, this._$EU(), i;
@@ -283,70 +283,70 @@ class w extends HTMLElement {
283
283
  firstUpdated(t) {
284
284
  }
285
285
  }
286
- w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, w[C("elementProperties")] = /* @__PURE__ */ new Map(), w[C("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: w }), (f.reactiveElementVersions ?? (f.reactiveElementVersions = [])).push("2.0.4");
286
+ w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, w[C("elementProperties")] = /* @__PURE__ */ new Map(), w[C("finalized")] = /* @__PURE__ */ new Map(), W == null || W({ ReactiveElement: w }), (f.reactiveElementVersions ?? (f.reactiveElementVersions = [])).push("2.0.4");
287
287
  /**
288
288
  * @license
289
289
  * Copyright 2017 Google LLC
290
290
  * SPDX-License-Identifier: BSD-3-Clause
291
291
  */
292
- const O = globalThis, z = O.trustedTypes, X = z ? z.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ct = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, lt = "?" + _, bt = `<${lt}>`, y = document, x = () => y.createComment(""), T = (r) => r === null || typeof r != "object" && typeof r != "function", Z = Array.isArray, Et = (r) => Z(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", W = `[
293
- \f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, g = RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
294
- \f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g, dt = /^(?:script|style|textarea|title)$/i, b = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), m = y.createTreeWalker(y, 129);
295
- function pt(r, t) {
296
- if (!Z(r) || !r.hasOwnProperty("raw"))
292
+ const O = globalThis, k = O.trustedTypes, X = k ? k.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, ct = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, lt = "?" + _, Et = `<${lt}>`, y = document, x = () => y.createComment(""), T = (n) => n === null || typeof n != "object" && typeof n != "function", Z = Array.isArray, bt = (n) => Z(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", B = `[
293
+ \f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, g = RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^
294
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g, dt = /^(?:script|style|textarea|title)$/i, E = Symbol.for("lit-noChange"), l = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), m = y.createTreeWalker(y, 129);
295
+ function pt(n, t) {
296
+ if (!Z(n) || !n.hasOwnProperty("raw"))
297
297
  throw Error("invalid template strings array");
298
298
  return X !== void 0 ? X.createHTML(t) : t;
299
299
  }
300
- const St = (r, t) => {
301
- const e = r.length - 1, s = [];
302
- let i, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = P;
303
- for (let a = 0; a < e; a++) {
304
- const h = r[a];
305
- let l, p, c = -1, u = 0;
300
+ const St = (n, t) => {
301
+ const e = n.length - 1, s = [];
302
+ let i, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = P;
303
+ for (let c = 0; c < e; c++) {
304
+ const h = n[c];
305
+ let d, p, a = -1, u = 0;
306
306
  for (; u < h.length && (o.lastIndex = u, p = o.exec(h), p !== null); )
307
- u = o.lastIndex, o === P ? p[1] === "!--" ? o = tt : p[1] !== void 0 ? o = et : p[2] !== void 0 ? (dt.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = g) : p[3] !== void 0 && (o = g) : o === g ? p[0] === ">" ? (o = i ?? P, c = -1) : p[1] === void 0 ? c = -2 : (c = o.lastIndex - p[2].length, l = p[1], o = p[3] === void 0 ? g : p[3] === '"' ? it : st) : o === it || o === st ? o = g : o === tt || o === et ? o = P : (o = g, i = void 0);
308
- const $ = o === g && r[a + 1].startsWith("/>") ? " " : "";
309
- n += o === P ? h + bt : c >= 0 ? (s.push(l), h.slice(0, c) + ct + h.slice(c) + _ + $) : h + _ + (c === -2 ? a : $);
307
+ u = o.lastIndex, o === P ? p[1] === "!--" ? o = tt : p[1] !== void 0 ? o = et : p[2] !== void 0 ? (dt.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = g) : p[3] !== void 0 && (o = g) : o === g ? p[0] === ">" ? (o = i ?? P, a = -1) : p[1] === void 0 ? a = -2 : (a = o.lastIndex - p[2].length, d = p[1], o = p[3] === void 0 ? g : p[3] === '"' ? it : st) : o === it || o === st ? o = g : o === tt || o === et ? o = P : (o = g, i = void 0);
308
+ const $ = o === g && n[c + 1].startsWith("/>") ? " " : "";
309
+ r += o === P ? h + Et : a >= 0 ? (s.push(d), h.slice(0, a) + ct + h.slice(a) + _ + $) : h + _ + (a === -2 ? c : $);
310
310
  }
311
- return [pt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
311
+ return [pt(n, r + (n[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
312
312
  };
313
313
  class N {
314
314
  constructor({ strings: t, _$litType$: e }, s) {
315
315
  let i;
316
316
  this.parts = [];
317
- let n = 0, o = 0;
318
- const a = t.length - 1, h = this.parts, [l, p] = St(t, e);
319
- if (this.el = N.createElement(l, s), m.currentNode = this.el.content, e === 2 || e === 3) {
320
- const c = this.el.content.firstChild;
321
- c.replaceWith(...c.childNodes);
317
+ let r = 0, o = 0;
318
+ const c = t.length - 1, h = this.parts, [d, p] = St(t, e);
319
+ if (this.el = N.createElement(d, s), m.currentNode = this.el.content, e === 2 || e === 3) {
320
+ const a = this.el.content.firstChild;
321
+ a.replaceWith(...a.childNodes);
322
322
  }
323
- for (; (i = m.nextNode()) !== null && h.length < a; ) {
323
+ for (; (i = m.nextNode()) !== null && h.length < c; ) {
324
324
  if (i.nodeType === 1) {
325
325
  if (i.hasAttributes())
326
- for (const c of i.getAttributeNames())
327
- if (c.endsWith(ct)) {
328
- const u = p[o++], $ = i.getAttribute(c).split(_), I = /([.?@])?(.*)/.exec(u);
329
- h.push({ type: 1, index: n, name: I[2], strings: $, ctor: I[1] === "." ? Pt : I[1] === "?" ? Ct : I[1] === "@" ? Ot : D }), i.removeAttribute(c);
326
+ for (const a of i.getAttributeNames())
327
+ if (a.endsWith(ct)) {
328
+ const u = p[o++], $ = i.getAttribute(a).split(_), I = /([.?@])?(.*)/.exec(u);
329
+ h.push({ type: 1, index: r, name: I[2], strings: $, ctor: I[1] === "." ? Pt : I[1] === "?" ? Ct : I[1] === "@" ? Ot : z }), i.removeAttribute(a);
330
330
  } else
331
- c.startsWith(_) && (h.push({ type: 6, index: n }), i.removeAttribute(c));
331
+ a.startsWith(_) && (h.push({ type: 6, index: r }), i.removeAttribute(a));
332
332
  if (dt.test(i.tagName)) {
333
- const c = i.textContent.split(_), u = c.length - 1;
333
+ const a = i.textContent.split(_), u = a.length - 1;
334
334
  if (u > 0) {
335
- i.textContent = z ? z.emptyScript : "";
335
+ i.textContent = k ? k.emptyScript : "";
336
336
  for (let $ = 0; $ < u; $++)
337
- i.append(c[$], x()), m.nextNode(), h.push({ type: 2, index: ++n });
338
- i.append(c[u], x());
337
+ i.append(a[$], x()), m.nextNode(), h.push({ type: 2, index: ++r });
338
+ i.append(a[u], x());
339
339
  }
340
340
  }
341
341
  } else if (i.nodeType === 8)
342
342
  if (i.data === lt)
343
- h.push({ type: 2, index: n });
343
+ h.push({ type: 2, index: r });
344
344
  else {
345
- let c = -1;
346
- for (; (c = i.data.indexOf(_, c + 1)) !== -1; )
347
- h.push({ type: 7, index: n }), c += _.length - 1;
345
+ let a = -1;
346
+ for (; (a = i.data.indexOf(_, a + 1)) !== -1; )
347
+ h.push({ type: 7, index: r }), a += _.length - 1;
348
348
  }
349
- n++;
349
+ r++;
350
350
  }
351
351
  }
352
352
  static createElement(t, e) {
@@ -354,13 +354,13 @@ class N {
354
354
  return s.innerHTML = t, s;
355
355
  }
356
356
  }
357
- function E(r, t, e = r, s) {
358
- var o, a;
359
- if (t === b)
357
+ function b(n, t, e = n, s) {
358
+ var o, c;
359
+ if (t === E)
360
360
  return t;
361
361
  let i = s !== void 0 ? (o = e.o) == null ? void 0 : o[s] : e.l;
362
- const n = T(t) ? void 0 : t._$litDirective$;
363
- return (i == null ? void 0 : i.constructor) !== n && ((a = i == null ? void 0 : i._$AO) == null || a.call(i, !1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, e, s)), s !== void 0 ? (e.o ?? (e.o = []))[s] = i : e.l = i), i !== void 0 && (t = E(r, i._$AS(r, t.values), i, s)), t;
362
+ const r = T(t) ? void 0 : t._$litDirective$;
363
+ return (i == null ? void 0 : i.constructor) !== r && ((c = i == null ? void 0 : i._$AO) == null || c.call(i, !1), r === void 0 ? i = void 0 : (i = new r(n), i._$AT(n, e, s)), s !== void 0 ? (e.o ?? (e.o = []))[s] = i : e.l = i), i !== void 0 && (t = b(n, i._$AS(n, t.values), i, s)), t;
364
364
  }
365
365
  class Ut {
366
366
  constructor(t, e) {
@@ -375,13 +375,13 @@ class Ut {
375
375
  u(t) {
376
376
  const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? y).importNode(e, !0);
377
377
  m.currentNode = i;
378
- let n = m.nextNode(), o = 0, a = 0, h = s[0];
378
+ let r = m.nextNode(), o = 0, c = 0, h = s[0];
379
379
  for (; h !== void 0; ) {
380
380
  if (o === h.index) {
381
- let l;
382
- h.type === 2 ? l = new H(n, n.nextSibling, this, t) : h.type === 1 ? l = new h.ctor(n, h.name, h.strings, this, t) : h.type === 6 && (l = new xt(n, this, t)), this._$AV.push(l), h = s[++a];
381
+ let d;
382
+ h.type === 2 ? d = new H(r, r.nextSibling, this, t) : h.type === 1 ? d = new h.ctor(r, h.name, h.strings, this, t) : h.type === 6 && (d = new xt(r, this, t)), this._$AV.push(d), h = s[++c];
383
383
  }
384
- o !== (h == null ? void 0 : h.index) && (n = m.nextNode(), o++);
384
+ o !== (h == null ? void 0 : h.index) && (r = m.nextNode(), o++);
385
385
  }
386
386
  return m.currentNode = y, i;
387
387
  }
@@ -397,7 +397,7 @@ class H {
397
397
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this.v;
398
398
  }
399
399
  constructor(t, e, s, i) {
400
- this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this.v = (i == null ? void 0 : i.isConnected) ?? !0;
400
+ this.type = 2, this._$AH = l, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this.v = (i == null ? void 0 : i.isConnected) ?? !0;
401
401
  }
402
402
  get parentNode() {
403
403
  let t = this._$AA.parentNode;
@@ -411,7 +411,7 @@ class H {
411
411
  return this._$AB;
412
412
  }
413
413
  _$AI(t, e = this) {
414
- t = E(this, t, e), T(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== b && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Et(t) ? this.k(t) : this._(t);
414
+ t = b(this, t, e), T(t) ? t === l || t == null || t === "" ? (this._$AH !== l && this._$AR(), this._$AH = l) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : bt(t) ? this.k(t) : this._(t);
415
415
  }
416
416
  O(t) {
417
417
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -420,28 +420,28 @@ class H {
420
420
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
421
421
  }
422
422
  _(t) {
423
- this._$AH !== d && T(this._$AH) ? this._$AA.nextSibling.data = t : this.T(y.createTextNode(t)), this._$AH = t;
423
+ this._$AH !== l && T(this._$AH) ? this._$AA.nextSibling.data = t : this.T(y.createTextNode(t)), this._$AH = t;
424
424
  }
425
425
  $(t) {
426
- var n;
426
+ var r;
427
427
  const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = N.createElement(pt(s.h, s.h[0]), this.options)), s);
428
- if (((n = this._$AH) == null ? void 0 : n._$AD) === i)
428
+ if (((r = this._$AH) == null ? void 0 : r._$AD) === i)
429
429
  this._$AH.p(e);
430
430
  else {
431
- const o = new Ut(i, this), a = o.u(this.options);
432
- o.p(e), this.T(a), this._$AH = o;
431
+ const o = new Ut(i, this), c = o.u(this.options);
432
+ o.p(e), this.T(c), this._$AH = o;
433
433
  }
434
434
  }
435
435
  _$AC(t) {
436
- let e = rt.get(t.strings);
437
- return e === void 0 && rt.set(t.strings, e = new N(t)), e;
436
+ let e = nt.get(t.strings);
437
+ return e === void 0 && nt.set(t.strings, e = new N(t)), e;
438
438
  }
439
439
  k(t) {
440
440
  Z(this._$AH) || (this._$AH = [], this._$AR());
441
441
  const e = this._$AH;
442
442
  let s, i = 0;
443
- for (const n of t)
444
- i === e.length ? e.push(s = new H(this.O(x()), this.O(x()), this, this.options)) : s = e[i], s._$AI(n), i++;
443
+ for (const r of t)
444
+ i === e.length ? e.push(s = new H(this.O(x()), this.O(x()), this, this.options)) : s = e[i], s._$AI(r), i++;
445
445
  i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
446
446
  }
447
447
  _$AR(t = this._$AA.nextSibling, e) {
@@ -456,58 +456,58 @@ class H {
456
456
  this._$AM === void 0 && (this.v = t, (e = this._$AP) == null || e.call(this, t));
457
457
  }
458
458
  }
459
- class D {
459
+ class z {
460
460
  get tagName() {
461
461
  return this.element.tagName;
462
462
  }
463
463
  get _$AU() {
464
464
  return this._$AM._$AU;
465
465
  }
466
- constructor(t, e, s, i, n) {
467
- this.type = 1, this._$AH = d, 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 = d;
466
+ constructor(t, e, s, i, r) {
467
+ this.type = 1, this._$AH = l, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = l;
468
468
  }
469
469
  _$AI(t, e = this, s, i) {
470
- const n = this.strings;
470
+ const r = this.strings;
471
471
  let o = !1;
472
- if (n === void 0)
473
- t = E(this, t, e, 0), o = !T(t) || t !== this._$AH && t !== b, o && (this._$AH = t);
472
+ if (r === void 0)
473
+ t = b(this, t, e, 0), o = !T(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
474
474
  else {
475
- const a = t;
476
- let h, l;
477
- for (t = n[0], h = 0; h < n.length - 1; h++)
478
- l = E(this, a[s + h], e, h), l === b && (l = this._$AH[h]), o || (o = !T(l) || l !== this._$AH[h]), l === d ? t = d : t !== d && (t += (l ?? "") + n[h + 1]), this._$AH[h] = l;
475
+ const c = t;
476
+ let h, d;
477
+ for (t = r[0], h = 0; h < r.length - 1; h++)
478
+ d = b(this, c[s + h], e, h), d === E && (d = this._$AH[h]), o || (o = !T(d) || d !== this._$AH[h]), d === l ? t = l : t !== l && (t += (d ?? "") + r[h + 1]), this._$AH[h] = d;
479
479
  }
480
480
  o && !i && this.j(t);
481
481
  }
482
482
  j(t) {
483
- t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
483
+ t === l ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
484
484
  }
485
485
  }
486
- class Pt extends D {
486
+ class Pt extends z {
487
487
  constructor() {
488
488
  super(...arguments), this.type = 3;
489
489
  }
490
490
  j(t) {
491
- this.element[this.name] = t === d ? void 0 : t;
491
+ this.element[this.name] = t === l ? void 0 : t;
492
492
  }
493
493
  }
494
- class Ct extends D {
494
+ class Ct extends z {
495
495
  constructor() {
496
496
  super(...arguments), this.type = 4;
497
497
  }
498
498
  j(t) {
499
- this.element.toggleAttribute(this.name, !!t && t !== d);
499
+ this.element.toggleAttribute(this.name, !!t && t !== l);
500
500
  }
501
501
  }
502
- class Ot extends D {
503
- constructor(t, e, s, i, n) {
504
- super(t, e, s, i, n), this.type = 5;
502
+ class Ot extends z {
503
+ constructor(t, e, s, i, r) {
504
+ super(t, e, s, i, r), this.type = 5;
505
505
  }
506
506
  _$AI(t, e = this) {
507
- if ((t = E(this, t, e, 0) ?? d) === b)
507
+ if ((t = b(this, t, e, 0) ?? l) === E)
508
508
  return;
509
- const s = this._$AH, i = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== d && (s === d || i);
510
- i && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
509
+ const s = this._$AH, i = t === l && s !== l || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== l && (s === l || i);
510
+ i && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
511
511
  }
512
512
  handleEvent(t) {
513
513
  var e;
@@ -522,19 +522,19 @@ class xt {
522
522
  return this._$AM._$AU;
523
523
  }
524
524
  _$AI(t) {
525
- E(this, t);
525
+ b(this, t);
526
526
  }
527
527
  }
528
528
  const V = O.litHtmlPolyfillSupport;
529
529
  V == null || V(N, H), (O.litHtmlVersions ?? (O.litHtmlVersions = [])).push("3.2.0");
530
- const Tt = (r, t, e) => {
530
+ const Tt = (n, t, e) => {
531
531
  const s = (e == null ? void 0 : e.renderBefore) ?? t;
532
532
  let i = s._$litPart$;
533
533
  if (i === void 0) {
534
- const n = (e == null ? void 0 : e.renderBefore) ?? null;
535
- s._$litPart$ = i = new H(t.insertBefore(x(), n), n, void 0, e ?? {});
534
+ const r = (e == null ? void 0 : e.renderBefore) ?? null;
535
+ s._$litPart$ = i = new H(t.insertBefore(x(), r), r, void 0, e ?? {});
536
536
  }
537
- return i._$AI(r), i;
537
+ return i._$AI(n), i;
538
538
  };
539
539
  /**
540
540
  * @license
@@ -563,7 +563,7 @@ class v extends w {
563
563
  super.disconnectedCallback(), (t = this.o) == null || t.setConnected(!1);
564
564
  }
565
565
  render() {
566
- return b;
566
+ return E;
567
567
  }
568
568
  }
569
569
  var ht;
@@ -576,56 +576,68 @@ q == null || q({ LitElement: v });
576
576
  * Copyright 2017 Google LLC
577
577
  * SPDX-License-Identifier: BSD-3-Clause
578
578
  */
579
- const Nt = { attribute: !0, type: String, converter: k, reflect: !1, hasChanged: K }, Ht = (r = Nt, t, e) => {
579
+ const Nt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: K }, Ht = (n = Nt, t, e) => {
580
580
  const { kind: s, metadata: i } = e;
581
- let n = globalThis.litPropertyMetadata.get(i);
582
- if (n === void 0 && globalThis.litPropertyMetadata.set(i, n = /* @__PURE__ */ new Map()), n.set(e.name, r), s === "accessor") {
581
+ let r = globalThis.litPropertyMetadata.get(i);
582
+ if (r === void 0 && globalThis.litPropertyMetadata.set(i, r = /* @__PURE__ */ new Map()), r.set(e.name, n), s === "accessor") {
583
583
  const { name: o } = e;
584
- return { set(a) {
584
+ return { set(c) {
585
585
  const h = t.get.call(this);
586
- t.set.call(this, a), this.requestUpdate(o, h, r);
587
- }, init(a) {
588
- return a !== void 0 && this.P(o, void 0, r), a;
586
+ t.set.call(this, c), this.requestUpdate(o, h, n);
587
+ }, init(c) {
588
+ return c !== void 0 && this.P(o, void 0, n), c;
589
589
  } };
590
590
  }
591
591
  if (s === "setter") {
592
592
  const { name: o } = e;
593
- return function(a) {
593
+ return function(c) {
594
594
  const h = this[o];
595
- t.call(this, a), this.requestUpdate(o, h, r);
595
+ t.call(this, c), this.requestUpdate(o, h, n);
596
596
  };
597
597
  }
598
598
  throw Error("Unsupported decorator location: " + s);
599
599
  };
600
- function A(r) {
601
- return (t, e) => typeof e == "object" ? Ht(r, t, e) : ((s, i, n) => {
602
- const o = i.hasOwnProperty(n);
603
- return i.constructor.createProperty(n, o ? { ...s, wrapped: !0 } : s), o ? Object.getOwnPropertyDescriptor(i, n) : void 0;
604
- })(r, t, e);
600
+ function A(n) {
601
+ return (t, e) => typeof e == "object" ? Ht(n, t, e) : ((s, i, r) => {
602
+ const o = i.hasOwnProperty(r);
603
+ return i.constructor.createProperty(r, o ? { ...s, wrapped: !0 } : s), o ? Object.getOwnPropertyDescriptor(i, r) : void 0;
604
+ })(n, t, e);
605
605
  }
606
606
  /**
607
607
  * @license
608
608
  * Copyright 2017 Google LLC
609
609
  * SPDX-License-Identifier: BSD-3-Clause
610
610
  */
611
- function L(r) {
612
- return A({ ...r, state: !0, attribute: !1 });
611
+ function D(n) {
612
+ return A({ ...n, state: !0, attribute: !1 });
613
613
  }
614
- var Mt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, M = (r, t, e, s) => {
615
- for (var i = s > 1 ? void 0 : s ? Rt(t, e) : t, n = r.length - 1, o; n >= 0; n--)
616
- (o = r[n]) && (i = (s ? o(t, e, i) : o(i)) || i);
614
+ var Mt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, M = (n, t, e, s) => {
615
+ for (var i = s > 1 ? void 0 : s ? Rt(t, e) : t, r = n.length - 1, o; r >= 0; r--)
616
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
617
617
  return s && i && Mt(t, e, i), i;
618
618
  };
619
- const nt = "https://widgets.ace.teliacompany.net", ot = "https://embed.webprovisions.io";
619
+ const rt = "https://widgets.ace.teliacompany.net", ot = "https://embed.webprovisions.io", It = () => {
620
+ if (typeof window < "u") {
621
+ const n = history.pushState, t = history.replaceState;
622
+ history.pushState = function(...e) {
623
+ n.apply(history, e), window.dispatchEvent(new Event("locationchange"));
624
+ }, history.replaceState = function(...e) {
625
+ t.apply(history, e), window.dispatchEvent(new Event("locationchange"));
626
+ };
627
+ }
628
+ };
620
629
  class S extends v {
621
630
  constructor() {
622
- super(...arguments), this.apiUrl = nt, this.embedUrl = ot, this._site = null, this._widgets = {};
631
+ super(...arguments), this.apiUrl = rt, this.embedUrl = ot, this._site = null, this._widgets = {};
623
632
  }
624
633
  async connectedCallback() {
625
- super.connectedCallback(), await this.loadSite();
634
+ super.connectedCallback(), It(), await this.loadSite(), window.addEventListener("locationchange", this.routeChangeListener);
626
635
  }
627
- async disconnectedCallback() {
628
- super.disconnectedCallback();
636
+ disconnectedCallback() {
637
+ super.disconnectedCallback(), window.removeEventListener("locationchange", this.routeChangeListener);
638
+ }
639
+ routeChangeListener() {
640
+ console.log("URL changed:", window.location.href);
629
641
  }
630
642
  async loadSite() {
631
643
  var s;
@@ -637,52 +649,29 @@ class S extends v {
637
649
  addWidgetEl(t) {
638
650
  const e = `ace-widget_${t}`;
639
651
  let s = document.getElementById(e);
640
- s || (s = document.createElement("ace-widget-wrapper"), s.setAttribute("id", e), s.setAttribute("widgetId", t), this.apiUrl !== nt && s.setAttribute("apiUrl", this.apiUrl), this.embedUrl !== ot && s.setAttribute("embedUrl", this.embedUrl), document.body.appendChild(s)), this._widgets = {
652
+ s || (s = document.createElement("ace-widget-wrapper"), s.setAttribute("id", e), s.setAttribute("widgetId", t), this.apiUrl !== rt && s.setAttribute("apiUrl", this.apiUrl), this.embedUrl !== ot && s.setAttribute("embedUrl", this.embedUrl), document.body.appendChild(s)), this._widgets = {
641
653
  ...this._widgets,
642
654
  [t]: s
643
655
  }, window.ace = window.ace || {
644
656
  _c: [],
645
657
  _w: [],
646
- widget: function(i, n) {
647
- window.ace._w.push([i, n]);
658
+ widget: function(i, r) {
659
+ window.ace._w.push([i, r]);
648
660
  },
649
661
  configure: function(i) {
650
662
  window.ace._c.push(i);
651
663
  }
652
664
  };
653
665
  }
654
- async render() {
666
+ render() {
655
667
  if (!this._site)
656
- return d;
657
- const t = [];
658
- (this._site.triggers || []).filter((e) => e.triggerType === "visit").forEach((e) => {
659
- const s = window.location.pathname, i = e.condition.outputs || [];
660
- e.condition.type === "url" && i.forEach((n) => {
661
- var h;
662
- const o = n.action.type === "render_widget";
663
- if ((n.value === s || n.value === "*") && o) {
664
- let l = { widgetId: "" };
665
- try {
666
- l = JSON.parse(n.action.data);
667
- } catch {
668
- l = {
669
- widgetId: ""
670
- };
671
- }
672
- const p = t.findIndex(
673
- (u) => u.widgetId === l.widgetId
674
- ) > -1, c = (((h = this._site) == null ? void 0 : h.widgets) || []).find(
675
- (u) => u.widgetId === l.widgetId
676
- );
677
- c && !p && t.push(c);
678
- }
679
- });
680
- });
681
- for await (const e of t) {
668
+ return l;
669
+ const t = jt(this._site);
670
+ for (const e of t) {
682
671
  const s = this._widgets[e.widgetId];
683
672
  s && s.activate();
684
673
  }
685
- return d;
674
+ return l;
686
675
  }
687
676
  }
688
677
  M([
@@ -695,21 +684,44 @@ M([
695
684
  A()
696
685
  ], S.prototype, "embedUrl", 2);
697
686
  M([
698
- L()
687
+ D()
699
688
  ], S.prototype, "_site", 2);
700
689
  M([
701
- L()
690
+ D()
702
691
  ], S.prototype, "_widgets", 2);
692
+ const jt = (n) => {
693
+ const t = [];
694
+ return (n.triggers || []).filter((e) => e.triggerType === "visit").forEach((e) => {
695
+ const s = window.location.pathname, i = e.condition.outputs || [];
696
+ e.condition.type === "url" && i.forEach((r) => {
697
+ const o = r.action.type === "render_widget";
698
+ if ((r.value === s || r.value === "*") && o) {
699
+ let h = { widgetId: "" };
700
+ try {
701
+ h = JSON.parse(r.action.data);
702
+ } catch {
703
+ h = {
704
+ widgetId: ""
705
+ };
706
+ }
707
+ const d = t.findIndex((a) => a.widgetId === h.widgetId) > -1, p = ((n == null ? void 0 : n.widgets) || []).find(
708
+ (a) => a.widgetId === h.widgetId
709
+ );
710
+ p && !d && t.push(p);
711
+ }
712
+ });
713
+ }), t;
714
+ };
703
715
  window.customElements.get("ace-site") || window.customElements.define("ace-site", S);
704
- var It = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, R = (r, t, e, s) => {
705
- for (var i = s > 1 ? void 0 : s ? jt(t, e) : t, n = r.length - 1, o; n >= 0; n--)
706
- (o = r[n]) && (i = (s ? o(t, e, i) : o(i)) || i);
707
- return s && i && It(t, e, i), i;
716
+ var Lt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, R = (n, t, e, s) => {
717
+ for (var i = s > 1 ? void 0 : s ? kt(t, e) : t, r = n.length - 1, o; r >= 0; r--)
718
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
719
+ return s && i && Lt(t, e, i), i;
708
720
  };
709
- const kt = "https://widgets.ace.teliacompany.net", zt = "https://embed.webprovisions.io";
721
+ const zt = "https://widgets.ace.teliacompany.net", Dt = "https://embed.webprovisions.io";
710
722
  class U extends v {
711
723
  constructor() {
712
- super(...arguments), this.apiUrl = kt, this.embedUrl = zt, this.widget = null, this.scriptEl = null;
724
+ super(...arguments), this.apiUrl = zt, this.embedUrl = Dt, this.widget = null, this.scriptEl = null;
713
725
  }
714
726
  async connectedCallback() {
715
727
  super.connectedCallback(), this.widget = await this._loadWidget(this.widgetId);
@@ -731,7 +743,7 @@ class U extends v {
731
743
  this.widget || (this.widget = await this._loadWidget(this.widgetId)), this._createEmbedScript();
732
744
  }
733
745
  render() {
734
- return this.scriptEl ? this.scriptEl : d;
746
+ return this.scriptEl ? this.scriptEl : l;
735
747
  }
736
748
  }
737
749
  R([
@@ -744,10 +756,10 @@ R([
744
756
  A()
745
757
  ], U.prototype, "embedUrl", 2);
746
758
  R([
747
- L()
759
+ D()
748
760
  ], U.prototype, "widget", 2);
749
761
  R([
750
- L()
762
+ D()
751
763
  ], U.prototype, "scriptEl", 2);
752
764
  customElements.get("ace-widget-wrapper") || customElements.define("ace-widget-wrapper", U);
753
765
  export {
package/index.umd.js CHANGED
@@ -2,17 +2,17 @@
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const $=globalThis,B=$.ShadowRoot&&($.ShadyCSS===void 0||$.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),Q=new WeakMap;let $t=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==G)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(B&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=Q.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Q.set(e,t))}return t}toString(){return this.cssText}};const _t=n=>new $t(typeof n=="string"?n:n+"",void 0,G),ft=(n,t)=>{if(B)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=$.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,n.appendChild(s)}},Y=B?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return _t(e)})(n):n;/**
5
+ */const $=globalThis,B=$.ShadowRoot&&($.ShadyCSS===void 0||$.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),Q=new WeakMap;let $t=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==G)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(B&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=Q.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Q.set(e,t))}return t}toString(){return this.cssText}};const ft=n=>new $t(typeof n=="string"?n:n+"",void 0,G),_t=(n,t)=>{if(B)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),s=$.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,n.appendChild(i)}},Y=B?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return ft(e)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:gt,defineProperty:mt,getOwnPropertyDescriptor:yt,getOwnPropertyNames:At,getOwnPropertySymbols:wt,getPrototypeOf:vt}=Object,_=globalThis,X=_.trustedTypes,bt=X?X.emptyScript:"",V=_.reactiveElementPolyfillSupport,O=(n,t)=>n,k={toAttribute(n,t){switch(t){case Boolean:n=n?bt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},q=(n,t)=>!gt(n,t),tt={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:q};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);class S extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=tt){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&&mt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=yt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const a=i==null?void 0:i.call(this);r.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??tt}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;const t=vt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){const e=this.properties,s=[...At(e),...wt(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(Y(i))}else t!==void 0&&e.push(Y(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(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.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 ft(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var r;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(((r=s.converter)==null?void 0:r.toAttribute)!==void 0?s.converter:k).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){var r;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:k;this._$Em=i,this[i]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(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??(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(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,o]of i)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(e)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),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=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[O("elementProperties")]=new Map,S[O("finalized")]=new Map,V==null||V({ReactiveElement:S}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:gt,defineProperty:mt,getOwnPropertyDescriptor:yt,getOwnPropertyNames:At,getOwnPropertySymbols:wt,getPrototypeOf:vt}=Object,f=globalThis,X=f.trustedTypes,bt=X?X.emptyScript:"",V=f.reactiveElementPolyfillSupport,O=(n,t)=>n,L={toAttribute(n,t){switch(t){case Boolean:n=n?bt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},q=(n,t)=>!gt(n,t),tt={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:q};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),f.litPropertyMetadata??(f.litPropertyMetadata=new WeakMap);class S extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=tt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&mt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=yt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const c=s==null?void 0:s.call(this);r.call(this,o),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??tt}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;const t=vt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){const e=this.properties,i=[...At(e),...wt(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(Y(s))}else t!==void 0&&e.push(Y(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i: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(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _t(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){var r;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:L).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var r;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const o=i.getPropertyOptions(s),c=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:L;this._$Em=s,this[s]=c.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??q)(this[t],e))return;this.P(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(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(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(e)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),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=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[O("elementProperties")]=new Map,S[O("finalized")]=new Map,V==null||V({ReactiveElement:S}),(f.reactiveElementVersions??(f.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const x=globalThis,z=x.trustedTypes,et=z?z.createPolicy("lit-html",{createHTML:n=>n}):void 0,st="$lit$",f=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+f,Et=`<${it}>`,y=document,T=()=>y.createComment(""),N=n=>n===null||typeof n!="object"&&typeof n!="function",J=Array.isArray,St=n=>J(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",K=`[
13
+ */const x=globalThis,W=x.trustedTypes,et=W?W.createPolicy("lit-html",{createHTML:n=>n}):void 0,it="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,st="?"+_,Et=`<${st}>`,y=document,T=()=>y.createComment(""),N=n=>n===null||typeof n!="object"&&typeof n!="function",J=Array.isArray,St=n=>J(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",K=`[
14
14
  \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nt=/-->/g,rt=/>/g,A=RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ot=/'/g,ht=/"/g,at=/^(?:script|style|textarea|title)$/i,U=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ct=new WeakMap,w=y.createTreeWalker(y,129);function lt(n,t){if(!J(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(t):t}const Ut=(n,t)=>{const e=n.length-1,s=[];let i,r=t===2?"<svg>":t===3?"<math>":"",o=H;for(let a=0;a<e;a++){const h=n[a];let l,p,c=-1,u=0;for(;u<h.length&&(o.lastIndex=u,p=o.exec(h),p!==null);)u=o.lastIndex,o===H?p[1]==="!--"?o=nt:p[1]!==void 0?o=rt:p[2]!==void 0?(at.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=A):p[3]!==void 0&&(o=A):o===A?p[0]===">"?(o=i??H,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,l=p[1],o=p[3]===void 0?A:p[3]==='"'?ht:ot):o===ht||o===ot?o=A:o===nt||o===rt?o=H:(o=A,i=void 0);const g=o===A&&n[a+1].startsWith("/>")?" ":"";r+=o===H?h+Et:c>=0?(s.push(l),h.slice(0,c)+st+h.slice(c)+f+g):h+f+(c===-2?a:g)}return[lt(n,r+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class M{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,o=0;const a=t.length-1,h=this.parts,[l,p]=Ut(t,e);if(this.el=M.createElement(l,s),w.currentNode=this.el.content,e===2||e===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=w.nextNode())!==null&&h.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(st)){const u=p[o++],g=i.getAttribute(c).split(f),W=/([.?@])?(.*)/.exec(u);h.push({type:1,index:r,name:W[2],strings:g,ctor:W[1]==="."?Ct:W[1]==="?"?Ot:W[1]==="@"?xt:D}),i.removeAttribute(c)}else c.startsWith(f)&&(h.push({type:6,index:r}),i.removeAttribute(c));if(at.test(i.tagName)){const c=i.textContent.split(f),u=c.length-1;if(u>0){i.textContent=z?z.emptyScript:"";for(let g=0;g<u;g++)i.append(c[g],T()),w.nextNode(),h.push({type:2,index:++r});i.append(c[u],T())}}}else if(i.nodeType===8)if(i.data===it)h.push({type:2,index:r});else{let c=-1;for(;(c=i.data.indexOf(f,c+1))!==-1;)h.push({type:7,index:r}),c+=f.length-1}r++}}static createElement(t,e){const s=y.createElement("template");return s.innerHTML=t,s}}function P(n,t,e=n,s){var o,a;if(t===U)return t;let i=s!==void 0?(o=e.o)==null?void 0:o[s]:e.l;const r=N(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==r&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,e,s)),s!==void 0?(e.o??(e.o=[]))[s]=i:e.l=i),i!==void 0&&(t=P(n,i._$AS(n,t.values),i,s)),t}class Pt{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==null?void 0:t.creationScope)??y).importNode(e,!0);w.currentNode=i;let r=w.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let l;h.type===2?l=new R(r,r.nextSibling,this,t):h.type===1?l=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&(l=new Tt(r,this,t)),this._$AV.push(l),h=s[++a]}o!==(h==null?void 0:h.index)&&(r=w.nextNode(),o++)}return w.currentNode=y,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 R{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this.v=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?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===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==U&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):St(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!==d&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){var r;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=M.createElement(lt(s.h,s.h[0]),this.options)),s);if(((r=this._$AH)==null?void 0:r._$AD)===i)this._$AH.p(e);else{const o=new Pt(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=ct.get(t.strings);return e===void 0&&ct.set(t.strings,e=new M(t)),e}k(t){J(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new R(this.O(T()),this.O(T()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class D{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,i){const r=this.strings;let o=!1;if(r===void 0)t=P(this,t,e,0),o=!N(t)||t!==this._$AH&&t!==U,o&&(this._$AH=t);else{const a=t;let h,l;for(t=r[0],h=0;h<r.length-1;h++)l=P(this,a[s+h],e,h),l===U&&(l=this._$AH[h]),o||(o=!N(l)||l!==this._$AH[h]),l===d?t=d:t!==d&&(t+=(l??"")+r[h+1]),this._$AH[h]=l}o&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ct extends D{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Ot extends D{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class xt extends D{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=P(this,t,e,0)??d)===U)return;const s=this._$AH,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Tt{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 Z=x.litHtmlPolyfillSupport;Z==null||Z(M,R),(x.litHtmlVersions??(x.litHtmlVersions=[])).push("3.2.0");const Nt=(n,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const r=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new R(t.insertBefore(T(),r),r,void 0,e??{})}return i._$AI(n),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ot=/'/g,ht=/"/g,at=/^(?:script|style|textarea|title)$/i,U=Symbol.for("lit-noChange"),l=Symbol.for("lit-nothing"),ct=new WeakMap,w=y.createTreeWalker(y,129);function lt(n,t){if(!J(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(t):t}const Ut=(n,t)=>{const e=n.length-1,i=[];let s,r=t===2?"<svg>":t===3?"<math>":"",o=H;for(let c=0;c<e;c++){const h=n[c];let d,p,a=-1,u=0;for(;u<h.length&&(o.lastIndex=u,p=o.exec(h),p!==null);)u=o.lastIndex,o===H?p[1]==="!--"?o=nt:p[1]!==void 0?o=rt:p[2]!==void 0?(at.test(p[2])&&(s=RegExp("</"+p[2],"g")),o=A):p[3]!==void 0&&(o=A):o===A?p[0]===">"?(o=s??H,a=-1):p[1]===void 0?a=-2:(a=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?A:p[3]==='"'?ht:ot):o===ht||o===ot?o=A:o===nt||o===rt?o=H:(o=A,s=void 0);const g=o===A&&n[c+1].startsWith("/>")?" ":"";r+=o===H?h+Et:a>=0?(i.push(d),h.slice(0,a)+it+h.slice(a)+_+g):h+_+(a===-2?c:g)}return[lt(n,r+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};class M{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,o=0;const c=t.length-1,h=this.parts,[d,p]=Ut(t,e);if(this.el=M.createElement(d,i),w.currentNode=this.el.content,e===2||e===3){const a=this.el.content.firstChild;a.replaceWith(...a.childNodes)}for(;(s=w.nextNode())!==null&&h.length<c;){if(s.nodeType===1){if(s.hasAttributes())for(const a of s.getAttributeNames())if(a.endsWith(it)){const u=p[o++],g=s.getAttribute(a).split(_),D=/([.?@])?(.*)/.exec(u);h.push({type:1,index:r,name:D[2],strings:g,ctor:D[1]==="."?Ct:D[1]==="?"?Ot:D[1]==="@"?xt:k}),s.removeAttribute(a)}else a.startsWith(_)&&(h.push({type:6,index:r}),s.removeAttribute(a));if(at.test(s.tagName)){const a=s.textContent.split(_),u=a.length-1;if(u>0){s.textContent=W?W.emptyScript:"";for(let g=0;g<u;g++)s.append(a[g],T()),w.nextNode(),h.push({type:2,index:++r});s.append(a[u],T())}}}else if(s.nodeType===8)if(s.data===st)h.push({type:2,index:r});else{let a=-1;for(;(a=s.data.indexOf(_,a+1))!==-1;)h.push({type:7,index:r}),a+=_.length-1}r++}}static createElement(t,e){const i=y.createElement("template");return i.innerHTML=t,i}}function P(n,t,e=n,i){var o,c;if(t===U)return t;let s=i!==void 0?(o=e.o)==null?void 0:o[i]:e.l;const r=N(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((c=s==null?void 0:s._$AO)==null||c.call(s,!1),r===void 0?s=void 0:(s=new r(n),s._$AT(n,e,i)),i!==void 0?(e.o??(e.o=[]))[i]=s:e.l=s),s!==void 0&&(t=P(n,s._$AS(n,t.values),s,i)),t}class Pt{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:i}=this._$AD,s=((t==null?void 0:t.creationScope)??y).importNode(e,!0);w.currentNode=s;let r=w.nextNode(),o=0,c=0,h=i[0];for(;h!==void 0;){if(o===h.index){let d;h.type===2?d=new R(r,r.nextSibling,this,t):h.type===1?d=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&(d=new Tt(r,this,t)),this._$AV.push(d),h=i[++c]}o!==(h==null?void 0:h.index)&&(r=w.nextNode(),o++)}return w.currentNode=y,s}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class R{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,i,s){this.type=2,this._$AH=l,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?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===l||t==null||t===""?(this._$AH!==l&&this._$AR(),this._$AH=l):t!==this._$AH&&t!==U&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):St(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!==l&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){var r;const{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=M.createElement(lt(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(e);else{const o=new Pt(s,this),c=o.u(this.options);o.p(e),this.T(c),this._$AH=o}}_$AC(t){let e=ct.get(t.strings);return e===void 0&&ct.set(t.strings,e=new M(t)),e}k(t){J(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new R(this.O(T()),this.O(T()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=l,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=l}_$AI(t,e=this,i,s){const r=this.strings;let o=!1;if(r===void 0)t=P(this,t,e,0),o=!N(t)||t!==this._$AH&&t!==U,o&&(this._$AH=t);else{const c=t;let h,d;for(t=r[0],h=0;h<r.length-1;h++)d=P(this,c[i+h],e,h),d===U&&(d=this._$AH[h]),o||(o=!N(d)||d!==this._$AH[h]),d===l?t=l:t!==l&&(t+=(d??"")+r[h+1]),this._$AH[h]=d}o&&!s&&this.j(t)}j(t){t===l?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ct extends k{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===l?void 0:t}}class Ot extends k{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==l)}}class xt extends k{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=P(this,t,e,0)??l)===U)return;const i=this._$AH,s=t===l&&i!==l||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==l&&(i===l||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Tt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const Z=x.litHtmlPolyfillSupport;Z==null||Z(M,R),(x.litHtmlVersions??(x.litHtmlVersions=[])).push("3.2.0");const Nt=(n,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const r=(e==null?void 0:e.renderBefore)??null;i._$litPart$=s=new R(t.insertBefore(T(),r),r,void 0,e??{})}return s._$AI(n),s};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
@@ -20,8 +20,8 @@
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const Ht={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:q},Mt=(n=Ht,t,e)=>{const{kind:s,metadata:i}=e;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(e.name,n),s==="accessor"){const{name:o}=e;return{set(a){const h=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,h,n)},init(a){return a!==void 0&&this.P(o,void 0,n),a}}}if(s==="setter"){const{name:o}=e;return function(a){const h=this[o];t.call(this,a),this.requestUpdate(o,h,n)}}throw Error("Unsupported decorator location: "+s)};function v(n){return(t,e)=>typeof e=="object"?Mt(n,t,e):((s,i,r)=>{const o=i.hasOwnProperty(r);return i.constructor.createProperty(r,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(i,r):void 0})(n,t,e)}/**
23
+ */const Ht={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:q},Mt=(n=Ht,t,e)=>{const{kind:i,metadata:s}=e;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),r.set(e.name,n),i==="accessor"){const{name:o}=e;return{set(c){const h=t.get.call(this);t.set.call(this,c),this.requestUpdate(o,h,n)},init(c){return c!==void 0&&this.P(o,void 0,n),c}}}if(i==="setter"){const{name:o}=e;return function(c){const h=this[o];t.call(this,c),this.requestUpdate(o,h,n)}}throw Error("Unsupported decorator location: "+i)};function v(n){return(t,e)=>typeof e=="object"?Mt(n,t,e):((i,s,r)=>{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(n,t,e)}/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */function L(n){return v({...n,state:!0,attribute:!1})}var Rt=Object.defineProperty,It=Object.getOwnPropertyDescriptor,I=(n,t,e,s)=>{for(var i=s>1?void 0:s?It(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&Rt(t,e,i),i};const dt="https://widgets.ace.teliacompany.net",pt="https://embed.webprovisions.io";class b extends C{constructor(){super(...arguments),this.apiUrl=dt,this.embedUrl=pt,this._site=null,this._widgets={}}async connectedCallback(){super.connectedCallback(),await this.loadSite()}async disconnectedCallback(){super.disconnectedCallback()}async loadSite(){var s;const e=await(await fetch(`${this.apiUrl}/api/site/${this.siteId}`)).json();this._site=e,(((s=this._site)==null?void 0:s.widgets)||[]).forEach(async i=>{this.addWidgetEl(i.widgetId)})}addWidgetEl(t){const e=`ace-widget_${t}`;let s=document.getElementById(e);s||(s=document.createElement("ace-widget-wrapper"),s.setAttribute("id",e),s.setAttribute("widgetId",t),this.apiUrl!==dt&&s.setAttribute("apiUrl",this.apiUrl),this.embedUrl!==pt&&s.setAttribute("embedUrl",this.embedUrl),document.body.appendChild(s)),this._widgets={...this._widgets,[t]:s},window.ace=window.ace||{_c:[],_w:[],widget:function(i,r){window.ace._w.push([i,r])},configure:function(i){window.ace._c.push(i)}}}async render(){if(!this._site)return d;const t=[];(this._site.triggers||[]).filter(e=>e.triggerType==="visit").forEach(e=>{const s=window.location.pathname,i=e.condition.outputs||[];e.condition.type==="url"&&i.forEach(r=>{var h;const o=r.action.type==="render_widget";if((r.value===s||r.value==="*")&&o){let l={widgetId:""};try{l=JSON.parse(r.action.data)}catch{l={widgetId:""}}const p=t.findIndex(u=>u.widgetId===l.widgetId)>-1,c=(((h=this._site)==null?void 0:h.widgets)||[]).find(u=>u.widgetId===l.widgetId);c&&!p&&t.push(c)}})});for await(const e of t){const s=this._widgets[e.widgetId];s&&s.activate()}return d}}I([v({attribute:!0})],b.prototype,"siteId",2),I([v()],b.prototype,"apiUrl",2),I([v()],b.prototype,"embedUrl",2),I([L()],b.prototype,"_site",2),I([L()],b.prototype,"_widgets",2),window.customElements.get("ace-site")||window.customElements.define("ace-site",b);var jt=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,j=(n,t,e,s)=>{for(var i=s>1?void 0:s?kt(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&jt(t,e,i),i};const zt="https://widgets.ace.teliacompany.net",Dt="https://embed.webprovisions.io";class E extends C{constructor(){super(...arguments),this.apiUrl=zt,this.embedUrl=Dt,this.widget=null,this.scriptEl=null}async connectedCallback(){super.connectedCallback(),this.widget=await this._loadWidget(this.widgetId)}async _loadWidget(t){return await(await fetch(`${this.apiUrl}/api/widget/${t}`)).json()}_createEmbedScript(){var e;if(!((e=this.widget)!=null&&e.distributionName))return;let t=document.createElement("script");t.setAttribute("type","module"),t.setAttribute("async","true"),t.setAttribute("src",`${this.embedUrl}/d/${this.widget.organization}/${this.widget.distributionName}@latest/index.js`),this.scriptEl=t}async activate(){this.widget||(this.widget=await this._loadWidget(this.widgetId)),this._createEmbedScript()}render(){return this.scriptEl?this.scriptEl:d}}j([v({attribute:!0})],E.prototype,"widgetId",2),j([v()],E.prototype,"apiUrl",2),j([v()],E.prototype,"embedUrl",2),j([L()],E.prototype,"widget",2),j([L()],E.prototype,"scriptEl",2),customElements.get("ace-widget-wrapper")||customElements.define("ace-widget-wrapper",E),m.SiteComponent=b,m.WidgetComponent=E,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
27
+ */function z(n){return v({...n,state:!0,attribute:!1})}var Rt=Object.defineProperty,It=Object.getOwnPropertyDescriptor,I=(n,t,e,i)=>{for(var s=i>1?void 0:i?It(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&Rt(t,e,s),s};const dt="https://widgets.ace.teliacompany.net",pt="https://embed.webprovisions.io",jt=()=>{if(typeof window<"u"){const n=history.pushState,t=history.replaceState;history.pushState=function(...e){n.apply(history,e),window.dispatchEvent(new Event("locationchange"))},history.replaceState=function(...e){t.apply(history,e),window.dispatchEvent(new Event("locationchange"))}}};class b extends C{constructor(){super(...arguments),this.apiUrl=dt,this.embedUrl=pt,this._site=null,this._widgets={}}async connectedCallback(){super.connectedCallback(),jt(),await this.loadSite(),window.addEventListener("locationchange",this.routeChangeListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("locationchange",this.routeChangeListener)}routeChangeListener(){console.log("URL changed:",window.location.href)}async loadSite(){var i;const e=await(await fetch(`${this.apiUrl}/api/site/${this.siteId}`)).json();this._site=e,(((i=this._site)==null?void 0:i.widgets)||[]).forEach(async s=>{this.addWidgetEl(s.widgetId)})}addWidgetEl(t){const e=`ace-widget_${t}`;let i=document.getElementById(e);i||(i=document.createElement("ace-widget-wrapper"),i.setAttribute("id",e),i.setAttribute("widgetId",t),this.apiUrl!==dt&&i.setAttribute("apiUrl",this.apiUrl),this.embedUrl!==pt&&i.setAttribute("embedUrl",this.embedUrl),document.body.appendChild(i)),this._widgets={...this._widgets,[t]:i},window.ace=window.ace||{_c:[],_w:[],widget:function(s,r){window.ace._w.push([s,r])},configure:function(s){window.ace._c.push(s)}}}render(){if(!this._site)return l;const t=Lt(this._site);for(const e of t){const i=this._widgets[e.widgetId];i&&i.activate()}return l}}I([v({attribute:!0})],b.prototype,"siteId",2),I([v()],b.prototype,"apiUrl",2),I([v()],b.prototype,"embedUrl",2),I([z()],b.prototype,"_site",2),I([z()],b.prototype,"_widgets",2);const Lt=n=>{const t=[];return(n.triggers||[]).filter(e=>e.triggerType==="visit").forEach(e=>{const i=window.location.pathname,s=e.condition.outputs||[];e.condition.type==="url"&&s.forEach(r=>{const o=r.action.type==="render_widget";if((r.value===i||r.value==="*")&&o){let h={widgetId:""};try{h=JSON.parse(r.action.data)}catch{h={widgetId:""}}const d=t.findIndex(a=>a.widgetId===h.widgetId)>-1,p=((n==null?void 0:n.widgets)||[]).find(a=>a.widgetId===h.widgetId);p&&!d&&t.push(p)}})}),t};window.customElements.get("ace-site")||window.customElements.define("ace-site",b);var Wt=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,j=(n,t,e,i)=>{for(var s=i>1?void 0:i?kt(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&Wt(t,e,s),s};const zt="https://widgets.ace.teliacompany.net",Dt="https://embed.webprovisions.io";class E extends C{constructor(){super(...arguments),this.apiUrl=zt,this.embedUrl=Dt,this.widget=null,this.scriptEl=null}async connectedCallback(){super.connectedCallback(),this.widget=await this._loadWidget(this.widgetId)}async _loadWidget(t){return await(await fetch(`${this.apiUrl}/api/widget/${t}`)).json()}_createEmbedScript(){var e;if(!((e=this.widget)!=null&&e.distributionName))return;let t=document.createElement("script");t.setAttribute("type","module"),t.setAttribute("async","true"),t.setAttribute("src",`${this.embedUrl}/d/${this.widget.organization}/${this.widget.distributionName}@latest/index.js`),this.scriptEl=t}async activate(){this.widget||(this.widget=await this._loadWidget(this.widgetId)),this._createEmbedScript()}render(){return this.scriptEl?this.scriptEl:l}}j([v({attribute:!0})],E.prototype,"widgetId",2),j([v()],E.prototype,"apiUrl",2),j([v()],E.prototype,"embedUrl",2),j([z()],E.prototype,"widget",2),j([z()],E.prototype,"scriptEl",2),customElements.get("ace-widget-wrapper")||customElements.define("ace-widget-wrapper",E),m.SiteComponent=b,m.WidgetComponent=E,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-site",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "dependencies": {
5
5
  "lit": "^3.0.2",
6
6
  "lit-html": "^3.0.2"
@@ -29,9 +29,10 @@ export declare class SiteComponent extends LitElement {
29
29
  _site: Site | null;
30
30
  _widgets: Record<string, WidgetComponent>;
31
31
  connectedCallback(): Promise<void>;
32
- disconnectedCallback(): Promise<void>;
32
+ disconnectedCallback(): void;
33
+ private routeChangeListener;
33
34
  loadSite(): Promise<void>;
34
35
  addWidgetEl(widgetId: string): void;
35
- protected render(): Promise<symbol>;
36
+ protected render(): symbol;
36
37
  }
37
38
  export {};