@liforma/client 0.4.15 → 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.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/next/index.js +619 -608
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  5. package/dist/next/thumbnail/avatarPlate.d.ts +11 -0
  6. package/dist/next/thumbnail/avatarPlate.d.ts.map +1 -0
  7. package/dist/next/thumbnail/avatarPlate.test.d.ts +2 -0
  8. package/dist/next/thumbnail/avatarPlate.test.d.ts.map +1 -0
  9. package/dist/next/thumbnail/expandAssetUrl.d.ts +3 -2
  10. package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -1
  11. package/dist/next/thumbnail/index.d.ts +2 -0
  12. package/dist/next/thumbnail/index.d.ts.map +1 -1
  13. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  14. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  15. package/dist/next/thumbnail.js +211 -200
  16. package/dist/next/thumbnail.js.map +1 -1
  17. package/dist/npm/index.js +496 -492
  18. package/dist/npm/index.js.map +1 -1
  19. package/dist/npm/thumbnail/avatarPlate.d.ts +11 -0
  20. package/dist/npm/thumbnail/avatarPlate.d.ts.map +1 -0
  21. package/dist/npm/thumbnail/expandAssetUrl.d.ts +3 -2
  22. package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -1
  23. package/dist/npm/thumbnail/index.d.ts +2 -0
  24. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  25. package/dist/npm/thumbnail/index.js +123 -110
  26. package/dist/npm/thumbnail/index.js.map +1 -1
  27. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  28. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  29. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  30. package/dist/react/index.js +749 -738
  31. package/dist/react/index.js.map +1 -1
  32. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  33. package/dist/react/thumbnail/avatarPlate.d.ts +11 -0
  34. package/dist/react/thumbnail/avatarPlate.d.ts.map +1 -0
  35. package/dist/react/thumbnail/avatarPlate.test.d.ts +2 -0
  36. package/dist/react/thumbnail/avatarPlate.test.d.ts.map +1 -0
  37. package/dist/react/thumbnail/expandAssetUrl.d.ts +3 -2
  38. package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -1
  39. package/dist/react/thumbnail/index.d.ts +2 -0
  40. package/dist/react/thumbnail/index.d.ts.map +1 -1
  41. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  42. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  43. package/dist/react/thumbnail.js +211 -200
  44. package/dist/react/thumbnail.js.map +1 -1
  45. package/dist/sdk/v2/client.js +1 -1
  46. package/dist/sdk/v2/client.js.map +1 -1
  47. package/dist/sdk/v2/thumbnail.js +2 -2
  48. package/dist/sdk/v2/thumbnail.js.map +1 -1
  49. package/dist/svelte/ExperienceThumbnail.svelte +3 -0
  50. package/package.json +1 -1
@@ -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/locationPlate.ts
110
- var b = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
109
+ //#region src/thumbnail/avatarPlate.ts
110
+ var b = /(\/avatars\/[^/]+\/)(\d+)(\/)/i;
111
111
  function x(e, t) {
112
- return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
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, a) => `${n}${t}${i}${a}`);
118
+ return n && n.replace(b, (e, n, r, i) => `${n}${t}${i}`);
117
119
  }
