@liforma/client 0.3.0 → 0.4.0
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 +17 -0
- package/README.md +14 -1
- package/dist/byo/audioCapture.d.ts +24 -0
- package/dist/byo/audioCapture.d.ts.map +1 -0
- package/dist/byo/index.d.ts +8 -0
- package/dist/byo/index.d.ts.map +1 -0
- package/dist/byo/index.js +307 -0
- package/dist/byo/index.js.map +1 -0
- package/dist/byo/mic.d.ts +27 -0
- package/dist/byo/mic.d.ts.map +1 -0
- package/dist/byo/pcm.d.ts +33 -0
- package/dist/byo/pcm.d.ts.map +1 -0
- package/dist/byo/pcmCarry.d.ts +17 -0
- package/dist/byo/pcmCarry.d.ts.map +1 -0
- package/dist/byo/resample.d.ts +18 -0
- package/dist/byo/resample.d.ts.map +1 -0
- package/dist/byo/turn.d.ts +39 -0
- package/dist/byo/turn.d.ts.map +1 -0
- package/dist/byo/types.d.ts +74 -0
- package/dist/byo/types.d.ts.map +1 -0
- package/dist/deepgram/connectDeepgramAgent.d.ts +51 -0
- package/dist/deepgram/connectDeepgramAgent.d.ts.map +1 -0
- package/dist/deepgram/deepgramAgentMessages.d.ts +31 -0
- package/dist/deepgram/deepgramAgentMessages.d.ts.map +1 -0
- package/dist/deepgram/index.d.ts +4 -0
- package/dist/deepgram/index.d.ts.map +1 -0
- package/dist/deepgram/index.js +142 -0
- package/dist/deepgram/index.js.map +1 -0
- package/dist/elevenlabs/connectElevenLabsAgent.d.ts +23 -0
- package/dist/elevenlabs/connectElevenLabsAgent.d.ts.map +1 -0
- package/dist/elevenlabs/index.d.ts +4 -0
- package/dist/elevenlabs/index.d.ts.map +1 -0
- package/dist/elevenlabs/index.js +89 -0
- package/dist/elevenlabs/index.js.map +1 -0
- package/dist/google/connectGeminiLive.d.ts +34 -0
- package/dist/google/connectGeminiLive.d.ts.map +1 -0
- package/dist/google/index.d.ts +4 -0
- package/dist/google/index.d.ts.map +1 -0
- package/dist/google/index.js +98 -0
- package/dist/google/index.js.map +1 -0
- package/dist/livekit/connectLiveKitAgent.d.ts +46 -0
- package/dist/livekit/connectLiveKitAgent.d.ts.map +1 -0
- package/dist/livekit/index.d.ts +3 -0
- package/dist/livekit/index.d.ts.map +1 -0
- package/dist/livekit/index.js +113 -0
- package/dist/livekit/index.js.map +1 -0
- package/dist/next/byo/audioCapture.d.ts +24 -0
- package/dist/next/byo/audioCapture.d.ts.map +1 -0
- package/dist/next/byo/pcm.d.ts +33 -0
- package/dist/next/byo/pcm.d.ts.map +1 -0
- package/dist/next/byo/resample.d.ts +18 -0
- package/dist/next/byo/resample.d.ts.map +1 -0
- package/dist/next/index.js +675 -474
- package/dist/next/index.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +16 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +41 -1
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +14 -2
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/speech/captureMediaStreamTrack.d.ts +1 -1
- package/dist/next/v2/speech/captureMediaStreamTrack.d.ts.map +1 -1
- package/dist/next/v2/speech/speechController.d.ts.map +1 -1
- package/dist/next/v2/speech/types.d.ts +13 -0
- package/dist/next/v2/speech/types.d.ts.map +1 -1
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/styles.d.ts +1 -1
- package/dist/next/widget/styles.d.ts.map +1 -1
- package/dist/npm/byo/audioCapture.d.ts +24 -0
- package/dist/npm/byo/audioCapture.d.ts.map +1 -0
- package/dist/npm/byo/pcm.d.ts +33 -0
- package/dist/npm/byo/pcm.d.ts.map +1 -0
- package/dist/npm/byo/resample.d.ts +18 -0
- package/dist/npm/byo/resample.d.ts.map +1 -0
- package/dist/npm/index.js +700 -499
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +16 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +41 -1
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +14 -2
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/speech/captureMediaStreamTrack.d.ts +1 -1
- package/dist/npm/v2/speech/captureMediaStreamTrack.d.ts.map +1 -1
- package/dist/npm/v2/speech/speechController.d.ts.map +1 -1
- package/dist/npm/v2/speech/types.d.ts +13 -0
- package/dist/npm/v2/speech/types.d.ts.map +1 -1
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/styles.d.ts +1 -1
- package/dist/npm/widget/styles.d.ts.map +1 -1
- package/dist/openai/connectOpenAiRealtime.d.ts +41 -0
- package/dist/openai/connectOpenAiRealtime.d.ts.map +1 -0
- package/dist/openai/connectOpenAiRealtimeWebRtc.d.ts +37 -0
- package/dist/openai/connectOpenAiRealtimeWebRtc.d.ts.map +1 -0
- package/dist/openai/index.d.ts +5 -0
- package/dist/openai/index.d.ts.map +1 -0
- package/dist/openai/index.js +282 -0
- package/dist/openai/index.js.map +1 -0
- package/dist/react/byo/audioCapture.d.ts +24 -0
- package/dist/react/byo/audioCapture.d.ts.map +1 -0
- package/dist/react/byo/pcm.d.ts +33 -0
- package/dist/react/byo/pcm.d.ts.map +1 -0
- package/dist/react/byo/resample.d.ts +18 -0
- package/dist/react/byo/resample.d.ts.map +1 -0
- package/dist/react/index.js +696 -495
- package/dist/react/index.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +16 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +41 -1
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +14 -2
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/speech/captureMediaStreamTrack.d.ts +1 -1
- package/dist/react/v2/speech/captureMediaStreamTrack.d.ts.map +1 -1
- package/dist/react/v2/speech/speechController.d.ts.map +1 -1
- package/dist/react/v2/speech/types.d.ts +13 -0
- package/dist/react/v2/speech/types.d.ts.map +1 -1
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/styles.d.ts +1 -1
- package/dist/react/widget/styles.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +37 -10
- package/dist/sdk/v2/client.js.map +1 -1
- package/package.json +55 -7
package/dist/react/index.js
CHANGED
|
@@ -18,7 +18,7 @@ function g(e) {
|
|
|
18
18
|
let n = ++m;
|
|
19
19
|
return p.set(e, n), n;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ee(e) {
|
|
22
22
|
let t = !!e.sessionEndpoint?.trim();
|
|
23
23
|
if (t && !e.experienceId?.trim()) throw Error("sessionEndpoint requires experienceId.");
|
|
24
24
|
if (!t && !e.experienceId && !e.manifest) throw Error("Experience requires experienceId or manifest.");
|
|
@@ -65,7 +65,7 @@ function _(e) {
|
|
|
65
65
|
};
|
|
66
66
|
throw Error("Experience requires experienceId or manifest.");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function te(e) {
|
|
69
69
|
return h([
|
|
70
70
|
e.experienceId,
|
|
71
71
|
e.sessionEndpoint,
|
|
@@ -87,23 +87,23 @@ function ee(e) {
|
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/svelte/experienceLoadError.ts
|
|
90
|
-
var
|
|
91
|
-
function
|
|
90
|
+
var _ = /\b(exp_[A-Za-z0-9][A-Za-z0-9_-]{2,127})\b/, v = /(?:Your origin|origin)\s+(\S+)\s+is not an allowed origin/i;
|
|
91
|
+
function y(e) {
|
|
92
92
|
return e instanceof Error ? e.message : String(e);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function b() {
|
|
95
95
|
try {
|
|
96
96
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
97
97
|
} catch {}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return
|
|
99
|
+
function ne(e) {
|
|
100
|
+
return _.exec(e)?.[1];
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
102
|
+
function x(e) {
|
|
103
|
+
return v.exec(e)?.[1];
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
let n =
|
|
105
|
+
function S(e, t) {
|
|
106
|
+
let n = y(e).trim() || "Unknown error", r = t?.experienceId?.trim() || ne(n) || void 0, i = t?.origin?.trim() || x(n) || b() || void 0;
|
|
107
107
|
return /No playable experience found/i.test(n) || /^Experience is not available\.?$/i.test(n) || /^Unknown experience\.?$/i.test(n) || /experience_unavailable/i.test(n) ? {
|
|
108
108
|
kind: "not_found",
|
|
109
109
|
title: "The application tried to load an avatar experience that doesn’t exist.",
|
|
@@ -136,7 +136,7 @@ function C(e, t) {
|
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region src/component/experienceComponentRuntime.ts
|
|
139
|
-
function
|
|
139
|
+
function C() {
|
|
140
140
|
let e, t, n = new Promise((n, r) => {
|
|
141
141
|
e = n, t = r;
|
|
142
142
|
});
|
|
@@ -146,29 +146,29 @@ function w() {
|
|
|
146
146
|
reject: t
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function w() {
|
|
150
150
|
return new DOMException("Aborted", "AbortError");
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function T(e) {
|
|
153
153
|
return e instanceof DOMException || e instanceof Error ? e : Error(String(e));
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function re(e) {
|
|
156
156
|
return e instanceof DOMException && e.name === "AbortError";
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function E(e) {
|
|
159
159
|
!e.instance || e.instanceDestroyed || (e.instanceDestroyed = !0, e.instance.destroy());
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function D(e, t, n, r) {
|
|
162
162
|
e.unsubscribers.push(t.on(n, r));
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
|
|
164
|
+
function O(e, t, n) {
|
|
165
|
+
D(e, t, "ready", (t) => {
|
|
166
166
|
e.destroyed || (e.ready.resolve(t), n().onReady?.(t));
|
|
167
|
-
}),
|
|
167
|
+
}), D(e, t, "started", (t) => {
|
|
168
168
|
e.destroyed || (e.started.resolve(t), n().onStarted?.(t));
|
|
169
|
-
}),
|
|
169
|
+
}), D(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), D(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), D(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), D(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), D(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), D(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), D(e, t, "message", (e) => n().onMessage?.(e)), D(e, t, "listeningState", (e) => n().onListeningState?.(e)), D(e, t, "modeChange", (e) => n().onModeChange?.(e)), D(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function ie(e = () => ({})) {
|
|
172
172
|
let t = 0, n = null;
|
|
173
173
|
function r(e) {
|
|
174
174
|
if (e) {
|
|
@@ -186,22 +186,22 @@ function re(e = () => ({})) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
function i(e, t, i, a, o = !1, s) {
|
|
189
|
-
let c =
|
|
190
|
-
return !
|
|
189
|
+
let c = T(e);
|
|
190
|
+
return !re(c) && n === t && !t.destroyed && (o && a?.(S(c, { experienceId: r(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), i.onError?.(c))), c;
|
|
191
191
|
}
|
|
192
192
|
function a() {
|
|
193
|
-
if (!n || n.destroyed) throw
|
|
193
|
+
if (!n || n.destroyed) throw w();
|
|
194
194
|
return n;
|
|
195
195
|
}
|
|
196
196
|
function o(e) {
|
|
197
|
-
if (e.destroyed || n !== e) throw
|
|
197
|
+
if (e.destroyed || n !== e) throw w();
|
|
198
198
|
}
|
|
199
199
|
function s() {
|
|
200
200
|
return {
|
|
201
201
|
id: ++t,
|
|
202
|
-
session:
|
|
203
|
-
ready:
|
|
204
|
-
started:
|
|
202
|
+
session: C(),
|
|
203
|
+
ready: C(),
|
|
204
|
+
started: C(),
|
|
205
205
|
unsubscribers: [],
|
|
206
206
|
reportedErrors: /* @__PURE__ */ new Set(),
|
|
207
207
|
instance: null,
|
|
@@ -212,19 +212,19 @@ function re(e = () => ({})) {
|
|
|
212
212
|
function u(e) {
|
|
213
213
|
if (e.destroyed) return;
|
|
214
214
|
e.destroyed = !0;
|
|
215
|
-
let t =
|
|
215
|
+
let t = w();
|
|
216
216
|
e.session.reject(t), e.ready.reject(t), e.started.reject(t);
|
|
217
217
|
for (let t of e.unsubscribers.splice(0)) t();
|
|
218
|
-
|
|
218
|
+
E(e), n === e && (n = null);
|
|
219
219
|
}
|
|
220
220
|
async function d(e, t, r, a, s, u) {
|
|
221
221
|
try {
|
|
222
222
|
let i = await c.startSession(r);
|
|
223
223
|
if (e.instance = i, e.destroyed || n !== e) {
|
|
224
|
-
|
|
224
|
+
E(e);
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
|
-
|
|
227
|
+
O(e, i, a);
|
|
228
228
|
let u = await i.attach({
|
|
229
229
|
container: t,
|
|
230
230
|
showClose: !!(a().onClose || s?.trim()),
|
|
@@ -244,7 +244,7 @@ function re(e = () => ({})) {
|
|
|
244
244
|
});
|
|
245
245
|
} catch (t) {
|
|
246
246
|
let n = i(t, e, a(), u, !0, r);
|
|
247
|
-
e.session.reject(n), e.ready.reject(n), e.started.reject(n),
|
|
247
|
+
e.session.reject(n), e.ready.reject(n), e.started.reject(n), E(e);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
function f(t, r, a, o) {
|
|
@@ -274,17 +274,17 @@ function re(e = () => ({})) {
|
|
|
274
274
|
}
|
|
275
275
|
//#endregion
|
|
276
276
|
//#region src/svelte/experienceLoadErrorStyles.ts
|
|
277
|
-
var
|
|
278
|
-
function
|
|
277
|
+
var k = "liforma-experience-load-error-styles";
|
|
278
|
+
function A() {
|
|
279
279
|
if (typeof document > "u" || document.getElementById("liforma-experience-load-error-styles")) return;
|
|
280
280
|
let e = document.createElement("style");
|
|
281
|
-
e.id =
|
|
281
|
+
e.id = k, e.textContent = j, document.head.append(e);
|
|
282
282
|
}
|
|
283
|
-
var
|
|
283
|
+
var j = "\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 word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/svelte/experienceLoadErrorOverlay.ts
|
|
286
|
-
function
|
|
287
|
-
|
|
286
|
+
function ae(e, t) {
|
|
287
|
+
A();
|
|
288
288
|
let n = t, r = !1, i = document.createElement("div");
|
|
289
289
|
i.className = "liforma-loading-screen liforma-loading-screen-absolute", i.setAttribute("role", "alert"), i.setAttribute("aria-live", "assertive");
|
|
290
290
|
let a = document.createElement("div");
|
|
@@ -314,75 +314,75 @@ function ie(e, t) {
|
|
|
314
314
|
}
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/react/Experience.tsx
|
|
317
|
-
var
|
|
318
|
-
let { returnUrl: c, onReady: l, onStarted: u, onUserTranscript: p, onUserSpeechStarted: m, onUserSpeechEnded: h, onCharacterSpeechStarted: g, onCharacterSpeechEnded:
|
|
319
|
-
|
|
317
|
+
var oe = e(function(e, a) {
|
|
318
|
+
let { returnUrl: c, onReady: l, onStarted: u, onUserTranscript: p, onUserSpeechStarted: m, onUserSpeechEnded: h, onCharacterSpeechStarted: g, onCharacterSpeechEnded: _, onConversationUpdate: v, onMessage: y, onListeningState: b, onModeChange: ne, onConversationProcessorError: x, onStateUpdate: S, onClose: C, onError: re } = e, E = o({}), D = o(ie(() => E.current)), O = o(null), [k, A] = s(!1), [j, oe] = s(null), M = o(null), N = o(null), se = te(e);
|
|
319
|
+
E.current = {
|
|
320
320
|
onReady: l,
|
|
321
321
|
onStarted: u,
|
|
322
322
|
onUserTranscript: p,
|
|
323
323
|
onUserSpeechStarted: m,
|
|
324
324
|
onUserSpeechEnded: h,
|
|
325
325
|
onCharacterSpeechStarted: g,
|
|
326
|
-
onCharacterSpeechEnded:
|
|
327
|
-
onConversationUpdate:
|
|
328
|
-
onMessage:
|
|
329
|
-
onListeningState:
|
|
330
|
-
onModeChange:
|
|
331
|
-
onConversationProcessorError:
|
|
332
|
-
onStateUpdate:
|
|
333
|
-
onClose:
|
|
334
|
-
onError:
|
|
326
|
+
onCharacterSpeechEnded: _,
|
|
327
|
+
onConversationUpdate: v,
|
|
328
|
+
onMessage: y,
|
|
329
|
+
onListeningState: b,
|
|
330
|
+
onModeChange: ne,
|
|
331
|
+
onConversationProcessorError: x,
|
|
332
|
+
onStateUpdate: S,
|
|
333
|
+
onClose: C,
|
|
334
|
+
onError: re
|
|
335
335
|
};
|
|
336
336
|
let ce = t((e) => {
|
|
337
|
-
|
|
337
|
+
M.current = e, A(e !== null);
|
|
338
338
|
}, []);
|
|
339
339
|
return r(a, () => ({
|
|
340
340
|
ready: () => {
|
|
341
|
-
let e =
|
|
342
|
-
return !e || e.destroyed ? Promise.reject(
|
|
341
|
+
let e = O.current;
|
|
342
|
+
return !e || e.destroyed ? Promise.reject(w()) : e.ready.promise;
|
|
343
343
|
},
|
|
344
344
|
started: () => {
|
|
345
|
-
let e =
|
|
346
|
-
return !e || e.destroyed ? Promise.reject(
|
|
345
|
+
let e = O.current;
|
|
346
|
+
return !e || e.destroyed ? Promise.reject(w()) : e.started.promise;
|
|
347
347
|
},
|
|
348
348
|
speech: {
|
|
349
|
-
speak: (e) =>
|
|
350
|
-
play: (e) =>
|
|
349
|
+
speak: (e) => D.current.withSession((t) => t.speech.speak(e)),
|
|
350
|
+
play: (e) => D.current.withSession((t) => t.speech.play(e)),
|
|
351
351
|
createUtterance: (e) => {
|
|
352
|
-
let t =
|
|
352
|
+
let t = D.current.getActiveInstance();
|
|
353
353
|
if (!t) throw Error("Session has not started. Wait for the player start button and the started event before using speech APIs.");
|
|
354
354
|
return t.speech.createUtterance(e);
|
|
355
355
|
},
|
|
356
|
-
interrupt: (e) =>
|
|
356
|
+
interrupt: (e) => D.current.withSession((t) => t.speech.interrupt(e))
|
|
357
357
|
},
|
|
358
|
-
startListening: () =>
|
|
359
|
-
stopListening: () =>
|
|
360
|
-
listenOnce: (e) =>
|
|
361
|
-
getManifest: () =>
|
|
362
|
-
getConversation: () =>
|
|
363
|
-
end: () =>
|
|
358
|
+
startListening: () => D.current.withSession((e) => e.startListening()),
|
|
359
|
+
stopListening: () => D.current.withSession((e) => e.stopListening()),
|
|
360
|
+
listenOnce: (e) => D.current.withSession((t) => t.listenOnce(e)),
|
|
361
|
+
getManifest: () => D.current.getActiveInstance()?.getManifest() ?? null,
|
|
362
|
+
getConversation: () => D.current.getActiveInstance()?.getConversation() ?? [],
|
|
363
|
+
end: () => D.current.withSession((e) => e.end())
|
|
364
364
|
}), []), i(() => {
|
|
365
|
-
if (!
|
|
366
|
-
let t =
|
|
365
|
+
if (!k || !M.current) return;
|
|
366
|
+
let t = M.current, n = D.current, r;
|
|
367
367
|
try {
|
|
368
|
-
r = { options:
|
|
368
|
+
r = { options: ee(e) };
|
|
369
369
|
} catch (e) {
|
|
370
|
-
r = { error:
|
|
370
|
+
r = { error: T(e) };
|
|
371
371
|
}
|
|
372
|
-
let i = n.activateGeneration(t, r, c,
|
|
373
|
-
return
|
|
374
|
-
n.cancelGeneration(i),
|
|
372
|
+
let i = n.activateGeneration(t, r, c, oe);
|
|
373
|
+
return O.current = i, () => {
|
|
374
|
+
n.cancelGeneration(i), O.current === i && (O.current = null);
|
|
375
375
|
};
|
|
376
376
|
}, [
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
k,
|
|
378
|
+
se,
|
|
379
379
|
c
|
|
380
380
|
]), n(() => {
|
|
381
|
-
let e =
|
|
382
|
-
if (!e || (e.replaceChildren(), !
|
|
383
|
-
let t =
|
|
381
|
+
let e = N.current;
|
|
382
|
+
if (!e || (e.replaceChildren(), !j)) return;
|
|
383
|
+
let t = ae(e, j);
|
|
384
384
|
return () => t.remove();
|
|
385
|
-
}, [
|
|
385
|
+
}, [j]), /* @__PURE__ */ f("div", {
|
|
386
386
|
className: "liforma-experience-shell",
|
|
387
387
|
style: {
|
|
388
388
|
position: "relative",
|
|
@@ -391,14 +391,14 @@ var ae = e(function(e, a) {
|
|
|
391
391
|
minHeight: "inherit"
|
|
392
392
|
},
|
|
393
393
|
children: [/* @__PURE__ */ d("div", {
|
|
394
|
-
ref:
|
|
394
|
+
ref: N,
|
|
395
395
|
className: "liforma-experience-error-host",
|
|
396
|
-
"aria-hidden":
|
|
396
|
+
"aria-hidden": j ? void 0 : !0,
|
|
397
397
|
style: {
|
|
398
398
|
position: "absolute",
|
|
399
399
|
inset: 0,
|
|
400
400
|
zIndex: 20,
|
|
401
|
-
pointerEvents:
|
|
401
|
+
pointerEvents: j ? "auto" : "none"
|
|
402
402
|
}
|
|
403
403
|
}), /* @__PURE__ */ d("div", {
|
|
404
404
|
ref: ce,
|
|
@@ -410,27 +410,27 @@ var ae = e(function(e, a) {
|
|
|
410
410
|
}
|
|
411
411
|
})]
|
|
412
412
|
});
|
|
413
|
-
}),
|
|
414
|
-
function
|
|
413
|
+
}), M = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, N = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
414
|
+
function se(e) {
|
|
415
415
|
let t = e.trim();
|
|
416
416
|
if (!t) return t;
|
|
417
|
-
let n = t.replace(
|
|
418
|
-
return n = n.replace(
|
|
417
|
+
let n = t.replace(M, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
|
|
418
|
+
return n = n.replace(N, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
|
|
419
419
|
}
|
|
420
420
|
function ce(e) {
|
|
421
421
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
422
422
|
if (!t) return null;
|
|
423
423
|
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
|
|
424
424
|
return {
|
|
425
|
-
avatarImage:
|
|
426
|
-
...n ? { backgroundImage:
|
|
427
|
-
...r ? { foregroundImage:
|
|
428
|
-
...i ? { fallbackImage:
|
|
425
|
+
avatarImage: se(t),
|
|
426
|
+
...n ? { backgroundImage: se(n) } : {},
|
|
427
|
+
...r ? { foregroundImage: se(r) } : {},
|
|
428
|
+
...i ? { fallbackImage: se(i) } : {}
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
//#endregion
|
|
432
432
|
//#region src/shims/localStack.ts
|
|
433
|
-
function
|
|
433
|
+
function P() {
|
|
434
434
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
435
435
|
if (typeof location > "u") return !1;
|
|
436
436
|
try {
|
|
@@ -441,70 +441,70 @@ function le() {
|
|
|
441
441
|
}
|
|
442
442
|
//#endregion
|
|
443
443
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
444
|
-
var
|
|
445
|
-
function
|
|
444
|
+
var le = "https://player.liforma.ai", ue = "http://localhost:3002";
|
|
445
|
+
function de(e) {
|
|
446
446
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function fe(e) {
|
|
449
449
|
let t = e?.trim();
|
|
450
|
-
return t ? t.replace(/\/$/, "") :
|
|
450
|
+
return t ? t.replace(/\/$/, "") : P() ? ue : le;
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
let t = e.experienceId.trim(), n =
|
|
452
|
+
function pe(e) {
|
|
453
|
+
let t = e.experienceId.trim(), n = fe(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
454
454
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function me(e) {
|
|
457
457
|
let t = e.href?.trim();
|
|
458
458
|
if (t) return t;
|
|
459
459
|
let n = e.experienceId?.trim();
|
|
460
460
|
if (!n) return;
|
|
461
461
|
let r = e.returnUrl?.trim();
|
|
462
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
462
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), pe({
|
|
463
463
|
experienceId: n,
|
|
464
464
|
...r ? { returnUrl: r } : {},
|
|
465
465
|
playerBaseUrl: e.playerBaseUrl
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function he() {
|
|
469
469
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
470
470
|
}
|
|
471
|
-
var
|
|
471
|
+
var F = 0, ge = [];
|
|
472
472
|
function _e() {
|
|
473
|
-
return
|
|
473
|
+
return he() ? 4 : Infinity;
|
|
474
474
|
}
|
|
475
475
|
function ve() {
|
|
476
|
-
return
|
|
476
|
+
return he() ? 160 : 0;
|
|
477
477
|
}
|
|
478
478
|
function ye() {
|
|
479
479
|
let e = _e();
|
|
480
|
-
for (;
|
|
481
|
-
let e =
|
|
480
|
+
for (; F < e && ge.length > 0;) {
|
|
481
|
+
let e = ge.shift();
|
|
482
482
|
if (!e || e.cancelled) continue;
|
|
483
|
-
|
|
483
|
+
F += 1, e.start();
|
|
484
484
|
let t = ve();
|
|
485
485
|
if (t <= 0) {
|
|
486
|
-
|
|
486
|
+
F = Math.max(0, F - 1);
|
|
487
487
|
continue;
|
|
488
488
|
}
|
|
489
489
|
window.setTimeout(() => {
|
|
490
|
-
|
|
490
|
+
F = Math.max(0, F - 1), ye();
|
|
491
491
|
}, t);
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
function be(e) {
|
|
495
|
-
if (!
|
|
495
|
+
if (!he()) return e(), () => {};
|
|
496
496
|
let t = {
|
|
497
497
|
start: e,
|
|
498
498
|
cancelled: !1
|
|
499
499
|
};
|
|
500
|
-
return
|
|
500
|
+
return ge.push(t), ye(), () => {
|
|
501
501
|
t.cancelled = !0;
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
//#endregion
|
|
505
505
|
//#region src/thumbnail/lazyLoad.ts
|
|
506
506
|
function xe() {
|
|
507
|
-
return
|
|
507
|
+
return he() ? "96px 0px" : "280px 0px";
|
|
508
508
|
}
|
|
509
509
|
function Se(e) {
|
|
510
510
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
@@ -548,27 +548,27 @@ function we(e, t) {
|
|
|
548
548
|
function Te() {
|
|
549
549
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function I(e, t) {
|
|
552
552
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
553
553
|
}
|
|
554
|
-
var
|
|
554
|
+
var Ee = /* @__PURE__ */ new Set(), De = !1, Oe = 0;
|
|
555
555
|
function ke() {
|
|
556
|
-
if (Oe = 0,
|
|
556
|
+
if (Oe = 0, Ee.size === 0 || typeof window > "u") return;
|
|
557
557
|
let e = window.innerHeight;
|
|
558
|
-
for (let t of
|
|
558
|
+
for (let t of Ee) {
|
|
559
559
|
if (t.pointerActive?.()) continue;
|
|
560
560
|
let n = t.element.getBoundingClientRect();
|
|
561
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
561
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(I(n, e));
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
function Ae() {
|
|
565
565
|
Oe === 0 && (Oe = requestAnimationFrame(ke));
|
|
566
566
|
}
|
|
567
567
|
function je() {
|
|
568
|
-
|
|
568
|
+
De || typeof window > "u" || (De = !0, window.addEventListener("scroll", Ae, { passive: !0 }), window.addEventListener("resize", Ae, { passive: !0 }));
|
|
569
569
|
}
|
|
570
570
|
function Me() {
|
|
571
|
-
|
|
571
|
+
Ee.size > 0 || !De || typeof window > "u" || (De = !1, Oe !== 0 && (cancelAnimationFrame(Oe), Oe = 0), window.removeEventListener("scroll", Ae), window.removeEventListener("resize", Ae));
|
|
572
572
|
}
|
|
573
573
|
function Ne(e, t) {
|
|
574
574
|
if (!Te()) return () => {};
|
|
@@ -577,8 +577,8 @@ function Ne(e, t) {
|
|
|
577
577
|
onParallax: t.onParallax,
|
|
578
578
|
pointerActive: t.pointerActive
|
|
579
579
|
};
|
|
580
|
-
return
|
|
581
|
-
|
|
580
|
+
return Ee.add(n), je(), n.pointerActive?.() || t.onParallax(I(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
581
|
+
Ee.delete(n), Me();
|
|
582
582
|
};
|
|
583
583
|
}
|
|
584
584
|
//#endregion
|
|
@@ -600,7 +600,7 @@ function Pe(e) {
|
|
|
600
600
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
601
601
|
}, u = () => {
|
|
602
602
|
let s = a;
|
|
603
|
-
a = !1, r = !1, i && s ? (t =
|
|
603
|
+
a = !1, r = !1, i && s ? (t = I(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
604
604
|
}, d = (e) => {
|
|
605
605
|
e.pointerType === "mouse" && (r = !0, o());
|
|
606
606
|
}, f = () => {
|
|
@@ -628,111 +628,111 @@ function Re(e, t) {
|
|
|
628
628
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
629
629
|
}
|
|
630
630
|
function ze(e) {
|
|
631
|
-
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick:
|
|
631
|
+
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: ee, returnUrl: te, playerBaseUrl: _, parallax: v = !0, lazy: y = !0, className: b = "", fallbackImage: ne } = e, x = a(() => ce({
|
|
632
632
|
galleryThumb: t,
|
|
633
633
|
avatarImage: r,
|
|
634
634
|
backgroundImage: i,
|
|
635
635
|
foregroundImage: c,
|
|
636
|
-
fallbackImage:
|
|
636
|
+
fallbackImage: ne
|
|
637
637
|
}), [
|
|
638
638
|
t,
|
|
639
639
|
r,
|
|
640
640
|
i,
|
|
641
641
|
c,
|
|
642
|
-
|
|
643
|
-
]),
|
|
642
|
+
ne
|
|
643
|
+
]), S = de({
|
|
644
644
|
href: m,
|
|
645
|
-
hasClickHandler: typeof
|
|
645
|
+
hasClickHandler: typeof ee == "function",
|
|
646
646
|
experienceId: p
|
|
647
|
-
}),
|
|
647
|
+
}), C = S === "anchor" && !m?.trim() && !!p?.trim(), w = !!x?.backgroundImage, T = v !== !1, re = o(null), E = o(!1), [D, O] = s(!y), [ie, k] = s(!1), [A, j] = s(!1), [ae, oe] = s(0), [M, N] = s(0), [se, P] = s(!1), [le, ue] = s(!1), [fe, pe] = s(!1), [he, F] = s(!1), [ge, _e] = s(), ve = x ? se && x.fallbackImage ? x.fallbackImage : x.avatarImage : "";
|
|
648
648
|
n(() => {
|
|
649
649
|
Le(Fe);
|
|
650
650
|
}, []), n(() => {
|
|
651
|
-
_e(
|
|
651
|
+
_e(me({
|
|
652
652
|
href: m,
|
|
653
653
|
experienceId: p,
|
|
654
|
-
returnUrl:
|
|
655
|
-
playerBaseUrl:
|
|
656
|
-
useCurrentPageAsReturnUrl:
|
|
654
|
+
returnUrl: te,
|
|
655
|
+
playerBaseUrl: _,
|
|
656
|
+
useCurrentPageAsReturnUrl: C && !te?.trim()
|
|
657
657
|
}));
|
|
658
658
|
}, [
|
|
659
659
|
m,
|
|
660
660
|
p,
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
661
|
+
te,
|
|
662
|
+
_,
|
|
663
|
+
C
|
|
664
664
|
]), n(() => {
|
|
665
|
-
|
|
665
|
+
ue(!1), pe(!1), F(!1), P(!1);
|
|
666
666
|
}, [
|
|
667
|
-
|
|
668
|
-
|
|
667
|
+
x?.backgroundImage,
|
|
668
|
+
x?.foregroundImage,
|
|
669
669
|
ve
|
|
670
670
|
]), n(() => {
|
|
671
|
-
let e =
|
|
671
|
+
let e = re.current;
|
|
672
672
|
if (e) {
|
|
673
|
-
if (!
|
|
674
|
-
|
|
673
|
+
if (!y) {
|
|
674
|
+
O(!0);
|
|
675
675
|
return;
|
|
676
676
|
}
|
|
677
677
|
return we(e, { onVisibleChange: (e) => {
|
|
678
|
-
e &&
|
|
678
|
+
e && O(!0);
|
|
679
679
|
} });
|
|
680
680
|
}
|
|
681
681
|
}, [
|
|
682
|
-
|
|
682
|
+
y,
|
|
683
|
+
x,
|
|
683
684
|
S,
|
|
684
|
-
|
|
685
|
-
F
|
|
685
|
+
ge
|
|
686
686
|
]), n(() => {
|
|
687
|
-
let e =
|
|
688
|
-
if (!(!e || !
|
|
687
|
+
let e = re.current;
|
|
688
|
+
if (!(!e || !T)) return Ne(e, {
|
|
689
689
|
onParallax: (e) => {
|
|
690
|
-
|
|
690
|
+
j(!0), E.current || (oe(e), N(0));
|
|
691
691
|
},
|
|
692
|
-
pointerActive: () =>
|
|
692
|
+
pointerActive: () => E.current
|
|
693
693
|
});
|
|
694
694
|
}, [
|
|
695
|
-
|
|
695
|
+
T,
|
|
696
|
+
x,
|
|
696
697
|
S,
|
|
697
|
-
|
|
698
|
-
F
|
|
698
|
+
ge
|
|
699
699
|
]);
|
|
700
700
|
let ye = (e) => {
|
|
701
|
-
if (!
|
|
701
|
+
if (!T || A) return;
|
|
702
702
|
let t = e.currentTarget.getBoundingClientRect();
|
|
703
|
-
t.width <= 0 || t.height <= 0 || (
|
|
703
|
+
t.width <= 0 || t.height <= 0 || (oe(((e.clientX - t.left) / t.width - .5) * 2), N(((e.clientY - t.top) / t.height - .5) * 2));
|
|
704
704
|
}, be = (e) => {
|
|
705
|
-
let t =
|
|
706
|
-
|
|
705
|
+
let t = E.current;
|
|
706
|
+
E.current = !1, k(!1), A && t ? (oe(I(e.getBoundingClientRect(), window.innerHeight)), N(0)) : A || (oe(0), N(0));
|
|
707
707
|
}, xe = (e) => {
|
|
708
|
-
if (!
|
|
709
|
-
|
|
708
|
+
if (!T) return;
|
|
709
|
+
E.current = !0, e.pointerType === "mouse" && k(!0);
|
|
710
710
|
let t = e.currentTarget, n = () => {
|
|
711
711
|
be(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
712
712
|
};
|
|
713
713
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
714
714
|
}, Se = (e) => {
|
|
715
|
-
if (
|
|
716
|
-
let t =
|
|
715
|
+
if (ee?.(e), !e.defaultPrevented && C && !te?.trim()) {
|
|
716
|
+
let t = me({
|
|
717
717
|
experienceId: p,
|
|
718
|
-
playerBaseUrl:
|
|
718
|
+
playerBaseUrl: _,
|
|
719
719
|
useCurrentPageAsReturnUrl: !0
|
|
720
720
|
});
|
|
721
721
|
t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
|
-
if (!
|
|
725
|
-
let Ce =
|
|
724
|
+
if (!x) return null;
|
|
725
|
+
let Ce = T && (ie || A), Te = D && (fe || le || he), Ee = [
|
|
726
726
|
"liforma-et",
|
|
727
|
-
|
|
727
|
+
w ? "liforma-et--scene" : "",
|
|
728
728
|
Ce ? "liforma-et--parallax" : "",
|
|
729
|
-
|
|
730
|
-
|
|
729
|
+
A ? "liforma-et--scroll-parallax" : "",
|
|
730
|
+
D && !Te ? "liforma-et--loading" : "",
|
|
731
731
|
Te ? "liforma-et--revealed" : "",
|
|
732
|
-
|
|
733
|
-
].filter(Boolean).join(" "),
|
|
734
|
-
"--liforma-et-parallax-x":
|
|
735
|
-
"--liforma-et-parallax-y":
|
|
732
|
+
b
|
|
733
|
+
].filter(Boolean).join(" "), De = {
|
|
734
|
+
"--liforma-et-parallax-x": ae,
|
|
735
|
+
"--liforma-et-parallax-y": M
|
|
736
736
|
}, Oe = (e, t) => {
|
|
737
737
|
e.complete && t(!0);
|
|
738
738
|
}, ke = /* @__PURE__ */ f(u, { children: [
|
|
@@ -740,79 +740,79 @@ function ze(e) {
|
|
|
740
740
|
className: "liforma-et__placeholder",
|
|
741
741
|
"aria-hidden": "true"
|
|
742
742
|
}),
|
|
743
|
-
|
|
744
|
-
className: Re("liforma-et__background",
|
|
745
|
-
src:
|
|
743
|
+
D && x.backgroundImage ? /* @__PURE__ */ d("img", {
|
|
744
|
+
className: Re("liforma-et__background", le),
|
|
745
|
+
src: x.backgroundImage,
|
|
746
746
|
alt: "",
|
|
747
747
|
decoding: "async",
|
|
748
748
|
ref: (e) => {
|
|
749
|
-
e && Oe(e,
|
|
749
|
+
e && Oe(e, ue);
|
|
750
750
|
},
|
|
751
|
-
onLoad: () =>
|
|
752
|
-
onError: () =>
|
|
751
|
+
onLoad: () => ue(!0),
|
|
752
|
+
onError: () => ue(!0)
|
|
753
753
|
}) : null,
|
|
754
|
-
|
|
755
|
-
className: Re("liforma-et__avatar",
|
|
754
|
+
D && ve ? /* @__PURE__ */ d("img", {
|
|
755
|
+
className: Re("liforma-et__avatar", fe),
|
|
756
756
|
src: ve,
|
|
757
757
|
alt: "",
|
|
758
758
|
decoding: "async",
|
|
759
759
|
ref: (e) => {
|
|
760
|
-
e && Oe(e,
|
|
760
|
+
e && Oe(e, pe);
|
|
761
761
|
},
|
|
762
|
-
onLoad: () =>
|
|
762
|
+
onLoad: () => pe(!0),
|
|
763
763
|
onError: () => {
|
|
764
|
-
|
|
764
|
+
x.fallbackImage ? P(!0) : pe(!0);
|
|
765
765
|
}
|
|
766
766
|
}) : null,
|
|
767
|
-
|
|
768
|
-
className: Re("liforma-et__foreground",
|
|
769
|
-
src:
|
|
767
|
+
D && x.foregroundImage ? /* @__PURE__ */ d("img", {
|
|
768
|
+
className: Re("liforma-et__foreground", he),
|
|
769
|
+
src: x.foregroundImage,
|
|
770
770
|
alt: "",
|
|
771
771
|
decoding: "async",
|
|
772
772
|
ref: (e) => {
|
|
773
|
-
e && Oe(e,
|
|
773
|
+
e && Oe(e, F);
|
|
774
774
|
},
|
|
775
|
-
onLoad: () =>
|
|
776
|
-
onError: () =>
|
|
775
|
+
onLoad: () => F(!0),
|
|
776
|
+
onError: () => F(!0)
|
|
777
777
|
}) : null
|
|
778
778
|
] }), Ae = {
|
|
779
779
|
onPointerDown: xe,
|
|
780
780
|
onPointerUp: (e) => be(e.currentTarget),
|
|
781
781
|
onPointerCancel: (e) => be(e.currentTarget),
|
|
782
782
|
onPointerEnter: (e) => {
|
|
783
|
-
|
|
783
|
+
T && e.pointerType === "mouse" && k(!0);
|
|
784
784
|
},
|
|
785
785
|
onPointerMove: ye,
|
|
786
786
|
onPointerLeave: () => {
|
|
787
|
-
|
|
787
|
+
E.current || (k(!1), A || (oe(0), N(0)));
|
|
788
788
|
}
|
|
789
789
|
}, je = (e) => {
|
|
790
|
-
|
|
790
|
+
re.current = e;
|
|
791
791
|
};
|
|
792
|
-
return
|
|
792
|
+
return S === "anchor" && ge ? /* @__PURE__ */ d("a", {
|
|
793
793
|
ref: je,
|
|
794
|
-
className:
|
|
795
|
-
style:
|
|
796
|
-
href:
|
|
794
|
+
className: Ee,
|
|
795
|
+
style: De,
|
|
796
|
+
href: ge,
|
|
797
797
|
target: h,
|
|
798
798
|
rel: g,
|
|
799
799
|
"aria-label": l,
|
|
800
800
|
onClick: Se,
|
|
801
801
|
...Ae,
|
|
802
802
|
children: ke
|
|
803
|
-
}) :
|
|
803
|
+
}) : S === "button" ? /* @__PURE__ */ d("button", {
|
|
804
804
|
type: "button",
|
|
805
805
|
ref: je,
|
|
806
|
-
className:
|
|
807
|
-
style:
|
|
806
|
+
className: Ee,
|
|
807
|
+
style: De,
|
|
808
808
|
"aria-label": l,
|
|
809
809
|
onClick: Se,
|
|
810
810
|
...Ae,
|
|
811
811
|
children: ke
|
|
812
812
|
}) : /* @__PURE__ */ d("div", {
|
|
813
813
|
ref: je,
|
|
814
|
-
className:
|
|
815
|
-
style:
|
|
814
|
+
className: Ee,
|
|
815
|
+
style: De,
|
|
816
816
|
role: l ? "img" : void 0,
|
|
817
817
|
"aria-label": l || void 0,
|
|
818
818
|
"aria-hidden": l ? void 0 : !0,
|
|
@@ -822,7 +822,7 @@ function ze(e) {
|
|
|
822
822
|
}
|
|
823
823
|
//#endregion
|
|
824
824
|
//#region src/widget/styles.ts
|
|
825
|
-
var Be = "\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 is the drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging {\n cursor: grabbing;\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", Ve = "liforma-experience-widget-styles";
|
|
825
|
+
var Be = "\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", Ve = "liforma-experience-widget-styles";
|
|
826
826
|
function He(e = Be) {
|
|
827
827
|
if (typeof document > "u") return;
|
|
828
828
|
let t = document.getElementById(Ve);
|
|
@@ -844,7 +844,7 @@ function Ge() {
|
|
|
844
844
|
return t ? t.replace(/\/$/, "") : null;
|
|
845
845
|
}
|
|
846
846
|
function Ke() {
|
|
847
|
-
return Ge() || (
|
|
847
|
+
return Ge() || (P() ? We : Ue);
|
|
848
848
|
}
|
|
849
849
|
//#endregion
|
|
850
850
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
@@ -4397,7 +4397,10 @@ var Js = new Set([
|
|
|
4397
4397
|
"widgetReady",
|
|
4398
4398
|
"widgetExpand",
|
|
4399
4399
|
"widgetCollapse",
|
|
4400
|
-
"widgetAudioSettings"
|
|
4400
|
+
"widgetAudioSettings",
|
|
4401
|
+
"widgetDragStart",
|
|
4402
|
+
"widgetDragMove",
|
|
4403
|
+
"widgetDragEnd"
|
|
4401
4404
|
]);
|
|
4402
4405
|
function Ys(e) {
|
|
4403
4406
|
if (!e || typeof e != "object") return null;
|
|
@@ -4408,6 +4411,16 @@ function Ys(e) {
|
|
|
4408
4411
|
let e = t.payload;
|
|
4409
4412
|
return !e || typeof e != "object" || typeof e.open != "boolean" ? null : t;
|
|
4410
4413
|
}
|
|
4414
|
+
if (t.type === "widgetDragStart" || t.type === "widgetDragEnd") {
|
|
4415
|
+
let e = t.payload;
|
|
4416
|
+
return !e || typeof e != "object" || typeof e.pointerId != "number" || !Number.isFinite(e.pointerId) ? null : t;
|
|
4417
|
+
}
|
|
4418
|
+
if (t.type === "widgetDragMove") {
|
|
4419
|
+
let e = t.payload;
|
|
4420
|
+
if (!e || typeof e != "object") return null;
|
|
4421
|
+
let { pointerId: n, dx: r, dy: i } = e;
|
|
4422
|
+
return typeof n != "number" || !Number.isFinite(n) || typeof r != "number" || !Number.isFinite(r) || typeof i != "number" || !Number.isFinite(i) ? null : t;
|
|
4423
|
+
}
|
|
4411
4424
|
return !t.payload || typeof t.payload != "object" ? null : t;
|
|
4412
4425
|
}
|
|
4413
4426
|
function Xs(e) {
|
|
@@ -4515,6 +4528,15 @@ function tc(e) {
|
|
|
4515
4528
|
case "widgetAudioSettings":
|
|
4516
4529
|
e.onWidgetAudioSettings?.(a.payload.open);
|
|
4517
4530
|
break;
|
|
4531
|
+
case "widgetDragStart":
|
|
4532
|
+
e.onWidgetDragStart?.(a.payload);
|
|
4533
|
+
break;
|
|
4534
|
+
case "widgetDragMove":
|
|
4535
|
+
e.onWidgetDragMove?.(a.payload);
|
|
4536
|
+
break;
|
|
4537
|
+
case "widgetDragEnd":
|
|
4538
|
+
e.onWidgetDragEnd?.(a.payload);
|
|
4539
|
+
break;
|
|
4518
4540
|
}
|
|
4519
4541
|
};
|
|
4520
4542
|
if (window.addEventListener("message", o), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
|
|
@@ -4665,7 +4687,8 @@ function tc(e) {
|
|
|
4665
4687
|
utteranceId: e.utteranceId,
|
|
4666
4688
|
format: e.format,
|
|
4667
4689
|
queue: e.queue,
|
|
4668
|
-
...e.characterId ? { characterId: e.characterId } : {}
|
|
4690
|
+
...e.characterId ? { characterId: e.characterId } : {},
|
|
4691
|
+
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
4669
4692
|
}
|
|
4670
4693
|
});
|
|
4671
4694
|
},
|
|
@@ -4681,6 +4704,17 @@ function tc(e) {
|
|
|
4681
4704
|
}
|
|
4682
4705
|
}, ec, [e.audio]);
|
|
4683
4706
|
},
|
|
4707
|
+
speechUtteranceSetTranscript(e) {
|
|
4708
|
+
return c({
|
|
4709
|
+
type: "speechUtteranceSetTranscript",
|
|
4710
|
+
schemaVersion: 2,
|
|
4711
|
+
payload: {
|
|
4712
|
+
correlationId: Z(),
|
|
4713
|
+
utteranceId: e.utteranceId,
|
|
4714
|
+
transcript: e.transcript
|
|
4715
|
+
}
|
|
4716
|
+
});
|
|
4717
|
+
},
|
|
4684
4718
|
speechUtteranceClose(e) {
|
|
4685
4719
|
return c({
|
|
4686
4720
|
type: "speechUtteranceClose",
|
|
@@ -4756,7 +4790,7 @@ function ac() {
|
|
|
4756
4790
|
}
|
|
4757
4791
|
function oc() {
|
|
4758
4792
|
let e = ac();
|
|
4759
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
4793
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : P() ? ic : rc;
|
|
4760
4794
|
}
|
|
4761
4795
|
function sc(e, t, n, r, i, a, o) {
|
|
4762
4796
|
let s = (e ?? oc()).replace(/\/$/, ""), c = s.endsWith("/embed") ? s : `${s}/embed`, l = new URL(c), u = n?.trim();
|
|
@@ -4938,51 +4972,176 @@ function Ac(e) {
|
|
|
4938
4972
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
4939
4973
|
}
|
|
4940
4974
|
//#endregion
|
|
4941
|
-
//#region src/
|
|
4975
|
+
//#region src/byo/pcm.ts
|
|
4942
4976
|
function jc(e) {
|
|
4943
|
-
let t =
|
|
4977
|
+
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
4944
4978
|
for (let t = 0; t < e.length; t++) {
|
|
4945
4979
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
4946
4980
|
n.setInt16(t * 2, r < 0 ? r * 32768 : r * 32767, !0);
|
|
4947
4981
|
}
|
|
4948
4982
|
return t;
|
|
4949
4983
|
}
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4984
|
+
//#endregion
|
|
4985
|
+
//#region src/byo/resample.ts
|
|
4986
|
+
function Mc(e, t, n, r, i) {
|
|
4987
|
+
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;
|
|
4988
|
+
return ((a * i + o) * i + s) * i + c;
|
|
4989
|
+
}
|
|
4990
|
+
function Nc(e, t) {
|
|
4991
|
+
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
4992
|
+
if (e === t) return {
|
|
4993
|
+
fromRate: e,
|
|
4994
|
+
toRate: t,
|
|
4995
|
+
push(e) {
|
|
4996
|
+
return e;
|
|
4997
|
+
},
|
|
4998
|
+
flush() {
|
|
4999
|
+
return new Float32Array();
|
|
5000
|
+
}
|
|
5001
|
+
};
|
|
5002
|
+
let n = e / t, r = new Float32Array(), i = 0;
|
|
5003
|
+
return {
|
|
5004
|
+
fromRate: e,
|
|
5005
|
+
toRate: t,
|
|
5006
|
+
push(e) {
|
|
5007
|
+
if (e.length === 0) return new Float32Array();
|
|
5008
|
+
let t = new Float32Array(r.length + e.length);
|
|
5009
|
+
if (t.set(r), t.set(e, r.length), r = t, r.length < 4) return new Float32Array();
|
|
5010
|
+
let a = [];
|
|
5011
|
+
for (; i + 2 < r.length - 1;) {
|
|
5012
|
+
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);
|
|
5013
|
+
a.push(Mc(r[o], r[e], r[s], r[c], t)), i += n;
|
|
5014
|
+
}
|
|
5015
|
+
let o = Math.max(0, Math.floor(i) - 1);
|
|
5016
|
+
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
5017
|
+
},
|
|
5018
|
+
flush() {
|
|
5019
|
+
return r.length === 0 ? new Float32Array() : (r = new Float32Array(), i = 0, new Float32Array());
|
|
5020
|
+
}
|
|
5021
|
+
};
|
|
5022
|
+
}
|
|
5023
|
+
//#endregion
|
|
5024
|
+
//#region src/byo/audioCapture.ts
|
|
5025
|
+
var Pc = "liforma-pcm-capture", Fc = `
|
|
5026
|
+
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
5027
|
+
process(inputs) {
|
|
5028
|
+
const ch = inputs[0] && inputs[0][0];
|
|
5029
|
+
if (ch && ch.length) {
|
|
5030
|
+
const copy = new Float32Array(ch.length);
|
|
5031
|
+
copy.set(ch);
|
|
5032
|
+
this.port.postMessage(copy, [copy.buffer]);
|
|
5033
|
+
}
|
|
5034
|
+
return true;
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
registerProcessor('${Pc}', LiformaPcmCaptureProcessor);
|
|
5038
|
+
`, Ic = null;
|
|
5039
|
+
function Lc() {
|
|
5040
|
+
return Ic ||= URL.createObjectURL(new Blob([Fc], { type: "application/javascript" })), Ic;
|
|
5041
|
+
}
|
|
5042
|
+
function Rc() {
|
|
5043
|
+
return window.AudioContext || window.webkitAudioContext || null;
|
|
5044
|
+
}
|
|
5045
|
+
async function zc(e) {
|
|
5046
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Rc();
|
|
5047
|
+
if (!o) throw Error("Web Audio is required for audio capture");
|
|
5048
|
+
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
4958
5049
|
l.gain.value = 0;
|
|
4959
|
-
let u =
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
5050
|
+
let u = s.sampleRate, d = Nc(u, n), f = !1, p = !1, m = (e) => {
|
|
5051
|
+
if (f || i && !i()) return;
|
|
5052
|
+
let t = d.push(e);
|
|
5053
|
+
t.length !== 0 && r(jc(t));
|
|
5054
|
+
}, h = () => void 0;
|
|
5055
|
+
return await (async () => {
|
|
5056
|
+
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
5057
|
+
try {
|
|
5058
|
+
await s.audioWorklet.addModule(Lc());
|
|
5059
|
+
let e = new AudioWorkletNode(s, Pc, {
|
|
5060
|
+
numberOfInputs: 1,
|
|
5061
|
+
numberOfOutputs: 1,
|
|
5062
|
+
outputChannelCount: [1]
|
|
5063
|
+
});
|
|
5064
|
+
return e.port.onmessage = (e) => {
|
|
5065
|
+
e.data instanceof Float32Array && m(e.data);
|
|
5066
|
+
}, c.connect(e), e.connect(l), l.connect(s.destination), h = () => {
|
|
5067
|
+
e.port.onmessage = null;
|
|
5068
|
+
try {
|
|
5069
|
+
e.disconnect();
|
|
5070
|
+
} catch {}
|
|
5071
|
+
try {
|
|
5072
|
+
c.disconnect();
|
|
5073
|
+
} catch {}
|
|
5074
|
+
try {
|
|
5075
|
+
l.disconnect();
|
|
5076
|
+
} catch {}
|
|
5077
|
+
}, p = !0, !0;
|
|
5078
|
+
} catch {
|
|
5079
|
+
return !1;
|
|
5080
|
+
}
|
|
5081
|
+
})() ? a?.(`Mic/track capture via AudioWorklet at ${u} Hz → ${n} Hz`) : ((() => {
|
|
5082
|
+
let e = s.createScriptProcessor?.bind(s);
|
|
5083
|
+
if (!e) throw Error("Neither AudioWorklet nor ScriptProcessor is available");
|
|
5084
|
+
let t = e(4096, 1, 1);
|
|
5085
|
+
t.onaudioprocess = (e) => {
|
|
5086
|
+
m(e.inputBuffer.getChannelData(0));
|
|
5087
|
+
}, c.connect(t), t.connect(l), l.connect(s.destination), h = () => {
|
|
5088
|
+
t.onaudioprocess = null;
|
|
5089
|
+
try {
|
|
5090
|
+
t.disconnect();
|
|
5091
|
+
} catch {}
|
|
5092
|
+
try {
|
|
5093
|
+
c.disconnect();
|
|
5094
|
+
} catch {}
|
|
4964
5095
|
try {
|
|
4965
|
-
|
|
5096
|
+
l.disconnect();
|
|
4966
5097
|
} catch {}
|
|
4967
|
-
|
|
5098
|
+
}, p = !1;
|
|
5099
|
+
})(), a?.(`Mic/track capture via ScriptProcessor at ${u} Hz → ${n} Hz`, "warn")), s.state === "suspended" && await s.resume().catch(() => void 0), {
|
|
5100
|
+
fromSampleRate: u,
|
|
5101
|
+
usingWorklet: p,
|
|
5102
|
+
stop() {
|
|
5103
|
+
f || (f = !0, d.flush(), h(), s.close().catch(() => void 0));
|
|
4968
5104
|
}
|
|
4969
5105
|
};
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
5106
|
+
}
|
|
5107
|
+
//#endregion
|
|
5108
|
+
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
5109
|
+
async function Bc(e) {
|
|
5110
|
+
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
5111
|
+
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new $("MediaStreamTrack is not available in this environment.");
|
|
5112
|
+
if (t.kind !== "audio") throw new $("speech.play track must be an audio MediaStreamTrack.");
|
|
5113
|
+
if (t.readyState === "ended" || i?.aborted) return;
|
|
5114
|
+
let a = new MediaStream([t]), o = Promise.resolve(), s = !1, c = null, l = () => {
|
|
5115
|
+
s || (s = !0, c?.stop(), c = null);
|
|
5116
|
+
};
|
|
5117
|
+
try {
|
|
5118
|
+
c = await zc({
|
|
5119
|
+
mediaStream: a,
|
|
5120
|
+
targetSampleRate: r,
|
|
5121
|
+
shouldSend: () => !s && !i?.aborted,
|
|
5122
|
+
onPcm: (e) => {
|
|
5123
|
+
if (s || i?.aborted) return;
|
|
5124
|
+
let t = kc(e);
|
|
5125
|
+
o = o.then(async () => {
|
|
5126
|
+
if (s || i?.aborted) return;
|
|
5127
|
+
let e = 0;
|
|
5128
|
+
for (; e < t.byteLength;) {
|
|
5129
|
+
let r = Math.min(e + bc.MAX_CHUNK_BYTES, t.byteLength);
|
|
5130
|
+
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
5131
|
+
let i = t.subarray(e, r);
|
|
5132
|
+
e = r, i.byteLength !== 0 && await n.write(i);
|
|
5133
|
+
}
|
|
5134
|
+
}).catch(() => {
|
|
5135
|
+
l();
|
|
5136
|
+
});
|
|
4979
5137
|
}
|
|
4980
|
-
}).catch(() => {
|
|
4981
|
-
m();
|
|
4982
5138
|
});
|
|
4983
|
-
}
|
|
5139
|
+
} catch (e) {
|
|
5140
|
+
throw l(), new $(`MediaStreamTrack capture failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
5141
|
+
}
|
|
5142
|
+
await new Promise((e) => {
|
|
4984
5143
|
let r = () => {
|
|
4985
|
-
|
|
5144
|
+
l(), o.finally(e);
|
|
4986
5145
|
};
|
|
4987
5146
|
t.addEventListener("ended", r, { once: !0 }), i?.addEventListener("abort", () => {
|
|
4988
5147
|
n.cancel().catch(() => void 0), r();
|
|
@@ -4991,7 +5150,7 @@ async function Mc(e) {
|
|
|
4991
5150
|
}
|
|
4992
5151
|
//#endregion
|
|
4993
5152
|
//#region src/v2/speech/speechController.ts
|
|
4994
|
-
async function
|
|
5153
|
+
async function Vc(e, t) {
|
|
4995
5154
|
if (_c(e)) throw new $("MediaStreamTrack play is handled on the host before embed.");
|
|
4996
5155
|
if (hc(e)) {
|
|
4997
5156
|
let t = kc(e.data);
|
|
@@ -5020,10 +5179,10 @@ async function Nc(e, t) {
|
|
|
5020
5179
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
5021
5180
|
};
|
|
5022
5181
|
}
|
|
5023
|
-
function
|
|
5182
|
+
function Hc() {
|
|
5024
5183
|
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)}`;
|
|
5025
5184
|
}
|
|
5026
|
-
function
|
|
5185
|
+
function Uc(e, t = "completed") {
|
|
5027
5186
|
return {
|
|
5028
5187
|
utteranceId: e.speechId,
|
|
5029
5188
|
characterId: e.characterId,
|
|
@@ -5037,13 +5196,13 @@ function Fc(e, t = "completed") {
|
|
|
5037
5196
|
}
|
|
5038
5197
|
};
|
|
5039
5198
|
}
|
|
5040
|
-
function
|
|
5199
|
+
function Wc(e) {
|
|
5041
5200
|
return e instanceof Error ? e : new $(String(e));
|
|
5042
5201
|
}
|
|
5043
|
-
function
|
|
5202
|
+
function Gc(e) {
|
|
5044
5203
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
5045
5204
|
}
|
|
5046
|
-
var
|
|
5205
|
+
var Kc = class {
|
|
5047
5206
|
id;
|
|
5048
5207
|
characterId;
|
|
5049
5208
|
result;
|
|
@@ -5069,9 +5228,10 @@ var Rc = class {
|
|
|
5069
5228
|
utteranceId: this.id,
|
|
5070
5229
|
format: this.format,
|
|
5071
5230
|
characterId: this.characterId,
|
|
5072
|
-
queue: e.queue
|
|
5231
|
+
queue: e.queue,
|
|
5232
|
+
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
5073
5233
|
}).catch((e) => {
|
|
5074
|
-
throw this.fail(
|
|
5234
|
+
throw this.fail(Wc(e)), Wc(e);
|
|
5075
5235
|
}), this.signal?.addEventListener("abort", () => {
|
|
5076
5236
|
this.cancel();
|
|
5077
5237
|
}, { once: !0 });
|
|
@@ -5104,6 +5264,13 @@ var Rc = class {
|
|
|
5104
5264
|
this.releaseWriteSlot();
|
|
5105
5265
|
}
|
|
5106
5266
|
}
|
|
5267
|
+
async setTranscript(e) {
|
|
5268
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Sc();
|
|
5269
|
+
await this.requireHost().speechUtteranceSetTranscript({
|
|
5270
|
+
utteranceId: this.id,
|
|
5271
|
+
transcript: e
|
|
5272
|
+
});
|
|
5273
|
+
}
|
|
5107
5274
|
async close(e) {
|
|
5108
5275
|
if (this.settled) return this.result;
|
|
5109
5276
|
this.closed = !0, await this.beginPromise.catch(() => void 0), await this.writeChain.catch(() => void 0);
|
|
@@ -5115,7 +5282,7 @@ var Rc = class {
|
|
|
5115
5282
|
});
|
|
5116
5283
|
return this.resolve(t), t;
|
|
5117
5284
|
} catch (e) {
|
|
5118
|
-
let t =
|
|
5285
|
+
let t = Wc(e);
|
|
5119
5286
|
throw this.fail(t), t;
|
|
5120
5287
|
}
|
|
5121
5288
|
}
|
|
@@ -5137,7 +5304,7 @@ var Rc = class {
|
|
|
5137
5304
|
};
|
|
5138
5305
|
return this.resolve(t), t;
|
|
5139
5306
|
} catch (e) {
|
|
5140
|
-
let t =
|
|
5307
|
+
let t = Wc(e);
|
|
5141
5308
|
throw this.fail(t), t;
|
|
5142
5309
|
}
|
|
5143
5310
|
}
|
|
@@ -5181,7 +5348,7 @@ var Rc = class {
|
|
|
5181
5348
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
5182
5349
|
}
|
|
5183
5350
|
};
|
|
5184
|
-
function
|
|
5351
|
+
function qc(e) {
|
|
5185
5352
|
let t = null, n = (t, n) => {
|
|
5186
5353
|
if (!e.getCapabilities()[n]) throw new xc(t, n);
|
|
5187
5354
|
}, r = {
|
|
@@ -5207,9 +5374,9 @@ function zc(e) {
|
|
|
5207
5374
|
return;
|
|
5208
5375
|
}
|
|
5209
5376
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
5210
|
-
t.removeEventListener("abort", s), n(
|
|
5377
|
+
t.removeEventListener("abort", s), n(Uc(e, "completed"));
|
|
5211
5378
|
}, (a) => {
|
|
5212
|
-
if (t.removeEventListener("abort", s),
|
|
5379
|
+
if (t.removeEventListener("abort", s), Gc(a)) {
|
|
5213
5380
|
n({
|
|
5214
5381
|
utteranceId: "utt_interrupted",
|
|
5215
5382
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
@@ -5220,14 +5387,14 @@ function zc(e) {
|
|
|
5220
5387
|
});
|
|
5221
5388
|
return;
|
|
5222
5389
|
}
|
|
5223
|
-
i(
|
|
5390
|
+
i(Wc(a));
|
|
5224
5391
|
});
|
|
5225
5392
|
});
|
|
5226
5393
|
}
|
|
5227
5394
|
try {
|
|
5228
|
-
return
|
|
5395
|
+
return Uc(await o, "completed");
|
|
5229
5396
|
} catch (t) {
|
|
5230
|
-
if (
|
|
5397
|
+
if (Gc(t)) return {
|
|
5231
5398
|
utteranceId: "utt_interrupted",
|
|
5232
5399
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
5233
5400
|
status: "interrupted",
|
|
@@ -5235,7 +5402,7 @@ function zc(e) {
|
|
|
5235
5402
|
transcript: r.text,
|
|
5236
5403
|
animation: wc("none")
|
|
5237
5404
|
};
|
|
5238
|
-
throw
|
|
5405
|
+
throw Wc(t);
|
|
5239
5406
|
}
|
|
5240
5407
|
},
|
|
5241
5408
|
async play(i) {
|
|
@@ -5257,7 +5424,7 @@ function zc(e) {
|
|
|
5257
5424
|
}
|
|
5258
5425
|
let o = e.getIframeHost();
|
|
5259
5426
|
if (!o) throw new $("Speech session is not attached.");
|
|
5260
|
-
let s = await
|
|
5427
|
+
let s = await Vc(i.audio, i.signal);
|
|
5261
5428
|
return o.speechPlay({
|
|
5262
5429
|
source: s,
|
|
5263
5430
|
characterId: i.characterId,
|
|
@@ -5274,19 +5441,20 @@ function zc(e) {
|
|
|
5274
5441
|
let a = r.queue ?? "replace-active";
|
|
5275
5442
|
if (a !== "replace-active" && a !== "replace-all") throw new $("createUtterance queue must be replace-active or replace-all.");
|
|
5276
5443
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
5277
|
-
let o = new
|
|
5278
|
-
id:
|
|
5444
|
+
let o = new Kc({
|
|
5445
|
+
id: Hc(),
|
|
5279
5446
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
5280
5447
|
format: i,
|
|
5281
5448
|
queue: a,
|
|
5282
5449
|
host: e,
|
|
5450
|
+
...r.transcript === void 0 ? {} : { transcript: r.transcript },
|
|
5283
5451
|
signal: r.signal
|
|
5284
5452
|
});
|
|
5285
5453
|
return t = o, o.result.finally(() => {
|
|
5286
5454
|
t === o && (t = null);
|
|
5287
5455
|
}), r.track && (async () => {
|
|
5288
5456
|
try {
|
|
5289
|
-
if (await
|
|
5457
|
+
if (await Bc({
|
|
5290
5458
|
track: r.track,
|
|
5291
5459
|
utterance: o,
|
|
5292
5460
|
sampleRate: i.sampleRate,
|
|
@@ -5314,7 +5482,7 @@ function zc(e) {
|
|
|
5314
5482
|
}
|
|
5315
5483
|
//#endregion
|
|
5316
5484
|
//#region src/v2/experience.ts
|
|
5317
|
-
function
|
|
5485
|
+
function Jc(e, t) {
|
|
5318
5486
|
return t ? Ns({
|
|
5319
5487
|
...e,
|
|
5320
5488
|
experience: {
|
|
@@ -5323,7 +5491,7 @@ function Bc(e, t) {
|
|
|
5323
5491
|
}
|
|
5324
5492
|
}) : e;
|
|
5325
5493
|
}
|
|
5326
|
-
var
|
|
5494
|
+
var Yc = class e {
|
|
5327
5495
|
launch;
|
|
5328
5496
|
conversationProcessor;
|
|
5329
5497
|
iframeHost = null;
|
|
@@ -5341,10 +5509,10 @@ var Vc = class e {
|
|
|
5341
5509
|
conversationCache = [];
|
|
5342
5510
|
speech;
|
|
5343
5511
|
constructor(e) {
|
|
5344
|
-
this.launch = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedManifest = e.kind === "manifest" ? e.manifest : null, this.speech =
|
|
5512
|
+
this.launch = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedManifest = e.kind === "manifest" ? e.manifest : null, this.speech = qc({
|
|
5345
5513
|
getIframeHost: () => this.iframeHost,
|
|
5346
5514
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
5347
|
-
getCapabilities: () =>
|
|
5515
|
+
getCapabilities: () => Xc(this.resolvedManifest),
|
|
5348
5516
|
getActiveCharacterId: () => this.resolvedManifest?.activeCharacterId ?? "character_unknown",
|
|
5349
5517
|
onProcessorInterrupt: () => {
|
|
5350
5518
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -5475,7 +5643,10 @@ var Vc = class e {
|
|
|
5475
5643
|
onWidgetReady: () => e.onWidgetReady?.(),
|
|
5476
5644
|
onWidgetExpand: () => e.onWidgetExpand?.(),
|
|
5477
5645
|
onWidgetCollapse: () => e.onWidgetCollapse?.(),
|
|
5478
|
-
onWidgetAudioSettings: (t) => e.onWidgetAudioSettings?.(t)
|
|
5646
|
+
onWidgetAudioSettings: (t) => e.onWidgetAudioSettings?.(t),
|
|
5647
|
+
onWidgetDragStart: (t) => e.onWidgetDragStart?.(t),
|
|
5648
|
+
onWidgetDragMove: (t) => e.onWidgetDragMove?.(t),
|
|
5649
|
+
onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
|
|
5479
5650
|
});
|
|
5480
5651
|
this.iframeHost = f;
|
|
5481
5652
|
let p = this.resolveMintInteraction(), m = this.launch.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Rs(this.launch.sessionEndpoint, {
|
|
@@ -5503,7 +5674,7 @@ var Vc = class e {
|
|
|
5503
5674
|
this.endpointAbortController = null;
|
|
5504
5675
|
}
|
|
5505
5676
|
if (f.postParentHello(), h) {
|
|
5506
|
-
let e =
|
|
5677
|
+
let e = Jc(h, this.launch.startButton);
|
|
5507
5678
|
this.launch.speechOnly && (e = dc(e)), this.assertBrowserCustomManifest(e), this.resolvedManifest = e, f.postManifest(e), u.setValue(e);
|
|
5508
5679
|
}
|
|
5509
5680
|
return await Promise.race([s, new Promise((e, t) => {
|
|
@@ -5613,7 +5784,7 @@ var Vc = class e {
|
|
|
5613
5784
|
};
|
|
5614
5785
|
}
|
|
5615
5786
|
};
|
|
5616
|
-
function
|
|
5787
|
+
function Xc(e) {
|
|
5617
5788
|
let t = e?.capabilities ?? [], n = t.includes("textSpeech"), r = t.includes("externalSpeechAudio");
|
|
5618
5789
|
return !n && !r ? {
|
|
5619
5790
|
textSpeech: !0,
|
|
@@ -5625,50 +5796,50 @@ function Hc(e) {
|
|
|
5625
5796
|
}
|
|
5626
5797
|
//#endregion
|
|
5627
5798
|
//#region src/widget/dockGeometry.ts
|
|
5628
|
-
var
|
|
5629
|
-
function
|
|
5799
|
+
var Zc = "(min-width: 768px)", Qc = 24, $c = .5, el = 1200, tl = .85, nl = 9 / 16;
|
|
5800
|
+
function rl() {
|
|
5630
5801
|
if (typeof window > "u") return 800;
|
|
5631
5802
|
let e = window.screen?.availHeight;
|
|
5632
5803
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
5633
5804
|
}
|
|
5634
|
-
function
|
|
5635
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
5636
|
-
return s > a && (s = a, o = s /
|
|
5805
|
+
function il(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Qc, r = typeof window < "u" ? rl() : 800) {
|
|
5806
|
+
let i = Math.max(160, Math.min(t - n * 2, t * tl)), a = Math.max(120, e - n * 2), o = Math.min(r * $c, el, i), s = o * nl;
|
|
5807
|
+
return s > a && (s = a, o = s / nl, o > i && (o = i, s = o * nl)), {
|
|
5637
5808
|
width: Math.round(s),
|
|
5638
5809
|
height: Math.round(o)
|
|
5639
5810
|
};
|
|
5640
5811
|
}
|
|
5641
|
-
function
|
|
5812
|
+
function al(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Qc) {
|
|
5642
5813
|
return {
|
|
5643
5814
|
left: Math.max(r, t - e.width - r),
|
|
5644
5815
|
top: Math.max(r, n - e.height - r)
|
|
5645
5816
|
};
|
|
5646
5817
|
}
|
|
5647
|
-
function
|
|
5818
|
+
function ol(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Qc) {
|
|
5648
5819
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
5649
5820
|
return {
|
|
5650
5821
|
left: Math.min(Math.max(a, e), o),
|
|
5651
5822
|
top: Math.min(Math.max(a, t), s)
|
|
5652
5823
|
};
|
|
5653
5824
|
}
|
|
5654
|
-
function
|
|
5655
|
-
return e(
|
|
5825
|
+
function sl(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
5826
|
+
return e(Zc).matches;
|
|
5656
5827
|
}
|
|
5657
5828
|
//#endregion
|
|
5658
5829
|
//#region src/widget/mountExperienceWidget.ts
|
|
5659
|
-
function
|
|
5830
|
+
function cl(e) {
|
|
5660
5831
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
5661
5832
|
}
|
|
5662
|
-
function
|
|
5833
|
+
function ll(e) {
|
|
5663
5834
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
5664
5835
|
let t = typeof e == "string" ? e.trim() : "";
|
|
5665
5836
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
5666
5837
|
}
|
|
5667
|
-
function
|
|
5838
|
+
function ul(e) {
|
|
5668
5839
|
return e === "expanded" || e === "docked";
|
|
5669
5840
|
}
|
|
5670
|
-
var
|
|
5671
|
-
function
|
|
5841
|
+
var dl = "<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>", fl = "<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>", pl = "<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>", ml = "<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>";
|
|
5842
|
+
function hl(e, t, n) {
|
|
5672
5843
|
Le(Fe);
|
|
5673
5844
|
let r = ce({
|
|
5674
5845
|
galleryThumb: t.galleryThumb,
|
|
@@ -5698,7 +5869,7 @@ function sl(e, t, n) {
|
|
|
5698
5869
|
}
|
|
5699
5870
|
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Pe(i);
|
|
5700
5871
|
}
|
|
5701
|
-
function
|
|
5872
|
+
function gl(e) {
|
|
5702
5873
|
return e.startButton ? {
|
|
5703
5874
|
...e.startButton,
|
|
5704
5875
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -5710,7 +5881,7 @@ function cl(e) {
|
|
|
5710
5881
|
variant: "primary"
|
|
5711
5882
|
};
|
|
5712
5883
|
}
|
|
5713
|
-
function
|
|
5884
|
+
function _l(e) {
|
|
5714
5885
|
let t = !1, n = () => {
|
|
5715
5886
|
t || e();
|
|
5716
5887
|
}, r = () => {
|
|
@@ -5730,12 +5901,12 @@ function ll(e) {
|
|
|
5730
5901
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
5731
5902
|
};
|
|
5732
5903
|
}
|
|
5733
|
-
function
|
|
5904
|
+
function vl(e, t) {
|
|
5734
5905
|
He(Be);
|
|
5735
5906
|
let n = t.experienceId?.trim();
|
|
5736
5907
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
5737
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
5738
|
-
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",
|
|
5908
|
+
let r = t.prefetch ?? "onExpand", i = cl(t.position), a = document.createElement("div");
|
|
5909
|
+
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", ll(t.offset));
|
|
5739
5910
|
let o = document.createElement("button");
|
|
5740
5911
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
5741
5912
|
let s = document.createElement("div");
|
|
@@ -5755,111 +5926,140 @@ function ul(e, t) {
|
|
|
5755
5926
|
let m = document.createElement("span");
|
|
5756
5927
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
5757
5928
|
let h = document.createElement("button");
|
|
5758
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
5929
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = pl, h.setAttribute("aria-label", "Reduce");
|
|
5759
5930
|
let g = document.createElement("button");
|
|
5760
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
5761
|
-
let
|
|
5762
|
-
|
|
5763
|
-
let
|
|
5764
|
-
|
|
5765
|
-
let
|
|
5766
|
-
|
|
5767
|
-
let
|
|
5931
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = dl, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
5932
|
+
let ee = document.createElement("button");
|
|
5933
|
+
ee.type = "button", ee.className = "liforma-ew__icon-btn liforma-ew__close", ee.innerHTML = fl, ee.setAttribute("aria-label", "Close"), p.append(m, h, g, ee);
|
|
5934
|
+
let te = document.createElement("div");
|
|
5935
|
+
te.className = "liforma-ew__stage";
|
|
5936
|
+
let _ = document.createElement("div");
|
|
5937
|
+
_.className = "liforma-ew__status", _.hidden = !0, f.append(te, _), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
|
|
5938
|
+
let v = null, y = !1, b = !1, ne = !1, x = !1, S = !1, C = !1, w = !1, T = 0, re = "", E = null, D = null, O = null, ie = null, k = null, A = null, j = null, ae = 0, oe = 0, M = null, N = !1, se = new AbortController(), ce = t.parallax !== !1, P = () => {
|
|
5768
5939
|
let e = a.dataset.state;
|
|
5769
5940
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
5770
|
-
}, ce = () => {
|
|
5771
|
-
k !== null && (clearTimeout(k), k = null);
|
|
5772
5941
|
}, le = () => {
|
|
5773
|
-
|
|
5942
|
+
O !== null && (clearTimeout(O), O = null);
|
|
5774
5943
|
}, ue = () => {
|
|
5944
|
+
ie !== null && (clearTimeout(ie), ie = null), a.classList.remove("liforma-ew--layout-settling");
|
|
5945
|
+
}, de = () => {
|
|
5775
5946
|
for (let e of [
|
|
5776
5947
|
f,
|
|
5777
5948
|
l,
|
|
5778
5949
|
p
|
|
5779
5950
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
5780
|
-
p.classList.remove("liforma-ew__toolbar--dragging");
|
|
5781
|
-
},
|
|
5951
|
+
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
5952
|
+
}, fe = (e, t, n, r) => {
|
|
5782
5953
|
let i = (i) => {
|
|
5783
5954
|
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";
|
|
5784
5955
|
};
|
|
5785
5956
|
i(f), i(l);
|
|
5786
5957
|
let a = p.offsetWidth || 120;
|
|
5787
5958
|
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";
|
|
5788
|
-
},
|
|
5789
|
-
|
|
5959
|
+
}, pe = (e, t) => {
|
|
5960
|
+
if (P() !== "docked") return;
|
|
5961
|
+
let n = il(), r = ol(e - ae, t - oe, n);
|
|
5962
|
+
k = r.left, A = r.top, fe(r.left, r.top, n.width, n.height);
|
|
5963
|
+
}, me = (e, t) => {
|
|
5964
|
+
if (P() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
5965
|
+
let n = il(), r = k ?? f.getBoundingClientRect().left, i = A ?? f.getBoundingClientRect().top, a = ol(r + e, i + t, n);
|
|
5966
|
+
k = a.left, A = a.top, fe(a.left, a.top, n.width, n.height);
|
|
5967
|
+
}, he = (e) => {
|
|
5968
|
+
M === "toolbar" && (j === null || e.pointerId !== j || (e.preventDefault(), pe(e.clientX, e.clientY)));
|
|
5969
|
+
}, F = (e) => {
|
|
5970
|
+
if (j === null || e && e.pointerId !== j) return;
|
|
5971
|
+
let t = M;
|
|
5972
|
+
j = null, M = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && N && (N = !1, window.removeEventListener("pointermove", he), window.removeEventListener("pointerup", F), window.removeEventListener("pointercancel", F));
|
|
5973
|
+
}, ge = (e, t, n) => {
|
|
5974
|
+
if (b || P() !== "docked" || !sl() || j !== null) return;
|
|
5975
|
+
j = n, M = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
5976
|
+
let r = f.getBoundingClientRect();
|
|
5977
|
+
ae = e - r.left, oe = t - r.top, N || (N = !0, window.addEventListener("pointermove", he), window.addEventListener("pointerup", F), window.addEventListener("pointercancel", F));
|
|
5978
|
+
}, _e = (e) => {
|
|
5979
|
+
if (b || P() !== "docked" || !sl() || j !== null) return;
|
|
5980
|
+
j = e.pointerId, M = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
5981
|
+
let t = f.getBoundingClientRect();
|
|
5982
|
+
k = t.left, A = t.top;
|
|
5983
|
+
}, ve = (e) => {
|
|
5984
|
+
M === "player" && (j === null || e.pointerId !== j || me(e.dx, e.dy));
|
|
5985
|
+
}, ye = (e) => {
|
|
5986
|
+
M === "player" && (j === null || e.pointerId !== j || F());
|
|
5987
|
+
}, be = () => {
|
|
5988
|
+
let e = sl(), t = P();
|
|
5790
5989
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
5791
5990
|
h.hidden = !0;
|
|
5792
5991
|
return;
|
|
5793
5992
|
}
|
|
5794
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
5795
|
-
},
|
|
5796
|
-
let t =
|
|
5797
|
-
n =
|
|
5798
|
-
},
|
|
5993
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = ml, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = pl, h.setAttribute("aria-label", "Reduce"));
|
|
5994
|
+
}, xe = (e) => {
|
|
5995
|
+
let t = il(), n = e && k !== null && A !== null ? ol(k, A, t) : al(t);
|
|
5996
|
+
n = ol(n.left, n.top, t), k = n.left, A = n.top, fe(n.left, n.top, t.width, t.height), be();
|
|
5997
|
+
}, Se = () => {
|
|
5799
5998
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
5800
5999
|
requestAnimationFrame(() => {
|
|
5801
|
-
|
|
6000
|
+
b || !ul(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
5802
6001
|
});
|
|
5803
6002
|
});
|
|
5804
|
-
},
|
|
5805
|
-
if (
|
|
6003
|
+
}, Ce = (e) => {
|
|
6004
|
+
if (ue(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !w) {
|
|
5806
6005
|
a.classList.remove("liforma-ew--layout-settling");
|
|
5807
6006
|
return;
|
|
5808
6007
|
}
|
|
5809
|
-
|
|
5810
|
-
if (
|
|
6008
|
+
ie = setTimeout(() => {
|
|
6009
|
+
if (ie = null, b || !ul(a.dataset.state)) {
|
|
5811
6010
|
a.classList.remove("liforma-ew--layout-settling");
|
|
5812
6011
|
return;
|
|
5813
6012
|
}
|
|
5814
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
6013
|
+
a.classList.remove("liforma-ew--layout-settling"), Se();
|
|
5815
6014
|
}, 220);
|
|
5816
|
-
},
|
|
5817
|
-
|
|
5818
|
-
|
|
6015
|
+
}, we = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
6016
|
+
le(), O = setTimeout(() => {
|
|
6017
|
+
O = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
5819
6018
|
}, 280);
|
|
5820
|
-
})),
|
|
6019
|
+
})), Te = {
|
|
5821
6020
|
galleryThumb: t.galleryThumb,
|
|
5822
6021
|
avatarImage: t.avatarImage,
|
|
5823
6022
|
backgroundImage: t.backgroundImage,
|
|
5824
6023
|
foregroundImage: t.foregroundImage,
|
|
5825
6024
|
fallbackImage: t.fallbackImage
|
|
5826
|
-
},
|
|
6025
|
+
}, I = (e) => {
|
|
5827
6026
|
if (!e) {
|
|
5828
|
-
|
|
6027
|
+
_.hidden = !0, _.textContent = "";
|
|
5829
6028
|
return;
|
|
5830
6029
|
}
|
|
5831
|
-
|
|
5832
|
-
},
|
|
6030
|
+
_.hidden = !1, _.textContent = e;
|
|
6031
|
+
}, Ee = (e) => {
|
|
5833
6032
|
if (!e) {
|
|
5834
6033
|
c.hidden = !0, c.textContent = "";
|
|
5835
6034
|
return;
|
|
5836
6035
|
}
|
|
5837
6036
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
5838
|
-
},
|
|
5839
|
-
|
|
5840
|
-
},
|
|
5841
|
-
|
|
5842
|
-
},
|
|
5843
|
-
|
|
5844
|
-
let t =
|
|
5845
|
-
return t ? (
|
|
5846
|
-
},
|
|
5847
|
-
if (
|
|
5848
|
-
|
|
6037
|
+
}, De = () => {
|
|
6038
|
+
ne = !0, o.disabled = !1, Ee(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
6039
|
+
}, Oe = () => {
|
|
6040
|
+
x = !0, a.dataset.warm = "true", l.hidden = !1, w || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
6041
|
+
}, ke = (e) => {
|
|
6042
|
+
E?.(), E = null;
|
|
6043
|
+
let t = hl(s, e, { parallax: ce });
|
|
6044
|
+
return t ? (E = t, !0) : !1;
|
|
6045
|
+
}, Ae = () => {
|
|
6046
|
+
if (ke(Te)) {
|
|
6047
|
+
De();
|
|
5849
6048
|
return;
|
|
5850
6049
|
}
|
|
5851
|
-
|
|
5852
|
-
if (!
|
|
5853
|
-
if (!
|
|
5854
|
-
|
|
6050
|
+
Ee("Loading…"), Je(n, { signal: se.signal }).then((e) => {
|
|
6051
|
+
if (!b) {
|
|
6052
|
+
if (!ke({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
6053
|
+
De();
|
|
5855
6054
|
}
|
|
5856
6055
|
}).catch((e) => {
|
|
5857
|
-
if (
|
|
6056
|
+
if (b || se.signal.aborted) return;
|
|
5858
6057
|
let n = e instanceof Error ? e : Error(String(e));
|
|
5859
|
-
|
|
6058
|
+
Ee("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
5860
6059
|
});
|
|
5861
|
-
},
|
|
6060
|
+
}, je = () => ({
|
|
5862
6061
|
experienceId: n,
|
|
6062
|
+
ui: "widget",
|
|
5863
6063
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
5864
6064
|
...t.language ? { language: t.language } : {},
|
|
5865
6065
|
...t.mode ? { mode: t.mode } : {},
|
|
@@ -5867,229 +6067,230 @@ function ul(e, t) {
|
|
|
5867
6067
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
5868
6068
|
...t.fit ? { fit: t.fit } : {},
|
|
5869
6069
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {},
|
|
5870
|
-
startButton:
|
|
5871
|
-
}),
|
|
5872
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
5873
|
-
},
|
|
5874
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
5875
|
-
},
|
|
6070
|
+
startButton: gl(t)
|
|
6071
|
+
}), Me = (e = !0) => {
|
|
6072
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), de(), a.dataset.state = "expanded", I(null), typeof document < "u" && (re = document.body.style.overflow, document.body.style.overflow = "hidden"), be(), e && t.onExpanded?.();
|
|
6073
|
+
}, Ne = () => {
|
|
6074
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", I(null), typeof document < "u" && (document.body.style.overflow = re), xe(!0), be(), v?.setWidgetChrome("docked");
|
|
6075
|
+
}, Pe = (e) => {
|
|
5876
6076
|
e.on("started", () => {
|
|
5877
|
-
|
|
6077
|
+
b || (w = !0, a.dataset.live = "true", I(null), t.onStarted?.(), ul(a.dataset.state) && Se());
|
|
5878
6078
|
});
|
|
5879
|
-
},
|
|
5880
|
-
|
|
5881
|
-
},
|
|
5882
|
-
|
|
5883
|
-
let e =
|
|
5884
|
-
|
|
5885
|
-
},
|
|
5886
|
-
if (!
|
|
5887
|
-
if (
|
|
5888
|
-
let e =
|
|
6079
|
+
}, Fe = () => {
|
|
6080
|
+
ue(), u.hidden = !0, p.hidden = !0, de(), 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"), ne && (o.disabled = !1), I(null), typeof document < "u" && (document.body.style.overflow = re), be();
|
|
6081
|
+
}, Ie = () => {
|
|
6082
|
+
le(), ue(), T += 1, y = !1, x = !1, S = !1, C = !1, w = !1;
|
|
6083
|
+
let e = v;
|
|
6084
|
+
v = null, e?.destroy(), te.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
|
|
6085
|
+
}, Le = () => {
|
|
6086
|
+
if (!b && ul(a.dataset.state)) {
|
|
6087
|
+
if (F(), y = !1, v && C) {
|
|
6088
|
+
let e = v;
|
|
5889
6089
|
(async () => {
|
|
5890
|
-
|
|
6090
|
+
w && (await we(), b || v !== e) || (x && e.setWidgetChrome("collapsed"), Fe(), w ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : x && Oe(), t.onCollapsed?.(), t.onClose?.());
|
|
5891
6091
|
})();
|
|
5892
6092
|
return;
|
|
5893
6093
|
}
|
|
5894
|
-
|
|
6094
|
+
Ie(), Fe(), t.onCollapsed?.(), t.onClose?.();
|
|
5895
6095
|
}
|
|
5896
|
-
},
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
});
|
|
5900
|
-
}, ke = () => {
|
|
5901
|
-
x || N() === "docked" && he(() => {
|
|
5902
|
-
ue(), Ce(!1), y?.setWidgetChrome("expanded");
|
|
6096
|
+
}, Re = () => {
|
|
6097
|
+
b || sl() && P() === "expanded" && Ce(() => {
|
|
6098
|
+
Ne();
|
|
5903
6099
|
});
|
|
5904
|
-
},
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
},
|
|
5909
|
-
|
|
5910
|
-
},
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
6100
|
+
}, ze = () => {
|
|
6101
|
+
b || P() === "docked" && (F(), Ce(() => {
|
|
6102
|
+
de(), Me(!1), v?.setWidgetChrome("expanded");
|
|
6103
|
+
}));
|
|
6104
|
+
}, Ve = () => {
|
|
6105
|
+
!v || !w || (le(), a.classList.remove("liforma-ew--session-revealed"), Me(), v.setWidgetChrome("expanded"), y = !1, Se());
|
|
6106
|
+
}, Ue = () => {
|
|
6107
|
+
!v || !C || w || (le(), a.classList.remove("liforma-ew--session-revealed"), Me(), y = !1, x && v.setWidgetChrome("expanded"));
|
|
6108
|
+
}, We = (e) => {
|
|
6109
|
+
b || e !== T && !w || (le(), a.classList.remove("liforma-ew--session-revealed"), Me(), y = !1, v?.setWidgetChrome("expanded"), w && Se());
|
|
6110
|
+
}, Ge = () => {
|
|
6111
|
+
if (b || S || x || v || ul(a.dataset.state)) return;
|
|
6112
|
+
S = !0;
|
|
6113
|
+
let e = T;
|
|
5914
6114
|
l.hidden = !1, (async () => {
|
|
5915
6115
|
try {
|
|
5916
|
-
let t = await
|
|
5917
|
-
|
|
5918
|
-
ui: "widget"
|
|
5919
|
-
});
|
|
5920
|
-
if (x || e !== E) {
|
|
6116
|
+
let t = await Yc.startSession(je());
|
|
6117
|
+
if (b || e !== T) {
|
|
5921
6118
|
t.destroy();
|
|
5922
6119
|
return;
|
|
5923
6120
|
}
|
|
5924
|
-
|
|
6121
|
+
v = t, Pe(t);
|
|
5925
6122
|
let n = await t.attach({
|
|
5926
6123
|
container: l,
|
|
5927
6124
|
onWidgetReady: () => {
|
|
5928
|
-
|
|
6125
|
+
b || e !== T || (S = !1, C = !0, Oe());
|
|
5929
6126
|
},
|
|
5930
6127
|
onWidgetExpand: () => {
|
|
5931
|
-
|
|
6128
|
+
We(e);
|
|
5932
6129
|
},
|
|
5933
6130
|
onWidgetAudioSettings: (e) => {
|
|
5934
|
-
|
|
6131
|
+
b || Xe(e);
|
|
6132
|
+
},
|
|
6133
|
+
onWidgetDragStart: (e) => {
|
|
6134
|
+
b || _e(e);
|
|
6135
|
+
},
|
|
6136
|
+
onWidgetDragMove: (e) => {
|
|
6137
|
+
b || ve(e);
|
|
6138
|
+
},
|
|
6139
|
+
onWidgetDragEnd: (e) => {
|
|
6140
|
+
b || ye(e);
|
|
5935
6141
|
},
|
|
5936
6142
|
onStateUpdate: (e) => {
|
|
5937
|
-
|
|
6143
|
+
b || e === "error" && ul(a.dataset.state) && I("Could not load the experience.");
|
|
5938
6144
|
}
|
|
5939
6145
|
});
|
|
5940
|
-
if (
|
|
5941
|
-
t.destroy(),
|
|
6146
|
+
if (b || e !== T) {
|
|
6147
|
+
t.destroy(), v === t && (v = null);
|
|
5942
6148
|
return;
|
|
5943
6149
|
}
|
|
5944
|
-
|
|
5945
|
-
|
|
6150
|
+
C = !0, n.on("close", () => {
|
|
6151
|
+
b || Le();
|
|
5946
6152
|
});
|
|
5947
6153
|
} catch (n) {
|
|
5948
|
-
if (
|
|
5949
|
-
|
|
6154
|
+
if (b || e !== T) return;
|
|
6155
|
+
S = !1, l.hidden = !0, l.replaceChildren(), v = null;
|
|
5950
6156
|
let r = n instanceof Error ? n : Error(String(n));
|
|
5951
6157
|
t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
|
|
5952
6158
|
}
|
|
5953
6159
|
})();
|
|
5954
|
-
},
|
|
5955
|
-
if (
|
|
5956
|
-
if (
|
|
5957
|
-
|
|
6160
|
+
}, Ke = () => {
|
|
6161
|
+
if (b || y || !ne || ul(a.dataset.state)) return;
|
|
6162
|
+
if (v && w) {
|
|
6163
|
+
Ve();
|
|
5958
6164
|
return;
|
|
5959
6165
|
}
|
|
5960
|
-
if (
|
|
5961
|
-
|
|
6166
|
+
if (v && C) {
|
|
6167
|
+
Ue();
|
|
5962
6168
|
return;
|
|
5963
6169
|
}
|
|
5964
|
-
let e = ++
|
|
5965
|
-
|
|
6170
|
+
let e = ++T;
|
|
6171
|
+
y = !0, x = !1, S = !1, C = !1, w = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), v &&= (v.destroy(), null), (async () => {
|
|
5966
6172
|
try {
|
|
5967
|
-
|
|
5968
|
-
let t = await
|
|
5969
|
-
if (
|
|
6173
|
+
Me();
|
|
6174
|
+
let t = await Yc.startSession(je());
|
|
6175
|
+
if (b || e !== T) {
|
|
5970
6176
|
t.destroy();
|
|
5971
6177
|
return;
|
|
5972
6178
|
}
|
|
5973
|
-
|
|
6179
|
+
v = t, Pe(t);
|
|
5974
6180
|
let n = await t.attach({
|
|
5975
|
-
container:
|
|
6181
|
+
container: te,
|
|
5976
6182
|
onWidgetAudioSettings: (e) => {
|
|
5977
|
-
|
|
6183
|
+
b || Xe(e);
|
|
6184
|
+
},
|
|
6185
|
+
onWidgetDragStart: (e) => {
|
|
6186
|
+
b || _e(e);
|
|
6187
|
+
},
|
|
6188
|
+
onWidgetDragMove: (e) => {
|
|
6189
|
+
b || ve(e);
|
|
6190
|
+
},
|
|
6191
|
+
onWidgetDragEnd: (e) => {
|
|
6192
|
+
b || ye(e);
|
|
5978
6193
|
},
|
|
5979
6194
|
onStateUpdate: (e) => {
|
|
5980
|
-
|
|
6195
|
+
b || (e === "error" ? I("Could not load the experience.") : ul(a.dataset.state) && I(null));
|
|
5981
6196
|
}
|
|
5982
6197
|
});
|
|
5983
|
-
if (
|
|
5984
|
-
t.destroy(),
|
|
6198
|
+
if (b || e !== T) {
|
|
6199
|
+
t.destroy(), v === t && (v = null);
|
|
5985
6200
|
return;
|
|
5986
6201
|
}
|
|
5987
|
-
|
|
5988
|
-
|
|
6202
|
+
C = !0, n.on("close", () => {
|
|
6203
|
+
b || Le();
|
|
5989
6204
|
});
|
|
5990
6205
|
} catch (n) {
|
|
5991
|
-
if (
|
|
6206
|
+
if (b || e !== T) return;
|
|
5992
6207
|
let r = n instanceof Error ? n : Error(String(n));
|
|
5993
|
-
|
|
6208
|
+
I(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
5994
6209
|
} finally {
|
|
5995
|
-
e ===
|
|
6210
|
+
e === T && (y = !1);
|
|
5996
6211
|
}
|
|
5997
6212
|
})();
|
|
5998
|
-
},
|
|
5999
|
-
if (!(
|
|
6000
|
-
if (
|
|
6001
|
-
|
|
6213
|
+
}, qe = () => {
|
|
6214
|
+
if (!(b || ul(a.dataset.state))) {
|
|
6215
|
+
if (v && w) {
|
|
6216
|
+
Ve();
|
|
6002
6217
|
return;
|
|
6003
6218
|
}
|
|
6004
|
-
if (
|
|
6005
|
-
|
|
6219
|
+
if (v && C) {
|
|
6220
|
+
Ue();
|
|
6006
6221
|
return;
|
|
6007
6222
|
}
|
|
6008
|
-
|
|
6223
|
+
Ke();
|
|
6009
6224
|
}
|
|
6010
|
-
},
|
|
6011
|
-
if (e.stopPropagation(),
|
|
6012
|
-
|
|
6225
|
+
}, Ye = (e) => {
|
|
6226
|
+
if (e.stopPropagation(), P() === "expanded") {
|
|
6227
|
+
Re();
|
|
6013
6228
|
return;
|
|
6014
6229
|
}
|
|
6015
|
-
|
|
6016
|
-
},
|
|
6230
|
+
P() === "docked" && ze();
|
|
6231
|
+
}, Xe = (e) => {
|
|
6017
6232
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
6018
|
-
},
|
|
6019
|
-
e.stopPropagation(),
|
|
6020
|
-
},
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
}, Ue = (e) => {
|
|
6030
|
-
if (!(M === null || e.pointerId !== M)) {
|
|
6031
|
-
M = null, p.classList.remove("liforma-ew__toolbar--dragging");
|
|
6032
|
-
try {
|
|
6033
|
-
p.releasePointerCapture(e.pointerId);
|
|
6034
|
-
} catch {}
|
|
6035
|
-
}
|
|
6036
|
-
}, We = (e) => {
|
|
6037
|
-
e.key === "Escape" && nl(a.dataset.state) && (e.preventDefault(), I());
|
|
6038
|
-
}, Ge = () => {
|
|
6039
|
-
if (!x) {
|
|
6040
|
-
if (N() === "docked") {
|
|
6041
|
-
if (!$c()) {
|
|
6042
|
-
ke();
|
|
6233
|
+
}, L = (e) => {
|
|
6234
|
+
e.stopPropagation(), ul(a.dataset.state) && v?.toggleAudioSettings();
|
|
6235
|
+
}, Ze = (e) => {
|
|
6236
|
+
P() === "docked" && sl() && (e.target?.closest("button") || (e.preventDefault(), ge(e.clientX, e.clientY, e.pointerId)));
|
|
6237
|
+
}, Qe = (e) => {
|
|
6238
|
+
e.key === "Escape" && ul(a.dataset.state) && (e.preventDefault(), Le());
|
|
6239
|
+
}, $e = () => {
|
|
6240
|
+
if (!b) {
|
|
6241
|
+
if (P() === "docked") {
|
|
6242
|
+
if (!sl()) {
|
|
6243
|
+
ze();
|
|
6043
6244
|
return;
|
|
6044
6245
|
}
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
}) :
|
|
6246
|
+
w ? Ce(() => {
|
|
6247
|
+
xe(!0);
|
|
6248
|
+
}) : xe(!0);
|
|
6048
6249
|
return;
|
|
6049
6250
|
}
|
|
6050
|
-
|
|
6251
|
+
be();
|
|
6051
6252
|
}
|
|
6052
|
-
},
|
|
6053
|
-
if (!
|
|
6054
|
-
if (
|
|
6055
|
-
|
|
6253
|
+
}, et = typeof window < "u" ? window.matchMedia(Zc) : null, tt = () => {
|
|
6254
|
+
if (!b) {
|
|
6255
|
+
if (P() === "docked" && !sl()) {
|
|
6256
|
+
ze();
|
|
6056
6257
|
return;
|
|
6057
6258
|
}
|
|
6058
|
-
|
|
6259
|
+
be();
|
|
6059
6260
|
}
|
|
6060
6261
|
};
|
|
6061
|
-
return o.addEventListener("click",
|
|
6062
|
-
e.stopPropagation(),
|
|
6063
|
-
}), h.addEventListener("click",
|
|
6064
|
-
|
|
6065
|
-
}) : r === "idle" && (
|
|
6066
|
-
|
|
6262
|
+
return o.addEventListener("click", qe), d.addEventListener("click", Le), ee.addEventListener("click", (e) => {
|
|
6263
|
+
e.stopPropagation(), Le();
|
|
6264
|
+
}), h.addEventListener("click", Ye), g.addEventListener("click", L), p.addEventListener("pointerdown", Ze), window.addEventListener("keydown", Qe), window.addEventListener("resize", $e), et?.addEventListener("change", tt), Ae(), be(), r === "eager" ? queueMicrotask(() => {
|
|
6265
|
+
b || Ge();
|
|
6266
|
+
}) : r === "idle" && (D = _l(() => {
|
|
6267
|
+
b || Ge();
|
|
6067
6268
|
})), {
|
|
6068
6269
|
root: a,
|
|
6069
|
-
expand:
|
|
6070
|
-
collapse:
|
|
6071
|
-
dock:
|
|
6072
|
-
maximize:
|
|
6270
|
+
expand: qe,
|
|
6271
|
+
collapse: Le,
|
|
6272
|
+
dock: Re,
|
|
6273
|
+
maximize: ze,
|
|
6073
6274
|
prefetch() {
|
|
6074
6275
|
if (r === "onExpand") {
|
|
6075
|
-
|
|
6276
|
+
Ge();
|
|
6076
6277
|
return;
|
|
6077
6278
|
}
|
|
6078
|
-
|
|
6279
|
+
Ge();
|
|
6079
6280
|
},
|
|
6080
6281
|
destroy() {
|
|
6081
|
-
|
|
6282
|
+
b || (b = !0, F(), D?.(), D = null, se.abort(), E?.(), E = null, window.removeEventListener("keydown", Qe), window.removeEventListener("resize", $e), et?.removeEventListener("change", tt), Ie(), Fe(), e.replaceChildren());
|
|
6082
6283
|
}
|
|
6083
6284
|
};
|
|
6084
6285
|
}
|
|
6085
6286
|
//#endregion
|
|
6086
6287
|
//#region src/react/ExperienceWidget.tsx
|
|
6087
|
-
function
|
|
6088
|
-
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, language:
|
|
6288
|
+
function yl(e) {
|
|
6289
|
+
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, language: ee, mode: te, speechInputMode: _, speechOnly: v, fit: y, embedBaseUrl: b, expandedMaxWidth: ne, expandedMaxHeight: x, startButtonLabel: S, startButton: C, className: w = "", onExpanded: T, onCollapsed: re, onStarted: E, onClose: D, onError: O, onPrefetchReady: ie } = e, k = m === "bottom-right" || m === "bottom-left";
|
|
6089
6290
|
return n(() => {
|
|
6090
6291
|
let e = t.current;
|
|
6091
6292
|
if (!e || !r.trim()) return;
|
|
6092
|
-
let n =
|
|
6293
|
+
let n = vl(e, {
|
|
6093
6294
|
experienceId: r,
|
|
6094
6295
|
alt: i,
|
|
6095
6296
|
galleryThumb: a,
|
|
@@ -6102,22 +6303,22 @@ function dl(e) {
|
|
|
6102
6303
|
position: m,
|
|
6103
6304
|
offset: h,
|
|
6104
6305
|
sessionEndpoint: g,
|
|
6105
|
-
language:
|
|
6106
|
-
mode:
|
|
6107
|
-
speechInputMode:
|
|
6108
|
-
speechOnly:
|
|
6109
|
-
fit:
|
|
6110
|
-
embedBaseUrl:
|
|
6111
|
-
expandedMaxWidth:
|
|
6112
|
-
expandedMaxHeight:
|
|
6113
|
-
startButtonLabel:
|
|
6114
|
-
startButton:
|
|
6115
|
-
onExpanded:
|
|
6116
|
-
onCollapsed:
|
|
6117
|
-
onStarted:
|
|
6118
|
-
onClose:
|
|
6119
|
-
onError:
|
|
6120
|
-
onPrefetchReady:
|
|
6306
|
+
language: ee,
|
|
6307
|
+
mode: te,
|
|
6308
|
+
speechInputMode: _,
|
|
6309
|
+
speechOnly: v,
|
|
6310
|
+
fit: y,
|
|
6311
|
+
embedBaseUrl: b,
|
|
6312
|
+
expandedMaxWidth: ne,
|
|
6313
|
+
expandedMaxHeight: x,
|
|
6314
|
+
startButtonLabel: S,
|
|
6315
|
+
startButton: C,
|
|
6316
|
+
onExpanded: T,
|
|
6317
|
+
onCollapsed: re,
|
|
6318
|
+
onStarted: E,
|
|
6319
|
+
onClose: D,
|
|
6320
|
+
onError: O,
|
|
6321
|
+
onPrefetchReady: ie
|
|
6121
6322
|
});
|
|
6122
6323
|
return () => n.destroy();
|
|
6123
6324
|
}, [
|
|
@@ -6133,26 +6334,26 @@ function dl(e) {
|
|
|
6133
6334
|
m,
|
|
6134
6335
|
h,
|
|
6135
6336
|
g,
|
|
6136
|
-
_,
|
|
6137
6337
|
ee,
|
|
6338
|
+
te,
|
|
6339
|
+
_,
|
|
6138
6340
|
v,
|
|
6139
6341
|
y,
|
|
6140
6342
|
b,
|
|
6343
|
+
ne,
|
|
6141
6344
|
x,
|
|
6142
|
-
te,
|
|
6143
6345
|
S,
|
|
6144
6346
|
C,
|
|
6145
|
-
|
|
6347
|
+
T,
|
|
6348
|
+
re,
|
|
6146
6349
|
E,
|
|
6147
|
-
ne,
|
|
6148
6350
|
D,
|
|
6149
6351
|
O,
|
|
6150
|
-
|
|
6151
|
-
re
|
|
6352
|
+
ie
|
|
6152
6353
|
]), /* @__PURE__ */ d("div", {
|
|
6153
6354
|
ref: t,
|
|
6154
|
-
className:
|
|
6155
|
-
style:
|
|
6355
|
+
className: w,
|
|
6356
|
+
style: k ? { display: "contents" } : {
|
|
6156
6357
|
width: "100%",
|
|
6157
6358
|
height: "100%",
|
|
6158
6359
|
minHeight: "inherit"
|
|
@@ -6160,6 +6361,6 @@ function dl(e) {
|
|
|
6160
6361
|
});
|
|
6161
6362
|
}
|
|
6162
6363
|
//#endregion
|
|
6163
|
-
export {
|
|
6364
|
+
export { oe as Experience, ze as ExperienceThumbnail, yl as ExperienceWidget };
|
|
6164
6365
|
|
|
6165
6366
|
//# sourceMappingURL=index.js.map
|