@liforma/client 0.4.8 → 0.4.10
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 +25 -0
- package/dist/next/index.js +516 -185
- 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/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 +35 -1
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +17 -2
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/experienceEvents.d.ts +3 -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 +29 -0
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/next/v2/types/sessionManifest.d.ts +1 -0
- package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/types.d.ts +5 -0
- package/dist/next/widget/types.d.ts.map +1 -1
- package/dist/npm/index.js +542 -225
- 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/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 +35 -1
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +17 -2
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/experienceEvents.d.ts +3 -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/liforma-experience.d.ts +2 -0
- package/dist/npm/v2/liforma-experience.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/types/sessionInteraction.d.ts +29 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionManifest.d.ts +1 -0
- package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionManifestSchema.d.ts +17 -0
- package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/types.d.ts +5 -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/experienceComponentRuntime.d.ts +1 -0
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +7 -0
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +977 -642
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- 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/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 +35 -1
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +17 -2
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/experienceEvents.d.ts +3 -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 +29 -0
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/react/v2/types/sessionManifest.d.ts +1 -0
- package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/types.d.ts +5 -0
- package/dist/react/widget/types.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +2 -2
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/svelte/Experience.svelte +6 -0
- 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/package.json +1 -1
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;
|
|
@@ -721,7 +722,7 @@ function Be(e) {
|
|
|
721
722
|
function Ve(e, t, n) {
|
|
722
723
|
let r = e.trim();
|
|
723
724
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
724
|
-
let i = n?.startButton, a = n?.theme, o = n?.showFeedback;
|
|
725
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction;
|
|
725
726
|
return {
|
|
726
727
|
type: "launch",
|
|
727
728
|
schemaVersion: 2,
|
|
@@ -730,7 +731,8 @@ function Ve(e, t, n) {
|
|
|
730
731
|
...t === void 0 ? {} : { session: t },
|
|
731
732
|
...i ? { startButton: i } : {},
|
|
732
733
|
...a ? { theme: a } : {},
|
|
733
|
-
...o === void 0 ? {} : { showFeedback: o }
|
|
734
|
+
...o === void 0 ? {} : { showFeedback: o },
|
|
735
|
+
...s ? { interaction: s } : {}
|
|
734
736
|
}
|
|
735
737
|
};
|
|
736
738
|
}
|
|
@@ -917,6 +919,9 @@ function Ze(e) {
|
|
|
917
919
|
case "fullWindow":
|
|
918
920
|
s(i.payload.active);
|
|
919
921
|
break;
|
|
922
|
+
case "interactionChange":
|
|
923
|
+
e.onInteractionChange?.(i.payload.interaction);
|
|
924
|
+
break;
|
|
920
925
|
}
|
|
921
926
|
};
|
|
922
927
|
if (window.addEventListener("message", x), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
|
|
@@ -1163,6 +1168,23 @@ function Ze(e) {
|
|
|
1163
1168
|
}
|
|
1164
1169
|
});
|
|
1165
1170
|
},
|
|
1171
|
+
setInteraction(e) {
|
|
1172
|
+
return C({
|
|
1173
|
+
type: "setInteraction",
|
|
1174
|
+
schemaVersion: 2,
|
|
1175
|
+
payload: {
|
|
1176
|
+
correlationId: Y(),
|
|
1177
|
+
interaction: e
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
},
|
|
1181
|
+
getInteraction() {
|
|
1182
|
+
return C({
|
|
1183
|
+
type: "getInteraction",
|
|
1184
|
+
schemaVersion: 2,
|
|
1185
|
+
payload: { correlationId: Y() }
|
|
1186
|
+
});
|
|
1187
|
+
},
|
|
1166
1188
|
conversion(e) {
|
|
1167
1189
|
return C({
|
|
1168
1190
|
type: "conversion",
|
|
@@ -1180,6 +1202,21 @@ function Ze(e) {
|
|
|
1180
1202
|
payload: { correlationId: Y() }
|
|
1181
1203
|
});
|
|
1182
1204
|
},
|
|
1205
|
+
reportSdkError(e) {
|
|
1206
|
+
return C({
|
|
1207
|
+
type: "reportSdkError",
|
|
1208
|
+
schemaVersion: 2,
|
|
1209
|
+
payload: {
|
|
1210
|
+
correlationId: Y(),
|
|
1211
|
+
errorCode: e.errorCode,
|
|
1212
|
+
message: e.message,
|
|
1213
|
+
stack: e.stack,
|
|
1214
|
+
severity: e.severity,
|
|
1215
|
+
operation: e.operation,
|
|
1216
|
+
release: e.release
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
},
|
|
1183
1220
|
destroy() {
|
|
1184
1221
|
if (!r) {
|
|
1185
1222
|
r = !0, i && s(!1);
|
|
@@ -1205,51 +1242,272 @@ function Qe(e) {
|
|
|
1205
1242
|
};
|
|
1206
1243
|
}
|
|
1207
1244
|
//#endregion
|
|
1208
|
-
//#region src/v2/
|
|
1209
|
-
var $e =
|
|
1210
|
-
|
|
1245
|
+
//#region src/v2/sdkRelease.ts
|
|
1246
|
+
var $e = `sdk@${{
|
|
1247
|
+
name: "@liforma/client",
|
|
1248
|
+
version: "0.4.10",
|
|
1249
|
+
type: "module",
|
|
1250
|
+
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1251
|
+
license: "MIT",
|
|
1252
|
+
homepage: "https://docs.liforma.ai",
|
|
1253
|
+
repository: {
|
|
1254
|
+
type: "git",
|
|
1255
|
+
url: "git+https://github.com/LiformaLtd/cdn.liforma.ai.git"
|
|
1256
|
+
},
|
|
1257
|
+
bugs: { url: "https://github.com/LiformaLtd/cdn.liforma.ai/issues" },
|
|
1258
|
+
publishConfig: { access: "public" },
|
|
1259
|
+
sideEffects: !1,
|
|
1260
|
+
exports: {
|
|
1261
|
+
".": {
|
|
1262
|
+
types: "./dist/npm/v2/npm.d.ts",
|
|
1263
|
+
import: "./dist/npm/index.js"
|
|
1264
|
+
},
|
|
1265
|
+
"./svelte": {
|
|
1266
|
+
types: "./dist/svelte/index.d.ts",
|
|
1267
|
+
import: "./dist/svelte/index.js",
|
|
1268
|
+
svelte: "./dist/svelte/index.js"
|
|
1269
|
+
},
|
|
1270
|
+
"./svelte/thumbnail": {
|
|
1271
|
+
types: "./dist/svelte/thumbnail.d.ts",
|
|
1272
|
+
import: "./dist/svelte/thumbnail.js",
|
|
1273
|
+
svelte: "./dist/svelte/thumbnail.js"
|
|
1274
|
+
},
|
|
1275
|
+
"./thumbnail": {
|
|
1276
|
+
types: "./dist/npm/thumbnail/index.d.ts",
|
|
1277
|
+
import: "./dist/npm/thumbnail/index.js"
|
|
1278
|
+
},
|
|
1279
|
+
"./react": {
|
|
1280
|
+
types: "./dist/react/react/index.d.ts",
|
|
1281
|
+
import: "./dist/react/index.js"
|
|
1282
|
+
},
|
|
1283
|
+
"./react/thumbnail": {
|
|
1284
|
+
types: "./dist/react/react/thumbnail.d.ts",
|
|
1285
|
+
import: "./dist/react/thumbnail.js"
|
|
1286
|
+
},
|
|
1287
|
+
"./next": {
|
|
1288
|
+
types: "./dist/next/next/index.d.ts",
|
|
1289
|
+
import: "./dist/next/index.js"
|
|
1290
|
+
},
|
|
1291
|
+
"./next/thumbnail": {
|
|
1292
|
+
types: "./dist/next/next/thumbnail.d.ts",
|
|
1293
|
+
import: "./dist/next/thumbnail.js"
|
|
1294
|
+
},
|
|
1295
|
+
"./byo": {
|
|
1296
|
+
types: "./dist/byo/index.d.ts",
|
|
1297
|
+
import: "./dist/byo/index.js"
|
|
1298
|
+
},
|
|
1299
|
+
"./elevenlabs": {
|
|
1300
|
+
types: "./dist/elevenlabs/index.d.ts",
|
|
1301
|
+
import: "./dist/elevenlabs/index.js"
|
|
1302
|
+
},
|
|
1303
|
+
"./openai": {
|
|
1304
|
+
types: "./dist/openai/index.d.ts",
|
|
1305
|
+
import: "./dist/openai/index.js"
|
|
1306
|
+
},
|
|
1307
|
+
"./deepgram": {
|
|
1308
|
+
types: "./dist/deepgram/index.d.ts",
|
|
1309
|
+
import: "./dist/deepgram/index.js"
|
|
1310
|
+
},
|
|
1311
|
+
"./google": {
|
|
1312
|
+
types: "./dist/google/index.d.ts",
|
|
1313
|
+
import: "./dist/google/index.js"
|
|
1314
|
+
},
|
|
1315
|
+
"./livekit": {
|
|
1316
|
+
types: "./dist/livekit/index.d.ts",
|
|
1317
|
+
import: "./dist/livekit/index.js"
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
files: [
|
|
1321
|
+
"dist/npm",
|
|
1322
|
+
"dist/svelte",
|
|
1323
|
+
"dist/react",
|
|
1324
|
+
"dist/next",
|
|
1325
|
+
"dist/byo",
|
|
1326
|
+
"dist/elevenlabs",
|
|
1327
|
+
"dist/openai",
|
|
1328
|
+
"dist/deepgram",
|
|
1329
|
+
"dist/google",
|
|
1330
|
+
"dist/livekit",
|
|
1331
|
+
"dist/sdk",
|
|
1332
|
+
"README.md",
|
|
1333
|
+
"CHANGELOG.md",
|
|
1334
|
+
"LICENSE"
|
|
1335
|
+
],
|
|
1336
|
+
peerDependencies: {
|
|
1337
|
+
"@elevenlabs/client": ">=1.0.0",
|
|
1338
|
+
"livekit-client": ">=2.0.0",
|
|
1339
|
+
react: "^18.0.0 || ^19.0.0",
|
|
1340
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
1341
|
+
svelte: "^5.0.0"
|
|
1342
|
+
},
|
|
1343
|
+
peerDependenciesMeta: {
|
|
1344
|
+
svelte: { optional: !0 },
|
|
1345
|
+
react: { optional: !0 },
|
|
1346
|
+
"react-dom": { optional: !0 },
|
|
1347
|
+
"@elevenlabs/client": { optional: !0 },
|
|
1348
|
+
"livekit-client": { optional: !0 }
|
|
1349
|
+
},
|
|
1350
|
+
scripts: {
|
|
1351
|
+
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",
|
|
1352
|
+
"build:react": "vite build --config vite.config.react.ts && vite build --config vite.config.react-thumbnail.ts && tsc -p tsconfig.react.json",
|
|
1353
|
+
"build:next": "vite build --config vite.config.next.ts && vite build --config vite.config.next-thumbnail.ts && tsc -p tsconfig.next.json",
|
|
1354
|
+
"build:byo": "vite build --config vite.config.byo.ts && tsc -p tsconfig.byo.json",
|
|
1355
|
+
"build:elevenlabs": "vite build --config vite.config.elevenlabs.ts && tsc -p tsconfig.elevenlabs.json",
|
|
1356
|
+
"build:openai": "vite build --config vite.config.openai.ts && tsc -p tsconfig.openai.json",
|
|
1357
|
+
"build:deepgram": "vite build --config vite.config.deepgram.ts && tsc -p tsconfig.deepgram.json",
|
|
1358
|
+
"build:google": "vite build --config vite.config.google.ts && tsc -p tsconfig.google.json",
|
|
1359
|
+
"build:livekit": "vite build --config vite.config.livekit.ts && tsc -p tsconfig.livekit.json",
|
|
1360
|
+
"copy:preview": "mkdir -p dist/preview && cp preview/v2-embed-test.html dist/preview/ && cp preview/v2-embed-test-redirect.html dist/preview/",
|
|
1361
|
+
"build:v2": "vite build --config vite.config.v2.ts && vite build --config vite.config.v2-thumbnail.ts",
|
|
1362
|
+
"build:npm": "vite build --config vite.config.npm.ts && vite build --config vite.config.thumbnail.ts && tsc -p tsconfig.npm.json",
|
|
1363
|
+
"build:svelte": "svelte-package -i src/svelte -o dist/svelte && vite build --config vite.config.svelte.ts",
|
|
1364
|
+
"check:consumer": "svelte-check --workspace test/consumer --tsconfig ./tsconfig.json",
|
|
1365
|
+
test: "vitest run",
|
|
1366
|
+
preview: "node scripts/preview-local.mjs",
|
|
1367
|
+
"dev:sdk": "npm run build:v2 && npm run copy:preview && npm run preview",
|
|
1368
|
+
dev: "npm run build && npm run preview",
|
|
1369
|
+
"publish:sdk": "node scripts/publish-sdk.mjs",
|
|
1370
|
+
"publish:npm": "node scripts/publish-npm.mjs",
|
|
1371
|
+
"publish:avatar": "node scripts/publish-avatar.mjs",
|
|
1372
|
+
"publish:avatars-dist": "node scripts/publish-avatars.mjs",
|
|
1373
|
+
"publish:avatars": "node scripts/republish-avatars.mjs",
|
|
1374
|
+
"build:avatars": "node scripts/build-avatars.mjs",
|
|
1375
|
+
"republish:avatars": "node scripts/republish-avatars.mjs",
|
|
1376
|
+
"catalogue:avatars": "node ../labs.liforma.ai/scripts/generate-avatar-index.mjs",
|
|
1377
|
+
"verify:avatars-dist": "node scripts/verify-avatars-dist.mjs",
|
|
1378
|
+
"verify:avatar-pack": "node scripts/verify-avatar-pack.mjs",
|
|
1379
|
+
"repair:render-plate-metadata": "node scripts/repair-render-plate-metadata.mjs",
|
|
1380
|
+
"verify:render-plate-crop": "node scripts/verify-render-plate-crop.mjs",
|
|
1381
|
+
"migrate:avatar-render-prep": "npm run migrate:avatar-render-prep --prefix ../labs.liforma.ai --",
|
|
1382
|
+
"convert:avatar-teeth": "node scripts/convert-avatar-teeth-webp.mjs",
|
|
1383
|
+
"warm:avatar-composites": "node scripts/warm-avatar-composites.mjs",
|
|
1384
|
+
"test:compose-costume": "node scripts/test-compose-costume-layers.mjs",
|
|
1385
|
+
"test:compose-costume-wasm": "node scripts/test-compose-costume-wasm.mjs",
|
|
1386
|
+
"test:parse-composite-filename": "node scripts/test-parse-composite-filename.mjs",
|
|
1387
|
+
"test:avatar-composite-rendered-path": "node scripts/test-avatar-composite-rendered-path.mjs",
|
|
1388
|
+
"test:avatar-compose-worker-cors": "node scripts/test-avatar-compose-worker-cors.mjs",
|
|
1389
|
+
"test:experience-thumb-url": "node scripts/test-experience-thumb-url.mjs",
|
|
1390
|
+
"test:compose-experience-thumb": "node scripts/test-compose-experience-thumb.mjs",
|
|
1391
|
+
"test:location-depth-paths": "node scripts/test-location-depth-paths.mjs",
|
|
1392
|
+
"test:location-binary-assets": "node scripts/test-location-binary-assets.mjs",
|
|
1393
|
+
"test:location-da3-depth": "node scripts/test-location-da3-depth.mjs",
|
|
1394
|
+
"test:location-interactions": "node scripts/test-location-interactions.mjs",
|
|
1395
|
+
"test:render-plate-chroma-key": "node scripts/test-render-plate-chroma-key.mjs",
|
|
1396
|
+
"test:sparse-plate": "node scripts/test-sparse-plate.mjs",
|
|
1397
|
+
"test:face-meshes-publish-depth": "node scripts/test-face-meshes-publish-depth.mjs",
|
|
1398
|
+
"test:avatar-avif-sibling": "node scripts/test-avatar-avif-sibling.mjs",
|
|
1399
|
+
"test:screen-chroma-key": "node scripts/test-screen-chroma-key.mjs",
|
|
1400
|
+
"pull:sources": "node scripts/sync-authoring-sources.mjs",
|
|
1401
|
+
"push:sources": "node scripts/sync-authoring-sources.mjs",
|
|
1402
|
+
"catalogue:locations": "node scripts/catalogue-locations.mjs",
|
|
1403
|
+
"generate:location-interactions": "node scripts/generate-location-interactions.mjs",
|
|
1404
|
+
"generate:location-depth": "node scripts/generate-location-depth.mjs",
|
|
1405
|
+
"generate:location-depth16-da3": "node scripts/generate-location-depth16-da3.mjs",
|
|
1406
|
+
"generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
|
|
1407
|
+
"build:locations": "node scripts/build-locations.mjs",
|
|
1408
|
+
"publish:locations": "node scripts/publish-locations.mjs",
|
|
1409
|
+
"verify:locations": "node scripts/verify-location-sources.mjs",
|
|
1410
|
+
"publish:models": "node scripts/publish-models.mjs",
|
|
1411
|
+
"publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
|
|
1412
|
+
"publish:models:ltx-int8": "node scripts/_upload-model-prefix.mjs text-to-video/lf-t2v-distill-int8",
|
|
1413
|
+
"publish:models:video-omni": "node scripts/_upload-model-prefix.mjs text-to-video/lf-video-omni-v1",
|
|
1414
|
+
"fetch:depth-anything-v2": "node scripts/fetch-depth-anything-v2.mjs",
|
|
1415
|
+
"fetch:video-depth-anything": "node scripts/fetch-video-depth-anything.mjs",
|
|
1416
|
+
"fetch:depth-pro": "node scripts/fetch-depth-pro.mjs",
|
|
1417
|
+
"fetch:face-landmarker": "node scripts/fetch-face-landmarker.mjs",
|
|
1418
|
+
"fetch:anime-face-detector": "node scripts/fetch-anime-face-detector.mjs",
|
|
1419
|
+
"fetch:face-parsing": "node scripts/fetch-face-parsing.mjs",
|
|
1420
|
+
"fetch:vitmatte": "node scripts/fetch-vitmatte.mjs",
|
|
1421
|
+
"fetch:liveportrait-mlx": "node scripts/fetch-liveportrait-mlx.mjs",
|
|
1422
|
+
"fetch:wav2vec-phoneme-ctc": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
|
|
1423
|
+
"fetch:lf-sta": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
|
|
1424
|
+
"fetch:supertonic-3": "node scripts/fetch-supertonic-3.mjs",
|
|
1425
|
+
"fetch:lf-tts": "node scripts/fetch-supertonic-3.mjs",
|
|
1426
|
+
"fetch:lf-t2i-turbo": "python3 ../tools/krea-2-salad/scripts/fetch_cdn_snapshot.py",
|
|
1427
|
+
"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",
|
|
1428
|
+
locations: "npm run catalogue:locations && npm run build:locations",
|
|
1429
|
+
"configure:cors": "node scripts/configure-r2-cors.mjs",
|
|
1430
|
+
"verify:cors": "node scripts/verify-cdn-cors.mjs",
|
|
1431
|
+
"deploy:worker:avatar-compose": "node scripts/deploy-avatar-compose-worker.mjs",
|
|
1432
|
+
"deploy:worker:experience-thumb": "node scripts/deploy-experience-thumb-worker.mjs",
|
|
1433
|
+
deploy: "npm run build && npm run publish:sdk",
|
|
1434
|
+
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",
|
|
1435
|
+
"preview:test": "npm run build && npm run preview"
|
|
1436
|
+
},
|
|
1437
|
+
dependencies: {
|
|
1438
|
+
"@jsquash/webp": "^1.5.0",
|
|
1439
|
+
zod: "^4.4.3"
|
|
1440
|
+
},
|
|
1441
|
+
devDependencies: {
|
|
1442
|
+
"@aws-sdk/client-s3": "^3.1000.0",
|
|
1443
|
+
"@aws-sdk/lib-storage": "^3.1110.0",
|
|
1444
|
+
"@elevenlabs/client": "^1.17.0",
|
|
1445
|
+
"@sveltejs/package": "^2.5.8",
|
|
1446
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
1447
|
+
"@testing-library/react": "^16.3.0",
|
|
1448
|
+
"@testing-library/svelte": "^5.4.2",
|
|
1449
|
+
"@types/node": "^25.9.3",
|
|
1450
|
+
"@types/react": "^19.1.12",
|
|
1451
|
+
"@types/react-dom": "^19.1.9",
|
|
1452
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
1453
|
+
"@webgpu/types": "^0.1.70",
|
|
1454
|
+
dotenv: "^17.2.3",
|
|
1455
|
+
jsdom: "^30.0.1",
|
|
1456
|
+
"livekit-client": "^2.21.0",
|
|
1457
|
+
react: "^19.1.1",
|
|
1458
|
+
"react-dom": "^19.1.1",
|
|
1459
|
+
sharp: "^0.34.2",
|
|
1460
|
+
svelte: "^5.55.2",
|
|
1461
|
+
"svelte-check": "^4.7.4",
|
|
1462
|
+
typescript: "^6.0.3",
|
|
1463
|
+
vite: "^8.0.16",
|
|
1464
|
+
vitest: "^4.1.10",
|
|
1465
|
+
wrangler: "^4.101.0"
|
|
1466
|
+
}
|
|
1467
|
+
}.version}`, et = "https://player.liforma.ai/embed", tt = "http://localhost:3002/embed";
|
|
1468
|
+
function nt() {
|
|
1211
1469
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1212
1470
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1213
1471
|
if (typeof document > "u") return null;
|
|
1214
1472
|
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();
|
|
1215
1473
|
return t ? t.replace(/\/$/, "") : null;
|
|
1216
1474
|
}
|
|
1217
|
-
function
|
|
1218
|
-
let e =
|
|
1219
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ?
|
|
1475
|
+
function rt() {
|
|
1476
|
+
let e = nt();
|
|
1477
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ? tt : et;
|
|
1220
1478
|
}
|
|
1221
|
-
function
|
|
1479
|
+
function it(e, t) {
|
|
1222
1480
|
return e?.trim() || t?.trim() || void 0;
|
|
1223
1481
|
}
|
|
1224
|
-
function
|
|
1225
|
-
let c = (e ??
|
|
1482
|
+
function at(e, t, n, r, i, a, o, s) {
|
|
1483
|
+
let c = (e ?? rt()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
|
|
1226
1484
|
d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
|
|
1227
1485
|
let f = r?.trim();
|
|
1228
|
-
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)),
|
|
1486
|
+
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());
|
|
1229
1487
|
}
|
|
1230
|
-
function
|
|
1488
|
+
function ot(e) {
|
|
1231
1489
|
if (typeof location > "u") return e;
|
|
1232
1490
|
let t = new URL(e);
|
|
1233
1491
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1234
1492
|
}
|
|
1235
|
-
function
|
|
1493
|
+
function st(e) {
|
|
1236
1494
|
return new URL(e).origin;
|
|
1237
1495
|
}
|
|
1238
1496
|
//#endregion
|
|
1239
1497
|
//#region src/v2/experienceEvents.ts
|
|
1240
|
-
function
|
|
1498
|
+
function ct() {
|
|
1241
1499
|
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)}`;
|
|
1242
1500
|
}
|
|
1243
|
-
function
|
|
1501
|
+
function lt(e, t, n) {
|
|
1244
1502
|
return {
|
|
1245
|
-
id:
|
|
1503
|
+
id: ct(),
|
|
1246
1504
|
type: e,
|
|
1247
1505
|
sessionId: t,
|
|
1248
1506
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1249
1507
|
data: n
|
|
1250
1508
|
};
|
|
1251
1509
|
}
|
|
1252
|
-
function
|
|
1510
|
+
function ut() {
|
|
1253
1511
|
return {
|
|
1254
1512
|
ready: /* @__PURE__ */ new Set(),
|
|
1255
1513
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1264,37 +1522,38 @@ function lt() {
|
|
|
1264
1522
|
message: /* @__PURE__ */ new Set(),
|
|
1265
1523
|
listeningState: /* @__PURE__ */ new Set(),
|
|
1266
1524
|
activityChange: /* @__PURE__ */ new Set(),
|
|
1525
|
+
interactionChange: /* @__PURE__ */ new Set(),
|
|
1267
1526
|
feedback: /* @__PURE__ */ new Set(),
|
|
1268
1527
|
feedbackFailed: /* @__PURE__ */ new Set(),
|
|
1269
1528
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1270
1529
|
};
|
|
1271
1530
|
}
|
|
1272
|
-
function
|
|
1531
|
+
function dt(e, t, n) {
|
|
1273
1532
|
return e[t].add(n), () => e[t].delete(n);
|
|
1274
1533
|
}
|
|
1275
|
-
function
|
|
1534
|
+
function ft(e, t, n) {
|
|
1276
1535
|
for (let r of e[t]) r(n);
|
|
1277
1536
|
}
|
|
1278
|
-
function
|
|
1537
|
+
function pt(e) {
|
|
1279
1538
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1280
1539
|
}
|
|
1281
1540
|
//#endregion
|
|
1282
1541
|
//#region src/v2/speech/types.ts
|
|
1283
|
-
function
|
|
1542
|
+
function mt(e) {
|
|
1284
1543
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1285
1544
|
}
|
|
1286
|
-
function
|
|
1545
|
+
function ht(e) {
|
|
1287
1546
|
return "url" in e && typeof e.url == "string";
|
|
1288
1547
|
}
|
|
1289
|
-
function
|
|
1548
|
+
function gt(e) {
|
|
1290
1549
|
if (!("track" in e)) return !1;
|
|
1291
1550
|
let t = e.track;
|
|
1292
1551
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1293
1552
|
}
|
|
1294
|
-
function
|
|
1295
|
-
return !
|
|
1553
|
+
function _t(e) {
|
|
1554
|
+
return !mt(e) && !ht(e) && !gt(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1296
1555
|
}
|
|
1297
|
-
var
|
|
1556
|
+
var vt = [
|
|
1298
1557
|
8e3,
|
|
1299
1558
|
16e3,
|
|
1300
1559
|
22050,
|
|
@@ -1312,14 +1571,14 @@ var _t = [
|
|
|
1312
1571
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1313
1572
|
MAX_PENDING_WRITES: 8,
|
|
1314
1573
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1315
|
-
},
|
|
1574
|
+
}, yt = class extends Error {
|
|
1316
1575
|
operation;
|
|
1317
1576
|
requiredCapability;
|
|
1318
1577
|
name = "UnsupportedSpeechOperationError";
|
|
1319
1578
|
constructor(e, t) {
|
|
1320
1579
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1321
1580
|
}
|
|
1322
|
-
},
|
|
1581
|
+
}, bt = class extends Error {
|
|
1323
1582
|
name = "SpeechUtteranceClosedError";
|
|
1324
1583
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1325
1584
|
super(e);
|
|
@@ -1329,72 +1588,72 @@ var _t = [
|
|
|
1329
1588
|
constructor(e, t) {
|
|
1330
1589
|
super(e, t);
|
|
1331
1590
|
}
|
|
1332
|
-
},
|
|
1591
|
+
}, xt = class extends Error {
|
|
1333
1592
|
name = "SpeechBufferTimeoutError";
|
|
1334
1593
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1335
1594
|
super(e);
|
|
1336
1595
|
}
|
|
1337
1596
|
};
|
|
1338
|
-
function
|
|
1597
|
+
function St(e = "none") {
|
|
1339
1598
|
return {
|
|
1340
1599
|
mode: e,
|
|
1341
1600
|
trackedDurationMs: 0,
|
|
1342
1601
|
fallbackDurationMs: 0
|
|
1343
1602
|
};
|
|
1344
1603
|
}
|
|
1345
|
-
function St(e) {
|
|
1346
|
-
return _t.includes(e);
|
|
1347
|
-
}
|
|
1348
1604
|
function Ct(e) {
|
|
1605
|
+
return vt.includes(e);
|
|
1606
|
+
}
|
|
1607
|
+
function wt(e) {
|
|
1349
1608
|
if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
|
|
1350
1609
|
if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
|
|
1351
|
-
if (!
|
|
1610
|
+
if (!Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1352
1611
|
}
|
|
1353
|
-
function
|
|
1354
|
-
if (
|
|
1355
|
-
|
|
1612
|
+
function Tt(e) {
|
|
1613
|
+
if (mt(e)) {
|
|
1614
|
+
wt(e.format);
|
|
1356
1615
|
return;
|
|
1357
1616
|
}
|
|
1358
|
-
if (
|
|
1617
|
+
if (ht(e)) {
|
|
1359
1618
|
if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
|
|
1360
|
-
if (e.sampleRate !== void 0 && !
|
|
1619
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1361
1620
|
return;
|
|
1362
1621
|
}
|
|
1363
|
-
if (
|
|
1622
|
+
if (gt(e)) {
|
|
1364
1623
|
if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
1365
|
-
if (e.sampleRate !== void 0 && !
|
|
1624
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1366
1625
|
return;
|
|
1367
1626
|
}
|
|
1368
|
-
if (
|
|
1627
|
+
if (_t(e)) {
|
|
1369
1628
|
let t = e.encoding.trim().toLowerCase();
|
|
1370
1629
|
if (!t) throw new Z("Encoded audio MIME type is required.");
|
|
1371
1630
|
if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
1372
|
-
if (e.sampleRate !== void 0 && !
|
|
1631
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1373
1632
|
return;
|
|
1374
1633
|
}
|
|
1375
1634
|
throw new Z("Unsupported speech.play audio shape.");
|
|
1376
1635
|
}
|
|
1377
|
-
function
|
|
1378
|
-
if (e.format) return
|
|
1636
|
+
function Et(e) {
|
|
1637
|
+
if (e.format) return wt(e.format), e.format;
|
|
1379
1638
|
if (e.track) {
|
|
1380
1639
|
let t = {
|
|
1381
1640
|
encoding: "pcm_s16le",
|
|
1382
1641
|
sampleRate: e.sampleRate ?? 24e3,
|
|
1383
1642
|
channels: 1
|
|
1384
1643
|
};
|
|
1385
|
-
return
|
|
1644
|
+
return wt(t), t;
|
|
1386
1645
|
}
|
|
1387
1646
|
throw new Z("createUtterance requires format or track.");
|
|
1388
1647
|
}
|
|
1389
|
-
function
|
|
1648
|
+
function Dt(e) {
|
|
1390
1649
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1391
1650
|
}
|
|
1392
|
-
function
|
|
1651
|
+
function Ot(e) {
|
|
1393
1652
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
1394
1653
|
}
|
|
1395
1654
|
//#endregion
|
|
1396
1655
|
//#region src/byo/pcm.ts
|
|
1397
|
-
function
|
|
1656
|
+
function kt(e) {
|
|
1398
1657
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
1399
1658
|
for (let t = 0; t < e.length; t++) {
|
|
1400
1659
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -1404,11 +1663,11 @@ function Ot(e) {
|
|
|
1404
1663
|
}
|
|
1405
1664
|
//#endregion
|
|
1406
1665
|
//#region src/byo/resample.ts
|
|
1407
|
-
function
|
|
1666
|
+
function At(e, t, n, r, i) {
|
|
1408
1667
|
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;
|
|
1409
1668
|
return ((a * i + o) * i + s) * i + c;
|
|
1410
1669
|
}
|
|
1411
|
-
function
|
|
1670
|
+
function jt(e, t) {
|
|
1412
1671
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
1413
1672
|
if (e === t) return {
|
|
1414
1673
|
fromRate: e,
|
|
@@ -1431,7 +1690,7 @@ function At(e, t) {
|
|
|
1431
1690
|
let a = [];
|
|
1432
1691
|
for (; i + 2 < r.length - 1;) {
|
|
1433
1692
|
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);
|
|
1434
|
-
a.push(
|
|
1693
|
+
a.push(At(r[o], r[e], r[s], r[c], t)), i += n;
|
|
1435
1694
|
}
|
|
1436
1695
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
1437
1696
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -1443,7 +1702,7 @@ function At(e, t) {
|
|
|
1443
1702
|
}
|
|
1444
1703
|
//#endregion
|
|
1445
1704
|
//#region src/byo/audioCapture.ts
|
|
1446
|
-
var
|
|
1705
|
+
var Mt = "liforma-pcm-capture", Nt = `
|
|
1447
1706
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
1448
1707
|
process(inputs) {
|
|
1449
1708
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -1455,29 +1714,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
1455
1714
|
return true;
|
|
1456
1715
|
}
|
|
1457
1716
|
}
|
|
1458
|
-
registerProcessor('${
|
|
1459
|
-
`,
|
|
1460
|
-
function Pt() {
|
|
1461
|
-
return Nt ||= URL.createObjectURL(new Blob([Mt], { type: "application/javascript" })), Nt;
|
|
1462
|
-
}
|
|
1717
|
+
registerProcessor('${Mt}', LiformaPcmCaptureProcessor);
|
|
1718
|
+
`, Pt = null;
|
|
1463
1719
|
function Ft() {
|
|
1720
|
+
return Pt ||= URL.createObjectURL(new Blob([Nt], { type: "application/javascript" })), Pt;
|
|
1721
|
+
}
|
|
1722
|
+
function It() {
|
|
1464
1723
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
1465
1724
|
}
|
|
1466
|
-
async function
|
|
1467
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
1725
|
+
async function Lt(e) {
|
|
1726
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = It();
|
|
1468
1727
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
1469
1728
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
1470
1729
|
l.gain.value = 0;
|
|
1471
|
-
let u = s.sampleRate, d =
|
|
1730
|
+
let u = s.sampleRate, d = jt(u, n), f = !1, p = !1, m = (e) => {
|
|
1472
1731
|
if (f || i && !i()) return;
|
|
1473
1732
|
let t = d.push(e);
|
|
1474
|
-
t.length !== 0 && r(
|
|
1733
|
+
t.length !== 0 && r(kt(t));
|
|
1475
1734
|
}, h = () => void 0;
|
|
1476
1735
|
return await (async () => {
|
|
1477
1736
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
1478
1737
|
try {
|
|
1479
|
-
await s.audioWorklet.addModule(
|
|
1480
|
-
let e = new AudioWorkletNode(s,
|
|
1738
|
+
await s.audioWorklet.addModule(Ft());
|
|
1739
|
+
let e = new AudioWorkletNode(s, Mt, {
|
|
1481
1740
|
numberOfInputs: 1,
|
|
1482
1741
|
numberOfOutputs: 1,
|
|
1483
1742
|
outputChannelCount: [1]
|
|
@@ -1527,7 +1786,7 @@ async function It(e) {
|
|
|
1527
1786
|
}
|
|
1528
1787
|
//#endregion
|
|
1529
1788
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
1530
|
-
async function
|
|
1789
|
+
async function Rt(e) {
|
|
1531
1790
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
1532
1791
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
|
|
1533
1792
|
if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -1536,13 +1795,13 @@ async function Lt(e) {
|
|
|
1536
1795
|
s || (s = !0, c?.stop(), c = null);
|
|
1537
1796
|
};
|
|
1538
1797
|
try {
|
|
1539
|
-
c = await
|
|
1798
|
+
c = await Lt({
|
|
1540
1799
|
mediaStream: a,
|
|
1541
1800
|
targetSampleRate: r,
|
|
1542
1801
|
shouldSend: () => !s && !i?.aborted,
|
|
1543
1802
|
onPcm: (e) => {
|
|
1544
1803
|
if (s || i?.aborted) return;
|
|
1545
|
-
let t =
|
|
1804
|
+
let t = Dt(e);
|
|
1546
1805
|
o = o.then(async () => {
|
|
1547
1806
|
if (s || i?.aborted) return;
|
|
1548
1807
|
let e = 0;
|
|
@@ -1571,10 +1830,10 @@ async function Lt(e) {
|
|
|
1571
1830
|
}
|
|
1572
1831
|
//#endregion
|
|
1573
1832
|
//#region src/v2/speech/speechController.ts
|
|
1574
|
-
async function
|
|
1575
|
-
if (
|
|
1576
|
-
if (
|
|
1577
|
-
let t =
|
|
1833
|
+
async function zt(e, t) {
|
|
1834
|
+
if (gt(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
|
|
1835
|
+
if (mt(e)) {
|
|
1836
|
+
let t = Dt(e.data);
|
|
1578
1837
|
if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
|
|
1579
1838
|
return {
|
|
1580
1839
|
kind: "pcm",
|
|
@@ -1582,17 +1841,17 @@ async function Rt(e, t) {
|
|
|
1582
1841
|
format: e.format
|
|
1583
1842
|
};
|
|
1584
1843
|
}
|
|
1585
|
-
if (
|
|
1844
|
+
if (ht(e)) return {
|
|
1586
1845
|
kind: "url",
|
|
1587
1846
|
url: e.url.trim(),
|
|
1588
1847
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1589
1848
|
};
|
|
1590
|
-
if (!
|
|
1849
|
+
if (!_t(e)) throw new Z("Unsupported speech.play audio shape.");
|
|
1591
1850
|
let n;
|
|
1592
1851
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
1593
1852
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1594
1853
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
1595
|
-
} else n =
|
|
1854
|
+
} else n = Dt(e.data);
|
|
1596
1855
|
return {
|
|
1597
1856
|
kind: "encoded",
|
|
1598
1857
|
data: n.slice().buffer,
|
|
@@ -1600,10 +1859,10 @@ async function Rt(e, t) {
|
|
|
1600
1859
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1601
1860
|
};
|
|
1602
1861
|
}
|
|
1603
|
-
function
|
|
1862
|
+
function Bt() {
|
|
1604
1863
|
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)}`;
|
|
1605
1864
|
}
|
|
1606
|
-
function
|
|
1865
|
+
function Vt(e, t = "completed") {
|
|
1607
1866
|
return {
|
|
1608
1867
|
utteranceId: e.speechId,
|
|
1609
1868
|
characterId: e.characterId,
|
|
@@ -1617,13 +1876,13 @@ function Bt(e, t = "completed") {
|
|
|
1617
1876
|
}
|
|
1618
1877
|
};
|
|
1619
1878
|
}
|
|
1620
|
-
function
|
|
1879
|
+
function Ht(e) {
|
|
1621
1880
|
return e instanceof Error ? e : new Z(String(e));
|
|
1622
1881
|
}
|
|
1623
|
-
function
|
|
1882
|
+
function Ut(e) {
|
|
1624
1883
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
1625
1884
|
}
|
|
1626
|
-
var
|
|
1885
|
+
var Wt = class {
|
|
1627
1886
|
id;
|
|
1628
1887
|
characterId;
|
|
1629
1888
|
result;
|
|
@@ -1652,14 +1911,14 @@ var Ut = class {
|
|
|
1652
1911
|
queue: e.queue,
|
|
1653
1912
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
1654
1913
|
}).catch((e) => {
|
|
1655
|
-
throw this.fail(
|
|
1914
|
+
throw this.fail(Ht(e)), Ht(e);
|
|
1656
1915
|
}), this.signal?.addEventListener("abort", () => {
|
|
1657
1916
|
this.cancel();
|
|
1658
1917
|
}, { once: !0 });
|
|
1659
1918
|
}
|
|
1660
1919
|
async write(e, t) {
|
|
1661
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1662
|
-
let n =
|
|
1920
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new bt();
|
|
1921
|
+
let n = Dt(e);
|
|
1663
1922
|
if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
|
|
1664
1923
|
if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
|
|
1665
1924
|
if (n.byteLength === 0) return;
|
|
@@ -1668,13 +1927,13 @@ var Ut = class {
|
|
|
1668
1927
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
1669
1928
|
if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
1670
1929
|
let a = async () => {
|
|
1671
|
-
if (this.closed || this.settled) throw new
|
|
1930
|
+
if (this.closed || this.settled) throw new bt();
|
|
1672
1931
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
1673
1932
|
utteranceId: this.id,
|
|
1674
1933
|
audio: t.buffer,
|
|
1675
1934
|
byteLength: t.byteLength
|
|
1676
1935
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
1677
|
-
setTimeout(() => t(new
|
|
1936
|
+
setTimeout(() => t(new xt()), r);
|
|
1678
1937
|
})]);
|
|
1679
1938
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
1680
1939
|
}, o = this.writeChain.then(a, a);
|
|
@@ -1686,7 +1945,7 @@ var Ut = class {
|
|
|
1686
1945
|
}
|
|
1687
1946
|
}
|
|
1688
1947
|
async setTranscript(e) {
|
|
1689
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1948
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new bt();
|
|
1690
1949
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
1691
1950
|
utteranceId: this.id,
|
|
1692
1951
|
transcript: e
|
|
@@ -1703,7 +1962,7 @@ var Ut = class {
|
|
|
1703
1962
|
});
|
|
1704
1963
|
return this.resolve(t), t;
|
|
1705
1964
|
} catch (e) {
|
|
1706
|
-
let t =
|
|
1965
|
+
let t = Ht(e);
|
|
1707
1966
|
throw this.fail(t), t;
|
|
1708
1967
|
}
|
|
1709
1968
|
}
|
|
@@ -1721,11 +1980,11 @@ var Ut = class {
|
|
|
1721
1980
|
characterId: this.characterId,
|
|
1722
1981
|
status: "cancelled",
|
|
1723
1982
|
durationMs: 0,
|
|
1724
|
-
animation:
|
|
1983
|
+
animation: St("none")
|
|
1725
1984
|
};
|
|
1726
1985
|
return this.resolve(t), t;
|
|
1727
1986
|
} catch (e) {
|
|
1728
|
-
let t =
|
|
1987
|
+
let t = Ht(e);
|
|
1729
1988
|
throw this.fail(t), t;
|
|
1730
1989
|
}
|
|
1731
1990
|
}
|
|
@@ -1738,7 +1997,7 @@ var Ut = class {
|
|
|
1738
1997
|
return e;
|
|
1739
1998
|
}
|
|
1740
1999
|
resolve(e) {
|
|
1741
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2000
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new bt()));
|
|
1742
2001
|
}
|
|
1743
2002
|
fail(e) {
|
|
1744
2003
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
@@ -1750,7 +2009,7 @@ var Ut = class {
|
|
|
1750
2009
|
}
|
|
1751
2010
|
await new Promise((t, n) => {
|
|
1752
2011
|
let r = setTimeout(() => {
|
|
1753
|
-
n(new
|
|
2012
|
+
n(new xt());
|
|
1754
2013
|
}, e);
|
|
1755
2014
|
this.pendingWriteWaiters.push({
|
|
1756
2015
|
resolve: () => {
|
|
@@ -1769,13 +2028,13 @@ var Ut = class {
|
|
|
1769
2028
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
1770
2029
|
}
|
|
1771
2030
|
};
|
|
1772
|
-
function
|
|
2031
|
+
function Gt(e) {
|
|
1773
2032
|
let t = null, n = (t, n) => {
|
|
1774
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2033
|
+
if (!e.getCapabilities()[n]) throw new yt(t, n);
|
|
1775
2034
|
}, r = {
|
|
1776
2035
|
async speak(r) {
|
|
1777
2036
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
1778
|
-
let i =
|
|
2037
|
+
let i = Ot(r.queue ?? "append");
|
|
1779
2038
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
1780
2039
|
let a = e.getIframeHost();
|
|
1781
2040
|
if (!a) throw new Z("Speech session is not attached.");
|
|
@@ -1795,41 +2054,41 @@ function Wt(e) {
|
|
|
1795
2054
|
return;
|
|
1796
2055
|
}
|
|
1797
2056
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
1798
|
-
t.removeEventListener("abort", s), n(
|
|
2057
|
+
t.removeEventListener("abort", s), n(Vt(e, "completed"));
|
|
1799
2058
|
}, (a) => {
|
|
1800
|
-
if (t.removeEventListener("abort", s),
|
|
2059
|
+
if (t.removeEventListener("abort", s), Ut(a)) {
|
|
1801
2060
|
n({
|
|
1802
2061
|
utteranceId: "utt_interrupted",
|
|
1803
2062
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1804
2063
|
status: "interrupted",
|
|
1805
2064
|
durationMs: 0,
|
|
1806
2065
|
transcript: r.text,
|
|
1807
|
-
animation:
|
|
2066
|
+
animation: St("none")
|
|
1808
2067
|
});
|
|
1809
2068
|
return;
|
|
1810
2069
|
}
|
|
1811
|
-
i(
|
|
2070
|
+
i(Ht(a));
|
|
1812
2071
|
});
|
|
1813
2072
|
});
|
|
1814
2073
|
}
|
|
1815
2074
|
try {
|
|
1816
|
-
return
|
|
2075
|
+
return Vt(await o, "completed");
|
|
1817
2076
|
} catch (t) {
|
|
1818
|
-
if (
|
|
2077
|
+
if (Ut(t)) return {
|
|
1819
2078
|
utteranceId: "utt_interrupted",
|
|
1820
2079
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1821
2080
|
status: "interrupted",
|
|
1822
2081
|
durationMs: 0,
|
|
1823
2082
|
transcript: r.text,
|
|
1824
|
-
animation:
|
|
2083
|
+
animation: St("none")
|
|
1825
2084
|
};
|
|
1826
|
-
throw
|
|
2085
|
+
throw Ht(t);
|
|
1827
2086
|
}
|
|
1828
2087
|
},
|
|
1829
2088
|
async play(i) {
|
|
1830
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2089
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Tt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1831
2090
|
let a = i.queue ?? "append";
|
|
1832
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2091
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), gt(i.audio)) {
|
|
1833
2092
|
let e = i.audio.sampleRate ?? 24e3;
|
|
1834
2093
|
return r.createUtterance({
|
|
1835
2094
|
format: {
|
|
@@ -1845,7 +2104,7 @@ function Wt(e) {
|
|
|
1845
2104
|
}
|
|
1846
2105
|
let o = e.getIframeHost();
|
|
1847
2106
|
if (!o) throw new Z("Speech session is not attached.");
|
|
1848
|
-
let s = await
|
|
2107
|
+
let s = await zt(i.audio, i.signal);
|
|
1849
2108
|
return o.speechPlay({
|
|
1850
2109
|
source: s,
|
|
1851
2110
|
characterId: i.characterId,
|
|
@@ -1857,13 +2116,13 @@ function Wt(e) {
|
|
|
1857
2116
|
},
|
|
1858
2117
|
createUtterance(r) {
|
|
1859
2118
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
1860
|
-
let i =
|
|
2119
|
+
let i = Et(r);
|
|
1861
2120
|
if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
|
|
1862
2121
|
let a = r.queue ?? "replace-active";
|
|
1863
2122
|
if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
|
|
1864
2123
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
1865
|
-
let o = new
|
|
1866
|
-
id:
|
|
2124
|
+
let o = new Wt({
|
|
2125
|
+
id: Bt(),
|
|
1867
2126
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1868
2127
|
format: i,
|
|
1869
2128
|
queue: a,
|
|
@@ -1875,7 +2134,7 @@ function Wt(e) {
|
|
|
1875
2134
|
t === o && (t = null);
|
|
1876
2135
|
}), r.track && (async () => {
|
|
1877
2136
|
try {
|
|
1878
|
-
if (await
|
|
2137
|
+
if (await Rt({
|
|
1879
2138
|
track: r.track,
|
|
1880
2139
|
utterance: o,
|
|
1881
2140
|
sampleRate: i.sampleRate,
|
|
@@ -1903,16 +2162,16 @@ function Wt(e) {
|
|
|
1903
2162
|
}
|
|
1904
2163
|
//#endregion
|
|
1905
2164
|
//#region src/v2/types/sessionInteraction.ts
|
|
1906
|
-
function
|
|
2165
|
+
function Kt(e) {
|
|
1907
2166
|
let t = e?.trim();
|
|
1908
2167
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
1909
2168
|
}
|
|
1910
2169
|
//#endregion
|
|
1911
2170
|
//#region src/v2/experience.ts
|
|
1912
|
-
function
|
|
2171
|
+
function qt(e) {
|
|
1913
2172
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
1914
2173
|
}
|
|
1915
|
-
var
|
|
2174
|
+
var Jt = class e {
|
|
1916
2175
|
bootstrap;
|
|
1917
2176
|
conversationProcessor;
|
|
1918
2177
|
iframeHost = null;
|
|
@@ -1926,18 +2185,19 @@ var qt = class e {
|
|
|
1926
2185
|
closed = !1;
|
|
1927
2186
|
attached = !1;
|
|
1928
2187
|
pendingFit = null;
|
|
2188
|
+
lastInteraction = null;
|
|
1929
2189
|
closeHandlers = [];
|
|
1930
|
-
eventRegistry =
|
|
2190
|
+
eventRegistry = ut();
|
|
1931
2191
|
readyEnvelope = null;
|
|
1932
2192
|
startedEnvelope = null;
|
|
1933
2193
|
sessionMintedEnvelope = null;
|
|
1934
2194
|
conversationCache = [];
|
|
1935
2195
|
speech;
|
|
1936
2196
|
constructor(e) {
|
|
1937
|
-
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 =
|
|
2197
|
+
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({
|
|
1938
2198
|
getIframeHost: () => this.iframeHost,
|
|
1939
2199
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
1940
|
-
getCapabilities: () =>
|
|
2200
|
+
getCapabilities: () => Yt(this.resolvedSession),
|
|
1941
2201
|
getActiveCharacterId: () => "character_unknown",
|
|
1942
2202
|
onProcessorInterrupt: () => {
|
|
1943
2203
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -1982,6 +2242,7 @@ var qt = class e {
|
|
|
1982
2242
|
speechInputMode: t.speechInputMode,
|
|
1983
2243
|
speechOnly: t.speechOnly,
|
|
1984
2244
|
attribution: t.attribution,
|
|
2245
|
+
alreadyConverted: t.alreadyConverted,
|
|
1985
2246
|
ui: t.ui,
|
|
1986
2247
|
onStart: t.onStart,
|
|
1987
2248
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2004,6 +2265,7 @@ var qt = class e {
|
|
|
2004
2265
|
speechInputMode: t.speechInputMode,
|
|
2005
2266
|
speechOnly: t.speechOnly,
|
|
2006
2267
|
attribution: t.attribution,
|
|
2268
|
+
alreadyConverted: t.alreadyConverted,
|
|
2007
2269
|
ui: t.ui,
|
|
2008
2270
|
onStart: t.onStart,
|
|
2009
2271
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2018,7 +2280,7 @@ var qt = class e {
|
|
|
2018
2280
|
return null;
|
|
2019
2281
|
}
|
|
2020
2282
|
on(e, t) {
|
|
2021
|
-
let n =
|
|
2283
|
+
let n = dt(this.eventRegistry, e, t);
|
|
2022
2284
|
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;
|
|
2023
2285
|
}
|
|
2024
2286
|
async attach(e) {
|
|
@@ -2032,7 +2294,7 @@ var qt = class e {
|
|
|
2032
2294
|
if (this.closed) throw Error("Session has ended.");
|
|
2033
2295
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2034
2296
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2035
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2297
|
+
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) => {
|
|
2036
2298
|
o = e;
|
|
2037
2299
|
}), c = null, l = new Promise((e) => {
|
|
2038
2300
|
c = e;
|
|
@@ -2077,6 +2339,9 @@ var qt = class e {
|
|
|
2077
2339
|
onActivityChange: (e) => {
|
|
2078
2340
|
this.emitWrapped("activityChange", e);
|
|
2079
2341
|
},
|
|
2342
|
+
onInteractionChange: (e) => {
|
|
2343
|
+
this.lastInteraction = e, this.emitWrapped("interactionChange", e);
|
|
2344
|
+
},
|
|
2080
2345
|
onFeedback: (e) => {
|
|
2081
2346
|
this.emitWrapped("feedback", e);
|
|
2082
2347
|
},
|
|
@@ -2111,6 +2376,7 @@ var qt = class e {
|
|
|
2111
2376
|
speechInputMode: p.speechInputMode,
|
|
2112
2377
|
speechOnly: this.bootstrap.speechOnly,
|
|
2113
2378
|
attribution: this.bootstrap.attribution,
|
|
2379
|
+
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2114
2380
|
signal: this.endpointAbortController.signal
|
|
2115
2381
|
})) : this.bootstrap.kind === "public" ? ke(this.bootstrap.experienceId, {
|
|
2116
2382
|
locale: this.bootstrap.locale,
|
|
@@ -2120,7 +2386,8 @@ var qt = class e {
|
|
|
2120
2386
|
mode: p.mode,
|
|
2121
2387
|
speechInputMode: p.speechInputMode,
|
|
2122
2388
|
speechOnly: this.bootstrap.speechOnly,
|
|
2123
|
-
attribution: this.bootstrap.attribution
|
|
2389
|
+
attribution: this.bootstrap.attribution,
|
|
2390
|
+
alreadyConverted: this.bootstrap.alreadyConverted
|
|
2124
2391
|
}) : Promise.resolve(this.bootstrap.session ? {
|
|
2125
2392
|
session: this.bootstrap.session,
|
|
2126
2393
|
launch: this.bootstrap.launch
|
|
@@ -2128,6 +2395,16 @@ var qt = class e {
|
|
|
2128
2395
|
try {
|
|
2129
2396
|
[, h] = await Promise.all([f.waitForLoad(), m]);
|
|
2130
2397
|
} catch (e) {
|
|
2398
|
+
try {
|
|
2399
|
+
f.reportSdkError({
|
|
2400
|
+
errorCode: "sdk.session.attach_failed",
|
|
2401
|
+
severity: "error",
|
|
2402
|
+
operation: "attach",
|
|
2403
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2404
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2405
|
+
release: $e
|
|
2406
|
+
});
|
|
2407
|
+
} catch {}
|
|
2131
2408
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
2132
2409
|
} finally {
|
|
2133
2410
|
this.endpointAbortController = null;
|
|
@@ -2140,16 +2417,42 @@ var qt = class e {
|
|
|
2140
2417
|
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Se(_), f.postLaunch(g, _, {
|
|
2141
2418
|
startButton: e.startButton,
|
|
2142
2419
|
theme: e.theme,
|
|
2143
|
-
showFeedback: e.showFeedback
|
|
2420
|
+
showFeedback: e.showFeedback,
|
|
2421
|
+
interaction: e.interaction
|
|
2144
2422
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
2145
2423
|
startButton: e.startButton,
|
|
2146
2424
|
theme: e.theme,
|
|
2147
|
-
showFeedback: e.showFeedback
|
|
2425
|
+
showFeedback: e.showFeedback,
|
|
2426
|
+
interaction: e.interaction
|
|
2148
2427
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2149
2428
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
2150
|
-
})])
|
|
2429
|
+
})]).catch((e) => {
|
|
2430
|
+
try {
|
|
2431
|
+
f.reportSdkError({
|
|
2432
|
+
errorCode: "sdk.session.attach_failed",
|
|
2433
|
+
severity: "error",
|
|
2434
|
+
operation: "attach",
|
|
2435
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2436
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2437
|
+
release: $e
|
|
2438
|
+
});
|
|
2439
|
+
} catch {}
|
|
2440
|
+
throw e;
|
|
2441
|
+
}), await Promise.race([l, new Promise((e, t) => {
|
|
2151
2442
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
|
|
2152
|
-
})])
|
|
2443
|
+
})]).catch((e) => {
|
|
2444
|
+
try {
|
|
2445
|
+
f.reportSdkError({
|
|
2446
|
+
errorCode: "sdk.session.attach_failed",
|
|
2447
|
+
severity: "error",
|
|
2448
|
+
operation: "attach",
|
|
2449
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2450
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2451
|
+
release: $e
|
|
2452
|
+
});
|
|
2453
|
+
} catch {}
|
|
2454
|
+
throw e;
|
|
2455
|
+
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
|
|
2153
2456
|
}
|
|
2154
2457
|
async startListening() {
|
|
2155
2458
|
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
@@ -2173,11 +2476,23 @@ var qt = class e {
|
|
|
2173
2476
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2174
2477
|
}
|
|
2175
2478
|
async setFit(e) {
|
|
2176
|
-
let t =
|
|
2479
|
+
let t = Kt(e);
|
|
2177
2480
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2178
2481
|
if (this.closed) throw Error("Session has ended.");
|
|
2179
2482
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
2180
2483
|
}
|
|
2484
|
+
async setInteraction(e) {
|
|
2485
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2486
|
+
if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
|
|
2487
|
+
let t = await this.iframeHost.setInteraction(e);
|
|
2488
|
+
return this.lastInteraction = t, t;
|
|
2489
|
+
}
|
|
2490
|
+
async getInteraction() {
|
|
2491
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2492
|
+
if (!this.iframeHost) throw Error("getInteraction() requires attach() first.");
|
|
2493
|
+
let e = await this.iframeHost.getInteraction();
|
|
2494
|
+
return this.lastInteraction = e, e;
|
|
2495
|
+
}
|
|
2181
2496
|
async conversion(e) {
|
|
2182
2497
|
if (this.closed) throw Error("Session has ended.");
|
|
2183
2498
|
if (!this.iframeHost) throw Error("conversion() requires attach() first.");
|
|
@@ -2197,7 +2512,7 @@ var qt = class e {
|
|
|
2197
2512
|
this.close();
|
|
2198
2513
|
}
|
|
2199
2514
|
destroy() {
|
|
2200
|
-
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,
|
|
2515
|
+
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);
|
|
2201
2516
|
}
|
|
2202
2517
|
resolveMintInteraction() {
|
|
2203
2518
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2209,8 +2524,8 @@ var qt = class e {
|
|
|
2209
2524
|
return this.resolvedSession?.id ?? "";
|
|
2210
2525
|
}
|
|
2211
2526
|
emitWrapped(e, t) {
|
|
2212
|
-
let n =
|
|
2213
|
-
return
|
|
2527
|
+
let n = lt(e, this.getSessionId(), t);
|
|
2528
|
+
return ft(this.eventRegistry, e, n), n;
|
|
2214
2529
|
}
|
|
2215
2530
|
queueProcessorTurn(e) {
|
|
2216
2531
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2269,7 +2584,7 @@ var qt = class e {
|
|
|
2269
2584
|
};
|
|
2270
2585
|
}
|
|
2271
2586
|
};
|
|
2272
|
-
function
|
|
2587
|
+
function Yt(e) {
|
|
2273
2588
|
return e ? {
|
|
2274
2589
|
textSpeech: e.capabilities.speech.output,
|
|
2275
2590
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -2280,26 +2595,26 @@ function Jt(e) {
|
|
|
2280
2595
|
}
|
|
2281
2596
|
//#endregion
|
|
2282
2597
|
//#region src/widget/dockGeometry.ts
|
|
2283
|
-
var
|
|
2284
|
-
function
|
|
2598
|
+
var Xt = "(min-width: 768px)", Zt = 24, Qt = .5, $t = 1200, en = .85, tn = 9 / 16;
|
|
2599
|
+
function nn() {
|
|
2285
2600
|
if (typeof window > "u") return 800;
|
|
2286
2601
|
let e = window.screen?.availHeight;
|
|
2287
2602
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
2288
2603
|
}
|
|
2289
|
-
function
|
|
2290
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
2291
|
-
return s > a && (s = a, o = s /
|
|
2604
|
+
function rn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Zt, r = typeof window < "u" ? nn() : 800) {
|
|
2605
|
+
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;
|
|
2606
|
+
return s > a && (s = a, o = s / tn, o > i && (o = i, s = o * tn)), {
|
|
2292
2607
|
width: Math.round(s),
|
|
2293
2608
|
height: Math.round(o)
|
|
2294
2609
|
};
|
|
2295
2610
|
}
|
|
2296
|
-
function
|
|
2611
|
+
function an(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Zt) {
|
|
2297
2612
|
return {
|
|
2298
2613
|
left: Math.max(r, t - e.width - r),
|
|
2299
2614
|
top: Math.max(r, n - e.height - r)
|
|
2300
2615
|
};
|
|
2301
2616
|
}
|
|
2302
|
-
function
|
|
2617
|
+
function on(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Zt) {
|
|
2303
2618
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
2304
2619
|
return {
|
|
2305
2620
|
left: Math.min(Math.max(a, e), o),
|
|
@@ -2307,14 +2622,14 @@ function an(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
|
|
|
2307
2622
|
};
|
|
2308
2623
|
}
|
|
2309
2624
|
function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
2310
|
-
return e(
|
|
2625
|
+
return e(Xt).matches;
|
|
2311
2626
|
}
|
|
2312
2627
|
//#endregion
|
|
2313
2628
|
//#region src/widget/mountExperienceWidget.ts
|
|
2314
|
-
function
|
|
2629
|
+
function sn(e) {
|
|
2315
2630
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
2316
2631
|
}
|
|
2317
|
-
function
|
|
2632
|
+
function cn(e) {
|
|
2318
2633
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
2319
2634
|
let t = typeof e == "string" ? e.trim() : "";
|
|
2320
2635
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -2322,9 +2637,9 @@ function sn(e) {
|
|
|
2322
2637
|
function $(e) {
|
|
2323
2638
|
return e === "expanded" || e === "docked";
|
|
2324
2639
|
}
|
|
2325
|
-
var
|
|
2326
|
-
function
|
|
2327
|
-
|
|
2640
|
+
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>";
|
|
2641
|
+
function pn(e, t, n) {
|
|
2642
|
+
ne(L);
|
|
2328
2643
|
let r = c({
|
|
2329
2644
|
galleryThumb: t.galleryThumb,
|
|
2330
2645
|
avatarImage: t.avatarImage,
|
|
@@ -2351,9 +2666,9 @@ function fn(e, t, n) {
|
|
|
2351
2666
|
let e = document.createElement("img");
|
|
2352
2667
|
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);
|
|
2353
2668
|
}
|
|
2354
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
2669
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : te(i);
|
|
2355
2670
|
}
|
|
2356
|
-
function
|
|
2671
|
+
function mn(e) {
|
|
2357
2672
|
return e.startButton ? {
|
|
2358
2673
|
...e.startButton,
|
|
2359
2674
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -2365,7 +2680,7 @@ function pn(e) {
|
|
|
2365
2680
|
variant: "primary"
|
|
2366
2681
|
};
|
|
2367
2682
|
}
|
|
2368
|
-
function
|
|
2683
|
+
function hn(e) {
|
|
2369
2684
|
let t = !1, n = () => {
|
|
2370
2685
|
t || e();
|
|
2371
2686
|
}, r = () => {
|
|
@@ -2385,12 +2700,12 @@ function mn(e) {
|
|
|
2385
2700
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
2386
2701
|
};
|
|
2387
2702
|
}
|
|
2388
|
-
function
|
|
2389
|
-
|
|
2703
|
+
function gn(e, t) {
|
|
2704
|
+
ae(re);
|
|
2390
2705
|
let n = t.experienceId?.trim();
|
|
2391
2706
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
2392
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
2393
|
-
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",
|
|
2707
|
+
let r = t.prefetch ?? "onExpand", i = sn(t.position), a = document.createElement("div");
|
|
2708
|
+
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));
|
|
2394
2709
|
let o = document.createElement("button");
|
|
2395
2710
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
2396
2711
|
let s = document.createElement("div");
|
|
@@ -2410,22 +2725,22 @@ function hn(e, t) {
|
|
|
2410
2725
|
let m = document.createElement("span");
|
|
2411
2726
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
2412
2727
|
let h = document.createElement("button");
|
|
2413
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
2728
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = dn, h.setAttribute("aria-label", "Reduce");
|
|
2414
2729
|
let g = document.createElement("button");
|
|
2415
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
2730
|
+
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");
|
|
2416
2731
|
let _ = document.createElement("button");
|
|
2417
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
2732
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = un, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
2418
2733
|
let v = document.createElement("div");
|
|
2419
2734
|
v.className = "liforma-ew__stage";
|
|
2420
2735
|
let y = document.createElement("div");
|
|
2421
2736
|
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);
|
|
2422
|
-
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,
|
|
2737
|
+
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 = () => {
|
|
2423
2738
|
let e = a.dataset.state;
|
|
2424
2739
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
2425
|
-
},
|
|
2740
|
+
}, oe = () => {
|
|
2426
2741
|
M !== null && (clearTimeout(M), M = null);
|
|
2427
2742
|
}, se = () => {
|
|
2428
|
-
|
|
2743
|
+
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
2429
2744
|
}, ce = () => {
|
|
2430
2745
|
for (let e of [
|
|
2431
2746
|
f,
|
|
@@ -2441,43 +2756,43 @@ function hn(e, t) {
|
|
|
2441
2756
|
let a = p.offsetWidth || 120;
|
|
2442
2757
|
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";
|
|
2443
2758
|
}, B = (e, t) => {
|
|
2444
|
-
if (
|
|
2445
|
-
let n =
|
|
2446
|
-
|
|
2759
|
+
if (z() !== "docked") return;
|
|
2760
|
+
let n = rn(), r = on(e - ee, t - te, n);
|
|
2761
|
+
P = r.left, F = r.top, le(r.left, r.top, n.width, n.height);
|
|
2447
2762
|
}, de = (e, t) => {
|
|
2448
|
-
if (
|
|
2449
|
-
let n =
|
|
2450
|
-
|
|
2763
|
+
if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
2764
|
+
let n = rn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = on(r + e, i + t, n);
|
|
2765
|
+
P = a.left, F = a.top, le(a.left, a.top, n.width, n.height);
|
|
2451
2766
|
}, fe = (e) => {
|
|
2452
|
-
|
|
2767
|
+
L === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), B(e.clientX, e.clientY)));
|
|
2453
2768
|
}, V = (e) => {
|
|
2454
|
-
if (
|
|
2455
|
-
let t =
|
|
2456
|
-
|
|
2769
|
+
if (I === null || e && e.pointerId !== I) return;
|
|
2770
|
+
let t = L;
|
|
2771
|
+
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));
|
|
2457
2772
|
}, pe = (e, t, n) => {
|
|
2458
|
-
if (S ||
|
|
2459
|
-
|
|
2773
|
+
if (S || z() !== "docked" || !Q() || I !== null) return;
|
|
2774
|
+
I = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2460
2775
|
let r = f.getBoundingClientRect();
|
|
2461
|
-
|
|
2776
|
+
ee = e - r.left, te = t - r.top, R || (R = !0, window.addEventListener("pointermove", fe), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
2462
2777
|
}, H = (e) => {
|
|
2463
|
-
if (S ||
|
|
2464
|
-
|
|
2778
|
+
if (S || z() !== "docked" || !Q() || I !== null) return;
|
|
2779
|
+
I = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2465
2780
|
let t = f.getBoundingClientRect();
|
|
2466
|
-
|
|
2781
|
+
P = t.left, F = t.top;
|
|
2467
2782
|
}, me = (e) => {
|
|
2468
|
-
|
|
2783
|
+
L === "player" && (I === null || e.pointerId !== I || de(e.dx, e.dy));
|
|
2469
2784
|
}, he = (e) => {
|
|
2470
|
-
|
|
2785
|
+
L === "player" && (I === null || e.pointerId !== I || V());
|
|
2471
2786
|
}, U = () => {
|
|
2472
|
-
let e = Q(), t =
|
|
2787
|
+
let e = Q(), t = z();
|
|
2473
2788
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
2474
2789
|
h.hidden = !0;
|
|
2475
2790
|
return;
|
|
2476
2791
|
}
|
|
2477
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
2792
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = fn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = dn, h.setAttribute("aria-label", "Reduce"));
|
|
2478
2793
|
}, ge = (e) => {
|
|
2479
|
-
let t =
|
|
2480
|
-
n =
|
|
2794
|
+
let t = rn(), n = e && P !== null && F !== null ? on(P, F, t) : an(t);
|
|
2795
|
+
n = on(n.left, n.top, t), P = n.left, F = n.top, le(n.left, n.top, t.width, t.height), U();
|
|
2481
2796
|
}, _e = () => {
|
|
2482
2797
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
2483
2798
|
requestAnimationFrame(() => {
|
|
@@ -2489,15 +2804,15 @@ function hn(e, t) {
|
|
|
2489
2804
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2490
2805
|
return;
|
|
2491
2806
|
}
|
|
2492
|
-
|
|
2493
|
-
if (
|
|
2807
|
+
N = setTimeout(() => {
|
|
2808
|
+
if (N = null, S || !$(a.dataset.state)) {
|
|
2494
2809
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2495
2810
|
return;
|
|
2496
2811
|
}
|
|
2497
2812
|
a.classList.remove("liforma-ew--layout-settling"), _e();
|
|
2498
2813
|
}, 220);
|
|
2499
2814
|
}, G = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
2500
|
-
|
|
2815
|
+
oe(), M = setTimeout(() => {
|
|
2501
2816
|
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
2502
2817
|
}, 280);
|
|
2503
2818
|
})), ve = {
|
|
@@ -2524,20 +2839,20 @@ function hn(e, t) {
|
|
|
2524
2839
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
2525
2840
|
}, Se = (e) => {
|
|
2526
2841
|
A?.(), A = null;
|
|
2527
|
-
let t =
|
|
2842
|
+
let t = pn(s, e, { parallax: ie });
|
|
2528
2843
|
return t ? (A = t, !0) : !1;
|
|
2529
2844
|
}, Ce = () => {
|
|
2530
2845
|
if (Se(ve)) {
|
|
2531
2846
|
be();
|
|
2532
2847
|
return;
|
|
2533
2848
|
}
|
|
2534
|
-
ye("Loading…"), ue(n, { signal:
|
|
2849
|
+
ye("Loading…"), ue(n, { signal: ne.signal }).then((e) => {
|
|
2535
2850
|
if (!S) {
|
|
2536
2851
|
if (!Se({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
2537
2852
|
be();
|
|
2538
2853
|
}
|
|
2539
2854
|
}).catch((e) => {
|
|
2540
|
-
if (S ||
|
|
2855
|
+
if (S || ne.signal.aborted) return;
|
|
2541
2856
|
let n = e instanceof Error ? e : Error(String(e));
|
|
2542
2857
|
ye("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
2543
2858
|
});
|
|
@@ -2550,11 +2865,13 @@ function hn(e, t) {
|
|
|
2550
2865
|
...t.mode ? { mode: t.mode } : {},
|
|
2551
2866
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
2552
2867
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
2868
|
+
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
2553
2869
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
2554
2870
|
}), Te = () => ({
|
|
2555
2871
|
...t.fit ? { fit: t.fit } : {},
|
|
2556
|
-
startButton:
|
|
2557
|
-
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
|
|
2872
|
+
startButton: mn(t),
|
|
2873
|
+
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
2874
|
+
...t.interaction ? { interaction: t.interaction } : {}
|
|
2558
2875
|
}), q = (e = !0) => {
|
|
2559
2876
|
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?.();
|
|
2560
2877
|
}, Ee = () => {
|
|
@@ -2570,7 +2887,7 @@ function hn(e, t) {
|
|
|
2570
2887
|
}, Oe = () => {
|
|
2571
2888
|
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();
|
|
2572
2889
|
}, ke = () => {
|
|
2573
|
-
|
|
2890
|
+
oe(), se(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
2574
2891
|
let e = b;
|
|
2575
2892
|
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");
|
|
2576
2893
|
}, J = () => {
|
|
@@ -2585,26 +2902,26 @@ function hn(e, t) {
|
|
|
2585
2902
|
ke(), Oe(), t.onCollapsed?.(), t.onClose?.();
|
|
2586
2903
|
}
|
|
2587
2904
|
}, Ae = () => {
|
|
2588
|
-
S || Q() &&
|
|
2905
|
+
S || Q() && z() === "expanded" && W(() => {
|
|
2589
2906
|
Ee();
|
|
2590
2907
|
});
|
|
2591
2908
|
}, je = () => {
|
|
2592
|
-
S ||
|
|
2909
|
+
S || z() === "docked" && (V(), W(() => {
|
|
2593
2910
|
ce(), q(!1), b?.setWidgetChrome("expanded");
|
|
2594
2911
|
}));
|
|
2595
2912
|
}, Me = () => {
|
|
2596
|
-
!b || !D || (
|
|
2913
|
+
!b || !D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, _e());
|
|
2597
2914
|
}, Ne = () => {
|
|
2598
|
-
!b || !E || D || (
|
|
2915
|
+
!b || !E || D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
2599
2916
|
}, Pe = (e) => {
|
|
2600
|
-
S || e !== O && !D || (
|
|
2917
|
+
S || e !== O && !D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, D && _e());
|
|
2601
2918
|
}, Fe = () => {
|
|
2602
2919
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
2603
2920
|
T = !0;
|
|
2604
2921
|
let e = O;
|
|
2605
2922
|
l.hidden = !1, (async () => {
|
|
2606
2923
|
try {
|
|
2607
|
-
let t = await
|
|
2924
|
+
let t = await Jt.startSession(we());
|
|
2608
2925
|
if (S || e !== O) {
|
|
2609
2926
|
t.destroy();
|
|
2610
2927
|
return;
|
|
@@ -2663,7 +2980,7 @@ function hn(e, t) {
|
|
|
2663
2980
|
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 () => {
|
|
2664
2981
|
try {
|
|
2665
2982
|
q();
|
|
2666
|
-
let t = await
|
|
2983
|
+
let t = await Jt.startSession(we());
|
|
2667
2984
|
if (S || e !== O) {
|
|
2668
2985
|
t.destroy();
|
|
2669
2986
|
return;
|
|
@@ -2720,22 +3037,22 @@ function hn(e, t) {
|
|
|
2720
3037
|
Ie();
|
|
2721
3038
|
}
|
|
2722
3039
|
}, Re = (e) => {
|
|
2723
|
-
if (e.stopPropagation(),
|
|
3040
|
+
if (e.stopPropagation(), z() === "expanded") {
|
|
2724
3041
|
Ae();
|
|
2725
3042
|
return;
|
|
2726
3043
|
}
|
|
2727
|
-
|
|
3044
|
+
z() === "docked" && je();
|
|
2728
3045
|
}, ze = (e) => {
|
|
2729
3046
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
2730
3047
|
}, Be = (e) => {
|
|
2731
3048
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
2732
3049
|
}, Ve = (e) => {
|
|
2733
|
-
|
|
3050
|
+
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), pe(e.clientX, e.clientY, e.pointerId)));
|
|
2734
3051
|
}, He = (e) => {
|
|
2735
3052
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), J());
|
|
2736
3053
|
}, Ue = () => {
|
|
2737
3054
|
if (!S) {
|
|
2738
|
-
if (
|
|
3055
|
+
if (z() === "docked") {
|
|
2739
3056
|
if (!Q()) {
|
|
2740
3057
|
je();
|
|
2741
3058
|
return;
|
|
@@ -2747,9 +3064,9 @@ function hn(e, t) {
|
|
|
2747
3064
|
}
|
|
2748
3065
|
U();
|
|
2749
3066
|
}
|
|
2750
|
-
}, We = typeof window < "u" ? window.matchMedia(
|
|
3067
|
+
}, We = typeof window < "u" ? window.matchMedia(Xt) : null, Ge = () => {
|
|
2751
3068
|
if (!S) {
|
|
2752
|
-
if (
|
|
3069
|
+
if (z() === "docked" && !Q()) {
|
|
2753
3070
|
je();
|
|
2754
3071
|
return;
|
|
2755
3072
|
}
|
|
@@ -2760,7 +3077,7 @@ function hn(e, t) {
|
|
|
2760
3077
|
e.stopPropagation(), J();
|
|
2761
3078
|
}), 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(() => {
|
|
2762
3079
|
S || Fe();
|
|
2763
|
-
}) : r === "idle" && (j =
|
|
3080
|
+
}) : r === "idle" && (j = hn(() => {
|
|
2764
3081
|
S || Fe();
|
|
2765
3082
|
})), {
|
|
2766
3083
|
root: a,
|
|
@@ -2776,11 +3093,11 @@ function hn(e, t) {
|
|
|
2776
3093
|
Fe();
|
|
2777
3094
|
},
|
|
2778
3095
|
destroy() {
|
|
2779
|
-
S || (S = !0, V(), j?.(), j = null,
|
|
3096
|
+
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());
|
|
2780
3097
|
}
|
|
2781
3098
|
};
|
|
2782
3099
|
}
|
|
2783
3100
|
//#endregion
|
|
2784
|
-
export {
|
|
3101
|
+
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 };
|
|
2785
3102
|
|
|
2786
3103
|
//# sourceMappingURL=index.js.map
|