@liforma/client 0.4.9 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/dist/next/index.js +763 -623
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts +2 -0
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/react/ExperienceWidget.d.ts +3 -0
- package/dist/next/react/ExperienceWidget.d.ts.map +1 -1
- package/dist/next/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/next/thumbnail/expandAssetUrl.test.d.ts +2 -0
- package/dist/next/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
- package/dist/next/thumbnail/index.d.ts +3 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/locationPlate.d.ts +13 -0
- package/dist/next/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/next/thumbnail/locationPlate.test.d.ts +2 -0
- package/dist/next/thumbnail/locationPlate.test.d.ts.map +1 -0
- package/dist/next/thumbnail/styles.d.ts.map +1 -1
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/next/thumbnail/types.d.ts +7 -1
- package/dist/next/thumbnail/types.d.ts.map +1 -1
- package/dist/next/thumbnail.js +273 -192
- package/dist/next/thumbnail.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +6 -2
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +25 -2
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +25 -3
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/next/v2/types/sessionInteraction.d.ts +13 -1
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/next/v2/types/sessionManifest.d.ts +1 -0
- package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/next/v2/types/stage.d.ts +8 -0
- package/dist/next/v2/types/stage.d.ts.map +1 -0
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/types.d.ts +1 -0
- package/dist/next/widget/types.d.ts.map +1 -1
- package/dist/npm/index.js +566 -454
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/npm/thumbnail/index.d.ts +3 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +151 -75
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/locationPlate.d.ts +13 -0
- package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/npm/thumbnail/styles.d.ts.map +1 -1
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/npm/thumbnail/types.d.ts +7 -1
- package/dist/npm/thumbnail/types.d.ts.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +6 -2
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +25 -2
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +25 -3
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +2 -1
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience.d.ts +2 -0
- package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +2 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionInteraction.d.ts +13 -1
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionManifest.d.ts +1 -0
- package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionManifestSchema.d.ts +17 -0
- package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
- package/dist/npm/v2/types/stage.d.ts +8 -0
- package/dist/npm/v2/types/stage.d.ts.map +1 -0
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/types.d.ts +1 -0
- package/dist/npm/widget/types.d.ts.map +1 -1
- package/dist/react/component/experienceComponentRuntime.d.ts +4 -0
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +15 -1
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +884 -719
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- package/dist/react/react/ExperienceThumbnail.d.ts +2 -0
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/react/react/ExperienceWidget.d.ts +3 -0
- package/dist/react/react/ExperienceWidget.d.ts.map +1 -1
- package/dist/react/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/react/thumbnail/expandAssetUrl.test.d.ts +2 -0
- package/dist/react/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
- package/dist/react/thumbnail/index.d.ts +3 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/locationPlate.d.ts +13 -0
- package/dist/react/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/react/thumbnail/locationPlate.test.d.ts +2 -0
- package/dist/react/thumbnail/locationPlate.test.d.ts.map +1 -0
- package/dist/react/thumbnail/styles.d.ts.map +1 -1
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/react/thumbnail/types.d.ts +7 -1
- package/dist/react/thumbnail/types.d.ts.map +1 -1
- package/dist/react/thumbnail.js +273 -192
- package/dist/react/thumbnail.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +6 -2
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +25 -2
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +25 -3
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/react/v2/types/sessionInteraction.d.ts +13 -1
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/react/v2/types/sessionManifest.d.ts +1 -0
- package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/react/v2/types/stage.d.ts +8 -0
- package/dist/react/v2/types/stage.d.ts.map +1 -0
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/types.d.ts +1 -0
- package/dist/react/widget/types.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +2 -2
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +9 -2
- package/dist/sdk/v2/thumbnail.js.map +1 -1
- package/dist/svelte/Experience.svelte +43 -0
- package/dist/svelte/Experience.svelte.d.ts +3 -0
- package/dist/svelte/ExperienceThumbnail.svelte +24 -2
- package/dist/svelte/ExperienceThumbnail.svelte.d.ts +2 -0
- package/dist/svelte/ExperienceWidget.svelte +9 -0
- package/dist/svelte/ExperienceWidget.svelte.d.ts +3 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -175,23 +175,23 @@ function k() {
|
|
|
175
175
|
function A(e) {
|
|
176
176
|
return e instanceof DOMException || e instanceof Error ? e : Error(String(e));
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function ee(e) {
|
|
179
179
|
return e instanceof DOMException && e.name === "AbortError";
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function j(e) {
|
|
182
182
|
!e.instance || e.instanceDestroyed || (e.instanceDestroyed = !0, e.instance.destroy());
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function M(e, t, n, r) {
|
|
185
185
|
e.unsubscribers.push(t.on(n, r));
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
187
|
+
function N(e, t, n) {
|
|
188
|
+
M(e, t, "ready", (t) => {
|
|
189
189
|
e.destroyed || (e.ready.resolve(t), n().onReady?.(t));
|
|
190
|
-
}),
|
|
190
|
+
}), M(e, t, "started", (t) => {
|
|
191
191
|
e.destroyed || (e.started.resolve(t), n().onStarted?.(t));
|
|
192
|
-
}),
|
|
192
|
+
}), M(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), M(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), M(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), M(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), M(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), M(e, t, "characterFocusChanged", (e) => n().onCharacterFocusChanged?.(e)), M(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), M(e, t, "message", (e) => n().onMessage?.(e)), M(e, t, "listeningState", (e) => n().onListeningState?.(e)), M(e, t, "activityChange", (e) => n().onActivityChange?.(e)), M(e, t, "feedback", (e) => n().onFeedback?.(e)), M(e, t, "feedbackFailed", (e) => n().onFeedbackFailed?.(e)), M(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function P(e = () => ({}), t = () => ({})) {
|
|
195
195
|
let n = 0, r = null;
|
|
196
196
|
function i(e) {
|
|
197
197
|
if (e) {
|
|
@@ -207,7 +207,7 @@ function F(e = () => ({}), t = () => ({})) {
|
|
|
207
207
|
}
|
|
208
208
|
function a(e, t, n, a, o = !1, s) {
|
|
209
209
|
let c = A(e);
|
|
210
|
-
return !
|
|
210
|
+
return !ee(c) && r === t && !t.destroyed && (o && a?.(D(c, { experienceId: i(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), n.onError?.(c))), c;
|
|
211
211
|
}
|
|
212
212
|
function o() {
|
|
213
213
|
if (!r || r.destroyed) throw k();
|
|
@@ -235,22 +235,26 @@ function F(e = () => ({}), t = () => ({})) {
|
|
|
235
235
|
let t = k();
|
|
236
236
|
e.session.reject(t), e.ready.reject(t), e.started.reject(t);
|
|
237
237
|
for (let t of e.unsubscribers.splice(0)) t();
|
|
238
|
-
|
|
238
|
+
j(e), r === e && (r = null);
|
|
239
239
|
}
|
|
240
240
|
async function f(e, n, i, o, u, d) {
|
|
241
241
|
try {
|
|
242
242
|
let a = await c.startSession(i);
|
|
243
243
|
if (e.instance = a, e.destroyed || r !== e) {
|
|
244
|
-
|
|
244
|
+
j(e);
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
N(e, a, o);
|
|
248
248
|
let d = t(), f = d.returnUrl?.trim() || u?.trim(), p = await a.attach({
|
|
249
249
|
container: n,
|
|
250
250
|
fit: d.fit,
|
|
251
|
+
stage: d.stage,
|
|
252
|
+
pipBackground: d.pipBackground,
|
|
253
|
+
pipShadow: d.pipShadow,
|
|
251
254
|
startButton: d.startButton,
|
|
252
255
|
theme: d.theme,
|
|
253
256
|
showFeedback: d.showFeedback,
|
|
257
|
+
interaction: d.interaction,
|
|
254
258
|
closeButton: d.closeButton,
|
|
255
259
|
returnUrl: f,
|
|
256
260
|
showClose: !!(o().onClose || f || d.closeButton === !0 || d.closeButton && typeof d.closeButton == "object" && d.closeButton.visible !== !1),
|
|
@@ -272,7 +276,7 @@ function F(e = () => ({}), t = () => ({})) {
|
|
|
272
276
|
});
|
|
273
277
|
} catch (t) {
|
|
274
278
|
let n = a(t, e, o(), d, !0, i);
|
|
275
|
-
e.session.reject(n), e.ready.reject(n), e.started.reject(n),
|
|
279
|
+
e.session.reject(n), e.ready.reject(n), e.started.reject(n), j(e);
|
|
276
280
|
}
|
|
277
281
|
}
|
|
278
282
|
function p(t, n, i, o) {
|
|
@@ -302,17 +306,17 @@ function F(e = () => ({}), t = () => ({})) {
|
|
|
302
306
|
}
|
|
303
307
|
//#endregion
|
|
304
308
|
//#region src/svelte/experienceLoadErrorStyles.ts
|
|
305
|
-
var
|
|
306
|
-
function
|
|
309
|
+
var F = "liforma-experience-load-error-styles";
|
|
310
|
+
function te() {
|
|
307
311
|
if (typeof document > "u" || document.getElementById("liforma-experience-load-error-styles")) return;
|
|
308
312
|
let e = document.createElement("style");
|
|
309
|
-
e.id =
|
|
313
|
+
e.id = F, e.textContent = I, document.head.append(e);
|
|
310
314
|
}
|
|
311
|
-
var
|
|
315
|
+
var I = "\n .liforma-loading-screen {\n inset: 0;\n z-index: 20;\n box-sizing: border-box;\n overflow-x: clip;\n width: 100%;\n height: 100%;\n max-width: 100vw;\n background:\n radial-gradient(circle at 50% 60%, rgba(79, 126, 196, 0.18), transparent 38%),\n #030508;\n font-family: system-ui, -apple-system, sans-serif;\n color: #e8f0ff;\n text-align: center;\n }\n .liforma-loading-screen-absolute {\n position: absolute;\n }\n .liforma-loading-card {\n position: absolute;\n left: 50%;\n top: 60%;\n transform: translate(-50%, -50%);\n width: min(22rem, calc(100% - 2.5rem));\n max-width: calc(100% - max(1.25rem, env(safe-area-inset-left, 0px)) - max(1.25rem, env(safe-area-inset-right, 0px)));\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n }\n .liforma-loading-card-error {\n display: block;\n text-align: center;\n padding: 1rem 1.05rem;\n border-radius: 14px;\n border: 1px solid rgba(255, 154, 154, 0.28);\n background:\n linear-gradient(180deg, rgba(21, 29, 42, 0.92), rgba(9, 13, 20, 0.92));\n }\n .liforma-loading-kicker {\n margin: 0 0 0.18rem;\n color: #8ba4c5;\n font-size: 0.68rem;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.08em;\n }\n .liforma-loading-error {\n margin: 0;\n max-width: 28rem;\n color: #ffb4b4;\n font-size: 0.92rem;\n line-height: 1.4;\n }\n .liforma-loading-error-title {\n margin: 0;\n color: #f6ebe8;\n font-size: 0.98rem;\n font-weight: 650;\n line-height: 1.35;\n }\n .liforma-loading-error-advanced {\n margin: 0.85rem 0 0;\n padding: 0;\n border: 0;\n background: transparent;\n color: #9eb7d8;\n font: inherit;\n font-size: 0.78rem;\n font-weight: 650;\n letter-spacing: 0.02em;\n text-decoration: underline;\n text-underline-offset: 0.18em;\n cursor: pointer;\n }\n .liforma-loading-error-advanced:hover,\n .liforma-loading-error-advanced:focus-visible {\n color: #d7e6ff;\n outline: none;\n }\n .liforma-loading-error-detail {\n margin: 0.7rem 0 0;\n padding: 0.65rem 0.7rem;\n border-radius: 10px;\n border: 1px solid rgba(158, 191, 255, 0.16);\n background: rgba(3, 5, 8, 0.45);\n color: #c6d4e8;\n font-size: 0.78rem;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n line-height: 1.4;\n text-align: left;\n white-space: pre-wrap;\n word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
|
|
312
316
|
//#endregion
|
|
313
317
|
//#region src/svelte/experienceLoadErrorOverlay.ts
|
|
314
318
|
function L(e, t) {
|
|
315
|
-
|
|
319
|
+
te();
|
|
316
320
|
let n = t, r = !1, i = document.createElement("div");
|
|
317
321
|
i.className = "liforma-loading-screen liforma-loading-screen-absolute", i.setAttribute("role", "alert"), i.setAttribute("aria-live", "assertive");
|
|
318
322
|
let a = document.createElement("div");
|
|
@@ -343,100 +347,121 @@ function L(e, t) {
|
|
|
343
347
|
//#endregion
|
|
344
348
|
//#region src/react/Experience.tsx
|
|
345
349
|
var ne = e(function(e, a) {
|
|
346
|
-
let { returnUrl: c, fit: l,
|
|
350
|
+
let { returnUrl: c, fit: l, stage: u, pipBackground: p, pipShadow: m, startButton: h, theme: g, showFeedback: y, interaction: b, closeButton: x, onReady: S, onStarted: C, onUserTranscript: w, onUserSpeechStarted: T, onUserSpeechEnded: E, onCharacterSpeechStarted: D, onCharacterSpeechEnded: O, onCharacterFocusChanged: ee, onConversationUpdate: j, onMessage: M, onListeningState: N, onActivityChange: F, onFeedback: te, onFeedbackFailed: I, onConversationProcessorError: ne, onPlayerStatusChange: re, onStateUpdate: ie, onClose: R, onError: z } = e, ae = o({}), B = o({
|
|
347
351
|
fit: l,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
stage: u,
|
|
353
|
+
pipBackground: p,
|
|
354
|
+
pipShadow: m,
|
|
355
|
+
startButton: h,
|
|
356
|
+
theme: g,
|
|
357
|
+
showFeedback: y,
|
|
358
|
+
interaction: b,
|
|
359
|
+
closeButton: x,
|
|
352
360
|
returnUrl: c
|
|
353
|
-
}),
|
|
354
|
-
|
|
361
|
+
}), V = o(P(() => ae.current, () => B.current)), oe = o(null), [H, se] = s(!1), [U, ce] = s(null), le = o(null), ue = o(null), de = v(e);
|
|
362
|
+
B.current = {
|
|
355
363
|
fit: l,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
364
|
+
stage: u,
|
|
365
|
+
pipBackground: p,
|
|
366
|
+
pipShadow: m,
|
|
367
|
+
startButton: h,
|
|
368
|
+
theme: g,
|
|
369
|
+
showFeedback: y,
|
|
370
|
+
interaction: b,
|
|
371
|
+
closeButton: x,
|
|
360
372
|
returnUrl: c
|
|
361
|
-
},
|
|
362
|
-
onReady:
|
|
363
|
-
onStarted:
|
|
364
|
-
onUserTranscript:
|
|
365
|
-
onUserSpeechStarted:
|
|
366
|
-
onUserSpeechEnded:
|
|
367
|
-
onCharacterSpeechStarted:
|
|
368
|
-
onCharacterSpeechEnded:
|
|
369
|
-
onCharacterFocusChanged:
|
|
370
|
-
onConversationUpdate:
|
|
371
|
-
onMessage:
|
|
372
|
-
onListeningState:
|
|
373
|
-
onActivityChange:
|
|
374
|
-
onFeedback:
|
|
375
|
-
onFeedbackFailed:
|
|
376
|
-
onConversationProcessorError:
|
|
377
|
-
onPlayerStatusChange:
|
|
378
|
-
onStateUpdate:
|
|
379
|
-
onClose:
|
|
380
|
-
onError:
|
|
381
|
-
};
|
|
382
|
-
let
|
|
383
|
-
|
|
373
|
+
}, ae.current = {
|
|
374
|
+
onReady: S,
|
|
375
|
+
onStarted: C,
|
|
376
|
+
onUserTranscript: w,
|
|
377
|
+
onUserSpeechStarted: T,
|
|
378
|
+
onUserSpeechEnded: E,
|
|
379
|
+
onCharacterSpeechStarted: D,
|
|
380
|
+
onCharacterSpeechEnded: O,
|
|
381
|
+
onCharacterFocusChanged: ee,
|
|
382
|
+
onConversationUpdate: j,
|
|
383
|
+
onMessage: M,
|
|
384
|
+
onListeningState: N,
|
|
385
|
+
onActivityChange: F,
|
|
386
|
+
onFeedback: te,
|
|
387
|
+
onFeedbackFailed: I,
|
|
388
|
+
onConversationProcessorError: ne,
|
|
389
|
+
onPlayerStatusChange: re,
|
|
390
|
+
onStateUpdate: ie,
|
|
391
|
+
onClose: R,
|
|
392
|
+
onError: z
|
|
393
|
+
};
|
|
394
|
+
let W = t((e) => {
|
|
395
|
+
le.current = e, se(e !== null);
|
|
384
396
|
}, []);
|
|
385
397
|
return r(a, () => ({
|
|
386
398
|
ready: () => {
|
|
387
|
-
let e =
|
|
399
|
+
let e = oe.current;
|
|
388
400
|
return !e || e.destroyed ? Promise.reject(k()) : e.ready.promise;
|
|
389
401
|
},
|
|
390
402
|
started: () => {
|
|
391
|
-
let e =
|
|
403
|
+
let e = oe.current;
|
|
392
404
|
return !e || e.destroyed ? Promise.reject(k()) : e.started.promise;
|
|
393
405
|
},
|
|
394
406
|
speech: {
|
|
395
|
-
speak: (e) =>
|
|
396
|
-
play: (e) =>
|
|
407
|
+
speak: (e) => V.current.withSession((t) => t.speech.speak(e)),
|
|
408
|
+
play: (e) => V.current.withSession((t) => t.speech.play(e)),
|
|
397
409
|
createUtterance: (e) => {
|
|
398
|
-
let t =
|
|
410
|
+
let t = V.current.getActiveInstance();
|
|
399
411
|
if (!t) throw Error("Session has not started. Wait for the player start button and the started event before using speech APIs.");
|
|
400
412
|
return t.speech.createUtterance(e);
|
|
401
413
|
},
|
|
402
|
-
interrupt: (e) =>
|
|
414
|
+
interrupt: (e) => V.current.withSession((t) => t.speech.interrupt(e))
|
|
403
415
|
},
|
|
404
|
-
startListening: () =>
|
|
405
|
-
stopListening: () =>
|
|
406
|
-
listenOnce: (e) =>
|
|
407
|
-
getSession: () =>
|
|
408
|
-
getManifest: () =>
|
|
409
|
-
getConversation: () =>
|
|
410
|
-
focusCharacter: (e) =>
|
|
411
|
-
setFit: (e) =>
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
416
|
+
startListening: () => V.current.withSession((e) => e.startListening()),
|
|
417
|
+
stopListening: () => V.current.withSession((e) => e.stopListening()),
|
|
418
|
+
listenOnce: (e) => V.current.withSession((t) => t.listenOnce(e)),
|
|
419
|
+
getSession: () => V.current.getActiveInstance()?.getSession() ?? null,
|
|
420
|
+
getManifest: () => V.current.getActiveInstance()?.getManifest() ?? null,
|
|
421
|
+
getConversation: () => V.current.getActiveInstance()?.getConversation() ?? [],
|
|
422
|
+
focusCharacter: (e) => V.current.withSession((t) => t.focusCharacter(e)),
|
|
423
|
+
setFit: (e) => V.current.withSession((t) => t.setFit(e)),
|
|
424
|
+
setStage: (e) => V.current.withSession((t) => t.setStage(e)),
|
|
425
|
+
setPipBackground: (e) => V.current.withSession((t) => t.setPipBackground(e)),
|
|
426
|
+
setPipShadow: (e) => V.current.withSession((t) => t.setPipShadow(e)),
|
|
427
|
+
conversion: (e) => V.current.withSession((t) => t.conversion(e)),
|
|
428
|
+
engage: () => V.current.withSession((e) => e.engage()),
|
|
429
|
+
end: () => V.current.withSession((e) => e.end())
|
|
415
430
|
}), []), i(() => {
|
|
416
|
-
if (!
|
|
417
|
-
let t =
|
|
431
|
+
if (!H || !le.current) return;
|
|
432
|
+
let t = le.current, n = V.current, r;
|
|
418
433
|
try {
|
|
419
434
|
r = { options: _(e) };
|
|
420
435
|
} catch (e) {
|
|
421
436
|
r = { error: A(e) };
|
|
422
437
|
}
|
|
423
|
-
let i = n.activateGeneration(t, r, c,
|
|
424
|
-
return
|
|
425
|
-
n.cancelGeneration(i),
|
|
438
|
+
let i = n.activateGeneration(t, r, c, ce);
|
|
439
|
+
return oe.current = i, () => {
|
|
440
|
+
n.cancelGeneration(i), oe.current === i && (oe.current = null);
|
|
426
441
|
};
|
|
427
442
|
}, [
|
|
428
|
-
|
|
429
|
-
|
|
443
|
+
H,
|
|
444
|
+
de,
|
|
430
445
|
c
|
|
431
446
|
]), n(() => {
|
|
432
|
-
let e =
|
|
447
|
+
let e = V.current.getActiveInstance();
|
|
433
448
|
e && e.setFit(l ?? "full");
|
|
434
449
|
}, [l]), n(() => {
|
|
435
|
-
let e =
|
|
436
|
-
|
|
437
|
-
|
|
450
|
+
let e = V.current.getActiveInstance();
|
|
451
|
+
e && e.setStage(u ?? "fill");
|
|
452
|
+
}, [u]), n(() => {
|
|
453
|
+
let e = V.current.getActiveInstance();
|
|
454
|
+
e && e.setPipBackground(p ?? "none");
|
|
455
|
+
}, [p]), n(() => {
|
|
456
|
+
if (m === void 0) return;
|
|
457
|
+
let e = V.current.getActiveInstance();
|
|
458
|
+
e && e.setPipShadow(m);
|
|
459
|
+
}, [m]), n(() => {
|
|
460
|
+
let e = ue.current;
|
|
461
|
+
if (!e || (e.replaceChildren(), !U)) return;
|
|
462
|
+
let t = L(e, U);
|
|
438
463
|
return () => t.remove();
|
|
439
|
-
}, [
|
|
464
|
+
}, [U]), /* @__PURE__ */ f("div", {
|
|
440
465
|
className: "liforma-experience-shell",
|
|
441
466
|
style: {
|
|
442
467
|
position: "relative",
|
|
@@ -445,17 +470,17 @@ var ne = e(function(e, a) {
|
|
|
445
470
|
minHeight: "inherit"
|
|
446
471
|
},
|
|
447
472
|
children: [/* @__PURE__ */ d("div", {
|
|
448
|
-
ref:
|
|
473
|
+
ref: ue,
|
|
449
474
|
className: "liforma-experience-error-host",
|
|
450
|
-
"aria-hidden":
|
|
475
|
+
"aria-hidden": U ? void 0 : !0,
|
|
451
476
|
style: {
|
|
452
477
|
position: "absolute",
|
|
453
478
|
inset: 0,
|
|
454
479
|
zIndex: 20,
|
|
455
|
-
pointerEvents:
|
|
480
|
+
pointerEvents: U ? "auto" : "none"
|
|
456
481
|
}
|
|
457
482
|
}), /* @__PURE__ */ d("div", {
|
|
458
|
-
ref:
|
|
483
|
+
ref: W,
|
|
459
484
|
className: "liforma-experience-host",
|
|
460
485
|
style: {
|
|
461
486
|
position: "absolute",
|
|
@@ -471,28 +496,98 @@ function re(e) {
|
|
|
471
496
|
return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
|
|
472
497
|
}
|
|
473
498
|
//#endregion
|
|
474
|
-
//#region src/thumbnail/
|
|
475
|
-
var
|
|
499
|
+
//#region src/thumbnail/locationPlate.ts
|
|
500
|
+
var ie = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
501
|
+
function R(e, t) {
|
|
502
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
503
|
+
}
|
|
504
|
+
function z(e, t) {
|
|
505
|
+
let n = e.trim();
|
|
506
|
+
return n && n.replace(ie, (e, n, r, i, a) => `${n}${t}${i}${a}`);
|
|
507
|
+
}
|
|
508
|
+
function ae(e, t) {
|
|
509
|
+
let n = () => {
|
|
510
|
+
t(e.clientWidth, e.clientHeight);
|
|
511
|
+
};
|
|
512
|
+
if (n(), typeof ResizeObserver > "u") return () => {};
|
|
513
|
+
let r = new ResizeObserver(n);
|
|
514
|
+
return r.observe(e), () => r.disconnect();
|
|
515
|
+
}
|
|
516
|
+
var B = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
476
517
|
function V(e) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
return
|
|
518
|
+
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
519
|
+
}
|
|
520
|
+
function oe(e) {
|
|
521
|
+
return /^https?:\/\//i.test(e) || e.startsWith("//");
|
|
481
522
|
}
|
|
482
|
-
function
|
|
523
|
+
function H(e) {
|
|
524
|
+
return e.startsWith("//") ? `https:${e}` : e;
|
|
525
|
+
}
|
|
526
|
+
function se(e) {
|
|
527
|
+
let t = e.indexOf("?");
|
|
528
|
+
return t === -1 ? {
|
|
529
|
+
pathname: e,
|
|
530
|
+
search: ""
|
|
531
|
+
} : {
|
|
532
|
+
pathname: e.slice(0, t),
|
|
533
|
+
search: e.slice(t)
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function U(e, t, n = "") {
|
|
537
|
+
return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
|
|
538
|
+
}
|
|
539
|
+
function ce(e, t, n) {
|
|
540
|
+
let r = e.trim();
|
|
541
|
+
if (!r) return r;
|
|
542
|
+
let i = V(n);
|
|
543
|
+
if (oe(r)) return z(H(r), t);
|
|
544
|
+
let { pathname: a, search: o } = se(r.replace(/\\/g, "/")), s = a;
|
|
545
|
+
if (!s.startsWith("/")) s = `/locations/${s.replace(/^locations\//i, "")}`;
|
|
546
|
+
else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? U(i, s, o) : r;
|
|
547
|
+
if (/\.webp$/i.test(s) && !B.test(s.replace(/\.webp$/i, ""))) return U(i, s, o);
|
|
548
|
+
let c = s.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
|
|
549
|
+
return c = c.replace(B, ""), `${i}/locations/${c}-${t}.webp${o}`;
|
|
550
|
+
}
|
|
551
|
+
function le(e, t) {
|
|
552
|
+
let n = e.trim();
|
|
553
|
+
if (!n) return n;
|
|
554
|
+
let r = V(t);
|
|
555
|
+
if (oe(n)) return H(n);
|
|
556
|
+
let { pathname: i, search: a } = se(n.replace(/\\/g, "/")), o = i;
|
|
557
|
+
if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
|
|
558
|
+
else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
|
|
559
|
+
else return n;
|
|
560
|
+
if (!/^\/avatars\//i.test(o)) return n;
|
|
561
|
+
let s = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
|
|
562
|
+
return s && !s.includes("/") && !a ? `${r}/avatars/${s}/256/${s}_neutral.webp` : U(r, o, a);
|
|
563
|
+
}
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
566
|
+
var ue = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, de = /_CH(\.webp)/i;
|
|
567
|
+
function W(e) {
|
|
568
|
+
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("/");
|
|
569
|
+
}
|
|
570
|
+
function fe(e, t = "256x256", n) {
|
|
571
|
+
let r = e.trim();
|
|
572
|
+
if (!r) return r;
|
|
573
|
+
if (W(r)) return ce(r, t, n);
|
|
574
|
+
let i = le(r, n);
|
|
575
|
+
return i = i.replace(ue, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(de, "_neutral$1");
|
|
576
|
+
}
|
|
577
|
+
function pe(e) {
|
|
483
578
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
484
579
|
if (!t) return null;
|
|
485
|
-
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
|
|
580
|
+
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 = V(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : fe(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : ce(e, a, o);
|
|
486
581
|
return {
|
|
487
|
-
avatarImage:
|
|
488
|
-
...n ? { backgroundImage:
|
|
489
|
-
...r ? { foregroundImage:
|
|
490
|
-
...i ? { fallbackImage:
|
|
582
|
+
avatarImage: c(t),
|
|
583
|
+
...n ? { backgroundImage: l(n) } : {},
|
|
584
|
+
...r ? { foregroundImage: l(r) } : {},
|
|
585
|
+
...i ? { fallbackImage: c(i) } : {}
|
|
491
586
|
};
|
|
492
587
|
}
|
|
493
588
|
//#endregion
|
|
494
589
|
//#region src/shims/localStack.ts
|
|
495
|
-
function
|
|
590
|
+
function me() {
|
|
496
591
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
497
592
|
if (typeof location > "u") return !1;
|
|
498
593
|
try {
|
|
@@ -503,83 +598,83 @@ function H() {
|
|
|
503
598
|
}
|
|
504
599
|
//#endregion
|
|
505
600
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
506
|
-
var
|
|
507
|
-
function
|
|
601
|
+
var he = "https://player.liforma.ai", ge = "http://localhost:3002";
|
|
602
|
+
function _e(e) {
|
|
508
603
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
509
604
|
}
|
|
510
|
-
function
|
|
605
|
+
function ve(e) {
|
|
511
606
|
let t = e?.trim();
|
|
512
|
-
return t ? t.replace(/\/$/, "") :
|
|
607
|
+
return t ? t.replace(/\/$/, "") : me() ? ge : he;
|
|
513
608
|
}
|
|
514
|
-
function
|
|
515
|
-
let t = e.experienceId.trim(), n =
|
|
609
|
+
function ye(e) {
|
|
610
|
+
let t = e.experienceId.trim(), n = ve(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
516
611
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
517
612
|
}
|
|
518
|
-
function
|
|
613
|
+
function be(e) {
|
|
519
614
|
let t = e.href?.trim();
|
|
520
615
|
if (t) return t;
|
|
521
616
|
let n = e.experienceId?.trim();
|
|
522
617
|
if (!n) return;
|
|
523
618
|
let r = e.returnUrl?.trim();
|
|
524
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
619
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ye({
|
|
525
620
|
experienceId: n,
|
|
526
621
|
...r ? { returnUrl: r } : {},
|
|
527
622
|
playerBaseUrl: e.playerBaseUrl
|
|
528
623
|
});
|
|
529
624
|
}
|
|
530
|
-
function
|
|
625
|
+
function xe() {
|
|
531
626
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
532
627
|
}
|
|
533
|
-
var
|
|
534
|
-
function
|
|
535
|
-
return
|
|
628
|
+
var G = 0, Se = [];
|
|
629
|
+
function Ce() {
|
|
630
|
+
return xe() ? 4 : Infinity;
|
|
536
631
|
}
|
|
537
|
-
function
|
|
538
|
-
return
|
|
632
|
+
function we() {
|
|
633
|
+
return xe() ? 160 : 0;
|
|
539
634
|
}
|
|
540
|
-
function
|
|
541
|
-
let e =
|
|
542
|
-
for (;
|
|
543
|
-
let e =
|
|
635
|
+
function Te() {
|
|
636
|
+
let e = Ce();
|
|
637
|
+
for (; G < e && Se.length > 0;) {
|
|
638
|
+
let e = Se.shift();
|
|
544
639
|
if (!e || e.cancelled) continue;
|
|
545
|
-
|
|
546
|
-
let t =
|
|
640
|
+
G += 1, e.start();
|
|
641
|
+
let t = we();
|
|
547
642
|
if (t <= 0) {
|
|
548
|
-
|
|
643
|
+
G = Math.max(0, G - 1);
|
|
549
644
|
continue;
|
|
550
645
|
}
|
|
551
646
|
window.setTimeout(() => {
|
|
552
|
-
|
|
647
|
+
G = Math.max(0, G - 1), Te();
|
|
553
648
|
}, t);
|
|
554
649
|
}
|
|
555
650
|
}
|
|
556
|
-
function
|
|
557
|
-
if (!
|
|
651
|
+
function Ee(e) {
|
|
652
|
+
if (!xe()) return e(), () => {};
|
|
558
653
|
let t = {
|
|
559
654
|
start: e,
|
|
560
655
|
cancelled: !1
|
|
561
656
|
};
|
|
562
|
-
return
|
|
657
|
+
return Se.push(t), Te(), () => {
|
|
563
658
|
t.cancelled = !0;
|
|
564
659
|
};
|
|
565
660
|
}
|
|
566
661
|
//#endregion
|
|
567
662
|
//#region src/thumbnail/lazyLoad.ts
|
|
568
|
-
function
|
|
569
|
-
return
|
|
663
|
+
function De() {
|
|
664
|
+
return xe() ? "96px 0px" : "280px 0px";
|
|
570
665
|
}
|
|
571
|
-
function
|
|
666
|
+
function Oe(e) {
|
|
572
667
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
573
668
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
574
669
|
}
|
|
575
|
-
function
|
|
670
|
+
function K(e, t) {
|
|
576
671
|
if (typeof window > "u") return !1;
|
|
577
672
|
let n = e.getBoundingClientRect();
|
|
578
673
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
579
674
|
}
|
|
580
|
-
function
|
|
581
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
582
|
-
o || (s?.(), s =
|
|
675
|
+
function ke(e, t) {
|
|
676
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? De(), i = Oe(r), a = !1, o = !1, s = null, c = () => {
|
|
677
|
+
o || (s?.(), s = Ee(() => {
|
|
583
678
|
s = null, o = !0, n(!0);
|
|
584
679
|
}));
|
|
585
680
|
}, l = (e) => {
|
|
@@ -601,55 +696,55 @@ function _e(e, t) {
|
|
|
601
696
|
rootMargin: r,
|
|
602
697
|
threshold: 0
|
|
603
698
|
});
|
|
604
|
-
return u.observe(e),
|
|
699
|
+
return u.observe(e), K(e, i) && l(!0), () => {
|
|
605
700
|
s?.(), s = null, u.disconnect();
|
|
606
701
|
};
|
|
607
702
|
}
|
|
608
703
|
//#endregion
|
|
609
704
|
//#region src/thumbnail/scrollParallax.ts
|
|
610
|
-
function
|
|
705
|
+
function Ae() {
|
|
611
706
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
612
707
|
}
|
|
613
|
-
function
|
|
708
|
+
function je(e, t) {
|
|
614
709
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
615
710
|
}
|
|
616
|
-
var
|
|
617
|
-
function
|
|
618
|
-
if (
|
|
711
|
+
var q = /* @__PURE__ */ new Set(), Me = !1, J = 0;
|
|
712
|
+
function Ne() {
|
|
713
|
+
if (J = 0, q.size === 0 || typeof window > "u") return;
|
|
619
714
|
let e = window.innerHeight;
|
|
620
|
-
for (let t of
|
|
715
|
+
for (let t of q) {
|
|
621
716
|
if (t.pointerActive?.()) continue;
|
|
622
717
|
let n = t.element.getBoundingClientRect();
|
|
623
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
718
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(je(n, e));
|
|
624
719
|
}
|
|
625
720
|
}
|
|
626
|
-
function
|
|
627
|
-
|
|
721
|
+
function Pe() {
|
|
722
|
+
J === 0 && (J = requestAnimationFrame(Ne));
|
|
628
723
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
724
|
+
function Fe() {
|
|
725
|
+
Me || typeof window > "u" || (Me = !0, window.addEventListener("scroll", Pe, { passive: !0 }), window.addEventListener("resize", Pe, { passive: !0 }));
|
|
631
726
|
}
|
|
632
|
-
function
|
|
633
|
-
|
|
727
|
+
function Ie() {
|
|
728
|
+
q.size > 0 || !Me || typeof window > "u" || (Me = !1, J !== 0 && (cancelAnimationFrame(J), J = 0), window.removeEventListener("scroll", Pe), window.removeEventListener("resize", Pe));
|
|
634
729
|
}
|
|
635
|
-
function
|
|
636
|
-
if (!
|
|
730
|
+
function Le(e, t) {
|
|
731
|
+
if (!Ae()) return () => {};
|
|
637
732
|
let n = {
|
|
638
733
|
element: e,
|
|
639
734
|
onParallax: t.onParallax,
|
|
640
735
|
pointerActive: t.pointerActive
|
|
641
736
|
};
|
|
642
|
-
return
|
|
643
|
-
|
|
737
|
+
return q.add(n), Fe(), n.pointerActive?.() || t.onParallax(je(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
738
|
+
q.delete(n), Ie();
|
|
644
739
|
};
|
|
645
740
|
}
|
|
646
741
|
//#endregion
|
|
647
742
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
648
|
-
function
|
|
743
|
+
function Re(e) {
|
|
649
744
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
650
745
|
let a = r || i;
|
|
651
746
|
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));
|
|
652
|
-
}, s =
|
|
747
|
+
}, s = Le(e, {
|
|
653
748
|
onParallax: (e) => {
|
|
654
749
|
i = !0, a || (t = e, n = 0, o());
|
|
655
750
|
},
|
|
@@ -662,7 +757,7 @@ function Ee(e) {
|
|
|
662
757
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
663
758
|
}, u = () => {
|
|
664
759
|
let s = a;
|
|
665
|
-
a = !1, r = !1, i && s ? (t =
|
|
760
|
+
a = !1, r = !1, i && s ? (t = je(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
666
761
|
}, d = (e) => {
|
|
667
762
|
e.pointerType === "mouse" && (r = !0, o());
|
|
668
763
|
}, f = () => {
|
|
@@ -674,108 +769,119 @@ function Ee(e) {
|
|
|
674
769
|
}
|
|
675
770
|
//#endregion
|
|
676
771
|
//#region src/thumbnail/styles.ts
|
|
677
|
-
var
|
|
678
|
-
function
|
|
679
|
-
if (typeof document > "u" ||
|
|
772
|
+
var ze = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", Be = !1;
|
|
773
|
+
function Ve(e) {
|
|
774
|
+
if (typeof document > "u" || Be) return;
|
|
680
775
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
681
|
-
|
|
776
|
+
Be = !0;
|
|
682
777
|
return;
|
|
683
778
|
}
|
|
684
779
|
let t = document.createElement("style");
|
|
685
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
780
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), Be = !0;
|
|
686
781
|
}
|
|
687
782
|
//#endregion
|
|
688
783
|
//#region src/react/ExperienceThumbnail.tsx
|
|
689
|
-
function
|
|
784
|
+
function He(e, t) {
|
|
690
785
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
691
786
|
}
|
|
692
|
-
function
|
|
693
|
-
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w } = e,
|
|
787
|
+
function Ue(e) {
|
|
788
|
+
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w, normalizeUrls: T = !0, cdnBaseUrl: E } = e, D = o(null), O = o(!1), [k, A] = s(0), [ee, j] = s(0), M = R(k, ee), N = a(() => pe({
|
|
694
789
|
galleryThumb: t,
|
|
695
790
|
avatarImage: r,
|
|
696
791
|
backgroundImage: i,
|
|
697
792
|
foregroundImage: c,
|
|
698
|
-
fallbackImage: w
|
|
793
|
+
fallbackImage: w,
|
|
794
|
+
normalize: T,
|
|
795
|
+
locationPlateSize: M,
|
|
796
|
+
cdnBaseUrl: E
|
|
699
797
|
}), [
|
|
700
798
|
t,
|
|
701
799
|
r,
|
|
702
800
|
i,
|
|
703
801
|
c,
|
|
704
|
-
w
|
|
705
|
-
|
|
802
|
+
w,
|
|
803
|
+
T,
|
|
804
|
+
M,
|
|
805
|
+
E
|
|
806
|
+
]), P = _e({
|
|
706
807
|
href: m,
|
|
707
808
|
hasClickHandler: typeof _ == "function",
|
|
708
809
|
experienceId: p
|
|
709
|
-
}),
|
|
810
|
+
}), F = P === "anchor" && !m?.trim() && !!p?.trim(), te = !!N?.backgroundImage, I = b !== !1, [L, ne] = s(!S), [ie, z] = s(!1), [B, V] = s(!1), [oe, H] = s(0), [se, U] = s(0), [ce, le] = s(!1), [ue, de] = s(!1), [W, fe] = s(!1), [me, he] = s(!1), [ge, ve] = s(), ye = N ? ce && N.fallbackImage ? N.fallbackImage : N.avatarImage : "";
|
|
710
811
|
n(() => {
|
|
711
|
-
|
|
812
|
+
Ve(ze);
|
|
712
813
|
}, []), n(() => {
|
|
713
|
-
|
|
814
|
+
ve(be({
|
|
714
815
|
href: m,
|
|
715
816
|
experienceId: p,
|
|
716
817
|
returnUrl: v,
|
|
717
818
|
playerBaseUrl: y,
|
|
718
|
-
useCurrentPageAsReturnUrl:
|
|
819
|
+
useCurrentPageAsReturnUrl: F && !v?.trim()
|
|
719
820
|
}));
|
|
720
821
|
}, [
|
|
721
822
|
m,
|
|
722
823
|
p,
|
|
723
824
|
v,
|
|
724
825
|
y,
|
|
725
|
-
|
|
826
|
+
F
|
|
726
827
|
]), n(() => {
|
|
727
|
-
|
|
828
|
+
de(!1), fe(!1), he(!1), le(!1);
|
|
728
829
|
}, [
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
830
|
+
N?.backgroundImage,
|
|
831
|
+
N?.foregroundImage,
|
|
832
|
+
ye
|
|
732
833
|
]), n(() => {
|
|
733
|
-
let e =
|
|
834
|
+
let e = D.current;
|
|
835
|
+
if (e) return ae(e, (e, t) => {
|
|
836
|
+
A(e), j(t);
|
|
837
|
+
});
|
|
838
|
+
}, [P, ge]), n(() => {
|
|
839
|
+
let e = D.current;
|
|
734
840
|
if (e) {
|
|
735
841
|
if (!S) {
|
|
736
|
-
|
|
842
|
+
ne(!0);
|
|
737
843
|
return;
|
|
738
844
|
}
|
|
739
|
-
return
|
|
740
|
-
e &&
|
|
845
|
+
return ke(e, { onVisibleChange: (e) => {
|
|
846
|
+
e && ne(!0);
|
|
741
847
|
} });
|
|
742
848
|
}
|
|
743
849
|
}, [
|
|
744
850
|
S,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
851
|
+
N,
|
|
852
|
+
P,
|
|
853
|
+
ge
|
|
748
854
|
]), n(() => {
|
|
749
|
-
let e =
|
|
750
|
-
if (!(!e || !
|
|
855
|
+
let e = D.current;
|
|
856
|
+
if (!(!e || !I)) return Le(e, {
|
|
751
857
|
onParallax: (e) => {
|
|
752
|
-
|
|
858
|
+
V(!0), O.current || (H(e), U(0));
|
|
753
859
|
},
|
|
754
|
-
pointerActive: () =>
|
|
860
|
+
pointerActive: () => O.current
|
|
755
861
|
});
|
|
756
862
|
}, [
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
863
|
+
I,
|
|
864
|
+
N,
|
|
865
|
+
P,
|
|
866
|
+
ge
|
|
761
867
|
]);
|
|
762
|
-
let
|
|
763
|
-
if (!
|
|
868
|
+
let xe = (e) => {
|
|
869
|
+
if (!I || B) return;
|
|
764
870
|
let t = e.currentTarget.getBoundingClientRect();
|
|
765
|
-
t.width <= 0 || t.height <= 0 || (
|
|
766
|
-
},
|
|
767
|
-
let t =
|
|
768
|
-
|
|
769
|
-
},
|
|
770
|
-
if (!
|
|
771
|
-
|
|
871
|
+
t.width <= 0 || t.height <= 0 || (H(((e.clientX - t.left) / t.width - .5) * 2), U(((e.clientY - t.top) / t.height - .5) * 2));
|
|
872
|
+
}, G = (e) => {
|
|
873
|
+
let t = O.current;
|
|
874
|
+
O.current = !1, z(!1), B && t ? (H(je(e.getBoundingClientRect(), window.innerHeight)), U(0)) : B || (H(0), U(0));
|
|
875
|
+
}, Se = (e) => {
|
|
876
|
+
if (!I) return;
|
|
877
|
+
O.current = !0, e.pointerType === "mouse" && z(!0);
|
|
772
878
|
let t = e.currentTarget, n = () => {
|
|
773
|
-
|
|
879
|
+
G(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
774
880
|
};
|
|
775
881
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
776
|
-
},
|
|
777
|
-
if (_?.(e), !e.defaultPrevented &&
|
|
778
|
-
let t =
|
|
882
|
+
}, Ce = (e) => {
|
|
883
|
+
if (_?.(e), !e.defaultPrevented && F && !v?.trim()) {
|
|
884
|
+
let t = be({
|
|
779
885
|
experienceId: p,
|
|
780
886
|
playerBaseUrl: y,
|
|
781
887
|
useCurrentPageAsReturnUrl: !0
|
|
@@ -783,135 +889,135 @@ function je(e) {
|
|
|
783
889
|
t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
|
|
784
890
|
}
|
|
785
891
|
};
|
|
786
|
-
if (!
|
|
787
|
-
let
|
|
892
|
+
if (!N) return null;
|
|
893
|
+
let we = I && (ie || B), Te = L && (W || ue || me), Ee = [
|
|
788
894
|
"liforma-et",
|
|
789
|
-
|
|
895
|
+
te ? "liforma-et--scene" : "",
|
|
790
896
|
re(x),
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
897
|
+
we ? "liforma-et--parallax" : "",
|
|
898
|
+
B ? "liforma-et--scroll-parallax" : "",
|
|
899
|
+
L && !Te ? "liforma-et--loading" : "",
|
|
900
|
+
Te ? "liforma-et--revealed" : "",
|
|
795
901
|
C
|
|
796
|
-
].filter(Boolean).join(" "),
|
|
797
|
-
"--liforma-et-parallax-x":
|
|
798
|
-
"--liforma-et-parallax-y":
|
|
799
|
-
},
|
|
902
|
+
].filter(Boolean).join(" "), De = {
|
|
903
|
+
"--liforma-et-parallax-x": oe,
|
|
904
|
+
"--liforma-et-parallax-y": se
|
|
905
|
+
}, Oe = (e, t) => {
|
|
800
906
|
e.complete && t(!0);
|
|
801
|
-
},
|
|
907
|
+
}, K = /* @__PURE__ */ f(u, { children: [
|
|
802
908
|
/* @__PURE__ */ d("span", {
|
|
803
909
|
className: "liforma-et__placeholder",
|
|
804
910
|
"aria-hidden": "true"
|
|
805
911
|
}),
|
|
806
|
-
|
|
807
|
-
className:
|
|
808
|
-
src:
|
|
912
|
+
L && N.backgroundImage ? /* @__PURE__ */ d("img", {
|
|
913
|
+
className: He("liforma-et__background", ue),
|
|
914
|
+
src: N.backgroundImage,
|
|
809
915
|
alt: "",
|
|
810
916
|
decoding: "async",
|
|
811
917
|
ref: (e) => {
|
|
812
|
-
e &&
|
|
918
|
+
e && Oe(e, de);
|
|
813
919
|
},
|
|
814
|
-
onLoad: () =>
|
|
815
|
-
onError: () =>
|
|
920
|
+
onLoad: () => de(!0),
|
|
921
|
+
onError: () => de(!0)
|
|
816
922
|
}) : null,
|
|
817
|
-
|
|
818
|
-
className:
|
|
819
|
-
src:
|
|
923
|
+
L && ye ? /* @__PURE__ */ d("img", {
|
|
924
|
+
className: He("liforma-et__avatar", W),
|
|
925
|
+
src: ye,
|
|
820
926
|
alt: "",
|
|
821
927
|
decoding: "async",
|
|
822
928
|
ref: (e) => {
|
|
823
|
-
e &&
|
|
929
|
+
e && Oe(e, fe);
|
|
824
930
|
},
|
|
825
|
-
onLoad: () =>
|
|
931
|
+
onLoad: () => fe(!0),
|
|
826
932
|
onError: () => {
|
|
827
|
-
|
|
933
|
+
N.fallbackImage ? le(!0) : fe(!0);
|
|
828
934
|
}
|
|
829
935
|
}) : null,
|
|
830
|
-
|
|
831
|
-
className:
|
|
832
|
-
src:
|
|
936
|
+
L && N.foregroundImage ? /* @__PURE__ */ d("img", {
|
|
937
|
+
className: He("liforma-et__foreground", me),
|
|
938
|
+
src: N.foregroundImage,
|
|
833
939
|
alt: "",
|
|
834
940
|
decoding: "async",
|
|
835
941
|
ref: (e) => {
|
|
836
|
-
e &&
|
|
942
|
+
e && Oe(e, he);
|
|
837
943
|
},
|
|
838
|
-
onLoad: () =>
|
|
839
|
-
onError: () =>
|
|
944
|
+
onLoad: () => he(!0),
|
|
945
|
+
onError: () => he(!0)
|
|
840
946
|
}) : null
|
|
841
|
-
] }),
|
|
842
|
-
onPointerDown:
|
|
843
|
-
onPointerUp: (e) =>
|
|
844
|
-
onPointerCancel: (e) =>
|
|
947
|
+
] }), Ae = {
|
|
948
|
+
onPointerDown: Se,
|
|
949
|
+
onPointerUp: (e) => G(e.currentTarget),
|
|
950
|
+
onPointerCancel: (e) => G(e.currentTarget),
|
|
845
951
|
onPointerEnter: (e) => {
|
|
846
|
-
|
|
952
|
+
I && e.pointerType === "mouse" && z(!0);
|
|
847
953
|
},
|
|
848
|
-
onPointerMove:
|
|
954
|
+
onPointerMove: xe,
|
|
849
955
|
onPointerLeave: () => {
|
|
850
|
-
|
|
956
|
+
O.current || (z(!1), B || (H(0), U(0)));
|
|
851
957
|
}
|
|
852
|
-
},
|
|
853
|
-
|
|
854
|
-
};
|
|
855
|
-
return
|
|
856
|
-
ref:
|
|
857
|
-
className:
|
|
858
|
-
style:
|
|
859
|
-
href:
|
|
958
|
+
}, q = (e) => {
|
|
959
|
+
D.current = e;
|
|
960
|
+
};
|
|
961
|
+
return P === "anchor" && ge ? /* @__PURE__ */ d("a", {
|
|
962
|
+
ref: q,
|
|
963
|
+
className: Ee,
|
|
964
|
+
style: De,
|
|
965
|
+
href: ge,
|
|
860
966
|
target: h,
|
|
861
967
|
rel: g,
|
|
862
968
|
"aria-label": l,
|
|
863
|
-
onClick:
|
|
864
|
-
...
|
|
865
|
-
children:
|
|
866
|
-
}) :
|
|
969
|
+
onClick: Ce,
|
|
970
|
+
...Ae,
|
|
971
|
+
children: K
|
|
972
|
+
}) : P === "button" ? /* @__PURE__ */ d("button", {
|
|
867
973
|
type: "button",
|
|
868
|
-
ref:
|
|
869
|
-
className:
|
|
870
|
-
style:
|
|
974
|
+
ref: q,
|
|
975
|
+
className: Ee,
|
|
976
|
+
style: De,
|
|
871
977
|
"aria-label": l,
|
|
872
|
-
onClick:
|
|
873
|
-
...
|
|
874
|
-
children:
|
|
978
|
+
onClick: Ce,
|
|
979
|
+
...Ae,
|
|
980
|
+
children: K
|
|
875
981
|
}) : /* @__PURE__ */ d("div", {
|
|
876
|
-
ref:
|
|
877
|
-
className:
|
|
878
|
-
style:
|
|
982
|
+
ref: q,
|
|
983
|
+
className: Ee,
|
|
984
|
+
style: De,
|
|
879
985
|
role: l ? "img" : void 0,
|
|
880
986
|
"aria-label": l || void 0,
|
|
881
987
|
"aria-hidden": l ? void 0 : !0,
|
|
882
|
-
...
|
|
883
|
-
children:
|
|
988
|
+
...Ae,
|
|
989
|
+
children: K
|
|
884
990
|
});
|
|
885
991
|
}
|
|
886
992
|
//#endregion
|
|
887
993
|
//#region src/widget/styles.ts
|
|
888
|
-
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";
|
|
889
|
-
function
|
|
994
|
+
var We = "\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", Ge = "liforma-experience-widget-styles";
|
|
995
|
+
function Ke(e = We) {
|
|
890
996
|
if (typeof document > "u") return;
|
|
891
|
-
let t = document.getElementById(
|
|
997
|
+
let t = document.getElementById(Ge);
|
|
892
998
|
if (t) {
|
|
893
999
|
t.textContent = e;
|
|
894
1000
|
return;
|
|
895
1001
|
}
|
|
896
1002
|
let n = document.createElement("style");
|
|
897
|
-
n.id =
|
|
1003
|
+
n.id = Ge, n.textContent = e, document.head.append(n);
|
|
898
1004
|
}
|
|
899
1005
|
//#endregion
|
|
900
1006
|
//#region src/shims/apiBaseUrl.ts
|
|
901
|
-
var
|
|
902
|
-
function
|
|
1007
|
+
var qe = "https://api.liforma.ai", Je = "http://localhost:3001";
|
|
1008
|
+
function Ye() {
|
|
903
1009
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
904
1010
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
905
1011
|
if (typeof document > "u") return null;
|
|
906
1012
|
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();
|
|
907
1013
|
return t ? t.replace(/\/$/, "") : null;
|
|
908
1014
|
}
|
|
909
|
-
function
|
|
910
|
-
return
|
|
1015
|
+
function Xe() {
|
|
1016
|
+
return Ye() || (me() ? Je : qe);
|
|
911
1017
|
}
|
|
912
1018
|
//#endregion
|
|
913
1019
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
914
|
-
function
|
|
1020
|
+
function Ze(e) {
|
|
915
1021
|
if (!e || typeof e != "object") return null;
|
|
916
1022
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
917
1023
|
return n ? {
|
|
@@ -920,10 +1026,10 @@ function ze(e) {
|
|
|
920
1026
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
921
1027
|
} : null;
|
|
922
1028
|
}
|
|
923
|
-
async function
|
|
1029
|
+
async function Qe(e, t) {
|
|
924
1030
|
let n = e.trim();
|
|
925
1031
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
926
|
-
let r = (t?.apiBaseUrl ??
|
|
1032
|
+
let r = (t?.apiBaseUrl ?? Xe()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
927
1033
|
method: "GET",
|
|
928
1034
|
headers: { Accept: "application/json" },
|
|
929
1035
|
signal: t?.signal
|
|
@@ -943,7 +1049,7 @@ async function Be(e, t) {
|
|
|
943
1049
|
throw Error("Experience preview returned invalid JSON.");
|
|
944
1050
|
}
|
|
945
1051
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
946
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
1052
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Ze(o.galleryThumb);
|
|
947
1053
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
948
1054
|
return {
|
|
949
1055
|
experienceId: s || n,
|
|
@@ -953,7 +1059,7 @@ async function Be(e, t) {
|
|
|
953
1059
|
}
|
|
954
1060
|
//#endregion
|
|
955
1061
|
//#region src/v2/errors/LiformaError.ts
|
|
956
|
-
var
|
|
1062
|
+
var $e = class extends Error {
|
|
957
1063
|
code;
|
|
958
1064
|
requestId;
|
|
959
1065
|
status;
|
|
@@ -962,16 +1068,16 @@ var Ve = class extends Error {
|
|
|
962
1068
|
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;
|
|
963
1069
|
}
|
|
964
1070
|
};
|
|
965
|
-
function
|
|
1071
|
+
function et(e) {
|
|
966
1072
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
967
1073
|
}
|
|
968
|
-
function
|
|
1074
|
+
function tt(e, t, n) {
|
|
969
1075
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
970
1076
|
try {
|
|
971
1077
|
i = JSON.parse(t);
|
|
972
1078
|
} catch {}
|
|
973
|
-
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 } =
|
|
974
|
-
return new
|
|
1079
|
+
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 } = et(a) ?? et(i) ?? {};
|
|
1080
|
+
return new $e(u, {
|
|
975
1081
|
code: l,
|
|
976
1082
|
requestId: d,
|
|
977
1083
|
status: e,
|
|
@@ -980,13 +1086,13 @@ function Ue(e, t, n) {
|
|
|
980
1086
|
}
|
|
981
1087
|
//#endregion
|
|
982
1088
|
//#region src/v2/api/captureAttribution.ts
|
|
983
|
-
var
|
|
1089
|
+
var nt = 128, rt = /[\u0000-\u001f\u007f]/g;
|
|
984
1090
|
function Y(e) {
|
|
985
1091
|
if (!e) return;
|
|
986
|
-
let t = e.replace(
|
|
987
|
-
if (t) return t.slice(0,
|
|
1092
|
+
let t = e.replace(rt, "").trim();
|
|
1093
|
+
if (t) return t.slice(0, nt);
|
|
988
1094
|
}
|
|
989
|
-
function
|
|
1095
|
+
function it(e) {
|
|
990
1096
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
991
1097
|
return {
|
|
992
1098
|
...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
|
|
@@ -996,7 +1102,7 @@ function Ke(e) {
|
|
|
996
1102
|
...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
|
|
997
1103
|
};
|
|
998
1104
|
}
|
|
999
|
-
function
|
|
1105
|
+
function at(e) {
|
|
1000
1106
|
if (e === !1) return;
|
|
1001
1107
|
if (e && typeof e == "object") {
|
|
1002
1108
|
let t = {
|
|
@@ -1010,7 +1116,7 @@ function qe(e) {
|
|
|
1010
1116
|
return Object.keys(t).length ? t : void 0;
|
|
1011
1117
|
}
|
|
1012
1118
|
if (typeof window > "u") return;
|
|
1013
|
-
let t =
|
|
1119
|
+
let t = it(window.location?.search), n = Y(document.referrer || void 0), r = {
|
|
1014
1120
|
...t,
|
|
1015
1121
|
...n ? { referrer: n } : {}
|
|
1016
1122
|
};
|
|
@@ -1018,19 +1124,19 @@ function qe(e) {
|
|
|
1018
1124
|
}
|
|
1019
1125
|
//#endregion
|
|
1020
1126
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
1021
|
-
function
|
|
1127
|
+
function ot(e) {
|
|
1022
1128
|
let t = e.locale?.trim();
|
|
1023
1129
|
if (t) return t;
|
|
1024
1130
|
let n = e.language?.trim();
|
|
1025
1131
|
if (n) return n;
|
|
1026
1132
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
1027
1133
|
}
|
|
1028
|
-
function
|
|
1134
|
+
function st(e) {
|
|
1029
1135
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
1030
1136
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
1031
1137
|
return t || n || void 0;
|
|
1032
1138
|
}
|
|
1033
|
-
function
|
|
1139
|
+
function ct(e, t) {
|
|
1034
1140
|
let n = e.trim();
|
|
1035
1141
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
1036
1142
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -1038,7 +1144,7 @@ function Xe(e, t) {
|
|
|
1038
1144
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
1039
1145
|
let i = t.experienceId.trim();
|
|
1040
1146
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
1041
|
-
let a =
|
|
1147
|
+
let a = ot(t), o = st(t), s = t.idempotencyKey?.trim();
|
|
1042
1148
|
return {
|
|
1043
1149
|
url: r.toString(),
|
|
1044
1150
|
init: {
|
|
@@ -1057,7 +1163,7 @@ function Xe(e, t) {
|
|
|
1057
1163
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
1058
1164
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
1059
1165
|
...(() => {
|
|
1060
|
-
let e =
|
|
1166
|
+
let e = at(t.attribution);
|
|
1061
1167
|
return e ? { attribution: e } : {};
|
|
1062
1168
|
})(),
|
|
1063
1169
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -1067,16 +1173,16 @@ function Xe(e, t) {
|
|
|
1067
1173
|
}
|
|
1068
1174
|
//#endregion
|
|
1069
1175
|
//#region src/v2/types/sessionLaunch.ts
|
|
1070
|
-
function
|
|
1176
|
+
function lt(e) {
|
|
1071
1177
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
1072
1178
|
}
|
|
1073
1179
|
function X(e) {
|
|
1074
1180
|
return typeof e == "boolean";
|
|
1075
1181
|
}
|
|
1076
|
-
function
|
|
1077
|
-
if (!
|
|
1182
|
+
function ut(e) {
|
|
1183
|
+
if (!lt(e)) return null;
|
|
1078
1184
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
1079
|
-
return !
|
|
1185
|
+
return !lt(t) || !lt(n) || !lt(r) || !lt(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
|
|
1080
1186
|
speech: {
|
|
1081
1187
|
input: t.input,
|
|
1082
1188
|
output: t.output,
|
|
@@ -1087,8 +1193,8 @@ function Qe(e) {
|
|
|
1087
1193
|
tools: { enabled: i.enabled }
|
|
1088
1194
|
};
|
|
1089
1195
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return !
|
|
1196
|
+
function dt(e) {
|
|
1197
|
+
return !lt(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
|
|
1092
1198
|
speech: {
|
|
1093
1199
|
input: e.speechInput,
|
|
1094
1200
|
output: e.speechOutput,
|
|
@@ -1099,12 +1205,12 @@ function $e(e) {
|
|
|
1099
1205
|
tools: { enabled: e.tools }
|
|
1100
1206
|
};
|
|
1101
1207
|
}
|
|
1102
|
-
function
|
|
1103
|
-
return
|
|
1208
|
+
function ft(e) {
|
|
1209
|
+
return ut(e) ?? dt(e);
|
|
1104
1210
|
}
|
|
1105
|
-
function
|
|
1106
|
-
if (!
|
|
1107
|
-
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 =
|
|
1211
|
+
function pt(e) {
|
|
1212
|
+
if (!lt(e)) throw Error("Session Launch response is missing session.");
|
|
1213
|
+
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 = ft(e.capabilities), l = mt(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;
|
|
1108
1214
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
1109
1215
|
return {
|
|
1110
1216
|
id: t,
|
|
@@ -1120,11 +1226,11 @@ function tt(e) {
|
|
|
1120
1226
|
...d ? { createdAt: d } : {}
|
|
1121
1227
|
};
|
|
1122
1228
|
}
|
|
1123
|
-
function
|
|
1229
|
+
function mt(e) {
|
|
1124
1230
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
1125
1231
|
let t = [];
|
|
1126
1232
|
for (let n of e) {
|
|
1127
|
-
if (!
|
|
1233
|
+
if (!lt(n)) continue;
|
|
1128
1234
|
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() : "";
|
|
1129
1235
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
1130
1236
|
axis: e,
|
|
@@ -1135,104 +1241,104 @@ function nt(e) {
|
|
|
1135
1241
|
}
|
|
1136
1242
|
return t.length > 0 ? t : void 0;
|
|
1137
1243
|
}
|
|
1138
|
-
function
|
|
1244
|
+
function ht(e) {
|
|
1139
1245
|
let t = e.localeVoiceFallbacks;
|
|
1140
1246
|
if (t?.length) for (let e of t) {
|
|
1141
1247
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
1142
1248
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
1143
1249
|
}
|
|
1144
1250
|
}
|
|
1145
|
-
function
|
|
1146
|
-
if (!
|
|
1251
|
+
function gt(e) {
|
|
1252
|
+
if (!lt(e)) throw Error("Session Launch response must be a JSON object.");
|
|
1147
1253
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
1148
1254
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
1149
|
-
let n =
|
|
1150
|
-
return
|
|
1255
|
+
let n = pt(e.session);
|
|
1256
|
+
return ht(n), {
|
|
1151
1257
|
session: n,
|
|
1152
1258
|
launch: t
|
|
1153
1259
|
};
|
|
1154
1260
|
}
|
|
1155
1261
|
//#endregion
|
|
1156
1262
|
//#region src/v2/api/mintPublicSession.ts
|
|
1157
|
-
function
|
|
1263
|
+
function _t() {
|
|
1158
1264
|
try {
|
|
1159
1265
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
1160
1266
|
} catch {}
|
|
1161
1267
|
}
|
|
1162
|
-
function
|
|
1268
|
+
function vt(e) {
|
|
1163
1269
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
1164
1270
|
}
|
|
1165
|
-
function
|
|
1166
|
-
let n =
|
|
1271
|
+
function yt(e, t) {
|
|
1272
|
+
let n = _t(), r = vt(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
1167
1273
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
1168
1274
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
1169
1275
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
1170
|
-
return new
|
|
1276
|
+
return new $e(`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.`, {
|
|
1171
1277
|
code: "ORIGIN_NOT_ALLOWED",
|
|
1172
1278
|
requestId: t.requestId,
|
|
1173
1279
|
status: t.status,
|
|
1174
1280
|
details: a
|
|
1175
1281
|
});
|
|
1176
1282
|
}
|
|
1177
|
-
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new
|
|
1283
|
+
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new $e(`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”.`, {
|
|
1178
1284
|
code: "BROWSER_EMBEDS_DISABLED",
|
|
1179
1285
|
requestId: t.requestId,
|
|
1180
1286
|
status: t.status,
|
|
1181
1287
|
details: a
|
|
1182
|
-
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new
|
|
1288
|
+
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new $e(`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.`, {
|
|
1183
1289
|
code: "EXPERIENCE_UNAVAILABLE",
|
|
1184
1290
|
requestId: t.requestId,
|
|
1185
1291
|
status: t.status,
|
|
1186
1292
|
details: a
|
|
1187
1293
|
}) : t;
|
|
1188
1294
|
}
|
|
1189
|
-
function
|
|
1295
|
+
function bt(e) {
|
|
1190
1296
|
let t = e?.locale?.trim();
|
|
1191
1297
|
if (t) return t;
|
|
1192
1298
|
let n = e?.language?.trim();
|
|
1193
1299
|
if (n) return n;
|
|
1194
1300
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
1195
1301
|
}
|
|
1196
|
-
function
|
|
1302
|
+
function xt(e) {
|
|
1197
1303
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
1198
|
-
if (t && n && t !== n) throw new
|
|
1304
|
+
if (t && n && t !== n) throw new $e("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
1199
1305
|
return t || n || void 0;
|
|
1200
1306
|
}
|
|
1201
|
-
function
|
|
1202
|
-
let n = { experienceId: e }, r =
|
|
1307
|
+
function St(e, t) {
|
|
1308
|
+
let n = { experienceId: e }, r = bt(t);
|
|
1203
1309
|
r && (n.locale = r);
|
|
1204
|
-
let i =
|
|
1310
|
+
let i = xt(t);
|
|
1205
1311
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
1206
|
-
let a =
|
|
1312
|
+
let a = at(t?.attribution);
|
|
1207
1313
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
1208
1314
|
}
|
|
1209
|
-
async function
|
|
1210
|
-
let n =
|
|
1315
|
+
async function Ct(e, t) {
|
|
1316
|
+
let n = Xe(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
1211
1317
|
method: "POST",
|
|
1212
1318
|
headers: {
|
|
1213
1319
|
"Content-Type": "application/json",
|
|
1214
1320
|
...r ? { "Idempotency-Key": r } : {}
|
|
1215
1321
|
},
|
|
1216
|
-
body: JSON.stringify(
|
|
1322
|
+
body: JSON.stringify(St(e, t))
|
|
1217
1323
|
});
|
|
1218
1324
|
if (!i.ok) {
|
|
1219
1325
|
let t = await i.text();
|
|
1220
|
-
throw
|
|
1326
|
+
throw yt(e, tt(i.status, t, i.headers));
|
|
1221
1327
|
}
|
|
1222
1328
|
let a;
|
|
1223
1329
|
try {
|
|
1224
1330
|
a = await i.json();
|
|
1225
1331
|
} catch {
|
|
1226
|
-
throw new
|
|
1332
|
+
throw new $e("Browser session mint returned invalid JSON.", {
|
|
1227
1333
|
code: "INVALID_RESPONSE",
|
|
1228
1334
|
status: i.status,
|
|
1229
1335
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
1230
1336
|
});
|
|
1231
1337
|
}
|
|
1232
|
-
return
|
|
1338
|
+
return gt(a);
|
|
1233
1339
|
}
|
|
1234
|
-
async function
|
|
1235
|
-
let n =
|
|
1340
|
+
async function wt(e, t) {
|
|
1341
|
+
let n = ct(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
1236
1342
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
1237
1343
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
1238
1344
|
try {
|
|
@@ -1245,9 +1351,9 @@ async function ft(e, t) {
|
|
|
1245
1351
|
}
|
|
1246
1352
|
if (!o.ok) {
|
|
1247
1353
|
let e = await o.text();
|
|
1248
|
-
throw
|
|
1354
|
+
throw tt(o.status, e, o.headers);
|
|
1249
1355
|
}
|
|
1250
|
-
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new
|
|
1356
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new $e("Session endpoint must return a JSON Session Launch response.", {
|
|
1251
1357
|
code: "INVALID_RESPONSE",
|
|
1252
1358
|
status: o.status,
|
|
1253
1359
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
@@ -1256,20 +1362,20 @@ async function ft(e, t) {
|
|
|
1256
1362
|
try {
|
|
1257
1363
|
s = await o.json();
|
|
1258
1364
|
} catch {
|
|
1259
|
-
throw new
|
|
1365
|
+
throw new $e("Session endpoint returned invalid JSON.", {
|
|
1260
1366
|
code: "INVALID_RESPONSE",
|
|
1261
1367
|
status: o.status,
|
|
1262
1368
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
1263
1369
|
});
|
|
1264
1370
|
}
|
|
1265
|
-
return
|
|
1371
|
+
return gt(s);
|
|
1266
1372
|
}
|
|
1267
1373
|
//#endregion
|
|
1268
1374
|
//#region src/v2/conversationProcessor.ts
|
|
1269
|
-
function
|
|
1375
|
+
function Tt(e) {
|
|
1270
1376
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
1271
1377
|
}
|
|
1272
|
-
function
|
|
1378
|
+
function Et(e) {
|
|
1273
1379
|
if (typeof e == "string") {
|
|
1274
1380
|
let t = e.trim();
|
|
1275
1381
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -1283,24 +1389,24 @@ function mt(e) {
|
|
|
1283
1389
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
1284
1390
|
};
|
|
1285
1391
|
}
|
|
1286
|
-
async function
|
|
1392
|
+
async function Dt(e, t) {
|
|
1287
1393
|
let n = await e(t);
|
|
1288
|
-
return
|
|
1394
|
+
return Tt(n) ? {
|
|
1289
1395
|
kind: "stream",
|
|
1290
1396
|
stream: n
|
|
1291
1397
|
} : {
|
|
1292
1398
|
kind: "complete",
|
|
1293
|
-
speech:
|
|
1399
|
+
speech: Et(n)
|
|
1294
1400
|
};
|
|
1295
1401
|
}
|
|
1296
1402
|
//#endregion
|
|
1297
1403
|
//#region src/v2/embed/playerReachability.ts
|
|
1298
|
-
var
|
|
1299
|
-
function
|
|
1404
|
+
var Ot = "3002";
|
|
1405
|
+
function kt(e) {
|
|
1300
1406
|
let t = new URL(e);
|
|
1301
|
-
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 ||
|
|
1407
|
+
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 || Ot}. 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.`;
|
|
1302
1408
|
}
|
|
1303
|
-
async function
|
|
1409
|
+
async function At(e, t) {
|
|
1304
1410
|
try {
|
|
1305
1411
|
await fetch(e, {
|
|
1306
1412
|
method: "GET",
|
|
@@ -1308,25 +1414,25 @@ async function vt(e, t) {
|
|
|
1308
1414
|
signal: AbortSignal.timeout(8e3)
|
|
1309
1415
|
});
|
|
1310
1416
|
} catch {
|
|
1311
|
-
throw Error(
|
|
1417
|
+
throw Error(kt(t));
|
|
1312
1418
|
}
|
|
1313
1419
|
}
|
|
1314
|
-
function
|
|
1420
|
+
function jt(e, t, n, r) {
|
|
1315
1421
|
try {
|
|
1316
1422
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
1317
1423
|
} catch (e) {
|
|
1318
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
1424
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(kt(n), { cause: e }) : e;
|
|
1319
1425
|
}
|
|
1320
1426
|
}
|
|
1321
|
-
var
|
|
1322
|
-
function
|
|
1323
|
-
return typeof e == "number" &&
|
|
1427
|
+
var Mt = new Set([1, 2]);
|
|
1428
|
+
function Nt(e) {
|
|
1429
|
+
return typeof e == "number" && Mt.has(e);
|
|
1324
1430
|
}
|
|
1325
|
-
var
|
|
1326
|
-
function
|
|
1431
|
+
var Pt = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.interactionChange".split("."));
|
|
1432
|
+
function Ft(e) {
|
|
1327
1433
|
if (!e || typeof e != "object") return null;
|
|
1328
1434
|
let t = e;
|
|
1329
|
-
if (!
|
|
1435
|
+
if (!Nt(t.schemaVersion) || !t.type || !Pt.has(t.type)) return null;
|
|
1330
1436
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
1331
1437
|
if (t.type === "fullWindow") {
|
|
1332
1438
|
let e = t.payload;
|
|
@@ -1349,10 +1455,10 @@ function Ct(e) {
|
|
|
1349
1455
|
let n = t.payload;
|
|
1350
1456
|
return !n || typeof n != "object" ? null : t;
|
|
1351
1457
|
}
|
|
1352
|
-
function
|
|
1458
|
+
function It(e, t, n) {
|
|
1353
1459
|
let r = e.trim();
|
|
1354
1460
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
1355
|
-
let i = n?.startButton, a = n?.theme, o = n?.showFeedback;
|
|
1461
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction;
|
|
1356
1462
|
return {
|
|
1357
1463
|
type: "launch",
|
|
1358
1464
|
schemaVersion: 2,
|
|
@@ -1361,24 +1467,25 @@ function wt(e, t, n) {
|
|
|
1361
1467
|
...t === void 0 ? {} : { session: t },
|
|
1362
1468
|
...i ? { startButton: i } : {},
|
|
1363
1469
|
...a ? { theme: a } : {},
|
|
1364
|
-
...o === void 0 ? {} : { showFeedback: o }
|
|
1470
|
+
...o === void 0 ? {} : { showFeedback: o },
|
|
1471
|
+
...s ? { interaction: s } : {}
|
|
1365
1472
|
}
|
|
1366
1473
|
};
|
|
1367
1474
|
}
|
|
1368
|
-
function
|
|
1475
|
+
function Lt() {
|
|
1369
1476
|
return {
|
|
1370
1477
|
type: "parentHello",
|
|
1371
1478
|
schemaVersion: 2
|
|
1372
1479
|
};
|
|
1373
1480
|
}
|
|
1374
|
-
function
|
|
1481
|
+
function Rt(e) {
|
|
1375
1482
|
return {
|
|
1376
1483
|
type: "widgetSetChrome",
|
|
1377
1484
|
schemaVersion: 2,
|
|
1378
1485
|
payload: { mode: e }
|
|
1379
1486
|
};
|
|
1380
1487
|
}
|
|
1381
|
-
function
|
|
1488
|
+
function zt() {
|
|
1382
1489
|
return {
|
|
1383
1490
|
type: "widgetToggleAudioSettings",
|
|
1384
1491
|
schemaVersion: 2,
|
|
@@ -1387,8 +1494,8 @@ function Dt() {
|
|
|
1387
1494
|
}
|
|
1388
1495
|
//#endregion
|
|
1389
1496
|
//#region src/v2/embed/fullWindowHost.ts
|
|
1390
|
-
var
|
|
1391
|
-
function
|
|
1497
|
+
var Bt = "2147483000";
|
|
1498
|
+
function Vt(e) {
|
|
1392
1499
|
let { style: t } = e;
|
|
1393
1500
|
return {
|
|
1394
1501
|
position: t.position,
|
|
@@ -1406,11 +1513,11 @@ function kt(e) {
|
|
|
1406
1513
|
maxHeight: t.maxHeight
|
|
1407
1514
|
};
|
|
1408
1515
|
}
|
|
1409
|
-
function
|
|
1516
|
+
function Ht(e) {
|
|
1410
1517
|
let { style: t } = e;
|
|
1411
|
-
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 =
|
|
1518
|
+
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 = Bt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
1412
1519
|
}
|
|
1413
|
-
function
|
|
1520
|
+
function Ut(e, t) {
|
|
1414
1521
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
1415
1522
|
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 = "";
|
|
1416
1523
|
return;
|
|
@@ -1420,20 +1527,20 @@ function jt(e, t) {
|
|
|
1420
1527
|
}
|
|
1421
1528
|
//#endregion
|
|
1422
1529
|
//#region src/v2/embed/iframeHost.ts
|
|
1423
|
-
function
|
|
1530
|
+
function Wt(e) {
|
|
1424
1531
|
return e;
|
|
1425
1532
|
}
|
|
1426
1533
|
function Z() {
|
|
1427
1534
|
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)}`;
|
|
1428
1535
|
}
|
|
1429
|
-
var
|
|
1430
|
-
function
|
|
1536
|
+
var Gt = 3e4;
|
|
1537
|
+
function Kt(e) {
|
|
1431
1538
|
let t = e.container;
|
|
1432
1539
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
1433
1540
|
let n = document.createElement("iframe");
|
|
1434
1541
|
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true");
|
|
1435
1542
|
let r = !1, i = !1, a = null, o = t.closest(".liforma-experience-shell") instanceof HTMLElement ? t.closest(".liforma-experience-shell") : t, s = (t) => {
|
|
1436
|
-
i !== t && (i = t, t ? (a =
|
|
1543
|
+
i !== t && (i = t, t ? (a = Vt(o), Ht(o)) : (Ut(o, a), a = null), e.onFullWindowChange?.(t));
|
|
1437
1544
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
1438
1545
|
p = e, m = t;
|
|
1439
1546
|
}), g = () => {
|
|
@@ -1444,10 +1551,10 @@ function Pt(e) {
|
|
|
1444
1551
|
let i = Date.now();
|
|
1445
1552
|
if (d > 0 && i - d < 250) return;
|
|
1446
1553
|
d = i, g();
|
|
1447
|
-
let a =
|
|
1554
|
+
let a = It(t.launch, t.session, t.chrome), o = () => {
|
|
1448
1555
|
if (r) return;
|
|
1449
1556
|
let t = n.contentWindow;
|
|
1450
|
-
t &&
|
|
1557
|
+
t && jt(t, a, e.playerOrigin);
|
|
1451
1558
|
};
|
|
1452
1559
|
o();
|
|
1453
1560
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -1455,17 +1562,17 @@ function Pt(e) {
|
|
|
1455
1562
|
r || !l || _(l);
|
|
1456
1563
|
}, y = () => {
|
|
1457
1564
|
if (u += 1, u === 1) {
|
|
1458
|
-
|
|
1565
|
+
At(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
1459
1566
|
return;
|
|
1460
1567
|
}
|
|
1461
1568
|
d = 0, v();
|
|
1462
1569
|
}, b = () => {
|
|
1463
|
-
u > 0 || m?.(Error(
|
|
1570
|
+
u > 0 || m?.(Error(kt(e.playerOrigin)));
|
|
1464
1571
|
};
|
|
1465
1572
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
1466
1573
|
let x = (t) => {
|
|
1467
1574
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
1468
|
-
let i =
|
|
1575
|
+
let i = Ft(t.data);
|
|
1469
1576
|
if (i) switch (i.type) {
|
|
1470
1577
|
case "close":
|
|
1471
1578
|
e.onClose?.(i.payload);
|
|
@@ -1504,7 +1611,7 @@ function Pt(e) {
|
|
|
1504
1611
|
e.onUserSpeechEnded?.(i.payload);
|
|
1505
1612
|
break;
|
|
1506
1613
|
case "modeChange":
|
|
1507
|
-
e.onActivityChange?.(
|
|
1614
|
+
e.onActivityChange?.(Wt(i.payload.mode));
|
|
1508
1615
|
break;
|
|
1509
1616
|
case "activityChange":
|
|
1510
1617
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -1560,8 +1667,8 @@ function Pt(e) {
|
|
|
1560
1667
|
let S = (t, i) => {
|
|
1561
1668
|
if (r) return;
|
|
1562
1669
|
let a = n.contentWindow;
|
|
1563
|
-
if (!a) throw Error(
|
|
1564
|
-
|
|
1670
|
+
if (!a) throw Error(kt(e.playerOrigin));
|
|
1671
|
+
jt(a, t, e.playerOrigin, i);
|
|
1565
1672
|
}, C = (e, t = 12e4, n) => {
|
|
1566
1673
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
|
|
1567
1674
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -1578,7 +1685,7 @@ function Pt(e) {
|
|
|
1578
1685
|
return h;
|
|
1579
1686
|
},
|
|
1580
1687
|
postParentHello() {
|
|
1581
|
-
S(
|
|
1688
|
+
S(Lt());
|
|
1582
1689
|
},
|
|
1583
1690
|
postLaunch(e, t, n) {
|
|
1584
1691
|
r || (l = {
|
|
@@ -1600,10 +1707,10 @@ function Pt(e) {
|
|
|
1600
1707
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
1601
1708
|
},
|
|
1602
1709
|
postWidgetSetChrome(e) {
|
|
1603
|
-
S(
|
|
1710
|
+
S(Rt(e));
|
|
1604
1711
|
},
|
|
1605
1712
|
postWidgetToggleAudioSettings() {
|
|
1606
|
-
S(
|
|
1713
|
+
S(zt());
|
|
1607
1714
|
},
|
|
1608
1715
|
speak(e) {
|
|
1609
1716
|
return C({
|
|
@@ -1725,7 +1832,7 @@ function Pt(e) {
|
|
|
1725
1832
|
audio: e.audio,
|
|
1726
1833
|
byteLength: e.byteLength
|
|
1727
1834
|
}
|
|
1728
|
-
},
|
|
1835
|
+
}, Gt, [e.audio]);
|
|
1729
1836
|
},
|
|
1730
1837
|
speechUtteranceSetTranscript(e) {
|
|
1731
1838
|
return C({
|
|
@@ -1797,6 +1904,36 @@ function Pt(e) {
|
|
|
1797
1904
|
}
|
|
1798
1905
|
});
|
|
1799
1906
|
},
|
|
1907
|
+
setStage(e) {
|
|
1908
|
+
return C({
|
|
1909
|
+
type: "setStage",
|
|
1910
|
+
schemaVersion: 2,
|
|
1911
|
+
payload: {
|
|
1912
|
+
correlationId: Z(),
|
|
1913
|
+
stage: e
|
|
1914
|
+
}
|
|
1915
|
+
});
|
|
1916
|
+
},
|
|
1917
|
+
setPipBackground(e) {
|
|
1918
|
+
return C({
|
|
1919
|
+
type: "setPipBackground",
|
|
1920
|
+
schemaVersion: 2,
|
|
1921
|
+
payload: {
|
|
1922
|
+
correlationId: Z(),
|
|
1923
|
+
pipBackground: e
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
},
|
|
1927
|
+
setPipShadow(e) {
|
|
1928
|
+
return C({
|
|
1929
|
+
type: "setPipShadow",
|
|
1930
|
+
schemaVersion: 2,
|
|
1931
|
+
payload: {
|
|
1932
|
+
correlationId: Z(),
|
|
1933
|
+
pipShadow: e
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
},
|
|
1800
1937
|
setInteraction(e) {
|
|
1801
1938
|
return C({
|
|
1802
1939
|
type: "setInteraction",
|
|
@@ -1857,7 +1994,7 @@ function Pt(e) {
|
|
|
1857
1994
|
}
|
|
1858
1995
|
//#endregion
|
|
1859
1996
|
//#region src/v2/embed/readyGate.ts
|
|
1860
|
-
function
|
|
1997
|
+
function qt(e) {
|
|
1861
1998
|
let t, n = !1, r = !1, i = () => {
|
|
1862
1999
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
1863
2000
|
};
|
|
@@ -1872,9 +2009,9 @@ function Ft(e) {
|
|
|
1872
2009
|
}
|
|
1873
2010
|
//#endregion
|
|
1874
2011
|
//#region src/v2/sdkRelease.ts
|
|
1875
|
-
var
|
|
2012
|
+
var Jt = `sdk@${{
|
|
1876
2013
|
name: "@liforma/client",
|
|
1877
|
-
version: "0.4.
|
|
2014
|
+
version: "0.4.11",
|
|
1878
2015
|
type: "module",
|
|
1879
2016
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1880
2017
|
license: "MIT",
|
|
@@ -2093,50 +2230,50 @@ var It = `sdk@${{
|
|
|
2093
2230
|
vitest: "^4.1.10",
|
|
2094
2231
|
wrangler: "^4.101.0"
|
|
2095
2232
|
}
|
|
2096
|
-
}.version}`,
|
|
2097
|
-
function
|
|
2233
|
+
}.version}`, Yt = "https://player.liforma.ai/embed", Xt = "http://localhost:3002/embed";
|
|
2234
|
+
function Zt() {
|
|
2098
2235
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
2099
2236
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
2100
2237
|
if (typeof document > "u") return null;
|
|
2101
2238
|
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();
|
|
2102
2239
|
return t ? t.replace(/\/$/, "") : null;
|
|
2103
2240
|
}
|
|
2104
|
-
function
|
|
2105
|
-
let e =
|
|
2106
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
2241
|
+
function Qt() {
|
|
2242
|
+
let e = Zt();
|
|
2243
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : me() ? Xt : Yt;
|
|
2107
2244
|
}
|
|
2108
|
-
function
|
|
2245
|
+
function $t(e, t) {
|
|
2109
2246
|
return e?.trim() || t?.trim() || void 0;
|
|
2110
2247
|
}
|
|
2111
|
-
function
|
|
2112
|
-
let
|
|
2113
|
-
|
|
2114
|
-
let
|
|
2115
|
-
return
|
|
2248
|
+
function en(e, t, n, r, i, a, o, s, c, l, u) {
|
|
2249
|
+
let d = (e ?? Qt()).replace(/\/$/, ""), f = d.endsWith("/embed") ? d : `${d}/embed`, p = new URL(f), m = n?.trim();
|
|
2250
|
+
m && p.searchParams.set("backdropId", m);
|
|
2251
|
+
let h = r?.trim();
|
|
2252
|
+
return h && p.searchParams.set("avatarId", h), (i === "face" || i === "medium") && p.searchParams.set("fit", i), c === "pip" && p.searchParams.set("stage", "pip"), l === "set" && p.searchParams.set("pipBackground", "set"), u === !1 && p.searchParams.set("pipShadow", "0"), a === "widget" && p.searchParams.set("ui", "widget"), o && p.searchParams.set("close", "1"), t && p.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && p.searchParams.set("cast", String(s)), tn(p.toString());
|
|
2116
2253
|
}
|
|
2117
|
-
function
|
|
2254
|
+
function tn(e) {
|
|
2118
2255
|
if (typeof location > "u") return e;
|
|
2119
2256
|
let t = new URL(e);
|
|
2120
2257
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
2121
2258
|
}
|
|
2122
|
-
function
|
|
2259
|
+
function nn(e) {
|
|
2123
2260
|
return new URL(e).origin;
|
|
2124
2261
|
}
|
|
2125
2262
|
//#endregion
|
|
2126
2263
|
//#region src/v2/experienceEvents.ts
|
|
2127
|
-
function
|
|
2264
|
+
function rn() {
|
|
2128
2265
|
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)}`;
|
|
2129
2266
|
}
|
|
2130
|
-
function
|
|
2267
|
+
function an(e, t, n) {
|
|
2131
2268
|
return {
|
|
2132
|
-
id:
|
|
2269
|
+
id: rn(),
|
|
2133
2270
|
type: e,
|
|
2134
2271
|
sessionId: t,
|
|
2135
2272
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2136
2273
|
data: n
|
|
2137
2274
|
};
|
|
2138
2275
|
}
|
|
2139
|
-
function
|
|
2276
|
+
function on() {
|
|
2140
2277
|
return {
|
|
2141
2278
|
ready: /* @__PURE__ */ new Set(),
|
|
2142
2279
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -2157,39 +2294,39 @@ function qt() {
|
|
|
2157
2294
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
2158
2295
|
};
|
|
2159
2296
|
}
|
|
2160
|
-
function
|
|
2297
|
+
function sn(e, t, n) {
|
|
2161
2298
|
return e[t].add(n), () => e[t].delete(n);
|
|
2162
2299
|
}
|
|
2163
|
-
function
|
|
2300
|
+
function cn(e, t, n) {
|
|
2164
2301
|
for (let r of e[t]) r(n);
|
|
2165
2302
|
}
|
|
2166
|
-
function
|
|
2303
|
+
function ln(e) {
|
|
2167
2304
|
for (let t of Object.keys(e)) e[t].clear();
|
|
2168
2305
|
}
|
|
2169
2306
|
//#endregion
|
|
2170
2307
|
//#region src/v2/speech/types.ts
|
|
2171
|
-
function
|
|
2308
|
+
function un(e) {
|
|
2172
2309
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
2173
2310
|
}
|
|
2174
|
-
function
|
|
2311
|
+
function dn(e) {
|
|
2175
2312
|
return "url" in e && typeof e.url == "string";
|
|
2176
2313
|
}
|
|
2177
|
-
function
|
|
2314
|
+
function fn(e) {
|
|
2178
2315
|
if (!("track" in e)) return !1;
|
|
2179
2316
|
let t = e.track;
|
|
2180
2317
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
2181
2318
|
}
|
|
2182
|
-
function
|
|
2183
|
-
return !
|
|
2319
|
+
function pn(e) {
|
|
2320
|
+
return !un(e) && !dn(e) && !fn(e) && "encoding" in e && typeof e.encoding == "string";
|
|
2184
2321
|
}
|
|
2185
|
-
var
|
|
2322
|
+
var mn = [
|
|
2186
2323
|
8e3,
|
|
2187
2324
|
16e3,
|
|
2188
2325
|
22050,
|
|
2189
2326
|
24e3,
|
|
2190
2327
|
44100,
|
|
2191
2328
|
48e3
|
|
2192
|
-
],
|
|
2329
|
+
], hn = {
|
|
2193
2330
|
MAX_CHUNK_BYTES: 64 * 1024,
|
|
2194
2331
|
RECOMMENDED_CHUNK_MS_MIN: 20,
|
|
2195
2332
|
RECOMMENDED_CHUNK_MS_MAX: 200,
|
|
@@ -2200,14 +2337,14 @@ var tn = [
|
|
|
2200
2337
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
2201
2338
|
MAX_PENDING_WRITES: 8,
|
|
2202
2339
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
2203
|
-
},
|
|
2340
|
+
}, gn = class extends Error {
|
|
2204
2341
|
operation;
|
|
2205
2342
|
requiredCapability;
|
|
2206
2343
|
name = "UnsupportedSpeechOperationError";
|
|
2207
2344
|
constructor(e, t) {
|
|
2208
2345
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
2209
2346
|
}
|
|
2210
|
-
},
|
|
2347
|
+
}, _n = class extends Error {
|
|
2211
2348
|
name = "SpeechUtteranceClosedError";
|
|
2212
2349
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
2213
2350
|
super(e);
|
|
@@ -2217,72 +2354,72 @@ var tn = [
|
|
|
2217
2354
|
constructor(e, t) {
|
|
2218
2355
|
super(e, t);
|
|
2219
2356
|
}
|
|
2220
|
-
},
|
|
2357
|
+
}, vn = class extends Error {
|
|
2221
2358
|
name = "SpeechBufferTimeoutError";
|
|
2222
2359
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
2223
2360
|
super(e);
|
|
2224
2361
|
}
|
|
2225
2362
|
};
|
|
2226
|
-
function
|
|
2363
|
+
function yn(e = "none") {
|
|
2227
2364
|
return {
|
|
2228
2365
|
mode: e,
|
|
2229
2366
|
trackedDurationMs: 0,
|
|
2230
2367
|
fallbackDurationMs: 0
|
|
2231
2368
|
};
|
|
2232
2369
|
}
|
|
2233
|
-
function
|
|
2234
|
-
return
|
|
2370
|
+
function bn(e) {
|
|
2371
|
+
return mn.includes(e);
|
|
2235
2372
|
}
|
|
2236
|
-
function
|
|
2373
|
+
function xn(e) {
|
|
2237
2374
|
if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
|
|
2238
2375
|
if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
|
|
2239
|
-
if (!
|
|
2376
|
+
if (!bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2240
2377
|
}
|
|
2241
|
-
function
|
|
2242
|
-
if (
|
|
2243
|
-
|
|
2378
|
+
function Sn(e) {
|
|
2379
|
+
if (un(e)) {
|
|
2380
|
+
xn(e.format);
|
|
2244
2381
|
return;
|
|
2245
2382
|
}
|
|
2246
|
-
if (
|
|
2383
|
+
if (dn(e)) {
|
|
2247
2384
|
if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
|
|
2248
|
-
if (e.sampleRate !== void 0 && !
|
|
2385
|
+
if (e.sampleRate !== void 0 && !bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2249
2386
|
return;
|
|
2250
2387
|
}
|
|
2251
|
-
if (
|
|
2388
|
+
if (fn(e)) {
|
|
2252
2389
|
if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
2253
|
-
if (e.sampleRate !== void 0 && !
|
|
2390
|
+
if (e.sampleRate !== void 0 && !bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2254
2391
|
return;
|
|
2255
2392
|
}
|
|
2256
|
-
if (
|
|
2393
|
+
if (pn(e)) {
|
|
2257
2394
|
let t = e.encoding.trim().toLowerCase();
|
|
2258
2395
|
if (!t) throw new Q("Encoded audio MIME type is required.");
|
|
2259
2396
|
if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
2260
|
-
if (e.sampleRate !== void 0 && !
|
|
2397
|
+
if (e.sampleRate !== void 0 && !bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2261
2398
|
return;
|
|
2262
2399
|
}
|
|
2263
2400
|
throw new Q("Unsupported speech.play audio shape.");
|
|
2264
2401
|
}
|
|
2265
|
-
function
|
|
2266
|
-
if (e.format) return
|
|
2402
|
+
function Cn(e) {
|
|
2403
|
+
if (e.format) return xn(e.format), e.format;
|
|
2267
2404
|
if (e.track) {
|
|
2268
2405
|
let t = {
|
|
2269
2406
|
encoding: "pcm_s16le",
|
|
2270
2407
|
sampleRate: e.sampleRate ?? 24e3,
|
|
2271
2408
|
channels: 1
|
|
2272
2409
|
};
|
|
2273
|
-
return
|
|
2410
|
+
return xn(t), t;
|
|
2274
2411
|
}
|
|
2275
2412
|
throw new Q("createUtterance requires format or track.");
|
|
2276
2413
|
}
|
|
2277
|
-
function
|
|
2414
|
+
function wn(e) {
|
|
2278
2415
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2279
2416
|
}
|
|
2280
|
-
function
|
|
2417
|
+
function Tn(e) {
|
|
2281
2418
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
2282
2419
|
}
|
|
2283
2420
|
//#endregion
|
|
2284
2421
|
//#region src/byo/pcm.ts
|
|
2285
|
-
function
|
|
2422
|
+
function En(e) {
|
|
2286
2423
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
2287
2424
|
for (let t = 0; t < e.length; t++) {
|
|
2288
2425
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -2292,11 +2429,11 @@ function mn(e) {
|
|
|
2292
2429
|
}
|
|
2293
2430
|
//#endregion
|
|
2294
2431
|
//#region src/byo/resample.ts
|
|
2295
|
-
function
|
|
2432
|
+
function Dn(e, t, n, r, i) {
|
|
2296
2433
|
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;
|
|
2297
2434
|
return ((a * i + o) * i + s) * i + c;
|
|
2298
2435
|
}
|
|
2299
|
-
function
|
|
2436
|
+
function On(e, t) {
|
|
2300
2437
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
2301
2438
|
if (e === t) return {
|
|
2302
2439
|
fromRate: e,
|
|
@@ -2319,7 +2456,7 @@ function gn(e, t) {
|
|
|
2319
2456
|
let a = [];
|
|
2320
2457
|
for (; i + 2 < r.length - 1;) {
|
|
2321
2458
|
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);
|
|
2322
|
-
a.push(
|
|
2459
|
+
a.push(Dn(r[o], r[e], r[s], r[c], t)), i += n;
|
|
2323
2460
|
}
|
|
2324
2461
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
2325
2462
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -2331,7 +2468,7 @@ function gn(e, t) {
|
|
|
2331
2468
|
}
|
|
2332
2469
|
//#endregion
|
|
2333
2470
|
//#region src/byo/audioCapture.ts
|
|
2334
|
-
var
|
|
2471
|
+
var kn = "liforma-pcm-capture", An = `
|
|
2335
2472
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
2336
2473
|
process(inputs) {
|
|
2337
2474
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -2343,29 +2480,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
2343
2480
|
return true;
|
|
2344
2481
|
}
|
|
2345
2482
|
}
|
|
2346
|
-
registerProcessor('${
|
|
2347
|
-
`,
|
|
2348
|
-
function
|
|
2349
|
-
return
|
|
2483
|
+
registerProcessor('${kn}', LiformaPcmCaptureProcessor);
|
|
2484
|
+
`, jn = null;
|
|
2485
|
+
function Mn() {
|
|
2486
|
+
return jn ||= URL.createObjectURL(new Blob([An], { type: "application/javascript" })), jn;
|
|
2350
2487
|
}
|
|
2351
|
-
function
|
|
2488
|
+
function Nn() {
|
|
2352
2489
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
2353
2490
|
}
|
|
2354
|
-
async function
|
|
2355
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
2491
|
+
async function Pn(e) {
|
|
2492
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Nn();
|
|
2356
2493
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
2357
2494
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
2358
2495
|
l.gain.value = 0;
|
|
2359
|
-
let u = s.sampleRate, d =
|
|
2496
|
+
let u = s.sampleRate, d = On(u, n), f = !1, p = !1, m = (e) => {
|
|
2360
2497
|
if (f || i && !i()) return;
|
|
2361
2498
|
let t = d.push(e);
|
|
2362
|
-
t.length !== 0 && r(
|
|
2499
|
+
t.length !== 0 && r(En(t));
|
|
2363
2500
|
}, h = () => void 0;
|
|
2364
2501
|
return await (async () => {
|
|
2365
2502
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
2366
2503
|
try {
|
|
2367
|
-
await s.audioWorklet.addModule(
|
|
2368
|
-
let e = new AudioWorkletNode(s,
|
|
2504
|
+
await s.audioWorklet.addModule(Mn());
|
|
2505
|
+
let e = new AudioWorkletNode(s, kn, {
|
|
2369
2506
|
numberOfInputs: 1,
|
|
2370
2507
|
numberOfOutputs: 1,
|
|
2371
2508
|
outputChannelCount: [1]
|
|
@@ -2415,7 +2552,7 @@ async function Sn(e) {
|
|
|
2415
2552
|
}
|
|
2416
2553
|
//#endregion
|
|
2417
2554
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
2418
|
-
async function
|
|
2555
|
+
async function Fn(e) {
|
|
2419
2556
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
2420
2557
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
|
|
2421
2558
|
if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -2424,18 +2561,18 @@ async function Cn(e) {
|
|
|
2424
2561
|
s || (s = !0, c?.stop(), c = null);
|
|
2425
2562
|
};
|
|
2426
2563
|
try {
|
|
2427
|
-
c = await
|
|
2564
|
+
c = await Pn({
|
|
2428
2565
|
mediaStream: a,
|
|
2429
2566
|
targetSampleRate: r,
|
|
2430
2567
|
shouldSend: () => !s && !i?.aborted,
|
|
2431
2568
|
onPcm: (e) => {
|
|
2432
2569
|
if (s || i?.aborted) return;
|
|
2433
|
-
let t =
|
|
2570
|
+
let t = wn(e);
|
|
2434
2571
|
o = o.then(async () => {
|
|
2435
2572
|
if (s || i?.aborted) return;
|
|
2436
2573
|
let e = 0;
|
|
2437
2574
|
for (; e < t.byteLength;) {
|
|
2438
|
-
let r = Math.min(e +
|
|
2575
|
+
let r = Math.min(e + hn.MAX_CHUNK_BYTES, t.byteLength);
|
|
2439
2576
|
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
2440
2577
|
let i = t.subarray(e, r);
|
|
2441
2578
|
e = r, i.byteLength !== 0 && await n.write(i);
|
|
@@ -2459,10 +2596,10 @@ async function Cn(e) {
|
|
|
2459
2596
|
}
|
|
2460
2597
|
//#endregion
|
|
2461
2598
|
//#region src/v2/speech/speechController.ts
|
|
2462
|
-
async function
|
|
2463
|
-
if (
|
|
2464
|
-
if (
|
|
2465
|
-
let t =
|
|
2599
|
+
async function In(e, t) {
|
|
2600
|
+
if (fn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
|
|
2601
|
+
if (un(e)) {
|
|
2602
|
+
let t = wn(e.data);
|
|
2466
2603
|
if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
|
|
2467
2604
|
return {
|
|
2468
2605
|
kind: "pcm",
|
|
@@ -2470,17 +2607,17 @@ async function wn(e, t) {
|
|
|
2470
2607
|
format: e.format
|
|
2471
2608
|
};
|
|
2472
2609
|
}
|
|
2473
|
-
if (
|
|
2610
|
+
if (dn(e)) return {
|
|
2474
2611
|
kind: "url",
|
|
2475
2612
|
url: e.url.trim(),
|
|
2476
2613
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2477
2614
|
};
|
|
2478
|
-
if (!
|
|
2615
|
+
if (!pn(e)) throw new Q("Unsupported speech.play audio shape.");
|
|
2479
2616
|
let n;
|
|
2480
2617
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
2481
2618
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2482
2619
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
2483
|
-
} else n =
|
|
2620
|
+
} else n = wn(e.data);
|
|
2484
2621
|
return {
|
|
2485
2622
|
kind: "encoded",
|
|
2486
2623
|
data: n.slice().buffer,
|
|
@@ -2488,10 +2625,10 @@ async function wn(e, t) {
|
|
|
2488
2625
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2489
2626
|
};
|
|
2490
2627
|
}
|
|
2491
|
-
function
|
|
2628
|
+
function Ln() {
|
|
2492
2629
|
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)}`;
|
|
2493
2630
|
}
|
|
2494
|
-
function
|
|
2631
|
+
function Rn(e, t = "completed") {
|
|
2495
2632
|
return {
|
|
2496
2633
|
utteranceId: e.speechId,
|
|
2497
2634
|
characterId: e.characterId,
|
|
@@ -2505,13 +2642,13 @@ function En(e, t = "completed") {
|
|
|
2505
2642
|
}
|
|
2506
2643
|
};
|
|
2507
2644
|
}
|
|
2508
|
-
function
|
|
2645
|
+
function zn(e) {
|
|
2509
2646
|
return e instanceof Error ? e : new Q(String(e));
|
|
2510
2647
|
}
|
|
2511
|
-
function
|
|
2648
|
+
function Bn(e) {
|
|
2512
2649
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
2513
2650
|
}
|
|
2514
|
-
var
|
|
2651
|
+
var Vn = class {
|
|
2515
2652
|
id;
|
|
2516
2653
|
characterId;
|
|
2517
2654
|
result;
|
|
@@ -2540,29 +2677,29 @@ var kn = class {
|
|
|
2540
2677
|
queue: e.queue,
|
|
2541
2678
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
2542
2679
|
}).catch((e) => {
|
|
2543
|
-
throw this.fail(
|
|
2680
|
+
throw this.fail(zn(e)), zn(e);
|
|
2544
2681
|
}), this.signal?.addEventListener("abort", () => {
|
|
2545
2682
|
this.cancel();
|
|
2546
2683
|
}, { once: !0 });
|
|
2547
2684
|
}
|
|
2548
2685
|
async write(e, t) {
|
|
2549
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2550
|
-
let n =
|
|
2686
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new _n();
|
|
2687
|
+
let n = wn(e);
|
|
2551
2688
|
if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
|
|
2552
|
-
if (n.byteLength >
|
|
2689
|
+
if (n.byteLength > hn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${hn.MAX_CHUNK_BYTES}).`);
|
|
2553
2690
|
if (n.byteLength === 0) return;
|
|
2554
|
-
let r = t?.timeoutMs ??
|
|
2691
|
+
let r = t?.timeoutMs ?? hn.DEFAULT_WRITE_TIMEOUT_MS;
|
|
2555
2692
|
await this.acquireWriteSlot(r);
|
|
2556
2693
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
2557
|
-
if (this.bufferedMs + i >
|
|
2694
|
+
if (this.bufferedMs + i > hn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
2558
2695
|
let a = async () => {
|
|
2559
|
-
if (this.closed || this.settled) throw new
|
|
2696
|
+
if (this.closed || this.settled) throw new _n();
|
|
2560
2697
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
2561
2698
|
utteranceId: this.id,
|
|
2562
2699
|
audio: t.buffer,
|
|
2563
2700
|
byteLength: t.byteLength
|
|
2564
2701
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
2565
|
-
setTimeout(() => t(new
|
|
2702
|
+
setTimeout(() => t(new vn()), r);
|
|
2566
2703
|
})]);
|
|
2567
2704
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
2568
2705
|
}, o = this.writeChain.then(a, a);
|
|
@@ -2574,7 +2711,7 @@ var kn = class {
|
|
|
2574
2711
|
}
|
|
2575
2712
|
}
|
|
2576
2713
|
async setTranscript(e) {
|
|
2577
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2714
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new _n();
|
|
2578
2715
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
2579
2716
|
utteranceId: this.id,
|
|
2580
2717
|
transcript: e
|
|
@@ -2591,7 +2728,7 @@ var kn = class {
|
|
|
2591
2728
|
});
|
|
2592
2729
|
return this.resolve(t), t;
|
|
2593
2730
|
} catch (e) {
|
|
2594
|
-
let t =
|
|
2731
|
+
let t = zn(e);
|
|
2595
2732
|
throw this.fail(t), t;
|
|
2596
2733
|
}
|
|
2597
2734
|
}
|
|
@@ -2609,11 +2746,11 @@ var kn = class {
|
|
|
2609
2746
|
characterId: this.characterId,
|
|
2610
2747
|
status: "cancelled",
|
|
2611
2748
|
durationMs: 0,
|
|
2612
|
-
animation:
|
|
2749
|
+
animation: yn("none")
|
|
2613
2750
|
};
|
|
2614
2751
|
return this.resolve(t), t;
|
|
2615
2752
|
} catch (e) {
|
|
2616
|
-
let t =
|
|
2753
|
+
let t = zn(e);
|
|
2617
2754
|
throw this.fail(t), t;
|
|
2618
2755
|
}
|
|
2619
2756
|
}
|
|
@@ -2626,19 +2763,19 @@ var kn = class {
|
|
|
2626
2763
|
return e;
|
|
2627
2764
|
}
|
|
2628
2765
|
resolve(e) {
|
|
2629
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2766
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new _n()));
|
|
2630
2767
|
}
|
|
2631
2768
|
fail(e) {
|
|
2632
2769
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
2633
2770
|
}
|
|
2634
2771
|
async acquireWriteSlot(e) {
|
|
2635
|
-
if (this.pendingWriteCount <
|
|
2772
|
+
if (this.pendingWriteCount < hn.MAX_PENDING_WRITES) {
|
|
2636
2773
|
this.pendingWriteCount += 1;
|
|
2637
2774
|
return;
|
|
2638
2775
|
}
|
|
2639
2776
|
await new Promise((t, n) => {
|
|
2640
2777
|
let r = setTimeout(() => {
|
|
2641
|
-
n(new
|
|
2778
|
+
n(new vn());
|
|
2642
2779
|
}, e);
|
|
2643
2780
|
this.pendingWriteWaiters.push({
|
|
2644
2781
|
resolve: () => {
|
|
@@ -2657,13 +2794,13 @@ var kn = class {
|
|
|
2657
2794
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2658
2795
|
}
|
|
2659
2796
|
};
|
|
2660
|
-
function
|
|
2797
|
+
function Hn(e) {
|
|
2661
2798
|
let t = null, n = (t, n) => {
|
|
2662
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2799
|
+
if (!e.getCapabilities()[n]) throw new gn(t, n);
|
|
2663
2800
|
}, r = {
|
|
2664
2801
|
async speak(r) {
|
|
2665
2802
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2666
|
-
let i =
|
|
2803
|
+
let i = Tn(r.queue ?? "append");
|
|
2667
2804
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2668
2805
|
let a = e.getIframeHost();
|
|
2669
2806
|
if (!a) throw new Q("Speech session is not attached.");
|
|
@@ -2683,41 +2820,41 @@ function An(e) {
|
|
|
2683
2820
|
return;
|
|
2684
2821
|
}
|
|
2685
2822
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2686
|
-
t.removeEventListener("abort", s), n(
|
|
2823
|
+
t.removeEventListener("abort", s), n(Rn(e, "completed"));
|
|
2687
2824
|
}, (a) => {
|
|
2688
|
-
if (t.removeEventListener("abort", s),
|
|
2825
|
+
if (t.removeEventListener("abort", s), Bn(a)) {
|
|
2689
2826
|
n({
|
|
2690
2827
|
utteranceId: "utt_interrupted",
|
|
2691
2828
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2692
2829
|
status: "interrupted",
|
|
2693
2830
|
durationMs: 0,
|
|
2694
2831
|
transcript: r.text,
|
|
2695
|
-
animation:
|
|
2832
|
+
animation: yn("none")
|
|
2696
2833
|
});
|
|
2697
2834
|
return;
|
|
2698
2835
|
}
|
|
2699
|
-
i(
|
|
2836
|
+
i(zn(a));
|
|
2700
2837
|
});
|
|
2701
2838
|
});
|
|
2702
2839
|
}
|
|
2703
2840
|
try {
|
|
2704
|
-
return
|
|
2841
|
+
return Rn(await o, "completed");
|
|
2705
2842
|
} catch (t) {
|
|
2706
|
-
if (
|
|
2843
|
+
if (Bn(t)) return {
|
|
2707
2844
|
utteranceId: "utt_interrupted",
|
|
2708
2845
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2709
2846
|
status: "interrupted",
|
|
2710
2847
|
durationMs: 0,
|
|
2711
2848
|
transcript: r.text,
|
|
2712
|
-
animation:
|
|
2849
|
+
animation: yn("none")
|
|
2713
2850
|
};
|
|
2714
|
-
throw
|
|
2851
|
+
throw zn(t);
|
|
2715
2852
|
}
|
|
2716
2853
|
},
|
|
2717
2854
|
async play(i) {
|
|
2718
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2855
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Sn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2719
2856
|
let a = i.queue ?? "append";
|
|
2720
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2857
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), fn(i.audio)) {
|
|
2721
2858
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2722
2859
|
return r.createUtterance({
|
|
2723
2860
|
format: {
|
|
@@ -2733,7 +2870,7 @@ function An(e) {
|
|
|
2733
2870
|
}
|
|
2734
2871
|
let o = e.getIframeHost();
|
|
2735
2872
|
if (!o) throw new Q("Speech session is not attached.");
|
|
2736
|
-
let s = await
|
|
2873
|
+
let s = await In(i.audio, i.signal);
|
|
2737
2874
|
return o.speechPlay({
|
|
2738
2875
|
source: s,
|
|
2739
2876
|
characterId: i.characterId,
|
|
@@ -2745,13 +2882,13 @@ function An(e) {
|
|
|
2745
2882
|
},
|
|
2746
2883
|
createUtterance(r) {
|
|
2747
2884
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2748
|
-
let i =
|
|
2885
|
+
let i = Cn(r);
|
|
2749
2886
|
if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
|
|
2750
2887
|
let a = r.queue ?? "replace-active";
|
|
2751
2888
|
if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
|
|
2752
2889
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2753
|
-
let o = new
|
|
2754
|
-
id:
|
|
2890
|
+
let o = new Vn({
|
|
2891
|
+
id: Ln(),
|
|
2755
2892
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2756
2893
|
format: i,
|
|
2757
2894
|
queue: a,
|
|
@@ -2763,7 +2900,7 @@ function An(e) {
|
|
|
2763
2900
|
t === o && (t = null);
|
|
2764
2901
|
}), r.track && (async () => {
|
|
2765
2902
|
try {
|
|
2766
|
-
if (await
|
|
2903
|
+
if (await Fn({
|
|
2767
2904
|
track: r.track,
|
|
2768
2905
|
utterance: o,
|
|
2769
2906
|
sampleRate: i.sampleRate,
|
|
@@ -2791,16 +2928,16 @@ function An(e) {
|
|
|
2791
2928
|
}
|
|
2792
2929
|
//#endregion
|
|
2793
2930
|
//#region src/v2/types/sessionInteraction.ts
|
|
2794
|
-
function
|
|
2931
|
+
function Un(e) {
|
|
2795
2932
|
let t = e?.trim();
|
|
2796
2933
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
2797
2934
|
}
|
|
2798
2935
|
//#endregion
|
|
2799
2936
|
//#region src/v2/experience.ts
|
|
2800
|
-
function
|
|
2937
|
+
function Wn(e) {
|
|
2801
2938
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
2802
2939
|
}
|
|
2803
|
-
var
|
|
2940
|
+
var Gn = class e {
|
|
2804
2941
|
bootstrap;
|
|
2805
2942
|
conversationProcessor;
|
|
2806
2943
|
iframeHost = null;
|
|
@@ -2814,19 +2951,22 @@ var Nn = class e {
|
|
|
2814
2951
|
closed = !1;
|
|
2815
2952
|
attached = !1;
|
|
2816
2953
|
pendingFit = null;
|
|
2954
|
+
pendingStage = null;
|
|
2955
|
+
pendingPipBackground = null;
|
|
2956
|
+
pendingPipShadow = null;
|
|
2817
2957
|
lastInteraction = null;
|
|
2818
2958
|
closeHandlers = [];
|
|
2819
|
-
eventRegistry =
|
|
2959
|
+
eventRegistry = on();
|
|
2820
2960
|
readyEnvelope = null;
|
|
2821
2961
|
startedEnvelope = null;
|
|
2822
2962
|
sessionMintedEnvelope = null;
|
|
2823
2963
|
conversationCache = [];
|
|
2824
2964
|
speech;
|
|
2825
2965
|
constructor(e) {
|
|
2826
|
-
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 =
|
|
2966
|
+
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 = Hn({
|
|
2827
2967
|
getIframeHost: () => this.iframeHost,
|
|
2828
2968
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
2829
|
-
getCapabilities: () =>
|
|
2969
|
+
getCapabilities: () => Kn(this.resolvedSession),
|
|
2830
2970
|
getActiveCharacterId: () => "character_unknown",
|
|
2831
2971
|
onProcessorInterrupt: () => {
|
|
2832
2972
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -2909,7 +3049,7 @@ var Nn = class e {
|
|
|
2909
3049
|
return null;
|
|
2910
3050
|
}
|
|
2911
3051
|
on(e, t) {
|
|
2912
|
-
let n =
|
|
3052
|
+
let n = sn(this.eventRegistry, e, t);
|
|
2913
3053
|
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;
|
|
2914
3054
|
}
|
|
2915
3055
|
async attach(e) {
|
|
@@ -2923,13 +3063,13 @@ var Nn = class e {
|
|
|
2923
3063
|
if (this.closed) throw Error("Session has ended.");
|
|
2924
3064
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2925
3065
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2926
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
3066
|
+
let t = this.bootstrap.embedBaseUrl ?? Qt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = en(t, n, r ? void 0 : $t(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Wn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow), a = nn(i), o = null, s = new Promise((e) => {
|
|
2927
3067
|
o = e;
|
|
2928
3068
|
}), c = null, l = new Promise((e) => {
|
|
2929
3069
|
c = e;
|
|
2930
|
-
}), u =
|
|
3070
|
+
}), u = qt((e) => {
|
|
2931
3071
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
2932
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
3072
|
+
}), d = this.bootstrap.onUserTranscript, f = Kt({
|
|
2933
3073
|
container: e.container,
|
|
2934
3074
|
src: i,
|
|
2935
3075
|
playerOrigin: a,
|
|
@@ -2995,7 +3135,7 @@ var Nn = class e {
|
|
|
2995
3135
|
onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
|
|
2996
3136
|
});
|
|
2997
3137
|
this.iframeHost = f;
|
|
2998
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
3138
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), wt(this.bootstrap.sessionEndpoint, {
|
|
2999
3139
|
experienceId: this.bootstrap.experienceId,
|
|
3000
3140
|
locale: this.bootstrap.locale,
|
|
3001
3141
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -3007,7 +3147,7 @@ var Nn = class e {
|
|
|
3007
3147
|
attribution: this.bootstrap.attribution,
|
|
3008
3148
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
3009
3149
|
signal: this.endpointAbortController.signal
|
|
3010
|
-
})) : this.bootstrap.kind === "public" ?
|
|
3150
|
+
})) : this.bootstrap.kind === "public" ? Ct(this.bootstrap.experienceId, {
|
|
3011
3151
|
locale: this.bootstrap.locale,
|
|
3012
3152
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
3013
3153
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -3031,7 +3171,7 @@ var Nn = class e {
|
|
|
3031
3171
|
operation: "attach",
|
|
3032
3172
|
message: e instanceof Error ? e.message : String(e),
|
|
3033
3173
|
stack: e instanceof Error ? e.stack : void 0,
|
|
3034
|
-
release:
|
|
3174
|
+
release: Jt
|
|
3035
3175
|
});
|
|
3036
3176
|
} catch {}
|
|
3037
3177
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -3043,14 +3183,16 @@ var Nn = class e {
|
|
|
3043
3183
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
3044
3184
|
this.launchToken = g;
|
|
3045
3185
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
3046
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
3186
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && ht(_), f.postLaunch(g, _, {
|
|
3047
3187
|
startButton: e.startButton,
|
|
3048
3188
|
theme: e.theme,
|
|
3049
|
-
showFeedback: e.showFeedback
|
|
3189
|
+
showFeedback: e.showFeedback,
|
|
3190
|
+
interaction: e.interaction
|
|
3050
3191
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
3051
3192
|
startButton: e.startButton,
|
|
3052
3193
|
theme: e.theme,
|
|
3053
|
-
showFeedback: e.showFeedback
|
|
3194
|
+
showFeedback: e.showFeedback,
|
|
3195
|
+
interaction: e.interaction
|
|
3054
3196
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
3055
3197
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
3056
3198
|
})]).catch((e) => {
|
|
@@ -3061,7 +3203,7 @@ var Nn = class e {
|
|
|
3061
3203
|
operation: "attach",
|
|
3062
3204
|
message: e instanceof Error ? e.message : String(e),
|
|
3063
3205
|
stack: e instanceof Error ? e.stack : void 0,
|
|
3064
|
-
release:
|
|
3206
|
+
release: Jt
|
|
3065
3207
|
});
|
|
3066
3208
|
} catch {}
|
|
3067
3209
|
throw e;
|
|
@@ -3075,11 +3217,11 @@ var Nn = class e {
|
|
|
3075
3217
|
operation: "attach",
|
|
3076
3218
|
message: e instanceof Error ? e.message : String(e),
|
|
3077
3219
|
stack: e instanceof Error ? e.stack : void 0,
|
|
3078
|
-
release:
|
|
3220
|
+
release: Jt
|
|
3079
3221
|
});
|
|
3080
3222
|
} catch {}
|
|
3081
3223
|
throw e;
|
|
3082
|
-
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
|
|
3224
|
+
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.pendingStage && await f.setStage(this.pendingStage), this.pendingPipBackground && await f.setPipBackground(this.pendingPipBackground), this.pendingPipShadow !== null && await f.setPipShadow(this.pendingPipShadow), this.createPlayerFacade();
|
|
3083
3225
|
}
|
|
3084
3226
|
async startListening() {
|
|
3085
3227
|
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
@@ -3103,11 +3245,25 @@ var Nn = class e {
|
|
|
3103
3245
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
3104
3246
|
}
|
|
3105
3247
|
async setFit(e) {
|
|
3106
|
-
let t =
|
|
3248
|
+
let t = Un(e);
|
|
3107
3249
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
3108
3250
|
if (this.closed) throw Error("Session has ended.");
|
|
3109
3251
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
3110
3252
|
}
|
|
3253
|
+
async setStage(e) {
|
|
3254
|
+
if (e !== "fill" && e !== "pip") throw Error("setStage requires \"fill\" or \"pip\".");
|
|
3255
|
+
if (this.closed) throw Error("Session has ended.");
|
|
3256
|
+
this.pendingStage = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setStage(e);
|
|
3257
|
+
}
|
|
3258
|
+
async setPipBackground(e) {
|
|
3259
|
+
if (e !== "none" && e !== "set") throw Error("setPipBackground requires \"none\" or \"set\".");
|
|
3260
|
+
if (this.closed) throw Error("Session has ended.");
|
|
3261
|
+
this.pendingPipBackground = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipBackground(e);
|
|
3262
|
+
}
|
|
3263
|
+
async setPipShadow(e) {
|
|
3264
|
+
if (this.closed) throw Error("Session has ended.");
|
|
3265
|
+
this.pendingPipShadow = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipShadow(e);
|
|
3266
|
+
}
|
|
3111
3267
|
async setInteraction(e) {
|
|
3112
3268
|
if (this.closed) throw Error("Session has ended.");
|
|
3113
3269
|
if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
|
|
@@ -3139,7 +3295,7 @@ var Nn = class e {
|
|
|
3139
3295
|
this.close();
|
|
3140
3296
|
}
|
|
3141
3297
|
destroy() {
|
|
3142
|
-
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,
|
|
3298
|
+
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, ln(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
3143
3299
|
}
|
|
3144
3300
|
resolveMintInteraction() {
|
|
3145
3301
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -3151,8 +3307,8 @@ var Nn = class e {
|
|
|
3151
3307
|
return this.resolvedSession?.id ?? "";
|
|
3152
3308
|
}
|
|
3153
3309
|
emitWrapped(e, t) {
|
|
3154
|
-
let n =
|
|
3155
|
-
return
|
|
3310
|
+
let n = an(e, this.getSessionId(), t);
|
|
3311
|
+
return cn(this.eventRegistry, e, n), n;
|
|
3156
3312
|
}
|
|
3157
3313
|
queueProcessorTurn(e) {
|
|
3158
3314
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -3161,7 +3317,7 @@ var Nn = class e {
|
|
|
3161
3317
|
let n = this.processorAbortController.signal;
|
|
3162
3318
|
this.processorChain = this.processorChain.then(async () => {
|
|
3163
3319
|
if (!n.aborted) try {
|
|
3164
|
-
let r = await
|
|
3320
|
+
let r = await Dt(t, {
|
|
3165
3321
|
utteranceId: e.utteranceId,
|
|
3166
3322
|
text: e.text,
|
|
3167
3323
|
conversation: this.conversationCache,
|
|
@@ -3211,7 +3367,7 @@ var Nn = class e {
|
|
|
3211
3367
|
};
|
|
3212
3368
|
}
|
|
3213
3369
|
};
|
|
3214
|
-
function
|
|
3370
|
+
function Kn(e) {
|
|
3215
3371
|
return e ? {
|
|
3216
3372
|
textSpeech: e.capabilities.speech.output,
|
|
3217
3373
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -3222,41 +3378,41 @@ function Pn(e) {
|
|
|
3222
3378
|
}
|
|
3223
3379
|
//#endregion
|
|
3224
3380
|
//#region src/widget/dockGeometry.ts
|
|
3225
|
-
var
|
|
3226
|
-
function
|
|
3381
|
+
var qn = "(min-width: 768px)", Jn = 24, Yn = .5, Xn = 1200, Zn = .85, Qn = 9 / 16;
|
|
3382
|
+
function $n() {
|
|
3227
3383
|
if (typeof window > "u") return 800;
|
|
3228
3384
|
let e = window.screen?.availHeight;
|
|
3229
3385
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
3230
3386
|
}
|
|
3231
|
-
function
|
|
3232
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
3233
|
-
return s > a && (s = a, o = s /
|
|
3387
|
+
function er(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Jn, r = typeof window < "u" ? $n() : 800) {
|
|
3388
|
+
let i = Math.max(160, Math.min(t - n * 2, t * Zn)), a = Math.max(120, e - n * 2), o = Math.min(r * Yn, Xn, i), s = o * Qn;
|
|
3389
|
+
return s > a && (s = a, o = s / Qn, o > i && (o = i, s = o * Qn)), {
|
|
3234
3390
|
width: Math.round(s),
|
|
3235
3391
|
height: Math.round(o)
|
|
3236
3392
|
};
|
|
3237
3393
|
}
|
|
3238
|
-
function
|
|
3394
|
+
function tr(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Jn) {
|
|
3239
3395
|
return {
|
|
3240
3396
|
left: Math.max(r, t - e.width - r),
|
|
3241
3397
|
top: Math.max(r, n - e.height - r)
|
|
3242
3398
|
};
|
|
3243
3399
|
}
|
|
3244
|
-
function
|
|
3400
|
+
function nr(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Jn) {
|
|
3245
3401
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
3246
3402
|
return {
|
|
3247
3403
|
left: Math.min(Math.max(a, e), o),
|
|
3248
3404
|
top: Math.min(Math.max(a, t), s)
|
|
3249
3405
|
};
|
|
3250
3406
|
}
|
|
3251
|
-
function
|
|
3252
|
-
return e(
|
|
3407
|
+
function rr(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
3408
|
+
return e(qn).matches;
|
|
3253
3409
|
}
|
|
3254
3410
|
//#endregion
|
|
3255
3411
|
//#region src/widget/mountExperienceWidget.ts
|
|
3256
|
-
function
|
|
3412
|
+
function ir(e) {
|
|
3257
3413
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
3258
3414
|
}
|
|
3259
|
-
function
|
|
3415
|
+
function ar(e) {
|
|
3260
3416
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
3261
3417
|
let t = typeof e == "string" ? e.trim() : "";
|
|
3262
3418
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -3264,10 +3420,10 @@ function qn(e) {
|
|
|
3264
3420
|
function $(e) {
|
|
3265
3421
|
return e === "expanded" || e === "docked";
|
|
3266
3422
|
}
|
|
3267
|
-
var
|
|
3268
|
-
function
|
|
3269
|
-
|
|
3270
|
-
let r =
|
|
3423
|
+
var or = "<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>", sr = "<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>", cr = "<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>", lr = "<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>";
|
|
3424
|
+
function ur(e, t, n) {
|
|
3425
|
+
Ve(ze);
|
|
3426
|
+
let r = pe({
|
|
3271
3427
|
galleryThumb: t.galleryThumb,
|
|
3272
3428
|
avatarImage: t.avatarImage,
|
|
3273
3429
|
backgroundImage: t.backgroundImage,
|
|
@@ -3293,9 +3449,9 @@ function Qn(e, t, n) {
|
|
|
3293
3449
|
let e = document.createElement("img");
|
|
3294
3450
|
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);
|
|
3295
3451
|
}
|
|
3296
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
3452
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Re(i);
|
|
3297
3453
|
}
|
|
3298
|
-
function
|
|
3454
|
+
function dr(e) {
|
|
3299
3455
|
return e.startButton ? {
|
|
3300
3456
|
...e.startButton,
|
|
3301
3457
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -3307,7 +3463,7 @@ function $n(e) {
|
|
|
3307
3463
|
variant: "primary"
|
|
3308
3464
|
};
|
|
3309
3465
|
}
|
|
3310
|
-
function
|
|
3466
|
+
function fr(e) {
|
|
3311
3467
|
let t = !1, n = () => {
|
|
3312
3468
|
t || e();
|
|
3313
3469
|
}, r = () => {
|
|
@@ -3327,12 +3483,12 @@ function er(e) {
|
|
|
3327
3483
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
3328
3484
|
};
|
|
3329
3485
|
}
|
|
3330
|
-
function
|
|
3331
|
-
|
|
3486
|
+
function pr(e, t) {
|
|
3487
|
+
Ke(We);
|
|
3332
3488
|
let n = t.experienceId?.trim();
|
|
3333
3489
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
3334
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
3335
|
-
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",
|
|
3490
|
+
let r = t.prefetch ?? "onExpand", i = ir(t.position), a = document.createElement("div");
|
|
3491
|
+
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", ar(t.offset));
|
|
3336
3492
|
let o = document.createElement("button");
|
|
3337
3493
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
3338
3494
|
let s = document.createElement("div");
|
|
@@ -3352,230 +3508,233 @@ function tr(e, t) {
|
|
|
3352
3508
|
let m = document.createElement("span");
|
|
3353
3509
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
3354
3510
|
let h = document.createElement("button");
|
|
3355
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
3511
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = cr, h.setAttribute("aria-label", "Reduce");
|
|
3356
3512
|
let g = document.createElement("button");
|
|
3357
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
3513
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = or, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
3358
3514
|
let _ = document.createElement("button");
|
|
3359
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
3515
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = sr, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
3360
3516
|
let v = document.createElement("div");
|
|
3361
3517
|
v.className = "liforma-ew__stage";
|
|
3362
3518
|
let y = document.createElement("div");
|
|
3363
3519
|
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);
|
|
3364
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null,
|
|
3520
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, ee = null, j = null, M = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
|
|
3365
3521
|
let e = a.dataset.state;
|
|
3366
3522
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
3523
|
+
}, z = () => {
|
|
3524
|
+
j !== null && (clearTimeout(j), j = null);
|
|
3525
|
+
}, ae = () => {
|
|
3526
|
+
M !== null && (clearTimeout(M), M = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3367
3527
|
}, B = () => {
|
|
3368
|
-
M !== null && (clearTimeout(M), M = null);
|
|
3369
|
-
}, V = () => {
|
|
3370
|
-
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3371
|
-
}, ie = () => {
|
|
3372
3528
|
for (let e of [
|
|
3373
3529
|
f,
|
|
3374
3530
|
l,
|
|
3375
3531
|
p
|
|
3376
3532
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
3377
3533
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
3378
|
-
},
|
|
3534
|
+
}, V = (e, t, n, r) => {
|
|
3379
3535
|
let i = (i) => {
|
|
3380
3536
|
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";
|
|
3381
3537
|
};
|
|
3382
3538
|
i(f), i(l);
|
|
3383
3539
|
let a = p.offsetWidth || 120;
|
|
3384
3540
|
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";
|
|
3385
|
-
}, ae = (e, t) => {
|
|
3386
|
-
if (z() !== "docked") return;
|
|
3387
|
-
let n = Hn(), r = Wn(e - ee, t - te, n);
|
|
3388
|
-
P = r.left, F = r.top, H(r.left, r.top, n.width, n.height);
|
|
3389
3541
|
}, oe = (e, t) => {
|
|
3390
|
-
if (
|
|
3391
|
-
let n =
|
|
3392
|
-
|
|
3542
|
+
if (R() !== "docked") return;
|
|
3543
|
+
let n = er(), r = nr(e - te, t - I, n);
|
|
3544
|
+
N = r.left, P = r.top, V(r.left, r.top, n.width, n.height);
|
|
3545
|
+
}, H = (e, t) => {
|
|
3546
|
+
if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
3547
|
+
let n = er(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = nr(r + e, i + t, n);
|
|
3548
|
+
N = a.left, P = a.top, V(a.left, a.top, n.width, n.height);
|
|
3393
3549
|
}, se = (e) => {
|
|
3394
|
-
L === "toolbar" && (
|
|
3550
|
+
L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
|
|
3395
3551
|
}, U = (e) => {
|
|
3396
|
-
if (
|
|
3552
|
+
if (F === null || e && e.pointerId !== F) return;
|
|
3397
3553
|
let t = L;
|
|
3398
|
-
|
|
3554
|
+
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", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
|
|
3399
3555
|
}, ce = (e, t, n) => {
|
|
3400
|
-
if (S ||
|
|
3401
|
-
|
|
3556
|
+
if (S || R() !== "docked" || !rr() || F !== null) return;
|
|
3557
|
+
F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3402
3558
|
let r = f.getBoundingClientRect();
|
|
3403
|
-
|
|
3559
|
+
te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
|
|
3404
3560
|
}, le = (e) => {
|
|
3405
|
-
if (S ||
|
|
3406
|
-
|
|
3561
|
+
if (S || R() !== "docked" || !rr() || F !== null) return;
|
|
3562
|
+
F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3407
3563
|
let t = f.getBoundingClientRect();
|
|
3408
|
-
|
|
3409
|
-
}, W = (e) => {
|
|
3410
|
-
L === "player" && (I === null || e.pointerId !== I || oe(e.dx, e.dy));
|
|
3564
|
+
N = t.left, P = t.top;
|
|
3411
3565
|
}, ue = (e) => {
|
|
3412
|
-
L === "player" && (
|
|
3413
|
-
},
|
|
3414
|
-
|
|
3566
|
+
L === "player" && (F === null || e.pointerId !== F || H(e.dx, e.dy));
|
|
3567
|
+
}, de = (e) => {
|
|
3568
|
+
L === "player" && (F === null || e.pointerId !== F || U());
|
|
3569
|
+
}, W = () => {
|
|
3570
|
+
let e = rr(), t = R();
|
|
3415
3571
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
3416
3572
|
h.hidden = !0;
|
|
3417
3573
|
return;
|
|
3418
3574
|
}
|
|
3419
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
3420
|
-
},
|
|
3421
|
-
let t =
|
|
3422
|
-
n =
|
|
3423
|
-
},
|
|
3575
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = lr, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = cr, h.setAttribute("aria-label", "Reduce"));
|
|
3576
|
+
}, fe = (e) => {
|
|
3577
|
+
let t = er(), n = e && N !== null && P !== null ? nr(N, P, t) : tr(t);
|
|
3578
|
+
n = nr(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
|
|
3579
|
+
}, pe = () => {
|
|
3424
3580
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
3425
3581
|
requestAnimationFrame(() => {
|
|
3426
3582
|
S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
3427
3583
|
});
|
|
3428
3584
|
});
|
|
3429
|
-
},
|
|
3430
|
-
if (
|
|
3585
|
+
}, me = (e) => {
|
|
3586
|
+
if (ae(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
3431
3587
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3432
3588
|
return;
|
|
3433
3589
|
}
|
|
3434
|
-
|
|
3435
|
-
if (
|
|
3590
|
+
M = setTimeout(() => {
|
|
3591
|
+
if (M = null, S || !$(a.dataset.state)) {
|
|
3436
3592
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3437
3593
|
return;
|
|
3438
3594
|
}
|
|
3439
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
3595
|
+
a.classList.remove("liforma-ew--layout-settling"), pe();
|
|
3440
3596
|
}, 220);
|
|
3441
|
-
},
|
|
3442
|
-
|
|
3443
|
-
|
|
3597
|
+
}, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
3598
|
+
z(), j = setTimeout(() => {
|
|
3599
|
+
j = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
3444
3600
|
}, 280);
|
|
3445
|
-
})),
|
|
3601
|
+
})), ge = {
|
|
3446
3602
|
galleryThumb: t.galleryThumb,
|
|
3447
3603
|
avatarImage: t.avatarImage,
|
|
3448
3604
|
backgroundImage: t.backgroundImage,
|
|
3449
3605
|
foregroundImage: t.foregroundImage,
|
|
3450
3606
|
fallbackImage: t.fallbackImage
|
|
3451
|
-
},
|
|
3607
|
+
}, _e = (e) => {
|
|
3452
3608
|
if (!e) {
|
|
3453
3609
|
y.hidden = !0, y.textContent = "";
|
|
3454
3610
|
return;
|
|
3455
3611
|
}
|
|
3456
3612
|
y.hidden = !1, y.textContent = e;
|
|
3457
|
-
},
|
|
3613
|
+
}, ve = (e) => {
|
|
3458
3614
|
if (!e) {
|
|
3459
3615
|
c.hidden = !0, c.textContent = "";
|
|
3460
3616
|
return;
|
|
3461
3617
|
}
|
|
3462
3618
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
3463
|
-
},
|
|
3464
|
-
C = !0, o.disabled = !1,
|
|
3465
|
-
},
|
|
3619
|
+
}, ye = () => {
|
|
3620
|
+
C = !0, o.disabled = !1, ve(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3621
|
+
}, be = () => {
|
|
3466
3622
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
3467
|
-
},
|
|
3623
|
+
}, xe = (e) => {
|
|
3468
3624
|
A?.(), A = null;
|
|
3469
|
-
let t =
|
|
3625
|
+
let t = ur(s, e, { parallax: ie });
|
|
3470
3626
|
return t ? (A = t, !0) : !1;
|
|
3471
|
-
},
|
|
3472
|
-
if (
|
|
3473
|
-
|
|
3627
|
+
}, G = () => {
|
|
3628
|
+
if (xe(ge)) {
|
|
3629
|
+
ye();
|
|
3474
3630
|
return;
|
|
3475
3631
|
}
|
|
3476
|
-
|
|
3632
|
+
ve("Loading…"), Qe(n, { signal: re.signal }).then((e) => {
|
|
3477
3633
|
if (!S) {
|
|
3478
|
-
if (!
|
|
3479
|
-
|
|
3634
|
+
if (!xe({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
3635
|
+
ye();
|
|
3480
3636
|
}
|
|
3481
3637
|
}).catch((e) => {
|
|
3482
3638
|
if (S || re.signal.aborted) return;
|
|
3483
3639
|
let n = e instanceof Error ? e : Error(String(e));
|
|
3484
|
-
|
|
3640
|
+
ve("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
3485
3641
|
});
|
|
3486
|
-
},
|
|
3642
|
+
}, Se = () => ({
|
|
3487
3643
|
experienceId: n,
|
|
3488
3644
|
ui: "widget",
|
|
3489
3645
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
3490
3646
|
...t.locale ? { locale: t.locale } : {},
|
|
3647
|
+
...t.secondaryLocale ? { secondaryLocale: t.secondaryLocale } : {},
|
|
3648
|
+
...t.learningLocale ? { learningLocale: t.learningLocale } : {},
|
|
3491
3649
|
...t.language ? { language: t.language } : {},
|
|
3492
3650
|
...t.mode ? { mode: t.mode } : {},
|
|
3493
3651
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
3494
3652
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
3495
3653
|
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
3496
3654
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
3497
|
-
}),
|
|
3655
|
+
}), Ce = () => ({
|
|
3498
3656
|
...t.fit ? { fit: t.fit } : {},
|
|
3499
|
-
startButton:
|
|
3500
|
-
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3657
|
+
startButton: dr(t),
|
|
3658
|
+
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
3659
|
+
...t.interaction ? { interaction: t.interaction } : {}
|
|
3660
|
+
}), we = (e = !0) => {
|
|
3661
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), B(), a.dataset.state = "expanded", _e(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
|
|
3662
|
+
}, Te = () => {
|
|
3663
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", _e(null), typeof document < "u" && (document.body.style.overflow = k), fe(!0), W(), b?.setWidgetChrome("docked");
|
|
3664
|
+
}, Ee = (e) => {
|
|
3506
3665
|
e.on("started", () => {
|
|
3507
|
-
S || (D = !0, a.dataset.live = "true",
|
|
3666
|
+
S || (D = !0, a.dataset.live = "true", _e(null), t.onStarted?.(), $(a.dataset.state) && pe());
|
|
3508
3667
|
}), e.on("feedback", (e) => {
|
|
3509
3668
|
S || t.onFeedback?.(e);
|
|
3510
3669
|
}), e.on("feedbackFailed", (e) => {
|
|
3511
3670
|
S || t.onFeedbackFailed?.(e);
|
|
3512
3671
|
});
|
|
3513
|
-
},
|
|
3514
|
-
|
|
3515
|
-
},
|
|
3516
|
-
|
|
3672
|
+
}, De = () => {
|
|
3673
|
+
ae(), u.hidden = !0, p.hidden = !0, B(), 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), _e(null), typeof document < "u" && (document.body.style.overflow = k), W();
|
|
3674
|
+
}, Oe = () => {
|
|
3675
|
+
z(), ae(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3517
3676
|
let e = b;
|
|
3518
3677
|
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");
|
|
3519
|
-
},
|
|
3678
|
+
}, K = () => {
|
|
3520
3679
|
if (!S && $(a.dataset.state)) {
|
|
3521
3680
|
if (U(), x = !1, b && E) {
|
|
3522
3681
|
let e = b;
|
|
3523
3682
|
(async () => {
|
|
3524
|
-
D && (await
|
|
3683
|
+
D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), De(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && be(), t.onCollapsed?.(), t.onClose?.());
|
|
3525
3684
|
})();
|
|
3526
3685
|
return;
|
|
3527
3686
|
}
|
|
3528
|
-
|
|
3687
|
+
Oe(), De(), t.onCollapsed?.(), t.onClose?.();
|
|
3529
3688
|
}
|
|
3530
|
-
}, De = () => {
|
|
3531
|
-
S || Gn() && z() === "expanded" && pe(() => {
|
|
3532
|
-
Se();
|
|
3533
|
-
});
|
|
3534
|
-
}, Oe = () => {
|
|
3535
|
-
S || z() === "docked" && (U(), pe(() => {
|
|
3536
|
-
ie(), J(!1), b?.setWidgetChrome("expanded");
|
|
3537
|
-
}));
|
|
3538
3689
|
}, ke = () => {
|
|
3539
|
-
|
|
3690
|
+
S || rr() && R() === "expanded" && me(() => {
|
|
3691
|
+
Te();
|
|
3692
|
+
});
|
|
3540
3693
|
}, Ae = () => {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
},
|
|
3694
|
+
S || R() === "docked" && (U(), me(() => {
|
|
3695
|
+
B(), we(!1), b?.setWidgetChrome("expanded");
|
|
3696
|
+
}));
|
|
3697
|
+
}, je = () => {
|
|
3698
|
+
!b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), we(), b.setWidgetChrome("expanded"), x = !1, pe());
|
|
3699
|
+
}, q = () => {
|
|
3700
|
+
!b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3701
|
+
}, Me = (e) => {
|
|
3702
|
+
S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, D && pe());
|
|
3703
|
+
}, J = () => {
|
|
3545
3704
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
3546
3705
|
T = !0;
|
|
3547
3706
|
let e = O;
|
|
3548
3707
|
l.hidden = !1, (async () => {
|
|
3549
3708
|
try {
|
|
3550
|
-
let t = await
|
|
3709
|
+
let t = await Gn.startSession(Se());
|
|
3551
3710
|
if (S || e !== O) {
|
|
3552
3711
|
t.destroy();
|
|
3553
3712
|
return;
|
|
3554
3713
|
}
|
|
3555
|
-
b = t,
|
|
3714
|
+
b = t, Ee(t);
|
|
3556
3715
|
let n = await t.attach({
|
|
3557
3716
|
container: l,
|
|
3558
|
-
...
|
|
3717
|
+
...Ce(),
|
|
3559
3718
|
onWidgetReady: () => {
|
|
3560
|
-
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") :
|
|
3719
|
+
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : be());
|
|
3561
3720
|
},
|
|
3562
3721
|
onWidgetExpand: () => {
|
|
3563
|
-
|
|
3722
|
+
Me(e);
|
|
3564
3723
|
},
|
|
3565
3724
|
onWidgetAudioSettings: (e) => {
|
|
3566
|
-
S ||
|
|
3725
|
+
S || Ie(e);
|
|
3567
3726
|
},
|
|
3568
3727
|
onWidgetDragStart: (e) => {
|
|
3569
3728
|
S || le(e);
|
|
3570
3729
|
},
|
|
3571
3730
|
onWidgetDragMove: (e) => {
|
|
3572
|
-
S ||
|
|
3731
|
+
S || ue(e);
|
|
3573
3732
|
},
|
|
3574
3733
|
onWidgetDragEnd: (e) => {
|
|
3575
|
-
S ||
|
|
3734
|
+
S || de(e);
|
|
3576
3735
|
},
|
|
3577
3736
|
onPlayerStatusChange: (e) => {
|
|
3578
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3737
|
+
S || e === "error" && $(a.dataset.state) && _e("Could not load the experience.");
|
|
3579
3738
|
}
|
|
3580
3739
|
});
|
|
3581
3740
|
if (S || e !== O) {
|
|
@@ -3583,7 +3742,7 @@ function tr(e, t) {
|
|
|
3583
3742
|
return;
|
|
3584
3743
|
}
|
|
3585
3744
|
n.on("close", () => {
|
|
3586
|
-
S ||
|
|
3745
|
+
S || K();
|
|
3587
3746
|
});
|
|
3588
3747
|
} catch (n) {
|
|
3589
3748
|
if (S || e !== O) return;
|
|
@@ -3592,43 +3751,43 @@ function tr(e, t) {
|
|
|
3592
3751
|
t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
|
|
3593
3752
|
}
|
|
3594
3753
|
})();
|
|
3595
|
-
},
|
|
3754
|
+
}, Ne = () => {
|
|
3596
3755
|
if (S || x || !C || $(a.dataset.state)) return;
|
|
3597
3756
|
if (b && D) {
|
|
3598
|
-
|
|
3757
|
+
je();
|
|
3599
3758
|
return;
|
|
3600
3759
|
}
|
|
3601
3760
|
if (b && E) {
|
|
3602
|
-
|
|
3761
|
+
q();
|
|
3603
3762
|
return;
|
|
3604
3763
|
}
|
|
3605
3764
|
let e = ++O;
|
|
3606
3765
|
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 () => {
|
|
3607
3766
|
try {
|
|
3608
|
-
|
|
3609
|
-
let t = await
|
|
3767
|
+
we();
|
|
3768
|
+
let t = await Gn.startSession(Se());
|
|
3610
3769
|
if (S || e !== O) {
|
|
3611
3770
|
t.destroy();
|
|
3612
3771
|
return;
|
|
3613
3772
|
}
|
|
3614
|
-
b = t,
|
|
3773
|
+
b = t, Ee(t);
|
|
3615
3774
|
let n = await t.attach({
|
|
3616
3775
|
container: v,
|
|
3617
|
-
...
|
|
3776
|
+
...Ce(),
|
|
3618
3777
|
onWidgetAudioSettings: (e) => {
|
|
3619
|
-
S ||
|
|
3778
|
+
S || Ie(e);
|
|
3620
3779
|
},
|
|
3621
3780
|
onWidgetDragStart: (e) => {
|
|
3622
3781
|
S || le(e);
|
|
3623
3782
|
},
|
|
3624
3783
|
onWidgetDragMove: (e) => {
|
|
3625
|
-
S ||
|
|
3784
|
+
S || ue(e);
|
|
3626
3785
|
},
|
|
3627
3786
|
onWidgetDragEnd: (e) => {
|
|
3628
|
-
S ||
|
|
3787
|
+
S || de(e);
|
|
3629
3788
|
},
|
|
3630
3789
|
onPlayerStatusChange: (e) => {
|
|
3631
|
-
S || (e === "error" ?
|
|
3790
|
+
S || (e === "error" ? _e("Could not load the experience.") : $(a.dataset.state) && _e(null));
|
|
3632
3791
|
}
|
|
3633
3792
|
});
|
|
3634
3793
|
if (S || e !== O) {
|
|
@@ -3636,101 +3795,101 @@ function tr(e, t) {
|
|
|
3636
3795
|
return;
|
|
3637
3796
|
}
|
|
3638
3797
|
E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
|
|
3639
|
-
S ||
|
|
3798
|
+
S || K();
|
|
3640
3799
|
});
|
|
3641
3800
|
} catch (n) {
|
|
3642
3801
|
if (S || e !== O) return;
|
|
3643
3802
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3644
|
-
|
|
3803
|
+
_e(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3645
3804
|
} finally {
|
|
3646
3805
|
e === O && (x = !1);
|
|
3647
3806
|
}
|
|
3648
3807
|
})();
|
|
3649
|
-
},
|
|
3808
|
+
}, Pe = () => {
|
|
3650
3809
|
if (!(S || $(a.dataset.state))) {
|
|
3651
3810
|
if (b && D) {
|
|
3652
|
-
|
|
3811
|
+
je();
|
|
3653
3812
|
return;
|
|
3654
3813
|
}
|
|
3655
3814
|
if (b && E) {
|
|
3656
|
-
|
|
3815
|
+
q();
|
|
3657
3816
|
return;
|
|
3658
3817
|
}
|
|
3659
3818
|
if (T || b) {
|
|
3660
|
-
|
|
3819
|
+
we();
|
|
3661
3820
|
return;
|
|
3662
3821
|
}
|
|
3663
|
-
|
|
3822
|
+
Ne();
|
|
3664
3823
|
}
|
|
3665
|
-
},
|
|
3666
|
-
if (e.stopPropagation(),
|
|
3667
|
-
|
|
3824
|
+
}, Fe = (e) => {
|
|
3825
|
+
if (e.stopPropagation(), R() === "expanded") {
|
|
3826
|
+
ke();
|
|
3668
3827
|
return;
|
|
3669
3828
|
}
|
|
3670
|
-
|
|
3671
|
-
},
|
|
3829
|
+
R() === "docked" && Ae();
|
|
3830
|
+
}, Ie = (e) => {
|
|
3672
3831
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
3673
|
-
},
|
|
3832
|
+
}, Le = (e) => {
|
|
3674
3833
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3675
|
-
},
|
|
3676
|
-
|
|
3677
|
-
},
|
|
3678
|
-
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(),
|
|
3679
|
-
},
|
|
3834
|
+
}, Re = (e) => {
|
|
3835
|
+
R() === "docked" && rr() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
|
|
3836
|
+
}, ze = (e) => {
|
|
3837
|
+
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), K());
|
|
3838
|
+
}, Be = () => {
|
|
3680
3839
|
if (!S) {
|
|
3681
|
-
if (
|
|
3682
|
-
if (!
|
|
3683
|
-
|
|
3840
|
+
if (R() === "docked") {
|
|
3841
|
+
if (!rr()) {
|
|
3842
|
+
Ae();
|
|
3684
3843
|
return;
|
|
3685
3844
|
}
|
|
3686
|
-
D ?
|
|
3687
|
-
|
|
3688
|
-
}) :
|
|
3845
|
+
D ? me(() => {
|
|
3846
|
+
fe(!0);
|
|
3847
|
+
}) : fe(!0);
|
|
3689
3848
|
return;
|
|
3690
3849
|
}
|
|
3691
|
-
|
|
3850
|
+
W();
|
|
3692
3851
|
}
|
|
3693
|
-
},
|
|
3852
|
+
}, Ve = typeof window < "u" ? window.matchMedia(qn) : null, He = () => {
|
|
3694
3853
|
if (!S) {
|
|
3695
|
-
if (
|
|
3696
|
-
|
|
3854
|
+
if (R() === "docked" && !rr()) {
|
|
3855
|
+
Ae();
|
|
3697
3856
|
return;
|
|
3698
3857
|
}
|
|
3699
|
-
|
|
3858
|
+
W();
|
|
3700
3859
|
}
|
|
3701
3860
|
};
|
|
3702
|
-
return o.addEventListener("click",
|
|
3703
|
-
e.stopPropagation(),
|
|
3704
|
-
}), h.addEventListener("click",
|
|
3705
|
-
S ||
|
|
3706
|
-
}) : r === "idle" && (
|
|
3707
|
-
S ||
|
|
3861
|
+
return o.addEventListener("click", Pe), d.addEventListener("click", K), _.addEventListener("click", (e) => {
|
|
3862
|
+
e.stopPropagation(), K();
|
|
3863
|
+
}), h.addEventListener("click", Fe), g.addEventListener("click", Le), p.addEventListener("pointerdown", Re), window.addEventListener("keydown", ze), window.addEventListener("resize", Be), Ve?.addEventListener("change", He), G(), W(), r === "eager" ? queueMicrotask(() => {
|
|
3864
|
+
S || J();
|
|
3865
|
+
}) : r === "idle" && (ee = fr(() => {
|
|
3866
|
+
S || J();
|
|
3708
3867
|
})), {
|
|
3709
3868
|
root: a,
|
|
3710
|
-
expand:
|
|
3711
|
-
collapse:
|
|
3712
|
-
dock:
|
|
3713
|
-
maximize:
|
|
3869
|
+
expand: Pe,
|
|
3870
|
+
collapse: K,
|
|
3871
|
+
dock: ke,
|
|
3872
|
+
maximize: Ae,
|
|
3714
3873
|
prefetch() {
|
|
3715
3874
|
if (r === "onExpand") {
|
|
3716
|
-
|
|
3875
|
+
J();
|
|
3717
3876
|
return;
|
|
3718
3877
|
}
|
|
3719
|
-
|
|
3878
|
+
J();
|
|
3720
3879
|
},
|
|
3721
3880
|
destroy() {
|
|
3722
|
-
S || (S = !0, U(),
|
|
3881
|
+
S || (S = !0, U(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", ze), window.removeEventListener("resize", Be), Ve?.removeEventListener("change", He), Oe(), De(), e.replaceChildren());
|
|
3723
3882
|
}
|
|
3724
3883
|
};
|
|
3725
3884
|
}
|
|
3726
3885
|
//#endregion
|
|
3727
3886
|
//#region src/react/ExperienceWidget.tsx
|
|
3728
|
-
function
|
|
3729
|
-
let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g,
|
|
3887
|
+
function mr(e) {
|
|
3888
|
+
let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, 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: ee = "", onExpanded: j, onCollapsed: M, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = e, ne = m === "bottom-right" || m === "bottom-left";
|
|
3730
3889
|
return n(() => {
|
|
3731
3890
|
let e = t.current;
|
|
3732
3891
|
if (!e || !r.trim()) return;
|
|
3733
|
-
let n =
|
|
3892
|
+
let n = pr(e, {
|
|
3734
3893
|
experienceId: r,
|
|
3735
3894
|
alt: i,
|
|
3736
3895
|
galleryThumb: a,
|
|
@@ -3743,25 +3902,28 @@ function nr(e) {
|
|
|
3743
3902
|
position: m,
|
|
3744
3903
|
offset: h,
|
|
3745
3904
|
sessionEndpoint: g,
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3905
|
+
locale: _,
|
|
3906
|
+
secondaryLocale: v,
|
|
3907
|
+
learningLocale: y,
|
|
3908
|
+
language: b,
|
|
3909
|
+
mode: x,
|
|
3910
|
+
speechInputMode: S,
|
|
3911
|
+
speechOnly: C,
|
|
3912
|
+
fit: w,
|
|
3913
|
+
embedBaseUrl: T,
|
|
3914
|
+
expandedMaxWidth: E,
|
|
3915
|
+
expandedMaxHeight: D,
|
|
3916
|
+
startButtonLabel: O,
|
|
3917
|
+
startButton: k,
|
|
3918
|
+
showFeedback: A,
|
|
3919
|
+
onFeedback: I,
|
|
3920
|
+
onFeedbackFailed: L,
|
|
3921
|
+
onExpanded: j,
|
|
3922
|
+
onCollapsed: M,
|
|
3923
|
+
onStarted: N,
|
|
3924
|
+
onClose: P,
|
|
3925
|
+
onError: F,
|
|
3926
|
+
onPrefetchReady: te
|
|
3765
3927
|
});
|
|
3766
3928
|
return () => n.destroy();
|
|
3767
3929
|
}, [
|
|
@@ -3788,18 +3950,21 @@ function nr(e) {
|
|
|
3788
3950
|
T,
|
|
3789
3951
|
E,
|
|
3790
3952
|
D,
|
|
3791
|
-
|
|
3792
|
-
I,
|
|
3953
|
+
O,
|
|
3793
3954
|
k,
|
|
3794
3955
|
A,
|
|
3956
|
+
I,
|
|
3957
|
+
L,
|
|
3795
3958
|
j,
|
|
3796
3959
|
M,
|
|
3797
3960
|
N,
|
|
3798
|
-
P
|
|
3961
|
+
P,
|
|
3962
|
+
F,
|
|
3963
|
+
te
|
|
3799
3964
|
]), /* @__PURE__ */ d("div", {
|
|
3800
3965
|
ref: t,
|
|
3801
|
-
className:
|
|
3802
|
-
style:
|
|
3966
|
+
className: ee,
|
|
3967
|
+
style: ne ? { display: "contents" } : {
|
|
3803
3968
|
width: "100%",
|
|
3804
3969
|
height: "100%",
|
|
3805
3970
|
minHeight: "inherit"
|
|
@@ -3807,6 +3972,6 @@ function nr(e) {
|
|
|
3807
3972
|
});
|
|
3808
3973
|
}
|
|
3809
3974
|
//#endregion
|
|
3810
|
-
export { ne as Experience,
|
|
3975
|
+
export { ne as Experience, Ue as ExperienceThumbnail, mr as ExperienceWidget };
|
|
3811
3976
|
|
|
3812
3977
|
//# sourceMappingURL=index.js.map
|