118
- function C(e, t) {
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}`);
129
+ }
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 w = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
127
- function T(e) {
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 E(e) {
142
+ function k(e) {
131
143
  return /^https?:\/\//i.test(e) || e.startsWith("//");
132
144
  }
133
- function D(e) {
145
+ function A(e) {
134
146
  return e.startsWith("//") ? `https:${e}` : e;
135
147
  }
136
- function O(e) {
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 k(e, t, n = "") {
158
+ function M(e, t, n = "") {
147
159
  return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
148
160
  }
149
- function A(e, t, n) {
161
+ function N(e, t, n) {
150
162
  let r = e.trim();
151
163
  if (!r) return r;
152
- let i = T(n);
153
- if (E(r)) return S(D(r), t);
154
- let { pathname: a, search: o } = O(r.replace(/\\/g, "/")), s = a;
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) ? k(i, s, o) : r;
157
- if (/\.webp$/i.test(s) && !w.test(s.replace(/\.webp$/i, ""))) return k(i, s, o);
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(w, ""), `${i}/locations/${c}-${t}.webp${o}`;
171
+ return c = c.replace(D, ""), `${i}/locations/${c}-${t}.webp${o}`;
160
172
  }
161
- function j(e, t) {
162
- let n = e.trim();
163
- if (!n) return n;
164
- let r = T(t);
165
- if (E(n)) return D(n);
166
- let { pathname: i, search: a } = O(n.replace(/\\/g, "/")), o = i;
167
- if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
168
- else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
169
- else return n;
170
- if (!/^\/avatars\//i.test(o)) return n;
171
- let s = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
172
- return s && !s.includes("/") && !a ? `${r}/avatars/${s}/256/${s}_neutral.webp` : k(r, o, a);
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 M = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, ee = /_CH(\.webp)/i;
177
- function N(e) {
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 P(e, t = "256x256", n) {
181
- let r = e.trim();
182
- if (!r) return r;
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 F(e) {
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 = T(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : P(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : A(e, a, o);
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: c(t),
193
- ...n ? { backgroundImage: l(n) } : {},
194
- ...r ? { foregroundImage: l(r) } : {},
195
- ...i ? { fallbackImage: c(i) } : {}
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 te() {
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 I = "https://player.liforma.ai", L = "http://localhost:3002";
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 re(e) {
224
+ function B(e) {
216
225
  let t = e?.trim();
217
- return t ? t.replace(/\/$/, "") : te() ? L : I;
226
+ return t ? t.replace(/\/$/, "") : L() ? z : R;
218
227
  }
219
- function ie(e) {
220
- let t = e.experienceId.trim(), n = re(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
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 R(e) {
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), ie({
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 z() {
244
+ function V() {
236
245
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
237
246
  }
238
- var B = 0, ae = [];
247
+ var H = 0, ae = [];
239
248
  function oe() {
240
- return z() ? 4 : Infinity;
249
+ return V() ? 4 : Infinity;
241
250
  }
242
251
  function se() {
243
- return z() ? 160 : 0;
252
+ return V() ? 160 : 0;
244
253
  }
245
- function ce() {
254
+ function U() {
246
255
  let e = oe();
247
- for (; B < e && ae.length > 0;) {
256
+ for (; H < e && ae.length > 0;) {
248
257
  let e = ae.shift();
249
258
  if (!e || e.cancelled) continue;
250
- B += 1, e.start();
259
+ H += 1, e.start();
251
260
  let t = se();
252
261
  if (t <= 0) {
253
- B = Math.max(0, B - 1);
262
+ H = Math.max(0, H - 1);
254
263
  continue;
255
264
  }
256
265
  window.setTimeout(() => {
257
- B = Math.max(0, B - 1), ce();
266
+ H = Math.max(0, H - 1), U();
258
267
  }, t);
259
268
  }
260
269
  }
261
- function le(e) {
262
- if (!z()) return e(), () => {};
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), ce(), () => {
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 V() {
274
- return z() ? "96px 0px" : "280px 0px";
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 ?? V(), i = ue(r), a = !1, o = !1, s = null, c = () => {
287
- o || (s?.(), s = le(() => {
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 H(e, t) {
327
+ function me(e, t) {
319
328
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
320
329
  }
321
- var me = /* @__PURE__ */ new Set(), U = !1, W = 0;
322
- function he() {
323
- if (W = 0, me.size === 0 || typeof window > "u") return;
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 me) {
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(H(n, e));
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
- U || typeof window > "u" || (U = !0, window.addEventListener("scroll", G, { passive: !0 }), window.addEventListener("resize", G, { passive: !0 }));
341
+ ge === 0 && (ge = requestAnimationFrame(G));
336
342
  }
337
- function ge() {
338
- me.size > 0 || !U || typeof window > "u" || (U = !1, W !== 0 && (cancelAnimationFrame(W), W = 0), window.removeEventListener("scroll", G), window.removeEventListener("resize", G));
343
+ function _e() {
344
+ he || typeof window > "u" || (he = !0, window.addEventListener("scroll", K, { passive: !0 }), window.addEventListener("resize", K, { passive: !0 }));
339
345
  }
340
- function _e(e, t) {
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));
348
+ }
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 me.add(n), K(), n.pointerActive?.() || t.onParallax(H(e.getBoundingClientRect(), window.innerHeight)), () => {
348
- me.delete(n), ge();
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 ve(e) {
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 = _e(e, {
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 = H(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
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 ye = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", be = !1;
383
- function xe(e) {
384
- if (typeof document > "u" || be) return;
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
- be = !0;
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), be = !0;
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 Se = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Ce = null;
395
- function we(e) {
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 Te(e) {
402
- if (!we(e)) return null;
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 Ee() {
409
- return typeof Image > "u" ? Promise.resolve(!1) : (Ce ||= new Promise((e) => {
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 = Se;
412
- }), Ce);
420
+ t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = we;
421
+ }), Te);
413
422
  }
414
- function De(e, t) {
415
- return t ? Te(e) ?? e : e;
423
+ function ke(e, t) {
424
+ return t ? De(e) ?? e : e;
416
425
  }
417
- function Oe(e) {
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 ke(e) {
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 Ae(e, t) {
438
+ function Me(e, t) {
430
439
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
431
440
  }
432
- function je(s) {
433
- let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: w = "full", lazy: T = !0, className: E = "", fallbackImage: D, normalizeUrls: O = !0, cdnBaseUrl: k } = s, A = n(null), j = n(!1), [M, ee] = r(0), [N, P] = r(0), te = x(M, N), I = t(() => F({
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: D,
439
- normalize: O,
440
- locationPlateSize: te,
441
- cdnBaseUrl: k
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
- te,
450
- k
451
- ]), L = ne({
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
- }), re = L === "anchor" && !m?.trim() && !!p?.trim(), ie = !!I?.backgroundImage, z = S !== !1, [B, ae] = r(!T), [oe, se] = r(!1), [ce, le] = r(!1), [V, ue] = r(!1), [de, pe] = r(!1), [me, U] = r(!1), [W, he] = r(!1), [G, K] = r(!1), [ge, ve] = r(0), [be, Se] = r(0), [Ce, we] = r(!1), [Te, je] = r(!1), [Me, Ne] = r(!1), [Pe, Fe] = r(!1), [q, Ie] = r(), Le = I ? Ce && I.fallbackImage ? I.fallbackImage : I.avatarImage : "";
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(ye), Ee().then((e) => {
458
- se(e), le(!0);
468
+ Ce(xe), Oe().then((e) => {
469
+ se(e), ce(!0);
459
470
  });
460
471
  }, []), e(() => {
461
- Ie(R({
472
+ Re(ie({
462
473
  href: m,
463
474
  experienceId: p,
464
475
  returnUrl: v,
465
476
  playerBaseUrl: b,
466
- useCurrentPageAsReturnUrl: re && !v?.trim()
477
+ useCurrentPageAsReturnUrl: B && !v?.trim()
467
478
  }));
468
479
  }, [
469
480
  m,
470
481
  p,
471
482
  v,
472
483
  b,
473
- re
484
+ B
474
485
  ]), e(() => {
475
- je(!1), Ne(!1), Fe(!1), we(!1), ue(!1), pe(!1), U(!1);
486
+ Ne(!1), q(!1), Ie(!1), Ee(!1), ue(!1), pe(!1), he(!1);
476
487
  }, [
477
- I?.backgroundImage,
478
- I?.foregroundImage,
479
- Le
488
+ R?.backgroundImage,
489
+ R?.foregroundImage,
490
+ ze
480
491
  ]), e(() => {
481
- let e = A.current;
482
- if (e) return C(e, (e, t) => {
483
- ee(e), P(t);
492
+ let e = j.current;
493
+ if (e) return E(e, (e, t) => {
494
+ P(e), I(t);
484
495
  });
485
- }, [L, q]), e(() => {
486
- let e = A.current;
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
- I,
499
- L,
500
- q
509
+ R,
510
+ z,
511
+ Le
501
512
  ]), e(() => {
502
- let e = A.current;
503
- if (!(!e || !z)) return _e(e, {
513
+ let e = j.current;
514
+ if (!(!e || !V)) return ye(e, {
504
515
  onParallax: (e) => {
505
- K(!0), j.current || (ve(e), Se(0));
516
+ _e(!0), M.current || (be(e), we(0));
506
517
  },
507
- pointerActive: () => j.current
518
+ pointerActive: () => M.current
508
519
  });
509
520
  }, [
521
+ V,
522
+ R,
510
523
  z,
511
- I,
512
- L,
513
- q
524
+ Le
514
525
  ]);
515
- let Re = (e) => {
516
- if (!z || G) return;
526
+ let Be = (e) => {
527
+ if (!V || K) return;
517
528
  let t = e.currentTarget.getBoundingClientRect();
518
- t.width <= 0 || t.height <= 0 || (ve(((e.clientX - t.left) / t.width - .5) * 2), Se(((e.clientY - t.top) / t.height - .5) * 2));
519
- }, ze = (e) => {
520
- let t = j.current;
521
- j.current = !1, he(!1), G && t ? (ve(H(e.getBoundingClientRect(), window.innerHeight)), Se(0)) : G || (ve(0), Se(0));
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 (!z) return;
524
- j.current = !0, e.pointerType === "mouse" && he(!0);
534
+ if (!V) return;
535
+ M.current = !0, e.pointerType === "mouse" && G(!0);
525
536
  let t = e.currentTarget, n = () => {
526
- ze(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
537
+ Ve(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
527
538
  };
528
539
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
529
- }, Be = (e) => {
530
- if (_?.(e), !e.defaultPrevented && re && !v?.trim()) {
531
- let t = R({
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 (!I) return null;
540
- let Ve = z && (W || G), He = B && ce && (Me || Te || Pe), Ue = [
550
+ if (!R) return null;
551
+ let Ue = V && (ge || K), We = H && U && (Pe || De || Fe), Ge = [
541
552
  "liforma-et",
542
- ie ? "liforma-et--scene" : "",
543
- y(w),
544
- Ve ? "liforma-et--parallax" : "",
545
- G ? "liforma-et--scroll-parallax" : "",
546
- B && !He ? "liforma-et--loading" : "",
547
- He ? "liforma-et--revealed" : "",
548
- E
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": ge,
551
- "--liforma-et-parallax-y": be
552
- }, We = (e, t) => {
561
+ "--liforma-et-parallax-x": ve,
562
+ "--liforma-et-parallax-y": Se
563
+ }, Ke = (e, t) => {
553
564
  e.complete && t(!0);
554
- }, Ge = /* @__PURE__ */ o(i, { children: [
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
- B && ce && I.backgroundImage ? /* @__PURE__ */ a("img", {
560
- className: Ae("liforma-et__background", Te),
561
- src: De(I.backgroundImage, oe),
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 && We(e, je);
576
+ e && Ke(e, Ne);
566
577
  },
567
- onLoad: () => je(!0),
578
+ onLoad: () => Ne(!0),
568
579
  onError: (e) => {
569
- let t = e.currentTarget, n = ke(t.src);
570
- if (n && !V) {
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
- je(!0);
585
+ Ne(!0);
575
586
  }
576
587
  }) : null,
577
- B && ce && Le ? /* @__PURE__ */ a("img", {
578
- className: Ae("liforma-et__avatar", Me),
579
- src: De(Le, oe),
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 && We(e, Ne);
594
+ e && Ke(e, q);
584
595
  },
585
- onLoad: () => Ne(!0),
596
+ onLoad: () => q(!0),
586
597
  onError: (e) => {
587
- let t = e.currentTarget, n = Oe(t.src);
588
- if (n && !me) {
589
- U(!0), t.src = n;
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
- I.fallbackImage ? we(!0) : Ne(!0);
603
+ R.fallbackImage ? Ee(!0) : q(!0);
593
604
  }
594
605
  }) : null,
595
- B && ce && I.foregroundImage ? /* @__PURE__ */ a("img", {
596
- className: Ae("liforma-et__foreground", Pe),
597
- src: De(I.foregroundImage, oe),
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 && We(e, Fe);
612
+ e && Ke(e, Ie);
602
613
  },
603
- onLoad: () => Fe(!0),
614
+ onLoad: () => Ie(!0),
604
615
  onError: (e) => {
605
- let t = e.currentTarget, n = ke(t.src);
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
- Fe(!0);
621
+ Ie(!0);
611
622
  }
612
623
  }) : null
613
- ] }), Ke = {
624
+ ] }), Je = {
614
625
  onPointerDown: J,
615
- onPointerUp: (e) => ze(e.currentTarget),
616
- onPointerCancel: (e) => ze(e.currentTarget),
626
+ onPointerUp: (e) => Ve(e.currentTarget),
627
+ onPointerCancel: (e) => Ve(e.currentTarget),
617
628
  onPointerEnter: (e) => {
618
- z && e.pointerType === "mouse" && he(!0);
629
+ V && e.pointerType === "mouse" && G(!0);
619
630
  },
620
- onPointerMove: Re,
631
+ onPointerMove: Be,
621
632
  onPointerLeave: () => {
622
- j.current || (he(!1), G || (ve(0), Se(0)));
633
+ M.current || (G(!1), K || (be(0), we(0)));
623
634
  }
624
- }, qe = (e) => {
625
- A.current = e;
635
+ }, Ye = (e) => {
636
+ j.current = e;
626
637
  };
627
- return L === "anchor" && q ? /* @__PURE__ */ a("a", {
628
- ref: qe,
629
- className: Ue,
638
+ return z === "anchor" && Le ? /* @__PURE__ */ a("a", {
639
+ ref: Ye,
640
+ className: Ge,
630
641
  style: Y,
631
- href: q,
642
+ href: Le,
632
643
  target: h,
633
644
  rel: g,
634
645
  "aria-label": f,
635
- onClick: Be,
636
- ...Ke,
637
- children: Ge
638
- }) : L === "button" ? /* @__PURE__ */ a("button", {
646
+ onClick: He,
647
+ ...Je,
648
+ children: qe
649
+ }) : z === "button" ? /* @__PURE__ */ a("button", {
639
650
  type: "button",
640
- ref: qe,
641
- className: Ue,
651
+ ref: Ye,
652
+ className: Ge,
642
653
  style: Y,
643
654
  "aria-label": f,
644
- onClick: Be,
645
- ...Ke,
646
- children: Ge
655
+ onClick: He,
656
+ ...Je,
657
+ children: qe
647
658
  }) : /* @__PURE__ */ a("div", {
648
- ref: qe,
649
- className: Ue,
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
- ...Ke,
655
- children: Ge
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 Pe(e = Me) {
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(Ne);
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 = Ne, n.textContent = e, document.head.append(n);
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 Fe = "https://api.liforma.ai", q = "http://localhost:3001";
674
- function Ie() {
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 Le() {
682
- return Ie() || (te() ? q : Fe);
692
+ function ze() {
693
+ return Re() || (L() ? Le : Ie);
683
694
  }
684
695
  //#endregion
685
696
  //#region src/v2/api/fetchExperiencePreview.ts
686
- function Re(e) {
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 ze(e, t) {
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 ?? Le()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
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 = Re(o.galleryThumb);
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 Be(e) {
748
+ function He(e) {
738
749
  if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
739
750
  }
740
- function Ve(e, t, n) {
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 } = Be(a) ?? Be(i) ?? {};
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 He = 128, Ue = /[\u0000-\u001f\u007f]/g;
766
+ var We = 128, Ge = /[\u0000-\u001f\u007f]/g;
756
767
  function Y(e) {
757
768
  if (!e) return;
758
- let t = e.replace(Ue, "").trim();
759
- if (t) return t.slice(0, He);
769
+ let t = e.replace(Ge, "").trim();
770
+ if (t) return t.slice(0, We);
760
771
  }
761
- function We(e) {
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 Ge(e) {
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 = We(window.location?.search), n = Y(document.referrer || void 0), r = {
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 Ke(e) {
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 qe(e) {
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 Je(e, t) {
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 = Ke(t), o = qe(t), s = t.idempotencyKey?.trim();
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 = Ge(t.attribution);
843
+ let e = qe(t.attribution);
833
844
  return e ? { attribution: e } : {};
834
845
  })(),
835
846
  ...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
@@ -839,19 +850,19 @@ function Je(e, t) {
839
850
  }
840
851
  //#endregion
841
852
  //#region src/v2/types/sessionLaunch.ts
842
- function Ye(e, t) {
853
+ function Ze(e, t) {
843
854
  return t === void 0 ? {} : { [e]: t };
844
855
  }
845
- function Xe(e) {
856
+ function Qe(e) {
846
857
  return !!e && typeof e == "object" && !Array.isArray(e);
847
858
  }
848
859
  function X(e) {
849
860
  return typeof e == "boolean";
850
861
  }
851
- function Ze(e) {
852
- if (!Xe(e)) return null;
862
+ function $e(e) {
863
+ if (!Qe(e)) return null;
853
864
  let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
854
- return !Xe(t) || !Xe(n) || !Xe(r) || !Xe(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
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 : {
855
866
  speech: {
856
867
  input: t.input,
857
868
  output: t.output,
@@ -862,8 +873,8 @@ function Ze(e) {
862
873
  tools: { enabled: i.enabled }
863
874
  };
864
875
  }
865
- function Qe(e) {
866
- return !Xe(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
876
+ function et(e) {
877
+ return !Qe(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
867
878
  speech: {
868
879
  input: e.speechInput,
869
880
  output: e.speechOutput,
@@ -874,12 +885,12 @@ function Qe(e) {
874
885
  tools: { enabled: e.tools }
875
886
  };
876
887
  }
877
- function $e(e) {
878
- return Ze(e) ?? Qe(e);
888
+ function tt(e) {
889
+ return $e(e) ?? et(e);
879
890
  }
880
- function et(e) {
881
- if (!Xe(e)) throw Error("Session Launch response is missing session.");
882
- 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 = $e(e.capabilities), l = tt(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;
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;
883
894
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
884
895
  return {
885
896
  id: t,
@@ -895,11 +906,11 @@ function et(e) {
895
906
  ...d ? { createdAt: d } : {}
896
907
  };
897
908
  }
898
- function tt(e) {
909
+ function rt(e) {
899
910
  if (!Array.isArray(e) || e.length === 0) return;
900
911
  let t = [];
901
912
  for (let n of e) {
902
- if (!Xe(n)) continue;
913
+ if (!Qe(n)) continue;
903
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() : "";
904
915
  !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
905
916
  axis: e,
@@ -910,35 +921,35 @@ function tt(e) {
910
921
  }
911
922
  return t.length > 0 ? t : void 0;
912
923
  }
913
- function nt(e) {
924
+ function it(e) {
914
925
  let t = e.localeVoiceFallbacks;
915
926
  if (t?.length) for (let e of t) {
916
927
  let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
917
928
  console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
918
929
  }
919
930
  }
920
- function rt(e) {
921
- if (!Xe(e)) throw Error("Session Launch response must be a JSON object.");
931
+ function at(e) {
932
+ if (!Qe(e)) throw Error("Session Launch response must be a JSON object.");
922
933
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
923
934
  if (!t) throw Error("Session Launch response is missing launch.");
924
- let n = et(e.session);
925
- return nt(n), {
935
+ let n = nt(e.session);
936
+ return it(n), {
926
937
  session: n,
927
938
  launch: t
928
939
  };
929
940
  }
930
941
  //#endregion
931
942
  //#region src/v2/api/mintPublicSession.ts
932
- function it() {
943
+ function ot() {
933
944
  try {
934
945
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
935
946
  } catch {}
936
947
  }
937
- function at(e) {
948
+ function st(e) {
938
949
  return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
939
950
  }
940
- function ot(e, t) {
941
- let n = it(), r = at(t.code), i = t.message.trim(), a = t.details ?? {};
951
+ function ct(e, t) {
952
+ let n = ot(), r = st(t.code), i = t.message.trim(), a = t.details ?? {};
942
953
  if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
943
954
  if (i.includes(e) && i.includes("allowed origin")) return t;
944
955
  let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
@@ -961,38 +972,38 @@ function ot(e, t) {
961
972
  details: a
962
973
  }) : t;
963
974
  }
964
- function st(e) {
975
+ function lt(e) {
965
976
  let t = e?.locale?.trim();
966
977
  if (t) return t;
967
978
  let n = e?.language?.trim();
968
979
  if (n) return n;
969
980
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
970
981
  }
971
- function ct(e) {
982
+ function ut(e) {
972
983
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
973
984
  if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
974
985
  return t || n || void 0;
975
986
  }
976
- function lt(e, t) {
977
- let n = { experienceId: e }, r = st(t);
987
+ function dt(e, t) {
988
+ let n = { experienceId: e }, r = lt(t);
978
989
  r && (n.locale = r);
979
- let i = ct(t);
990
+ let i = ut(t);
980
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);
981
- let a = Ge(t?.attribution);
992
+ let a = qe(t?.attribution);
982
993
  return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
983
994
  }
984
- async function ut(e, t) {
985
- let n = Le(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
995
+ async function ft(e, t) {
996
+ let n = ze(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
986
997
  method: "POST",
987
998
  headers: {
988
999
  "Content-Type": "application/json",
989
1000
  ...r ? { "Idempotency-Key": r } : {}
990
1001
  },
991
- body: JSON.stringify(lt(e, t))
1002
+ body: JSON.stringify(dt(e, t))
992
1003
  });
993
1004
  if (!i.ok) {
994
1005
  let t = await i.text();
995
- throw ot(e, Ve(i.status, t, i.headers));
1006
+ throw ct(e, Ue(i.status, t, i.headers));
996
1007
  }
997
1008
  let a;
998
1009
  try {
@@ -1004,10 +1015,10 @@ async function ut(e, t) {
1004
1015
  requestId: i.headers.get("Liforma-Request-Id") ?? void 0
1005
1016
  });
1006
1017
  }
1007
- return rt(a);
1018
+ return at(a);
1008
1019
  }
1009
- async function dt(e, t) {
1010
- let n = Je(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1020
+ async function pt(e, t) {
1021
+ let n = Xe(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1011
1022
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
1012
1023
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
1013
1024
  try {
@@ -1020,7 +1031,7 @@ async function dt(e, t) {
1020
1031
  }
1021
1032
  if (!o.ok) {
1022
1033
  let e = await o.text();
1023
- throw Ve(o.status, e, o.headers);
1034
+ throw Ue(o.status, e, o.headers);
1024
1035
  }
1025
1036
  if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
1026
1037
  code: "INVALID_RESPONSE",
@@ -1037,14 +1048,14 @@ async function dt(e, t) {
1037
1048
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
1038
1049
  });
1039
1050
  }
1040
- return rt(s);
1051
+ return at(s);
1041
1052
  }
1042
1053
  //#endregion
1043
1054
  //#region src/v2/conversationProcessor.ts
1044
- function ft(e) {
1055
+ function mt(e) {
1045
1056
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
1046
1057
  }
1047
- function pt(e) {
1058
+ function ht(e) {
1048
1059
  if (typeof e == "string") {
1049
1060
  let t = e.trim();
1050
1061
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -1058,24 +1069,24 @@ function pt(e) {
1058
1069
  ...e.behavior ? { behavior: e.behavior } : {}
1059
1070
  };
1060
1071
  }
1061
- async function mt(e, t) {
1072
+ async function gt(e, t) {
1062
1073
  let n = await e(t);
1063
- return ft(n) ? {
1074
+ return mt(n) ? {
1064
1075
  kind: "stream",
1065
1076
  stream: n
1066
1077
  } : {
1067
1078
  kind: "complete",
1068
- speech: pt(n)
1079
+ speech: ht(n)
1069
1080
  };
1070
1081
  }
1071
1082
  //#endregion
1072
1083
  //#region src/v2/embed/playerReachability.ts
1073
- var ht = "3002";
1074
- function gt(e) {
1084
+ var _t = "3002";
1085
+ function vt(e) {
1075
1086
  let t = new URL(e);
1076
- 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 || ht}. 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.`;
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.`;
1077
1088
  }
1078
- async function _t(e, t) {
1089
+ async function yt(e, t) {
1079
1090
  try {
1080
1091
  await fetch(e, {
1081
1092
  method: "GET",
@@ -1083,25 +1094,25 @@ async function _t(e, t) {
1083
1094
  signal: AbortSignal.timeout(8e3)
1084
1095
  });
1085
1096
  } catch {
1086
- throw Error(gt(t));
1097
+ throw Error(vt(t));
1087
1098
  }
1088
1099
  }
1089
- function vt(e, t, n, r) {
1100
+ function bt(e, t, n, r) {
1090
1101
  try {
1091
1102
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
1092
1103
  } catch (e) {
1093
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(gt(n), { cause: e }) : e;
1104
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(vt(n), { cause: e }) : e;
1094
1105
  }
1095
1106
  }
1096
- var yt = new Set([1, 2]);
1097
- function bt(e) {
1098
- return typeof e == "number" && yt.has(e);
1099
- }
1100
- var xt = 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("."));
1107
+ var xt = new Set([1, 2]);
1101
1108
  function St(e) {
1109
+ return typeof e == "number" && xt.has(e);
1110
+ }
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) {
1102
1113
  if (!e || typeof e != "object") return null;
1103
1114
  let t = e;
1104
- if (!bt(t.schemaVersion) || !t.type || !xt.has(t.type)) return null;
1115
+ if (!St(t.schemaVersion) || !t.type || !Ct.has(t.type)) return null;
1105
1116
  if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
1106
1117
  if (t.type === "fullWindow" || t.type === "theatre") {
1107
1118
  let e = t.payload;
@@ -1124,10 +1135,10 @@ function St(e) {
1124
1135
  let n = t.payload;
1125
1136
  return !n || typeof n != "object" ? null : t;
1126
1137
  }
1127
- function Ct(e, t) {
1138
+ function Tt(e, t) {
1128
1139
  return t === void 0 ? {} : { [e]: t };
1129
1140
  }
1130
- function wt(e, t, n) {
1141
+ function Et(e, t, n) {
1131
1142
  let r = e.trim();
1132
1143
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
1133
1144
  let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatre;
@@ -1141,34 +1152,34 @@ function wt(e, t, n) {
1141
1152
  ...a ? { theme: a } : {},
1142
1153
  ...o === void 0 ? {} : { showFeedback: o },
1143
1154
  ...s ? { interaction: s } : {},
1144
- ...Ct("settingsButton", n?.settingsButton),
1145
- ...Ct("theatreButton", n?.theatreButton),
1146
- ...Ct("fullscreenButton", n?.fullscreenButton),
1155
+ ...Tt("settingsButton", n?.settingsButton),
1156
+ ...Tt("theatreButton", n?.theatreButton),
1157
+ ...Tt("fullscreenButton", n?.fullscreenButton),
1147
1158
  ...c === void 0 ? {} : { theatre: c }
1148
1159
  }
1149
1160
  };
1150
1161
  }
1151
- function Tt() {
1162
+ function Dt() {
1152
1163
  return {
1153
1164
  type: "parentHello",
1154
1165
  schemaVersion: 2
1155
1166
  };
1156
1167
  }
1157
- function Et(e) {
1168
+ function Ot(e) {
1158
1169
  return {
1159
1170
  type: "widgetSetChrome",
1160
1171
  schemaVersion: 2,
1161
1172
  payload: { mode: e }
1162
1173
  };
1163
1174
  }
1164
- function Dt() {
1175
+ function kt() {
1165
1176
  return {
1166
1177
  type: "widgetToggleAudioSettings",
1167
1178
  schemaVersion: 2,
1168
1179
  payload: {}
1169
1180
  };
1170
1181
  }
1171
- function Ot(e) {
1182
+ function At(e) {
1172
1183
  return {
1173
1184
  type: "setTheatre",
1174
1185
  schemaVersion: 2,
@@ -1177,8 +1188,8 @@ function Ot(e) {
1177
1188
  }
1178
1189
  //#endregion
1179
1190
  //#region src/v2/embed/fullWindowHost.ts
1180
- var kt = "2147483000";
1181
- function At(e) {
1191
+ var jt = "2147483000";
1192
+ function Mt(e) {
1182
1193
  let { style: t } = e;
1183
1194
  return {
1184
1195
  position: t.position,
@@ -1196,11 +1207,11 @@ function At(e) {
1196
1207
  maxHeight: t.maxHeight
1197
1208
  };
1198
1209
  }
1199
- function jt(e) {
1210
+ function Nt(e) {
1200
1211
  let { style: t } = e;
1201
- 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 = kt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
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";
1202
1213
  }
1203
- function Mt(e, t) {
1214
+ function Pt(e, t) {
1204
1215
  if (delete e.dataset.liformaFullWindow, !t) {
1205
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 = "";
1206
1217
  return;
@@ -1210,20 +1221,20 @@ function Mt(e, t) {
1210
1221
  }
1211
1222
  //#endregion
1212
1223
  //#region src/v2/embed/iframeHost.ts
1213
- function Nt(e) {
1224
+ function Ft(e) {
1214
1225
  return e;
1215
1226
  }
1216
1227
  function Z() {
1217
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)}`;
1218
1229
  }
