ui.shipaid.com 0.0.8 → 0.1.1

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/README.md CHANGED
@@ -23,6 +23,16 @@ This is a list of the events emitted by the widget:
23
23
  | `shipaid-loaded` | Dispatched when the widget has finished fetching data from the API, and has successfully rendered. | Contains the data from the ShipAid API: [`ShipAidStore`](/types/shipaid.ts) |
24
24
  | `shipaid-protection-status` | Dispatched a user either adds or removes the protection product from their cart. | `{ protection: boolean, cart: ShopifyCart, lineItem: ShopifyCartItem }` |
25
25
 
26
+ ### Methods
27
+
28
+ This is a list of public methods that can be used to change protection settings:
29
+
30
+ | Method | Description | Payload |
31
+ |--------|-------------|---------|
32
+ | `hasProtection` | Returns a boolean which indicates whether the protection item is currently in the cart. | |
33
+ | `updateCart` | Updates the internal cart, and triggers any protection product updates - use this method in conjunction with ajax carts. | Optional - the cart object from the ajax API. |
34
+ | `addProtection` | Adds the relevant protection item to cart. | |
35
+ | `removeProtection` | Removes the protection item from the cart. | |
26
36
 
27
37
  ## Contributing
28
38
 
@@ -35,13 +45,7 @@ This is a list of the events emitted by the widget:
35
45
 
36
46
  ### Development
37
47
 
38
- Make sure to copy `.env.example` to `.env.local`, and add the ShipAid API endpoint:
39
-
40
- ```env
41
- # Can be either the URL of a local dev instance, or the Nhost staging URL
42
- VITE_APP_SHIPAID_API=http://localhost:1337/v1/graphql
43
- ```
44
- You will need to make sure your development store has the ShipAid app installed, so the store and its protection product is added to the DB.
48
+ You will need to make sure your development store has the ShipAid app installed, so the store and its protection product is added to the DB. You will also need to ensure the Shopify app you are testing this with has an app proxy added, and pointed towards an API instance.
45
49
 
46
50
  ```sh
47
51
  pnpm install
@@ -66,8 +70,6 @@ And add the widget element in your cart (likely `/sections/main-cart-items.liqui
66
70
 
67
71
  ### Build
68
72
 
