@liforma/client 0.4.14 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/next/index.js +625 -602
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/thumbnail/avatarPlate.d.ts +11 -0
- package/dist/next/thumbnail/avatarPlate.d.ts.map +1 -0
- package/dist/next/thumbnail/avatarPlate.test.d.ts +2 -0
- package/dist/next/thumbnail/avatarPlate.test.d.ts.map +1 -0
- package/dist/next/thumbnail/expandAssetUrl.d.ts +3 -2
- package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -1
- package/dist/next/thumbnail/index.d.ts +2 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +7 -3
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/next/thumbnail.js +211 -200
- package/dist/next/thumbnail.js.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +7 -7
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +8 -5
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/types/sessionLaunch.d.ts +6 -0
- package/dist/next/v2/types/sessionLaunch.d.ts.map +1 -1
- package/dist/npm/index.js +506 -490
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/avatarPlate.d.ts +11 -0
- package/dist/npm/thumbnail/avatarPlate.d.ts.map +1 -0
- package/dist/npm/thumbnail/expandAssetUrl.d.ts +3 -2
- package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.d.ts +2 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +123 -110
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +7 -3
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +7 -7
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +8 -5
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +1 -1
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +1 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/types/index.d.ts +1 -1
- package/dist/npm/v2/types/index.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionLaunch.d.ts +6 -0
- package/dist/npm/v2/types/sessionLaunch.d.ts.map +1 -1
- package/dist/react/component/experienceComponentRuntime.d.ts +3 -1
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +6 -4
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +733 -704
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/react/thumbnail/avatarPlate.d.ts +11 -0
- package/dist/react/thumbnail/avatarPlate.d.ts.map +1 -0
- package/dist/react/thumbnail/avatarPlate.test.d.ts +2 -0
- package/dist/react/thumbnail/avatarPlate.test.d.ts.map +1 -0
- package/dist/react/thumbnail/expandAssetUrl.d.ts +3 -2
- package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -1
- package/dist/react/thumbnail/index.d.ts +2 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +7 -3
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/react/thumbnail.js +211 -200
- package/dist/react/thumbnail.js.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +7 -7
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +8 -5
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/types/sessionLaunch.d.ts +6 -0
- package/dist/react/v2/types/sessionLaunch.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +3 -3
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +2 -2
- package/dist/sdk/v2/thumbnail.js.map +1 -1
- package/dist/svelte/Experience.svelte +4 -0
- package/dist/svelte/ExperienceThumbnail.svelte +3 -0
- package/package.json +1 -1
package/dist/next/index.js
CHANGED
|
@@ -106,16 +106,28 @@ function y(e) {
|
|
|
106
106
|
return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
|
-
//#region src/thumbnail/
|
|
110
|
-
var b = /(
|
|
109
|
+
//#region src/thumbnail/avatarPlate.ts
|
|
110
|
+
var b = /(\/avatars\/[^/]+\/)(\d+)(\/)/i;
|
|
111
111
|
function x(e, t) {
|
|
112
|
-
|
|
112
|
+
if (!Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1) return "256";
|
|
113
|
+
let n = Math.max(e, t);
|
|
114
|
+
return n > 512 ? "1024" : n > 280 ? "512" : "256";
|
|
113
115
|
}
|
|
114
116
|
function S(e, t) {
|
|
115
117
|
let n = e.trim();
|
|
116
|
-
return n && n.replace(b, (e, n, r, i
|
|
118
|
+
return n && n.replace(b, (e, n, r, i) => `${n}${t}${i}`);
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/thumbnail/locationPlate.ts
|
|
122
|
+
var C = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
|
|
123
|
+
function w(e, t) {
|
|
124
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
125
|
+
}
|
|
126
|
+
function T(e, t) {
|
|
127
|
+
let n = e.trim();
|
|
128
|
+
return n && n.replace(C, (e, n, r, i, a) => `${n}${t}${i}${a}`);
|
|
117
129
|
}
|
|
118
|
-
function
|
|
130
|
+
function E(e, t) {
|
|
119
131
|
let n = () => {
|
|
120
132
|
t(e.clientWidth, e.clientHeight);
|
|
121
133
|
};
|
|
@@ -123,17 +135,17 @@ function C(e, t) {
|
|
|
123
135
|
let r = new ResizeObserver(n);
|
|
124
136
|
return r.observe(e), () => r.disconnect();
|
|
125
137
|
}
|
|
126
|
-
var
|
|
127
|
-
function
|
|
138
|
+
var D = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
139
|
+
function O(e) {
|
|
128
140
|
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
129
141
|
}
|
|
130
|
-
function
|
|
142
|
+
function k(e) {
|
|
131
143
|
return /^https?:\/\//i.test(e) || e.startsWith("//");
|
|
132
144
|
}
|
|
133
|
-
function
|
|
145
|
+
function A(e) {
|
|
134
146
|
return e.startsWith("//") ? `https:${e}` : e;
|
|
135
147
|
}
|
|
136
|
-
function
|
|
148
|
+
function j(e) {
|
|
137
149
|
let t = e.indexOf("?");
|
|
138
150
|
return t === -1 ? {
|
|
139
151
|
pathname: e,
|
|
@@ -143,61 +155,58 @@ function O(e) {
|
|
|
143
155
|
search: e.slice(t)
|
|
144
156
|
};
|
|
145
157
|
}
|
|
146
|
-
function
|
|
158
|
+
function M(e, t, n = "") {
|
|
147
159
|
return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
|
|
148
160
|
}
|
|
149
|
-
function
|
|
161
|
+
function N(e, t, n) {
|
|
150
162
|
let r = e.trim();
|
|
151
163
|
if (!r) return r;
|
|
152
|
-
let i =
|
|
153
|
-
if (
|
|
154
|
-
let { pathname: a, search: o } =
|
|
164
|
+
let i = O(n);
|
|
165
|
+
if (k(r)) return T(A(r), t);
|
|
166
|
+
let { pathname: a, search: o } = j(r.replace(/\\/g, "/")), s = a;
|
|
155
167
|
if (!s.startsWith("/")) s = `/locations/${s.replace(/^locations\//i, "")}`;
|
|
156
|
-
else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ?
|
|
157
|
-
if (/\.webp$/i.test(s) && !
|
|
168
|
+
else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? M(i, s, o) : r;
|
|
169
|
+
if (/\.webp$/i.test(s) && !D.test(s.replace(/\.webp$/i, ""))) return M(i, s, o);
|
|
158
170
|
let c = s.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
|
|
159
|
-
return c = c.replace(
|
|
171
|
+
return c = c.replace(D, ""), `${i}/locations/${c}-${t}.webp${o}`;
|
|
160
172
|
}
|
|
161
|
-
function
|
|
162
|
-
let
|
|
163
|
-
if (!
|
|
164
|
-
let
|
|
165
|
-
if (
|
|
166
|
-
let { pathname:
|
|
167
|
-
if (!
|
|
168
|
-
else if (/^[^/]+$/.test(
|
|
169
|
-
else return
|
|
170
|
-
if (!/^\/avatars\//i.test(
|
|
171
|
-
let
|
|
172
|
-
return
|
|
173
|
+
function P(e, t, n = "256") {
|
|
174
|
+
let r = e.trim();
|
|
175
|
+
if (!r) return r;
|
|
176
|
+
let i = O(t), a = n;
|
|
177
|
+
if (k(r)) return S(A(r), a);
|
|
178
|
+
let { pathname: o, search: s } = j(r.replace(/\\/g, "/")), c = o;
|
|
179
|
+
if (!c.startsWith("/")) if (/^avatars\//i.test(c)) c = `/${c}`;
|
|
180
|
+
else if (/^[^/]+$/.test(c) && !s) return `${i}/avatars/${c}/${a}/${c}_neutral.webp`;
|
|
181
|
+
else return r;
|
|
182
|
+
if (!/^\/avatars\//i.test(c)) return r;
|
|
183
|
+
let l = c.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
|
|
184
|
+
return l && !l.includes("/") && !s ? `${i}/avatars/${l}/${a}/${l}_neutral.webp` : S(M(i, c, s), a);
|
|
173
185
|
}
|
|
174
186
|
//#endregion
|
|
175
187
|
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
176
|
-
var
|
|
177
|
-
function
|
|
188
|
+
var F = /_CH(\.webp)/i;
|
|
189
|
+
function I(e) {
|
|
178
190
|
return /\/locations\//i.test(e) || /^locations\//i.test(e) ? !0 : /^https?:\/\//i.test(e) || e.startsWith("//") || /^\/?avatars\//i.test(e) || e.startsWith("/") ? !1 : e.includes("/");
|
|
179
191
|
}
|
|
180
|
-
function
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
if (N(r)) return A(r, t, n);
|
|
184
|
-
let i = j(r, n);
|
|
185
|
-
return i = i.replace(M, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(ee, "_neutral$1");
|
|
192
|
+
function ee(e, t = "256x256", n, r = "256") {
|
|
193
|
+
let i = e.trim();
|
|
194
|
+
return i && (I(i) ? N(i, t, n) : P(i, n, r).replace(F, "_neutral$1"));
|
|
186
195
|
}
|
|
187
|
-
function
|
|
196
|
+
function te(e) {
|
|
188
197
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
189
198
|
if (!t) return null;
|
|
190
|
-
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o =
|
|
199
|
+
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = e.avatarPlateSize ?? "256", s = O(e.cdnBaseUrl), c = e.normalize !== !1, l = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : ee(e, a, s, o), u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : N(e, a, s);
|
|
191
200
|
return {
|
|
192
|
-
avatarImage:
|
|
193
|
-
...n ? { backgroundImage:
|
|
194
|
-
...r ? { foregroundImage:
|
|
195
|
-
...i ? { fallbackImage:
|
|
201
|
+
avatarImage: l(t),
|
|
202
|
+
...n ? { backgroundImage: u(n) } : {},
|
|
203
|
+
...r ? { foregroundImage: u(r) } : {},
|
|
204
|
+
...i ? { fallbackImage: l(i) } : {}
|
|
196
205
|
};
|
|
197
206
|
}
|
|
198
207
|
//#endregion
|
|
199
208
|
//#region src/shims/localStack.ts
|
|
200
|
-
function
|
|
209
|
+
function L() {
|
|
201
210
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
202
211
|
if (typeof location > "u") return !1;
|
|
203
212
|
try {
|
|
@@ -208,70 +217,70 @@ function te() {
|
|
|
208
217
|
}
|
|
209
218
|
//#endregion
|
|
210
219
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
211
|
-
var
|
|
220
|
+
var R = "https://player.liforma.ai", z = "http://localhost:3002";
|
|
212
221
|
function ne(e) {
|
|
213
222
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
214
223
|
}
|
|
215
|
-
function
|
|
224
|
+
function B(e) {
|
|
216
225
|
let t = e?.trim();
|
|
217
|
-
return t ? t.replace(/\/$/, "") :
|
|
226
|
+
return t ? t.replace(/\/$/, "") : L() ? z : R;
|
|
218
227
|
}
|
|
219
|
-
function
|
|
220
|
-
let t = e.experienceId.trim(), n =
|
|
228
|
+
function re(e) {
|
|
229
|
+
let t = e.experienceId.trim(), n = B(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
221
230
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
222
231
|
}
|
|
223
|
-
function
|
|
232
|
+
function ie(e) {
|
|
224
233
|
let t = e.href?.trim();
|
|
225
234
|
if (t) return t;
|
|
226
235
|
let n = e.experienceId?.trim();
|
|
227
236
|
if (!n) return;
|
|
228
237
|
let r = e.returnUrl?.trim();
|
|
229
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
238
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), re({
|
|
230
239
|
experienceId: n,
|
|
231
240
|
...r ? { returnUrl: r } : {},
|
|
232
241
|
playerBaseUrl: e.playerBaseUrl
|
|
233
242
|
});
|
|
234
243
|
}
|
|
235
|
-
function
|
|
244
|
+
function V() {
|
|
236
245
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
237
246
|
}
|
|
238
|
-
var
|
|
247
|
+
var H = 0, ae = [];
|
|
239
248
|
function oe() {
|
|
240
|
-
return
|
|
249
|
+
return V() ? 4 : Infinity;
|
|
241
250
|
}
|
|
242
251
|
function se() {
|
|
243
|
-
return
|
|
252
|
+
return V() ? 160 : 0;
|
|
244
253
|
}
|
|
245
|
-
function
|
|
254
|
+
function U() {
|
|
246
255
|
let e = oe();
|
|
247
|
-
for (;
|
|
256
|
+
for (; H < e && ae.length > 0;) {
|
|
248
257
|
let e = ae.shift();
|
|
249
258
|
if (!e || e.cancelled) continue;
|
|
250
|
-
|
|
259
|
+
H += 1, e.start();
|
|
251
260
|
let t = se();
|
|
252
261
|
if (t <= 0) {
|
|
253
|
-
|
|
262
|
+
H = Math.max(0, H - 1);
|
|
254
263
|
continue;
|
|
255
264
|
}
|
|
256
265
|
window.setTimeout(() => {
|
|
257
|
-
|
|
266
|
+
H = Math.max(0, H - 1), U();
|
|
258
267
|
}, t);
|
|
259
268
|
}
|
|
260
269
|
}
|
|
261
|
-
function
|
|
262
|
-
if (!
|
|
270
|
+
function ce(e) {
|
|
271
|
+
if (!V()) return e(), () => {};
|
|
263
272
|
let t = {
|
|
264
273
|
start: e,
|
|
265
274
|
cancelled: !1
|
|
266
275
|
};
|
|
267
|
-
return ae.push(t),
|
|
276
|
+
return ae.push(t), U(), () => {
|
|
268
277
|
t.cancelled = !0;
|
|
269
278
|
};
|
|
270
279
|
}
|
|
271
280
|
//#endregion
|
|
272
281
|
//#region src/thumbnail/lazyLoad.ts
|
|
273
|
-
function
|
|
274
|
-
return
|
|
282
|
+
function le() {
|
|
283
|
+
return V() ? "96px 0px" : "280px 0px";
|
|
275
284
|
}
|
|
276
285
|
function ue(e) {
|
|
277
286
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
@@ -283,8 +292,8 @@ function de(e, t) {
|
|
|
283
292
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
284
293
|
}
|
|
285
294
|
function fe(e, t) {
|
|
286
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
287
|
-
o || (s?.(), s =
|
|
295
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? le(), i = ue(r), a = !1, o = !1, s = null, c = () => {
|
|
296
|
+
o || (s?.(), s = ce(() => {
|
|
288
297
|
s = null, o = !0, n(!0);
|
|
289
298
|
}));
|
|
290
299
|
}, l = (e) => {
|
|
@@ -315,46 +324,46 @@ function fe(e, t) {
|
|
|
315
324
|
function pe() {
|
|
316
325
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
317
326
|
}
|
|
318
|
-
function
|
|
327
|
+
function me(e, t) {
|
|
319
328
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
320
329
|
}
|
|
321
|
-
var
|
|
322
|
-
function
|
|
323
|
-
if (
|
|
330
|
+
var W = /* @__PURE__ */ new Set(), he = !1, ge = 0;
|
|
331
|
+
function G() {
|
|
332
|
+
if (ge = 0, W.size === 0 || typeof window > "u") return;
|
|
324
333
|
let e = window.innerHeight;
|
|
325
|
-
for (let t of
|
|
334
|
+
for (let t of W) {
|
|
326
335
|
if (t.pointerActive?.()) continue;
|
|
327
336
|
let n = t.element.getBoundingClientRect();
|
|
328
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
337
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(me(n, e));
|
|
329
338
|
}
|
|
330
339
|
}
|
|
331
|
-
function G() {
|
|
332
|
-
W === 0 && (W = requestAnimationFrame(he));
|
|
333
|
-
}
|
|
334
340
|
function K() {
|
|
335
|
-
|
|
341
|
+
ge === 0 && (ge = requestAnimationFrame(G));
|
|
342
|
+
}
|
|
343
|
+
function _e() {
|
|
344
|
+
he || typeof window > "u" || (he = !0, window.addEventListener("scroll", K, { passive: !0 }), window.addEventListener("resize", K, { passive: !0 }));
|
|
336
345
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
346
|
+
function ve() {
|
|
347
|
+
W.size > 0 || !he || typeof window > "u" || (he = !1, ge !== 0 && (cancelAnimationFrame(ge), ge = 0), window.removeEventListener("scroll", K), window.removeEventListener("resize", K));
|
|
339
348
|
}
|
|
340
|
-
function
|
|
349
|
+
function ye(e, t) {
|
|
341
350
|
if (!pe()) return () => {};
|
|
342
351
|
let n = {
|
|
343
352
|
element: e,
|
|
344
353
|
onParallax: t.onParallax,
|
|
345
354
|
pointerActive: t.pointerActive
|
|
346
355
|
};
|
|
347
|
-
return
|
|
348
|
-
|
|
356
|
+
return W.add(n), _e(), n.pointerActive?.() || t.onParallax(me(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
357
|
+
W.delete(n), ve();
|
|
349
358
|
};
|
|
350
359
|
}
|
|
351
360
|
//#endregion
|
|
352
361
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
353
|
-
function
|
|
362
|
+
function be(e) {
|
|
354
363
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
355
364
|
let a = r || i;
|
|
356
365
|
e.classList.toggle("liforma-et--parallax", a), e.classList.toggle("liforma-et--scroll-parallax", i), e.style.setProperty("--liforma-et-parallax-x", String(t)), e.style.setProperty("--liforma-et-parallax-y", String(n));
|
|
357
|
-
}, s =
|
|
366
|
+
}, s = ye(e, {
|
|
358
367
|
onParallax: (e) => {
|
|
359
368
|
i = !0, a || (t = e, n = 0, o());
|
|
360
369
|
},
|
|
@@ -367,7 +376,7 @@ function ve(e) {
|
|
|
367
376
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
368
377
|
}, u = () => {
|
|
369
378
|
let s = a;
|
|
370
|
-
a = !1, r = !1, i && s ? (t =
|
|
379
|
+
a = !1, r = !1, i && s ? (t = me(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
371
380
|
}, d = (e) => {
|
|
372
381
|
e.pointerType === "mouse" && (r = !0, o());
|
|
373
382
|
}, f = () => {
|
|
@@ -379,111 +388,113 @@ function ve(e) {
|
|
|
379
388
|
}
|
|
380
389
|
//#endregion
|
|
381
390
|
//#region src/thumbnail/styles.ts
|
|
382
|
-
var
|
|
383
|
-
function
|
|
384
|
-
if (typeof document > "u" ||
|
|
391
|
+
var xe = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", Se = !1;
|
|
392
|
+
function Ce(e) {
|
|
393
|
+
if (typeof document > "u" || Se) return;
|
|
385
394
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
386
|
-
|
|
395
|
+
Se = !0;
|
|
387
396
|
return;
|
|
388
397
|
}
|
|
389
398
|
let t = document.createElement("style");
|
|
390
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
399
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), Se = !0;
|
|
391
400
|
}
|
|
392
401
|
//#endregion
|
|
393
402
|
//#region src/thumbnail/plateDelivery.ts
|
|
394
|
-
var
|
|
395
|
-
function
|
|
403
|
+
var we = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Te = null;
|
|
404
|
+
function Ee(e) {
|
|
396
405
|
let t = e.trim();
|
|
397
406
|
if (!t || t.startsWith("blob:") || t.startsWith("data:")) return !1;
|
|
398
407
|
let n = t.split(/[?#]/)[0] ?? t, r = /\/avatars\//i.test(n), i = /\/locations\//i.test(n);
|
|
399
408
|
return !r && !i || /\.depth\.webp$/i.test(n) ? !1 : /\.webp$/i.test(n);
|
|
400
409
|
}
|
|
401
|
-
function
|
|
402
|
-
if (!
|
|
410
|
+
function De(e) {
|
|
411
|
+
if (!Ee(e)) return null;
|
|
403
412
|
let t = e.search(/[?#]/);
|
|
404
413
|
if (t < 0) return e.replace(/\.webp$/i, ".avif");
|
|
405
414
|
let n = e.slice(0, t), r = e.slice(t);
|
|
406
415
|
return `${n.replace(/\.webp$/i, ".avif")}${r}`;
|
|
407
416
|
}
|
|
408
|
-
function
|
|
409
|
-
return typeof Image > "u" ? Promise.resolve(!1) : (
|
|
417
|
+
function Oe() {
|
|
418
|
+
return typeof Image > "u" ? Promise.resolve(!1) : (Te ||= new Promise((e) => {
|
|
410
419
|
let t = new Image();
|
|
411
|
-
t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src =
|
|
412
|
-
}),
|
|
420
|
+
t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = we;
|
|
421
|
+
}), Te);
|
|
413
422
|
}
|
|
414
|
-
function
|
|
415
|
-
return t ?
|
|
423
|
+
function ke(e, t) {
|
|
424
|
+
return t ? De(e) ?? e : e;
|
|
416
425
|
}
|
|
417
|
-
function
|
|
426
|
+
function Ae(e) {
|
|
418
427
|
let t = e.trim(), n = t.search(/[?#]/), r = n < 0 ? t : t.slice(0, n);
|
|
419
428
|
if (!/\.avif$/i.test(r)) return null;
|
|
420
429
|
let i = r.replace(/\.avif$/i, ".webp");
|
|
421
430
|
return n < 0 ? i : `${i}${t.slice(n)}`;
|
|
422
431
|
}
|
|
423
|
-
function
|
|
432
|
+
function je(e) {
|
|
424
433
|
let t = e.trim();
|
|
425
434
|
return /-400x225\.(webp|avif)(?:$|[?#])/i.test(t) ? t.replace(/-400x225\.(webp|avif)/i, "-800x450.$1") : null;
|
|
426
435
|
}
|
|
427
436
|
//#endregion
|
|
428
437
|
//#region src/react/ExperienceThumbnail.tsx
|
|
429
|
-
function
|
|
438
|
+
function Me(e, t) {
|
|
430
439
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
431
440
|
}
|
|
432
|
-
function
|
|
433
|
-
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit:
|
|
441
|
+
function Ne(s) {
|
|
442
|
+
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: C = "full", lazy: T = !0, className: D = "", fallbackImage: O, normalizeUrls: k = !0, cdnBaseUrl: A } = s, j = n(null), M = n(!1), [N, P] = r(0), [F, I] = r(0), ee = w(N, F), L = x(N, F), R = t(() => te({
|
|
434
443
|
galleryThumb: c,
|
|
435
444
|
avatarImage: l,
|
|
436
445
|
backgroundImage: u,
|
|
437
446
|
foregroundImage: d,
|
|
438
|
-
fallbackImage:
|
|
439
|
-
normalize:
|
|
440
|
-
locationPlateSize:
|
|
441
|
-
|
|
447
|
+
fallbackImage: O,
|
|
448
|
+
normalize: k,
|
|
449
|
+
locationPlateSize: ee,
|
|
450
|
+
avatarPlateSize: L,
|
|
451
|
+
cdnBaseUrl: A
|
|
442
452
|
}), [
|
|
443
453
|
c,
|
|
444
454
|
l,
|
|
445
455
|
u,
|
|
446
456
|
d,
|
|
447
|
-
D,
|
|
448
457
|
O,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
458
|
+
k,
|
|
459
|
+
ee,
|
|
460
|
+
L,
|
|
461
|
+
A
|
|
462
|
+
]), z = ne({
|
|
452
463
|
href: m,
|
|
453
464
|
hasClickHandler: typeof _ == "function",
|
|
454
465
|
experienceId: p
|
|
455
|
-
}),
|
|
466
|
+
}), B = z === "anchor" && !m?.trim() && !!p?.trim(), re = !!R?.backgroundImage, V = S !== !1, [H, ae] = r(!T), [oe, se] = r(!1), [U, ce] = r(!1), [le, ue] = r(!1), [de, pe] = r(!1), [W, he] = r(!1), [ge, G] = r(!1), [K, _e] = r(!1), [ve, be] = r(0), [Se, we] = r(0), [Te, Ee] = r(!1), [De, Ne] = r(!1), [Pe, q] = r(!1), [Fe, Ie] = r(!1), [Le, Re] = r(), ze = R ? Te && R.fallbackImage ? R.fallbackImage : R.avatarImage : "";
|
|
456
467
|
e(() => {
|
|
457
|
-
xe
|
|
458
|
-
se(e),
|
|
468
|
+
Ce(xe), Oe().then((e) => {
|
|
469
|
+
se(e), ce(!0);
|
|
459
470
|
});
|
|
460
471
|
}, []), e(() => {
|
|
461
|
-
|
|
472
|
+
Re(ie({
|
|
462
473
|
href: m,
|
|
463
474
|
experienceId: p,
|
|
464
475
|
returnUrl: v,
|
|
465
476
|
playerBaseUrl: b,
|
|
466
|
-
useCurrentPageAsReturnUrl:
|
|
477
|
+
useCurrentPageAsReturnUrl: B && !v?.trim()
|
|
467
478
|
}));
|
|
468
479
|
}, [
|
|
469
480
|
m,
|
|
470
481
|
p,
|
|
471
482
|
v,
|
|
472
483
|
b,
|
|
473
|
-
|
|
484
|
+
B
|
|
474
485
|
]), e(() => {
|
|
475
|
-
|
|
486
|
+
Ne(!1), q(!1), Ie(!1), Ee(!1), ue(!1), pe(!1), he(!1);
|
|
476
487
|
}, [
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
488
|
+
R?.backgroundImage,
|
|
489
|
+
R?.foregroundImage,
|
|
490
|
+
ze
|
|
480
491
|
]), e(() => {
|
|
481
|
-
let e =
|
|
482
|
-
if (e) return
|
|
483
|
-
|
|
492
|
+
let e = j.current;
|
|
493
|
+
if (e) return E(e, (e, t) => {
|
|
494
|
+
P(e), I(t);
|
|
484
495
|
});
|
|
485
|
-
}, [
|
|
486
|
-
let e =
|
|
496
|
+
}, [z, Le]), e(() => {
|
|
497
|
+
let e = j.current;
|
|
487
498
|
if (e) {
|
|
488
499
|
if (!T) {
|
|
489
500
|
ae(!0);
|
|
@@ -495,40 +506,40 @@ function je(s) {
|
|
|
495
506
|
}
|
|
496
507
|
}, [
|
|
497
508
|
T,
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
509
|
+
R,
|
|
510
|
+
z,
|
|
511
|
+
Le
|
|
501
512
|
]), e(() => {
|
|
502
|
-
let e =
|
|
503
|
-
if (!(!e || !
|
|
513
|
+
let e = j.current;
|
|
514
|
+
if (!(!e || !V)) return ye(e, {
|
|
504
515
|
onParallax: (e) => {
|
|
505
|
-
|
|
516
|
+
_e(!0), M.current || (be(e), we(0));
|
|
506
517
|
},
|
|
507
|
-
pointerActive: () =>
|
|
518
|
+
pointerActive: () => M.current
|
|
508
519
|
});
|
|
509
520
|
}, [
|
|
521
|
+
V,
|
|
522
|
+
R,
|
|
510
523
|
z,
|
|
511
|
-
|
|
512
|
-
L,
|
|
513
|
-
q
|
|
524
|
+
Le
|
|
514
525
|
]);
|
|
515
|
-
let
|
|
516
|
-
if (!
|
|
526
|
+
let Be = (e) => {
|
|
527
|
+
if (!V || K) return;
|
|
517
528
|
let t = e.currentTarget.getBoundingClientRect();
|
|
518
|
-
t.width <= 0 || t.height <= 0 || (
|
|
519
|
-
},
|
|
520
|
-
let t =
|
|
521
|
-
|
|
529
|
+
t.width <= 0 || t.height <= 0 || (be(((e.clientX - t.left) / t.width - .5) * 2), we(((e.clientY - t.top) / t.height - .5) * 2));
|
|
530
|
+
}, Ve = (e) => {
|
|
531
|
+
let t = M.current;
|
|
532
|
+
M.current = !1, G(!1), K && t ? (be(me(e.getBoundingClientRect(), window.innerHeight)), we(0)) : K || (be(0), we(0));
|
|
522
533
|
}, J = (e) => {
|
|
523
|
-
if (!
|
|
524
|
-
|
|
534
|
+
if (!V) return;
|
|
535
|
+
M.current = !0, e.pointerType === "mouse" && G(!0);
|
|
525
536
|
let t = e.currentTarget, n = () => {
|
|
526
|
-
|
|
537
|
+
Ve(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
527
538
|
};
|
|
528
539
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
529
|
-
},
|
|
530
|
-
if (_?.(e), !e.defaultPrevented &&
|
|
531
|
-
let t =
|
|
540
|
+
}, He = (e) => {
|
|
541
|
+
if (_?.(e), !e.defaultPrevented && B && !v?.trim()) {
|
|
542
|
+
let t = ie({
|
|
532
543
|
experienceId: p,
|
|
533
544
|
playerBaseUrl: b,
|
|
534
545
|
useCurrentPageAsReturnUrl: !0
|
|
@@ -536,154 +547,154 @@ function je(s) {
|
|
|
536
547
|
t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
|
|
537
548
|
}
|
|
538
549
|
};
|
|
539
|
-
if (!
|
|
540
|
-
let
|
|
550
|
+
if (!R) return null;
|
|
551
|
+
let Ue = V && (ge || K), We = H && U && (Pe || De || Fe), Ge = [
|
|
541
552
|
"liforma-et",
|
|
542
|
-
|
|
543
|
-
y(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
553
|
+
re ? "liforma-et--scene" : "",
|
|
554
|
+
y(C),
|
|
555
|
+
Ue ? "liforma-et--parallax" : "",
|
|
556
|
+
K ? "liforma-et--scroll-parallax" : "",
|
|
557
|
+
H && !We ? "liforma-et--loading" : "",
|
|
558
|
+
We ? "liforma-et--revealed" : "",
|
|
559
|
+
D
|
|
549
560
|
].filter(Boolean).join(" "), Y = {
|
|
550
|
-
"--liforma-et-parallax-x":
|
|
551
|
-
"--liforma-et-parallax-y":
|
|
552
|
-
},
|
|
561
|
+
"--liforma-et-parallax-x": ve,
|
|
562
|
+
"--liforma-et-parallax-y": Se
|
|
563
|
+
}, Ke = (e, t) => {
|
|
553
564
|
e.complete && t(!0);
|
|
554
|
-
},
|
|
565
|
+
}, qe = /* @__PURE__ */ o(i, { children: [
|
|
555
566
|
/* @__PURE__ */ a("span", {
|
|
556
567
|
className: "liforma-et__placeholder",
|
|
557
568
|
"aria-hidden": "true"
|
|
558
569
|
}),
|
|
559
|
-
|
|
560
|
-
className:
|
|
561
|
-
src:
|
|
570
|
+
H && U && R.backgroundImage ? /* @__PURE__ */ a("img", {
|
|
571
|
+
className: Me("liforma-et__background", De),
|
|
572
|
+
src: ke(R.backgroundImage, oe),
|
|
562
573
|
alt: "",
|
|
563
574
|
decoding: "async",
|
|
564
575
|
ref: (e) => {
|
|
565
|
-
e &&
|
|
576
|
+
e && Ke(e, Ne);
|
|
566
577
|
},
|
|
567
|
-
onLoad: () =>
|
|
578
|
+
onLoad: () => Ne(!0),
|
|
568
579
|
onError: (e) => {
|
|
569
|
-
let t = e.currentTarget, n =
|
|
570
|
-
if (n && !
|
|
580
|
+
let t = e.currentTarget, n = je(t.src);
|
|
581
|
+
if (n && !le) {
|
|
571
582
|
ue(!0), t.src = n;
|
|
572
583
|
return;
|
|
573
584
|
}
|
|
574
|
-
|
|
585
|
+
Ne(!0);
|
|
575
586
|
}
|
|
576
587
|
}) : null,
|
|
577
|
-
|
|
578
|
-
className:
|
|
579
|
-
src:
|
|
588
|
+
H && U && ze ? /* @__PURE__ */ a("img", {
|
|
589
|
+
className: Me("liforma-et__avatar", Pe),
|
|
590
|
+
src: ke(ze, oe),
|
|
580
591
|
alt: "",
|
|
581
592
|
decoding: "async",
|
|
582
593
|
ref: (e) => {
|
|
583
|
-
e &&
|
|
594
|
+
e && Ke(e, q);
|
|
584
595
|
},
|
|
585
|
-
onLoad: () =>
|
|
596
|
+
onLoad: () => q(!0),
|
|
586
597
|
onError: (e) => {
|
|
587
|
-
let t = e.currentTarget, n =
|
|
588
|
-
if (n && !
|
|
589
|
-
|
|
598
|
+
let t = e.currentTarget, n = Ae(t.src);
|
|
599
|
+
if (n && !W) {
|
|
600
|
+
he(!0), t.src = n;
|
|
590
601
|
return;
|
|
591
602
|
}
|
|
592
|
-
|
|
603
|
+
R.fallbackImage ? Ee(!0) : q(!0);
|
|
593
604
|
}
|
|
594
605
|
}) : null,
|
|
595
|
-
|
|
596
|
-
className:
|
|
597
|
-
src:
|
|
606
|
+
H && U && R.foregroundImage ? /* @__PURE__ */ a("img", {
|
|
607
|
+
className: Me("liforma-et__foreground", Fe),
|
|
608
|
+
src: ke(R.foregroundImage, oe),
|
|
598
609
|
alt: "",
|
|
599
610
|
decoding: "async",
|
|
600
611
|
ref: (e) => {
|
|
601
|
-
e &&
|
|
612
|
+
e && Ke(e, Ie);
|
|
602
613
|
},
|
|
603
|
-
onLoad: () =>
|
|
614
|
+
onLoad: () => Ie(!0),
|
|
604
615
|
onError: (e) => {
|
|
605
|
-
let t = e.currentTarget, n =
|
|
616
|
+
let t = e.currentTarget, n = je(t.src);
|
|
606
617
|
if (n && !de) {
|
|
607
618
|
pe(!0), t.src = n;
|
|
608
619
|
return;
|
|
609
620
|
}
|
|
610
|
-
|
|
621
|
+
Ie(!0);
|
|
611
622
|
}
|
|
612
623
|
}) : null
|
|
613
|
-
] }),
|
|
624
|
+
] }), Je = {
|
|
614
625
|
onPointerDown: J,
|
|
615
|
-
onPointerUp: (e) =>
|
|
616
|
-
onPointerCancel: (e) =>
|
|
626
|
+
onPointerUp: (e) => Ve(e.currentTarget),
|
|
627
|
+
onPointerCancel: (e) => Ve(e.currentTarget),
|
|
617
628
|
onPointerEnter: (e) => {
|
|
618
|
-
|
|
629
|
+
V && e.pointerType === "mouse" && G(!0);
|
|
619
630
|
},
|
|
620
|
-
onPointerMove:
|
|
631
|
+
onPointerMove: Be,
|
|
621
632
|
onPointerLeave: () => {
|
|
622
|
-
|
|
633
|
+
M.current || (G(!1), K || (be(0), we(0)));
|
|
623
634
|
}
|
|
624
|
-
},
|
|
625
|
-
|
|
635
|
+
}, Ye = (e) => {
|
|
636
|
+
j.current = e;
|
|
626
637
|
};
|
|
627
|
-
return
|
|
628
|
-
ref:
|
|
629
|
-
className:
|
|
638
|
+
return z === "anchor" && Le ? /* @__PURE__ */ a("a", {
|
|
639
|
+
ref: Ye,
|
|
640
|
+
className: Ge,
|
|
630
641
|
style: Y,
|
|
631
|
-
href:
|
|
642
|
+
href: Le,
|
|
632
643
|
target: h,
|
|
633
644
|
rel: g,
|
|
634
645
|
"aria-label": f,
|
|
635
|
-
onClick:
|
|
636
|
-
...
|
|
637
|
-
children:
|
|
638
|
-
}) :
|
|
646
|
+
onClick: He,
|
|
647
|
+
...Je,
|
|
648
|
+
children: qe
|
|
649
|
+
}) : z === "button" ? /* @__PURE__ */ a("button", {
|
|
639
650
|
type: "button",
|
|
640
|
-
ref:
|
|
641
|
-
className:
|
|
651
|
+
ref: Ye,
|
|
652
|
+
className: Ge,
|
|
642
653
|
style: Y,
|
|
643
654
|
"aria-label": f,
|
|
644
|
-
onClick:
|
|
645
|
-
...
|
|
646
|
-
children:
|
|
655
|
+
onClick: He,
|
|
656
|
+
...Je,
|
|
657
|
+
children: qe
|
|
647
658
|
}) : /* @__PURE__ */ a("div", {
|
|
648
|
-
ref:
|
|
649
|
-
className:
|
|
659
|
+
ref: Ye,
|
|
660
|
+
className: Ge,
|
|
650
661
|
style: Y,
|
|
651
662
|
role: f ? "img" : void 0,
|
|
652
663
|
"aria-label": f || void 0,
|
|
653
664
|
"aria-hidden": f ? void 0 : !0,
|
|
654
|
-
...
|
|
655
|
-
children:
|
|
665
|
+
...Je,
|
|
666
|
+
children: qe
|
|
656
667
|
});
|
|
657
668
|
}
|
|
658
669
|
//#endregion
|
|
659
670
|
//#region src/widget/styles.ts
|
|
660
|
-
var Me = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", Ne = "liforma-experience-widget-styles";
|
|
661
|
-
function
|
|
671
|
+
var Pe = "\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", q = "liforma-experience-widget-styles";
|
|
672
|
+
function Fe(e = Pe) {
|
|
662
673
|
if (typeof document > "u") return;
|
|
663
|
-
let t = document.getElementById(
|
|
674
|
+
let t = document.getElementById(q);
|
|
664
675
|
if (t) {
|
|
665
676
|
t.textContent = e;
|
|
666
677
|
return;
|
|
667
678
|
}
|
|
668
679
|
let n = document.createElement("style");
|
|
669
|
-
n.id =
|
|
680
|
+
n.id = q, n.textContent = e, document.head.append(n);
|
|
670
681
|
}
|
|
671
682
|
//#endregion
|
|
672
683
|
//#region src/shims/apiBaseUrl.ts
|
|
673
|
-
var
|
|
674
|
-
function
|
|
684
|
+
var Ie = "https://api.liforma.ai", Le = "http://localhost:3001";
|
|
685
|
+
function Re() {
|
|
675
686
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
676
687
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
677
688
|
if (typeof document > "u") return null;
|
|
678
689
|
let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-api-base-url")?.trim();
|
|
679
690
|
return t ? t.replace(/\/$/, "") : null;
|
|
680
691
|
}
|
|
681
|
-
function
|
|
682
|
-
return
|
|
692
|
+
function ze() {
|
|
693
|
+
return Re() || (L() ? Le : Ie);
|
|
683
694
|
}
|
|
684
695
|
//#endregion
|
|
685
696
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
686
|
-
function
|
|
697
|
+
function Be(e) {
|
|
687
698
|
if (!e || typeof e != "object") return null;
|
|
688
699
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
689
700
|
return n ? {
|
|
@@ -692,10 +703,10 @@ function Re(e) {
|
|
|
692
703
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
693
704
|
} : null;
|
|
694
705
|
}
|
|
695
|
-
async function
|
|
706
|
+
async function Ve(e, t) {
|
|
696
707
|
let n = e.trim();
|
|
697
708
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
698
|
-
let r = (t?.apiBaseUrl ??
|
|
709
|
+
let r = (t?.apiBaseUrl ?? ze()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
699
710
|
method: "GET",
|
|
700
711
|
headers: { Accept: "application/json" },
|
|
701
712
|
signal: t?.signal
|
|
@@ -715,7 +726,7 @@ async function ze(e, t) {
|
|
|
715
726
|
throw Error("Experience preview returned invalid JSON.");
|
|
716
727
|
}
|
|
717
728
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
718
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
729
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Be(o.galleryThumb);
|
|
719
730
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
720
731
|
return {
|
|
721
732
|
experienceId: s || n,
|
|
@@ -734,15 +745,15 @@ var J = class extends Error {
|
|
|
734
745
|
super(e, t?.cause === void 0 ? void 0 : { cause: t.cause }), this.name = "LiformaError", this.code = t?.code?.trim() || "UNKNOWN", this.requestId = t?.requestId?.trim() || void 0, this.status = t?.status, this.details = t?.details;
|
|
735
746
|
}
|
|
736
747
|
};
|
|
737
|
-
function
|
|
748
|
+
function He(e) {
|
|
738
749
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
739
750
|
}
|
|
740
|
-
function
|
|
751
|
+
function Ue(e, t, n) {
|
|
741
752
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
742
753
|
try {
|
|
743
754
|
i = JSON.parse(t);
|
|
744
755
|
} catch {}
|
|
745
|
-
let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } =
|
|
756
|
+
let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = He(a) ?? He(i) ?? {};
|
|
746
757
|
return new J(u, {
|
|
747
758
|
code: l,
|
|
748
759
|
requestId: d,
|
|
@@ -752,13 +763,13 @@ function Ve(e, t, n) {
|
|
|
752
763
|
}
|
|
753
764
|
//#endregion
|
|
754
765
|
//#region src/v2/api/captureAttribution.ts
|
|
755
|
-
var
|
|
766
|
+
var We = 128, Ge = /[\u0000-\u001f\u007f]/g;
|
|
756
767
|
function Y(e) {
|
|
757
768
|
if (!e) return;
|
|
758
|
-
let t = e.replace(
|
|
759
|
-
if (t) return t.slice(0,
|
|
769
|
+
let t = e.replace(Ge, "").trim();
|
|
770
|
+
if (t) return t.slice(0, We);
|
|
760
771
|
}
|
|
761
|
-
function
|
|
772
|
+
function Ke(e) {
|
|
762
773
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
763
774
|
return {
|
|
764
775
|
...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
|
|
@@ -768,7 +779,7 @@ function We(e) {
|
|
|
768
779
|
...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
|
|
769
780
|
};
|
|
770
781
|
}
|
|
771
|
-
function
|
|
782
|
+
function qe(e) {
|
|
772
783
|
if (e === !1) return;
|
|
773
784
|
if (e && typeof e == "object") {
|
|
774
785
|
let t = {
|
|
@@ -782,7 +793,7 @@ function Ge(e) {
|
|
|
782
793
|
return Object.keys(t).length ? t : void 0;
|
|
783
794
|
}
|
|
784
795
|
if (typeof window > "u") return;
|
|
785
|
-
let t =
|
|
796
|
+
let t = Ke(window.location?.search), n = Y(document.referrer || void 0), r = {
|
|
786
797
|
...t,
|
|
787
798
|
...n ? { referrer: n } : {}
|
|
788
799
|
};
|
|
@@ -790,19 +801,19 @@ function Ge(e) {
|
|
|
790
801
|
}
|
|
791
802
|
//#endregion
|
|
792
803
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
793
|
-
function
|
|
804
|
+
function Je(e) {
|
|
794
805
|
let t = e.locale?.trim();
|
|
795
806
|
if (t) return t;
|
|
796
807
|
let n = e.language?.trim();
|
|
797
808
|
if (n) return n;
|
|
798
809
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
799
810
|
}
|
|
800
|
-
function
|
|
811
|
+
function Ye(e) {
|
|
801
812
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
802
813
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
803
814
|
return t || n || void 0;
|
|
804
815
|
}
|
|
805
|
-
function
|
|
816
|
+
function Xe(e, t) {
|
|
806
817
|
let n = e.trim();
|
|
807
818
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
808
819
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -810,7 +821,7 @@ function Je(e, t) {
|
|
|
810
821
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
811
822
|
let i = t.experienceId.trim();
|
|
812
823
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
813
|
-
let a =
|
|
824
|
+
let a = Je(t), o = Ye(t), s = t.idempotencyKey?.trim();
|
|
814
825
|
return {
|
|
815
826
|
url: r.toString(),
|
|
816
827
|
init: {
|
|
@@ -829,7 +840,7 @@ function Je(e, t) {
|
|
|
829
840
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
830
841
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
831
842
|
...(() => {
|
|
832
|
-
let e =
|
|
843
|
+
let e = qe(t.attribution);
|
|
833
844
|
return e ? { attribution: e } : {};
|
|
834
845
|
})(),
|
|
835
846
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -839,16 +850,19 @@ function Je(e, t) {
|
|
|
839
850
|
}
|
|
840
851
|
//#endregion
|
|
841
852
|
//#region src/v2/types/sessionLaunch.ts
|
|
842
|
-
function
|
|
853
|
+
function Ze(e, t) {
|
|
854
|
+
return t === void 0 ? {} : { [e]: t };
|
|
855
|
+
}
|
|
856
|
+
function Qe(e) {
|
|
843
857
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
844
858
|
}
|
|
845
859
|
function X(e) {
|
|
846
860
|
return typeof e == "boolean";
|
|
847
861
|
}
|
|
848
|
-
function
|
|
849
|
-
if (!
|
|
862
|
+
function $e(e) {
|
|
863
|
+
if (!Qe(e)) return null;
|
|
850
864
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
851
|
-
return !
|
|
865
|
+
return !Qe(t) || !Qe(n) || !Qe(r) || !Qe(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
|
|
852
866
|
speech: {
|
|
853
867
|
input: t.input,
|
|
854
868
|
output: t.output,
|
|
@@ -859,8 +873,8 @@ function Xe(e) {
|
|
|
859
873
|
tools: { enabled: i.enabled }
|
|
860
874
|
};
|
|
861
875
|
}
|
|
862
|
-
function
|
|
863
|
-
return !
|
|
876
|
+
function et(e) {
|
|
877
|
+
return !Qe(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
|
|
864
878
|
speech: {
|
|
865
879
|
input: e.speechInput,
|
|
866
880
|
output: e.speechOutput,
|
|
@@ -871,12 +885,12 @@ function Ze(e) {
|
|
|
871
885
|
tools: { enabled: e.tools }
|
|
872
886
|
};
|
|
873
887
|
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
888
|
+
function tt(e) {
|
|
889
|
+
return $e(e) ?? et(e);
|
|
876
890
|
}
|
|
877
|
-
function
|
|
878
|
-
if (!
|
|
879
|
-
let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c =
|
|
891
|
+
function nt(e) {
|
|
892
|
+
if (!Qe(e)) throw Error("Session Launch response is missing session.");
|
|
893
|
+
let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = tt(e.capabilities), l = rt(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
|
|
880
894
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
881
895
|
return {
|
|
882
896
|
id: t,
|
|
@@ -892,11 +906,11 @@ function $e(e) {
|
|
|
892
906
|
...d ? { createdAt: d } : {}
|
|
893
907
|
};
|
|
894
908
|
}
|
|
895
|
-
function
|
|
909
|
+
function rt(e) {
|
|
896
910
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
897
911
|
let t = [];
|
|
898
912
|
for (let n of e) {
|
|
899
|
-
if (!
|
|
913
|
+
if (!Qe(n)) continue;
|
|
900
914
|
let e = n.axis === "locale" || n.axis === "secondaryLocale" ? n.axis : null, r = typeof n.requested == "string" ? n.requested.trim() : "", i = typeof n.resolved == "string" ? n.resolved.trim() : "";
|
|
901
915
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
902
916
|
axis: e,
|
|
@@ -907,35 +921,35 @@ function et(e) {
|
|
|
907
921
|
}
|
|
908
922
|
return t.length > 0 ? t : void 0;
|
|
909
923
|
}
|
|
910
|
-
function
|
|
924
|
+
function it(e) {
|
|
911
925
|
let t = e.localeVoiceFallbacks;
|
|
912
926
|
if (t?.length) for (let e of t) {
|
|
913
927
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
914
928
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
915
929
|
}
|
|
916
930
|
}
|
|
917
|
-
function
|
|
918
|
-
if (!
|
|
931
|
+
function at(e) {
|
|
932
|
+
if (!Qe(e)) throw Error("Session Launch response must be a JSON object.");
|
|
919
933
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
920
934
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
921
|
-
let n =
|
|
922
|
-
return
|
|
935
|
+
let n = nt(e.session);
|
|
936
|
+
return it(n), {
|
|
923
937
|
session: n,
|
|
924
938
|
launch: t
|
|
925
939
|
};
|
|
926
940
|
}
|
|
927
941
|
//#endregion
|
|
928
942
|
//#region src/v2/api/mintPublicSession.ts
|
|
929
|
-
function
|
|
943
|
+
function ot() {
|
|
930
944
|
try {
|
|
931
945
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
932
946
|
} catch {}
|
|
933
947
|
}
|
|
934
|
-
function
|
|
948
|
+
function st(e) {
|
|
935
949
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
936
950
|
}
|
|
937
|
-
function
|
|
938
|
-
let n =
|
|
951
|
+
function ct(e, t) {
|
|
952
|
+
let n = ot(), r = st(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
939
953
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
940
954
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
941
955
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
@@ -958,38 +972,38 @@ function at(e, t) {
|
|
|
958
972
|
details: a
|
|
959
973
|
}) : t;
|
|
960
974
|
}
|
|
961
|
-
function
|
|
975
|
+
function lt(e) {
|
|
962
976
|
let t = e?.locale?.trim();
|
|
963
977
|
if (t) return t;
|
|
964
978
|
let n = e?.language?.trim();
|
|
965
979
|
if (n) return n;
|
|
966
980
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
967
981
|
}
|
|
968
|
-
function
|
|
982
|
+
function ut(e) {
|
|
969
983
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
970
984
|
if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
971
985
|
return t || n || void 0;
|
|
972
986
|
}
|
|
973
|
-
function
|
|
974
|
-
let n = { experienceId: e }, r =
|
|
987
|
+
function dt(e, t) {
|
|
988
|
+
let n = { experienceId: e }, r = lt(t);
|
|
975
989
|
r && (n.locale = r);
|
|
976
|
-
let i =
|
|
990
|
+
let i = ut(t);
|
|
977
991
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
978
|
-
let a =
|
|
992
|
+
let a = qe(t?.attribution);
|
|
979
993
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
980
994
|
}
|
|
981
|
-
async function
|
|
982
|
-
let n =
|
|
995
|
+
async function ft(e, t) {
|
|
996
|
+
let n = ze(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
983
997
|
method: "POST",
|
|
984
998
|
headers: {
|
|
985
999
|
"Content-Type": "application/json",
|
|
986
1000
|
...r ? { "Idempotency-Key": r } : {}
|
|
987
1001
|
},
|
|
988
|
-
body: JSON.stringify(
|
|
1002
|
+
body: JSON.stringify(dt(e, t))
|
|
989
1003
|
});
|
|
990
1004
|
if (!i.ok) {
|
|
991
1005
|
let t = await i.text();
|
|
992
|
-
throw
|
|
1006
|
+
throw ct(e, Ue(i.status, t, i.headers));
|
|
993
1007
|
}
|
|
994
1008
|
let a;
|
|
995
1009
|
try {
|
|
@@ -1001,10 +1015,10 @@ async function lt(e, t) {
|
|
|
1001
1015
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
1002
1016
|
});
|
|
1003
1017
|
}
|
|
1004
|
-
return
|
|
1018
|
+
return at(a);
|
|
1005
1019
|
}
|
|
1006
|
-
async function
|
|
1007
|
-
let n =
|
|
1020
|
+
async function pt(e, t) {
|
|
1021
|
+
let n = Xe(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
1008
1022
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
1009
1023
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
1010
1024
|
try {
|
|
@@ -1017,7 +1031,7 @@ async function ut(e, t) {
|
|
|
1017
1031
|
}
|
|
1018
1032
|
if (!o.ok) {
|
|
1019
1033
|
let e = await o.text();
|
|
1020
|
-
throw
|
|
1034
|
+
throw Ue(o.status, e, o.headers);
|
|
1021
1035
|
}
|
|
1022
1036
|
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
|
|
1023
1037
|
code: "INVALID_RESPONSE",
|
|
@@ -1034,14 +1048,14 @@ async function ut(e, t) {
|
|
|
1034
1048
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
1035
1049
|
});
|
|
1036
1050
|
}
|
|
1037
|
-
return
|
|
1051
|
+
return at(s);
|
|
1038
1052
|
}
|
|
1039
1053
|
//#endregion
|
|
1040
1054
|
//#region src/v2/conversationProcessor.ts
|
|
1041
|
-
function
|
|
1055
|
+
function mt(e) {
|
|
1042
1056
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
1043
1057
|
}
|
|
1044
|
-
function
|
|
1058
|
+
function ht(e) {
|
|
1045
1059
|
if (typeof e == "string") {
|
|
1046
1060
|
let t = e.trim();
|
|
1047
1061
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -1055,24 +1069,24 @@ function ft(e) {
|
|
|
1055
1069
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
1056
1070
|
};
|
|
1057
1071
|
}
|
|
1058
|
-
async function
|
|
1072
|
+
async function gt(e, t) {
|
|
1059
1073
|
let n = await e(t);
|
|
1060
|
-
return
|
|
1074
|
+
return mt(n) ? {
|
|
1061
1075
|
kind: "stream",
|
|
1062
1076
|
stream: n
|
|
1063
1077
|
} : {
|
|
1064
1078
|
kind: "complete",
|
|
1065
|
-
speech:
|
|
1079
|
+
speech: ht(n)
|
|
1066
1080
|
};
|
|
1067
1081
|
}
|
|
1068
1082
|
//#endregion
|
|
1069
1083
|
//#region src/v2/embed/playerReachability.ts
|
|
1070
|
-
var
|
|
1071
|
-
function
|
|
1084
|
+
var _t = "3002";
|
|
1085
|
+
function vt(e) {
|
|
1072
1086
|
let t = new URL(e);
|
|
1073
|
-
return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port ||
|
|
1087
|
+
return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || _t}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
|
|
1074
1088
|
}
|
|
1075
|
-
async function
|
|
1089
|
+
async function yt(e, t) {
|
|
1076
1090
|
try {
|
|
1077
1091
|
await fetch(e, {
|
|
1078
1092
|
method: "GET",
|
|
@@ -1080,25 +1094,25 @@ async function gt(e, t) {
|
|
|
1080
1094
|
signal: AbortSignal.timeout(8e3)
|
|
1081
1095
|
});
|
|
1082
1096
|
} catch {
|
|
1083
|
-
throw Error(
|
|
1097
|
+
throw Error(vt(t));
|
|
1084
1098
|
}
|
|
1085
1099
|
}
|
|
1086
|
-
function
|
|
1100
|
+
function bt(e, t, n, r) {
|
|
1087
1101
|
try {
|
|
1088
1102
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
1089
1103
|
} catch (e) {
|
|
1090
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
1104
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(vt(n), { cause: e }) : e;
|
|
1091
1105
|
}
|
|
1092
1106
|
}
|
|
1093
|
-
var
|
|
1094
|
-
function
|
|
1095
|
-
return typeof e == "number" &&
|
|
1107
|
+
var xt = new Set([1, 2]);
|
|
1108
|
+
function St(e) {
|
|
1109
|
+
return typeof e == "number" && xt.has(e);
|
|
1096
1110
|
}
|
|
1097
|
-
var
|
|
1098
|
-
function
|
|
1111
|
+
var Ct = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
|
|
1112
|
+
function wt(e) {
|
|
1099
1113
|
if (!e || typeof e != "object") return null;
|
|
1100
1114
|
let t = e;
|
|
1101
|
-
if (!
|
|
1115
|
+
if (!St(t.schemaVersion) || !t.type || !Ct.has(t.type)) return null;
|
|
1102
1116
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
1103
1117
|
if (t.type === "fullWindow" || t.type === "theatre") {
|
|
1104
1118
|
let e = t.payload;
|
|
@@ -1121,10 +1135,13 @@ function xt(e) {
|
|
|
1121
1135
|
let n = t.payload;
|
|
1122
1136
|
return !n || typeof n != "object" ? null : t;
|
|
1123
1137
|
}
|
|
1124
|
-
function
|
|
1138
|
+
function Tt(e, t) {
|
|
1139
|
+
return t === void 0 ? {} : { [e]: t };
|
|
1140
|
+
}
|
|
1141
|
+
function Et(e, t, n) {
|
|
1125
1142
|
let r = e.trim();
|
|
1126
1143
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
1127
|
-
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.
|
|
1144
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatre;
|
|
1128
1145
|
return {
|
|
1129
1146
|
type: "launch",
|
|
1130
1147
|
schemaVersion: 2,
|
|
@@ -1135,32 +1152,34 @@ function St(e, t, n) {
|
|
|
1135
1152
|
...a ? { theme: a } : {},
|
|
1136
1153
|
...o === void 0 ? {} : { showFeedback: o },
|
|
1137
1154
|
...s ? { interaction: s } : {},
|
|
1138
|
-
...
|
|
1139
|
-
...
|
|
1155
|
+
...Tt("settingsButton", n?.settingsButton),
|
|
1156
|
+
...Tt("theatreButton", n?.theatreButton),
|
|
1157
|
+
...Tt("fullscreenButton", n?.fullscreenButton),
|
|
1158
|
+
...c === void 0 ? {} : { theatre: c }
|
|
1140
1159
|
}
|
|
1141
1160
|
};
|
|
1142
1161
|
}
|
|
1143
|
-
function
|
|
1162
|
+
function Dt() {
|
|
1144
1163
|
return {
|
|
1145
1164
|
type: "parentHello",
|
|
1146
1165
|
schemaVersion: 2
|
|
1147
1166
|
};
|
|
1148
1167
|
}
|
|
1149
|
-
function
|
|
1168
|
+
function Ot(e) {
|
|
1150
1169
|
return {
|
|
1151
1170
|
type: "widgetSetChrome",
|
|
1152
1171
|
schemaVersion: 2,
|
|
1153
1172
|
payload: { mode: e }
|
|
1154
1173
|
};
|
|
1155
1174
|
}
|
|
1156
|
-
function
|
|
1175
|
+
function kt() {
|
|
1157
1176
|
return {
|
|
1158
1177
|
type: "widgetToggleAudioSettings",
|
|
1159
1178
|
schemaVersion: 2,
|
|
1160
1179
|
payload: {}
|
|
1161
1180
|
};
|
|
1162
1181
|
}
|
|
1163
|
-
function
|
|
1182
|
+
function At(e) {
|
|
1164
1183
|
return {
|
|
1165
1184
|
type: "setTheatre",
|
|
1166
1185
|
schemaVersion: 2,
|
|
@@ -1169,8 +1188,8 @@ function Et(e) {
|
|
|
1169
1188
|
}
|
|
1170
1189
|
//#endregion
|
|
1171
1190
|
//#region src/v2/embed/fullWindowHost.ts
|
|
1172
|
-
var
|
|
1173
|
-
function
|
|
1191
|
+
var jt = "2147483000";
|
|
1192
|
+
function Mt(e) {
|
|
1174
1193
|
let { style: t } = e;
|
|
1175
1194
|
return {
|
|
1176
1195
|
position: t.position,
|
|
@@ -1188,11 +1207,11 @@ function Ot(e) {
|
|
|
1188
1207
|
maxHeight: t.maxHeight
|
|
1189
1208
|
};
|
|
1190
1209
|
}
|
|
1191
|
-
function
|
|
1210
|
+
function Nt(e) {
|
|
1192
1211
|
let { style: t } = e;
|
|
1193
|
-
t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex =
|
|
1212
|
+
t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = jt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
1194
1213
|
}
|
|
1195
|
-
function
|
|
1214
|
+
function Pt(e, t) {
|
|
1196
1215
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
1197
1216
|
e.style.position = "", e.style.top = "", e.style.right = "", e.style.bottom = "", e.style.left = "", e.style.inset = "", e.style.width = "", e.style.height = "", e.style.zIndex = "", e.style.margin = "", e.style.borderRadius = "", e.style.maxWidth = "", e.style.maxHeight = "";
|
|
1198
1217
|
return;
|
|
@@ -1202,20 +1221,20 @@ function At(e, t) {
|
|
|
1202
1221
|
}
|
|
1203
1222
|
//#endregion
|
|
1204
1223
|
//#region src/v2/embed/iframeHost.ts
|
|
1205
|
-
function
|
|
1224
|
+
function Ft(e) {
|
|
1206
1225
|
return e;
|
|
1207
1226
|
}
|
|
1208
1227
|
function Z() {
|
|
1209
1228
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `cmd_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `cmd_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
1210
1229
|
}
|
|
1211
|
-
var
|
|
1212
|
-
function
|
|
1230
|
+
var It = 3e4;
|
|
1231
|
+
function Lt(e) {
|
|
1213
1232
|
let t = e.container;
|
|
1214
1233
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
1215
1234
|
let n = document.createElement("iframe");
|
|
1216
1235
|
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true"), n.setAttribute("fetchpriority", "high"), "fetchPriority" in n && (n.fetchPriority = "high");
|
|
1217
1236
|
let r = !1, i = !1, a = null, o = null, s = (r) => {
|
|
1218
|
-
i !== r && (i = r, r ? (a =
|
|
1237
|
+
i !== r && (i = r, r ? (a = Mt(n), o = document.body.style.overflow, document.body.append(n), Nt(n), document.body.style.overflow = "hidden") : (t.append(n), Pt(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
|
|
1219
1238
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
1220
1239
|
p = e, m = t;
|
|
1221
1240
|
}), g = () => {
|
|
@@ -1226,10 +1245,10 @@ function Nt(e) {
|
|
|
1226
1245
|
let i = Date.now();
|
|
1227
1246
|
if (d > 0 && i - d < 250) return;
|
|
1228
1247
|
d = i, g();
|
|
1229
|
-
let a =
|
|
1248
|
+
let a = Et(t.launch, t.session, t.chrome), o = () => {
|
|
1230
1249
|
if (r) return;
|
|
1231
1250
|
let t = n.contentWindow;
|
|
1232
|
-
t &&
|
|
1251
|
+
t && bt(t, a, e.playerOrigin);
|
|
1233
1252
|
};
|
|
1234
1253
|
o();
|
|
1235
1254
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -1237,17 +1256,17 @@ function Nt(e) {
|
|
|
1237
1256
|
r || !l || _(l);
|
|
1238
1257
|
}, y = () => {
|
|
1239
1258
|
if (u += 1, u === 1) {
|
|
1240
|
-
|
|
1259
|
+
yt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
1241
1260
|
return;
|
|
1242
1261
|
}
|
|
1243
1262
|
d = 0, v();
|
|
1244
1263
|
}, b = () => {
|
|
1245
|
-
u > 0 || m?.(Error(
|
|
1264
|
+
u > 0 || m?.(Error(vt(e.playerOrigin)));
|
|
1246
1265
|
};
|
|
1247
1266
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
1248
1267
|
let x = (t) => {
|
|
1249
1268
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
1250
|
-
let i =
|
|
1269
|
+
let i = wt(t.data);
|
|
1251
1270
|
if (i) switch (i.type) {
|
|
1252
1271
|
case "close":
|
|
1253
1272
|
e.onClose?.(i.payload);
|
|
@@ -1286,7 +1305,7 @@ function Nt(e) {
|
|
|
1286
1305
|
e.onUserSpeechEnded?.(i.payload);
|
|
1287
1306
|
break;
|
|
1288
1307
|
case "modeChange":
|
|
1289
|
-
e.onActivityChange?.(
|
|
1308
|
+
e.onActivityChange?.(Ft(i.payload.mode));
|
|
1290
1309
|
break;
|
|
1291
1310
|
case "activityChange":
|
|
1292
1311
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -1345,8 +1364,8 @@ function Nt(e) {
|
|
|
1345
1364
|
let S = (t, i) => {
|
|
1346
1365
|
if (r) return;
|
|
1347
1366
|
let a = n.contentWindow;
|
|
1348
|
-
if (!a) throw Error(
|
|
1349
|
-
|
|
1367
|
+
if (!a) throw Error(vt(e.playerOrigin));
|
|
1368
|
+
bt(a, t, e.playerOrigin, i);
|
|
1350
1369
|
}, C = (e, t = 12e4, n) => {
|
|
1351
1370
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
|
|
1352
1371
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -1363,7 +1382,7 @@ function Nt(e) {
|
|
|
1363
1382
|
return h;
|
|
1364
1383
|
},
|
|
1365
1384
|
postParentHello() {
|
|
1366
|
-
S(
|
|
1385
|
+
S(Dt());
|
|
1367
1386
|
},
|
|
1368
1387
|
postLaunch(e, t, n) {
|
|
1369
1388
|
r || (l = {
|
|
@@ -1385,13 +1404,13 @@ function Nt(e) {
|
|
|
1385
1404
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
1386
1405
|
},
|
|
1387
1406
|
postWidgetSetChrome(e) {
|
|
1388
|
-
S(
|
|
1407
|
+
S(Ot(e));
|
|
1389
1408
|
},
|
|
1390
1409
|
postWidgetToggleAudioSettings() {
|
|
1391
|
-
S(
|
|
1410
|
+
S(kt());
|
|
1392
1411
|
},
|
|
1393
1412
|
postSetTheatre(e) {
|
|
1394
|
-
S(
|
|
1413
|
+
S(At(e));
|
|
1395
1414
|
},
|
|
1396
1415
|
speak(e) {
|
|
1397
1416
|
return C({
|
|
@@ -1513,7 +1532,7 @@ function Nt(e) {
|
|
|
1513
1532
|
audio: e.audio,
|
|
1514
1533
|
byteLength: e.byteLength
|
|
1515
1534
|
}
|
|
1516
|
-
},
|
|
1535
|
+
}, It, [e.audio]);
|
|
1517
1536
|
},
|
|
1518
1537
|
speechUtteranceSetTranscript(e) {
|
|
1519
1538
|
return C({
|
|
@@ -1675,7 +1694,7 @@ function Nt(e) {
|
|
|
1675
1694
|
}
|
|
1676
1695
|
//#endregion
|
|
1677
1696
|
//#region src/v2/embed/readyGate.ts
|
|
1678
|
-
function
|
|
1697
|
+
function Rt(e) {
|
|
1679
1698
|
let t, n = !1, r = !1, i = () => {
|
|
1680
1699
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
1681
1700
|
};
|
|
@@ -1690,9 +1709,9 @@ function Pt(e) {
|
|
|
1690
1709
|
}
|
|
1691
1710
|
//#endregion
|
|
1692
1711
|
//#region src/v2/sdkRelease.ts
|
|
1693
|
-
var
|
|
1712
|
+
var zt = `sdk@${{
|
|
1694
1713
|
name: "@liforma/client",
|
|
1695
|
-
version: "0.4.
|
|
1714
|
+
version: "0.4.16",
|
|
1696
1715
|
type: "module",
|
|
1697
1716
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1698
1717
|
license: "MIT",
|
|
@@ -1914,54 +1933,54 @@ var Ft = `sdk@${{
|
|
|
1914
1933
|
vitest: "^4.1.10",
|
|
1915
1934
|
wrangler: "^4.101.0"
|
|
1916
1935
|
}
|
|
1917
|
-
}.version}`,
|
|
1918
|
-
function
|
|
1936
|
+
}.version}`, Bt = "https://player.liforma.ai/embed", Vt = "http://localhost:3002/embed";
|
|
1937
|
+
function Ht() {
|
|
1919
1938
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1920
1939
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1921
1940
|
if (typeof document > "u") return null;
|
|
1922
1941
|
let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-player-embed-url")?.trim();
|
|
1923
1942
|
return t ? t.replace(/\/$/, "") : null;
|
|
1924
1943
|
}
|
|
1925
|
-
function
|
|
1926
|
-
let e =
|
|
1927
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
1944
|
+
function Ut() {
|
|
1945
|
+
let e = Ht();
|
|
1946
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : L() ? Vt : Bt;
|
|
1928
1947
|
}
|
|
1929
|
-
function
|
|
1948
|
+
function Wt(e, t) {
|
|
1930
1949
|
return e?.trim() || t?.trim() || void 0;
|
|
1931
1950
|
}
|
|
1932
|
-
function
|
|
1933
|
-
let p = (e ??
|
|
1951
|
+
function Gt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
1952
|
+
let p = (e ?? Ut()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
|
|
1934
1953
|
g && h.searchParams.set("backdropId", g);
|
|
1935
1954
|
let _ = r?.trim();
|
|
1936
1955
|
_ && h.searchParams.set("avatarId", _);
|
|
1937
1956
|
let v = d?.trim();
|
|
1938
1957
|
v && h.searchParams.set("previewBg", v);
|
|
1939
1958
|
let y = f?.trim();
|
|
1940
|
-
return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)),
|
|
1959
|
+
return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), Kt(h.toString());
|
|
1941
1960
|
}
|
|
1942
|
-
function
|
|
1961
|
+
function Kt(e) {
|
|
1943
1962
|
if (typeof location > "u") return e;
|
|
1944
1963
|
let t = new URL(e);
|
|
1945
1964
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1946
1965
|
}
|
|
1947
|
-
function
|
|
1966
|
+
function qt(e) {
|
|
1948
1967
|
return new URL(e).origin;
|
|
1949
1968
|
}
|
|
1950
1969
|
//#endregion
|
|
1951
1970
|
//#region src/v2/experienceEvents.ts
|
|
1952
|
-
function
|
|
1971
|
+
function Jt() {
|
|
1953
1972
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `evt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `evt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
1954
1973
|
}
|
|
1955
|
-
function
|
|
1974
|
+
function Yt(e, t, n) {
|
|
1956
1975
|
return {
|
|
1957
|
-
id:
|
|
1976
|
+
id: Jt(),
|
|
1958
1977
|
type: e,
|
|
1959
1978
|
sessionId: t,
|
|
1960
1979
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1961
1980
|
data: n
|
|
1962
1981
|
};
|
|
1963
1982
|
}
|
|
1964
|
-
function
|
|
1983
|
+
function Xt() {
|
|
1965
1984
|
return {
|
|
1966
1985
|
ready: /* @__PURE__ */ new Set(),
|
|
1967
1986
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1982,39 +2001,39 @@ function Kt() {
|
|
|
1982
2001
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1983
2002
|
};
|
|
1984
2003
|
}
|
|
1985
|
-
function
|
|
2004
|
+
function Zt(e, t, n) {
|
|
1986
2005
|
return e[t].add(n), () => e[t].delete(n);
|
|
1987
2006
|
}
|
|
1988
|
-
function
|
|
2007
|
+
function Qt(e, t, n) {
|
|
1989
2008
|
for (let r of e[t]) r(n);
|
|
1990
2009
|
}
|
|
1991
|
-
function
|
|
2010
|
+
function $t(e) {
|
|
1992
2011
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1993
2012
|
}
|
|
1994
2013
|
//#endregion
|
|
1995
2014
|
//#region src/v2/speech/types.ts
|
|
1996
|
-
function
|
|
2015
|
+
function en(e) {
|
|
1997
2016
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1998
2017
|
}
|
|
1999
|
-
function
|
|
2018
|
+
function tn(e) {
|
|
2000
2019
|
return "url" in e && typeof e.url == "string";
|
|
2001
2020
|
}
|
|
2002
|
-
function
|
|
2021
|
+
function nn(e) {
|
|
2003
2022
|
if (!("track" in e)) return !1;
|
|
2004
2023
|
let t = e.track;
|
|
2005
2024
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
2006
2025
|
}
|
|
2007
|
-
function
|
|
2008
|
-
return !
|
|
2026
|
+
function rn(e) {
|
|
2027
|
+
return !en(e) && !tn(e) && !nn(e) && "encoding" in e && typeof e.encoding == "string";
|
|
2009
2028
|
}
|
|
2010
|
-
var
|
|
2029
|
+
var an = [
|
|
2011
2030
|
8e3,
|
|
2012
2031
|
16e3,
|
|
2013
2032
|
22050,
|
|
2014
2033
|
24e3,
|
|
2015
2034
|
44100,
|
|
2016
2035
|
48e3
|
|
2017
|
-
],
|
|
2036
|
+
], on = {
|
|
2018
2037
|
MAX_CHUNK_BYTES: 64 * 1024,
|
|
2019
2038
|
RECOMMENDED_CHUNK_MS_MIN: 20,
|
|
2020
2039
|
RECOMMENDED_CHUNK_MS_MAX: 200,
|
|
@@ -2025,14 +2044,14 @@ var en = [
|
|
|
2025
2044
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
2026
2045
|
MAX_PENDING_WRITES: 8,
|
|
2027
2046
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
2028
|
-
},
|
|
2047
|
+
}, sn = class extends Error {
|
|
2029
2048
|
operation;
|
|
2030
2049
|
requiredCapability;
|
|
2031
2050
|
name = "UnsupportedSpeechOperationError";
|
|
2032
2051
|
constructor(e, t) {
|
|
2033
2052
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
2034
2053
|
}
|
|
2035
|
-
},
|
|
2054
|
+
}, cn = class extends Error {
|
|
2036
2055
|
name = "SpeechUtteranceClosedError";
|
|
2037
2056
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
2038
2057
|
super(e);
|
|
@@ -2042,72 +2061,72 @@ var en = [
|
|
|
2042
2061
|
constructor(e, t) {
|
|
2043
2062
|
super(e, t);
|
|
2044
2063
|
}
|
|
2045
|
-
},
|
|
2064
|
+
}, ln = class extends Error {
|
|
2046
2065
|
name = "SpeechBufferTimeoutError";
|
|
2047
2066
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
2048
2067
|
super(e);
|
|
2049
2068
|
}
|
|
2050
2069
|
};
|
|
2051
|
-
function
|
|
2070
|
+
function un(e = "none") {
|
|
2052
2071
|
return {
|
|
2053
2072
|
mode: e,
|
|
2054
2073
|
trackedDurationMs: 0,
|
|
2055
2074
|
fallbackDurationMs: 0
|
|
2056
2075
|
};
|
|
2057
2076
|
}
|
|
2058
|
-
function
|
|
2059
|
-
return
|
|
2077
|
+
function dn(e) {
|
|
2078
|
+
return an.includes(e);
|
|
2060
2079
|
}
|
|
2061
|
-
function
|
|
2080
|
+
function fn(e) {
|
|
2062
2081
|
if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
|
|
2063
2082
|
if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
|
|
2064
|
-
if (!
|
|
2083
|
+
if (!dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2065
2084
|
}
|
|
2066
|
-
function
|
|
2067
|
-
if (
|
|
2068
|
-
|
|
2085
|
+
function pn(e) {
|
|
2086
|
+
if (en(e)) {
|
|
2087
|
+
fn(e.format);
|
|
2069
2088
|
return;
|
|
2070
2089
|
}
|
|
2071
|
-
if (
|
|
2090
|
+
if (tn(e)) {
|
|
2072
2091
|
if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
|
|
2073
|
-
if (e.sampleRate !== void 0 && !
|
|
2092
|
+
if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2074
2093
|
return;
|
|
2075
2094
|
}
|
|
2076
|
-
if (
|
|
2095
|
+
if (nn(e)) {
|
|
2077
2096
|
if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
2078
|
-
if (e.sampleRate !== void 0 && !
|
|
2097
|
+
if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2079
2098
|
return;
|
|
2080
2099
|
}
|
|
2081
|
-
if (
|
|
2100
|
+
if (rn(e)) {
|
|
2082
2101
|
let t = e.encoding.trim().toLowerCase();
|
|
2083
2102
|
if (!t) throw new Q("Encoded audio MIME type is required.");
|
|
2084
2103
|
if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
2085
|
-
if (e.sampleRate !== void 0 && !
|
|
2104
|
+
if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2086
2105
|
return;
|
|
2087
2106
|
}
|
|
2088
2107
|
throw new Q("Unsupported speech.play audio shape.");
|
|
2089
2108
|
}
|
|
2090
|
-
function
|
|
2091
|
-
if (e.format) return
|
|
2109
|
+
function mn(e) {
|
|
2110
|
+
if (e.format) return fn(e.format), e.format;
|
|
2092
2111
|
if (e.track) {
|
|
2093
2112
|
let t = {
|
|
2094
2113
|
encoding: "pcm_s16le",
|
|
2095
2114
|
sampleRate: e.sampleRate ?? 24e3,
|
|
2096
2115
|
channels: 1
|
|
2097
2116
|
};
|
|
2098
|
-
return
|
|
2117
|
+
return fn(t), t;
|
|
2099
2118
|
}
|
|
2100
2119
|
throw new Q("createUtterance requires format or track.");
|
|
2101
2120
|
}
|
|
2102
|
-
function
|
|
2121
|
+
function hn(e) {
|
|
2103
2122
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2104
2123
|
}
|
|
2105
|
-
function
|
|
2124
|
+
function gn(e) {
|
|
2106
2125
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
2107
2126
|
}
|
|
2108
2127
|
//#endregion
|
|
2109
2128
|
//#region src/byo/pcm.ts
|
|
2110
|
-
function
|
|
2129
|
+
function _n(e) {
|
|
2111
2130
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
2112
2131
|
for (let t = 0; t < e.length; t++) {
|
|
2113
2132
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -2117,11 +2136,11 @@ function pn(e) {
|
|
|
2117
2136
|
}
|
|
2118
2137
|
//#endregion
|
|
2119
2138
|
//#region src/byo/resample.ts
|
|
2120
|
-
function
|
|
2139
|
+
function vn(e, t, n, r, i) {
|
|
2121
2140
|
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;
|
|
2122
2141
|
return ((a * i + o) * i + s) * i + c;
|
|
2123
2142
|
}
|
|
2124
|
-
function
|
|
2143
|
+
function yn(e, t) {
|
|
2125
2144
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
2126
2145
|
if (e === t) return {
|
|
2127
2146
|
fromRate: e,
|
|
@@ -2144,7 +2163,7 @@ function hn(e, t) {
|
|
|
2144
2163
|
let a = [];
|
|
2145
2164
|
for (; i + 2 < r.length - 1;) {
|
|
2146
2165
|
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);
|
|
2147
|
-
a.push(
|
|
2166
|
+
a.push(vn(r[o], r[e], r[s], r[c], t)), i += n;
|
|
2148
2167
|
}
|
|
2149
2168
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
2150
2169
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -2156,7 +2175,7 @@ function hn(e, t) {
|
|
|
2156
2175
|
}
|
|
2157
2176
|
//#endregion
|
|
2158
2177
|
//#region src/byo/audioCapture.ts
|
|
2159
|
-
var
|
|
2178
|
+
var bn = "liforma-pcm-capture", xn = `
|
|
2160
2179
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
2161
2180
|
process(inputs) {
|
|
2162
2181
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -2168,29 +2187,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
2168
2187
|
return true;
|
|
2169
2188
|
}
|
|
2170
2189
|
}
|
|
2171
|
-
registerProcessor('${
|
|
2172
|
-
`,
|
|
2173
|
-
function
|
|
2174
|
-
return
|
|
2190
|
+
registerProcessor('${bn}', LiformaPcmCaptureProcessor);
|
|
2191
|
+
`, Sn = null;
|
|
2192
|
+
function Cn() {
|
|
2193
|
+
return Sn ||= URL.createObjectURL(new Blob([xn], { type: "application/javascript" })), Sn;
|
|
2175
2194
|
}
|
|
2176
|
-
function
|
|
2195
|
+
function wn() {
|
|
2177
2196
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
2178
2197
|
}
|
|
2179
|
-
async function
|
|
2180
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
2198
|
+
async function Tn(e) {
|
|
2199
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = wn();
|
|
2181
2200
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
2182
2201
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
2183
2202
|
l.gain.value = 0;
|
|
2184
|
-
let u = s.sampleRate, d =
|
|
2203
|
+
let u = s.sampleRate, d = yn(u, n), f = !1, p = !1, m = (e) => {
|
|
2185
2204
|
if (f || i && !i()) return;
|
|
2186
2205
|
let t = d.push(e);
|
|
2187
|
-
t.length !== 0 && r(
|
|
2206
|
+
t.length !== 0 && r(_n(t));
|
|
2188
2207
|
}, h = () => void 0;
|
|
2189
2208
|
return await (async () => {
|
|
2190
2209
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
2191
2210
|
try {
|
|
2192
|
-
await s.audioWorklet.addModule(
|
|
2193
|
-
let e = new AudioWorkletNode(s,
|
|
2211
|
+
await s.audioWorklet.addModule(Cn());
|
|
2212
|
+
let e = new AudioWorkletNode(s, bn, {
|
|
2194
2213
|
numberOfInputs: 1,
|
|
2195
2214
|
numberOfOutputs: 1,
|
|
2196
2215
|
outputChannelCount: [1]
|
|
@@ -2240,7 +2259,7 @@ async function xn(e) {
|
|
|
2240
2259
|
}
|
|
2241
2260
|
//#endregion
|
|
2242
2261
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
2243
|
-
async function
|
|
2262
|
+
async function En(e) {
|
|
2244
2263
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
2245
2264
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
|
|
2246
2265
|
if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -2249,18 +2268,18 @@ async function Sn(e) {
|
|
|
2249
2268
|
s || (s = !0, c?.stop(), c = null);
|
|
2250
2269
|
};
|
|
2251
2270
|
try {
|
|
2252
|
-
c = await
|
|
2271
|
+
c = await Tn({
|
|
2253
2272
|
mediaStream: a,
|
|
2254
2273
|
targetSampleRate: r,
|
|
2255
2274
|
shouldSend: () => !s && !i?.aborted,
|
|
2256
2275
|
onPcm: (e) => {
|
|
2257
2276
|
if (s || i?.aborted) return;
|
|
2258
|
-
let t =
|
|
2277
|
+
let t = hn(e);
|
|
2259
2278
|
o = o.then(async () => {
|
|
2260
2279
|
if (s || i?.aborted) return;
|
|
2261
2280
|
let e = 0;
|
|
2262
2281
|
for (; e < t.byteLength;) {
|
|
2263
|
-
let r = Math.min(e +
|
|
2282
|
+
let r = Math.min(e + on.MAX_CHUNK_BYTES, t.byteLength);
|
|
2264
2283
|
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
2265
2284
|
let i = t.subarray(e, r);
|
|
2266
2285
|
e = r, i.byteLength !== 0 && await n.write(i);
|
|
@@ -2284,10 +2303,10 @@ async function Sn(e) {
|
|
|
2284
2303
|
}
|
|
2285
2304
|
//#endregion
|
|
2286
2305
|
//#region src/v2/speech/speechController.ts
|
|
2287
|
-
async function
|
|
2288
|
-
if (
|
|
2289
|
-
if (
|
|
2290
|
-
let t =
|
|
2306
|
+
async function Dn(e, t) {
|
|
2307
|
+
if (nn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
|
|
2308
|
+
if (en(e)) {
|
|
2309
|
+
let t = hn(e.data);
|
|
2291
2310
|
if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
|
|
2292
2311
|
return {
|
|
2293
2312
|
kind: "pcm",
|
|
@@ -2295,17 +2314,17 @@ async function Cn(e, t) {
|
|
|
2295
2314
|
format: e.format
|
|
2296
2315
|
};
|
|
2297
2316
|
}
|
|
2298
|
-
if (
|
|
2317
|
+
if (tn(e)) return {
|
|
2299
2318
|
kind: "url",
|
|
2300
2319
|
url: e.url.trim(),
|
|
2301
2320
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2302
2321
|
};
|
|
2303
|
-
if (
|
|
2322
|
+
if (!rn(e)) throw new Q("Unsupported speech.play audio shape.");
|
|
2304
2323
|
let n;
|
|
2305
2324
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
2306
2325
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2307
2326
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
2308
|
-
} else n =
|
|
2327
|
+
} else n = hn(e.data);
|
|
2309
2328
|
return {
|
|
2310
2329
|
kind: "encoded",
|
|
2311
2330
|
data: n.slice().buffer,
|
|
@@ -2313,10 +2332,10 @@ async function Cn(e, t) {
|
|
|
2313
2332
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2314
2333
|
};
|
|
2315
2334
|
}
|
|
2316
|
-
function
|
|
2335
|
+
function On() {
|
|
2317
2336
|
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)}`;
|
|
2318
2337
|
}
|
|
2319
|
-
function
|
|
2338
|
+
function kn(e, t = "completed") {
|
|
2320
2339
|
return {
|
|
2321
2340
|
utteranceId: e.speechId,
|
|
2322
2341
|
characterId: e.characterId,
|
|
@@ -2330,13 +2349,13 @@ function Tn(e, t = "completed") {
|
|
|
2330
2349
|
}
|
|
2331
2350
|
};
|
|
2332
2351
|
}
|
|
2333
|
-
function
|
|
2352
|
+
function An(e) {
|
|
2334
2353
|
return e instanceof Error ? e : new Q(String(e));
|
|
2335
2354
|
}
|
|
2336
|
-
function
|
|
2355
|
+
function jn(e) {
|
|
2337
2356
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
2338
2357
|
}
|
|
2339
|
-
var
|
|
2358
|
+
var Mn = class {
|
|
2340
2359
|
id;
|
|
2341
2360
|
characterId;
|
|
2342
2361
|
result;
|
|
@@ -2365,29 +2384,29 @@ var On = class {
|
|
|
2365
2384
|
queue: e.queue,
|
|
2366
2385
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
2367
2386
|
}).catch((e) => {
|
|
2368
|
-
throw this.fail(
|
|
2387
|
+
throw this.fail(An(e)), An(e);
|
|
2369
2388
|
}), this.signal?.addEventListener("abort", () => {
|
|
2370
2389
|
this.cancel();
|
|
2371
2390
|
}, { once: !0 });
|
|
2372
2391
|
}
|
|
2373
2392
|
async write(e, t) {
|
|
2374
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2375
|
-
let n =
|
|
2393
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new cn();
|
|
2394
|
+
let n = hn(e);
|
|
2376
2395
|
if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
|
|
2377
|
-
if (n.byteLength >
|
|
2396
|
+
if (n.byteLength > on.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${on.MAX_CHUNK_BYTES}).`);
|
|
2378
2397
|
if (n.byteLength === 0) return;
|
|
2379
|
-
let r = t?.timeoutMs ??
|
|
2398
|
+
let r = t?.timeoutMs ?? on.DEFAULT_WRITE_TIMEOUT_MS;
|
|
2380
2399
|
await this.acquireWriteSlot(r);
|
|
2381
2400
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
2382
|
-
if (this.bufferedMs + i >
|
|
2401
|
+
if (this.bufferedMs + i > on.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
2383
2402
|
let a = async () => {
|
|
2384
|
-
if (this.closed || this.settled) throw new
|
|
2403
|
+
if (this.closed || this.settled) throw new cn();
|
|
2385
2404
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
2386
2405
|
utteranceId: this.id,
|
|
2387
2406
|
audio: t.buffer,
|
|
2388
2407
|
byteLength: t.byteLength
|
|
2389
2408
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
2390
|
-
setTimeout(() => t(new
|
|
2409
|
+
setTimeout(() => t(new ln()), r);
|
|
2391
2410
|
})]);
|
|
2392
2411
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
2393
2412
|
}, o = this.writeChain.then(a, a);
|
|
@@ -2399,7 +2418,7 @@ var On = class {
|
|
|
2399
2418
|
}
|
|
2400
2419
|
}
|
|
2401
2420
|
async setTranscript(e) {
|
|
2402
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2421
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new cn();
|
|
2403
2422
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
2404
2423
|
utteranceId: this.id,
|
|
2405
2424
|
transcript: e
|
|
@@ -2416,7 +2435,7 @@ var On = class {
|
|
|
2416
2435
|
});
|
|
2417
2436
|
return this.resolve(t), t;
|
|
2418
2437
|
} catch (e) {
|
|
2419
|
-
let t =
|
|
2438
|
+
let t = An(e);
|
|
2420
2439
|
throw this.fail(t), t;
|
|
2421
2440
|
}
|
|
2422
2441
|
}
|
|
@@ -2434,11 +2453,11 @@ var On = class {
|
|
|
2434
2453
|
characterId: this.characterId,
|
|
2435
2454
|
status: "cancelled",
|
|
2436
2455
|
durationMs: 0,
|
|
2437
|
-
animation:
|
|
2456
|
+
animation: un("none")
|
|
2438
2457
|
};
|
|
2439
2458
|
return this.resolve(t), t;
|
|
2440
2459
|
} catch (e) {
|
|
2441
|
-
let t =
|
|
2460
|
+
let t = An(e);
|
|
2442
2461
|
throw this.fail(t), t;
|
|
2443
2462
|
}
|
|
2444
2463
|
}
|
|
@@ -2451,19 +2470,19 @@ var On = class {
|
|
|
2451
2470
|
return e;
|
|
2452
2471
|
}
|
|
2453
2472
|
resolve(e) {
|
|
2454
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2473
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new cn()));
|
|
2455
2474
|
}
|
|
2456
2475
|
fail(e) {
|
|
2457
2476
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
2458
2477
|
}
|
|
2459
2478
|
async acquireWriteSlot(e) {
|
|
2460
|
-
if (this.pendingWriteCount <
|
|
2479
|
+
if (this.pendingWriteCount < on.MAX_PENDING_WRITES) {
|
|
2461
2480
|
this.pendingWriteCount += 1;
|
|
2462
2481
|
return;
|
|
2463
2482
|
}
|
|
2464
2483
|
await new Promise((t, n) => {
|
|
2465
2484
|
let r = setTimeout(() => {
|
|
2466
|
-
n(new
|
|
2485
|
+
n(new ln());
|
|
2467
2486
|
}, e);
|
|
2468
2487
|
this.pendingWriteWaiters.push({
|
|
2469
2488
|
resolve: () => {
|
|
@@ -2482,13 +2501,13 @@ var On = class {
|
|
|
2482
2501
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2483
2502
|
}
|
|
2484
2503
|
};
|
|
2485
|
-
function
|
|
2504
|
+
function Nn(e) {
|
|
2486
2505
|
let t = null, n = (t, n) => {
|
|
2487
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2506
|
+
if (!e.getCapabilities()[n]) throw new sn(t, n);
|
|
2488
2507
|
}, r = {
|
|
2489
2508
|
async speak(r) {
|
|
2490
2509
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2491
|
-
let i =
|
|
2510
|
+
let i = gn(r.queue ?? "append");
|
|
2492
2511
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2493
2512
|
let a = e.getIframeHost();
|
|
2494
2513
|
if (!a) throw new Q("Speech session is not attached.");
|
|
@@ -2508,41 +2527,41 @@ function kn(e) {
|
|
|
2508
2527
|
return;
|
|
2509
2528
|
}
|
|
2510
2529
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2511
|
-
t.removeEventListener("abort", s), n(
|
|
2530
|
+
t.removeEventListener("abort", s), n(kn(e, "completed"));
|
|
2512
2531
|
}, (a) => {
|
|
2513
|
-
if (t.removeEventListener("abort", s),
|
|
2532
|
+
if (t.removeEventListener("abort", s), jn(a)) {
|
|
2514
2533
|
n({
|
|
2515
2534
|
utteranceId: "utt_interrupted",
|
|
2516
2535
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2517
2536
|
status: "interrupted",
|
|
2518
2537
|
durationMs: 0,
|
|
2519
2538
|
transcript: r.text,
|
|
2520
|
-
animation:
|
|
2539
|
+
animation: un("none")
|
|
2521
2540
|
});
|
|
2522
2541
|
return;
|
|
2523
2542
|
}
|
|
2524
|
-
i(
|
|
2543
|
+
i(An(a));
|
|
2525
2544
|
});
|
|
2526
2545
|
});
|
|
2527
2546
|
}
|
|
2528
2547
|
try {
|
|
2529
|
-
return
|
|
2548
|
+
return kn(await o, "completed");
|
|
2530
2549
|
} catch (t) {
|
|
2531
|
-
if (
|
|
2550
|
+
if (jn(t)) return {
|
|
2532
2551
|
utteranceId: "utt_interrupted",
|
|
2533
2552
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2534
2553
|
status: "interrupted",
|
|
2535
2554
|
durationMs: 0,
|
|
2536
2555
|
transcript: r.text,
|
|
2537
|
-
animation:
|
|
2556
|
+
animation: un("none")
|
|
2538
2557
|
};
|
|
2539
|
-
throw
|
|
2558
|
+
throw An(t);
|
|
2540
2559
|
}
|
|
2541
2560
|
},
|
|
2542
2561
|
async play(i) {
|
|
2543
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2562
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), pn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2544
2563
|
let a = i.queue ?? "append";
|
|
2545
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2564
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), nn(i.audio)) {
|
|
2546
2565
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2547
2566
|
return r.createUtterance({
|
|
2548
2567
|
format: {
|
|
@@ -2558,7 +2577,7 @@ function kn(e) {
|
|
|
2558
2577
|
}
|
|
2559
2578
|
let o = e.getIframeHost();
|
|
2560
2579
|
if (!o) throw new Q("Speech session is not attached.");
|
|
2561
|
-
let s = await
|
|
2580
|
+
let s = await Dn(i.audio, i.signal);
|
|
2562
2581
|
return o.speechPlay({
|
|
2563
2582
|
source: s,
|
|
2564
2583
|
characterId: i.characterId,
|
|
@@ -2570,13 +2589,13 @@ function kn(e) {
|
|
|
2570
2589
|
},
|
|
2571
2590
|
createUtterance(r) {
|
|
2572
2591
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2573
|
-
let i =
|
|
2592
|
+
let i = mn(r);
|
|
2574
2593
|
if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
|
|
2575
2594
|
let a = r.queue ?? "replace-active";
|
|
2576
2595
|
if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
|
|
2577
2596
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2578
|
-
let o = new
|
|
2579
|
-
id:
|
|
2597
|
+
let o = new Mn({
|
|
2598
|
+
id: On(),
|
|
2580
2599
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2581
2600
|
format: i,
|
|
2582
2601
|
queue: a,
|
|
@@ -2588,7 +2607,7 @@ function kn(e) {
|
|
|
2588
2607
|
t === o && (t = null);
|
|
2589
2608
|
}), r.track && (async () => {
|
|
2590
2609
|
try {
|
|
2591
|
-
if (await
|
|
2610
|
+
if (await En({
|
|
2592
2611
|
track: r.track,
|
|
2593
2612
|
utterance: o,
|
|
2594
2613
|
sampleRate: i.sampleRate,
|
|
@@ -2616,16 +2635,16 @@ function kn(e) {
|
|
|
2616
2635
|
}
|
|
2617
2636
|
//#endregion
|
|
2618
2637
|
//#region src/v2/types/sessionInteraction.ts
|
|
2619
|
-
function
|
|
2638
|
+
function Pn(e) {
|
|
2620
2639
|
let t = e?.trim();
|
|
2621
2640
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
2622
2641
|
}
|
|
2623
2642
|
//#endregion
|
|
2624
2643
|
//#region src/v2/experience.ts
|
|
2625
|
-
function
|
|
2644
|
+
function Fn(e) {
|
|
2626
2645
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
2627
2646
|
}
|
|
2628
|
-
var
|
|
2647
|
+
var In = class e {
|
|
2629
2648
|
bootstrap;
|
|
2630
2649
|
conversationProcessor;
|
|
2631
2650
|
iframeHost = null;
|
|
@@ -2645,17 +2664,17 @@ var Mn = class e {
|
|
|
2645
2664
|
pendingTheatre = null;
|
|
2646
2665
|
lastInteraction = null;
|
|
2647
2666
|
closeHandlers = [];
|
|
2648
|
-
eventRegistry =
|
|
2667
|
+
eventRegistry = Xt();
|
|
2649
2668
|
readyEnvelope = null;
|
|
2650
2669
|
startedEnvelope = null;
|
|
2651
2670
|
sessionMintedEnvelope = null;
|
|
2652
2671
|
conversationCache = [];
|
|
2653
2672
|
speech;
|
|
2654
2673
|
constructor(e) {
|
|
2655
|
-
this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech =
|
|
2674
|
+
this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = Nn({
|
|
2656
2675
|
getIframeHost: () => this.iframeHost,
|
|
2657
2676
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
2658
|
-
getCapabilities: () =>
|
|
2677
|
+
getCapabilities: () => Ln(this.resolvedSession),
|
|
2659
2678
|
getActiveCharacterId: () => "character_unknown",
|
|
2660
2679
|
onProcessorInterrupt: () => {
|
|
2661
2680
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -2744,7 +2763,7 @@ var Mn = class e {
|
|
|
2744
2763
|
return null;
|
|
2745
2764
|
}
|
|
2746
2765
|
on(e, t) {
|
|
2747
|
-
let n =
|
|
2766
|
+
let n = Zt(this.eventRegistry, e, t);
|
|
2748
2767
|
return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
|
|
2749
2768
|
}
|
|
2750
2769
|
async attach(e) {
|
|
@@ -2758,13 +2777,13 @@ var Mn = class e {
|
|
|
2758
2777
|
if (this.closed) throw Error("Session has ended.");
|
|
2759
2778
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2760
2779
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2761
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2780
|
+
let t = this.bootstrap.embedBaseUrl ?? Ut(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Gt(t, n, r ? void 0 : Wt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Fn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = qt(i), o = null, s = new Promise((e) => {
|
|
2762
2781
|
o = e;
|
|
2763
2782
|
}), c = null, l = new Promise((e) => {
|
|
2764
2783
|
c = e;
|
|
2765
|
-
}), u =
|
|
2784
|
+
}), u = Rt((e) => {
|
|
2766
2785
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
2767
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
2786
|
+
}), d = this.bootstrap.onUserTranscript, f = Lt({
|
|
2768
2787
|
container: e.container,
|
|
2769
2788
|
src: i,
|
|
2770
2789
|
playerOrigin: a,
|
|
@@ -2831,7 +2850,7 @@ var Mn = class e {
|
|
|
2831
2850
|
onTheatreChange: (t) => e.onTheatreChange?.(t)
|
|
2832
2851
|
});
|
|
2833
2852
|
this.iframeHost = f;
|
|
2834
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
2853
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), pt(this.bootstrap.sessionEndpoint, {
|
|
2835
2854
|
experienceId: this.bootstrap.experienceId,
|
|
2836
2855
|
locale: this.bootstrap.locale,
|
|
2837
2856
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -2843,7 +2862,7 @@ var Mn = class e {
|
|
|
2843
2862
|
attribution: this.bootstrap.attribution,
|
|
2844
2863
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2845
2864
|
signal: this.endpointAbortController.signal
|
|
2846
|
-
})) : this.bootstrap.kind === "public" ?
|
|
2865
|
+
})) : this.bootstrap.kind === "public" ? ft(this.bootstrap.experienceId, {
|
|
2847
2866
|
locale: this.bootstrap.locale,
|
|
2848
2867
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
2849
2868
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -2867,7 +2886,7 @@ var Mn = class e {
|
|
|
2867
2886
|
operation: "attach",
|
|
2868
2887
|
message: e instanceof Error ? e.message : String(e),
|
|
2869
2888
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2870
|
-
release:
|
|
2889
|
+
release: zt
|
|
2871
2890
|
});
|
|
2872
2891
|
} catch {}
|
|
2873
2892
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -2879,19 +2898,23 @@ var Mn = class e {
|
|
|
2879
2898
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2880
2899
|
this.launchToken = g;
|
|
2881
2900
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2882
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
2901
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && it(_), f.postLaunch(g, _, {
|
|
2883
2902
|
startButton: e.startButton,
|
|
2884
2903
|
theme: e.theme,
|
|
2885
2904
|
showFeedback: e.showFeedback,
|
|
2886
2905
|
interaction: e.interaction,
|
|
2887
|
-
...e.
|
|
2906
|
+
...Ze("settingsButton", e.settingsButton),
|
|
2907
|
+
...Ze("theatreButton", e.theatreButton),
|
|
2908
|
+
...Ze("fullscreenButton", e.fullscreenButton),
|
|
2888
2909
|
...e.theatre === void 0 ? {} : { theatre: e.theatre }
|
|
2889
2910
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
2890
2911
|
startButton: e.startButton,
|
|
2891
2912
|
theme: e.theme,
|
|
2892
2913
|
showFeedback: e.showFeedback,
|
|
2893
2914
|
interaction: e.interaction,
|
|
2894
|
-
...e.
|
|
2915
|
+
...Ze("settingsButton", e.settingsButton),
|
|
2916
|
+
...Ze("theatreButton", e.theatreButton),
|
|
2917
|
+
...Ze("fullscreenButton", e.fullscreenButton),
|
|
2895
2918
|
...e.theatre === void 0 ? {} : { theatre: e.theatre }
|
|
2896
2919
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2897
2920
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
@@ -2903,7 +2926,7 @@ var Mn = class e {
|
|
|
2903
2926
|
operation: "attach",
|
|
2904
2927
|
message: e instanceof Error ? e.message : String(e),
|
|
2905
2928
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2906
|
-
release:
|
|
2929
|
+
release: zt
|
|
2907
2930
|
});
|
|
2908
2931
|
} catch {}
|
|
2909
2932
|
throw e;
|
|
@@ -2917,7 +2940,7 @@ var Mn = class e {
|
|
|
2917
2940
|
operation: "attach",
|
|
2918
2941
|
message: e instanceof Error ? e.message : String(e),
|
|
2919
2942
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2920
|
-
release:
|
|
2943
|
+
release: zt
|
|
2921
2944
|
});
|
|
2922
2945
|
} catch {}
|
|
2923
2946
|
throw e;
|
|
@@ -2949,7 +2972,7 @@ var Mn = class e {
|
|
|
2949
2972
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2950
2973
|
}
|
|
2951
2974
|
async setFit(e) {
|
|
2952
|
-
let t =
|
|
2975
|
+
let t = Pn(e);
|
|
2953
2976
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2954
2977
|
if (this.closed) throw Error("Session has ended.");
|
|
2955
2978
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
@@ -2999,7 +3022,7 @@ var Mn = class e {
|
|
|
2999
3022
|
this.close();
|
|
3000
3023
|
}
|
|
3001
3024
|
destroy() {
|
|
3002
|
-
this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null,
|
|
3025
|
+
this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, $t(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
3003
3026
|
}
|
|
3004
3027
|
resolveMintInteraction() {
|
|
3005
3028
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -3011,8 +3034,8 @@ var Mn = class e {
|
|
|
3011
3034
|
return this.resolvedSession?.id ?? "";
|
|
3012
3035
|
}
|
|
3013
3036
|
emitWrapped(e, t) {
|
|
3014
|
-
let n =
|
|
3015
|
-
return
|
|
3037
|
+
let n = Yt(e, this.getSessionId(), t);
|
|
3038
|
+
return Qt(this.eventRegistry, e, n), n;
|
|
3016
3039
|
}
|
|
3017
3040
|
queueProcessorTurn(e) {
|
|
3018
3041
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -3021,7 +3044,7 @@ var Mn = class e {
|
|
|
3021
3044
|
let n = this.processorAbortController.signal;
|
|
3022
3045
|
this.processorChain = this.processorChain.then(async () => {
|
|
3023
3046
|
if (!n.aborted) try {
|
|
3024
|
-
let r = await
|
|
3047
|
+
let r = await gt(t, {
|
|
3025
3048
|
utteranceId: e.utteranceId,
|
|
3026
3049
|
text: e.text,
|
|
3027
3050
|
conversation: this.conversationCache,
|
|
@@ -3071,7 +3094,7 @@ var Mn = class e {
|
|
|
3071
3094
|
};
|
|
3072
3095
|
}
|
|
3073
3096
|
};
|
|
3074
|
-
function
|
|
3097
|
+
function Ln(e) {
|
|
3075
3098
|
return e ? {
|
|
3076
3099
|
textSpeech: e.capabilities.speech.output,
|
|
3077
3100
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -3082,41 +3105,41 @@ function Nn(e) {
|
|
|
3082
3105
|
}
|
|
3083
3106
|
//#endregion
|
|
3084
3107
|
//#region src/widget/dockGeometry.ts
|
|
3085
|
-
var
|
|
3086
|
-
function
|
|
3108
|
+
var Rn = "(min-width: 768px)", zn = 24, Bn = .5, Vn = 1200, Hn = .85, Un = 9 / 16;
|
|
3109
|
+
function Wn() {
|
|
3087
3110
|
if (typeof window > "u") return 800;
|
|
3088
3111
|
let e = window.screen?.availHeight;
|
|
3089
3112
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
3090
3113
|
}
|
|
3091
|
-
function
|
|
3092
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
3093
|
-
return s > a && (s = a, o = s /
|
|
3114
|
+
function Gn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = zn, r = typeof window < "u" ? Wn() : 800) {
|
|
3115
|
+
let i = Math.max(160, Math.min(t - n * 2, t * Hn)), a = Math.max(120, e - n * 2), o = Math.min(r * Bn, Vn, i), s = o * Un;
|
|
3116
|
+
return s > a && (s = a, o = s / Un, o > i && (o = i, s = o * Un)), {
|
|
3094
3117
|
width: Math.round(s),
|
|
3095
3118
|
height: Math.round(o)
|
|
3096
3119
|
};
|
|
3097
3120
|
}
|
|
3098
|
-
function
|
|
3121
|
+
function Kn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = zn) {
|
|
3099
3122
|
return {
|
|
3100
3123
|
left: Math.max(r, t - e.width - r),
|
|
3101
3124
|
top: Math.max(r, n - e.height - r)
|
|
3102
3125
|
};
|
|
3103
3126
|
}
|
|
3104
|
-
function
|
|
3127
|
+
function qn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = zn) {
|
|
3105
3128
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
3106
3129
|
return {
|
|
3107
3130
|
left: Math.min(Math.max(a, e), o),
|
|
3108
3131
|
top: Math.min(Math.max(a, t), s)
|
|
3109
3132
|
};
|
|
3110
3133
|
}
|
|
3111
|
-
function
|
|
3112
|
-
return e(
|
|
3134
|
+
function Jn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
3135
|
+
return e(Rn).matches;
|
|
3113
3136
|
}
|
|
3114
3137
|
//#endregion
|
|
3115
3138
|
//#region src/widget/mountExperienceWidget.ts
|
|
3116
|
-
function
|
|
3139
|
+
function Yn(e) {
|
|
3117
3140
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
3118
3141
|
}
|
|
3119
|
-
function
|
|
3142
|
+
function Xn(e) {
|
|
3120
3143
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
3121
3144
|
let t = typeof e == "string" ? e.trim() : "";
|
|
3122
3145
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -3124,10 +3147,10 @@ function Kn(e) {
|
|
|
3124
3147
|
function $(e) {
|
|
3125
3148
|
return e === "expanded" || e === "docked";
|
|
3126
3149
|
}
|
|
3127
|
-
var
|
|
3128
|
-
function
|
|
3129
|
-
xe
|
|
3130
|
-
let r =
|
|
3150
|
+
var Zn = "<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>", Qn = "<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>", $n = "<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>", er = "<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>";
|
|
3151
|
+
function tr(e, t, n) {
|
|
3152
|
+
Ce(xe);
|
|
3153
|
+
let r = te({
|
|
3131
3154
|
galleryThumb: t.galleryThumb,
|
|
3132
3155
|
avatarImage: t.avatarImage,
|
|
3133
3156
|
backgroundImage: t.backgroundImage,
|
|
@@ -3153,9 +3176,9 @@ function Zn(e, t, n) {
|
|
|
3153
3176
|
let e = document.createElement("img");
|
|
3154
3177
|
e.className = "liforma-et__foreground liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.foregroundImage, e.addEventListener("load", () => o(e), { once: !0 }), i.append(e);
|
|
3155
3178
|
}
|
|
3156
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
3179
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : be(i);
|
|
3157
3180
|
}
|
|
3158
|
-
function
|
|
3181
|
+
function nr(e) {
|
|
3159
3182
|
return e.startButton ? {
|
|
3160
3183
|
...e.startButton,
|
|
3161
3184
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -3167,7 +3190,7 @@ function Qn(e) {
|
|
|
3167
3190
|
variant: "primary"
|
|
3168
3191
|
};
|
|
3169
3192
|
}
|
|
3170
|
-
function
|
|
3193
|
+
function rr(e) {
|
|
3171
3194
|
let t = !1, n = () => {
|
|
3172
3195
|
t || e();
|
|
3173
3196
|
}, r = () => {
|
|
@@ -3187,12 +3210,12 @@ function $n(e) {
|
|
|
3187
3210
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
3188
3211
|
};
|
|
3189
3212
|
}
|
|
3190
|
-
function
|
|
3191
|
-
Pe
|
|
3213
|
+
function ir(e, t) {
|
|
3214
|
+
Fe(Pe);
|
|
3192
3215
|
let n = t.experienceId?.trim();
|
|
3193
3216
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
3194
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
3195
|
-
a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset",
|
|
3217
|
+
let r = t.prefetch ?? "onExpand", i = Yn(t.position), a = document.createElement("div");
|
|
3218
|
+
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", Xn(t.offset));
|
|
3196
3219
|
let o = document.createElement("button");
|
|
3197
3220
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
3198
3221
|
let s = document.createElement("div");
|
|
@@ -3212,136 +3235,136 @@ function er(e, t) {
|
|
|
3212
3235
|
let m = document.createElement("span");
|
|
3213
3236
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
3214
3237
|
let h = document.createElement("button");
|
|
3215
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
3238
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = $n, h.setAttribute("aria-label", "Reduce");
|
|
3216
3239
|
let g = document.createElement("button");
|
|
3217
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
3240
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Zn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
3218
3241
|
let _ = document.createElement("button");
|
|
3219
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
3242
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Qn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
3220
3243
|
let v = document.createElement("div");
|
|
3221
3244
|
v.className = "liforma-ew__stage";
|
|
3222
3245
|
let y = document.createElement("div");
|
|
3223
3246
|
y.className = "liforma-ew__status", y.hidden = !0, f.append(v, y), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
|
|
3224
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null,
|
|
3247
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, N = null, P = null, F = null, I = null, ee = 0, te = 0, L = null, R = !1, z = new AbortController(), ne = t.parallax !== !1, B = () => {
|
|
3225
3248
|
let e = a.dataset.state;
|
|
3226
3249
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
3227
|
-
},
|
|
3250
|
+
}, re = () => {
|
|
3228
3251
|
M !== null && (clearTimeout(M), M = null);
|
|
3229
|
-
},
|
|
3230
|
-
|
|
3231
|
-
},
|
|
3252
|
+
}, ie = () => {
|
|
3253
|
+
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3254
|
+
}, V = () => {
|
|
3232
3255
|
for (let e of [
|
|
3233
3256
|
f,
|
|
3234
3257
|
l,
|
|
3235
3258
|
p
|
|
3236
3259
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
3237
3260
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
3238
|
-
},
|
|
3261
|
+
}, H = (e, t, n, r) => {
|
|
3239
3262
|
let i = (i) => {
|
|
3240
3263
|
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";
|
|
3241
3264
|
};
|
|
3242
3265
|
i(f), i(l);
|
|
3243
3266
|
let a = p.offsetWidth || 120;
|
|
3244
3267
|
p.style.left = `${e + n - a - 10}px`, p.style.top = `${t + 10}px`, p.style.right = "auto", p.style.bottom = "auto", p.style.width = "auto", p.style.height = "auto";
|
|
3245
|
-
},
|
|
3246
|
-
if (
|
|
3247
|
-
let n =
|
|
3248
|
-
|
|
3249
|
-
},
|
|
3250
|
-
if (
|
|
3251
|
-
let n =
|
|
3252
|
-
|
|
3253
|
-
},
|
|
3254
|
-
L === "toolbar" && (
|
|
3255
|
-
},
|
|
3256
|
-
if (
|
|
3268
|
+
}, ae = (e, t) => {
|
|
3269
|
+
if (B() !== "docked") return;
|
|
3270
|
+
let n = Gn(), r = qn(e - ee, t - te, n);
|
|
3271
|
+
P = r.left, F = r.top, H(r.left, r.top, n.width, n.height);
|
|
3272
|
+
}, oe = (e, t) => {
|
|
3273
|
+
if (B() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
3274
|
+
let n = Gn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = qn(r + e, i + t, n);
|
|
3275
|
+
P = a.left, F = a.top, H(a.left, a.top, n.width, n.height);
|
|
3276
|
+
}, se = (e) => {
|
|
3277
|
+
L === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), ae(e.clientX, e.clientY)));
|
|
3278
|
+
}, U = (e) => {
|
|
3279
|
+
if (I === null || e && e.pointerId !== I) return;
|
|
3257
3280
|
let t = L;
|
|
3258
|
-
|
|
3259
|
-
},
|
|
3260
|
-
if (S ||
|
|
3261
|
-
|
|
3281
|
+
I = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && R && (R = !1, window.removeEventListener("pointermove", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
|
|
3282
|
+
}, ce = (e, t, n) => {
|
|
3283
|
+
if (S || B() !== "docked" || !Jn() || I !== null) return;
|
|
3284
|
+
I = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3262
3285
|
let r = f.getBoundingClientRect();
|
|
3263
|
-
|
|
3264
|
-
},
|
|
3265
|
-
if (S ||
|
|
3266
|
-
|
|
3286
|
+
ee = e - r.left, te = t - r.top, R || (R = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
|
|
3287
|
+
}, le = (e) => {
|
|
3288
|
+
if (S || B() !== "docked" || !Jn() || I !== null) return;
|
|
3289
|
+
I = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3267
3290
|
let t = f.getBoundingClientRect();
|
|
3268
|
-
|
|
3269
|
-
},
|
|
3270
|
-
L === "player" && (
|
|
3271
|
-
},
|
|
3272
|
-
L === "player" && (
|
|
3273
|
-
},
|
|
3274
|
-
let e =
|
|
3291
|
+
P = t.left, F = t.top;
|
|
3292
|
+
}, ue = (e) => {
|
|
3293
|
+
L === "player" && (I === null || e.pointerId !== I || oe(e.dx, e.dy));
|
|
3294
|
+
}, de = (e) => {
|
|
3295
|
+
L === "player" && (I === null || e.pointerId !== I || U());
|
|
3296
|
+
}, fe = () => {
|
|
3297
|
+
let e = Jn(), t = B();
|
|
3275
3298
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
3276
3299
|
h.hidden = !0;
|
|
3277
3300
|
return;
|
|
3278
3301
|
}
|
|
3279
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
3280
|
-
},
|
|
3281
|
-
let t =
|
|
3282
|
-
n =
|
|
3283
|
-
},
|
|
3302
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = er, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = $n, h.setAttribute("aria-label", "Reduce"));
|
|
3303
|
+
}, pe = (e) => {
|
|
3304
|
+
let t = Gn(), n = e && P !== null && F !== null ? qn(P, F, t) : Kn(t);
|
|
3305
|
+
n = qn(n.left, n.top, t), P = n.left, F = n.top, H(n.left, n.top, t.width, t.height), fe();
|
|
3306
|
+
}, me = () => {
|
|
3284
3307
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
3285
3308
|
requestAnimationFrame(() => {
|
|
3286
3309
|
S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
3287
3310
|
});
|
|
3288
3311
|
});
|
|
3289
3312
|
}, W = (e) => {
|
|
3290
|
-
if (
|
|
3313
|
+
if (ie(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
3291
3314
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3292
3315
|
return;
|
|
3293
3316
|
}
|
|
3294
|
-
|
|
3295
|
-
if (
|
|
3317
|
+
N = setTimeout(() => {
|
|
3318
|
+
if (N = null, S || !$(a.dataset.state)) {
|
|
3296
3319
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3297
3320
|
return;
|
|
3298
3321
|
}
|
|
3299
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
3322
|
+
a.classList.remove("liforma-ew--layout-settling"), me();
|
|
3300
3323
|
}, 220);
|
|
3301
3324
|
}, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
3302
|
-
|
|
3325
|
+
re(), M = setTimeout(() => {
|
|
3303
3326
|
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
3304
3327
|
}, 280);
|
|
3305
|
-
})),
|
|
3328
|
+
})), ge = {
|
|
3306
3329
|
galleryThumb: t.galleryThumb,
|
|
3307
3330
|
avatarImage: t.avatarImage,
|
|
3308
3331
|
backgroundImage: t.backgroundImage,
|
|
3309
3332
|
foregroundImage: t.foregroundImage,
|
|
3310
3333
|
fallbackImage: t.fallbackImage
|
|
3311
|
-
},
|
|
3334
|
+
}, G = (e) => {
|
|
3312
3335
|
if (!e) {
|
|
3313
3336
|
y.hidden = !0, y.textContent = "";
|
|
3314
3337
|
return;
|
|
3315
3338
|
}
|
|
3316
3339
|
y.hidden = !1, y.textContent = e;
|
|
3317
|
-
},
|
|
3340
|
+
}, K = (e) => {
|
|
3318
3341
|
if (!e) {
|
|
3319
3342
|
c.hidden = !0, c.textContent = "";
|
|
3320
3343
|
return;
|
|
3321
3344
|
}
|
|
3322
3345
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
3323
3346
|
}, _e = () => {
|
|
3324
|
-
C = !0, o.disabled = !1,
|
|
3347
|
+
C = !0, o.disabled = !1, K(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3325
3348
|
}, ve = () => {
|
|
3326
3349
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
3327
3350
|
}, ye = (e) => {
|
|
3328
3351
|
A?.(), A = null;
|
|
3329
|
-
let t =
|
|
3352
|
+
let t = tr(s, e, { parallax: ne });
|
|
3330
3353
|
return t ? (A = t, !0) : !1;
|
|
3331
3354
|
}, be = () => {
|
|
3332
|
-
if (ye(
|
|
3355
|
+
if (ye(ge)) {
|
|
3333
3356
|
_e();
|
|
3334
3357
|
return;
|
|
3335
3358
|
}
|
|
3336
|
-
|
|
3359
|
+
K("Loading…"), Ve(n, { signal: z.signal }).then((e) => {
|
|
3337
3360
|
if (!S) {
|
|
3338
3361
|
if (!ye({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
3339
3362
|
_e();
|
|
3340
3363
|
}
|
|
3341
3364
|
}).catch((e) => {
|
|
3342
|
-
if (S ||
|
|
3365
|
+
if (S || z.signal.aborted) return;
|
|
3343
3366
|
let n = e instanceof Error ? e : Error(String(e));
|
|
3344
|
-
|
|
3367
|
+
K("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
3345
3368
|
});
|
|
3346
3369
|
}, xe = () => ({
|
|
3347
3370
|
experienceId: n,
|
|
@@ -3358,30 +3381,30 @@ function er(e, t) {
|
|
|
3358
3381
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
3359
3382
|
}), Se = () => ({
|
|
3360
3383
|
...t.fit ? { fit: t.fit } : {},
|
|
3361
|
-
startButton:
|
|
3384
|
+
startButton: nr(t),
|
|
3362
3385
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
3363
3386
|
...t.interaction ? { interaction: t.interaction } : {}
|
|
3364
3387
|
}), Ce = (e = !0) => {
|
|
3365
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
3388
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), V(), a.dataset.state = "expanded", G(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), fe(), e && t.onExpanded?.();
|
|
3366
3389
|
}, we = () => {
|
|
3367
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
3390
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", G(null), typeof document < "u" && (document.body.style.overflow = k), pe(!0), fe(), b?.setWidgetChrome("docked");
|
|
3368
3391
|
}, Te = (e) => {
|
|
3369
3392
|
e.on("started", () => {
|
|
3370
|
-
S || (D = !0, a.dataset.live = "true",
|
|
3393
|
+
S || (D = !0, a.dataset.live = "true", G(null), t.onStarted?.(), $(a.dataset.state) && me());
|
|
3371
3394
|
}), e.on("feedback", (e) => {
|
|
3372
3395
|
S || t.onFeedback?.(e);
|
|
3373
3396
|
}), e.on("feedbackFailed", (e) => {
|
|
3374
3397
|
S || t.onFeedbackFailed?.(e);
|
|
3375
3398
|
});
|
|
3376
3399
|
}, Ee = () => {
|
|
3377
|
-
|
|
3400
|
+
ie(), u.hidden = !0, p.hidden = !0, V(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), G(null), typeof document < "u" && (document.body.style.overflow = k), fe();
|
|
3378
3401
|
}, De = () => {
|
|
3379
|
-
|
|
3402
|
+
re(), ie(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3380
3403
|
let e = b;
|
|
3381
3404
|
b = null, e?.destroy(), v.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
|
|
3382
3405
|
}, Oe = () => {
|
|
3383
3406
|
if (!S && $(a.dataset.state)) {
|
|
3384
|
-
if (
|
|
3407
|
+
if (U(), x = !1, b && E) {
|
|
3385
3408
|
let e = b;
|
|
3386
3409
|
(async () => {
|
|
3387
3410
|
D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Ee(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && ve(), t.onCollapsed?.(), t.onClose?.());
|
|
@@ -3391,26 +3414,26 @@ function er(e, t) {
|
|
|
3391
3414
|
De(), Ee(), t.onCollapsed?.(), t.onClose?.();
|
|
3392
3415
|
}
|
|
3393
3416
|
}, ke = () => {
|
|
3394
|
-
S ||
|
|
3417
|
+
S || Jn() && B() === "expanded" && W(() => {
|
|
3395
3418
|
we();
|
|
3396
3419
|
});
|
|
3397
3420
|
}, Ae = () => {
|
|
3398
|
-
S ||
|
|
3399
|
-
|
|
3421
|
+
S || B() === "docked" && (U(), W(() => {
|
|
3422
|
+
V(), Ce(!1), b?.setWidgetChrome("expanded");
|
|
3400
3423
|
}));
|
|
3401
3424
|
}, je = () => {
|
|
3402
|
-
!b || !D || (
|
|
3403
|
-
},
|
|
3404
|
-
!b || !E || D || (
|
|
3405
|
-
},
|
|
3406
|
-
S || e !== O && !D || (
|
|
3425
|
+
!b || !D || (re(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, me());
|
|
3426
|
+
}, Me = () => {
|
|
3427
|
+
!b || !E || D || (re(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3428
|
+
}, Ne = (e) => {
|
|
3429
|
+
S || e !== O && !D || (re(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && me());
|
|
3407
3430
|
}, q = () => {
|
|
3408
3431
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
3409
3432
|
T = !0;
|
|
3410
3433
|
let e = O;
|
|
3411
3434
|
l.hidden = !1, (async () => {
|
|
3412
3435
|
try {
|
|
3413
|
-
let t = await
|
|
3436
|
+
let t = await In.startSession(xe());
|
|
3414
3437
|
if (S || e !== O) {
|
|
3415
3438
|
t.destroy();
|
|
3416
3439
|
return;
|
|
@@ -3423,22 +3446,22 @@ function er(e, t) {
|
|
|
3423
3446
|
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ve());
|
|
3424
3447
|
},
|
|
3425
3448
|
onWidgetExpand: () => {
|
|
3426
|
-
|
|
3449
|
+
Ne(e);
|
|
3427
3450
|
},
|
|
3428
3451
|
onWidgetAudioSettings: (e) => {
|
|
3429
|
-
S ||
|
|
3452
|
+
S || ze(e);
|
|
3430
3453
|
},
|
|
3431
3454
|
onWidgetDragStart: (e) => {
|
|
3432
|
-
S ||
|
|
3455
|
+
S || le(e);
|
|
3433
3456
|
},
|
|
3434
3457
|
onWidgetDragMove: (e) => {
|
|
3435
|
-
S ||
|
|
3458
|
+
S || ue(e);
|
|
3436
3459
|
},
|
|
3437
3460
|
onWidgetDragEnd: (e) => {
|
|
3438
|
-
S ||
|
|
3461
|
+
S || de(e);
|
|
3439
3462
|
},
|
|
3440
3463
|
onPlayerStatusChange: (e) => {
|
|
3441
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3464
|
+
S || e === "error" && $(a.dataset.state) && G("Could not load the experience.");
|
|
3442
3465
|
}
|
|
3443
3466
|
});
|
|
3444
3467
|
if (S || e !== O) {
|
|
@@ -3462,14 +3485,14 @@ function er(e, t) {
|
|
|
3462
3485
|
return;
|
|
3463
3486
|
}
|
|
3464
3487
|
if (b && E) {
|
|
3465
|
-
|
|
3488
|
+
Me();
|
|
3466
3489
|
return;
|
|
3467
3490
|
}
|
|
3468
3491
|
let e = ++O;
|
|
3469
3492
|
x = !0, w = !1, T = !1, E = !1, D = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
|
|
3470
3493
|
try {
|
|
3471
3494
|
Ce();
|
|
3472
|
-
let t = await
|
|
3495
|
+
let t = await In.startSession(xe());
|
|
3473
3496
|
if (S || e !== O) {
|
|
3474
3497
|
t.destroy();
|
|
3475
3498
|
return;
|
|
@@ -3479,19 +3502,19 @@ function er(e, t) {
|
|
|
3479
3502
|
container: v,
|
|
3480
3503
|
...Se(),
|
|
3481
3504
|
onWidgetAudioSettings: (e) => {
|
|
3482
|
-
S ||
|
|
3505
|
+
S || ze(e);
|
|
3483
3506
|
},
|
|
3484
3507
|
onWidgetDragStart: (e) => {
|
|
3485
|
-
S ||
|
|
3508
|
+
S || le(e);
|
|
3486
3509
|
},
|
|
3487
3510
|
onWidgetDragMove: (e) => {
|
|
3488
|
-
S ||
|
|
3511
|
+
S || ue(e);
|
|
3489
3512
|
},
|
|
3490
3513
|
onWidgetDragEnd: (e) => {
|
|
3491
|
-
S ||
|
|
3514
|
+
S || de(e);
|
|
3492
3515
|
},
|
|
3493
3516
|
onPlayerStatusChange: (e) => {
|
|
3494
|
-
S || (e === "error" ?
|
|
3517
|
+
S || (e === "error" ? G("Could not load the experience.") : $(a.dataset.state) && G(null));
|
|
3495
3518
|
}
|
|
3496
3519
|
});
|
|
3497
3520
|
if (S || e !== O) {
|
|
@@ -3504,7 +3527,7 @@ function er(e, t) {
|
|
|
3504
3527
|
} catch (n) {
|
|
3505
3528
|
if (S || e !== O) return;
|
|
3506
3529
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3507
|
-
|
|
3530
|
+
G(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3508
3531
|
} finally {
|
|
3509
3532
|
e === O && (x = !1);
|
|
3510
3533
|
}
|
|
@@ -3516,7 +3539,7 @@ function er(e, t) {
|
|
|
3516
3539
|
return;
|
|
3517
3540
|
}
|
|
3518
3541
|
if (b && E) {
|
|
3519
|
-
|
|
3542
|
+
Me();
|
|
3520
3543
|
return;
|
|
3521
3544
|
}
|
|
3522
3545
|
if (T || b) {
|
|
@@ -3526,47 +3549,47 @@ function er(e, t) {
|
|
|
3526
3549
|
Ie();
|
|
3527
3550
|
}
|
|
3528
3551
|
}, Re = (e) => {
|
|
3529
|
-
if (e.stopPropagation(),
|
|
3552
|
+
if (e.stopPropagation(), B() === "expanded") {
|
|
3530
3553
|
ke();
|
|
3531
3554
|
return;
|
|
3532
3555
|
}
|
|
3533
|
-
|
|
3534
|
-
},
|
|
3556
|
+
B() === "docked" && Ae();
|
|
3557
|
+
}, ze = (e) => {
|
|
3535
3558
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
3536
3559
|
}, Be = (e) => {
|
|
3537
3560
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3538
|
-
},
|
|
3539
|
-
|
|
3561
|
+
}, J = (e) => {
|
|
3562
|
+
B() === "docked" && Jn() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
|
|
3540
3563
|
}, He = (e) => {
|
|
3541
3564
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Oe());
|
|
3542
3565
|
}, Ue = () => {
|
|
3543
3566
|
if (!S) {
|
|
3544
|
-
if (
|
|
3545
|
-
if (!
|
|
3567
|
+
if (B() === "docked") {
|
|
3568
|
+
if (!Jn()) {
|
|
3546
3569
|
Ae();
|
|
3547
3570
|
return;
|
|
3548
3571
|
}
|
|
3549
3572
|
D ? W(() => {
|
|
3550
|
-
|
|
3551
|
-
}) :
|
|
3573
|
+
pe(!0);
|
|
3574
|
+
}) : pe(!0);
|
|
3552
3575
|
return;
|
|
3553
3576
|
}
|
|
3554
|
-
|
|
3577
|
+
fe();
|
|
3555
3578
|
}
|
|
3556
|
-
},
|
|
3579
|
+
}, We = typeof window < "u" ? window.matchMedia(Rn) : null, Ge = () => {
|
|
3557
3580
|
if (!S) {
|
|
3558
|
-
if (
|
|
3581
|
+
if (B() === "docked" && !Jn()) {
|
|
3559
3582
|
Ae();
|
|
3560
3583
|
return;
|
|
3561
3584
|
}
|
|
3562
|
-
|
|
3585
|
+
fe();
|
|
3563
3586
|
}
|
|
3564
3587
|
};
|
|
3565
3588
|
return o.addEventListener("click", Le), d.addEventListener("click", Oe), _.addEventListener("click", (e) => {
|
|
3566
3589
|
e.stopPropagation(), Oe();
|
|
3567
|
-
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown",
|
|
3590
|
+
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", J), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), be(), fe(), r === "eager" ? queueMicrotask(() => {
|
|
3568
3591
|
S || q();
|
|
3569
|
-
}) : r === "idle" && (j =
|
|
3592
|
+
}) : r === "idle" && (j = rr(() => {
|
|
3570
3593
|
S || q();
|
|
3571
3594
|
})), {
|
|
3572
3595
|
root: a,
|
|
@@ -3582,18 +3605,18 @@ function er(e, t) {
|
|
|
3582
3605
|
q();
|
|
3583
3606
|
},
|
|
3584
3607
|
destroy() {
|
|
3585
|
-
S || (S = !0,
|
|
3608
|
+
S || (S = !0, U(), j?.(), j = null, z.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), De(), Ee(), e.replaceChildren());
|
|
3586
3609
|
}
|
|
3587
3610
|
};
|
|
3588
3611
|
}
|
|
3589
3612
|
//#endregion
|
|
3590
3613
|
//#region src/react/ExperienceWidget.tsx
|
|
3591
|
-
function
|
|
3592
|
-
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed:
|
|
3614
|
+
function ar(t) {
|
|
3615
|
+
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed: N, onStarted: P, onClose: F, onError: I, onPrefetchReady: ee, onFeedback: te, onFeedbackFailed: L } = t, R = m === "bottom-right" || m === "bottom-left";
|
|
3593
3616
|
return e(() => {
|
|
3594
3617
|
let e = r.current;
|
|
3595
3618
|
if (!e || !i.trim()) return;
|
|
3596
|
-
let t =
|
|
3619
|
+
let t = ir(e, {
|
|
3597
3620
|
experienceId: i,
|
|
3598
3621
|
alt: o,
|
|
3599
3622
|
galleryThumb: s,
|
|
@@ -3620,14 +3643,14 @@ function tr(t) {
|
|
|
3620
3643
|
startButtonLabel: O,
|
|
3621
3644
|
startButton: k,
|
|
3622
3645
|
showFeedback: A,
|
|
3623
|
-
onFeedback:
|
|
3646
|
+
onFeedback: te,
|
|
3624
3647
|
onFeedbackFailed: L,
|
|
3625
3648
|
onExpanded: M,
|
|
3626
|
-
onCollapsed:
|
|
3627
|
-
onStarted:
|
|
3628
|
-
onClose:
|
|
3629
|
-
onError:
|
|
3630
|
-
onPrefetchReady:
|
|
3649
|
+
onCollapsed: N,
|
|
3650
|
+
onStarted: P,
|
|
3651
|
+
onClose: F,
|
|
3652
|
+
onError: I,
|
|
3653
|
+
onPrefetchReady: ee
|
|
3631
3654
|
});
|
|
3632
3655
|
return () => t.destroy();
|
|
3633
3656
|
}, [
|
|
@@ -3657,18 +3680,18 @@ function tr(t) {
|
|
|
3657
3680
|
O,
|
|
3658
3681
|
k,
|
|
3659
3682
|
A,
|
|
3660
|
-
|
|
3683
|
+
te,
|
|
3661
3684
|
L,
|
|
3662
3685
|
M,
|
|
3663
|
-
ee,
|
|
3664
3686
|
N,
|
|
3665
3687
|
P,
|
|
3666
3688
|
F,
|
|
3667
|
-
|
|
3689
|
+
I,
|
|
3690
|
+
ee
|
|
3668
3691
|
]), /* @__PURE__ */ a("div", {
|
|
3669
3692
|
ref: r,
|
|
3670
3693
|
className: j,
|
|
3671
|
-
style:
|
|
3694
|
+
style: R ? { display: "contents" } : {
|
|
3672
3695
|
width: "100%",
|
|
3673
3696
|
height: "100%",
|
|
3674
3697
|
minHeight: "inherit"
|
|
@@ -3677,11 +3700,11 @@ function tr(t) {
|
|
|
3677
3700
|
}
|
|
3678
3701
|
//#endregion
|
|
3679
3702
|
//#region src/next/index.ts
|
|
3680
|
-
function
|
|
3703
|
+
function or(e = {}) {
|
|
3681
3704
|
let t = v(e);
|
|
3682
3705
|
return { POST: ({ request: e }) => t(e) };
|
|
3683
3706
|
}
|
|
3684
3707
|
//#endregion
|
|
3685
|
-
export {
|
|
3708
|
+
export { Ne as ExperienceThumbnail, ar as ExperienceWidget, v as createLiformaSessionRouteHandler, or as createLiformaSvelteKitSessionHandler };
|
|
3686
3709
|
|
|
3687
3710
|
//# sourceMappingURL=index.js.map
|