ui.shipaid.com 0.2.23 → 0.3.0-beta.2

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/dist/widget.es.js CHANGED
@@ -3,9 +3,9 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const e$4 = (e2) => (n2) => "function" == typeof n2 ? ((e3, n3) => (customElements.define(e3, n3), n3))(e2, n2) : ((e3, n3) => {
7
- const { kind: t2, elements: s2 } = n3;
8
- return { kind: t2, elements: s2, finisher(n4) {
6
+ const e$7 = (e2) => (n2) => "function" == typeof n2 ? ((e3, n3) => (customElements.define(e3, n3), n3))(e2, n2) : ((e3, n3) => {
7
+ const { kind: t2, elements: s3 } = n3;
8
+ return { kind: t2, elements: s3, finisher(n4) {
9
9
  customElements.define(e3, n4);
10
10
  } };
11
11
  })(e2, n2);
@@ -14,88 +14,88 @@ const e$4 = (e2) => (n2) => "function" == typeof n2 ? ((e3, n3) => (customElemen
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const i$2 = (i2, e2) => "method" === e2.kind && e2.descriptor && !("value" in e2.descriptor) ? { ...e2, finisher(n2) {
17
+ const i$3 = (i2, e2) => "method" === e2.kind && e2.descriptor && !("value" in e2.descriptor) ? { ...e2, finisher(n2) {
18
18
  n2.createProperty(e2.key, i2);
19
19
  } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: e2.key, initializer() {
20
20
  "function" == typeof e2.initializer && (this[e2.key] = e2.initializer.call(this));
21
21
  }, finisher(n2) {
22
22
  n2.createProperty(e2.key, i2);
23
23
  } };
24
- function e$3(e2) {
24
+ function e$6(e2) {
25
25
  return (n2, t2) => void 0 !== t2 ? ((i2, e3, n3) => {
26
26
  e3.constructor.createProperty(n3, i2);
27
- })(e2, n2, t2) : i$2(e2, n2);
27
+ })(e2, n2, t2) : i$3(e2, n2);
28
28
  }
29
29
  /**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
33
  */
34
- function t$2(t2) {
35
- return e$3({ ...t2, state: true });
34
+ function t$3(t2) {
35
+ return e$6({ ...t2, state: true });
36
36
  }
37
37
  /**
38
38
  * @license
39
39
  * Copyright 2021 Google LLC
40
40
  * SPDX-License-Identifier: BSD-3-Clause
41
41
  */
42
- var n$5;
43
- null != (null === (n$5 = window.HTMLSlotElement) || void 0 === n$5 ? void 0 : n$5.prototype.assignedElements) ? (o2, n2) => o2.assignedElements(n2) : (o2, n2) => o2.assignedNodes(n2).filter((o3) => o3.nodeType === Node.ELEMENT_NODE);
42
+ var n$6;
43
+ null != (null === (n$6 = window.HTMLSlotElement) || void 0 === n$6 ? void 0 : n$6.prototype.assignedElements) ? (o3, n2) => o3.assignedElements(n2) : (o3, n2) => o3.assignedNodes(n2).filter((o4) => o4.nodeType === Node.ELEMENT_NODE);
44
44
  /**
45
45
  * @license
46
46
  * Copyright 2019 Google LLC
47
47
  * SPDX-License-Identifier: BSD-3-Clause
48
48
  */
49
- const t$1 = window, e$2 = t$1.ShadowRoot && (void 0 === t$1.ShadyCSS || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$3 = Symbol(), n$4 = /* @__PURE__ */ new WeakMap();
50
- class o$3 {
49
+ const t$2 = window, e$5 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$4 = Symbol(), n$5 = /* @__PURE__ */ new WeakMap();
50
+ let o$4 = class o {
51
51
  constructor(t2, e2, n2) {
52
- if (this._$cssResult$ = true, n2 !== s$3)
52
+ if (this._$cssResult$ = true, n2 !== s$4)
53
53
  throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
54
54
  this.cssText = t2, this.t = e2;
55
55
  }
56
56
  get styleSheet() {
57
57
  let t2 = this.o;
58
- const s2 = this.t;
59
- if (e$2 && void 0 === t2) {
60
- const e2 = void 0 !== s2 && 1 === s2.length;
61
- e2 && (t2 = n$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && n$4.set(s2, t2));
58
+ const s3 = this.t;
59
+ if (e$5 && void 0 === t2) {
60
+ const e2 = void 0 !== s3 && 1 === s3.length;
61
+ e2 && (t2 = n$5.get(s3)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && n$5.set(s3, t2));
62
62
  }
63
63
  return t2;
64
64
  }
65
65
  toString() {
66
66
  return this.cssText;
67
67
  }
68
- }
69
- const r$2 = (t2) => new o$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$3), i$1 = (t2, ...e2) => {
70
- const n2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, n3) => e3 + ((t3) => {
68
+ };
69
+ const r$3 = (t2) => new o$4("string" == typeof t2 ? t2 : t2 + "", void 0, s$4), i$2 = (t2, ...e2) => {
70
+ const n2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s3, n3) => e3 + ((t3) => {
71
71
  if (true === t3._$cssResult$)
72
72
  return t3.cssText;
73
73
  if ("number" == typeof t3)
74
74
  return t3;
75
75
  throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
76
- })(s2) + t2[n3 + 1], t2[0]);
77
- return new o$3(n2, t2, s$3);
78
- }, S$1 = (s2, n2) => {
79
- e$2 ? s2.adoptedStyleSheets = n2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet) : n2.forEach((e2) => {
80
- const n3 = document.createElement("style"), o2 = t$1.litNonce;
81
- void 0 !== o2 && n3.setAttribute("nonce", o2), n3.textContent = e2.cssText, s2.appendChild(n3);
76
+ })(s3) + t2[n3 + 1], t2[0]);
77
+ return new o$4(n2, t2, s$4);
78
+ }, S$1 = (s3, n2) => {
79
+ e$5 ? s3.adoptedStyleSheets = n2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet) : n2.forEach((e2) => {
80
+ const n3 = document.createElement("style"), o3 = t$2.litNonce;
81
+ void 0 !== o3 && n3.setAttribute("nonce", o3), n3.textContent = e2.cssText, s3.appendChild(n3);
82
82
  });
83
- }, c$1 = e$2 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
83
+ }, c$2 = e$5 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
84
84
  let e2 = "";
85
- for (const s2 of t3.cssRules)
86
- e2 += s2.cssText;
87
- return r$2(e2);
85
+ for (const s3 of t3.cssRules)
86
+ e2 += s3.cssText;
87
+ return r$3(e2);
88
88
  })(t2) : t2;
89
89
  /**
90
90
  * @license
91
91
  * Copyright 2017 Google LLC
92
92
  * SPDX-License-Identifier: BSD-3-Clause
93
93
  */
94
- var s$2;
95
- const e$1 = window, r$1 = e$1.trustedTypes, h$1 = r$1 ? r$1.emptyScript : "", o$2 = e$1.reactiveElementPolyfillSupport, n$3 = { toAttribute(t2, i2) {
94
+ var s$3;
95
+ const e$4 = window, r$2 = e$4.trustedTypes, h$2 = r$2 ? r$2.emptyScript : "", o$3 = e$4.reactiveElementPolyfillSupport, n$4 = { toAttribute(t2, i2) {
96
96
  switch (i2) {
97
97
  case Boolean:
98
- t2 = t2 ? h$1 : null;
98
+ t2 = t2 ? h$2 : null;
99
99
  break;
100
100
  case Object:
101
101
  case Array:
@@ -103,90 +103,90 @@ const e$1 = window, r$1 = e$1.trustedTypes, h$1 = r$1 ? r$1.emptyScript : "", o$
103
103
  }
104
104
  return t2;
105
105
  }, fromAttribute(t2, i2) {
106
- let s2 = t2;
106
+ let s3 = t2;
107
107
  switch (i2) {
108
108
  case Boolean:
109
- s2 = null !== t2;
109
+ s3 = null !== t2;
110
110
  break;
111
111
  case Number:
112
- s2 = null === t2 ? null : Number(t2);
112
+ s3 = null === t2 ? null : Number(t2);
113
113
  break;
114
114
  case Object:
115
115
  case Array:
116
116
  try {
117
- s2 = JSON.parse(t2);
117
+ s3 = JSON.parse(t2);
118
118
  } catch (t3) {
119
- s2 = null;
119
+ s3 = null;
120
120
  }
121
121
  }
122
- return s2;
123
- } }, a$1 = (t2, i2) => i2 !== t2 && (i2 == i2 || t2 == t2), l$2 = { attribute: true, type: String, converter: n$3, reflect: false, hasChanged: a$1 };
124
- class d$1 extends HTMLElement {
122
+ return s3;
123
+ } }, a$1 = (t2, i2) => i2 !== t2 && (i2 == i2 || t2 == t2), l$3 = { attribute: true, type: String, converter: n$4, reflect: false, hasChanged: a$1 };
124
+ let d$1 = class d extends HTMLElement {
125
125
  constructor() {
126
126
  super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = false, this.hasUpdated = false, this._$El = null, this.u();
127
127
  }
128
128
  static addInitializer(t2) {
129
129
  var i2;
130
- null !== (i2 = this.h) && void 0 !== i2 || (this.h = []), this.h.push(t2);
130
+ this.finalize(), (null !== (i2 = this.h) && void 0 !== i2 ? i2 : this.h = []).push(t2);
131
131
  }
132
132
  static get observedAttributes() {
133
133
  this.finalize();
134
134
  const t2 = [];
135
- return this.elementProperties.forEach((i2, s2) => {
136
- const e2 = this._$Ep(s2, i2);
137
- void 0 !== e2 && (this._$Ev.set(e2, s2), t2.push(e2));
135
+ return this.elementProperties.forEach((i2, s3) => {
136
+ const e2 = this._$Ep(s3, i2);
137
+ void 0 !== e2 && (this._$Ev.set(e2, s3), t2.push(e2));
138
138
  }), t2;
139
139
  }
140
- static createProperty(t2, i2 = l$2) {
140
+ static createProperty(t2, i2 = l$3) {
141
141
  if (i2.state && (i2.attribute = false), this.finalize(), this.elementProperties.set(t2, i2), !i2.noAccessor && !this.prototype.hasOwnProperty(t2)) {
142
- const s2 = "symbol" == typeof t2 ? Symbol() : "__" + t2, e2 = this.getPropertyDescriptor(t2, s2, i2);
142
+ const s3 = "symbol" == typeof t2 ? Symbol() : "__" + t2, e2 = this.getPropertyDescriptor(t2, s3, i2);
143
143
  void 0 !== e2 && Object.defineProperty(this.prototype, t2, e2);
144
144
  }
145
145
  }
146
- static getPropertyDescriptor(t2, i2, s2) {
146
+ static getPropertyDescriptor(t2, i2, s3) {
147
147
  return { get() {
148
148
  return this[i2];
149
149
  }, set(e2) {
150
150
  const r2 = this[t2];
151
- this[i2] = e2, this.requestUpdate(t2, r2, s2);
151
+ this[i2] = e2, this.requestUpdate(t2, r2, s3);
152
152
  }, configurable: true, enumerable: true };
153
153
  }
154
154
  static getPropertyOptions(t2) {
155
- return this.elementProperties.get(t2) || l$2;
155
+ return this.elementProperties.get(t2) || l$3;
156
156
  }
157
157
  static finalize() {
158
158
  if (this.hasOwnProperty("finalized"))
159
159
  return false;
160
160
  this.finalized = true;
161
161
  const t2 = Object.getPrototypeOf(this);
162
- if (t2.finalize(), this.elementProperties = new Map(t2.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
162
+ if (t2.finalize(), void 0 !== t2.h && (this.h = [...t2.h]), this.elementProperties = new Map(t2.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
163
163
  const t3 = this.properties, i2 = [...Object.getOwnPropertyNames(t3), ...Object.getOwnPropertySymbols(t3)];
164
- for (const s2 of i2)
165
- this.createProperty(s2, t3[s2]);
164
+ for (const s3 of i2)
165
+ this.createProperty(s3, t3[s3]);
166
166
  }
167
167
  return this.elementStyles = this.finalizeStyles(this.styles), true;
168
168
  }
169
169
  static finalizeStyles(i2) {
170
- const s2 = [];
170
+ const s3 = [];
171
171
  if (Array.isArray(i2)) {
172
172
  const e2 = new Set(i2.flat(1 / 0).reverse());
173
173
  for (const i3 of e2)
174
- s2.unshift(c$1(i3));
174
+ s3.unshift(c$2(i3));
175
175
  } else
176
- void 0 !== i2 && s2.push(c$1(i2));
177
- return s2;
176
+ void 0 !== i2 && s3.push(c$2(i2));
177
+ return s3;
178
178
  }
179
179
  static _$Ep(t2, i2) {
180
- const s2 = i2.attribute;
181
- return false === s2 ? void 0 : "string" == typeof s2 ? s2 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
180
+ const s3 = i2.attribute;
181
+ return false === s3 ? void 0 : "string" == typeof s3 ? s3 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
182
182
  }
183
183
  u() {
184
184
  var t2;
185
185
  this._$E_ = new Promise((t3) => this.enableUpdating = t3), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), null === (t2 = this.constructor.h) || void 0 === t2 || t2.forEach((t3) => t3(this));
186
186
  }
187
187
  addController(t2) {
188
- var i2, s2;
189
- (null !== (i2 = this._$ES) && void 0 !== i2 ? i2 : this._$ES = []).push(t2), void 0 !== this.renderRoot && this.isConnected && (null === (s2 = t2.hostConnected) || void 0 === s2 || s2.call(t2));
188
+ var i2, s3;
189
+ (null !== (i2 = this._$ES) && void 0 !== i2 ? i2 : this._$ES = []).push(t2), void 0 !== this.renderRoot && this.isConnected && (null === (s3 = t2.hostConnected) || void 0 === s3 || s3.call(t2));
190
190
  }
191
191
  removeController(t2) {
192
192
  var i2;
@@ -199,8 +199,8 @@ class d$1 extends HTMLElement {
199
199
  }
200
200
  createRenderRoot() {
201
201
  var t2;
202
- const s2 = null !== (t2 = this.shadowRoot) && void 0 !== t2 ? t2 : this.attachShadow(this.constructor.shadowRootOptions);
203
- return S$1(s2, this.constructor.elementStyles), s2;
202
+ const s3 = null !== (t2 = this.shadowRoot) && void 0 !== t2 ? t2 : this.attachShadow(this.constructor.shadowRootOptions);
203
+ return S$1(s3, this.constructor.elementStyles), s3;
204
204
  }
205
205
  connectedCallback() {
206
206
  var t2;
@@ -218,28 +218,28 @@ class d$1 extends HTMLElement {
218
218
  return null === (i2 = t3.hostDisconnected) || void 0 === i2 ? void 0 : i2.call(t3);
219
219
  });
220
220
  }
221
- attributeChangedCallback(t2, i2, s2) {
222
- this._$AK(t2, s2);
221
+ attributeChangedCallback(t2, i2, s3) {
222
+ this._$AK(t2, s3);
223
223
  }
224
- _$EO(t2, i2, s2 = l$2) {
224
+ _$EO(t2, i2, s3 = l$3) {
225
225
  var e2;
226
- const r2 = this.constructor._$Ep(t2, s2);
227
- if (void 0 !== r2 && true === s2.reflect) {
228
- const h2 = (void 0 !== (null === (e2 = s2.converter) || void 0 === e2 ? void 0 : e2.toAttribute) ? s2.converter : n$3).toAttribute(i2, s2.type);
226
+ const r2 = this.constructor._$Ep(t2, s3);
227
+ if (void 0 !== r2 && true === s3.reflect) {
228
+ const h2 = (void 0 !== (null === (e2 = s3.converter) || void 0 === e2 ? void 0 : e2.toAttribute) ? s3.converter : n$4).toAttribute(i2, s3.type);
229
229
  this._$El = t2, null == h2 ? this.removeAttribute(r2) : this.setAttribute(r2, h2), this._$El = null;
230
230
  }
231
231
  }
232
232
  _$AK(t2, i2) {
233
- var s2;
233
+ var s3;
234
234
  const e2 = this.constructor, r2 = e2._$Ev.get(t2);
235
235
  if (void 0 !== r2 && this._$El !== r2) {
236
- const t3 = e2.getPropertyOptions(r2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== (null === (s2 = t3.converter) || void 0 === s2 ? void 0 : s2.fromAttribute) ? t3.converter : n$3;
236
+ const t3 = e2.getPropertyOptions(r2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== (null === (s3 = t3.converter) || void 0 === s3 ? void 0 : s3.fromAttribute) ? t3.converter : n$4;
237
237
  this._$El = r2, this[r2] = h2.fromAttribute(i2, t3.type), this._$El = null;
238
238
  }
239
239
  }
240
- requestUpdate(t2, i2, s2) {
240
+ requestUpdate(t2, i2, s3) {
241
241
  let e2 = true;
242
- void 0 !== t2 && (((s2 = s2 || this.constructor.getPropertyOptions(t2)).hasChanged || a$1)(this[t2], i2) ? (this._$AL.has(t2) || this._$AL.set(t2, i2), true === s2.reflect && this._$El !== t2 && (void 0 === this._$EC && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t2, s2))) : e2 = false), !this.isUpdatePending && e2 && (this._$E_ = this._$Ej());
242
+ void 0 !== t2 && (((s3 = s3 || this.constructor.getPropertyOptions(t2)).hasChanged || a$1)(this[t2], i2) ? (this._$AL.has(t2) || this._$AL.set(t2, i2), true === s3.reflect && this._$El !== t2 && (void 0 === this._$EC && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t2, s3))) : e2 = false), !this.isUpdatePending && e2 && (this._$E_ = this._$Ej());
243
243
  }
244
244
  async _$Ej() {
245
245
  this.isUpdatePending = true;
@@ -260,16 +260,16 @@ class d$1 extends HTMLElement {
260
260
  return;
261
261
  this.hasUpdated, this._$Ei && (this._$Ei.forEach((t3, i3) => this[i3] = t3), this._$Ei = void 0);
262
262
  let i2 = false;
263
- const s2 = this._$AL;
263
+ const s3 = this._$AL;
264
264
  try {
265
- i2 = this.shouldUpdate(s2), i2 ? (this.willUpdate(s2), null === (t2 = this._$ES) || void 0 === t2 || t2.forEach((t3) => {
265
+ i2 = this.shouldUpdate(s3), i2 ? (this.willUpdate(s3), null === (t2 = this._$ES) || void 0 === t2 || t2.forEach((t3) => {
266
266
  var i3;
267
267
  return null === (i3 = t3.hostUpdate) || void 0 === i3 ? void 0 : i3.call(t3);
268
- }), this.update(s2)) : this._$Ek();
268
+ }), this.update(s3)) : this._$Ek();
269
269
  } catch (t3) {
270
270
  throw i2 = false, this._$Ek(), t3;
271
271
  }
272
- i2 && this._$AE(s2);
272
+ i2 && this._$AE(s3);
273
273
  }
274
274
  willUpdate(t2) {
275
275
  }
@@ -299,39 +299,39 @@ class d$1 extends HTMLElement {
299
299
  }
300
300
  firstUpdated(t2) {
301
301
  }
302
- }
303
- d$1.finalized = true, d$1.elementProperties = /* @__PURE__ */ new Map(), d$1.elementStyles = [], d$1.shadowRootOptions = { mode: "open" }, null == o$2 || o$2({ ReactiveElement: d$1 }), (null !== (s$2 = e$1.reactiveElementVersions) && void 0 !== s$2 ? s$2 : e$1.reactiveElementVersions = []).push("1.4.1");
302
+ };
303
+ d$1.finalized = true, d$1.elementProperties = /* @__PURE__ */ new Map(), d$1.elementStyles = [], d$1.shadowRootOptions = { mode: "open" }, null == o$3 || o$3({ ReactiveElement: d$1 }), (null !== (s$3 = e$4.reactiveElementVersions) && void 0 !== s$3 ? s$3 : e$4.reactiveElementVersions = []).push("1.6.1");
304
304
  /**
305
305
  * @license
306
306
  * Copyright 2017 Google LLC
307
307
  * SPDX-License-Identifier: BSD-3-Clause
308
308
  */
309
- var t;
310
- const i = window, s$1 = i.trustedTypes, e = s$1 ? s$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, o$1 = `lit$${(Math.random() + "").slice(9)}$`, n$2 = "?" + o$1, l$1 = `<${n$2}>`, h = document, r = (t2 = "") => h.createComment(t2), d = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, u = Array.isArray, c = (t2) => u(t2) || "function" == typeof (null == t2 ? void 0 : t2[Symbol.iterator]), v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, a = /-->/g, f = />/g, _ = RegExp(`>|[
309
+ var t$1;
310
+ const i$1 = window, s$2 = i$1.trustedTypes, e$3 = s$2 ? s$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, o$2 = `lit$${(Math.random() + "").slice(9)}$`, n$3 = "?" + o$2, l$2 = `<${n$3}>`, h$1 = document, r$1 = (t2 = "") => h$1.createComment(t2), d2 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, u = Array.isArray, c$1 = (t2) => u(t2) || "function" == typeof (null == t2 ? void 0 : t2[Symbol.iterator]), v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, a = /-->/g, f = />/g, _ = RegExp(`>|[
311
311
  \f\r](?:([^\\s"'>=/]+)([
312
312
  \f\r]*=[
313
313
  \f\r]*(?:[^
314
- \f\r"'\`<>=]|("|')|))|$)`, "g"), m = /'/g, p = /"/g, $ = /^(?:script|style|textarea|title)$/i, g = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), y = g(1), x = Symbol.for("lit-noChange"), b = Symbol.for("lit-nothing"), T = /* @__PURE__ */ new WeakMap(), A = h.createTreeWalker(h, 129, null, false), E = (t2, i2) => {
315
- const s2 = t2.length - 1, n2 = [];
316
- let h2, r2 = 2 === i2 ? "<svg>" : "", d2 = v;
317
- for (let i3 = 0; i3 < s2; i3++) {
318
- const s3 = t2[i3];
314
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), m = /'/g, p = /"/g, $ = /^(?:script|style|textarea|title)$/i, g = (t2) => (i2, ...s3) => ({ _$litType$: t2, strings: i2, values: s3 }), y = g(1), x = Symbol.for("lit-noChange"), b = Symbol.for("lit-nothing"), T = /* @__PURE__ */ new WeakMap(), A = h$1.createTreeWalker(h$1, 129, null, false), E = (t2, i2) => {
315
+ const s3 = t2.length - 1, n2 = [];
316
+ let h2, r2 = 2 === i2 ? "<svg>" : "", d3 = v;
317
+ for (let i3 = 0; i3 < s3; i3++) {
318
+ const s4 = t2[i3];
319
319
  let e2, u3, c2 = -1, g2 = 0;
320
- for (; g2 < s3.length && (d2.lastIndex = g2, u3 = d2.exec(s3), null !== u3); )
321
- g2 = d2.lastIndex, d2 === v ? "!--" === u3[1] ? d2 = a : void 0 !== u3[1] ? d2 = f : void 0 !== u3[2] ? ($.test(u3[2]) && (h2 = RegExp("</" + u3[2], "g")), d2 = _) : void 0 !== u3[3] && (d2 = _) : d2 === _ ? ">" === u3[0] ? (d2 = null != h2 ? h2 : v, c2 = -1) : void 0 === u3[1] ? c2 = -2 : (c2 = d2.lastIndex - u3[2].length, e2 = u3[1], d2 = void 0 === u3[3] ? _ : '"' === u3[3] ? p : m) : d2 === p || d2 === m ? d2 = _ : d2 === a || d2 === f ? d2 = v : (d2 = _, h2 = void 0);
322
- const y2 = d2 === _ && t2[i3 + 1].startsWith("/>") ? " " : "";
323
- r2 += d2 === v ? s3 + l$1 : c2 >= 0 ? (n2.push(e2), s3.slice(0, c2) + "$lit$" + s3.slice(c2) + o$1 + y2) : s3 + o$1 + (-2 === c2 ? (n2.push(void 0), i3) : y2);
320
+ for (; g2 < s4.length && (d3.lastIndex = g2, u3 = d3.exec(s4), null !== u3); )
321
+ g2 = d3.lastIndex, d3 === v ? "!--" === u3[1] ? d3 = a : void 0 !== u3[1] ? d3 = f : void 0 !== u3[2] ? ($.test(u3[2]) && (h2 = RegExp("</" + u3[2], "g")), d3 = _) : void 0 !== u3[3] && (d3 = _) : d3 === _ ? ">" === u3[0] ? (d3 = null != h2 ? h2 : v, c2 = -1) : void 0 === u3[1] ? c2 = -2 : (c2 = d3.lastIndex - u3[2].length, e2 = u3[1], d3 = void 0 === u3[3] ? _ : '"' === u3[3] ? p : m) : d3 === p || d3 === m ? d3 = _ : d3 === a || d3 === f ? d3 = v : (d3 = _, h2 = void 0);
322
+ const y2 = d3 === _ && t2[i3 + 1].startsWith("/>") ? " " : "";
323
+ r2 += d3 === v ? s4 + l$2 : c2 >= 0 ? (n2.push(e2), s4.slice(0, c2) + "$lit$" + s4.slice(c2) + o$2 + y2) : s4 + o$2 + (-2 === c2 ? (n2.push(void 0), i3) : y2);
324
324
  }
325
- const u2 = r2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : "");
325
+ const u2 = r2 + (t2[s3] || "<?>") + (2 === i2 ? "</svg>" : "");
326
326
  if (!Array.isArray(t2) || !t2.hasOwnProperty("raw"))
327
327
  throw Error("invalid template strings array");
328
- return [void 0 !== e ? e.createHTML(u2) : u2, n2];
328
+ return [void 0 !== e$3 ? e$3.createHTML(u2) : u2, n2];
329
329
  };
330
330
  class C {
331
331
  constructor({ strings: t2, _$litType$: i2 }, e2) {
332
332
  let l2;
333
333
  this.parts = [];
334
- let h2 = 0, d2 = 0;
334
+ let h2 = 0, d3 = 0;
335
335
  const u2 = t2.length - 1, c2 = this.parts, [v2, a2] = E(t2, i2);
336
336
  if (this.el = C.createElement(v2, e2), A.currentNode = this.el.content, 2 === i2) {
337
337
  const t3 = this.el.content, i3 = t3.firstChild;
@@ -342,10 +342,10 @@ class C {
342
342
  if (l2.hasAttributes()) {
343
343
  const t3 = [];
344
344
  for (const i3 of l2.getAttributeNames())
345
- if (i3.endsWith("$lit$") || i3.startsWith(o$1)) {
346
- const s2 = a2[d2++];
347
- if (t3.push(i3), void 0 !== s2) {
348
- const t4 = l2.getAttribute(s2.toLowerCase() + "$lit$").split(o$1), i4 = /([.?@])?(.*)/.exec(s2);
345
+ if (i3.endsWith("$lit$") || i3.startsWith(o$2)) {
346
+ const s3 = a2[d3++];
347
+ if (t3.push(i3), void 0 !== s3) {
348
+ const t4 = l2.getAttribute(s3.toLowerCase() + "$lit$").split(o$2), i4 = /([.?@])?(.*)/.exec(s3);
349
349
  c2.push({ type: 1, index: h2, name: i4[2], strings: t4, ctor: "." === i4[1] ? M : "?" === i4[1] ? k : "@" === i4[1] ? H : S });
350
350
  } else
351
351
  c2.push({ type: 6, index: h2 });
@@ -354,37 +354,37 @@ class C {
354
354
  l2.removeAttribute(i3);
355
355
  }
356
356
  if ($.test(l2.tagName)) {
357
- const t3 = l2.textContent.split(o$1), i3 = t3.length - 1;
357
+ const t3 = l2.textContent.split(o$2), i3 = t3.length - 1;
358
358
  if (i3 > 0) {
359
- l2.textContent = s$1 ? s$1.emptyScript : "";
360
- for (let s2 = 0; s2 < i3; s2++)
361
- l2.append(t3[s2], r()), A.nextNode(), c2.push({ type: 2, index: ++h2 });
362
- l2.append(t3[i3], r());
359
+ l2.textContent = s$2 ? s$2.emptyScript : "";
360
+ for (let s3 = 0; s3 < i3; s3++)
361
+ l2.append(t3[s3], r$1()), A.nextNode(), c2.push({ type: 2, index: ++h2 });
362
+ l2.append(t3[i3], r$1());
363
363
  }
364
364
  }
365
365
  } else if (8 === l2.nodeType)
366
- if (l2.data === n$2)
366
+ if (l2.data === n$3)
367
367
  c2.push({ type: 2, index: h2 });
368
368
  else {
369
369
  let t3 = -1;
370
- for (; -1 !== (t3 = l2.data.indexOf(o$1, t3 + 1)); )
371
- c2.push({ type: 7, index: h2 }), t3 += o$1.length - 1;
370
+ for (; -1 !== (t3 = l2.data.indexOf(o$2, t3 + 1)); )
371
+ c2.push({ type: 7, index: h2 }), t3 += o$2.length - 1;
372
372
  }
373
373
  h2++;
374
374
  }
375
375
  }
376
376
  static createElement(t2, i2) {
377
- const s2 = h.createElement("template");
378
- return s2.innerHTML = t2, s2;
377
+ const s3 = h$1.createElement("template");
378
+ return s3.innerHTML = t2, s3;
379
379
  }
380
380
  }
381
- function P(t2, i2, s2 = t2, e2) {
382
- var o2, n2, l2, h2;
381
+ function P(t2, i2, s3 = t2, e2) {
382
+ var o3, n2, l2, h2;
383
383
  if (i2 === x)
384
384
  return i2;
385
- let r2 = void 0 !== e2 ? null === (o2 = s2._$Co) || void 0 === o2 ? void 0 : o2[e2] : s2._$Cl;
386
- const u2 = d(i2) ? void 0 : i2._$litDirective$;
387
- return (null == r2 ? void 0 : r2.constructor) !== u2 && (null === (n2 = null == r2 ? void 0 : r2._$AO) || void 0 === n2 || n2.call(r2, false), void 0 === u2 ? r2 = void 0 : (r2 = new u2(t2), r2._$AT(t2, s2, e2)), void 0 !== e2 ? (null !== (l2 = (h2 = s2)._$Co) && void 0 !== l2 ? l2 : h2._$Co = [])[e2] = r2 : s2._$Cl = r2), void 0 !== r2 && (i2 = P(t2, r2._$AS(t2, i2.values), r2, e2)), i2;
385
+ let r2 = void 0 !== e2 ? null === (o3 = s3._$Co) || void 0 === o3 ? void 0 : o3[e2] : s3._$Cl;
386
+ const u2 = d2(i2) ? void 0 : i2._$litDirective$;
387
+ return (null == r2 ? void 0 : r2.constructor) !== u2 && (null === (n2 = null == r2 ? void 0 : r2._$AO) || void 0 === n2 || n2.call(r2, false), void 0 === u2 ? r2 = void 0 : (r2 = new u2(t2), r2._$AT(t2, s3, e2)), void 0 !== e2 ? (null !== (l2 = (h2 = s3)._$Co) && void 0 !== l2 ? l2 : h2._$Co = [])[e2] = r2 : s3._$Cl = r2), void 0 !== r2 && (i2 = P(t2, r2._$AS(t2, i2.values), r2, e2)), i2;
388
388
  }
389
389
  class V {
390
390
  constructor(t2, i2) {
@@ -398,28 +398,28 @@ class V {
398
398
  }
399
399
  v(t2) {
400
400
  var i2;
401
- const { el: { content: s2 }, parts: e2 } = this._$AD, o2 = (null !== (i2 = null == t2 ? void 0 : t2.creationScope) && void 0 !== i2 ? i2 : h).importNode(s2, true);
402
- A.currentNode = o2;
403
- let n2 = A.nextNode(), l2 = 0, r2 = 0, d2 = e2[0];
404
- for (; void 0 !== d2; ) {
405
- if (l2 === d2.index) {
401
+ const { el: { content: s3 }, parts: e2 } = this._$AD, o3 = (null !== (i2 = null == t2 ? void 0 : t2.creationScope) && void 0 !== i2 ? i2 : h$1).importNode(s3, true);
402
+ A.currentNode = o3;
403
+ let n2 = A.nextNode(), l2 = 0, r2 = 0, d3 = e2[0];
404
+ for (; void 0 !== d3; ) {
405
+ if (l2 === d3.index) {
406
406
  let i3;
407
- 2 === d2.type ? i3 = new N(n2, n2.nextSibling, this, t2) : 1 === d2.type ? i3 = new d2.ctor(n2, d2.name, d2.strings, this, t2) : 6 === d2.type && (i3 = new I(n2, this, t2)), this.u.push(i3), d2 = e2[++r2];
407
+ 2 === d3.type ? i3 = new N(n2, n2.nextSibling, this, t2) : 1 === d3.type ? i3 = new d3.ctor(n2, d3.name, d3.strings, this, t2) : 6 === d3.type && (i3 = new I(n2, this, t2)), this.u.push(i3), d3 = e2[++r2];
408
408
  }
409
- l2 !== (null == d2 ? void 0 : d2.index) && (n2 = A.nextNode(), l2++);
409
+ l2 !== (null == d3 ? void 0 : d3.index) && (n2 = A.nextNode(), l2++);
410
410
  }
411
- return o2;
411
+ return o3;
412
412
  }
413
413
  p(t2) {
414
414
  let i2 = 0;
415
- for (const s2 of this.u)
416
- void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++;
415
+ for (const s3 of this.u)
416
+ void 0 !== s3 && (void 0 !== s3.strings ? (s3._$AI(t2, s3, i2), i2 += s3.strings.length - 2) : s3._$AI(t2[i2])), i2++;
417
417
  }
418
418
  }
419
419
  class N {
420
- constructor(t2, i2, s2, e2) {
421
- var o2;
422
- this.type = 2, this._$AH = b, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cm = null === (o2 = null == e2 ? void 0 : e2.isConnected) || void 0 === o2 || o2;
420
+ constructor(t2, i2, s3, e2) {
421
+ var o3;
422
+ this.type = 2, this._$AH = b, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s3, this.options = e2, this._$Cm = null === (o3 = null == e2 ? void 0 : e2.isConnected) || void 0 === o3 || o3;
423
423
  }
424
424
  get _$AU() {
425
425
  var t2, i2;
@@ -437,7 +437,7 @@ class N {
437
437
  return this._$AB;
438
438
  }
439
439
  _$AI(t2, i2 = this) {
440
- t2 = P(this, t2, i2), d(t2) ? t2 === b || null == t2 || "" === t2 ? (this._$AH !== b && this._$AR(), this._$AH = b) : t2 !== this._$AH && t2 !== x && this.g(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : c(t2) ? this.k(t2) : this.g(t2);
440
+ t2 = P(this, t2, i2), d2(t2) ? t2 === b || null == t2 || "" === t2 ? (this._$AH !== b && this._$AR(), this._$AH = b) : t2 !== this._$AH && t2 !== x && this.g(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : c$1(t2) ? this.k(t2) : this.g(t2);
441
441
  }
442
442
  O(t2, i2 = this._$AB) {
443
443
  return this._$AA.parentNode.insertBefore(t2, i2);
@@ -446,16 +446,16 @@ class N {
446
446
  this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
447
447
  }
448
448
  g(t2) {
449
- this._$AH !== b && d(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(h.createTextNode(t2)), this._$AH = t2;
449
+ this._$AH !== b && d2(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(h$1.createTextNode(t2)), this._$AH = t2;
450
450
  }
451
451
  $(t2) {
452
452
  var i2;
453
- const { values: s2, _$litType$: e2 } = t2, o2 = "number" == typeof e2 ? this._$AC(t2) : (void 0 === e2.el && (e2.el = C.createElement(e2.h, this.options)), e2);
454
- if ((null === (i2 = this._$AH) || void 0 === i2 ? void 0 : i2._$AD) === o2)
455
- this._$AH.p(s2);
453
+ const { values: s3, _$litType$: e2 } = t2, o3 = "number" == typeof e2 ? this._$AC(t2) : (void 0 === e2.el && (e2.el = C.createElement(e2.h, this.options)), e2);
454
+ if ((null === (i2 = this._$AH) || void 0 === i2 ? void 0 : i2._$AD) === o3)
455
+ this._$AH.p(s3);
456
456
  else {
457
- const t3 = new V(o2, this), i3 = t3.v(this.options);
458
- t3.p(s2), this.T(i3), this._$AH = t3;
457
+ const t3 = new V(o3, this), i3 = t3.v(this.options);
458
+ t3.p(s3), this.T(i3), this._$AH = t3;
459
459
  }
460
460
  }
461
461
  _$AC(t2) {
@@ -465,14 +465,14 @@ class N {
465
465
  k(t2) {
466
466
  u(this._$AH) || (this._$AH = [], this._$AR());
467
467
  const i2 = this._$AH;
468
- let s2, e2 = 0;
469
- for (const o2 of t2)
470
- e2 === i2.length ? i2.push(s2 = new N(this.O(r()), this.O(r()), this, this.options)) : s2 = i2[e2], s2._$AI(o2), e2++;
471
- e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2);
468
+ let s3, e2 = 0;
469
+ for (const o3 of t2)
470
+ e2 === i2.length ? i2.push(s3 = new N(this.O(r$1()), this.O(r$1()), this, this.options)) : s3 = i2[e2], s3._$AI(o3), e2++;
471
+ e2 < i2.length && (this._$AR(s3 && s3._$AB.nextSibling, e2), i2.length = e2);
472
472
  }
473
473
  _$AR(t2 = this._$AA.nextSibling, i2) {
474
- var s2;
475
- for (null === (s2 = this._$AP) || void 0 === s2 || s2.call(this, false, true, i2); t2 && t2 !== this._$AB; ) {
474
+ var s3;
475
+ for (null === (s3 = this._$AP) || void 0 === s3 || s3.call(this, false, true, i2); t2 && t2 !== this._$AB; ) {
476
476
  const i3 = t2.nextSibling;
477
477
  t2.remove(), t2 = i3;
478
478
  }
@@ -483,8 +483,8 @@ class N {
483
483
  }
484
484
  }
485
485
  class S {
486
- constructor(t2, i2, s2, e2, o2) {
487
- this.type = 1, this._$AH = b, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = o2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = b;
486
+ constructor(t2, i2, s3, e2, o3) {
487
+ this.type = 1, this._$AH = b, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = o3, s3.length > 2 || "" !== s3[0] || "" !== s3[1] ? (this._$AH = Array(s3.length - 1).fill(new String()), this.strings = s3) : this._$AH = b;
488
488
  }
489
489
  get tagName() {
490
490
  return this.element.tagName;
@@ -492,16 +492,16 @@ class S {
492
492
  get _$AU() {
493
493
  return this._$AM._$AU;
494
494
  }
495
- _$AI(t2, i2 = this, s2, e2) {
496
- const o2 = this.strings;
495
+ _$AI(t2, i2 = this, s3, e2) {
496
+ const o3 = this.strings;
497
497
  let n2 = false;
498
- if (void 0 === o2)
499
- t2 = P(this, t2, i2, 0), n2 = !d(t2) || t2 !== this._$AH && t2 !== x, n2 && (this._$AH = t2);
498
+ if (void 0 === o3)
499
+ t2 = P(this, t2, i2, 0), n2 = !d2(t2) || t2 !== this._$AH && t2 !== x, n2 && (this._$AH = t2);
500
500
  else {
501
501
  const e3 = t2;
502
502
  let l2, h2;
503
- for (t2 = o2[0], l2 = 0; l2 < o2.length - 1; l2++)
504
- h2 = P(this, e3[s2 + l2], i2, l2), h2 === x && (h2 = this._$AH[l2]), n2 || (n2 = !d(h2) || h2 !== this._$AH[l2]), h2 === b ? t2 = b : t2 !== b && (t2 += (null != h2 ? h2 : "") + o2[l2 + 1]), this._$AH[l2] = h2;
503
+ for (t2 = o3[0], l2 = 0; l2 < o3.length - 1; l2++)
504
+ h2 = P(this, e3[s3 + l2], i2, l2), h2 === x && (h2 = this._$AH[l2]), n2 || (n2 = !d2(h2) || h2 !== this._$AH[l2]), h2 === b ? t2 = b : t2 !== b && (t2 += (null != h2 ? h2 : "") + o3[l2 + 1]), this._$AH[l2] = h2;
505
505
  }
506
506
  n2 && !e2 && this.j(t2);
507
507
  }
@@ -517,7 +517,7 @@ class M extends S {
517
517
  this.element[this.name] = t2 === b ? void 0 : t2;
518
518
  }
519
519
  }
520
- const R = s$1 ? s$1.emptyScript : "";
520
+ const R = s$2 ? s$2.emptyScript : "";
521
521
  class k extends S {
522
522
  constructor() {
523
523
  super(...arguments), this.type = 4;
@@ -527,24 +527,24 @@ class k extends S {
527
527
  }
528
528
  }
529
529
  class H extends S {
530
- constructor(t2, i2, s2, e2, o2) {
531
- super(t2, i2, s2, e2, o2), this.type = 5;
530
+ constructor(t2, i2, s3, e2, o3) {
531
+ super(t2, i2, s3, e2, o3), this.type = 5;
532
532
  }
533
533
  _$AI(t2, i2 = this) {
534
- var s2;
535
- if ((t2 = null !== (s2 = P(this, t2, i2, 0)) && void 0 !== s2 ? s2 : b) === x)
534
+ var s3;
535
+ if ((t2 = null !== (s3 = P(this, t2, i2, 0)) && void 0 !== s3 ? s3 : b) === x)
536
536
  return;
537
- const e2 = this._$AH, o2 = t2 === b && e2 !== b || t2.capture !== e2.capture || t2.once !== e2.once || t2.passive !== e2.passive, n2 = t2 !== b && (e2 === b || o2);
538
- o2 && this.element.removeEventListener(this.name, this, e2), n2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
537
+ const e2 = this._$AH, o3 = t2 === b && e2 !== b || t2.capture !== e2.capture || t2.once !== e2.once || t2.passive !== e2.passive, n2 = t2 !== b && (e2 === b || o3);
538
+ o3 && this.element.removeEventListener(this.name, this, e2), n2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
539
539
  }
540
540
  handleEvent(t2) {
541
- var i2, s2;
542
- "function" == typeof this._$AH ? this._$AH.call(null !== (s2 = null === (i2 = this.options) || void 0 === i2 ? void 0 : i2.host) && void 0 !== s2 ? s2 : this.element, t2) : this._$AH.handleEvent(t2);
541
+ var i2, s3;
542
+ "function" == typeof this._$AH ? this._$AH.call(null !== (s3 = null === (i2 = this.options) || void 0 === i2 ? void 0 : i2.host) && void 0 !== s3 ? s3 : this.element, t2) : this._$AH.handleEvent(t2);
543
543
  }
544
544
  }
545
545
  class I {
546
- constructor(t2, i2, s2) {
547
- this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2;
546
+ constructor(t2, i2, s3) {
547
+ this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s3;
548
548
  }
549
549
  get _$AU() {
550
550
  return this._$AM._$AU;
@@ -553,15 +553,15 @@ class I {
553
553
  P(this, t2);
554
554
  }
555
555
  }
556
- const z = i.litHtmlPolyfillSupport;
557
- null == z || z(C, N), (null !== (t = i.litHtmlVersions) && void 0 !== t ? t : i.litHtmlVersions = []).push("2.4.0");
558
- const Z = (t2, i2, s2) => {
559
- var e2, o2;
560
- const n2 = null !== (e2 = null == s2 ? void 0 : s2.renderBefore) && void 0 !== e2 ? e2 : i2;
556
+ const z = i$1.litHtmlPolyfillSupport;
557
+ null == z || z(C, N), (null !== (t$1 = i$1.litHtmlVersions) && void 0 !== t$1 ? t$1 : i$1.litHtmlVersions = []).push("2.6.1");
558
+ const Z = (t2, i2, s3) => {
559
+ var e2, o3;
560
+ const n2 = null !== (e2 = null == s3 ? void 0 : s3.renderBefore) && void 0 !== e2 ? e2 : i2;
561
561
  let l2 = n2._$litPart$;
562
562
  if (void 0 === l2) {
563
- const t3 = null !== (o2 = null == s2 ? void 0 : s2.renderBefore) && void 0 !== o2 ? o2 : null;
564
- n2._$litPart$ = l2 = new N(i2.insertBefore(r(), t3), t3, void 0, null != s2 ? s2 : {});
563
+ const t3 = null !== (o3 = null == s3 ? void 0 : s3.renderBefore) && void 0 !== o3 ? o3 : null;
564
+ n2._$litPart$ = l2 = new N(i2.insertBefore(r$1(), t3), t3, void 0, null != s3 ? s3 : {});
565
565
  }
566
566
  return l2._$AI(t2), l2;
567
567
  };
@@ -570,8 +570,8 @@ const Z = (t2, i2, s2) => {
570
570
  * Copyright 2017 Google LLC
571
571
  * SPDX-License-Identifier: BSD-3-Clause
572
572
  */
573
- var l, o;
574
- class s extends d$1 {
573
+ var l$1, o$1;
574
+ let s$1 = class s extends d$1 {
575
575
  constructor() {
576
576
  super(...arguments), this.renderOptions = { host: this }, this._$Dt = void 0;
577
577
  }
@@ -595,11 +595,249 @@ class s extends d$1 {
595
595
  render() {
596
596
  return x;
597
597
  }
598
+ };
599
+ s$1.finalized = true, s$1._$litElement$ = true, null === (l$1 = globalThis.litElementHydrateSupport) || void 0 === l$1 || l$1.call(globalThis, { LitElement: s$1 });
600
+ const n$2 = globalThis.litElementPolyfillSupport;
601
+ null == n$2 || n$2({ LitElement: s$1 });
602
+ (null !== (o$1 = globalThis.litElementVersions) && void 0 !== o$1 ? o$1 : globalThis.litElementVersions = []).push("3.2.0");
603
+ const LANG_CHANGED_EVENT = "langChanged";
604
+ function interpolate(text, values, config) {
605
+ return Object.entries(extract(values || {})).reduce((text2, [key, value]) => text2.replace(new RegExp(`{{[  ]*${key}[  ]*}}`, `gm`), String(extract(value))), text);
606
+ }
607
+ function lookup(key, config) {
608
+ const parts = key.split(".");
609
+ let string = config.strings;
610
+ while (string != null && parts.length > 0) {
611
+ string = string[parts.shift()];
612
+ }
613
+ return string != null ? string.toString() : null;
614
+ }
615
+ function extract(obj) {
616
+ return typeof obj === "function" ? obj() : obj;
617
+ }
618
+ const defaultTranslateConfig = () => {
619
+ return {
620
+ loader: () => Promise.resolve({}),
621
+ empty: (key) => `[${key}]`,
622
+ lookup,
623
+ interpolate,
624
+ translationCache: {}
625
+ };
626
+ };
627
+ let translateConfig = defaultTranslateConfig();
628
+ function registerTranslateConfig(config) {
629
+ return translateConfig = Object.assign(Object.assign({}, translateConfig), config);
630
+ }
631
+ function dispatchLangChanged(detail) {
632
+ window.dispatchEvent(new CustomEvent(LANG_CHANGED_EVENT, { detail }));
633
+ }
634
+ function updateLang(newLang, newStrings, config = translateConfig) {
635
+ dispatchLangChanged({
636
+ previousStrings: config.strings,
637
+ previousLang: config.lang,
638
+ lang: config.lang = newLang,
639
+ strings: config.strings = newStrings
640
+ });
641
+ }
642
+ function listenForLangChanged(callback, options) {
643
+ const handler = (e2) => callback(e2.detail);
644
+ window.addEventListener(LANG_CHANGED_EVENT, handler, options);
645
+ return () => window.removeEventListener(LANG_CHANGED_EVENT, handler);
646
+ }
647
+ async function use(lang, config = translateConfig) {
648
+ const strings = await config.loader(lang, config);
649
+ config.translationCache = {};
650
+ updateLang(lang, strings, config);
651
+ }
652
+ function get(key, values, config = translateConfig) {
653
+ let translation = config.translationCache[key] || (config.translationCache[key] = config.lookup(key, config) || config.empty(key, config));
654
+ values = values != null ? extract(values) : null;
655
+ return values != null ? config.interpolate(translation, values, config) : translation;
656
+ }
657
+ /**
658
+ * @license
659
+ * Copyright 2017 Google LLC
660
+ * SPDX-License-Identifier: BSD-3-Clause
661
+ */
662
+ const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e$2 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
663
+ class i {
664
+ constructor(t2) {
665
+ }
666
+ get _$AU() {
667
+ return this._$AM._$AU;
668
+ }
669
+ _$AT(t2, e2, i2) {
670
+ this._$Ct = t2, this._$AM = e2, this._$Ci = i2;
671
+ }
672
+ _$AS(t2, e2) {
673
+ return this.update(t2, e2);
674
+ }
675
+ update(t2, e2) {
676
+ return this.render(...e2);
677
+ }
678
+ }
679
+ /**
680
+ * @license
681
+ * Copyright 2020 Google LLC
682
+ * SPDX-License-Identifier: BSD-3-Clause
683
+ */
684
+ const e$1 = (o3) => void 0 === o3.strings;
685
+ /**
686
+ * @license
687
+ * Copyright 2017 Google LLC
688
+ * SPDX-License-Identifier: BSD-3-Clause
689
+ */
690
+ const s2 = (i2, t2) => {
691
+ var e2, o3;
692
+ const r2 = i2._$AN;
693
+ if (void 0 === r2)
694
+ return false;
695
+ for (const i3 of r2)
696
+ null === (o3 = (e2 = i3)._$AO) || void 0 === o3 || o3.call(e2, t2, false), s2(i3, t2);
697
+ return true;
698
+ }, o2 = (i2) => {
699
+ let t2, e2;
700
+ do {
701
+ if (void 0 === (t2 = i2._$AM))
702
+ break;
703
+ e2 = t2._$AN, e2.delete(i2), i2 = t2;
704
+ } while (0 === (null == e2 ? void 0 : e2.size));
705
+ }, r = (i2) => {
706
+ for (let t2; t2 = i2._$AM; i2 = t2) {
707
+ let e2 = t2._$AN;
708
+ if (void 0 === e2)
709
+ t2._$AN = e2 = /* @__PURE__ */ new Set();
710
+ else if (e2.has(i2))
711
+ break;
712
+ e2.add(i2), l(t2);
713
+ }
714
+ };
715
+ function n$1(i2) {
716
+ void 0 !== this._$AN ? (o2(this), this._$AM = i2, r(this)) : this._$AM = i2;
717
+ }
718
+ function h(i2, t2 = false, e2 = 0) {
719
+ const r2 = this._$AH, n2 = this._$AN;
720
+ if (void 0 !== n2 && 0 !== n2.size)
721
+ if (t2)
722
+ if (Array.isArray(r2))
723
+ for (let i3 = e2; i3 < r2.length; i3++)
724
+ s2(r2[i3], false), o2(r2[i3]);
725
+ else
726
+ null != r2 && (s2(r2, false), o2(r2));
727
+ else
728
+ s2(this, i2);
729
+ }
730
+ const l = (i2) => {
731
+ var t$12, s3, o3, r2;
732
+ i2.type == t.CHILD && (null !== (t$12 = (o3 = i2)._$AP) && void 0 !== t$12 || (o3._$AP = h), null !== (s3 = (r2 = i2)._$AQ) && void 0 !== s3 || (r2._$AQ = n$1));
733
+ };
734
+ class c extends i {
735
+ constructor() {
736
+ super(...arguments), this._$AN = void 0;
737
+ }
738
+ _$AT(i2, t2, e2) {
739
+ super._$AT(i2, t2, e2), r(this), this.isConnected = i2._$AU;
740
+ }
741
+ _$AO(i2, t2 = true) {
742
+ var e2, r2;
743
+ i2 !== this.isConnected && (this.isConnected = i2, i2 ? null === (e2 = this.reconnected) || void 0 === e2 || e2.call(this) : null === (r2 = this.disconnected) || void 0 === r2 || r2.call(this)), t2 && (s2(this, i2), o2(this));
744
+ }
745
+ setValue(t2) {
746
+ if (e$1(this._$Ct))
747
+ this._$Ct._$AI(t2, this);
748
+ else {
749
+ const i2 = [...this._$Ct._$AH];
750
+ i2[this._$Ci] = t2, this._$Ct._$AI(i2, this, 0);
751
+ }
752
+ }
753
+ disconnected() {
754
+ }
755
+ reconnected() {
756
+ }
598
757
  }
599
- s.finalized = true, s._$litElement$ = true, null === (l = globalThis.litElementHydrateSupport) || void 0 === l || l.call(globalThis, { LitElement: s });
600
- const n$1 = globalThis.litElementPolyfillSupport;
601
- null == n$1 || n$1({ LitElement: s });
602
- (null !== (o = globalThis.litElementVersions) && void 0 !== o ? o : globalThis.litElementVersions = []).push("3.2.0");
758
+ class LangChangedDirectiveBase extends c {
759
+ constructor() {
760
+ super(...arguments);
761
+ this.langChangedSubscription = null;
762
+ this.getValue = () => "";
763
+ }
764
+ /**
765
+ * Sets up the directive by setting the getValue property and subscribing.
766
+ * When subclassing LangChangedDirectiveBase this function should be call in the render function.
767
+ * @param getValue
768
+ */
769
+ renderValue(getValue) {
770
+ this.getValue = getValue;
771
+ this.subscribe();
772
+ return this.getValue();
773
+ }
774
+ /**
775
+ * Called when the lang changed event is dispatched.
776
+ * @param e
777
+ */
778
+ langChanged(e2) {
779
+ this.setValue(this.getValue(e2));
780
+ }
781
+ /**
782
+ * Subscribes to the lang changed event.
783
+ */
784
+ subscribe() {
785
+ if (this.langChangedSubscription == null) {
786
+ this.langChangedSubscription = listenForLangChanged(this.langChanged.bind(this));
787
+ }
788
+ }
789
+ /**
790
+ * Unsubscribes from the lang changed event.
791
+ */
792
+ unsubscribe() {
793
+ if (this.langChangedSubscription != null) {
794
+ this.langChangedSubscription();
795
+ }
796
+ }
797
+ /**
798
+ * Unsubscribes when disconnected.
799
+ */
800
+ disconnected() {
801
+ this.unsubscribe();
802
+ }
803
+ /**
804
+ * Subscribes when reconnected.
805
+ */
806
+ reconnected() {
807
+ this.subscribe();
808
+ }
809
+ }
810
+ class TranslateDirective extends LangChangedDirectiveBase {
811
+ render(key, values, config) {
812
+ return this.renderValue(() => get(key, values, config));
813
+ }
814
+ }
815
+ const translate = e$2(TranslateDirective);
816
+ /**
817
+ * @license
818
+ * Copyright 2017 Google LLC
819
+ * SPDX-License-Identifier: BSD-3-Clause
820
+ */
821
+ class e extends i {
822
+ constructor(i2) {
823
+ if (super(i2), this.it = b, i2.type !== t.CHILD)
824
+ throw Error(this.constructor.directiveName + "() can only be used in child bindings");
825
+ }
826
+ render(r2) {
827
+ if (r2 === b || null == r2)
828
+ return this._t = void 0, this.it = r2;
829
+ if (r2 === x)
830
+ return r2;
831
+ if ("string" != typeof r2)
832
+ throw Error(this.constructor.directiveName + "() called with a non-string value");
833
+ if (r2 === this.it)
834
+ return this._t;
835
+ this.it = r2;
836
+ const s3 = [r2];
837
+ return s3.raw = s3, this._t = { _$litType$: this.constructor.resultType, strings: s3, values: [] };
838
+ }
839
+ }
840
+ e.directiveName = "unsafeHTML", e.resultType = 1;
603
841
  function asUpdateableLitElement(element) {
604
842
  if (!element.dispatchEvent || !element.requestUpdate)
605
843
  throw new Error(
@@ -642,7 +880,7 @@ function useEffect(element, on, observe) {
642
880
  on,
643
881
  observe: ["__initial__dirty"]
644
882
  });
645
- effect.observe.some((o2, index) => observe[index] !== o2) && effect.on();
883
+ effect.observe.some((o3, index) => observe[index] !== o3) && effect.on();
646
884
  effect.observe = observe;
647
885
  }
648
886
  const useOnce = (element, on) => useEffect(element, on, []);
@@ -651,10 +889,10 @@ const useOnce = (element, on) => useEffect(element, on, []);
651
889
  * Copyright 2021 Google LLC
652
890
  * SPDX-License-Identifier: BSD-3-Clause
653
891
  */
654
- function n(n2, o2, r2) {
655
- return n2 ? o2() : null == r2 ? void 0 : r2();
892
+ function n(n2, o3, r2) {
893
+ return n2 ? o3() : null == r2 ? void 0 : r2();
656
894
  }
657
- const styles$1 = i$1`
895
+ const styles$1 = i$2`
658
896
  :host {
659
897
  --shipaid-primary: #002bd6;
660
898
  --shipaid-secondary: #0076ff;
@@ -798,7 +1036,7 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
798
1036
  __defProp$1(target, key, result);
799
1037
  return result;
800
1038
  };
801
- let LearnMorePopup = class extends s {
1039
+ let LearnMorePopup = class extends s$1 {
802
1040
  constructor() {
803
1041
  super(...arguments);
804
1042
  this.active = false;
@@ -815,40 +1053,23 @@ let LearnMorePopup = class extends s {
815
1053
  class="popup-close"
816
1054
  @click=${this.handleClosePopup}
817
1055
  >
818
- Close
1056
+ ${translate("learn-more-popup.close")}
819
1057
  </button>
820
- <p class="popup-title">Delivery Guarantee</p>
1058
+ <p class="popup-title">${translate("learn-more-popup.title")}</p>
821
1059
  <p>
822
- We empower your favorite brands to offer a delivery guarantee because every order is precious!
1060
+ ${translate("learn-more-popup.subtitle")}
823
1061
  </p>
824
1062
  <img
825
1063
  src="https://res.cloudinary.com/dxyz34kfj/image/upload/v1660782754/shipaid-image_hoz6k8.jpg"
826
1064
  alt="shipaid protected parcel"
827
1065
  class="popup-top-image"
828
1066
  />
829
- <p class="popup-title">Shop Worry-Free</p>
1067
+ <p class="popup-title">${translate("learn-more-popup.disclaimer.title")}</p>
830
1068
  <p>
831
- Brands and shipment carriers cannot always guarantee your order will arrive
832
- at your doorstep safely. Things happen! We help the brand you are purchasing
833
- from replace the product you ordered in the chance of an issue in transit.
834
- If you encounter an issue, simply reach out to the brand and they will
835
- get it resolved as soon as possible.
1069
+ ${translate("learn-more-popup.disclaimer.subtitle")}
836
1070
  </p>
837
1071
  <p class="popup-disclaimer">
838
- By purchasing this delivery guarantee, you agree to our Terms Of Service
839
- and Privacy Policy. You are not obligated to purchase this guarantee.
840
- This guarantee is NOT insurance and does not provide indemnification against
841
- loss, damage, or liability arising from a contingent or unknown event,
842
- but rather, through ShipAid brands provide a delivery guarantee whereby
843
- if the product you ordered is not delivered in satisfactory condition,
844
- the brand from which you ordered the product may replace the product
845
- free of charge. ShipAid does not provide any products or services directly
846
- to consumers, but instead provides a service that allow brands to facilitate
847
- product replacement to their customers. Purchasing this guarantee does not
848
- mean that you will automatically be reimbursed for any product or shipping
849
- costs because the resolution process and decision for compensation is strictly
850
- decided by the brand you a purchasing from. The brand will require proof
851
- of damage or undelivered product.
1072
+ ${translate("learn-more-popup.disclaimer.text")}
852
1073
  </p>
853
1074
  <div class="popup-footer">
854
1075
  <div class="footer-links">
@@ -857,14 +1078,14 @@ let LearnMorePopup = class extends s {
857
1078
  target="_blank"
858
1079
  rel="noreferrer"
859
1080
  >
860
- Terms of Service
1081
+ ${translate("learn-more-popup.links.terms")}
861
1082
  </a>
862
1083
  <a
863
1084
  href="https://www.shipaid.com/privacy-policy"
864
1085
  target="_blank"
865
1086
  rel="noreferrer"
866
1087
  >
867
- Privacy Policy
1088
+ ${translate("learn-more-popup.links.privacy")}
868
1089
  </a>
869
1090
  </div>
870
1091
  <div class="footer-date">
@@ -877,12 +1098,53 @@ let LearnMorePopup = class extends s {
877
1098
  };
878
1099
  LearnMorePopup.styles = styles$1;
879
1100
  __decorateClass$1([
880
- e$3({ type: Boolean, attribute: true })
1101
+ e$6({ type: Boolean, attribute: true })
881
1102
  ], LearnMorePopup.prototype, "active", 2);
882
1103
  LearnMorePopup = __decorateClass$1([
883
- e$4("shipaid-popup-learn-more")
1104
+ e$7("shipaid-popup-learn-more")
884
1105
  ], LearnMorePopup);
885
- const styles = i$1`
1106
+ const loading = "Loading ShipAid Widget...";
1107
+ const title = "Delivery Guarantee";
1108
+ const description = "in case of Loss, Damage or Theft";
1109
+ const footer = {
1110
+ button: "Powered by"
1111
+ };
1112
+ const actions = {
1113
+ add: "Add",
1114
+ remove: "Remove",
1115
+ loading: "Loading..."
1116
+ };
1117
+ const defaultLangFile = {
1118
+ loading,
1119
+ title,
1120
+ description,
1121
+ footer,
1122
+ actions,
1123
+ "learn-more-popup": {
1124
+ close: "Close",
1125
+ title: "Delivery Guarantee",
1126
+ subtitle: "We empower your favorite brands to offer a delivery guarantee because every order is precious!",
1127
+ disclaimer: {
1128
+ title: "Shop Worry-Free",
1129
+ subtitle: "Brands and shipment carriers cannot always guarantee your order will arrive at your doorstep safely. Things happen! We help the brand you are purchasing from replace the product you ordered in the chance of an issue in transit. If you encounter an issue, simply reach out to the brand and they will get it resolved as soon as possible.",
1130
+ text: "By purchasing this delivery guarantee, you agree to our Terms Of Service and Privacy Policy. You are not obligated to purchase this guarantee. This guarantee is NOT insurance and does not provide indemnification against loss, damage, or liability arising from a contingent or unknown event, but rather, through ShipAid brands provide a delivery guarantee whereby if the product you ordered is not delivered in satisfactory condition, the brand from which you ordered the product may replace the product free of charge. ShipAid does not provide any products or services directly to consumers, but instead provides a service that allow brands to facilitate product replacement to their customers. Purchasing this guarantee does not mean that you will automatically be reimbursed for any product or shipping costs because the resolution process and decision for compensation is strictly decided by the brand you a purchasing from. The brand will require proof of damage or undelivered product."
1131
+ },
1132
+ links: {
1133
+ terms: "Terms of Service",
1134
+ privacy: "Privacy Policy"
1135
+ }
1136
+ }
1137
+ };
1138
+ const en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1139
+ __proto__: null,
1140
+ actions,
1141
+ default: defaultLangFile,
1142
+ description,
1143
+ footer,
1144
+ loading,
1145
+ title
1146
+ }, Symbol.toStringTag, { value: "Module" }));
1147
+ const styles = i$2`
886
1148
  :host {
887
1149
  --shipaid-primary: #002bd6;
888
1150
  --shipaid-secondary: #0076ff;
@@ -1210,19 +1472,31 @@ const StoreQuery = `query StoreByDomain ($store: String!) {
1210
1472
  protectionSettings
1211
1473
  }
1212
1474
  }`;
1213
- let ShipAidWidget = class extends s {
1475
+ const langFiles = /* @__PURE__ */ Object.assign({ "./lang/en.json": () => Promise.resolve().then(() => en).then((m2) => m2["default"]), "./lang/it.json": () => import("./it-0759ce74.js").then((m2) => m2["default"]) });
1476
+ registerTranslateConfig({
1477
+ loader: async (lang) => {
1478
+ if (lang === "en")
1479
+ return defaultLangFile;
1480
+ const fileImport = Reflect.get(langFiles, `./lang/${lang}.json`);
1481
+ return fileImport ? await fileImport() : defaultLangFile;
1482
+ }
1483
+ });
1484
+ let ShipAidWidget = class extends s$1 {
1214
1485
  constructor() {
1215
- var _a, _b, _c, _d;
1486
+ var _a, _b, _c;
1216
1487
  super(...arguments);
1217
1488
  this.disablePolling = false;
1218
1489
  this.disableActions = false;
1219
1490
  this.pollingInterval = POLL_INTERVAL_DEFAULT;
1220
1491
  this.disableRefresh = false;
1492
+ this.lang = "en";
1493
+ this.currency = void 0;
1221
1494
  this._apiEndpoint = "/apps/shipaid";
1222
- this._storeDomain = (_d = (_a = window.Shopify) == null ? void 0 : _a.shop) != null ? _d : (_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost;
1495
+ this._storeDomain = ((_a = window.Shopify) == null ? void 0 : _a.shop) ?? ((_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost);
1223
1496
  this._hasFinishedSetup = false;
1224
1497
  this._shouldShowWidget = true;
1225
1498
  this._hasProtectionInCart = false;
1499
+ this.hasLoadedStrings = false;
1226
1500
  this._state = {
1227
1501
  loading: false,
1228
1502
  success: null,
@@ -1238,6 +1512,10 @@ let ShipAidWidget = class extends s {
1238
1512
  })
1239
1513
  };
1240
1514
  }
1515
+ shouldUpdate(props) {
1516
+ return this.hasLoadedStrings && super.shouldUpdate(props);
1517
+ }
1518
+ /** Getter to check if we should refresh the page or not */
1241
1519
  get shouldRefreshOnUpdate() {
1242
1520
  if (this.disablePolling)
1243
1521
  return false;
@@ -1245,6 +1523,7 @@ let ShipAidWidget = class extends s {
1245
1523
  return false;
1246
1524
  return true;
1247
1525
  }
1526
+ /** Getter to check whether to show the widget or not */
1248
1527
  get planActive() {
1249
1528
  var _a, _b;
1250
1529
  const { searchParams } = new URL(window.location.href);
@@ -1254,18 +1533,20 @@ let ShipAidWidget = class extends s {
1254
1533
  }
1255
1534
  return !!((_b = this._store) == null ? void 0 : _b.planActive);
1256
1535
  }
1536
+ // ? Internal Helpers
1257
1537
  _currencyFormat(value) {
1258
- var _a, _b, _c, _d, _e;
1259
- return new Intl.NumberFormat((_b = (_a = window.Shopify) == null ? void 0 : _a.locale) != null ? _b : void 0, {
1260
- currency: ((_c = this._store) == null ? void 0 : _c.currency) || ((_e = (_d = window.Shopify) == null ? void 0 : _d.currency) == null ? void 0 : _e.active) || "USD",
1538
+ var _a, _b, _c;
1539
+ return new Intl.NumberFormat(void 0, {
1540
+ currency: this.currency || ((_a = this._store) == null ? void 0 : _a.currency) || ((_c = (_b = window.Shopify) == null ? void 0 : _b.currency) == null ? void 0 : _c.active) || "USD",
1261
1541
  style: "currency"
1262
1542
  }).format(Number(value));
1263
1543
  }
1544
+ // ? Internal methods
1545
+ /** Emit events */
1264
1546
  _dispatchEvent(event, detail = {}) {
1265
- this.dispatchEvent(
1266
- new CustomEvent(event, { bubbles: true, composed: true, detail })
1267
- );
1547
+ this.dispatchEvent(new CustomEvent(event, { bubbles: true, composed: true, detail }));
1268
1548
  }
1549
+ /** Handle cart or page refreshes */
1269
1550
  async _handleRefresh(input) {
1270
1551
  const isCart = Reflect.has(input, "items");
1271
1552
  if (this.shouldRefreshOnUpdate)
@@ -1278,8 +1559,9 @@ let ShipAidWidget = class extends s {
1278
1559
  lineItem: !isCart ? input : this._protectionCartItem
1279
1560
  });
1280
1561
  }
1562
+ /** Given the current order, it calculates the protection total according to the store protection settings. */
1281
1563
  async calculateProtectionTotal(cart) {
1282
- var _a, _b, _c, _d, _e, _f, _g, _h;
1564
+ var _a, _b, _c, _d, _e, _f;
1283
1565
  if (!cart)
1284
1566
  cart = await this._fetchCart();
1285
1567
  if (!cart)
@@ -1291,22 +1573,22 @@ let ShipAidWidget = class extends s {
1291
1573
  throw new Error("Tried to find protection variant, but protection settings for this store are missing.");
1292
1574
  }
1293
1575
  const excludedProductSkus = Array.isArray((_b = this._store) == null ? void 0 : _b.excludedProductSkus) ? (_c = this._store) == null ? void 0 : _c.excludedProductSkus.map((sku) => sku.trim()) : [];
1294
- const itemTotal = (_e = (_d = cart.items) == null ? void 0 : _d.reduce((total, item) => {
1576
+ const itemTotal = ((_d = cart.items) == null ? void 0 : _d.reduce((total, item) => {
1295
1577
  if (!item.sku)
1296
1578
  return total;
1297
1579
  const itemIsExcluded = excludedProductSkus.some((sku) => sku === item.sku.trim());
1298
1580
  return itemIsExcluded ? total - item.final_line_price : total;
1299
- }, cart.total_price)) != null ? _e : cart.total_price;
1300
- const protectionVariantsInCart = (_g = (_f = cart.items) == null ? void 0 : _f.filter((item) => {
1581
+ }, cart.total_price)) ?? cart.total_price;
1582
+ const protectionVariantsInCart = ((_e = cart.items) == null ? void 0 : _e.filter((item) => {
1301
1583
  var _a2, _b2;
1302
1584
  return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some((variant) => variant.id === item.variant_id);
1303
- })) != null ? _g : [];
1585
+ })) ?? [];
1304
1586
  const protectionVariantsInCartTotal = protectionVariantsInCart.reduce((total, item) => total + item.final_line_price, 0);
1305
1587
  const cartTotal = itemTotal - protectionVariantsInCartTotal;
1306
1588
  if (settings.protectionType === "FIXED") {
1307
1589
  if (typeof settings.defaultFee !== "number")
1308
1590
  throw new Error("Missing default fee amount.");
1309
- if (!((_h = settings.rules) == null ? void 0 : _h.length))
1591
+ if (!((_f = settings.rules) == null ? void 0 : _f.length))
1310
1592
  return settings.defaultFee;
1311
1593
  const formattedCartTotal = cartTotal / 100;
1312
1594
  const sortedRules = settings.rules.sort((a2, b2) => {
@@ -1328,6 +1610,10 @@ let ShipAidWidget = class extends s {
1328
1610
  }
1329
1611
  throw new Error("No protection type handler found for this store.");
1330
1612
  }
1613
+ /**
1614
+ * Given the current order, it finds the relevant protection product variant, and adds it to cart.
1615
+ * This should be run whenever the cart updates, or it is manually triggered.
1616
+ */
1331
1617
  _findProtectionVariant(protectionFee) {
1332
1618
  var _a, _b, _c, _d;
1333
1619
  const settings = (_a = this._store) == null ? void 0 : _a.protectionSettings;
@@ -1346,6 +1632,7 @@ let ShipAidWidget = class extends s {
1346
1632
  }
1347
1633
  return matchingVariant;
1348
1634
  }
1635
+ /** Update State */
1349
1636
  _setState(state2, message) {
1350
1637
  this._state = {
1351
1638
  loading: state2 === "loading",
@@ -1353,12 +1640,14 @@ let ShipAidWidget = class extends s {
1353
1640
  error: state2 === "error" ? message || true : false
1354
1641
  };
1355
1642
  }
1643
+ /** Updates the current protection status, calling the relevant add/remove function. */
1356
1644
  async _updateProtection() {
1357
1645
  return this._hasProtectionInCart ? this.removeProtection() : this.addProtection();
1358
1646
  }
1647
+ /** Fetches store info from the ShipAid public API. */
1359
1648
  async _fetchShipAidData() {
1360
- var _a, _b, _c, _d, _e, _f;
1361
- const shop = (_d = (_a = window.Shopify) == null ? void 0 : _a.shop) != null ? _d : (_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost;
1649
+ var _a, _b, _c, _d, _e;
1650
+ const shop = ((_a = window.Shopify) == null ? void 0 : _a.shop) ?? ((_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost);
1362
1651
  if (!shop)
1363
1652
  throw new Error("No shop found in Shopify object.");
1364
1653
  try {
@@ -1374,9 +1663,9 @@ let ShipAidWidget = class extends s {
1374
1663
  );
1375
1664
  if (!response)
1376
1665
  throw new Error("Missing response for store query.");
1377
- if ((_e = response.errors) == null ? void 0 : _e.length)
1666
+ if ((_d = response.errors) == null ? void 0 : _d.length)
1378
1667
  throw new Error(response.errors[0].message);
1379
- if (!((_f = response.data) == null ? void 0 : _f.store)) {
1668
+ if (!((_e = response.data) == null ? void 0 : _e.store)) {
1380
1669
  throw new Error("Missing store from store query response.");
1381
1670
  }
1382
1671
  return response.data.store;
@@ -1385,6 +1674,7 @@ let ShipAidWidget = class extends s {
1385
1674
  throw new Error(`Could not find a store for ${this._storeDomain}`);
1386
1675
  }
1387
1676
  }
1677
+ /** Fetch current cart from the Shopify ajax API */
1388
1678
  async _fetchCart() {
1389
1679
  try {
1390
1680
  const cart = await this._fetch.get("/cart.js");
@@ -1395,6 +1685,7 @@ let ShipAidWidget = class extends s {
1395
1685
  throw new Error("Could not fetch cart for current domain.");
1396
1686
  }
1397
1687
  }
1688
+ /** Fetch current product from the Shopify ajax API */
1398
1689
  async _fetchProduct() {
1399
1690
  try {
1400
1691
  const { product } = await this._fetch.get(`/products/${PRODUCT_HANDLE}.json`);
@@ -1405,14 +1696,18 @@ let ShipAidWidget = class extends s {
1405
1696
  throw new Error("Could not fetch protection product for current domain.");
1406
1697
  }
1407
1698
  }
1699
+ // ? Public methods that can be called from outside the component, for custom integrations.
1700
+ /** Whether the cart currently contains Shipping protection from ShipAid. */
1408
1701
  hasProtection() {
1409
1702
  return this._hasProtectionInCart;
1410
1703
  }
1704
+ /** Update the internal cart, which will trigger any protection fee updates */
1411
1705
  async updateCart(cart) {
1412
1706
  if (!cart)
1413
1707
  cart = await this._fetchCart();
1414
1708
  this._cart = cart;
1415
1709
  }
1710
+ /** Add ShipAid shipping protection. */
1416
1711
  async addProtection() {
1417
1712
  var _a, _b;
1418
1713
  try {
@@ -1443,6 +1738,7 @@ let ShipAidWidget = class extends s {
1443
1738
  );
1444
1739
  }
1445
1740
  }
1741
+ /** Remove ShipAid shipping protection. */
1446
1742
  async removeProtection() {
1447
1743
  try {
1448
1744
  if (!this._store)
@@ -1471,6 +1767,7 @@ let ShipAidWidget = class extends s {
1471
1767
  );
1472
1768
  }
1473
1769
  }
1770
+ /** Templates */
1474
1771
  learnMorePopupTemplate() {
1475
1772
  return y`
1476
1773
  <shipaid-popup-learn-more ?active=${this._popup === "learn-more"} @close=${() => {
@@ -1492,10 +1789,10 @@ let ShipAidWidget = class extends s {
1492
1789
  </div>
1493
1790
  <div class="prompt-product-details">
1494
1791
  <p class="prompt-product-details-title">
1495
- <slot name="title">Delivery Guarantee</slot>
1792
+ <slot name="title">${translate("title")}</slot>
1496
1793
  </p>
1497
1794
  <p class="prompt-product-details-description">
1498
- <slot name="subtitle">in case of Loss, Damage or Theft</slot>
1795
+ <slot name="subtitle">${translate("description")}</slot>
1499
1796
  </p>
1500
1797
  </div>
1501
1798
  <div class="prompt-product-actions">
@@ -1510,7 +1807,7 @@ let ShipAidWidget = class extends s {
1510
1807
  @click=${this._updateProtection}
1511
1808
  ?disabled=${this._state.loading}
1512
1809
  >
1513
- ${this._state.loading ? "Loading..." : this._hasProtectionInCart ? "Remove" : "+ Add"}
1810
+ ${this._state.loading ? translate("actions.loading") : this._hasProtectionInCart ? translate("actions.remove") : y`+ ${translate("actions.add")}`}
1514
1811
  </button>
1515
1812
  `
1516
1813
  )}
@@ -1527,7 +1824,7 @@ let ShipAidWidget = class extends s {
1527
1824
  this._popup = "learn-more";
1528
1825
  }}
1529
1826
  >
1530
- <span>Powered by</span>
1827
+ <span>${translate("footer.button")}</span>
1531
1828
  ${ShipAidLogoText}
1532
1829
  </a>
1533
1830
  <button
@@ -1542,6 +1839,12 @@ let ShipAidWidget = class extends s {
1542
1839
  </div>
1543
1840
  `;
1544
1841
  }
1842
+ // Load the initial language and mark that the strings has been loaded so the component can render.
1843
+ async connectedCallback() {
1844
+ super.connectedCallback();
1845
+ await use(this.lang);
1846
+ this.hasLoadedStrings = true;
1847
+ }
1545
1848
  render() {
1546
1849
  useOnce(this, async () => {
1547
1850
  var _a, _b;
@@ -1599,7 +1902,12 @@ let ShipAidWidget = class extends s {
1599
1902
  if (hasSessionPayload)
1600
1903
  return;
1601
1904
  sessionStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify({ loaded: true }));
1602
- if (!this._hasProtectionInCart && ((_c = this._cart) == null ? void 0 : _c.item_count) && this._store.widgetShowCart) {
1905
+ if (
1906
+ // If we first check that no protection items are in the cart
1907
+ !this._hasProtectionInCart && // Then check we have some items in the cart
1908
+ ((_c = this._cart) == null ? void 0 : _c.item_count) && // And that we are actually showing the widget
1909
+ this._store.widgetShowCart
1910
+ ) {
1603
1911
  await this.addProtection();
1604
1912
  }
1605
1913
  }, 500);
@@ -1689,7 +1997,7 @@ let ShipAidWidget = class extends s {
1689
1997
  () => b
1690
1998
  );
1691
1999
  },
1692
- () => y`<p><slot name="loading" default>Loading ShipAid Widget...</slot></p>`
2000
+ () => y`<p><slot name="loading" default>${translate("loading")}</slot></p>`
1693
2001
  )}
1694
2002
  </div>
1695
2003
  `;
@@ -1697,55 +2005,64 @@ let ShipAidWidget = class extends s {
1697
2005
  };
1698
2006
  ShipAidWidget.styles = styles;
1699
2007
  __decorateClass([
1700
- e$3({ type: Boolean, attribute: true })
2008
+ e$6({ type: Boolean, attribute: true })
1701
2009
  ], ShipAidWidget.prototype, "disablePolling", 2);
1702
2010
  __decorateClass([
1703
- e$3({ type: Boolean, attribute: true })
2011
+ e$6({ type: Boolean, attribute: true })
1704
2012
  ], ShipAidWidget.prototype, "disableActions", 2);
1705
2013
  __decorateClass([
1706
- e$3({ type: Number, attribute: true })
2014
+ e$6({ type: Number, attribute: true })
1707
2015
  ], ShipAidWidget.prototype, "pollingInterval", 2);
1708
2016
  __decorateClass([
1709
- e$3({ type: Boolean, attribute: true })
2017
+ e$6({ type: Boolean, attribute: true })
1710
2018
  ], ShipAidWidget.prototype, "disableRefresh", 2);
1711
2019
  __decorateClass([
1712
- t$2()
2020
+ e$6({ type: String, attribute: true })
2021
+ ], ShipAidWidget.prototype, "lang", 2);
2022
+ __decorateClass([
2023
+ e$6({ type: String, attribute: true })
2024
+ ], ShipAidWidget.prototype, "currency", 2);
2025
+ __decorateClass([
2026
+ t$3()
1713
2027
  ], ShipAidWidget.prototype, "_storeDomain", 2);
1714
2028
  __decorateClass([
1715
- t$2()
2029
+ t$3()
1716
2030
  ], ShipAidWidget.prototype, "_store", 2);
1717
2031
  __decorateClass([
1718
- t$2()
2032
+ t$3()
1719
2033
  ], ShipAidWidget.prototype, "_cart", 2);
1720
2034
  __decorateClass([
1721
- t$2()
2035
+ t$3()
1722
2036
  ], ShipAidWidget.prototype, "_protectionProduct", 2);
1723
2037
  __decorateClass([
1724
- t$2()
2038
+ t$3()
1725
2039
  ], ShipAidWidget.prototype, "_cartLastUpdated", 2);
1726
2040
  __decorateClass([
1727
- t$2()
2041
+ t$3()
1728
2042
  ], ShipAidWidget.prototype, "_hasFinishedSetup", 2);
1729
2043
  __decorateClass([
1730
- t$2()
2044
+ t$3()
1731
2045
  ], ShipAidWidget.prototype, "_shouldShowWidget", 2);
1732
2046
  __decorateClass([
1733
- t$2()
2047
+ t$3()
1734
2048
  ], ShipAidWidget.prototype, "_hasProtectionInCart", 2);
1735
2049
  __decorateClass([
1736
- t$2()
2050
+ t$3()
1737
2051
  ], ShipAidWidget.prototype, "_protectionCartItem", 2);
1738
2052
  __decorateClass([
1739
- t$2()
2053
+ t$3()
1740
2054
  ], ShipAidWidget.prototype, "_protectionVariant", 2);
1741
2055
  __decorateClass([
1742
- t$2()
2056
+ t$3()
2057
+ ], ShipAidWidget.prototype, "hasLoadedStrings", 2);
2058
+ __decorateClass([
2059
+ t$3()
1743
2060
  ], ShipAidWidget.prototype, "_state", 2);
1744
2061
  __decorateClass([
1745
- t$2()
2062
+ t$3()
1746
2063
  ], ShipAidWidget.prototype, "_popup", 2);
1747
2064
  ShipAidWidget = __decorateClass([
1748
- e$4("shipaid-widget")
2065
+ e$7("shipaid-widget")
1749
2066
  ], ShipAidWidget);
1750
2067
  export {
1751
2068
  ShipAidWidget