@liforma/client 0.4.6 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +23 -0
- package/dist/next/index.js +525 -182
- package/dist/next/index.js.map +1 -1
- package/dist/next/next/createLiformaSessionRouteHandler.d.ts +4 -0
- package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -1
- package/dist/next/next/thumbnail.d.ts +5 -0
- package/dist/next/next/thumbnail.d.ts.map +1 -0
- package/dist/next/react/thumbnail.d.ts +4 -0
- package/dist/next/react/thumbnail.d.ts.map +1 -0
- package/dist/next/thumbnail.js +396 -0
- package/dist/next/thumbnail.js.map +1 -0
- package/dist/next/v2/api/mintPublicSession.d.ts +1 -0
- package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -1
- package/dist/next/v2/api/sessionEndpointRequest.d.ts +4 -0
- package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +13 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +39 -1
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +18 -2
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/experienceEvents.d.ts +5 -1
- package/dist/next/v2/experienceEvents.d.ts.map +1 -1
- package/dist/next/v2/sdkRelease.d.ts +3 -0
- package/dist/next/v2/sdkRelease.d.ts.map +1 -0
- package/dist/next/v2/types/sessionInteraction.d.ts +17 -0
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/types.d.ts +4 -0
- package/dist/next/widget/types.d.ts.map +1 -1
- package/dist/npm/index.js +551 -222
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/svelte/experienceLoadError.d.ts.map +1 -1
- package/dist/npm/svelte/experienceLoadErrorStyles.d.ts +1 -1
- package/dist/npm/svelte/experienceLoadErrorStyles.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +231 -0
- package/dist/npm/thumbnail/index.js.map +1 -0
- package/dist/npm/v2/api/mintPublicSession.d.ts +1 -0
- package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -1
- package/dist/npm/v2/api/sessionEndpointRequest.d.ts +4 -0
- package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +13 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +39 -1
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +18 -2
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/experienceEvents.d.ts +5 -1
- package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +1 -1
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +1 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/sdkRelease.d.ts +3 -0
- package/dist/npm/v2/sdkRelease.d.ts.map +1 -0
- package/dist/npm/v2/thumbnail-cdn.d.ts +17 -0
- package/dist/npm/v2/thumbnail-cdn.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts +17 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/types.d.ts +4 -0
- package/dist/npm/widget/types.d.ts.map +1 -1
- package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +8 -0
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +991 -646
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- package/dist/react/react/thumbnail.d.ts +4 -0
- package/dist/react/react/thumbnail.d.ts.map +1 -0
- package/dist/react/svelte/experienceLoadError.d.ts.map +1 -1
- package/dist/react/svelte/experienceLoadErrorStyles.d.ts +1 -1
- package/dist/react/svelte/experienceLoadErrorStyles.d.ts.map +1 -1
- package/dist/react/thumbnail.js +396 -0
- package/dist/react/thumbnail.js.map +1 -0
- package/dist/react/v2/api/mintPublicSession.d.ts +1 -0
- package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -1
- package/dist/react/v2/api/sessionEndpointRequest.d.ts +4 -0
- package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +13 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +39 -1
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +18 -2
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/experienceEvents.d.ts +5 -1
- package/dist/react/v2/experienceEvents.d.ts.map +1 -1
- package/dist/react/v2/sdkRelease.d.ts +3 -0
- package/dist/react/v2/sdkRelease.d.ts.map +1 -0
- package/dist/react/v2/types/sessionInteraction.d.ts +17 -0
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/types.d.ts +4 -0
- package/dist/react/widget/types.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +3 -810
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +222 -0
- package/dist/sdk/v2/thumbnail.js.map +1 -0
- package/dist/svelte/Experience.svelte +13 -0
- package/dist/svelte/Experience.svelte.d.ts +1 -0
- package/dist/svelte/ExperienceThumbnail.svelte +1 -1
- package/dist/svelte/ExperienceThumbnail.svelte.d.ts +1 -1
- package/dist/svelte/experienceLoadError.js +37 -15
- package/dist/svelte/experienceLoadError.test.js +8 -0
- package/dist/svelte/experienceLoadErrorOverlay.js +1 -1
- package/dist/svelte/experienceLoadErrorStyles.d.ts +1 -1
- package/dist/svelte/experienceLoadErrorStyles.js +1 -0
- package/dist/svelte/thumbnail.d.ts +2 -0
- package/dist/svelte/thumbnail.js +1 -0
- package/package.json +24 -6
package/dist/npm/index.js
CHANGED
|
@@ -183,7 +183,7 @@ function k(e, t) {
|
|
|
183
183
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
184
184
|
}
|
|
185
185
|
var A = /* @__PURE__ */ new Set(), j = !1, M = 0;
|
|
186
|
-
function
|
|
186
|
+
function N() {
|
|
187
187
|
if (M = 0, A.size === 0 || typeof window > "u") return;
|
|
188
188
|
let e = window.innerHeight;
|
|
189
189
|
for (let t of A) {
|
|
@@ -192,33 +192,33 @@ function ee() {
|
|
|
192
192
|
n.bottom < -64 || n.top > e + 64 || t.onParallax(k(n, e));
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
function N() {
|
|
196
|
-
M === 0 && (M = requestAnimationFrame(ee));
|
|
197
|
-
}
|
|
198
195
|
function P() {
|
|
199
|
-
|
|
196
|
+
M === 0 && (M = requestAnimationFrame(N));
|
|
200
197
|
}
|
|
201
198
|
function F() {
|
|
202
|
-
|
|
199
|
+
j || typeof window > "u" || (j = !0, window.addEventListener("scroll", P, { passive: !0 }), window.addEventListener("resize", P, { passive: !0 }));
|
|
200
|
+
}
|
|
201
|
+
function I() {
|
|
202
|
+
A.size > 0 || !j || typeof window > "u" || (j = !1, M !== 0 && (cancelAnimationFrame(M), M = 0), window.removeEventListener("scroll", P), window.removeEventListener("resize", P));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ee(e, t) {
|
|
205
205
|
if (!O()) return () => {};
|
|
206
206
|
let n = {
|
|
207
207
|
element: e,
|
|
208
208
|
onParallax: t.onParallax,
|
|
209
209
|
pointerActive: t.pointerActive
|
|
210
210
|
};
|
|
211
|
-
return A.add(n),
|
|
212
|
-
A.delete(n),
|
|
211
|
+
return A.add(n), F(), n.pointerActive?.() || t.onParallax(k(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
212
|
+
A.delete(n), I();
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
217
|
-
function
|
|
217
|
+
function te(e) {
|
|
218
218
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
219
219
|
let a = r || i;
|
|
220
220
|
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));
|
|
221
|
-
}, s =
|
|
221
|
+
}, s = ee(e, {
|
|
222
222
|
onParallax: (e) => {
|
|
223
223
|
i = !0, a || (t = e, n = 0, o());
|
|
224
224
|
},
|
|
@@ -243,32 +243,32 @@ function ne(e) {
|
|
|
243
243
|
}
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region src/thumbnail/styles.ts
|
|
246
|
-
var
|
|
247
|
-
function
|
|
248
|
-
if (typeof document > "u" ||
|
|
246
|
+
var L = ".liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", R = !1;
|
|
247
|
+
function ne(e) {
|
|
248
|
+
if (typeof document > "u" || R) return;
|
|
249
249
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
250
|
-
|
|
250
|
+
R = !0;
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
let t = document.createElement("style");
|
|
254
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
254
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), R = !0;
|
|
255
255
|
}
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/widget/styles.ts
|
|
258
|
-
var ie = "\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", ae = "liforma-experience-widget-styles";
|
|
259
|
-
function
|
|
258
|
+
var re = "\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", ie = "liforma-experience-widget-styles";
|
|
259
|
+
function ae(e = re) {
|
|
260
260
|
if (typeof document > "u") return;
|
|
261
|
-
let t = document.getElementById(
|
|
261
|
+
let t = document.getElementById(ie);
|
|
262
262
|
if (t) {
|
|
263
263
|
t.textContent = e;
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
let n = document.createElement("style");
|
|
267
|
-
n.id =
|
|
267
|
+
n.id = ie, n.textContent = e, document.head.append(n);
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/shims/apiBaseUrl.ts
|
|
271
|
-
var
|
|
271
|
+
var z = "https://api.liforma.ai", oe = "http://localhost:3001";
|
|
272
272
|
function se() {
|
|
273
273
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
274
274
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
@@ -277,7 +277,7 @@ function se() {
|
|
|
277
277
|
return t ? t.replace(/\/$/, "") : null;
|
|
278
278
|
}
|
|
279
279
|
function ce() {
|
|
280
|
-
return se() || (l() ?
|
|
280
|
+
return se() || (l() ? oe : z);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
@@ -429,7 +429,8 @@ function _e(e, t) {
|
|
|
429
429
|
...(() => {
|
|
430
430
|
let e = he(t.attribution);
|
|
431
431
|
return e ? { attribution: e } : {};
|
|
432
|
-
})()
|
|
432
|
+
})(),
|
|
433
|
+
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
433
434
|
})
|
|
434
435
|
}
|
|
435
436
|
};
|
|
@@ -573,7 +574,7 @@ function Oe(e, t) {
|
|
|
573
574
|
let i = De(t);
|
|
574
575
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
575
576
|
let a = he(t?.attribution);
|
|
576
|
-
return a && (n.attribution = a), n;
|
|
577
|
+
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
577
578
|
}
|
|
578
579
|
async function ke(e, t) {
|
|
579
580
|
let n = ce(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
@@ -691,7 +692,7 @@ var Le = new Set([1, 2]);
|
|
|
691
692
|
function Re(e) {
|
|
692
693
|
return typeof e == "number" && Le.has(e);
|
|
693
694
|
}
|
|
694
|
-
var ze = 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".split("."));
|
|
695
|
+
var ze = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.interactionChange".split("."));
|
|
695
696
|
function Be(e) {
|
|
696
697
|
if (!e || typeof e != "object") return null;
|
|
697
698
|
let t = e;
|
|
@@ -917,6 +918,9 @@ function Ze(e) {
|
|
|
917
918
|
case "fullWindow":
|
|
918
919
|
s(i.payload.active);
|
|
919
920
|
break;
|
|
921
|
+
case "interactionChange":
|
|
922
|
+
e.onInteractionChange?.(i.payload.interaction);
|
|
923
|
+
break;
|
|
920
924
|
}
|
|
921
925
|
};
|
|
922
926
|
if (window.addEventListener("message", x), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
|
|
@@ -1163,6 +1167,23 @@ function Ze(e) {
|
|
|
1163
1167
|
}
|
|
1164
1168
|
});
|
|
1165
1169
|
},
|
|
1170
|
+
setInteraction(e) {
|
|
1171
|
+
return C({
|
|
1172
|
+
type: "setInteraction",
|
|
1173
|
+
schemaVersion: 2,
|
|
1174
|
+
payload: {
|
|
1175
|
+
correlationId: Y(),
|
|
1176
|
+
interaction: e
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
},
|
|
1180
|
+
getInteraction() {
|
|
1181
|
+
return C({
|
|
1182
|
+
type: "getInteraction",
|
|
1183
|
+
schemaVersion: 2,
|
|
1184
|
+
payload: { correlationId: Y() }
|
|
1185
|
+
});
|
|
1186
|
+
},
|
|
1166
1187
|
conversion(e) {
|
|
1167
1188
|
return C({
|
|
1168
1189
|
type: "conversion",
|
|
@@ -1173,6 +1194,28 @@ function Ze(e) {
|
|
|
1173
1194
|
}
|
|
1174
1195
|
});
|
|
1175
1196
|
},
|
|
1197
|
+
engage() {
|
|
1198
|
+
return C({
|
|
1199
|
+
type: "engage",
|
|
1200
|
+
schemaVersion: 2,
|
|
1201
|
+
payload: { correlationId: Y() }
|
|
1202
|
+
});
|
|
1203
|
+
},
|
|
1204
|
+
reportSdkError(e) {
|
|
1205
|
+
return C({
|
|
1206
|
+
type: "reportSdkError",
|
|
1207
|
+
schemaVersion: 2,
|
|
1208
|
+
payload: {
|
|
1209
|
+
correlationId: Y(),
|
|
1210
|
+
errorCode: e.errorCode,
|
|
1211
|
+
message: e.message,
|
|
1212
|
+
stack: e.stack,
|
|
1213
|
+
severity: e.severity,
|
|
1214
|
+
operation: e.operation,
|
|
1215
|
+
release: e.release
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
},
|
|
1176
1219
|
destroy() {
|
|
1177
1220
|
if (!r) {
|
|
1178
1221
|
r = !0, i && s(!1);
|
|
@@ -1198,54 +1241,276 @@ function Qe(e) {
|
|
|
1198
1241
|
};
|
|
1199
1242
|
}
|
|
1200
1243
|
//#endregion
|
|
1201
|
-
//#region src/v2/
|
|
1202
|
-
var $e =
|
|
1203
|
-
|
|
1244
|
+
//#region src/v2/sdkRelease.ts
|
|
1245
|
+
var $e = `sdk@${{
|
|
1246
|
+
name: "@liforma/client",
|
|
1247
|
+
version: "0.4.9",
|
|
1248
|
+
type: "module",
|
|
1249
|
+
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1250
|
+
license: "MIT",
|
|
1251
|
+
homepage: "https://docs.liforma.ai",
|
|
1252
|
+
repository: {
|
|
1253
|
+
type: "git",
|
|
1254
|
+
url: "git+https://github.com/LiformaLtd/cdn.liforma.ai.git"
|
|
1255
|
+
},
|
|
1256
|
+
bugs: { url: "https://github.com/LiformaLtd/cdn.liforma.ai/issues" },
|
|
1257
|
+
publishConfig: { access: "public" },
|
|
1258
|
+
sideEffects: !1,
|
|
1259
|
+
exports: {
|
|
1260
|
+
".": {
|
|
1261
|
+
types: "./dist/npm/v2/npm.d.ts",
|
|
1262
|
+
import: "./dist/npm/index.js"
|
|
1263
|
+
},
|
|
1264
|
+
"./svelte": {
|
|
1265
|
+
types: "./dist/svelte/index.d.ts",
|
|
1266
|
+
import: "./dist/svelte/index.js",
|
|
1267
|
+
svelte: "./dist/svelte/index.js"
|
|
1268
|
+
},
|
|
1269
|
+
"./svelte/thumbnail": {
|
|
1270
|
+
types: "./dist/svelte/thumbnail.d.ts",
|
|
1271
|
+
import: "./dist/svelte/thumbnail.js",
|
|
1272
|
+
svelte: "./dist/svelte/thumbnail.js"
|
|
1273
|
+
},
|
|
1274
|
+
"./thumbnail": {
|
|
1275
|
+
types: "./dist/npm/thumbnail/index.d.ts",
|
|
1276
|
+
import: "./dist/npm/thumbnail/index.js"
|
|
1277
|
+
},
|
|
1278
|
+
"./react": {
|
|
1279
|
+
types: "./dist/react/react/index.d.ts",
|
|
1280
|
+
import: "./dist/react/index.js"
|
|
1281
|
+
},
|
|
1282
|
+
"./react/thumbnail": {
|
|
1283
|
+
types: "./dist/react/react/thumbnail.d.ts",
|
|
1284
|
+
import: "./dist/react/thumbnail.js"
|
|
1285
|
+
},
|
|
1286
|
+
"./next": {
|
|
1287
|
+
types: "./dist/next/next/index.d.ts",
|
|
1288
|
+
import: "./dist/next/index.js"
|
|
1289
|
+
},
|
|
1290
|
+
"./next/thumbnail": {
|
|
1291
|
+
types: "./dist/next/next/thumbnail.d.ts",
|
|
1292
|
+
import: "./dist/next/thumbnail.js"
|
|
1293
|
+
},
|
|
1294
|
+
"./byo": {
|
|
1295
|
+
types: "./dist/byo/index.d.ts",
|
|
1296
|
+
import: "./dist/byo/index.js"
|
|
1297
|
+
},
|
|
1298
|
+
"./elevenlabs": {
|
|
1299
|
+
types: "./dist/elevenlabs/index.d.ts",
|
|
1300
|
+
import: "./dist/elevenlabs/index.js"
|
|
1301
|
+
},
|
|
1302
|
+
"./openai": {
|
|
1303
|
+
types: "./dist/openai/index.d.ts",
|
|
1304
|
+
import: "./dist/openai/index.js"
|
|
1305
|
+
},
|
|
1306
|
+
"./deepgram": {
|
|
1307
|
+
types: "./dist/deepgram/index.d.ts",
|
|
1308
|
+
import: "./dist/deepgram/index.js"
|
|
1309
|
+
},
|
|
1310
|
+
"./google": {
|
|
1311
|
+
types: "./dist/google/index.d.ts",
|
|
1312
|
+
import: "./dist/google/index.js"
|
|
1313
|
+
},
|
|
1314
|
+
"./livekit": {
|
|
1315
|
+
types: "./dist/livekit/index.d.ts",
|
|
1316
|
+
import: "./dist/livekit/index.js"
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
files: [
|
|
1320
|
+
"dist/npm",
|
|
1321
|
+
"dist/svelte",
|
|
1322
|
+
"dist/react",
|
|
1323
|
+
"dist/next",
|
|
1324
|
+
"dist/byo",
|
|
1325
|
+
"dist/elevenlabs",
|
|
1326
|
+
"dist/openai",
|
|
1327
|
+
"dist/deepgram",
|
|
1328
|
+
"dist/google",
|
|
1329
|
+
"dist/livekit",
|
|
1330
|
+
"dist/sdk",
|
|
1331
|
+
"README.md",
|
|
1332
|
+
"CHANGELOG.md",
|
|
1333
|
+
"LICENSE"
|
|
1334
|
+
],
|
|
1335
|
+
peerDependencies: {
|
|
1336
|
+
"@elevenlabs/client": ">=1.0.0",
|
|
1337
|
+
"livekit-client": ">=2.0.0",
|
|
1338
|
+
react: "^18.0.0 || ^19.0.0",
|
|
1339
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
1340
|
+
svelte: "^5.0.0"
|
|
1341
|
+
},
|
|
1342
|
+
peerDependenciesMeta: {
|
|
1343
|
+
svelte: { optional: !0 },
|
|
1344
|
+
react: { optional: !0 },
|
|
1345
|
+
"react-dom": { optional: !0 },
|
|
1346
|
+
"@elevenlabs/client": { optional: !0 },
|
|
1347
|
+
"livekit-client": { optional: !0 }
|
|
1348
|
+
},
|
|
1349
|
+
scripts: {
|
|
1350
|
+
build: "npm run build:v2 && npm run build:npm && npm run build:svelte && npm run build:react && npm run build:next && npm run build:byo && npm run build:elevenlabs && npm run build:openai && npm run build:deepgram && npm run build:google && npm run build:livekit && npm run copy:preview",
|
|
1351
|
+
"build:react": "vite build --config vite.config.react.ts && vite build --config vite.config.react-thumbnail.ts && tsc -p tsconfig.react.json",
|
|
1352
|
+
"build:next": "vite build --config vite.config.next.ts && vite build --config vite.config.next-thumbnail.ts && tsc -p tsconfig.next.json",
|
|
1353
|
+
"build:byo": "vite build --config vite.config.byo.ts && tsc -p tsconfig.byo.json",
|
|
1354
|
+
"build:elevenlabs": "vite build --config vite.config.elevenlabs.ts && tsc -p tsconfig.elevenlabs.json",
|
|
1355
|
+
"build:openai": "vite build --config vite.config.openai.ts && tsc -p tsconfig.openai.json",
|
|
1356
|
+
"build:deepgram": "vite build --config vite.config.deepgram.ts && tsc -p tsconfig.deepgram.json",
|
|
1357
|
+
"build:google": "vite build --config vite.config.google.ts && tsc -p tsconfig.google.json",
|
|
1358
|
+
"build:livekit": "vite build --config vite.config.livekit.ts && tsc -p tsconfig.livekit.json",
|
|
1359
|
+
"copy:preview": "mkdir -p dist/preview && cp preview/v2-embed-test.html dist/preview/ && cp preview/v2-embed-test-redirect.html dist/preview/",
|
|
1360
|
+
"build:v2": "vite build --config vite.config.v2.ts && vite build --config vite.config.v2-thumbnail.ts",
|
|
1361
|
+
"build:npm": "vite build --config vite.config.npm.ts && vite build --config vite.config.thumbnail.ts && tsc -p tsconfig.npm.json",
|
|
1362
|
+
"build:svelte": "svelte-package -i src/svelte -o dist/svelte && vite build --config vite.config.svelte.ts",
|
|
1363
|
+
"check:consumer": "svelte-check --workspace test/consumer --tsconfig ./tsconfig.json",
|
|
1364
|
+
test: "vitest run",
|
|
1365
|
+
preview: "node scripts/preview-local.mjs",
|
|
1366
|
+
"dev:sdk": "npm run build:v2 && npm run copy:preview && npm run preview",
|
|
1367
|
+
dev: "npm run build && npm run preview",
|
|
1368
|
+
"publish:sdk": "node scripts/publish-sdk.mjs",
|
|
1369
|
+
"publish:npm": "node scripts/publish-npm.mjs",
|
|
1370
|
+
"publish:avatar": "node scripts/publish-avatar.mjs",
|
|
1371
|
+
"publish:avatars-dist": "node scripts/publish-avatars.mjs",
|
|
1372
|
+
"publish:avatars": "node scripts/republish-avatars.mjs",
|
|
1373
|
+
"build:avatars": "node scripts/build-avatars.mjs",
|
|
1374
|
+
"republish:avatars": "node scripts/republish-avatars.mjs",
|
|
1375
|
+
"catalogue:avatars": "node ../labs.liforma.ai/scripts/generate-avatar-index.mjs",
|
|
1376
|
+
"verify:avatars-dist": "node scripts/verify-avatars-dist.mjs",
|
|
1377
|
+
"verify:avatar-pack": "node scripts/verify-avatar-pack.mjs",
|
|
1378
|
+
"repair:render-plate-metadata": "node scripts/repair-render-plate-metadata.mjs",
|
|
1379
|
+
"verify:render-plate-crop": "node scripts/verify-render-plate-crop.mjs",
|
|
1380
|
+
"migrate:avatar-render-prep": "npm run migrate:avatar-render-prep --prefix ../labs.liforma.ai --",
|
|
1381
|
+
"convert:avatar-teeth": "node scripts/convert-avatar-teeth-webp.mjs",
|
|
1382
|
+
"warm:avatar-composites": "node scripts/warm-avatar-composites.mjs",
|
|
1383
|
+
"test:compose-costume": "node scripts/test-compose-costume-layers.mjs",
|
|
1384
|
+
"test:compose-costume-wasm": "node scripts/test-compose-costume-wasm.mjs",
|
|
1385
|
+
"test:parse-composite-filename": "node scripts/test-parse-composite-filename.mjs",
|
|
1386
|
+
"test:avatar-composite-rendered-path": "node scripts/test-avatar-composite-rendered-path.mjs",
|
|
1387
|
+
"test:avatar-compose-worker-cors": "node scripts/test-avatar-compose-worker-cors.mjs",
|
|
1388
|
+
"test:experience-thumb-url": "node scripts/test-experience-thumb-url.mjs",
|
|
1389
|
+
"test:compose-experience-thumb": "node scripts/test-compose-experience-thumb.mjs",
|
|
1390
|
+
"test:location-depth-paths": "node scripts/test-location-depth-paths.mjs",
|
|
1391
|
+
"test:location-binary-assets": "node scripts/test-location-binary-assets.mjs",
|
|
1392
|
+
"test:location-da3-depth": "node scripts/test-location-da3-depth.mjs",
|
|
1393
|
+
"test:location-interactions": "node scripts/test-location-interactions.mjs",
|
|
1394
|
+
"test:render-plate-chroma-key": "node scripts/test-render-plate-chroma-key.mjs",
|
|
1395
|
+
"test:sparse-plate": "node scripts/test-sparse-plate.mjs",
|
|
1396
|
+
"test:face-meshes-publish-depth": "node scripts/test-face-meshes-publish-depth.mjs",
|
|
1397
|
+
"test:avatar-avif-sibling": "node scripts/test-avatar-avif-sibling.mjs",
|
|
1398
|
+
"test:screen-chroma-key": "node scripts/test-screen-chroma-key.mjs",
|
|
1399
|
+
"pull:sources": "node scripts/sync-authoring-sources.mjs",
|
|
1400
|
+
"push:sources": "node scripts/sync-authoring-sources.mjs",
|
|
1401
|
+
"catalogue:locations": "node scripts/catalogue-locations.mjs",
|
|
1402
|
+
"generate:location-interactions": "node scripts/generate-location-interactions.mjs",
|
|
1403
|
+
"generate:location-depth": "node scripts/generate-location-depth.mjs",
|
|
1404
|
+
"generate:location-depth16-da3": "node scripts/generate-location-depth16-da3.mjs",
|
|
1405
|
+
"generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
|
|
1406
|
+
"build:locations": "node scripts/build-locations.mjs",
|
|
1407
|
+
"publish:locations": "node scripts/publish-locations.mjs",
|
|
1408
|
+
"verify:locations": "node scripts/verify-location-sources.mjs",
|
|
1409
|
+
"publish:models": "node scripts/publish-models.mjs",
|
|
1410
|
+
"publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
|
|
1411
|
+
"publish:models:ltx-int8": "node scripts/_upload-model-prefix.mjs text-to-video/lf-t2v-distill-int8",
|
|
1412
|
+
"publish:models:video-omni": "node scripts/_upload-model-prefix.mjs text-to-video/lf-video-omni-v1",
|
|
1413
|
+
"fetch:depth-anything-v2": "node scripts/fetch-depth-anything-v2.mjs",
|
|
1414
|
+
"fetch:video-depth-anything": "node scripts/fetch-video-depth-anything.mjs",
|
|
1415
|
+
"fetch:depth-pro": "node scripts/fetch-depth-pro.mjs",
|
|
1416
|
+
"fetch:face-landmarker": "node scripts/fetch-face-landmarker.mjs",
|
|
1417
|
+
"fetch:anime-face-detector": "node scripts/fetch-anime-face-detector.mjs",
|
|
1418
|
+
"fetch:face-parsing": "node scripts/fetch-face-parsing.mjs",
|
|
1419
|
+
"fetch:vitmatte": "node scripts/fetch-vitmatte.mjs",
|
|
1420
|
+
"fetch:liveportrait-mlx": "node scripts/fetch-liveportrait-mlx.mjs",
|
|
1421
|
+
"fetch:wav2vec-phoneme-ctc": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
|
|
1422
|
+
"fetch:lf-sta": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
|
|
1423
|
+
"fetch:supertonic-3": "node scripts/fetch-supertonic-3.mjs",
|
|
1424
|
+
"fetch:lf-tts": "node scripts/fetch-supertonic-3.mjs",
|
|
1425
|
+
"fetch:lf-t2i-turbo": "python3 ../tools/krea-2-salad/scripts/fetch_cdn_snapshot.py",
|
|
1426
|
+
"fetch:models": "npm run fetch:depth-anything-v2 && npm run fetch:video-depth-anything && npm run fetch:depth-pro && npm run fetch:face-landmarker && npm run fetch:anime-face-detector && npm run fetch:face-parsing && npm run fetch:vitmatte && npm run fetch:lf-sta && npm run fetch:lf-tts",
|
|
1427
|
+
locations: "npm run catalogue:locations && npm run build:locations",
|
|
1428
|
+
"configure:cors": "node scripts/configure-r2-cors.mjs",
|
|
1429
|
+
"verify:cors": "node scripts/verify-cdn-cors.mjs",
|
|
1430
|
+
"deploy:worker:avatar-compose": "node scripts/deploy-avatar-compose-worker.mjs",
|
|
1431
|
+
"deploy:worker:experience-thumb": "node scripts/deploy-experience-thumb-worker.mjs",
|
|
1432
|
+
deploy: "npm run build && npm run publish:sdk",
|
|
1433
|
+
verify: "npm run build && node scripts/check-sdk-size.mjs && node scripts/verify-thumbnail-light.mjs && node scripts/test-embed-protocol.mjs && node scripts/test-manifest-embed-url.mjs && node scripts/test-player-reachability.mjs && node scripts/test-session-endpoint.mjs && node scripts/verify-package.mjs",
|
|
1434
|
+
"preview:test": "npm run build && npm run preview"
|
|
1435
|
+
},
|
|
1436
|
+
dependencies: {
|
|
1437
|
+
"@jsquash/webp": "^1.5.0",
|
|
1438
|
+
zod: "^4.4.3"
|
|
1439
|
+
},
|
|
1440
|
+
devDependencies: {
|
|
1441
|
+
"@aws-sdk/client-s3": "^3.1000.0",
|
|
1442
|
+
"@aws-sdk/lib-storage": "^3.1110.0",
|
|
1443
|
+
"@elevenlabs/client": "^1.17.0",
|
|
1444
|
+
"@sveltejs/package": "^2.5.8",
|
|
1445
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
1446
|
+
"@testing-library/react": "^16.3.0",
|
|
1447
|
+
"@testing-library/svelte": "^5.4.2",
|
|
1448
|
+
"@types/node": "^25.9.3",
|
|
1449
|
+
"@types/react": "^19.1.12",
|
|
1450
|
+
"@types/react-dom": "^19.1.9",
|
|
1451
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
1452
|
+
"@webgpu/types": "^0.1.70",
|
|
1453
|
+
dotenv: "^17.2.3",
|
|
1454
|
+
jsdom: "^30.0.1",
|
|
1455
|
+
"livekit-client": "^2.21.0",
|
|
1456
|
+
react: "^19.1.1",
|
|
1457
|
+
"react-dom": "^19.1.1",
|
|
1458
|
+
sharp: "^0.34.2",
|
|
1459
|
+
svelte: "^5.55.2",
|
|
1460
|
+
"svelte-check": "^4.7.4",
|
|
1461
|
+
typescript: "^6.0.3",
|
|
1462
|
+
vite: "^8.0.16",
|
|
1463
|
+
vitest: "^4.1.10",
|
|
1464
|
+
wrangler: "^4.101.0"
|
|
1465
|
+
}
|
|
1466
|
+
}.version}`, et = "https://player.liforma.ai/embed", tt = "http://localhost:3002/embed";
|
|
1467
|
+
function nt() {
|
|
1204
1468
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1205
1469
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1206
1470
|
if (typeof document > "u") return null;
|
|
1207
1471
|
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();
|
|
1208
1472
|
return t ? t.replace(/\/$/, "") : null;
|
|
1209
1473
|
}
|
|
1210
|
-
function
|
|
1211
|
-
let e =
|
|
1212
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ?
|
|
1474
|
+
function rt() {
|
|
1475
|
+
let e = nt();
|
|
1476
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ? tt : et;
|
|
1213
1477
|
}
|
|
1214
|
-
function
|
|
1478
|
+
function it(e, t) {
|
|
1215
1479
|
return e?.trim() || t?.trim() || void 0;
|
|
1216
1480
|
}
|
|
1217
|
-
function
|
|
1218
|
-
let c = (e ??
|
|
1481
|
+
function at(e, t, n, r, i, a, o, s) {
|
|
1482
|
+
let c = (e ?? rt()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
|
|
1219
1483
|
d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
|
|
1220
1484
|
let f = r?.trim();
|
|
1221
|
-
return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)),
|
|
1485
|
+
return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), ot(u.toString());
|
|
1222
1486
|
}
|
|
1223
|
-
function
|
|
1487
|
+
function ot(e) {
|
|
1224
1488
|
if (typeof location > "u") return e;
|
|
1225
1489
|
let t = new URL(e);
|
|
1226
1490
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1227
1491
|
}
|
|
1228
|
-
function
|
|
1492
|
+
function st(e) {
|
|
1229
1493
|
return new URL(e).origin;
|
|
1230
1494
|
}
|
|
1231
1495
|
//#endregion
|
|
1232
1496
|
//#region src/v2/experienceEvents.ts
|
|
1233
|
-
function
|
|
1497
|
+
function ct() {
|
|
1234
1498
|
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)}`;
|
|
1235
1499
|
}
|
|
1236
|
-
function
|
|
1500
|
+
function lt(e, t, n) {
|
|
1237
1501
|
return {
|
|
1238
|
-
id:
|
|
1502
|
+
id: ct(),
|
|
1239
1503
|
type: e,
|
|
1240
1504
|
sessionId: t,
|
|
1241
1505
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1242
1506
|
data: n
|
|
1243
1507
|
};
|
|
1244
1508
|
}
|
|
1245
|
-
function
|
|
1509
|
+
function ut() {
|
|
1246
1510
|
return {
|
|
1247
1511
|
ready: /* @__PURE__ */ new Set(),
|
|
1248
1512
|
started: /* @__PURE__ */ new Set(),
|
|
1513
|
+
sessionMinted: /* @__PURE__ */ new Set(),
|
|
1249
1514
|
userTranscript: /* @__PURE__ */ new Set(),
|
|
1250
1515
|
userSpeechStarted: /* @__PURE__ */ new Set(),
|
|
1251
1516
|
userSpeechEnded: /* @__PURE__ */ new Set(),
|
|
@@ -1256,37 +1521,38 @@ function lt() {
|
|
|
1256
1521
|
message: /* @__PURE__ */ new Set(),
|
|
1257
1522
|
listeningState: /* @__PURE__ */ new Set(),
|
|
1258
1523
|
activityChange: /* @__PURE__ */ new Set(),
|
|
1524
|
+
interactionChange: /* @__PURE__ */ new Set(),
|
|
1259
1525
|
feedback: /* @__PURE__ */ new Set(),
|
|
1260
1526
|
feedbackFailed: /* @__PURE__ */ new Set(),
|
|
1261
1527
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1262
1528
|
};
|
|
1263
1529
|
}
|
|
1264
|
-
function
|
|
1530
|
+
function dt(e, t, n) {
|
|
1265
1531
|
return e[t].add(n), () => e[t].delete(n);
|
|
1266
1532
|
}
|
|
1267
|
-
function
|
|
1533
|
+
function ft(e, t, n) {
|
|
1268
1534
|
for (let r of e[t]) r(n);
|
|
1269
1535
|
}
|
|
1270
|
-
function
|
|
1536
|
+
function pt(e) {
|
|
1271
1537
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1272
1538
|
}
|
|
1273
1539
|
//#endregion
|
|
1274
1540
|
//#region src/v2/speech/types.ts
|
|
1275
|
-
function
|
|
1541
|
+
function mt(e) {
|
|
1276
1542
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1277
1543
|
}
|
|
1278
|
-
function
|
|
1544
|
+
function ht(e) {
|
|
1279
1545
|
return "url" in e && typeof e.url == "string";
|
|
1280
1546
|
}
|
|
1281
|
-
function
|
|
1547
|
+
function gt(e) {
|
|
1282
1548
|
if (!("track" in e)) return !1;
|
|
1283
1549
|
let t = e.track;
|
|
1284
1550
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1285
1551
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return !
|
|
1552
|
+
function _t(e) {
|
|
1553
|
+
return !mt(e) && !ht(e) && !gt(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1288
1554
|
}
|
|
1289
|
-
var
|
|
1555
|
+
var vt = [
|
|
1290
1556
|
8e3,
|
|
1291
1557
|
16e3,
|
|
1292
1558
|
22050,
|
|
@@ -1304,14 +1570,14 @@ var _t = [
|
|
|
1304
1570
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1305
1571
|
MAX_PENDING_WRITES: 8,
|
|
1306
1572
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1307
|
-
},
|
|
1573
|
+
}, yt = class extends Error {
|
|
1308
1574
|
operation;
|
|
1309
1575
|
requiredCapability;
|
|
1310
1576
|
name = "UnsupportedSpeechOperationError";
|
|
1311
1577
|
constructor(e, t) {
|
|
1312
1578
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1313
1579
|
}
|
|
1314
|
-
},
|
|
1580
|
+
}, bt = class extends Error {
|
|
1315
1581
|
name = "SpeechUtteranceClosedError";
|
|
1316
1582
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1317
1583
|
super(e);
|
|
@@ -1321,72 +1587,72 @@ var _t = [
|
|
|
1321
1587
|
constructor(e, t) {
|
|
1322
1588
|
super(e, t);
|
|
1323
1589
|
}
|
|
1324
|
-
},
|
|
1590
|
+
}, xt = class extends Error {
|
|
1325
1591
|
name = "SpeechBufferTimeoutError";
|
|
1326
1592
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1327
1593
|
super(e);
|
|
1328
1594
|
}
|
|
1329
1595
|
};
|
|
1330
|
-
function
|
|
1596
|
+
function St(e = "none") {
|
|
1331
1597
|
return {
|
|
1332
1598
|
mode: e,
|
|
1333
1599
|
trackedDurationMs: 0,
|
|
1334
1600
|
fallbackDurationMs: 0
|
|
1335
1601
|
};
|
|
1336
1602
|
}
|
|
1337
|
-
function St(e) {
|
|
1338
|
-
return _t.includes(e);
|
|
1339
|
-
}
|
|
1340
1603
|
function Ct(e) {
|
|
1604
|
+
return vt.includes(e);
|
|
1605
|
+
}
|
|
1606
|
+
function wt(e) {
|
|
1341
1607
|
if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
|
|
1342
1608
|
if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
|
|
1343
|
-
if (!
|
|
1609
|
+
if (!Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1344
1610
|
}
|
|
1345
|
-
function
|
|
1346
|
-
if (
|
|
1347
|
-
|
|
1611
|
+
function Tt(e) {
|
|
1612
|
+
if (mt(e)) {
|
|
1613
|
+
wt(e.format);
|
|
1348
1614
|
return;
|
|
1349
1615
|
}
|
|
1350
|
-
if (
|
|
1616
|
+
if (ht(e)) {
|
|
1351
1617
|
if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
|
|
1352
|
-
if (e.sampleRate !== void 0 && !
|
|
1618
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1353
1619
|
return;
|
|
1354
1620
|
}
|
|
1355
|
-
if (
|
|
1621
|
+
if (gt(e)) {
|
|
1356
1622
|
if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
1357
|
-
if (e.sampleRate !== void 0 && !
|
|
1623
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1358
1624
|
return;
|
|
1359
1625
|
}
|
|
1360
|
-
if (
|
|
1626
|
+
if (_t(e)) {
|
|
1361
1627
|
let t = e.encoding.trim().toLowerCase();
|
|
1362
1628
|
if (!t) throw new Z("Encoded audio MIME type is required.");
|
|
1363
1629
|
if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
1364
|
-
if (e.sampleRate !== void 0 && !
|
|
1630
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1365
1631
|
return;
|
|
1366
1632
|
}
|
|
1367
1633
|
throw new Z("Unsupported speech.play audio shape.");
|
|
1368
1634
|
}
|
|
1369
|
-
function
|
|
1370
|
-
if (e.format) return
|
|
1635
|
+
function Et(e) {
|
|
1636
|
+
if (e.format) return wt(e.format), e.format;
|
|
1371
1637
|
if (e.track) {
|
|
1372
1638
|
let t = {
|
|
1373
1639
|
encoding: "pcm_s16le",
|
|
1374
1640
|
sampleRate: e.sampleRate ?? 24e3,
|
|
1375
1641
|
channels: 1
|
|
1376
1642
|
};
|
|
1377
|
-
return
|
|
1643
|
+
return wt(t), t;
|
|
1378
1644
|
}
|
|
1379
1645
|
throw new Z("createUtterance requires format or track.");
|
|
1380
1646
|
}
|
|
1381
|
-
function
|
|
1647
|
+
function Dt(e) {
|
|
1382
1648
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1383
1649
|
}
|
|
1384
|
-
function
|
|
1650
|
+
function Ot(e) {
|
|
1385
1651
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
1386
1652
|
}
|
|
1387
1653
|
//#endregion
|
|
1388
1654
|
//#region src/byo/pcm.ts
|
|
1389
|
-
function
|
|
1655
|
+
function kt(e) {
|
|
1390
1656
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
1391
1657
|
for (let t = 0; t < e.length; t++) {
|
|
1392
1658
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -1396,11 +1662,11 @@ function Ot(e) {
|
|
|
1396
1662
|
}
|
|
1397
1663
|
//#endregion
|
|
1398
1664
|
//#region src/byo/resample.ts
|
|
1399
|
-
function
|
|
1665
|
+
function At(e, t, n, r, i) {
|
|
1400
1666
|
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;
|
|
1401
1667
|
return ((a * i + o) * i + s) * i + c;
|
|
1402
1668
|
}
|
|
1403
|
-
function
|
|
1669
|
+
function jt(e, t) {
|
|
1404
1670
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
1405
1671
|
if (e === t) return {
|
|
1406
1672
|
fromRate: e,
|
|
@@ -1423,7 +1689,7 @@ function At(e, t) {
|
|
|
1423
1689
|
let a = [];
|
|
1424
1690
|
for (; i + 2 < r.length - 1;) {
|
|
1425
1691
|
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);
|
|
1426
|
-
a.push(
|
|
1692
|
+
a.push(At(r[o], r[e], r[s], r[c], t)), i += n;
|
|
1427
1693
|
}
|
|
1428
1694
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
1429
1695
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -1435,7 +1701,7 @@ function At(e, t) {
|
|
|
1435
1701
|
}
|
|
1436
1702
|
//#endregion
|
|
1437
1703
|
//#region src/byo/audioCapture.ts
|
|
1438
|
-
var
|
|
1704
|
+
var Mt = "liforma-pcm-capture", Nt = `
|
|
1439
1705
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
1440
1706
|
process(inputs) {
|
|
1441
1707
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -1447,29 +1713,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
1447
1713
|
return true;
|
|
1448
1714
|
}
|
|
1449
1715
|
}
|
|
1450
|
-
registerProcessor('${
|
|
1451
|
-
`,
|
|
1452
|
-
function Pt() {
|
|
1453
|
-
return Nt ||= URL.createObjectURL(new Blob([Mt], { type: "application/javascript" })), Nt;
|
|
1454
|
-
}
|
|
1716
|
+
registerProcessor('${Mt}', LiformaPcmCaptureProcessor);
|
|
1717
|
+
`, Pt = null;
|
|
1455
1718
|
function Ft() {
|
|
1719
|
+
return Pt ||= URL.createObjectURL(new Blob([Nt], { type: "application/javascript" })), Pt;
|
|
1720
|
+
}
|
|
1721
|
+
function It() {
|
|
1456
1722
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
1457
1723
|
}
|
|
1458
|
-
async function
|
|
1459
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
1724
|
+
async function Lt(e) {
|
|
1725
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = It();
|
|
1460
1726
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
1461
1727
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
1462
1728
|
l.gain.value = 0;
|
|
1463
|
-
let u = s.sampleRate, d =
|
|
1729
|
+
let u = s.sampleRate, d = jt(u, n), f = !1, p = !1, m = (e) => {
|
|
1464
1730
|
if (f || i && !i()) return;
|
|
1465
1731
|
let t = d.push(e);
|
|
1466
|
-
t.length !== 0 && r(
|
|
1732
|
+
t.length !== 0 && r(kt(t));
|
|
1467
1733
|
}, h = () => void 0;
|
|
1468
1734
|
return await (async () => {
|
|
1469
1735
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
1470
1736
|
try {
|
|
1471
|
-
await s.audioWorklet.addModule(
|
|
1472
|
-
let e = new AudioWorkletNode(s,
|
|
1737
|
+
await s.audioWorklet.addModule(Ft());
|
|
1738
|
+
let e = new AudioWorkletNode(s, Mt, {
|
|
1473
1739
|
numberOfInputs: 1,
|
|
1474
1740
|
numberOfOutputs: 1,
|
|
1475
1741
|
outputChannelCount: [1]
|
|
@@ -1519,7 +1785,7 @@ async function It(e) {
|
|
|
1519
1785
|
}
|
|
1520
1786
|
//#endregion
|
|
1521
1787
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
1522
|
-
async function
|
|
1788
|
+
async function Rt(e) {
|
|
1523
1789
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
1524
1790
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
|
|
1525
1791
|
if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -1528,13 +1794,13 @@ async function Lt(e) {
|
|
|
1528
1794
|
s || (s = !0, c?.stop(), c = null);
|
|
1529
1795
|
};
|
|
1530
1796
|
try {
|
|
1531
|
-
c = await
|
|
1797
|
+
c = await Lt({
|
|
1532
1798
|
mediaStream: a,
|
|
1533
1799
|
targetSampleRate: r,
|
|
1534
1800
|
shouldSend: () => !s && !i?.aborted,
|
|
1535
1801
|
onPcm: (e) => {
|
|
1536
1802
|
if (s || i?.aborted) return;
|
|
1537
|
-
let t =
|
|
1803
|
+
let t = Dt(e);
|
|
1538
1804
|
o = o.then(async () => {
|
|
1539
1805
|
if (s || i?.aborted) return;
|
|
1540
1806
|
let e = 0;
|
|
@@ -1563,10 +1829,10 @@ async function Lt(e) {
|
|
|
1563
1829
|
}
|
|
1564
1830
|
//#endregion
|
|
1565
1831
|
//#region src/v2/speech/speechController.ts
|
|
1566
|
-
async function
|
|
1567
|
-
if (
|
|
1568
|
-
if (
|
|
1569
|
-
let t =
|
|
1832
|
+
async function zt(e, t) {
|
|
1833
|
+
if (gt(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
|
|
1834
|
+
if (mt(e)) {
|
|
1835
|
+
let t = Dt(e.data);
|
|
1570
1836
|
if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
|
|
1571
1837
|
return {
|
|
1572
1838
|
kind: "pcm",
|
|
@@ -1574,17 +1840,17 @@ async function Rt(e, t) {
|
|
|
1574
1840
|
format: e.format
|
|
1575
1841
|
};
|
|
1576
1842
|
}
|
|
1577
|
-
if (
|
|
1843
|
+
if (ht(e)) return {
|
|
1578
1844
|
kind: "url",
|
|
1579
1845
|
url: e.url.trim(),
|
|
1580
1846
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1581
1847
|
};
|
|
1582
|
-
if (!
|
|
1848
|
+
if (!_t(e)) throw new Z("Unsupported speech.play audio shape.");
|
|
1583
1849
|
let n;
|
|
1584
1850
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
1585
1851
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1586
1852
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
1587
|
-
} else n =
|
|
1853
|
+
} else n = Dt(e.data);
|
|
1588
1854
|
return {
|
|
1589
1855
|
kind: "encoded",
|
|
1590
1856
|
data: n.slice().buffer,
|
|
@@ -1592,10 +1858,10 @@ async function Rt(e, t) {
|
|
|
1592
1858
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1593
1859
|
};
|
|
1594
1860
|
}
|
|
1595
|
-
function
|
|
1861
|
+
function Bt() {
|
|
1596
1862
|
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)}`;
|
|
1597
1863
|
}
|
|
1598
|
-
function
|
|
1864
|
+
function Vt(e, t = "completed") {
|
|
1599
1865
|
return {
|
|
1600
1866
|
utteranceId: e.speechId,
|
|
1601
1867
|
characterId: e.characterId,
|
|
@@ -1609,13 +1875,13 @@ function Bt(e, t = "completed") {
|
|
|
1609
1875
|
}
|
|
1610
1876
|
};
|
|
1611
1877
|
}
|
|
1612
|
-
function
|
|
1878
|
+
function Ht(e) {
|
|
1613
1879
|
return e instanceof Error ? e : new Z(String(e));
|
|
1614
1880
|
}
|
|
1615
|
-
function
|
|
1881
|
+
function Ut(e) {
|
|
1616
1882
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
1617
1883
|
}
|
|
1618
|
-
var
|
|
1884
|
+
var Wt = class {
|
|
1619
1885
|
id;
|
|
1620
1886
|
characterId;
|
|
1621
1887
|
result;
|
|
@@ -1644,14 +1910,14 @@ var Ut = class {
|
|
|
1644
1910
|
queue: e.queue,
|
|
1645
1911
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
1646
1912
|
}).catch((e) => {
|
|
1647
|
-
throw this.fail(
|
|
1913
|
+
throw this.fail(Ht(e)), Ht(e);
|
|
1648
1914
|
}), this.signal?.addEventListener("abort", () => {
|
|
1649
1915
|
this.cancel();
|
|
1650
1916
|
}, { once: !0 });
|
|
1651
1917
|
}
|
|
1652
1918
|
async write(e, t) {
|
|
1653
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1654
|
-
let n =
|
|
1919
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new bt();
|
|
1920
|
+
let n = Dt(e);
|
|
1655
1921
|
if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
|
|
1656
1922
|
if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
|
|
1657
1923
|
if (n.byteLength === 0) return;
|
|
@@ -1660,13 +1926,13 @@ var Ut = class {
|
|
|
1660
1926
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
1661
1927
|
if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
1662
1928
|
let a = async () => {
|
|
1663
|
-
if (this.closed || this.settled) throw new
|
|
1929
|
+
if (this.closed || this.settled) throw new bt();
|
|
1664
1930
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
1665
1931
|
utteranceId: this.id,
|
|
1666
1932
|
audio: t.buffer,
|
|
1667
1933
|
byteLength: t.byteLength
|
|
1668
1934
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
1669
|
-
setTimeout(() => t(new
|
|
1935
|
+
setTimeout(() => t(new xt()), r);
|
|
1670
1936
|
})]);
|
|
1671
1937
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
1672
1938
|
}, o = this.writeChain.then(a, a);
|
|
@@ -1678,7 +1944,7 @@ var Ut = class {
|
|
|
1678
1944
|
}
|
|
1679
1945
|
}
|
|
1680
1946
|
async setTranscript(e) {
|
|
1681
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1947
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new bt();
|
|
1682
1948
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
1683
1949
|
utteranceId: this.id,
|
|
1684
1950
|
transcript: e
|
|
@@ -1695,7 +1961,7 @@ var Ut = class {
|
|
|
1695
1961
|
});
|
|
1696
1962
|
return this.resolve(t), t;
|
|
1697
1963
|
} catch (e) {
|
|
1698
|
-
let t =
|
|
1964
|
+
let t = Ht(e);
|
|
1699
1965
|
throw this.fail(t), t;
|
|
1700
1966
|
}
|
|
1701
1967
|
}
|
|
@@ -1713,11 +1979,11 @@ var Ut = class {
|
|
|
1713
1979
|
characterId: this.characterId,
|
|
1714
1980
|
status: "cancelled",
|
|
1715
1981
|
durationMs: 0,
|
|
1716
|
-
animation:
|
|
1982
|
+
animation: St("none")
|
|
1717
1983
|
};
|
|
1718
1984
|
return this.resolve(t), t;
|
|
1719
1985
|
} catch (e) {
|
|
1720
|
-
let t =
|
|
1986
|
+
let t = Ht(e);
|
|
1721
1987
|
throw this.fail(t), t;
|
|
1722
1988
|
}
|
|
1723
1989
|
}
|
|
@@ -1730,7 +1996,7 @@ var Ut = class {
|
|
|
1730
1996
|
return e;
|
|
1731
1997
|
}
|
|
1732
1998
|
resolve(e) {
|
|
1733
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
1999
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new bt()));
|
|
1734
2000
|
}
|
|
1735
2001
|
fail(e) {
|
|
1736
2002
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
@@ -1742,7 +2008,7 @@ var Ut = class {
|
|
|
1742
2008
|
}
|
|
1743
2009
|
await new Promise((t, n) => {
|
|
1744
2010
|
let r = setTimeout(() => {
|
|
1745
|
-
n(new
|
|
2011
|
+
n(new xt());
|
|
1746
2012
|
}, e);
|
|
1747
2013
|
this.pendingWriteWaiters.push({
|
|
1748
2014
|
resolve: () => {
|
|
@@ -1761,13 +2027,13 @@ var Ut = class {
|
|
|
1761
2027
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
1762
2028
|
}
|
|
1763
2029
|
};
|
|
1764
|
-
function
|
|
2030
|
+
function Gt(e) {
|
|
1765
2031
|
let t = null, n = (t, n) => {
|
|
1766
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2032
|
+
if (!e.getCapabilities()[n]) throw new yt(t, n);
|
|
1767
2033
|
}, r = {
|
|
1768
2034
|
async speak(r) {
|
|
1769
2035
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
1770
|
-
let i =
|
|
2036
|
+
let i = Ot(r.queue ?? "append");
|
|
1771
2037
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
1772
2038
|
let a = e.getIframeHost();
|
|
1773
2039
|
if (!a) throw new Z("Speech session is not attached.");
|
|
@@ -1787,41 +2053,41 @@ function Wt(e) {
|
|
|
1787
2053
|
return;
|
|
1788
2054
|
}
|
|
1789
2055
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
1790
|
-
t.removeEventListener("abort", s), n(
|
|
2056
|
+
t.removeEventListener("abort", s), n(Vt(e, "completed"));
|
|
1791
2057
|
}, (a) => {
|
|
1792
|
-
if (t.removeEventListener("abort", s),
|
|
2058
|
+
if (t.removeEventListener("abort", s), Ut(a)) {
|
|
1793
2059
|
n({
|
|
1794
2060
|
utteranceId: "utt_interrupted",
|
|
1795
2061
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1796
2062
|
status: "interrupted",
|
|
1797
2063
|
durationMs: 0,
|
|
1798
2064
|
transcript: r.text,
|
|
1799
|
-
animation:
|
|
2065
|
+
animation: St("none")
|
|
1800
2066
|
});
|
|
1801
2067
|
return;
|
|
1802
2068
|
}
|
|
1803
|
-
i(
|
|
2069
|
+
i(Ht(a));
|
|
1804
2070
|
});
|
|
1805
2071
|
});
|
|
1806
2072
|
}
|
|
1807
2073
|
try {
|
|
1808
|
-
return
|
|
2074
|
+
return Vt(await o, "completed");
|
|
1809
2075
|
} catch (t) {
|
|
1810
|
-
if (
|
|
2076
|
+
if (Ut(t)) return {
|
|
1811
2077
|
utteranceId: "utt_interrupted",
|
|
1812
2078
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1813
2079
|
status: "interrupted",
|
|
1814
2080
|
durationMs: 0,
|
|
1815
2081
|
transcript: r.text,
|
|
1816
|
-
animation:
|
|
2082
|
+
animation: St("none")
|
|
1817
2083
|
};
|
|
1818
|
-
throw
|
|
2084
|
+
throw Ht(t);
|
|
1819
2085
|
}
|
|
1820
2086
|
},
|
|
1821
2087
|
async play(i) {
|
|
1822
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2088
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Tt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1823
2089
|
let a = i.queue ?? "append";
|
|
1824
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2090
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), gt(i.audio)) {
|
|
1825
2091
|
let e = i.audio.sampleRate ?? 24e3;
|
|
1826
2092
|
return r.createUtterance({
|
|
1827
2093
|
format: {
|
|
@@ -1837,7 +2103,7 @@ function Wt(e) {
|
|
|
1837
2103
|
}
|
|
1838
2104
|
let o = e.getIframeHost();
|
|
1839
2105
|
if (!o) throw new Z("Speech session is not attached.");
|
|
1840
|
-
let s = await
|
|
2106
|
+
let s = await zt(i.audio, i.signal);
|
|
1841
2107
|
return o.speechPlay({
|
|
1842
2108
|
source: s,
|
|
1843
2109
|
characterId: i.characterId,
|
|
@@ -1849,13 +2115,13 @@ function Wt(e) {
|
|
|
1849
2115
|
},
|
|
1850
2116
|
createUtterance(r) {
|
|
1851
2117
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
1852
|
-
let i =
|
|
2118
|
+
let i = Et(r);
|
|
1853
2119
|
if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
|
|
1854
2120
|
let a = r.queue ?? "replace-active";
|
|
1855
2121
|
if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
|
|
1856
2122
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
1857
|
-
let o = new
|
|
1858
|
-
id:
|
|
2123
|
+
let o = new Wt({
|
|
2124
|
+
id: Bt(),
|
|
1859
2125
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1860
2126
|
format: i,
|
|
1861
2127
|
queue: a,
|
|
@@ -1867,7 +2133,7 @@ function Wt(e) {
|
|
|
1867
2133
|
t === o && (t = null);
|
|
1868
2134
|
}), r.track && (async () => {
|
|
1869
2135
|
try {
|
|
1870
|
-
if (await
|
|
2136
|
+
if (await Rt({
|
|
1871
2137
|
track: r.track,
|
|
1872
2138
|
utterance: o,
|
|
1873
2139
|
sampleRate: i.sampleRate,
|
|
@@ -1895,16 +2161,16 @@ function Wt(e) {
|
|
|
1895
2161
|
}
|
|
1896
2162
|
//#endregion
|
|
1897
2163
|
//#region src/v2/types/sessionInteraction.ts
|
|
1898
|
-
function
|
|
2164
|
+
function Kt(e) {
|
|
1899
2165
|
let t = e?.trim();
|
|
1900
2166
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
1901
2167
|
}
|
|
1902
2168
|
//#endregion
|
|
1903
2169
|
//#region src/v2/experience.ts
|
|
1904
|
-
function
|
|
2170
|
+
function qt(e) {
|
|
1905
2171
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
1906
2172
|
}
|
|
1907
|
-
var
|
|
2173
|
+
var Jt = class e {
|
|
1908
2174
|
bootstrap;
|
|
1909
2175
|
conversationProcessor;
|
|
1910
2176
|
iframeHost = null;
|
|
@@ -1918,17 +2184,19 @@ var qt = class e {
|
|
|
1918
2184
|
closed = !1;
|
|
1919
2185
|
attached = !1;
|
|
1920
2186
|
pendingFit = null;
|
|
2187
|
+
lastInteraction = null;
|
|
1921
2188
|
closeHandlers = [];
|
|
1922
|
-
eventRegistry =
|
|
2189
|
+
eventRegistry = ut();
|
|
1923
2190
|
readyEnvelope = null;
|
|
1924
2191
|
startedEnvelope = null;
|
|
2192
|
+
sessionMintedEnvelope = null;
|
|
1925
2193
|
conversationCache = [];
|
|
1926
2194
|
speech;
|
|
1927
2195
|
constructor(e) {
|
|
1928
|
-
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 =
|
|
2196
|
+
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 = Gt({
|
|
1929
2197
|
getIframeHost: () => this.iframeHost,
|
|
1930
2198
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
1931
|
-
getCapabilities: () =>
|
|
2199
|
+
getCapabilities: () => Yt(this.resolvedSession),
|
|
1932
2200
|
getActiveCharacterId: () => "character_unknown",
|
|
1933
2201
|
onProcessorInterrupt: () => {
|
|
1934
2202
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -1973,6 +2241,7 @@ var qt = class e {
|
|
|
1973
2241
|
speechInputMode: t.speechInputMode,
|
|
1974
2242
|
speechOnly: t.speechOnly,
|
|
1975
2243
|
attribution: t.attribution,
|
|
2244
|
+
alreadyConverted: t.alreadyConverted,
|
|
1976
2245
|
ui: t.ui,
|
|
1977
2246
|
onStart: t.onStart,
|
|
1978
2247
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -1995,6 +2264,7 @@ var qt = class e {
|
|
|
1995
2264
|
speechInputMode: t.speechInputMode,
|
|
1996
2265
|
speechOnly: t.speechOnly,
|
|
1997
2266
|
attribution: t.attribution,
|
|
2267
|
+
alreadyConverted: t.alreadyConverted,
|
|
1998
2268
|
ui: t.ui,
|
|
1999
2269
|
onStart: t.onStart,
|
|
2000
2270
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2009,8 +2279,8 @@ var qt = class e {
|
|
|
2009
2279
|
return null;
|
|
2010
2280
|
}
|
|
2011
2281
|
on(e, t) {
|
|
2012
|
-
let n =
|
|
2013
|
-
return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
|
|
2282
|
+
let n = dt(this.eventRegistry, e, t);
|
|
2283
|
+
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;
|
|
2014
2284
|
}
|
|
2015
2285
|
async attach(e) {
|
|
2016
2286
|
if (this.closed) throw Error("Session has ended.");
|
|
@@ -2023,7 +2293,7 @@ var qt = class e {
|
|
|
2023
2293
|
if (this.closed) throw Error("Session has ended.");
|
|
2024
2294
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2025
2295
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2026
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2296
|
+
let t = this.bootstrap.embedBaseUrl ?? rt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = at(t, n, r ? void 0 : it(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, qt(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = st(i), o = null, s = new Promise((e) => {
|
|
2027
2297
|
o = e;
|
|
2028
2298
|
}), c = null, l = new Promise((e) => {
|
|
2029
2299
|
c = e;
|
|
@@ -2068,6 +2338,9 @@ var qt = class e {
|
|
|
2068
2338
|
onActivityChange: (e) => {
|
|
2069
2339
|
this.emitWrapped("activityChange", e);
|
|
2070
2340
|
},
|
|
2341
|
+
onInteractionChange: (e) => {
|
|
2342
|
+
this.lastInteraction = e, this.emitWrapped("interactionChange", e);
|
|
2343
|
+
},
|
|
2071
2344
|
onFeedback: (e) => {
|
|
2072
2345
|
this.emitWrapped("feedback", e);
|
|
2073
2346
|
},
|
|
@@ -2102,6 +2375,7 @@ var qt = class e {
|
|
|
2102
2375
|
speechInputMode: p.speechInputMode,
|
|
2103
2376
|
speechOnly: this.bootstrap.speechOnly,
|
|
2104
2377
|
attribution: this.bootstrap.attribution,
|
|
2378
|
+
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2105
2379
|
signal: this.endpointAbortController.signal
|
|
2106
2380
|
})) : this.bootstrap.kind === "public" ? ke(this.bootstrap.experienceId, {
|
|
2107
2381
|
locale: this.bootstrap.locale,
|
|
@@ -2111,7 +2385,8 @@ var qt = class e {
|
|
|
2111
2385
|
mode: p.mode,
|
|
2112
2386
|
speechInputMode: p.speechInputMode,
|
|
2113
2387
|
speechOnly: this.bootstrap.speechOnly,
|
|
2114
|
-
attribution: this.bootstrap.attribution
|
|
2388
|
+
attribution: this.bootstrap.attribution,
|
|
2389
|
+
alreadyConverted: this.bootstrap.alreadyConverted
|
|
2115
2390
|
}) : Promise.resolve(this.bootstrap.session ? {
|
|
2116
2391
|
session: this.bootstrap.session,
|
|
2117
2392
|
launch: this.bootstrap.launch
|
|
@@ -2119,6 +2394,16 @@ var qt = class e {
|
|
|
2119
2394
|
try {
|
|
2120
2395
|
[, h] = await Promise.all([f.waitForLoad(), m]);
|
|
2121
2396
|
} catch (e) {
|
|
2397
|
+
try {
|
|
2398
|
+
f.reportSdkError({
|
|
2399
|
+
errorCode: "sdk.session.attach_failed",
|
|
2400
|
+
severity: "error",
|
|
2401
|
+
operation: "attach",
|
|
2402
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2403
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2404
|
+
release: $e
|
|
2405
|
+
});
|
|
2406
|
+
} catch {}
|
|
2122
2407
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
2123
2408
|
} finally {
|
|
2124
2409
|
this.endpointAbortController = null;
|
|
@@ -2126,7 +2411,9 @@ var qt = class e {
|
|
|
2126
2411
|
f.postParentHello();
|
|
2127
2412
|
let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2128
2413
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2129
|
-
|
|
2414
|
+
this.launchToken = g;
|
|
2415
|
+
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2416
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Se(_), f.postLaunch(g, _, {
|
|
2130
2417
|
startButton: e.startButton,
|
|
2131
2418
|
theme: e.theme,
|
|
2132
2419
|
showFeedback: e.showFeedback
|
|
@@ -2136,9 +2423,33 @@ var qt = class e {
|
|
|
2136
2423
|
showFeedback: e.showFeedback
|
|
2137
2424
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2138
2425
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
2139
|
-
})])
|
|
2426
|
+
})]).catch((e) => {
|
|
2427
|
+
try {
|
|
2428
|
+
f.reportSdkError({
|
|
2429
|
+
errorCode: "sdk.session.attach_failed",
|
|
2430
|
+
severity: "error",
|
|
2431
|
+
operation: "attach",
|
|
2432
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2433
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2434
|
+
release: $e
|
|
2435
|
+
});
|
|
2436
|
+
} catch {}
|
|
2437
|
+
throw e;
|
|
2438
|
+
}), await Promise.race([l, new Promise((e, t) => {
|
|
2140
2439
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
|
|
2141
|
-
})])
|
|
2440
|
+
})]).catch((e) => {
|
|
2441
|
+
try {
|
|
2442
|
+
f.reportSdkError({
|
|
2443
|
+
errorCode: "sdk.session.attach_failed",
|
|
2444
|
+
severity: "error",
|
|
2445
|
+
operation: "attach",
|
|
2446
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2447
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2448
|
+
release: $e
|
|
2449
|
+
});
|
|
2450
|
+
} catch {}
|
|
2451
|
+
throw e;
|
|
2452
|
+
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
|
|
2142
2453
|
}
|
|
2143
2454
|
async startListening() {
|
|
2144
2455
|
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
@@ -2162,16 +2473,33 @@ var qt = class e {
|
|
|
2162
2473
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2163
2474
|
}
|
|
2164
2475
|
async setFit(e) {
|
|
2165
|
-
let t =
|
|
2476
|
+
let t = Kt(e);
|
|
2166
2477
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2167
2478
|
if (this.closed) throw Error("Session has ended.");
|
|
2168
2479
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
2169
2480
|
}
|
|
2481
|
+
async setInteraction(e) {
|
|
2482
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2483
|
+
if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
|
|
2484
|
+
let t = await this.iframeHost.setInteraction(e);
|
|
2485
|
+
return this.lastInteraction = t, t;
|
|
2486
|
+
}
|
|
2487
|
+
async getInteraction() {
|
|
2488
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2489
|
+
if (!this.iframeHost) throw Error("getInteraction() requires attach() first.");
|
|
2490
|
+
let e = await this.iframeHost.getInteraction();
|
|
2491
|
+
return this.lastInteraction = e, e;
|
|
2492
|
+
}
|
|
2170
2493
|
async conversion(e) {
|
|
2171
2494
|
if (this.closed) throw Error("Session has ended.");
|
|
2172
2495
|
if (!this.iframeHost) throw Error("conversion() requires attach() first.");
|
|
2173
2496
|
await this.iframeHost.conversion(e);
|
|
2174
2497
|
}
|
|
2498
|
+
async engage() {
|
|
2499
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2500
|
+
if (!this.iframeHost) throw Error("engage() requires attach() first.");
|
|
2501
|
+
await this.iframeHost.engage();
|
|
2502
|
+
}
|
|
2175
2503
|
getLastTurn() {
|
|
2176
2504
|
if (this.conversationCache.length === 0) return [];
|
|
2177
2505
|
let e = this.conversationCache[this.conversationCache.length - 1].turnId;
|
|
@@ -2181,7 +2509,7 @@ var qt = class e {
|
|
|
2181
2509
|
this.close();
|
|
2182
2510
|
}
|
|
2183
2511
|
destroy() {
|
|
2184
|
-
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,
|
|
2512
|
+
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, pt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
2185
2513
|
}
|
|
2186
2514
|
resolveMintInteraction() {
|
|
2187
2515
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2193,8 +2521,8 @@ var qt = class e {
|
|
|
2193
2521
|
return this.resolvedSession?.id ?? "";
|
|
2194
2522
|
}
|
|
2195
2523
|
emitWrapped(e, t) {
|
|
2196
|
-
let n =
|
|
2197
|
-
return
|
|
2524
|
+
let n = lt(e, this.getSessionId(), t);
|
|
2525
|
+
return ft(this.eventRegistry, e, n), n;
|
|
2198
2526
|
}
|
|
2199
2527
|
queueProcessorTurn(e) {
|
|
2200
2528
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2253,7 +2581,7 @@ var qt = class e {
|
|
|
2253
2581
|
};
|
|
2254
2582
|
}
|
|
2255
2583
|
};
|
|
2256
|
-
function
|
|
2584
|
+
function Yt(e) {
|
|
2257
2585
|
return e ? {
|
|
2258
2586
|
textSpeech: e.capabilities.speech.output,
|
|
2259
2587
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -2264,26 +2592,26 @@ function Jt(e) {
|
|
|
2264
2592
|
}
|
|
2265
2593
|
//#endregion
|
|
2266
2594
|
//#region src/widget/dockGeometry.ts
|
|
2267
|
-
var
|
|
2268
|
-
function
|
|
2595
|
+
var Xt = "(min-width: 768px)", Zt = 24, Qt = .5, $t = 1200, en = .85, tn = 9 / 16;
|
|
2596
|
+
function nn() {
|
|
2269
2597
|
if (typeof window > "u") return 800;
|
|
2270
2598
|
let e = window.screen?.availHeight;
|
|
2271
2599
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
2272
2600
|
}
|
|
2273
|
-
function
|
|
2274
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
2275
|
-
return s > a && (s = a, o = s /
|
|
2601
|
+
function rn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Zt, r = typeof window < "u" ? nn() : 800) {
|
|
2602
|
+
let i = Math.max(160, Math.min(t - n * 2, t * en)), a = Math.max(120, e - n * 2), o = Math.min(r * Qt, $t, i), s = o * tn;
|
|
2603
|
+
return s > a && (s = a, o = s / tn, o > i && (o = i, s = o * tn)), {
|
|
2276
2604
|
width: Math.round(s),
|
|
2277
2605
|
height: Math.round(o)
|
|
2278
2606
|
};
|
|
2279
2607
|
}
|
|
2280
|
-
function
|
|
2608
|
+
function an(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Zt) {
|
|
2281
2609
|
return {
|
|
2282
2610
|
left: Math.max(r, t - e.width - r),
|
|
2283
2611
|
top: Math.max(r, n - e.height - r)
|
|
2284
2612
|
};
|
|
2285
2613
|
}
|
|
2286
|
-
function
|
|
2614
|
+
function on(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Zt) {
|
|
2287
2615
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
2288
2616
|
return {
|
|
2289
2617
|
left: Math.min(Math.max(a, e), o),
|
|
@@ -2291,14 +2619,14 @@ function an(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
|
|
|
2291
2619
|
};
|
|
2292
2620
|
}
|
|
2293
2621
|
function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
2294
|
-
return e(
|
|
2622
|
+
return e(Xt).matches;
|
|
2295
2623
|
}
|
|
2296
2624
|
//#endregion
|
|
2297
2625
|
//#region src/widget/mountExperienceWidget.ts
|
|
2298
|
-
function
|
|
2626
|
+
function sn(e) {
|
|
2299
2627
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
2300
2628
|
}
|
|
2301
|
-
function
|
|
2629
|
+
function cn(e) {
|
|
2302
2630
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
2303
2631
|
let t = typeof e == "string" ? e.trim() : "";
|
|
2304
2632
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -2306,9 +2634,9 @@ function sn(e) {
|
|
|
2306
2634
|
function $(e) {
|
|
2307
2635
|
return e === "expanded" || e === "docked";
|
|
2308
2636
|
}
|
|
2309
|
-
var
|
|
2310
|
-
function
|
|
2311
|
-
|
|
2637
|
+
var ln = "<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>", un = "<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>", dn = "<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>", fn = "<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>";
|
|
2638
|
+
function pn(e, t, n) {
|
|
2639
|
+
ne(L);
|
|
2312
2640
|
let r = c({
|
|
2313
2641
|
galleryThumb: t.galleryThumb,
|
|
2314
2642
|
avatarImage: t.avatarImage,
|
|
@@ -2335,9 +2663,9 @@ function fn(e, t, n) {
|
|
|
2335
2663
|
let e = document.createElement("img");
|
|
2336
2664
|
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);
|
|
2337
2665
|
}
|
|
2338
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
2666
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : te(i);
|
|
2339
2667
|
}
|
|
2340
|
-
function
|
|
2668
|
+
function mn(e) {
|
|
2341
2669
|
return e.startButton ? {
|
|
2342
2670
|
...e.startButton,
|
|
2343
2671
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -2349,7 +2677,7 @@ function pn(e) {
|
|
|
2349
2677
|
variant: "primary"
|
|
2350
2678
|
};
|
|
2351
2679
|
}
|
|
2352
|
-
function
|
|
2680
|
+
function hn(e) {
|
|
2353
2681
|
let t = !1, n = () => {
|
|
2354
2682
|
t || e();
|
|
2355
2683
|
}, r = () => {
|
|
@@ -2369,12 +2697,12 @@ function mn(e) {
|
|
|
2369
2697
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
2370
2698
|
};
|
|
2371
2699
|
}
|
|
2372
|
-
function
|
|
2373
|
-
|
|
2700
|
+
function gn(e, t) {
|
|
2701
|
+
ae(re);
|
|
2374
2702
|
let n = t.experienceId?.trim();
|
|
2375
2703
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
2376
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
2377
|
-
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",
|
|
2704
|
+
let r = t.prefetch ?? "onExpand", i = sn(t.position), a = document.createElement("div");
|
|
2705
|
+
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", cn(t.offset));
|
|
2378
2706
|
let o = document.createElement("button");
|
|
2379
2707
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
2380
2708
|
let s = document.createElement("div");
|
|
@@ -2394,22 +2722,22 @@ function hn(e, t) {
|
|
|
2394
2722
|
let m = document.createElement("span");
|
|
2395
2723
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
2396
2724
|
let h = document.createElement("button");
|
|
2397
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
2725
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = dn, h.setAttribute("aria-label", "Reduce");
|
|
2398
2726
|
let g = document.createElement("button");
|
|
2399
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
2727
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = ln, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
2400
2728
|
let _ = document.createElement("button");
|
|
2401
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
2729
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = un, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
2402
2730
|
let v = document.createElement("div");
|
|
2403
2731
|
v.className = "liforma-ew__stage";
|
|
2404
2732
|
let y = document.createElement("div");
|
|
2405
2733
|
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);
|
|
2406
|
-
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,
|
|
2734
|
+
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, ne = new AbortController(), ie = t.parallax !== !1, z = () => {
|
|
2407
2735
|
let e = a.dataset.state;
|
|
2408
2736
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
2409
|
-
},
|
|
2737
|
+
}, oe = () => {
|
|
2410
2738
|
M !== null && (clearTimeout(M), M = null);
|
|
2411
2739
|
}, se = () => {
|
|
2412
|
-
|
|
2740
|
+
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
2413
2741
|
}, ce = () => {
|
|
2414
2742
|
for (let e of [
|
|
2415
2743
|
f,
|
|
@@ -2425,43 +2753,43 @@ function hn(e, t) {
|
|
|
2425
2753
|
let a = p.offsetWidth || 120;
|
|
2426
2754
|
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";
|
|
2427
2755
|
}, B = (e, t) => {
|
|
2428
|
-
if (
|
|
2429
|
-
let n =
|
|
2430
|
-
|
|
2756
|
+
if (z() !== "docked") return;
|
|
2757
|
+
let n = rn(), r = on(e - ee, t - te, n);
|
|
2758
|
+
P = r.left, F = r.top, le(r.left, r.top, n.width, n.height);
|
|
2431
2759
|
}, de = (e, t) => {
|
|
2432
|
-
if (
|
|
2433
|
-
let n =
|
|
2434
|
-
|
|
2760
|
+
if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
2761
|
+
let n = rn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = on(r + e, i + t, n);
|
|
2762
|
+
P = a.left, F = a.top, le(a.left, a.top, n.width, n.height);
|
|
2435
2763
|
}, fe = (e) => {
|
|
2436
|
-
|
|
2764
|
+
L === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), B(e.clientX, e.clientY)));
|
|
2437
2765
|
}, V = (e) => {
|
|
2438
|
-
if (
|
|
2439
|
-
let t =
|
|
2440
|
-
|
|
2766
|
+
if (I === null || e && e.pointerId !== I) return;
|
|
2767
|
+
let t = L;
|
|
2768
|
+
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", fe), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
2441
2769
|
}, pe = (e, t, n) => {
|
|
2442
|
-
if (S ||
|
|
2443
|
-
|
|
2770
|
+
if (S || z() !== "docked" || !Q() || I !== null) return;
|
|
2771
|
+
I = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2444
2772
|
let r = f.getBoundingClientRect();
|
|
2445
|
-
|
|
2773
|
+
ee = e - r.left, te = t - r.top, R || (R = !0, window.addEventListener("pointermove", fe), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
2446
2774
|
}, H = (e) => {
|
|
2447
|
-
if (S ||
|
|
2448
|
-
|
|
2775
|
+
if (S || z() !== "docked" || !Q() || I !== null) return;
|
|
2776
|
+
I = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2449
2777
|
let t = f.getBoundingClientRect();
|
|
2450
|
-
|
|
2778
|
+
P = t.left, F = t.top;
|
|
2451
2779
|
}, me = (e) => {
|
|
2452
|
-
|
|
2780
|
+
L === "player" && (I === null || e.pointerId !== I || de(e.dx, e.dy));
|
|
2453
2781
|
}, he = (e) => {
|
|
2454
|
-
|
|
2782
|
+
L === "player" && (I === null || e.pointerId !== I || V());
|
|
2455
2783
|
}, U = () => {
|
|
2456
|
-
let e = Q(), t =
|
|
2784
|
+
let e = Q(), t = z();
|
|
2457
2785
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
2458
2786
|
h.hidden = !0;
|
|
2459
2787
|
return;
|
|
2460
2788
|
}
|
|
2461
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
2789
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = fn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = dn, h.setAttribute("aria-label", "Reduce"));
|
|
2462
2790
|
}, ge = (e) => {
|
|
2463
|
-
let t =
|
|
2464
|
-
n =
|
|
2791
|
+
let t = rn(), n = e && P !== null && F !== null ? on(P, F, t) : an(t);
|
|
2792
|
+
n = on(n.left, n.top, t), P = n.left, F = n.top, le(n.left, n.top, t.width, t.height), U();
|
|
2465
2793
|
}, _e = () => {
|
|
2466
2794
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
2467
2795
|
requestAnimationFrame(() => {
|
|
@@ -2473,15 +2801,15 @@ function hn(e, t) {
|
|
|
2473
2801
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2474
2802
|
return;
|
|
2475
2803
|
}
|
|
2476
|
-
|
|
2477
|
-
if (
|
|
2804
|
+
N = setTimeout(() => {
|
|
2805
|
+
if (N = null, S || !$(a.dataset.state)) {
|
|
2478
2806
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2479
2807
|
return;
|
|
2480
2808
|
}
|
|
2481
2809
|
a.classList.remove("liforma-ew--layout-settling"), _e();
|
|
2482
2810
|
}, 220);
|
|
2483
2811
|
}, G = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
2484
|
-
|
|
2812
|
+
oe(), M = setTimeout(() => {
|
|
2485
2813
|
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
2486
2814
|
}, 280);
|
|
2487
2815
|
})), ve = {
|
|
@@ -2508,20 +2836,20 @@ function hn(e, t) {
|
|
|
2508
2836
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
2509
2837
|
}, Se = (e) => {
|
|
2510
2838
|
A?.(), A = null;
|
|
2511
|
-
let t =
|
|
2839
|
+
let t = pn(s, e, { parallax: ie });
|
|
2512
2840
|
return t ? (A = t, !0) : !1;
|
|
2513
2841
|
}, Ce = () => {
|
|
2514
2842
|
if (Se(ve)) {
|
|
2515
2843
|
be();
|
|
2516
2844
|
return;
|
|
2517
2845
|
}
|
|
2518
|
-
ye("Loading…"), ue(n, { signal:
|
|
2846
|
+
ye("Loading…"), ue(n, { signal: ne.signal }).then((e) => {
|
|
2519
2847
|
if (!S) {
|
|
2520
2848
|
if (!Se({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
2521
2849
|
be();
|
|
2522
2850
|
}
|
|
2523
2851
|
}).catch((e) => {
|
|
2524
|
-
if (S ||
|
|
2852
|
+
if (S || ne.signal.aborted) return;
|
|
2525
2853
|
let n = e instanceof Error ? e : Error(String(e));
|
|
2526
2854
|
ye("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
2527
2855
|
});
|
|
@@ -2534,10 +2862,11 @@ function hn(e, t) {
|
|
|
2534
2862
|
...t.mode ? { mode: t.mode } : {},
|
|
2535
2863
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
2536
2864
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
2865
|
+
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
2537
2866
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
2538
2867
|
}), Te = () => ({
|
|
2539
2868
|
...t.fit ? { fit: t.fit } : {},
|
|
2540
|
-
startButton:
|
|
2869
|
+
startButton: mn(t),
|
|
2541
2870
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
|
|
2542
2871
|
}), q = (e = !0) => {
|
|
2543
2872
|
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ce(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), U(), e && t.onExpanded?.();
|
|
@@ -2554,7 +2883,7 @@ function hn(e, t) {
|
|
|
2554
2883
|
}, Oe = () => {
|
|
2555
2884
|
se(), u.hidden = !0, p.hidden = !0, ce(), 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), U();
|
|
2556
2885
|
}, ke = () => {
|
|
2557
|
-
|
|
2886
|
+
oe(), se(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
2558
2887
|
let e = b;
|
|
2559
2888
|
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");
|
|
2560
2889
|
}, J = () => {
|
|
@@ -2569,26 +2898,26 @@ function hn(e, t) {
|
|
|
2569
2898
|
ke(), Oe(), t.onCollapsed?.(), t.onClose?.();
|
|
2570
2899
|
}
|
|
2571
2900
|
}, Ae = () => {
|
|
2572
|
-
S || Q() &&
|
|
2901
|
+
S || Q() && z() === "expanded" && W(() => {
|
|
2573
2902
|
Ee();
|
|
2574
2903
|
});
|
|
2575
2904
|
}, je = () => {
|
|
2576
|
-
S ||
|
|
2905
|
+
S || z() === "docked" && (V(), W(() => {
|
|
2577
2906
|
ce(), q(!1), b?.setWidgetChrome("expanded");
|
|
2578
2907
|
}));
|
|
2579
2908
|
}, Me = () => {
|
|
2580
|
-
!b || !D || (
|
|
2909
|
+
!b || !D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, _e());
|
|
2581
2910
|
}, Ne = () => {
|
|
2582
|
-
!b || !E || D || (
|
|
2911
|
+
!b || !E || D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
2583
2912
|
}, Pe = (e) => {
|
|
2584
|
-
S || e !== O && !D || (
|
|
2913
|
+
S || e !== O && !D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, D && _e());
|
|
2585
2914
|
}, Fe = () => {
|
|
2586
2915
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
2587
2916
|
T = !0;
|
|
2588
2917
|
let e = O;
|
|
2589
2918
|
l.hidden = !1, (async () => {
|
|
2590
2919
|
try {
|
|
2591
|
-
let t = await
|
|
2920
|
+
let t = await Jt.startSession(we());
|
|
2592
2921
|
if (S || e !== O) {
|
|
2593
2922
|
t.destroy();
|
|
2594
2923
|
return;
|
|
@@ -2647,7 +2976,7 @@ function hn(e, t) {
|
|
|
2647
2976
|
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 () => {
|
|
2648
2977
|
try {
|
|
2649
2978
|
q();
|
|
2650
|
-
let t = await
|
|
2979
|
+
let t = await Jt.startSession(we());
|
|
2651
2980
|
if (S || e !== O) {
|
|
2652
2981
|
t.destroy();
|
|
2653
2982
|
return;
|
|
@@ -2704,22 +3033,22 @@ function hn(e, t) {
|
|
|
2704
3033
|
Ie();
|
|
2705
3034
|
}
|
|
2706
3035
|
}, Re = (e) => {
|
|
2707
|
-
if (e.stopPropagation(),
|
|
3036
|
+
if (e.stopPropagation(), z() === "expanded") {
|
|
2708
3037
|
Ae();
|
|
2709
3038
|
return;
|
|
2710
3039
|
}
|
|
2711
|
-
|
|
3040
|
+
z() === "docked" && je();
|
|
2712
3041
|
}, ze = (e) => {
|
|
2713
3042
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
2714
3043
|
}, Be = (e) => {
|
|
2715
3044
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
2716
3045
|
}, Ve = (e) => {
|
|
2717
|
-
|
|
3046
|
+
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), pe(e.clientX, e.clientY, e.pointerId)));
|
|
2718
3047
|
}, He = (e) => {
|
|
2719
3048
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), J());
|
|
2720
3049
|
}, Ue = () => {
|
|
2721
3050
|
if (!S) {
|
|
2722
|
-
if (
|
|
3051
|
+
if (z() === "docked") {
|
|
2723
3052
|
if (!Q()) {
|
|
2724
3053
|
je();
|
|
2725
3054
|
return;
|
|
@@ -2731,9 +3060,9 @@ function hn(e, t) {
|
|
|
2731
3060
|
}
|
|
2732
3061
|
U();
|
|
2733
3062
|
}
|
|
2734
|
-
}, We = typeof window < "u" ? window.matchMedia(
|
|
3063
|
+
}, We = typeof window < "u" ? window.matchMedia(Xt) : null, Ge = () => {
|
|
2735
3064
|
if (!S) {
|
|
2736
|
-
if (
|
|
3065
|
+
if (z() === "docked" && !Q()) {
|
|
2737
3066
|
je();
|
|
2738
3067
|
return;
|
|
2739
3068
|
}
|
|
@@ -2744,7 +3073,7 @@ function hn(e, t) {
|
|
|
2744
3073
|
e.stopPropagation(), J();
|
|
2745
3074
|
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), Ce(), U(), r === "eager" ? queueMicrotask(() => {
|
|
2746
3075
|
S || Fe();
|
|
2747
|
-
}) : r === "idle" && (j =
|
|
3076
|
+
}) : r === "idle" && (j = hn(() => {
|
|
2748
3077
|
S || Fe();
|
|
2749
3078
|
})), {
|
|
2750
3079
|
root: a,
|
|
@@ -2760,11 +3089,11 @@ function hn(e, t) {
|
|
|
2760
3089
|
Fe();
|
|
2761
3090
|
},
|
|
2762
3091
|
destroy() {
|
|
2763
|
-
S || (S = !0, V(), j?.(), j = null,
|
|
3092
|
+
S || (S = !0, V(), j?.(), j = null, ne.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), ke(), Oe(), e.replaceChildren());
|
|
2764
3093
|
}
|
|
2765
3094
|
};
|
|
2766
3095
|
}
|
|
2767
3096
|
//#endregion
|
|
2768
|
-
export {
|
|
3097
|
+
export { L as EXPERIENCE_THUMBNAIL_CSS, re as EXPERIENCE_WIDGET_CSS, Jt as Experience, B as LiformaError, X as SPEECH_LIMITS, xt as SpeechBufferTimeoutError, Z as SpeechRuntimeError, bt as SpeechUtteranceClosedError, yt as UnsupportedSpeechOperationError, D as attachImageReady, E as attachLazyThumb, ee as attachScrollLinkedParallax, m as buildHostedLaunchUrl, ne as ensureExperienceThumbnailStyles, ae as ensureExperienceWidgetStyles, ue as fetchExperiencePreview, C as getDefaultLazyRootMargin, k as horizontalParallaxFromViewportY, fe as liformaErrorFromResponse, gn as mountExperienceWidget, n as navigateOnExperienceClose, h as resolveThumbnailHref, f as resolveThumbnailInteraction, c as resolveThumbnailLayers, r as thumbnailFitClass, s as toGalleryThumbUrl, Se as warnLocaleVoiceFallbacks };
|
|
2769
3098
|
|
|
2770
3099
|
//# sourceMappingURL=index.js.map
|