69
- Create an `.env.production` file, and add the URL to the ShipAid production API.
70
-
71
73
  Once the project has been built, you can publish the project to NPM, and users can add the script to their store using a package CDN (I.e. [Unpkg](https://unpkg.com/)).
72
74
 
73
75
  ```sh
@@ -1,40 +1,40 @@
1
- var vt=Object.defineProperty,_t=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable;var Y=(o,t,e)=>t in o?vt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,C=(o,t)=>{for(var e in t||(t={}))gt.call(t,e)&&Y(o,e,t[e]);if(K)for(var e of K(t))yt.call(t,e)&&Y(o,e,t[e]);return o},P=(o,t)=>_t(o,$t(t));/**
1
+ var xt=Object.defineProperty,Ct=Object.defineProperties;var Pt=Object.getOwnPropertyDescriptors;var ot=Object.getOwnPropertySymbols;var Tt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var rt=(o,t,e)=>t in o?xt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,A=(o,t)=>{for(var e in t||(t={}))Tt.call(t,e)&&rt(o,e,t[e]);if(ot)for(var e of ot(t))Ut.call(t,e)&&rt(o,e,t[e]);return o},b=(o,t)=>Ct(o,Pt(t));/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const wt=o=>t=>typeof t=="function"?((e,i)=>(window.customElements.define(e,i),i))(o,t):((e,i)=>{const{kind:s,elements:r}=i;return{kind:s,elements:r,finisher(n){window.customElements.define(e,n)}}})(o,t);/**
5
+ */const Nt=o=>t=>typeof t=="function"?((e,i)=>(window.customElements.define(e,i),i))(o,t):((e,i)=>{const{kind:r,elements:s}=i;return{kind:r,elements:s,finisher(n){window.customElements.define(e,n)}}})(o,t);/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const At=(o,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?P(C({},t),{finisher(e){e.createProperty(t.key,o)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,o)}};function bt(o){return(t,e)=>e!==void 0?((i,s,r)=>{s.constructor.createProperty(r,i)})(o,t,e):At(o,t)}/**
9
+ */const kt=(o,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?b(A({},t),{finisher(e){e.createProperty(t.key,o)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,o)}};function st(o){return(t,e)=>e!==void 0?((i,r,s)=>{r.constructor.createProperty(s,i)})(o,t,e):kt(o,t)}/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */function $(o){return bt(P(C({},o),{state:!0}))}/**
13
+ */function _(o){return st(b(A({},o),{state:!0}))}/**
14
14
  * @license
15
15
  * Copyright 2021 Google LLC
16
16
  * SPDX-License-Identifier: BSD-3-Clause
17
- */var D;((D=window.HTMLSlotElement)===null||D===void 0?void 0:D.prototype.assignedElements)!=null;/**
17
+ */var F;((F=window.HTMLSlotElement)===null||F===void 0?void 0:F.prototype.assignedElements)!=null;/**
18
18
  * @license
19
19
  * Copyright 2019 Google LLC
20
20
  * SPDX-License-Identifier: BSD-3-Clause
21
- */const L=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,j=Symbol(),Z=new Map;class G{constructor(t,e){if(this._$cssResult$=!0,e!==j)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=Z.get(this.cssText);return L&&t===void 0&&(Z.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const Et=o=>new G(typeof o=="string"?o:o+"",j),xt=(o,...t)=>{const e=o.length===1?o[0]:t.reduce((i,s,r)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+o[r+1],o[0]);return new G(e,j)},St=(o,t)=>{L?o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=window.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,o.appendChild(i)})},Q=L?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Et(e)})(o):o;/**
21
+ */const j=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),nt=new Map;class at{constructor(t,e){if(this._$cssResult$=!0,e!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=nt.get(this.cssText);return j&&t===void 0&&(nt.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const Ot=o=>new at(typeof o=="string"?o:o+"",V),It=(o,...t)=>{const e=o.length===1?o[0]:t.reduce((i,r,s)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+o[s+1],o[0]);return new at(e,V)},Ht=(o,t)=>{j?o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),r=window.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,o.appendChild(i)})},pt=j?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return Ot(e)})(o):o;/**
22
22
  * @license
23
23
  * Copyright 2017 Google LLC
24
24
  * SPDX-License-Identifier: BSD-3-Clause
25
- */var B;const X=window.trustedTypes,Ct=X?X.emptyScript:"",tt=window.reactiveElementPolyfillSupport,V={toAttribute(o,t){switch(t){case Boolean:o=o?Ct:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},et=(o,t)=>t!==o&&(t==t||o==o),F={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:et};class w extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;(e=this.l)!==null&&e!==void 0||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Eh(i,e);s!==void 0&&(this._$Eu.set(s,i),t.push(s))}),t}static createProperty(t,e=F){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const r=this[t];this[e]=s,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||F}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of i)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}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(Q(s))}else t!==void 0&&e.push(Q(t));return e}static _$Eh(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Em(),this.requestUpdate(),(t=this.constructor.l)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$Eg)!==null&&e!==void 0?e:this._$Eg=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$Eg)===null||e===void 0||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return St(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$Eg)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$Eg)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=F){var s,r;const n=this.constructor._$Eh(t,i);if(n!==void 0&&i.reflect===!0){const h=((r=(s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==null&&r!==void 0?r:V.toAttribute)(e,i.type);this._$Ei=t,h==null?this.removeAttribute(n):this.setAttribute(n,h),this._$Ei=null}}_$AK(t,e){var i,s,r;const n=this.constructor,h=n._$Eu.get(t);if(h!==void 0&&this._$Ei!==h){const a=n.getPropertyOptions(h),p=a.converter,u=(r=(s=(i=p)===null||i===void 0?void 0:i.fromAttribute)!==null&&s!==void 0?s:typeof p=="function"?p:null)!==null&&r!==void 0?r:V.fromAttribute;this._$Ei=h,this[h]=u(e,a.type),this._$Ei=null}}requestUpdate(t,e,i){let s=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||et)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Ei!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((s,r)=>this[r]=s),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$Eg)===null||t===void 0||t.forEach(s=>{var r;return(r=s.hostUpdate)===null||r===void 0?void 0:r.call(s)}),this.update(i)):this._$EU()}catch(s){throw e=!1,this._$EU(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$Eg)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?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._$Ep}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$ES(i,this[i],e)),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}w.finalized=!0,w.elementProperties=new Map,w.elementStyles=[],w.shadowRootOptions={mode:"open"},tt==null||tt({ReactiveElement:w}),((B=globalThis.reactiveElementVersions)!==null&&B!==void 0?B:globalThis.reactiveElementVersions=[]).push("1.3.0");/**
25
+ */var B;const ht=window.trustedTypes,Lt=ht?ht.emptyScript:"",ct=window.reactiveElementPolyfillSupport,q={toAttribute(o,t){switch(t){case Boolean:o=o?Lt:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},dt=(o,t)=>t!==o&&(t==t||o==o),W={attribute:!0,type:String,converter:q,reflect:!1,hasChanged:dt};class S extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;(e=this.l)!==null&&e!==void 0||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const r=this._$Eh(i,e);r!==void 0&&(this._$Eu.set(r,i),t.push(r))}),t}static createProperty(t,e=W){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Object.defineProperty(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(r){const s=this[t];this[e]=r,this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||W}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of i)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const r of i)e.unshift(pt(r))}else t!==void 0&&e.push(pt(t));return e}static _$Eh(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Em(),this.requestUpdate(),(t=this.constructor.l)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$Eg)!==null&&e!==void 0?e:this._$Eg=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$Eg)===null||e===void 0||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Ht(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$Eg)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$Eg)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=W){var r,s;const n=this.constructor._$Eh(t,i);if(n!==void 0&&i.reflect===!0){const c=((s=(r=i.converter)===null||r===void 0?void 0:r.toAttribute)!==null&&s!==void 0?s:q.toAttribute)(e,i.type);this._$Ei=t,c==null?this.removeAttribute(n):this.setAttribute(n,c),this._$Ei=null}}_$AK(t,e){var i,r,s;const n=this.constructor,c=n._$Eu.get(t);if(c!==void 0&&this._$Ei!==c){const a=n.getPropertyOptions(c),p=a.converter,l=(s=(r=(i=p)===null||i===void 0?void 0:i.fromAttribute)!==null&&r!==void 0?r:typeof p=="function"?p:null)!==null&&s!==void 0?s:q.fromAttribute;this._$Ei=c,this[c]=l(e,a.type),this._$Ei=null}}requestUpdate(t,e,i){let r=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||dt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Ei!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):r=!1),!this.isUpdatePending&&r&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((r,s)=>this[s]=r),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$Eg)===null||t===void 0||t.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(i)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$Eg)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostUpdated)===null||r===void 0?void 0:r.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._$Ep}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$ES(i,this[i],e)),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}S.finalized=!0,S.elementProperties=new Map,S.elementStyles=[],S.shadowRootOptions={mode:"open"},ct==null||ct({ReactiveElement:S}),((B=globalThis.reactiveElementVersions)!==null&&B!==void 0?B:globalThis.reactiveElementVersions=[]).push("1.3.0");/**
26
26
  * @license
27
27
  * Copyright 2017 Google LLC
28
28
  * SPDX-License-Identifier: BSD-3-Clause
29
- */var W;const A=globalThis.trustedTypes,it=A?A.createPolicy("lit-html",{createHTML:o=>o}):void 0,g=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+g,Pt=`<${ot}>`,b=document,T=(o="")=>b.createComment(o),U=o=>o===null||typeof o!="object"&&typeof o!="function",st=Array.isArray,Tt=o=>{var t;return st(o)||typeof((t=o)===null||t===void 0?void 0:t[Symbol.iterator])=="function"},k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rt=/-->/g,nt=/>/g,y=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,at=/'/g,pt=/"/g,ht=/^(?:script|style|textarea|title)$/i,Ut=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),N=Ut(1),E=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),dt=new WeakMap,kt=(o,t,e)=>{var i,s;const r=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let n=r._$litPart$;if(n===void 0){const h=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;r._$litPart$=n=new I(t.insertBefore(T(),h),h,void 0,e!=null?e:{})}return n._$AI(o),n},x=b.createTreeWalker(b,129,null,!1),Nt=(o,t)=>{const e=o.length-1,i=[];let s,r=t===2?"<svg>":"",n=k;for(let a=0;a<e;a++){const p=o[a];let u,d,l=-1,m=0;for(;m<p.length&&(n.lastIndex=m,d=n.exec(p),d!==null);)m=n.lastIndex,n===k?d[1]==="!--"?n=rt:d[1]!==void 0?n=nt:d[2]!==void 0?(ht.test(d[2])&&(s=RegExp("</"+d[2],"g")),n=y):d[3]!==void 0&&(n=y):n===y?d[0]===">"?(n=s!=null?s:k,l=-1):d[1]===void 0?l=-2:(l=n.lastIndex-d[2].length,u=d[1],n=d[3]===void 0?y:d[3]==='"'?pt:at):n===pt||n===at?n=y:n===rt||n===nt?n=k:(n=y,s=void 0);const z=n===y&&o[a+1].startsWith("/>")?" ":"";r+=n===k?p+Pt:l>=0?(i.push(u),p.slice(0,l)+"$lit$"+p.slice(l)+g+z):p+g+(l===-2?(i.push(void 0),a):z)}const h=r+(o[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return[it!==void 0?it.createHTML(h):h,i]};class O{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,n=0;const h=t.length-1,a=this.parts,[p,u]=Nt(t,e);if(this.el=O.createElement(p,i),x.currentNode=this.el.content,e===2){const d=this.el.content,l=d.firstChild;l.remove(),d.append(...l.childNodes)}for(;(s=x.nextNode())!==null&&a.length<h;){if(s.nodeType===1){if(s.hasAttributes()){const d=[];for(const l of s.getAttributeNames())if(l.endsWith("$lit$")||l.startsWith(g)){const m=u[n++];if(d.push(l),m!==void 0){const z=s.getAttribute(m.toLowerCase()+"$lit$").split(g),M=/([.?@])?(.*)/.exec(m);a.push({type:1,index:r,name:M[2],strings:z,ctor:M[1]==="."?Ot:M[1]==="?"?zt:M[1]==="@"?Mt:R})}else a.push({type:6,index:r})}for(const l of d)s.removeAttribute(l)}if(ht.test(s.tagName)){const d=s.textContent.split(g),l=d.length-1;if(l>0){s.textContent=A?A.emptyScript:"";for(let m=0;m<l;m++)s.append(d[m],T()),x.nextNode(),a.push({type:2,index:++r});s.append(d[l],T())}}}else if(s.nodeType===8)if(s.data===ot)a.push({type:2,index:r});else{let d=-1;for(;(d=s.data.indexOf(g,d+1))!==-1;)a.push({type:7,index:r}),d+=g.length-1}r++}}static createElement(t,e){const i=b.createElement("template");return i.innerHTML=t,i}}function S(o,t,e=o,i){var s,r,n,h;if(t===E)return t;let a=i!==void 0?(s=e._$Cl)===null||s===void 0?void 0:s[i]:e._$Cu;const p=U(t)?void 0:t._$litDirective$;return(a==null?void 0:a.constructor)!==p&&((r=a==null?void 0:a._$AO)===null||r===void 0||r.call(a,!1),p===void 0?a=void 0:(a=new p(o),a._$AT(o,e,i)),i!==void 0?((n=(h=e)._$Cl)!==null&&n!==void 0?n:h._$Cl=[])[i]=a:e._$Cu=a),a!==void 0&&(t=S(o,a._$AS(o,t.values),a,i)),t}class Ht{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,r=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:b).importNode(i,!0);x.currentNode=r;let n=x.nextNode(),h=0,a=0,p=s[0];for(;p!==void 0;){if(h===p.index){let u;p.type===2?u=new I(n,n.nextSibling,this,t):p.type===1?u=new p.ctor(n,p.name,p.strings,this,t):p.type===6&&(u=new Rt(n,this,t)),this.v.push(u),p=s[++a]}h!==(p==null?void 0:p.index)&&(n=x.nextNode(),h++)}return r}m(t){let e=0;for(const i of this.v)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class I{constructor(t,e,i,s){var r;this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=(r=s==null?void 0:s.isConnected)===null||r===void 0||r}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),U(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==E&&this.$(t):t._$litType$!==void 0?this.T(t):t.nodeType!==void 0?this.k(t):Tt(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==c&&U(this._$AH)?this._$AA.nextSibling.data=t:this.k(b.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=O.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.m(i);else{const n=new Ht(r,this),h=n.p(this.options);n.m(i),this.k(h),this._$AH=n}}_$AC(t){let e=dt.get(t.strings);return e===void 0&&dt.set(t.strings,e=new O(t)),e}S(t){st(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 I(this.A(T()),this.A(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||i===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._$Cg=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class R{constructor(t,e,i,s,r){this.type=1,this._$AH=c,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=c}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const r=this.strings;let n=!1;if(r===void 0)t=S(this,t,e,0),n=!U(t)||t!==this._$AH&&t!==E,n&&(this._$AH=t);else{const h=t;let a,p;for(t=r[0],a=0;a<r.length-1;a++)p=S(this,h[i+a],e,a),p===E&&(p=this._$AH[a]),n||(n=!U(p)||p!==this._$AH[a]),p===c?t=c:t!==c&&(t+=(p!=null?p:"")+r[a+1]),this._$AH[a]=p}n&&!s&&this.C(t)}C(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class Ot extends R{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===c?void 0:t}}const It=A?A.emptyScript:"";class zt extends R{constructor(){super(...arguments),this.type=4}C(t){t&&t!==c?this.element.setAttribute(this.name,It):this.element.removeAttribute(this.name)}}class Mt extends R{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){var i;if((t=(i=S(this,t,e,0))!==null&&i!==void 0?i:c)===E)return;const s=this._$AH,r=t===c&&s!==c||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==c&&(s===c||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Rt{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){S(this,t)}}const lt=window.litHtmlPolyfillSupport;lt==null||lt(O,I),((W=globalThis.litHtmlVersions)!==null&&W!==void 0?W:globalThis.litHtmlVersions=[]).push("2.2.0");/**
29
+ */var J;const x=globalThis.trustedTypes,lt=x?x.createPolicy("lit-html",{createHTML:o=>o}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,ut="?"+y,zt=`<${ut}>`,C=document,k=(o="")=>C.createComment(o),O=o=>o===null||typeof o!="object"&&typeof o!="function",ft=Array.isArray,Dt=o=>{var t;return ft(o)||typeof((t=o)===null||t===void 0?void 0:t[Symbol.iterator])=="function"},I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mt=/-->/g,vt=/>/g,E=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_t=/'/g,gt=/"/g,yt=/^(?:script|style|textarea|title)$/i,Mt=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),P=Mt(1),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),$t=new WeakMap,Rt=(o,t,e)=>{var i,r;const s=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let n=s._$litPart$;if(n===void 0){const c=(r=e==null?void 0:e.renderBefore)!==null&&r!==void 0?r:null;s._$litPart$=n=new D(t.insertBefore(k(),c),c,void 0,e!=null?e:{})}return n._$AI(o),n},U=C.createTreeWalker(C,129,null,!1),Ft=(o,t)=>{const e=o.length-1,i=[];let r,s=t===2?"<svg>":"",n=I;for(let a=0;a<e;a++){const p=o[a];let l,h,d=-1,f=0;for(;f<p.length&&(n.lastIndex=f,h=n.exec(p),h!==null);)f=n.lastIndex,n===I?h[1]==="!--"?n=mt:h[1]!==void 0?n=vt:h[2]!==void 0?(yt.test(h[2])&&(r=RegExp("</"+h[2],"g")),n=E):h[3]!==void 0&&(n=E):n===E?h[0]===">"?(n=r!=null?r:I,d=-1):h[1]===void 0?d=-2:(d=n.lastIndex-h[2].length,l=h[1],n=h[3]===void 0?E:h[3]==='"'?gt:_t):n===gt||n===_t?n=E:n===mt||n===vt?n=I:(n=E,r=void 0);const $=n===E&&o[a+1].startsWith("/>")?" ":"";s+=n===I?p+zt:d>=0?(i.push(l),p.slice(0,d)+"$lit$"+p.slice(d)+y+$):p+y+(d===-2?(i.push(void 0),a):$)}const c=s+(o[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return[lt!==void 0?lt.createHTML(c):c,i]};class z{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let s=0,n=0;const c=t.length-1,a=this.parts,[p,l]=Ft(t,e);if(this.el=z.createElement(p,i),U.currentNode=this.el.content,e===2){const h=this.el.content,d=h.firstChild;d.remove(),h.append(...d.childNodes)}for(;(r=U.nextNode())!==null&&a.length<c;){if(r.nodeType===1){if(r.hasAttributes()){const h=[];for(const d of r.getAttributeNames())if(d.endsWith("$lit$")||d.startsWith(y)){const f=l[n++];if(h.push(d),f!==void 0){const $=r.getAttribute(f.toLowerCase()+"$lit$").split(y),w=/([.?@])?(.*)/.exec(f);a.push({type:1,index:s,name:w[2],strings:$,ctor:w[1]==="."?Vt:w[1]==="?"?qt:w[1]==="@"?Wt:M})}else a.push({type:6,index:s})}for(const d of h)r.removeAttribute(d)}if(yt.test(r.tagName)){const h=r.textContent.split(y),d=h.length-1;if(d>0){r.textContent=x?x.emptyScript:"";for(let f=0;f<d;f++)r.append(h[f],k()),U.nextNode(),a.push({type:2,index:++s});r.append(h[d],k())}}}else if(r.nodeType===8)if(r.data===ut)a.push({type:2,index:s});else{let h=-1;for(;(h=r.data.indexOf(y,h+1))!==-1;)a.push({type:7,index:s}),h+=y.length-1}s++}}static createElement(t,e){const i=C.createElement("template");return i.innerHTML=t,i}}function N(o,t,e=o,i){var r,s,n,c;if(t===T)return t;let a=i!==void 0?(r=e._$Cl)===null||r===void 0?void 0:r[i]:e._$Cu;const p=O(t)?void 0:t._$litDirective$;return(a==null?void 0:a.constructor)!==p&&((s=a==null?void 0:a._$AO)===null||s===void 0||s.call(a,!1),p===void 0?a=void 0:(a=new p(o),a._$AT(o,e,i)),i!==void 0?((n=(c=e)._$Cl)!==null&&n!==void 0?n:c._$Cl=[])[i]=a:e._$Cu=a),a!==void 0&&(t=N(o,a._$AS(o,t.values),a,i)),t}class jt{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:r}=this._$AD,s=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:C).importNode(i,!0);U.currentNode=s;let n=U.nextNode(),c=0,a=0,p=r[0];for(;p!==void 0;){if(c===p.index){let l;p.type===2?l=new D(n,n.nextSibling,this,t):p.type===1?l=new p.ctor(n,p.name,p.strings,this,t):p.type===6&&(l=new Jt(n,this,t)),this.v.push(l),p=r[++a]}c!==(p==null?void 0:p.index)&&(n=U.nextNode(),c++)}return s}m(t){let e=0;for(const i of this.v)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class D{constructor(t,e,i,r){var s;this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cg=(s=r==null?void 0:r.isConnected)===null||s===void 0||s}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=N(this,t,e),O(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==T&&this.$(t):t._$litType$!==void 0?this.T(t):t.nodeType!==void 0?this.k(t):Dt(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==u&&O(this._$AH)?this._$AA.nextSibling.data=t:this.k(C.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=z.createElement(r.h,this.options)),r);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===s)this._$AH.m(i);else{const n=new jt(s,this),c=n.p(this.options);n.m(i),this.k(c),this._$AH=n}}_$AC(t){let e=$t.get(t.strings);return e===void 0&&$t.set(t.strings,e=new z(t)),e}S(t){ft(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const s of t)r===e.length?e.push(i=new D(this.A(k()),this.A(k()),this,this.options)):i=e[r],i._$AI(s),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cg=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class M{constructor(t,e,i,r,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=u}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,r){const s=this.strings;let n=!1;if(s===void 0)t=N(this,t,e,0),n=!O(t)||t!==this._$AH&&t!==T,n&&(this._$AH=t);else{const c=t;let a,p;for(t=s[0],a=0;a<s.length-1;a++)p=N(this,c[i+a],e,a),p===T&&(p=this._$AH[a]),n||(n=!O(p)||p!==this._$AH[a]),p===u?t=u:t!==u&&(t+=(p!=null?p:"")+s[a+1]),this._$AH[a]=p}n&&!r&&this.C(t)}C(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class Vt extends M{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===u?void 0:t}}const Bt=x?x.emptyScript:"";class qt extends M{constructor(){super(...arguments),this.type=4}C(t){t&&t!==u?this.element.setAttribute(this.name,Bt):this.element.removeAttribute(this.name)}}class Wt extends M{constructor(t,e,i,r,s){super(t,e,i,r,s),this.type=5}_$AI(t,e=this){var i;if((t=(i=N(this,t,e,0))!==null&&i!==void 0?i:u)===T)return;const r=this._$AH,s=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==u&&(r===u||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class Jt{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){N(this,t)}}const wt=window.litHtmlPolyfillSupport;wt==null||wt(z,D),((J=globalThis.litHtmlVersions)!==null&&J!==void 0?J:globalThis.litHtmlVersions=[]).push("2.2.0");/**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
- */var q,J;class H extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=kt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!1)}render(){return E}}H.finalized=!0,H._$litElement$=!0,(q=globalThis.litElementHydrateSupport)===null||q===void 0||q.call(globalThis,{LitElement:H});const ct=globalThis.litElementPolyfillSupport;ct==null||ct({LitElement:H}),((J=globalThis.litElementVersions)!==null&&J!==void 0?J:globalThis.litElementVersions=[]).push("3.2.0");function Dt(o){if(!o.dispatchEvent||!o.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return o}const v="__registered_effects";function Lt(o){const t=o;if(t[v])return t;const e=Dt(o),i=e.updated;return t[v]={index:0,count:0,effects:[]},e.updated=s=>(t[v].index=0,i(s)),t}function jt(o,t){const e=Lt(o),{index:i,count:s}=e[v];return i===s?(e[v].index++,e[v].count++,e[v].effects.push(t),t):(e[v].index++,e[v].effects[i])}function ut(o,t,e){const i=jt(o,{on:t,observe:["__initial__dirty"]});i.observe.some((s,r)=>e[r]!==s)&&i.on(),i.observe=e}const Bt=(o,t)=>ut(o,t,[]);/**
33
+ */var K,Y;class H extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=Rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!1)}render(){return T}}H.finalized=!0,H._$litElement$=!0,(K=globalThis.litElementHydrateSupport)===null||K===void 0||K.call(globalThis,{LitElement:H});const At=globalThis.litElementPolyfillSupport;At==null||At({LitElement:H}),((Y=globalThis.litElementVersions)!==null&&Y!==void 0?Y:globalThis.litElementVersions=[]).push("3.2.0");function Kt(o){if(!o.dispatchEvent||!o.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return o}const g="__registered_effects";function Yt(o){const t=o;if(t[g])return t;const e=Kt(o),i=e.updated;return t[g]={index:0,count:0,effects:[]},e.updated=r=>(t[g].index=0,i(r)),t}function Zt(o,t){const e=Yt(o),{index:i,count:r}=e[g];return i===r?(e[g].index++,e[g].count++,e[g].effects.push(t),t):(e[g].index++,e[g].effects[i])}function bt(o,t,e){const i=Zt(o,{on:t,observe:["__initial__dirty"]});i.observe.some((r,s)=>e[s]!==r)&&i.on(),i.observe=e}const Gt=(o,t)=>bt(o,t,[]);/**
34
34
  * @license
35
35
  * Copyright 2021 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
- */function ft(o,t,e){return o?t():e==null?void 0:e()}var Vt=xt`
37
+ */function Z(o,t,e){return o?t():e==null?void 0:e()}var Xt=It`
38
38
  :host {
39
39
  --shipaid-primary: #002bd6;
40
40
  --shipaid-secondary: #0076ff;
@@ -202,6 +202,14 @@ var vt=Object.defineProperty,_t=Object.defineProperties;var $t=Object.getOwnProp
202
202
  height: 55px;
203
203
  margin-top: 1rem;
204
204
  }
205
+ .shipaid-prompt .prompt-product .prompt-product-image {
206
+ position: relative;
207
+ }
208
+ .shipaid-prompt .prompt-product .prompt-product-image img {
209
+ height: 30px;
210
+ width: auto;
211
+ object-fit: contain;
212
+ }
205
213
  .shipaid-prompt .prompt-product .prompt-product-details .prompt-product-details-title {
206
214
  font-size: var(--shipaid-font-base);
207
215
  font-weight: var(--shipaid-font-heavy);
@@ -264,7 +272,7 @@ var vt=Object.defineProperty,_t=Object.defineProperties;var $t=Object.getOwnProp
264
272
  color: var(--shipaid-text-grey);
265
273
  font-weight: var(--shipaid-font-heavy);
266
274
  }
267
- `,Ft=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,_=(o,t,e,i)=>{for(var s=i>1?void 0:i?Wt(t,e):t,r=o.length-1,n;r>=0;r--)(n=o[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&Ft(t,e,s),s},qt=(o=>(o.LOADED="shipaid-loaded",o.STATUS_UPDATE="shipaid-protection-status",o))(qt||{});const mt=async(o,t)=>{try{const e=await fetch(o,t);if(!e.ok)throw new Error(await e.text());return await e.json()}catch(e){throw console.error(e),new Error("Failed to complete fetch request.")}};let f=class extends H{constructor(){super(...arguments);var o;this._storeDomain=(o=window.Shopify)==null?void 0:o.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>mt(t),post:(t,e)=>mt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var e,i;Bt(this,async()=>{var a,p;const s=document.createElement("link");s.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),s.setAttribute("rel","stylesheet"),document.head.appendChild(s);const[r,n]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=r,this._cart=n;const h=(p=(a=n.items)==null?void 0:a.some(u=>u.variant_id===r.productVariantNumericId))!=null?p:!1;this._hasProtectionInCart=h,this._hasFinishedSetup=!0,this._dispatchEvent("shipaid-loaded",r)}),ut(this,()=>{var n,h,a,p;if(!((n=this._cart)!=null&&n.items))return;const s=(a=(h=this._cart)==null?void 0:h.items)==null?void 0:a.findIndex(u=>{var d;return u.variant_id===((d=this._store)==null?void 0:d.productVariantNumericId)}),r=(p=this._cart)==null?void 0:p.items[s];this._hasProtectionInCart=!!r,r&&(this._protectionProduct=P(C({},r),{index:s,position:s+1}))},[this._store,this._cart]);const o=N`
275
+ `,L=(o=>(o.LOADED="shipaid-loaded",o.STATUS_UPDATE="shipaid-protection-status",o))(L||{}),Qt=Object.defineProperty,te=Object.getOwnPropertyDescriptor,v=(o,t,e,i)=>{for(var r=i>1?void 0:i?te(t,e):t,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(i?n(t,e,r):n(r))||r);return i&&r&&Qt(t,e,r),r};const Et=async(o,t)=>{try{const e=await fetch(o,t);if(!e.ok)throw new Error(await e.text());return await e.json()}catch(e){throw console.error(e),new Error("Failed to complete fetch request.")}},ee=4e3;let m=class extends H{constructor(){super(...arguments);var o;this._apiEndpoint="/apps/shipaid",this._storeDomain=(o=window.Shopify)==null?void 0:o.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>Et(t),post:(t,e)=>Et(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var e;Gt(this,async()=>{var r,s,n,c;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);try{const[a,p]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=a,this._cart=p}catch{this._hasFinishedSetup=!0;return}if(!((s=(r=this._store)==null?void 0:r.plan)!=null&&s.active)){console.warn("No ShipAid plan is active for this store - skipping setup."),this._hasFinishedSetup=!0;return}if(!((c=(n=this._store)==null?void 0:n.protectionSettings)!=null&&c.protectionType)){console.warn("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0;return}this._hasFinishedSetup=!0,this._dispatchEvent(L.LOADED,this._store),setTimeout(async()=>{var a;!this._hasProtectionInCart&&((a=this._store)==null?void 0:a.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()},500),this.polling&&setInterval(async()=>{if(!this.polling)return;const a=this._cartLastUpdated;a&&new Date().getTime()-a.getTime()<this.polling||await this.updateCart()},this.polling)}),bt(this,async()=>{var h,d,f,$,w;if(this._cartLastUpdated=new Date,!((h=this._cart)!=null&&h.items))return;const i=await this.calculateProtectionTotal(this._cart),r=this._findProtectionVariant(i);if(this._protectionVariant=r,!(r!=null&&r.id))throw new Error("No matching protection variant found.");const s=(f=(d=this._cart.items)==null?void 0:d.findIndex(St=>{var G,X,Q,tt,et;return(et=(tt=(Q=(X=(G=this._store)==null?void 0:G.protectionSettings)==null?void 0:X.product)==null?void 0:Q.variants)==null?void 0:tt.edges)==null?void 0:et.some(({node:R})=>{var it;return(it=R==null?void 0:R.id)==null?void 0:it.includes(St.variant_id.toString())})}))!=null?f:[],n=($=this._cart)==null?void 0:$.items[s];if(this._hasProtectionInCart=!!n,!n)return;if((w=r.id)!=null&&w.includes(n.id.toString())){this._protectionCartItem=b(A({},n),{index:s,position:s+1});return}const c={id:n.key,quantity:0};await this._fetch.post("/cart/change.js",c);const a={id:r.id.replace("gid://shopify/ProductVariant/",""),quantity:1},p=await this._fetch.post("/cart/add.js",a),l=b(A({},this._cart),{items:[p,...this._cart.items]});this._cart=l,this._dispatchEvent(L.STATUS_UPDATE,{protection:!0,cart:l,lineItem:p})},[this._store,this._cart]);const o=P`
268
276
  <div class=${`shipaid-popup ${this._popup==="learn-more"&&"active"}`}>
269
277
  <div class="popup">
270
278
  <button class="popup-close" @click=${()=>{this._popup=null}}>Close</button>
@@ -284,25 +292,28 @@ var vt=Object.defineProperty,_t=Object.defineProperties;var $t=Object.getOwnProp
284
292
  </div>
285
293
  </div>
286
294
  </div>
287
- `,t=N`
295
+ `,t=P`
288
296
  <div class="shipaid-prompt">
289
297
  <p class="prompt-title">${this._hasProtectionInCart?"Active":"Inactive"}</p>
290
298
  <div class="prompt-product">
291
- <!-- <div class="prompt-product-image">
292
- <img src="" alt="ShipAid logo" />
293
- </div> -->
299
+ <div class="prompt-product-image">
300
+ <img
301
+ src="https://uploads-ssl.webflow.com/62295eacde7b7e37b63b0d49/62298401de7b7eeffd3c36c7_Shipaid_emblem-p-500.png"
302
+ alt="ShipAid logo"
303
+ lazy />
304
+ </div>
294
305
  <div class="prompt-product-details">
295
306
  <p class="prompt-product-details-title">Instant Package Protection</p>
296
307
  <p class="prompt-product-details-description">Resolve shipping issues care-free</p>
297
308
  </div>
298
309
  <div class="prompt-product-actions">
299
- <p class="prompt-product-actions-price">${this._currencyFormat((i=(e=this._store)==null?void 0:e.productPrice)!=null?i:0)}</p>
310
+ <p class="prompt-product-actions-price">${((e=this._protectionVariant)==null?void 0:e.price)&&this._currencyFormat(this._protectionVariant.price)}</p>
300
311
  <button class="prompt-product-actions-button" @click=${this._updateProtection} ?disabled=${this._state.loading}>
301
312
  ${this._state.loading?"Loading...":this._hasProtectionInCart?"Remove":"+ Add"}
302
313
  </button>
303
314
  </div>
304
315
  </div>
305
- ${ft(this._state.error,()=>N`<p class="error">${this._state.error}</p>`)}
316
+ ${Z(this._state.error,()=>P`<p class="error">${this._state.error}</p>`)}
306
317
  <div class="prompt-footer">
307
318
  <button class="prompt-footer-about" @click=${()=>{this._popup="learn-more"}}>Learn More</button>
308
319
  <a class="prompt-footer-badge" href="/">
@@ -312,8 +323,8 @@ var vt=Object.defineProperty,_t=Object.defineProperties;var $t=Object.getOwnProp
312
323
  </a>
313
324
  </div>
314
325
  </div>
315
- `;return N`
326
+ `;return P`
316
327
  <div class="shipaid">
317
- ${ft(this._hasFinishedSetup&&this._store,()=>[o,t],()=>N`<p>Loading...</p>`)}
328
+ ${Z(this._hasFinishedSetup,()=>{var i,r;return Z(((r=(i=this._store)==null?void 0:i.plan)==null?void 0:r.active)&&this._store.widgetShowCart,()=>[o,t],()=>P``)},()=>P`<p><slot>Loading ShipAid Widget...</slot></p>`)}
318
329
  </div>
319
- `}_currencyFormat(o){var t,e,i,s,r;return new Intl.NumberFormat((e=(t=window.Shopify)==null?void 0:t.locale)!=null?e:void 0,{currency:((i=this._store)==null?void 0:i.currency)||((r=(s=window.Shopify)==null?void 0:s.currency)==null?void 0:r.active)||"USD",style:"currency"}).format(o)}_dispatchEvent(o,t={}){this.dispatchEvent(new CustomEvent(o,{bubbles:!0,composed:!0,detail:t}))}_setState(o,t){this._state={loading:o==="loading",success:o==="success",error:o==="error"?t||!0:!1}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{const o=this._storeDomain||window.location.hostname;if(!o)throw new Error("Missing store domain - cannot continue.");const t=new URL("https://xfnjpunvafvudwuzwjlm.nhost.run");t.pathname=`/api/rest/store/${o}/properties`;const e=await this._fetch.get(t.toString());if(!e.store)throw new Error(`Could not find a store for ${o}`);if(!e.store.productVariantNumericId)throw new Error("Missing variant ID for ShipAid product.");return e.store}catch(o){throw console.error(o),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(o){throw console.error(o),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async addProtection(){var o,t;try{if(!((o=this._store)!=null&&o.productVariantNumericId))throw new Error("Store has not been loaded.");if(!((t=this._cart)!=null&&t.items))throw new Error("Cart has not been loaded.");this._setState("loading");const e={id:this._store.productVariantNumericId,quantity:1},i=await this._fetch.post("/cart/add.js",e),s=P(C({},this._cart),{items:[i,...this._cart.items]});this._cart=s,this._setState("success"),this._dispatchEvent("shipaid-protection-status",{protection:!0,cart:s,lineItem:i})}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){var o;try{if(!((o=this._store)!=null&&o.productVariantNumericId))throw new Error("Store has not been loaded.");if(!this._protectionProduct)throw new Error("Protection product not found.");this._setState("loading");const t={id:this._protectionProduct.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);this._dispatchEvent("shipaid-protection-status",{protection:!1,cart:e,lineItem:this._protectionProduct}),this._cart=e,this._setState("success")}catch(t){console.error(t),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}};f.styles=Vt,_([$()],f.prototype,"_storeDomain",2),_([$()],f.prototype,"_store",2),_([$()],f.prototype,"_cart",2),_([$()],f.prototype,"_hasFinishedSetup",2),_([$()],f.prototype,"_hasProtectionInCart",2),_([$()],f.prototype,"_protectionProduct",2),_([$()],f.prototype,"_state",2),_([$()],f.prototype,"_popup",2),f=_([wt("shipaid-widget")],f);export{f as ShipAidWidget};
330
+ `}_currencyFormat(o){var t,e,i,r,s;return new Intl.NumberFormat((e=(t=window.Shopify)==null?void 0:t.locale)!=null?e:void 0,{currency:((i=this._store)==null?void 0:i.currency)||((s=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:s.active)||"USD",style:"currency"}).format(Number(o))}_dispatchEvent(o,t={}){this.dispatchEvent(new CustomEvent(o,{bubbles:!0,composed:!0,detail:t}))}async calculateProtectionTotal(o){var r,s,n,c;if(o||(o=await this._fetchCart()),!o)throw new Error("Could not fetch cart.");const t=(r=this._store)==null?void 0:r.protectionSettings;if(!t||!t.product)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const e=((n=(s=o.items)==null?void 0:s.filter(a=>{var p,l,h;return(h=(l=(p=t.product)==null?void 0:p.variants)==null?void 0:l.edges)==null?void 0:h.some(({node:d})=>{var f;return(f=d==null?void 0:d.id)==null?void 0:f.includes(a.variant_id.toString())})}))!=null?n:[]).reduce((a,p)=>a+=p.final_line_price,0),i=o.total_price-e;if(t.protectionType==="FIXED"){if(!t.defaultFee)throw new Error("Missing default fee amount.");if(!((c=t.rules)!=null&&c.length))return t.defaultFee;const a=i/100,p=t.rules.sort((l,h)=>!l.rangeLower||!h.rangeLower?0:l.rangeLower-h.rangeLower).find(l=>{const h=Boolean(l.rangeLower&&l.rangeLower<a);return l.rangeUpper?h&&l.rangeUpper>=a:h});return typeof(p==null?void 0:p.fee)=="number"?p.fee:t.defaultFee}if(t.protectionType==="PERCENTAGE"){const a=i*t.percentage/100;return a>=t.minimumFee?a:t.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(o){var e,i,r;const t=(e=this._store)==null?void 0:e.protectionSettings;if(!t||!((r=(i=t.product)==null?void 0:i.variants)!=null&&r.edges))throw new Error("Missing product and variants from protection settings.");return t.product.variants.edges.flatMap(({node:s})=>{if(!s||!s.price)return[];const n=Number(s.price);return[b(A({},s),{formattedPrice:n})]}).sort((s,n)=>s.formattedPrice-n.formattedPrice).find(s=>s.formattedPrice>=o)}_setState(o,t){this._state={loading:o==="loading",success:o==="success",error:o==="error"?t||!0:!1}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{const o=new URL(window.location.href);o.pathname=this._apiEndpoint;const t=await this._fetch.get(o.toString());if(!t)throw new Error(`Failed to fetch store data for ${o.toString()}`);const[e]=t.stores;if(!e)throw new Error(`Could not find a store for this URL ${o.toString()}.`);return e}catch(o){throw console.error(o),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(o){throw console.error(o),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(o){o||(o=await this._fetchCart()),this._cart=o}async addProtection(){var o,t;try{if(!this._store)throw new Error("Store has not been loaded.");if(!((o=this._cart)!=null&&o.items))throw new Error("Cart has not been loaded.");if(!((t=this._protectionVariant)!=null&&t.id))throw new Error("No protection variant found.");this._setState("loading");const e={id:this._protectionVariant.id.replace("gid://shopify/ProductVariant/",""),quantity:1},i=await this._fetch.post("/cart/add.js",e),r=b(A({},this._cart),{items:[i,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent(L.STATUS_UPDATE,{protection:!0,cart:r,lineItem:i})}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const o={id:this._protectionCartItem.key,quantity:0},t=await this._fetch.post("/cart/change.js",o);this._dispatchEvent(L.STATUS_UPDATE,{protection:!1,cart:t,lineItem:this._protectionCartItem}),this._cart=t,this._setState("success")}catch(o){console.error(o),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}};m.styles=Xt,v([st({type:Number,attribute:!0,converter:o=>o?o==="false"?0:Number(o):ee})],m.prototype,"polling",2),v([_()],m.prototype,"_storeDomain",2),v([_()],m.prototype,"_store",2),v([_()],m.prototype,"_cart",2),v([_()],m.prototype,"_cartLastUpdated",2),v([_()],m.prototype,"_hasFinishedSetup",2),v([_()],m.prototype,"_hasProtectionInCart",2),v([_()],m.prototype,"_protectionCartItem",2),v([_()],m.prototype,"_protectionVariant",2),v([_()],m.prototype,"_state",2),v([_()],m.prototype,"_popup",2),m=v([Nt("shipaid-widget")],m);export{m as ShipAidWidget};
@@ -1,54 +1,53 @@
1
- var jt=Object.defineProperty,Bt=Object.defineProperties,Vt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,_t=(t,e,i)=>e in t?jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,M=(t,e)=>{for(var i in e||(e={}))Ft.call(e,i)&&_t(t,i,e[i]);if(vt)for(var i of vt(e))qt.call(e,i)&&_t(t,i,e[i]);return t},z=(t,e)=>Bt(t,Vt(e)),ShipAidWidget=function(t){"use strict";
1
+ var ShipAidWidget=function(t){"use strict";var e=Object.defineProperty,i=Object.defineProperties,o=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,a=(t,i,o)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[i]=o,p=(t,e)=>{for(var i in e||(e={}))s.call(e,i)&&a(t,i,e[i]);if(r)for(var i of r(e))n.call(e,i)&&a(t,i,e[i]);return t},l=(t,e)=>i(t,o(e))
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */const e=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?z(M({},e),{finisher(i){i.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
6
+ */;const d=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?l(p({},e),{finisher(i){i.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */
11
+ */function h(t){return(e,i)=>{return void 0!==i?(o=t,r=i,void e.constructor.createProperty(r,o)):d(t,e);
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- function i(t){return function(t){return(i,o)=>{return void 0!==o?(r=t,s=o,void i.constructor.createProperty(s,r)):e(t,i);var r,s}}(z(M({},t),{state:!0}))}
16
+ */var o,r}}function c(t){return h(l(p({},t),{state:!0}))}
18
17
  /**
19
18
  * @license
20
19
  * Copyright 2021 Google LLC
21
20
  * SPDX-License-Identifier: BSD-3-Clause
22
- */var o;null===(o=window.HTMLSlotElement)||void 0===o||o.prototype.assignedElements;
21
+ */var u;null===(u=window.HTMLSlotElement)||void 0===u||u.prototype.assignedElements;
23
22
  /**
24
23
  * @license
25
24
  * Copyright 2019 Google LLC
26
25
  * SPDX-License-Identifier: BSD-3-Clause
27
26
  */
28
- const r=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),n=new Map;class a{constructor(t,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=n.get(this.cssText);return r&&void 0===t&&(n.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const p=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",s))(e)})(t):t
27
+ const f=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,v=Symbol(),m=new Map;class g{constructor(t,e){if(this._$cssResult$=!0,e!==v)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=m.get(this.cssText);return f&&void 0===t&&(m.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const _=f?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new g("string"==typeof t?t:t+"",v))(e)})(t):t
29
28
  /**
30
29
  * @license
31
30
  * Copyright 2017 Google LLC
32
31
  * SPDX-License-Identifier: BSD-3-Clause
33
- */;var l;const d=window.trustedTypes,h=d?d.emptyScript:"",c=window.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},f=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:f};class m extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Eh(i,e);void 0!==o&&(this._$Eu.set(o,i),t.push(o))})),t}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=window.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=v){var o,r;const s=this.constructor._$Eh(t,i);if(void 0!==s&&!0===i.reflect){const n=(null!==(r=null===(o=i.converter)||void 0===o?void 0:o.toAttribute)&&void 0!==r?r:u.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Ei=null}}_$AK(t,e){var i,o,r;const s=this.constructor,n=s._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=s.getPropertyOptions(n),a=t.converter,p=null!==(r=null!==(o=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==o?o:"function"==typeof a?a:null)&&void 0!==r?r:u.fromAttribute;this._$Ei=n,this[n]=p(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||f)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),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._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
32
+ */;var y;const $=window.trustedTypes,w=$?$.emptyScript:"",A=window.reactiveElementPolyfillSupport,b={toAttribute(t,e){switch(e){case Boolean:t=t?w:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},S=(t,e)=>e!==t&&(e==e||t==t),E={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:S};class x extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Eh(i,e);void 0!==o&&(this._$Eu.set(o,i),t.push(o))})),t}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||E}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(_(t))}else void 0!==t&&e.push(_(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{f?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=window.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=E){var o,r;const s=this.constructor._$Eh(t,i);if(void 0!==s&&!0===i.reflect){const n=(null!==(r=null===(o=i.converter)||void 0===o?void 0:o.toAttribute)&&void 0!==r?r:b.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Ei=null}}_$AK(t,e){var i,o,r;const s=this.constructor,n=s._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=s.getPropertyOptions(n),a=t.converter,p=null!==(r=null!==(o=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==o?o:"function"==typeof a?a:null)&&void 0!==r?r:b.fromAttribute;this._$Ei=n,this[n]=p(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||S)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),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._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
34
33
  /**
35
34
  * @license
36
35
  * Copyright 2017 Google LLC
37
36
  * SPDX-License-Identifier: BSD-3-Clause
38
37
  */
39
- var _;m.finalized=!0,m.elementProperties=new Map,m.elementStyles=[],m.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:m}),(null!==(l=globalThis.reactiveElementVersions)&&void 0!==l?l:globalThis.reactiveElementVersions=[]).push("1.3.0");const g=globalThis.trustedTypes,y=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,$=`lit$${(Math.random()+"").slice(9)}$`,A="?"+$,w=`<${A}>`,b=document,S=(t="")=>b.createComment(t),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,x=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,C=/-->/g,U=/>/g,T=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,O=/'/g,k=/"/g,N=/^(?:script|style|textarea|title)$/i,H=(L=1,(t,...e)=>({_$litType$:L,strings:t,values:e})),I=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),j=new WeakMap,D=b.createTreeWalker(b,129,null,!1);var L;class W{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[p,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=P;for(let p=0;p<i;p++){const e=t[p];let i,a,l=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===P?"!--"===a[1]?n=C:void 0!==a[1]?n=U:void 0!==a[2]?(N.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=T):void 0!==a[3]&&(n=T):n===T?">"===a[0]?(n=null!=r?r:P,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?T:'"'===a[3]?k:O):n===k||n===O?n=T:n===C||n===U?n=P:(n=T,r=void 0);const h=n===T&&t[p+1].startsWith("/>")?" ":"";s+=n===P?e+w:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+$+h):e+$+(-2===l?(o.push(void 0),p):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==y?y.createHTML(a):a,o]})(t,e);if(this.el=W.createElement(p,i),D.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=D.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith($)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split($),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?J:"?"===e[1]?Y:"@"===e[1]?Z:q})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(N.test(o.tagName)){const t=o.textContent.split($),e=t.length-1;if(e>0){o.textContent=g?g.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],S()),D.nextNode(),a.push({type:2,index:++r});o.append(t[e],S())}}}else if(8===o.nodeType)if(o.data===A)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf($,t+1));)a.push({type:7,index:r}),t+=$.length-1}r++}}static createElement(t,e){const i=b.createElement("template");return i.innerHTML=t,i}}function B(t,e,i=t,o){var r,s,n,a;if(e===I)return e;let p=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const l=E(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==l&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===l?p=void 0:(p=new l(t),p._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=p:i._$Cu=p),void 0!==p&&(e=B(t,p._$AS(t,e.values),p,o)),e}class V{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:b).importNode(i,!0);D.currentNode=r;let s=D.nextNode(),n=0,a=0,p=o[0];for(;void 0!==p;){if(n===p.index){let e;2===p.type?e=new F(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new G(s,this,t)),this.v.push(e),p=o[++a]}n!==(null==p?void 0:p.index)&&(s=D.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class F{constructor(t,e,i,o){var r;this.type=2,this._$AH=R,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cg=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=B(this,t,e),E(t)?t===R||null==t||""===t?(this._$AH!==R&&this._$AR(),this._$AH=R):t!==this._$AH&&t!==I&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return x(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==R&&E(this._$AH)?this._$AA.nextSibling.data=t:this.k(b.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=W.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new V(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=j.get(t.strings);return void 0===e&&j.set(t.strings,e=new W(t)),e}S(t){x(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new F(this.A(S()),this.A(S()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class q{constructor(t,e,i,o,r){this.type=1,this._$AH=R,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=R}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=B(this,t,e,0),s=!E(t)||t!==this._$AH&&t!==I,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=B(this,o[i+n],e,n),a===I&&(a=this._$AH[n]),s||(s=!E(a)||a!==this._$AH[n]),a===R?t=R:t!==R&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.C(t)}C(t){t===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class J extends q{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===R?void 0:t}}const K=g?g.emptyScript:"";class Y extends q{constructor(){super(...arguments),this.type=4}C(t){t&&t!==R?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}}class Z extends q{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=B(this,t,e,0))&&void 0!==i?i:R)===I)return;const o=this._$AH,r=t===R&&o!==R||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==R&&(o===R||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class G{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){B(this,t)}}const Q=window.litHtmlPolyfillSupport;
38
+ var C;x.finalized=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},null==A||A({ReactiveElement:x}),(null!==(y=globalThis.reactiveElementVersions)&&void 0!==y?y:globalThis.reactiveElementVersions=[]).push("1.3.0");const P=globalThis.trustedTypes,T=P?P.createPolicy("lit-html",{createHTML:t=>t}):void 0,U=`lit$${(Math.random()+"").slice(9)}$`,O="?"+U,k=`<${O}>`,N=document,I=(t="")=>N.createComment(t),H=t=>null===t||"object"!=typeof t&&"function"!=typeof t,L=Array.isArray,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,R=/>/g,z=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,j=/'/g,W=/"/g,F=/^(?:script|style|textarea|title)$/i,V=(Y=1,(t,...e)=>({_$litType$:Y,strings:t,values:e})),B=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),J=new WeakMap,K=N.createTreeWalker(N,129,null,!1);var Y;class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[p,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=D;for(let p=0;p<i;p++){const e=t[p];let i,a,l=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===D?"!--"===a[1]?n=M:void 0!==a[1]?n=R:void 0!==a[2]?(F.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=z):void 0!==a[3]&&(n=z):n===z?">"===a[0]?(n=null!=r?r:D,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?z:'"'===a[3]?W:j):n===W||n===j?n=z:n===M||n===R?n=D:(n=z,r=void 0);const h=n===z&&t[p+1].startsWith("/>")?" ":"";s+=n===D?e+k:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+U+h):e+U+(-2===l?(o.push(void 0),p):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==T?T.createHTML(a):a,o]})(t,e);if(this.el=Z.createElement(p,i),K.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=K.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(U)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(U),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?et:"?"===e[1]?ot:"@"===e[1]?rt:tt})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(F.test(o.tagName)){const t=o.textContent.split(U),e=t.length-1;if(e>0){o.textContent=P?P.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],I()),K.nextNode(),a.push({type:2,index:++r});o.append(t[e],I())}}}else if(8===o.nodeType)if(o.data===O)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(U,t+1));)a.push({type:7,index:r}),t+=U.length-1}r++}}static createElement(t,e){const i=N.createElement("template");return i.innerHTML=t,i}}function G(t,e,i=t,o){var r,s,n,a;if(e===B)return e;let p=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const l=H(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==l&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===l?p=void 0:(p=new l(t),p._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=p:i._$Cu=p),void 0!==p&&(e=G(t,p._$AS(t,e.values),p,o)),e}class X{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:N).importNode(i,!0);K.currentNode=r;let s=K.nextNode(),n=0,a=0,p=o[0];for(;void 0!==p;){if(n===p.index){let e;2===p.type?e=new Q(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new st(s,this,t)),this.v.push(e),p=o[++a]}n!==(null==p?void 0:p.index)&&(s=K.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Q{constructor(t,e,i,o){var r;this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cg=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=G(this,t,e),H(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==B&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return L(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==q&&H(this._$AH)?this._$AA.nextSibling.data=t:this.k(N.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Z.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new X(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new Z(t)),e}S(t){L(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new Q(this.A(I()),this.A(I()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class tt{constructor(t,e,i,o,r){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=q}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=G(this,t,e,0),s=!H(t)||t!==this._$AH&&t!==B,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=G(this,o[i+n],e,n),a===B&&(a=this._$AH[n]),s||(s=!H(a)||a!==this._$AH[n]),a===q?t=q:t!==q&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.C(t)}C(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class et extends tt{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===q?void 0:t}}const it=P?P.emptyScript:"";class ot extends tt{constructor(){super(...arguments),this.type=4}C(t){t&&t!==q?this.element.setAttribute(this.name,it):this.element.removeAttribute(this.name)}}class rt extends tt{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=G(this,t,e,0))&&void 0!==i?i:q)===B)return;const o=this._$AH,r=t===q&&o!==q||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==q&&(o===q||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class st{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){G(this,t)}}const nt=window.litHtmlPolyfillSupport;
40
39
  /**
41
40
  * @license
42
41
  * Copyright 2017 Google LLC
43
42
  * SPDX-License-Identifier: BSD-3-Clause
44
43
  */
45
- var X,tt;null==Q||Q(W,F),(null!==(_=globalThis.litHtmlVersions)&&void 0!==_?_:globalThis.litHtmlVersions=[]).push("2.2.0");class et extends m{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new F(e.insertBefore(S(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return I}}et.finalized=!0,et._$litElement$=!0,null===(X=globalThis.litElementHydrateSupport)||void 0===X||X.call(globalThis,{LitElement:et});const it=globalThis.litElementPolyfillSupport;null==it||it({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.0");const ot="__registered_effects";function rt(t){const e=t;if(e[ot])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[ot]={index:0,count:0,effects:[]},i.updated=t=>(e[ot].index=0,o(t)),e}function st(t,e,i){const o=function(t,e){const i=rt(t),{index:o,count:r}=i[ot];return o===r?(i[ot].index++,i[ot].count++,i[ot].effects.push(e),e):(i[ot].index++,i[ot].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
44
+ var at,pt;null==nt||nt(Z,Q),(null!==(C=globalThis.litHtmlVersions)&&void 0!==C?C:globalThis.litHtmlVersions=[]).push("2.2.0");class lt extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new Q(e.insertBefore(I(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return B}}lt.finalized=!0,lt._$litElement$=!0,null===(at=globalThis.litElementHydrateSupport)||void 0===at||at.call(globalThis,{LitElement:lt});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:lt}),(null!==(pt=globalThis.litElementVersions)&&void 0!==pt?pt:globalThis.litElementVersions=[]).push("3.2.0");const ht="__registered_effects";function ct(t){const e=t;if(e[ht])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[ht]={index:0,count:0,effects:[]},i.updated=t=>(e[ht].index=0,o(t)),e}function ut(t,e,i){const o=function(t,e){const i=ct(t),{index:o,count:r}=i[ht];return o===r?(i[ht].index++,i[ht].count++,i[ht].effects.push(e),e):(i[ht].index++,i[ht].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
46
45
  /**
47
46
  * @license
48
47
  * Copyright 2021 Google LLC
49
48
  * SPDX-License-Identifier: BSD-3-Clause
50
49
  */
51
- function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new a(i,s)})`
50
+ function ft(t,e,i){return t?e():null==i?void 0:i()}var vt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new g(i,v)})`
52
51
  :host {
53
52
  --shipaid-primary: #002bd6;
54
53
  --shipaid-secondary: #0076ff;
@@ -216,6 +215,14 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
216
215
  height: 55px;
217
216
  margin-top: 1rem;
218
217
  }
218
+ .shipaid-prompt .prompt-product .prompt-product-image {
219
+ position: relative;
220
+ }
221
+ .shipaid-prompt .prompt-product .prompt-product-image img {
222
+ height: 30px;
223
+ width: auto;
224
+ object-fit: contain;
225
+ }
219
226
  .shipaid-prompt .prompt-product .prompt-product-details .prompt-product-details-title {
220
227
  font-size: var(--shipaid-font-base);
221
228
  font-weight: var(--shipaid-font-heavy);
@@ -278,7 +285,7 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
278
285
  color: var(--shipaid-text-grey);
279
286
  font-weight: var(--shipaid-font-heavy);
280
287
  }
281
- `,pt=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,dt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?lt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&pt(e,i,s),s},ht=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ht||{});const ct=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}};return t.ShipAidWidget=class extends et{constructor(){var t;super(...arguments),this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ct(t),post:(t,e)=>ct(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t,e;((t,e)=>{st(t,e,[])})(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);const[o,r]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=o,this._cart=r;const s=null!=(e=null==(t=r.items)?void 0:t.some((t=>t.variant_id===o.productVariantNumericId)))&&e;this._hasProtectionInCart=s,this._hasFinishedSetup=!0,this._dispatchEvent("shipaid-loaded",o)})),st(this,(()=>{var t,e,i,o;if(null==(t=this._cart)||!t.items)return;const r=null==(i=null==(e=this._cart)?void 0:e.items)?void 0:i.findIndex((t=>{var e;return t.variant_id===(null==(e=this._store)?void 0:e.productVariantNumericId)})),s=null==(o=this._cart)?void 0:o.items[r];this._hasProtectionInCart=!!s,s&&(this._protectionProduct=z(M({},s),{index:r,position:r+1}))}),[this._store,this._cart]);const i=H`
288
+ `,mt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(mt||{}),gt=Object.defineProperty,_t=Object.getOwnPropertyDescriptor,yt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?_t(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&gt(e,i,s),s};const $t=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}};return t.ShipAidWidget=class extends lt{constructor(){var t;super(...arguments),this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>$t(t),post:(t,e)=>$t(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t;((t,e)=>{ut(t,e,[])})(this,(async()=>{var t,e,i,o;const r=document.createElement("link");r.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),r.setAttribute("rel","stylesheet"),document.head.appendChild(r);try{const[t,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch{return void(this._hasFinishedSetup=!0)}return null!=(e=null==(t=this._store)?void 0:t.plan)&&e.active?null!=(o=null==(i=this._store)?void 0:i.protectionSettings)&&o.protectionType?(this._hasFinishedSetup=!0,this._dispatchEvent(mt.LOADED,this._store),setTimeout((async()=>{var t;!this._hasProtectionInCart&&(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.polling&&setInterval((async()=>{if(!this.polling)return;const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.polling||await this.updateCart()}),this.polling))):(console.warn("No protection settings for this store - skipping setup."),void(this._hasFinishedSetup=!0)):(console.warn("No ShipAid plan is active for this store - skipping setup."),void(this._hasFinishedSetup=!0))})),ut(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,null==(t=this._cart)||!t.items)return;const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,null==n||!n.id)throw new Error("No matching protection variant found.");const a=null!=(i=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i,o,r,s;return null==(s=null==(r=null==(o=null==(i=null==(e=this._store)?void 0:e.protectionSettings)?void 0:i.product)?void 0:o.variants)?void 0:r.edges)?void 0:s.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?i:[],d=null==(o=this._cart)?void 0:o.items[a];if(this._hasProtectionInCart=!!d,!d)return;if(null!=(r=n.id)&&r.includes(d.id.toString()))return void(this._protectionCartItem=l(p({},d),{index:a,position:a+1}));const h={id:d.key,quantity:0};await this._fetch.post("/cart/change.js",h);const c={id:n.id.replace("gid://shopify/ProductVariant/",""),quantity:1},u=await this._fetch.post("/cart/add.js",c),f=l(p({},this._cart),{items:[u,...this._cart.items]});this._cart=f,this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:f,lineItem:u})}),[this._store,this._cart]);const e=V`
282
289
  <div class=${`shipaid-popup ${"learn-more"===this._popup&&"active"}`}>
283
290
  <div class="popup">
284
291
  <button class="popup-close" @click=${()=>{this._popup=null}}>Close</button>
@@ -298,25 +305,28 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
298
305
  </div>
299
306
  </div>
300
307
  </div>
301
- `,o=H`
308
+ `,i=V`
302
309
  <div class="shipaid-prompt">
303
310
  <p class="prompt-title">${this._hasProtectionInCart?"Active":"Inactive"}</p>
304
311
  <div class="prompt-product">
305
- <!-- <div class="prompt-product-image">
306
- <img src="" alt="ShipAid logo" />
307
- </div> -->
312
+ <div class="prompt-product-image">
313
+ <img
314
+ src="https://uploads-ssl.webflow.com/62295eacde7b7e37b63b0d49/62298401de7b7eeffd3c36c7_Shipaid_emblem-p-500.png"
315
+ alt="ShipAid logo"
316
+ lazy />
317
+ </div>
308
318
  <div class="prompt-product-details">
309
319
  <p class="prompt-product-details-title">Instant Package Protection</p>
310
320
  <p class="prompt-product-details-description">Resolve shipping issues care-free</p>
311
321
  </div>
312
322
  <div class="prompt-product-actions">
313
- <p class="prompt-product-actions-price">${this._currencyFormat(null!=(e=null==(t=this._store)?void 0:t.productPrice)?e:0)}</p>
323
+ <p class="prompt-product-actions-price">${(null==(t=this._protectionVariant)?void 0:t.price)&&this._currencyFormat(this._protectionVariant.price)}</p>
314
324
  <button class="prompt-product-actions-button" @click=${this._updateProtection} ?disabled=${this._state.loading}>
315
325
  ${this._state.loading?"Loading...":this._hasProtectionInCart?"Remove":"+ Add"}
316
326
  </button>
317
327
  </div>
318
328
  </div>
319
- ${nt(this._state.error,(()=>H`<p class="error">${this._state.error}</p>`))}
329
+ ${ft(this._state.error,(()=>V`<p class="error">${this._state.error}</p>`))}
320
330
  <div class="prompt-footer">
321
331
  <button class="prompt-footer-about" @click=${()=>{this._popup="learn-more"}}>Learn More</button>
322
332
  <a class="prompt-footer-badge" href="/">
@@ -326,8 +336,8 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
326
336
  </a>
327
337
  </div>
328
338
  </div>
329
- `;return H`
339
+ `;return V`
330
340
  <div class="shipaid">
331
- ${nt(this._hasFinishedSetup&&this._store,(()=>[i,o]),(()=>H`<p>Loading...</p>`))}
341
+ ${ft(this._hasFinishedSetup,(()=>{var t,o;return ft((null==(o=null==(t=this._store)?void 0:t.plan)?void 0:o.active)&&this._store.widgetShowCart,(()=>[e,i]),(()=>V``))}),(()=>V`<p><slot>Loading ShipAid Widget...</slot></p>`))}
332
342
  </div>
333
- `}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(t)}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{const t=this._storeDomain||window.location.hostname;if(!t)throw new Error("Missing store domain - cannot continue.");const e=new URL("https://xfnjpunvafvudwuzwjlm.nhost.run");e.pathname=`/api/rest/store/${t}/properties`;const i=await this._fetch.get(e.toString());if(!i.store)throw new Error(`Could not find a store for ${t}`);if(!i.store.productVariantNumericId)throw new Error("Missing variant ID for ShipAid product.");return i.store}catch(L){throw console.error(L),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(L){throw console.error(L),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async addProtection(){var t,e;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(null==(e=this._cart)||!e.items)throw new Error("Cart has not been loaded.");this._setState("loading");const i={id:this._store.productVariantNumericId,quantity:1},o=await this._fetch.post("/cart/add.js",i),r=z(M({},this._cart),{items:[o,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent("shipaid-protection-status",{protection:!0,cart:r,lineItem:o})}catch(i){console.error(i),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){var t;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(!this._protectionProduct)throw new Error("Protection product not found.");this._setState("loading");const e={id:this._protectionProduct.key,quantity:0},i=await this._fetch.post("/cart/change.js",e);this._dispatchEvent("shipaid-protection-status",{protection:!1,cart:i,lineItem:this._protectionProduct}),this._cart=i,this._setState("success")}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}},t.ShipAidWidget.styles=at,dt([i()],t.ShipAidWidget.prototype,"_storeDomain",2),dt([i()],t.ShipAidWidget.prototype,"_store",2),dt([i()],t.ShipAidWidget.prototype,"_cart",2),dt([i()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),dt([i()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),dt([i()],t.ShipAidWidget.prototype,"_protectionProduct",2),dt([i()],t.ShipAidWidget.prototype,"_state",2),dt([i()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=dt([(t=>e=>{return"function"==typeof e?(i=t,o=e,window.customElements.define(i,o),o):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){window.customElements.define(t,e)}}})(t,e);var i,o})("shipaid-widget")],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
343
+ `}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async calculateProtectionTotal(t){var e,i,o,r;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");const s=null==(e=this._store)?void 0:e.protectionSettings;if(!s||!s.product)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const n=(null!=(o=null==(i=t.items)?void 0:i.filter((t=>{var e,i,o;return null==(o=null==(i=null==(e=s.product)?void 0:e.variants)?void 0:i.edges)?void 0:o.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?o:[]).reduce(((t,e)=>t+e.final_line_price),0),a=t.total_price-n;if("FIXED"===s.protectionType){if(!s.defaultFee)throw new Error("Missing default fee amount.");if(null==(r=s.rules)||!r.length)return s.defaultFee;const t=a/100,e=s.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:s.defaultFee}if("PERCENTAGE"===s.protectionType){const t=a*s.percentage/100;return t>=s.minimumFee?t:s.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o;const r=null==(e=this._store)?void 0:e.protectionSettings;if(!r||null==(o=null==(i=r.product)?void 0:i.variants)||!o.edges)throw new Error("Missing product and variants from protection settings.");return r.product.variants.edges.flatMap((({node:t})=>{if(!t||!t.price)return[];const e=Number(t.price);return[l(p({},t),{formattedPrice:e})]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)).find((e=>e.formattedPrice>=t))}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e=await this._fetch.get(t.toString());if(!e)throw new Error(`Failed to fetch store data for ${t.toString()}`);const[i]=e.stores;if(!i)throw new Error(`Could not find a store for this URL ${t.toString()}.`);return i}catch(Y){throw console.error(Y),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(Y){throw console.error(Y),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(null==(t=this._cart)||!t.items)throw new Error("Cart has not been loaded.");if(null==(e=this._protectionVariant)||!e.id)throw new Error("No protection variant found.");this._setState("loading");const i={id:this._protectionVariant.id.replace("gid://shopify/ProductVariant/",""),quantity:1},o=await this._fetch.post("/cart/add.js",i),r=l(p({},this._cart),{items:[o,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:r,lineItem:o})}catch(i){console.error(i),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={id:this._protectionCartItem.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);this._dispatchEvent(mt.STATUS_UPDATE,{protection:!1,cart:e,lineItem:this._protectionCartItem}),this._cart=e,this._setState("success")}catch(Y){console.error(Y),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}},t.ShipAidWidget.styles=vt,yt([h({type:Number,attribute:!0,converter:t=>t?"false"===t?0:Number(t):4e3})],t.ShipAidWidget.prototype,"polling",2),yt([c()],t.ShipAidWidget.prototype,"_storeDomain",2),yt([c()],t.ShipAidWidget.prototype,"_store",2),yt([c()],t.ShipAidWidget.prototype,"_cart",2),yt([c()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),yt([c()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),yt([c()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),yt([c()],t.ShipAidWidget.prototype,"_protectionCartItem",2),yt([c()],t.ShipAidWidget.prototype,"_protectionVariant",2),yt([c()],t.ShipAidWidget.prototype,"_state",2),yt([c()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=yt([(t=>e=>{return"function"==typeof e?(i=t,o=e,window.customElements.define(i,o),o):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){window.customElements.define(t,e)}}})(t,e);var i,o})("shipaid-widget")],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
@@ -1,54 +1,53 @@
1
- var Wt=Object.defineProperty,Bt=Object.defineProperties,Vt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,_t=(t,e,i)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,M=(t,e)=>{for(var i in e||(e={}))Ft.call(e,i)&&_t(t,i,e[i]);if(vt)for(var i of vt(e))qt.call(e,i)&&_t(t,i,e[i]);return t},z=(t,e)=>Bt(t,Vt(e));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShipAidWidget={})}(this,(function(t){"use strict";
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShipAidWidget={})}(this,(function(t){"use strict";var e=Object.defineProperty,i=Object.defineProperties,o=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,a=(t,i,o)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[i]=o,p=(t,e)=>{for(var i in e||(e={}))s.call(e,i)&&a(t,i,e[i]);if(r)for(var i of r(e))n.call(e,i)&&a(t,i,e[i]);return t},l=(t,e)=>i(t,o(e))
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */const e=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?z(M({},e),{finisher(i){i.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
6
+ */;const d=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?l(p({},e),{finisher(i){i.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */
11
+ */function h(t){return(e,i)=>{return void 0!==i?(o=t,r=i,void e.constructor.createProperty(r,o)):d(t,e);
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- function i(t){return function(t){return(i,o)=>{return void 0!==o?(s=t,r=o,void i.constructor.createProperty(r,s)):e(t,i);var s,r}}(z(M({},t),{state:!0}))}
16
+ */var o,r}}function c(t){return h(l(p({},t),{state:!0}))}
18
17
  /**
19
18
  * @license
20
19
  * Copyright 2021 Google LLC
21
20
  * SPDX-License-Identifier: BSD-3-Clause
22
- */var o;null===(o=window.HTMLSlotElement)||void 0===o||o.prototype.assignedElements;
21
+ */var u;null===(u=window.HTMLSlotElement)||void 0===u||u.prototype.assignedElements;
23
22
  /**
24
23
  * @license
25
24
  * Copyright 2019 Google LLC
26
25
  * SPDX-License-Identifier: BSD-3-Clause
27
26
  */
28
- const s=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new Map;class a{constructor(t,e){if(this._$cssResult$=!0,e!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=n.get(this.cssText);return s&&void 0===t&&(n.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const p=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",r))(e)})(t):t
27
+ const f=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,v=Symbol(),m=new Map;class g{constructor(t,e){if(this._$cssResult$=!0,e!==v)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=m.get(this.cssText);return f&&void 0===t&&(m.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const _=f?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new g("string"==typeof t?t:t+"",v))(e)})(t):t
29
28
  /**
30
29
  * @license
31
30
  * Copyright 2017 Google LLC
32
31
  * SPDX-License-Identifier: BSD-3-Clause
33
- */;var l;const d=window.trustedTypes,h=d?d.emptyScript:"",c=window.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},f=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:f};class m extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Eh(i,e);void 0!==o&&(this._$Eu.set(o,i),t.push(o))})),t}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const s=this[t];this[e]=o,this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{s?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=window.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=v){var o,s;const r=this.constructor._$Eh(t,i);if(void 0!==r&&!0===i.reflect){const n=(null!==(s=null===(o=i.converter)||void 0===o?void 0:o.toAttribute)&&void 0!==s?s:u.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Ei=null}}_$AK(t,e){var i,o,s;const r=this.constructor,n=r._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=r.getPropertyOptions(n),a=t.converter,p=null!==(s=null!==(o=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==o?o:"function"==typeof a?a:null)&&void 0!==s?s:u.fromAttribute;this._$Ei=n,this[n]=p(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||f)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),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._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
32
+ */;var y;const $=window.trustedTypes,w=$?$.emptyScript:"",A=window.reactiveElementPolyfillSupport,b={toAttribute(t,e){switch(e){case Boolean:t=t?w:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},S=(t,e)=>e!==t&&(e==e||t==t),E={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:S};class x extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Eh(i,e);void 0!==o&&(this._$Eu.set(o,i),t.push(o))})),t}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||E}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(_(t))}else void 0!==t&&e.push(_(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{f?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=window.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=E){var o,r;const s=this.constructor._$Eh(t,i);if(void 0!==s&&!0===i.reflect){const n=(null!==(r=null===(o=i.converter)||void 0===o?void 0:o.toAttribute)&&void 0!==r?r:b.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Ei=null}}_$AK(t,e){var i,o,r;const s=this.constructor,n=s._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=s.getPropertyOptions(n),a=t.converter,p=null!==(r=null!==(o=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==o?o:"function"==typeof a?a:null)&&void 0!==r?r:b.fromAttribute;this._$Ei=n,this[n]=p(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||S)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),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._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
34
33
  /**
35
34
  * @license
36
35
  * Copyright 2017 Google LLC
37
36
  * SPDX-License-Identifier: BSD-3-Clause
38
37
  */
39
- var _;m.finalized=!0,m.elementProperties=new Map,m.elementStyles=[],m.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:m}),(null!==(l=globalThis.reactiveElementVersions)&&void 0!==l?l:globalThis.reactiveElementVersions=[]).push("1.3.0");const g=globalThis.trustedTypes,y=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,$=`lit$${(Math.random()+"").slice(9)}$`,A="?"+$,w=`<${A}>`,b=document,S=(t="")=>b.createComment(t),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,C=/-->/g,T=/>/g,U=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,O=/'/g,k=/"/g,N=/^(?:script|style|textarea|title)$/i,H=(W=1,(t,...e)=>({_$litType$:W,strings:t,values:e})),I=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),j=new WeakMap,D=b.createTreeWalker(b,129,null,!1);var W;class L{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let s=0,r=0;const n=t.length-1,a=this.parts,[p,l]=((t,e)=>{const i=t.length-1,o=[];let s,r=2===e?"<svg>":"",n=P;for(let p=0;p<i;p++){const e=t[p];let i,a,l=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===P?"!--"===a[1]?n=C:void 0!==a[1]?n=T:void 0!==a[2]?(N.test(a[2])&&(s=RegExp("</"+a[2],"g")),n=U):void 0!==a[3]&&(n=U):n===U?">"===a[0]?(n=null!=s?s:P,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?U:'"'===a[3]?k:O):n===k||n===O?n=U:n===C||n===T?n=P:(n=U,s=void 0);const h=n===U&&t[p+1].startsWith("/>")?" ":"";r+=n===P?e+w:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+$+h):e+$+(-2===l?(o.push(void 0),p):h)}const a=r+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==y?y.createHTML(a):a,o]})(t,e);if(this.el=L.createElement(p,i),D.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=D.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith($)){const i=l[r++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split($),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?J:"?"===e[1]?Y:"@"===e[1]?Z:q})}else a.push({type:6,index:s})}for(const e of t)o.removeAttribute(e)}if(N.test(o.tagName)){const t=o.textContent.split($),e=t.length-1;if(e>0){o.textContent=g?g.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],S()),D.nextNode(),a.push({type:2,index:++s});o.append(t[e],S())}}}else if(8===o.nodeType)if(o.data===A)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=o.data.indexOf($,t+1));)a.push({type:7,index:s}),t+=$.length-1}s++}}static createElement(t,e){const i=b.createElement("template");return i.innerHTML=t,i}}function B(t,e,i=t,o){var s,r,n,a;if(e===I)return e;let p=void 0!==o?null===(s=i._$Cl)||void 0===s?void 0:s[o]:i._$Cu;const l=x(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==l&&(null===(r=null==p?void 0:p._$AO)||void 0===r||r.call(p,!1),void 0===l?p=void 0:(p=new l(t),p._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=p:i._$Cu=p),void 0!==p&&(e=B(t,p._$AS(t,e.values),p,o)),e}class V{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,s=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:b).importNode(i,!0);D.currentNode=s;let r=D.nextNode(),n=0,a=0,p=o[0];for(;void 0!==p;){if(n===p.index){let e;2===p.type?e=new F(r,r.nextSibling,this,t):1===p.type?e=new p.ctor(r,p.name,p.strings,this,t):6===p.type&&(e=new G(r,this,t)),this.v.push(e),p=o[++a]}n!==(null==p?void 0:p.index)&&(r=D.nextNode(),n++)}return s}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class F{constructor(t,e,i,o){var s;this.type=2,this._$AH=R,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cg=null===(s=null==o?void 0:o.isConnected)||void 0===s||s}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=B(this,t,e),x(t)?t===R||null==t||""===t?(this._$AH!==R&&this._$AR(),this._$AH=R):t!==this._$AH&&t!==I&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return E(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==R&&x(this._$AH)?this._$AA.nextSibling.data=t:this.k(b.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,s="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=L.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.m(i);else{const t=new V(s,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=j.get(t.strings);return void 0===e&&j.set(t.strings,e=new L(t)),e}S(t){E(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const s of t)o===e.length?e.push(i=new F(this.A(S()),this.A(S()),this,this.options)):i=e[o],i._$AI(s),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class q{constructor(t,e,i,o,s){this.type=1,this._$AH=R,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=R}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const s=this.strings;let r=!1;if(void 0===s)t=B(this,t,e,0),r=!x(t)||t!==this._$AH&&t!==I,r&&(this._$AH=t);else{const o=t;let n,a;for(t=s[0],n=0;n<s.length-1;n++)a=B(this,o[i+n],e,n),a===I&&(a=this._$AH[n]),r||(r=!x(a)||a!==this._$AH[n]),a===R?t=R:t!==R&&(t+=(null!=a?a:"")+s[n+1]),this._$AH[n]=a}r&&!o&&this.C(t)}C(t){t===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class J extends q{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===R?void 0:t}}const K=g?g.emptyScript:"";class Y extends q{constructor(){super(...arguments),this.type=4}C(t){t&&t!==R?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}}class Z extends q{constructor(t,e,i,o,s){super(t,e,i,o,s),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=B(this,t,e,0))&&void 0!==i?i:R)===I)return;const o=this._$AH,s=t===R&&o!==R||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,r=t!==R&&(o===R||s);s&&this.element.removeEventListener(this.name,this,o),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class G{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){B(this,t)}}const Q=window.litHtmlPolyfillSupport;
38
+ var C;x.finalized=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},null==A||A({ReactiveElement:x}),(null!==(y=globalThis.reactiveElementVersions)&&void 0!==y?y:globalThis.reactiveElementVersions=[]).push("1.3.0");const P=globalThis.trustedTypes,T=P?P.createPolicy("lit-html",{createHTML:t=>t}):void 0,U=`lit$${(Math.random()+"").slice(9)}$`,O="?"+U,k=`<${O}>`,N=document,I=(t="")=>N.createComment(t),H=t=>null===t||"object"!=typeof t&&"function"!=typeof t,L=Array.isArray,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,R=/>/g,z=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,j=/'/g,W=/"/g,F=/^(?:script|style|textarea|title)$/i,V=(Y=1,(t,...e)=>({_$litType$:Y,strings:t,values:e})),B=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),J=new WeakMap,K=N.createTreeWalker(N,129,null,!1);var Y;class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[p,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=D;for(let p=0;p<i;p++){const e=t[p];let i,a,l=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===D?"!--"===a[1]?n=M:void 0!==a[1]?n=R:void 0!==a[2]?(F.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=z):void 0!==a[3]&&(n=z):n===z?">"===a[0]?(n=null!=r?r:D,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?z:'"'===a[3]?W:j):n===W||n===j?n=z:n===M||n===R?n=D:(n=z,r=void 0);const h=n===z&&t[p+1].startsWith("/>")?" ":"";s+=n===D?e+k:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+U+h):e+U+(-2===l?(o.push(void 0),p):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==T?T.createHTML(a):a,o]})(t,e);if(this.el=Z.createElement(p,i),K.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=K.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(U)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(U),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?et:"?"===e[1]?ot:"@"===e[1]?rt:tt})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(F.test(o.tagName)){const t=o.textContent.split(U),e=t.length-1;if(e>0){o.textContent=P?P.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],I()),K.nextNode(),a.push({type:2,index:++r});o.append(t[e],I())}}}else if(8===o.nodeType)if(o.data===O)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(U,t+1));)a.push({type:7,index:r}),t+=U.length-1}r++}}static createElement(t,e){const i=N.createElement("template");return i.innerHTML=t,i}}function G(t,e,i=t,o){var r,s,n,a;if(e===B)return e;let p=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const l=H(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==l&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===l?p=void 0:(p=new l(t),p._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=p:i._$Cu=p),void 0!==p&&(e=G(t,p._$AS(t,e.values),p,o)),e}class X{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:N).importNode(i,!0);K.currentNode=r;let s=K.nextNode(),n=0,a=0,p=o[0];for(;void 0!==p;){if(n===p.index){let e;2===p.type?e=new Q(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new st(s,this,t)),this.v.push(e),p=o[++a]}n!==(null==p?void 0:p.index)&&(s=K.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Q{constructor(t,e,i,o){var r;this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cg=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=G(this,t,e),H(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==B&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return L(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==q&&H(this._$AH)?this._$AA.nextSibling.data=t:this.k(N.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Z.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new X(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new Z(t)),e}S(t){L(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new Q(this.A(I()),this.A(I()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class tt{constructor(t,e,i,o,r){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=q}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=G(this,t,e,0),s=!H(t)||t!==this._$AH&&t!==B,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=G(this,o[i+n],e,n),a===B&&(a=this._$AH[n]),s||(s=!H(a)||a!==this._$AH[n]),a===q?t=q:t!==q&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.C(t)}C(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class et extends tt{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===q?void 0:t}}const it=P?P.emptyScript:"";class ot extends tt{constructor(){super(...arguments),this.type=4}C(t){t&&t!==q?this.element.setAttribute(this.name,it):this.element.removeAttribute(this.name)}}class rt extends tt{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=G(this,t,e,0))&&void 0!==i?i:q)===B)return;const o=this._$AH,r=t===q&&o!==q||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==q&&(o===q||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class st{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){G(this,t)}}const nt=window.litHtmlPolyfillSupport;
40
39
  /**
41
40
  * @license
42
41
  * Copyright 2017 Google LLC
43
42
  * SPDX-License-Identifier: BSD-3-Clause
44
43
  */
45
- var X,tt;null==Q||Q(L,F),(null!==(_=globalThis.litHtmlVersions)&&void 0!==_?_:globalThis.litHtmlVersions=[]).push("2.2.0");class et extends m{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,s;const r=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=r._$litPart$;if(void 0===n){const t=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:null;r._$litPart$=n=new F(e.insertBefore(S(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return I}}et.finalized=!0,et._$litElement$=!0,null===(X=globalThis.litElementHydrateSupport)||void 0===X||X.call(globalThis,{LitElement:et});const it=globalThis.litElementPolyfillSupport;null==it||it({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.0");const ot="__registered_effects";function st(t){const e=t;if(e[ot])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[ot]={index:0,count:0,effects:[]},i.updated=t=>(e[ot].index=0,o(t)),e}function rt(t,e,i){const o=function(t,e){const i=st(t),{index:o,count:s}=i[ot];return o===s?(i[ot].index++,i[ot].count++,i[ot].effects.push(e),e):(i[ot].index++,i[ot].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
44
+ var at,pt;null==nt||nt(Z,Q),(null!==(C=globalThis.litHtmlVersions)&&void 0!==C?C:globalThis.litHtmlVersions=[]).push("2.2.0");class lt extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new Q(e.insertBefore(I(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return B}}lt.finalized=!0,lt._$litElement$=!0,null===(at=globalThis.litElementHydrateSupport)||void 0===at||at.call(globalThis,{LitElement:lt});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:lt}),(null!==(pt=globalThis.litElementVersions)&&void 0!==pt?pt:globalThis.litElementVersions=[]).push("3.2.0");const ht="__registered_effects";function ct(t){const e=t;if(e[ht])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[ht]={index:0,count:0,effects:[]},i.updated=t=>(e[ht].index=0,o(t)),e}function ut(t,e,i){const o=function(t,e){const i=ct(t),{index:o,count:r}=i[ht];return o===r?(i[ht].index++,i[ht].count++,i[ht].effects.push(e),e):(i[ht].index++,i[ht].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
46
45
  /**
47
46
  * @license
48
47
  * Copyright 2021 Google LLC
49
48
  * SPDX-License-Identifier: BSD-3-Clause
50
49
  */
51
- function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new a(i,r)})`
50
+ function ft(t,e,i){return t?e():null==i?void 0:i()}var vt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new g(i,v)})`
52
51
  :host {
53
52
  --shipaid-primary: #002bd6;
54
53
  --shipaid-secondary: #0076ff;
@@ -216,6 +215,14 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
216
215
  height: 55px;
217
216
  margin-top: 1rem;
218
217
  }
218
+ .shipaid-prompt .prompt-product .prompt-product-image {
219
+ position: relative;
220
+ }
221
+ .shipaid-prompt .prompt-product .prompt-product-image img {
222
+ height: 30px;
223
+ width: auto;
224
+ object-fit: contain;
225
+ }
219
226
  .shipaid-prompt .prompt-product .prompt-product-details .prompt-product-details-title {
220
227
  font-size: var(--shipaid-font-base);
221
228
  font-weight: var(--shipaid-font-heavy);
@@ -278,7 +285,7 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
278
285
  color: var(--shipaid-text-grey);
279
286
  font-weight: var(--shipaid-font-heavy);
280
287
  }
281
- `,pt=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,dt=(t,e,i,o)=>{for(var s,r=o>1?void 0:o?lt(e,i):e,n=t.length-1;n>=0;n--)(s=t[n])&&(r=(o?s(e,i,r):s(r))||r);return o&&r&&pt(e,i,r),r},ht=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ht||{});const ct=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}};t.ShipAidWidget=class extends et{constructor(){var t;super(...arguments),this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ct(t),post:(t,e)=>ct(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t,e;((t,e)=>{rt(t,e,[])})(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);const[o,s]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=o,this._cart=s;const r=null!=(e=null==(t=s.items)?void 0:t.some((t=>t.variant_id===o.productVariantNumericId)))&&e;this._hasProtectionInCart=r,this._hasFinishedSetup=!0,this._dispatchEvent("shipaid-loaded",o)})),rt(this,(()=>{var t,e,i,o;if(null==(t=this._cart)||!t.items)return;const s=null==(i=null==(e=this._cart)?void 0:e.items)?void 0:i.findIndex((t=>{var e;return t.variant_id===(null==(e=this._store)?void 0:e.productVariantNumericId)})),r=null==(o=this._cart)?void 0:o.items[s];this._hasProtectionInCart=!!r,r&&(this._protectionProduct=z(M({},r),{index:s,position:s+1}))}),[this._store,this._cart]);const i=H`
288
+ `,mt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(mt||{}),gt=Object.defineProperty,_t=Object.getOwnPropertyDescriptor,yt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?_t(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&gt(e,i,s),s};const $t=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}};t.ShipAidWidget=class extends lt{constructor(){var t;super(...arguments),this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>$t(t),post:(t,e)=>$t(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t;((t,e)=>{ut(t,e,[])})(this,(async()=>{var t,e,i,o;const r=document.createElement("link");r.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),r.setAttribute("rel","stylesheet"),document.head.appendChild(r);try{const[t,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch{return void(this._hasFinishedSetup=!0)}return null!=(e=null==(t=this._store)?void 0:t.plan)&&e.active?null!=(o=null==(i=this._store)?void 0:i.protectionSettings)&&o.protectionType?(this._hasFinishedSetup=!0,this._dispatchEvent(mt.LOADED,this._store),setTimeout((async()=>{var t;!this._hasProtectionInCart&&(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.polling&&setInterval((async()=>{if(!this.polling)return;const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.polling||await this.updateCart()}),this.polling))):(console.warn("No protection settings for this store - skipping setup."),void(this._hasFinishedSetup=!0)):(console.warn("No ShipAid plan is active for this store - skipping setup."),void(this._hasFinishedSetup=!0))})),ut(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,null==(t=this._cart)||!t.items)return;const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,null==n||!n.id)throw new Error("No matching protection variant found.");const a=null!=(i=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i,o,r,s;return null==(s=null==(r=null==(o=null==(i=null==(e=this._store)?void 0:e.protectionSettings)?void 0:i.product)?void 0:o.variants)?void 0:r.edges)?void 0:s.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?i:[],d=null==(o=this._cart)?void 0:o.items[a];if(this._hasProtectionInCart=!!d,!d)return;if(null!=(r=n.id)&&r.includes(d.id.toString()))return void(this._protectionCartItem=l(p({},d),{index:a,position:a+1}));const h={id:d.key,quantity:0};await this._fetch.post("/cart/change.js",h);const c={id:n.id.replace("gid://shopify/ProductVariant/",""),quantity:1},u=await this._fetch.post("/cart/add.js",c),f=l(p({},this._cart),{items:[u,...this._cart.items]});this._cart=f,this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:f,lineItem:u})}),[this._store,this._cart]);const e=V`
282
289
  <div class=${`shipaid-popup ${"learn-more"===this._popup&&"active"}`}>
283
290
  <div class="popup">
284
291
  <button class="popup-close" @click=${()=>{this._popup=null}}>Close</button>
@@ -298,25 +305,28 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
298
305
  </div>
299
306
  </div>
300
307
  </div>
301
- `,o=H`
308
+ `,i=V`
302
309
  <div class="shipaid-prompt">
303
310
  <p class="prompt-title">${this._hasProtectionInCart?"Active":"Inactive"}</p>
304
311
  <div class="prompt-product">
305
- <!-- <div class="prompt-product-image">
306
- <img src="" alt="ShipAid logo" />
307
- </div> -->
312
+ <div class="prompt-product-image">
313
+ <img
314
+ src="https://uploads-ssl.webflow.com/62295eacde7b7e37b63b0d49/62298401de7b7eeffd3c36c7_Shipaid_emblem-p-500.png"
315
+ alt="ShipAid logo"
316
+ lazy />
317
+ </div>
308
318
  <div class="prompt-product-details">
309
319
  <p class="prompt-product-details-title">Instant Package Protection</p>
310
320
  <p class="prompt-product-details-description">Resolve shipping issues care-free</p>
311
321
  </div>
312
322
  <div class="prompt-product-actions">
313
- <p class="prompt-product-actions-price">${this._currencyFormat(null!=(e=null==(t=this._store)?void 0:t.productPrice)?e:0)}</p>
323
+ <p class="prompt-product-actions-price">${(null==(t=this._protectionVariant)?void 0:t.price)&&this._currencyFormat(this._protectionVariant.price)}</p>
314
324
  <button class="prompt-product-actions-button" @click=${this._updateProtection} ?disabled=${this._state.loading}>
315
325
  ${this._state.loading?"Loading...":this._hasProtectionInCart?"Remove":"+ Add"}
316
326
  </button>
317
327
  </div>
318
328
  </div>
319
- ${nt(this._state.error,(()=>H`<p class="error">${this._state.error}</p>`))}
329
+ ${ft(this._state.error,(()=>V`<p class="error">${this._state.error}</p>`))}
320
330
  <div class="prompt-footer">
321
331
  <button class="prompt-footer-about" @click=${()=>{this._popup="learn-more"}}>Learn More</button>
322
332
  <a class="prompt-footer-badge" href="/">
@@ -326,8 +336,8 @@ function nt(t,e,i){return t?e():null==i?void 0:i()}var at=((t,...e)=>{const i=1=
326
336
  </a>
327
337
  </div>
328
338
  </div>
329
- `;return H`
339
+ `;return V`
330
340
  <div class="shipaid">
331
- ${nt(this._hasFinishedSetup&&this._store,(()=>[i,o]),(()=>H`<p>Loading...</p>`))}
341
+ ${ft(this._hasFinishedSetup,(()=>{var t,o;return ft((null==(o=null==(t=this._store)?void 0:t.plan)?void 0:o.active)&&this._store.widgetShowCart,(()=>[e,i]),(()=>V``))}),(()=>V`<p><slot>Loading ShipAid Widget...</slot></p>`))}
332
342
  </div>
333
- `}_currencyFormat(t){var e,i,o,s,r;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(r=null==(s=window.Shopify)?void 0:s.currency)?void 0:r.active)||"USD",style:"currency"}).format(t)}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{const t=this._storeDomain||window.location.hostname;if(!t)throw new Error("Missing store domain - cannot continue.");const e=new URL("https://xfnjpunvafvudwuzwjlm.nhost.run");e.pathname=`/api/rest/store/${t}/properties`;const i=await this._fetch.get(e.toString());if(!i.store)throw new Error(`Could not find a store for ${t}`);if(!i.store.productVariantNumericId)throw new Error("Missing variant ID for ShipAid product.");return i.store}catch(W){throw console.error(W),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(W){throw console.error(W),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async addProtection(){var t,e;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(null==(e=this._cart)||!e.items)throw new Error("Cart has not been loaded.");this._setState("loading");const i={id:this._store.productVariantNumericId,quantity:1},o=await this._fetch.post("/cart/add.js",i),s=z(M({},this._cart),{items:[o,...this._cart.items]});this._cart=s,this._setState("success"),this._dispatchEvent("shipaid-protection-status",{protection:!0,cart:s,lineItem:o})}catch(i){console.error(i),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){var t;try{if(null==(t=this._store)||!t.productVariantNumericId)throw new Error("Store has not been loaded.");if(!this._protectionProduct)throw new Error("Protection product not found.");this._setState("loading");const e={id:this._protectionProduct.key,quantity:0},i=await this._fetch.post("/cart/change.js",e);this._dispatchEvent("shipaid-protection-status",{protection:!1,cart:i,lineItem:this._protectionProduct}),this._cart=i,this._setState("success")}catch(e){console.error(e),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}},t.ShipAidWidget.styles=at,dt([i()],t.ShipAidWidget.prototype,"_storeDomain",2),dt([i()],t.ShipAidWidget.prototype,"_store",2),dt([i()],t.ShipAidWidget.prototype,"_cart",2),dt([i()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),dt([i()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),dt([i()],t.ShipAidWidget.prototype,"_protectionProduct",2),dt([i()],t.ShipAidWidget.prototype,"_state",2),dt([i()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=dt([(t=>e=>{return"function"==typeof e?(i=t,o=e,window.customElements.define(i,o),o):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){window.customElements.define(t,e)}}})(t,e);var i,o})("shipaid-widget")],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
343
+ `}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async calculateProtectionTotal(t){var e,i,o,r;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");const s=null==(e=this._store)?void 0:e.protectionSettings;if(!s||!s.product)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const n=(null!=(o=null==(i=t.items)?void 0:i.filter((t=>{var e,i,o;return null==(o=null==(i=null==(e=s.product)?void 0:e.variants)?void 0:i.edges)?void 0:o.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?o:[]).reduce(((t,e)=>t+e.final_line_price),0),a=t.total_price-n;if("FIXED"===s.protectionType){if(!s.defaultFee)throw new Error("Missing default fee amount.");if(null==(r=s.rules)||!r.length)return s.defaultFee;const t=a/100,e=s.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:s.defaultFee}if("PERCENTAGE"===s.protectionType){const t=a*s.percentage/100;return t>=s.minimumFee?t:s.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o;const r=null==(e=this._store)?void 0:e.protectionSettings;if(!r||null==(o=null==(i=r.product)?void 0:i.variants)||!o.edges)throw new Error("Missing product and variants from protection settings.");return r.product.variants.edges.flatMap((({node:t})=>{if(!t||!t.price)return[];const e=Number(t.price);return[l(p({},t),{formattedPrice:e})]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)).find((e=>e.formattedPrice>=t))}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e=await this._fetch.get(t.toString());if(!e)throw new Error(`Failed to fetch store data for ${t.toString()}`);const[i]=e.stores;if(!i)throw new Error(`Could not find a store for this URL ${t.toString()}.`);return i}catch(Y){throw console.error(Y),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(Y){throw console.error(Y),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(null==(t=this._cart)||!t.items)throw new Error("Cart has not been loaded.");if(null==(e=this._protectionVariant)||!e.id)throw new Error("No protection variant found.");this._setState("loading");const i={id:this._protectionVariant.id.replace("gid://shopify/ProductVariant/",""),quantity:1},o=await this._fetch.post("/cart/add.js",i),r=l(p({},this._cart),{items:[o,...this._cart.items]});this._cart=r,this._setState("success"),this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:r,lineItem:o})}catch(i){console.error(i),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={id:this._protectionCartItem.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);this._dispatchEvent(mt.STATUS_UPDATE,{protection:!1,cart:e,lineItem:this._protectionCartItem}),this._cart=e,this._setState("success")}catch(Y){console.error(Y),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}},t.ShipAidWidget.styles=vt,yt([h({type:Number,attribute:!0,converter:t=>t?"false"===t?0:Number(t):4e3})],t.ShipAidWidget.prototype,"polling",2),yt([c()],t.ShipAidWidget.prototype,"_storeDomain",2),yt([c()],t.ShipAidWidget.prototype,"_store",2),yt([c()],t.ShipAidWidget.prototype,"_cart",2),yt([c()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),yt([c()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),yt([c()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),yt([c()],t.ShipAidWidget.prototype,"_protectionCartItem",2),yt([c()],t.ShipAidWidget.prototype,"_protectionVariant",2),yt([c()],t.ShipAidWidget.prototype,"_state",2),yt([c()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=yt([(t=>e=>{return"function"==typeof e?(i=t,o=e,window.customElements.define(i,o),o):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){window.customElements.define(t,e)}}})(t,e);var i,o})("shipaid-widget")],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui.shipaid.com",
3
3
  "private": false,
4
- "version": "0.0.8",
4
+ "version": "0.1.1",
5
5
  "main": "dist/ui.shipaid.com.umd.js",
6
6
  "unpkg": "dist/ui.shipaid.com.iife.js",
7
7
  "module": "dist/ui.shipaid.com.es.js",
@@ -19,22 +19,23 @@
19
19
  "lint": "eslint . --ext=ts --fix"
20
20
  },
21
21
  "dependencies": {
22
- "@lit-labs/task": "^1.1.1",
23
- "lit": "^2.2.1",
22
+ "@lit-labs/task": "^1.1.2",
23
+ "lit": "^2.2.4",
24
24
  "lit-element-effect": "^1.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@typescript-eslint/eslint-plugin": "^5.15.0",
28
- "@typescript-eslint/parser": "^5.15.0",
27
+ "@typescript-eslint/eslint-plugin": "^5.25.0",
28
+ "@typescript-eslint/parser": "^5.25.0",
29
29
  "eslint": "^7.32.0",
30
30
  "eslint-config-standard": "^16.0.3",
31
31
  "eslint-plugin-html": "^6.2.0",
32
- "eslint-plugin-import": "^2.25.4",
32
+ "eslint-plugin-import": "^2.26.0",
33
33
  "eslint-plugin-lit": "^1.6.1",
34
34
  "eslint-plugin-lit-a11y": "^2.2.0",
35
35
  "eslint-plugin-node": "^11.1.0",
36
36
  "eslint-plugin-promise": "^5.2.0",
37
- "typescript": "^4.6.2",
38
- "vite": "^2.8.6"
37
+ "typescript": "^4.6.4",
38
+ "vite": "^2.9.9",
39
+ "vite-plugin-full-reload": "^1.0.0"
39
40
  }
40
41
  }
package/types/shipaid.ts CHANGED
@@ -1,12 +1,53 @@
1
+ export interface ProtectionSettingsProductVariant {
2
+ id?: string
3
+ sku?: string
4
+ price?: string
5
+ title?: string
6
+ selectedOptions?: { name?: string, value?: string }[]
7
+ }
8
+
9
+ export interface ProtectionSettingsProduct {
10
+ // Making these optional, as it is stored as a jsonb field, so we can't guarantee the format it returns.
11
+ id?: string
12
+ title?: string
13
+ options?: { name: string, value: string }[]
14
+ variants?: {
15
+ edges?: {
16
+ node?: ProtectionSettingsProductVariant
17
+ }[]
18
+ }
19
+ }
20
+
21
+ export interface ProtectionSettings {
22
+ product?: ProtectionSettingsProduct
23
+ }
24
+
25
+ export interface ProtectionSettingsPercentage extends ProtectionSettings {
26
+ protectionType: 'PERCENTAGE'
27
+ percentage: number
28
+ minimumFee: number
29
+ }
30
+ export interface ProtectionSettingsFixed extends ProtectionSettings {
31
+ protectionType: 'FIXED'
32
+ defaultFee?: number
33
+ // Making these optional, as it is stored as a jsonb field, so we can't guarantee the format it returns.
34
+ rules?: {
35
+ fee?: number
36
+ rangeLower?: number
37
+ rangeUpper?: number
38
+ }[]
39
+ }
40
+
1
41
  export interface ShipAidStore {
2
42
  store: string;
3
- productId: string;
4
- productVariantId: string;
5
- productPrice: number;
6
- productVariantNumericId: number
7
43
  currency: string
44
+ widgetAutoOptIn?: boolean
45
+ widgetShowCart?: boolean
46
+ excludedProductTags?: string[]
47
+ plan?: { active: boolean }
48
+ protectionSettings: ProtectionSettingsFixed | ProtectionSettingsPercentage
8
49
  }
9
50
 
10
51
  export interface ShipAidStoreQuery {
11
- store: ShipAidStore | null
52
+ stores: ShipAidStore[]
12
53
  }
package/types/shopify.ts CHANGED
@@ -1,5 +1,18 @@
1
1
  /* eslint-disable no-use-before-define */
2
2
  /* eslint-disable camelcase */
3
+
4
+ declare global {
5
+ interface Window {
6
+ Shopify?: {
7
+ shop?: string
8
+ locale?: string
9
+ currency?: {
10
+ active?: string
11
+ }
12
+ }
13
+ }
14
+ }
15
+
3
16
  export interface ShopifyCart {
4
17
  token: string;
5
18
  note?: null;
@@ -70,15 +83,3 @@ export interface ShopifyCartAddPayload {
70
83
  id: number | string
71
84
  quantity?: number
72
85
  }
73
-
74
- declare global {
75
- interface Window {
76
- Shopify?: {
77
- shop?: string
78
- locale?: string
79
- currency?: {
80
- active?: string
81
- }
82
- }
83
- }
84
- }
@@ -0,0 +1,15 @@
1
+ export enum Events {
2
+ LOADED = 'shipaid-loaded',
3
+ STATUS_UPDATE = 'shipaid-protection-status'
4
+ }
5
+
6
+ export interface State {
7
+ loading: boolean
8
+ success: boolean | null
9
+ error: boolean | string | null
10
+ }
11
+
12
+ export interface FetchHelper {
13
+ get: <Data>(url: string) => Promise<Data>
14
+ post: <Data>(url: string, body: unknown) => Promise<Data>
15
+ }
package/.env.example DELETED
@@ -1 +0,0 @@
1
- VITE_APP_SHIPAID_API=http://localhost:9228