@liforma/client 0.4.10 → 0.4.11
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/CHANGELOG.md +10 -1
- package/dist/next/index.js +754 -618
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts +2 -0
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/react/ExperienceWidget.d.ts +3 -0
- package/dist/next/react/ExperienceWidget.d.ts.map +1 -1
- package/dist/next/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/next/thumbnail/expandAssetUrl.test.d.ts +2 -0
- package/dist/next/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
- package/dist/next/thumbnail/index.d.ts +3 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/locationPlate.d.ts +13 -0
- package/dist/next/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/next/thumbnail/locationPlate.test.d.ts +2 -0
- package/dist/next/thumbnail/locationPlate.test.d.ts.map +1 -0
- package/dist/next/thumbnail/styles.d.ts.map +1 -1
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/next/thumbnail/types.d.ts +7 -1
- package/dist/next/thumbnail/types.d.ts.map +1 -1
- package/dist/next/thumbnail.js +273 -192
- package/dist/next/thumbnail.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +3 -0
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +21 -0
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +20 -0
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/next/v2/types/stage.d.ts +8 -0
- package/dist/next/v2/types/stage.d.ts.map +1 -0
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/index.js +557 -449
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/npm/thumbnail/index.d.ts +3 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +151 -75
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/locationPlate.d.ts +13 -0
- package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/npm/thumbnail/styles.d.ts.map +1 -1
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/npm/thumbnail/types.d.ts +7 -1
- package/dist/npm/thumbnail/types.d.ts.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +3 -0
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +21 -0
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +20 -0
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +1 -0
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +1 -0
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/npm/v2/types/stage.d.ts +8 -0
- package/dist/npm/v2/types/stage.d.ts.map +1 -0
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/component/experienceComponentRuntime.d.ts +3 -0
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +13 -1
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +870 -712
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- package/dist/react/react/ExperienceThumbnail.d.ts +2 -0
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/react/react/ExperienceWidget.d.ts +3 -0
- package/dist/react/react/ExperienceWidget.d.ts.map +1 -1
- package/dist/react/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/react/thumbnail/expandAssetUrl.test.d.ts +2 -0
- package/dist/react/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
- package/dist/react/thumbnail/index.d.ts +3 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/locationPlate.d.ts +13 -0
- package/dist/react/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/react/thumbnail/locationPlate.test.d.ts +2 -0
- package/dist/react/thumbnail/locationPlate.test.d.ts.map +1 -0
- package/dist/react/thumbnail/styles.d.ts.map +1 -1
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/react/thumbnail/types.d.ts +7 -1
- package/dist/react/thumbnail/types.d.ts.map +1 -1
- package/dist/react/thumbnail.js +273 -192
- package/dist/react/thumbnail.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +3 -0
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +21 -0
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +20 -0
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/react/v2/types/stage.d.ts +8 -0
- package/dist/react/v2/types/stage.d.ts.map +1 -0
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +2 -2
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +9 -2
- package/dist/sdk/v2/thumbnail.js.map +1 -1
- package/dist/svelte/Experience.svelte +41 -0
- package/dist/svelte/Experience.svelte.d.ts +3 -0
- package/dist/svelte/ExperienceThumbnail.svelte +24 -2
- package/dist/svelte/ExperienceThumbnail.svelte.d.ts +2 -0
- package/dist/svelte/ExperienceWidget.svelte +9 -0
- package/dist/svelte/ExperienceWidget.svelte.d.ts +3 -0
- package/package.json +1 -1
package/dist/npm/index.js
CHANGED
|
@@ -34,28 +34,87 @@ function r(e) {
|
|
|
34
34
|
return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region src/thumbnail/
|
|
38
|
-
var i = /(
|
|
37
|
+
//#region src/thumbnail/locationPlate.ts
|
|
38
|
+
var i = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
39
|
+
function a(e, t) {
|
|
40
|
+
let n = e.trim();
|
|
41
|
+
return n && n.replace(i, (e, n, r, i, a) => `${n}${t}${i}${a}`);
|
|
42
|
+
}
|
|
43
|
+
var o = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
39
44
|
function s(e) {
|
|
40
|
-
|
|
41
|
-
if (!t) return t;
|
|
42
|
-
let n = t.replace(i, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
|
|
43
|
-
return n = n.replace(a, "_neutral$1"), n = n.replace(o, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
|
|
45
|
+
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
44
46
|
}
|
|
45
47
|
function c(e) {
|
|
48
|
+
return /^https?:\/\//i.test(e) || e.startsWith("//");
|
|
49
|
+
}
|
|
50
|
+
function l(e) {
|
|
51
|
+
return e.startsWith("//") ? `https:${e}` : e;
|
|
52
|
+
}
|
|
53
|
+
function u(e) {
|
|
54
|
+
let t = e.indexOf("?");
|
|
55
|
+
return t === -1 ? {
|
|
56
|
+
pathname: e,
|
|
57
|
+
search: ""
|
|
58
|
+
} : {
|
|
59
|
+
pathname: e.slice(0, t),
|
|
60
|
+
search: e.slice(t)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function d(e, t, n = "") {
|
|
64
|
+
return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
|
|
65
|
+
}
|
|
66
|
+
function f(e, t, n) {
|
|
67
|
+
let r = e.trim();
|
|
68
|
+
if (!r) return r;
|
|
69
|
+
let i = s(n);
|
|
70
|
+
if (c(r)) return a(l(r), t);
|
|
71
|
+
let { pathname: f, search: p } = u(r.replace(/\\/g, "/")), m = f;
|
|
72
|
+
if (!m.startsWith("/")) m = `/locations/${m.replace(/^locations\//i, "")}`;
|
|
73
|
+
else if (!/^\/locations\//i.test(m)) return /^\/avatars\//i.test(m) ? d(i, m, p) : r;
|
|
74
|
+
if (/\.webp$/i.test(m) && !o.test(m.replace(/\.webp$/i, ""))) return d(i, m, p);
|
|
75
|
+
let h = m.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
|
|
76
|
+
return h = h.replace(o, ""), `${i}/locations/${h}-${t}.webp${p}`;
|
|
77
|
+
}
|
|
78
|
+
function p(e, t) {
|
|
79
|
+
let n = e.trim();
|
|
80
|
+
if (!n) return n;
|
|
81
|
+
let r = s(t);
|
|
82
|
+
if (c(n)) return l(n);
|
|
83
|
+
let { pathname: i, search: a } = u(n.replace(/\\/g, "/")), o = i;
|
|
84
|
+
if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
|
|
85
|
+
else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
|
|
86
|
+
else return n;
|
|
87
|
+
if (!/^\/avatars\//i.test(o)) return n;
|
|
88
|
+
let f = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
|
|
89
|
+
return f && !f.includes("/") && !a ? `${r}/avatars/${f}/256/${f}_neutral.webp` : d(r, o, a);
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
93
|
+
var m = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, h = /_CH(\.webp)/i;
|
|
94
|
+
function g(e) {
|
|
95
|
+
return /\/locations\//i.test(e) || /^locations\//i.test(e) ? !0 : /^https?:\/\//i.test(e) || e.startsWith("//") || /^\/?avatars\//i.test(e) || e.startsWith("/") ? !1 : e.includes("/");
|
|
96
|
+
}
|
|
97
|
+
function _(e, t = "256x256", n) {
|
|
98
|
+
let r = e.trim();
|
|
99
|
+
if (!r) return r;
|
|
100
|
+
if (g(r)) return f(r, t, n);
|
|
101
|
+
let i = p(r, n);
|
|
102
|
+
return i = i.replace(m, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(h, "_neutral$1");
|
|
103
|
+
}
|
|
104
|
+
function v(e) {
|
|
46
105
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
47
106
|
if (!t) return null;
|
|
48
|
-
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
|
|
107
|
+
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = s(e.cdnBaseUrl), c = e.normalize !== !1, l = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : _(e, a, o), u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : f(e, a, o);
|
|
49
108
|
return {
|
|
50
|
-
avatarImage:
|
|
51
|
-
...n ? { backgroundImage:
|
|
52
|
-
...r ? { foregroundImage:
|
|
53
|
-
...i ? { fallbackImage:
|
|
109
|
+
avatarImage: l(t),
|
|
110
|
+
...n ? { backgroundImage: u(n) } : {},
|
|
111
|
+
...r ? { foregroundImage: u(r) } : {},
|
|
112
|
+
...i ? { fallbackImage: l(i) } : {}
|
|
54
113
|
};
|
|
55
114
|
}
|
|
56
115
|
//#endregion
|
|
57
116
|
//#region src/shims/localStack.ts
|
|
58
|
-
function
|
|
117
|
+
function y() {
|
|
59
118
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
60
119
|
if (typeof location > "u") return !1;
|
|
61
120
|
try {
|
|
@@ -66,83 +125,83 @@ function l() {
|
|
|
66
125
|
}
|
|
67
126
|
//#endregion
|
|
68
127
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
69
|
-
var
|
|
70
|
-
function
|
|
128
|
+
var b = "https://player.liforma.ai", x = "http://localhost:3002";
|
|
129
|
+
function S(e) {
|
|
71
130
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
72
131
|
}
|
|
73
|
-
function
|
|
132
|
+
function C(e) {
|
|
74
133
|
let t = e?.trim();
|
|
75
|
-
return t ? t.replace(/\/$/, "") :
|
|
134
|
+
return t ? t.replace(/\/$/, "") : y() ? x : b;
|
|
76
135
|
}
|
|
77
|
-
function
|
|
78
|
-
let t = e.experienceId.trim(), n =
|
|
136
|
+
function w(e) {
|
|
137
|
+
let t = e.experienceId.trim(), n = C(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
79
138
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
80
139
|
}
|
|
81
|
-
function
|
|
140
|
+
function T(e) {
|
|
82
141
|
let t = e.href?.trim();
|
|
83
142
|
if (t) return t;
|
|
84
143
|
let n = e.experienceId?.trim();
|
|
85
144
|
if (!n) return;
|
|
86
145
|
let r = e.returnUrl?.trim();
|
|
87
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
146
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), w({
|
|
88
147
|
experienceId: n,
|
|
89
148
|
...r ? { returnUrl: r } : {},
|
|
90
149
|
playerBaseUrl: e.playerBaseUrl
|
|
91
150
|
});
|
|
92
151
|
}
|
|
93
|
-
function
|
|
152
|
+
function E() {
|
|
94
153
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
95
154
|
}
|
|
96
|
-
var
|
|
97
|
-
function
|
|
98
|
-
return
|
|
155
|
+
var D = 0, O = [];
|
|
156
|
+
function ee() {
|
|
157
|
+
return E() ? 4 : Infinity;
|
|
99
158
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
159
|
+
function k() {
|
|
160
|
+
return E() ? 160 : 0;
|
|
102
161
|
}
|
|
103
|
-
function
|
|
104
|
-
let e =
|
|
105
|
-
for (;
|
|
106
|
-
let e =
|
|
162
|
+
function te() {
|
|
163
|
+
let e = ee();
|
|
164
|
+
for (; D < e && O.length > 0;) {
|
|
165
|
+
let e = O.shift();
|
|
107
166
|
if (!e || e.cancelled) continue;
|
|
108
|
-
|
|
109
|
-
let t =
|
|
167
|
+
D += 1, e.start();
|
|
168
|
+
let t = k();
|
|
110
169
|
if (t <= 0) {
|
|
111
|
-
|
|
170
|
+
D = Math.max(0, D - 1);
|
|
112
171
|
continue;
|
|
113
172
|
}
|
|
114
173
|
window.setTimeout(() => {
|
|
115
|
-
|
|
174
|
+
D = Math.max(0, D - 1), te();
|
|
116
175
|
}, t);
|
|
117
176
|
}
|
|
118
177
|
}
|
|
119
|
-
function
|
|
120
|
-
if (!
|
|
178
|
+
function A(e) {
|
|
179
|
+
if (!E()) return e(), () => {};
|
|
121
180
|
let t = {
|
|
122
181
|
start: e,
|
|
123
182
|
cancelled: !1
|
|
124
183
|
};
|
|
125
|
-
return
|
|
184
|
+
return O.push(t), te(), () => {
|
|
126
185
|
t.cancelled = !0;
|
|
127
186
|
};
|
|
128
187
|
}
|
|
129
188
|
//#endregion
|
|
130
189
|
//#region src/thumbnail/lazyLoad.ts
|
|
131
|
-
function
|
|
132
|
-
return
|
|
190
|
+
function j() {
|
|
191
|
+
return E() ? "96px 0px" : "280px 0px";
|
|
133
192
|
}
|
|
134
|
-
function
|
|
193
|
+
function M(e) {
|
|
135
194
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
136
195
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
137
196
|
}
|
|
138
|
-
function
|
|
197
|
+
function N(e, t) {
|
|
139
198
|
if (typeof window > "u") return !1;
|
|
140
199
|
let n = e.getBoundingClientRect();
|
|
141
200
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
142
201
|
}
|
|
143
|
-
function
|
|
144
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
145
|
-
o || (s?.(), s =
|
|
202
|
+
function P(e, t) {
|
|
203
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? j(), i = M(r), a = !1, o = !1, s = null, c = () => {
|
|
204
|
+
o || (s?.(), s = A(() => {
|
|
146
205
|
s = null, o = !0, n(!0);
|
|
147
206
|
}));
|
|
148
207
|
}, l = (e) => {
|
|
@@ -164,11 +223,11 @@ function E(e, t) {
|
|
|
164
223
|
rootMargin: r,
|
|
165
224
|
threshold: 0
|
|
166
225
|
});
|
|
167
|
-
return u.observe(e),
|
|
226
|
+
return u.observe(e), N(e, i) && l(!0), () => {
|
|
168
227
|
s?.(), s = null, u.disconnect();
|
|
169
228
|
};
|
|
170
229
|
}
|
|
171
|
-
function
|
|
230
|
+
function ne(e, t) {
|
|
172
231
|
let n = () => t();
|
|
173
232
|
return e.complete ? queueMicrotask(n) : (e.addEventListener("load", n, { once: !0 }), e.addEventListener("error", n, { once: !0 })), () => {
|
|
174
233
|
e.removeEventListener("load", n), e.removeEventListener("error", n);
|
|
@@ -176,49 +235,49 @@ function D(e, t) {
|
|
|
176
235
|
}
|
|
177
236
|
//#endregion
|
|
178
237
|
//#region src/thumbnail/scrollParallax.ts
|
|
179
|
-
function
|
|
238
|
+
function re() {
|
|
180
239
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
181
240
|
}
|
|
182
|
-
function
|
|
241
|
+
function F(e, t) {
|
|
183
242
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
184
243
|
}
|
|
185
|
-
var
|
|
186
|
-
function
|
|
187
|
-
if (
|
|
244
|
+
var I = /* @__PURE__ */ new Set(), L = !1, R = 0;
|
|
245
|
+
function z() {
|
|
246
|
+
if (R = 0, I.size === 0 || typeof window > "u") return;
|
|
188
247
|
let e = window.innerHeight;
|
|
189
|
-
for (let t of
|
|
248
|
+
for (let t of I) {
|
|
190
249
|
if (t.pointerActive?.()) continue;
|
|
191
250
|
let n = t.element.getBoundingClientRect();
|
|
192
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
251
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(F(n, e));
|
|
193
252
|
}
|
|
194
253
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
254
|
+
function B() {
|
|
255
|
+
R === 0 && (R = requestAnimationFrame(z));
|
|
197
256
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
257
|
+
function ie() {
|
|
258
|
+
L || typeof window > "u" || (L = !0, window.addEventListener("scroll", B, { passive: !0 }), window.addEventListener("resize", B, { passive: !0 }));
|
|
200
259
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
260
|
+
function ae() {
|
|
261
|
+
I.size > 0 || !L || typeof window > "u" || (L = !1, R !== 0 && (cancelAnimationFrame(R), R = 0), window.removeEventListener("scroll", B), window.removeEventListener("resize", B));
|
|
203
262
|
}
|
|
204
|
-
function
|
|
205
|
-
if (!
|
|
263
|
+
function oe(e, t) {
|
|
264
|
+
if (!re()) return () => {};
|
|
206
265
|
let n = {
|
|
207
266
|
element: e,
|
|
208
267
|
onParallax: t.onParallax,
|
|
209
268
|
pointerActive: t.pointerActive
|
|
210
269
|
};
|
|
211
|
-
return
|
|
212
|
-
|
|
270
|
+
return I.add(n), ie(), n.pointerActive?.() || t.onParallax(F(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
271
|
+
I.delete(n), ae();
|
|
213
272
|
};
|
|
214
273
|
}
|
|
215
274
|
//#endregion
|
|
216
275
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
217
|
-
function
|
|
276
|
+
function se(e) {
|
|
218
277
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
219
278
|
let a = r || i;
|
|
220
279
|
e.classList.toggle("liforma-et--parallax", a), e.classList.toggle("liforma-et--scroll-parallax", i), e.style.setProperty("--liforma-et-parallax-x", String(t)), e.style.setProperty("--liforma-et-parallax-y", String(n));
|
|
221
|
-
}, s =
|
|
280
|
+
}, s = oe(e, {
|
|
222
281
|
onParallax: (e) => {
|
|
223
282
|
i = !0, a || (t = e, n = 0, o());
|
|
224
283
|
},
|
|
@@ -231,7 +290,7 @@ function te(e) {
|
|
|
231
290
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
232
291
|
}, u = () => {
|
|
233
292
|
let s = a;
|
|
234
|
-
a = !1, r = !1, i && s ? (t =
|
|
293
|
+
a = !1, r = !1, i && s ? (t = F(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
235
294
|
}, d = (e) => {
|
|
236
295
|
e.pointerType === "mouse" && (r = !0, o());
|
|
237
296
|
}, f = () => {
|
|
@@ -243,45 +302,45 @@ function te(e) {
|
|
|
243
302
|
}
|
|
244
303
|
//#endregion
|
|
245
304
|
//#region src/thumbnail/styles.ts
|
|
246
|
-
var
|
|
247
|
-
function
|
|
248
|
-
if (typeof document > "u" ||
|
|
305
|
+
var ce = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", le = !1;
|
|
306
|
+
function V(e) {
|
|
307
|
+
if (typeof document > "u" || le) return;
|
|
249
308
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
250
|
-
|
|
309
|
+
le = !0;
|
|
251
310
|
return;
|
|
252
311
|
}
|
|
253
312
|
let t = document.createElement("style");
|
|
254
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
313
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), le = !0;
|
|
255
314
|
}
|
|
256
315
|
//#endregion
|
|
257
316
|
//#region src/widget/styles.ts
|
|
258
|
-
var re = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", ie = "liforma-experience-widget-styles";
|
|
259
|
-
function
|
|
317
|
+
var ue = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", de = "liforma-experience-widget-styles";
|
|
318
|
+
function fe(e = ue) {
|
|
260
319
|
if (typeof document > "u") return;
|
|
261
|
-
let t = document.getElementById(
|
|
320
|
+
let t = document.getElementById(de);
|
|
262
321
|
if (t) {
|
|
263
322
|
t.textContent = e;
|
|
264
323
|
return;
|
|
265
324
|
}
|
|
266
325
|
let n = document.createElement("style");
|
|
267
|
-
n.id =
|
|
326
|
+
n.id = de, n.textContent = e, document.head.append(n);
|
|
268
327
|
}
|
|
269
328
|
//#endregion
|
|
270
329
|
//#region src/shims/apiBaseUrl.ts
|
|
271
|
-
var
|
|
272
|
-
function
|
|
330
|
+
var pe = "https://api.liforma.ai", me = "http://localhost:3001";
|
|
331
|
+
function he() {
|
|
273
332
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
274
333
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
275
334
|
if (typeof document > "u") return null;
|
|
276
335
|
let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-api-base-url")?.trim();
|
|
277
336
|
return t ? t.replace(/\/$/, "") : null;
|
|
278
337
|
}
|
|
279
|
-
function
|
|
280
|
-
return
|
|
338
|
+
function H() {
|
|
339
|
+
return he() || (y() ? me : pe);
|
|
281
340
|
}
|
|
282
341
|
//#endregion
|
|
283
342
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
284
|
-
function
|
|
343
|
+
function ge(e) {
|
|
285
344
|
if (!e || typeof e != "object") return null;
|
|
286
345
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
287
346
|
return n ? {
|
|
@@ -290,10 +349,10 @@ function le(e) {
|
|
|
290
349
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
291
350
|
} : null;
|
|
292
351
|
}
|
|
293
|
-
async function
|
|
352
|
+
async function _e(e, t) {
|
|
294
353
|
let n = e.trim();
|
|
295
354
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
296
|
-
let r = (t?.apiBaseUrl ??
|
|
355
|
+
let r = (t?.apiBaseUrl ?? H()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
297
356
|
method: "GET",
|
|
298
357
|
headers: { Accept: "application/json" },
|
|
299
358
|
signal: t?.signal
|
|
@@ -313,7 +372,7 @@ async function ue(e, t) {
|
|
|
313
372
|
throw Error("Experience preview returned invalid JSON.");
|
|
314
373
|
}
|
|
315
374
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
316
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
375
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = ge(o.galleryThumb);
|
|
317
376
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
318
377
|
return {
|
|
319
378
|
experienceId: s || n,
|
|
@@ -323,7 +382,7 @@ async function ue(e, t) {
|
|
|
323
382
|
}
|
|
324
383
|
//#endregion
|
|
325
384
|
//#region src/v2/errors/LiformaError.ts
|
|
326
|
-
var
|
|
385
|
+
var U = class extends Error {
|
|
327
386
|
code;
|
|
328
387
|
requestId;
|
|
329
388
|
status;
|
|
@@ -332,16 +391,16 @@ var B = class extends Error {
|
|
|
332
391
|
super(e, t?.cause === void 0 ? void 0 : { cause: t.cause }), this.name = "LiformaError", this.code = t?.code?.trim() || "UNKNOWN", this.requestId = t?.requestId?.trim() || void 0, this.status = t?.status, this.details = t?.details;
|
|
333
392
|
}
|
|
334
393
|
};
|
|
335
|
-
function
|
|
394
|
+
function ve(e) {
|
|
336
395
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
337
396
|
}
|
|
338
|
-
function
|
|
397
|
+
function ye(e, t, n) {
|
|
339
398
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
340
399
|
try {
|
|
341
400
|
i = JSON.parse(t);
|
|
342
401
|
} catch {}
|
|
343
|
-
let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } =
|
|
344
|
-
return new
|
|
402
|
+
let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = ve(a) ?? ve(i) ?? {};
|
|
403
|
+
return new U(u, {
|
|
345
404
|
code: l,
|
|
346
405
|
requestId: d,
|
|
347
406
|
status: e,
|
|
@@ -350,37 +409,37 @@ function fe(e, t, n) {
|
|
|
350
409
|
}
|
|
351
410
|
//#endregion
|
|
352
411
|
//#region src/v2/api/captureAttribution.ts
|
|
353
|
-
var
|
|
354
|
-
function
|
|
412
|
+
var be = 128, W = /[\u0000-\u001f\u007f]/g;
|
|
413
|
+
function G(e) {
|
|
355
414
|
if (!e) return;
|
|
356
|
-
let t = e.replace(
|
|
357
|
-
if (t) return t.slice(0,
|
|
415
|
+
let t = e.replace(W, "").trim();
|
|
416
|
+
if (t) return t.slice(0, be);
|
|
358
417
|
}
|
|
359
|
-
function
|
|
418
|
+
function xe(e) {
|
|
360
419
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
361
420
|
return {
|
|
362
|
-
...
|
|
363
|
-
...
|
|
364
|
-
...
|
|
365
|
-
...
|
|
366
|
-
...
|
|
421
|
+
...G(t.get("utm_source")) ? { utmSource: G(t.get("utm_source")) } : {},
|
|
422
|
+
...G(t.get("utm_medium")) ? { utmMedium: G(t.get("utm_medium")) } : {},
|
|
423
|
+
...G(t.get("utm_campaign")) ? { utmCampaign: G(t.get("utm_campaign")) } : {},
|
|
424
|
+
...G(t.get("utm_content")) ? { utmContent: G(t.get("utm_content")) } : {},
|
|
425
|
+
...G(t.get("utm_term")) ? { utmTerm: G(t.get("utm_term")) } : {}
|
|
367
426
|
};
|
|
368
427
|
}
|
|
369
|
-
function
|
|
428
|
+
function Se(e) {
|
|
370
429
|
if (e === !1) return;
|
|
371
430
|
if (e && typeof e == "object") {
|
|
372
431
|
let t = {
|
|
373
|
-
...
|
|
374
|
-
...
|
|
375
|
-
...
|
|
376
|
-
...
|
|
377
|
-
...
|
|
378
|
-
...
|
|
432
|
+
...G(e.utmSource) ? { utmSource: G(e.utmSource) } : {},
|
|
433
|
+
...G(e.utmMedium) ? { utmMedium: G(e.utmMedium) } : {},
|
|
434
|
+
...G(e.utmCampaign) ? { utmCampaign: G(e.utmCampaign) } : {},
|
|
435
|
+
...G(e.utmContent) ? { utmContent: G(e.utmContent) } : {},
|
|
436
|
+
...G(e.utmTerm) ? { utmTerm: G(e.utmTerm) } : {},
|
|
437
|
+
...G(e.referrer) ? { referrer: G(e.referrer) } : {}
|
|
379
438
|
};
|
|
380
439
|
return Object.keys(t).length ? t : void 0;
|
|
381
440
|
}
|
|
382
441
|
if (typeof window > "u") return;
|
|
383
|
-
let t =
|
|
442
|
+
let t = xe(window.location?.search), n = G(document.referrer || void 0), r = {
|
|
384
443
|
...t,
|
|
385
444
|
...n ? { referrer: n } : {}
|
|
386
445
|
};
|
|
@@ -388,19 +447,19 @@ function he(e) {
|
|
|
388
447
|
}
|
|
389
448
|
//#endregion
|
|
390
449
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
391
|
-
function
|
|
450
|
+
function Ce(e) {
|
|
392
451
|
let t = e.locale?.trim();
|
|
393
452
|
if (t) return t;
|
|
394
453
|
let n = e.language?.trim();
|
|
395
454
|
if (n) return n;
|
|
396
455
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
397
456
|
}
|
|
398
|
-
function
|
|
457
|
+
function we(e) {
|
|
399
458
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
400
459
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
401
460
|
return t || n || void 0;
|
|
402
461
|
}
|
|
403
|
-
function
|
|
462
|
+
function Te(e, t) {
|
|
404
463
|
let n = e.trim();
|
|
405
464
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
406
465
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -408,7 +467,7 @@ function _e(e, t) {
|
|
|
408
467
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
409
468
|
let i = t.experienceId.trim();
|
|
410
469
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
411
|
-
let a =
|
|
470
|
+
let a = Ce(t), o = we(t), s = t.idempotencyKey?.trim();
|
|
412
471
|
return {
|
|
413
472
|
url: r.toString(),
|
|
414
473
|
init: {
|
|
@@ -427,7 +486,7 @@ function _e(e, t) {
|
|
|
427
486
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
428
487
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
429
488
|
...(() => {
|
|
430
|
-
let e =
|
|
489
|
+
let e = Se(t.attribution);
|
|
431
490
|
return e ? { attribution: e } : {};
|
|
432
491
|
})(),
|
|
433
492
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -437,16 +496,16 @@ function _e(e, t) {
|
|
|
437
496
|
}
|
|
438
497
|
//#endregion
|
|
439
498
|
//#region src/v2/types/sessionLaunch.ts
|
|
440
|
-
function
|
|
499
|
+
function K(e) {
|
|
441
500
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
442
501
|
}
|
|
443
|
-
function
|
|
502
|
+
function q(e) {
|
|
444
503
|
return typeof e == "boolean";
|
|
445
504
|
}
|
|
446
|
-
function
|
|
447
|
-
if (!
|
|
505
|
+
function Ee(e) {
|
|
506
|
+
if (!K(e)) return null;
|
|
448
507
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
449
|
-
return !
|
|
508
|
+
return !K(t) || !K(n) || !K(r) || !K(i) || !q(t.input) || !q(t.output) || !q(t.externalAudio) || !q(n.managed) || !q(r.enabled) || !q(i.enabled) ? null : {
|
|
450
509
|
speech: {
|
|
451
510
|
input: t.input,
|
|
452
511
|
output: t.output,
|
|
@@ -457,8 +516,8 @@ function ve(e) {
|
|
|
457
516
|
tools: { enabled: i.enabled }
|
|
458
517
|
};
|
|
459
518
|
}
|
|
460
|
-
function
|
|
461
|
-
return !
|
|
519
|
+
function De(e) {
|
|
520
|
+
return !K(e) || !q(e.avatar) || !q(e.speechInput) || !q(e.speechOutput) || !q(e.tools) || !q(e.externalAudio) ? null : {
|
|
462
521
|
speech: {
|
|
463
522
|
input: e.speechInput,
|
|
464
523
|
output: e.speechOutput,
|
|
@@ -469,12 +528,12 @@ function K(e) {
|
|
|
469
528
|
tools: { enabled: e.tools }
|
|
470
529
|
};
|
|
471
530
|
}
|
|
472
|
-
function
|
|
473
|
-
return
|
|
531
|
+
function Oe(e) {
|
|
532
|
+
return Ee(e) ?? De(e);
|
|
474
533
|
}
|
|
475
|
-
function
|
|
476
|
-
if (!
|
|
477
|
-
let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c =
|
|
534
|
+
function ke(e) {
|
|
535
|
+
if (!K(e)) throw Error("Session Launch response is missing session.");
|
|
536
|
+
let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = Oe(e.capabilities), l = J(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
|
|
478
537
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
479
538
|
return {
|
|
480
539
|
id: t,
|
|
@@ -490,11 +549,11 @@ function be(e) {
|
|
|
490
549
|
...d ? { createdAt: d } : {}
|
|
491
550
|
};
|
|
492
551
|
}
|
|
493
|
-
function
|
|
552
|
+
function J(e) {
|
|
494
553
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
495
554
|
let t = [];
|
|
496
555
|
for (let n of e) {
|
|
497
|
-
if (!
|
|
556
|
+
if (!K(n)) continue;
|
|
498
557
|
let e = n.axis === "locale" || n.axis === "secondaryLocale" ? n.axis : null, r = typeof n.requested == "string" ? n.requested.trim() : "", i = typeof n.resolved == "string" ? n.resolved.trim() : "";
|
|
499
558
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
500
559
|
axis: e,
|
|
@@ -505,104 +564,104 @@ function xe(e) {
|
|
|
505
564
|
}
|
|
506
565
|
return t.length > 0 ? t : void 0;
|
|
507
566
|
}
|
|
508
|
-
function
|
|
567
|
+
function Ae(e) {
|
|
509
568
|
let t = e.localeVoiceFallbacks;
|
|
510
569
|
if (t?.length) for (let e of t) {
|
|
511
570
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
512
571
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
513
572
|
}
|
|
514
573
|
}
|
|
515
|
-
function
|
|
516
|
-
if (!
|
|
574
|
+
function je(e) {
|
|
575
|
+
if (!K(e)) throw Error("Session Launch response must be a JSON object.");
|
|
517
576
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
518
577
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
519
|
-
let n =
|
|
520
|
-
return
|
|
578
|
+
let n = ke(e.session);
|
|
579
|
+
return Ae(n), {
|
|
521
580
|
session: n,
|
|
522
581
|
launch: t
|
|
523
582
|
};
|
|
524
583
|
}
|
|
525
584
|
//#endregion
|
|
526
585
|
//#region src/v2/api/mintPublicSession.ts
|
|
527
|
-
function
|
|
586
|
+
function Me() {
|
|
528
587
|
try {
|
|
529
588
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
530
589
|
} catch {}
|
|
531
590
|
}
|
|
532
|
-
function
|
|
591
|
+
function Ne(e) {
|
|
533
592
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
534
593
|
}
|
|
535
|
-
function
|
|
536
|
-
let n =
|
|
594
|
+
function Pe(e, t) {
|
|
595
|
+
let n = Me(), r = Ne(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
537
596
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
538
597
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
539
598
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
540
|
-
return new
|
|
599
|
+
return new U(`Your origin ${r} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${r} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`, {
|
|
541
600
|
code: "ORIGIN_NOT_ALLOWED",
|
|
542
601
|
requestId: t.requestId,
|
|
543
602
|
status: t.status,
|
|
544
603
|
details: a
|
|
545
604
|
});
|
|
546
605
|
}
|
|
547
|
-
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new
|
|
606
|
+
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new U(`Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.`, {
|
|
548
607
|
code: "BROWSER_EMBEDS_DISABLED",
|
|
549
608
|
requestId: t.requestId,
|
|
550
609
|
status: t.status,
|
|
551
610
|
details: a
|
|
552
|
-
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new
|
|
611
|
+
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new U(`No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.`, {
|
|
553
612
|
code: "EXPERIENCE_UNAVAILABLE",
|
|
554
613
|
requestId: t.requestId,
|
|
555
614
|
status: t.status,
|
|
556
615
|
details: a
|
|
557
616
|
}) : t;
|
|
558
617
|
}
|
|
559
|
-
function
|
|
618
|
+
function Fe(e) {
|
|
560
619
|
let t = e?.locale?.trim();
|
|
561
620
|
if (t) return t;
|
|
562
621
|
let n = e?.language?.trim();
|
|
563
622
|
if (n) return n;
|
|
564
623
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
565
624
|
}
|
|
566
|
-
function
|
|
625
|
+
function Ie(e) {
|
|
567
626
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
568
|
-
if (t && n && t !== n) throw new
|
|
627
|
+
if (t && n && t !== n) throw new U("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
569
628
|
return t || n || void 0;
|
|
570
629
|
}
|
|
571
|
-
function
|
|
572
|
-
let n = { experienceId: e }, r =
|
|
630
|
+
function Le(e, t) {
|
|
631
|
+
let n = { experienceId: e }, r = Fe(t);
|
|
573
632
|
r && (n.locale = r);
|
|
574
|
-
let i =
|
|
633
|
+
let i = Ie(t);
|
|
575
634
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
576
|
-
let a =
|
|
635
|
+
let a = Se(t?.attribution);
|
|
577
636
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
578
637
|
}
|
|
579
|
-
async function
|
|
580
|
-
let n =
|
|
638
|
+
async function Re(e, t) {
|
|
639
|
+
let n = H(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
581
640
|
method: "POST",
|
|
582
641
|
headers: {
|
|
583
642
|
"Content-Type": "application/json",
|
|
584
643
|
...r ? { "Idempotency-Key": r } : {}
|
|
585
644
|
},
|
|
586
|
-
body: JSON.stringify(
|
|
645
|
+
body: JSON.stringify(Le(e, t))
|
|
587
646
|
});
|
|
588
647
|
if (!i.ok) {
|
|
589
648
|
let t = await i.text();
|
|
590
|
-
throw
|
|
649
|
+
throw Pe(e, ye(i.status, t, i.headers));
|
|
591
650
|
}
|
|
592
651
|
let a;
|
|
593
652
|
try {
|
|
594
653
|
a = await i.json();
|
|
595
654
|
} catch {
|
|
596
|
-
throw new
|
|
655
|
+
throw new U("Browser session mint returned invalid JSON.", {
|
|
597
656
|
code: "INVALID_RESPONSE",
|
|
598
657
|
status: i.status,
|
|
599
658
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
600
659
|
});
|
|
601
660
|
}
|
|
602
|
-
return
|
|
661
|
+
return je(a);
|
|
603
662
|
}
|
|
604
|
-
async function
|
|
605
|
-
let n =
|
|
663
|
+
async function ze(e, t) {
|
|
664
|
+
let n = Te(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
606
665
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
607
666
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
608
667
|
try {
|
|
@@ -615,9 +674,9 @@ async function J(e, t) {
|
|
|
615
674
|
}
|
|
616
675
|
if (!o.ok) {
|
|
617
676
|
let e = await o.text();
|
|
618
|
-
throw
|
|
677
|
+
throw ye(o.status, e, o.headers);
|
|
619
678
|
}
|
|
620
|
-
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new
|
|
679
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new U("Session endpoint must return a JSON Session Launch response.", {
|
|
621
680
|
code: "INVALID_RESPONSE",
|
|
622
681
|
status: o.status,
|
|
623
682
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
@@ -626,20 +685,20 @@ async function J(e, t) {
|
|
|
626
685
|
try {
|
|
627
686
|
s = await o.json();
|
|
628
687
|
} catch {
|
|
629
|
-
throw new
|
|
688
|
+
throw new U("Session endpoint returned invalid JSON.", {
|
|
630
689
|
code: "INVALID_RESPONSE",
|
|
631
690
|
status: o.status,
|
|
632
691
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
633
692
|
});
|
|
634
693
|
}
|
|
635
|
-
return
|
|
694
|
+
return je(s);
|
|
636
695
|
}
|
|
637
696
|
//#endregion
|
|
638
697
|
//#region src/v2/conversationProcessor.ts
|
|
639
|
-
function
|
|
698
|
+
function Be(e) {
|
|
640
699
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
641
700
|
}
|
|
642
|
-
function
|
|
701
|
+
function Ve(e) {
|
|
643
702
|
if (typeof e == "string") {
|
|
644
703
|
let t = e.trim();
|
|
645
704
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -653,24 +712,24 @@ function je(e) {
|
|
|
653
712
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
654
713
|
};
|
|
655
714
|
}
|
|
656
|
-
async function
|
|
715
|
+
async function He(e, t) {
|
|
657
716
|
let n = await e(t);
|
|
658
|
-
return
|
|
717
|
+
return Be(n) ? {
|
|
659
718
|
kind: "stream",
|
|
660
719
|
stream: n
|
|
661
720
|
} : {
|
|
662
721
|
kind: "complete",
|
|
663
|
-
speech:
|
|
722
|
+
speech: Ve(n)
|
|
664
723
|
};
|
|
665
724
|
}
|
|
666
725
|
//#endregion
|
|
667
726
|
//#region src/v2/embed/playerReachability.ts
|
|
668
|
-
var
|
|
669
|
-
function
|
|
727
|
+
var Ue = "3002";
|
|
728
|
+
function We(e) {
|
|
670
729
|
let t = new URL(e);
|
|
671
|
-
return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port ||
|
|
730
|
+
return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || Ue}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
|
|
672
731
|
}
|
|
673
|
-
async function
|
|
732
|
+
async function Ge(e, t) {
|
|
674
733
|
try {
|
|
675
734
|
await fetch(e, {
|
|
676
735
|
method: "GET",
|
|
@@ -678,25 +737,25 @@ async function Fe(e, t) {
|
|
|
678
737
|
signal: AbortSignal.timeout(8e3)
|
|
679
738
|
});
|
|
680
739
|
} catch {
|
|
681
|
-
throw Error(
|
|
740
|
+
throw Error(We(t));
|
|
682
741
|
}
|
|
683
742
|
}
|
|
684
|
-
function
|
|
743
|
+
function Ke(e, t, n, r) {
|
|
685
744
|
try {
|
|
686
745
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
687
746
|
} catch (e) {
|
|
688
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
747
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(We(n), { cause: e }) : e;
|
|
689
748
|
}
|
|
690
749
|
}
|
|
691
|
-
var
|
|
692
|
-
function
|
|
693
|
-
return typeof e == "number" &&
|
|
750
|
+
var qe = new Set([1, 2]);
|
|
751
|
+
function Je(e) {
|
|
752
|
+
return typeof e == "number" && qe.has(e);
|
|
694
753
|
}
|
|
695
|
-
var
|
|
696
|
-
function
|
|
754
|
+
var Ye = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.interactionChange".split("."));
|
|
755
|
+
function Xe(e) {
|
|
697
756
|
if (!e || typeof e != "object") return null;
|
|
698
757
|
let t = e;
|
|
699
|
-
if (!
|
|
758
|
+
if (!Je(t.schemaVersion) || !t.type || !Ye.has(t.type)) return null;
|
|
700
759
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
701
760
|
if (t.type === "fullWindow") {
|
|
702
761
|
let e = t.payload;
|
|
@@ -719,7 +778,7 @@ function Be(e) {
|
|
|
719
778
|
let n = t.payload;
|
|
720
779
|
return !n || typeof n != "object" ? null : t;
|
|
721
780
|
}
|
|
722
|
-
function
|
|
781
|
+
function Ze(e, t, n) {
|
|
723
782
|
let r = e.trim();
|
|
724
783
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
725
784
|
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction;
|
|
@@ -736,20 +795,20 @@ function Ve(e, t, n) {
|
|
|
736
795
|
}
|
|
737
796
|
};
|
|
738
797
|
}
|
|
739
|
-
function
|
|
798
|
+
function Qe() {
|
|
740
799
|
return {
|
|
741
800
|
type: "parentHello",
|
|
742
801
|
schemaVersion: 2
|
|
743
802
|
};
|
|
744
803
|
}
|
|
745
|
-
function
|
|
804
|
+
function $e(e) {
|
|
746
805
|
return {
|
|
747
806
|
type: "widgetSetChrome",
|
|
748
807
|
schemaVersion: 2,
|
|
749
808
|
payload: { mode: e }
|
|
750
809
|
};
|
|
751
810
|
}
|
|
752
|
-
function
|
|
811
|
+
function et() {
|
|
753
812
|
return {
|
|
754
813
|
type: "widgetToggleAudioSettings",
|
|
755
814
|
schemaVersion: 2,
|
|
@@ -758,8 +817,8 @@ function We() {
|
|
|
758
817
|
}
|
|
759
818
|
//#endregion
|
|
760
819
|
//#region src/v2/embed/fullWindowHost.ts
|
|
761
|
-
var
|
|
762
|
-
function
|
|
820
|
+
var tt = "2147483000";
|
|
821
|
+
function nt(e) {
|
|
763
822
|
let { style: t } = e;
|
|
764
823
|
return {
|
|
765
824
|
position: t.position,
|
|
@@ -777,11 +836,11 @@ function Ke(e) {
|
|
|
777
836
|
maxHeight: t.maxHeight
|
|
778
837
|
};
|
|
779
838
|
}
|
|
780
|
-
function
|
|
839
|
+
function rt(e) {
|
|
781
840
|
let { style: t } = e;
|
|
782
|
-
t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex =
|
|
841
|
+
t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = tt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
783
842
|
}
|
|
784
|
-
function
|
|
843
|
+
function it(e, t) {
|
|
785
844
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
786
845
|
e.style.position = "", e.style.top = "", e.style.right = "", e.style.bottom = "", e.style.left = "", e.style.inset = "", e.style.width = "", e.style.height = "", e.style.zIndex = "", e.style.margin = "", e.style.borderRadius = "", e.style.maxWidth = "", e.style.maxHeight = "";
|
|
787
846
|
return;
|
|
@@ -791,20 +850,20 @@ function Je(e, t) {
|
|
|
791
850
|
}
|
|
792
851
|
//#endregion
|
|
793
852
|
//#region src/v2/embed/iframeHost.ts
|
|
794
|
-
function
|
|
853
|
+
function at(e) {
|
|
795
854
|
return e;
|
|
796
855
|
}
|
|
797
856
|
function Y() {
|
|
798
857
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `cmd_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `cmd_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
799
858
|
}
|
|
800
|
-
var
|
|
801
|
-
function
|
|
859
|
+
var ot = 3e4;
|
|
860
|
+
function st(e) {
|
|
802
861
|
let t = e.container;
|
|
803
862
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
804
863
|
let n = document.createElement("iframe");
|
|
805
864
|
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true");
|
|
806
865
|
let r = !1, i = !1, a = null, o = t.closest(".liforma-experience-shell") instanceof HTMLElement ? t.closest(".liforma-experience-shell") : t, s = (t) => {
|
|
807
|
-
i !== t && (i = t, t ? (a =
|
|
866
|
+
i !== t && (i = t, t ? (a = nt(o), rt(o)) : (it(o, a), a = null), e.onFullWindowChange?.(t));
|
|
808
867
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
809
868
|
p = e, m = t;
|
|
810
869
|
}), g = () => {
|
|
@@ -815,10 +874,10 @@ function Ze(e) {
|
|
|
815
874
|
let i = Date.now();
|
|
816
875
|
if (d > 0 && i - d < 250) return;
|
|
817
876
|
d = i, g();
|
|
818
|
-
let a =
|
|
877
|
+
let a = Ze(t.launch, t.session, t.chrome), o = () => {
|
|
819
878
|
if (r) return;
|
|
820
879
|
let t = n.contentWindow;
|
|
821
|
-
t &&
|
|
880
|
+
t && Ke(t, a, e.playerOrigin);
|
|
822
881
|
};
|
|
823
882
|
o();
|
|
824
883
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -826,17 +885,17 @@ function Ze(e) {
|
|
|
826
885
|
r || !l || _(l);
|
|
827
886
|
}, y = () => {
|
|
828
887
|
if (u += 1, u === 1) {
|
|
829
|
-
|
|
888
|
+
Ge(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
830
889
|
return;
|
|
831
890
|
}
|
|
832
891
|
d = 0, v();
|
|
833
892
|
}, b = () => {
|
|
834
|
-
u > 0 || m?.(Error(
|
|
893
|
+
u > 0 || m?.(Error(We(e.playerOrigin)));
|
|
835
894
|
};
|
|
836
895
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
837
896
|
let x = (t) => {
|
|
838
897
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
839
|
-
let i =
|
|
898
|
+
let i = Xe(t.data);
|
|
840
899
|
if (i) switch (i.type) {
|
|
841
900
|
case "close":
|
|
842
901
|
e.onClose?.(i.payload);
|
|
@@ -875,7 +934,7 @@ function Ze(e) {
|
|
|
875
934
|
e.onUserSpeechEnded?.(i.payload);
|
|
876
935
|
break;
|
|
877
936
|
case "modeChange":
|
|
878
|
-
e.onActivityChange?.(
|
|
937
|
+
e.onActivityChange?.(at(i.payload.mode));
|
|
879
938
|
break;
|
|
880
939
|
case "activityChange":
|
|
881
940
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -931,8 +990,8 @@ function Ze(e) {
|
|
|
931
990
|
let S = (t, i) => {
|
|
932
991
|
if (r) return;
|
|
933
992
|
let a = n.contentWindow;
|
|
934
|
-
if (!a) throw Error(
|
|
935
|
-
|
|
993
|
+
if (!a) throw Error(We(e.playerOrigin));
|
|
994
|
+
Ke(a, t, e.playerOrigin, i);
|
|
936
995
|
}, C = (e, t = 12e4, n) => {
|
|
937
996
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Y();
|
|
938
997
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -949,7 +1008,7 @@ function Ze(e) {
|
|
|
949
1008
|
return h;
|
|
950
1009
|
},
|
|
951
1010
|
postParentHello() {
|
|
952
|
-
S(
|
|
1011
|
+
S(Qe());
|
|
953
1012
|
},
|
|
954
1013
|
postLaunch(e, t, n) {
|
|
955
1014
|
r || (l = {
|
|
@@ -971,10 +1030,10 @@ function Ze(e) {
|
|
|
971
1030
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
972
1031
|
},
|
|
973
1032
|
postWidgetSetChrome(e) {
|
|
974
|
-
S(
|
|
1033
|
+
S($e(e));
|
|
975
1034
|
},
|
|
976
1035
|
postWidgetToggleAudioSettings() {
|
|
977
|
-
S(
|
|
1036
|
+
S(et());
|
|
978
1037
|
},
|
|
979
1038
|
speak(e) {
|
|
980
1039
|
return C({
|
|
@@ -1096,7 +1155,7 @@ function Ze(e) {
|
|
|
1096
1155
|
audio: e.audio,
|
|
1097
1156
|
byteLength: e.byteLength
|
|
1098
1157
|
}
|
|
1099
|
-
},
|
|
1158
|
+
}, ot, [e.audio]);
|
|
1100
1159
|
},
|
|
1101
1160
|
speechUtteranceSetTranscript(e) {
|
|
1102
1161
|
return C({
|
|
@@ -1168,6 +1227,36 @@ function Ze(e) {
|
|
|
1168
1227
|
}
|
|
1169
1228
|
});
|
|
1170
1229
|
},
|
|
1230
|
+
setStage(e) {
|
|
1231
|
+
return C({
|
|
1232
|
+
type: "setStage",
|
|
1233
|
+
schemaVersion: 2,
|
|
1234
|
+
payload: {
|
|
1235
|
+
correlationId: Y(),
|
|
1236
|
+
stage: e
|
|
1237
|
+
}
|
|
1238
|
+
});
|
|
1239
|
+
},
|
|
1240
|
+
setPipBackground(e) {
|
|
1241
|
+
return C({
|
|
1242
|
+
type: "setPipBackground",
|
|
1243
|
+
schemaVersion: 2,
|
|
1244
|
+
payload: {
|
|
1245
|
+
correlationId: Y(),
|
|
1246
|
+
pipBackground: e
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
},
|
|
1250
|
+
setPipShadow(e) {
|
|
1251
|
+
return C({
|
|
1252
|
+
type: "setPipShadow",
|
|
1253
|
+
schemaVersion: 2,
|
|
1254
|
+
payload: {
|
|
1255
|
+
correlationId: Y(),
|
|
1256
|
+
pipShadow: e
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
},
|
|
1171
1260
|
setInteraction(e) {
|
|
1172
1261
|
return C({
|
|
1173
1262
|
type: "setInteraction",
|
|
@@ -1228,7 +1317,7 @@ function Ze(e) {
|
|
|
1228
1317
|
}
|
|
1229
1318
|
//#endregion
|
|
1230
1319
|
//#region src/v2/embed/readyGate.ts
|
|
1231
|
-
function
|
|
1320
|
+
function ct(e) {
|
|
1232
1321
|
let t, n = !1, r = !1, i = () => {
|
|
1233
1322
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
1234
1323
|
};
|
|
@@ -1243,9 +1332,9 @@ function Qe(e) {
|
|
|
1243
1332
|
}
|
|
1244
1333
|
//#endregion
|
|
1245
1334
|
//#region src/v2/sdkRelease.ts
|
|
1246
|
-
var
|
|
1335
|
+
var lt = `sdk@${{
|
|
1247
1336
|
name: "@liforma/client",
|
|
1248
|
-
version: "0.4.
|
|
1337
|
+
version: "0.4.11",
|
|
1249
1338
|
type: "module",
|
|
1250
1339
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1251
1340
|
license: "MIT",
|
|
@@ -1464,50 +1553,50 @@ var $e = `sdk@${{
|
|
|
1464
1553
|
vitest: "^4.1.10",
|
|
1465
1554
|
wrangler: "^4.101.0"
|
|
1466
1555
|
}
|
|
1467
|
-
}.version}`,
|
|
1468
|
-
function
|
|
1556
|
+
}.version}`, ut = "https://player.liforma.ai/embed", dt = "http://localhost:3002/embed";
|
|
1557
|
+
function ft() {
|
|
1469
1558
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1470
1559
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1471
1560
|
if (typeof document > "u") return null;
|
|
1472
1561
|
let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-player-embed-url")?.trim();
|
|
1473
1562
|
return t ? t.replace(/\/$/, "") : null;
|
|
1474
1563
|
}
|
|
1475
|
-
function
|
|
1476
|
-
let e =
|
|
1477
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
1564
|
+
function pt() {
|
|
1565
|
+
let e = ft();
|
|
1566
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : y() ? dt : ut;
|
|
1478
1567
|
}
|
|
1479
|
-
function
|
|
1568
|
+
function mt(e, t) {
|
|
1480
1569
|
return e?.trim() || t?.trim() || void 0;
|
|
1481
1570
|
}
|
|
1482
|
-
function
|
|
1483
|
-
let
|
|
1484
|
-
|
|
1485
|
-
let
|
|
1486
|
-
return
|
|
1571
|
+
function ht(e, t, n, r, i, a, o, s, c, l, u) {
|
|
1572
|
+
let d = (e ?? pt()).replace(/\/$/, ""), f = d.endsWith("/embed") ? d : `${d}/embed`, p = new URL(f), m = n?.trim();
|
|
1573
|
+
m && p.searchParams.set("backdropId", m);
|
|
1574
|
+
let h = r?.trim();
|
|
1575
|
+
return h && p.searchParams.set("avatarId", h), (i === "face" || i === "medium") && p.searchParams.set("fit", i), c === "pip" && p.searchParams.set("stage", "pip"), l === "set" && p.searchParams.set("pipBackground", "set"), u === !1 && p.searchParams.set("pipShadow", "0"), a === "widget" && p.searchParams.set("ui", "widget"), o && p.searchParams.set("close", "1"), t && p.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && p.searchParams.set("cast", String(s)), gt(p.toString());
|
|
1487
1576
|
}
|
|
1488
|
-
function
|
|
1577
|
+
function gt(e) {
|
|
1489
1578
|
if (typeof location > "u") return e;
|
|
1490
1579
|
let t = new URL(e);
|
|
1491
1580
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1492
1581
|
}
|
|
1493
|
-
function
|
|
1582
|
+
function _t(e) {
|
|
1494
1583
|
return new URL(e).origin;
|
|
1495
1584
|
}
|
|
1496
1585
|
//#endregion
|
|
1497
1586
|
//#region src/v2/experienceEvents.ts
|
|
1498
|
-
function
|
|
1587
|
+
function vt() {
|
|
1499
1588
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `evt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `evt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
1500
1589
|
}
|
|
1501
|
-
function
|
|
1590
|
+
function yt(e, t, n) {
|
|
1502
1591
|
return {
|
|
1503
|
-
id:
|
|
1592
|
+
id: vt(),
|
|
1504
1593
|
type: e,
|
|
1505
1594
|
sessionId: t,
|
|
1506
1595
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1507
1596
|
data: n
|
|
1508
1597
|
};
|
|
1509
1598
|
}
|
|
1510
|
-
function
|
|
1599
|
+
function bt() {
|
|
1511
1600
|
return {
|
|
1512
1601
|
ready: /* @__PURE__ */ new Set(),
|
|
1513
1602
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1528,32 +1617,32 @@ function ut() {
|
|
|
1528
1617
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1529
1618
|
};
|
|
1530
1619
|
}
|
|
1531
|
-
function
|
|
1620
|
+
function xt(e, t, n) {
|
|
1532
1621
|
return e[t].add(n), () => e[t].delete(n);
|
|
1533
1622
|
}
|
|
1534
|
-
function
|
|
1623
|
+
function St(e, t, n) {
|
|
1535
1624
|
for (let r of e[t]) r(n);
|
|
1536
1625
|
}
|
|
1537
|
-
function
|
|
1626
|
+
function Ct(e) {
|
|
1538
1627
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1539
1628
|
}
|
|
1540
1629
|
//#endregion
|
|
1541
1630
|
//#region src/v2/speech/types.ts
|
|
1542
|
-
function
|
|
1631
|
+
function wt(e) {
|
|
1543
1632
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1544
1633
|
}
|
|
1545
|
-
function
|
|
1634
|
+
function Tt(e) {
|
|
1546
1635
|
return "url" in e && typeof e.url == "string";
|
|
1547
1636
|
}
|
|
1548
|
-
function
|
|
1637
|
+
function Et(e) {
|
|
1549
1638
|
if (!("track" in e)) return !1;
|
|
1550
1639
|
let t = e.track;
|
|
1551
1640
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1552
1641
|
}
|
|
1553
|
-
function
|
|
1554
|
-
return !
|
|
1642
|
+
function Dt(e) {
|
|
1643
|
+
return !wt(e) && !Tt(e) && !Et(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1555
1644
|
}
|
|
1556
|
-
var
|
|
1645
|
+
var Ot = [
|
|
1557
1646
|
8e3,
|
|
1558
1647
|
16e3,
|
|
1559
1648
|
22050,
|
|
@@ -1571,14 +1660,14 @@ var vt = [
|
|
|
1571
1660
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1572
1661
|
MAX_PENDING_WRITES: 8,
|
|
1573
1662
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1574
|
-
},
|
|
1663
|
+
}, kt = class extends Error {
|
|
1575
1664
|
operation;
|
|
1576
1665
|
requiredCapability;
|
|
1577
1666
|
name = "UnsupportedSpeechOperationError";
|
|
1578
1667
|
constructor(e, t) {
|
|
1579
1668
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1580
1669
|
}
|
|
1581
|
-
},
|
|
1670
|
+
}, At = class extends Error {
|
|
1582
1671
|
name = "SpeechUtteranceClosedError";
|
|
1583
1672
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1584
1673
|
super(e);
|
|
@@ -1588,72 +1677,72 @@ var vt = [
|
|
|
1588
1677
|
constructor(e, t) {
|
|
1589
1678
|
super(e, t);
|
|
1590
1679
|
}
|
|
1591
|
-
},
|
|
1680
|
+
}, jt = class extends Error {
|
|
1592
1681
|
name = "SpeechBufferTimeoutError";
|
|
1593
1682
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1594
1683
|
super(e);
|
|
1595
1684
|
}
|
|
1596
1685
|
};
|
|
1597
|
-
function
|
|
1686
|
+
function Mt(e = "none") {
|
|
1598
1687
|
return {
|
|
1599
1688
|
mode: e,
|
|
1600
1689
|
trackedDurationMs: 0,
|
|
1601
1690
|
fallbackDurationMs: 0
|
|
1602
1691
|
};
|
|
1603
1692
|
}
|
|
1604
|
-
function
|
|
1605
|
-
return
|
|
1693
|
+
function Nt(e) {
|
|
1694
|
+
return Ot.includes(e);
|
|
1606
1695
|
}
|
|
1607
|
-
function
|
|
1696
|
+
function Pt(e) {
|
|
1608
1697
|
if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
|
|
1609
1698
|
if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
|
|
1610
|
-
if (!
|
|
1699
|
+
if (!Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1611
1700
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (
|
|
1614
|
-
|
|
1701
|
+
function Ft(e) {
|
|
1702
|
+
if (wt(e)) {
|
|
1703
|
+
Pt(e.format);
|
|
1615
1704
|
return;
|
|
1616
1705
|
}
|
|
1617
|
-
if (
|
|
1706
|
+
if (Tt(e)) {
|
|
1618
1707
|
if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
|
|
1619
|
-
if (e.sampleRate !== void 0 && !
|
|
1708
|
+
if (e.sampleRate !== void 0 && !Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1620
1709
|
return;
|
|
1621
1710
|
}
|
|
1622
|
-
if (
|
|
1711
|
+
if (Et(e)) {
|
|
1623
1712
|
if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
1624
|
-
if (e.sampleRate !== void 0 && !
|
|
1713
|
+
if (e.sampleRate !== void 0 && !Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1625
1714
|
return;
|
|
1626
1715
|
}
|
|
1627
|
-
if (
|
|
1716
|
+
if (Dt(e)) {
|
|
1628
1717
|
let t = e.encoding.trim().toLowerCase();
|
|
1629
1718
|
if (!t) throw new Z("Encoded audio MIME type is required.");
|
|
1630
1719
|
if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
1631
|
-
if (e.sampleRate !== void 0 && !
|
|
1720
|
+
if (e.sampleRate !== void 0 && !Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1632
1721
|
return;
|
|
1633
1722
|
}
|
|
1634
1723
|
throw new Z("Unsupported speech.play audio shape.");
|
|
1635
1724
|
}
|
|
1636
|
-
function
|
|
1637
|
-
if (e.format) return
|
|
1725
|
+
function It(e) {
|
|
1726
|
+
if (e.format) return Pt(e.format), e.format;
|
|
1638
1727
|
if (e.track) {
|
|
1639
1728
|
let t = {
|
|
1640
1729
|
encoding: "pcm_s16le",
|
|
1641
1730
|
sampleRate: e.sampleRate ?? 24e3,
|
|
1642
1731
|
channels: 1
|
|
1643
1732
|
};
|
|
1644
|
-
return
|
|
1733
|
+
return Pt(t), t;
|
|
1645
1734
|
}
|
|
1646
1735
|
throw new Z("createUtterance requires format or track.");
|
|
1647
1736
|
}
|
|
1648
|
-
function
|
|
1737
|
+
function Lt(e) {
|
|
1649
1738
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1650
1739
|
}
|
|
1651
|
-
function
|
|
1740
|
+
function Rt(e) {
|
|
1652
1741
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
1653
1742
|
}
|
|
1654
1743
|
//#endregion
|
|
1655
1744
|
//#region src/byo/pcm.ts
|
|
1656
|
-
function
|
|
1745
|
+
function zt(e) {
|
|
1657
1746
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
1658
1747
|
for (let t = 0; t < e.length; t++) {
|
|
1659
1748
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -1663,11 +1752,11 @@ function kt(e) {
|
|
|
1663
1752
|
}
|
|
1664
1753
|
//#endregion
|
|
1665
1754
|
//#region src/byo/resample.ts
|
|
1666
|
-
function
|
|
1755
|
+
function Bt(e, t, n, r, i) {
|
|
1667
1756
|
let a = -.5 * e + 1.5 * t - 1.5 * n + .5 * r, o = e - 2.5 * t + 2 * n - .5 * r, s = -.5 * e + .5 * n, c = t;
|
|
1668
1757
|
return ((a * i + o) * i + s) * i + c;
|
|
1669
1758
|
}
|
|
1670
|
-
function
|
|
1759
|
+
function Vt(e, t) {
|
|
1671
1760
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
1672
1761
|
if (e === t) return {
|
|
1673
1762
|
fromRate: e,
|
|
@@ -1690,7 +1779,7 @@ function jt(e, t) {
|
|
|
1690
1779
|
let a = [];
|
|
1691
1780
|
for (; i + 2 < r.length - 1;) {
|
|
1692
1781
|
let e = Math.floor(i), t = i - e, o = Math.max(0, e - 1), s = Math.min(r.length - 1, e + 1), c = Math.min(r.length - 1, e + 2);
|
|
1693
|
-
a.push(
|
|
1782
|
+
a.push(Bt(r[o], r[e], r[s], r[c], t)), i += n;
|
|
1694
1783
|
}
|
|
1695
1784
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
1696
1785
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -1702,7 +1791,7 @@ function jt(e, t) {
|
|
|
1702
1791
|
}
|
|
1703
1792
|
//#endregion
|
|
1704
1793
|
//#region src/byo/audioCapture.ts
|
|
1705
|
-
var
|
|
1794
|
+
var Ht = "liforma-pcm-capture", Ut = `
|
|
1706
1795
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
1707
1796
|
process(inputs) {
|
|
1708
1797
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -1714,29 +1803,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
1714
1803
|
return true;
|
|
1715
1804
|
}
|
|
1716
1805
|
}
|
|
1717
|
-
registerProcessor('${
|
|
1718
|
-
`,
|
|
1719
|
-
function
|
|
1720
|
-
return
|
|
1806
|
+
registerProcessor('${Ht}', LiformaPcmCaptureProcessor);
|
|
1807
|
+
`, Wt = null;
|
|
1808
|
+
function Gt() {
|
|
1809
|
+
return Wt ||= URL.createObjectURL(new Blob([Ut], { type: "application/javascript" })), Wt;
|
|
1721
1810
|
}
|
|
1722
|
-
function
|
|
1811
|
+
function Kt() {
|
|
1723
1812
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
1724
1813
|
}
|
|
1725
|
-
async function
|
|
1726
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
1814
|
+
async function qt(e) {
|
|
1815
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Kt();
|
|
1727
1816
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
1728
1817
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
1729
1818
|
l.gain.value = 0;
|
|
1730
|
-
let u = s.sampleRate, d =
|
|
1819
|
+
let u = s.sampleRate, d = Vt(u, n), f = !1, p = !1, m = (e) => {
|
|
1731
1820
|
if (f || i && !i()) return;
|
|
1732
1821
|
let t = d.push(e);
|
|
1733
|
-
t.length !== 0 && r(
|
|
1822
|
+
t.length !== 0 && r(zt(t));
|
|
1734
1823
|
}, h = () => void 0;
|
|
1735
1824
|
return await (async () => {
|
|
1736
1825
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
1737
1826
|
try {
|
|
1738
|
-
await s.audioWorklet.addModule(
|
|
1739
|
-
let e = new AudioWorkletNode(s,
|
|
1827
|
+
await s.audioWorklet.addModule(Gt());
|
|
1828
|
+
let e = new AudioWorkletNode(s, Ht, {
|
|
1740
1829
|
numberOfInputs: 1,
|
|
1741
1830
|
numberOfOutputs: 1,
|
|
1742
1831
|
outputChannelCount: [1]
|
|
@@ -1786,7 +1875,7 @@ async function Lt(e) {
|
|
|
1786
1875
|
}
|
|
1787
1876
|
//#endregion
|
|
1788
1877
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
1789
|
-
async function
|
|
1878
|
+
async function Jt(e) {
|
|
1790
1879
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
1791
1880
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
|
|
1792
1881
|
if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -1795,13 +1884,13 @@ async function Rt(e) {
|
|
|
1795
1884
|
s || (s = !0, c?.stop(), c = null);
|
|
1796
1885
|
};
|
|
1797
1886
|
try {
|
|
1798
|
-
c = await
|
|
1887
|
+
c = await qt({
|
|
1799
1888
|
mediaStream: a,
|
|
1800
1889
|
targetSampleRate: r,
|
|
1801
1890
|
shouldSend: () => !s && !i?.aborted,
|
|
1802
1891
|
onPcm: (e) => {
|
|
1803
1892
|
if (s || i?.aborted) return;
|
|
1804
|
-
let t =
|
|
1893
|
+
let t = Lt(e);
|
|
1805
1894
|
o = o.then(async () => {
|
|
1806
1895
|
if (s || i?.aborted) return;
|
|
1807
1896
|
let e = 0;
|
|
@@ -1830,10 +1919,10 @@ async function Rt(e) {
|
|
|
1830
1919
|
}
|
|
1831
1920
|
//#endregion
|
|
1832
1921
|
//#region src/v2/speech/speechController.ts
|
|
1833
|
-
async function
|
|
1834
|
-
if (
|
|
1835
|
-
if (
|
|
1836
|
-
let t =
|
|
1922
|
+
async function Yt(e, t) {
|
|
1923
|
+
if (Et(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
|
|
1924
|
+
if (wt(e)) {
|
|
1925
|
+
let t = Lt(e.data);
|
|
1837
1926
|
if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
|
|
1838
1927
|
return {
|
|
1839
1928
|
kind: "pcm",
|
|
@@ -1841,17 +1930,17 @@ async function zt(e, t) {
|
|
|
1841
1930
|
format: e.format
|
|
1842
1931
|
};
|
|
1843
1932
|
}
|
|
1844
|
-
if (
|
|
1933
|
+
if (Tt(e)) return {
|
|
1845
1934
|
kind: "url",
|
|
1846
1935
|
url: e.url.trim(),
|
|
1847
1936
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1848
1937
|
};
|
|
1849
|
-
if (!
|
|
1938
|
+
if (!Dt(e)) throw new Z("Unsupported speech.play audio shape.");
|
|
1850
1939
|
let n;
|
|
1851
1940
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
1852
1941
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1853
1942
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
1854
|
-
} else n =
|
|
1943
|
+
} else n = Lt(e.data);
|
|
1855
1944
|
return {
|
|
1856
1945
|
kind: "encoded",
|
|
1857
1946
|
data: n.slice().buffer,
|
|
@@ -1859,10 +1948,10 @@ async function zt(e, t) {
|
|
|
1859
1948
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1860
1949
|
};
|
|
1861
1950
|
}
|
|
1862
|
-
function
|
|
1951
|
+
function Xt() {
|
|
1863
1952
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `utt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `utt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
1864
1953
|
}
|
|
1865
|
-
function
|
|
1954
|
+
function Zt(e, t = "completed") {
|
|
1866
1955
|
return {
|
|
1867
1956
|
utteranceId: e.speechId,
|
|
1868
1957
|
characterId: e.characterId,
|
|
@@ -1876,13 +1965,13 @@ function Vt(e, t = "completed") {
|
|
|
1876
1965
|
}
|
|
1877
1966
|
};
|
|
1878
1967
|
}
|
|
1879
|
-
function
|
|
1968
|
+
function Qt(e) {
|
|
1880
1969
|
return e instanceof Error ? e : new Z(String(e));
|
|
1881
1970
|
}
|
|
1882
|
-
function
|
|
1971
|
+
function $t(e) {
|
|
1883
1972
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
1884
1973
|
}
|
|
1885
|
-
var
|
|
1974
|
+
var en = class {
|
|
1886
1975
|
id;
|
|
1887
1976
|
characterId;
|
|
1888
1977
|
result;
|
|
@@ -1911,14 +2000,14 @@ var Wt = class {
|
|
|
1911
2000
|
queue: e.queue,
|
|
1912
2001
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
1913
2002
|
}).catch((e) => {
|
|
1914
|
-
throw this.fail(
|
|
2003
|
+
throw this.fail(Qt(e)), Qt(e);
|
|
1915
2004
|
}), this.signal?.addEventListener("abort", () => {
|
|
1916
2005
|
this.cancel();
|
|
1917
2006
|
}, { once: !0 });
|
|
1918
2007
|
}
|
|
1919
2008
|
async write(e, t) {
|
|
1920
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1921
|
-
let n =
|
|
2009
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new At();
|
|
2010
|
+
let n = Lt(e);
|
|
1922
2011
|
if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
|
|
1923
2012
|
if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
|
|
1924
2013
|
if (n.byteLength === 0) return;
|
|
@@ -1927,13 +2016,13 @@ var Wt = class {
|
|
|
1927
2016
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
1928
2017
|
if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
1929
2018
|
let a = async () => {
|
|
1930
|
-
if (this.closed || this.settled) throw new
|
|
2019
|
+
if (this.closed || this.settled) throw new At();
|
|
1931
2020
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
1932
2021
|
utteranceId: this.id,
|
|
1933
2022
|
audio: t.buffer,
|
|
1934
2023
|
byteLength: t.byteLength
|
|
1935
2024
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
1936
|
-
setTimeout(() => t(new
|
|
2025
|
+
setTimeout(() => t(new jt()), r);
|
|
1937
2026
|
})]);
|
|
1938
2027
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
1939
2028
|
}, o = this.writeChain.then(a, a);
|
|
@@ -1945,7 +2034,7 @@ var Wt = class {
|
|
|
1945
2034
|
}
|
|
1946
2035
|
}
|
|
1947
2036
|
async setTranscript(e) {
|
|
1948
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2037
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new At();
|
|
1949
2038
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
1950
2039
|
utteranceId: this.id,
|
|
1951
2040
|
transcript: e
|
|
@@ -1962,7 +2051,7 @@ var Wt = class {
|
|
|
1962
2051
|
});
|
|
1963
2052
|
return this.resolve(t), t;
|
|
1964
2053
|
} catch (e) {
|
|
1965
|
-
let t =
|
|
2054
|
+
let t = Qt(e);
|
|
1966
2055
|
throw this.fail(t), t;
|
|
1967
2056
|
}
|
|
1968
2057
|
}
|
|
@@ -1980,11 +2069,11 @@ var Wt = class {
|
|
|
1980
2069
|
characterId: this.characterId,
|
|
1981
2070
|
status: "cancelled",
|
|
1982
2071
|
durationMs: 0,
|
|
1983
|
-
animation:
|
|
2072
|
+
animation: Mt("none")
|
|
1984
2073
|
};
|
|
1985
2074
|
return this.resolve(t), t;
|
|
1986
2075
|
} catch (e) {
|
|
1987
|
-
let t =
|
|
2076
|
+
let t = Qt(e);
|
|
1988
2077
|
throw this.fail(t), t;
|
|
1989
2078
|
}
|
|
1990
2079
|
}
|
|
@@ -1997,7 +2086,7 @@ var Wt = class {
|
|
|
1997
2086
|
return e;
|
|
1998
2087
|
}
|
|
1999
2088
|
resolve(e) {
|
|
2000
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2089
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new At()));
|
|
2001
2090
|
}
|
|
2002
2091
|
fail(e) {
|
|
2003
2092
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
@@ -2009,7 +2098,7 @@ var Wt = class {
|
|
|
2009
2098
|
}
|
|
2010
2099
|
await new Promise((t, n) => {
|
|
2011
2100
|
let r = setTimeout(() => {
|
|
2012
|
-
n(new
|
|
2101
|
+
n(new jt());
|
|
2013
2102
|
}, e);
|
|
2014
2103
|
this.pendingWriteWaiters.push({
|
|
2015
2104
|
resolve: () => {
|
|
@@ -2028,13 +2117,13 @@ var Wt = class {
|
|
|
2028
2117
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2029
2118
|
}
|
|
2030
2119
|
};
|
|
2031
|
-
function
|
|
2120
|
+
function tn(e) {
|
|
2032
2121
|
let t = null, n = (t, n) => {
|
|
2033
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2122
|
+
if (!e.getCapabilities()[n]) throw new kt(t, n);
|
|
2034
2123
|
}, r = {
|
|
2035
2124
|
async speak(r) {
|
|
2036
2125
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2037
|
-
let i =
|
|
2126
|
+
let i = Rt(r.queue ?? "append");
|
|
2038
2127
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2039
2128
|
let a = e.getIframeHost();
|
|
2040
2129
|
if (!a) throw new Z("Speech session is not attached.");
|
|
@@ -2054,41 +2143,41 @@ function Gt(e) {
|
|
|
2054
2143
|
return;
|
|
2055
2144
|
}
|
|
2056
2145
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2057
|
-
t.removeEventListener("abort", s), n(
|
|
2146
|
+
t.removeEventListener("abort", s), n(Zt(e, "completed"));
|
|
2058
2147
|
}, (a) => {
|
|
2059
|
-
if (t.removeEventListener("abort", s),
|
|
2148
|
+
if (t.removeEventListener("abort", s), $t(a)) {
|
|
2060
2149
|
n({
|
|
2061
2150
|
utteranceId: "utt_interrupted",
|
|
2062
2151
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2063
2152
|
status: "interrupted",
|
|
2064
2153
|
durationMs: 0,
|
|
2065
2154
|
transcript: r.text,
|
|
2066
|
-
animation:
|
|
2155
|
+
animation: Mt("none")
|
|
2067
2156
|
});
|
|
2068
2157
|
return;
|
|
2069
2158
|
}
|
|
2070
|
-
i(
|
|
2159
|
+
i(Qt(a));
|
|
2071
2160
|
});
|
|
2072
2161
|
});
|
|
2073
2162
|
}
|
|
2074
2163
|
try {
|
|
2075
|
-
return
|
|
2164
|
+
return Zt(await o, "completed");
|
|
2076
2165
|
} catch (t) {
|
|
2077
|
-
if (
|
|
2166
|
+
if ($t(t)) return {
|
|
2078
2167
|
utteranceId: "utt_interrupted",
|
|
2079
2168
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2080
2169
|
status: "interrupted",
|
|
2081
2170
|
durationMs: 0,
|
|
2082
2171
|
transcript: r.text,
|
|
2083
|
-
animation:
|
|
2172
|
+
animation: Mt("none")
|
|
2084
2173
|
};
|
|
2085
|
-
throw
|
|
2174
|
+
throw Qt(t);
|
|
2086
2175
|
}
|
|
2087
2176
|
},
|
|
2088
2177
|
async play(i) {
|
|
2089
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2178
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Ft(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2090
2179
|
let a = i.queue ?? "append";
|
|
2091
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2180
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Et(i.audio)) {
|
|
2092
2181
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2093
2182
|
return r.createUtterance({
|
|
2094
2183
|
format: {
|
|
@@ -2104,7 +2193,7 @@ function Gt(e) {
|
|
|
2104
2193
|
}
|
|
2105
2194
|
let o = e.getIframeHost();
|
|
2106
2195
|
if (!o) throw new Z("Speech session is not attached.");
|
|
2107
|
-
let s = await
|
|
2196
|
+
let s = await Yt(i.audio, i.signal);
|
|
2108
2197
|
return o.speechPlay({
|
|
2109
2198
|
source: s,
|
|
2110
2199
|
characterId: i.characterId,
|
|
@@ -2116,13 +2205,13 @@ function Gt(e) {
|
|
|
2116
2205
|
},
|
|
2117
2206
|
createUtterance(r) {
|
|
2118
2207
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2119
|
-
let i =
|
|
2208
|
+
let i = It(r);
|
|
2120
2209
|
if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
|
|
2121
2210
|
let a = r.queue ?? "replace-active";
|
|
2122
2211
|
if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
|
|
2123
2212
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2124
|
-
let o = new
|
|
2125
|
-
id:
|
|
2213
|
+
let o = new en({
|
|
2214
|
+
id: Xt(),
|
|
2126
2215
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2127
2216
|
format: i,
|
|
2128
2217
|
queue: a,
|
|
@@ -2134,7 +2223,7 @@ function Gt(e) {
|
|
|
2134
2223
|
t === o && (t = null);
|
|
2135
2224
|
}), r.track && (async () => {
|
|
2136
2225
|
try {
|
|
2137
|
-
if (await
|
|
2226
|
+
if (await Jt({
|
|
2138
2227
|
track: r.track,
|
|
2139
2228
|
utterance: o,
|
|
2140
2229
|
sampleRate: i.sampleRate,
|
|
@@ -2162,16 +2251,16 @@ function Gt(e) {
|
|
|
2162
2251
|
}
|
|
2163
2252
|
//#endregion
|
|
2164
2253
|
//#region src/v2/types/sessionInteraction.ts
|
|
2165
|
-
function
|
|
2254
|
+
function nn(e) {
|
|
2166
2255
|
let t = e?.trim();
|
|
2167
2256
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
2168
2257
|
}
|
|
2169
2258
|
//#endregion
|
|
2170
2259
|
//#region src/v2/experience.ts
|
|
2171
|
-
function
|
|
2260
|
+
function rn(e) {
|
|
2172
2261
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
2173
2262
|
}
|
|
2174
|
-
var
|
|
2263
|
+
var an = class e {
|
|
2175
2264
|
bootstrap;
|
|
2176
2265
|
conversationProcessor;
|
|
2177
2266
|
iframeHost = null;
|
|
@@ -2185,19 +2274,22 @@ var Jt = class e {
|
|
|
2185
2274
|
closed = !1;
|
|
2186
2275
|
attached = !1;
|
|
2187
2276
|
pendingFit = null;
|
|
2277
|
+
pendingStage = null;
|
|
2278
|
+
pendingPipBackground = null;
|
|
2279
|
+
pendingPipShadow = null;
|
|
2188
2280
|
lastInteraction = null;
|
|
2189
2281
|
closeHandlers = [];
|
|
2190
|
-
eventRegistry =
|
|
2282
|
+
eventRegistry = bt();
|
|
2191
2283
|
readyEnvelope = null;
|
|
2192
2284
|
startedEnvelope = null;
|
|
2193
2285
|
sessionMintedEnvelope = null;
|
|
2194
2286
|
conversationCache = [];
|
|
2195
2287
|
speech;
|
|
2196
2288
|
constructor(e) {
|
|
2197
|
-
this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech =
|
|
2289
|
+
this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = tn({
|
|
2198
2290
|
getIframeHost: () => this.iframeHost,
|
|
2199
2291
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
2200
|
-
getCapabilities: () =>
|
|
2292
|
+
getCapabilities: () => on(this.resolvedSession),
|
|
2201
2293
|
getActiveCharacterId: () => "character_unknown",
|
|
2202
2294
|
onProcessorInterrupt: () => {
|
|
2203
2295
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -2280,7 +2372,7 @@ var Jt = class e {
|
|
|
2280
2372
|
return null;
|
|
2281
2373
|
}
|
|
2282
2374
|
on(e, t) {
|
|
2283
|
-
let n =
|
|
2375
|
+
let n = xt(this.eventRegistry, e, t);
|
|
2284
2376
|
return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
|
|
2285
2377
|
}
|
|
2286
2378
|
async attach(e) {
|
|
@@ -2294,13 +2386,13 @@ var Jt = class e {
|
|
|
2294
2386
|
if (this.closed) throw Error("Session has ended.");
|
|
2295
2387
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2296
2388
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2297
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2389
|
+
let t = this.bootstrap.embedBaseUrl ?? pt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = ht(t, n, r ? void 0 : mt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, rn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow), a = _t(i), o = null, s = new Promise((e) => {
|
|
2298
2390
|
o = e;
|
|
2299
2391
|
}), c = null, l = new Promise((e) => {
|
|
2300
2392
|
c = e;
|
|
2301
|
-
}), u =
|
|
2393
|
+
}), u = ct((e) => {
|
|
2302
2394
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
2303
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
2395
|
+
}), d = this.bootstrap.onUserTranscript, f = st({
|
|
2304
2396
|
container: e.container,
|
|
2305
2397
|
src: i,
|
|
2306
2398
|
playerOrigin: a,
|
|
@@ -2366,7 +2458,7 @@ var Jt = class e {
|
|
|
2366
2458
|
onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
|
|
2367
2459
|
});
|
|
2368
2460
|
this.iframeHost = f;
|
|
2369
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
2461
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ze(this.bootstrap.sessionEndpoint, {
|
|
2370
2462
|
experienceId: this.bootstrap.experienceId,
|
|
2371
2463
|
locale: this.bootstrap.locale,
|
|
2372
2464
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -2378,7 +2470,7 @@ var Jt = class e {
|
|
|
2378
2470
|
attribution: this.bootstrap.attribution,
|
|
2379
2471
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2380
2472
|
signal: this.endpointAbortController.signal
|
|
2381
|
-
})) : this.bootstrap.kind === "public" ?
|
|
2473
|
+
})) : this.bootstrap.kind === "public" ? Re(this.bootstrap.experienceId, {
|
|
2382
2474
|
locale: this.bootstrap.locale,
|
|
2383
2475
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
2384
2476
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -2402,7 +2494,7 @@ var Jt = class e {
|
|
|
2402
2494
|
operation: "attach",
|
|
2403
2495
|
message: e instanceof Error ? e.message : String(e),
|
|
2404
2496
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2405
|
-
release:
|
|
2497
|
+
release: lt
|
|
2406
2498
|
});
|
|
2407
2499
|
} catch {}
|
|
2408
2500
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -2414,7 +2506,7 @@ var Jt = class e {
|
|
|
2414
2506
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2415
2507
|
this.launchToken = g;
|
|
2416
2508
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2417
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
2509
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Ae(_), f.postLaunch(g, _, {
|
|
2418
2510
|
startButton: e.startButton,
|
|
2419
2511
|
theme: e.theme,
|
|
2420
2512
|
showFeedback: e.showFeedback,
|
|
@@ -2434,7 +2526,7 @@ var Jt = class e {
|
|
|
2434
2526
|
operation: "attach",
|
|
2435
2527
|
message: e instanceof Error ? e.message : String(e),
|
|
2436
2528
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2437
|
-
release:
|
|
2529
|
+
release: lt
|
|
2438
2530
|
});
|
|
2439
2531
|
} catch {}
|
|
2440
2532
|
throw e;
|
|
@@ -2448,11 +2540,11 @@ var Jt = class e {
|
|
|
2448
2540
|
operation: "attach",
|
|
2449
2541
|
message: e instanceof Error ? e.message : String(e),
|
|
2450
2542
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2451
|
-
release:
|
|
2543
|
+
release: lt
|
|
2452
2544
|
});
|
|
2453
2545
|
} catch {}
|
|
2454
2546
|
throw e;
|
|
2455
|
-
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
|
|
2547
|
+
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.pendingStage && await f.setStage(this.pendingStage), this.pendingPipBackground && await f.setPipBackground(this.pendingPipBackground), this.pendingPipShadow !== null && await f.setPipShadow(this.pendingPipShadow), this.createPlayerFacade();
|
|
2456
2548
|
}
|
|
2457
2549
|
async startListening() {
|
|
2458
2550
|
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
@@ -2476,11 +2568,25 @@ var Jt = class e {
|
|
|
2476
2568
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2477
2569
|
}
|
|
2478
2570
|
async setFit(e) {
|
|
2479
|
-
let t =
|
|
2571
|
+
let t = nn(e);
|
|
2480
2572
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2481
2573
|
if (this.closed) throw Error("Session has ended.");
|
|
2482
2574
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
2483
2575
|
}
|
|
2576
|
+
async setStage(e) {
|
|
2577
|
+
if (e !== "fill" && e !== "pip") throw Error("setStage requires \"fill\" or \"pip\".");
|
|
2578
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2579
|
+
this.pendingStage = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setStage(e);
|
|
2580
|
+
}
|
|
2581
|
+
async setPipBackground(e) {
|
|
2582
|
+
if (e !== "none" && e !== "set") throw Error("setPipBackground requires \"none\" or \"set\".");
|
|
2583
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2584
|
+
this.pendingPipBackground = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipBackground(e);
|
|
2585
|
+
}
|
|
2586
|
+
async setPipShadow(e) {
|
|
2587
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2588
|
+
this.pendingPipShadow = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipShadow(e);
|
|
2589
|
+
}
|
|
2484
2590
|
async setInteraction(e) {
|
|
2485
2591
|
if (this.closed) throw Error("Session has ended.");
|
|
2486
2592
|
if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
|
|
@@ -2512,7 +2618,7 @@ var Jt = class e {
|
|
|
2512
2618
|
this.close();
|
|
2513
2619
|
}
|
|
2514
2620
|
destroy() {
|
|
2515
|
-
this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null,
|
|
2621
|
+
this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, Ct(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
2516
2622
|
}
|
|
2517
2623
|
resolveMintInteraction() {
|
|
2518
2624
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2524,8 +2630,8 @@ var Jt = class e {
|
|
|
2524
2630
|
return this.resolvedSession?.id ?? "";
|
|
2525
2631
|
}
|
|
2526
2632
|
emitWrapped(e, t) {
|
|
2527
|
-
let n =
|
|
2528
|
-
return
|
|
2633
|
+
let n = yt(e, this.getSessionId(), t);
|
|
2634
|
+
return St(this.eventRegistry, e, n), n;
|
|
2529
2635
|
}
|
|
2530
2636
|
queueProcessorTurn(e) {
|
|
2531
2637
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2534,7 +2640,7 @@ var Jt = class e {
|
|
|
2534
2640
|
let n = this.processorAbortController.signal;
|
|
2535
2641
|
this.processorChain = this.processorChain.then(async () => {
|
|
2536
2642
|
if (!n.aborted) try {
|
|
2537
|
-
let r = await
|
|
2643
|
+
let r = await He(t, {
|
|
2538
2644
|
utteranceId: e.utteranceId,
|
|
2539
2645
|
text: e.text,
|
|
2540
2646
|
conversation: this.conversationCache,
|
|
@@ -2584,7 +2690,7 @@ var Jt = class e {
|
|
|
2584
2690
|
};
|
|
2585
2691
|
}
|
|
2586
2692
|
};
|
|
2587
|
-
function
|
|
2693
|
+
function on(e) {
|
|
2588
2694
|
return e ? {
|
|
2589
2695
|
textSpeech: e.capabilities.speech.output,
|
|
2590
2696
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -2595,26 +2701,26 @@ function Yt(e) {
|
|
|
2595
2701
|
}
|
|
2596
2702
|
//#endregion
|
|
2597
2703
|
//#region src/widget/dockGeometry.ts
|
|
2598
|
-
var
|
|
2599
|
-
function
|
|
2704
|
+
var sn = "(min-width: 768px)", cn = 24, ln = .5, un = 1200, dn = .85, fn = 9 / 16;
|
|
2705
|
+
function pn() {
|
|
2600
2706
|
if (typeof window > "u") return 800;
|
|
2601
2707
|
let e = window.screen?.availHeight;
|
|
2602
2708
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
2603
2709
|
}
|
|
2604
|
-
function
|
|
2605
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
2606
|
-
return s > a && (s = a, o = s /
|
|
2710
|
+
function mn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = cn, r = typeof window < "u" ? pn() : 800) {
|
|
2711
|
+
let i = Math.max(160, Math.min(t - n * 2, t * dn)), a = Math.max(120, e - n * 2), o = Math.min(r * ln, un, i), s = o * fn;
|
|
2712
|
+
return s > a && (s = a, o = s / fn, o > i && (o = i, s = o * fn)), {
|
|
2607
2713
|
width: Math.round(s),
|
|
2608
2714
|
height: Math.round(o)
|
|
2609
2715
|
};
|
|
2610
2716
|
}
|
|
2611
|
-
function
|
|
2717
|
+
function hn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = cn) {
|
|
2612
2718
|
return {
|
|
2613
2719
|
left: Math.max(r, t - e.width - r),
|
|
2614
2720
|
top: Math.max(r, n - e.height - r)
|
|
2615
2721
|
};
|
|
2616
2722
|
}
|
|
2617
|
-
function
|
|
2723
|
+
function gn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = cn) {
|
|
2618
2724
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
2619
2725
|
return {
|
|
2620
2726
|
left: Math.min(Math.max(a, e), o),
|
|
@@ -2622,14 +2728,14 @@ function on(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
|
|
|
2622
2728
|
};
|
|
2623
2729
|
}
|
|
2624
2730
|
function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
2625
|
-
return e(
|
|
2731
|
+
return e(sn).matches;
|
|
2626
2732
|
}
|
|
2627
2733
|
//#endregion
|
|
2628
2734
|
//#region src/widget/mountExperienceWidget.ts
|
|
2629
|
-
function
|
|
2735
|
+
function _n(e) {
|
|
2630
2736
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
2631
2737
|
}
|
|
2632
|
-
function
|
|
2738
|
+
function vn(e) {
|
|
2633
2739
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
2634
2740
|
let t = typeof e == "string" ? e.trim() : "";
|
|
2635
2741
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -2637,10 +2743,10 @@ function cn(e) {
|
|
|
2637
2743
|
function $(e) {
|
|
2638
2744
|
return e === "expanded" || e === "docked";
|
|
2639
2745
|
}
|
|
2640
|
-
var
|
|
2641
|
-
function
|
|
2642
|
-
|
|
2643
|
-
let r =
|
|
2746
|
+
var yn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", bn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", xn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Sn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
|
|
2747
|
+
function Cn(e, t, n) {
|
|
2748
|
+
V(ce);
|
|
2749
|
+
let r = v({
|
|
2644
2750
|
galleryThumb: t.galleryThumb,
|
|
2645
2751
|
avatarImage: t.avatarImage,
|
|
2646
2752
|
backgroundImage: t.backgroundImage,
|
|
@@ -2666,9 +2772,9 @@ function pn(e, t, n) {
|
|
|
2666
2772
|
let e = document.createElement("img");
|
|
2667
2773
|
e.className = "liforma-et__foreground liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.foregroundImage, e.addEventListener("load", () => o(e), { once: !0 }), i.append(e);
|
|
2668
2774
|
}
|
|
2669
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
2775
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : se(i);
|
|
2670
2776
|
}
|
|
2671
|
-
function
|
|
2777
|
+
function wn(e) {
|
|
2672
2778
|
return e.startButton ? {
|
|
2673
2779
|
...e.startButton,
|
|
2674
2780
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -2680,7 +2786,7 @@ function mn(e) {
|
|
|
2680
2786
|
variant: "primary"
|
|
2681
2787
|
};
|
|
2682
2788
|
}
|
|
2683
|
-
function
|
|
2789
|
+
function Tn(e) {
|
|
2684
2790
|
let t = !1, n = () => {
|
|
2685
2791
|
t || e();
|
|
2686
2792
|
}, r = () => {
|
|
@@ -2700,12 +2806,12 @@ function hn(e) {
|
|
|
2700
2806
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
2701
2807
|
};
|
|
2702
2808
|
}
|
|
2703
|
-
function
|
|
2704
|
-
|
|
2809
|
+
function En(e, t) {
|
|
2810
|
+
fe(ue);
|
|
2705
2811
|
let n = t.experienceId?.trim();
|
|
2706
2812
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
2707
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
2708
|
-
a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset",
|
|
2813
|
+
let r = t.prefetch ?? "onExpand", i = _n(t.position), a = document.createElement("div");
|
|
2814
|
+
a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", vn(t.offset));
|
|
2709
2815
|
let o = document.createElement("button");
|
|
2710
2816
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
2711
2817
|
let s = document.createElement("div");
|
|
@@ -2725,169 +2831,171 @@ function gn(e, t) {
|
|
|
2725
2831
|
let m = document.createElement("span");
|
|
2726
2832
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
2727
2833
|
let h = document.createElement("button");
|
|
2728
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
2834
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = xn, h.setAttribute("aria-label", "Reduce");
|
|
2729
2835
|
let g = document.createElement("button");
|
|
2730
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
2836
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = yn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
2731
2837
|
let _ = document.createElement("button");
|
|
2732
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
2838
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = bn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
2733
2839
|
let v = document.createElement("div");
|
|
2734
2840
|
v.className = "liforma-ew__stage";
|
|
2735
2841
|
let y = document.createElement("div");
|
|
2736
2842
|
y.className = "liforma-ew__status", y.hidden = !0, f.append(v, y), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
|
|
2737
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0,
|
|
2843
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, ee = "", k = null, te = null, A = null, j = null, M = null, N = null, P = null, ne = 0, re = 0, F = null, I = !1, L = new AbortController(), R = t.parallax !== !1, z = () => {
|
|
2738
2844
|
let e = a.dataset.state;
|
|
2739
2845
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
2740
|
-
},
|
|
2741
|
-
|
|
2742
|
-
},
|
|
2743
|
-
|
|
2744
|
-
},
|
|
2846
|
+
}, B = () => {
|
|
2847
|
+
A !== null && (clearTimeout(A), A = null);
|
|
2848
|
+
}, ie = () => {
|
|
2849
|
+
j !== null && (clearTimeout(j), j = null), a.classList.remove("liforma-ew--layout-settling");
|
|
2850
|
+
}, ae = () => {
|
|
2745
2851
|
for (let e of [
|
|
2746
2852
|
f,
|
|
2747
2853
|
l,
|
|
2748
2854
|
p
|
|
2749
2855
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
2750
2856
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
2751
|
-
},
|
|
2857
|
+
}, oe = (e, t, n, r) => {
|
|
2752
2858
|
let i = (i) => {
|
|
2753
2859
|
i.style.left = `${e}px`, i.style.top = `${t}px`, i.style.width = `${n}px`, i.style.height = `${r}px`, i.style.right = "auto", i.style.bottom = "auto";
|
|
2754
2860
|
};
|
|
2755
2861
|
i(f), i(l);
|
|
2756
2862
|
let a = p.offsetWidth || 120;
|
|
2757
2863
|
p.style.left = `${e + n - a - 10}px`, p.style.top = `${t + 10}px`, p.style.right = "auto", p.style.bottom = "auto", p.style.width = "auto", p.style.height = "auto";
|
|
2758
|
-
},
|
|
2864
|
+
}, se = (e, t) => {
|
|
2759
2865
|
if (z() !== "docked") return;
|
|
2760
|
-
let n =
|
|
2761
|
-
|
|
2762
|
-
},
|
|
2866
|
+
let n = mn(), r = gn(e - ne, t - re, n);
|
|
2867
|
+
M = r.left, N = r.top, oe(r.left, r.top, n.width, n.height);
|
|
2868
|
+
}, ce = (e, t) => {
|
|
2763
2869
|
if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
2764
|
-
let n =
|
|
2765
|
-
|
|
2766
|
-
},
|
|
2767
|
-
|
|
2870
|
+
let n = mn(), r = M ?? f.getBoundingClientRect().left, i = N ?? f.getBoundingClientRect().top, a = gn(r + e, i + t, n);
|
|
2871
|
+
M = a.left, N = a.top, oe(a.left, a.top, n.width, n.height);
|
|
2872
|
+
}, le = (e) => {
|
|
2873
|
+
F === "toolbar" && (P === null || e.pointerId !== P || (e.preventDefault(), se(e.clientX, e.clientY)));
|
|
2768
2874
|
}, V = (e) => {
|
|
2769
|
-
if (
|
|
2770
|
-
let t =
|
|
2771
|
-
|
|
2772
|
-
},
|
|
2773
|
-
if (S || z() !== "docked" || !Q() ||
|
|
2774
|
-
|
|
2875
|
+
if (P === null || e && e.pointerId !== P) return;
|
|
2876
|
+
let t = F;
|
|
2877
|
+
P = null, F = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && I && (I = !1, window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
2878
|
+
}, de = (e, t, n) => {
|
|
2879
|
+
if (S || z() !== "docked" || !Q() || P !== null) return;
|
|
2880
|
+
P = n, F = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2775
2881
|
let r = f.getBoundingClientRect();
|
|
2776
|
-
|
|
2777
|
-
},
|
|
2778
|
-
if (S || z() !== "docked" || !Q() ||
|
|
2779
|
-
|
|
2882
|
+
ne = e - r.left, re = t - r.top, I || (I = !0, window.addEventListener("pointermove", le), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
2883
|
+
}, pe = (e) => {
|
|
2884
|
+
if (S || z() !== "docked" || !Q() || P !== null) return;
|
|
2885
|
+
P = e.pointerId, F = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2780
2886
|
let t = f.getBoundingClientRect();
|
|
2781
|
-
|
|
2887
|
+
M = t.left, N = t.top;
|
|
2782
2888
|
}, me = (e) => {
|
|
2783
|
-
|
|
2889
|
+
F === "player" && (P === null || e.pointerId !== P || ce(e.dx, e.dy));
|
|
2784
2890
|
}, he = (e) => {
|
|
2785
|
-
|
|
2786
|
-
},
|
|
2891
|
+
F === "player" && (P === null || e.pointerId !== P || V());
|
|
2892
|
+
}, H = () => {
|
|
2787
2893
|
let e = Q(), t = z();
|
|
2788
2894
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
2789
2895
|
h.hidden = !0;
|
|
2790
2896
|
return;
|
|
2791
2897
|
}
|
|
2792
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
2898
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = Sn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = xn, h.setAttribute("aria-label", "Reduce"));
|
|
2793
2899
|
}, ge = (e) => {
|
|
2794
|
-
let t =
|
|
2795
|
-
n =
|
|
2796
|
-
},
|
|
2900
|
+
let t = mn(), n = e && M !== null && N !== null ? gn(M, N, t) : hn(t);
|
|
2901
|
+
n = gn(n.left, n.top, t), M = n.left, N = n.top, oe(n.left, n.top, t.width, t.height), H();
|
|
2902
|
+
}, U = () => {
|
|
2797
2903
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
2798
2904
|
requestAnimationFrame(() => {
|
|
2799
2905
|
S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
2800
2906
|
});
|
|
2801
2907
|
});
|
|
2802
|
-
},
|
|
2803
|
-
if (
|
|
2908
|
+
}, ve = (e) => {
|
|
2909
|
+
if (ie(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
2804
2910
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2805
2911
|
return;
|
|
2806
2912
|
}
|
|
2807
|
-
|
|
2808
|
-
if (
|
|
2913
|
+
j = setTimeout(() => {
|
|
2914
|
+
if (j = null, S || !$(a.dataset.state)) {
|
|
2809
2915
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2810
2916
|
return;
|
|
2811
2917
|
}
|
|
2812
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
2918
|
+
a.classList.remove("liforma-ew--layout-settling"), U();
|
|
2813
2919
|
}, 220);
|
|
2814
|
-
},
|
|
2815
|
-
|
|
2816
|
-
|
|
2920
|
+
}, ye = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
2921
|
+
B(), A = setTimeout(() => {
|
|
2922
|
+
A = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
2817
2923
|
}, 280);
|
|
2818
|
-
})),
|
|
2924
|
+
})), be = {
|
|
2819
2925
|
galleryThumb: t.galleryThumb,
|
|
2820
2926
|
avatarImage: t.avatarImage,
|
|
2821
2927
|
backgroundImage: t.backgroundImage,
|
|
2822
2928
|
foregroundImage: t.foregroundImage,
|
|
2823
2929
|
fallbackImage: t.fallbackImage
|
|
2824
|
-
},
|
|
2930
|
+
}, W = (e) => {
|
|
2825
2931
|
if (!e) {
|
|
2826
2932
|
y.hidden = !0, y.textContent = "";
|
|
2827
2933
|
return;
|
|
2828
2934
|
}
|
|
2829
2935
|
y.hidden = !1, y.textContent = e;
|
|
2830
|
-
},
|
|
2936
|
+
}, G = (e) => {
|
|
2831
2937
|
if (!e) {
|
|
2832
2938
|
c.hidden = !0, c.textContent = "";
|
|
2833
2939
|
return;
|
|
2834
2940
|
}
|
|
2835
2941
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
2836
|
-
}, be = () => {
|
|
2837
|
-
C = !0, o.disabled = !1, ye(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
2838
2942
|
}, xe = () => {
|
|
2943
|
+
C = !0, o.disabled = !1, G(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
2944
|
+
}, Se = () => {
|
|
2839
2945
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
2840
|
-
},
|
|
2841
|
-
|
|
2842
|
-
let t =
|
|
2843
|
-
return t ? (
|
|
2844
|
-
},
|
|
2845
|
-
if (
|
|
2846
|
-
|
|
2946
|
+
}, Ce = (e) => {
|
|
2947
|
+
k?.(), k = null;
|
|
2948
|
+
let t = Cn(s, e, { parallax: R });
|
|
2949
|
+
return t ? (k = t, !0) : !1;
|
|
2950
|
+
}, we = () => {
|
|
2951
|
+
if (Ce(be)) {
|
|
2952
|
+
xe();
|
|
2847
2953
|
return;
|
|
2848
2954
|
}
|
|
2849
|
-
|
|
2955
|
+
G("Loading…"), _e(n, { signal: L.signal }).then((e) => {
|
|
2850
2956
|
if (!S) {
|
|
2851
|
-
if (!
|
|
2852
|
-
|
|
2957
|
+
if (!Ce({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
2958
|
+
xe();
|
|
2853
2959
|
}
|
|
2854
2960
|
}).catch((e) => {
|
|
2855
|
-
if (S ||
|
|
2961
|
+
if (S || L.signal.aborted) return;
|
|
2856
2962
|
let n = e instanceof Error ? e : Error(String(e));
|
|
2857
|
-
|
|
2963
|
+
G("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
2858
2964
|
});
|
|
2859
|
-
},
|
|
2965
|
+
}, Te = () => ({
|
|
2860
2966
|
experienceId: n,
|
|
2861
2967
|
ui: "widget",
|
|
2862
2968
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
2863
2969
|
...t.locale ? { locale: t.locale } : {},
|
|
2970
|
+
...t.secondaryLocale ? { secondaryLocale: t.secondaryLocale } : {},
|
|
2971
|
+
...t.learningLocale ? { learningLocale: t.learningLocale } : {},
|
|
2864
2972
|
...t.language ? { language: t.language } : {},
|
|
2865
2973
|
...t.mode ? { mode: t.mode } : {},
|
|
2866
2974
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
2867
2975
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
2868
2976
|
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
2869
2977
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
2870
|
-
}),
|
|
2978
|
+
}), K = () => ({
|
|
2871
2979
|
...t.fit ? { fit: t.fit } : {},
|
|
2872
|
-
startButton:
|
|
2980
|
+
startButton: wn(t),
|
|
2873
2981
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
2874
2982
|
...t.interaction ? { interaction: t.interaction } : {}
|
|
2875
2983
|
}), q = (e = !0) => {
|
|
2876
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
2984
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", W(null), typeof document < "u" && (ee = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
|
|
2877
2985
|
}, Ee = () => {
|
|
2878
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
2986
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", W(null), typeof document < "u" && (document.body.style.overflow = ee), ge(!0), H(), b?.setWidgetChrome("docked");
|
|
2879
2987
|
}, De = (e) => {
|
|
2880
2988
|
e.on("started", () => {
|
|
2881
|
-
S || (D = !0, a.dataset.live = "true",
|
|
2989
|
+
S || (D = !0, a.dataset.live = "true", W(null), t.onStarted?.(), $(a.dataset.state) && U());
|
|
2882
2990
|
}), e.on("feedback", (e) => {
|
|
2883
2991
|
S || t.onFeedback?.(e);
|
|
2884
2992
|
}), e.on("feedbackFailed", (e) => {
|
|
2885
2993
|
S || t.onFeedbackFailed?.(e);
|
|
2886
2994
|
});
|
|
2887
2995
|
}, Oe = () => {
|
|
2888
|
-
|
|
2996
|
+
ie(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), W(null), typeof document < "u" && (document.body.style.overflow = ee), H();
|
|
2889
2997
|
}, ke = () => {
|
|
2890
|
-
|
|
2998
|
+
B(), ie(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
2891
2999
|
let e = b;
|
|
2892
3000
|
b = null, e?.destroy(), v.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
|
|
2893
3001
|
}, J = () => {
|
|
@@ -2895,33 +3003,33 @@ function gn(e, t) {
|
|
|
2895
3003
|
if (V(), x = !1, b && E) {
|
|
2896
3004
|
let e = b;
|
|
2897
3005
|
(async () => {
|
|
2898
|
-
D && (await
|
|
3006
|
+
D && (await ye(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Oe(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && Se(), t.onCollapsed?.(), t.onClose?.());
|
|
2899
3007
|
})();
|
|
2900
3008
|
return;
|
|
2901
3009
|
}
|
|
2902
3010
|
ke(), Oe(), t.onCollapsed?.(), t.onClose?.();
|
|
2903
3011
|
}
|
|
2904
3012
|
}, Ae = () => {
|
|
2905
|
-
S || Q() && z() === "expanded" &&
|
|
3013
|
+
S || Q() && z() === "expanded" && ve(() => {
|
|
2906
3014
|
Ee();
|
|
2907
3015
|
});
|
|
2908
3016
|
}, je = () => {
|
|
2909
|
-
S || z() === "docked" && (V(),
|
|
2910
|
-
|
|
3017
|
+
S || z() === "docked" && (V(), ve(() => {
|
|
3018
|
+
ae(), q(!1), b?.setWidgetChrome("expanded");
|
|
2911
3019
|
}));
|
|
2912
3020
|
}, Me = () => {
|
|
2913
|
-
!b || !D || (
|
|
3021
|
+
!b || !D || (B(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, U());
|
|
2914
3022
|
}, Ne = () => {
|
|
2915
|
-
!b || !E || D || (
|
|
3023
|
+
!b || !E || D || (B(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
2916
3024
|
}, Pe = (e) => {
|
|
2917
|
-
S || e !== O && !D || (
|
|
3025
|
+
S || e !== O && !D || (B(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, D && U());
|
|
2918
3026
|
}, Fe = () => {
|
|
2919
3027
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
2920
3028
|
T = !0;
|
|
2921
3029
|
let e = O;
|
|
2922
3030
|
l.hidden = !1, (async () => {
|
|
2923
3031
|
try {
|
|
2924
|
-
let t = await
|
|
3032
|
+
let t = await an.startSession(Te());
|
|
2925
3033
|
if (S || e !== O) {
|
|
2926
3034
|
t.destroy();
|
|
2927
3035
|
return;
|
|
@@ -2929,9 +3037,9 @@ function gn(e, t) {
|
|
|
2929
3037
|
b = t, De(t);
|
|
2930
3038
|
let n = await t.attach({
|
|
2931
3039
|
container: l,
|
|
2932
|
-
...
|
|
3040
|
+
...K(),
|
|
2933
3041
|
onWidgetReady: () => {
|
|
2934
|
-
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") :
|
|
3042
|
+
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : Se());
|
|
2935
3043
|
},
|
|
2936
3044
|
onWidgetExpand: () => {
|
|
2937
3045
|
Pe(e);
|
|
@@ -2940,7 +3048,7 @@ function gn(e, t) {
|
|
|
2940
3048
|
S || ze(e);
|
|
2941
3049
|
},
|
|
2942
3050
|
onWidgetDragStart: (e) => {
|
|
2943
|
-
S ||
|
|
3051
|
+
S || pe(e);
|
|
2944
3052
|
},
|
|
2945
3053
|
onWidgetDragMove: (e) => {
|
|
2946
3054
|
S || me(e);
|
|
@@ -2949,7 +3057,7 @@ function gn(e, t) {
|
|
|
2949
3057
|
S || he(e);
|
|
2950
3058
|
},
|
|
2951
3059
|
onPlayerStatusChange: (e) => {
|
|
2952
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3060
|
+
S || e === "error" && $(a.dataset.state) && W("Could not load the experience.");
|
|
2953
3061
|
}
|
|
2954
3062
|
});
|
|
2955
3063
|
if (S || e !== O) {
|
|
@@ -2980,7 +3088,7 @@ function gn(e, t) {
|
|
|
2980
3088
|
x = !0, w = !1, T = !1, E = !1, D = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
|
|
2981
3089
|
try {
|
|
2982
3090
|
q();
|
|
2983
|
-
let t = await
|
|
3091
|
+
let t = await an.startSession(Te());
|
|
2984
3092
|
if (S || e !== O) {
|
|
2985
3093
|
t.destroy();
|
|
2986
3094
|
return;
|
|
@@ -2988,12 +3096,12 @@ function gn(e, t) {
|
|
|
2988
3096
|
b = t, De(t);
|
|
2989
3097
|
let n = await t.attach({
|
|
2990
3098
|
container: v,
|
|
2991
|
-
...
|
|
3099
|
+
...K(),
|
|
2992
3100
|
onWidgetAudioSettings: (e) => {
|
|
2993
3101
|
S || ze(e);
|
|
2994
3102
|
},
|
|
2995
3103
|
onWidgetDragStart: (e) => {
|
|
2996
|
-
S ||
|
|
3104
|
+
S || pe(e);
|
|
2997
3105
|
},
|
|
2998
3106
|
onWidgetDragMove: (e) => {
|
|
2999
3107
|
S || me(e);
|
|
@@ -3002,7 +3110,7 @@ function gn(e, t) {
|
|
|
3002
3110
|
S || he(e);
|
|
3003
3111
|
},
|
|
3004
3112
|
onPlayerStatusChange: (e) => {
|
|
3005
|
-
S || (e === "error" ?
|
|
3113
|
+
S || (e === "error" ? W("Could not load the experience.") : $(a.dataset.state) && W(null));
|
|
3006
3114
|
}
|
|
3007
3115
|
});
|
|
3008
3116
|
if (S || e !== O) {
|
|
@@ -3015,7 +3123,7 @@ function gn(e, t) {
|
|
|
3015
3123
|
} catch (n) {
|
|
3016
3124
|
if (S || e !== O) return;
|
|
3017
3125
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3018
|
-
|
|
3126
|
+
W(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3019
3127
|
} finally {
|
|
3020
3128
|
e === O && (x = !1);
|
|
3021
3129
|
}
|
|
@@ -3047,7 +3155,7 @@ function gn(e, t) {
|
|
|
3047
3155
|
}, Be = (e) => {
|
|
3048
3156
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3049
3157
|
}, Ve = (e) => {
|
|
3050
|
-
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(),
|
|
3158
|
+
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), de(e.clientX, e.clientY, e.pointerId)));
|
|
3051
3159
|
}, He = (e) => {
|
|
3052
3160
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), J());
|
|
3053
3161
|
}, Ue = () => {
|
|
@@ -3057,27 +3165,27 @@ function gn(e, t) {
|
|
|
3057
3165
|
je();
|
|
3058
3166
|
return;
|
|
3059
3167
|
}
|
|
3060
|
-
D ?
|
|
3168
|
+
D ? ve(() => {
|
|
3061
3169
|
ge(!0);
|
|
3062
3170
|
}) : ge(!0);
|
|
3063
3171
|
return;
|
|
3064
3172
|
}
|
|
3065
|
-
|
|
3173
|
+
H();
|
|
3066
3174
|
}
|
|
3067
|
-
}, We = typeof window < "u" ? window.matchMedia(
|
|
3175
|
+
}, We = typeof window < "u" ? window.matchMedia(sn) : null, Ge = () => {
|
|
3068
3176
|
if (!S) {
|
|
3069
3177
|
if (z() === "docked" && !Q()) {
|
|
3070
3178
|
je();
|
|
3071
3179
|
return;
|
|
3072
3180
|
}
|
|
3073
|
-
|
|
3181
|
+
H();
|
|
3074
3182
|
}
|
|
3075
3183
|
};
|
|
3076
3184
|
return o.addEventListener("click", Le), d.addEventListener("click", J), _.addEventListener("click", (e) => {
|
|
3077
3185
|
e.stopPropagation(), J();
|
|
3078
|
-
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge),
|
|
3186
|
+
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), we(), H(), r === "eager" ? queueMicrotask(() => {
|
|
3079
3187
|
S || Fe();
|
|
3080
|
-
}) : r === "idle" && (
|
|
3188
|
+
}) : r === "idle" && (te = Tn(() => {
|
|
3081
3189
|
S || Fe();
|
|
3082
3190
|
})), {
|
|
3083
3191
|
root: a,
|
|
@@ -3093,11 +3201,11 @@ function gn(e, t) {
|
|
|
3093
3201
|
Fe();
|
|
3094
3202
|
},
|
|
3095
3203
|
destroy() {
|
|
3096
|
-
S || (S = !0, V(),
|
|
3204
|
+
S || (S = !0, V(), te?.(), te = null, L.abort(), k?.(), k = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), ke(), Oe(), e.replaceChildren());
|
|
3097
3205
|
}
|
|
3098
3206
|
};
|
|
3099
3207
|
}
|
|
3100
3208
|
//#endregion
|
|
3101
|
-
export {
|
|
3209
|
+
export { ce as EXPERIENCE_THUMBNAIL_CSS, ue as EXPERIENCE_WIDGET_CSS, an as Experience, U as LiformaError, X as SPEECH_LIMITS, jt as SpeechBufferTimeoutError, Z as SpeechRuntimeError, At as SpeechUtteranceClosedError, kt as UnsupportedSpeechOperationError, ne as attachImageReady, P as attachLazyThumb, oe as attachScrollLinkedParallax, w as buildHostedLaunchUrl, V as ensureExperienceThumbnailStyles, fe as ensureExperienceWidgetStyles, _e as fetchExperiencePreview, j as getDefaultLazyRootMargin, F as horizontalParallaxFromViewportY, ye as liformaErrorFromResponse, En as mountExperienceWidget, n as navigateOnExperienceClose, T as resolveThumbnailHref, S as resolveThumbnailInteraction, v as resolveThumbnailLayers, r as thumbnailFitClass, _ as toGalleryThumbUrl, Ae as warnLocaleVoiceFallbacks };
|
|
3102
3210
|
|
|
3103
3211
|
//# sourceMappingURL=index.js.map
|