@liforma/client 0.4.13 → 0.4.14
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 +12 -0
- package/README.md +4 -4
- package/dist/next/index.js +687 -618
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/thumbnail/index.d.ts +1 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/locationPlate.d.ts +3 -3
- package/dist/next/thumbnail/locationPlate.d.ts.map +1 -1
- package/dist/next/thumbnail/plateDelivery.d.ts +18 -0
- package/dist/next/thumbnail/plateDelivery.d.ts.map +1 -0
- package/dist/next/thumbnail/plateDelivery.test.d.ts +2 -0
- package/dist/next/thumbnail/plateDelivery.test.d.ts.map +1 -0
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +1 -1
- package/dist/next/thumbnail.js +147 -91
- package/dist/next/thumbnail.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +3 -0
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts +4 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/npm/index.js +23 -10
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/index.d.ts +1 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +106 -70
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/locationPlate.d.ts +3 -3
- package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -1
- package/dist/npm/thumbnail/plateDelivery.d.ts +18 -0
- package/dist/npm/thumbnail/plateDelivery.d.ts.map +1 -0
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +3 -0
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts +4 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +3 -0
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +693 -618
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/react/thumbnail/index.d.ts +1 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/locationPlate.d.ts +3 -3
- package/dist/react/thumbnail/locationPlate.d.ts.map +1 -1
- package/dist/react/thumbnail/plateDelivery.d.ts +18 -0
- package/dist/react/thumbnail/plateDelivery.d.ts.map +1 -0
- package/dist/react/thumbnail/plateDelivery.test.d.ts +2 -0
- package/dist/react/thumbnail/plateDelivery.test.d.ts.map +1 -0
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +1 -1
- package/dist/react/thumbnail.js +147 -91
- package/dist/react/thumbnail.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +3 -0
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts +4 -1
- package/dist/react/v2/shims/embedBaseUrl.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 +2 -2
- package/dist/sdk/v2/thumbnail.js.map +1 -1
- package/dist/svelte/Experience.svelte +8 -0
- package/dist/svelte/ExperienceThumbnail.svelte +49 -8
- package/package.json +4 -1
package/dist/next/index.js
CHANGED
|
@@ -107,9 +107,9 @@ function y(e) {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/thumbnail/locationPlate.ts
|
|
110
|
-
var b = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
110
|
+
var b = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
|
|
111
111
|
function x(e, t) {
|
|
112
|
-
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
112
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
113
113
|
}
|
|
114
114
|
function S(e, t) {
|
|
115
115
|
let n = e.trim();
|
|
@@ -123,7 +123,7 @@ function C(e, t) {
|
|
|
123
123
|
let r = new ResizeObserver(n);
|
|
124
124
|
return r.observe(e), () => r.disconnect();
|
|
125
125
|
}
|
|
126
|
-
var w = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
126
|
+
var w = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
127
127
|
function T(e) {
|
|
128
128
|
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
129
129
|
}
|
|
@@ -173,21 +173,21 @@ function j(e, t) {
|
|
|
173
173
|
}
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
176
|
-
var
|
|
177
|
-
function
|
|
176
|
+
var M = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, ee = /_CH(\.webp)/i;
|
|
177
|
+
function N(e) {
|
|
178
178
|
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("/");
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function P(e, t = "256x256", n) {
|
|
181
181
|
let r = e.trim();
|
|
182
182
|
if (!r) return r;
|
|
183
|
-
if (
|
|
183
|
+
if (N(r)) return A(r, t, n);
|
|
184
184
|
let i = j(r, n);
|
|
185
|
-
return i = i.replace(
|
|
185
|
+
return i = i.replace(M, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(ee, "_neutral$1");
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function F(e) {
|
|
188
188
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
189
189
|
if (!t) return null;
|
|
190
|
-
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 = T(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() :
|
|
190
|
+
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 = T(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : P(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : A(e, a, o);
|
|
191
191
|
return {
|
|
192
192
|
avatarImage: c(t),
|
|
193
193
|
...n ? { backgroundImage: l(n) } : {},
|
|
@@ -197,7 +197,7 @@ function P(e) {
|
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/shims/localStack.ts
|
|
200
|
-
function
|
|
200
|
+
function te() {
|
|
201
201
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
202
202
|
if (typeof location > "u") return !1;
|
|
203
203
|
try {
|
|
@@ -208,83 +208,83 @@ function ne() {
|
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
211
|
-
var
|
|
212
|
-
function
|
|
211
|
+
var I = "https://player.liforma.ai", L = "http://localhost:3002";
|
|
212
|
+
function ne(e) {
|
|
213
213
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function re(e) {
|
|
216
216
|
let t = e?.trim();
|
|
217
|
-
return t ? t.replace(/\/$/, "") :
|
|
217
|
+
return t ? t.replace(/\/$/, "") : te() ? L : I;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
let t = e.experienceId.trim(), n =
|
|
219
|
+
function ie(e) {
|
|
220
|
+
let t = e.experienceId.trim(), n = re(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
221
221
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function R(e) {
|
|
224
224
|
let t = e.href?.trim();
|
|
225
225
|
if (t) return t;
|
|
226
226
|
let n = e.experienceId?.trim();
|
|
227
227
|
if (!n) return;
|
|
228
228
|
let r = e.returnUrl?.trim();
|
|
229
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
229
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ie({
|
|
230
230
|
experienceId: n,
|
|
231
231
|
...r ? { returnUrl: r } : {},
|
|
232
232
|
playerBaseUrl: e.playerBaseUrl
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function z() {
|
|
236
236
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var B = 0, ae = [];
|
|
239
|
+
function oe() {
|
|
240
|
+
return z() ? 4 : Infinity;
|
|
241
|
+
}
|
|
239
242
|
function se() {
|
|
240
|
-
return
|
|
243
|
+
return z() ? 160 : 0;
|
|
241
244
|
}
|
|
242
245
|
function ce() {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
let e = se();
|
|
247
|
-
for (; z < e && oe.length > 0;) {
|
|
248
|
-
let e = oe.shift();
|
|
246
|
+
let e = oe();
|
|
247
|
+
for (; B < e && ae.length > 0;) {
|
|
248
|
+
let e = ae.shift();
|
|
249
249
|
if (!e || e.cancelled) continue;
|
|
250
|
-
|
|
251
|
-
let t =
|
|
250
|
+
B += 1, e.start();
|
|
251
|
+
let t = se();
|
|
252
252
|
if (t <= 0) {
|
|
253
|
-
|
|
253
|
+
B = Math.max(0, B - 1);
|
|
254
254
|
continue;
|
|
255
255
|
}
|
|
256
256
|
window.setTimeout(() => {
|
|
257
|
-
|
|
257
|
+
B = Math.max(0, B - 1), ce();
|
|
258
258
|
}, t);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
if (!
|
|
261
|
+
function le(e) {
|
|
262
|
+
if (!z()) return e(), () => {};
|
|
263
263
|
let t = {
|
|
264
264
|
start: e,
|
|
265
265
|
cancelled: !1
|
|
266
266
|
};
|
|
267
|
-
return
|
|
267
|
+
return ae.push(t), ce(), () => {
|
|
268
268
|
t.cancelled = !0;
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/thumbnail/lazyLoad.ts
|
|
273
|
-
function
|
|
274
|
-
return
|
|
273
|
+
function V() {
|
|
274
|
+
return z() ? "96px 0px" : "280px 0px";
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function ue(e) {
|
|
277
277
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
278
278
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function de(e, t) {
|
|
281
281
|
if (typeof window > "u") return !1;
|
|
282
282
|
let n = e.getBoundingClientRect();
|
|
283
283
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
287
|
-
o || (s?.(), s =
|
|
285
|
+
function fe(e, t) {
|
|
286
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? V(), i = ue(r), a = !1, o = !1, s = null, c = () => {
|
|
287
|
+
o || (s?.(), s = le(() => {
|
|
288
288
|
s = null, o = !0, n(!0);
|
|
289
289
|
}));
|
|
290
290
|
}, l = (e) => {
|
|
@@ -306,55 +306,55 @@ function pe(e, t) {
|
|
|
306
306
|
rootMargin: r,
|
|
307
307
|
threshold: 0
|
|
308
308
|
});
|
|
309
|
-
return u.observe(e),
|
|
309
|
+
return u.observe(e), de(e, i) && l(!0), () => {
|
|
310
310
|
s?.(), s = null, u.disconnect();
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
//#endregion
|
|
314
314
|
//#region src/thumbnail/scrollParallax.ts
|
|
315
|
-
function
|
|
315
|
+
function pe() {
|
|
316
316
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function H(e, t) {
|
|
319
319
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var me = /* @__PURE__ */ new Set(), U = !1, W = 0;
|
|
322
322
|
function he() {
|
|
323
|
-
if (W = 0,
|
|
323
|
+
if (W = 0, me.size === 0 || typeof window > "u") return;
|
|
324
324
|
let e = window.innerHeight;
|
|
325
|
-
for (let t of
|
|
325
|
+
for (let t of me) {
|
|
326
326
|
if (t.pointerActive?.()) continue;
|
|
327
327
|
let n = t.element.getBoundingClientRect();
|
|
328
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
328
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(H(n, e));
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function G() {
|
|
332
332
|
W === 0 && (W = requestAnimationFrame(he));
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
U || typeof window > "u" || (U = !0, window.addEventListener("scroll",
|
|
334
|
+
function K() {
|
|
335
|
+
U || typeof window > "u" || (U = !0, window.addEventListener("scroll", G, { passive: !0 }), window.addEventListener("resize", G, { passive: !0 }));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
337
|
+
function ge() {
|
|
338
|
+
me.size > 0 || !U || typeof window > "u" || (U = !1, W !== 0 && (cancelAnimationFrame(W), W = 0), window.removeEventListener("scroll", G), window.removeEventListener("resize", G));
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
if (!
|
|
340
|
+
function _e(e, t) {
|
|
341
|
+
if (!pe()) return () => {};
|
|
342
342
|
let n = {
|
|
343
343
|
element: e,
|
|
344
344
|
onParallax: t.onParallax,
|
|
345
345
|
pointerActive: t.pointerActive
|
|
346
346
|
};
|
|
347
|
-
return
|
|
348
|
-
|
|
347
|
+
return me.add(n), K(), n.pointerActive?.() || t.onParallax(H(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
348
|
+
me.delete(n), ge();
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
351
|
//#endregion
|
|
352
352
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
353
|
-
function
|
|
353
|
+
function ve(e) {
|
|
354
354
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
355
355
|
let a = r || i;
|
|
356
356
|
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));
|
|
357
|
-
}, s =
|
|
357
|
+
}, s = _e(e, {
|
|
358
358
|
onParallax: (e) => {
|
|
359
359
|
i = !0, a || (t = e, n = 0, o());
|
|
360
360
|
},
|
|
@@ -367,7 +367,7 @@ function ye(e) {
|
|
|
367
367
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
368
368
|
}, u = () => {
|
|
369
369
|
let s = a;
|
|
370
|
-
a = !1, r = !1, i && s ? (t =
|
|
370
|
+
a = !1, r = !1, i && s ? (t = H(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
371
371
|
}, d = (e) => {
|
|
372
372
|
e.pointerType === "mouse" && (r = !0, o());
|
|
373
373
|
}, f = () => {
|
|
@@ -379,30 +379,65 @@ function ye(e) {
|
|
|
379
379
|
}
|
|
380
380
|
//#endregion
|
|
381
381
|
//#region src/thumbnail/styles.ts
|
|
382
|
-
var
|
|
383
|
-
function
|
|
384
|
-
if (typeof document > "u" ||
|
|
382
|
+
var ye = ":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;\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}", be = !1;
|
|
383
|
+
function xe(e) {
|
|
384
|
+
if (typeof document > "u" || be) return;
|
|
385
385
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
386
|
-
|
|
386
|
+
be = !0;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
let t = document.createElement("style");
|
|
390
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
390
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), be = !0;
|
|
391
|
+
}
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/thumbnail/plateDelivery.ts
|
|
394
|
+
var Se = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Ce = null;
|
|
395
|
+
function we(e) {
|
|
396
|
+
let t = e.trim();
|
|
397
|
+
if (!t || t.startsWith("blob:") || t.startsWith("data:")) return !1;
|
|
398
|
+
let n = t.split(/[?#]/)[0] ?? t, r = /\/avatars\//i.test(n), i = /\/locations\//i.test(n);
|
|
399
|
+
return !r && !i || /\.depth\.webp$/i.test(n) ? !1 : /\.webp$/i.test(n);
|
|
400
|
+
}
|
|
401
|
+
function Te(e) {
|
|
402
|
+
if (!we(e)) return null;
|
|
403
|
+
let t = e.search(/[?#]/);
|
|
404
|
+
if (t < 0) return e.replace(/\.webp$/i, ".avif");
|
|
405
|
+
let n = e.slice(0, t), r = e.slice(t);
|
|
406
|
+
return `${n.replace(/\.webp$/i, ".avif")}${r}`;
|
|
407
|
+
}
|
|
408
|
+
function Ee() {
|
|
409
|
+
return typeof Image > "u" ? Promise.resolve(!1) : (Ce ||= new Promise((e) => {
|
|
410
|
+
let t = new Image();
|
|
411
|
+
t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = Se;
|
|
412
|
+
}), Ce);
|
|
413
|
+
}
|
|
414
|
+
function De(e, t) {
|
|
415
|
+
return t ? Te(e) ?? e : e;
|
|
416
|
+
}
|
|
417
|
+
function Oe(e) {
|
|
418
|
+
let t = e.trim(), n = t.search(/[?#]/), r = n < 0 ? t : t.slice(0, n);
|
|
419
|
+
if (!/\.avif$/i.test(r)) return null;
|
|
420
|
+
let i = r.replace(/\.avif$/i, ".webp");
|
|
421
|
+
return n < 0 ? i : `${i}${t.slice(n)}`;
|
|
422
|
+
}
|
|
423
|
+
function ke(e) {
|
|
424
|
+
let t = e.trim();
|
|
425
|
+
return /-400x225\.(webp|avif)(?:$|[?#])/i.test(t) ? t.replace(/-400x225\.(webp|avif)/i, "-800x450.$1") : null;
|
|
391
426
|
}
|
|
392
427
|
//#endregion
|
|
393
428
|
//#region src/react/ExperienceThumbnail.tsx
|
|
394
|
-
function
|
|
429
|
+
function Ae(e, t) {
|
|
395
430
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
396
431
|
}
|
|
397
|
-
function
|
|
398
|
-
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: w = "full", lazy: T = !0, className: E = "", fallbackImage: D, normalizeUrls: O = !0, cdnBaseUrl: k } = s, A = n(null), j = n(!1), [
|
|
432
|
+
function je(s) {
|
|
433
|
+
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: w = "full", lazy: T = !0, className: E = "", fallbackImage: D, normalizeUrls: O = !0, cdnBaseUrl: k } = s, A = n(null), j = n(!1), [M, ee] = r(0), [N, P] = r(0), te = x(M, N), I = t(() => F({
|
|
399
434
|
galleryThumb: c,
|
|
400
435
|
avatarImage: l,
|
|
401
436
|
backgroundImage: u,
|
|
402
437
|
foregroundImage: d,
|
|
403
438
|
fallbackImage: D,
|
|
404
439
|
normalize: O,
|
|
405
|
-
locationPlateSize:
|
|
440
|
+
locationPlateSize: te,
|
|
406
441
|
cdnBaseUrl: k
|
|
407
442
|
}), [
|
|
408
443
|
c,
|
|
@@ -411,87 +446,89 @@ function we(s) {
|
|
|
411
446
|
d,
|
|
412
447
|
D,
|
|
413
448
|
O,
|
|
414
|
-
|
|
449
|
+
te,
|
|
415
450
|
k
|
|
416
|
-
]),
|
|
451
|
+
]), L = ne({
|
|
417
452
|
href: m,
|
|
418
453
|
hasClickHandler: typeof _ == "function",
|
|
419
454
|
experienceId: p
|
|
420
|
-
}),
|
|
455
|
+
}), re = L === "anchor" && !m?.trim() && !!p?.trim(), ie = !!I?.backgroundImage, z = S !== !1, [B, ae] = r(!T), [oe, se] = r(!1), [ce, le] = r(!1), [V, ue] = r(!1), [de, pe] = r(!1), [me, U] = r(!1), [W, he] = r(!1), [G, K] = r(!1), [ge, ve] = r(0), [be, Se] = r(0), [Ce, we] = r(!1), [Te, je] = r(!1), [Me, Ne] = r(!1), [Pe, Fe] = r(!1), [q, Ie] = r(), Le = I ? Ce && I.fallbackImage ? I.fallbackImage : I.avatarImage : "";
|
|
421
456
|
e(() => {
|
|
422
|
-
|
|
457
|
+
xe(ye), Ee().then((e) => {
|
|
458
|
+
se(e), le(!0);
|
|
459
|
+
});
|
|
423
460
|
}, []), e(() => {
|
|
424
|
-
|
|
461
|
+
Ie(R({
|
|
425
462
|
href: m,
|
|
426
463
|
experienceId: p,
|
|
427
464
|
returnUrl: v,
|
|
428
465
|
playerBaseUrl: b,
|
|
429
|
-
useCurrentPageAsReturnUrl:
|
|
466
|
+
useCurrentPageAsReturnUrl: re && !v?.trim()
|
|
430
467
|
}));
|
|
431
468
|
}, [
|
|
432
469
|
m,
|
|
433
470
|
p,
|
|
434
471
|
v,
|
|
435
472
|
b,
|
|
436
|
-
|
|
473
|
+
re
|
|
437
474
|
]), e(() => {
|
|
438
|
-
|
|
475
|
+
je(!1), Ne(!1), Fe(!1), we(!1), ue(!1), pe(!1), U(!1);
|
|
439
476
|
}, [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
477
|
+
I?.backgroundImage,
|
|
478
|
+
I?.foregroundImage,
|
|
479
|
+
Le
|
|
443
480
|
]), e(() => {
|
|
444
481
|
let e = A.current;
|
|
445
482
|
if (e) return C(e, (e, t) => {
|
|
446
|
-
|
|
483
|
+
ee(e), P(t);
|
|
447
484
|
});
|
|
448
|
-
}, [
|
|
485
|
+
}, [L, q]), e(() => {
|
|
449
486
|
let e = A.current;
|
|
450
487
|
if (e) {
|
|
451
488
|
if (!T) {
|
|
452
|
-
|
|
489
|
+
ae(!0);
|
|
453
490
|
return;
|
|
454
491
|
}
|
|
455
|
-
return
|
|
456
|
-
e &&
|
|
492
|
+
return fe(e, { onVisibleChange: (e) => {
|
|
493
|
+
e && ae(!0);
|
|
457
494
|
} });
|
|
458
495
|
}
|
|
459
496
|
}, [
|
|
460
497
|
T,
|
|
461
|
-
F,
|
|
462
498
|
I,
|
|
463
|
-
|
|
499
|
+
L,
|
|
500
|
+
q
|
|
464
501
|
]), e(() => {
|
|
465
502
|
let e = A.current;
|
|
466
|
-
if (!(!e || !
|
|
503
|
+
if (!(!e || !z)) return _e(e, {
|
|
467
504
|
onParallax: (e) => {
|
|
468
|
-
|
|
505
|
+
K(!0), j.current || (ve(e), Se(0));
|
|
469
506
|
},
|
|
470
507
|
pointerActive: () => j.current
|
|
471
508
|
});
|
|
472
509
|
}, [
|
|
473
|
-
|
|
474
|
-
F,
|
|
510
|
+
z,
|
|
475
511
|
I,
|
|
476
|
-
|
|
512
|
+
L,
|
|
513
|
+
q
|
|
477
514
|
]);
|
|
478
|
-
let
|
|
479
|
-
if (!
|
|
515
|
+
let Re = (e) => {
|
|
516
|
+
if (!z || G) return;
|
|
480
517
|
let t = e.currentTarget.getBoundingClientRect();
|
|
481
|
-
t.width <= 0 || t.height <= 0 || (
|
|
482
|
-
},
|
|
518
|
+
t.width <= 0 || t.height <= 0 || (ve(((e.clientX - t.left) / t.width - .5) * 2), Se(((e.clientY - t.top) / t.height - .5) * 2));
|
|
519
|
+
}, ze = (e) => {
|
|
483
520
|
let t = j.current;
|
|
484
|
-
j.current = !1,
|
|
485
|
-
},
|
|
486
|
-
if (!
|
|
487
|
-
j.current = !0, e.pointerType === "mouse" &&
|
|
521
|
+
j.current = !1, he(!1), G && t ? (ve(H(e.getBoundingClientRect(), window.innerHeight)), Se(0)) : G || (ve(0), Se(0));
|
|
522
|
+
}, J = (e) => {
|
|
523
|
+
if (!z) return;
|
|
524
|
+
j.current = !0, e.pointerType === "mouse" && he(!0);
|
|
488
525
|
let t = e.currentTarget, n = () => {
|
|
489
|
-
|
|
526
|
+
ze(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
490
527
|
};
|
|
491
528
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
492
|
-
},
|
|
493
|
-
if (_?.(e), !e.defaultPrevented &&
|
|
494
|
-
let t =
|
|
529
|
+
}, Be = (e) => {
|
|
530
|
+
if (_?.(e), !e.defaultPrevented && re && !v?.trim()) {
|
|
531
|
+
let t = R({
|
|
495
532
|
experienceId: p,
|
|
496
533
|
playerBaseUrl: b,
|
|
497
534
|
useCurrentPageAsReturnUrl: !0
|
|
@@ -499,135 +536,154 @@ function we(s) {
|
|
|
499
536
|
t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
|
|
500
537
|
}
|
|
501
538
|
};
|
|
502
|
-
if (!
|
|
503
|
-
let
|
|
539
|
+
if (!I) return null;
|
|
540
|
+
let Ve = z && (W || G), He = B && ce && (Me || Te || Pe), Ue = [
|
|
504
541
|
"liforma-et",
|
|
505
|
-
|
|
542
|
+
ie ? "liforma-et--scene" : "",
|
|
506
543
|
y(w),
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
544
|
+
Ve ? "liforma-et--parallax" : "",
|
|
545
|
+
G ? "liforma-et--scroll-parallax" : "",
|
|
546
|
+
B && !He ? "liforma-et--loading" : "",
|
|
547
|
+
He ? "liforma-et--revealed" : "",
|
|
511
548
|
E
|
|
512
|
-
].filter(Boolean).join(" "),
|
|
513
|
-
"--liforma-et-parallax-x":
|
|
514
|
-
"--liforma-et-parallax-y":
|
|
515
|
-
},
|
|
549
|
+
].filter(Boolean).join(" "), Y = {
|
|
550
|
+
"--liforma-et-parallax-x": ge,
|
|
551
|
+
"--liforma-et-parallax-y": be
|
|
552
|
+
}, We = (e, t) => {
|
|
516
553
|
e.complete && t(!0);
|
|
517
|
-
},
|
|
554
|
+
}, Ge = /* @__PURE__ */ o(i, { children: [
|
|
518
555
|
/* @__PURE__ */ a("span", {
|
|
519
556
|
className: "liforma-et__placeholder",
|
|
520
557
|
"aria-hidden": "true"
|
|
521
558
|
}),
|
|
522
|
-
|
|
523
|
-
className:
|
|
524
|
-
src:
|
|
559
|
+
B && ce && I.backgroundImage ? /* @__PURE__ */ a("img", {
|
|
560
|
+
className: Ae("liforma-et__background", Te),
|
|
561
|
+
src: De(I.backgroundImage, oe),
|
|
525
562
|
alt: "",
|
|
526
563
|
decoding: "async",
|
|
527
564
|
ref: (e) => {
|
|
528
|
-
e &&
|
|
565
|
+
e && We(e, je);
|
|
529
566
|
},
|
|
530
|
-
onLoad: () =>
|
|
531
|
-
onError: () =>
|
|
567
|
+
onLoad: () => je(!0),
|
|
568
|
+
onError: (e) => {
|
|
569
|
+
let t = e.currentTarget, n = ke(t.src);
|
|
570
|
+
if (n && !V) {
|
|
571
|
+
ue(!0), t.src = n;
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
je(!0);
|
|
575
|
+
}
|
|
532
576
|
}) : null,
|
|
533
|
-
|
|
534
|
-
className:
|
|
535
|
-
src:
|
|
577
|
+
B && ce && Le ? /* @__PURE__ */ a("img", {
|
|
578
|
+
className: Ae("liforma-et__avatar", Me),
|
|
579
|
+
src: De(Le, oe),
|
|
536
580
|
alt: "",
|
|
537
581
|
decoding: "async",
|
|
538
582
|
ref: (e) => {
|
|
539
|
-
e &&
|
|
583
|
+
e && We(e, Ne);
|
|
540
584
|
},
|
|
541
|
-
onLoad: () =>
|
|
542
|
-
onError: () => {
|
|
543
|
-
|
|
585
|
+
onLoad: () => Ne(!0),
|
|
586
|
+
onError: (e) => {
|
|
587
|
+
let t = e.currentTarget, n = Oe(t.src);
|
|
588
|
+
if (n && !me) {
|
|
589
|
+
U(!0), t.src = n;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
I.fallbackImage ? we(!0) : Ne(!0);
|
|
544
593
|
}
|
|
545
594
|
}) : null,
|
|
546
|
-
|
|
547
|
-
className:
|
|
548
|
-
src:
|
|
595
|
+
B && ce && I.foregroundImage ? /* @__PURE__ */ a("img", {
|
|
596
|
+
className: Ae("liforma-et__foreground", Pe),
|
|
597
|
+
src: De(I.foregroundImage, oe),
|
|
549
598
|
alt: "",
|
|
550
599
|
decoding: "async",
|
|
551
600
|
ref: (e) => {
|
|
552
|
-
e &&
|
|
601
|
+
e && We(e, Fe);
|
|
553
602
|
},
|
|
554
|
-
onLoad: () =>
|
|
555
|
-
onError: () =>
|
|
603
|
+
onLoad: () => Fe(!0),
|
|
604
|
+
onError: (e) => {
|
|
605
|
+
let t = e.currentTarget, n = ke(t.src);
|
|
606
|
+
if (n && !de) {
|
|
607
|
+
pe(!0), t.src = n;
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
Fe(!0);
|
|
611
|
+
}
|
|
556
612
|
}) : null
|
|
557
|
-
] }),
|
|
558
|
-
onPointerDown:
|
|
559
|
-
onPointerUp: (e) =>
|
|
560
|
-
onPointerCancel: (e) =>
|
|
613
|
+
] }), Ke = {
|
|
614
|
+
onPointerDown: J,
|
|
615
|
+
onPointerUp: (e) => ze(e.currentTarget),
|
|
616
|
+
onPointerCancel: (e) => ze(e.currentTarget),
|
|
561
617
|
onPointerEnter: (e) => {
|
|
562
|
-
|
|
618
|
+
z && e.pointerType === "mouse" && he(!0);
|
|
563
619
|
},
|
|
564
|
-
onPointerMove:
|
|
620
|
+
onPointerMove: Re,
|
|
565
621
|
onPointerLeave: () => {
|
|
566
|
-
j.current || (
|
|
622
|
+
j.current || (he(!1), G || (ve(0), Se(0)));
|
|
567
623
|
}
|
|
568
|
-
},
|
|
624
|
+
}, qe = (e) => {
|
|
569
625
|
A.current = e;
|
|
570
626
|
};
|
|
571
|
-
return
|
|
572
|
-
ref:
|
|
573
|
-
className:
|
|
574
|
-
style:
|
|
575
|
-
href:
|
|
627
|
+
return L === "anchor" && q ? /* @__PURE__ */ a("a", {
|
|
628
|
+
ref: qe,
|
|
629
|
+
className: Ue,
|
|
630
|
+
style: Y,
|
|
631
|
+
href: q,
|
|
576
632
|
target: h,
|
|
577
633
|
rel: g,
|
|
578
634
|
"aria-label": f,
|
|
579
|
-
onClick:
|
|
580
|
-
...
|
|
581
|
-
children:
|
|
582
|
-
}) :
|
|
635
|
+
onClick: Be,
|
|
636
|
+
...Ke,
|
|
637
|
+
children: Ge
|
|
638
|
+
}) : L === "button" ? /* @__PURE__ */ a("button", {
|
|
583
639
|
type: "button",
|
|
584
|
-
ref:
|
|
585
|
-
className:
|
|
586
|
-
style:
|
|
640
|
+
ref: qe,
|
|
641
|
+
className: Ue,
|
|
642
|
+
style: Y,
|
|
587
643
|
"aria-label": f,
|
|
588
|
-
onClick:
|
|
589
|
-
...
|
|
590
|
-
children:
|
|
644
|
+
onClick: Be,
|
|
645
|
+
...Ke,
|
|
646
|
+
children: Ge
|
|
591
647
|
}) : /* @__PURE__ */ a("div", {
|
|
592
|
-
ref:
|
|
593
|
-
className:
|
|
594
|
-
style:
|
|
648
|
+
ref: qe,
|
|
649
|
+
className: Ue,
|
|
650
|
+
style: Y,
|
|
595
651
|
role: f ? "img" : void 0,
|
|
596
652
|
"aria-label": f || void 0,
|
|
597
653
|
"aria-hidden": f ? void 0 : !0,
|
|
598
|
-
...
|
|
599
|
-
children:
|
|
654
|
+
...Ke,
|
|
655
|
+
children: Ge
|
|
600
656
|
});
|
|
601
657
|
}
|
|
602
658
|
//#endregion
|
|
603
659
|
//#region src/widget/styles.ts
|
|
604
|
-
var Te = "\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", Ee = "liforma-experience-widget-styles";
|
|
605
|
-
function
|
|
660
|
+
var Me = "\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", Ne = "liforma-experience-widget-styles";
|
|
661
|
+
function Pe(e = Me) {
|
|
606
662
|
if (typeof document > "u") return;
|
|
607
|
-
let t = document.getElementById(
|
|
663
|
+
let t = document.getElementById(Ne);
|
|
608
664
|
if (t) {
|
|
609
665
|
t.textContent = e;
|
|
610
666
|
return;
|
|
611
667
|
}
|
|
612
668
|
let n = document.createElement("style");
|
|
613
|
-
n.id =
|
|
669
|
+
n.id = Ne, n.textContent = e, document.head.append(n);
|
|
614
670
|
}
|
|
615
671
|
//#endregion
|
|
616
672
|
//#region src/shims/apiBaseUrl.ts
|
|
617
|
-
var
|
|
618
|
-
function
|
|
673
|
+
var Fe = "https://api.liforma.ai", q = "http://localhost:3001";
|
|
674
|
+
function Ie() {
|
|
619
675
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
620
676
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
621
677
|
if (typeof document > "u") return null;
|
|
622
678
|
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();
|
|
623
679
|
return t ? t.replace(/\/$/, "") : null;
|
|
624
680
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
681
|
+
function Le() {
|
|
682
|
+
return Ie() || (te() ? q : Fe);
|
|
627
683
|
}
|
|
628
684
|
//#endregion
|
|
629
685
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
630
|
-
function
|
|
686
|
+
function Re(e) {
|
|
631
687
|
if (!e || typeof e != "object") return null;
|
|
632
688
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
633
689
|
return n ? {
|
|
@@ -636,10 +692,10 @@ function je(e) {
|
|
|
636
692
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
637
693
|
} : null;
|
|
638
694
|
}
|
|
639
|
-
async function
|
|
695
|
+
async function ze(e, t) {
|
|
640
696
|
let n = e.trim();
|
|
641
697
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
642
|
-
let r = (t?.apiBaseUrl ??
|
|
698
|
+
let r = (t?.apiBaseUrl ?? Le()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
643
699
|
method: "GET",
|
|
644
700
|
headers: { Accept: "application/json" },
|
|
645
701
|
signal: t?.signal
|
|
@@ -659,7 +715,7 @@ async function Me(e, t) {
|
|
|
659
715
|
throw Error("Experience preview returned invalid JSON.");
|
|
660
716
|
}
|
|
661
717
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
662
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
718
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Re(o.galleryThumb);
|
|
663
719
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
664
720
|
return {
|
|
665
721
|
experienceId: s || n,
|
|
@@ -669,7 +725,7 @@ async function Me(e, t) {
|
|
|
669
725
|
}
|
|
670
726
|
//#endregion
|
|
671
727
|
//#region src/v2/errors/LiformaError.ts
|
|
672
|
-
var
|
|
728
|
+
var J = class extends Error {
|
|
673
729
|
code;
|
|
674
730
|
requestId;
|
|
675
731
|
status;
|
|
@@ -678,16 +734,16 @@ var q = class extends Error {
|
|
|
678
734
|
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;
|
|
679
735
|
}
|
|
680
736
|
};
|
|
681
|
-
function
|
|
737
|
+
function Be(e) {
|
|
682
738
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
683
739
|
}
|
|
684
|
-
function
|
|
740
|
+
function Ve(e, t, n) {
|
|
685
741
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
686
742
|
try {
|
|
687
743
|
i = JSON.parse(t);
|
|
688
744
|
} catch {}
|
|
689
|
-
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 } =
|
|
690
|
-
return new
|
|
745
|
+
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 } = Be(a) ?? Be(i) ?? {};
|
|
746
|
+
return new J(u, {
|
|
691
747
|
code: l,
|
|
692
748
|
requestId: d,
|
|
693
749
|
status: e,
|
|
@@ -696,37 +752,37 @@ function Pe(e, t, n) {
|
|
|
696
752
|
}
|
|
697
753
|
//#endregion
|
|
698
754
|
//#region src/v2/api/captureAttribution.ts
|
|
699
|
-
var
|
|
700
|
-
function
|
|
755
|
+
var He = 128, Ue = /[\u0000-\u001f\u007f]/g;
|
|
756
|
+
function Y(e) {
|
|
701
757
|
if (!e) return;
|
|
702
|
-
let t = e.replace(
|
|
703
|
-
if (t) return t.slice(0,
|
|
758
|
+
let t = e.replace(Ue, "").trim();
|
|
759
|
+
if (t) return t.slice(0, He);
|
|
704
760
|
}
|
|
705
|
-
function
|
|
761
|
+
function We(e) {
|
|
706
762
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
707
763
|
return {
|
|
708
|
-
...
|
|
709
|
-
...
|
|
710
|
-
...
|
|
711
|
-
...
|
|
712
|
-
...
|
|
764
|
+
...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
|
|
765
|
+
...Y(t.get("utm_medium")) ? { utmMedium: Y(t.get("utm_medium")) } : {},
|
|
766
|
+
...Y(t.get("utm_campaign")) ? { utmCampaign: Y(t.get("utm_campaign")) } : {},
|
|
767
|
+
...Y(t.get("utm_content")) ? { utmContent: Y(t.get("utm_content")) } : {},
|
|
768
|
+
...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
|
|
713
769
|
};
|
|
714
770
|
}
|
|
715
|
-
function
|
|
771
|
+
function Ge(e) {
|
|
716
772
|
if (e === !1) return;
|
|
717
773
|
if (e && typeof e == "object") {
|
|
718
774
|
let t = {
|
|
719
|
-
...
|
|
720
|
-
...
|
|
721
|
-
...
|
|
722
|
-
...
|
|
723
|
-
...
|
|
724
|
-
...
|
|
775
|
+
...Y(e.utmSource) ? { utmSource: Y(e.utmSource) } : {},
|
|
776
|
+
...Y(e.utmMedium) ? { utmMedium: Y(e.utmMedium) } : {},
|
|
777
|
+
...Y(e.utmCampaign) ? { utmCampaign: Y(e.utmCampaign) } : {},
|
|
778
|
+
...Y(e.utmContent) ? { utmContent: Y(e.utmContent) } : {},
|
|
779
|
+
...Y(e.utmTerm) ? { utmTerm: Y(e.utmTerm) } : {},
|
|
780
|
+
...Y(e.referrer) ? { referrer: Y(e.referrer) } : {}
|
|
725
781
|
};
|
|
726
782
|
return Object.keys(t).length ? t : void 0;
|
|
727
783
|
}
|
|
728
784
|
if (typeof window > "u") return;
|
|
729
|
-
let t =
|
|
785
|
+
let t = We(window.location?.search), n = Y(document.referrer || void 0), r = {
|
|
730
786
|
...t,
|
|
731
787
|
...n ? { referrer: n } : {}
|
|
732
788
|
};
|
|
@@ -734,19 +790,19 @@ function Re(e) {
|
|
|
734
790
|
}
|
|
735
791
|
//#endregion
|
|
736
792
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
737
|
-
function
|
|
793
|
+
function Ke(e) {
|
|
738
794
|
let t = e.locale?.trim();
|
|
739
795
|
if (t) return t;
|
|
740
796
|
let n = e.language?.trim();
|
|
741
797
|
if (n) return n;
|
|
742
798
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
743
799
|
}
|
|
744
|
-
function
|
|
800
|
+
function qe(e) {
|
|
745
801
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
746
802
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
747
803
|
return t || n || void 0;
|
|
748
804
|
}
|
|
749
|
-
function
|
|
805
|
+
function Je(e, t) {
|
|
750
806
|
let n = e.trim();
|
|
751
807
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
752
808
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -754,7 +810,7 @@ function Ve(e, t) {
|
|
|
754
810
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
755
811
|
let i = t.experienceId.trim();
|
|
756
812
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
757
|
-
let a =
|
|
813
|
+
let a = Ke(t), o = qe(t), s = t.idempotencyKey?.trim();
|
|
758
814
|
return {
|
|
759
815
|
url: r.toString(),
|
|
760
816
|
init: {
|
|
@@ -773,7 +829,7 @@ function Ve(e, t) {
|
|
|
773
829
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
774
830
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
775
831
|
...(() => {
|
|
776
|
-
let e =
|
|
832
|
+
let e = Ge(t.attribution);
|
|
777
833
|
return e ? { attribution: e } : {};
|
|
778
834
|
})(),
|
|
779
835
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -783,16 +839,16 @@ function Ve(e, t) {
|
|
|
783
839
|
}
|
|
784
840
|
//#endregion
|
|
785
841
|
//#region src/v2/types/sessionLaunch.ts
|
|
786
|
-
function
|
|
842
|
+
function Ye(e) {
|
|
787
843
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
788
844
|
}
|
|
789
845
|
function X(e) {
|
|
790
846
|
return typeof e == "boolean";
|
|
791
847
|
}
|
|
792
|
-
function
|
|
793
|
-
if (!
|
|
848
|
+
function Xe(e) {
|
|
849
|
+
if (!Ye(e)) return null;
|
|
794
850
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
795
|
-
return !
|
|
851
|
+
return !Ye(t) || !Ye(n) || !Ye(r) || !Ye(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
|
|
796
852
|
speech: {
|
|
797
853
|
input: t.input,
|
|
798
854
|
output: t.output,
|
|
@@ -803,8 +859,8 @@ function He(e) {
|
|
|
803
859
|
tools: { enabled: i.enabled }
|
|
804
860
|
};
|
|
805
861
|
}
|
|
806
|
-
function
|
|
807
|
-
return !
|
|
862
|
+
function Ze(e) {
|
|
863
|
+
return !Ye(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
|
|
808
864
|
speech: {
|
|
809
865
|
input: e.speechInput,
|
|
810
866
|
output: e.speechOutput,
|
|
@@ -815,12 +871,12 @@ function Ue(e) {
|
|
|
815
871
|
tools: { enabled: e.tools }
|
|
816
872
|
};
|
|
817
873
|
}
|
|
818
|
-
function
|
|
819
|
-
return
|
|
874
|
+
function Qe(e) {
|
|
875
|
+
return Xe(e) ?? Ze(e);
|
|
820
876
|
}
|
|
821
|
-
function
|
|
822
|
-
if (!
|
|
823
|
-
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 =
|
|
877
|
+
function $e(e) {
|
|
878
|
+
if (!Ye(e)) throw Error("Session Launch response is missing session.");
|
|
879
|
+
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 = Qe(e.capabilities), l = et(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;
|
|
824
880
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
825
881
|
return {
|
|
826
882
|
id: t,
|
|
@@ -836,11 +892,11 @@ function Ge(e) {
|
|
|
836
892
|
...d ? { createdAt: d } : {}
|
|
837
893
|
};
|
|
838
894
|
}
|
|
839
|
-
function
|
|
895
|
+
function et(e) {
|
|
840
896
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
841
897
|
let t = [];
|
|
842
898
|
for (let n of e) {
|
|
843
|
-
if (!
|
|
899
|
+
if (!Ye(n)) continue;
|
|
844
900
|
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() : "";
|
|
845
901
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
846
902
|
axis: e,
|
|
@@ -851,104 +907,104 @@ function Ke(e) {
|
|
|
851
907
|
}
|
|
852
908
|
return t.length > 0 ? t : void 0;
|
|
853
909
|
}
|
|
854
|
-
function
|
|
910
|
+
function tt(e) {
|
|
855
911
|
let t = e.localeVoiceFallbacks;
|
|
856
912
|
if (t?.length) for (let e of t) {
|
|
857
913
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
858
914
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
859
915
|
}
|
|
860
916
|
}
|
|
861
|
-
function
|
|
862
|
-
if (!
|
|
917
|
+
function nt(e) {
|
|
918
|
+
if (!Ye(e)) throw Error("Session Launch response must be a JSON object.");
|
|
863
919
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
864
920
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
865
|
-
let n =
|
|
866
|
-
return
|
|
921
|
+
let n = $e(e.session);
|
|
922
|
+
return tt(n), {
|
|
867
923
|
session: n,
|
|
868
924
|
launch: t
|
|
869
925
|
};
|
|
870
926
|
}
|
|
871
927
|
//#endregion
|
|
872
928
|
//#region src/v2/api/mintPublicSession.ts
|
|
873
|
-
function
|
|
929
|
+
function rt() {
|
|
874
930
|
try {
|
|
875
931
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
876
932
|
} catch {}
|
|
877
933
|
}
|
|
878
|
-
function
|
|
934
|
+
function it(e) {
|
|
879
935
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
880
936
|
}
|
|
881
|
-
function
|
|
882
|
-
let n =
|
|
937
|
+
function at(e, t) {
|
|
938
|
+
let n = rt(), r = it(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
883
939
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
884
940
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
885
941
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
886
|
-
return new
|
|
942
|
+
return new J(`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.`, {
|
|
887
943
|
code: "ORIGIN_NOT_ALLOWED",
|
|
888
944
|
requestId: t.requestId,
|
|
889
945
|
status: t.status,
|
|
890
946
|
details: a
|
|
891
947
|
});
|
|
892
948
|
}
|
|
893
|
-
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new
|
|
949
|
+
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new J(`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”.`, {
|
|
894
950
|
code: "BROWSER_EMBEDS_DISABLED",
|
|
895
951
|
requestId: t.requestId,
|
|
896
952
|
status: t.status,
|
|
897
953
|
details: a
|
|
898
|
-
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new
|
|
954
|
+
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new J(`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.`, {
|
|
899
955
|
code: "EXPERIENCE_UNAVAILABLE",
|
|
900
956
|
requestId: t.requestId,
|
|
901
957
|
status: t.status,
|
|
902
958
|
details: a
|
|
903
959
|
}) : t;
|
|
904
960
|
}
|
|
905
|
-
function
|
|
961
|
+
function ot(e) {
|
|
906
962
|
let t = e?.locale?.trim();
|
|
907
963
|
if (t) return t;
|
|
908
964
|
let n = e?.language?.trim();
|
|
909
965
|
if (n) return n;
|
|
910
966
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
911
967
|
}
|
|
912
|
-
function
|
|
968
|
+
function st(e) {
|
|
913
969
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
914
|
-
if (t && n && t !== n) throw new
|
|
970
|
+
if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
915
971
|
return t || n || void 0;
|
|
916
972
|
}
|
|
917
|
-
function
|
|
918
|
-
let n = { experienceId: e }, r =
|
|
973
|
+
function ct(e, t) {
|
|
974
|
+
let n = { experienceId: e }, r = ot(t);
|
|
919
975
|
r && (n.locale = r);
|
|
920
|
-
let i =
|
|
976
|
+
let i = st(t);
|
|
921
977
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
922
|
-
let a =
|
|
978
|
+
let a = Ge(t?.attribution);
|
|
923
979
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
924
980
|
}
|
|
925
|
-
async function
|
|
926
|
-
let n =
|
|
981
|
+
async function lt(e, t) {
|
|
982
|
+
let n = Le(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
927
983
|
method: "POST",
|
|
928
984
|
headers: {
|
|
929
985
|
"Content-Type": "application/json",
|
|
930
986
|
...r ? { "Idempotency-Key": r } : {}
|
|
931
987
|
},
|
|
932
|
-
body: JSON.stringify(
|
|
988
|
+
body: JSON.stringify(ct(e, t))
|
|
933
989
|
});
|
|
934
990
|
if (!i.ok) {
|
|
935
991
|
let t = await i.text();
|
|
936
|
-
throw
|
|
992
|
+
throw at(e, Ve(i.status, t, i.headers));
|
|
937
993
|
}
|
|
938
994
|
let a;
|
|
939
995
|
try {
|
|
940
996
|
a = await i.json();
|
|
941
997
|
} catch {
|
|
942
|
-
throw new
|
|
998
|
+
throw new J("Browser session mint returned invalid JSON.", {
|
|
943
999
|
code: "INVALID_RESPONSE",
|
|
944
1000
|
status: i.status,
|
|
945
1001
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
946
1002
|
});
|
|
947
1003
|
}
|
|
948
|
-
return
|
|
1004
|
+
return nt(a);
|
|
949
1005
|
}
|
|
950
|
-
async function
|
|
951
|
-
let n =
|
|
1006
|
+
async function ut(e, t) {
|
|
1007
|
+
let n = Je(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
952
1008
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
953
1009
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
954
1010
|
try {
|
|
@@ -961,9 +1017,9 @@ async function nt(e, t) {
|
|
|
961
1017
|
}
|
|
962
1018
|
if (!o.ok) {
|
|
963
1019
|
let e = await o.text();
|
|
964
|
-
throw
|
|
1020
|
+
throw Ve(o.status, e, o.headers);
|
|
965
1021
|
}
|
|
966
|
-
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new
|
|
1022
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
|
|
967
1023
|
code: "INVALID_RESPONSE",
|
|
968
1024
|
status: o.status,
|
|
969
1025
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
@@ -972,20 +1028,20 @@ async function nt(e, t) {
|
|
|
972
1028
|
try {
|
|
973
1029
|
s = await o.json();
|
|
974
1030
|
} catch {
|
|
975
|
-
throw new
|
|
1031
|
+
throw new J("Session endpoint returned invalid JSON.", {
|
|
976
1032
|
code: "INVALID_RESPONSE",
|
|
977
1033
|
status: o.status,
|
|
978
1034
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
979
1035
|
});
|
|
980
1036
|
}
|
|
981
|
-
return
|
|
1037
|
+
return nt(s);
|
|
982
1038
|
}
|
|
983
1039
|
//#endregion
|
|
984
1040
|
//#region src/v2/conversationProcessor.ts
|
|
985
|
-
function
|
|
1041
|
+
function dt(e) {
|
|
986
1042
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
987
1043
|
}
|
|
988
|
-
function
|
|
1044
|
+
function ft(e) {
|
|
989
1045
|
if (typeof e == "string") {
|
|
990
1046
|
let t = e.trim();
|
|
991
1047
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -999,24 +1055,24 @@ function it(e) {
|
|
|
999
1055
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
1000
1056
|
};
|
|
1001
1057
|
}
|
|
1002
|
-
async function
|
|
1058
|
+
async function pt(e, t) {
|
|
1003
1059
|
let n = await e(t);
|
|
1004
|
-
return
|
|
1060
|
+
return dt(n) ? {
|
|
1005
1061
|
kind: "stream",
|
|
1006
1062
|
stream: n
|
|
1007
1063
|
} : {
|
|
1008
1064
|
kind: "complete",
|
|
1009
|
-
speech:
|
|
1065
|
+
speech: ft(n)
|
|
1010
1066
|
};
|
|
1011
1067
|
}
|
|
1012
1068
|
//#endregion
|
|
1013
1069
|
//#region src/v2/embed/playerReachability.ts
|
|
1014
|
-
var
|
|
1015
|
-
function
|
|
1070
|
+
var mt = "3002";
|
|
1071
|
+
function ht(e) {
|
|
1016
1072
|
let t = new URL(e);
|
|
1017
|
-
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 ||
|
|
1073
|
+
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 || mt}. 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.`;
|
|
1018
1074
|
}
|
|
1019
|
-
async function
|
|
1075
|
+
async function gt(e, t) {
|
|
1020
1076
|
try {
|
|
1021
1077
|
await fetch(e, {
|
|
1022
1078
|
method: "GET",
|
|
@@ -1024,25 +1080,25 @@ async function ct(e, t) {
|
|
|
1024
1080
|
signal: AbortSignal.timeout(8e3)
|
|
1025
1081
|
});
|
|
1026
1082
|
} catch {
|
|
1027
|
-
throw Error(
|
|
1083
|
+
throw Error(ht(t));
|
|
1028
1084
|
}
|
|
1029
1085
|
}
|
|
1030
|
-
function
|
|
1086
|
+
function _t(e, t, n, r) {
|
|
1031
1087
|
try {
|
|
1032
1088
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
1033
1089
|
} catch (e) {
|
|
1034
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
1090
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(ht(n), { cause: e }) : e;
|
|
1035
1091
|
}
|
|
1036
1092
|
}
|
|
1037
|
-
var
|
|
1038
|
-
function
|
|
1039
|
-
return typeof e == "number" &&
|
|
1093
|
+
var vt = new Set([1, 2]);
|
|
1094
|
+
function yt(e) {
|
|
1095
|
+
return typeof e == "number" && vt.has(e);
|
|
1040
1096
|
}
|
|
1041
|
-
var
|
|
1042
|
-
function
|
|
1097
|
+
var bt = 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.theatre.interactionChange".split("."));
|
|
1098
|
+
function xt(e) {
|
|
1043
1099
|
if (!e || typeof e != "object") return null;
|
|
1044
1100
|
let t = e;
|
|
1045
|
-
if (!
|
|
1101
|
+
if (!yt(t.schemaVersion) || !t.type || !bt.has(t.type)) return null;
|
|
1046
1102
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
1047
1103
|
if (t.type === "fullWindow" || t.type === "theatre") {
|
|
1048
1104
|
let e = t.payload;
|
|
@@ -1065,7 +1121,7 @@ function pt(e) {
|
|
|
1065
1121
|
let n = t.payload;
|
|
1066
1122
|
return !n || typeof n != "object" ? null : t;
|
|
1067
1123
|
}
|
|
1068
|
-
function
|
|
1124
|
+
function St(e, t, n) {
|
|
1069
1125
|
let r = e.trim();
|
|
1070
1126
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
1071
1127
|
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatreButton, l = n?.theatre;
|
|
@@ -1084,27 +1140,27 @@ function mt(e, t, n) {
|
|
|
1084
1140
|
}
|
|
1085
1141
|
};
|
|
1086
1142
|
}
|
|
1087
|
-
function
|
|
1143
|
+
function Ct() {
|
|
1088
1144
|
return {
|
|
1089
1145
|
type: "parentHello",
|
|
1090
1146
|
schemaVersion: 2
|
|
1091
1147
|
};
|
|
1092
1148
|
}
|
|
1093
|
-
function
|
|
1149
|
+
function wt(e) {
|
|
1094
1150
|
return {
|
|
1095
1151
|
type: "widgetSetChrome",
|
|
1096
1152
|
schemaVersion: 2,
|
|
1097
1153
|
payload: { mode: e }
|
|
1098
1154
|
};
|
|
1099
1155
|
}
|
|
1100
|
-
function
|
|
1156
|
+
function Tt() {
|
|
1101
1157
|
return {
|
|
1102
1158
|
type: "widgetToggleAudioSettings",
|
|
1103
1159
|
schemaVersion: 2,
|
|
1104
1160
|
payload: {}
|
|
1105
1161
|
};
|
|
1106
1162
|
}
|
|
1107
|
-
function
|
|
1163
|
+
function Et(e) {
|
|
1108
1164
|
return {
|
|
1109
1165
|
type: "setTheatre",
|
|
1110
1166
|
schemaVersion: 2,
|
|
@@ -1113,8 +1169,8 @@ function vt(e) {
|
|
|
1113
1169
|
}
|
|
1114
1170
|
//#endregion
|
|
1115
1171
|
//#region src/v2/embed/fullWindowHost.ts
|
|
1116
|
-
var
|
|
1117
|
-
function
|
|
1172
|
+
var Dt = "2147483000";
|
|
1173
|
+
function Ot(e) {
|
|
1118
1174
|
let { style: t } = e;
|
|
1119
1175
|
return {
|
|
1120
1176
|
position: t.position,
|
|
@@ -1132,11 +1188,11 @@ function bt(e) {
|
|
|
1132
1188
|
maxHeight: t.maxHeight
|
|
1133
1189
|
};
|
|
1134
1190
|
}
|
|
1135
|
-
function
|
|
1191
|
+
function kt(e) {
|
|
1136
1192
|
let { style: t } = e;
|
|
1137
|
-
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 =
|
|
1193
|
+
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 = Dt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
1138
1194
|
}
|
|
1139
|
-
function
|
|
1195
|
+
function At(e, t) {
|
|
1140
1196
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
1141
1197
|
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 = "";
|
|
1142
1198
|
return;
|
|
@@ -1146,20 +1202,20 @@ function St(e, t) {
|
|
|
1146
1202
|
}
|
|
1147
1203
|
//#endregion
|
|
1148
1204
|
//#region src/v2/embed/iframeHost.ts
|
|
1149
|
-
function
|
|
1205
|
+
function jt(e) {
|
|
1150
1206
|
return e;
|
|
1151
1207
|
}
|
|
1152
1208
|
function Z() {
|
|
1153
1209
|
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)}`;
|
|
1154
1210
|
}
|
|
1155
|
-
var
|
|
1156
|
-
function
|
|
1211
|
+
var Mt = 3e4;
|
|
1212
|
+
function Nt(e) {
|
|
1157
1213
|
let t = e.container;
|
|
1158
1214
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
1159
1215
|
let n = document.createElement("iframe");
|
|
1160
|
-
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), 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");
|
|
1216
|
+
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), 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"), n.setAttribute("fetchpriority", "high"), "fetchPriority" in n && (n.fetchPriority = "high");
|
|
1161
1217
|
let r = !1, i = !1, a = null, o = null, s = (r) => {
|
|
1162
|
-
i !== r && (i = r, r ? (a =
|
|
1218
|
+
i !== r && (i = r, r ? (a = Ot(n), o = document.body.style.overflow, document.body.append(n), kt(n), document.body.style.overflow = "hidden") : (t.append(n), At(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
|
|
1163
1219
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
1164
1220
|
p = e, m = t;
|
|
1165
1221
|
}), g = () => {
|
|
@@ -1170,10 +1226,10 @@ function Tt(e) {
|
|
|
1170
1226
|
let i = Date.now();
|
|
1171
1227
|
if (d > 0 && i - d < 250) return;
|
|
1172
1228
|
d = i, g();
|
|
1173
|
-
let a =
|
|
1229
|
+
let a = St(t.launch, t.session, t.chrome), o = () => {
|
|
1174
1230
|
if (r) return;
|
|
1175
1231
|
let t = n.contentWindow;
|
|
1176
|
-
t &&
|
|
1232
|
+
t && _t(t, a, e.playerOrigin);
|
|
1177
1233
|
};
|
|
1178
1234
|
o();
|
|
1179
1235
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -1181,17 +1237,17 @@ function Tt(e) {
|
|
|
1181
1237
|
r || !l || _(l);
|
|
1182
1238
|
}, y = () => {
|
|
1183
1239
|
if (u += 1, u === 1) {
|
|
1184
|
-
|
|
1240
|
+
gt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
1185
1241
|
return;
|
|
1186
1242
|
}
|
|
1187
1243
|
d = 0, v();
|
|
1188
1244
|
}, b = () => {
|
|
1189
|
-
u > 0 || m?.(Error(
|
|
1245
|
+
u > 0 || m?.(Error(ht(e.playerOrigin)));
|
|
1190
1246
|
};
|
|
1191
1247
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
1192
1248
|
let x = (t) => {
|
|
1193
1249
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
1194
|
-
let i =
|
|
1250
|
+
let i = xt(t.data);
|
|
1195
1251
|
if (i) switch (i.type) {
|
|
1196
1252
|
case "close":
|
|
1197
1253
|
e.onClose?.(i.payload);
|
|
@@ -1230,7 +1286,7 @@ function Tt(e) {
|
|
|
1230
1286
|
e.onUserSpeechEnded?.(i.payload);
|
|
1231
1287
|
break;
|
|
1232
1288
|
case "modeChange":
|
|
1233
|
-
e.onActivityChange?.(
|
|
1289
|
+
e.onActivityChange?.(jt(i.payload.mode));
|
|
1234
1290
|
break;
|
|
1235
1291
|
case "activityChange":
|
|
1236
1292
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -1289,8 +1345,8 @@ function Tt(e) {
|
|
|
1289
1345
|
let S = (t, i) => {
|
|
1290
1346
|
if (r) return;
|
|
1291
1347
|
let a = n.contentWindow;
|
|
1292
|
-
if (!a) throw Error(
|
|
1293
|
-
|
|
1348
|
+
if (!a) throw Error(ht(e.playerOrigin));
|
|
1349
|
+
_t(a, t, e.playerOrigin, i);
|
|
1294
1350
|
}, C = (e, t = 12e4, n) => {
|
|
1295
1351
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
|
|
1296
1352
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -1307,7 +1363,7 @@ function Tt(e) {
|
|
|
1307
1363
|
return h;
|
|
1308
1364
|
},
|
|
1309
1365
|
postParentHello() {
|
|
1310
|
-
S(
|
|
1366
|
+
S(Ct());
|
|
1311
1367
|
},
|
|
1312
1368
|
postLaunch(e, t, n) {
|
|
1313
1369
|
r || (l = {
|
|
@@ -1329,13 +1385,13 @@ function Tt(e) {
|
|
|
1329
1385
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
1330
1386
|
},
|
|
1331
1387
|
postWidgetSetChrome(e) {
|
|
1332
|
-
S(
|
|
1388
|
+
S(wt(e));
|
|
1333
1389
|
},
|
|
1334
1390
|
postWidgetToggleAudioSettings() {
|
|
1335
|
-
S(
|
|
1391
|
+
S(Tt());
|
|
1336
1392
|
},
|
|
1337
1393
|
postSetTheatre(e) {
|
|
1338
|
-
S(
|
|
1394
|
+
S(Et(e));
|
|
1339
1395
|
},
|
|
1340
1396
|
speak(e) {
|
|
1341
1397
|
return C({
|
|
@@ -1457,7 +1513,7 @@ function Tt(e) {
|
|
|
1457
1513
|
audio: e.audio,
|
|
1458
1514
|
byteLength: e.byteLength
|
|
1459
1515
|
}
|
|
1460
|
-
},
|
|
1516
|
+
}, Mt, [e.audio]);
|
|
1461
1517
|
},
|
|
1462
1518
|
speechUtteranceSetTranscript(e) {
|
|
1463
1519
|
return C({
|
|
@@ -1619,7 +1675,7 @@ function Tt(e) {
|
|
|
1619
1675
|
}
|
|
1620
1676
|
//#endregion
|
|
1621
1677
|
//#region src/v2/embed/readyGate.ts
|
|
1622
|
-
function
|
|
1678
|
+
function Pt(e) {
|
|
1623
1679
|
let t, n = !1, r = !1, i = () => {
|
|
1624
1680
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
1625
1681
|
};
|
|
@@ -1634,9 +1690,9 @@ function Et(e) {
|
|
|
1634
1690
|
}
|
|
1635
1691
|
//#endregion
|
|
1636
1692
|
//#region src/v2/sdkRelease.ts
|
|
1637
|
-
var
|
|
1693
|
+
var Ft = `sdk@${{
|
|
1638
1694
|
name: "@liforma/client",
|
|
1639
|
-
version: "0.4.
|
|
1695
|
+
version: "0.4.14",
|
|
1640
1696
|
type: "module",
|
|
1641
1697
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1642
1698
|
license: "MIT",
|
|
@@ -1797,6 +1853,8 @@ var Dt = `sdk@${{
|
|
|
1797
1853
|
"generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
|
|
1798
1854
|
"build:locations": "node scripts/build-locations.mjs",
|
|
1799
1855
|
"publish:locations": "node scripts/publish-locations.mjs",
|
|
1856
|
+
"publish:location-400x225": "node scripts/build-location-400x225.mjs",
|
|
1857
|
+
"test:location-400x225": "node scripts/test-location-400x225.mjs",
|
|
1800
1858
|
"verify:locations": "node scripts/verify-location-sources.mjs",
|
|
1801
1859
|
"publish:models": "node scripts/publish-models.mjs",
|
|
1802
1860
|
"publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
|
|
@@ -1826,6 +1884,7 @@ var Dt = `sdk@${{
|
|
|
1826
1884
|
"preview:test": "npm run build && npm run preview"
|
|
1827
1885
|
},
|
|
1828
1886
|
dependencies: {
|
|
1887
|
+
"@jsquash/avif": "^1.3.0",
|
|
1829
1888
|
"@jsquash/webp": "^1.5.0",
|
|
1830
1889
|
zod: "^4.4.3"
|
|
1831
1890
|
},
|
|
@@ -1855,50 +1914,54 @@ var Dt = `sdk@${{
|
|
|
1855
1914
|
vitest: "^4.1.10",
|
|
1856
1915
|
wrangler: "^4.101.0"
|
|
1857
1916
|
}
|
|
1858
|
-
}.version}`,
|
|
1859
|
-
function
|
|
1917
|
+
}.version}`, It = "https://player.liforma.ai/embed", Lt = "http://localhost:3002/embed";
|
|
1918
|
+
function Rt() {
|
|
1860
1919
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1861
1920
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1862
1921
|
if (typeof document > "u") return null;
|
|
1863
1922
|
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();
|
|
1864
1923
|
return t ? t.replace(/\/$/, "") : null;
|
|
1865
1924
|
}
|
|
1866
|
-
function
|
|
1867
|
-
let e =
|
|
1868
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
1925
|
+
function zt() {
|
|
1926
|
+
let e = Rt();
|
|
1927
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : te() ? Lt : It;
|
|
1869
1928
|
}
|
|
1870
|
-
function
|
|
1929
|
+
function Bt(e, t) {
|
|
1871
1930
|
return e?.trim() || t?.trim() || void 0;
|
|
1872
1931
|
}
|
|
1873
|
-
function
|
|
1874
|
-
let
|
|
1875
|
-
|
|
1876
|
-
let
|
|
1877
|
-
|
|
1932
|
+
function Vt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
1933
|
+
let p = (e ?? zt()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
|
|
1934
|
+
g && h.searchParams.set("backdropId", g);
|
|
1935
|
+
let _ = r?.trim();
|
|
1936
|
+
_ && h.searchParams.set("avatarId", _);
|
|
1937
|
+
let v = d?.trim();
|
|
1938
|
+
v && h.searchParams.set("previewBg", v);
|
|
1939
|
+
let y = f?.trim();
|
|
1940
|
+
return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), Ht(h.toString());
|
|
1878
1941
|
}
|
|
1879
|
-
function
|
|
1942
|
+
function Ht(e) {
|
|
1880
1943
|
if (typeof location > "u") return e;
|
|
1881
1944
|
let t = new URL(e);
|
|
1882
1945
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1883
1946
|
}
|
|
1884
|
-
function
|
|
1947
|
+
function Ut(e) {
|
|
1885
1948
|
return new URL(e).origin;
|
|
1886
1949
|
}
|
|
1887
1950
|
//#endregion
|
|
1888
1951
|
//#region src/v2/experienceEvents.ts
|
|
1889
|
-
function
|
|
1952
|
+
function Wt() {
|
|
1890
1953
|
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)}`;
|
|
1891
1954
|
}
|
|
1892
|
-
function
|
|
1955
|
+
function Gt(e, t, n) {
|
|
1893
1956
|
return {
|
|
1894
|
-
id:
|
|
1957
|
+
id: Wt(),
|
|
1895
1958
|
type: e,
|
|
1896
1959
|
sessionId: t,
|
|
1897
1960
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1898
1961
|
data: n
|
|
1899
1962
|
};
|
|
1900
1963
|
}
|
|
1901
|
-
function
|
|
1964
|
+
function Kt() {
|
|
1902
1965
|
return {
|
|
1903
1966
|
ready: /* @__PURE__ */ new Set(),
|
|
1904
1967
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1919,39 +1982,39 @@ function Rt() {
|
|
|
1919
1982
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1920
1983
|
};
|
|
1921
1984
|
}
|
|
1922
|
-
function
|
|
1985
|
+
function qt(e, t, n) {
|
|
1923
1986
|
return e[t].add(n), () => e[t].delete(n);
|
|
1924
1987
|
}
|
|
1925
|
-
function
|
|
1988
|
+
function Jt(e, t, n) {
|
|
1926
1989
|
for (let r of e[t]) r(n);
|
|
1927
1990
|
}
|
|
1928
|
-
function
|
|
1991
|
+
function Yt(e) {
|
|
1929
1992
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1930
1993
|
}
|
|
1931
1994
|
//#endregion
|
|
1932
1995
|
//#region src/v2/speech/types.ts
|
|
1933
|
-
function
|
|
1996
|
+
function Xt(e) {
|
|
1934
1997
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1935
1998
|
}
|
|
1936
|
-
function
|
|
1999
|
+
function Zt(e) {
|
|
1937
2000
|
return "url" in e && typeof e.url == "string";
|
|
1938
2001
|
}
|
|
1939
|
-
function
|
|
2002
|
+
function Qt(e) {
|
|
1940
2003
|
if (!("track" in e)) return !1;
|
|
1941
2004
|
let t = e.track;
|
|
1942
2005
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1943
2006
|
}
|
|
1944
|
-
function
|
|
1945
|
-
return !
|
|
2007
|
+
function $t(e) {
|
|
2008
|
+
return !Xt(e) && !Zt(e) && !Qt(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1946
2009
|
}
|
|
1947
|
-
var
|
|
2010
|
+
var en = [
|
|
1948
2011
|
8e3,
|
|
1949
2012
|
16e3,
|
|
1950
2013
|
22050,
|
|
1951
2014
|
24e3,
|
|
1952
2015
|
44100,
|
|
1953
2016
|
48e3
|
|
1954
|
-
],
|
|
2017
|
+
], tn = {
|
|
1955
2018
|
MAX_CHUNK_BYTES: 64 * 1024,
|
|
1956
2019
|
RECOMMENDED_CHUNK_MS_MIN: 20,
|
|
1957
2020
|
RECOMMENDED_CHUNK_MS_MAX: 200,
|
|
@@ -1962,14 +2025,14 @@ var Kt = [
|
|
|
1962
2025
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1963
2026
|
MAX_PENDING_WRITES: 8,
|
|
1964
2027
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1965
|
-
},
|
|
2028
|
+
}, nn = class extends Error {
|
|
1966
2029
|
operation;
|
|
1967
2030
|
requiredCapability;
|
|
1968
2031
|
name = "UnsupportedSpeechOperationError";
|
|
1969
2032
|
constructor(e, t) {
|
|
1970
2033
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1971
2034
|
}
|
|
1972
|
-
},
|
|
2035
|
+
}, rn = class extends Error {
|
|
1973
2036
|
name = "SpeechUtteranceClosedError";
|
|
1974
2037
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1975
2038
|
super(e);
|
|
@@ -1979,72 +2042,72 @@ var Kt = [
|
|
|
1979
2042
|
constructor(e, t) {
|
|
1980
2043
|
super(e, t);
|
|
1981
2044
|
}
|
|
1982
|
-
},
|
|
2045
|
+
}, an = class extends Error {
|
|
1983
2046
|
name = "SpeechBufferTimeoutError";
|
|
1984
2047
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1985
2048
|
super(e);
|
|
1986
2049
|
}
|
|
1987
2050
|
};
|
|
1988
|
-
function
|
|
2051
|
+
function on(e = "none") {
|
|
1989
2052
|
return {
|
|
1990
2053
|
mode: e,
|
|
1991
2054
|
trackedDurationMs: 0,
|
|
1992
2055
|
fallbackDurationMs: 0
|
|
1993
2056
|
};
|
|
1994
2057
|
}
|
|
1995
|
-
function
|
|
1996
|
-
return
|
|
2058
|
+
function sn(e) {
|
|
2059
|
+
return en.includes(e);
|
|
1997
2060
|
}
|
|
1998
|
-
function
|
|
2061
|
+
function cn(e) {
|
|
1999
2062
|
if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
|
|
2000
2063
|
if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
|
|
2001
|
-
if (!
|
|
2064
|
+
if (!sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2002
2065
|
}
|
|
2003
|
-
function
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
2066
|
+
function ln(e) {
|
|
2067
|
+
if (Xt(e)) {
|
|
2068
|
+
cn(e.format);
|
|
2006
2069
|
return;
|
|
2007
2070
|
}
|
|
2008
|
-
if (
|
|
2071
|
+
if (Zt(e)) {
|
|
2009
2072
|
if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
|
|
2010
|
-
if (e.sampleRate !== void 0 && !
|
|
2073
|
+
if (e.sampleRate !== void 0 && !sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2011
2074
|
return;
|
|
2012
2075
|
}
|
|
2013
|
-
if (
|
|
2076
|
+
if (Qt(e)) {
|
|
2014
2077
|
if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
2015
|
-
if (e.sampleRate !== void 0 && !
|
|
2078
|
+
if (e.sampleRate !== void 0 && !sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2016
2079
|
return;
|
|
2017
2080
|
}
|
|
2018
|
-
if (
|
|
2081
|
+
if ($t(e)) {
|
|
2019
2082
|
let t = e.encoding.trim().toLowerCase();
|
|
2020
2083
|
if (!t) throw new Q("Encoded audio MIME type is required.");
|
|
2021
2084
|
if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
2022
|
-
if (e.sampleRate !== void 0 && !
|
|
2085
|
+
if (e.sampleRate !== void 0 && !sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2023
2086
|
return;
|
|
2024
2087
|
}
|
|
2025
2088
|
throw new Q("Unsupported speech.play audio shape.");
|
|
2026
2089
|
}
|
|
2027
|
-
function
|
|
2028
|
-
if (e.format) return
|
|
2090
|
+
function un(e) {
|
|
2091
|
+
if (e.format) return cn(e.format), e.format;
|
|
2029
2092
|
if (e.track) {
|
|
2030
2093
|
let t = {
|
|
2031
2094
|
encoding: "pcm_s16le",
|
|
2032
2095
|
sampleRate: e.sampleRate ?? 24e3,
|
|
2033
2096
|
channels: 1
|
|
2034
2097
|
};
|
|
2035
|
-
return
|
|
2098
|
+
return cn(t), t;
|
|
2036
2099
|
}
|
|
2037
2100
|
throw new Q("createUtterance requires format or track.");
|
|
2038
2101
|
}
|
|
2039
|
-
function
|
|
2102
|
+
function dn(e) {
|
|
2040
2103
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2041
2104
|
}
|
|
2042
|
-
function
|
|
2105
|
+
function fn(e) {
|
|
2043
2106
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
2044
2107
|
}
|
|
2045
2108
|
//#endregion
|
|
2046
2109
|
//#region src/byo/pcm.ts
|
|
2047
|
-
function
|
|
2110
|
+
function pn(e) {
|
|
2048
2111
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
2049
2112
|
for (let t = 0; t < e.length; t++) {
|
|
2050
2113
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -2054,11 +2117,11 @@ function an(e) {
|
|
|
2054
2117
|
}
|
|
2055
2118
|
//#endregion
|
|
2056
2119
|
//#region src/byo/resample.ts
|
|
2057
|
-
function
|
|
2120
|
+
function mn(e, t, n, r, i) {
|
|
2058
2121
|
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;
|
|
2059
2122
|
return ((a * i + o) * i + s) * i + c;
|
|
2060
2123
|
}
|
|
2061
|
-
function
|
|
2124
|
+
function hn(e, t) {
|
|
2062
2125
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
2063
2126
|
if (e === t) return {
|
|
2064
2127
|
fromRate: e,
|
|
@@ -2081,7 +2144,7 @@ function sn(e, t) {
|
|
|
2081
2144
|
let a = [];
|
|
2082
2145
|
for (; i + 2 < r.length - 1;) {
|
|
2083
2146
|
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);
|
|
2084
|
-
a.push(
|
|
2147
|
+
a.push(mn(r[o], r[e], r[s], r[c], t)), i += n;
|
|
2085
2148
|
}
|
|
2086
2149
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
2087
2150
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -2093,7 +2156,7 @@ function sn(e, t) {
|
|
|
2093
2156
|
}
|
|
2094
2157
|
//#endregion
|
|
2095
2158
|
//#region src/byo/audioCapture.ts
|
|
2096
|
-
var
|
|
2159
|
+
var gn = "liforma-pcm-capture", _n = `
|
|
2097
2160
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
2098
2161
|
process(inputs) {
|
|
2099
2162
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -2105,29 +2168,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
2105
2168
|
return true;
|
|
2106
2169
|
}
|
|
2107
2170
|
}
|
|
2108
|
-
registerProcessor('${
|
|
2109
|
-
`,
|
|
2110
|
-
function
|
|
2111
|
-
return
|
|
2171
|
+
registerProcessor('${gn}', LiformaPcmCaptureProcessor);
|
|
2172
|
+
`, vn = null;
|
|
2173
|
+
function yn() {
|
|
2174
|
+
return vn ||= URL.createObjectURL(new Blob([_n], { type: "application/javascript" })), vn;
|
|
2112
2175
|
}
|
|
2113
|
-
function
|
|
2176
|
+
function bn() {
|
|
2114
2177
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
2115
2178
|
}
|
|
2116
|
-
async function
|
|
2117
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
2179
|
+
async function xn(e) {
|
|
2180
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = bn();
|
|
2118
2181
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
2119
2182
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
2120
2183
|
l.gain.value = 0;
|
|
2121
|
-
let u = s.sampleRate, d =
|
|
2184
|
+
let u = s.sampleRate, d = hn(u, n), f = !1, p = !1, m = (e) => {
|
|
2122
2185
|
if (f || i && !i()) return;
|
|
2123
2186
|
let t = d.push(e);
|
|
2124
|
-
t.length !== 0 && r(
|
|
2187
|
+
t.length !== 0 && r(pn(t));
|
|
2125
2188
|
}, h = () => void 0;
|
|
2126
2189
|
return await (async () => {
|
|
2127
2190
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
2128
2191
|
try {
|
|
2129
|
-
await s.audioWorklet.addModule(
|
|
2130
|
-
let e = new AudioWorkletNode(s,
|
|
2192
|
+
await s.audioWorklet.addModule(yn());
|
|
2193
|
+
let e = new AudioWorkletNode(s, gn, {
|
|
2131
2194
|
numberOfInputs: 1,
|
|
2132
2195
|
numberOfOutputs: 1,
|
|
2133
2196
|
outputChannelCount: [1]
|
|
@@ -2177,7 +2240,7 @@ async function pn(e) {
|
|
|
2177
2240
|
}
|
|
2178
2241
|
//#endregion
|
|
2179
2242
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
2180
|
-
async function
|
|
2243
|
+
async function Sn(e) {
|
|
2181
2244
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
2182
2245
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
|
|
2183
2246
|
if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -2186,18 +2249,18 @@ async function mn(e) {
|
|
|
2186
2249
|
s || (s = !0, c?.stop(), c = null);
|
|
2187
2250
|
};
|
|
2188
2251
|
try {
|
|
2189
|
-
c = await
|
|
2252
|
+
c = await xn({
|
|
2190
2253
|
mediaStream: a,
|
|
2191
2254
|
targetSampleRate: r,
|
|
2192
2255
|
shouldSend: () => !s && !i?.aborted,
|
|
2193
2256
|
onPcm: (e) => {
|
|
2194
2257
|
if (s || i?.aborted) return;
|
|
2195
|
-
let t =
|
|
2258
|
+
let t = dn(e);
|
|
2196
2259
|
o = o.then(async () => {
|
|
2197
2260
|
if (s || i?.aborted) return;
|
|
2198
2261
|
let e = 0;
|
|
2199
2262
|
for (; e < t.byteLength;) {
|
|
2200
|
-
let r = Math.min(e +
|
|
2263
|
+
let r = Math.min(e + tn.MAX_CHUNK_BYTES, t.byteLength);
|
|
2201
2264
|
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
2202
2265
|
let i = t.subarray(e, r);
|
|
2203
2266
|
e = r, i.byteLength !== 0 && await n.write(i);
|
|
@@ -2221,10 +2284,10 @@ async function mn(e) {
|
|
|
2221
2284
|
}
|
|
2222
2285
|
//#endregion
|
|
2223
2286
|
//#region src/v2/speech/speechController.ts
|
|
2224
|
-
async function
|
|
2225
|
-
if (
|
|
2226
|
-
if (
|
|
2227
|
-
let t =
|
|
2287
|
+
async function Cn(e, t) {
|
|
2288
|
+
if (Qt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
|
|
2289
|
+
if (Xt(e)) {
|
|
2290
|
+
let t = dn(e.data);
|
|
2228
2291
|
if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
|
|
2229
2292
|
return {
|
|
2230
2293
|
kind: "pcm",
|
|
@@ -2232,17 +2295,17 @@ async function hn(e, t) {
|
|
|
2232
2295
|
format: e.format
|
|
2233
2296
|
};
|
|
2234
2297
|
}
|
|
2235
|
-
if (
|
|
2298
|
+
if (Zt(e)) return {
|
|
2236
2299
|
kind: "url",
|
|
2237
2300
|
url: e.url.trim(),
|
|
2238
2301
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2239
2302
|
};
|
|
2240
|
-
if (
|
|
2303
|
+
if (!$t(e)) throw new Q("Unsupported speech.play audio shape.");
|
|
2241
2304
|
let n;
|
|
2242
2305
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
2243
2306
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2244
2307
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
2245
|
-
} else n =
|
|
2308
|
+
} else n = dn(e.data);
|
|
2246
2309
|
return {
|
|
2247
2310
|
kind: "encoded",
|
|
2248
2311
|
data: n.slice().buffer,
|
|
@@ -2250,10 +2313,10 @@ async function hn(e, t) {
|
|
|
2250
2313
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2251
2314
|
};
|
|
2252
2315
|
}
|
|
2253
|
-
function
|
|
2316
|
+
function wn() {
|
|
2254
2317
|
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)}`;
|
|
2255
2318
|
}
|
|
2256
|
-
function
|
|
2319
|
+
function Tn(e, t = "completed") {
|
|
2257
2320
|
return {
|
|
2258
2321
|
utteranceId: e.speechId,
|
|
2259
2322
|
characterId: e.characterId,
|
|
@@ -2267,13 +2330,13 @@ function _n(e, t = "completed") {
|
|
|
2267
2330
|
}
|
|
2268
2331
|
};
|
|
2269
2332
|
}
|
|
2270
|
-
function
|
|
2333
|
+
function En(e) {
|
|
2271
2334
|
return e instanceof Error ? e : new Q(String(e));
|
|
2272
2335
|
}
|
|
2273
|
-
function
|
|
2336
|
+
function Dn(e) {
|
|
2274
2337
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
2275
2338
|
}
|
|
2276
|
-
var
|
|
2339
|
+
var On = class {
|
|
2277
2340
|
id;
|
|
2278
2341
|
characterId;
|
|
2279
2342
|
result;
|
|
@@ -2302,29 +2365,29 @@ var bn = class {
|
|
|
2302
2365
|
queue: e.queue,
|
|
2303
2366
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
2304
2367
|
}).catch((e) => {
|
|
2305
|
-
throw this.fail(
|
|
2368
|
+
throw this.fail(En(e)), En(e);
|
|
2306
2369
|
}), this.signal?.addEventListener("abort", () => {
|
|
2307
2370
|
this.cancel();
|
|
2308
2371
|
}, { once: !0 });
|
|
2309
2372
|
}
|
|
2310
2373
|
async write(e, t) {
|
|
2311
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2312
|
-
let n =
|
|
2374
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new rn();
|
|
2375
|
+
let n = dn(e);
|
|
2313
2376
|
if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
|
|
2314
|
-
if (n.byteLength >
|
|
2377
|
+
if (n.byteLength > tn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${tn.MAX_CHUNK_BYTES}).`);
|
|
2315
2378
|
if (n.byteLength === 0) return;
|
|
2316
|
-
let r = t?.timeoutMs ??
|
|
2379
|
+
let r = t?.timeoutMs ?? tn.DEFAULT_WRITE_TIMEOUT_MS;
|
|
2317
2380
|
await this.acquireWriteSlot(r);
|
|
2318
2381
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
2319
|
-
if (this.bufferedMs + i >
|
|
2382
|
+
if (this.bufferedMs + i > tn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
2320
2383
|
let a = async () => {
|
|
2321
|
-
if (this.closed || this.settled) throw new
|
|
2384
|
+
if (this.closed || this.settled) throw new rn();
|
|
2322
2385
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
2323
2386
|
utteranceId: this.id,
|
|
2324
2387
|
audio: t.buffer,
|
|
2325
2388
|
byteLength: t.byteLength
|
|
2326
2389
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
2327
|
-
setTimeout(() => t(new
|
|
2390
|
+
setTimeout(() => t(new an()), r);
|
|
2328
2391
|
})]);
|
|
2329
2392
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
2330
2393
|
}, o = this.writeChain.then(a, a);
|
|
@@ -2336,7 +2399,7 @@ var bn = class {
|
|
|
2336
2399
|
}
|
|
2337
2400
|
}
|
|
2338
2401
|
async setTranscript(e) {
|
|
2339
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2402
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new rn();
|
|
2340
2403
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
2341
2404
|
utteranceId: this.id,
|
|
2342
2405
|
transcript: e
|
|
@@ -2353,7 +2416,7 @@ var bn = class {
|
|
|
2353
2416
|
});
|
|
2354
2417
|
return this.resolve(t), t;
|
|
2355
2418
|
} catch (e) {
|
|
2356
|
-
let t =
|
|
2419
|
+
let t = En(e);
|
|
2357
2420
|
throw this.fail(t), t;
|
|
2358
2421
|
}
|
|
2359
2422
|
}
|
|
@@ -2371,11 +2434,11 @@ var bn = class {
|
|
|
2371
2434
|
characterId: this.characterId,
|
|
2372
2435
|
status: "cancelled",
|
|
2373
2436
|
durationMs: 0,
|
|
2374
|
-
animation:
|
|
2437
|
+
animation: on("none")
|
|
2375
2438
|
};
|
|
2376
2439
|
return this.resolve(t), t;
|
|
2377
2440
|
} catch (e) {
|
|
2378
|
-
let t =
|
|
2441
|
+
let t = En(e);
|
|
2379
2442
|
throw this.fail(t), t;
|
|
2380
2443
|
}
|
|
2381
2444
|
}
|
|
@@ -2388,19 +2451,19 @@ var bn = class {
|
|
|
2388
2451
|
return e;
|
|
2389
2452
|
}
|
|
2390
2453
|
resolve(e) {
|
|
2391
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2454
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new rn()));
|
|
2392
2455
|
}
|
|
2393
2456
|
fail(e) {
|
|
2394
2457
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
2395
2458
|
}
|
|
2396
2459
|
async acquireWriteSlot(e) {
|
|
2397
|
-
if (this.pendingWriteCount <
|
|
2460
|
+
if (this.pendingWriteCount < tn.MAX_PENDING_WRITES) {
|
|
2398
2461
|
this.pendingWriteCount += 1;
|
|
2399
2462
|
return;
|
|
2400
2463
|
}
|
|
2401
2464
|
await new Promise((t, n) => {
|
|
2402
2465
|
let r = setTimeout(() => {
|
|
2403
|
-
n(new
|
|
2466
|
+
n(new an());
|
|
2404
2467
|
}, e);
|
|
2405
2468
|
this.pendingWriteWaiters.push({
|
|
2406
2469
|
resolve: () => {
|
|
@@ -2419,13 +2482,13 @@ var bn = class {
|
|
|
2419
2482
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2420
2483
|
}
|
|
2421
2484
|
};
|
|
2422
|
-
function
|
|
2485
|
+
function kn(e) {
|
|
2423
2486
|
let t = null, n = (t, n) => {
|
|
2424
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2487
|
+
if (!e.getCapabilities()[n]) throw new nn(t, n);
|
|
2425
2488
|
}, r = {
|
|
2426
2489
|
async speak(r) {
|
|
2427
2490
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2428
|
-
let i =
|
|
2491
|
+
let i = fn(r.queue ?? "append");
|
|
2429
2492
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2430
2493
|
let a = e.getIframeHost();
|
|
2431
2494
|
if (!a) throw new Q("Speech session is not attached.");
|
|
@@ -2445,41 +2508,41 @@ function xn(e) {
|
|
|
2445
2508
|
return;
|
|
2446
2509
|
}
|
|
2447
2510
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2448
|
-
t.removeEventListener("abort", s), n(
|
|
2511
|
+
t.removeEventListener("abort", s), n(Tn(e, "completed"));
|
|
2449
2512
|
}, (a) => {
|
|
2450
|
-
if (t.removeEventListener("abort", s),
|
|
2513
|
+
if (t.removeEventListener("abort", s), Dn(a)) {
|
|
2451
2514
|
n({
|
|
2452
2515
|
utteranceId: "utt_interrupted",
|
|
2453
2516
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2454
2517
|
status: "interrupted",
|
|
2455
2518
|
durationMs: 0,
|
|
2456
2519
|
transcript: r.text,
|
|
2457
|
-
animation:
|
|
2520
|
+
animation: on("none")
|
|
2458
2521
|
});
|
|
2459
2522
|
return;
|
|
2460
2523
|
}
|
|
2461
|
-
i(
|
|
2524
|
+
i(En(a));
|
|
2462
2525
|
});
|
|
2463
2526
|
});
|
|
2464
2527
|
}
|
|
2465
2528
|
try {
|
|
2466
|
-
return
|
|
2529
|
+
return Tn(await o, "completed");
|
|
2467
2530
|
} catch (t) {
|
|
2468
|
-
if (
|
|
2531
|
+
if (Dn(t)) return {
|
|
2469
2532
|
utteranceId: "utt_interrupted",
|
|
2470
2533
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2471
2534
|
status: "interrupted",
|
|
2472
2535
|
durationMs: 0,
|
|
2473
2536
|
transcript: r.text,
|
|
2474
|
-
animation:
|
|
2537
|
+
animation: on("none")
|
|
2475
2538
|
};
|
|
2476
|
-
throw
|
|
2539
|
+
throw En(t);
|
|
2477
2540
|
}
|
|
2478
2541
|
},
|
|
2479
2542
|
async play(i) {
|
|
2480
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2543
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), ln(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2481
2544
|
let a = i.queue ?? "append";
|
|
2482
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2545
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Qt(i.audio)) {
|
|
2483
2546
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2484
2547
|
return r.createUtterance({
|
|
2485
2548
|
format: {
|
|
@@ -2495,7 +2558,7 @@ function xn(e) {
|
|
|
2495
2558
|
}
|
|
2496
2559
|
let o = e.getIframeHost();
|
|
2497
2560
|
if (!o) throw new Q("Speech session is not attached.");
|
|
2498
|
-
let s = await
|
|
2561
|
+
let s = await Cn(i.audio, i.signal);
|
|
2499
2562
|
return o.speechPlay({
|
|
2500
2563
|
source: s,
|
|
2501
2564
|
characterId: i.characterId,
|
|
@@ -2507,13 +2570,13 @@ function xn(e) {
|
|
|
2507
2570
|
},
|
|
2508
2571
|
createUtterance(r) {
|
|
2509
2572
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2510
|
-
let i =
|
|
2573
|
+
let i = un(r);
|
|
2511
2574
|
if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
|
|
2512
2575
|
let a = r.queue ?? "replace-active";
|
|
2513
2576
|
if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
|
|
2514
2577
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2515
|
-
let o = new
|
|
2516
|
-
id:
|
|
2578
|
+
let o = new On({
|
|
2579
|
+
id: wn(),
|
|
2517
2580
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2518
2581
|
format: i,
|
|
2519
2582
|
queue: a,
|
|
@@ -2525,7 +2588,7 @@ function xn(e) {
|
|
|
2525
2588
|
t === o && (t = null);
|
|
2526
2589
|
}), r.track && (async () => {
|
|
2527
2590
|
try {
|
|
2528
|
-
if (await
|
|
2591
|
+
if (await Sn({
|
|
2529
2592
|
track: r.track,
|
|
2530
2593
|
utterance: o,
|
|
2531
2594
|
sampleRate: i.sampleRate,
|
|
@@ -2553,16 +2616,16 @@ function xn(e) {
|
|
|
2553
2616
|
}
|
|
2554
2617
|
//#endregion
|
|
2555
2618
|
//#region src/v2/types/sessionInteraction.ts
|
|
2556
|
-
function
|
|
2619
|
+
function An(e) {
|
|
2557
2620
|
let t = e?.trim();
|
|
2558
2621
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
2559
2622
|
}
|
|
2560
2623
|
//#endregion
|
|
2561
2624
|
//#region src/v2/experience.ts
|
|
2562
|
-
function
|
|
2625
|
+
function jn(e) {
|
|
2563
2626
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
2564
2627
|
}
|
|
2565
|
-
var
|
|
2628
|
+
var Mn = class e {
|
|
2566
2629
|
bootstrap;
|
|
2567
2630
|
conversationProcessor;
|
|
2568
2631
|
iframeHost = null;
|
|
@@ -2582,17 +2645,17 @@ var wn = class e {
|
|
|
2582
2645
|
pendingTheatre = null;
|
|
2583
2646
|
lastInteraction = null;
|
|
2584
2647
|
closeHandlers = [];
|
|
2585
|
-
eventRegistry =
|
|
2648
|
+
eventRegistry = Kt();
|
|
2586
2649
|
readyEnvelope = null;
|
|
2587
2650
|
startedEnvelope = null;
|
|
2588
2651
|
sessionMintedEnvelope = null;
|
|
2589
2652
|
conversationCache = [];
|
|
2590
2653
|
speech;
|
|
2591
2654
|
constructor(e) {
|
|
2592
|
-
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 =
|
|
2655
|
+
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 = kn({
|
|
2593
2656
|
getIframeHost: () => this.iframeHost,
|
|
2594
2657
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
2595
|
-
getCapabilities: () =>
|
|
2658
|
+
getCapabilities: () => Nn(this.resolvedSession),
|
|
2596
2659
|
getActiveCharacterId: () => "character_unknown",
|
|
2597
2660
|
onProcessorInterrupt: () => {
|
|
2598
2661
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -2613,6 +2676,8 @@ var wn = class e {
|
|
|
2613
2676
|
embedBaseUrl: t.embedBaseUrl,
|
|
2614
2677
|
debug: t.debug,
|
|
2615
2678
|
speechOnly: t.speechOnly,
|
|
2679
|
+
previewBackground: t.previewBackground,
|
|
2680
|
+
previewForeground: t.previewForeground,
|
|
2616
2681
|
ui: t.ui,
|
|
2617
2682
|
onStart: t.onStart,
|
|
2618
2683
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2636,6 +2701,8 @@ var wn = class e {
|
|
|
2636
2701
|
mode: t.mode,
|
|
2637
2702
|
speechInputMode: t.speechInputMode,
|
|
2638
2703
|
speechOnly: t.speechOnly,
|
|
2704
|
+
previewBackground: t.previewBackground,
|
|
2705
|
+
previewForeground: t.previewForeground,
|
|
2639
2706
|
attribution: t.attribution,
|
|
2640
2707
|
alreadyConverted: t.alreadyConverted,
|
|
2641
2708
|
ui: t.ui,
|
|
@@ -2659,6 +2726,8 @@ var wn = class e {
|
|
|
2659
2726
|
mode: t.mode,
|
|
2660
2727
|
speechInputMode: t.speechInputMode,
|
|
2661
2728
|
speechOnly: t.speechOnly,
|
|
2729
|
+
previewBackground: t.previewBackground,
|
|
2730
|
+
previewForeground: t.previewForeground,
|
|
2662
2731
|
attribution: t.attribution,
|
|
2663
2732
|
alreadyConverted: t.alreadyConverted,
|
|
2664
2733
|
ui: t.ui,
|
|
@@ -2675,7 +2744,7 @@ var wn = class e {
|
|
|
2675
2744
|
return null;
|
|
2676
2745
|
}
|
|
2677
2746
|
on(e, t) {
|
|
2678
|
-
let n =
|
|
2747
|
+
let n = qt(this.eventRegistry, e, t);
|
|
2679
2748
|
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;
|
|
2680
2749
|
}
|
|
2681
2750
|
async attach(e) {
|
|
@@ -2689,13 +2758,13 @@ var wn = class e {
|
|
|
2689
2758
|
if (this.closed) throw Error("Session has ended.");
|
|
2690
2759
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2691
2760
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2692
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2761
|
+
let t = this.bootstrap.embedBaseUrl ?? zt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Vt(t, n, r ? void 0 : Bt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, jn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = Ut(i), o = null, s = new Promise((e) => {
|
|
2693
2762
|
o = e;
|
|
2694
2763
|
}), c = null, l = new Promise((e) => {
|
|
2695
2764
|
c = e;
|
|
2696
|
-
}), u =
|
|
2765
|
+
}), u = Pt((e) => {
|
|
2697
2766
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
2698
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
2767
|
+
}), d = this.bootstrap.onUserTranscript, f = Nt({
|
|
2699
2768
|
container: e.container,
|
|
2700
2769
|
src: i,
|
|
2701
2770
|
playerOrigin: a,
|
|
@@ -2762,7 +2831,7 @@ var wn = class e {
|
|
|
2762
2831
|
onTheatreChange: (t) => e.onTheatreChange?.(t)
|
|
2763
2832
|
});
|
|
2764
2833
|
this.iframeHost = f;
|
|
2765
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
2834
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ut(this.bootstrap.sessionEndpoint, {
|
|
2766
2835
|
experienceId: this.bootstrap.experienceId,
|
|
2767
2836
|
locale: this.bootstrap.locale,
|
|
2768
2837
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -2774,7 +2843,7 @@ var wn = class e {
|
|
|
2774
2843
|
attribution: this.bootstrap.attribution,
|
|
2775
2844
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2776
2845
|
signal: this.endpointAbortController.signal
|
|
2777
|
-
})) : this.bootstrap.kind === "public" ?
|
|
2846
|
+
})) : this.bootstrap.kind === "public" ? lt(this.bootstrap.experienceId, {
|
|
2778
2847
|
locale: this.bootstrap.locale,
|
|
2779
2848
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
2780
2849
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -2798,7 +2867,7 @@ var wn = class e {
|
|
|
2798
2867
|
operation: "attach",
|
|
2799
2868
|
message: e instanceof Error ? e.message : String(e),
|
|
2800
2869
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2801
|
-
release:
|
|
2870
|
+
release: Ft
|
|
2802
2871
|
});
|
|
2803
2872
|
} catch {}
|
|
2804
2873
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -2810,7 +2879,7 @@ var wn = class e {
|
|
|
2810
2879
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2811
2880
|
this.launchToken = g;
|
|
2812
2881
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2813
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
2882
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && tt(_), f.postLaunch(g, _, {
|
|
2814
2883
|
startButton: e.startButton,
|
|
2815
2884
|
theme: e.theme,
|
|
2816
2885
|
showFeedback: e.showFeedback,
|
|
@@ -2834,7 +2903,7 @@ var wn = class e {
|
|
|
2834
2903
|
operation: "attach",
|
|
2835
2904
|
message: e instanceof Error ? e.message : String(e),
|
|
2836
2905
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2837
|
-
release:
|
|
2906
|
+
release: Ft
|
|
2838
2907
|
});
|
|
2839
2908
|
} catch {}
|
|
2840
2909
|
throw e;
|
|
@@ -2848,7 +2917,7 @@ var wn = class e {
|
|
|
2848
2917
|
operation: "attach",
|
|
2849
2918
|
message: e instanceof Error ? e.message : String(e),
|
|
2850
2919
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2851
|
-
release:
|
|
2920
|
+
release: Ft
|
|
2852
2921
|
});
|
|
2853
2922
|
} catch {}
|
|
2854
2923
|
throw e;
|
|
@@ -2880,7 +2949,7 @@ var wn = class e {
|
|
|
2880
2949
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2881
2950
|
}
|
|
2882
2951
|
async setFit(e) {
|
|
2883
|
-
let t =
|
|
2952
|
+
let t = An(e);
|
|
2884
2953
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2885
2954
|
if (this.closed) throw Error("Session has ended.");
|
|
2886
2955
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
@@ -2930,7 +2999,7 @@ var wn = class e {
|
|
|
2930
2999
|
this.close();
|
|
2931
3000
|
}
|
|
2932
3001
|
destroy() {
|
|
2933
|
-
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,
|
|
3002
|
+
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, Yt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
2934
3003
|
}
|
|
2935
3004
|
resolveMintInteraction() {
|
|
2936
3005
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2942,8 +3011,8 @@ var wn = class e {
|
|
|
2942
3011
|
return this.resolvedSession?.id ?? "";
|
|
2943
3012
|
}
|
|
2944
3013
|
emitWrapped(e, t) {
|
|
2945
|
-
let n =
|
|
2946
|
-
return
|
|
3014
|
+
let n = Gt(e, this.getSessionId(), t);
|
|
3015
|
+
return Jt(this.eventRegistry, e, n), n;
|
|
2947
3016
|
}
|
|
2948
3017
|
queueProcessorTurn(e) {
|
|
2949
3018
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2952,7 +3021,7 @@ var wn = class e {
|
|
|
2952
3021
|
let n = this.processorAbortController.signal;
|
|
2953
3022
|
this.processorChain = this.processorChain.then(async () => {
|
|
2954
3023
|
if (!n.aborted) try {
|
|
2955
|
-
let r = await
|
|
3024
|
+
let r = await pt(t, {
|
|
2956
3025
|
utteranceId: e.utteranceId,
|
|
2957
3026
|
text: e.text,
|
|
2958
3027
|
conversation: this.conversationCache,
|
|
@@ -3002,7 +3071,7 @@ var wn = class e {
|
|
|
3002
3071
|
};
|
|
3003
3072
|
}
|
|
3004
3073
|
};
|
|
3005
|
-
function
|
|
3074
|
+
function Nn(e) {
|
|
3006
3075
|
return e ? {
|
|
3007
3076
|
textSpeech: e.capabilities.speech.output,
|
|
3008
3077
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -3013,41 +3082,41 @@ function Tn(e) {
|
|
|
3013
3082
|
}
|
|
3014
3083
|
//#endregion
|
|
3015
3084
|
//#region src/widget/dockGeometry.ts
|
|
3016
|
-
var
|
|
3017
|
-
function
|
|
3085
|
+
var Pn = "(min-width: 768px)", Fn = 24, In = .5, Ln = 1200, Rn = .85, zn = 9 / 16;
|
|
3086
|
+
function Bn() {
|
|
3018
3087
|
if (typeof window > "u") return 800;
|
|
3019
3088
|
let e = window.screen?.availHeight;
|
|
3020
3089
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
3021
3090
|
}
|
|
3022
|
-
function
|
|
3023
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
3024
|
-
return s > a && (s = a, o = s /
|
|
3091
|
+
function Vn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Fn, r = typeof window < "u" ? Bn() : 800) {
|
|
3092
|
+
let i = Math.max(160, Math.min(t - n * 2, t * Rn)), a = Math.max(120, e - n * 2), o = Math.min(r * In, Ln, i), s = o * zn;
|
|
3093
|
+
return s > a && (s = a, o = s / zn, o > i && (o = i, s = o * zn)), {
|
|
3025
3094
|
width: Math.round(s),
|
|
3026
3095
|
height: Math.round(o)
|
|
3027
3096
|
};
|
|
3028
3097
|
}
|
|
3029
|
-
function
|
|
3098
|
+
function Hn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Fn) {
|
|
3030
3099
|
return {
|
|
3031
3100
|
left: Math.max(r, t - e.width - r),
|
|
3032
3101
|
top: Math.max(r, n - e.height - r)
|
|
3033
3102
|
};
|
|
3034
3103
|
}
|
|
3035
|
-
function
|
|
3104
|
+
function Un(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Fn) {
|
|
3036
3105
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
3037
3106
|
return {
|
|
3038
3107
|
left: Math.min(Math.max(a, e), o),
|
|
3039
3108
|
top: Math.min(Math.max(a, t), s)
|
|
3040
3109
|
};
|
|
3041
3110
|
}
|
|
3042
|
-
function
|
|
3043
|
-
return e(
|
|
3111
|
+
function Wn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
3112
|
+
return e(Pn).matches;
|
|
3044
3113
|
}
|
|
3045
3114
|
//#endregion
|
|
3046
3115
|
//#region src/widget/mountExperienceWidget.ts
|
|
3047
|
-
function
|
|
3116
|
+
function Gn(e) {
|
|
3048
3117
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
3049
3118
|
}
|
|
3050
|
-
function
|
|
3119
|
+
function Kn(e) {
|
|
3051
3120
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
3052
3121
|
let t = typeof e == "string" ? e.trim() : "";
|
|
3053
3122
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -3055,10 +3124,10 @@ function Rn(e) {
|
|
|
3055
3124
|
function $(e) {
|
|
3056
3125
|
return e === "expanded" || e === "docked";
|
|
3057
3126
|
}
|
|
3058
|
-
var
|
|
3059
|
-
function
|
|
3060
|
-
|
|
3061
|
-
let r =
|
|
3127
|
+
var qn = "<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>", Jn = "<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>", 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=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></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=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
|
|
3128
|
+
function Zn(e, t, n) {
|
|
3129
|
+
xe(ye);
|
|
3130
|
+
let r = F({
|
|
3062
3131
|
galleryThumb: t.galleryThumb,
|
|
3063
3132
|
avatarImage: t.avatarImage,
|
|
3064
3133
|
backgroundImage: t.backgroundImage,
|
|
@@ -3084,9 +3153,9 @@ function Un(e, t, n) {
|
|
|
3084
3153
|
let e = document.createElement("img");
|
|
3085
3154
|
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);
|
|
3086
3155
|
}
|
|
3087
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
3156
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ve(i);
|
|
3088
3157
|
}
|
|
3089
|
-
function
|
|
3158
|
+
function Qn(e) {
|
|
3090
3159
|
return e.startButton ? {
|
|
3091
3160
|
...e.startButton,
|
|
3092
3161
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -3098,7 +3167,7 @@ function Wn(e) {
|
|
|
3098
3167
|
variant: "primary"
|
|
3099
3168
|
};
|
|
3100
3169
|
}
|
|
3101
|
-
function
|
|
3170
|
+
function $n(e) {
|
|
3102
3171
|
let t = !1, n = () => {
|
|
3103
3172
|
t || e();
|
|
3104
3173
|
}, r = () => {
|
|
@@ -3118,12 +3187,12 @@ function Gn(e) {
|
|
|
3118
3187
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
3119
3188
|
};
|
|
3120
3189
|
}
|
|
3121
|
-
function
|
|
3122
|
-
|
|
3190
|
+
function er(e, t) {
|
|
3191
|
+
Pe(Me);
|
|
3123
3192
|
let n = t.experienceId?.trim();
|
|
3124
3193
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
3125
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
3126
|
-
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",
|
|
3194
|
+
let r = t.prefetch ?? "onExpand", i = Gn(t.position), a = document.createElement("div");
|
|
3195
|
+
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", Kn(t.offset));
|
|
3127
3196
|
let o = document.createElement("button");
|
|
3128
3197
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
3129
3198
|
let s = document.createElement("div");
|
|
@@ -3143,74 +3212,74 @@ function Kn(e, t) {
|
|
|
3143
3212
|
let m = document.createElement("span");
|
|
3144
3213
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
3145
3214
|
let h = document.createElement("button");
|
|
3146
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
3215
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Yn, h.setAttribute("aria-label", "Reduce");
|
|
3147
3216
|
let g = document.createElement("button");
|
|
3148
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
3217
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = qn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
3149
3218
|
let _ = document.createElement("button");
|
|
3150
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
3219
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Jn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
3151
3220
|
let v = document.createElement("div");
|
|
3152
3221
|
v.className = "liforma-ew__stage";
|
|
3153
3222
|
let y = document.createElement("div");
|
|
3154
3223
|
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);
|
|
3155
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null,
|
|
3224
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, ee = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
|
|
3156
3225
|
let e = a.dataset.state;
|
|
3157
3226
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
3158
|
-
}, R = () => {
|
|
3159
|
-
ee !== null && (clearTimeout(ee), ee = null);
|
|
3160
3227
|
}, z = () => {
|
|
3161
|
-
|
|
3162
|
-
},
|
|
3228
|
+
M !== null && (clearTimeout(M), M = null);
|
|
3229
|
+
}, B = () => {
|
|
3230
|
+
ee !== null && (clearTimeout(ee), ee = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3231
|
+
}, ae = () => {
|
|
3163
3232
|
for (let e of [
|
|
3164
3233
|
f,
|
|
3165
3234
|
l,
|
|
3166
3235
|
p
|
|
3167
3236
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
3168
3237
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
3169
|
-
},
|
|
3238
|
+
}, oe = (e, t, n, r) => {
|
|
3170
3239
|
let i = (i) => {
|
|
3171
3240
|
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";
|
|
3172
3241
|
};
|
|
3173
3242
|
i(f), i(l);
|
|
3174
3243
|
let a = p.offsetWidth || 120;
|
|
3175
3244
|
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";
|
|
3245
|
+
}, se = (e, t) => {
|
|
3246
|
+
if (R() !== "docked") return;
|
|
3247
|
+
let n = Vn(), r = Un(e - te, t - I, n);
|
|
3248
|
+
N = r.left, P = r.top, oe(r.left, r.top, n.width, n.height);
|
|
3176
3249
|
}, ce = (e, t) => {
|
|
3177
|
-
if (
|
|
3178
|
-
let n =
|
|
3179
|
-
|
|
3180
|
-
}, le = (e
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
},
|
|
3187
|
-
if (
|
|
3188
|
-
|
|
3189
|
-
P = null, I = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && re && (re = !1, window.removeEventListener("pointermove", ue), window.removeEventListener("pointerup", B), window.removeEventListener("pointercancel", B));
|
|
3190
|
-
}, de = (e, t, n) => {
|
|
3191
|
-
if (S || L() !== "docked" || !In() || P !== null) return;
|
|
3192
|
-
P = n, I = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3250
|
+
if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
3251
|
+
let n = Vn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Un(r + e, i + t, n);
|
|
3252
|
+
N = a.left, P = a.top, oe(a.left, a.top, n.width, n.height);
|
|
3253
|
+
}, le = (e) => {
|
|
3254
|
+
L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), se(e.clientX, e.clientY)));
|
|
3255
|
+
}, V = (e) => {
|
|
3256
|
+
if (F === null || e && e.pointerId !== F) return;
|
|
3257
|
+
let t = L;
|
|
3258
|
+
F = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && ne && (ne = !1, window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
3259
|
+
}, ue = (e, t, n) => {
|
|
3260
|
+
if (S || R() !== "docked" || !Wn() || F !== null) return;
|
|
3261
|
+
F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3193
3262
|
let r = f.getBoundingClientRect();
|
|
3194
|
-
|
|
3195
|
-
},
|
|
3196
|
-
if (S ||
|
|
3197
|
-
|
|
3263
|
+
te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", le), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
3264
|
+
}, de = (e) => {
|
|
3265
|
+
if (S || R() !== "docked" || !Wn() || F !== null) return;
|
|
3266
|
+
F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3198
3267
|
let t = f.getBoundingClientRect();
|
|
3199
|
-
|
|
3268
|
+
N = t.left, P = t.top;
|
|
3269
|
+
}, fe = (e) => {
|
|
3270
|
+
L === "player" && (F === null || e.pointerId !== F || ce(e.dx, e.dy));
|
|
3200
3271
|
}, pe = (e) => {
|
|
3201
|
-
|
|
3202
|
-
},
|
|
3203
|
-
|
|
3204
|
-
}, V = () => {
|
|
3205
|
-
let e = In(), t = L();
|
|
3272
|
+
L === "player" && (F === null || e.pointerId !== F || V());
|
|
3273
|
+
}, H = () => {
|
|
3274
|
+
let e = Wn(), t = R();
|
|
3206
3275
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
3207
3276
|
h.hidden = !0;
|
|
3208
3277
|
return;
|
|
3209
3278
|
}
|
|
3210
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
3211
|
-
},
|
|
3212
|
-
let t =
|
|
3213
|
-
n =
|
|
3279
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = Xn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Yn, h.setAttribute("aria-label", "Reduce"));
|
|
3280
|
+
}, me = (e) => {
|
|
3281
|
+
let t = Vn(), n = e && N !== null && P !== null ? Un(N, P, t) : Hn(t);
|
|
3282
|
+
n = Un(n.left, n.top, t), N = n.left, P = n.top, oe(n.left, n.top, t.width, t.height), H();
|
|
3214
3283
|
}, U = () => {
|
|
3215
3284
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
3216
3285
|
requestAnimationFrame(() => {
|
|
@@ -3218,63 +3287,63 @@ function Kn(e, t) {
|
|
|
3218
3287
|
});
|
|
3219
3288
|
});
|
|
3220
3289
|
}, W = (e) => {
|
|
3221
|
-
if (
|
|
3290
|
+
if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
3222
3291
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3223
3292
|
return;
|
|
3224
3293
|
}
|
|
3225
|
-
|
|
3226
|
-
if (
|
|
3294
|
+
ee = setTimeout(() => {
|
|
3295
|
+
if (ee = null, S || !$(a.dataset.state)) {
|
|
3227
3296
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3228
3297
|
return;
|
|
3229
3298
|
}
|
|
3230
3299
|
a.classList.remove("liforma-ew--layout-settling"), U();
|
|
3231
3300
|
}, 220);
|
|
3232
3301
|
}, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
3233
|
-
|
|
3234
|
-
|
|
3302
|
+
z(), M = setTimeout(() => {
|
|
3303
|
+
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
3235
3304
|
}, 280);
|
|
3236
|
-
})),
|
|
3305
|
+
})), G = {
|
|
3237
3306
|
galleryThumb: t.galleryThumb,
|
|
3238
3307
|
avatarImage: t.avatarImage,
|
|
3239
3308
|
backgroundImage: t.backgroundImage,
|
|
3240
3309
|
foregroundImage: t.foregroundImage,
|
|
3241
3310
|
fallbackImage: t.fallbackImage
|
|
3242
|
-
},
|
|
3311
|
+
}, K = (e) => {
|
|
3243
3312
|
if (!e) {
|
|
3244
3313
|
y.hidden = !0, y.textContent = "";
|
|
3245
3314
|
return;
|
|
3246
3315
|
}
|
|
3247
3316
|
y.hidden = !1, y.textContent = e;
|
|
3248
|
-
},
|
|
3317
|
+
}, ge = (e) => {
|
|
3249
3318
|
if (!e) {
|
|
3250
3319
|
c.hidden = !0, c.textContent = "";
|
|
3251
3320
|
return;
|
|
3252
3321
|
}
|
|
3253
3322
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
3323
|
+
}, _e = () => {
|
|
3324
|
+
C = !0, o.disabled = !1, ge(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3254
3325
|
}, ve = () => {
|
|
3255
|
-
C = !0, o.disabled = !1, _e(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3256
|
-
}, ye = () => {
|
|
3257
3326
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
3258
|
-
},
|
|
3327
|
+
}, ye = (e) => {
|
|
3259
3328
|
A?.(), A = null;
|
|
3260
|
-
let t =
|
|
3329
|
+
let t = Zn(s, e, { parallax: ie });
|
|
3261
3330
|
return t ? (A = t, !0) : !1;
|
|
3262
|
-
},
|
|
3263
|
-
if (
|
|
3264
|
-
|
|
3331
|
+
}, be = () => {
|
|
3332
|
+
if (ye(G)) {
|
|
3333
|
+
_e();
|
|
3265
3334
|
return;
|
|
3266
3335
|
}
|
|
3267
|
-
|
|
3336
|
+
ge("Loading…"), ze(n, { signal: re.signal }).then((e) => {
|
|
3268
3337
|
if (!S) {
|
|
3269
|
-
if (!
|
|
3270
|
-
|
|
3338
|
+
if (!ye({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
3339
|
+
_e();
|
|
3271
3340
|
}
|
|
3272
3341
|
}).catch((e) => {
|
|
3273
|
-
if (S ||
|
|
3342
|
+
if (S || re.signal.aborted) return;
|
|
3274
3343
|
let n = e instanceof Error ? e : Error(String(e));
|
|
3275
|
-
|
|
3344
|
+
ge("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
3276
3345
|
});
|
|
3277
|
-
},
|
|
3346
|
+
}, xe = () => ({
|
|
3278
3347
|
experienceId: n,
|
|
3279
3348
|
ui: "widget",
|
|
3280
3349
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
@@ -3287,89 +3356,89 @@ function Kn(e, t) {
|
|
|
3287
3356
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
3288
3357
|
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
3289
3358
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
3290
|
-
}),
|
|
3359
|
+
}), Se = () => ({
|
|
3291
3360
|
...t.fit ? { fit: t.fit } : {},
|
|
3292
|
-
startButton:
|
|
3361
|
+
startButton: Qn(t),
|
|
3293
3362
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
3294
3363
|
...t.interaction ? { interaction: t.interaction } : {}
|
|
3295
|
-
}),
|
|
3296
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
3297
|
-
},
|
|
3298
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
3299
|
-
},
|
|
3364
|
+
}), Ce = (e = !0) => {
|
|
3365
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
|
|
3366
|
+
}, we = () => {
|
|
3367
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", K(null), typeof document < "u" && (document.body.style.overflow = k), me(!0), H(), b?.setWidgetChrome("docked");
|
|
3368
|
+
}, Te = (e) => {
|
|
3300
3369
|
e.on("started", () => {
|
|
3301
|
-
S || (D = !0, a.dataset.live = "true",
|
|
3370
|
+
S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && U());
|
|
3302
3371
|
}), e.on("feedback", (e) => {
|
|
3303
3372
|
S || t.onFeedback?.(e);
|
|
3304
3373
|
}), e.on("feedbackFailed", (e) => {
|
|
3305
3374
|
S || t.onFeedbackFailed?.(e);
|
|
3306
3375
|
});
|
|
3307
|
-
},
|
|
3308
|
-
|
|
3309
|
-
},
|
|
3310
|
-
|
|
3376
|
+
}, Ee = () => {
|
|
3377
|
+
B(), 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), K(null), typeof document < "u" && (document.body.style.overflow = k), H();
|
|
3378
|
+
}, De = () => {
|
|
3379
|
+
z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3311
3380
|
let e = b;
|
|
3312
3381
|
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");
|
|
3313
|
-
},
|
|
3382
|
+
}, Oe = () => {
|
|
3314
3383
|
if (!S && $(a.dataset.state)) {
|
|
3315
|
-
if (
|
|
3384
|
+
if (V(), x = !1, b && E) {
|
|
3316
3385
|
let e = b;
|
|
3317
3386
|
(async () => {
|
|
3318
|
-
D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"),
|
|
3387
|
+
D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Ee(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && ve(), t.onCollapsed?.(), t.onClose?.());
|
|
3319
3388
|
})();
|
|
3320
3389
|
return;
|
|
3321
3390
|
}
|
|
3322
|
-
|
|
3391
|
+
De(), Ee(), t.onCollapsed?.(), t.onClose?.();
|
|
3323
3392
|
}
|
|
3324
|
-
},
|
|
3325
|
-
S ||
|
|
3326
|
-
|
|
3393
|
+
}, ke = () => {
|
|
3394
|
+
S || Wn() && R() === "expanded" && W(() => {
|
|
3395
|
+
we();
|
|
3327
3396
|
});
|
|
3328
|
-
},
|
|
3329
|
-
S ||
|
|
3330
|
-
|
|
3397
|
+
}, Ae = () => {
|
|
3398
|
+
S || R() === "docked" && (V(), W(() => {
|
|
3399
|
+
ae(), Ce(!1), b?.setWidgetChrome("expanded");
|
|
3331
3400
|
}));
|
|
3401
|
+
}, je = () => {
|
|
3402
|
+
!b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, U());
|
|
3332
3403
|
}, Ne = () => {
|
|
3333
|
-
!b || !D || (
|
|
3334
|
-
}, Pe = () => {
|
|
3335
|
-
!b || !E || D || (R(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3404
|
+
!b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3336
3405
|
}, Fe = (e) => {
|
|
3337
|
-
S || e !== O && !D || (
|
|
3338
|
-
},
|
|
3406
|
+
S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && U());
|
|
3407
|
+
}, q = () => {
|
|
3339
3408
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
3340
3409
|
T = !0;
|
|
3341
3410
|
let e = O;
|
|
3342
3411
|
l.hidden = !1, (async () => {
|
|
3343
3412
|
try {
|
|
3344
|
-
let t = await
|
|
3413
|
+
let t = await Mn.startSession(xe());
|
|
3345
3414
|
if (S || e !== O) {
|
|
3346
3415
|
t.destroy();
|
|
3347
3416
|
return;
|
|
3348
3417
|
}
|
|
3349
|
-
b = t,
|
|
3418
|
+
b = t, Te(t);
|
|
3350
3419
|
let n = await t.attach({
|
|
3351
3420
|
container: l,
|
|
3352
|
-
...
|
|
3421
|
+
...Se(),
|
|
3353
3422
|
onWidgetReady: () => {
|
|
3354
|
-
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") :
|
|
3423
|
+
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ve());
|
|
3355
3424
|
},
|
|
3356
3425
|
onWidgetExpand: () => {
|
|
3357
3426
|
Fe(e);
|
|
3358
3427
|
},
|
|
3359
3428
|
onWidgetAudioSettings: (e) => {
|
|
3360
|
-
S ||
|
|
3429
|
+
S || J(e);
|
|
3361
3430
|
},
|
|
3362
3431
|
onWidgetDragStart: (e) => {
|
|
3363
|
-
S ||
|
|
3432
|
+
S || de(e);
|
|
3364
3433
|
},
|
|
3365
3434
|
onWidgetDragMove: (e) => {
|
|
3366
|
-
S ||
|
|
3435
|
+
S || fe(e);
|
|
3367
3436
|
},
|
|
3368
3437
|
onWidgetDragEnd: (e) => {
|
|
3369
|
-
S ||
|
|
3438
|
+
S || pe(e);
|
|
3370
3439
|
},
|
|
3371
3440
|
onPlayerStatusChange: (e) => {
|
|
3372
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3441
|
+
S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
|
|
3373
3442
|
}
|
|
3374
3443
|
});
|
|
3375
3444
|
if (S || e !== O) {
|
|
@@ -3377,7 +3446,7 @@ function Kn(e, t) {
|
|
|
3377
3446
|
return;
|
|
3378
3447
|
}
|
|
3379
3448
|
n.on("close", () => {
|
|
3380
|
-
S ||
|
|
3449
|
+
S || Oe();
|
|
3381
3450
|
});
|
|
3382
3451
|
} catch (n) {
|
|
3383
3452
|
if (S || e !== O) return;
|
|
@@ -3386,43 +3455,43 @@ function Kn(e, t) {
|
|
|
3386
3455
|
t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
|
|
3387
3456
|
}
|
|
3388
3457
|
})();
|
|
3389
|
-
},
|
|
3458
|
+
}, Ie = () => {
|
|
3390
3459
|
if (S || x || !C || $(a.dataset.state)) return;
|
|
3391
3460
|
if (b && D) {
|
|
3392
|
-
|
|
3461
|
+
je();
|
|
3393
3462
|
return;
|
|
3394
3463
|
}
|
|
3395
3464
|
if (b && E) {
|
|
3396
|
-
|
|
3465
|
+
Ne();
|
|
3397
3466
|
return;
|
|
3398
3467
|
}
|
|
3399
3468
|
let e = ++O;
|
|
3400
3469
|
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 () => {
|
|
3401
3470
|
try {
|
|
3402
|
-
|
|
3403
|
-
let t = await
|
|
3471
|
+
Ce();
|
|
3472
|
+
let t = await Mn.startSession(xe());
|
|
3404
3473
|
if (S || e !== O) {
|
|
3405
3474
|
t.destroy();
|
|
3406
3475
|
return;
|
|
3407
3476
|
}
|
|
3408
|
-
b = t,
|
|
3477
|
+
b = t, Te(t);
|
|
3409
3478
|
let n = await t.attach({
|
|
3410
3479
|
container: v,
|
|
3411
|
-
...
|
|
3480
|
+
...Se(),
|
|
3412
3481
|
onWidgetAudioSettings: (e) => {
|
|
3413
|
-
S ||
|
|
3482
|
+
S || J(e);
|
|
3414
3483
|
},
|
|
3415
3484
|
onWidgetDragStart: (e) => {
|
|
3416
|
-
S ||
|
|
3485
|
+
S || de(e);
|
|
3417
3486
|
},
|
|
3418
3487
|
onWidgetDragMove: (e) => {
|
|
3419
|
-
S ||
|
|
3488
|
+
S || fe(e);
|
|
3420
3489
|
},
|
|
3421
3490
|
onWidgetDragEnd: (e) => {
|
|
3422
|
-
S ||
|
|
3491
|
+
S || pe(e);
|
|
3423
3492
|
},
|
|
3424
3493
|
onPlayerStatusChange: (e) => {
|
|
3425
|
-
S || (e === "error" ?
|
|
3494
|
+
S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
|
|
3426
3495
|
}
|
|
3427
3496
|
});
|
|
3428
3497
|
if (S || e !== O) {
|
|
@@ -3430,12 +3499,12 @@ function Kn(e, t) {
|
|
|
3430
3499
|
return;
|
|
3431
3500
|
}
|
|
3432
3501
|
E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
|
|
3433
|
-
S ||
|
|
3502
|
+
S || Oe();
|
|
3434
3503
|
});
|
|
3435
3504
|
} catch (n) {
|
|
3436
3505
|
if (S || e !== O) return;
|
|
3437
3506
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3438
|
-
|
|
3507
|
+
K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3439
3508
|
} finally {
|
|
3440
3509
|
e === O && (x = !1);
|
|
3441
3510
|
}
|
|
@@ -3443,88 +3512,88 @@ function Kn(e, t) {
|
|
|
3443
3512
|
}, Le = () => {
|
|
3444
3513
|
if (!(S || $(a.dataset.state))) {
|
|
3445
3514
|
if (b && D) {
|
|
3446
|
-
|
|
3515
|
+
je();
|
|
3447
3516
|
return;
|
|
3448
3517
|
}
|
|
3449
3518
|
if (b && E) {
|
|
3450
|
-
|
|
3519
|
+
Ne();
|
|
3451
3520
|
return;
|
|
3452
3521
|
}
|
|
3453
3522
|
if (T || b) {
|
|
3454
|
-
|
|
3523
|
+
Ce();
|
|
3455
3524
|
return;
|
|
3456
3525
|
}
|
|
3457
|
-
|
|
3526
|
+
Ie();
|
|
3458
3527
|
}
|
|
3459
3528
|
}, Re = (e) => {
|
|
3460
|
-
if (e.stopPropagation(),
|
|
3461
|
-
|
|
3529
|
+
if (e.stopPropagation(), R() === "expanded") {
|
|
3530
|
+
ke();
|
|
3462
3531
|
return;
|
|
3463
3532
|
}
|
|
3464
|
-
|
|
3465
|
-
},
|
|
3533
|
+
R() === "docked" && Ae();
|
|
3534
|
+
}, J = (e) => {
|
|
3466
3535
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
3467
3536
|
}, Be = (e) => {
|
|
3468
3537
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3469
3538
|
}, Ve = (e) => {
|
|
3470
|
-
|
|
3471
|
-
},
|
|
3472
|
-
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(),
|
|
3473
|
-
},
|
|
3539
|
+
R() === "docked" && Wn() && (e.target?.closest("button") || (e.preventDefault(), ue(e.clientX, e.clientY, e.pointerId)));
|
|
3540
|
+
}, He = (e) => {
|
|
3541
|
+
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Oe());
|
|
3542
|
+
}, Ue = () => {
|
|
3474
3543
|
if (!S) {
|
|
3475
|
-
if (
|
|
3476
|
-
if (!
|
|
3477
|
-
|
|
3544
|
+
if (R() === "docked") {
|
|
3545
|
+
if (!Wn()) {
|
|
3546
|
+
Ae();
|
|
3478
3547
|
return;
|
|
3479
3548
|
}
|
|
3480
3549
|
D ? W(() => {
|
|
3481
|
-
|
|
3482
|
-
}) :
|
|
3550
|
+
me(!0);
|
|
3551
|
+
}) : me(!0);
|
|
3483
3552
|
return;
|
|
3484
3553
|
}
|
|
3485
|
-
|
|
3554
|
+
H();
|
|
3486
3555
|
}
|
|
3487
|
-
},
|
|
3556
|
+
}, Y = typeof window < "u" ? window.matchMedia(Pn) : null, We = () => {
|
|
3488
3557
|
if (!S) {
|
|
3489
|
-
if (
|
|
3490
|
-
|
|
3558
|
+
if (R() === "docked" && !Wn()) {
|
|
3559
|
+
Ae();
|
|
3491
3560
|
return;
|
|
3492
3561
|
}
|
|
3493
|
-
|
|
3562
|
+
H();
|
|
3494
3563
|
}
|
|
3495
3564
|
};
|
|
3496
|
-
return o.addEventListener("click", Le), d.addEventListener("click",
|
|
3497
|
-
e.stopPropagation(),
|
|
3498
|
-
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown",
|
|
3499
|
-
S ||
|
|
3500
|
-
}) : r === "idle" && (j =
|
|
3501
|
-
S ||
|
|
3565
|
+
return o.addEventListener("click", Le), d.addEventListener("click", Oe), _.addEventListener("click", (e) => {
|
|
3566
|
+
e.stopPropagation(), Oe();
|
|
3567
|
+
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), Y?.addEventListener("change", We), be(), H(), r === "eager" ? queueMicrotask(() => {
|
|
3568
|
+
S || q();
|
|
3569
|
+
}) : r === "idle" && (j = $n(() => {
|
|
3570
|
+
S || q();
|
|
3502
3571
|
})), {
|
|
3503
3572
|
root: a,
|
|
3504
3573
|
expand: Le,
|
|
3505
|
-
collapse:
|
|
3506
|
-
dock:
|
|
3507
|
-
maximize:
|
|
3574
|
+
collapse: Oe,
|
|
3575
|
+
dock: ke,
|
|
3576
|
+
maximize: Ae,
|
|
3508
3577
|
prefetch() {
|
|
3509
3578
|
if (r === "onExpand") {
|
|
3510
|
-
|
|
3579
|
+
q();
|
|
3511
3580
|
return;
|
|
3512
3581
|
}
|
|
3513
|
-
|
|
3582
|
+
q();
|
|
3514
3583
|
},
|
|
3515
3584
|
destroy() {
|
|
3516
|
-
S || (S = !0,
|
|
3585
|
+
S || (S = !0, V(), j?.(), j = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), Y?.removeEventListener("change", We), De(), Ee(), e.replaceChildren());
|
|
3517
3586
|
}
|
|
3518
3587
|
};
|
|
3519
3588
|
}
|
|
3520
3589
|
//#endregion
|
|
3521
3590
|
//#region src/react/ExperienceWidget.tsx
|
|
3522
|
-
function
|
|
3523
|
-
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded:
|
|
3591
|
+
function tr(t) {
|
|
3592
|
+
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed: ee, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = t, ne = m === "bottom-right" || m === "bottom-left";
|
|
3524
3593
|
return e(() => {
|
|
3525
3594
|
let e = r.current;
|
|
3526
3595
|
if (!e || !i.trim()) return;
|
|
3527
|
-
let t =
|
|
3596
|
+
let t = er(e, {
|
|
3528
3597
|
experienceId: i,
|
|
3529
3598
|
alt: o,
|
|
3530
3599
|
galleryThumb: s,
|
|
@@ -3551,14 +3620,14 @@ function qn(t) {
|
|
|
3551
3620
|
startButtonLabel: O,
|
|
3552
3621
|
startButton: k,
|
|
3553
3622
|
showFeedback: A,
|
|
3554
|
-
onFeedback:
|
|
3555
|
-
onFeedbackFailed:
|
|
3556
|
-
onExpanded:
|
|
3557
|
-
onCollapsed:
|
|
3558
|
-
onStarted:
|
|
3559
|
-
onClose:
|
|
3560
|
-
onError:
|
|
3561
|
-
onPrefetchReady:
|
|
3623
|
+
onFeedback: I,
|
|
3624
|
+
onFeedbackFailed: L,
|
|
3625
|
+
onExpanded: M,
|
|
3626
|
+
onCollapsed: ee,
|
|
3627
|
+
onStarted: N,
|
|
3628
|
+
onClose: P,
|
|
3629
|
+
onError: F,
|
|
3630
|
+
onPrefetchReady: te
|
|
3562
3631
|
});
|
|
3563
3632
|
return () => t.destroy();
|
|
3564
3633
|
}, [
|
|
@@ -3588,18 +3657,18 @@ function qn(t) {
|
|
|
3588
3657
|
O,
|
|
3589
3658
|
k,
|
|
3590
3659
|
A,
|
|
3591
|
-
F,
|
|
3592
3660
|
I,
|
|
3593
|
-
|
|
3594
|
-
te,
|
|
3661
|
+
L,
|
|
3595
3662
|
M,
|
|
3663
|
+
ee,
|
|
3596
3664
|
N,
|
|
3597
3665
|
P,
|
|
3598
|
-
|
|
3666
|
+
F,
|
|
3667
|
+
te
|
|
3599
3668
|
]), /* @__PURE__ */ a("div", {
|
|
3600
3669
|
ref: r,
|
|
3601
3670
|
className: j,
|
|
3602
|
-
style:
|
|
3671
|
+
style: ne ? { display: "contents" } : {
|
|
3603
3672
|
width: "100%",
|
|
3604
3673
|
height: "100%",
|
|
3605
3674
|
minHeight: "inherit"
|
|
@@ -3608,11 +3677,11 @@ function qn(t) {
|
|
|
3608
3677
|
}
|
|
3609
3678
|
//#endregion
|
|
3610
3679
|
//#region src/next/index.ts
|
|
3611
|
-
function
|
|
3680
|
+
function nr(e = {}) {
|
|
3612
3681
|
let t = v(e);
|
|
3613
3682
|
return { POST: ({ request: e }) => t(e) };
|
|
3614
3683
|
}
|
|
3615
3684
|
//#endregion
|
|
3616
|
-
export {
|
|
3685
|
+
export { je as ExperienceThumbnail, tr as ExperienceWidget, v as createLiformaSessionRouteHandler, nr as createLiformaSvelteKitSessionHandler };
|
|
3617
3686
|
|
|
3618
3687
|
//# sourceMappingURL=index.js.map
|