1219
- var Pt = 3e4;
1220
- function Ft(e) {
1230
+ var It = 3e4;
1231
+ function Lt(e) {
1221
1232
  let t = e.container;
1222
1233
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
1223
1234
  let n = document.createElement("iframe");
1224
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");
1225
1236
  let r = !1, i = !1, a = null, o = null, s = (r) => {
1226
- i !== r && (i = r, r ? (a = At(n), o = document.body.style.overflow, document.body.append(n), jt(n), document.body.style.overflow = "hidden") : (t.append(n), Mt(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
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));
1227
1238
  }, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
1228
1239
  p = e, m = t;
1229
1240
  }), g = () => {
@@ -1234,10 +1245,10 @@ function Ft(e) {
1234
1245
  let i = Date.now();
1235
1246
  if (d > 0 && i - d < 250) return;
1236
1247
  d = i, g();
1237
- let a = wt(t.launch, t.session, t.chrome), o = () => {
1248
+ let a = Et(t.launch, t.session, t.chrome), o = () => {
1238
1249
  if (r) return;
1239
1250
  let t = n.contentWindow;
1240
- t && vt(t, a, e.playerOrigin);
1251
+ t && bt(t, a, e.playerOrigin);
1241
1252
  };
1242
1253
  o();
1243
1254
  for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
@@ -1245,17 +1256,17 @@ function Ft(e) {
1245
1256
  r || !l || _(l);
1246
1257
  }, y = () => {
1247
1258
  if (u += 1, u === 1) {
1248
- _t(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1259
+ yt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1249
1260
  return;
1250
1261
  }
1251
1262
  d = 0, v();
1252
1263
  }, b = () => {
1253
- u > 0 || m?.(Error(gt(e.playerOrigin)));
1264
+ u > 0 || m?.(Error(vt(e.playerOrigin)));
1254
1265
  };
1255
1266
  n.addEventListener("load", y), n.addEventListener("error", b);
1256
1267
  let x = (t) => {
1257
1268
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
1258
- let i = St(t.data);
1269
+ let i = wt(t.data);
1259
1270
  if (i) switch (i.type) {
1260
1271
  case "close":
1261
1272
  e.onClose?.(i.payload);
@@ -1294,7 +1305,7 @@ function Ft(e) {
1294
1305
  e.onUserSpeechEnded?.(i.payload);
1295
1306
  break;
1296
1307
  case "modeChange":
1297
- e.onActivityChange?.(Nt(i.payload.mode));
1308
+ e.onActivityChange?.(Ft(i.payload.mode));
1298
1309
  break;
1299
1310
  case "activityChange":
1300
1311
  e.onActivityChange?.(i.payload.activity);
@@ -1353,8 +1364,8 @@ function Ft(e) {
1353
1364
  let S = (t, i) => {
1354
1365
  if (r) return;
1355
1366
  let a = n.contentWindow;
1356
- if (!a) throw Error(gt(e.playerOrigin));
1357
- vt(a, t, e.playerOrigin, i);
1367
+ if (!a) throw Error(vt(e.playerOrigin));
1368
+ bt(a, t, e.playerOrigin, i);
1358
1369
  }, C = (e, t = 12e4, n) => {
1359
1370
  let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
1360
1371
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
@@ -1371,7 +1382,7 @@ function Ft(e) {
1371
1382
  return h;
1372
1383
  },
1373
1384
  postParentHello() {
1374
- S(Tt());
1385
+ S(Dt());
1375
1386
  },
1376
1387
  postLaunch(e, t, n) {
1377
1388
  r || (l = {
@@ -1393,13 +1404,13 @@ function Ft(e) {
1393
1404
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1394
1405
  },
1395
1406
  postWidgetSetChrome(e) {
1396
- S(Et(e));
1407
+ S(Ot(e));
1397
1408
  },
1398
1409
  postWidgetToggleAudioSettings() {
1399
- S(Dt());
1410
+ S(kt());
1400
1411
  },
1401
1412
  postSetTheatre(e) {
1402
- S(Ot(e));
1413
+ S(At(e));
1403
1414
  },
1404
1415
  speak(e) {
1405
1416
  return C({
@@ -1521,7 +1532,7 @@ function Ft(e) {
1521
1532
  audio: e.audio,
1522
1533
  byteLength: e.byteLength
1523
1534
  }
1524
- }, Pt, [e.audio]);
1535
+ }, It, [e.audio]);
1525
1536
  },
1526
1537
  speechUtteranceSetTranscript(e) {
1527
1538
  return C({
@@ -1683,7 +1694,7 @@ function Ft(e) {
1683
1694
  }
1684
1695
  //#endregion
1685
1696
  //#region src/v2/embed/readyGate.ts
1686
- function It(e) {
1697
+ function Rt(e) {
1687
1698
  let t, n = !1, r = !1, i = () => {
1688
1699
  r || !n || t === void 0 || (r = !0, e(t));
1689
1700
  };
@@ -1698,9 +1709,9 @@ function It(e) {
1698
1709
  }
1699
1710
  //#endregion
1700
1711
  //#region src/v2/sdkRelease.ts
1701
- var Lt = `sdk@${{
1712
+ var zt = `sdk@${{
1702
1713
  name: "@liforma/client",
1703
- version: "0.4.15",
1714
+ version: "0.4.16",
1704
1715
  type: "module",
1705
1716
  description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
1706
1717
  license: "MIT",
@@ -1922,54 +1933,54 @@ var Lt = `sdk@${{
1922
1933
  vitest: "^4.1.10",
1923
1934
  wrangler: "^4.101.0"
1924
1935
  }
1925
- }.version}`, Rt = "https://player.liforma.ai/embed", zt = "http://localhost:3002/embed";
1926
- function Bt() {
1936
+ }.version}`, Bt = "https://player.liforma.ai/embed", Vt = "http://localhost:3002/embed";
1937
+ function Ht() {
1927
1938
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1928
1939
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1929
1940
  if (typeof document > "u") return null;
1930
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();
1931
1942
  return t ? t.replace(/\/$/, "") : null;
1932
1943
  }
1933
- function Vt() {
1934
- let e = Bt();
1935
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : te() ? zt : Rt;
1944
+ function Ut() {
1945
+ let e = Ht();
1946
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : L() ? Vt : Bt;
1936
1947
  }
1937
- function Ht(e, t) {
1948
+ function Wt(e, t) {
1938
1949
  return e?.trim() || t?.trim() || void 0;
1939
1950
  }
1940
- function Ut(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1941
- let p = (e ?? Vt()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
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();
1942
1953
  g && h.searchParams.set("backdropId", g);
1943
1954
  let _ = r?.trim();
1944
1955
  _ && h.searchParams.set("avatarId", _);
1945
1956
  let v = d?.trim();
1946
1957
  v && h.searchParams.set("previewBg", v);
1947
1958
  let y = f?.trim();
1948
- 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)), Wt(h.toString());
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());
1949
1960
  }
1950
- function Wt(e) {
1961
+ function Kt(e) {
1951
1962
  if (typeof location > "u") return e;
1952
1963
  let t = new URL(e);
1953
1964
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1954
1965
  }
1955
- function Gt(e) {
1966
+ function qt(e) {
1956
1967
  return new URL(e).origin;
1957
1968
  }
1958
1969
  //#endregion
1959
1970
  //#region src/v2/experienceEvents.ts
1960
- function Kt() {
1971
+ function Jt() {
1961
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)}`;
1962
1973
  }
1963
- function qt(e, t, n) {
1974
+ function Yt(e, t, n) {
1964
1975
  return {
1965
- id: Kt(),
1976
+ id: Jt(),
1966
1977
  type: e,
1967
1978
  sessionId: t,
1968
1979
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1969
1980
  data: n
1970
1981
  };
1971
1982
  }
1972
- function Jt() {
1983
+ function Xt() {
1973
1984
  return {
1974
1985
  ready: /* @__PURE__ */ new Set(),
1975
1986
  started: /* @__PURE__ */ new Set(),
@@ -1990,39 +2001,39 @@ function Jt() {
1990
2001
  conversationProcessorError: /* @__PURE__ */ new Set()
1991
2002
  };
1992
2003
  }
1993
- function Yt(e, t, n) {
2004
+ function Zt(e, t, n) {
1994
2005
  return e[t].add(n), () => e[t].delete(n);
1995
2006
  }
1996
- function Xt(e, t, n) {
2007
+ function Qt(e, t, n) {
1997
2008
  for (let r of e[t]) r(n);
1998
2009
  }
1999
- function Zt(e) {
2010
+ function $t(e) {
2000
2011
  for (let t of Object.keys(e)) e[t].clear();
2001
2012
  }
2002
2013
  //#endregion
2003
2014
  //#region src/v2/speech/types.ts
2004
- function Qt(e) {
2015
+ function en(e) {
2005
2016
  return "data" in e && "format" in e && e.format != null && !("track" in e);
2006
2017
  }
2007
- function $t(e) {
2018
+ function tn(e) {
2008
2019
  return "url" in e && typeof e.url == "string";
2009
2020
  }
2010
- function en(e) {
2021
+ function nn(e) {
2011
2022
  if (!("track" in e)) return !1;
2012
2023
  let t = e.track;
2013
2024
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
2014
2025
  }
2015
- function tn(e) {
2016
- return !Qt(e) && !$t(e) && !en(e) && "encoding" in e && typeof e.encoding == "string";
2026
+ function rn(e) {
2027
+ return !en(e) && !tn(e) && !nn(e) && "encoding" in e && typeof e.encoding == "string";
2017
2028
  }
2018
- var nn = [
2029
+ var an = [
2019
2030
  8e3,
2020
2031
  16e3,
2021
2032
  22050,
2022
2033
  24e3,
2023
2034
  44100,
2024
2035
  48e3
2025
- ], rn = {
2036
+ ], on = {
2026
2037
  MAX_CHUNK_BYTES: 64 * 1024,
2027
2038
  RECOMMENDED_CHUNK_MS_MIN: 20,
2028
2039
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -2033,14 +2044,14 @@ var nn = [
2033
2044
  MAX_UTTERANCE_DURATION_MS: 9e4,
2034
2045
  MAX_PENDING_WRITES: 8,
2035
2046
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
2036
- }, an = class extends Error {
2047
+ }, sn = class extends Error {
2037
2048
  operation;
2038
2049
  requiredCapability;
2039
2050
  name = "UnsupportedSpeechOperationError";
2040
2051
  constructor(e, t) {
2041
2052
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
2042
2053
  }
2043
- }, on = class extends Error {
2054
+ }, cn = class extends Error {
2044
2055
  name = "SpeechUtteranceClosedError";
2045
2056
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
2046
2057
  super(e);
@@ -2050,72 +2061,72 @@ var nn = [
2050
2061
  constructor(e, t) {
2051
2062
  super(e, t);
2052
2063
  }
2053
- }, sn = class extends Error {
2064
+ }, ln = class extends Error {
2054
2065
  name = "SpeechBufferTimeoutError";
2055
2066
  constructor(e = "Timed out waiting for speech buffer capacity.") {
2056
2067
  super(e);
2057
2068
  }
2058
2069
  };
2059
- function cn(e = "none") {
2070
+ function un(e = "none") {
2060
2071
  return {
2061
2072
  mode: e,
2062
2073
  trackedDurationMs: 0,
2063
2074
  fallbackDurationMs: 0
2064
2075
  };
2065
2076
  }
2066
- function ln(e) {
2067
- return nn.includes(e);
2077
+ function dn(e) {
2078
+ return an.includes(e);
2068
2079
  }
2069
- function un(e) {
2080
+ function fn(e) {
2070
2081
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
2071
2082
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
2072
- if (!ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2083
+ if (!dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2073
2084
  }
2074
- function dn(e) {
2075
- if (Qt(e)) {
2076
- un(e.format);
2085
+ function pn(e) {
2086
+ if (en(e)) {
2087
+ fn(e.format);
2077
2088
  return;
2078
2089
  }
2079
- if ($t(e)) {
2090
+ if (tn(e)) {
2080
2091
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
2081
- if (e.sampleRate !== void 0 && !ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2092
+ if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2082
2093
  return;
2083
2094
  }
2084
- if (en(e)) {
2095
+ if (nn(e)) {
2085
2096
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
2086
- if (e.sampleRate !== void 0 && !ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2097
+ if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2087
2098
  return;
2088
2099
  }
2089
- if (tn(e)) {
2100
+ if (rn(e)) {
2090
2101
  let t = e.encoding.trim().toLowerCase();
2091
2102
  if (!t) throw new Q("Encoded audio MIME type is required.");
2092
2103
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
2093
- if (e.sampleRate !== void 0 && !ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2104
+ if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2094
2105
  return;
2095
2106
  }
2096
2107
  throw new Q("Unsupported speech.play audio shape.");
2097
2108
  }
2098
- function fn(e) {
2099
- if (e.format) return un(e.format), e.format;
2109
+ function mn(e) {
2110
+ if (e.format) return fn(e.format), e.format;
2100
2111
  if (e.track) {
2101
2112
  let t = {
2102
2113
  encoding: "pcm_s16le",
2103
2114
  sampleRate: e.sampleRate ?? 24e3,
2104
2115
  channels: 1
2105
2116
  };
2106
- return un(t), t;
2117
+ return fn(t), t;
2107
2118
  }
2108
2119
  throw new Q("createUtterance requires format or track.");
2109
2120
  }
2110
- function pn(e) {
2121
+ function hn(e) {
2111
2122
  return e instanceof Uint8Array ? e : new Uint8Array(e);
2112
2123
  }
2113
- function mn(e) {
2124
+ function gn(e) {
2114
2125
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
2115
2126
  }
2116
2127
  //#endregion
2117
2128
  //#region src/byo/pcm.ts
2118
- function hn(e) {
2129
+ function _n(e) {
2119
2130
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
2120
2131
  for (let t = 0; t < e.length; t++) {
2121
2132
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -2125,11 +2136,11 @@ function hn(e) {
2125
2136
  }
2126
2137
  //#endregion
2127
2138
  //#region src/byo/resample.ts
2128
- function gn(e, t, n, r, i) {
2139
+ function vn(e, t, n, r, i) {
2129
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;
2130
2141
  return ((a * i + o) * i + s) * i + c;
2131
2142
  }
2132
- function _n(e, t) {
2143
+ function yn(e, t) {
2133
2144
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
2134
2145
  if (e === t) return {
2135
2146
  fromRate: e,
@@ -2152,7 +2163,7 @@ function _n(e, t) {
2152
2163
  let a = [];
2153
2164
  for (; i + 2 < r.length - 1;) {
2154
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);
2155
- a.push(gn(r[o], r[e], r[s], r[c], t)), i += n;
2166
+ a.push(vn(r[o], r[e], r[s], r[c], t)), i += n;
2156
2167
  }
2157
2168
  let o = Math.max(0, Math.floor(i) - 1);
2158
2169
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -2164,7 +2175,7 @@ function _n(e, t) {
2164
2175
  }
2165
2176
  //#endregion
2166
2177
  //#region src/byo/audioCapture.ts
2167
- var vn = "liforma-pcm-capture", yn = `
2178
+ var bn = "liforma-pcm-capture", xn = `
2168
2179
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2169
2180
  process(inputs) {
2170
2181
  const ch = inputs[0] && inputs[0][0];
@@ -2176,29 +2187,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2176
2187
  return true;
2177
2188
  }
2178
2189
  }
2179
- registerProcessor('${vn}', LiformaPcmCaptureProcessor);
2180
- `, bn = null;
2181
- function xn() {
2182
- return bn ||= URL.createObjectURL(new Blob([yn], { type: "application/javascript" })), bn;
2190
+ registerProcessor('${bn}', LiformaPcmCaptureProcessor);
2191
+ `, Sn = null;
2192
+ function Cn() {
2193
+ return Sn ||= URL.createObjectURL(new Blob([xn], { type: "application/javascript" })), Sn;
2183
2194
  }
2184
- function Sn() {
2195
+ function wn() {
2185
2196
  return window.AudioContext || window.webkitAudioContext || null;
2186
2197
  }
2187
- async function Cn(e) {
2188
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Sn();
2198
+ async function Tn(e) {
2199
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = wn();
2189
2200
  if (!o) throw Error("Web Audio is required for audio capture");
2190
2201
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
2191
2202
  l.gain.value = 0;
2192
- let u = s.sampleRate, d = _n(u, n), f = !1, p = !1, m = (e) => {
2203
+ let u = s.sampleRate, d = yn(u, n), f = !1, p = !1, m = (e) => {
2193
2204
  if (f || i && !i()) return;
2194
2205
  let t = d.push(e);
2195
- t.length !== 0 && r(hn(t));
2206
+ t.length !== 0 && r(_n(t));
2196
2207
  }, h = () => void 0;
2197
2208
  return await (async () => {
2198
2209
  if (typeof s.audioWorklet?.addModule != "function") return !1;
2199
2210
  try {
2200
- await s.audioWorklet.addModule(xn());
2201
- let e = new AudioWorkletNode(s, vn, {
2211
+ await s.audioWorklet.addModule(Cn());
2212
+ let e = new AudioWorkletNode(s, bn, {
2202
2213
  numberOfInputs: 1,
2203
2214
  numberOfOutputs: 1,
2204
2215
  outputChannelCount: [1]
@@ -2248,7 +2259,7 @@ async function Cn(e) {
2248
2259
  }
2249
2260
  //#endregion
2250
2261
  //#region src/v2/speech/captureMediaStreamTrack.ts
2251
- async function wn(e) {
2262
+ async function En(e) {
2252
2263
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
2253
2264
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
2254
2265
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -2257,18 +2268,18 @@ async function wn(e) {
2257
2268
  s || (s = !0, c?.stop(), c = null);
2258
2269
  };
2259
2270
  try {
2260
- c = await Cn({
2271
+ c = await Tn({
2261
2272
  mediaStream: a,
2262
2273
  targetSampleRate: r,
2263
2274
  shouldSend: () => !s && !i?.aborted,
2264
2275
  onPcm: (e) => {
2265
2276
  if (s || i?.aborted) return;
2266
- let t = pn(e);
2277
+ let t = hn(e);
2267
2278
  o = o.then(async () => {
2268
2279
  if (s || i?.aborted) return;
2269
2280
  let e = 0;
2270
2281
  for (; e < t.byteLength;) {
2271
- let r = Math.min(e + rn.MAX_CHUNK_BYTES, t.byteLength);
2282
+ let r = Math.min(e + on.MAX_CHUNK_BYTES, t.byteLength);
2272
2283
  if ((r - e) % 2 == 1 && --r, r <= e) break;
2273
2284
  let i = t.subarray(e, r);
2274
2285
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -2292,10 +2303,10 @@ async function wn(e) {
2292
2303
  }
2293
2304
  //#endregion
2294
2305
  //#region src/v2/speech/speechController.ts
2295
- async function Tn(e, t) {
2296
- if (en(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2297
- if (Qt(e)) {
2298
- let t = pn(e.data);
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);
2299
2310
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
2300
2311
  return {
2301
2312
  kind: "pcm",
@@ -2303,17 +2314,17 @@ async function Tn(e, t) {
2303
2314
  format: e.format
2304
2315
  };
2305
2316
  }
2306
- if ($t(e)) return {
2317
+ if (tn(e)) return {
2307
2318
  kind: "url",
2308
2319
  url: e.url.trim(),
2309
2320
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2310
2321
  };
2311
- if (!tn(e)) throw new Q("Unsupported speech.play audio shape.");
2322
+ if (!rn(e)) throw new Q("Unsupported speech.play audio shape.");
2312
2323
  let n;
2313
2324
  if (typeof Blob < "u" && e.data instanceof Blob) {
2314
2325
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
2315
2326
  n = new Uint8Array(await e.data.arrayBuffer());
2316
- } else n = pn(e.data);
2327
+ } else n = hn(e.data);
2317
2328
  return {
2318
2329
  kind: "encoded",
2319
2330
  data: n.slice().buffer,
@@ -2321,10 +2332,10 @@ async function Tn(e, t) {
2321
2332
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2322
2333
  };
2323
2334
  }
2324
- function En() {
2335
+ function On() {
2325
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)}`;
2326
2337
  }
2327
- function Dn(e, t = "completed") {
2338
+ function kn(e, t = "completed") {
2328
2339
  return {
2329
2340
  utteranceId: e.speechId,
2330
2341
  characterId: e.characterId,
@@ -2338,13 +2349,13 @@ function Dn(e, t = "completed") {
2338
2349
  }
2339
2350
  };
2340
2351
  }
2341
- function On(e) {
2352
+ function An(e) {
2342
2353
  return e instanceof Error ? e : new Q(String(e));
2343
2354
  }
2344
- function kn(e) {
2355
+ function jn(e) {
2345
2356
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
2346
2357
  }
2347
- var An = class {
2358
+ var Mn = class {
2348
2359
  id;
2349
2360
  characterId;
2350
2361
  result;
@@ -2373,29 +2384,29 @@ var An = class {
2373
2384
  queue: e.queue,
2374
2385
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
2375
2386
  }).catch((e) => {
2376
- throw this.fail(On(e)), On(e);
2387
+ throw this.fail(An(e)), An(e);
2377
2388
  }), this.signal?.addEventListener("abort", () => {
2378
2389
  this.cancel();
2379
2390
  }, { once: !0 });
2380
2391
  }
2381
2392
  async write(e, t) {
2382
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new on();
2383
- let n = pn(e);
2393
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new cn();
2394
+ let n = hn(e);
2384
2395
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
2385
- if (n.byteLength > rn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${rn.MAX_CHUNK_BYTES}).`);
2396
+ if (n.byteLength > on.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${on.MAX_CHUNK_BYTES}).`);
2386
2397
  if (n.byteLength === 0) return;
2387
- let r = t?.timeoutMs ?? rn.DEFAULT_WRITE_TIMEOUT_MS;
2398
+ let r = t?.timeoutMs ?? on.DEFAULT_WRITE_TIMEOUT_MS;
2388
2399
  await this.acquireWriteSlot(r);
2389
2400
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
2390
- if (this.bufferedMs + i > rn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2401
+ if (this.bufferedMs + i > on.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2391
2402
  let a = async () => {
2392
- if (this.closed || this.settled) throw new on();
2403
+ if (this.closed || this.settled) throw new cn();
2393
2404
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
2394
2405
  utteranceId: this.id,
2395
2406
  audio: t.buffer,
2396
2407
  byteLength: t.byteLength
2397
2408
  }), a = await Promise.race([i, new Promise((e, t) => {
2398
- setTimeout(() => t(new sn()), r);
2409
+ setTimeout(() => t(new ln()), r);
2399
2410
  })]);
2400
2411
  this.bufferedMs = Math.max(0, a.bufferedMs);
2401
2412
  }, o = this.writeChain.then(a, a);
@@ -2407,7 +2418,7 @@ var An = class {
2407
2418
  }
2408
2419
  }
2409
2420
  async setTranscript(e) {
2410
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new on();
2421
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new cn();
2411
2422
  await this.requireHost().speechUtteranceSetTranscript({
2412
2423
  utteranceId: this.id,
2413
2424
  transcript: e
@@ -2424,7 +2435,7 @@ var An = class {
2424
2435
  });
2425
2436
  return this.resolve(t), t;
2426
2437
  } catch (e) {
2427
- let t = On(e);
2438
+ let t = An(e);
2428
2439
  throw this.fail(t), t;
2429
2440
  }
2430
2441
  }
@@ -2442,11 +2453,11 @@ var An = class {
2442
2453
  characterId: this.characterId,
2443
2454
  status: "cancelled",
2444
2455
  durationMs: 0,
2445
- animation: cn("none")
2456
+ animation: un("none")
2446
2457
  };
2447
2458
  return this.resolve(t), t;
2448
2459
  } catch (e) {
2449
- let t = On(e);
2460
+ let t = An(e);
2450
2461
  throw this.fail(t), t;
2451
2462
  }
2452
2463
  }
@@ -2459,19 +2470,19 @@ var An = class {
2459
2470
  return e;
2460
2471
  }
2461
2472
  resolve(e) {
2462
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new on()));
2473
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new cn()));
2463
2474
  }
2464
2475
  fail(e) {
2465
2476
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
2466
2477
  }
2467
2478
  async acquireWriteSlot(e) {
2468
- if (this.pendingWriteCount < rn.MAX_PENDING_WRITES) {
2479
+ if (this.pendingWriteCount < on.MAX_PENDING_WRITES) {
2469
2480
  this.pendingWriteCount += 1;
2470
2481
  return;
2471
2482
  }
2472
2483
  await new Promise((t, n) => {
2473
2484
  let r = setTimeout(() => {
2474
- n(new sn());
2485
+ n(new ln());
2475
2486
  }, e);
2476
2487
  this.pendingWriteWaiters.push({
2477
2488
  resolve: () => {
@@ -2490,13 +2501,13 @@ var An = class {
2490
2501
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2491
2502
  }
2492
2503
  };
2493
- function jn(e) {
2504
+ function Nn(e) {
2494
2505
  let t = null, n = (t, n) => {
2495
- if (!e.getCapabilities()[n]) throw new an(t, n);
2506
+ if (!e.getCapabilities()[n]) throw new sn(t, n);
2496
2507
  }, r = {
2497
2508
  async speak(r) {
2498
2509
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2499
- let i = mn(r.queue ?? "append");
2510
+ let i = gn(r.queue ?? "append");
2500
2511
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2501
2512
  let a = e.getIframeHost();
2502
2513
  if (!a) throw new Q("Speech session is not attached.");
@@ -2516,41 +2527,41 @@ function jn(e) {
2516
2527
  return;
2517
2528
  }
2518
2529
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2519
- t.removeEventListener("abort", s), n(Dn(e, "completed"));
2530
+ t.removeEventListener("abort", s), n(kn(e, "completed"));
2520
2531
  }, (a) => {
2521
- if (t.removeEventListener("abort", s), kn(a)) {
2532
+ if (t.removeEventListener("abort", s), jn(a)) {
2522
2533
  n({
2523
2534
  utteranceId: "utt_interrupted",
2524
2535
  characterId: r.characterId ?? e.getActiveCharacterId(),
2525
2536
  status: "interrupted",
2526
2537
  durationMs: 0,
2527
2538
  transcript: r.text,
2528
- animation: cn("none")
2539
+ animation: un("none")
2529
2540
  });
2530
2541
  return;
2531
2542
  }
2532
- i(On(a));
2543
+ i(An(a));
2533
2544
  });
2534
2545
  });
2535
2546
  }
2536
2547
  try {
2537
- return Dn(await o, "completed");
2548
+ return kn(await o, "completed");
2538
2549
  } catch (t) {
2539
- if (kn(t)) return {
2550
+ if (jn(t)) return {
2540
2551
  utteranceId: "utt_interrupted",
2541
2552
  characterId: r.characterId ?? e.getActiveCharacterId(),
2542
2553
  status: "interrupted",
2543
2554
  durationMs: 0,
2544
2555
  transcript: r.text,
2545
- animation: cn("none")
2556
+ animation: un("none")
2546
2557
  };
2547
- throw On(t);
2558
+ throw An(t);
2548
2559
  }
2549
2560
  },
2550
2561
  async play(i) {
2551
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), dn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2562
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), pn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2552
2563
  let a = i.queue ?? "append";
2553
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), en(i.audio)) {
2564
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), nn(i.audio)) {
2554
2565
  let e = i.audio.sampleRate ?? 24e3;
2555
2566
  return r.createUtterance({
2556
2567
  format: {
@@ -2566,7 +2577,7 @@ function jn(e) {
2566
2577
  }
2567
2578
  let o = e.getIframeHost();
2568
2579
  if (!o) throw new Q("Speech session is not attached.");
2569
- let s = await Tn(i.audio, i.signal);
2580
+ let s = await Dn(i.audio, i.signal);
2570
2581
  return o.speechPlay({
2571
2582
  source: s,
2572
2583
  characterId: i.characterId,
@@ -2578,13 +2589,13 @@ function jn(e) {
2578
2589
  },
2579
2590
  createUtterance(r) {
2580
2591
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2581
- let i = fn(r);
2592
+ let i = mn(r);
2582
2593
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2583
2594
  let a = r.queue ?? "replace-active";
2584
2595
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2585
2596
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2586
- let o = new An({
2587
- id: En(),
2597
+ let o = new Mn({
2598
+ id: On(),
2588
2599
  characterId: r.characterId ?? e.getActiveCharacterId(),
2589
2600
  format: i,
2590
2601
  queue: a,
@@ -2596,7 +2607,7 @@ function jn(e) {
2596
2607
  t === o && (t = null);
2597
2608
  }), r.track && (async () => {
2598
2609
  try {
2599
- if (await wn({
2610
+ if (await En({
2600
2611
  track: r.track,
2601
2612
  utterance: o,
2602
2613
  sampleRate: i.sampleRate,
@@ -2624,16 +2635,16 @@ function jn(e) {
2624
2635
  }
2625
2636
  //#endregion
2626
2637
  //#region src/v2/types/sessionInteraction.ts
2627
- function Mn(e) {
2638
+ function Pn(e) {
2628
2639
  let t = e?.trim();
2629
2640
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2630
2641
  }
2631
2642
  //#endregion
2632
2643
  //#region src/v2/experience.ts
2633
- function Nn(e) {
2644
+ function Fn(e) {
2634
2645
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2635
2646
  }
2636
- var Pn = class e {
2647
+ var In = class e {
2637
2648
  bootstrap;
2638
2649
  conversationProcessor;
2639
2650
  iframeHost = null;
@@ -2653,17 +2664,17 @@ var Pn = class e {
2653
2664
  pendingTheatre = null;
2654
2665
  lastInteraction = null;
2655
2666
  closeHandlers = [];
2656
- eventRegistry = Jt();
2667
+ eventRegistry = Xt();
2657
2668
  readyEnvelope = null;
2658
2669
  startedEnvelope = null;
2659
2670
  sessionMintedEnvelope = null;
2660
2671
  conversationCache = [];
2661
2672
  speech;
2662
2673
  constructor(e) {
2663
- 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 = jn({
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({
2664
2675
  getIframeHost: () => this.iframeHost,
2665
2676
  assertSessionStarted: () => this.assertSessionStarted(),
2666
- getCapabilities: () => Fn(this.resolvedSession),
2677
+ getCapabilities: () => Ln(this.resolvedSession),
2667
2678
  getActiveCharacterId: () => "character_unknown",
2668
2679
  onProcessorInterrupt: () => {
2669
2680
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2752,7 +2763,7 @@ var Pn = class e {
2752
2763
  return null;
2753
2764
  }
2754
2765
  on(e, t) {
2755
- let n = Yt(this.eventRegistry, e, t);
2766
+ let n = Zt(this.eventRegistry, e, t);
2756
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;
2757
2768
  }
2758
2769
  async attach(e) {
@@ -2766,13 +2777,13 @@ var Pn = class e {
2766
2777
  if (this.closed) throw Error("Session has ended.");
2767
2778
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2768
2779
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2769
- let t = this.bootstrap.embedBaseUrl ?? Vt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Ut(t, n, r ? void 0 : Ht(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Nn(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 = Gt(i), o = null, s = new Promise((e) => {
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) => {
2770
2781
  o = e;
2771
2782
  }), c = null, l = new Promise((e) => {
2772
2783
  c = e;
2773
- }), u = It((e) => {
2784
+ }), u = Rt((e) => {
2774
2785
  this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2775
- }), d = this.bootstrap.onUserTranscript, f = Ft({
2786
+ }), d = this.bootstrap.onUserTranscript, f = Lt({
2776
2787
  container: e.container,
2777
2788
  src: i,
2778
2789
  playerOrigin: a,
@@ -2839,7 +2850,7 @@ var Pn = class e {
2839
2850
  onTheatreChange: (t) => e.onTheatreChange?.(t)
2840
2851
  });
2841
2852
  this.iframeHost = f;
2842
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), dt(this.bootstrap.sessionEndpoint, {
2853
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), pt(this.bootstrap.sessionEndpoint, {
2843
2854
  experienceId: this.bootstrap.experienceId,
2844
2855
  locale: this.bootstrap.locale,
2845
2856
  secondaryLocale: this.bootstrap.secondaryLocale,
@@ -2851,7 +2862,7 @@ var Pn = class e {
2851
2862
  attribution: this.bootstrap.attribution,
2852
2863
  alreadyConverted: this.bootstrap.alreadyConverted,
2853
2864
  signal: this.endpointAbortController.signal
2854
- })) : this.bootstrap.kind === "public" ? ut(this.bootstrap.experienceId, {
2865
+ })) : this.bootstrap.kind === "public" ? ft(this.bootstrap.experienceId, {
2855
2866
  locale: this.bootstrap.locale,
2856
2867
  secondaryLocale: this.bootstrap.secondaryLocale,
2857
2868
  learningLocale: this.bootstrap.learningLocale,
@@ -2875,7 +2886,7 @@ var Pn = class e {
2875
2886
  operation: "attach",
2876
2887
  message: e instanceof Error ? e.message : String(e),
2877
2888
  stack: e instanceof Error ? e.stack : void 0,
2878
- release: Lt
2889
+ release: zt
2879
2890
  });
2880
2891
  } catch {}
2881
2892
  throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
@@ -2887,23 +2898,23 @@ var Pn = class e {
2887
2898
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2888
2899
  this.launchToken = g;
2889
2900
  let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2890
- return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && nt(_), f.postLaunch(g, _, {
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, _, {
2891
2902
  startButton: e.startButton,
2892
2903
  theme: e.theme,
2893
2904
  showFeedback: e.showFeedback,
2894
2905
  interaction: e.interaction,
2895
- ...Ye("settingsButton", e.settingsButton),
2896
- ...Ye("theatreButton", e.theatreButton),
2897
- ...Ye("fullscreenButton", e.fullscreenButton),
2906
+ ...Ze("settingsButton", e.settingsButton),
2907
+ ...Ze("theatreButton", e.theatreButton),
2908
+ ...Ze("fullscreenButton", e.fullscreenButton),
2898
2909
  ...e.theatre === void 0 ? {} : { theatre: e.theatre }
2899
2910
  }), u.setValue(_)) : f.postLaunch(g, void 0, {
2900
2911
  startButton: e.startButton,
2901
2912
  theme: e.theme,
2902
2913
  showFeedback: e.showFeedback,
2903
2914
  interaction: e.interaction,
2904
- ...Ye("settingsButton", e.settingsButton),
2905
- ...Ye("theatreButton", e.theatreButton),
2906
- ...Ye("fullscreenButton", e.fullscreenButton),
2915
+ ...Ze("settingsButton", e.settingsButton),
2916
+ ...Ze("theatreButton", e.theatreButton),
2917
+ ...Ze("fullscreenButton", e.fullscreenButton),
2907
2918
  ...e.theatre === void 0 ? {} : { theatre: e.theatre }
2908
2919
  }), await Promise.race([s, new Promise((e, t) => {
2909
2920
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
@@ -2915,7 +2926,7 @@ var Pn = class e {
2915
2926
  operation: "attach",
2916
2927
  message: e instanceof Error ? e.message : String(e),
2917
2928
  stack: e instanceof Error ? e.stack : void 0,
2918
- release: Lt
2929
+ release: zt
2919
2930
  });
2920
2931
  } catch {}
2921
2932
  throw e;
@@ -2929,7 +2940,7 @@ var Pn = class e {
2929
2940
  operation: "attach",
2930
2941
  message: e instanceof Error ? e.message : String(e),
2931
2942
  stack: e instanceof Error ? e.stack : void 0,
2932
- release: Lt
2943
+ release: zt
2933
2944
  });
2934
2945
  } catch {}
2935
2946
  throw e;
@@ -2961,7 +2972,7 @@ var Pn = class e {
2961
2972
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2962
2973
  }
2963
2974
  async setFit(e) {
2964
- let t = Mn(e);
2975
+ let t = Pn(e);
2965
2976
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2966
2977
  if (this.closed) throw Error("Session has ended.");
2967
2978
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
@@ -3011,7 +3022,7 @@ var Pn = class e {
3011
3022
  this.close();
3012
3023
  }
3013
3024
  destroy() {
3014
- 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, Zt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
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);
3015
3026
  }
3016
3027
  resolveMintInteraction() {
3017
3028
  return this.bootstrap.kind === "launch" ? {} : {
@@ -3023,8 +3034,8 @@ var Pn = class e {
3023
3034
  return this.resolvedSession?.id ?? "";
3024
3035
  }
3025
3036
  emitWrapped(e, t) {
3026
- let n = qt(e, this.getSessionId(), t);
3027
- return Xt(this.eventRegistry, e, n), n;
3037
+ let n = Yt(e, this.getSessionId(), t);
3038
+ return Qt(this.eventRegistry, e, n), n;
3028
3039
  }
3029
3040
  queueProcessorTurn(e) {
3030
3041
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -3033,7 +3044,7 @@ var Pn = class e {
3033
3044
  let n = this.processorAbortController.signal;
3034
3045
  this.processorChain = this.processorChain.then(async () => {
3035
3046
  if (!n.aborted) try {
3036
- let r = await mt(t, {
3047
+ let r = await gt(t, {
3037
3048
  utteranceId: e.utteranceId,
3038
3049
  text: e.text,
3039
3050
  conversation: this.conversationCache,
@@ -3083,7 +3094,7 @@ var Pn = class e {
3083
3094
  };
3084
3095
  }
3085
3096
  };
3086
- function Fn(e) {
3097
+ function Ln(e) {
3087
3098
  return e ? {
3088
3099
  textSpeech: e.capabilities.speech.output,
3089
3100
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -3094,41 +3105,41 @@ function Fn(e) {
3094
3105
  }
3095
3106
  //#endregion
3096
3107
  //#region src/widget/dockGeometry.ts
3097
- var In = "(min-width: 768px)", Ln = 24, Rn = .5, zn = 1200, Bn = .85, Vn = 9 / 16;
3098
- function Hn() {
3108
+ var Rn = "(min-width: 768px)", zn = 24, Bn = .5, Vn = 1200, Hn = .85, Un = 9 / 16;
3109
+ function Wn() {
3099
3110
  if (typeof window > "u") return 800;
3100
3111
  let e = window.screen?.availHeight;
3101
3112
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
3102
3113
  }
3103
- function Un(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Ln, r = typeof window < "u" ? Hn() : 800) {
3104
- let i = Math.max(160, Math.min(t - n * 2, t * Bn)), a = Math.max(120, e - n * 2), o = Math.min(r * Rn, zn, i), s = o * Vn;
3105
- return s > a && (s = a, o = s / Vn, o > i && (o = i, s = o * Vn)), {
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)), {
3106
3117
  width: Math.round(s),
3107
3118
  height: Math.round(o)
3108
3119
  };
3109
3120
  }
3110
- function Wn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Ln) {
3121
+ function Kn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = zn) {
3111
3122
  return {
3112
3123
  left: Math.max(r, t - e.width - r),
3113
3124
  top: Math.max(r, n - e.height - r)
3114
3125
  };
3115
3126
  }
3116
- function Gn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Ln) {
3127
+ function qn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = zn) {
3117
3128
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
3118
3129
  return {
3119
3130
  left: Math.min(Math.max(a, e), o),
3120
3131
  top: Math.min(Math.max(a, t), s)
3121
3132
  };
3122
3133
  }
3123
- function Kn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3124
- return e(In).matches;
3134
+ function Jn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3135
+ return e(Rn).matches;
3125
3136
  }
3126
3137
  //#endregion
3127
3138
  //#region src/widget/mountExperienceWidget.ts
3128
- function qn(e) {
3139
+ function Yn(e) {
3129
3140
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
3130
3141
  }
3131
- function Jn(e) {
3142
+ function Xn(e) {
3132
3143
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
3133
3144
  let t = typeof e == "string" ? e.trim() : "";
3134
3145
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -3136,10 +3147,10 @@ function Jn(e) {
3136
3147
  function $(e) {
3137
3148
  return e === "expanded" || e === "docked";
3138
3149
  }
3139
- var Yn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", Xn = "<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>", 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=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Qn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
3140
- function $n(e, t, n) {
3141
- xe(ye);
3142
- let r = F({
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({
3143
3154
  galleryThumb: t.galleryThumb,
3144
3155
  avatarImage: t.avatarImage,
3145
3156
  backgroundImage: t.backgroundImage,
@@ -3165,9 +3176,9 @@ function $n(e, t, n) {
3165
3176
  let e = document.createElement("img");
3166
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);
3167
3178
  }
3168
- return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ve(i);
3179
+ return e.replaceChildren(i), n?.parallax === !1 ? () => {} : be(i);
3169
3180
  }
3170
- function er(e) {
3181
+ function nr(e) {
3171
3182
  return e.startButton ? {
3172
3183
  ...e.startButton,
3173
3184
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -3179,7 +3190,7 @@ function er(e) {
3179
3190
  variant: "primary"
3180
3191
  };
3181
3192
  }
3182
- function tr(e) {
3193
+ function rr(e) {
3183
3194
  let t = !1, n = () => {
3184
3195
  t || e();
3185
3196
  }, r = () => {
@@ -3199,12 +3210,12 @@ function tr(e) {
3199
3210
  t = !0, window.removeEventListener("load", r), i?.();
3200
3211
  };
3201
3212
  }
3202
- function nr(e, t) {
3203
- Pe(Me);
3213
+ function ir(e, t) {
3214
+ Fe(Pe);
3204
3215
  let n = t.experienceId?.trim();
3205
3216
  if (!n) throw Error("ExperienceWidget requires experienceId.");
3206
- let r = t.prefetch ?? "onExpand", i = qn(t.position), a = document.createElement("div");
3207
- 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", Jn(t.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));
3208
3219
  let o = document.createElement("button");
3209
3220
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
3210
3221
  let s = document.createElement("div");
@@ -3224,136 +3235,136 @@ function nr(e, t) {
3224
3235
  let m = document.createElement("span");
3225
3236
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
3226
3237
  let h = document.createElement("button");
3227
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Zn, h.setAttribute("aria-label", "Reduce");
3238
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = $n, h.setAttribute("aria-label", "Reduce");
3228
3239
  let g = document.createElement("button");
3229
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Yn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
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");
3230
3241
  let _ = document.createElement("button");
3231
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Xn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3242
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Qn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3232
3243
  let v = document.createElement("div");
3233
3244
  v.className = "liforma-ew__stage";
3234
3245
  let y = document.createElement("div");
3235
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);
3236
- let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, ee = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
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 = () => {
3237
3248
  let e = a.dataset.state;
3238
3249
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
3239
- }, z = () => {
3250
+ }, re = () => {
3240
3251
  M !== null && (clearTimeout(M), M = null);
3241
- }, B = () => {
3242
- ee !== null && (clearTimeout(ee), ee = null), a.classList.remove("liforma-ew--layout-settling");
3243
- }, ae = () => {
3252
+ }, ie = () => {
3253
+ N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
3254
+ }, V = () => {
3244
3255
  for (let e of [
3245
3256
  f,
3246
3257
  l,
3247
3258
  p
3248
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");
3249
3260
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
3250
- }, oe = (e, t, n, r) => {
3261
+ }, H = (e, t, n, r) => {
3251
3262
  let i = (i) => {
3252
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";
3253
3264
  };
3254
3265
  i(f), i(l);
3255
3266
  let a = p.offsetWidth || 120;
3256
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";
3257
- }, se = (e, t) => {
3258
- if (R() !== "docked") return;
3259
- let n = Un(), r = Gn(e - te, t - I, n);
3260
- N = r.left, P = r.top, oe(r.left, r.top, n.width, n.height);
3261
- }, ce = (e, t) => {
3262
- if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
3263
- let n = Un(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Gn(r + e, i + t, n);
3264
- N = a.left, P = a.top, oe(a.left, a.top, n.width, n.height);
3265
- }, le = (e) => {
3266
- L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), se(e.clientX, e.clientY)));
3267
- }, V = (e) => {
3268
- if (F === null || e && e.pointerId !== F) return;
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;
3269
3280
  let t = L;
3270
- F = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && ne && (ne = !1, window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
3271
- }, ue = (e, t, n) => {
3272
- if (S || R() !== "docked" || !Kn() || F !== null) return;
3273
- F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
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");
3274
3285
  let r = f.getBoundingClientRect();
3275
- te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", le), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
3276
- }, de = (e) => {
3277
- if (S || R() !== "docked" || !Kn() || F !== null) return;
3278
- F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
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");
3279
3290
  let t = f.getBoundingClientRect();
3280
- N = t.left, P = t.top;
3281
- }, fe = (e) => {
3282
- L === "player" && (F === null || e.pointerId !== F || ce(e.dx, e.dy));
3283
- }, pe = (e) => {
3284
- L === "player" && (F === null || e.pointerId !== F || V());
3285
- }, H = () => {
3286
- let e = Kn(), t = R();
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();
3287
3298
  if (!e || t !== "expanded" && t !== "docked") {
3288
3299
  h.hidden = !0;
3289
3300
  return;
3290
3301
  }
3291
- h.hidden = !1, t === "docked" ? (h.innerHTML = Qn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Zn, h.setAttribute("aria-label", "Reduce"));
3292
- }, me = (e) => {
3293
- let t = Un(), n = e && N !== null && P !== null ? Gn(N, P, t) : Wn(t);
3294
- n = Gn(n.left, n.top, t), N = n.left, P = n.top, oe(n.left, n.top, t.width, t.height), H();
3295
- }, U = () => {
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 = () => {
3296
3307
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
3297
3308
  requestAnimationFrame(() => {
3298
3309
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
3299
3310
  });
3300
3311
  });
3301
3312
  }, W = (e) => {
3302
- if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3313
+ if (ie(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3303
3314
  a.classList.remove("liforma-ew--layout-settling");
3304
3315
  return;
3305
3316
  }
3306
- ee = setTimeout(() => {
3307
- if (ee = null, S || !$(a.dataset.state)) {
3317
+ N = setTimeout(() => {
3318
+ if (N = null, S || !$(a.dataset.state)) {
3308
3319
  a.classList.remove("liforma-ew--layout-settling");
3309
3320
  return;
3310
3321
  }
3311
- a.classList.remove("liforma-ew--layout-settling"), U();
3322
+ a.classList.remove("liforma-ew--layout-settling"), me();
3312
3323
  }, 220);
3313
3324
  }, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
3314
- z(), M = setTimeout(() => {
3325
+ re(), M = setTimeout(() => {
3315
3326
  M = null, a.classList.remove("liforma-ew--session-concealing"), e();
3316
3327
  }, 280);
3317
- })), G = {
3328
+ })), ge = {
3318
3329
  galleryThumb: t.galleryThumb,
3319
3330
  avatarImage: t.avatarImage,
3320
3331
  backgroundImage: t.backgroundImage,
3321
3332
  foregroundImage: t.foregroundImage,
3322
3333
  fallbackImage: t.fallbackImage
3323
- }, K = (e) => {
3334
+ }, G = (e) => {
3324
3335
  if (!e) {
3325
3336
  y.hidden = !0, y.textContent = "";
3326
3337
  return;
3327
3338
  }
3328
3339
  y.hidden = !1, y.textContent = e;
3329
- }, ge = (e) => {
3340
+ }, K = (e) => {
3330
3341
  if (!e) {
3331
3342
  c.hidden = !0, c.textContent = "";
3332
3343
  return;
3333
3344
  }
3334
3345
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
3335
3346
  }, _e = () => {
3336
- C = !0, o.disabled = !1, ge(null), r === "onExpand" && t.onPrefetchReady?.();
3347
+ C = !0, o.disabled = !1, K(null), r === "onExpand" && t.onPrefetchReady?.();
3337
3348
  }, ve = () => {
3338
3349
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
3339
3350
  }, ye = (e) => {
3340
3351
  A?.(), A = null;
3341
- let t = $n(s, e, { parallax: ie });
3352
+ let t = tr(s, e, { parallax: ne });
3342
3353
  return t ? (A = t, !0) : !1;
3343
3354
  }, be = () => {
3344
- if (ye(G)) {
3355
+ if (ye(ge)) {
3345
3356
  _e();
3346
3357
  return;
3347
3358
  }
3348
- ge("Loading…"), ze(n, { signal: re.signal }).then((e) => {
3359
+ K("Loading…"), Ve(n, { signal: z.signal }).then((e) => {
3349
3360
  if (!S) {
3350
3361
  if (!ye({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3351
3362
  _e();
3352
3363
  }
3353
3364
  }).catch((e) => {
3354
- if (S || re.signal.aborted) return;
3365
+ if (S || z.signal.aborted) return;
3355
3366
  let n = e instanceof Error ? e : Error(String(e));
3356
- ge("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3367
+ K("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3357
3368
  });
3358
3369
  }, xe = () => ({
3359
3370
  experienceId: n,
@@ -3370,30 +3381,30 @@ function nr(e, t) {
3370
3381
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
3371
3382
  }), Se = () => ({
3372
3383
  ...t.fit ? { fit: t.fit } : {},
3373
- startButton: er(t),
3384
+ startButton: nr(t),
3374
3385
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
3375
3386
  ...t.interaction ? { interaction: t.interaction } : {}
3376
3387
  }), Ce = (e = !0) => {
3377
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
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?.();
3378
3389
  }, we = () => {
3379
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", K(null), typeof document < "u" && (document.body.style.overflow = k), me(!0), H(), b?.setWidgetChrome("docked");
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");
3380
3391
  }, Te = (e) => {
3381
3392
  e.on("started", () => {
3382
- S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && U());
3393
+ S || (D = !0, a.dataset.live = "true", G(null), t.onStarted?.(), $(a.dataset.state) && me());
3383
3394
  }), e.on("feedback", (e) => {
3384
3395
  S || t.onFeedback?.(e);
3385
3396
  }), e.on("feedbackFailed", (e) => {
3386
3397
  S || t.onFeedbackFailed?.(e);
3387
3398
  });
3388
3399
  }, Ee = () => {
3389
- B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), H();
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();
3390
3401
  }, De = () => {
3391
- z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3402
+ re(), ie(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3392
3403
  let e = b;
3393
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");
3394
3405
  }, Oe = () => {
3395
3406
  if (!S && $(a.dataset.state)) {
3396
- if (V(), x = !1, b && E) {
3407
+ if (U(), x = !1, b && E) {
3397
3408
  let e = b;
3398
3409
  (async () => {
3399
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?.());
@@ -3403,26 +3414,26 @@ function nr(e, t) {
3403
3414
  De(), Ee(), t.onCollapsed?.(), t.onClose?.();
3404
3415
  }
3405
3416
  }, ke = () => {
3406
- S || Kn() && R() === "expanded" && W(() => {
3417
+ S || Jn() && B() === "expanded" && W(() => {
3407
3418
  we();
3408
3419
  });
3409
3420
  }, Ae = () => {
3410
- S || R() === "docked" && (V(), W(() => {
3411
- ae(), Ce(!1), b?.setWidgetChrome("expanded");
3421
+ S || B() === "docked" && (U(), W(() => {
3422
+ V(), Ce(!1), b?.setWidgetChrome("expanded");
3412
3423
  }));
3413
3424
  }, je = () => {
3414
- !b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, U());
3415
- }, Ne = () => {
3416
- !b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
3417
- }, Fe = (e) => {
3418
- S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && U());
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());
3419
3430
  }, q = () => {
3420
3431
  if (S || T || w || b || $(a.dataset.state)) return;
3421
3432
  T = !0;
3422
3433
  let e = O;
3423
3434
  l.hidden = !1, (async () => {
3424
3435
  try {
3425
- let t = await Pn.startSession(xe());
3436
+ let t = await In.startSession(xe());
3426
3437
  if (S || e !== O) {
3427
3438
  t.destroy();
3428
3439
  return;
@@ -3435,22 +3446,22 @@ function nr(e, t) {
3435
3446
  S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ve());
3436
3447
  },
3437
3448
  onWidgetExpand: () => {
3438
- Fe(e);
3449
+ Ne(e);
3439
3450
  },
3440
3451
  onWidgetAudioSettings: (e) => {
3441
- S || J(e);
3452
+ S || ze(e);
3442
3453
  },
3443
3454
  onWidgetDragStart: (e) => {
3444
- S || de(e);
3455
+ S || le(e);
3445
3456
  },
3446
3457
  onWidgetDragMove: (e) => {
3447
- S || fe(e);
3458
+ S || ue(e);
3448
3459
  },
3449
3460
  onWidgetDragEnd: (e) => {
3450
- S || pe(e);
3461
+ S || de(e);
3451
3462
  },
3452
3463
  onPlayerStatusChange: (e) => {
3453
- S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
3464
+ S || e === "error" && $(a.dataset.state) && G("Could not load the experience.");
3454
3465
  }
3455
3466
  });
3456
3467
  if (S || e !== O) {
@@ -3474,14 +3485,14 @@ function nr(e, t) {
3474
3485
  return;
3475
3486
  }
3476
3487
  if (b && E) {
3477
- Ne();
3488
+ Me();
3478
3489
  return;
3479
3490
  }
3480
3491
  let e = ++O;
3481
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 () => {
3482
3493
  try {
3483
3494
  Ce();
3484
- let t = await Pn.startSession(xe());
3495
+ let t = await In.startSession(xe());
3485
3496
  if (S || e !== O) {
3486
3497
  t.destroy();
3487
3498
  return;
@@ -3491,19 +3502,19 @@ function nr(e, t) {
3491
3502
  container: v,
3492
3503
  ...Se(),
3493
3504
  onWidgetAudioSettings: (e) => {
3494
- S || J(e);
3505
+ S || ze(e);
3495
3506
  },
3496
3507
  onWidgetDragStart: (e) => {
3497
- S || de(e);
3508
+ S || le(e);
3498
3509
  },
3499
3510
  onWidgetDragMove: (e) => {
3500
- S || fe(e);
3511
+ S || ue(e);
3501
3512
  },
3502
3513
  onWidgetDragEnd: (e) => {
3503
- S || pe(e);
3514
+ S || de(e);
3504
3515
  },
3505
3516
  onPlayerStatusChange: (e) => {
3506
- S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
3517
+ S || (e === "error" ? G("Could not load the experience.") : $(a.dataset.state) && G(null));
3507
3518
  }
3508
3519
  });
3509
3520
  if (S || e !== O) {
@@ -3516,7 +3527,7 @@ function nr(e, t) {
3516
3527
  } catch (n) {
3517
3528
  if (S || e !== O) return;
3518
3529
  let r = n instanceof Error ? n : Error(String(n));
3519
- K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3530
+ G(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3520
3531
  } finally {
3521
3532
  e === O && (x = !1);
3522
3533
  }
@@ -3528,7 +3539,7 @@ function nr(e, t) {
3528
3539
  return;
3529
3540
  }
3530
3541
  if (b && E) {
3531
- Ne();
3542
+ Me();
3532
3543
  return;
3533
3544
  }
3534
3545
  if (T || b) {
@@ -3538,47 +3549,47 @@ function nr(e, t) {
3538
3549
  Ie();
3539
3550
  }
3540
3551
  }, Re = (e) => {
3541
- if (e.stopPropagation(), R() === "expanded") {
3552
+ if (e.stopPropagation(), B() === "expanded") {
3542
3553
  ke();
3543
3554
  return;
3544
3555
  }
3545
- R() === "docked" && Ae();
3546
- }, J = (e) => {
3556
+ B() === "docked" && Ae();
3557
+ }, ze = (e) => {
3547
3558
  g.setAttribute("aria-pressed", e ? "true" : "false");
3548
3559
  }, Be = (e) => {
3549
3560
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
3550
- }, Ve = (e) => {
3551
- R() === "docked" && Kn() && (e.target?.closest("button") || (e.preventDefault(), ue(e.clientX, e.clientY, e.pointerId)));
3561
+ }, J = (e) => {
3562
+ B() === "docked" && Jn() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
3552
3563
  }, He = (e) => {
3553
3564
  e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Oe());
3554
3565
  }, Ue = () => {
3555
3566
  if (!S) {
3556
- if (R() === "docked") {
3557
- if (!Kn()) {
3567
+ if (B() === "docked") {
3568
+ if (!Jn()) {
3558
3569
  Ae();
3559
3570
  return;
3560
3571
  }
3561
3572
  D ? W(() => {
3562
- me(!0);
3563
- }) : me(!0);
3573
+ pe(!0);
3574
+ }) : pe(!0);
3564
3575
  return;
3565
3576
  }
3566
- H();
3577
+ fe();
3567
3578
  }
3568
- }, Y = typeof window < "u" ? window.matchMedia(In) : null, We = () => {
3579
+ }, We = typeof window < "u" ? window.matchMedia(Rn) : null, Ge = () => {
3569
3580
  if (!S) {
3570
- if (R() === "docked" && !Kn()) {
3581
+ if (B() === "docked" && !Jn()) {
3571
3582
  Ae();
3572
3583
  return;
3573
3584
  }
3574
- H();
3585
+ fe();
3575
3586
  }
3576
3587
  };
3577
3588
  return o.addEventListener("click", Le), d.addEventListener("click", Oe), _.addEventListener("click", (e) => {
3578
3589
  e.stopPropagation(), Oe();
3579
- }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), Y?.addEventListener("change", We), be(), H(), r === "eager" ? queueMicrotask(() => {
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(() => {
3580
3591
  S || q();
3581
- }) : r === "idle" && (j = tr(() => {
3592
+ }) : r === "idle" && (j = rr(() => {
3582
3593
  S || q();
3583
3594
  })), {
3584
3595
  root: a,
@@ -3594,18 +3605,18 @@ function nr(e, t) {
3594
3605
  q();
3595
3606
  },
3596
3607
  destroy() {
3597
- S || (S = !0, V(), j?.(), j = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), Y?.removeEventListener("change", We), De(), Ee(), e.replaceChildren());
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());
3598
3609
  }
3599
3610
  };
3600
3611
  }
3601
3612
  //#endregion
3602
3613
  //#region src/react/ExperienceWidget.tsx
3603
- function rr(t) {
3604
- let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed: ee, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = t, ne = m === "bottom-right" || m === "bottom-left";
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";
3605
3616
  return e(() => {
3606
3617
  let e = r.current;
3607
3618
  if (!e || !i.trim()) return;
3608
- let t = nr(e, {
3619
+ let t = ir(e, {
3609
3620
  experienceId: i,
3610
3621
  alt: o,
3611
3622
  galleryThumb: s,
@@ -3632,14 +3643,14 @@ function rr(t) {
3632
3643
  startButtonLabel: O,
3633
3644
  startButton: k,
3634
3645
  showFeedback: A,
3635
- onFeedback: I,
3646
+ onFeedback: te,
3636
3647
  onFeedbackFailed: L,
3637
3648
  onExpanded: M,
3638
- onCollapsed: ee,
3639
- onStarted: N,
3640
- onClose: P,
3641
- onError: F,
3642
- onPrefetchReady: te
3649
+ onCollapsed: N,
3650
+ onStarted: P,
3651
+ onClose: F,
3652
+ onError: I,
3653
+ onPrefetchReady: ee
3643
3654
  });
3644
3655
  return () => t.destroy();
3645
3656
  }, [
@@ -3669,18 +3680,18 @@ function rr(t) {
3669
3680
  O,
3670
3681
  k,
3671
3682
  A,
3672
- I,
3683
+ te,
3673
3684
  L,
3674
3685
  M,
3675
- ee,
3676
3686
  N,
3677
3687
  P,
3678
3688
  F,
3679
- te
3689
+ I,
3690
+ ee
3680
3691
  ]), /* @__PURE__ */ a("div", {
3681
3692
  ref: r,
3682
3693
  className: j,
3683
- style: ne ? { display: "contents" } : {
3694
+ style: R ? { display: "contents" } : {
3684
3695
  width: "100%",
3685
3696
  height: "100%",
3686
3697
  minHeight: "inherit"
@@ -3689,11 +3700,11 @@ function rr(t) {
3689
3700
  }
3690
3701
  //#endregion
3691
3702
  //#region src/next/index.ts
3692
- function ir(e = {}) {
3703
+ function or(e = {}) {
3693
3704
  let t = v(e);
3694
3705
  return { POST: ({ request: e }) => t(e) };
3695
3706
  }
3696
3707
  //#endregion
3697
- export { je as ExperienceThumbnail, rr as ExperienceWidget, v as createLiformaSessionRouteHandler, ir as createLiformaSvelteKitSessionHandler };
3708
+ export { Ne as ExperienceThumbnail, ar as ExperienceWidget, v as createLiformaSessionRouteHandler, or as createLiformaSvelteKitSessionHandler };
3698
3709
 
3699
3710
  //# sourceMappingURL=index.js.map