@vouchfor/embeds 0.0.0-experiment.0b5c8d1 → 0.0.0-experiment.113f809
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/embeds.js +117 -103
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/src/components/Embed/controllers/fetcher.d.ts +1 -0
- package/dist/es/src/components/Embed/index.d.ts +2 -0
- package/dist/iife/embeds.iife.js +249 -207
- package/dist/iife/embeds.iife.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Embed/Embed.stories.ts +13 -1
- package/src/components/Embed/controllers/fetcher.ts +24 -5
- package/src/components/Embed/index.ts +4 -1
package/dist/es/embeds.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { property as
|
1
|
+
import { property as y, state as Bt, customElement as le } from "lit/decorators.js";
|
2
2
|
import { ifDefined as ft } from "lit/directives/if-defined.js";
|
3
|
-
import { createRef as
|
4
|
-
import { Task as
|
3
|
+
import { createRef as Wt, ref as qt } from "lit/directives/ref.js";
|
4
|
+
import { Task as gt } from "@lit/task";
|
5
5
|
import { v4 as P } from "uuid";
|
6
6
|
import "@vouchfor/media-player";
|
7
7
|
/**
|
@@ -9,10 +9,10 @@ import "@vouchfor/media-player";
|
|
9
9
|
* Copyright 2019 Google LLC
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
11
11
|
*/
|
12
|
-
const G = globalThis, _t = G.ShadowRoot && (G.ShadyCSS === void 0 || G.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
12
|
+
const G = globalThis, _t = G.ShadowRoot && (G.ShadyCSS === void 0 || G.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Xt = Symbol(), yt = /* @__PURE__ */ new WeakMap();
|
13
13
|
let de = class {
|
14
14
|
constructor(t, e, i) {
|
15
|
-
if (this._$cssResult$ = !0, i !==
|
15
|
+
if (this._$cssResult$ = !0, i !== Xt)
|
16
16
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
17
17
|
this.cssText = t, this.t = e;
|
18
18
|
}
|
@@ -21,7 +21,7 @@ let de = class {
|
|
21
21
|
const e = this.t;
|
22
22
|
if (_t && t === void 0) {
|
23
23
|
const i = e !== void 0 && e.length === 1;
|
24
|
-
i && (t =
|
24
|
+
i && (t = yt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && yt.set(e, t));
|
25
25
|
}
|
26
26
|
return t;
|
27
27
|
}
|
@@ -29,7 +29,7 @@ let de = class {
|
|
29
29
|
return this.cssText;
|
30
30
|
}
|
31
31
|
};
|
32
|
-
const ce = (r) => new de(typeof r == "string" ? r : r + "", void 0,
|
32
|
+
const ce = (r) => new de(typeof r == "string" ? r : r + "", void 0, Xt), pe = (r, t) => {
|
33
33
|
if (_t)
|
34
34
|
r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
35
35
|
else
|
@@ -48,10 +48,10 @@ const ce = (r) => new de(typeof r == "string" ? r : r + "", void 0, qt), pe = (r
|
|
48
48
|
* Copyright 2017 Google LLC
|
49
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
50
50
|
*/
|
51
|
-
const { is: ue, defineProperty: _e, getOwnPropertyDescriptor: me, getOwnPropertyNames: $e, getOwnPropertySymbols: fe, getPrototypeOf: ge } = Object, b = globalThis,
|
51
|
+
const { is: ue, defineProperty: _e, getOwnPropertyDescriptor: me, getOwnPropertyNames: $e, getOwnPropertySymbols: fe, getPrototypeOf: ge } = Object, b = globalThis, At = b.trustedTypes, ye = At ? At.emptyScript : "", rt = b.reactiveElementPolyfillSupport, I = (r, t) => r, ct = { toAttribute(r, t) {
|
52
52
|
switch (t) {
|
53
53
|
case Boolean:
|
54
|
-
r = r ?
|
54
|
+
r = r ? ye : null;
|
55
55
|
break;
|
56
56
|
case Object:
|
57
57
|
case Array:
|
@@ -76,7 +76,7 @@ const { is: ue, defineProperty: _e, getOwnPropertyDescriptor: me, getOwnProperty
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
return e;
|
79
|
-
} },
|
79
|
+
} }, Jt = (r, t) => !ue(r, t), bt = { attribute: !0, type: String, converter: ct, reflect: !1, hasChanged: Jt };
|
80
80
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), b.litPropertyMetadata ?? (b.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
81
81
|
let N = class extends HTMLElement {
|
82
82
|
static addInitializer(t) {
|
@@ -85,7 +85,7 @@ let N = class extends HTMLElement {
|
|
85
85
|
static get observedAttributes() {
|
86
86
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
87
87
|
}
|
88
|
-
static createProperty(t, e =
|
88
|
+
static createProperty(t, e = bt) {
|
89
89
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
90
90
|
const i = Symbol(), s = this.getPropertyDescriptor(t, i, e);
|
91
91
|
s !== void 0 && _e(this.prototype, t, s);
|
@@ -105,7 +105,7 @@ let N = class extends HTMLElement {
|
|
105
105
|
}, configurable: !0, enumerable: !0 };
|
106
106
|
}
|
107
107
|
static getPropertyOptions(t) {
|
108
|
-
return this.elementProperties.get(t) ??
|
108
|
+
return this.elementProperties.get(t) ?? bt;
|
109
109
|
}
|
110
110
|
static _$Ei() {
|
111
111
|
if (this.hasOwnProperty(I("elementProperties")))
|
@@ -211,7 +211,7 @@ let N = class extends HTMLElement {
|
|
211
211
|
}
|
212
212
|
requestUpdate(t, e, i, s = !1, n) {
|
213
213
|
if (t !== void 0) {
|
214
|
-
if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ??
|
214
|
+
if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ?? Jt)(s ? n : this[t], e))
|
215
215
|
return;
|
216
216
|
this.C(t, e, i);
|
217
217
|
}
|
@@ -295,13 +295,13 @@ N.elementStyles = [], N.shadowRootOptions = { mode: "open" }, N[I("elementProper
|
|
295
295
|
* Copyright 2017 Google LLC
|
296
296
|
* SPDX-License-Identifier: BSD-3-Clause
|
297
297
|
*/
|
298
|
-
const V = globalThis, Y = V.trustedTypes,
|
299
|
-
\f\r]`, L = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
300
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
301
|
-
function
|
298
|
+
const V = globalThis, Y = V.trustedTypes, Et = Y ? Y.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Kt = "$lit$", v = `lit$${(Math.random() + "").slice(9)}$`, Ft = "?" + v, ve = `<${Ft}>`, T = document, Q = () => T.createComment(""), B = (r) => r === null || typeof r != "object" && typeof r != "function", Gt = Array.isArray, Ae = (r) => Gt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", nt = `[
|
299
|
+
\f\r]`, L = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, St = /-->/g, wt = />/g, S = RegExp(`>|${nt}(?:([^\\s"'>=/]+)(${nt}*=${nt}*(?:[^
|
300
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Pt = /'/g, Ct = /"/g, Zt = /^(?:script|style|textarea|title)$/i, W = Symbol.for("lit-noChange"), _ = Symbol.for("lit-nothing"), Ut = /* @__PURE__ */ new WeakMap(), C = T.createTreeWalker(T, 129);
|
301
|
+
function Yt(r, t) {
|
302
302
|
if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
|
303
303
|
throw Error("invalid template strings array");
|
304
|
-
return
|
304
|
+
return Et !== void 0 ? Et.createHTML(t) : t;
|
305
305
|
}
|
306
306
|
const be = (r, t) => {
|
307
307
|
const e = r.length - 1, i = [];
|
@@ -310,19 +310,19 @@ const be = (r, t) => {
|
|
310
310
|
const a = r[h];
|
311
311
|
let d, c, l = -1, p = 0;
|
312
312
|
for (; p < a.length && (o.lastIndex = p, c = o.exec(a), c !== null); )
|
313
|
-
p = o.lastIndex, o === L ? c[1] === "!--" ? o =
|
313
|
+
p = o.lastIndex, o === L ? c[1] === "!--" ? o = St : c[1] !== void 0 ? o = wt : c[2] !== void 0 ? (Zt.test(c[2]) && (s = RegExp("</" + c[2], "g")), o = S) : c[3] !== void 0 && (o = S) : o === S ? c[0] === ">" ? (o = s ?? L, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, d = c[1], o = c[3] === void 0 ? S : c[3] === '"' ? Ct : Pt) : o === Ct || o === Pt ? o = S : o === St || o === wt ? o = L : (o = S, s = void 0);
|
314
314
|
const u = o === S && r[h + 1].startsWith("/>") ? " " : "";
|
315
|
-
n += o === L ? a +
|
315
|
+
n += o === L ? a + ve : l >= 0 ? (i.push(d), a.slice(0, l) + Kt + a.slice(l) + v + u) : a + v + (l === -2 ? h : u);
|
316
316
|
}
|
317
|
-
return [
|
317
|
+
return [Yt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
|
318
318
|
};
|
319
|
-
let pt = class
|
319
|
+
let pt = class Qt {
|
320
320
|
constructor({ strings: t, _$litType$: e }, i) {
|
321
321
|
let s;
|
322
322
|
this.parts = [];
|
323
323
|
let n = 0, o = 0;
|
324
324
|
const h = t.length - 1, a = this.parts, [d, c] = be(t, e);
|
325
|
-
if (this.el =
|
325
|
+
if (this.el = Qt.createElement(d, i), C.currentNode = this.el.content, e === 2) {
|
326
326
|
const l = this.el.content.firstChild;
|
327
327
|
l.replaceWith(...l.childNodes);
|
328
328
|
}
|
@@ -330,13 +330,13 @@ let pt = class Yt {
|
|
330
330
|
if (s.nodeType === 1) {
|
331
331
|
if (s.hasAttributes())
|
332
332
|
for (const l of s.getAttributeNames())
|
333
|
-
if (l.endsWith(
|
334
|
-
const p = c[o++], u = s.getAttribute(l).split(
|
333
|
+
if (l.endsWith(Kt)) {
|
334
|
+
const p = c[o++], u = s.getAttribute(l).split(v), g = /([.?@])?(.*)/.exec(p);
|
335
335
|
a.push({ type: 1, index: n, name: g[2], strings: u, ctor: g[1] === "." ? Se : g[1] === "?" ? we : g[1] === "@" ? Pe : it }), s.removeAttribute(l);
|
336
336
|
} else
|
337
|
-
l.startsWith(
|
338
|
-
if (
|
339
|
-
const l = s.textContent.split(
|
337
|
+
l.startsWith(v) && (a.push({ type: 6, index: n }), s.removeAttribute(l));
|
338
|
+
if (Zt.test(s.tagName)) {
|
339
|
+
const l = s.textContent.split(v), p = l.length - 1;
|
340
340
|
if (p > 0) {
|
341
341
|
s.textContent = Y ? Y.emptyScript : "";
|
342
342
|
for (let u = 0; u < p; u++)
|
@@ -345,12 +345,12 @@ let pt = class Yt {
|
|
345
345
|
}
|
346
346
|
}
|
347
347
|
} else if (s.nodeType === 8)
|
348
|
-
if (s.data ===
|
348
|
+
if (s.data === Ft)
|
349
349
|
a.push({ type: 2, index: n });
|
350
350
|
else {
|
351
351
|
let l = -1;
|
352
|
-
for (; (l = s.data.indexOf(
|
353
|
-
a.push({ type: 7, index: n }), l +=
|
352
|
+
for (; (l = s.data.indexOf(v, l + 1)) !== -1; )
|
353
|
+
a.push({ type: 7, index: n }), l += v.length - 1;
|
354
354
|
}
|
355
355
|
n++;
|
356
356
|
}
|
@@ -385,7 +385,7 @@ let Ee = class {
|
|
385
385
|
for (; a !== void 0; ) {
|
386
386
|
if (o === a.index) {
|
387
387
|
let d;
|
388
|
-
a.type === 2 ? d = new
|
388
|
+
a.type === 2 ? d = new te(n, n.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (d = new Ce(n, this, t)), this._$AV.push(d), a = i[++h];
|
389
389
|
}
|
390
390
|
o !== (a == null ? void 0 : a.index) && (n = C.nextNode(), o++);
|
391
391
|
}
|
@@ -396,7 +396,7 @@ let Ee = class {
|
|
396
396
|
for (const i of this._$AV)
|
397
397
|
i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
398
398
|
}
|
399
|
-
},
|
399
|
+
}, te = class ee {
|
400
400
|
get _$AU() {
|
401
401
|
var t;
|
402
402
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
@@ -429,7 +429,7 @@ let Ee = class {
|
|
429
429
|
}
|
430
430
|
g(t) {
|
431
431
|
var n;
|
432
|
-
const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = pt.createElement(
|
432
|
+
const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = pt.createElement(Yt(i.h, i.h[0]), this.options)), i);
|
433
433
|
if (((n = this._$AH) == null ? void 0 : n._$AD) === s)
|
434
434
|
this._$AH.p(e);
|
435
435
|
else {
|
@@ -438,15 +438,15 @@ let Ee = class {
|
|
438
438
|
}
|
439
439
|
}
|
440
440
|
_$AC(t) {
|
441
|
-
let e =
|
442
|
-
return e === void 0 &&
|
441
|
+
let e = Ut.get(t.strings);
|
442
|
+
return e === void 0 && Ut.set(t.strings, e = new pt(t)), e;
|
443
443
|
}
|
444
444
|
T(t) {
|
445
|
-
|
445
|
+
Gt(this._$AH) || (this._$AH = [], this._$AR());
|
446
446
|
const e = this._$AH;
|
447
447
|
let i, s = 0;
|
448
448
|
for (const n of t)
|
449
|
-
s === e.length ? e.push(i = new
|
449
|
+
s === e.length ? e.push(i = new ee(this.k(Q()), this.k(Q()), this, this.options)) : i = e[s], i._$AI(n), s++;
|
450
450
|
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
|
451
451
|
}
|
452
452
|
_$AR(t = this._$AA.nextSibling, e) {
|
@@ -526,16 +526,16 @@ let Ee = class {
|
|
526
526
|
}
|
527
527
|
};
|
528
528
|
const ot = V.litHtmlPolyfillSupport;
|
529
|
-
ot == null || ot(pt,
|
529
|
+
ot == null || ot(pt, te), (V.litHtmlVersions ?? (V.litHtmlVersions = [])).push("3.1.0");
|
530
530
|
/**
|
531
531
|
* @license
|
532
532
|
* Copyright 2019 Google LLC
|
533
533
|
* SPDX-License-Identifier: BSD-3-Clause
|
534
534
|
*/
|
535
|
-
const Z = globalThis, mt = Z.ShadowRoot && (Z.ShadyCSS === void 0 || Z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
535
|
+
const Z = globalThis, mt = Z.ShadowRoot && (Z.ShadyCSS === void 0 || Z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ie = Symbol(), Tt = /* @__PURE__ */ new WeakMap();
|
536
536
|
let Ue = class {
|
537
537
|
constructor(t, e, i) {
|
538
|
-
if (this._$cssResult$ = !0, i !==
|
538
|
+
if (this._$cssResult$ = !0, i !== ie)
|
539
539
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
540
540
|
this.cssText = t, this.t = e;
|
541
541
|
}
|
@@ -544,7 +544,7 @@ let Ue = class {
|
|
544
544
|
const e = this.t;
|
545
545
|
if (mt && t === void 0) {
|
546
546
|
const i = e !== void 0 && e.length === 1;
|
547
|
-
i && (t =
|
547
|
+
i && (t = Tt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Tt.set(e, t));
|
548
548
|
}
|
549
549
|
return t;
|
550
550
|
}
|
@@ -552,7 +552,7 @@ let Ue = class {
|
|
552
552
|
return this.cssText;
|
553
553
|
}
|
554
554
|
};
|
555
|
-
const Te = (r) => new Ue(typeof r == "string" ? r : r + "", void 0,
|
555
|
+
const Te = (r) => new Ue(typeof r == "string" ? r : r + "", void 0, ie), xe = (r, t) => {
|
556
556
|
if (mt)
|
557
557
|
r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
558
558
|
else
|
@@ -560,7 +560,7 @@ const Te = (r) => new Ue(typeof r == "string" ? r : r + "", void 0, ee), xe = (r
|
|
560
560
|
const i = document.createElement("style"), s = Z.litNonce;
|
561
561
|
s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i);
|
562
562
|
}
|
563
|
-
},
|
563
|
+
}, xt = mt ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
|
564
564
|
let e = "";
|
565
565
|
for (const i of t.cssRules)
|
566
566
|
e += i.cssText;
|
@@ -571,7 +571,7 @@ const Te = (r) => new Ue(typeof r == "string" ? r : r + "", void 0, ee), xe = (r
|
|
571
571
|
* Copyright 2017 Google LLC
|
572
572
|
* SPDX-License-Identifier: BSD-3-Clause
|
573
573
|
*/
|
574
|
-
const { is: Re, defineProperty: He, getOwnPropertyDescriptor: ke, getOwnPropertyNames: Oe, getOwnPropertySymbols: Ne, getPrototypeOf: Le } = Object, E = globalThis,
|
574
|
+
const { is: Re, defineProperty: He, getOwnPropertyDescriptor: ke, getOwnPropertyNames: Oe, getOwnPropertySymbols: Ne, getPrototypeOf: Le } = Object, E = globalThis, Rt = E.trustedTypes, Me = Rt ? Rt.emptyScript : "", at = E.reactiveElementPolyfillSupport, D = (r, t) => r, ut = { toAttribute(r, t) {
|
575
575
|
switch (t) {
|
576
576
|
case Boolean:
|
577
577
|
r = r ? Me : null;
|
@@ -599,7 +599,7 @@ const { is: Re, defineProperty: He, getOwnPropertyDescriptor: ke, getOwnProperty
|
|
599
599
|
}
|
600
600
|
}
|
601
601
|
return e;
|
602
|
-
} },
|
602
|
+
} }, se = (r, t) => !Re(r, t), Ht = { attribute: !0, type: String, converter: ut, reflect: !1, hasChanged: se };
|
603
603
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), E.litPropertyMetadata ?? (E.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
604
604
|
class R extends HTMLElement {
|
605
605
|
static addInitializer(t) {
|
@@ -608,7 +608,7 @@ class R extends HTMLElement {
|
|
608
608
|
static get observedAttributes() {
|
609
609
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
610
610
|
}
|
611
|
-
static createProperty(t, e =
|
611
|
+
static createProperty(t, e = Ht) {
|
612
612
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
613
613
|
const i = Symbol(), s = this.getPropertyDescriptor(t, i, e);
|
614
614
|
s !== void 0 && He(this.prototype, t, s);
|
@@ -628,7 +628,7 @@ class R extends HTMLElement {
|
|
628
628
|
}, configurable: !0, enumerable: !0 };
|
629
629
|
}
|
630
630
|
static getPropertyOptions(t) {
|
631
|
-
return this.elementProperties.get(t) ??
|
631
|
+
return this.elementProperties.get(t) ?? Ht;
|
632
632
|
}
|
633
633
|
static _$Ei() {
|
634
634
|
if (this.hasOwnProperty(D("elementProperties")))
|
@@ -663,9 +663,9 @@ class R extends HTMLElement {
|
|
663
663
|
if (Array.isArray(t)) {
|
664
664
|
const i = new Set(t.flat(1 / 0).reverse());
|
665
665
|
for (const s of i)
|
666
|
-
e.unshift(
|
666
|
+
e.unshift(xt(s));
|
667
667
|
} else
|
668
|
-
t !== void 0 && e.push(
|
668
|
+
t !== void 0 && e.push(xt(t));
|
669
669
|
return e;
|
670
670
|
}
|
671
671
|
static _$Eu(t, e) {
|
@@ -734,7 +734,7 @@ class R extends HTMLElement {
|
|
734
734
|
}
|
735
735
|
requestUpdate(t, e, i, s = !1, n) {
|
736
736
|
if (t !== void 0) {
|
737
|
-
if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ??
|
737
|
+
if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ?? se)(s ? n : this[t], e))
|
738
738
|
return;
|
739
739
|
this.C(t, e, i);
|
740
740
|
}
|
@@ -818,13 +818,13 @@ R.elementStyles = [], R.shadowRootOptions = { mode: "open" }, R[D("elementProper
|
|
818
818
|
* Copyright 2017 Google LLC
|
819
819
|
* SPDX-License-Identifier: BSD-3-Clause
|
820
820
|
*/
|
821
|
-
const z = globalThis, tt = z.trustedTypes,
|
822
|
-
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
823
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
824
|
-
function
|
821
|
+
const z = globalThis, tt = z.trustedTypes, kt = tt ? tt.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, re = "$lit$", A = `lit$${(Math.random() + "").slice(9)}$`, ne = "?" + A, Ie = `<${ne}>`, x = document, q = () => x.createComment(""), X = (r) => r === null || typeof r != "object" && typeof r != "function", oe = Array.isArray, Ve = (r) => oe(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", ht = `[
|
822
|
+
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ot = /-->/g, Nt = />/g, w = RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
823
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Lt = /'/g, Mt = /"/g, ae = /^(?:script|style|textarea|title)$/i, De = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), ze = De(1), k = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), It = /* @__PURE__ */ new WeakMap(), U = x.createTreeWalker(x, 129);
|
824
|
+
function he(r, t) {
|
825
825
|
if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
|
826
826
|
throw Error("invalid template strings array");
|
827
|
-
return
|
827
|
+
return kt !== void 0 ? kt.createHTML(t) : t;
|
828
828
|
}
|
829
829
|
const je = (r, t) => {
|
830
830
|
const e = r.length - 1, i = [];
|
@@ -833,11 +833,11 @@ const je = (r, t) => {
|
|
833
833
|
const a = r[h];
|
834
834
|
let d, c, l = -1, p = 0;
|
835
835
|
for (; p < a.length && (o.lastIndex = p, c = o.exec(a), c !== null); )
|
836
|
-
p = o.lastIndex, o === M ? c[1] === "!--" ? o =
|
836
|
+
p = o.lastIndex, o === M ? c[1] === "!--" ? o = Ot : c[1] !== void 0 ? o = Nt : c[2] !== void 0 ? (ae.test(c[2]) && (s = RegExp("</" + c[2], "g")), o = w) : c[3] !== void 0 && (o = w) : o === w ? c[0] === ">" ? (o = s ?? M, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, d = c[1], o = c[3] === void 0 ? w : c[3] === '"' ? Mt : Lt) : o === Mt || o === Lt ? o = w : o === Ot || o === Nt ? o = M : (o = w, s = void 0);
|
837
837
|
const u = o === w && r[h + 1].startsWith("/>") ? " " : "";
|
838
|
-
n += o === M ? a + Ie : l >= 0 ? (i.push(d), a.slice(0, l) +
|
838
|
+
n += o === M ? a + Ie : l >= 0 ? (i.push(d), a.slice(0, l) + re + a.slice(l) + A + u) : a + A + (l === -2 ? h : u);
|
839
839
|
}
|
840
|
-
return [
|
840
|
+
return [he(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
|
841
841
|
};
|
842
842
|
class J {
|
843
843
|
constructor({ strings: t, _$litType$: e }, i) {
|
@@ -853,12 +853,12 @@ class J {
|
|
853
853
|
if (s.nodeType === 1) {
|
854
854
|
if (s.hasAttributes())
|
855
855
|
for (const l of s.getAttributeNames())
|
856
|
-
if (l.endsWith(
|
856
|
+
if (l.endsWith(re)) {
|
857
857
|
const p = c[o++], u = s.getAttribute(l).split(A), g = /([.?@])?(.*)/.exec(p);
|
858
858
|
a.push({ type: 1, index: n, name: g[2], strings: u, ctor: g[1] === "." ? We : g[1] === "?" ? qe : g[1] === "@" ? Xe : st }), s.removeAttribute(l);
|
859
859
|
} else
|
860
860
|
l.startsWith(A) && (a.push({ type: 6, index: n }), s.removeAttribute(l));
|
861
|
-
if (
|
861
|
+
if (ae.test(s.tagName)) {
|
862
862
|
const l = s.textContent.split(A), p = l.length - 1;
|
863
863
|
if (p > 0) {
|
864
864
|
s.textContent = tt ? tt.emptyScript : "";
|
@@ -868,7 +868,7 @@ class J {
|
|
868
868
|
}
|
869
869
|
}
|
870
870
|
} else if (s.nodeType === 8)
|
871
|
-
if (s.data ===
|
871
|
+
if (s.data === ne)
|
872
872
|
a.push({ type: 2, index: n });
|
873
873
|
else {
|
874
874
|
let l = -1;
|
@@ -953,7 +953,7 @@ class K {
|
|
953
953
|
}
|
954
954
|
g(t) {
|
955
955
|
var n;
|
956
|
-
const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = J.createElement(
|
956
|
+
const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = J.createElement(he(i.h, i.h[0]), this.options)), i);
|
957
957
|
if (((n = this._$AH) == null ? void 0 : n._$AD) === s)
|
958
958
|
this._$AH.p(e);
|
959
959
|
else {
|
@@ -962,11 +962,11 @@ class K {
|
|
962
962
|
}
|
963
963
|
}
|
964
964
|
_$AC(t) {
|
965
|
-
let e =
|
966
|
-
return e === void 0 &&
|
965
|
+
let e = It.get(t.strings);
|
966
|
+
return e === void 0 && It.set(t.strings, e = new J(t)), e;
|
967
967
|
}
|
968
968
|
T(t) {
|
969
|
-
|
969
|
+
oe(this._$AH) || (this._$AH = [], this._$AR());
|
970
970
|
const e = this._$AH;
|
971
971
|
let i, s = 0;
|
972
972
|
for (const n of t)
|
@@ -1095,8 +1095,8 @@ class j extends R {
|
|
1095
1095
|
return k;
|
1096
1096
|
}
|
1097
1097
|
}
|
1098
|
-
var
|
1099
|
-
j._$litElement$ = !0, j.finalized = !0, (
|
1098
|
+
var jt;
|
1099
|
+
j._$litElement$ = !0, j.finalized = !0, (jt = globalThis.litElementHydrateSupport) == null || jt.call(globalThis, { LitElement: j });
|
1100
1100
|
const dt = globalThis.litElementPolyfillSupport;
|
1101
1101
|
dt == null || dt({ LitElement: j });
|
1102
1102
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.2");
|
@@ -1110,10 +1110,10 @@ function Fe(r, t, e) {
|
|
1110
1110
|
}
|
1111
1111
|
class Ge {
|
1112
1112
|
constructor(t, e) {
|
1113
|
-
this._events = [], this._cleanup = [], this._forwardElementRef =
|
1113
|
+
this._events = [], this._cleanup = [], this._forwardElementRef = Wt(), this.host = t, this._events = e, t.addController(this);
|
1114
1114
|
}
|
1115
1115
|
register() {
|
1116
|
-
return
|
1116
|
+
return qt(this._forwardElementRef);
|
1117
1117
|
}
|
1118
1118
|
hostConnected() {
|
1119
1119
|
requestAnimationFrame(() => {
|
@@ -1128,20 +1128,20 @@ class Ge {
|
|
1128
1128
|
}), this._cleanup = [];
|
1129
1129
|
}
|
1130
1130
|
}
|
1131
|
-
const
|
1131
|
+
const Vt = "https://d2rxhdlm2q91uk.cloudfront.net", Ze = "https://d1ix11aj5kfygl.cloudfront.net", Ye = "https://d157jlwnudd93d.cloudfront.net", Dt = "https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev", Qe = "https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging", ti = "https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod", ei = "http://localhost:6060/v2", ii = "https://embed-dev.vouchfor.com/v2", si = "https://embed-staging.vouchfor.com/v2", ri = "https://embed.vouchfor.com/v2";
|
1132
1132
|
function et(r) {
|
1133
1133
|
if (!["local", "dev", "staging", "prod"].includes(r))
|
1134
1134
|
throw new Error(`Unknown environment: ${r}`);
|
1135
1135
|
if (r === "local")
|
1136
1136
|
return {
|
1137
|
-
videoUrl:
|
1138
|
-
publicApiUrl:
|
1137
|
+
videoUrl: Vt,
|
1138
|
+
publicApiUrl: Dt,
|
1139
1139
|
embedApiUrl: ei
|
1140
1140
|
};
|
1141
1141
|
if (r === "dev")
|
1142
1142
|
return {
|
1143
|
-
videoUrl:
|
1144
|
-
publicApiUrl:
|
1143
|
+
videoUrl: Vt,
|
1144
|
+
publicApiUrl: Dt,
|
1145
1145
|
embedApiUrl: ii
|
1146
1146
|
};
|
1147
1147
|
if (r === "staging")
|
@@ -1191,27 +1191,38 @@ class ni {
|
|
1191
1191
|
["Cache-Control", "max-age=0"]
|
1192
1192
|
]
|
1193
1193
|
}), a;
|
1194
|
-
}, this.host = t, new
|
1194
|
+
}, this.host = t, new gt(
|
1195
1195
|
this.host,
|
1196
1196
|
async ([e, i, s, n, o]) => {
|
1197
1197
|
var h, a, d, c;
|
1198
1198
|
try {
|
1199
1199
|
if (t.vouch = void 0, t.template = void 0, s) {
|
1200
1200
|
let l;
|
1201
|
-
o && (this.fetching = !0, l = await this.getTemplate(e, i, o)),
|
1201
|
+
o && (this.fetching = !0, l = await this.getTemplate(e, i, o)), this._vouch = s, t.template = l ?? ((a = (h = s == null ? void 0 : s.settings) == null ? void 0 : h.template) == null ? void 0 : a.instance);
|
1202
1202
|
} else if (n) {
|
1203
1203
|
this.fetching = !0;
|
1204
1204
|
const [l, p] = await Promise.all([
|
1205
1205
|
this.getVouch(e, i, n),
|
1206
1206
|
o ? this.getTemplate(e, i, o) : null
|
1207
1207
|
]);
|
1208
|
-
|
1208
|
+
this._vouch = l, t.template = p ?? ((c = (d = l == null ? void 0 : l.settings) == null ? void 0 : d.template) == null ? void 0 : c.instance);
|
1209
1209
|
}
|
1210
1210
|
} finally {
|
1211
1211
|
this.fetching = !1;
|
1212
1212
|
}
|
1213
1213
|
},
|
1214
1214
|
() => [t.env, t.apiKey, t.data, t.vouchId, t.templateId]
|
1215
|
+
), new gt(
|
1216
|
+
this.host,
|
1217
|
+
([e, i]) => {
|
1218
|
+
t.vouch = e ? {
|
1219
|
+
...e,
|
1220
|
+
questions: {
|
1221
|
+
items: e == null ? void 0 : e.questions.items.filter((s, n) => !(i != null && i.length) || (i == null ? void 0 : i.includes(n + 1)))
|
1222
|
+
}
|
1223
|
+
} : void 0;
|
1224
|
+
},
|
1225
|
+
() => [this._vouch, t.questions]
|
1215
1226
|
);
|
1216
1227
|
}
|
1217
1228
|
set fetching(t) {
|
@@ -1221,7 +1232,7 @@ class ni {
|
|
1221
1232
|
return this._fetching;
|
1222
1233
|
}
|
1223
1234
|
}
|
1224
|
-
const oi = "@vouchfor/embeds", ai = "0.0.0-experiment.
|
1235
|
+
const oi = "@vouchfor/embeds", ai = "0.0.0-experiment.113f809", hi = "MIT", li = "Aaron Williams", di = "dist/es/embeds.js", ci = "dist/es/embeds.js", pi = "module", ui = "dist/es/index.d.ts", _i = {
|
1225
1236
|
".": "./dist/es/embeds.js"
|
1226
1237
|
}, mi = [
|
1227
1238
|
"dist",
|
@@ -1245,11 +1256,11 @@ const oi = "@vouchfor/embeds", ai = "0.0.0-experiment.0b5c8d1", hi = "MIT", li =
|
|
1245
1256
|
test: "true"
|
1246
1257
|
}, gi = {
|
1247
1258
|
"@lit/task": "^1.0.0",
|
1248
|
-
"@vouchfor/media-player": "0.0.0-experiment.
|
1259
|
+
"@vouchfor/media-player": "0.0.0-experiment.113f809",
|
1249
1260
|
uuid: "^9.0.1"
|
1250
|
-
}, vi = {
|
1251
|
-
lit: "^3.1.0"
|
1252
1261
|
}, yi = {
|
1262
|
+
lit: "^3.1.0"
|
1263
|
+
}, vi = {
|
1253
1264
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
1254
1265
|
"@open-wc/testing": "^3.2.0",
|
1255
1266
|
"@storybook/addon-essentials": "^7.4.5",
|
@@ -1296,9 +1307,9 @@ const oi = "@vouchfor/embeds", ai = "0.0.0-experiment.0b5c8d1", hi = "MIT", li =
|
|
1296
1307
|
"**/*.{md,json,yml}": "prettier --write"
|
1297
1308
|
},
|
1298
1309
|
dependencies: gi,
|
1299
|
-
peerDependencies:
|
1300
|
-
devDependencies:
|
1301
|
-
},
|
1310
|
+
peerDependencies: yi,
|
1311
|
+
devDependencies: vi
|
1312
|
+
}, zt = 1;
|
1302
1313
|
class bi {
|
1303
1314
|
constructor(t) {
|
1304
1315
|
this._tabId = void 0, this._clientId = void 0, this._visitorId = void 0, this._hasPlayed = !1, this._hasLoaded = {}, this._answersViewed = {}, this._streamStartTime = {}, this._streamLatestTime = {}, this._currentlyPlayingVideo = null, this._createVisitor = (e) => {
|
@@ -1350,7 +1361,7 @@ class bi {
|
|
1350
1361
|
}, this._streamEnded = () => {
|
1351
1362
|
if (this._currentlyPlayingVideo) {
|
1352
1363
|
const { id: e, key: i } = this._currentlyPlayingVideo;
|
1353
|
-
this._streamLatestTime[i] > this._streamStartTime[i] +
|
1364
|
+
this._streamLatestTime[i] > this._streamStartTime[i] + zt && this._sendTrackingEvent("VIDEO_STREAMED", {
|
1354
1365
|
answerId: e,
|
1355
1366
|
streamStart: this._streamStartTime[i],
|
1356
1367
|
streamEnd: this._streamLatestTime[i]
|
@@ -1372,7 +1383,7 @@ class bi {
|
|
1372
1383
|
!this.host.paused && // Only update the latest time if this event fires for the currently active video
|
1373
1384
|
e === ((o = (n = this.host.scene) == null ? void 0 : n.video) == null ? void 0 : o.id) && (this._currentlyPlayingVideo = { id: e, key: i, node: s }, this._streamLatestTime[i] = s.currentTime);
|
1374
1385
|
}, this._handleVideoPause = ({ detail: { id: e, key: i } }) => {
|
1375
|
-
this._streamLatestTime[i] > this._streamStartTime[i] +
|
1386
|
+
this._streamLatestTime[i] > this._streamStartTime[i] + zt && this._sendTrackingEvent("VIDEO_STREAMED", {
|
1376
1387
|
answerId: e,
|
1377
1388
|
streamStart: this._streamStartTime[i],
|
1378
1389
|
streamEnd: this._streamLatestTime[i]
|
@@ -1422,7 +1433,7 @@ var Ei = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, f = (r, t,
|
|
1422
1433
|
};
|
1423
1434
|
let $ = class extends j {
|
1424
1435
|
constructor() {
|
1425
|
-
super(...arguments), this._mediaPlayerRef =
|
1436
|
+
super(...arguments), this._mediaPlayerRef = Wt(), this.env = "prod", this.apiKey = "", this.disableTracking = !1, this.trackingSource = "embed", this.preload = "auto", this.autoplay = !1, this.aspectRatio = 0, this.eventController = new Ge(this, [
|
1426
1437
|
"durationchange",
|
1427
1438
|
"ended",
|
1428
1439
|
"error",
|
@@ -1539,7 +1550,7 @@ let $ = class extends j {
|
|
1539
1550
|
render() {
|
1540
1551
|
return ze`
|
1541
1552
|
<vmp-new-media-player
|
1542
|
-
${
|
1553
|
+
${qt(this._mediaPlayerRef)}
|
1543
1554
|
${this.eventController.register()}
|
1544
1555
|
?autoplay=${this.autoplay}
|
1545
1556
|
?loading=${this.fetching}
|
@@ -1553,46 +1564,49 @@ let $ = class extends j {
|
|
1553
1564
|
}
|
1554
1565
|
};
|
1555
1566
|
f([
|
1556
|
-
|
1567
|
+
y({ type: Object })
|
1557
1568
|
], $.prototype, "data", 2);
|
1558
1569
|
f([
|
1559
|
-
|
1570
|
+
y({ type: String })
|
1560
1571
|
], $.prototype, "vouchId", 2);
|
1561
1572
|
f([
|
1562
|
-
|
1573
|
+
y({ type: String })
|
1563
1574
|
], $.prototype, "templateId", 2);
|
1564
1575
|
f([
|
1565
|
-
|
1576
|
+
y({ type: Array })
|
1577
|
+
], $.prototype, "questions", 2);
|
1578
|
+
f([
|
1579
|
+
y({ type: String })
|
1566
1580
|
], $.prototype, "env", 2);
|
1567
1581
|
f([
|
1568
|
-
|
1582
|
+
y({ type: String })
|
1569
1583
|
], $.prototype, "apiKey", 2);
|
1570
1584
|
f([
|
1571
|
-
|
1585
|
+
y({ type: Boolean })
|
1572
1586
|
], $.prototype, "disableTracking", 2);
|
1573
1587
|
f([
|
1574
|
-
|
1588
|
+
y({ type: String })
|
1575
1589
|
], $.prototype, "trackingSource", 2);
|
1576
1590
|
f([
|
1577
|
-
|
1591
|
+
y({ type: Array })
|
1578
1592
|
], $.prototype, "controls", 2);
|
1579
1593
|
f([
|
1580
|
-
|
1594
|
+
y({ type: String })
|
1581
1595
|
], $.prototype, "preload", 2);
|
1582
1596
|
f([
|
1583
|
-
|
1597
|
+
y({ type: Boolean })
|
1584
1598
|
], $.prototype, "autoplay", 2);
|
1585
1599
|
f([
|
1586
|
-
|
1600
|
+
y({ type: Number })
|
1587
1601
|
], $.prototype, "aspectRatio", 2);
|
1588
1602
|
f([
|
1589
|
-
|
1603
|
+
Bt()
|
1590
1604
|
], $.prototype, "vouch", 2);
|
1591
1605
|
f([
|
1592
|
-
|
1606
|
+
Bt()
|
1593
1607
|
], $.prototype, "template", 2);
|
1594
1608
|
$ = f([
|
1595
|
-
|
1609
|
+
le("vouch-embed")
|
1596
1610
|
], $);
|
1597
1611
|
export {
|
1598
1612
|
$ as Embed
|