@liforma/client 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +14 -1
- package/dist/byo/audioCapture.d.ts +24 -0
- package/dist/byo/audioCapture.d.ts.map +1 -0
- package/dist/byo/index.d.ts +8 -0
- package/dist/byo/index.d.ts.map +1 -0
- package/dist/byo/index.js +307 -0
- package/dist/byo/index.js.map +1 -0
- package/dist/byo/mic.d.ts +27 -0
- package/dist/byo/mic.d.ts.map +1 -0
- package/dist/byo/pcm.d.ts +33 -0
- package/dist/byo/pcm.d.ts.map +1 -0
- package/dist/byo/pcmCarry.d.ts +17 -0
- package/dist/byo/pcmCarry.d.ts.map +1 -0
- package/dist/byo/resample.d.ts +18 -0
- package/dist/byo/resample.d.ts.map +1 -0
- package/dist/byo/turn.d.ts +39 -0
- package/dist/byo/turn.d.ts.map +1 -0
- package/dist/byo/types.d.ts +74 -0
- package/dist/byo/types.d.ts.map +1 -0
- package/dist/deepgram/connectDeepgramAgent.d.ts +51 -0
- package/dist/deepgram/connectDeepgramAgent.d.ts.map +1 -0
- package/dist/deepgram/deepgramAgentMessages.d.ts +31 -0
- package/dist/deepgram/deepgramAgentMessages.d.ts.map +1 -0
- package/dist/deepgram/index.d.ts +4 -0
- package/dist/deepgram/index.d.ts.map +1 -0
- package/dist/deepgram/index.js +142 -0
- package/dist/deepgram/index.js.map +1 -0
- package/dist/elevenlabs/connectElevenLabsAgent.d.ts +23 -0
- package/dist/elevenlabs/connectElevenLabsAgent.d.ts.map +1 -0
- package/dist/elevenlabs/index.d.ts +4 -0
- package/dist/elevenlabs/index.d.ts.map +1 -0
- package/dist/elevenlabs/index.js +89 -0
- package/dist/elevenlabs/index.js.map +1 -0
- package/dist/google/connectGeminiLive.d.ts +34 -0
- package/dist/google/connectGeminiLive.d.ts.map +1 -0
- package/dist/google/index.d.ts +4 -0
- package/dist/google/index.d.ts.map +1 -0
- package/dist/google/index.js +98 -0
- package/dist/google/index.js.map +1 -0
- package/dist/livekit/connectLiveKitAgent.d.ts +46 -0
- package/dist/livekit/connectLiveKitAgent.d.ts.map +1 -0
- package/dist/livekit/index.d.ts +3 -0
- package/dist/livekit/index.d.ts.map +1 -0
- package/dist/livekit/index.js +113 -0
- package/dist/livekit/index.js.map +1 -0
- package/dist/next/byo/audioCapture.d.ts +24 -0
- package/dist/next/byo/audioCapture.d.ts.map +1 -0
- package/dist/next/byo/pcm.d.ts +33 -0
- package/dist/next/byo/pcm.d.ts.map +1 -0
- package/dist/next/byo/resample.d.ts +18 -0
- package/dist/next/byo/resample.d.ts.map +1 -0
- package/dist/next/index.js +675 -474
- package/dist/next/index.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +16 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +41 -1
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +14 -2
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/speech/captureMediaStreamTrack.d.ts +1 -1
- package/dist/next/v2/speech/captureMediaStreamTrack.d.ts.map +1 -1
- package/dist/next/v2/speech/speechController.d.ts.map +1 -1
- package/dist/next/v2/speech/types.d.ts +13 -0
- package/dist/next/v2/speech/types.d.ts.map +1 -1
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/styles.d.ts +1 -1
- package/dist/next/widget/styles.d.ts.map +1 -1
- package/dist/npm/byo/audioCapture.d.ts +24 -0
- package/dist/npm/byo/audioCapture.d.ts.map +1 -0
- package/dist/npm/byo/pcm.d.ts +33 -0
- package/dist/npm/byo/pcm.d.ts.map +1 -0
- package/dist/npm/byo/resample.d.ts +18 -0
- package/dist/npm/byo/resample.d.ts.map +1 -0
- package/dist/npm/index.js +700 -499
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +16 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +41 -1
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +14 -2
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/speech/captureMediaStreamTrack.d.ts +1 -1
- package/dist/npm/v2/speech/captureMediaStreamTrack.d.ts.map +1 -1
- package/dist/npm/v2/speech/speechController.d.ts.map +1 -1
- package/dist/npm/v2/speech/types.d.ts +13 -0
- package/dist/npm/v2/speech/types.d.ts.map +1 -1
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/styles.d.ts +1 -1
- package/dist/npm/widget/styles.d.ts.map +1 -1
- package/dist/openai/connectOpenAiRealtime.d.ts +41 -0
- package/dist/openai/connectOpenAiRealtime.d.ts.map +1 -0
- package/dist/openai/connectOpenAiRealtimeWebRtc.d.ts +37 -0
- package/dist/openai/connectOpenAiRealtimeWebRtc.d.ts.map +1 -0
- package/dist/openai/index.d.ts +5 -0
- package/dist/openai/index.d.ts.map +1 -0
- package/dist/openai/index.js +282 -0
- package/dist/openai/index.js.map +1 -0
- package/dist/react/byo/audioCapture.d.ts +24 -0
- package/dist/react/byo/audioCapture.d.ts.map +1 -0
- package/dist/react/byo/pcm.d.ts +33 -0
- package/dist/react/byo/pcm.d.ts.map +1 -0
- package/dist/react/byo/resample.d.ts +18 -0
- package/dist/react/byo/resample.d.ts.map +1 -0
- package/dist/react/index.js +696 -495
- package/dist/react/index.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +16 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +41 -1
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +14 -2
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/speech/captureMediaStreamTrack.d.ts +1 -1
- package/dist/react/v2/speech/captureMediaStreamTrack.d.ts.map +1 -1
- package/dist/react/v2/speech/speechController.d.ts.map +1 -1
- package/dist/react/v2/speech/types.d.ts +13 -0
- package/dist/react/v2/speech/types.d.ts.map +1 -1
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/styles.d.ts +1 -1
- package/dist/react/widget/styles.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +37 -10
- package/dist/sdk/v2/client.js.map +1 -1
- package/package.json +55 -7
package/dist/next/index.js
CHANGED
|
@@ -150,52 +150,52 @@ var O = 0, k = [];
|
|
|
150
150
|
function A() {
|
|
151
151
|
return D() ? 4 : Infinity;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function j() {
|
|
154
154
|
return D() ? 160 : 0;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function re() {
|
|
157
157
|
let e = A();
|
|
158
158
|
for (; O < e && k.length > 0;) {
|
|
159
159
|
let e = k.shift();
|
|
160
160
|
if (!e || e.cancelled) continue;
|
|
161
161
|
O += 1, e.start();
|
|
162
|
-
let t =
|
|
162
|
+
let t = j();
|
|
163
163
|
if (t <= 0) {
|
|
164
164
|
O = Math.max(0, O - 1);
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
167
167
|
window.setTimeout(() => {
|
|
168
|
-
O = Math.max(0, O - 1),
|
|
168
|
+
O = Math.max(0, O - 1), re();
|
|
169
169
|
}, t);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function M(e) {
|
|
173
173
|
if (!D()) return e(), () => {};
|
|
174
174
|
let t = {
|
|
175
175
|
start: e,
|
|
176
176
|
cancelled: !1
|
|
177
177
|
};
|
|
178
|
-
return k.push(t),
|
|
178
|
+
return k.push(t), re(), () => {
|
|
179
179
|
t.cancelled = !0;
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/thumbnail/lazyLoad.ts
|
|
184
|
-
function
|
|
184
|
+
function ie() {
|
|
185
185
|
return D() ? "96px 0px" : "280px 0px";
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function ae(e) {
|
|
188
188
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
189
189
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function oe(e, t) {
|
|
192
192
|
if (typeof window > "u") return !1;
|
|
193
193
|
let n = e.getBoundingClientRect();
|
|
194
194
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
198
|
-
o || (s?.(), s =
|
|
196
|
+
function se(e, t) {
|
|
197
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? ie(), i = ae(r), a = !1, o = !1, s = null, c = () => {
|
|
198
|
+
o || (s?.(), s = M(() => {
|
|
199
199
|
s = null, o = !0, n(!0);
|
|
200
200
|
}));
|
|
201
201
|
}, l = (e) => {
|
|
@@ -217,55 +217,55 @@ function le(e, t) {
|
|
|
217
217
|
rootMargin: r,
|
|
218
218
|
threshold: 0
|
|
219
219
|
});
|
|
220
|
-
return u.observe(e),
|
|
220
|
+
return u.observe(e), oe(e, i) && l(!0), () => {
|
|
221
221
|
s?.(), s = null, u.disconnect();
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
//#endregion
|
|
225
225
|
//#region src/thumbnail/scrollParallax.ts
|
|
226
|
-
function
|
|
226
|
+
function ce() {
|
|
227
227
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function le(e, t) {
|
|
230
230
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
231
231
|
}
|
|
232
|
-
var
|
|
233
|
-
function
|
|
234
|
-
if (
|
|
232
|
+
var N = /* @__PURE__ */ new Set(), ue = !1, P = 0;
|
|
233
|
+
function de() {
|
|
234
|
+
if (P = 0, N.size === 0 || typeof window > "u") return;
|
|
235
235
|
let e = window.innerHeight;
|
|
236
|
-
for (let t of
|
|
236
|
+
for (let t of N) {
|
|
237
237
|
if (t.pointerActive?.()) continue;
|
|
238
238
|
let n = t.element.getBoundingClientRect();
|
|
239
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
239
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(le(n, e));
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
+
function fe() {
|
|
243
|
+
P === 0 && (P = requestAnimationFrame(de));
|
|
244
|
+
}
|
|
242
245
|
function pe() {
|
|
243
|
-
|
|
246
|
+
ue || typeof window > "u" || (ue = !0, window.addEventListener("scroll", fe, { passive: !0 }), window.addEventListener("resize", fe, { passive: !0 }));
|
|
244
247
|
}
|
|
245
248
|
function me() {
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
function he() {
|
|
249
|
-
M.size > 0 || !de || typeof window > "u" || (de = !1, N !== 0 && (cancelAnimationFrame(N), N = 0), window.removeEventListener("scroll", pe), window.removeEventListener("resize", pe));
|
|
249
|
+
N.size > 0 || !ue || typeof window > "u" || (ue = !1, P !== 0 && (cancelAnimationFrame(P), P = 0), window.removeEventListener("scroll", fe), window.removeEventListener("resize", fe));
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
if (!
|
|
251
|
+
function he(e, t) {
|
|
252
|
+
if (!ce()) return () => {};
|
|
253
253
|
let n = {
|
|
254
254
|
element: e,
|
|
255
255
|
onParallax: t.onParallax,
|
|
256
256
|
pointerActive: t.pointerActive
|
|
257
257
|
};
|
|
258
|
-
return
|
|
259
|
-
|
|
258
|
+
return N.add(n), pe(), n.pointerActive?.() || t.onParallax(le(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
259
|
+
N.delete(n), me();
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
//#endregion
|
|
263
263
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
264
|
-
function
|
|
264
|
+
function ge(e) {
|
|
265
265
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
266
266
|
let a = r || i;
|
|
267
267
|
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));
|
|
268
|
-
}, s =
|
|
268
|
+
}, s = he(e, {
|
|
269
269
|
onParallax: (e) => {
|
|
270
270
|
i = !0, a || (t = e, n = 0, o());
|
|
271
271
|
},
|
|
@@ -278,7 +278,7 @@ function _e(e) {
|
|
|
278
278
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
279
279
|
}, u = () => {
|
|
280
280
|
let s = a;
|
|
281
|
-
a = !1, r = !1, i && s ? (t =
|
|
281
|
+
a = !1, r = !1, i && s ? (t = le(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
282
282
|
}, d = (e) => {
|
|
283
283
|
e.pointerType === "mouse" && (r = !0, o());
|
|
284
284
|
}, f = () => {
|
|
@@ -290,22 +290,22 @@ function _e(e) {
|
|
|
290
290
|
}
|
|
291
291
|
//#endregion
|
|
292
292
|
//#region src/thumbnail/styles.ts
|
|
293
|
-
var
|
|
294
|
-
function
|
|
295
|
-
if (typeof document > "u" ||
|
|
293
|
+
var _e = ".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: cover;\n object-position: 50% 30%;\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.liforma-et--scene .liforma-et__avatar {\n object-fit: contain;\n object-position: center bottom;\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:not(.liforma-et--scene) {\n --liforma-et-avatar-scale: 1.05;\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__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", ve = !1;
|
|
294
|
+
function ye(e) {
|
|
295
|
+
if (typeof document > "u" || ve) return;
|
|
296
296
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
297
|
-
|
|
297
|
+
ve = !0;
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
let t = document.createElement("style");
|
|
301
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
301
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), ve = !0;
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
304
|
//#region src/react/ExperienceThumbnail.tsx
|
|
305
|
-
function
|
|
305
|
+
function be(e, t) {
|
|
306
306
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function xe(s) {
|
|
309
309
|
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: ee, returnUrl: _, playerBaseUrl: v, parallax: y = !0, lazy: b = !0, className: te = "", fallbackImage: S } = s, C = t(() => x({
|
|
310
310
|
galleryThumb: c,
|
|
311
311
|
avatarImage: l,
|
|
@@ -322,11 +322,11 @@ function Se(s) {
|
|
|
322
322
|
href: m,
|
|
323
323
|
hasClickHandler: typeof ee == "function",
|
|
324
324
|
experienceId: p
|
|
325
|
-
}), E = T === "anchor" && !m?.trim() && !!p?.trim(), D = !!C?.backgroundImage, O = y !== !1, k = n(null), A = n(!1), [
|
|
325
|
+
}), E = T === "anchor" && !m?.trim() && !!p?.trim(), D = !!C?.backgroundImage, O = y !== !1, k = n(null), A = n(!1), [j, re] = r(!b), [M, ie] = r(!1), [ae, oe] = r(!1), [ce, N] = r(0), [ue, P] = r(0), [de, fe] = r(!1), [pe, me] = r(!1), [ge, ve] = r(!1), [xe, Se] = r(!1), [Ce, we] = r(), Te = C ? de && C.fallbackImage ? C.fallbackImage : C.avatarImage : "";
|
|
326
326
|
e(() => {
|
|
327
|
-
|
|
327
|
+
ye(_e);
|
|
328
328
|
}, []), e(() => {
|
|
329
|
-
|
|
329
|
+
we(ne({
|
|
330
330
|
href: m,
|
|
331
331
|
experienceId: p,
|
|
332
332
|
returnUrl: _,
|
|
@@ -340,32 +340,32 @@ function Se(s) {
|
|
|
340
340
|
v,
|
|
341
341
|
E
|
|
342
342
|
]), e(() => {
|
|
343
|
-
|
|
343
|
+
me(!1), ve(!1), Se(!1), fe(!1);
|
|
344
344
|
}, [
|
|
345
345
|
C?.backgroundImage,
|
|
346
346
|
C?.foregroundImage,
|
|
347
|
-
|
|
347
|
+
Te
|
|
348
348
|
]), e(() => {
|
|
349
349
|
let e = k.current;
|
|
350
350
|
if (e) {
|
|
351
351
|
if (!b) {
|
|
352
|
-
|
|
352
|
+
re(!0);
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
return
|
|
356
|
-
e &&
|
|
355
|
+
return se(e, { onVisibleChange: (e) => {
|
|
356
|
+
e && re(!0);
|
|
357
357
|
} });
|
|
358
358
|
}
|
|
359
359
|
}, [
|
|
360
360
|
b,
|
|
361
361
|
C,
|
|
362
362
|
T,
|
|
363
|
-
|
|
363
|
+
Ce
|
|
364
364
|
]), e(() => {
|
|
365
365
|
let e = k.current;
|
|
366
|
-
if (!(!e || !O)) return
|
|
366
|
+
if (!(!e || !O)) return he(e, {
|
|
367
367
|
onParallax: (e) => {
|
|
368
|
-
|
|
368
|
+
oe(!0), A.current || (N(e), P(0));
|
|
369
369
|
},
|
|
370
370
|
pointerActive: () => A.current
|
|
371
371
|
});
|
|
@@ -373,23 +373,23 @@ function Se(s) {
|
|
|
373
373
|
O,
|
|
374
374
|
C,
|
|
375
375
|
T,
|
|
376
|
-
|
|
376
|
+
Ce
|
|
377
377
|
]);
|
|
378
|
-
let
|
|
379
|
-
if (!O ||
|
|
378
|
+
let Ee = (e) => {
|
|
379
|
+
if (!O || ae) return;
|
|
380
380
|
let t = e.currentTarget.getBoundingClientRect();
|
|
381
|
-
t.width <= 0 || t.height <= 0 || (
|
|
382
|
-
},
|
|
381
|
+
t.width <= 0 || t.height <= 0 || (N(((e.clientX - t.left) / t.width - .5) * 2), P(((e.clientY - t.top) / t.height - .5) * 2));
|
|
382
|
+
}, De = (e) => {
|
|
383
383
|
let t = A.current;
|
|
384
|
-
A.current = !1,
|
|
385
|
-
},
|
|
384
|
+
A.current = !1, ie(!1), ae && t ? (N(le(e.getBoundingClientRect(), window.innerHeight)), P(0)) : ae || (N(0), P(0));
|
|
385
|
+
}, Oe = (e) => {
|
|
386
386
|
if (!O) return;
|
|
387
|
-
A.current = !0, e.pointerType === "mouse" &&
|
|
387
|
+
A.current = !0, e.pointerType === "mouse" && ie(!0);
|
|
388
388
|
let t = e.currentTarget, n = () => {
|
|
389
|
-
|
|
389
|
+
De(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
390
390
|
};
|
|
391
391
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
392
|
-
},
|
|
392
|
+
}, F = (e) => {
|
|
393
393
|
if (ee?.(e), !e.defaultPrevented && E && !_?.trim()) {
|
|
394
394
|
let t = ne({
|
|
395
395
|
experienceId: p,
|
|
@@ -400,97 +400,97 @@ function Se(s) {
|
|
|
400
400
|
}
|
|
401
401
|
};
|
|
402
402
|
if (!C) return null;
|
|
403
|
-
let
|
|
403
|
+
let ke = O && (M || ae), Ae = j && (ge || pe || xe), je = [
|
|
404
404
|
"liforma-et",
|
|
405
405
|
D ? "liforma-et--scene" : "",
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
ke ? "liforma-et--parallax" : "",
|
|
407
|
+
ae ? "liforma-et--scroll-parallax" : "",
|
|
408
|
+
j && !Ae ? "liforma-et--loading" : "",
|
|
409
|
+
Ae ? "liforma-et--revealed" : "",
|
|
410
410
|
te
|
|
411
|
-
].filter(Boolean).join(" "),
|
|
412
|
-
"--liforma-et-parallax-x":
|
|
413
|
-
"--liforma-et-parallax-y":
|
|
414
|
-
},
|
|
411
|
+
].filter(Boolean).join(" "), I = {
|
|
412
|
+
"--liforma-et-parallax-x": ce,
|
|
413
|
+
"--liforma-et-parallax-y": ue
|
|
414
|
+
}, Me = (e, t) => {
|
|
415
415
|
e.complete && t(!0);
|
|
416
416
|
}, Ne = /* @__PURE__ */ o(i, { children: [
|
|
417
417
|
/* @__PURE__ */ a("span", {
|
|
418
418
|
className: "liforma-et__placeholder",
|
|
419
419
|
"aria-hidden": "true"
|
|
420
420
|
}),
|
|
421
|
-
|
|
422
|
-
className:
|
|
421
|
+
j && C.backgroundImage ? /* @__PURE__ */ a("img", {
|
|
422
|
+
className: be("liforma-et__background", pe),
|
|
423
423
|
src: C.backgroundImage,
|
|
424
424
|
alt: "",
|
|
425
425
|
decoding: "async",
|
|
426
426
|
ref: (e) => {
|
|
427
|
-
e &&
|
|
427
|
+
e && Me(e, me);
|
|
428
428
|
},
|
|
429
|
-
onLoad: () =>
|
|
430
|
-
onError: () =>
|
|
429
|
+
onLoad: () => me(!0),
|
|
430
|
+
onError: () => me(!0)
|
|
431
431
|
}) : null,
|
|
432
|
-
|
|
433
|
-
className:
|
|
434
|
-
src:
|
|
432
|
+
j && Te ? /* @__PURE__ */ a("img", {
|
|
433
|
+
className: be("liforma-et__avatar", ge),
|
|
434
|
+
src: Te,
|
|
435
435
|
alt: "",
|
|
436
436
|
decoding: "async",
|
|
437
437
|
ref: (e) => {
|
|
438
|
-
e &&
|
|
438
|
+
e && Me(e, ve);
|
|
439
439
|
},
|
|
440
|
-
onLoad: () =>
|
|
440
|
+
onLoad: () => ve(!0),
|
|
441
441
|
onError: () => {
|
|
442
|
-
C.fallbackImage ?
|
|
442
|
+
C.fallbackImage ? fe(!0) : ve(!0);
|
|
443
443
|
}
|
|
444
444
|
}) : null,
|
|
445
|
-
|
|
446
|
-
className:
|
|
445
|
+
j && C.foregroundImage ? /* @__PURE__ */ a("img", {
|
|
446
|
+
className: be("liforma-et__foreground", xe),
|
|
447
447
|
src: C.foregroundImage,
|
|
448
448
|
alt: "",
|
|
449
449
|
decoding: "async",
|
|
450
450
|
ref: (e) => {
|
|
451
|
-
e &&
|
|
451
|
+
e && Me(e, Se);
|
|
452
452
|
},
|
|
453
|
-
onLoad: () =>
|
|
454
|
-
onError: () =>
|
|
453
|
+
onLoad: () => Se(!0),
|
|
454
|
+
onError: () => Se(!0)
|
|
455
455
|
}) : null
|
|
456
456
|
] }), Pe = {
|
|
457
|
-
onPointerDown:
|
|
458
|
-
onPointerUp: (e) =>
|
|
459
|
-
onPointerCancel: (e) =>
|
|
457
|
+
onPointerDown: Oe,
|
|
458
|
+
onPointerUp: (e) => De(e.currentTarget),
|
|
459
|
+
onPointerCancel: (e) => De(e.currentTarget),
|
|
460
460
|
onPointerEnter: (e) => {
|
|
461
|
-
O && e.pointerType === "mouse" &&
|
|
461
|
+
O && e.pointerType === "mouse" && ie(!0);
|
|
462
462
|
},
|
|
463
|
-
onPointerMove:
|
|
463
|
+
onPointerMove: Ee,
|
|
464
464
|
onPointerLeave: () => {
|
|
465
|
-
A.current || (
|
|
465
|
+
A.current || (ie(!1), ae || (N(0), P(0)));
|
|
466
466
|
}
|
|
467
467
|
}, L = (e) => {
|
|
468
468
|
k.current = e;
|
|
469
469
|
};
|
|
470
|
-
return T === "anchor" &&
|
|
470
|
+
return T === "anchor" && Ce ? /* @__PURE__ */ a("a", {
|
|
471
471
|
ref: L,
|
|
472
|
-
className:
|
|
473
|
-
style:
|
|
474
|
-
href:
|
|
472
|
+
className: je,
|
|
473
|
+
style: I,
|
|
474
|
+
href: Ce,
|
|
475
475
|
target: h,
|
|
476
476
|
rel: g,
|
|
477
477
|
"aria-label": f,
|
|
478
|
-
onClick:
|
|
478
|
+
onClick: F,
|
|
479
479
|
...Pe,
|
|
480
480
|
children: Ne
|
|
481
481
|
}) : T === "button" ? /* @__PURE__ */ a("button", {
|
|
482
482
|
type: "button",
|
|
483
483
|
ref: L,
|
|
484
|
-
className:
|
|
485
|
-
style:
|
|
484
|
+
className: je,
|
|
485
|
+
style: I,
|
|
486
486
|
"aria-label": f,
|
|
487
|
-
onClick:
|
|
487
|
+
onClick: F,
|
|
488
488
|
...Pe,
|
|
489
489
|
children: Ne
|
|
490
490
|
}) : /* @__PURE__ */ a("div", {
|
|
491
491
|
ref: L,
|
|
492
|
-
className:
|
|
493
|
-
style:
|
|
492
|
+
className: je,
|
|
493
|
+
style: I,
|
|
494
494
|
role: f ? "img" : void 0,
|
|
495
495
|
"aria-label": f || void 0,
|
|
496
496
|
"aria-hidden": f ? void 0 : !0,
|
|
@@ -500,33 +500,33 @@ function Se(s) {
|
|
|
500
500
|
}
|
|
501
501
|
//#endregion
|
|
502
502
|
//#region src/widget/styles.ts
|
|
503
|
-
var Ce = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip is the drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging {\n cursor: grabbing;\n}\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", we = "liforma-experience-widget-styles";
|
|
504
|
-
function
|
|
503
|
+
var Se = "\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", Ce = "liforma-experience-widget-styles";
|
|
504
|
+
function we(e = Se) {
|
|
505
505
|
if (typeof document > "u") return;
|
|
506
|
-
let t = document.getElementById(
|
|
506
|
+
let t = document.getElementById(Ce);
|
|
507
507
|
if (t) {
|
|
508
508
|
t.textContent = e;
|
|
509
509
|
return;
|
|
510
510
|
}
|
|
511
511
|
let n = document.createElement("style");
|
|
512
|
-
n.id =
|
|
512
|
+
n.id = Ce, n.textContent = e, document.head.append(n);
|
|
513
513
|
}
|
|
514
514
|
//#endregion
|
|
515
515
|
//#region src/shims/apiBaseUrl.ts
|
|
516
|
-
var
|
|
517
|
-
function
|
|
516
|
+
var Te = "https://api.liforma.ai", Ee = "http://localhost:3001";
|
|
517
|
+
function De() {
|
|
518
518
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
519
519
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
520
520
|
if (typeof document > "u") return null;
|
|
521
521
|
let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-api-base-url")?.trim();
|
|
522
522
|
return t ? t.replace(/\/$/, "") : null;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
return
|
|
524
|
+
function Oe() {
|
|
525
|
+
return De() || (te() ? Ee : Te);
|
|
526
526
|
}
|
|
527
527
|
//#endregion
|
|
528
528
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
529
|
-
function
|
|
529
|
+
function F(e) {
|
|
530
530
|
if (!e || typeof e != "object") return null;
|
|
531
531
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
532
532
|
return n ? {
|
|
@@ -535,10 +535,10 @@ function Ae(e) {
|
|
|
535
535
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
536
536
|
} : null;
|
|
537
537
|
}
|
|
538
|
-
async function
|
|
538
|
+
async function ke(e, t) {
|
|
539
539
|
let n = e.trim();
|
|
540
540
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
541
|
-
let r = (t?.apiBaseUrl ??
|
|
541
|
+
let r = (t?.apiBaseUrl ?? Oe()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
542
542
|
method: "GET",
|
|
543
543
|
headers: { Accept: "application/json" },
|
|
544
544
|
signal: t?.signal
|
|
@@ -558,7 +558,7 @@ async function je(e, t) {
|
|
|
558
558
|
throw Error("Experience preview returned invalid JSON.");
|
|
559
559
|
}
|
|
560
560
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
561
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
561
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = F(o.galleryThumb);
|
|
562
562
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
563
563
|
return {
|
|
564
564
|
experienceId: s || n,
|
|
@@ -568,7 +568,7 @@ async function je(e, t) {
|
|
|
568
568
|
}
|
|
569
569
|
//#endregion
|
|
570
570
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
571
|
-
function
|
|
571
|
+
function Ae(e, t) {
|
|
572
572
|
let n = e.trim();
|
|
573
573
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
574
574
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -599,8 +599,8 @@ function Me(e, t) {
|
|
|
599
599
|
}
|
|
600
600
|
//#endregion
|
|
601
601
|
//#region node_modules/zod/v4/core/core.js
|
|
602
|
-
var
|
|
603
|
-
function
|
|
602
|
+
var je;
|
|
603
|
+
function I(e, t, n) {
|
|
604
604
|
function r(n, r) {
|
|
605
605
|
if (n._zod || Object.defineProperty(n, "_zod", {
|
|
606
606
|
value: {
|
|
@@ -629,7 +629,7 @@ function F(e, t, n) {
|
|
|
629
629
|
}
|
|
630
630
|
return Object.defineProperty(o, "init", { value: r }), Object.defineProperty(o, Symbol.hasInstance, { value: (t) => n?.Parent && t instanceof n.Parent ? !0 : t?._zod?.traits?.has(e) }), Object.defineProperty(o, "name", { value: e }), o;
|
|
631
631
|
}
|
|
632
|
-
var
|
|
632
|
+
var Me = class extends Error {
|
|
633
633
|
constructor() {
|
|
634
634
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
635
635
|
}
|
|
@@ -638,7 +638,7 @@ var I = class extends Error {
|
|
|
638
638
|
super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
|
-
(
|
|
641
|
+
(je = globalThis).__zod_globalConfig ?? (je.__zod_globalConfig = {});
|
|
642
642
|
var Pe = globalThis.__zod_globalConfig;
|
|
643
643
|
function L(e) {
|
|
644
644
|
return e && Object.assign(Pe, e), Pe;
|
|
@@ -919,7 +919,7 @@ var gt = (e, t) => {
|
|
|
919
919
|
value: () => e.message,
|
|
920
920
|
enumerable: !1
|
|
921
921
|
});
|
|
922
|
-
}, _t =
|
|
922
|
+
}, _t = I("$ZodError", gt), vt = I("$ZodError", gt, { Parent: Error });
|
|
923
923
|
function yt(e, t = (e) => e.message) {
|
|
924
924
|
let n = {}, r = [];
|
|
925
925
|
for (let i of e.issues) i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : r.push(t(i));
|
|
@@ -957,7 +957,7 @@ var xt = (e) => (t, n, r, i) => {
|
|
|
957
957
|
value: n,
|
|
958
958
|
issues: []
|
|
959
959
|
}, a);
|
|
960
|
-
if (o instanceof Promise) throw new
|
|
960
|
+
if (o instanceof Promise) throw new Me();
|
|
961
961
|
if (o.issues.length) {
|
|
962
962
|
let t = new (i?.Err ?? e)(o.issues.map((e) => pt(e, a, L())));
|
|
963
963
|
throw Ke(t, i?.callee), t;
|
|
@@ -984,7 +984,7 @@ var xt = (e) => (t, n, r, i) => {
|
|
|
984
984
|
value: n,
|
|
985
985
|
issues: []
|
|
986
986
|
}, i);
|
|
987
|
-
if (a instanceof Promise) throw new
|
|
987
|
+
if (a instanceof Promise) throw new Me();
|
|
988
988
|
return a.issues.length ? {
|
|
989
989
|
success: !1,
|
|
990
990
|
error: new (e ?? _t)(a.issues.map((e) => pt(e, i, L())))
|
|
@@ -1052,14 +1052,14 @@ function on(e) {
|
|
|
1052
1052
|
var sn = (e) => {
|
|
1053
1053
|
let t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1054
1054
|
return RegExp(`^${t}$`);
|
|
1055
|
-
}, cn = /^-?\d+$/, ln = /^-?\d+(?:\.\d+)?$/, un = /^(?:true|false)$/i, dn = /^[^A-Z]*$/, fn = /^[^a-z]*$/, B = /*@__PURE__*/
|
|
1055
|
+
}, cn = /^-?\d+$/, ln = /^-?\d+(?:\.\d+)?$/, un = /^(?:true|false)$/i, dn = /^[^A-Z]*$/, fn = /^[^a-z]*$/, B = /*@__PURE__*/ I("$ZodCheck", (e, t) => {
|
|
1056
1056
|
var n;
|
|
1057
1057
|
e._zod ??= {}, e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
1058
1058
|
}), pn = {
|
|
1059
1059
|
number: "number",
|
|
1060
1060
|
bigint: "bigint",
|
|
1061
1061
|
object: "date"
|
|
1062
|
-
}, mn = /*@__PURE__*/
|
|
1062
|
+
}, mn = /*@__PURE__*/ I("$ZodCheckLessThan", (e, t) => {
|
|
1063
1063
|
B.init(e, t);
|
|
1064
1064
|
let n = pn[typeof t.value];
|
|
1065
1065
|
e._zod.onattach.push((e) => {
|
|
@@ -1076,7 +1076,7 @@ var sn = (e) => {
|
|
|
1076
1076
|
continue: !t.abort
|
|
1077
1077
|
});
|
|
1078
1078
|
};
|
|
1079
|
-
}), hn = /*@__PURE__*/
|
|
1079
|
+
}), hn = /*@__PURE__*/ I("$ZodCheckGreaterThan", (e, t) => {
|
|
1080
1080
|
B.init(e, t);
|
|
1081
1081
|
let n = pn[typeof t.value];
|
|
1082
1082
|
e._zod.onattach.push((e) => {
|
|
@@ -1093,7 +1093,7 @@ var sn = (e) => {
|
|
|
1093
1093
|
continue: !t.abort
|
|
1094
1094
|
});
|
|
1095
1095
|
};
|
|
1096
|
-
}), gn = /*@__PURE__*/
|
|
1096
|
+
}), gn = /*@__PURE__*/ I("$ZodCheckMultipleOf", (e, t) => {
|
|
1097
1097
|
B.init(e, t), e._zod.onattach.push((e) => {
|
|
1098
1098
|
var n;
|
|
1099
1099
|
(n = e._zod.bag).multipleOf ?? (n.multipleOf = t.value);
|
|
@@ -1108,7 +1108,7 @@ var sn = (e) => {
|
|
|
1108
1108
|
continue: !t.abort
|
|
1109
1109
|
});
|
|
1110
1110
|
};
|
|
1111
|
-
}), _n = /*@__PURE__*/
|
|
1111
|
+
}), _n = /*@__PURE__*/ I("$ZodCheckNumberFormat", (e, t) => {
|
|
1112
1112
|
B.init(e, t), t.format = t.format || "float64";
|
|
1113
1113
|
let n = t.format?.includes("int"), r = n ? "int" : "number", [i, a] = tt[t.format];
|
|
1114
1114
|
e._zod.onattach.push((e) => {
|
|
@@ -1169,7 +1169,7 @@ var sn = (e) => {
|
|
|
1169
1169
|
continue: !t.abort
|
|
1170
1170
|
});
|
|
1171
1171
|
};
|
|
1172
|
-
}), vn = /*@__PURE__*/
|
|
1172
|
+
}), vn = /*@__PURE__*/ I("$ZodCheckMaxLength", (e, t) => {
|
|
1173
1173
|
var n;
|
|
1174
1174
|
B.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
|
|
1175
1175
|
let t = e.value;
|
|
@@ -1191,7 +1191,7 @@ var sn = (e) => {
|
|
|
1191
1191
|
continue: !t.abort
|
|
1192
1192
|
});
|
|
1193
1193
|
};
|
|
1194
|
-
}), yn = /*@__PURE__*/
|
|
1194
|
+
}), yn = /*@__PURE__*/ I("$ZodCheckMinLength", (e, t) => {
|
|
1195
1195
|
var n;
|
|
1196
1196
|
B.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
|
|
1197
1197
|
let t = e.value;
|
|
@@ -1213,7 +1213,7 @@ var sn = (e) => {
|
|
|
1213
1213
|
continue: !t.abort
|
|
1214
1214
|
});
|
|
1215
1215
|
};
|
|
1216
|
-
}), bn = /*@__PURE__*/
|
|
1216
|
+
}), bn = /*@__PURE__*/ I("$ZodCheckLengthEquals", (e, t) => {
|
|
1217
1217
|
var n;
|
|
1218
1218
|
B.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
|
|
1219
1219
|
let t = e.value;
|
|
@@ -1241,7 +1241,7 @@ var sn = (e) => {
|
|
|
1241
1241
|
continue: !t.abort
|
|
1242
1242
|
});
|
|
1243
1243
|
};
|
|
1244
|
-
}), xn = /*@__PURE__*/
|
|
1244
|
+
}), xn = /*@__PURE__*/ I("$ZodCheckStringFormat", (e, t) => {
|
|
1245
1245
|
var n, r;
|
|
1246
1246
|
B.init(e, t), e._zod.onattach.push((e) => {
|
|
1247
1247
|
let n = e._zod.bag;
|
|
@@ -1257,7 +1257,7 @@ var sn = (e) => {
|
|
|
1257
1257
|
continue: !t.abort
|
|
1258
1258
|
});
|
|
1259
1259
|
}) : (r = e._zod).check ?? (r.check = () => {});
|
|
1260
|
-
}), Sn = /*@__PURE__*/
|
|
1260
|
+
}), Sn = /*@__PURE__*/ I("$ZodCheckRegex", (e, t) => {
|
|
1261
1261
|
xn.init(e, t), e._zod.check = (n) => {
|
|
1262
1262
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1263
1263
|
origin: "string",
|
|
@@ -1269,11 +1269,11 @@ var sn = (e) => {
|
|
|
1269
1269
|
continue: !t.abort
|
|
1270
1270
|
});
|
|
1271
1271
|
};
|
|
1272
|
-
}), Cn = /*@__PURE__*/
|
|
1272
|
+
}), Cn = /*@__PURE__*/ I("$ZodCheckLowerCase", (e, t) => {
|
|
1273
1273
|
t.pattern ??= dn, xn.init(e, t);
|
|
1274
|
-
}), wn = /*@__PURE__*/
|
|
1274
|
+
}), wn = /*@__PURE__*/ I("$ZodCheckUpperCase", (e, t) => {
|
|
1275
1275
|
t.pattern ??= fn, xn.init(e, t);
|
|
1276
|
-
}), Tn = /*@__PURE__*/
|
|
1276
|
+
}), Tn = /*@__PURE__*/ I("$ZodCheckIncludes", (e, t) => {
|
|
1277
1277
|
B.init(e, t);
|
|
1278
1278
|
let n = Qe(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1279
1279
|
t.pattern = r, e._zod.onattach.push((e) => {
|
|
@@ -1290,7 +1290,7 @@ var sn = (e) => {
|
|
|
1290
1290
|
continue: !t.abort
|
|
1291
1291
|
});
|
|
1292
1292
|
};
|
|
1293
|
-
}), En = /*@__PURE__*/
|
|
1293
|
+
}), En = /*@__PURE__*/ I("$ZodCheckStartsWith", (e, t) => {
|
|
1294
1294
|
B.init(e, t);
|
|
1295
1295
|
let n = RegExp(`^${Qe(t.prefix)}.*`);
|
|
1296
1296
|
t.pattern ??= n, e._zod.onattach.push((e) => {
|
|
@@ -1307,7 +1307,7 @@ var sn = (e) => {
|
|
|
1307
1307
|
continue: !t.abort
|
|
1308
1308
|
});
|
|
1309
1309
|
};
|
|
1310
|
-
}), Dn = /*@__PURE__*/
|
|
1310
|
+
}), Dn = /*@__PURE__*/ I("$ZodCheckEndsWith", (e, t) => {
|
|
1311
1311
|
B.init(e, t);
|
|
1312
1312
|
let n = RegExp(`.*${Qe(t.suffix)}$`);
|
|
1313
1313
|
t.pattern ??= n, e._zod.onattach.push((e) => {
|
|
@@ -1324,7 +1324,7 @@ var sn = (e) => {
|
|
|
1324
1324
|
continue: !t.abort
|
|
1325
1325
|
});
|
|
1326
1326
|
};
|
|
1327
|
-
}), On = /*@__PURE__*/
|
|
1327
|
+
}), On = /*@__PURE__*/ I("$ZodCheckOverwrite", (e, t) => {
|
|
1328
1328
|
B.init(e, t), e._zod.check = (e) => {
|
|
1329
1329
|
e.value = t.tx(e.value);
|
|
1330
1330
|
};
|
|
@@ -1351,7 +1351,7 @@ var sn = (e) => {
|
|
|
1351
1351
|
major: 4,
|
|
1352
1352
|
minor: 4,
|
|
1353
1353
|
patch: 3
|
|
1354
|
-
}, V = /*@__PURE__*/
|
|
1354
|
+
}, V = /*@__PURE__*/ I("$ZodType", (e, t) => {
|
|
1355
1355
|
var n;
|
|
1356
1356
|
e ??= {}, e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = An;
|
|
1357
1357
|
let r = [...e._zod.def.checks ?? []];
|
|
@@ -1368,7 +1368,7 @@ var sn = (e) => {
|
|
|
1368
1368
|
if (ut(e) || !a._zod.def.when(e)) continue;
|
|
1369
1369
|
} else if (r) continue;
|
|
1370
1370
|
let t = e.issues.length, o = a._zod.check(e);
|
|
1371
|
-
if (o instanceof Promise && n?.async === !1) throw new
|
|
1371
|
+
if (o instanceof Promise && n?.async === !1) throw new Me();
|
|
1372
1372
|
if (i || o instanceof Promise) i = (i ?? Promise.resolve()).then(async () => {
|
|
1373
1373
|
await o, e.issues.length !== t && (r ||= lt(e, t));
|
|
1374
1374
|
});
|
|
@@ -1382,7 +1382,7 @@ var sn = (e) => {
|
|
|
1382
1382
|
if (lt(n)) return n.aborted = !0, n;
|
|
1383
1383
|
let o = t(i, r, a);
|
|
1384
1384
|
if (o instanceof Promise) {
|
|
1385
|
-
if (a.async === !1) throw new
|
|
1385
|
+
if (a.async === !1) throw new Me();
|
|
1386
1386
|
return o.then((t) => e._zod.parse(t, a));
|
|
1387
1387
|
}
|
|
1388
1388
|
return e._zod.parse(o, a);
|
|
@@ -1401,7 +1401,7 @@ var sn = (e) => {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
let o = e._zod.parse(i, a);
|
|
1403
1403
|
if (o instanceof Promise) {
|
|
1404
|
-
if (a.async === !1) throw new
|
|
1404
|
+
if (a.async === !1) throw new Me();
|
|
1405
1405
|
return o.then((e) => t(e, r, a));
|
|
1406
1406
|
}
|
|
1407
1407
|
return t(o, r, a);
|
|
@@ -1419,7 +1419,7 @@ var sn = (e) => {
|
|
|
1419
1419
|
vendor: "zod",
|
|
1420
1420
|
version: 1
|
|
1421
1421
|
}));
|
|
1422
|
-
}), jn = /*@__PURE__*/
|
|
1422
|
+
}), jn = /*@__PURE__*/ I("$ZodString", (e, t) => {
|
|
1423
1423
|
V.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? sn(e._zod.bag), e._zod.parse = (n, r) => {
|
|
1424
1424
|
if (t.coerce) try {
|
|
1425
1425
|
n.value = String(n.value);
|
|
@@ -1431,11 +1431,11 @@ var sn = (e) => {
|
|
|
1431
1431
|
inst: e
|
|
1432
1432
|
}), n;
|
|
1433
1433
|
};
|
|
1434
|
-
}), H = /*@__PURE__*/
|
|
1434
|
+
}), H = /*@__PURE__*/ I("$ZodStringFormat", (e, t) => {
|
|
1435
1435
|
xn.init(e, t), jn.init(e, t);
|
|
1436
|
-
}), Mn = /*@__PURE__*/
|
|
1436
|
+
}), Mn = /*@__PURE__*/ I("$ZodGUID", (e, t) => {
|
|
1437
1437
|
t.pattern ??= Ht, H.init(e, t);
|
|
1438
|
-
}), Nn = /*@__PURE__*/
|
|
1438
|
+
}), Nn = /*@__PURE__*/ I("$ZodUUID", (e, t) => {
|
|
1439
1439
|
if (t.version) {
|
|
1440
1440
|
let e = {
|
|
1441
1441
|
v1: 1,
|
|
@@ -1451,9 +1451,9 @@ var sn = (e) => {
|
|
|
1451
1451
|
t.pattern ??= Ut(e);
|
|
1452
1452
|
} else t.pattern ??= Ut();
|
|
1453
1453
|
H.init(e, t);
|
|
1454
|
-
}), Pn = /*@__PURE__*/
|
|
1454
|
+
}), Pn = /*@__PURE__*/ I("$ZodEmail", (e, t) => {
|
|
1455
1455
|
t.pattern ??= Wt, H.init(e, t);
|
|
1456
|
-
}), Fn = /*@__PURE__*/
|
|
1456
|
+
}), Fn = /*@__PURE__*/ I("$ZodURL", (e, t) => {
|
|
1457
1457
|
H.init(e, t), e._zod.check = (n) => {
|
|
1458
1458
|
try {
|
|
1459
1459
|
let r = n.value.trim();
|
|
@@ -1497,31 +1497,31 @@ var sn = (e) => {
|
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
1499
|
};
|
|
1500
|
-
}), In = /*@__PURE__*/
|
|
1500
|
+
}), In = /*@__PURE__*/ I("$ZodEmoji", (e, t) => {
|
|
1501
1501
|
t.pattern ??= Kt(), H.init(e, t);
|
|
1502
|
-
}), Ln = /*@__PURE__*/
|
|
1502
|
+
}), Ln = /*@__PURE__*/ I("$ZodNanoID", (e, t) => {
|
|
1503
1503
|
t.pattern ??= Bt, H.init(e, t);
|
|
1504
|
-
}), Rn = /*@__PURE__*/
|
|
1504
|
+
}), Rn = /*@__PURE__*/ I("$ZodCUID", (e, t) => {
|
|
1505
1505
|
t.pattern ??= Ft, H.init(e, t);
|
|
1506
|
-
}), zn = /*@__PURE__*/
|
|
1506
|
+
}), zn = /*@__PURE__*/ I("$ZodCUID2", (e, t) => {
|
|
1507
1507
|
t.pattern ??= It, H.init(e, t);
|
|
1508
|
-
}), Bn = /*@__PURE__*/
|
|
1508
|
+
}), Bn = /*@__PURE__*/ I("$ZodULID", (e, t) => {
|
|
1509
1509
|
t.pattern ??= Lt, H.init(e, t);
|
|
1510
|
-
}), Vn = /*@__PURE__*/
|
|
1510
|
+
}), Vn = /*@__PURE__*/ I("$ZodXID", (e, t) => {
|
|
1511
1511
|
t.pattern ??= Rt, H.init(e, t);
|
|
1512
|
-
}), Hn = /*@__PURE__*/
|
|
1512
|
+
}), Hn = /*@__PURE__*/ I("$ZodKSUID", (e, t) => {
|
|
1513
1513
|
t.pattern ??= zt, H.init(e, t);
|
|
1514
|
-
}), Un = /*@__PURE__*/
|
|
1514
|
+
}), Un = /*@__PURE__*/ I("$ZodISODateTime", (e, t) => {
|
|
1515
1515
|
t.pattern ??= on(t), H.init(e, t);
|
|
1516
|
-
}), Wn = /*@__PURE__*/
|
|
1516
|
+
}), Wn = /*@__PURE__*/ I("$ZodISODate", (e, t) => {
|
|
1517
1517
|
t.pattern ??= nn, H.init(e, t);
|
|
1518
|
-
}), Gn = /*@__PURE__*/
|
|
1518
|
+
}), Gn = /*@__PURE__*/ I("$ZodISOTime", (e, t) => {
|
|
1519
1519
|
t.pattern ??= an(t), H.init(e, t);
|
|
1520
|
-
}), Kn = /*@__PURE__*/
|
|
1520
|
+
}), Kn = /*@__PURE__*/ I("$ZodISODuration", (e, t) => {
|
|
1521
1521
|
t.pattern ??= Vt, H.init(e, t);
|
|
1522
|
-
}), qn = /*@__PURE__*/
|
|
1522
|
+
}), qn = /*@__PURE__*/ I("$ZodIPv4", (e, t) => {
|
|
1523
1523
|
t.pattern ??= qt, H.init(e, t), e._zod.bag.format = "ipv4";
|
|
1524
|
-
}), Jn = /*@__PURE__*/
|
|
1524
|
+
}), Jn = /*@__PURE__*/ I("$ZodIPv6", (e, t) => {
|
|
1525
1525
|
t.pattern ??= Jt, H.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
1526
1526
|
try {
|
|
1527
1527
|
new URL(`http://[${n.value}]`);
|
|
@@ -1535,9 +1535,9 @@ var sn = (e) => {
|
|
|
1535
1535
|
});
|
|
1536
1536
|
}
|
|
1537
1537
|
};
|
|
1538
|
-
}), Yn = /*@__PURE__*/
|
|
1538
|
+
}), Yn = /*@__PURE__*/ I("$ZodCIDRv4", (e, t) => {
|
|
1539
1539
|
t.pattern ??= Yt, H.init(e, t);
|
|
1540
|
-
}), Xn = /*@__PURE__*/
|
|
1540
|
+
}), Xn = /*@__PURE__*/ I("$ZodCIDRv6", (e, t) => {
|
|
1541
1541
|
t.pattern ??= Xt, H.init(e, t), e._zod.check = (n) => {
|
|
1542
1542
|
let r = n.value.split("/");
|
|
1543
1543
|
try {
|
|
@@ -1567,7 +1567,7 @@ function Zn(e) {
|
|
|
1567
1567
|
return !1;
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
var Qn = /*@__PURE__*/
|
|
1570
|
+
var Qn = /*@__PURE__*/ I("$ZodBase64", (e, t) => {
|
|
1571
1571
|
t.pattern ??= Zt, H.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
1572
1572
|
Zn(n.value) || n.issues.push({
|
|
1573
1573
|
code: "invalid_format",
|
|
@@ -1583,7 +1583,7 @@ function $n(e) {
|
|
|
1583
1583
|
let t = e.replace(/[-_]/g, (e) => e === "-" ? "+" : "/");
|
|
1584
1584
|
return Zn(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
|
|
1585
1585
|
}
|
|
1586
|
-
var er = /*@__PURE__*/
|
|
1586
|
+
var er = /*@__PURE__*/ I("$ZodBase64URL", (e, t) => {
|
|
1587
1587
|
t.pattern ??= Qt, H.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
1588
1588
|
$n(n.value) || n.issues.push({
|
|
1589
1589
|
code: "invalid_format",
|
|
@@ -1593,7 +1593,7 @@ var er = /*@__PURE__*/ F("$ZodBase64URL", (e, t) => {
|
|
|
1593
1593
|
continue: !t.abort
|
|
1594
1594
|
});
|
|
1595
1595
|
};
|
|
1596
|
-
}), tr = /*@__PURE__*/
|
|
1596
|
+
}), tr = /*@__PURE__*/ I("$ZodE164", (e, t) => {
|
|
1597
1597
|
t.pattern ??= en, H.init(e, t);
|
|
1598
1598
|
});
|
|
1599
1599
|
function nr(e, t = null) {
|
|
@@ -1608,7 +1608,7 @@ function nr(e, t = null) {
|
|
|
1608
1608
|
return !1;
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
|
-
var rr = /*@__PURE__*/
|
|
1611
|
+
var rr = /*@__PURE__*/ I("$ZodJWT", (e, t) => {
|
|
1612
1612
|
H.init(e, t), e._zod.check = (n) => {
|
|
1613
1613
|
nr(n.value, t.alg) || n.issues.push({
|
|
1614
1614
|
code: "invalid_format",
|
|
@@ -1618,7 +1618,7 @@ var rr = /*@__PURE__*/ F("$ZodJWT", (e, t) => {
|
|
|
1618
1618
|
continue: !t.abort
|
|
1619
1619
|
});
|
|
1620
1620
|
};
|
|
1621
|
-
}), ir = /*@__PURE__*/
|
|
1621
|
+
}), ir = /*@__PURE__*/ I("$ZodNumber", (e, t) => {
|
|
1622
1622
|
V.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? ln, e._zod.parse = (n, r) => {
|
|
1623
1623
|
if (t.coerce) try {
|
|
1624
1624
|
n.value = Number(n.value);
|
|
@@ -1634,9 +1634,9 @@ var rr = /*@__PURE__*/ F("$ZodJWT", (e, t) => {
|
|
|
1634
1634
|
...a ? { received: a } : {}
|
|
1635
1635
|
}), n;
|
|
1636
1636
|
};
|
|
1637
|
-
}), ar = /*@__PURE__*/
|
|
1637
|
+
}), ar = /*@__PURE__*/ I("$ZodNumberFormat", (e, t) => {
|
|
1638
1638
|
_n.init(e, t), ir.init(e, t);
|
|
1639
|
-
}), or = /*@__PURE__*/
|
|
1639
|
+
}), or = /*@__PURE__*/ I("$ZodBoolean", (e, t) => {
|
|
1640
1640
|
V.init(e, t), e._zod.pattern = un, e._zod.parse = (n, r) => {
|
|
1641
1641
|
if (t.coerce) try {
|
|
1642
1642
|
n.value = !!n.value;
|
|
@@ -1649,9 +1649,9 @@ var rr = /*@__PURE__*/ F("$ZodJWT", (e, t) => {
|
|
|
1649
1649
|
inst: e
|
|
1650
1650
|
}), n;
|
|
1651
1651
|
};
|
|
1652
|
-
}), sr = /*@__PURE__*/
|
|
1652
|
+
}), sr = /*@__PURE__*/ I("$ZodUnknown", (e, t) => {
|
|
1653
1653
|
V.init(e, t), e._zod.parse = (e) => e;
|
|
1654
|
-
}), cr = /*@__PURE__*/
|
|
1654
|
+
}), cr = /*@__PURE__*/ I("$ZodNever", (e, t) => {
|
|
1655
1655
|
V.init(e, t), e._zod.parse = (t, n) => (t.issues.push({
|
|
1656
1656
|
expected: "never",
|
|
1657
1657
|
code: "invalid_type",
|
|
@@ -1662,7 +1662,7 @@ var rr = /*@__PURE__*/ F("$ZodJWT", (e, t) => {
|
|
|
1662
1662
|
function lr(e, t, n) {
|
|
1663
1663
|
e.issues.length && t.issues.push(...dt(n, e.issues)), t.value[n] = e.value;
|
|
1664
1664
|
}
|
|
1665
|
-
var ur = /*@__PURE__*/
|
|
1665
|
+
var ur = /*@__PURE__*/ I("$ZodArray", (e, t) => {
|
|
1666
1666
|
V.init(e, t), e._zod.parse = (n, r) => {
|
|
1667
1667
|
let i = n.value;
|
|
1668
1668
|
if (!Array.isArray(i)) return n.issues.push({
|
|
@@ -1733,7 +1733,7 @@ function pr(e, t, n, r, i, a) {
|
|
|
1733
1733
|
inst: a
|
|
1734
1734
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1735
1735
|
}
|
|
1736
|
-
var mr = /*@__PURE__*/
|
|
1736
|
+
var mr = /*@__PURE__*/ I("$ZodObject", (e, t) => {
|
|
1737
1737
|
if (V.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1738
1738
|
let e = t.shape;
|
|
1739
1739
|
Object.defineProperty(t, "shape", { get: () => {
|
|
@@ -1774,7 +1774,7 @@ var mr = /*@__PURE__*/ F("$ZodObject", (e, t) => {
|
|
|
1774
1774
|
}
|
|
1775
1775
|
return i ? pr(c, s, t, o, n.value, e) : c.length ? Promise.all(c).then(() => t) : t;
|
|
1776
1776
|
};
|
|
1777
|
-
}), hr = /*@__PURE__*/
|
|
1777
|
+
}), hr = /*@__PURE__*/ I("$ZodObjectJIT", (e, t) => {
|
|
1778
1778
|
mr.init(e, t);
|
|
1779
1779
|
let n = e._zod.parse, r = Le(() => fr(t)), i = (e) => {
|
|
1780
1780
|
let t = new kn([
|
|
@@ -1877,7 +1877,7 @@ function gr(e, t, n, r) {
|
|
|
1877
1877
|
errors: e.map((e) => e.issues.map((e) => pt(e, r, L())))
|
|
1878
1878
|
}), t);
|
|
1879
1879
|
}
|
|
1880
|
-
var _r = /*@__PURE__*/
|
|
1880
|
+
var _r = /*@__PURE__*/ I("$ZodUnion", (e, t) => {
|
|
1881
1881
|
V.init(e, t), R(e._zod, "optin", () => t.options.some((e) => e._zod.optin === "optional") ? "optional" : void 0), R(e._zod, "optout", () => t.options.some((e) => e._zod.optout === "optional") ? "optional" : void 0), R(e._zod, "values", () => {
|
|
1882
1882
|
if (t.options.every((e) => e._zod.values)) return new Set(t.options.flatMap((e) => Array.from(e._zod.values)));
|
|
1883
1883
|
}), R(e._zod, "pattern", () => {
|
|
@@ -1903,7 +1903,7 @@ var _r = /*@__PURE__*/ F("$ZodUnion", (e, t) => {
|
|
|
1903
1903
|
}
|
|
1904
1904
|
return a ? Promise.all(o).then((t) => gr(t, r, e, i)) : gr(o, r, e, i);
|
|
1905
1905
|
};
|
|
1906
|
-
}), vr = /*@__PURE__*/
|
|
1906
|
+
}), vr = /*@__PURE__*/ I("$ZodIntersection", (e, t) => {
|
|
1907
1907
|
V.init(e, t), e._zod.parse = (e, n) => {
|
|
1908
1908
|
let r = e.value, i = t.left._zod.run({
|
|
1909
1909
|
value: r,
|
|
@@ -1979,7 +1979,7 @@ function br(e, t, n) {
|
|
|
1979
1979
|
if (!o.valid) throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
|
|
1980
1980
|
return e.value = o.data, e;
|
|
1981
1981
|
}
|
|
1982
|
-
var xr = /*@__PURE__*/
|
|
1982
|
+
var xr = /*@__PURE__*/ I("$ZodRecord", (e, t) => {
|
|
1983
1983
|
V.init(e, t), e._zod.parse = (n, r) => {
|
|
1984
1984
|
let i = n.value;
|
|
1985
1985
|
if (!Ye(i)) return n.issues.push({
|
|
@@ -2065,7 +2065,7 @@ var xr = /*@__PURE__*/ F("$ZodRecord", (e, t) => {
|
|
|
2065
2065
|
}
|
|
2066
2066
|
return a.length ? Promise.all(a).then(() => n) : n;
|
|
2067
2067
|
};
|
|
2068
|
-
}), Sr = /*@__PURE__*/
|
|
2068
|
+
}), Sr = /*@__PURE__*/ I("$ZodEnum", (e, t) => {
|
|
2069
2069
|
V.init(e, t);
|
|
2070
2070
|
let n = Fe(t.entries), r = new Set(n);
|
|
2071
2071
|
e._zod.values = r, e._zod.pattern = RegExp(`^(${n.filter((e) => Ze.has(typeof e)).map((e) => typeof e == "string" ? Qe(e) : e.toString()).join("|")})$`), e._zod.parse = (t, i) => {
|
|
@@ -2077,7 +2077,7 @@ var xr = /*@__PURE__*/ F("$ZodRecord", (e, t) => {
|
|
|
2077
2077
|
inst: e
|
|
2078
2078
|
}), t;
|
|
2079
2079
|
};
|
|
2080
|
-
}), Cr = /*@__PURE__*/
|
|
2080
|
+
}), Cr = /*@__PURE__*/ I("$ZodLiteral", (e, t) => {
|
|
2081
2081
|
if (V.init(e, t), t.values.length === 0) throw Error("Cannot create literal schema with no valid values");
|
|
2082
2082
|
let n = new Set(t.values);
|
|
2083
2083
|
e._zod.values = n, e._zod.pattern = RegExp(`^(${t.values.map((e) => typeof e == "string" ? Qe(e) : e ? Qe(e.toString()) : String(e)).join("|")})$`), e._zod.parse = (r, i) => {
|
|
@@ -2089,12 +2089,12 @@ var xr = /*@__PURE__*/ F("$ZodRecord", (e, t) => {
|
|
|
2089
2089
|
inst: e
|
|
2090
2090
|
}), r;
|
|
2091
2091
|
};
|
|
2092
|
-
}), wr = /*@__PURE__*/
|
|
2092
|
+
}), wr = /*@__PURE__*/ I("$ZodTransform", (e, t) => {
|
|
2093
2093
|
V.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, r) => {
|
|
2094
2094
|
if (r.direction === "backward") throw new Ne(e.constructor.name);
|
|
2095
2095
|
let i = t.transform(n.value, n);
|
|
2096
2096
|
if (r.async) return (i instanceof Promise ? i : Promise.resolve(i)).then((e) => (n.value = e, n.fallback = !0, n));
|
|
2097
|
-
if (i instanceof Promise) throw new
|
|
2097
|
+
if (i instanceof Promise) throw new Me();
|
|
2098
2098
|
return n.value = i, n.fallback = !0, n;
|
|
2099
2099
|
};
|
|
2100
2100
|
});
|
|
@@ -2104,7 +2104,7 @@ function Tr(e, t) {
|
|
|
2104
2104
|
value: void 0
|
|
2105
2105
|
} : e;
|
|
2106
2106
|
}
|
|
2107
|
-
var Er = /*@__PURE__*/
|
|
2107
|
+
var Er = /*@__PURE__*/ I("$ZodOptional", (e, t) => {
|
|
2108
2108
|
V.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", R(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, void 0]) : void 0), R(e._zod, "pattern", () => {
|
|
2109
2109
|
let e = t.innerType._zod.pattern;
|
|
2110
2110
|
return e ? RegExp(`^(${ze(e.source)})?$`) : void 0;
|
|
@@ -2115,14 +2115,14 @@ var Er = /*@__PURE__*/ F("$ZodOptional", (e, t) => {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
return e.value === void 0 ? e : t.innerType._zod.run(e, n);
|
|
2117
2117
|
};
|
|
2118
|
-
}), Dr = /*@__PURE__*/
|
|
2118
|
+
}), Dr = /*@__PURE__*/ I("$ZodExactOptional", (e, t) => {
|
|
2119
2119
|
Er.init(e, t), R(e._zod, "values", () => t.innerType._zod.values), R(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (e, n) => t.innerType._zod.run(e, n);
|
|
2120
|
-
}), Or = /*@__PURE__*/
|
|
2120
|
+
}), Or = /*@__PURE__*/ I("$ZodNullable", (e, t) => {
|
|
2121
2121
|
V.init(e, t), R(e._zod, "optin", () => t.innerType._zod.optin), R(e._zod, "optout", () => t.innerType._zod.optout), R(e._zod, "pattern", () => {
|
|
2122
2122
|
let e = t.innerType._zod.pattern;
|
|
2123
2123
|
return e ? RegExp(`^(${ze(e.source)}|null)$`) : void 0;
|
|
2124
2124
|
}), R(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run(e, n);
|
|
2125
|
-
}), kr = /*@__PURE__*/
|
|
2125
|
+
}), kr = /*@__PURE__*/ I("$ZodDefault", (e, t) => {
|
|
2126
2126
|
V.init(e, t), e._zod.optin = "optional", R(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
|
|
2127
2127
|
if (n.direction === "backward") return t.innerType._zod.run(e, n);
|
|
2128
2128
|
if (e.value === void 0) return e.value = t.defaultValue, e;
|
|
@@ -2133,9 +2133,9 @@ var Er = /*@__PURE__*/ F("$ZodOptional", (e, t) => {
|
|
|
2133
2133
|
function Ar(e, t) {
|
|
2134
2134
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2135
2135
|
}
|
|
2136
|
-
var jr = /*@__PURE__*/
|
|
2136
|
+
var jr = /*@__PURE__*/ I("$ZodPrefault", (e, t) => {
|
|
2137
2137
|
V.init(e, t), e._zod.optin = "optional", R(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => (n.direction === "backward" || e.value === void 0 && (e.value = t.defaultValue), t.innerType._zod.run(e, n));
|
|
2138
|
-
}), Mr = /*@__PURE__*/
|
|
2138
|
+
}), Mr = /*@__PURE__*/ I("$ZodNonOptional", (e, t) => {
|
|
2139
2139
|
V.init(e, t), R(e._zod, "values", () => {
|
|
2140
2140
|
let e = t.innerType._zod.values;
|
|
2141
2141
|
return e ? new Set([...e].filter((e) => e !== void 0)) : void 0;
|
|
@@ -2152,7 +2152,7 @@ function Nr(e, t) {
|
|
|
2152
2152
|
inst: t
|
|
2153
2153
|
}), e;
|
|
2154
2154
|
}
|
|
2155
|
-
var Pr = /*@__PURE__*/
|
|
2155
|
+
var Pr = /*@__PURE__*/ I("$ZodCatch", (e, t) => {
|
|
2156
2156
|
V.init(e, t), e._zod.optin = "optional", R(e._zod, "optout", () => t.innerType._zod.optout), R(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
|
|
2157
2157
|
if (n.direction === "backward") return t.innerType._zod.run(e, n);
|
|
2158
2158
|
let r = t.innerType._zod.run(e, n);
|
|
@@ -2166,7 +2166,7 @@ var Pr = /*@__PURE__*/ F("$ZodCatch", (e, t) => {
|
|
|
2166
2166
|
input: e.value
|
|
2167
2167
|
}), e.issues = [], e.fallback = !0), e);
|
|
2168
2168
|
};
|
|
2169
|
-
}), Fr = /*@__PURE__*/
|
|
2169
|
+
}), Fr = /*@__PURE__*/ I("$ZodPipe", (e, t) => {
|
|
2170
2170
|
V.init(e, t), R(e._zod, "values", () => t.in._zod.values), R(e._zod, "optin", () => t.in._zod.optin), R(e._zod, "optout", () => t.out._zod.optout), R(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (e, n) => {
|
|
2171
2171
|
if (n.direction === "backward") {
|
|
2172
2172
|
let r = t.out._zod.run(e, n);
|
|
@@ -2183,7 +2183,7 @@ function Ir(e, t, n) {
|
|
|
2183
2183
|
fallback: e.fallback
|
|
2184
2184
|
}, n);
|
|
2185
2185
|
}
|
|
2186
|
-
var Lr = /*@__PURE__*/
|
|
2186
|
+
var Lr = /*@__PURE__*/ I("$ZodReadonly", (e, t) => {
|
|
2187
2187
|
V.init(e, t), R(e._zod, "propValues", () => t.innerType._zod.propValues), R(e._zod, "values", () => t.innerType._zod.values), R(e._zod, "optin", () => t.innerType?._zod?.optin), R(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (e, n) => {
|
|
2188
2188
|
if (n.direction === "backward") return t.innerType._zod.run(e, n);
|
|
2189
2189
|
let r = t.innerType._zod.run(e, n);
|
|
@@ -2193,7 +2193,7 @@ var Lr = /*@__PURE__*/ F("$ZodReadonly", (e, t) => {
|
|
|
2193
2193
|
function Rr(e) {
|
|
2194
2194
|
return e.value = Object.freeze(e.value), e;
|
|
2195
2195
|
}
|
|
2196
|
-
var zr = /*@__PURE__*/
|
|
2196
|
+
var zr = /*@__PURE__*/ I("$ZodCustom", (e, t) => {
|
|
2197
2197
|
B.init(e, t), V.init(e, t), e._zod.parse = (e, t) => e, e._zod.check = (n) => {
|
|
2198
2198
|
let r = n.value, i = t.fn(r);
|
|
2199
2199
|
if (i instanceof Promise) return i.then((t) => Br(t, n, r, e));
|
|
@@ -3133,31 +3133,31 @@ var Xi = (e, t = {}) => (n) => {
|
|
|
3133
3133
|
U(i.innerType, t, r);
|
|
3134
3134
|
let a = t.seen.get(e);
|
|
3135
3135
|
a.ref = i.innerType;
|
|
3136
|
-
}, ba = /*@__PURE__*/
|
|
3136
|
+
}, ba = /*@__PURE__*/ I("ZodISODateTime", (e, t) => {
|
|
3137
3137
|
Un.init(e, t), J.init(e, t);
|
|
3138
3138
|
});
|
|
3139
3139
|
function xa(e) {
|
|
3140
3140
|
return /* @__PURE__ */ mi(ba, e);
|
|
3141
3141
|
}
|
|
3142
|
-
var Sa = /*@__PURE__*/
|
|
3142
|
+
var Sa = /*@__PURE__*/ I("ZodISODate", (e, t) => {
|
|
3143
3143
|
Wn.init(e, t), J.init(e, t);
|
|
3144
3144
|
});
|
|
3145
3145
|
function Ca(e) {
|
|
3146
3146
|
return /* @__PURE__ */ hi(Sa, e);
|
|
3147
3147
|
}
|
|
3148
|
-
var wa = /*@__PURE__*/
|
|
3148
|
+
var wa = /*@__PURE__*/ I("ZodISOTime", (e, t) => {
|
|
3149
3149
|
Gn.init(e, t), J.init(e, t);
|
|
3150
3150
|
});
|
|
3151
3151
|
function Ta(e) {
|
|
3152
3152
|
return /* @__PURE__ */ gi(wa, e);
|
|
3153
3153
|
}
|
|
3154
|
-
var Ea = /*@__PURE__*/
|
|
3154
|
+
var Ea = /*@__PURE__*/ I("ZodISODuration", (e, t) => {
|
|
3155
3155
|
Kn.init(e, t), J.init(e, t);
|
|
3156
3156
|
});
|
|
3157
3157
|
function Da(e) {
|
|
3158
3158
|
return /* @__PURE__ */ _i(Ea, e);
|
|
3159
3159
|
}
|
|
3160
|
-
var G = /*@__PURE__*/
|
|
3160
|
+
var G = /*@__PURE__*/ I("ZodError", (e, t) => {
|
|
3161
3161
|
_t.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
3162
3162
|
format: { value: (t) => bt(e, t) },
|
|
3163
3163
|
flatten: { value: (t) => yt(e, t) },
|
|
@@ -3202,7 +3202,7 @@ function Va(e, t, n) {
|
|
|
3202
3202
|
}
|
|
3203
3203
|
}
|
|
3204
3204
|
}
|
|
3205
|
-
var K = /*@__PURE__*/
|
|
3205
|
+
var K = /*@__PURE__*/ I("ZodType", (e, t) => (V.init(e, t), Object.assign(e["~standard"], { jsonSchema: {
|
|
3206
3206
|
input: Zi(e, "input"),
|
|
3207
3207
|
output: Zi(e, "output")
|
|
3208
3208
|
} }), e.toJSONSchema = Xi(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (t, n) => Oa(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => Aa(e, t, n), e.parseAsync = async (t, n) => ka(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => ja(e, t, n), e.spa = e.safeParseAsync, e.encode = (t, n) => Ma(e, t, n), e.decode = (t, n) => Na(e, t, n), e.encodeAsync = async (t, n) => Pa(e, t, n), e.decodeAsync = async (t, n) => Fa(e, t, n), e.safeEncode = (t, n) => Ia(e, t, n), e.safeDecode = (t, n) => La(e, t, n), e.safeEncodeAsync = async (t, n) => Ra(e, t, n), e.safeDecodeAsync = async (t, n) => za(e, t, n), Va(e, "ZodType", {
|
|
@@ -3300,7 +3300,7 @@ var K = /*@__PURE__*/ F("ZodType", (e, t) => (V.init(e, t), Object.assign(e["~st
|
|
|
3300
3300
|
return Wr.get(e)?.description;
|
|
3301
3301
|
},
|
|
3302
3302
|
configurable: !0
|
|
3303
|
-
}), e)), Ha = /*@__PURE__*/
|
|
3303
|
+
}), e)), Ha = /*@__PURE__*/ I("_ZodString", (e, t) => {
|
|
3304
3304
|
jn.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => $i(e, t, n, r);
|
|
3305
3305
|
let n = e._zod.bag;
|
|
3306
3306
|
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, Va(e, "_ZodString", {
|
|
@@ -3350,53 +3350,53 @@ var K = /*@__PURE__*/ F("ZodType", (e, t) => (V.init(e, t), Object.assign(e["~st
|
|
|
3350
3350
|
return this.check(/* @__PURE__ */ Hi());
|
|
3351
3351
|
}
|
|
3352
3352
|
});
|
|
3353
|
-
}), Ua = /*@__PURE__*/
|
|
3353
|
+
}), Ua = /*@__PURE__*/ I("ZodString", (e, t) => {
|
|
3354
3354
|
jn.init(e, t), Ha.init(e, t), e.email = (t) => e.check(/* @__PURE__ */ Kr(Wa, t)), e.url = (t) => e.check(/* @__PURE__ */ Qr(qa, t)), e.jwt = (t) => e.check(/* @__PURE__ */ pi(co, t)), e.emoji = (t) => e.check(/* @__PURE__ */ $r(Ja, t)), e.guid = (t) => e.check(/* @__PURE__ */ qr(Ga, t)), e.uuid = (t) => e.check(/* @__PURE__ */ Jr(Ka, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ Yr(Ka, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ Xr(Ka, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ Zr(Ka, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ ei(Ya, t)), e.guid = (t) => e.check(/* @__PURE__ */ qr(Ga, t)), e.cuid = (t) => e.check(/* @__PURE__ */ ti(Xa, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ ni(Za, t)), e.ulid = (t) => e.check(/* @__PURE__ */ ri(Qa, t)), e.base64 = (t) => e.check(/* @__PURE__ */ ui(ao, t)), e.base64url = (t) => e.check(/* @__PURE__ */ di(oo, t)), e.xid = (t) => e.check(/* @__PURE__ */ ii($a, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ ai(eo, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ oi(to, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ si(no, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ ci(ro, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ li(io, t)), e.e164 = (t) => e.check(/* @__PURE__ */ fi(so, t)), e.datetime = (t) => e.check(xa(t)), e.date = (t) => e.check(Ca(t)), e.time = (t) => e.check(Ta(t)), e.duration = (t) => e.check(Da(t));
|
|
3355
3355
|
});
|
|
3356
3356
|
function q(e) {
|
|
3357
3357
|
return /* @__PURE__ */ Gr(Ua, e);
|
|
3358
3358
|
}
|
|
3359
|
-
var J = /*@__PURE__*/
|
|
3359
|
+
var J = /*@__PURE__*/ I("ZodStringFormat", (e, t) => {
|
|
3360
3360
|
H.init(e, t), Ha.init(e, t);
|
|
3361
|
-
}), Wa = /*@__PURE__*/
|
|
3361
|
+
}), Wa = /*@__PURE__*/ I("ZodEmail", (e, t) => {
|
|
3362
3362
|
Pn.init(e, t), J.init(e, t);
|
|
3363
|
-
}), Ga = /*@__PURE__*/
|
|
3363
|
+
}), Ga = /*@__PURE__*/ I("ZodGUID", (e, t) => {
|
|
3364
3364
|
Mn.init(e, t), J.init(e, t);
|
|
3365
|
-
}), Ka = /*@__PURE__*/
|
|
3365
|
+
}), Ka = /*@__PURE__*/ I("ZodUUID", (e, t) => {
|
|
3366
3366
|
Nn.init(e, t), J.init(e, t);
|
|
3367
|
-
}), qa = /*@__PURE__*/
|
|
3367
|
+
}), qa = /*@__PURE__*/ I("ZodURL", (e, t) => {
|
|
3368
3368
|
Fn.init(e, t), J.init(e, t);
|
|
3369
|
-
}), Ja = /*@__PURE__*/
|
|
3369
|
+
}), Ja = /*@__PURE__*/ I("ZodEmoji", (e, t) => {
|
|
3370
3370
|
In.init(e, t), J.init(e, t);
|
|
3371
|
-
}), Ya = /*@__PURE__*/
|
|
3371
|
+
}), Ya = /*@__PURE__*/ I("ZodNanoID", (e, t) => {
|
|
3372
3372
|
Ln.init(e, t), J.init(e, t);
|
|
3373
|
-
}), Xa = /*@__PURE__*/
|
|
3373
|
+
}), Xa = /*@__PURE__*/ I("ZodCUID", (e, t) => {
|
|
3374
3374
|
Rn.init(e, t), J.init(e, t);
|
|
3375
|
-
}), Za = /*@__PURE__*/
|
|
3375
|
+
}), Za = /*@__PURE__*/ I("ZodCUID2", (e, t) => {
|
|
3376
3376
|
zn.init(e, t), J.init(e, t);
|
|
3377
|
-
}), Qa = /*@__PURE__*/
|
|
3377
|
+
}), Qa = /*@__PURE__*/ I("ZodULID", (e, t) => {
|
|
3378
3378
|
Bn.init(e, t), J.init(e, t);
|
|
3379
|
-
}), $a = /*@__PURE__*/
|
|
3379
|
+
}), $a = /*@__PURE__*/ I("ZodXID", (e, t) => {
|
|
3380
3380
|
Vn.init(e, t), J.init(e, t);
|
|
3381
|
-
}), eo = /*@__PURE__*/
|
|
3381
|
+
}), eo = /*@__PURE__*/ I("ZodKSUID", (e, t) => {
|
|
3382
3382
|
Hn.init(e, t), J.init(e, t);
|
|
3383
|
-
}), to = /*@__PURE__*/
|
|
3383
|
+
}), to = /*@__PURE__*/ I("ZodIPv4", (e, t) => {
|
|
3384
3384
|
qn.init(e, t), J.init(e, t);
|
|
3385
|
-
}), no = /*@__PURE__*/
|
|
3385
|
+
}), no = /*@__PURE__*/ I("ZodIPv6", (e, t) => {
|
|
3386
3386
|
Jn.init(e, t), J.init(e, t);
|
|
3387
|
-
}), ro = /*@__PURE__*/
|
|
3387
|
+
}), ro = /*@__PURE__*/ I("ZodCIDRv4", (e, t) => {
|
|
3388
3388
|
Yn.init(e, t), J.init(e, t);
|
|
3389
|
-
}), io = /*@__PURE__*/
|
|
3389
|
+
}), io = /*@__PURE__*/ I("ZodCIDRv6", (e, t) => {
|
|
3390
3390
|
Xn.init(e, t), J.init(e, t);
|
|
3391
|
-
}), ao = /*@__PURE__*/
|
|
3391
|
+
}), ao = /*@__PURE__*/ I("ZodBase64", (e, t) => {
|
|
3392
3392
|
Qn.init(e, t), J.init(e, t);
|
|
3393
|
-
}), oo = /*@__PURE__*/
|
|
3393
|
+
}), oo = /*@__PURE__*/ I("ZodBase64URL", (e, t) => {
|
|
3394
3394
|
er.init(e, t), J.init(e, t);
|
|
3395
|
-
}), so = /*@__PURE__*/
|
|
3395
|
+
}), so = /*@__PURE__*/ I("ZodE164", (e, t) => {
|
|
3396
3396
|
tr.init(e, t), J.init(e, t);
|
|
3397
|
-
}), co = /*@__PURE__*/
|
|
3397
|
+
}), co = /*@__PURE__*/ I("ZodJWT", (e, t) => {
|
|
3398
3398
|
rr.init(e, t), J.init(e, t);
|
|
3399
|
-
}), lo = /*@__PURE__*/
|
|
3399
|
+
}), lo = /*@__PURE__*/ I("ZodNumber", (e, t) => {
|
|
3400
3400
|
ir.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ea(e, t, n, r), Va(e, "ZodNumber", {
|
|
3401
3401
|
gt(e, t) {
|
|
3402
3402
|
return this.check(/* @__PURE__ */ Ti(e, t));
|
|
@@ -3450,31 +3450,31 @@ var J = /*@__PURE__*/ F("ZodStringFormat", (e, t) => {
|
|
|
3450
3450
|
function uo(e) {
|
|
3451
3451
|
return /* @__PURE__ */ vi(lo, e);
|
|
3452
3452
|
}
|
|
3453
|
-
var fo = /*@__PURE__*/
|
|
3453
|
+
var fo = /*@__PURE__*/ I("ZodNumberFormat", (e, t) => {
|
|
3454
3454
|
ar.init(e, t), lo.init(e, t);
|
|
3455
3455
|
});
|
|
3456
3456
|
function po(e) {
|
|
3457
3457
|
return /* @__PURE__ */ yi(fo, e);
|
|
3458
3458
|
}
|
|
3459
|
-
var mo = /*@__PURE__*/
|
|
3459
|
+
var mo = /*@__PURE__*/ I("ZodBoolean", (e, t) => {
|
|
3460
3460
|
or.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ta(e, t, n, r);
|
|
3461
3461
|
});
|
|
3462
3462
|
function ho(e) {
|
|
3463
3463
|
return /* @__PURE__ */ bi(mo, e);
|
|
3464
3464
|
}
|
|
3465
|
-
var go = /*@__PURE__*/
|
|
3465
|
+
var go = /*@__PURE__*/ I("ZodUnknown", (e, t) => {
|
|
3466
3466
|
sr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (e, t, n) => void 0;
|
|
3467
3467
|
});
|
|
3468
3468
|
function _o() {
|
|
3469
3469
|
return /* @__PURE__ */ xi(go);
|
|
3470
3470
|
}
|
|
3471
|
-
var vo = /*@__PURE__*/
|
|
3471
|
+
var vo = /*@__PURE__*/ I("ZodNever", (e, t) => {
|
|
3472
3472
|
cr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => na(e, t, n, r);
|
|
3473
3473
|
});
|
|
3474
3474
|
function yo(e) {
|
|
3475
3475
|
return /* @__PURE__ */ Si(vo, e);
|
|
3476
3476
|
}
|
|
3477
|
-
var bo = /*@__PURE__*/
|
|
3477
|
+
var bo = /*@__PURE__*/ I("ZodArray", (e, t) => {
|
|
3478
3478
|
ur.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => sa(e, t, n, r), e.element = t.element, Va(e, "ZodArray", {
|
|
3479
3479
|
min(e, t) {
|
|
3480
3480
|
return this.check(/* @__PURE__ */ ki(e, t));
|
|
@@ -3496,7 +3496,7 @@ var bo = /*@__PURE__*/ F("ZodArray", (e, t) => {
|
|
|
3496
3496
|
function xo(e, t) {
|
|
3497
3497
|
return /* @__PURE__ */ Ui(bo, e, t);
|
|
3498
3498
|
}
|
|
3499
|
-
var So = /*@__PURE__*/
|
|
3499
|
+
var So = /*@__PURE__*/ I("ZodObject", (e, t) => {
|
|
3500
3500
|
hr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ca(e, t, n, r), R(e, "shape", () => t.shape), Va(e, "ZodObject", {
|
|
3501
3501
|
keyof() {
|
|
3502
3502
|
return X(Object.keys(this._zod.def.shape));
|
|
@@ -3561,7 +3561,7 @@ function Y(e, t) {
|
|
|
3561
3561
|
...z(t)
|
|
3562
3562
|
});
|
|
3563
3563
|
}
|
|
3564
|
-
var Co = /*@__PURE__*/
|
|
3564
|
+
var Co = /*@__PURE__*/ I("ZodUnion", (e, t) => {
|
|
3565
3565
|
_r.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => la(e, t, n, r), e.options = t.options;
|
|
3566
3566
|
});
|
|
3567
3567
|
function wo(e, t) {
|
|
@@ -3571,7 +3571,7 @@ function wo(e, t) {
|
|
|
3571
3571
|
...z(t)
|
|
3572
3572
|
});
|
|
3573
3573
|
}
|
|
3574
|
-
var To = /*@__PURE__*/
|
|
3574
|
+
var To = /*@__PURE__*/ I("ZodIntersection", (e, t) => {
|
|
3575
3575
|
vr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ua(e, t, n, r);
|
|
3576
3576
|
});
|
|
3577
3577
|
function Eo(e, t) {
|
|
@@ -3581,7 +3581,7 @@ function Eo(e, t) {
|
|
|
3581
3581
|
right: t
|
|
3582
3582
|
});
|
|
3583
3583
|
}
|
|
3584
|
-
var Do = /*@__PURE__*/
|
|
3584
|
+
var Do = /*@__PURE__*/ I("ZodRecord", (e, t) => {
|
|
3585
3585
|
xr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => da(e, t, n, r), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
3586
3586
|
});
|
|
3587
3587
|
function Oo(e, t, n) {
|
|
@@ -3597,7 +3597,7 @@ function Oo(e, t, n) {
|
|
|
3597
3597
|
...z(n)
|
|
3598
3598
|
});
|
|
3599
3599
|
}
|
|
3600
|
-
var ko = /*@__PURE__*/
|
|
3600
|
+
var ko = /*@__PURE__*/ I("ZodEnum", (e, t) => {
|
|
3601
3601
|
Sr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ra(e, t, n, r), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
3602
3602
|
let n = new Set(Object.keys(t.entries));
|
|
3603
3603
|
e.extract = (e, r) => {
|
|
@@ -3629,7 +3629,7 @@ function X(e, t) {
|
|
|
3629
3629
|
...z(t)
|
|
3630
3630
|
});
|
|
3631
3631
|
}
|
|
3632
|
-
var Ao = /*@__PURE__*/
|
|
3632
|
+
var Ao = /*@__PURE__*/ I("ZodLiteral", (e, t) => {
|
|
3633
3633
|
Cr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ia(e, t, n, r), e.values = new Set(t.values), Object.defineProperty(e, "value", { get() {
|
|
3634
3634
|
if (t.values.length > 1) throw Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
3635
3635
|
return t.values[0];
|
|
@@ -3642,7 +3642,7 @@ function jo(e, t) {
|
|
|
3642
3642
|
...z(t)
|
|
3643
3643
|
});
|
|
3644
3644
|
}
|
|
3645
|
-
var Mo = /*@__PURE__*/
|
|
3645
|
+
var Mo = /*@__PURE__*/ I("ZodTransform", (e, t) => {
|
|
3646
3646
|
wr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => oa(e, t, n, r), e._zod.parse = (n, r) => {
|
|
3647
3647
|
if (r.direction === "backward") throw new Ne(e.constructor.name);
|
|
3648
3648
|
n.addIssue = (r) => {
|
|
@@ -3662,7 +3662,7 @@ function No(e) {
|
|
|
3662
3662
|
transform: e
|
|
3663
3663
|
});
|
|
3664
3664
|
}
|
|
3665
|
-
var Po = /*@__PURE__*/
|
|
3665
|
+
var Po = /*@__PURE__*/ I("ZodOptional", (e, t) => {
|
|
3666
3666
|
Er.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ya(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3667
3667
|
});
|
|
3668
3668
|
function Fo(e) {
|
|
@@ -3671,7 +3671,7 @@ function Fo(e) {
|
|
|
3671
3671
|
innerType: e
|
|
3672
3672
|
});
|
|
3673
3673
|
}
|
|
3674
|
-
var Io = /*@__PURE__*/
|
|
3674
|
+
var Io = /*@__PURE__*/ I("ZodExactOptional", (e, t) => {
|
|
3675
3675
|
Dr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ya(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3676
3676
|
});
|
|
3677
3677
|
function Lo(e) {
|
|
@@ -3680,7 +3680,7 @@ function Lo(e) {
|
|
|
3680
3680
|
innerType: e
|
|
3681
3681
|
});
|
|
3682
3682
|
}
|
|
3683
|
-
var Ro = /*@__PURE__*/
|
|
3683
|
+
var Ro = /*@__PURE__*/ I("ZodNullable", (e, t) => {
|
|
3684
3684
|
Or.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => fa(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3685
3685
|
});
|
|
3686
3686
|
function zo(e) {
|
|
@@ -3689,7 +3689,7 @@ function zo(e) {
|
|
|
3689
3689
|
innerType: e
|
|
3690
3690
|
});
|
|
3691
3691
|
}
|
|
3692
|
-
var Bo = /*@__PURE__*/
|
|
3692
|
+
var Bo = /*@__PURE__*/ I("ZodDefault", (e, t) => {
|
|
3693
3693
|
kr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ma(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
3694
3694
|
});
|
|
3695
3695
|
function Vo(e, t) {
|
|
@@ -3701,7 +3701,7 @@ function Vo(e, t) {
|
|
|
3701
3701
|
}
|
|
3702
3702
|
});
|
|
3703
3703
|
}
|
|
3704
|
-
var Ho = /*@__PURE__*/
|
|
3704
|
+
var Ho = /*@__PURE__*/ I("ZodPrefault", (e, t) => {
|
|
3705
3705
|
jr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ha(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3706
3706
|
});
|
|
3707
3707
|
function Uo(e, t) {
|
|
@@ -3713,7 +3713,7 @@ function Uo(e, t) {
|
|
|
3713
3713
|
}
|
|
3714
3714
|
});
|
|
3715
3715
|
}
|
|
3716
|
-
var Wo = /*@__PURE__*/
|
|
3716
|
+
var Wo = /*@__PURE__*/ I("ZodNonOptional", (e, t) => {
|
|
3717
3717
|
Mr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => pa(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3718
3718
|
});
|
|
3719
3719
|
function Go(e, t) {
|
|
@@ -3723,7 +3723,7 @@ function Go(e, t) {
|
|
|
3723
3723
|
...z(t)
|
|
3724
3724
|
});
|
|
3725
3725
|
}
|
|
3726
|
-
var Ko = /*@__PURE__*/
|
|
3726
|
+
var Ko = /*@__PURE__*/ I("ZodCatch", (e, t) => {
|
|
3727
3727
|
Pr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => ga(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
3728
3728
|
});
|
|
3729
3729
|
function qo(e, t) {
|
|
@@ -3733,7 +3733,7 @@ function qo(e, t) {
|
|
|
3733
3733
|
catchValue: typeof t == "function" ? t : () => t
|
|
3734
3734
|
});
|
|
3735
3735
|
}
|
|
3736
|
-
var Jo = /*@__PURE__*/
|
|
3736
|
+
var Jo = /*@__PURE__*/ I("ZodPipe", (e, t) => {
|
|
3737
3737
|
Fr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => _a(e, t, n, r), e.in = t.in, e.out = t.out;
|
|
3738
3738
|
});
|
|
3739
3739
|
function Yo(e, t) {
|
|
@@ -3743,7 +3743,7 @@ function Yo(e, t) {
|
|
|
3743
3743
|
out: t
|
|
3744
3744
|
});
|
|
3745
3745
|
}
|
|
3746
|
-
var Xo = /*@__PURE__*/
|
|
3746
|
+
var Xo = /*@__PURE__*/ I("ZodReadonly", (e, t) => {
|
|
3747
3747
|
Lr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => va(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3748
3748
|
});
|
|
3749
3749
|
function Zo(e) {
|
|
@@ -3752,7 +3752,7 @@ function Zo(e) {
|
|
|
3752
3752
|
innerType: e
|
|
3753
3753
|
});
|
|
3754
3754
|
}
|
|
3755
|
-
var Qo = /*@__PURE__*/
|
|
3755
|
+
var Qo = /*@__PURE__*/ I("ZodCustom", (e, t) => {
|
|
3756
3756
|
zr.init(e, t), K.init(e, t), e._zod.processJSONSchema = (t, n, r) => aa(e, t, n, r);
|
|
3757
3757
|
});
|
|
3758
3758
|
function $o(e, t = {}) {
|
|
@@ -3952,7 +3952,7 @@ function gs(e, t, n) {
|
|
|
3952
3952
|
return o === "browser_embeds_disabled" || /^Browser embeds are not enabled/i.test(a ?? "") ? a && a.includes("Allow public client-only embeds") ? a : `Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.` : o === "experience_unavailable" || /^Experience is not available\.?$/i.test(a ?? "") || /^Unknown experience\.?$/i.test(a ?? "") ? a && a.includes("No playable experience found") ? a : `No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.` : a || n.trim().slice(0, 500) || `Public session mint failed (${t})`;
|
|
3953
3953
|
}
|
|
3954
3954
|
async function _s(e, t) {
|
|
3955
|
-
let n =
|
|
3955
|
+
let n = Oe(), r = { experienceId: e };
|
|
3956
3956
|
t?.language && (r.language = t.language), t?.mode && (r.mode = t.mode), t?.responseMode && (r.responseMode = t.responseMode), t?.speechInputMode && (r.speechInputMode = t.speechInputMode), t?.startButton && (r.startButton = t.startButton), t?.speechOnly !== void 0 && (r.speechOnly = t.speechOnly);
|
|
3957
3957
|
let i = await fetch(`${n}/v1/public-sessions`, {
|
|
3958
3958
|
method: "POST",
|
|
@@ -3972,7 +3972,7 @@ async function _s(e, t) {
|
|
|
3972
3972
|
return ps(a);
|
|
3973
3973
|
}
|
|
3974
3974
|
async function vs(e, t) {
|
|
3975
|
-
let n =
|
|
3975
|
+
let n = Ae(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
3976
3976
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
3977
3977
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
3978
3978
|
try {
|
|
@@ -4075,7 +4075,10 @@ var Os = new Set([
|
|
|
4075
4075
|
"widgetReady",
|
|
4076
4076
|
"widgetExpand",
|
|
4077
4077
|
"widgetCollapse",
|
|
4078
|
-
"widgetAudioSettings"
|
|
4078
|
+
"widgetAudioSettings",
|
|
4079
|
+
"widgetDragStart",
|
|
4080
|
+
"widgetDragMove",
|
|
4081
|
+
"widgetDragEnd"
|
|
4079
4082
|
]);
|
|
4080
4083
|
function ks(e) {
|
|
4081
4084
|
if (!e || typeof e != "object") return null;
|
|
@@ -4086,6 +4089,16 @@ function ks(e) {
|
|
|
4086
4089
|
let e = t.payload;
|
|
4087
4090
|
return !e || typeof e != "object" || typeof e.open != "boolean" ? null : t;
|
|
4088
4091
|
}
|
|
4092
|
+
if (t.type === "widgetDragStart" || t.type === "widgetDragEnd") {
|
|
4093
|
+
let e = t.payload;
|
|
4094
|
+
return !e || typeof e != "object" || typeof e.pointerId != "number" || !Number.isFinite(e.pointerId) ? null : t;
|
|
4095
|
+
}
|
|
4096
|
+
if (t.type === "widgetDragMove") {
|
|
4097
|
+
let e = t.payload;
|
|
4098
|
+
if (!e || typeof e != "object") return null;
|
|
4099
|
+
let { pointerId: n, dx: r, dy: i } = e;
|
|
4100
|
+
return typeof n != "number" || !Number.isFinite(n) || typeof r != "number" || !Number.isFinite(r) || typeof i != "number" || !Number.isFinite(i) ? null : t;
|
|
4101
|
+
}
|
|
4089
4102
|
return !t.payload || typeof t.payload != "object" ? null : t;
|
|
4090
4103
|
}
|
|
4091
4104
|
function As(e) {
|
|
@@ -4193,6 +4206,15 @@ function Fs(e) {
|
|
|
4193
4206
|
case "widgetAudioSettings":
|
|
4194
4207
|
e.onWidgetAudioSettings?.(a.payload.open);
|
|
4195
4208
|
break;
|
|
4209
|
+
case "widgetDragStart":
|
|
4210
|
+
e.onWidgetDragStart?.(a.payload);
|
|
4211
|
+
break;
|
|
4212
|
+
case "widgetDragMove":
|
|
4213
|
+
e.onWidgetDragMove?.(a.payload);
|
|
4214
|
+
break;
|
|
4215
|
+
case "widgetDragEnd":
|
|
4216
|
+
e.onWidgetDragEnd?.(a.payload);
|
|
4217
|
+
break;
|
|
4196
4218
|
}
|
|
4197
4219
|
};
|
|
4198
4220
|
if (window.addEventListener("message", o), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
|
|
@@ -4343,7 +4365,8 @@ function Fs(e) {
|
|
|
4343
4365
|
utteranceId: e.utteranceId,
|
|
4344
4366
|
format: e.format,
|
|
4345
4367
|
queue: e.queue,
|
|
4346
|
-
...e.characterId ? { characterId: e.characterId } : {}
|
|
4368
|
+
...e.characterId ? { characterId: e.characterId } : {},
|
|
4369
|
+
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
4347
4370
|
}
|
|
4348
4371
|
});
|
|
4349
4372
|
},
|
|
@@ -4359,6 +4382,17 @@ function Fs(e) {
|
|
|
4359
4382
|
}
|
|
4360
4383
|
}, Ps, [e.audio]);
|
|
4361
4384
|
},
|
|
4385
|
+
speechUtteranceSetTranscript(e) {
|
|
4386
|
+
return c({
|
|
4387
|
+
type: "speechUtteranceSetTranscript",
|
|
4388
|
+
schemaVersion: 2,
|
|
4389
|
+
payload: {
|
|
4390
|
+
correlationId: Z(),
|
|
4391
|
+
utteranceId: e.utteranceId,
|
|
4392
|
+
transcript: e.transcript
|
|
4393
|
+
}
|
|
4394
|
+
});
|
|
4395
|
+
},
|
|
4362
4396
|
speechUtteranceClose(e) {
|
|
4363
4397
|
return c({
|
|
4364
4398
|
type: "speechUtteranceClose",
|
|
@@ -4616,51 +4650,176 @@ function uc(e) {
|
|
|
4616
4650
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
4617
4651
|
}
|
|
4618
4652
|
//#endregion
|
|
4619
|
-
//#region src/
|
|
4653
|
+
//#region src/byo/pcm.ts
|
|
4620
4654
|
function dc(e) {
|
|
4621
|
-
let t =
|
|
4655
|
+
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
4622
4656
|
for (let t = 0; t < e.length; t++) {
|
|
4623
4657
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
4624
4658
|
n.setInt16(t * 2, r < 0 ? r * 32768 : r * 32767, !0);
|
|
4625
4659
|
}
|
|
4626
4660
|
return t;
|
|
4627
4661
|
}
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4662
|
+
//#endregion
|
|
4663
|
+
//#region src/byo/resample.ts
|
|
4664
|
+
function fc(e, t, n, r, i) {
|
|
4665
|
+
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;
|
|
4666
|
+
return ((a * i + o) * i + s) * i + c;
|
|
4667
|
+
}
|
|
4668
|
+
function pc(e, t) {
|
|
4669
|
+
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
4670
|
+
if (e === t) return {
|
|
4671
|
+
fromRate: e,
|
|
4672
|
+
toRate: t,
|
|
4673
|
+
push(e) {
|
|
4674
|
+
return e;
|
|
4675
|
+
},
|
|
4676
|
+
flush() {
|
|
4677
|
+
return new Float32Array();
|
|
4678
|
+
}
|
|
4679
|
+
};
|
|
4680
|
+
let n = e / t, r = new Float32Array(), i = 0;
|
|
4681
|
+
return {
|
|
4682
|
+
fromRate: e,
|
|
4683
|
+
toRate: t,
|
|
4684
|
+
push(e) {
|
|
4685
|
+
if (e.length === 0) return new Float32Array();
|
|
4686
|
+
let t = new Float32Array(r.length + e.length);
|
|
4687
|
+
if (t.set(r), t.set(e, r.length), r = t, r.length < 4) return new Float32Array();
|
|
4688
|
+
let a = [];
|
|
4689
|
+
for (; i + 2 < r.length - 1;) {
|
|
4690
|
+
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);
|
|
4691
|
+
a.push(fc(r[o], r[e], r[s], r[c], t)), i += n;
|
|
4692
|
+
}
|
|
4693
|
+
let o = Math.max(0, Math.floor(i) - 1);
|
|
4694
|
+
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
4695
|
+
},
|
|
4696
|
+
flush() {
|
|
4697
|
+
return r.length === 0 ? new Float32Array() : (r = new Float32Array(), i = 0, new Float32Array());
|
|
4698
|
+
}
|
|
4699
|
+
};
|
|
4700
|
+
}
|
|
4701
|
+
//#endregion
|
|
4702
|
+
//#region src/byo/audioCapture.ts
|
|
4703
|
+
var mc = "liforma-pcm-capture", hc = `
|
|
4704
|
+
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
4705
|
+
process(inputs) {
|
|
4706
|
+
const ch = inputs[0] && inputs[0][0];
|
|
4707
|
+
if (ch && ch.length) {
|
|
4708
|
+
const copy = new Float32Array(ch.length);
|
|
4709
|
+
copy.set(ch);
|
|
4710
|
+
this.port.postMessage(copy, [copy.buffer]);
|
|
4711
|
+
}
|
|
4712
|
+
return true;
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
registerProcessor('${mc}', LiformaPcmCaptureProcessor);
|
|
4716
|
+
`, gc = null;
|
|
4717
|
+
function _c() {
|
|
4718
|
+
return gc ||= URL.createObjectURL(new Blob([hc], { type: "application/javascript" })), gc;
|
|
4719
|
+
}
|
|
4720
|
+
function vc() {
|
|
4721
|
+
return window.AudioContext || window.webkitAudioContext || null;
|
|
4722
|
+
}
|
|
4723
|
+
async function yc(e) {
|
|
4724
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = vc();
|
|
4725
|
+
if (!o) throw Error("Web Audio is required for audio capture");
|
|
4726
|
+
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
4636
4727
|
l.gain.value = 0;
|
|
4637
|
-
let u =
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4728
|
+
let u = s.sampleRate, d = pc(u, n), f = !1, p = !1, m = (e) => {
|
|
4729
|
+
if (f || i && !i()) return;
|
|
4730
|
+
let t = d.push(e);
|
|
4731
|
+
t.length !== 0 && r(dc(t));
|
|
4732
|
+
}, h = () => void 0;
|
|
4733
|
+
return await (async () => {
|
|
4734
|
+
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
4735
|
+
try {
|
|
4736
|
+
await s.audioWorklet.addModule(_c());
|
|
4737
|
+
let e = new AudioWorkletNode(s, mc, {
|
|
4738
|
+
numberOfInputs: 1,
|
|
4739
|
+
numberOfOutputs: 1,
|
|
4740
|
+
outputChannelCount: [1]
|
|
4741
|
+
});
|
|
4742
|
+
return e.port.onmessage = (e) => {
|
|
4743
|
+
e.data instanceof Float32Array && m(e.data);
|
|
4744
|
+
}, c.connect(e), e.connect(l), l.connect(s.destination), h = () => {
|
|
4745
|
+
e.port.onmessage = null;
|
|
4746
|
+
try {
|
|
4747
|
+
e.disconnect();
|
|
4748
|
+
} catch {}
|
|
4749
|
+
try {
|
|
4750
|
+
c.disconnect();
|
|
4751
|
+
} catch {}
|
|
4752
|
+
try {
|
|
4753
|
+
l.disconnect();
|
|
4754
|
+
} catch {}
|
|
4755
|
+
}, p = !0, !0;
|
|
4756
|
+
} catch {
|
|
4757
|
+
return !1;
|
|
4758
|
+
}
|
|
4759
|
+
})() ? a?.(`Mic/track capture via AudioWorklet at ${u} Hz → ${n} Hz`) : ((() => {
|
|
4760
|
+
let e = s.createScriptProcessor?.bind(s);
|
|
4761
|
+
if (!e) throw Error("Neither AudioWorklet nor ScriptProcessor is available");
|
|
4762
|
+
let t = e(4096, 1, 1);
|
|
4763
|
+
t.onaudioprocess = (e) => {
|
|
4764
|
+
m(e.inputBuffer.getChannelData(0));
|
|
4765
|
+
}, c.connect(t), t.connect(l), l.connect(s.destination), h = () => {
|
|
4766
|
+
t.onaudioprocess = null;
|
|
4767
|
+
try {
|
|
4768
|
+
t.disconnect();
|
|
4769
|
+
} catch {}
|
|
4642
4770
|
try {
|
|
4643
|
-
c.disconnect()
|
|
4771
|
+
c.disconnect();
|
|
4644
4772
|
} catch {}
|
|
4645
|
-
|
|
4773
|
+
try {
|
|
4774
|
+
l.disconnect();
|
|
4775
|
+
} catch {}
|
|
4776
|
+
}, p = !1;
|
|
4777
|
+
})(), a?.(`Mic/track capture via ScriptProcessor at ${u} Hz → ${n} Hz`, "warn")), s.state === "suspended" && await s.resume().catch(() => void 0), {
|
|
4778
|
+
fromSampleRate: u,
|
|
4779
|
+
usingWorklet: p,
|
|
4780
|
+
stop() {
|
|
4781
|
+
f || (f = !0, d.flush(), h(), s.close().catch(() => void 0));
|
|
4646
4782
|
}
|
|
4647
4783
|
};
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4784
|
+
}
|
|
4785
|
+
//#endregion
|
|
4786
|
+
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
4787
|
+
async function bc(e) {
|
|
4788
|
+
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
4789
|
+
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new $("MediaStreamTrack is not available in this environment.");
|
|
4790
|
+
if (t.kind !== "audio") throw new $("speech.play track must be an audio MediaStreamTrack.");
|
|
4791
|
+
if (t.readyState === "ended" || i?.aborted) return;
|
|
4792
|
+
let a = new MediaStream([t]), o = Promise.resolve(), s = !1, c = null, l = () => {
|
|
4793
|
+
s || (s = !0, c?.stop(), c = null);
|
|
4794
|
+
};
|
|
4795
|
+
try {
|
|
4796
|
+
c = await yc({
|
|
4797
|
+
mediaStream: a,
|
|
4798
|
+
targetSampleRate: r,
|
|
4799
|
+
shouldSend: () => !s && !i?.aborted,
|
|
4800
|
+
onPcm: (e) => {
|
|
4801
|
+
if (s || i?.aborted) return;
|
|
4802
|
+
let t = lc(e);
|
|
4803
|
+
o = o.then(async () => {
|
|
4804
|
+
if (s || i?.aborted) return;
|
|
4805
|
+
let e = 0;
|
|
4806
|
+
for (; e < t.byteLength;) {
|
|
4807
|
+
let r = Math.min(e + ec.MAX_CHUNK_BYTES, t.byteLength);
|
|
4808
|
+
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
4809
|
+
let i = t.subarray(e, r);
|
|
4810
|
+
e = r, i.byteLength !== 0 && await n.write(i);
|
|
4811
|
+
}
|
|
4812
|
+
}).catch(() => {
|
|
4813
|
+
l();
|
|
4814
|
+
});
|
|
4657
4815
|
}
|
|
4658
|
-
}).catch(() => {
|
|
4659
|
-
m();
|
|
4660
4816
|
});
|
|
4661
|
-
}
|
|
4817
|
+
} catch (e) {
|
|
4818
|
+
throw l(), new $(`MediaStreamTrack capture failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
4819
|
+
}
|
|
4820
|
+
await new Promise((e) => {
|
|
4662
4821
|
let r = () => {
|
|
4663
|
-
|
|
4822
|
+
l(), o.finally(e);
|
|
4664
4823
|
};
|
|
4665
4824
|
t.addEventListener("ended", r, { once: !0 }), i?.addEventListener("abort", () => {
|
|
4666
4825
|
n.cancel().catch(() => void 0), r();
|
|
@@ -4669,7 +4828,7 @@ async function fc(e) {
|
|
|
4669
4828
|
}
|
|
4670
4829
|
//#endregion
|
|
4671
4830
|
//#region src/v2/speech/speechController.ts
|
|
4672
|
-
async function
|
|
4831
|
+
async function xc(e, t) {
|
|
4673
4832
|
if (Zs(e)) throw new $("MediaStreamTrack play is handled on the host before embed.");
|
|
4674
4833
|
if (Ys(e)) {
|
|
4675
4834
|
let t = lc(e.data);
|
|
@@ -4698,10 +4857,10 @@ async function pc(e, t) {
|
|
|
4698
4857
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
4699
4858
|
};
|
|
4700
4859
|
}
|
|
4701
|
-
function
|
|
4860
|
+
function Sc() {
|
|
4702
4861
|
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)}`;
|
|
4703
4862
|
}
|
|
4704
|
-
function
|
|
4863
|
+
function Cc(e, t = "completed") {
|
|
4705
4864
|
return {
|
|
4706
4865
|
utteranceId: e.speechId,
|
|
4707
4866
|
characterId: e.characterId,
|
|
@@ -4715,13 +4874,13 @@ function hc(e, t = "completed") {
|
|
|
4715
4874
|
}
|
|
4716
4875
|
};
|
|
4717
4876
|
}
|
|
4718
|
-
function
|
|
4877
|
+
function wc(e) {
|
|
4719
4878
|
return e instanceof Error ? e : new $(String(e));
|
|
4720
4879
|
}
|
|
4721
|
-
function
|
|
4880
|
+
function Tc(e) {
|
|
4722
4881
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
4723
4882
|
}
|
|
4724
|
-
var
|
|
4883
|
+
var Ec = class {
|
|
4725
4884
|
id;
|
|
4726
4885
|
characterId;
|
|
4727
4886
|
result;
|
|
@@ -4747,9 +4906,10 @@ var vc = class {
|
|
|
4747
4906
|
utteranceId: this.id,
|
|
4748
4907
|
format: this.format,
|
|
4749
4908
|
characterId: this.characterId,
|
|
4750
|
-
queue: e.queue
|
|
4909
|
+
queue: e.queue,
|
|
4910
|
+
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
4751
4911
|
}).catch((e) => {
|
|
4752
|
-
throw this.fail(
|
|
4912
|
+
throw this.fail(wc(e)), wc(e);
|
|
4753
4913
|
}), this.signal?.addEventListener("abort", () => {
|
|
4754
4914
|
this.cancel();
|
|
4755
4915
|
}, { once: !0 });
|
|
@@ -4782,6 +4942,13 @@ var vc = class {
|
|
|
4782
4942
|
this.releaseWriteSlot();
|
|
4783
4943
|
}
|
|
4784
4944
|
}
|
|
4945
|
+
async setTranscript(e) {
|
|
4946
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new nc();
|
|
4947
|
+
await this.requireHost().speechUtteranceSetTranscript({
|
|
4948
|
+
utteranceId: this.id,
|
|
4949
|
+
transcript: e
|
|
4950
|
+
});
|
|
4951
|
+
}
|
|
4785
4952
|
async close(e) {
|
|
4786
4953
|
if (this.settled) return this.result;
|
|
4787
4954
|
this.closed = !0, await this.beginPromise.catch(() => void 0), await this.writeChain.catch(() => void 0);
|
|
@@ -4793,7 +4960,7 @@ var vc = class {
|
|
|
4793
4960
|
});
|
|
4794
4961
|
return this.resolve(t), t;
|
|
4795
4962
|
} catch (e) {
|
|
4796
|
-
let t =
|
|
4963
|
+
let t = wc(e);
|
|
4797
4964
|
throw this.fail(t), t;
|
|
4798
4965
|
}
|
|
4799
4966
|
}
|
|
@@ -4815,7 +4982,7 @@ var vc = class {
|
|
|
4815
4982
|
};
|
|
4816
4983
|
return this.resolve(t), t;
|
|
4817
4984
|
} catch (e) {
|
|
4818
|
-
let t =
|
|
4985
|
+
let t = wc(e);
|
|
4819
4986
|
throw this.fail(t), t;
|
|
4820
4987
|
}
|
|
4821
4988
|
}
|
|
@@ -4859,7 +5026,7 @@ var vc = class {
|
|
|
4859
5026
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
4860
5027
|
}
|
|
4861
5028
|
};
|
|
4862
|
-
function
|
|
5029
|
+
function Dc(e) {
|
|
4863
5030
|
let t = null, n = (t, n) => {
|
|
4864
5031
|
if (!e.getCapabilities()[n]) throw new tc(t, n);
|
|
4865
5032
|
}, r = {
|
|
@@ -4885,9 +5052,9 @@ function yc(e) {
|
|
|
4885
5052
|
return;
|
|
4886
5053
|
}
|
|
4887
5054
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
4888
|
-
t.removeEventListener("abort", s), n(
|
|
5055
|
+
t.removeEventListener("abort", s), n(Cc(e, "completed"));
|
|
4889
5056
|
}, (a) => {
|
|
4890
|
-
if (t.removeEventListener("abort", s),
|
|
5057
|
+
if (t.removeEventListener("abort", s), Tc(a)) {
|
|
4891
5058
|
n({
|
|
4892
5059
|
utteranceId: "utt_interrupted",
|
|
4893
5060
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
@@ -4898,14 +5065,14 @@ function yc(e) {
|
|
|
4898
5065
|
});
|
|
4899
5066
|
return;
|
|
4900
5067
|
}
|
|
4901
|
-
i(
|
|
5068
|
+
i(wc(a));
|
|
4902
5069
|
});
|
|
4903
5070
|
});
|
|
4904
5071
|
}
|
|
4905
5072
|
try {
|
|
4906
|
-
return
|
|
5073
|
+
return Cc(await o, "completed");
|
|
4907
5074
|
} catch (t) {
|
|
4908
|
-
if (
|
|
5075
|
+
if (Tc(t)) return {
|
|
4909
5076
|
utteranceId: "utt_interrupted",
|
|
4910
5077
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
4911
5078
|
status: "interrupted",
|
|
@@ -4913,7 +5080,7 @@ function yc(e) {
|
|
|
4913
5080
|
transcript: r.text,
|
|
4914
5081
|
animation: ic("none")
|
|
4915
5082
|
};
|
|
4916
|
-
throw
|
|
5083
|
+
throw wc(t);
|
|
4917
5084
|
}
|
|
4918
5085
|
},
|
|
4919
5086
|
async play(i) {
|
|
@@ -4935,7 +5102,7 @@ function yc(e) {
|
|
|
4935
5102
|
}
|
|
4936
5103
|
let o = e.getIframeHost();
|
|
4937
5104
|
if (!o) throw new $("Speech session is not attached.");
|
|
4938
|
-
let s = await
|
|
5105
|
+
let s = await xc(i.audio, i.signal);
|
|
4939
5106
|
return o.speechPlay({
|
|
4940
5107
|
source: s,
|
|
4941
5108
|
characterId: i.characterId,
|
|
@@ -4952,19 +5119,20 @@ function yc(e) {
|
|
|
4952
5119
|
let a = r.queue ?? "replace-active";
|
|
4953
5120
|
if (a !== "replace-active" && a !== "replace-all") throw new $("createUtterance queue must be replace-active or replace-all.");
|
|
4954
5121
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
4955
|
-
let o = new
|
|
4956
|
-
id:
|
|
5122
|
+
let o = new Ec({
|
|
5123
|
+
id: Sc(),
|
|
4957
5124
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
4958
5125
|
format: i,
|
|
4959
5126
|
queue: a,
|
|
4960
5127
|
host: e,
|
|
5128
|
+
...r.transcript === void 0 ? {} : { transcript: r.transcript },
|
|
4961
5129
|
signal: r.signal
|
|
4962
5130
|
});
|
|
4963
5131
|
return t = o, o.result.finally(() => {
|
|
4964
5132
|
t === o && (t = null);
|
|
4965
5133
|
}), r.track && (async () => {
|
|
4966
5134
|
try {
|
|
4967
|
-
if (await
|
|
5135
|
+
if (await bc({
|
|
4968
5136
|
track: r.track,
|
|
4969
5137
|
utterance: o,
|
|
4970
5138
|
sampleRate: i.sampleRate,
|
|
@@ -4992,7 +5160,7 @@ function yc(e) {
|
|
|
4992
5160
|
}
|
|
4993
5161
|
//#endregion
|
|
4994
5162
|
//#region src/v2/experience.ts
|
|
4995
|
-
function
|
|
5163
|
+
function Oc(e, t) {
|
|
4996
5164
|
return t ? ps({
|
|
4997
5165
|
...e,
|
|
4998
5166
|
experience: {
|
|
@@ -5001,7 +5169,7 @@ function bc(e, t) {
|
|
|
5001
5169
|
}
|
|
5002
5170
|
}) : e;
|
|
5003
5171
|
}
|
|
5004
|
-
var
|
|
5172
|
+
var kc = class e {
|
|
5005
5173
|
launch;
|
|
5006
5174
|
conversationProcessor;
|
|
5007
5175
|
iframeHost = null;
|
|
@@ -5019,10 +5187,10 @@ var xc = class e {
|
|
|
5019
5187
|
conversationCache = [];
|
|
5020
5188
|
speech;
|
|
5021
5189
|
constructor(e) {
|
|
5022
|
-
this.launch = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedManifest = e.kind === "manifest" ? e.manifest : null, this.speech =
|
|
5190
|
+
this.launch = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedManifest = e.kind === "manifest" ? e.manifest : null, this.speech = Dc({
|
|
5023
5191
|
getIframeHost: () => this.iframeHost,
|
|
5024
5192
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
5025
|
-
getCapabilities: () =>
|
|
5193
|
+
getCapabilities: () => Ac(this.resolvedManifest),
|
|
5026
5194
|
getActiveCharacterId: () => this.resolvedManifest?.activeCharacterId ?? "character_unknown",
|
|
5027
5195
|
onProcessorInterrupt: () => {
|
|
5028
5196
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -5153,7 +5321,10 @@ var xc = class e {
|
|
|
5153
5321
|
onWidgetReady: () => e.onWidgetReady?.(),
|
|
5154
5322
|
onWidgetExpand: () => e.onWidgetExpand?.(),
|
|
5155
5323
|
onWidgetCollapse: () => e.onWidgetCollapse?.(),
|
|
5156
|
-
onWidgetAudioSettings: (t) => e.onWidgetAudioSettings?.(t)
|
|
5324
|
+
onWidgetAudioSettings: (t) => e.onWidgetAudioSettings?.(t),
|
|
5325
|
+
onWidgetDragStart: (t) => e.onWidgetDragStart?.(t),
|
|
5326
|
+
onWidgetDragMove: (t) => e.onWidgetDragMove?.(t),
|
|
5327
|
+
onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
|
|
5157
5328
|
});
|
|
5158
5329
|
this.iframeHost = f;
|
|
5159
5330
|
let p = this.resolveMintInteraction(), m = this.launch.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), vs(this.launch.sessionEndpoint, {
|
|
@@ -5181,7 +5352,7 @@ var xc = class e {
|
|
|
5181
5352
|
this.endpointAbortController = null;
|
|
5182
5353
|
}
|
|
5183
5354
|
if (f.postParentHello(), h) {
|
|
5184
|
-
let e =
|
|
5355
|
+
let e = Oc(h, this.launch.startButton);
|
|
5185
5356
|
this.launch.speechOnly && (e = Gs(e)), this.assertBrowserCustomManifest(e), this.resolvedManifest = e, f.postManifest(e), u.setValue(e);
|
|
5186
5357
|
}
|
|
5187
5358
|
return await Promise.race([s, new Promise((e, t) => {
|
|
@@ -5291,7 +5462,7 @@ var xc = class e {
|
|
|
5291
5462
|
};
|
|
5292
5463
|
}
|
|
5293
5464
|
};
|
|
5294
|
-
function
|
|
5465
|
+
function Ac(e) {
|
|
5295
5466
|
let t = e?.capabilities ?? [], n = t.includes("textSpeech"), r = t.includes("externalSpeechAudio");
|
|
5296
5467
|
return !n && !r ? {
|
|
5297
5468
|
textSpeech: !0,
|
|
@@ -5303,51 +5474,51 @@ function Sc(e) {
|
|
|
5303
5474
|
}
|
|
5304
5475
|
//#endregion
|
|
5305
5476
|
//#region src/widget/dockGeometry.ts
|
|
5306
|
-
var
|
|
5307
|
-
function
|
|
5477
|
+
var jc = "(min-width: 768px)", Mc = 24, Nc = .5, Pc = 1200, Fc = .85, Ic = 9 / 16;
|
|
5478
|
+
function Lc() {
|
|
5308
5479
|
if (typeof window > "u") return 800;
|
|
5309
5480
|
let e = window.screen?.availHeight;
|
|
5310
5481
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
5311
5482
|
}
|
|
5312
|
-
function
|
|
5313
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
5314
|
-
return s > a && (s = a, o = s /
|
|
5483
|
+
function Rc(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Mc, r = typeof window < "u" ? Lc() : 800) {
|
|
5484
|
+
let i = Math.max(160, Math.min(t - n * 2, t * Fc)), a = Math.max(120, e - n * 2), o = Math.min(r * Nc, Pc, i), s = o * Ic;
|
|
5485
|
+
return s > a && (s = a, o = s / Ic, o > i && (o = i, s = o * Ic)), {
|
|
5315
5486
|
width: Math.round(s),
|
|
5316
5487
|
height: Math.round(o)
|
|
5317
5488
|
};
|
|
5318
5489
|
}
|
|
5319
|
-
function
|
|
5490
|
+
function zc(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Mc) {
|
|
5320
5491
|
return {
|
|
5321
5492
|
left: Math.max(r, t - e.width - r),
|
|
5322
5493
|
top: Math.max(r, n - e.height - r)
|
|
5323
5494
|
};
|
|
5324
5495
|
}
|
|
5325
|
-
function
|
|
5496
|
+
function Bc(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Mc) {
|
|
5326
5497
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
5327
5498
|
return {
|
|
5328
5499
|
left: Math.min(Math.max(a, e), o),
|
|
5329
5500
|
top: Math.min(Math.max(a, t), s)
|
|
5330
5501
|
};
|
|
5331
5502
|
}
|
|
5332
|
-
function
|
|
5333
|
-
return e(
|
|
5503
|
+
function Vc(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
5504
|
+
return e(jc).matches;
|
|
5334
5505
|
}
|
|
5335
5506
|
//#endregion
|
|
5336
5507
|
//#region src/widget/mountExperienceWidget.ts
|
|
5337
|
-
function
|
|
5508
|
+
function Hc(e) {
|
|
5338
5509
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
5339
5510
|
}
|
|
5340
|
-
function
|
|
5511
|
+
function Uc(e) {
|
|
5341
5512
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
5342
5513
|
let t = typeof e == "string" ? e.trim() : "";
|
|
5343
5514
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
5344
5515
|
}
|
|
5345
|
-
function
|
|
5516
|
+
function Wc(e) {
|
|
5346
5517
|
return e === "expanded" || e === "docked";
|
|
5347
5518
|
}
|
|
5348
|
-
var
|
|
5349
|
-
function
|
|
5350
|
-
|
|
5519
|
+
var Gc = "<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>", Kc = "<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>", qc = "<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>", Jc = "<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>";
|
|
5520
|
+
function Yc(e, t, n) {
|
|
5521
|
+
ye(_e);
|
|
5351
5522
|
let r = x({
|
|
5352
5523
|
galleryThumb: t.galleryThumb,
|
|
5353
5524
|
avatarImage: t.avatarImage,
|
|
@@ -5374,9 +5545,9 @@ function Vc(e, t, n) {
|
|
|
5374
5545
|
let e = document.createElement("img");
|
|
5375
5546
|
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);
|
|
5376
5547
|
}
|
|
5377
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
5548
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ge(i);
|
|
5378
5549
|
}
|
|
5379
|
-
function
|
|
5550
|
+
function Xc(e) {
|
|
5380
5551
|
return e.startButton ? {
|
|
5381
5552
|
...e.startButton,
|
|
5382
5553
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -5388,7 +5559,7 @@ function Hc(e) {
|
|
|
5388
5559
|
variant: "primary"
|
|
5389
5560
|
};
|
|
5390
5561
|
}
|
|
5391
|
-
function
|
|
5562
|
+
function Zc(e) {
|
|
5392
5563
|
let t = !1, n = () => {
|
|
5393
5564
|
t || e();
|
|
5394
5565
|
}, r = () => {
|
|
@@ -5408,12 +5579,12 @@ function Uc(e) {
|
|
|
5408
5579
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
5409
5580
|
};
|
|
5410
5581
|
}
|
|
5411
|
-
function
|
|
5412
|
-
|
|
5582
|
+
function Qc(e, t) {
|
|
5583
|
+
we(Se);
|
|
5413
5584
|
let n = t.experienceId?.trim();
|
|
5414
5585
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
5415
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
5416
|
-
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",
|
|
5586
|
+
let r = t.prefetch ?? "onExpand", i = Hc(t.position), a = document.createElement("div");
|
|
5587
|
+
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", Uc(t.offset));
|
|
5417
5588
|
let o = document.createElement("button");
|
|
5418
5589
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
5419
5590
|
let s = document.createElement("div");
|
|
@@ -5433,21 +5604,21 @@ function Wc(e, t) {
|
|
|
5433
5604
|
let m = document.createElement("span");
|
|
5434
5605
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
5435
5606
|
let h = document.createElement("button");
|
|
5436
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
5607
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = qc, h.setAttribute("aria-label", "Reduce");
|
|
5437
5608
|
let g = document.createElement("button");
|
|
5438
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
5609
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Gc, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
5439
5610
|
let ee = document.createElement("button");
|
|
5440
|
-
ee.type = "button", ee.className = "liforma-ew__icon-btn liforma-ew__close", ee.innerHTML =
|
|
5611
|
+
ee.type = "button", ee.className = "liforma-ew__icon-btn liforma-ew__close", ee.innerHTML = Kc, ee.setAttribute("aria-label", "Close"), p.append(m, h, g, ee);
|
|
5441
5612
|
let _ = document.createElement("div");
|
|
5442
5613
|
_.className = "liforma-ew__stage";
|
|
5443
5614
|
let v = document.createElement("div");
|
|
5444
5615
|
v.className = "liforma-ew__status", v.hidden = !0, f.append(_, v), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
|
|
5445
|
-
let y = null, b = !1, x = !1, te = !1, S = !1, C = !1, w = !1, T = !1, E = 0, ne = "", D = null, O = null, k = null, A = null, re = null,
|
|
5616
|
+
let y = null, b = !1, x = !1, te = !1, S = !1, C = !1, w = !1, T = !1, E = 0, ne = "", D = null, O = null, k = null, A = null, j = null, re = null, M = null, ie = 0, ae = 0, oe = null, se = !1, ce = new AbortController(), le = t.parallax !== !1, N = () => {
|
|
5446
5617
|
let e = a.dataset.state;
|
|
5447
5618
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
5448
5619
|
}, ue = () => {
|
|
5449
5620
|
k !== null && (clearTimeout(k), k = null);
|
|
5450
|
-
},
|
|
5621
|
+
}, P = () => {
|
|
5451
5622
|
A !== null && (clearTimeout(A), A = null), a.classList.remove("liforma-ew--layout-settling");
|
|
5452
5623
|
}, de = () => {
|
|
5453
5624
|
for (let e of [
|
|
@@ -5455,89 +5626,118 @@ function Wc(e, t) {
|
|
|
5455
5626
|
l,
|
|
5456
5627
|
p
|
|
5457
5628
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
5458
|
-
p.classList.remove("liforma-ew__toolbar--dragging");
|
|
5459
|
-
},
|
|
5629
|
+
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
5630
|
+
}, fe = (e, t, n, r) => {
|
|
5460
5631
|
let i = (i) => {
|
|
5461
5632
|
i.style.left = `${e}px`, i.style.top = `${t}px`, i.style.width = `${n}px`, i.style.height = `${r}px`, i.style.right = "auto", i.style.bottom = "auto";
|
|
5462
5633
|
};
|
|
5463
5634
|
i(f), i(l);
|
|
5464
5635
|
let a = p.offsetWidth || 120;
|
|
5465
5636
|
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";
|
|
5466
|
-
},
|
|
5467
|
-
|
|
5637
|
+
}, pe = (e, t) => {
|
|
5638
|
+
if (N() !== "docked") return;
|
|
5639
|
+
let n = Rc(), r = Bc(e - ie, t - ae, n);
|
|
5640
|
+
j = r.left, re = r.top, fe(r.left, r.top, n.width, n.height);
|
|
5641
|
+
}, me = (e, t) => {
|
|
5642
|
+
if (N() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
5643
|
+
let n = Rc(), r = j ?? f.getBoundingClientRect().left, i = re ?? f.getBoundingClientRect().top, a = Bc(r + e, i + t, n);
|
|
5644
|
+
j = a.left, re = a.top, fe(a.left, a.top, n.width, n.height);
|
|
5645
|
+
}, he = (e) => {
|
|
5646
|
+
oe === "toolbar" && (M === null || e.pointerId !== M || (e.preventDefault(), pe(e.clientX, e.clientY)));
|
|
5647
|
+
}, ge = (e) => {
|
|
5648
|
+
if (M === null || e && e.pointerId !== M) return;
|
|
5649
|
+
let t = oe;
|
|
5650
|
+
M = null, oe = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && se && (se = !1, window.removeEventListener("pointermove", he), window.removeEventListener("pointerup", ge), window.removeEventListener("pointercancel", ge));
|
|
5651
|
+
}, _e = (e, t, n) => {
|
|
5652
|
+
if (x || N() !== "docked" || !Vc() || M !== null) return;
|
|
5653
|
+
M = n, oe = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
5654
|
+
let r = f.getBoundingClientRect();
|
|
5655
|
+
ie = e - r.left, ae = t - r.top, se || (se = !0, window.addEventListener("pointermove", he), window.addEventListener("pointerup", ge), window.addEventListener("pointercancel", ge));
|
|
5656
|
+
}, ve = (e) => {
|
|
5657
|
+
if (x || N() !== "docked" || !Vc() || M !== null) return;
|
|
5658
|
+
M = e.pointerId, oe = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
5659
|
+
let t = f.getBoundingClientRect();
|
|
5660
|
+
j = t.left, re = t.top;
|
|
5661
|
+
}, ye = (e) => {
|
|
5662
|
+
oe === "player" && (M === null || e.pointerId !== M || me(e.dx, e.dy));
|
|
5663
|
+
}, be = (e) => {
|
|
5664
|
+
oe === "player" && (M === null || e.pointerId !== M || ge());
|
|
5665
|
+
}, xe = () => {
|
|
5666
|
+
let e = Vc(), t = N();
|
|
5468
5667
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
5469
5668
|
h.hidden = !0;
|
|
5470
5669
|
return;
|
|
5471
5670
|
}
|
|
5472
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
5473
|
-
},
|
|
5474
|
-
let t =
|
|
5475
|
-
n =
|
|
5476
|
-
},
|
|
5671
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = Jc, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = qc, h.setAttribute("aria-label", "Reduce"));
|
|
5672
|
+
}, Ce = (e) => {
|
|
5673
|
+
let t = Rc(), n = e && j !== null && re !== null ? Bc(j, re, t) : zc(t);
|
|
5674
|
+
n = Bc(n.left, n.top, t), j = n.left, re = n.top, fe(n.left, n.top, t.width, t.height), xe();
|
|
5675
|
+
}, Te = () => {
|
|
5477
5676
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
5478
5677
|
requestAnimationFrame(() => {
|
|
5479
|
-
x || !
|
|
5678
|
+
x || !Wc(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
5480
5679
|
});
|
|
5481
5680
|
});
|
|
5482
|
-
},
|
|
5483
|
-
if (
|
|
5681
|
+
}, Ee = (e) => {
|
|
5682
|
+
if (P(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !T) {
|
|
5484
5683
|
a.classList.remove("liforma-ew--layout-settling");
|
|
5485
5684
|
return;
|
|
5486
5685
|
}
|
|
5487
5686
|
A = setTimeout(() => {
|
|
5488
|
-
if (A = null, x || !
|
|
5687
|
+
if (A = null, x || !Wc(a.dataset.state)) {
|
|
5489
5688
|
a.classList.remove("liforma-ew--layout-settling");
|
|
5490
5689
|
return;
|
|
5491
5690
|
}
|
|
5492
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
5691
|
+
a.classList.remove("liforma-ew--layout-settling"), Te();
|
|
5493
5692
|
}, 220);
|
|
5494
|
-
},
|
|
5693
|
+
}, De = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
5495
5694
|
ue(), k = setTimeout(() => {
|
|
5496
5695
|
k = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
5497
5696
|
}, 280);
|
|
5498
|
-
})),
|
|
5697
|
+
})), Oe = {
|
|
5499
5698
|
galleryThumb: t.galleryThumb,
|
|
5500
5699
|
avatarImage: t.avatarImage,
|
|
5501
5700
|
backgroundImage: t.backgroundImage,
|
|
5502
5701
|
foregroundImage: t.foregroundImage,
|
|
5503
5702
|
fallbackImage: t.fallbackImage
|
|
5504
|
-
},
|
|
5703
|
+
}, F = (e) => {
|
|
5505
5704
|
if (!e) {
|
|
5506
5705
|
v.hidden = !0, v.textContent = "";
|
|
5507
5706
|
return;
|
|
5508
5707
|
}
|
|
5509
5708
|
v.hidden = !1, v.textContent = e;
|
|
5510
|
-
},
|
|
5709
|
+
}, Ae = (e) => {
|
|
5511
5710
|
if (!e) {
|
|
5512
5711
|
c.hidden = !0, c.textContent = "";
|
|
5513
5712
|
return;
|
|
5514
5713
|
}
|
|
5515
5714
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
5516
|
-
},
|
|
5517
|
-
te = !0, o.disabled = !1,
|
|
5518
|
-
},
|
|
5715
|
+
}, je = () => {
|
|
5716
|
+
te = !0, o.disabled = !1, Ae(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
5717
|
+
}, I = () => {
|
|
5519
5718
|
S = !0, a.dataset.warm = "true", l.hidden = !1, T || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
5520
|
-
},
|
|
5719
|
+
}, Me = (e) => {
|
|
5521
5720
|
D?.(), D = null;
|
|
5522
|
-
let t =
|
|
5721
|
+
let t = Yc(s, e, { parallax: le });
|
|
5523
5722
|
return t ? (D = t, !0) : !1;
|
|
5524
|
-
},
|
|
5525
|
-
if (
|
|
5526
|
-
|
|
5723
|
+
}, Ne = () => {
|
|
5724
|
+
if (Me(Oe)) {
|
|
5725
|
+
je();
|
|
5527
5726
|
return;
|
|
5528
5727
|
}
|
|
5529
|
-
|
|
5728
|
+
Ae("Loading…"), ke(n, { signal: ce.signal }).then((e) => {
|
|
5530
5729
|
if (!x) {
|
|
5531
|
-
if (!
|
|
5532
|
-
|
|
5730
|
+
if (!Me({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
5731
|
+
je();
|
|
5533
5732
|
}
|
|
5534
5733
|
}).catch((e) => {
|
|
5535
5734
|
if (x || ce.signal.aborted) return;
|
|
5536
5735
|
let n = e instanceof Error ? e : Error(String(e));
|
|
5537
|
-
|
|
5736
|
+
Ae("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
5538
5737
|
});
|
|
5539
|
-
},
|
|
5738
|
+
}, Pe = () => ({
|
|
5540
5739
|
experienceId: n,
|
|
5740
|
+
ui: "widget",
|
|
5541
5741
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
5542
5742
|
...t.language ? { language: t.language } : {},
|
|
5543
5743
|
...t.mode ? { mode: t.mode } : {},
|
|
@@ -5545,74 +5745,80 @@ function Wc(e, t) {
|
|
|
5545
5745
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
5546
5746
|
...t.fit ? { fit: t.fit } : {},
|
|
5547
5747
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {},
|
|
5548
|
-
startButton:
|
|
5549
|
-
}),
|
|
5550
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), de(), a.dataset.state = "expanded",
|
|
5551
|
-
},
|
|
5552
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
5553
|
-
},
|
|
5748
|
+
startButton: Xc(t)
|
|
5749
|
+
}), L = (e = !0) => {
|
|
5750
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), de(), a.dataset.state = "expanded", F(null), typeof document < "u" && (ne = document.body.style.overflow, document.body.style.overflow = "hidden"), xe(), e && t.onExpanded?.();
|
|
5751
|
+
}, Fe = () => {
|
|
5752
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", F(null), typeof document < "u" && (document.body.style.overflow = ne), Ce(!0), xe(), y?.setWidgetChrome("docked");
|
|
5753
|
+
}, Ie = (e) => {
|
|
5554
5754
|
e.on("started", () => {
|
|
5555
|
-
x || (T = !0, a.dataset.live = "true",
|
|
5755
|
+
x || (T = !0, a.dataset.live = "true", F(null), t.onStarted?.(), Wc(a.dataset.state) && Te());
|
|
5556
5756
|
});
|
|
5557
|
-
},
|
|
5558
|
-
|
|
5559
|
-
},
|
|
5560
|
-
ue(),
|
|
5757
|
+
}, Le = () => {
|
|
5758
|
+
P(), u.hidden = !0, p.hidden = !0, de(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), te && (o.disabled = !1), F(null), typeof document < "u" && (document.body.style.overflow = ne), xe();
|
|
5759
|
+
}, Re = () => {
|
|
5760
|
+
ue(), P(), E += 1, b = !1, S = !1, C = !1, w = !1, T = !1;
|
|
5561
5761
|
let e = y;
|
|
5562
5762
|
y = null, e?.destroy(), _.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
|
|
5563
|
-
},
|
|
5564
|
-
if (!x &&
|
|
5565
|
-
if (b = !1, y && w) {
|
|
5763
|
+
}, ze = () => {
|
|
5764
|
+
if (!x && Wc(a.dataset.state)) {
|
|
5765
|
+
if (ge(), b = !1, y && w) {
|
|
5566
5766
|
let e = y;
|
|
5567
5767
|
(async () => {
|
|
5568
|
-
T && (await
|
|
5768
|
+
T && (await De(), x || y !== e) || (S && e.setWidgetChrome("collapsed"), Le(), T ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : S && I(), t.onCollapsed?.(), t.onClose?.());
|
|
5569
5769
|
})();
|
|
5570
5770
|
return;
|
|
5571
5771
|
}
|
|
5572
|
-
|
|
5772
|
+
Re(), Le(), t.onCollapsed?.(), t.onClose?.();
|
|
5573
5773
|
}
|
|
5574
|
-
},
|
|
5575
|
-
x ||
|
|
5576
|
-
|
|
5577
|
-
});
|
|
5578
|
-
}, I = () => {
|
|
5579
|
-
x || j() === "docked" && he(() => {
|
|
5580
|
-
de(), De(!1), y?.setWidgetChrome("expanded");
|
|
5774
|
+
}, Be = () => {
|
|
5775
|
+
x || Vc() && N() === "expanded" && Ee(() => {
|
|
5776
|
+
Fe();
|
|
5581
5777
|
});
|
|
5582
|
-
},
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
},
|
|
5587
|
-
|
|
5588
|
-
},
|
|
5589
|
-
|
|
5778
|
+
}, Ve = () => {
|
|
5779
|
+
x || N() === "docked" && (ge(), Ee(() => {
|
|
5780
|
+
de(), L(!1), y?.setWidgetChrome("expanded");
|
|
5781
|
+
}));
|
|
5782
|
+
}, R = () => {
|
|
5783
|
+
!y || !T || (ue(), a.classList.remove("liforma-ew--session-revealed"), L(), y.setWidgetChrome("expanded"), b = !1, Te());
|
|
5784
|
+
}, He = () => {
|
|
5785
|
+
!y || !w || T || (ue(), a.classList.remove("liforma-ew--session-revealed"), L(), b = !1, S && y.setWidgetChrome("expanded"));
|
|
5786
|
+
}, Ue = (e) => {
|
|
5787
|
+
x || e !== E && !T || (ue(), a.classList.remove("liforma-ew--session-revealed"), L(), b = !1, y?.setWidgetChrome("expanded"), T && Te());
|
|
5788
|
+
}, We = () => {
|
|
5789
|
+
if (x || C || S || y || Wc(a.dataset.state)) return;
|
|
5590
5790
|
C = !0;
|
|
5591
5791
|
let e = E;
|
|
5592
5792
|
l.hidden = !1, (async () => {
|
|
5593
5793
|
try {
|
|
5594
|
-
let t = await
|
|
5595
|
-
...Ee(),
|
|
5596
|
-
ui: "widget"
|
|
5597
|
-
});
|
|
5794
|
+
let t = await kc.startSession(Pe());
|
|
5598
5795
|
if (x || e !== E) {
|
|
5599
5796
|
t.destroy();
|
|
5600
5797
|
return;
|
|
5601
5798
|
}
|
|
5602
|
-
y = t,
|
|
5799
|
+
y = t, Ie(t);
|
|
5603
5800
|
let n = await t.attach({
|
|
5604
5801
|
container: l,
|
|
5605
5802
|
onWidgetReady: () => {
|
|
5606
|
-
x || e !== E || (C = !1, w = !0,
|
|
5803
|
+
x || e !== E || (C = !1, w = !0, I());
|
|
5607
5804
|
},
|
|
5608
5805
|
onWidgetExpand: () => {
|
|
5609
|
-
|
|
5806
|
+
Ue(e);
|
|
5610
5807
|
},
|
|
5611
5808
|
onWidgetAudioSettings: (e) => {
|
|
5612
|
-
x ||
|
|
5809
|
+
x || Je(e);
|
|
5810
|
+
},
|
|
5811
|
+
onWidgetDragStart: (e) => {
|
|
5812
|
+
x || ve(e);
|
|
5813
|
+
},
|
|
5814
|
+
onWidgetDragMove: (e) => {
|
|
5815
|
+
x || ye(e);
|
|
5816
|
+
},
|
|
5817
|
+
onWidgetDragEnd: (e) => {
|
|
5818
|
+
x || be(e);
|
|
5613
5819
|
},
|
|
5614
5820
|
onStateUpdate: (e) => {
|
|
5615
|
-
x || e === "error" &&
|
|
5821
|
+
x || e === "error" && Wc(a.dataset.state) && F("Could not load the experience.");
|
|
5616
5822
|
}
|
|
5617
5823
|
});
|
|
5618
5824
|
if (x || e !== E) {
|
|
@@ -5620,7 +5826,7 @@ function Wc(e, t) {
|
|
|
5620
5826
|
return;
|
|
5621
5827
|
}
|
|
5622
5828
|
w = !0, n.on("close", () => {
|
|
5623
|
-
x ||
|
|
5829
|
+
x || ze();
|
|
5624
5830
|
});
|
|
5625
5831
|
} catch (n) {
|
|
5626
5832
|
if (x || e !== E) return;
|
|
@@ -5629,33 +5835,42 @@ function Wc(e, t) {
|
|
|
5629
5835
|
t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
|
|
5630
5836
|
}
|
|
5631
5837
|
})();
|
|
5632
|
-
},
|
|
5633
|
-
if (x || b || !te ||
|
|
5838
|
+
}, Ge = () => {
|
|
5839
|
+
if (x || b || !te || Wc(a.dataset.state)) return;
|
|
5634
5840
|
if (y && T) {
|
|
5635
|
-
|
|
5841
|
+
R();
|
|
5636
5842
|
return;
|
|
5637
5843
|
}
|
|
5638
5844
|
if (y && w) {
|
|
5639
|
-
|
|
5845
|
+
He();
|
|
5640
5846
|
return;
|
|
5641
5847
|
}
|
|
5642
5848
|
let e = ++E;
|
|
5643
5849
|
b = !0, S = !1, C = !1, w = !1, T = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), y &&= (y.destroy(), null), (async () => {
|
|
5644
5850
|
try {
|
|
5645
|
-
|
|
5646
|
-
let t = await
|
|
5851
|
+
L();
|
|
5852
|
+
let t = await kc.startSession(Pe());
|
|
5647
5853
|
if (x || e !== E) {
|
|
5648
5854
|
t.destroy();
|
|
5649
5855
|
return;
|
|
5650
5856
|
}
|
|
5651
|
-
y = t,
|
|
5857
|
+
y = t, Ie(t);
|
|
5652
5858
|
let n = await t.attach({
|
|
5653
5859
|
container: _,
|
|
5654
5860
|
onWidgetAudioSettings: (e) => {
|
|
5655
|
-
x ||
|
|
5861
|
+
x || Je(e);
|
|
5862
|
+
},
|
|
5863
|
+
onWidgetDragStart: (e) => {
|
|
5864
|
+
x || ve(e);
|
|
5865
|
+
},
|
|
5866
|
+
onWidgetDragMove: (e) => {
|
|
5867
|
+
x || ye(e);
|
|
5868
|
+
},
|
|
5869
|
+
onWidgetDragEnd: (e) => {
|
|
5870
|
+
x || be(e);
|
|
5656
5871
|
},
|
|
5657
5872
|
onStateUpdate: (e) => {
|
|
5658
|
-
x || (e === "error" ?
|
|
5873
|
+
x || (e === "error" ? F("Could not load the experience.") : Wc(a.dataset.state) && F(null));
|
|
5659
5874
|
}
|
|
5660
5875
|
});
|
|
5661
5876
|
if (x || e !== E) {
|
|
@@ -5663,111 +5878,97 @@ function Wc(e, t) {
|
|
|
5663
5878
|
return;
|
|
5664
5879
|
}
|
|
5665
5880
|
w = !0, n.on("close", () => {
|
|
5666
|
-
x ||
|
|
5881
|
+
x || ze();
|
|
5667
5882
|
});
|
|
5668
5883
|
} catch (n) {
|
|
5669
5884
|
if (x || e !== E) return;
|
|
5670
5885
|
let r = n instanceof Error ? n : Error(String(n));
|
|
5671
|
-
|
|
5886
|
+
F(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
5672
5887
|
} finally {
|
|
5673
5888
|
e === E && (b = !1);
|
|
5674
5889
|
}
|
|
5675
5890
|
})();
|
|
5676
|
-
},
|
|
5677
|
-
if (!(x ||
|
|
5891
|
+
}, Ke = () => {
|
|
5892
|
+
if (!(x || Wc(a.dataset.state))) {
|
|
5678
5893
|
if (y && T) {
|
|
5679
|
-
|
|
5894
|
+
R();
|
|
5680
5895
|
return;
|
|
5681
5896
|
}
|
|
5682
5897
|
if (y && w) {
|
|
5683
|
-
|
|
5898
|
+
He();
|
|
5684
5899
|
return;
|
|
5685
5900
|
}
|
|
5686
|
-
|
|
5901
|
+
Ge();
|
|
5687
5902
|
}
|
|
5688
|
-
},
|
|
5689
|
-
if (e.stopPropagation(),
|
|
5690
|
-
|
|
5903
|
+
}, qe = (e) => {
|
|
5904
|
+
if (e.stopPropagation(), N() === "expanded") {
|
|
5905
|
+
Be();
|
|
5691
5906
|
return;
|
|
5692
5907
|
}
|
|
5693
|
-
|
|
5694
|
-
},
|
|
5908
|
+
N() === "docked" && Ve();
|
|
5909
|
+
}, Je = (e) => {
|
|
5695
5910
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
5696
|
-
},
|
|
5697
|
-
e.stopPropagation(),
|
|
5698
|
-
},
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
}, R = (e) => {
|
|
5704
|
-
if (ae === null || e.pointerId !== ae || j() !== "docked") return;
|
|
5705
|
-
let t = Ac(), n = Mc(e.clientX - oe, e.clientY - se, t);
|
|
5706
|
-
re = n.left, ie = n.top, N(n.left, n.top, t.width, t.height);
|
|
5707
|
-
}, He = (e) => {
|
|
5708
|
-
if (!(ae === null || e.pointerId !== ae)) {
|
|
5709
|
-
ae = null, p.classList.remove("liforma-ew__toolbar--dragging");
|
|
5710
|
-
try {
|
|
5711
|
-
p.releasePointerCapture(e.pointerId);
|
|
5712
|
-
} catch {}
|
|
5713
|
-
}
|
|
5714
|
-
}, Ue = (e) => {
|
|
5715
|
-
e.key === "Escape" && Ic(a.dataset.state) && (e.preventDefault(), P());
|
|
5716
|
-
}, We = () => {
|
|
5911
|
+
}, Ye = (e) => {
|
|
5912
|
+
e.stopPropagation(), Wc(a.dataset.state) && y?.toggleAudioSettings();
|
|
5913
|
+
}, Xe = (e) => {
|
|
5914
|
+
N() === "docked" && Vc() && (e.target?.closest("button") || (e.preventDefault(), _e(e.clientX, e.clientY, e.pointerId)));
|
|
5915
|
+
}, Ze = (e) => {
|
|
5916
|
+
e.key === "Escape" && Wc(a.dataset.state) && (e.preventDefault(), ze());
|
|
5917
|
+
}, Qe = () => {
|
|
5717
5918
|
if (!x) {
|
|
5718
|
-
if (
|
|
5719
|
-
if (!
|
|
5720
|
-
|
|
5919
|
+
if (N() === "docked") {
|
|
5920
|
+
if (!Vc()) {
|
|
5921
|
+
Ve();
|
|
5721
5922
|
return;
|
|
5722
5923
|
}
|
|
5723
|
-
T ?
|
|
5724
|
-
|
|
5725
|
-
}) :
|
|
5924
|
+
T ? Ee(() => {
|
|
5925
|
+
Ce(!0);
|
|
5926
|
+
}) : Ce(!0);
|
|
5726
5927
|
return;
|
|
5727
5928
|
}
|
|
5728
|
-
|
|
5929
|
+
xe();
|
|
5729
5930
|
}
|
|
5730
|
-
},
|
|
5931
|
+
}, $e = typeof window < "u" ? window.matchMedia(jc) : null, z = () => {
|
|
5731
5932
|
if (!x) {
|
|
5732
|
-
if (
|
|
5733
|
-
|
|
5933
|
+
if (N() === "docked" && !Vc()) {
|
|
5934
|
+
Ve();
|
|
5734
5935
|
return;
|
|
5735
5936
|
}
|
|
5736
|
-
|
|
5937
|
+
xe();
|
|
5737
5938
|
}
|
|
5738
5939
|
};
|
|
5739
|
-
return o.addEventListener("click",
|
|
5740
|
-
e.stopPropagation(),
|
|
5741
|
-
}), h.addEventListener("click",
|
|
5742
|
-
x ||
|
|
5743
|
-
}) : r === "idle" && (O =
|
|
5744
|
-
x ||
|
|
5940
|
+
return o.addEventListener("click", Ke), d.addEventListener("click", ze), ee.addEventListener("click", (e) => {
|
|
5941
|
+
e.stopPropagation(), ze();
|
|
5942
|
+
}), h.addEventListener("click", qe), g.addEventListener("click", Ye), p.addEventListener("pointerdown", Xe), window.addEventListener("keydown", Ze), window.addEventListener("resize", Qe), $e?.addEventListener("change", z), Ne(), xe(), r === "eager" ? queueMicrotask(() => {
|
|
5943
|
+
x || We();
|
|
5944
|
+
}) : r === "idle" && (O = Zc(() => {
|
|
5945
|
+
x || We();
|
|
5745
5946
|
})), {
|
|
5746
5947
|
root: a,
|
|
5747
|
-
expand:
|
|
5748
|
-
collapse:
|
|
5749
|
-
dock:
|
|
5750
|
-
maximize:
|
|
5948
|
+
expand: Ke,
|
|
5949
|
+
collapse: ze,
|
|
5950
|
+
dock: Be,
|
|
5951
|
+
maximize: Ve,
|
|
5751
5952
|
prefetch() {
|
|
5752
5953
|
if (r === "onExpand") {
|
|
5753
|
-
|
|
5954
|
+
We();
|
|
5754
5955
|
return;
|
|
5755
5956
|
}
|
|
5756
|
-
|
|
5957
|
+
We();
|
|
5757
5958
|
},
|
|
5758
5959
|
destroy() {
|
|
5759
|
-
x || (x = !0, O?.(), O = null, ce.abort(), D?.(), D = null, window.removeEventListener("keydown",
|
|
5960
|
+
x || (x = !0, ge(), O?.(), O = null, ce.abort(), D?.(), D = null, window.removeEventListener("keydown", Ze), window.removeEventListener("resize", Qe), $e?.removeEventListener("change", z), Re(), Le(), e.replaceChildren());
|
|
5760
5961
|
}
|
|
5761
5962
|
};
|
|
5762
5963
|
}
|
|
5763
5964
|
//#endregion
|
|
5764
5965
|
//#region src/react/ExperienceWidget.tsx
|
|
5765
|
-
function
|
|
5766
|
-
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, language: ee, mode: _, speechInputMode: v, speechOnly: y, fit: b, embedBaseUrl: x, expandedMaxWidth: te, expandedMaxHeight: S, startButtonLabel: C, startButton: w, className: T = "", onExpanded: E, onCollapsed: ne, onStarted: D, onClose: O, onError: k, onPrefetchReady: A } = t,
|
|
5966
|
+
function $c(t) {
|
|
5967
|
+
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, language: ee, mode: _, speechInputMode: v, speechOnly: y, fit: b, embedBaseUrl: x, expandedMaxWidth: te, expandedMaxHeight: S, startButtonLabel: C, startButton: w, className: T = "", onExpanded: E, onCollapsed: ne, onStarted: D, onClose: O, onError: k, onPrefetchReady: A } = t, j = m === "bottom-right" || m === "bottom-left";
|
|
5767
5968
|
return e(() => {
|
|
5768
5969
|
let e = r.current;
|
|
5769
5970
|
if (!e || !i.trim()) return;
|
|
5770
|
-
let t =
|
|
5971
|
+
let t = Qc(e, {
|
|
5771
5972
|
experienceId: i,
|
|
5772
5973
|
alt: o,
|
|
5773
5974
|
galleryThumb: s,
|
|
@@ -5830,7 +6031,7 @@ function Gc(t) {
|
|
|
5830
6031
|
]), /* @__PURE__ */ a("div", {
|
|
5831
6032
|
ref: r,
|
|
5832
6033
|
className: T,
|
|
5833
|
-
style:
|
|
6034
|
+
style: j ? { display: "contents" } : {
|
|
5834
6035
|
width: "100%",
|
|
5835
6036
|
height: "100%",
|
|
5836
6037
|
minHeight: "inherit"
|
|
@@ -5838,6 +6039,6 @@ function Gc(t) {
|
|
|
5838
6039
|
});
|
|
5839
6040
|
}
|
|
5840
6041
|
//#endregion
|
|
5841
|
-
export {
|
|
6042
|
+
export { xe as ExperienceThumbnail, $c as ExperienceWidget, _ as createLiformaSessionRouteHandler };
|
|
5842
6043
|
|
|
5843
6044
|
//# sourceMappingURL=index.js.map
|