@liforma/client 0.2.1
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 +28 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/next/index.js +5186 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/next/createLiformaSessionRouteHandler.d.ts +45 -0
- package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -0
- package/dist/next/next/index.d.ts +8 -0
- package/dist/next/next/index.d.ts.map +1 -0
- package/dist/next/react/ExperienceThumbnail.d.ts +22 -0
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -0
- package/dist/next/react/ExperienceWidget.d.ts +35 -0
- package/dist/next/react/ExperienceWidget.d.ts.map +1 -0
- package/dist/next/shims/apiBaseUrl.d.ts +14 -0
- package/dist/next/shims/apiBaseUrl.d.ts.map +1 -0
- package/dist/next/shims/localStack.d.ts +6 -0
- package/dist/next/shims/localStack.d.ts.map +1 -0
- package/dist/next/thumbnail/attachThumbnailParallax.d.ts +7 -0
- package/dist/next/thumbnail/attachThumbnailParallax.d.ts.map +1 -0
- package/dist/next/thumbnail/ensureStyles.d.ts +3 -0
- package/dist/next/thumbnail/ensureStyles.d.ts.map +1 -0
- package/dist/next/thumbnail/hostedLaunchUrl.d.ts +23 -0
- package/dist/next/thumbnail/hostedLaunchUrl.d.ts.map +1 -0
- package/dist/next/thumbnail/index.d.ts +9 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -0
- package/dist/next/thumbnail/lazyLoad.d.ts +8 -0
- package/dist/next/thumbnail/lazyLoad.d.ts.map +1 -0
- package/dist/next/thumbnail/scrollParallax.d.ts +13 -0
- package/dist/next/thumbnail/scrollParallax.d.ts.map +1 -0
- package/dist/next/thumbnail/styles.d.ts +3 -0
- package/dist/next/thumbnail/styles.d.ts.map +1 -0
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +23 -0
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -0
- package/dist/next/thumbnail/toGalleryThumbUrl.test.d.ts +2 -0
- package/dist/next/thumbnail/toGalleryThumbUrl.test.d.ts.map +1 -0
- package/dist/next/thumbnail/types.d.ts +37 -0
- package/dist/next/thumbnail/types.d.ts.map +1 -0
- package/dist/next/v2/api/fetchExperiencePreview.d.ts +15 -0
- package/dist/next/v2/api/fetchExperiencePreview.d.ts.map +1 -0
- package/dist/next/v2/api/mintPublicSession.d.ts +25 -0
- package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -0
- package/dist/next/v2/api/sessionEndpointRequest.d.ts +16 -0
- package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -0
- package/dist/next/v2/conversationProcessor.d.ts +6 -0
- package/dist/next/v2/conversationProcessor.d.ts.map +1 -0
- package/dist/next/v2/embed/iframeHost.d.ts +70 -0
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -0
- package/dist/next/v2/embed/playerReachability.d.ts +4 -0
- package/dist/next/v2/embed/playerReachability.d.ts.map +1 -0
- package/dist/next/v2/embed/protocol.d.ts +181 -0
- package/dist/next/v2/embed/protocol.d.ts.map +1 -0
- package/dist/next/v2/embed/readyGate.d.ts +7 -0
- package/dist/next/v2/embed/readyGate.d.ts.map +1 -0
- package/dist/next/v2/experience.d.ts +133 -0
- package/dist/next/v2/experience.d.ts.map +1 -0
- package/dist/next/v2/experienceEvents.d.ts +27 -0
- package/dist/next/v2/experienceEvents.d.ts.map +1 -0
- package/dist/next/v2/shims/embedBaseUrl.d.ts +19 -0
- package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -0
- package/dist/next/v2/speechOnlyManifest.d.ts +7 -0
- package/dist/next/v2/speechOnlyManifest.d.ts.map +1 -0
- package/dist/next/v2/types/sessionInteraction.d.ts +120 -0
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -0
- package/dist/next/v2/types/sessionManifest.d.ts +93 -0
- package/dist/next/v2/types/sessionManifest.d.ts.map +1 -0
- package/dist/next/v2/types/sessionManifestSchema.d.ts +183 -0
- package/dist/next/v2/types/sessionManifestSchema.d.ts.map +1 -0
- package/dist/next/v2/types/sessionPipeline.d.ts +23 -0
- package/dist/next/v2/types/sessionPipeline.d.ts.map +1 -0
- package/dist/next/widget/dockGeometry.d.ts +26 -0
- package/dist/next/widget/dockGeometry.d.ts.map +1 -0
- package/dist/next/widget/index.d.ts +5 -0
- package/dist/next/widget/index.d.ts.map +1 -0
- package/dist/next/widget/mountExperienceWidget.d.ts +13 -0
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -0
- package/dist/next/widget/styles.d.ts +4 -0
- package/dist/next/widget/styles.d.ts.map +1 -0
- package/dist/next/widget/types.d.ts +62 -0
- package/dist/next/widget/types.d.ts.map +1 -0
- package/dist/npm/index.js +4859 -0
- package/dist/npm/index.js.map +1 -0
- package/dist/npm/shims/apiBaseUrl.d.ts +14 -0
- package/dist/npm/shims/apiBaseUrl.d.ts.map +1 -0
- package/dist/npm/shims/localStack.d.ts +6 -0
- package/dist/npm/shims/localStack.d.ts.map +1 -0
- package/dist/npm/svelte/experienceLoadError.d.ts +16 -0
- package/dist/npm/svelte/experienceLoadError.d.ts.map +1 -0
- package/dist/npm/svelte/experienceLoadErrorOverlay.d.ts +8 -0
- package/dist/npm/svelte/experienceLoadErrorOverlay.d.ts.map +1 -0
- package/dist/npm/svelte/experienceLoadErrorStyles.d.ts +5 -0
- package/dist/npm/svelte/experienceLoadErrorStyles.d.ts.map +1 -0
- package/dist/npm/thumbnail/attachThumbnailParallax.d.ts +7 -0
- package/dist/npm/thumbnail/attachThumbnailParallax.d.ts.map +1 -0
- package/dist/npm/thumbnail/ensureStyles.d.ts +3 -0
- package/dist/npm/thumbnail/ensureStyles.d.ts.map +1 -0
- package/dist/npm/thumbnail/hostedLaunchUrl.d.ts +23 -0
- package/dist/npm/thumbnail/hostedLaunchUrl.d.ts.map +1 -0
- package/dist/npm/thumbnail/index.d.ts +9 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -0
- package/dist/npm/thumbnail/lazyLoad.d.ts +8 -0
- package/dist/npm/thumbnail/lazyLoad.d.ts.map +1 -0
- package/dist/npm/thumbnail/scrollParallax.d.ts +13 -0
- package/dist/npm/thumbnail/scrollParallax.d.ts.map +1 -0
- package/dist/npm/thumbnail/styles.d.ts +3 -0
- package/dist/npm/thumbnail/styles.d.ts.map +1 -0
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +23 -0
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -0
- package/dist/npm/thumbnail/types.d.ts +37 -0
- package/dist/npm/thumbnail/types.d.ts.map +1 -0
- package/dist/npm/v2/api/fetchExperiencePreview.d.ts +15 -0
- package/dist/npm/v2/api/fetchExperiencePreview.d.ts.map +1 -0
- package/dist/npm/v2/api/mintPublicSession.d.ts +25 -0
- package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -0
- package/dist/npm/v2/api/sessionEndpointRequest.d.ts +16 -0
- package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -0
- package/dist/npm/v2/conversationProcessor.d.ts +6 -0
- package/dist/npm/v2/conversationProcessor.d.ts.map +1 -0
- package/dist/npm/v2/embed/iframeHost.d.ts +70 -0
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -0
- package/dist/npm/v2/embed/playerReachability.d.ts +4 -0
- package/dist/npm/v2/embed/playerReachability.d.ts.map +1 -0
- package/dist/npm/v2/embed/protocol.d.ts +181 -0
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -0
- package/dist/npm/v2/embed/readyGate.d.ts +7 -0
- package/dist/npm/v2/embed/readyGate.d.ts.map +1 -0
- package/dist/npm/v2/embed/returnNavigation.d.ts +4 -0
- package/dist/npm/v2/embed/returnNavigation.d.ts.map +1 -0
- package/dist/npm/v2/experience.d.ts +133 -0
- package/dist/npm/v2/experience.d.ts.map +1 -0
- package/dist/npm/v2/experienceEvents.d.ts +27 -0
- package/dist/npm/v2/experienceEvents.d.ts.map +1 -0
- package/dist/npm/v2/index.d.ts +21 -0
- package/dist/npm/v2/index.d.ts.map +1 -0
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts +9 -0
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -0
- package/dist/npm/v2/liforma-experience-widget.d.ts +8 -0
- package/dist/npm/v2/liforma-experience-widget.d.ts.map +1 -0
- package/dist/npm/v2/liforma-experience.d.ts +15 -0
- package/dist/npm/v2/liforma-experience.d.ts.map +1 -0
- package/dist/npm/v2/npm.d.ts +10 -0
- package/dist/npm/v2/npm.d.ts.map +1 -0
- package/dist/npm/v2/shims/embedBaseUrl.d.ts +19 -0
- package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -0
- package/dist/npm/v2/speechOnlyManifest.d.ts +7 -0
- package/dist/npm/v2/speechOnlyManifest.d.ts.map +1 -0
- package/dist/npm/v2/types/index.d.ts +3 -0
- package/dist/npm/v2/types/index.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts +120 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionManifest.d.ts +93 -0
- package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionManifestSchema.d.ts +183 -0
- package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionPipeline.d.ts +23 -0
- package/dist/npm/v2/types/sessionPipeline.d.ts.map +1 -0
- package/dist/npm/widget/dockGeometry.d.ts +26 -0
- package/dist/npm/widget/dockGeometry.d.ts.map +1 -0
- package/dist/npm/widget/index.d.ts +5 -0
- package/dist/npm/widget/index.d.ts.map +1 -0
- package/dist/npm/widget/mountExperienceWidget.d.ts +13 -0
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -0
- package/dist/npm/widget/styles.d.ts +4 -0
- package/dist/npm/widget/styles.d.ts.map +1 -0
- package/dist/npm/widget/types.d.ts +62 -0
- package/dist/npm/widget/types.d.ts.map +1 -0
- package/dist/react/component/experienceComponentLaunch.d.ts +7 -0
- package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -0
- package/dist/react/component/experienceComponentRuntime.d.ts +55 -0
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -0
- package/dist/react/component/experienceComponentTypes.d.ts +60 -0
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -0
- package/dist/react/index.js +5499 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/react/Experience.d.ts +4 -0
- package/dist/react/react/Experience.d.ts.map +1 -0
- package/dist/react/react/ExperienceThumbnail.d.ts +22 -0
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -0
- package/dist/react/react/ExperienceWidget.d.ts +35 -0
- package/dist/react/react/ExperienceWidget.d.ts.map +1 -0
- package/dist/react/react/index.d.ts +8 -0
- package/dist/react/react/index.d.ts.map +1 -0
- package/dist/react/shims/apiBaseUrl.d.ts +14 -0
- package/dist/react/shims/apiBaseUrl.d.ts.map +1 -0
- package/dist/react/shims/localStack.d.ts +6 -0
- package/dist/react/shims/localStack.d.ts.map +1 -0
- package/dist/react/svelte/experienceLoadError.d.ts +16 -0
- package/dist/react/svelte/experienceLoadError.d.ts.map +1 -0
- package/dist/react/svelte/experienceLoadErrorOverlay.d.ts +8 -0
- package/dist/react/svelte/experienceLoadErrorOverlay.d.ts.map +1 -0
- package/dist/react/svelte/experienceLoadErrorStyles.d.ts +5 -0
- package/dist/react/svelte/experienceLoadErrorStyles.d.ts.map +1 -0
- package/dist/react/thumbnail/attachThumbnailParallax.d.ts +7 -0
- package/dist/react/thumbnail/attachThumbnailParallax.d.ts.map +1 -0
- package/dist/react/thumbnail/ensureStyles.d.ts +3 -0
- package/dist/react/thumbnail/ensureStyles.d.ts.map +1 -0
- package/dist/react/thumbnail/hostedLaunchUrl.d.ts +23 -0
- package/dist/react/thumbnail/hostedLaunchUrl.d.ts.map +1 -0
- package/dist/react/thumbnail/index.d.ts +9 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -0
- package/dist/react/thumbnail/lazyLoad.d.ts +8 -0
- package/dist/react/thumbnail/lazyLoad.d.ts.map +1 -0
- package/dist/react/thumbnail/scrollParallax.d.ts +13 -0
- package/dist/react/thumbnail/scrollParallax.d.ts.map +1 -0
- package/dist/react/thumbnail/styles.d.ts +3 -0
- package/dist/react/thumbnail/styles.d.ts.map +1 -0
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +23 -0
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -0
- package/dist/react/thumbnail/toGalleryThumbUrl.test.d.ts +2 -0
- package/dist/react/thumbnail/toGalleryThumbUrl.test.d.ts.map +1 -0
- package/dist/react/thumbnail/types.d.ts +37 -0
- package/dist/react/thumbnail/types.d.ts.map +1 -0
- package/dist/react/v2/api/fetchExperiencePreview.d.ts +15 -0
- package/dist/react/v2/api/fetchExperiencePreview.d.ts.map +1 -0
- package/dist/react/v2/api/mintPublicSession.d.ts +25 -0
- package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -0
- package/dist/react/v2/api/sessionEndpointRequest.d.ts +16 -0
- package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -0
- package/dist/react/v2/conversationProcessor.d.ts +6 -0
- package/dist/react/v2/conversationProcessor.d.ts.map +1 -0
- package/dist/react/v2/embed/iframeHost.d.ts +70 -0
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -0
- package/dist/react/v2/embed/playerReachability.d.ts +4 -0
- package/dist/react/v2/embed/playerReachability.d.ts.map +1 -0
- package/dist/react/v2/embed/protocol.d.ts +181 -0
- package/dist/react/v2/embed/protocol.d.ts.map +1 -0
- package/dist/react/v2/embed/readyGate.d.ts +7 -0
- package/dist/react/v2/embed/readyGate.d.ts.map +1 -0
- package/dist/react/v2/experience.d.ts +133 -0
- package/dist/react/v2/experience.d.ts.map +1 -0
- package/dist/react/v2/experienceEvents.d.ts +27 -0
- package/dist/react/v2/experienceEvents.d.ts.map +1 -0
- package/dist/react/v2/shims/embedBaseUrl.d.ts +19 -0
- package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -0
- package/dist/react/v2/speechOnlyManifest.d.ts +7 -0
- package/dist/react/v2/speechOnlyManifest.d.ts.map +1 -0
- package/dist/react/v2/types/sessionInteraction.d.ts +120 -0
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -0
- package/dist/react/v2/types/sessionManifest.d.ts +93 -0
- package/dist/react/v2/types/sessionManifest.d.ts.map +1 -0
- package/dist/react/v2/types/sessionManifestSchema.d.ts +183 -0
- package/dist/react/v2/types/sessionManifestSchema.d.ts.map +1 -0
- package/dist/react/v2/types/sessionPipeline.d.ts +23 -0
- package/dist/react/v2/types/sessionPipeline.d.ts.map +1 -0
- package/dist/react/widget/dockGeometry.d.ts +26 -0
- package/dist/react/widget/dockGeometry.d.ts.map +1 -0
- package/dist/react/widget/index.d.ts +5 -0
- package/dist/react/widget/index.d.ts.map +1 -0
- package/dist/react/widget/mountExperienceWidget.d.ts +13 -0
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -0
- package/dist/react/widget/styles.d.ts +4 -0
- package/dist/react/widget/styles.d.ts.map +1 -0
- package/dist/react/widget/types.d.ts +62 -0
- package/dist/react/widget/types.d.ts.map +1 -0
- package/dist/sdk/v2/client.js +806 -0
- package/dist/sdk/v2/client.js.map +1 -0
- package/dist/svelte/Experience.svelte +522 -0
- package/dist/svelte/Experience.svelte.d.ts +15 -0
- package/dist/svelte/ExperienceThumbnail.svelte +376 -0
- package/dist/svelte/ExperienceThumbnail.svelte.d.ts +22 -0
- package/dist/svelte/ExperienceWidget.svelte +146 -0
- package/dist/svelte/ExperienceWidget.svelte.d.ts +35 -0
- package/dist/svelte/experienceLoadError.d.ts +15 -0
- package/dist/svelte/experienceLoadError.js +82 -0
- package/dist/svelte/experienceLoadError.test.d.ts +1 -0
- package/dist/svelte/experienceLoadError.test.js +18 -0
- package/dist/svelte/experienceLoadErrorOverlay.d.ts +7 -0
- package/dist/svelte/experienceLoadErrorOverlay.js +48 -0
- package/dist/svelte/experienceLoadErrorStyles.d.ts +4 -0
- package/dist/svelte/experienceLoadErrorStyles.js +112 -0
- package/dist/svelte/index.d.ts +7 -0
- package/dist/svelte/index.js +5 -0
- package/dist/svelte/types.d.ts +1 -0
- package/dist/svelte/types.js +1 -0
- package/package.json +154 -0
|
@@ -0,0 +1,4859 @@
|
|
|
1
|
+
//#region src/v2/embed/returnNavigation.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = e.trim();
|
|
4
|
+
if (!n) return null;
|
|
5
|
+
if (/^https?:\/\//i.test(n)) try {
|
|
6
|
+
return new URL(n);
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
let r = t.replace(/\/$/, ""), i = n.startsWith("/") ? n : `/${n}`;
|
|
11
|
+
try {
|
|
12
|
+
return new URL(i, `${r}/`);
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function t(e) {
|
|
18
|
+
try {
|
|
19
|
+
if (document.referrer) {
|
|
20
|
+
let e = new URL(document.referrer);
|
|
21
|
+
if (e.origin === window.location.origin && e.pathname !== window.location.pathname) return `${e.pathname}${e.search}${e.hash}`;
|
|
22
|
+
}
|
|
23
|
+
} catch {}
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
function n(n, r = "/meet") {
|
|
27
|
+
if (n.reason !== "user") return;
|
|
28
|
+
let i = e(n.returnUrl?.trim() || t(r), window.location.origin);
|
|
29
|
+
i?.protocol.startsWith("http") && window.location.assign(i.toString());
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
33
|
+
var r = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, i = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
34
|
+
function a(e) {
|
|
35
|
+
let t = e.trim();
|
|
36
|
+
if (!t) return t;
|
|
37
|
+
let n = t.replace(r, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
|
|
38
|
+
return n = n.replace(i, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
|
|
39
|
+
}
|
|
40
|
+
function o(e) {
|
|
41
|
+
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
42
|
+
if (!t) return null;
|
|
43
|
+
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
|
|
44
|
+
return {
|
|
45
|
+
avatarImage: a(t),
|
|
46
|
+
...n ? { backgroundImage: a(n) } : {},
|
|
47
|
+
...r ? { foregroundImage: a(r) } : {},
|
|
48
|
+
...i ? { fallbackImage: a(i) } : {}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/shims/localStack.ts
|
|
53
|
+
function s() {
|
|
54
|
+
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
55
|
+
if (typeof location > "u") return !1;
|
|
56
|
+
try {
|
|
57
|
+
return new URLSearchParams(location.search).get("stack") === "local";
|
|
58
|
+
} catch {
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
64
|
+
var c = "https://player.liforma.ai", l = "http://localhost:3002";
|
|
65
|
+
function u(e) {
|
|
66
|
+
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
67
|
+
}
|
|
68
|
+
function d(e) {
|
|
69
|
+
let t = e?.trim();
|
|
70
|
+
return t ? t.replace(/\/$/, "") : s() ? l : c;
|
|
71
|
+
}
|
|
72
|
+
function f(e) {
|
|
73
|
+
let t = e.experienceId.trim(), n = d(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
74
|
+
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
75
|
+
}
|
|
76
|
+
function p(e) {
|
|
77
|
+
let t = e.href?.trim();
|
|
78
|
+
if (t) return t;
|
|
79
|
+
let n = e.experienceId?.trim();
|
|
80
|
+
if (!n) return;
|
|
81
|
+
let r = e.returnUrl?.trim();
|
|
82
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), f({
|
|
83
|
+
experienceId: n,
|
|
84
|
+
...r ? { returnUrl: r } : {},
|
|
85
|
+
playerBaseUrl: e.playerBaseUrl
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/thumbnail/lazyLoad.ts
|
|
90
|
+
function ee(e, t) {
|
|
91
|
+
let { rootMargin: n = "280px 0px", onVisibleChange: r } = t, i = !1;
|
|
92
|
+
if (typeof IntersectionObserver > "u") return r(!0), () => {};
|
|
93
|
+
let a = new IntersectionObserver((e) => {
|
|
94
|
+
let t = e.some((e) => e.isIntersecting);
|
|
95
|
+
t !== i && (i = t, r(i));
|
|
96
|
+
}, {
|
|
97
|
+
root: null,
|
|
98
|
+
rootMargin: n,
|
|
99
|
+
threshold: 0
|
|
100
|
+
});
|
|
101
|
+
a.observe(e);
|
|
102
|
+
let o = e.getBoundingClientRect();
|
|
103
|
+
return typeof window < "u" && o.bottom >= -280 && o.top <= window.innerHeight + 280 && (i = !0, r(!0)), () => a.disconnect();
|
|
104
|
+
}
|
|
105
|
+
function m(e, t) {
|
|
106
|
+
let n = () => t();
|
|
107
|
+
return e.complete ? queueMicrotask(n) : (e.addEventListener("load", n, { once: !0 }), e.addEventListener("error", n, { once: !0 })), () => {
|
|
108
|
+
e.removeEventListener("load", n), e.removeEventListener("error", n);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/thumbnail/scrollParallax.ts
|
|
113
|
+
function h() {
|
|
114
|
+
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
115
|
+
}
|
|
116
|
+
function g(e, t) {
|
|
117
|
+
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
118
|
+
}
|
|
119
|
+
function te(e, t) {
|
|
120
|
+
if (!h()) return () => {};
|
|
121
|
+
let n = 0, r = () => {
|
|
122
|
+
n = 0, !t.pointerActive?.() && t.onParallax(g(e.getBoundingClientRect(), window.innerHeight));
|
|
123
|
+
}, i = () => {
|
|
124
|
+
n === 0 && (n = requestAnimationFrame(r));
|
|
125
|
+
};
|
|
126
|
+
return r(), window.addEventListener("scroll", i, { passive: !0 }), window.addEventListener("resize", i, { passive: !0 }), () => {
|
|
127
|
+
n !== 0 && cancelAnimationFrame(n), window.removeEventListener("scroll", i), window.removeEventListener("resize", i);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
132
|
+
function _(e) {
|
|
133
|
+
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
134
|
+
let a = r || i;
|
|
135
|
+
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));
|
|
136
|
+
}, s = te(e, {
|
|
137
|
+
onParallax: (e) => {
|
|
138
|
+
i = !0, a || (t = e, n = 0, o());
|
|
139
|
+
},
|
|
140
|
+
pointerActive: () => a
|
|
141
|
+
}), c = (r) => {
|
|
142
|
+
if (i) return;
|
|
143
|
+
let a = e.getBoundingClientRect();
|
|
144
|
+
a.width <= 0 || a.height <= 0 || (t = ((r.clientX - a.left) / a.width - .5) * 2, n = ((r.clientY - a.top) / a.height - .5) * 2, o());
|
|
145
|
+
}, l = (e) => {
|
|
146
|
+
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
147
|
+
}, u = () => {
|
|
148
|
+
let s = a;
|
|
149
|
+
a = !1, r = !1, i && s ? (t = g(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
150
|
+
}, d = (e) => {
|
|
151
|
+
e.pointerType === "mouse" && (r = !0, o());
|
|
152
|
+
}, f = () => {
|
|
153
|
+
a || (r = !1, i || (t = 0, n = 0), o());
|
|
154
|
+
};
|
|
155
|
+
return e.addEventListener("pointermove", c), e.addEventListener("pointerdown", l), e.addEventListener("pointerup", u), e.addEventListener("pointercancel", u), e.addEventListener("pointerenter", d), e.addEventListener("pointerleave", f), () => {
|
|
156
|
+
s(), e.removeEventListener("pointermove", c), e.removeEventListener("pointerdown", l), e.removeEventListener("pointerup", u), e.removeEventListener("pointercancel", u), e.removeEventListener("pointerenter", d), e.removeEventListener("pointerleave", f), e.classList.remove("liforma-et--parallax", "liforma-et--scroll-parallax"), e.style.removeProperty("--liforma-et-parallax-x"), e.style.removeProperty("--liforma-et-parallax-y");
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/thumbnail/styles.ts
|
|
161
|
+
var v = ".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 will-change: transform;\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 will-change: transform;\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 will-change: transform;\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.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}", y = !1;
|
|
162
|
+
function b(e) {
|
|
163
|
+
if (typeof document > "u" || y) return;
|
|
164
|
+
if (document.querySelector("style[data-liforma-et]")) {
|
|
165
|
+
y = !0;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let t = document.createElement("style");
|
|
169
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), y = !0;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/widget/styles.ts
|
|
173
|
+
var ne = "\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", re = "liforma-experience-widget-styles";
|
|
174
|
+
function ie(e = ne) {
|
|
175
|
+
if (typeof document > "u") return;
|
|
176
|
+
let t = document.getElementById(re);
|
|
177
|
+
if (t) {
|
|
178
|
+
t.textContent = e;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let n = document.createElement("style");
|
|
182
|
+
n.id = re, n.textContent = e, document.head.append(n);
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/shims/apiBaseUrl.ts
|
|
186
|
+
var x = "https://api.liforma.ai", ae = "http://localhost:3001";
|
|
187
|
+
function S() {
|
|
188
|
+
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
189
|
+
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
190
|
+
if (typeof document > "u") return null;
|
|
191
|
+
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();
|
|
192
|
+
return t ? t.replace(/\/$/, "") : null;
|
|
193
|
+
}
|
|
194
|
+
function C() {
|
|
195
|
+
return S() || (s() ? ae : x);
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/v2/api/fetchExperiencePreview.ts
|
|
199
|
+
function w(e) {
|
|
200
|
+
if (!e || typeof e != "object") return null;
|
|
201
|
+
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
202
|
+
return n ? {
|
|
203
|
+
avatarImage: n,
|
|
204
|
+
...typeof t.backgroundImage == "string" && t.backgroundImage.trim() ? { backgroundImage: t.backgroundImage.trim() } : {},
|
|
205
|
+
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
206
|
+
} : null;
|
|
207
|
+
}
|
|
208
|
+
async function oe(e, t) {
|
|
209
|
+
let n = e.trim();
|
|
210
|
+
if (!n) throw Error("Experience preview requires experienceId.");
|
|
211
|
+
let r = (t?.apiBaseUrl ?? C()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
212
|
+
method: "GET",
|
|
213
|
+
headers: { Accept: "application/json" },
|
|
214
|
+
signal: t?.signal
|
|
215
|
+
});
|
|
216
|
+
if (!i.ok) {
|
|
217
|
+
let e = `Experience preview failed (${i.status})`;
|
|
218
|
+
try {
|
|
219
|
+
let t = await i.json();
|
|
220
|
+
t.message?.trim() && (e = t.message.trim());
|
|
221
|
+
} catch {}
|
|
222
|
+
throw Error(e);
|
|
223
|
+
}
|
|
224
|
+
let a;
|
|
225
|
+
try {
|
|
226
|
+
a = await i.json();
|
|
227
|
+
} catch {
|
|
228
|
+
throw Error("Experience preview returned invalid JSON.");
|
|
229
|
+
}
|
|
230
|
+
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
231
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = w(o.galleryThumb);
|
|
232
|
+
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
233
|
+
return {
|
|
234
|
+
experienceId: s || n,
|
|
235
|
+
title: c || s || n,
|
|
236
|
+
galleryThumb: l
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/v2/api/sessionEndpointRequest.ts
|
|
241
|
+
function se(e, t) {
|
|
242
|
+
let n = e.trim();
|
|
243
|
+
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
244
|
+
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
245
|
+
let r = new URL(n, location.href);
|
|
246
|
+
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
247
|
+
let i = t.experienceId.trim();
|
|
248
|
+
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
249
|
+
return {
|
|
250
|
+
url: r.toString(),
|
|
251
|
+
init: {
|
|
252
|
+
method: "POST",
|
|
253
|
+
credentials: "same-origin",
|
|
254
|
+
headers: {
|
|
255
|
+
Accept: "application/json",
|
|
256
|
+
"Content-Type": "application/json"
|
|
257
|
+
},
|
|
258
|
+
body: JSON.stringify({
|
|
259
|
+
experienceId: i,
|
|
260
|
+
...t.language ? { language: t.language } : {},
|
|
261
|
+
...t.mode ? { mode: t.mode } : {},
|
|
262
|
+
...t.responseMode ? { responseMode: t.responseMode } : {},
|
|
263
|
+
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
264
|
+
...t.startButton ? { startButton: t.startButton } : {},
|
|
265
|
+
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly }
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region node_modules/zod/v4/core/core.js
|
|
272
|
+
var ce;
|
|
273
|
+
function T(e, t, n) {
|
|
274
|
+
function r(n, r) {
|
|
275
|
+
if (n._zod || Object.defineProperty(n, "_zod", {
|
|
276
|
+
value: {
|
|
277
|
+
def: r,
|
|
278
|
+
constr: o,
|
|
279
|
+
traits: /* @__PURE__ */ new Set()
|
|
280
|
+
},
|
|
281
|
+
enumerable: !1
|
|
282
|
+
}), n._zod.traits.has(e)) return;
|
|
283
|
+
n._zod.traits.add(e), t(n, r);
|
|
284
|
+
let i = o.prototype, a = Object.keys(i);
|
|
285
|
+
for (let e = 0; e < a.length; e++) {
|
|
286
|
+
let t = a[e];
|
|
287
|
+
t in n || (n[t] = i[t].bind(n));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
let i = n?.Parent ?? Object;
|
|
291
|
+
class a extends i {}
|
|
292
|
+
Object.defineProperty(a, "name", { value: e });
|
|
293
|
+
function o(e) {
|
|
294
|
+
var t;
|
|
295
|
+
let i = n?.Parent ? new a() : this;
|
|
296
|
+
r(i, e), (t = i._zod).deferred ?? (t.deferred = []);
|
|
297
|
+
for (let e of i._zod.deferred) e();
|
|
298
|
+
return i;
|
|
299
|
+
}
|
|
300
|
+
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;
|
|
301
|
+
}
|
|
302
|
+
var E = class extends Error {
|
|
303
|
+
constructor() {
|
|
304
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
305
|
+
}
|
|
306
|
+
}, le = class extends Error {
|
|
307
|
+
constructor(e) {
|
|
308
|
+
super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
(ce = globalThis).__zod_globalConfig ?? (ce.__zod_globalConfig = {});
|
|
312
|
+
var D = globalThis.__zod_globalConfig;
|
|
313
|
+
function O(e) {
|
|
314
|
+
return e && Object.assign(D, e), D;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region node_modules/zod/v4/core/util.js
|
|
318
|
+
function ue(e) {
|
|
319
|
+
let t = Object.values(e).filter((e) => typeof e == "number");
|
|
320
|
+
return Object.entries(e).filter(([e, n]) => t.indexOf(+e) === -1).map(([e, t]) => t);
|
|
321
|
+
}
|
|
322
|
+
function de(e, t) {
|
|
323
|
+
return typeof t == "bigint" ? t.toString() : t;
|
|
324
|
+
}
|
|
325
|
+
function fe(e) {
|
|
326
|
+
return { get value() {
|
|
327
|
+
{
|
|
328
|
+
let t = e();
|
|
329
|
+
return Object.defineProperty(this, "value", { value: t }), t;
|
|
330
|
+
}
|
|
331
|
+
throw Error("cached value already set");
|
|
332
|
+
} };
|
|
333
|
+
}
|
|
334
|
+
function pe(e) {
|
|
335
|
+
return e == null;
|
|
336
|
+
}
|
|
337
|
+
function me(e) {
|
|
338
|
+
let t = +!!e.startsWith("^"), n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
339
|
+
return e.slice(t, n);
|
|
340
|
+
}
|
|
341
|
+
function k(e, t) {
|
|
342
|
+
let n = e / t, r = Math.round(n), i = 2 ** -52 * Math.max(Math.abs(n), 1);
|
|
343
|
+
return Math.abs(n - r) < i ? 0 : n - r;
|
|
344
|
+
}
|
|
345
|
+
var he = /* @__PURE__*/ Symbol("evaluating");
|
|
346
|
+
function A(e, t, n) {
|
|
347
|
+
let r;
|
|
348
|
+
Object.defineProperty(e, t, {
|
|
349
|
+
get() {
|
|
350
|
+
if (r !== he) return r === void 0 && (r = he, r = n()), r;
|
|
351
|
+
},
|
|
352
|
+
set(n) {
|
|
353
|
+
Object.defineProperty(e, t, { value: n });
|
|
354
|
+
},
|
|
355
|
+
configurable: !0
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function j(e, t, n) {
|
|
359
|
+
Object.defineProperty(e, t, {
|
|
360
|
+
value: n,
|
|
361
|
+
writable: !0,
|
|
362
|
+
enumerable: !0,
|
|
363
|
+
configurable: !0
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function M(...e) {
|
|
367
|
+
let t = {};
|
|
368
|
+
for (let n of e) Object.assign(t, Object.getOwnPropertyDescriptors(n));
|
|
369
|
+
return Object.defineProperties({}, t);
|
|
370
|
+
}
|
|
371
|
+
function N(e) {
|
|
372
|
+
return JSON.stringify(e);
|
|
373
|
+
}
|
|
374
|
+
function ge(e) {
|
|
375
|
+
return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
376
|
+
}
|
|
377
|
+
var _e = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {};
|
|
378
|
+
function ve(e) {
|
|
379
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
380
|
+
}
|
|
381
|
+
var ye = /* @__PURE__*/ fe(() => {
|
|
382
|
+
if (D.jitless || typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
|
|
383
|
+
try {
|
|
384
|
+
return Function(""), !0;
|
|
385
|
+
} catch {
|
|
386
|
+
return !1;
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
function be(e) {
|
|
390
|
+
if (ve(e) === !1) return !1;
|
|
391
|
+
let t = e.constructor;
|
|
392
|
+
if (t === void 0 || typeof t != "function") return !0;
|
|
393
|
+
let n = t.prototype;
|
|
394
|
+
return !(ve(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
395
|
+
}
|
|
396
|
+
function P(e) {
|
|
397
|
+
return be(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e;
|
|
398
|
+
}
|
|
399
|
+
var xe = /* @__PURE__*/ new Set([
|
|
400
|
+
"string",
|
|
401
|
+
"number",
|
|
402
|
+
"symbol"
|
|
403
|
+
]);
|
|
404
|
+
function F(e) {
|
|
405
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
406
|
+
}
|
|
407
|
+
function I(e, t, n) {
|
|
408
|
+
let r = new e._zod.constr(t ?? e._zod.def);
|
|
409
|
+
return (!t || n?.parent) && (r._zod.parent = e), r;
|
|
410
|
+
}
|
|
411
|
+
function L(e) {
|
|
412
|
+
let t = e;
|
|
413
|
+
if (!t) return {};
|
|
414
|
+
if (typeof t == "string") return { error: () => t };
|
|
415
|
+
if (t?.message !== void 0) {
|
|
416
|
+
if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
|
|
417
|
+
t.error = t.message;
|
|
418
|
+
}
|
|
419
|
+
return delete t.message, typeof t.error == "string" ? {
|
|
420
|
+
...t,
|
|
421
|
+
error: () => t.error
|
|
422
|
+
} : t;
|
|
423
|
+
}
|
|
424
|
+
function Se(e) {
|
|
425
|
+
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
426
|
+
}
|
|
427
|
+
var Ce = {
|
|
428
|
+
safeint: [-(2 ** 53 - 1), 2 ** 53 - 1],
|
|
429
|
+
int32: [-2147483648, 2147483647],
|
|
430
|
+
uint32: [0, 4294967295],
|
|
431
|
+
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
432
|
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
433
|
+
};
|
|
434
|
+
function we(e, t) {
|
|
435
|
+
let n = e._zod.def, r = n.checks;
|
|
436
|
+
if (r && r.length > 0) throw Error(".pick() cannot be used on object schemas containing refinements");
|
|
437
|
+
return I(e, M(e._zod.def, {
|
|
438
|
+
get shape() {
|
|
439
|
+
let e = {};
|
|
440
|
+
for (let r in t) {
|
|
441
|
+
if (!(r in n.shape)) throw Error(`Unrecognized key: "${r}"`);
|
|
442
|
+
t[r] && (e[r] = n.shape[r]);
|
|
443
|
+
}
|
|
444
|
+
return j(this, "shape", e), e;
|
|
445
|
+
},
|
|
446
|
+
checks: []
|
|
447
|
+
}));
|
|
448
|
+
}
|
|
449
|
+
function Te(e, t) {
|
|
450
|
+
let n = e._zod.def, r = n.checks;
|
|
451
|
+
if (r && r.length > 0) throw Error(".omit() cannot be used on object schemas containing refinements");
|
|
452
|
+
return I(e, M(e._zod.def, {
|
|
453
|
+
get shape() {
|
|
454
|
+
let r = { ...e._zod.def.shape };
|
|
455
|
+
for (let e in t) {
|
|
456
|
+
if (!(e in n.shape)) throw Error(`Unrecognized key: "${e}"`);
|
|
457
|
+
t[e] && delete r[e];
|
|
458
|
+
}
|
|
459
|
+
return j(this, "shape", r), r;
|
|
460
|
+
},
|
|
461
|
+
checks: []
|
|
462
|
+
}));
|
|
463
|
+
}
|
|
464
|
+
function Ee(e, t) {
|
|
465
|
+
if (!be(t)) throw Error("Invalid input to extend: expected a plain object");
|
|
466
|
+
let n = e._zod.def.checks;
|
|
467
|
+
if (n && n.length > 0) {
|
|
468
|
+
let n = e._zod.def.shape;
|
|
469
|
+
for (let e in t) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
470
|
+
}
|
|
471
|
+
return I(e, M(e._zod.def, { get shape() {
|
|
472
|
+
let n = {
|
|
473
|
+
...e._zod.def.shape,
|
|
474
|
+
...t
|
|
475
|
+
};
|
|
476
|
+
return j(this, "shape", n), n;
|
|
477
|
+
} }));
|
|
478
|
+
}
|
|
479
|
+
function De(e, t) {
|
|
480
|
+
if (!be(t)) throw Error("Invalid input to safeExtend: expected a plain object");
|
|
481
|
+
return I(e, M(e._zod.def, { get shape() {
|
|
482
|
+
let n = {
|
|
483
|
+
...e._zod.def.shape,
|
|
484
|
+
...t
|
|
485
|
+
};
|
|
486
|
+
return j(this, "shape", n), n;
|
|
487
|
+
} }));
|
|
488
|
+
}
|
|
489
|
+
function Oe(e, t) {
|
|
490
|
+
if (e._zod.def.checks?.length) throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
491
|
+
return I(e, M(e._zod.def, {
|
|
492
|
+
get shape() {
|
|
493
|
+
let n = {
|
|
494
|
+
...e._zod.def.shape,
|
|
495
|
+
...t._zod.def.shape
|
|
496
|
+
};
|
|
497
|
+
return j(this, "shape", n), n;
|
|
498
|
+
},
|
|
499
|
+
get catchall() {
|
|
500
|
+
return t._zod.def.catchall;
|
|
501
|
+
},
|
|
502
|
+
checks: t._zod.def.checks ?? []
|
|
503
|
+
}));
|
|
504
|
+
}
|
|
505
|
+
function ke(e, t, n) {
|
|
506
|
+
let r = t._zod.def.checks;
|
|
507
|
+
if (r && r.length > 0) throw Error(".partial() cannot be used on object schemas containing refinements");
|
|
508
|
+
return I(t, M(t._zod.def, {
|
|
509
|
+
get shape() {
|
|
510
|
+
let r = t._zod.def.shape, i = { ...r };
|
|
511
|
+
if (n) for (let t in n) {
|
|
512
|
+
if (!(t in r)) throw Error(`Unrecognized key: "${t}"`);
|
|
513
|
+
n[t] && (i[t] = e ? new e({
|
|
514
|
+
type: "optional",
|
|
515
|
+
innerType: r[t]
|
|
516
|
+
}) : r[t]);
|
|
517
|
+
}
|
|
518
|
+
else for (let t in r) i[t] = e ? new e({
|
|
519
|
+
type: "optional",
|
|
520
|
+
innerType: r[t]
|
|
521
|
+
}) : r[t];
|
|
522
|
+
return j(this, "shape", i), i;
|
|
523
|
+
},
|
|
524
|
+
checks: []
|
|
525
|
+
}));
|
|
526
|
+
}
|
|
527
|
+
function Ae(e, t, n) {
|
|
528
|
+
return I(t, M(t._zod.def, { get shape() {
|
|
529
|
+
let r = t._zod.def.shape, i = { ...r };
|
|
530
|
+
if (n) for (let t in n) {
|
|
531
|
+
if (!(t in i)) throw Error(`Unrecognized key: "${t}"`);
|
|
532
|
+
n[t] && (i[t] = new e({
|
|
533
|
+
type: "nonoptional",
|
|
534
|
+
innerType: r[t]
|
|
535
|
+
}));
|
|
536
|
+
}
|
|
537
|
+
else for (let t in r) i[t] = new e({
|
|
538
|
+
type: "nonoptional",
|
|
539
|
+
innerType: r[t]
|
|
540
|
+
});
|
|
541
|
+
return j(this, "shape", i), i;
|
|
542
|
+
} }));
|
|
543
|
+
}
|
|
544
|
+
function R(e, t = 0) {
|
|
545
|
+
if (e.aborted === !0) return !0;
|
|
546
|
+
for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0;
|
|
547
|
+
return !1;
|
|
548
|
+
}
|
|
549
|
+
function je(e, t = 0) {
|
|
550
|
+
if (e.aborted === !0) return !0;
|
|
551
|
+
for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0;
|
|
552
|
+
return !1;
|
|
553
|
+
}
|
|
554
|
+
function z(e, t) {
|
|
555
|
+
return t.map((t) => {
|
|
556
|
+
var n;
|
|
557
|
+
return (n = t).path ?? (n.path = []), t.path.unshift(e), t;
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
function Me(e) {
|
|
561
|
+
return typeof e == "string" ? e : e?.message;
|
|
562
|
+
}
|
|
563
|
+
function B(e, t, n) {
|
|
564
|
+
let r = e.message ? e.message : Me(e.inst?._zod.def?.error?.(e)) ?? Me(t?.error?.(e)) ?? Me(n.customError?.(e)) ?? Me(n.localeError?.(e)) ?? "Invalid input", { inst: i, continue: a, input: o, ...s } = e;
|
|
565
|
+
return s.path ??= [], s.message = r, t?.reportInput && (s.input = o), s;
|
|
566
|
+
}
|
|
567
|
+
function Ne(e) {
|
|
568
|
+
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
569
|
+
}
|
|
570
|
+
function Pe(...e) {
|
|
571
|
+
let [t, n, r] = e;
|
|
572
|
+
return typeof t == "string" ? {
|
|
573
|
+
message: t,
|
|
574
|
+
code: "custom",
|
|
575
|
+
input: n,
|
|
576
|
+
inst: r
|
|
577
|
+
} : { ...t };
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region node_modules/zod/v4/core/errors.js
|
|
581
|
+
var Fe = (e, t) => {
|
|
582
|
+
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
583
|
+
value: e._zod,
|
|
584
|
+
enumerable: !1
|
|
585
|
+
}), Object.defineProperty(e, "issues", {
|
|
586
|
+
value: t,
|
|
587
|
+
enumerable: !1
|
|
588
|
+
}), e.message = JSON.stringify(t, de, 2), Object.defineProperty(e, "toString", {
|
|
589
|
+
value: () => e.message,
|
|
590
|
+
enumerable: !1
|
|
591
|
+
});
|
|
592
|
+
}, Ie = T("$ZodError", Fe), Le = T("$ZodError", Fe, { Parent: Error });
|
|
593
|
+
function Re(e, t = (e) => e.message) {
|
|
594
|
+
let n = {}, r = [];
|
|
595
|
+
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));
|
|
596
|
+
return {
|
|
597
|
+
formErrors: r,
|
|
598
|
+
fieldErrors: n
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
function ze(e, t = (e) => e.message) {
|
|
602
|
+
let n = { _errors: [] }, r = (e, i = []) => {
|
|
603
|
+
for (let a of e.issues) if (a.code === "invalid_union" && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path]));
|
|
604
|
+
else if (a.code === "invalid_key") r({ issues: a.issues }, [...i, ...a.path]);
|
|
605
|
+
else if (a.code === "invalid_element") r({ issues: a.issues }, [...i, ...a.path]);
|
|
606
|
+
else {
|
|
607
|
+
let e = [...i, ...a.path];
|
|
608
|
+
if (e.length === 0) n._errors.push(t(a));
|
|
609
|
+
else {
|
|
610
|
+
let r = n, i = 0;
|
|
611
|
+
for (; i < e.length;) {
|
|
612
|
+
let n = e[i];
|
|
613
|
+
i === e.length - 1 ? (r[n] = r[n] || { _errors: [] }, r[n]._errors.push(t(a))) : r[n] = r[n] || { _errors: [] }, r = r[n], i++;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
return r(e), n;
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region node_modules/zod/v4/core/parse.js
|
|
622
|
+
var Be = (e) => (t, n, r, i) => {
|
|
623
|
+
let a = r ? {
|
|
624
|
+
...r,
|
|
625
|
+
async: !1
|
|
626
|
+
} : { async: !1 }, o = t._zod.run({
|
|
627
|
+
value: n,
|
|
628
|
+
issues: []
|
|
629
|
+
}, a);
|
|
630
|
+
if (o instanceof Promise) throw new E();
|
|
631
|
+
if (o.issues.length) {
|
|
632
|
+
let t = new (i?.Err ?? e)(o.issues.map((e) => B(e, a, O())));
|
|
633
|
+
throw _e(t, i?.callee), t;
|
|
634
|
+
}
|
|
635
|
+
return o.value;
|
|
636
|
+
}, Ve = (e) => async (t, n, r, i) => {
|
|
637
|
+
let a = r ? {
|
|
638
|
+
...r,
|
|
639
|
+
async: !0
|
|
640
|
+
} : { async: !0 }, o = t._zod.run({
|
|
641
|
+
value: n,
|
|
642
|
+
issues: []
|
|
643
|
+
}, a);
|
|
644
|
+
if (o instanceof Promise && (o = await o), o.issues.length) {
|
|
645
|
+
let t = new (i?.Err ?? e)(o.issues.map((e) => B(e, a, O())));
|
|
646
|
+
throw _e(t, i?.callee), t;
|
|
647
|
+
}
|
|
648
|
+
return o.value;
|
|
649
|
+
}, He = (e) => (t, n, r) => {
|
|
650
|
+
let i = r ? {
|
|
651
|
+
...r,
|
|
652
|
+
async: !1
|
|
653
|
+
} : { async: !1 }, a = t._zod.run({
|
|
654
|
+
value: n,
|
|
655
|
+
issues: []
|
|
656
|
+
}, i);
|
|
657
|
+
if (a instanceof Promise) throw new E();
|
|
658
|
+
return a.issues.length ? {
|
|
659
|
+
success: !1,
|
|
660
|
+
error: new (e ?? Ie)(a.issues.map((e) => B(e, i, O())))
|
|
661
|
+
} : {
|
|
662
|
+
success: !0,
|
|
663
|
+
data: a.value
|
|
664
|
+
};
|
|
665
|
+
}, Ue = /* @__PURE__*/ He(Le), We = (e) => async (t, n, r) => {
|
|
666
|
+
let i = r ? {
|
|
667
|
+
...r,
|
|
668
|
+
async: !0
|
|
669
|
+
} : { async: !0 }, a = t._zod.run({
|
|
670
|
+
value: n,
|
|
671
|
+
issues: []
|
|
672
|
+
}, i);
|
|
673
|
+
return a instanceof Promise && (a = await a), a.issues.length ? {
|
|
674
|
+
success: !1,
|
|
675
|
+
error: new e(a.issues.map((e) => B(e, i, O())))
|
|
676
|
+
} : {
|
|
677
|
+
success: !0,
|
|
678
|
+
data: a.value
|
|
679
|
+
};
|
|
680
|
+
}, Ge = /* @__PURE__*/ We(Le), Ke = (e) => (t, n, r) => {
|
|
681
|
+
let i = r ? {
|
|
682
|
+
...r,
|
|
683
|
+
direction: "backward"
|
|
684
|
+
} : { direction: "backward" };
|
|
685
|
+
return Be(e)(t, n, i);
|
|
686
|
+
}, qe = (e) => (t, n, r) => Be(e)(t, n, r), Je = (e) => async (t, n, r) => {
|
|
687
|
+
let i = r ? {
|
|
688
|
+
...r,
|
|
689
|
+
direction: "backward"
|
|
690
|
+
} : { direction: "backward" };
|
|
691
|
+
return Ve(e)(t, n, i);
|
|
692
|
+
}, Ye = (e) => async (t, n, r) => Ve(e)(t, n, r), Xe = (e) => (t, n, r) => {
|
|
693
|
+
let i = r ? {
|
|
694
|
+
...r,
|
|
695
|
+
direction: "backward"
|
|
696
|
+
} : { direction: "backward" };
|
|
697
|
+
return He(e)(t, n, i);
|
|
698
|
+
}, Ze = (e) => (t, n, r) => He(e)(t, n, r), Qe = (e) => async (t, n, r) => {
|
|
699
|
+
let i = r ? {
|
|
700
|
+
...r,
|
|
701
|
+
direction: "backward"
|
|
702
|
+
} : { direction: "backward" };
|
|
703
|
+
return We(e)(t, n, i);
|
|
704
|
+
}, $e = (e) => async (t, n, r) => We(e)(t, n, r), et = /^[cC][0-9a-z]{6,}$/, tt = /^[0-9a-z]+$/, nt = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, rt = /^[0-9a-vA-V]{20}$/, it = /^[A-Za-z0-9]{27}$/, at = /^[a-zA-Z0-9_-]{21}$/, ot = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, st = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, ct = (e) => e ? RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, lt = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, ut = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
705
|
+
function dt() {
|
|
706
|
+
return new RegExp(ut, "u");
|
|
707
|
+
}
|
|
708
|
+
var ft = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, pt = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, mt = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, ht = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, gt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, _t = /^[A-Za-z0-9_-]*$/, vt = /^https?$/, yt = /^\+[1-9]\d{6,14}$/, bt = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", xt = /*@__PURE__*/ RegExp(`^${bt}$`);
|
|
709
|
+
function St(e) {
|
|
710
|
+
let t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
711
|
+
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
712
|
+
}
|
|
713
|
+
function Ct(e) {
|
|
714
|
+
return RegExp(`^${St(e)}$`);
|
|
715
|
+
}
|
|
716
|
+
function wt(e) {
|
|
717
|
+
let t = St({ precision: e.precision }), n = ["Z"];
|
|
718
|
+
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
719
|
+
let r = `${t}(?:${n.join("|")})`;
|
|
720
|
+
return RegExp(`^${bt}T(?:${r})$`);
|
|
721
|
+
}
|
|
722
|
+
var Tt = (e) => {
|
|
723
|
+
let t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
724
|
+
return RegExp(`^${t}$`);
|
|
725
|
+
}, Et = /^-?\d+$/, Dt = /^-?\d+(?:\.\d+)?$/, Ot = /^(?:true|false)$/i, kt = /^[^A-Z]*$/, At = /^[^a-z]*$/, V = /*@__PURE__*/ T("$ZodCheck", (e, t) => {
|
|
726
|
+
var n;
|
|
727
|
+
e._zod ??= {}, e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
728
|
+
}), jt = {
|
|
729
|
+
number: "number",
|
|
730
|
+
bigint: "bigint",
|
|
731
|
+
object: "date"
|
|
732
|
+
}, Mt = /*@__PURE__*/ T("$ZodCheckLessThan", (e, t) => {
|
|
733
|
+
V.init(e, t);
|
|
734
|
+
let n = jt[typeof t.value];
|
|
735
|
+
e._zod.onattach.push((e) => {
|
|
736
|
+
let n = e._zod.bag, r = (t.inclusive ? n.maximum : n.exclusiveMaximum) ?? Infinity;
|
|
737
|
+
t.value < r && (t.inclusive ? n.maximum = t.value : n.exclusiveMaximum = t.value);
|
|
738
|
+
}), e._zod.check = (r) => {
|
|
739
|
+
(t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
|
|
740
|
+
origin: n,
|
|
741
|
+
code: "too_big",
|
|
742
|
+
maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
|
|
743
|
+
input: r.value,
|
|
744
|
+
inclusive: t.inclusive,
|
|
745
|
+
inst: e,
|
|
746
|
+
continue: !t.abort
|
|
747
|
+
});
|
|
748
|
+
};
|
|
749
|
+
}), Nt = /*@__PURE__*/ T("$ZodCheckGreaterThan", (e, t) => {
|
|
750
|
+
V.init(e, t);
|
|
751
|
+
let n = jt[typeof t.value];
|
|
752
|
+
e._zod.onattach.push((e) => {
|
|
753
|
+
let n = e._zod.bag, r = (t.inclusive ? n.minimum : n.exclusiveMinimum) ?? -Infinity;
|
|
754
|
+
t.value > r && (t.inclusive ? n.minimum = t.value : n.exclusiveMinimum = t.value);
|
|
755
|
+
}), e._zod.check = (r) => {
|
|
756
|
+
(t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
|
|
757
|
+
origin: n,
|
|
758
|
+
code: "too_small",
|
|
759
|
+
minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
|
|
760
|
+
input: r.value,
|
|
761
|
+
inclusive: t.inclusive,
|
|
762
|
+
inst: e,
|
|
763
|
+
continue: !t.abort
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
}), Pt = /*@__PURE__*/ T("$ZodCheckMultipleOf", (e, t) => {
|
|
767
|
+
V.init(e, t), e._zod.onattach.push((e) => {
|
|
768
|
+
var n;
|
|
769
|
+
(n = e._zod.bag).multipleOf ?? (n.multipleOf = t.value);
|
|
770
|
+
}), e._zod.check = (n) => {
|
|
771
|
+
if (typeof n.value != typeof t.value) throw Error("Cannot mix number and bigint in multiple_of check.");
|
|
772
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : k(n.value, t.value) === 0) || n.issues.push({
|
|
773
|
+
origin: typeof n.value,
|
|
774
|
+
code: "not_multiple_of",
|
|
775
|
+
divisor: t.value,
|
|
776
|
+
input: n.value,
|
|
777
|
+
inst: e,
|
|
778
|
+
continue: !t.abort
|
|
779
|
+
});
|
|
780
|
+
};
|
|
781
|
+
}), Ft = /*@__PURE__*/ T("$ZodCheckNumberFormat", (e, t) => {
|
|
782
|
+
V.init(e, t), t.format = t.format || "float64";
|
|
783
|
+
let n = t.format?.includes("int"), r = n ? "int" : "number", [i, a] = Ce[t.format];
|
|
784
|
+
e._zod.onattach.push((e) => {
|
|
785
|
+
let r = e._zod.bag;
|
|
786
|
+
r.format = t.format, r.minimum = i, r.maximum = a, n && (r.pattern = Et);
|
|
787
|
+
}), e._zod.check = (o) => {
|
|
788
|
+
let s = o.value;
|
|
789
|
+
if (n) {
|
|
790
|
+
if (!Number.isInteger(s)) {
|
|
791
|
+
o.issues.push({
|
|
792
|
+
expected: r,
|
|
793
|
+
format: t.format,
|
|
794
|
+
code: "invalid_type",
|
|
795
|
+
continue: !1,
|
|
796
|
+
input: s,
|
|
797
|
+
inst: e
|
|
798
|
+
});
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
if (!Number.isSafeInteger(s)) {
|
|
802
|
+
s > 0 ? o.issues.push({
|
|
803
|
+
input: s,
|
|
804
|
+
code: "too_big",
|
|
805
|
+
maximum: 2 ** 53 - 1,
|
|
806
|
+
note: "Integers must be within the safe integer range.",
|
|
807
|
+
inst: e,
|
|
808
|
+
origin: r,
|
|
809
|
+
inclusive: !0,
|
|
810
|
+
continue: !t.abort
|
|
811
|
+
}) : o.issues.push({
|
|
812
|
+
input: s,
|
|
813
|
+
code: "too_small",
|
|
814
|
+
minimum: -(2 ** 53 - 1),
|
|
815
|
+
note: "Integers must be within the safe integer range.",
|
|
816
|
+
inst: e,
|
|
817
|
+
origin: r,
|
|
818
|
+
inclusive: !0,
|
|
819
|
+
continue: !t.abort
|
|
820
|
+
});
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
s < i && o.issues.push({
|
|
825
|
+
origin: "number",
|
|
826
|
+
input: s,
|
|
827
|
+
code: "too_small",
|
|
828
|
+
minimum: i,
|
|
829
|
+
inclusive: !0,
|
|
830
|
+
inst: e,
|
|
831
|
+
continue: !t.abort
|
|
832
|
+
}), s > a && o.issues.push({
|
|
833
|
+
origin: "number",
|
|
834
|
+
input: s,
|
|
835
|
+
code: "too_big",
|
|
836
|
+
maximum: a,
|
|
837
|
+
inclusive: !0,
|
|
838
|
+
inst: e,
|
|
839
|
+
continue: !t.abort
|
|
840
|
+
});
|
|
841
|
+
};
|
|
842
|
+
}), It = /*@__PURE__*/ T("$ZodCheckMaxLength", (e, t) => {
|
|
843
|
+
var n;
|
|
844
|
+
V.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
|
|
845
|
+
let t = e.value;
|
|
846
|
+
return !pe(t) && t.length !== void 0;
|
|
847
|
+
}), e._zod.onattach.push((e) => {
|
|
848
|
+
let n = e._zod.bag.maximum ?? Infinity;
|
|
849
|
+
t.maximum < n && (e._zod.bag.maximum = t.maximum);
|
|
850
|
+
}), e._zod.check = (n) => {
|
|
851
|
+
let r = n.value;
|
|
852
|
+
if (r.length <= t.maximum) return;
|
|
853
|
+
let i = Ne(r);
|
|
854
|
+
n.issues.push({
|
|
855
|
+
origin: i,
|
|
856
|
+
code: "too_big",
|
|
857
|
+
maximum: t.maximum,
|
|
858
|
+
inclusive: !0,
|
|
859
|
+
input: r,
|
|
860
|
+
inst: e,
|
|
861
|
+
continue: !t.abort
|
|
862
|
+
});
|
|
863
|
+
};
|
|
864
|
+
}), Lt = /*@__PURE__*/ T("$ZodCheckMinLength", (e, t) => {
|
|
865
|
+
var n;
|
|
866
|
+
V.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
|
|
867
|
+
let t = e.value;
|
|
868
|
+
return !pe(t) && t.length !== void 0;
|
|
869
|
+
}), e._zod.onattach.push((e) => {
|
|
870
|
+
let n = e._zod.bag.minimum ?? -Infinity;
|
|
871
|
+
t.minimum > n && (e._zod.bag.minimum = t.minimum);
|
|
872
|
+
}), e._zod.check = (n) => {
|
|
873
|
+
let r = n.value;
|
|
874
|
+
if (r.length >= t.minimum) return;
|
|
875
|
+
let i = Ne(r);
|
|
876
|
+
n.issues.push({
|
|
877
|
+
origin: i,
|
|
878
|
+
code: "too_small",
|
|
879
|
+
minimum: t.minimum,
|
|
880
|
+
inclusive: !0,
|
|
881
|
+
input: r,
|
|
882
|
+
inst: e,
|
|
883
|
+
continue: !t.abort
|
|
884
|
+
});
|
|
885
|
+
};
|
|
886
|
+
}), Rt = /*@__PURE__*/ T("$ZodCheckLengthEquals", (e, t) => {
|
|
887
|
+
var n;
|
|
888
|
+
V.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
|
|
889
|
+
let t = e.value;
|
|
890
|
+
return !pe(t) && t.length !== void 0;
|
|
891
|
+
}), e._zod.onattach.push((e) => {
|
|
892
|
+
let n = e._zod.bag;
|
|
893
|
+
n.minimum = t.length, n.maximum = t.length, n.length = t.length;
|
|
894
|
+
}), e._zod.check = (n) => {
|
|
895
|
+
let r = n.value, i = r.length;
|
|
896
|
+
if (i === t.length) return;
|
|
897
|
+
let a = Ne(r), o = i > t.length;
|
|
898
|
+
n.issues.push({
|
|
899
|
+
origin: a,
|
|
900
|
+
...o ? {
|
|
901
|
+
code: "too_big",
|
|
902
|
+
maximum: t.length
|
|
903
|
+
} : {
|
|
904
|
+
code: "too_small",
|
|
905
|
+
minimum: t.length
|
|
906
|
+
},
|
|
907
|
+
inclusive: !0,
|
|
908
|
+
exact: !0,
|
|
909
|
+
input: n.value,
|
|
910
|
+
inst: e,
|
|
911
|
+
continue: !t.abort
|
|
912
|
+
});
|
|
913
|
+
};
|
|
914
|
+
}), zt = /*@__PURE__*/ T("$ZodCheckStringFormat", (e, t) => {
|
|
915
|
+
var n, r;
|
|
916
|
+
V.init(e, t), e._zod.onattach.push((e) => {
|
|
917
|
+
let n = e._zod.bag;
|
|
918
|
+
n.format = t.format, t.pattern && (n.patterns ??= /* @__PURE__ */ new Set(), n.patterns.add(t.pattern));
|
|
919
|
+
}), t.pattern ? (n = e._zod).check ?? (n.check = (n) => {
|
|
920
|
+
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
921
|
+
origin: "string",
|
|
922
|
+
code: "invalid_format",
|
|
923
|
+
format: t.format,
|
|
924
|
+
input: n.value,
|
|
925
|
+
...t.pattern ? { pattern: t.pattern.toString() } : {},
|
|
926
|
+
inst: e,
|
|
927
|
+
continue: !t.abort
|
|
928
|
+
});
|
|
929
|
+
}) : (r = e._zod).check ?? (r.check = () => {});
|
|
930
|
+
}), Bt = /*@__PURE__*/ T("$ZodCheckRegex", (e, t) => {
|
|
931
|
+
zt.init(e, t), e._zod.check = (n) => {
|
|
932
|
+
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
933
|
+
origin: "string",
|
|
934
|
+
code: "invalid_format",
|
|
935
|
+
format: "regex",
|
|
936
|
+
input: n.value,
|
|
937
|
+
pattern: t.pattern.toString(),
|
|
938
|
+
inst: e,
|
|
939
|
+
continue: !t.abort
|
|
940
|
+
});
|
|
941
|
+
};
|
|
942
|
+
}), Vt = /*@__PURE__*/ T("$ZodCheckLowerCase", (e, t) => {
|
|
943
|
+
t.pattern ??= kt, zt.init(e, t);
|
|
944
|
+
}), Ht = /*@__PURE__*/ T("$ZodCheckUpperCase", (e, t) => {
|
|
945
|
+
t.pattern ??= At, zt.init(e, t);
|
|
946
|
+
}), Ut = /*@__PURE__*/ T("$ZodCheckIncludes", (e, t) => {
|
|
947
|
+
V.init(e, t);
|
|
948
|
+
let n = F(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
949
|
+
t.pattern = r, e._zod.onattach.push((e) => {
|
|
950
|
+
let t = e._zod.bag;
|
|
951
|
+
t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(r);
|
|
952
|
+
}), e._zod.check = (n) => {
|
|
953
|
+
n.value.includes(t.includes, t.position) || n.issues.push({
|
|
954
|
+
origin: "string",
|
|
955
|
+
code: "invalid_format",
|
|
956
|
+
format: "includes",
|
|
957
|
+
includes: t.includes,
|
|
958
|
+
input: n.value,
|
|
959
|
+
inst: e,
|
|
960
|
+
continue: !t.abort
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
}), Wt = /*@__PURE__*/ T("$ZodCheckStartsWith", (e, t) => {
|
|
964
|
+
V.init(e, t);
|
|
965
|
+
let n = RegExp(`^${F(t.prefix)}.*`);
|
|
966
|
+
t.pattern ??= n, e._zod.onattach.push((e) => {
|
|
967
|
+
let t = e._zod.bag;
|
|
968
|
+
t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
|
|
969
|
+
}), e._zod.check = (n) => {
|
|
970
|
+
n.value.startsWith(t.prefix) || n.issues.push({
|
|
971
|
+
origin: "string",
|
|
972
|
+
code: "invalid_format",
|
|
973
|
+
format: "starts_with",
|
|
974
|
+
prefix: t.prefix,
|
|
975
|
+
input: n.value,
|
|
976
|
+
inst: e,
|
|
977
|
+
continue: !t.abort
|
|
978
|
+
});
|
|
979
|
+
};
|
|
980
|
+
}), Gt = /*@__PURE__*/ T("$ZodCheckEndsWith", (e, t) => {
|
|
981
|
+
V.init(e, t);
|
|
982
|
+
let n = RegExp(`.*${F(t.suffix)}$`);
|
|
983
|
+
t.pattern ??= n, e._zod.onattach.push((e) => {
|
|
984
|
+
let t = e._zod.bag;
|
|
985
|
+
t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
|
|
986
|
+
}), e._zod.check = (n) => {
|
|
987
|
+
n.value.endsWith(t.suffix) || n.issues.push({
|
|
988
|
+
origin: "string",
|
|
989
|
+
code: "invalid_format",
|
|
990
|
+
format: "ends_with",
|
|
991
|
+
suffix: t.suffix,
|
|
992
|
+
input: n.value,
|
|
993
|
+
inst: e,
|
|
994
|
+
continue: !t.abort
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
}), Kt = /*@__PURE__*/ T("$ZodCheckOverwrite", (e, t) => {
|
|
998
|
+
V.init(e, t), e._zod.check = (e) => {
|
|
999
|
+
e.value = t.tx(e.value);
|
|
1000
|
+
};
|
|
1001
|
+
}), qt = class {
|
|
1002
|
+
constructor(e = []) {
|
|
1003
|
+
this.content = [], this.indent = 0, this && (this.args = e);
|
|
1004
|
+
}
|
|
1005
|
+
indented(e) {
|
|
1006
|
+
this.indent += 1, e(this), --this.indent;
|
|
1007
|
+
}
|
|
1008
|
+
write(e) {
|
|
1009
|
+
if (typeof e == "function") {
|
|
1010
|
+
e(this, { execution: "sync" }), e(this, { execution: "async" });
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
let t = e.split("\n").filter((e) => e), n = Math.min(...t.map((e) => e.length - e.trimStart().length)), r = t.map((e) => e.slice(n)).map((e) => " ".repeat(this.indent * 2) + e);
|
|
1014
|
+
for (let e of r) this.content.push(e);
|
|
1015
|
+
}
|
|
1016
|
+
compile() {
|
|
1017
|
+
let e = Function, t = this?.args, n = [...(this?.content ?? [""]).map((e) => ` ${e}`)];
|
|
1018
|
+
return new e(...t, n.join("\n"));
|
|
1019
|
+
}
|
|
1020
|
+
}, Jt = {
|
|
1021
|
+
major: 4,
|
|
1022
|
+
minor: 4,
|
|
1023
|
+
patch: 3
|
|
1024
|
+
}, H = /*@__PURE__*/ T("$ZodType", (e, t) => {
|
|
1025
|
+
var n;
|
|
1026
|
+
e ??= {}, e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Jt;
|
|
1027
|
+
let r = [...e._zod.def.checks ?? []];
|
|
1028
|
+
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
1029
|
+
for (let t of r) for (let n of t._zod.onattach) n(e);
|
|
1030
|
+
if (r.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
|
|
1031
|
+
e._zod.run = e._zod.parse;
|
|
1032
|
+
});
|
|
1033
|
+
else {
|
|
1034
|
+
let t = (e, t, n) => {
|
|
1035
|
+
let r = R(e), i;
|
|
1036
|
+
for (let a of t) {
|
|
1037
|
+
if (a._zod.def.when) {
|
|
1038
|
+
if (je(e) || !a._zod.def.when(e)) continue;
|
|
1039
|
+
} else if (r) continue;
|
|
1040
|
+
let t = e.issues.length, o = a._zod.check(e);
|
|
1041
|
+
if (o instanceof Promise && n?.async === !1) throw new E();
|
|
1042
|
+
if (i || o instanceof Promise) i = (i ?? Promise.resolve()).then(async () => {
|
|
1043
|
+
await o, e.issues.length !== t && (r ||= R(e, t));
|
|
1044
|
+
});
|
|
1045
|
+
else {
|
|
1046
|
+
if (e.issues.length === t) continue;
|
|
1047
|
+
r ||= R(e, t);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return i ? i.then(() => e) : e;
|
|
1051
|
+
}, n = (n, i, a) => {
|
|
1052
|
+
if (R(n)) return n.aborted = !0, n;
|
|
1053
|
+
let o = t(i, r, a);
|
|
1054
|
+
if (o instanceof Promise) {
|
|
1055
|
+
if (a.async === !1) throw new E();
|
|
1056
|
+
return o.then((t) => e._zod.parse(t, a));
|
|
1057
|
+
}
|
|
1058
|
+
return e._zod.parse(o, a);
|
|
1059
|
+
};
|
|
1060
|
+
e._zod.run = (i, a) => {
|
|
1061
|
+
if (a.skipChecks) return e._zod.parse(i, a);
|
|
1062
|
+
if (a.direction === "backward") {
|
|
1063
|
+
let t = e._zod.parse({
|
|
1064
|
+
value: i.value,
|
|
1065
|
+
issues: []
|
|
1066
|
+
}, {
|
|
1067
|
+
...a,
|
|
1068
|
+
skipChecks: !0
|
|
1069
|
+
});
|
|
1070
|
+
return t instanceof Promise ? t.then((e) => n(e, i, a)) : n(t, i, a);
|
|
1071
|
+
}
|
|
1072
|
+
let o = e._zod.parse(i, a);
|
|
1073
|
+
if (o instanceof Promise) {
|
|
1074
|
+
if (a.async === !1) throw new E();
|
|
1075
|
+
return o.then((e) => t(e, r, a));
|
|
1076
|
+
}
|
|
1077
|
+
return t(o, r, a);
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
A(e, "~standard", () => ({
|
|
1081
|
+
validate: (t) => {
|
|
1082
|
+
try {
|
|
1083
|
+
let n = Ue(e, t);
|
|
1084
|
+
return n.success ? { value: n.data } : { issues: n.error?.issues };
|
|
1085
|
+
} catch {
|
|
1086
|
+
return Ge(e, t).then((e) => e.success ? { value: e.data } : { issues: e.error?.issues });
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
vendor: "zod",
|
|
1090
|
+
version: 1
|
|
1091
|
+
}));
|
|
1092
|
+
}), Yt = /*@__PURE__*/ T("$ZodString", (e, t) => {
|
|
1093
|
+
H.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Tt(e._zod.bag), e._zod.parse = (n, r) => {
|
|
1094
|
+
if (t.coerce) try {
|
|
1095
|
+
n.value = String(n.value);
|
|
1096
|
+
} catch {}
|
|
1097
|
+
return typeof n.value == "string" || n.issues.push({
|
|
1098
|
+
expected: "string",
|
|
1099
|
+
code: "invalid_type",
|
|
1100
|
+
input: n.value,
|
|
1101
|
+
inst: e
|
|
1102
|
+
}), n;
|
|
1103
|
+
};
|
|
1104
|
+
}), U = /*@__PURE__*/ T("$ZodStringFormat", (e, t) => {
|
|
1105
|
+
zt.init(e, t), Yt.init(e, t);
|
|
1106
|
+
}), Xt = /*@__PURE__*/ T("$ZodGUID", (e, t) => {
|
|
1107
|
+
t.pattern ??= st, U.init(e, t);
|
|
1108
|
+
}), Zt = /*@__PURE__*/ T("$ZodUUID", (e, t) => {
|
|
1109
|
+
if (t.version) {
|
|
1110
|
+
let e = {
|
|
1111
|
+
v1: 1,
|
|
1112
|
+
v2: 2,
|
|
1113
|
+
v3: 3,
|
|
1114
|
+
v4: 4,
|
|
1115
|
+
v5: 5,
|
|
1116
|
+
v6: 6,
|
|
1117
|
+
v7: 7,
|
|
1118
|
+
v8: 8
|
|
1119
|
+
}[t.version];
|
|
1120
|
+
if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`);
|
|
1121
|
+
t.pattern ??= ct(e);
|
|
1122
|
+
} else t.pattern ??= ct();
|
|
1123
|
+
U.init(e, t);
|
|
1124
|
+
}), Qt = /*@__PURE__*/ T("$ZodEmail", (e, t) => {
|
|
1125
|
+
t.pattern ??= lt, U.init(e, t);
|
|
1126
|
+
}), $t = /*@__PURE__*/ T("$ZodURL", (e, t) => {
|
|
1127
|
+
U.init(e, t), e._zod.check = (n) => {
|
|
1128
|
+
try {
|
|
1129
|
+
let r = n.value.trim();
|
|
1130
|
+
if (!t.normalize && t.protocol?.source === vt.source && !/^https?:\/\//i.test(r)) {
|
|
1131
|
+
n.issues.push({
|
|
1132
|
+
code: "invalid_format",
|
|
1133
|
+
format: "url",
|
|
1134
|
+
note: "Invalid URL format",
|
|
1135
|
+
input: n.value,
|
|
1136
|
+
inst: e,
|
|
1137
|
+
continue: !t.abort
|
|
1138
|
+
});
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
let i = new URL(r);
|
|
1142
|
+
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(i.hostname) || n.issues.push({
|
|
1143
|
+
code: "invalid_format",
|
|
1144
|
+
format: "url",
|
|
1145
|
+
note: "Invalid hostname",
|
|
1146
|
+
pattern: t.hostname.source,
|
|
1147
|
+
input: n.value,
|
|
1148
|
+
inst: e,
|
|
1149
|
+
continue: !t.abort
|
|
1150
|
+
})), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || n.issues.push({
|
|
1151
|
+
code: "invalid_format",
|
|
1152
|
+
format: "url",
|
|
1153
|
+
note: "Invalid protocol",
|
|
1154
|
+
pattern: t.protocol.source,
|
|
1155
|
+
input: n.value,
|
|
1156
|
+
inst: e,
|
|
1157
|
+
continue: !t.abort
|
|
1158
|
+
})), t.normalize ? n.value = i.href : n.value = r;
|
|
1159
|
+
return;
|
|
1160
|
+
} catch {
|
|
1161
|
+
n.issues.push({
|
|
1162
|
+
code: "invalid_format",
|
|
1163
|
+
format: "url",
|
|
1164
|
+
input: n.value,
|
|
1165
|
+
inst: e,
|
|
1166
|
+
continue: !t.abort
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
}), en = /*@__PURE__*/ T("$ZodEmoji", (e, t) => {
|
|
1171
|
+
t.pattern ??= dt(), U.init(e, t);
|
|
1172
|
+
}), tn = /*@__PURE__*/ T("$ZodNanoID", (e, t) => {
|
|
1173
|
+
t.pattern ??= at, U.init(e, t);
|
|
1174
|
+
}), nn = /*@__PURE__*/ T("$ZodCUID", (e, t) => {
|
|
1175
|
+
t.pattern ??= et, U.init(e, t);
|
|
1176
|
+
}), rn = /*@__PURE__*/ T("$ZodCUID2", (e, t) => {
|
|
1177
|
+
t.pattern ??= tt, U.init(e, t);
|
|
1178
|
+
}), an = /*@__PURE__*/ T("$ZodULID", (e, t) => {
|
|
1179
|
+
t.pattern ??= nt, U.init(e, t);
|
|
1180
|
+
}), on = /*@__PURE__*/ T("$ZodXID", (e, t) => {
|
|
1181
|
+
t.pattern ??= rt, U.init(e, t);
|
|
1182
|
+
}), sn = /*@__PURE__*/ T("$ZodKSUID", (e, t) => {
|
|
1183
|
+
t.pattern ??= it, U.init(e, t);
|
|
1184
|
+
}), cn = /*@__PURE__*/ T("$ZodISODateTime", (e, t) => {
|
|
1185
|
+
t.pattern ??= wt(t), U.init(e, t);
|
|
1186
|
+
}), ln = /*@__PURE__*/ T("$ZodISODate", (e, t) => {
|
|
1187
|
+
t.pattern ??= xt, U.init(e, t);
|
|
1188
|
+
}), un = /*@__PURE__*/ T("$ZodISOTime", (e, t) => {
|
|
1189
|
+
t.pattern ??= Ct(t), U.init(e, t);
|
|
1190
|
+
}), dn = /*@__PURE__*/ T("$ZodISODuration", (e, t) => {
|
|
1191
|
+
t.pattern ??= ot, U.init(e, t);
|
|
1192
|
+
}), fn = /*@__PURE__*/ T("$ZodIPv4", (e, t) => {
|
|
1193
|
+
t.pattern ??= ft, U.init(e, t), e._zod.bag.format = "ipv4";
|
|
1194
|
+
}), pn = /*@__PURE__*/ T("$ZodIPv6", (e, t) => {
|
|
1195
|
+
t.pattern ??= pt, U.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
1196
|
+
try {
|
|
1197
|
+
new URL(`http://[${n.value}]`);
|
|
1198
|
+
} catch {
|
|
1199
|
+
n.issues.push({
|
|
1200
|
+
code: "invalid_format",
|
|
1201
|
+
format: "ipv6",
|
|
1202
|
+
input: n.value,
|
|
1203
|
+
inst: e,
|
|
1204
|
+
continue: !t.abort
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}), mn = /*@__PURE__*/ T("$ZodCIDRv4", (e, t) => {
|
|
1209
|
+
t.pattern ??= mt, U.init(e, t);
|
|
1210
|
+
}), hn = /*@__PURE__*/ T("$ZodCIDRv6", (e, t) => {
|
|
1211
|
+
t.pattern ??= ht, U.init(e, t), e._zod.check = (n) => {
|
|
1212
|
+
let r = n.value.split("/");
|
|
1213
|
+
try {
|
|
1214
|
+
if (r.length !== 2) throw Error();
|
|
1215
|
+
let [e, t] = r;
|
|
1216
|
+
if (!t) throw Error();
|
|
1217
|
+
let n = Number(t);
|
|
1218
|
+
if (`${n}` !== t || n < 0 || n > 128) throw Error();
|
|
1219
|
+
new URL(`http://[${e}]`);
|
|
1220
|
+
} catch {
|
|
1221
|
+
n.issues.push({
|
|
1222
|
+
code: "invalid_format",
|
|
1223
|
+
format: "cidrv6",
|
|
1224
|
+
input: n.value,
|
|
1225
|
+
inst: e,
|
|
1226
|
+
continue: !t.abort
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
});
|
|
1231
|
+
function gn(e) {
|
|
1232
|
+
if (e === "") return !0;
|
|
1233
|
+
if (/\s/.test(e) || e.length % 4 != 0) return !1;
|
|
1234
|
+
try {
|
|
1235
|
+
return atob(e), !0;
|
|
1236
|
+
} catch {
|
|
1237
|
+
return !1;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
var _n = /*@__PURE__*/ T("$ZodBase64", (e, t) => {
|
|
1241
|
+
t.pattern ??= gt, U.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
1242
|
+
gn(n.value) || n.issues.push({
|
|
1243
|
+
code: "invalid_format",
|
|
1244
|
+
format: "base64",
|
|
1245
|
+
input: n.value,
|
|
1246
|
+
inst: e,
|
|
1247
|
+
continue: !t.abort
|
|
1248
|
+
});
|
|
1249
|
+
};
|
|
1250
|
+
});
|
|
1251
|
+
function vn(e) {
|
|
1252
|
+
if (!_t.test(e)) return !1;
|
|
1253
|
+
let t = e.replace(/[-_]/g, (e) => e === "-" ? "+" : "/");
|
|
1254
|
+
return gn(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
|
|
1255
|
+
}
|
|
1256
|
+
var yn = /*@__PURE__*/ T("$ZodBase64URL", (e, t) => {
|
|
1257
|
+
t.pattern ??= _t, U.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
1258
|
+
vn(n.value) || n.issues.push({
|
|
1259
|
+
code: "invalid_format",
|
|
1260
|
+
format: "base64url",
|
|
1261
|
+
input: n.value,
|
|
1262
|
+
inst: e,
|
|
1263
|
+
continue: !t.abort
|
|
1264
|
+
});
|
|
1265
|
+
};
|
|
1266
|
+
}), bn = /*@__PURE__*/ T("$ZodE164", (e, t) => {
|
|
1267
|
+
t.pattern ??= yt, U.init(e, t);
|
|
1268
|
+
});
|
|
1269
|
+
function xn(e, t = null) {
|
|
1270
|
+
try {
|
|
1271
|
+
let n = e.split(".");
|
|
1272
|
+
if (n.length !== 3) return !1;
|
|
1273
|
+
let [r] = n;
|
|
1274
|
+
if (!r) return !1;
|
|
1275
|
+
let i = JSON.parse(atob(r));
|
|
1276
|
+
return !("typ" in i && i?.typ !== "JWT" || !i.alg || t && (!("alg" in i) || i.alg !== t));
|
|
1277
|
+
} catch {
|
|
1278
|
+
return !1;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
var Sn = /*@__PURE__*/ T("$ZodJWT", (e, t) => {
|
|
1282
|
+
U.init(e, t), e._zod.check = (n) => {
|
|
1283
|
+
xn(n.value, t.alg) || n.issues.push({
|
|
1284
|
+
code: "invalid_format",
|
|
1285
|
+
format: "jwt",
|
|
1286
|
+
input: n.value,
|
|
1287
|
+
inst: e,
|
|
1288
|
+
continue: !t.abort
|
|
1289
|
+
});
|
|
1290
|
+
};
|
|
1291
|
+
}), Cn = /*@__PURE__*/ T("$ZodNumber", (e, t) => {
|
|
1292
|
+
H.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Dt, e._zod.parse = (n, r) => {
|
|
1293
|
+
if (t.coerce) try {
|
|
1294
|
+
n.value = Number(n.value);
|
|
1295
|
+
} catch {}
|
|
1296
|
+
let i = n.value;
|
|
1297
|
+
if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i)) return n;
|
|
1298
|
+
let a = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
|
|
1299
|
+
return n.issues.push({
|
|
1300
|
+
expected: "number",
|
|
1301
|
+
code: "invalid_type",
|
|
1302
|
+
input: i,
|
|
1303
|
+
inst: e,
|
|
1304
|
+
...a ? { received: a } : {}
|
|
1305
|
+
}), n;
|
|
1306
|
+
};
|
|
1307
|
+
}), wn = /*@__PURE__*/ T("$ZodNumberFormat", (e, t) => {
|
|
1308
|
+
Ft.init(e, t), Cn.init(e, t);
|
|
1309
|
+
}), Tn = /*@__PURE__*/ T("$ZodBoolean", (e, t) => {
|
|
1310
|
+
H.init(e, t), e._zod.pattern = Ot, e._zod.parse = (n, r) => {
|
|
1311
|
+
if (t.coerce) try {
|
|
1312
|
+
n.value = !!n.value;
|
|
1313
|
+
} catch {}
|
|
1314
|
+
let i = n.value;
|
|
1315
|
+
return typeof i == "boolean" || n.issues.push({
|
|
1316
|
+
expected: "boolean",
|
|
1317
|
+
code: "invalid_type",
|
|
1318
|
+
input: i,
|
|
1319
|
+
inst: e
|
|
1320
|
+
}), n;
|
|
1321
|
+
};
|
|
1322
|
+
}), En = /*@__PURE__*/ T("$ZodUnknown", (e, t) => {
|
|
1323
|
+
H.init(e, t), e._zod.parse = (e) => e;
|
|
1324
|
+
}), Dn = /*@__PURE__*/ T("$ZodNever", (e, t) => {
|
|
1325
|
+
H.init(e, t), e._zod.parse = (t, n) => (t.issues.push({
|
|
1326
|
+
expected: "never",
|
|
1327
|
+
code: "invalid_type",
|
|
1328
|
+
input: t.value,
|
|
1329
|
+
inst: e
|
|
1330
|
+
}), t);
|
|
1331
|
+
});
|
|
1332
|
+
function On(e, t, n) {
|
|
1333
|
+
e.issues.length && t.issues.push(...z(n, e.issues)), t.value[n] = e.value;
|
|
1334
|
+
}
|
|
1335
|
+
var kn = /*@__PURE__*/ T("$ZodArray", (e, t) => {
|
|
1336
|
+
H.init(e, t), e._zod.parse = (n, r) => {
|
|
1337
|
+
let i = n.value;
|
|
1338
|
+
if (!Array.isArray(i)) return n.issues.push({
|
|
1339
|
+
expected: "array",
|
|
1340
|
+
code: "invalid_type",
|
|
1341
|
+
input: i,
|
|
1342
|
+
inst: e
|
|
1343
|
+
}), n;
|
|
1344
|
+
n.value = Array(i.length);
|
|
1345
|
+
let a = [];
|
|
1346
|
+
for (let e = 0; e < i.length; e++) {
|
|
1347
|
+
let o = i[e], s = t.element._zod.run({
|
|
1348
|
+
value: o,
|
|
1349
|
+
issues: []
|
|
1350
|
+
}, r);
|
|
1351
|
+
s instanceof Promise ? a.push(s.then((t) => On(t, n, e))) : On(s, n, e);
|
|
1352
|
+
}
|
|
1353
|
+
return a.length ? Promise.all(a).then(() => n) : n;
|
|
1354
|
+
};
|
|
1355
|
+
});
|
|
1356
|
+
function An(e, t, n, r, i, a) {
|
|
1357
|
+
let o = n in r;
|
|
1358
|
+
if (e.issues.length) {
|
|
1359
|
+
if (i && a && !o) return;
|
|
1360
|
+
t.issues.push(...z(n, e.issues));
|
|
1361
|
+
}
|
|
1362
|
+
if (!o && !i) {
|
|
1363
|
+
e.issues.length || t.issues.push({
|
|
1364
|
+
code: "invalid_type",
|
|
1365
|
+
expected: "nonoptional",
|
|
1366
|
+
input: void 0,
|
|
1367
|
+
path: [n]
|
|
1368
|
+
});
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
e.value === void 0 ? o && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
1372
|
+
}
|
|
1373
|
+
function jn(e) {
|
|
1374
|
+
let t = Object.keys(e.shape);
|
|
1375
|
+
for (let n of t) if (!e.shape?.[n]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${n}": expected a Zod schema`);
|
|
1376
|
+
let n = Se(e.shape);
|
|
1377
|
+
return {
|
|
1378
|
+
...e,
|
|
1379
|
+
keys: t,
|
|
1380
|
+
keySet: new Set(t),
|
|
1381
|
+
numKeys: t.length,
|
|
1382
|
+
optionalKeys: new Set(n)
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
function Mn(e, t, n, r, i, a) {
|
|
1386
|
+
let o = [], s = i.keySet, c = i.catchall._zod, l = c.def.type, u = c.optin === "optional", d = c.optout === "optional";
|
|
1387
|
+
for (let i in t) {
|
|
1388
|
+
if (i === "__proto__" || s.has(i)) continue;
|
|
1389
|
+
if (l === "never") {
|
|
1390
|
+
o.push(i);
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
let a = c.run({
|
|
1394
|
+
value: t[i],
|
|
1395
|
+
issues: []
|
|
1396
|
+
}, r);
|
|
1397
|
+
a instanceof Promise ? e.push(a.then((e) => An(e, n, i, t, u, d))) : An(a, n, i, t, u, d);
|
|
1398
|
+
}
|
|
1399
|
+
return o.length && n.issues.push({
|
|
1400
|
+
code: "unrecognized_keys",
|
|
1401
|
+
keys: o,
|
|
1402
|
+
input: t,
|
|
1403
|
+
inst: a
|
|
1404
|
+
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1405
|
+
}
|
|
1406
|
+
var Nn = /*@__PURE__*/ T("$ZodObject", (e, t) => {
|
|
1407
|
+
if (H.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1408
|
+
let e = t.shape;
|
|
1409
|
+
Object.defineProperty(t, "shape", { get: () => {
|
|
1410
|
+
let n = { ...e };
|
|
1411
|
+
return Object.defineProperty(t, "shape", { value: n }), n;
|
|
1412
|
+
} });
|
|
1413
|
+
}
|
|
1414
|
+
let n = fe(() => jn(t));
|
|
1415
|
+
A(e._zod, "propValues", () => {
|
|
1416
|
+
let e = t.shape, n = {};
|
|
1417
|
+
for (let t in e) {
|
|
1418
|
+
let r = e[t]._zod;
|
|
1419
|
+
if (r.values) {
|
|
1420
|
+
n[t] ?? (n[t] = /* @__PURE__ */ new Set());
|
|
1421
|
+
for (let e of r.values) n[t].add(e);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return n;
|
|
1425
|
+
});
|
|
1426
|
+
let r = ve, i = t.catchall, a;
|
|
1427
|
+
e._zod.parse = (t, o) => {
|
|
1428
|
+
a ??= n.value;
|
|
1429
|
+
let s = t.value;
|
|
1430
|
+
if (!r(s)) return t.issues.push({
|
|
1431
|
+
expected: "object",
|
|
1432
|
+
code: "invalid_type",
|
|
1433
|
+
input: s,
|
|
1434
|
+
inst: e
|
|
1435
|
+
}), t;
|
|
1436
|
+
t.value = {};
|
|
1437
|
+
let c = [], l = a.shape;
|
|
1438
|
+
for (let e of a.keys) {
|
|
1439
|
+
let n = l[e], r = n._zod.optin === "optional", i = n._zod.optout === "optional", a = n._zod.run({
|
|
1440
|
+
value: s[e],
|
|
1441
|
+
issues: []
|
|
1442
|
+
}, o);
|
|
1443
|
+
a instanceof Promise ? c.push(a.then((n) => An(n, t, e, s, r, i))) : An(a, t, e, s, r, i);
|
|
1444
|
+
}
|
|
1445
|
+
return i ? Mn(c, s, t, o, n.value, e) : c.length ? Promise.all(c).then(() => t) : t;
|
|
1446
|
+
};
|
|
1447
|
+
}), Pn = /*@__PURE__*/ T("$ZodObjectJIT", (e, t) => {
|
|
1448
|
+
Nn.init(e, t);
|
|
1449
|
+
let n = e._zod.parse, r = fe(() => jn(t)), i = (e) => {
|
|
1450
|
+
let t = new qt([
|
|
1451
|
+
"shape",
|
|
1452
|
+
"payload",
|
|
1453
|
+
"ctx"
|
|
1454
|
+
]), n = r.value, i = (e) => {
|
|
1455
|
+
let t = N(e);
|
|
1456
|
+
return `shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`;
|
|
1457
|
+
};
|
|
1458
|
+
t.write("const input = payload.value;");
|
|
1459
|
+
let a = Object.create(null), o = 0;
|
|
1460
|
+
for (let e of n.keys) a[e] = `key_${o++}`;
|
|
1461
|
+
t.write("const newResult = {};");
|
|
1462
|
+
for (let r of n.keys) {
|
|
1463
|
+
let n = a[r], o = N(r), s = e[r], c = s?._zod?.optin === "optional", l = s?._zod?.optout === "optional";
|
|
1464
|
+
t.write(`const ${n} = ${i(r)};`), c && l ? t.write(`
|
|
1465
|
+
if (${n}.issues.length) {
|
|
1466
|
+
if (${o} in input) {
|
|
1467
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
1468
|
+
...iss,
|
|
1469
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
1470
|
+
})));
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
if (${n}.value === undefined) {
|
|
1475
|
+
if (${o} in input) {
|
|
1476
|
+
newResult[${o}] = undefined;
|
|
1477
|
+
}
|
|
1478
|
+
} else {
|
|
1479
|
+
newResult[${o}] = ${n}.value;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
`) : c ? t.write(`
|
|
1483
|
+
if (${n}.issues.length) {
|
|
1484
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
1485
|
+
...iss,
|
|
1486
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
1487
|
+
})));
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
if (${n}.value === undefined) {
|
|
1491
|
+
if (${o} in input) {
|
|
1492
|
+
newResult[${o}] = undefined;
|
|
1493
|
+
}
|
|
1494
|
+
} else {
|
|
1495
|
+
newResult[${o}] = ${n}.value;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
`) : t.write(`
|
|
1499
|
+
const ${n}_present = ${o} in input;
|
|
1500
|
+
if (${n}.issues.length) {
|
|
1501
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
1502
|
+
...iss,
|
|
1503
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
1504
|
+
})));
|
|
1505
|
+
}
|
|
1506
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
1507
|
+
payload.issues.push({
|
|
1508
|
+
code: "invalid_type",
|
|
1509
|
+
expected: "nonoptional",
|
|
1510
|
+
input: undefined,
|
|
1511
|
+
path: [${o}]
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
if (${n}_present) {
|
|
1516
|
+
if (${n}.value === undefined) {
|
|
1517
|
+
newResult[${o}] = undefined;
|
|
1518
|
+
} else {
|
|
1519
|
+
newResult[${o}] = ${n}.value;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
`);
|
|
1524
|
+
}
|
|
1525
|
+
t.write("payload.value = newResult;"), t.write("return payload;");
|
|
1526
|
+
let s = t.compile();
|
|
1527
|
+
return (t, n) => s(e, t, n);
|
|
1528
|
+
}, a, o = ve, s = !D.jitless, c = s && ye.value, l = t.catchall, u;
|
|
1529
|
+
e._zod.parse = (d, f) => {
|
|
1530
|
+
u ??= r.value;
|
|
1531
|
+
let p = d.value;
|
|
1532
|
+
return o(p) ? s && c && f?.async === !1 && f.jitless !== !0 ? (a ||= i(t.shape), d = a(d, f), l ? Mn([], p, d, f, u, e) : d) : n(d, f) : (d.issues.push({
|
|
1533
|
+
expected: "object",
|
|
1534
|
+
code: "invalid_type",
|
|
1535
|
+
input: p,
|
|
1536
|
+
inst: e
|
|
1537
|
+
}), d);
|
|
1538
|
+
};
|
|
1539
|
+
});
|
|
1540
|
+
function Fn(e, t, n, r) {
|
|
1541
|
+
for (let n of e) if (n.issues.length === 0) return t.value = n.value, t;
|
|
1542
|
+
let i = e.filter((e) => !R(e));
|
|
1543
|
+
return i.length === 1 ? (t.value = i[0].value, i[0]) : (t.issues.push({
|
|
1544
|
+
code: "invalid_union",
|
|
1545
|
+
input: t.value,
|
|
1546
|
+
inst: n,
|
|
1547
|
+
errors: e.map((e) => e.issues.map((e) => B(e, r, O())))
|
|
1548
|
+
}), t);
|
|
1549
|
+
}
|
|
1550
|
+
var In = /*@__PURE__*/ T("$ZodUnion", (e, t) => {
|
|
1551
|
+
H.init(e, t), A(e._zod, "optin", () => t.options.some((e) => e._zod.optin === "optional") ? "optional" : void 0), A(e._zod, "optout", () => t.options.some((e) => e._zod.optout === "optional") ? "optional" : void 0), A(e._zod, "values", () => {
|
|
1552
|
+
if (t.options.every((e) => e._zod.values)) return new Set(t.options.flatMap((e) => Array.from(e._zod.values)));
|
|
1553
|
+
}), A(e._zod, "pattern", () => {
|
|
1554
|
+
if (t.options.every((e) => e._zod.pattern)) {
|
|
1555
|
+
let e = t.options.map((e) => e._zod.pattern);
|
|
1556
|
+
return RegExp(`^(${e.map((e) => me(e.source)).join("|")})$`);
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
let n = t.options.length === 1 ? t.options[0]._zod.run : null;
|
|
1560
|
+
e._zod.parse = (r, i) => {
|
|
1561
|
+
if (n) return n(r, i);
|
|
1562
|
+
let a = !1, o = [];
|
|
1563
|
+
for (let e of t.options) {
|
|
1564
|
+
let t = e._zod.run({
|
|
1565
|
+
value: r.value,
|
|
1566
|
+
issues: []
|
|
1567
|
+
}, i);
|
|
1568
|
+
if (t instanceof Promise) o.push(t), a = !0;
|
|
1569
|
+
else {
|
|
1570
|
+
if (t.issues.length === 0) return t;
|
|
1571
|
+
o.push(t);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
return a ? Promise.all(o).then((t) => Fn(t, r, e, i)) : Fn(o, r, e, i);
|
|
1575
|
+
};
|
|
1576
|
+
}), Ln = /*@__PURE__*/ T("$ZodIntersection", (e, t) => {
|
|
1577
|
+
H.init(e, t), e._zod.parse = (e, n) => {
|
|
1578
|
+
let r = e.value, i = t.left._zod.run({
|
|
1579
|
+
value: r,
|
|
1580
|
+
issues: []
|
|
1581
|
+
}, n), a = t.right._zod.run({
|
|
1582
|
+
value: r,
|
|
1583
|
+
issues: []
|
|
1584
|
+
}, n);
|
|
1585
|
+
return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => zn(e, t, n)) : zn(e, i, a);
|
|
1586
|
+
};
|
|
1587
|
+
});
|
|
1588
|
+
function Rn(e, t) {
|
|
1589
|
+
if (e === t || e instanceof Date && t instanceof Date && +e == +t) return {
|
|
1590
|
+
valid: !0,
|
|
1591
|
+
data: e
|
|
1592
|
+
};
|
|
1593
|
+
if (be(e) && be(t)) {
|
|
1594
|
+
let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = {
|
|
1595
|
+
...e,
|
|
1596
|
+
...t
|
|
1597
|
+
};
|
|
1598
|
+
for (let n of r) {
|
|
1599
|
+
let r = Rn(e[n], t[n]);
|
|
1600
|
+
if (!r.valid) return {
|
|
1601
|
+
valid: !1,
|
|
1602
|
+
mergeErrorPath: [n, ...r.mergeErrorPath]
|
|
1603
|
+
};
|
|
1604
|
+
i[n] = r.data;
|
|
1605
|
+
}
|
|
1606
|
+
return {
|
|
1607
|
+
valid: !0,
|
|
1608
|
+
data: i
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
1612
|
+
if (e.length !== t.length) return {
|
|
1613
|
+
valid: !1,
|
|
1614
|
+
mergeErrorPath: []
|
|
1615
|
+
};
|
|
1616
|
+
let n = [];
|
|
1617
|
+
for (let r = 0; r < e.length; r++) {
|
|
1618
|
+
let i = e[r], a = t[r], o = Rn(i, a);
|
|
1619
|
+
if (!o.valid) return {
|
|
1620
|
+
valid: !1,
|
|
1621
|
+
mergeErrorPath: [r, ...o.mergeErrorPath]
|
|
1622
|
+
};
|
|
1623
|
+
n.push(o.data);
|
|
1624
|
+
}
|
|
1625
|
+
return {
|
|
1626
|
+
valid: !0,
|
|
1627
|
+
data: n
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
return {
|
|
1631
|
+
valid: !1,
|
|
1632
|
+
mergeErrorPath: []
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
function zn(e, t, n) {
|
|
1636
|
+
let r = /* @__PURE__ */ new Map(), i;
|
|
1637
|
+
for (let n of t.issues) if (n.code === "unrecognized_keys") {
|
|
1638
|
+
i ??= n;
|
|
1639
|
+
for (let e of n.keys) r.has(e) || r.set(e, {}), r.get(e).l = !0;
|
|
1640
|
+
} else e.issues.push(n);
|
|
1641
|
+
for (let t of n.issues) if (t.code === "unrecognized_keys") for (let e of t.keys) r.has(e) || r.set(e, {}), r.get(e).r = !0;
|
|
1642
|
+
else e.issues.push(t);
|
|
1643
|
+
let a = [...r].filter(([, e]) => e.l && e.r).map(([e]) => e);
|
|
1644
|
+
if (a.length && i && e.issues.push({
|
|
1645
|
+
...i,
|
|
1646
|
+
keys: a
|
|
1647
|
+
}), R(e)) return e;
|
|
1648
|
+
let o = Rn(t.value, n.value);
|
|
1649
|
+
if (!o.valid) throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
|
|
1650
|
+
return e.value = o.data, e;
|
|
1651
|
+
}
|
|
1652
|
+
var Bn = /*@__PURE__*/ T("$ZodRecord", (e, t) => {
|
|
1653
|
+
H.init(e, t), e._zod.parse = (n, r) => {
|
|
1654
|
+
let i = n.value;
|
|
1655
|
+
if (!be(i)) return n.issues.push({
|
|
1656
|
+
expected: "record",
|
|
1657
|
+
code: "invalid_type",
|
|
1658
|
+
input: i,
|
|
1659
|
+
inst: e
|
|
1660
|
+
}), n;
|
|
1661
|
+
let a = [], o = t.keyType._zod.values;
|
|
1662
|
+
if (o) {
|
|
1663
|
+
n.value = {};
|
|
1664
|
+
let s = /* @__PURE__ */ new Set();
|
|
1665
|
+
for (let c of o) if (typeof c == "string" || typeof c == "number" || typeof c == "symbol") {
|
|
1666
|
+
s.add(typeof c == "number" ? c.toString() : c);
|
|
1667
|
+
let o = t.keyType._zod.run({
|
|
1668
|
+
value: c,
|
|
1669
|
+
issues: []
|
|
1670
|
+
}, r);
|
|
1671
|
+
if (o instanceof Promise) throw Error("Async schemas not supported in object keys currently");
|
|
1672
|
+
if (o.issues.length) {
|
|
1673
|
+
n.issues.push({
|
|
1674
|
+
code: "invalid_key",
|
|
1675
|
+
origin: "record",
|
|
1676
|
+
issues: o.issues.map((e) => B(e, r, O())),
|
|
1677
|
+
input: c,
|
|
1678
|
+
path: [c],
|
|
1679
|
+
inst: e
|
|
1680
|
+
});
|
|
1681
|
+
continue;
|
|
1682
|
+
}
|
|
1683
|
+
let l = o.value, u = t.valueType._zod.run({
|
|
1684
|
+
value: i[c],
|
|
1685
|
+
issues: []
|
|
1686
|
+
}, r);
|
|
1687
|
+
u instanceof Promise ? a.push(u.then((e) => {
|
|
1688
|
+
e.issues.length && n.issues.push(...z(c, e.issues)), n.value[l] = e.value;
|
|
1689
|
+
})) : (u.issues.length && n.issues.push(...z(c, u.issues)), n.value[l] = u.value);
|
|
1690
|
+
}
|
|
1691
|
+
let c;
|
|
1692
|
+
for (let e in i) s.has(e) || (c ??= [], c.push(e));
|
|
1693
|
+
c && c.length > 0 && n.issues.push({
|
|
1694
|
+
code: "unrecognized_keys",
|
|
1695
|
+
input: i,
|
|
1696
|
+
inst: e,
|
|
1697
|
+
keys: c
|
|
1698
|
+
});
|
|
1699
|
+
} else {
|
|
1700
|
+
n.value = {};
|
|
1701
|
+
for (let o of Reflect.ownKeys(i)) {
|
|
1702
|
+
if (o === "__proto__" || !Object.prototype.propertyIsEnumerable.call(i, o)) continue;
|
|
1703
|
+
let s = t.keyType._zod.run({
|
|
1704
|
+
value: o,
|
|
1705
|
+
issues: []
|
|
1706
|
+
}, r);
|
|
1707
|
+
if (s instanceof Promise) throw Error("Async schemas not supported in object keys currently");
|
|
1708
|
+
if (typeof o == "string" && Dt.test(o) && s.issues.length) {
|
|
1709
|
+
let e = t.keyType._zod.run({
|
|
1710
|
+
value: Number(o),
|
|
1711
|
+
issues: []
|
|
1712
|
+
}, r);
|
|
1713
|
+
if (e instanceof Promise) throw Error("Async schemas not supported in object keys currently");
|
|
1714
|
+
e.issues.length === 0 && (s = e);
|
|
1715
|
+
}
|
|
1716
|
+
if (s.issues.length) {
|
|
1717
|
+
t.mode === "loose" ? n.value[o] = i[o] : n.issues.push({
|
|
1718
|
+
code: "invalid_key",
|
|
1719
|
+
origin: "record",
|
|
1720
|
+
issues: s.issues.map((e) => B(e, r, O())),
|
|
1721
|
+
input: o,
|
|
1722
|
+
path: [o],
|
|
1723
|
+
inst: e
|
|
1724
|
+
});
|
|
1725
|
+
continue;
|
|
1726
|
+
}
|
|
1727
|
+
let c = t.valueType._zod.run({
|
|
1728
|
+
value: i[o],
|
|
1729
|
+
issues: []
|
|
1730
|
+
}, r);
|
|
1731
|
+
c instanceof Promise ? a.push(c.then((e) => {
|
|
1732
|
+
e.issues.length && n.issues.push(...z(o, e.issues)), n.value[s.value] = e.value;
|
|
1733
|
+
})) : (c.issues.length && n.issues.push(...z(o, c.issues)), n.value[s.value] = c.value);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
return a.length ? Promise.all(a).then(() => n) : n;
|
|
1737
|
+
};
|
|
1738
|
+
}), Vn = /*@__PURE__*/ T("$ZodEnum", (e, t) => {
|
|
1739
|
+
H.init(e, t);
|
|
1740
|
+
let n = ue(t.entries), r = new Set(n);
|
|
1741
|
+
e._zod.values = r, e._zod.pattern = RegExp(`^(${n.filter((e) => xe.has(typeof e)).map((e) => typeof e == "string" ? F(e) : e.toString()).join("|")})$`), e._zod.parse = (t, i) => {
|
|
1742
|
+
let a = t.value;
|
|
1743
|
+
return r.has(a) || t.issues.push({
|
|
1744
|
+
code: "invalid_value",
|
|
1745
|
+
values: n,
|
|
1746
|
+
input: a,
|
|
1747
|
+
inst: e
|
|
1748
|
+
}), t;
|
|
1749
|
+
};
|
|
1750
|
+
}), Hn = /*@__PURE__*/ T("$ZodLiteral", (e, t) => {
|
|
1751
|
+
if (H.init(e, t), t.values.length === 0) throw Error("Cannot create literal schema with no valid values");
|
|
1752
|
+
let n = new Set(t.values);
|
|
1753
|
+
e._zod.values = n, e._zod.pattern = RegExp(`^(${t.values.map((e) => typeof e == "string" ? F(e) : e ? F(e.toString()) : String(e)).join("|")})$`), e._zod.parse = (r, i) => {
|
|
1754
|
+
let a = r.value;
|
|
1755
|
+
return n.has(a) || r.issues.push({
|
|
1756
|
+
code: "invalid_value",
|
|
1757
|
+
values: t.values,
|
|
1758
|
+
input: a,
|
|
1759
|
+
inst: e
|
|
1760
|
+
}), r;
|
|
1761
|
+
};
|
|
1762
|
+
}), Un = /*@__PURE__*/ T("$ZodTransform", (e, t) => {
|
|
1763
|
+
H.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, r) => {
|
|
1764
|
+
if (r.direction === "backward") throw new le(e.constructor.name);
|
|
1765
|
+
let i = t.transform(n.value, n);
|
|
1766
|
+
if (r.async) return (i instanceof Promise ? i : Promise.resolve(i)).then((e) => (n.value = e, n.fallback = !0, n));
|
|
1767
|
+
if (i instanceof Promise) throw new E();
|
|
1768
|
+
return n.value = i, n.fallback = !0, n;
|
|
1769
|
+
};
|
|
1770
|
+
});
|
|
1771
|
+
function Wn(e, t) {
|
|
1772
|
+
return t === void 0 && (e.issues.length || e.fallback) ? {
|
|
1773
|
+
issues: [],
|
|
1774
|
+
value: void 0
|
|
1775
|
+
} : e;
|
|
1776
|
+
}
|
|
1777
|
+
var Gn = /*@__PURE__*/ T("$ZodOptional", (e, t) => {
|
|
1778
|
+
H.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", A(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, void 0]) : void 0), A(e._zod, "pattern", () => {
|
|
1779
|
+
let e = t.innerType._zod.pattern;
|
|
1780
|
+
return e ? RegExp(`^(${me(e.source)})?$`) : void 0;
|
|
1781
|
+
}), e._zod.parse = (e, n) => {
|
|
1782
|
+
if (t.innerType._zod.optin === "optional") {
|
|
1783
|
+
let r = e.value, i = t.innerType._zod.run(e, n);
|
|
1784
|
+
return i instanceof Promise ? i.then((e) => Wn(e, r)) : Wn(i, r);
|
|
1785
|
+
}
|
|
1786
|
+
return e.value === void 0 ? e : t.innerType._zod.run(e, n);
|
|
1787
|
+
};
|
|
1788
|
+
}), Kn = /*@__PURE__*/ T("$ZodExactOptional", (e, t) => {
|
|
1789
|
+
Gn.init(e, t), A(e._zod, "values", () => t.innerType._zod.values), A(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (e, n) => t.innerType._zod.run(e, n);
|
|
1790
|
+
}), qn = /*@__PURE__*/ T("$ZodNullable", (e, t) => {
|
|
1791
|
+
H.init(e, t), A(e._zod, "optin", () => t.innerType._zod.optin), A(e._zod, "optout", () => t.innerType._zod.optout), A(e._zod, "pattern", () => {
|
|
1792
|
+
let e = t.innerType._zod.pattern;
|
|
1793
|
+
return e ? RegExp(`^(${me(e.source)}|null)$`) : void 0;
|
|
1794
|
+
}), A(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);
|
|
1795
|
+
}), Jn = /*@__PURE__*/ T("$ZodDefault", (e, t) => {
|
|
1796
|
+
H.init(e, t), e._zod.optin = "optional", A(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
|
|
1797
|
+
if (n.direction === "backward") return t.innerType._zod.run(e, n);
|
|
1798
|
+
if (e.value === void 0) return e.value = t.defaultValue, e;
|
|
1799
|
+
let r = t.innerType._zod.run(e, n);
|
|
1800
|
+
return r instanceof Promise ? r.then((e) => Yn(e, t)) : Yn(r, t);
|
|
1801
|
+
};
|
|
1802
|
+
});
|
|
1803
|
+
function Yn(e, t) {
|
|
1804
|
+
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
1805
|
+
}
|
|
1806
|
+
var Xn = /*@__PURE__*/ T("$ZodPrefault", (e, t) => {
|
|
1807
|
+
H.init(e, t), e._zod.optin = "optional", A(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));
|
|
1808
|
+
}), Zn = /*@__PURE__*/ T("$ZodNonOptional", (e, t) => {
|
|
1809
|
+
H.init(e, t), A(e._zod, "values", () => {
|
|
1810
|
+
let e = t.innerType._zod.values;
|
|
1811
|
+
return e ? new Set([...e].filter((e) => e !== void 0)) : void 0;
|
|
1812
|
+
}), e._zod.parse = (n, r) => {
|
|
1813
|
+
let i = t.innerType._zod.run(n, r);
|
|
1814
|
+
return i instanceof Promise ? i.then((t) => Qn(t, e)) : Qn(i, e);
|
|
1815
|
+
};
|
|
1816
|
+
});
|
|
1817
|
+
function Qn(e, t) {
|
|
1818
|
+
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
1819
|
+
code: "invalid_type",
|
|
1820
|
+
expected: "nonoptional",
|
|
1821
|
+
input: e.value,
|
|
1822
|
+
inst: t
|
|
1823
|
+
}), e;
|
|
1824
|
+
}
|
|
1825
|
+
var $n = /*@__PURE__*/ T("$ZodCatch", (e, t) => {
|
|
1826
|
+
H.init(e, t), e._zod.optin = "optional", A(e._zod, "optout", () => t.innerType._zod.optout), A(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
|
|
1827
|
+
if (n.direction === "backward") return t.innerType._zod.run(e, n);
|
|
1828
|
+
let r = t.innerType._zod.run(e, n);
|
|
1829
|
+
return r instanceof Promise ? r.then((r) => (e.value = r.value, r.issues.length && (e.value = t.catchValue({
|
|
1830
|
+
...e,
|
|
1831
|
+
error: { issues: r.issues.map((e) => B(e, n, O())) },
|
|
1832
|
+
input: e.value
|
|
1833
|
+
}), e.issues = [], e.fallback = !0), e)) : (e.value = r.value, r.issues.length && (e.value = t.catchValue({
|
|
1834
|
+
...e,
|
|
1835
|
+
error: { issues: r.issues.map((e) => B(e, n, O())) },
|
|
1836
|
+
input: e.value
|
|
1837
|
+
}), e.issues = [], e.fallback = !0), e);
|
|
1838
|
+
};
|
|
1839
|
+
}), er = /*@__PURE__*/ T("$ZodPipe", (e, t) => {
|
|
1840
|
+
H.init(e, t), A(e._zod, "values", () => t.in._zod.values), A(e._zod, "optin", () => t.in._zod.optin), A(e._zod, "optout", () => t.out._zod.optout), A(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (e, n) => {
|
|
1841
|
+
if (n.direction === "backward") {
|
|
1842
|
+
let r = t.out._zod.run(e, n);
|
|
1843
|
+
return r instanceof Promise ? r.then((e) => tr(e, t.in, n)) : tr(r, t.in, n);
|
|
1844
|
+
}
|
|
1845
|
+
let r = t.in._zod.run(e, n);
|
|
1846
|
+
return r instanceof Promise ? r.then((e) => tr(e, t.out, n)) : tr(r, t.out, n);
|
|
1847
|
+
};
|
|
1848
|
+
});
|
|
1849
|
+
function tr(e, t, n) {
|
|
1850
|
+
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({
|
|
1851
|
+
value: e.value,
|
|
1852
|
+
issues: e.issues,
|
|
1853
|
+
fallback: e.fallback
|
|
1854
|
+
}, n);
|
|
1855
|
+
}
|
|
1856
|
+
var nr = /*@__PURE__*/ T("$ZodReadonly", (e, t) => {
|
|
1857
|
+
H.init(e, t), A(e._zod, "propValues", () => t.innerType._zod.propValues), A(e._zod, "values", () => t.innerType._zod.values), A(e._zod, "optin", () => t.innerType?._zod?.optin), A(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (e, n) => {
|
|
1858
|
+
if (n.direction === "backward") return t.innerType._zod.run(e, n);
|
|
1859
|
+
let r = t.innerType._zod.run(e, n);
|
|
1860
|
+
return r instanceof Promise ? r.then(rr) : rr(r);
|
|
1861
|
+
};
|
|
1862
|
+
});
|
|
1863
|
+
function rr(e) {
|
|
1864
|
+
return e.value = Object.freeze(e.value), e;
|
|
1865
|
+
}
|
|
1866
|
+
var ir = /*@__PURE__*/ T("$ZodCustom", (e, t) => {
|
|
1867
|
+
V.init(e, t), H.init(e, t), e._zod.parse = (e, t) => e, e._zod.check = (n) => {
|
|
1868
|
+
let r = n.value, i = t.fn(r);
|
|
1869
|
+
if (i instanceof Promise) return i.then((t) => ar(t, n, r, e));
|
|
1870
|
+
ar(i, n, r, e);
|
|
1871
|
+
};
|
|
1872
|
+
});
|
|
1873
|
+
function ar(e, t, n, r) {
|
|
1874
|
+
if (!e) {
|
|
1875
|
+
let e = {
|
|
1876
|
+
code: "custom",
|
|
1877
|
+
input: n,
|
|
1878
|
+
inst: r,
|
|
1879
|
+
path: [...r._zod.def.path ?? []],
|
|
1880
|
+
continue: !r._zod.def.abort
|
|
1881
|
+
};
|
|
1882
|
+
r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(Pe(e));
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
//#endregion
|
|
1886
|
+
//#region node_modules/zod/v4/core/registries.js
|
|
1887
|
+
var or, sr = class {
|
|
1888
|
+
constructor() {
|
|
1889
|
+
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
1890
|
+
}
|
|
1891
|
+
add(e, ...t) {
|
|
1892
|
+
let n = t[0];
|
|
1893
|
+
return this._map.set(e, n), n && typeof n == "object" && "id" in n && this._idmap.set(n.id, e), this;
|
|
1894
|
+
}
|
|
1895
|
+
clear() {
|
|
1896
|
+
return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
1897
|
+
}
|
|
1898
|
+
remove(e) {
|
|
1899
|
+
let t = this._map.get(e);
|
|
1900
|
+
return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(e), this;
|
|
1901
|
+
}
|
|
1902
|
+
get(e) {
|
|
1903
|
+
let t = e._zod.parent;
|
|
1904
|
+
if (t) {
|
|
1905
|
+
let n = { ...this.get(t) ?? {} };
|
|
1906
|
+
delete n.id;
|
|
1907
|
+
let r = {
|
|
1908
|
+
...n,
|
|
1909
|
+
...this._map.get(e)
|
|
1910
|
+
};
|
|
1911
|
+
return Object.keys(r).length ? r : void 0;
|
|
1912
|
+
}
|
|
1913
|
+
return this._map.get(e);
|
|
1914
|
+
}
|
|
1915
|
+
has(e) {
|
|
1916
|
+
return this._map.has(e);
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
function cr() {
|
|
1920
|
+
return new sr();
|
|
1921
|
+
}
|
|
1922
|
+
(or = globalThis).__zod_globalRegistry ?? (or.__zod_globalRegistry = cr());
|
|
1923
|
+
var lr = globalThis.__zod_globalRegistry;
|
|
1924
|
+
//#endregion
|
|
1925
|
+
//#region node_modules/zod/v4/core/api.js
|
|
1926
|
+
// @__NO_SIDE_EFFECTS__
|
|
1927
|
+
function ur(e, t) {
|
|
1928
|
+
return new e({
|
|
1929
|
+
type: "string",
|
|
1930
|
+
...L(t)
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
// @__NO_SIDE_EFFECTS__
|
|
1934
|
+
function dr(e, t) {
|
|
1935
|
+
return new e({
|
|
1936
|
+
type: "string",
|
|
1937
|
+
format: "email",
|
|
1938
|
+
check: "string_format",
|
|
1939
|
+
abort: !1,
|
|
1940
|
+
...L(t)
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
// @__NO_SIDE_EFFECTS__
|
|
1944
|
+
function fr(e, t) {
|
|
1945
|
+
return new e({
|
|
1946
|
+
type: "string",
|
|
1947
|
+
format: "guid",
|
|
1948
|
+
check: "string_format",
|
|
1949
|
+
abort: !1,
|
|
1950
|
+
...L(t)
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
// @__NO_SIDE_EFFECTS__
|
|
1954
|
+
function pr(e, t) {
|
|
1955
|
+
return new e({
|
|
1956
|
+
type: "string",
|
|
1957
|
+
format: "uuid",
|
|
1958
|
+
check: "string_format",
|
|
1959
|
+
abort: !1,
|
|
1960
|
+
...L(t)
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
// @__NO_SIDE_EFFECTS__
|
|
1964
|
+
function mr(e, t) {
|
|
1965
|
+
return new e({
|
|
1966
|
+
type: "string",
|
|
1967
|
+
format: "uuid",
|
|
1968
|
+
check: "string_format",
|
|
1969
|
+
abort: !1,
|
|
1970
|
+
version: "v4",
|
|
1971
|
+
...L(t)
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1974
|
+
// @__NO_SIDE_EFFECTS__
|
|
1975
|
+
function hr(e, t) {
|
|
1976
|
+
return new e({
|
|
1977
|
+
type: "string",
|
|
1978
|
+
format: "uuid",
|
|
1979
|
+
check: "string_format",
|
|
1980
|
+
abort: !1,
|
|
1981
|
+
version: "v6",
|
|
1982
|
+
...L(t)
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
// @__NO_SIDE_EFFECTS__
|
|
1986
|
+
function gr(e, t) {
|
|
1987
|
+
return new e({
|
|
1988
|
+
type: "string",
|
|
1989
|
+
format: "uuid",
|
|
1990
|
+
check: "string_format",
|
|
1991
|
+
abort: !1,
|
|
1992
|
+
version: "v7",
|
|
1993
|
+
...L(t)
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
// @__NO_SIDE_EFFECTS__
|
|
1997
|
+
function _r(e, t) {
|
|
1998
|
+
return new e({
|
|
1999
|
+
type: "string",
|
|
2000
|
+
format: "url",
|
|
2001
|
+
check: "string_format",
|
|
2002
|
+
abort: !1,
|
|
2003
|
+
...L(t)
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
// @__NO_SIDE_EFFECTS__
|
|
2007
|
+
function vr(e, t) {
|
|
2008
|
+
return new e({
|
|
2009
|
+
type: "string",
|
|
2010
|
+
format: "emoji",
|
|
2011
|
+
check: "string_format",
|
|
2012
|
+
abort: !1,
|
|
2013
|
+
...L(t)
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
// @__NO_SIDE_EFFECTS__
|
|
2017
|
+
function yr(e, t) {
|
|
2018
|
+
return new e({
|
|
2019
|
+
type: "string",
|
|
2020
|
+
format: "nanoid",
|
|
2021
|
+
check: "string_format",
|
|
2022
|
+
abort: !1,
|
|
2023
|
+
...L(t)
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
// @__NO_SIDE_EFFECTS__
|
|
2027
|
+
function br(e, t) {
|
|
2028
|
+
return new e({
|
|
2029
|
+
type: "string",
|
|
2030
|
+
format: "cuid",
|
|
2031
|
+
check: "string_format",
|
|
2032
|
+
abort: !1,
|
|
2033
|
+
...L(t)
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
// @__NO_SIDE_EFFECTS__
|
|
2037
|
+
function xr(e, t) {
|
|
2038
|
+
return new e({
|
|
2039
|
+
type: "string",
|
|
2040
|
+
format: "cuid2",
|
|
2041
|
+
check: "string_format",
|
|
2042
|
+
abort: !1,
|
|
2043
|
+
...L(t)
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
// @__NO_SIDE_EFFECTS__
|
|
2047
|
+
function Sr(e, t) {
|
|
2048
|
+
return new e({
|
|
2049
|
+
type: "string",
|
|
2050
|
+
format: "ulid",
|
|
2051
|
+
check: "string_format",
|
|
2052
|
+
abort: !1,
|
|
2053
|
+
...L(t)
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
// @__NO_SIDE_EFFECTS__
|
|
2057
|
+
function Cr(e, t) {
|
|
2058
|
+
return new e({
|
|
2059
|
+
type: "string",
|
|
2060
|
+
format: "xid",
|
|
2061
|
+
check: "string_format",
|
|
2062
|
+
abort: !1,
|
|
2063
|
+
...L(t)
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
// @__NO_SIDE_EFFECTS__
|
|
2067
|
+
function wr(e, t) {
|
|
2068
|
+
return new e({
|
|
2069
|
+
type: "string",
|
|
2070
|
+
format: "ksuid",
|
|
2071
|
+
check: "string_format",
|
|
2072
|
+
abort: !1,
|
|
2073
|
+
...L(t)
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
// @__NO_SIDE_EFFECTS__
|
|
2077
|
+
function Tr(e, t) {
|
|
2078
|
+
return new e({
|
|
2079
|
+
type: "string",
|
|
2080
|
+
format: "ipv4",
|
|
2081
|
+
check: "string_format",
|
|
2082
|
+
abort: !1,
|
|
2083
|
+
...L(t)
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
// @__NO_SIDE_EFFECTS__
|
|
2087
|
+
function Er(e, t) {
|
|
2088
|
+
return new e({
|
|
2089
|
+
type: "string",
|
|
2090
|
+
format: "ipv6",
|
|
2091
|
+
check: "string_format",
|
|
2092
|
+
abort: !1,
|
|
2093
|
+
...L(t)
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
// @__NO_SIDE_EFFECTS__
|
|
2097
|
+
function Dr(e, t) {
|
|
2098
|
+
return new e({
|
|
2099
|
+
type: "string",
|
|
2100
|
+
format: "cidrv4",
|
|
2101
|
+
check: "string_format",
|
|
2102
|
+
abort: !1,
|
|
2103
|
+
...L(t)
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
// @__NO_SIDE_EFFECTS__
|
|
2107
|
+
function Or(e, t) {
|
|
2108
|
+
return new e({
|
|
2109
|
+
type: "string",
|
|
2110
|
+
format: "cidrv6",
|
|
2111
|
+
check: "string_format",
|
|
2112
|
+
abort: !1,
|
|
2113
|
+
...L(t)
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
// @__NO_SIDE_EFFECTS__
|
|
2117
|
+
function kr(e, t) {
|
|
2118
|
+
return new e({
|
|
2119
|
+
type: "string",
|
|
2120
|
+
format: "base64",
|
|
2121
|
+
check: "string_format",
|
|
2122
|
+
abort: !1,
|
|
2123
|
+
...L(t)
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
// @__NO_SIDE_EFFECTS__
|
|
2127
|
+
function Ar(e, t) {
|
|
2128
|
+
return new e({
|
|
2129
|
+
type: "string",
|
|
2130
|
+
format: "base64url",
|
|
2131
|
+
check: "string_format",
|
|
2132
|
+
abort: !1,
|
|
2133
|
+
...L(t)
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
// @__NO_SIDE_EFFECTS__
|
|
2137
|
+
function jr(e, t) {
|
|
2138
|
+
return new e({
|
|
2139
|
+
type: "string",
|
|
2140
|
+
format: "e164",
|
|
2141
|
+
check: "string_format",
|
|
2142
|
+
abort: !1,
|
|
2143
|
+
...L(t)
|
|
2144
|
+
});
|
|
2145
|
+
}
|
|
2146
|
+
// @__NO_SIDE_EFFECTS__
|
|
2147
|
+
function Mr(e, t) {
|
|
2148
|
+
return new e({
|
|
2149
|
+
type: "string",
|
|
2150
|
+
format: "jwt",
|
|
2151
|
+
check: "string_format",
|
|
2152
|
+
abort: !1,
|
|
2153
|
+
...L(t)
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
// @__NO_SIDE_EFFECTS__
|
|
2157
|
+
function Nr(e, t) {
|
|
2158
|
+
return new e({
|
|
2159
|
+
type: "string",
|
|
2160
|
+
format: "datetime",
|
|
2161
|
+
check: "string_format",
|
|
2162
|
+
offset: !1,
|
|
2163
|
+
local: !1,
|
|
2164
|
+
precision: null,
|
|
2165
|
+
...L(t)
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
// @__NO_SIDE_EFFECTS__
|
|
2169
|
+
function Pr(e, t) {
|
|
2170
|
+
return new e({
|
|
2171
|
+
type: "string",
|
|
2172
|
+
format: "date",
|
|
2173
|
+
check: "string_format",
|
|
2174
|
+
...L(t)
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
// @__NO_SIDE_EFFECTS__
|
|
2178
|
+
function Fr(e, t) {
|
|
2179
|
+
return new e({
|
|
2180
|
+
type: "string",
|
|
2181
|
+
format: "time",
|
|
2182
|
+
check: "string_format",
|
|
2183
|
+
precision: null,
|
|
2184
|
+
...L(t)
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
// @__NO_SIDE_EFFECTS__
|
|
2188
|
+
function Ir(e, t) {
|
|
2189
|
+
return new e({
|
|
2190
|
+
type: "string",
|
|
2191
|
+
format: "duration",
|
|
2192
|
+
check: "string_format",
|
|
2193
|
+
...L(t)
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
// @__NO_SIDE_EFFECTS__
|
|
2197
|
+
function Lr(e, t) {
|
|
2198
|
+
return new e({
|
|
2199
|
+
type: "number",
|
|
2200
|
+
checks: [],
|
|
2201
|
+
...L(t)
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
// @__NO_SIDE_EFFECTS__
|
|
2205
|
+
function Rr(e, t) {
|
|
2206
|
+
return new e({
|
|
2207
|
+
type: "number",
|
|
2208
|
+
check: "number_format",
|
|
2209
|
+
abort: !1,
|
|
2210
|
+
format: "safeint",
|
|
2211
|
+
...L(t)
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
// @__NO_SIDE_EFFECTS__
|
|
2215
|
+
function zr(e, t) {
|
|
2216
|
+
return new e({
|
|
2217
|
+
type: "boolean",
|
|
2218
|
+
...L(t)
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
// @__NO_SIDE_EFFECTS__
|
|
2222
|
+
function Br(e) {
|
|
2223
|
+
return new e({ type: "unknown" });
|
|
2224
|
+
}
|
|
2225
|
+
// @__NO_SIDE_EFFECTS__
|
|
2226
|
+
function Vr(e, t) {
|
|
2227
|
+
return new e({
|
|
2228
|
+
type: "never",
|
|
2229
|
+
...L(t)
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
// @__NO_SIDE_EFFECTS__
|
|
2233
|
+
function Hr(e, t) {
|
|
2234
|
+
return new Mt({
|
|
2235
|
+
check: "less_than",
|
|
2236
|
+
...L(t),
|
|
2237
|
+
value: e,
|
|
2238
|
+
inclusive: !1
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
// @__NO_SIDE_EFFECTS__
|
|
2242
|
+
function Ur(e, t) {
|
|
2243
|
+
return new Mt({
|
|
2244
|
+
check: "less_than",
|
|
2245
|
+
...L(t),
|
|
2246
|
+
value: e,
|
|
2247
|
+
inclusive: !0
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
// @__NO_SIDE_EFFECTS__
|
|
2251
|
+
function Wr(e, t) {
|
|
2252
|
+
return new Nt({
|
|
2253
|
+
check: "greater_than",
|
|
2254
|
+
...L(t),
|
|
2255
|
+
value: e,
|
|
2256
|
+
inclusive: !1
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
// @__NO_SIDE_EFFECTS__
|
|
2260
|
+
function Gr(e, t) {
|
|
2261
|
+
return new Nt({
|
|
2262
|
+
check: "greater_than",
|
|
2263
|
+
...L(t),
|
|
2264
|
+
value: e,
|
|
2265
|
+
inclusive: !0
|
|
2266
|
+
});
|
|
2267
|
+
}
|
|
2268
|
+
// @__NO_SIDE_EFFECTS__
|
|
2269
|
+
function Kr(e, t) {
|
|
2270
|
+
return new Pt({
|
|
2271
|
+
check: "multiple_of",
|
|
2272
|
+
...L(t),
|
|
2273
|
+
value: e
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
// @__NO_SIDE_EFFECTS__
|
|
2277
|
+
function qr(e, t) {
|
|
2278
|
+
return new It({
|
|
2279
|
+
check: "max_length",
|
|
2280
|
+
...L(t),
|
|
2281
|
+
maximum: e
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
// @__NO_SIDE_EFFECTS__
|
|
2285
|
+
function Jr(e, t) {
|
|
2286
|
+
return new Lt({
|
|
2287
|
+
check: "min_length",
|
|
2288
|
+
...L(t),
|
|
2289
|
+
minimum: e
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
// @__NO_SIDE_EFFECTS__
|
|
2293
|
+
function Yr(e, t) {
|
|
2294
|
+
return new Rt({
|
|
2295
|
+
check: "length_equals",
|
|
2296
|
+
...L(t),
|
|
2297
|
+
length: e
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
// @__NO_SIDE_EFFECTS__
|
|
2301
|
+
function Xr(e, t) {
|
|
2302
|
+
return new Bt({
|
|
2303
|
+
check: "string_format",
|
|
2304
|
+
format: "regex",
|
|
2305
|
+
...L(t),
|
|
2306
|
+
pattern: e
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
// @__NO_SIDE_EFFECTS__
|
|
2310
|
+
function Zr(e) {
|
|
2311
|
+
return new Vt({
|
|
2312
|
+
check: "string_format",
|
|
2313
|
+
format: "lowercase",
|
|
2314
|
+
...L(e)
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
// @__NO_SIDE_EFFECTS__
|
|
2318
|
+
function Qr(e) {
|
|
2319
|
+
return new Ht({
|
|
2320
|
+
check: "string_format",
|
|
2321
|
+
format: "uppercase",
|
|
2322
|
+
...L(e)
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
// @__NO_SIDE_EFFECTS__
|
|
2326
|
+
function $r(e, t) {
|
|
2327
|
+
return new Ut({
|
|
2328
|
+
check: "string_format",
|
|
2329
|
+
format: "includes",
|
|
2330
|
+
...L(t),
|
|
2331
|
+
includes: e
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
// @__NO_SIDE_EFFECTS__
|
|
2335
|
+
function ei(e, t) {
|
|
2336
|
+
return new Wt({
|
|
2337
|
+
check: "string_format",
|
|
2338
|
+
format: "starts_with",
|
|
2339
|
+
...L(t),
|
|
2340
|
+
prefix: e
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
// @__NO_SIDE_EFFECTS__
|
|
2344
|
+
function ti(e, t) {
|
|
2345
|
+
return new Gt({
|
|
2346
|
+
check: "string_format",
|
|
2347
|
+
format: "ends_with",
|
|
2348
|
+
...L(t),
|
|
2349
|
+
suffix: e
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2352
|
+
// @__NO_SIDE_EFFECTS__
|
|
2353
|
+
function ni(e) {
|
|
2354
|
+
return new Kt({
|
|
2355
|
+
check: "overwrite",
|
|
2356
|
+
tx: e
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
// @__NO_SIDE_EFFECTS__
|
|
2360
|
+
function ri(e) {
|
|
2361
|
+
return /* @__PURE__ */ ni((t) => t.normalize(e));
|
|
2362
|
+
}
|
|
2363
|
+
// @__NO_SIDE_EFFECTS__
|
|
2364
|
+
function ii() {
|
|
2365
|
+
return /* @__PURE__ */ ni((e) => e.trim());
|
|
2366
|
+
}
|
|
2367
|
+
// @__NO_SIDE_EFFECTS__
|
|
2368
|
+
function ai() {
|
|
2369
|
+
return /* @__PURE__ */ ni((e) => e.toLowerCase());
|
|
2370
|
+
}
|
|
2371
|
+
// @__NO_SIDE_EFFECTS__
|
|
2372
|
+
function oi() {
|
|
2373
|
+
return /* @__PURE__ */ ni((e) => e.toUpperCase());
|
|
2374
|
+
}
|
|
2375
|
+
// @__NO_SIDE_EFFECTS__
|
|
2376
|
+
function si() {
|
|
2377
|
+
return /* @__PURE__ */ ni((e) => ge(e));
|
|
2378
|
+
}
|
|
2379
|
+
// @__NO_SIDE_EFFECTS__
|
|
2380
|
+
function ci(e, t, n) {
|
|
2381
|
+
return new e({
|
|
2382
|
+
type: "array",
|
|
2383
|
+
element: t,
|
|
2384
|
+
...L(n)
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
// @__NO_SIDE_EFFECTS__
|
|
2388
|
+
function li(e, t, n) {
|
|
2389
|
+
return new e({
|
|
2390
|
+
type: "custom",
|
|
2391
|
+
check: "custom",
|
|
2392
|
+
fn: t,
|
|
2393
|
+
...L(n)
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
// @__NO_SIDE_EFFECTS__
|
|
2397
|
+
function ui(e, t) {
|
|
2398
|
+
let n = /* @__PURE__ */ di((t) => (t.addIssue = (e) => {
|
|
2399
|
+
if (typeof e == "string") t.issues.push(Pe(e, t.value, n._zod.def));
|
|
2400
|
+
else {
|
|
2401
|
+
let r = e;
|
|
2402
|
+
r.fatal && (r.continue = !1), r.code ??= "custom", r.input ??= t.value, r.inst ??= n, r.continue ??= !n._zod.def.abort, t.issues.push(Pe(r));
|
|
2403
|
+
}
|
|
2404
|
+
}, e(t.value, t)), t);
|
|
2405
|
+
return n;
|
|
2406
|
+
}
|
|
2407
|
+
// @__NO_SIDE_EFFECTS__
|
|
2408
|
+
function di(e, t) {
|
|
2409
|
+
let n = new V({
|
|
2410
|
+
check: "custom",
|
|
2411
|
+
...L(t)
|
|
2412
|
+
});
|
|
2413
|
+
return n._zod.check = e, n;
|
|
2414
|
+
}
|
|
2415
|
+
//#endregion
|
|
2416
|
+
//#region node_modules/zod/v4/core/to-json-schema.js
|
|
2417
|
+
function fi(e) {
|
|
2418
|
+
let t = e?.target ?? "draft-2020-12";
|
|
2419
|
+
return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
|
|
2420
|
+
processors: e.processors ?? {},
|
|
2421
|
+
metadataRegistry: e?.metadata ?? lr,
|
|
2422
|
+
target: t,
|
|
2423
|
+
unrepresentable: e?.unrepresentable ?? "throw",
|
|
2424
|
+
override: e?.override ?? (() => {}),
|
|
2425
|
+
io: e?.io ?? "output",
|
|
2426
|
+
counter: 0,
|
|
2427
|
+
seen: /* @__PURE__ */ new Map(),
|
|
2428
|
+
cycles: e?.cycles ?? "ref",
|
|
2429
|
+
reused: e?.reused ?? "inline",
|
|
2430
|
+
external: e?.external ?? void 0
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2433
|
+
function W(e, t, n = {
|
|
2434
|
+
path: [],
|
|
2435
|
+
schemaPath: []
|
|
2436
|
+
}) {
|
|
2437
|
+
var r;
|
|
2438
|
+
let i = e._zod.def, a = t.seen.get(e);
|
|
2439
|
+
if (a) return a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema;
|
|
2440
|
+
let o = {
|
|
2441
|
+
schema: {},
|
|
2442
|
+
count: 1,
|
|
2443
|
+
cycle: void 0,
|
|
2444
|
+
path: n.path
|
|
2445
|
+
};
|
|
2446
|
+
t.seen.set(e, o);
|
|
2447
|
+
let s = e._zod.toJSONSchema?.();
|
|
2448
|
+
if (s) o.schema = s;
|
|
2449
|
+
else {
|
|
2450
|
+
let r = {
|
|
2451
|
+
...n,
|
|
2452
|
+
schemaPath: [...n.schemaPath, e],
|
|
2453
|
+
path: n.path
|
|
2454
|
+
};
|
|
2455
|
+
if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r);
|
|
2456
|
+
else {
|
|
2457
|
+
let n = o.schema, a = t.processors[i.type];
|
|
2458
|
+
if (!a) throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
|
|
2459
|
+
a(e, t, n, r);
|
|
2460
|
+
}
|
|
2461
|
+
let a = e._zod.parent;
|
|
2462
|
+
a && (o.ref ||= a, W(a, t, r), t.seen.get(a).isParent = !0);
|
|
2463
|
+
}
|
|
2464
|
+
let c = t.metadataRegistry.get(e);
|
|
2465
|
+
return c && Object.assign(o.schema, c), t.io === "input" && G(e) && (delete o.schema.examples, delete o.schema.default), t.io === "input" && "_prefault" in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema;
|
|
2466
|
+
}
|
|
2467
|
+
function pi(e, t) {
|
|
2468
|
+
let n = e.seen.get(t);
|
|
2469
|
+
if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
|
|
2470
|
+
let r = /* @__PURE__ */ new Map();
|
|
2471
|
+
for (let t of e.seen.entries()) {
|
|
2472
|
+
let n = e.metadataRegistry.get(t[0])?.id;
|
|
2473
|
+
if (n) {
|
|
2474
|
+
let e = r.get(n);
|
|
2475
|
+
if (e && e !== t[0]) throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
2476
|
+
r.set(n, t[0]);
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
let i = (t) => {
|
|
2480
|
+
let r = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2481
|
+
if (e.external) {
|
|
2482
|
+
let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e);
|
|
2483
|
+
if (n) return { ref: i(n) };
|
|
2484
|
+
let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`;
|
|
2485
|
+
return t[1].defId = a, {
|
|
2486
|
+
defId: a,
|
|
2487
|
+
ref: `${i("__shared")}#/${r}/${a}`
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
if (t[1] === n) return { ref: "#" };
|
|
2491
|
+
let i = `#/${r}/`, a = t[1].schema.id ?? `__schema${e.counter++}`;
|
|
2492
|
+
return {
|
|
2493
|
+
defId: a,
|
|
2494
|
+
ref: i + a
|
|
2495
|
+
};
|
|
2496
|
+
}, a = (e) => {
|
|
2497
|
+
if (e[1].schema.$ref) return;
|
|
2498
|
+
let t = e[1], { ref: n, defId: r } = i(e);
|
|
2499
|
+
t.def = { ...t.schema }, r && (t.defId = r);
|
|
2500
|
+
let a = t.schema;
|
|
2501
|
+
for (let e in a) delete a[e];
|
|
2502
|
+
a.$ref = n;
|
|
2503
|
+
};
|
|
2504
|
+
if (e.cycles === "throw") for (let t of e.seen.entries()) {
|
|
2505
|
+
let e = t[1];
|
|
2506
|
+
if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
2507
|
+
|
|
2508
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
2509
|
+
}
|
|
2510
|
+
for (let n of e.seen.entries()) {
|
|
2511
|
+
let r = n[1];
|
|
2512
|
+
if (t === n[0]) {
|
|
2513
|
+
a(n);
|
|
2514
|
+
continue;
|
|
2515
|
+
}
|
|
2516
|
+
if (e.external) {
|
|
2517
|
+
let r = e.external.registry.get(n[0])?.id;
|
|
2518
|
+
if (t !== n[0] && r) {
|
|
2519
|
+
a(n);
|
|
2520
|
+
continue;
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
if (e.metadataRegistry.get(n[0])?.id) {
|
|
2524
|
+
a(n);
|
|
2525
|
+
continue;
|
|
2526
|
+
}
|
|
2527
|
+
if (r.cycle) {
|
|
2528
|
+
a(n);
|
|
2529
|
+
continue;
|
|
2530
|
+
}
|
|
2531
|
+
if (r.count > 1 && e.reused === "ref") {
|
|
2532
|
+
a(n);
|
|
2533
|
+
continue;
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
function mi(e, t) {
|
|
2538
|
+
let n = e.seen.get(t);
|
|
2539
|
+
if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
|
|
2540
|
+
let r = (t) => {
|
|
2541
|
+
let n = e.seen.get(t);
|
|
2542
|
+
if (n.ref === null) return;
|
|
2543
|
+
let i = n.def ?? n.schema, a = { ...i }, o = n.ref;
|
|
2544
|
+
if (n.ref = null, o) {
|
|
2545
|
+
r(o);
|
|
2546
|
+
let n = e.seen.get(o), s = n.schema;
|
|
2547
|
+
if (s.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (i.allOf = i.allOf ?? [], i.allOf.push(s)) : Object.assign(i, s), Object.assign(i, a), t._zod.parent === o) for (let e in i) e === "$ref" || e === "allOf" || e in a || delete i[e];
|
|
2548
|
+
if (s.$ref && n.def) for (let e in i) e === "$ref" || e === "allOf" || e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e];
|
|
2549
|
+
}
|
|
2550
|
+
let s = t._zod.parent;
|
|
2551
|
+
if (s && s !== o) {
|
|
2552
|
+
r(s);
|
|
2553
|
+
let t = e.seen.get(s);
|
|
2554
|
+
if (t?.schema.$ref && (i.$ref = t.schema.$ref, t.def)) for (let e in i) e === "$ref" || e === "allOf" || e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e];
|
|
2555
|
+
}
|
|
2556
|
+
e.override({
|
|
2557
|
+
zodSchema: t,
|
|
2558
|
+
jsonSchema: i,
|
|
2559
|
+
path: n.path ?? []
|
|
2560
|
+
});
|
|
2561
|
+
};
|
|
2562
|
+
for (let t of [...e.seen.entries()].reverse()) r(t[0]);
|
|
2563
|
+
let i = {};
|
|
2564
|
+
if (e.target === "draft-2020-12" ? i.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? i.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? i.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
|
|
2565
|
+
let n = e.external.registry.get(t)?.id;
|
|
2566
|
+
if (!n) throw Error("Schema is missing an `id` property");
|
|
2567
|
+
i.$id = e.external.uri(n);
|
|
2568
|
+
}
|
|
2569
|
+
Object.assign(i, n.def ?? n.schema);
|
|
2570
|
+
let a = e.metadataRegistry.get(t)?.id;
|
|
2571
|
+
a !== void 0 && i.id === a && delete i.id;
|
|
2572
|
+
let o = e.external?.defs ?? {};
|
|
2573
|
+
for (let t of e.seen.entries()) {
|
|
2574
|
+
let e = t[1];
|
|
2575
|
+
e.def && e.defId && (e.def.id === e.defId && delete e.def.id, o[e.defId] = e.def);
|
|
2576
|
+
}
|
|
2577
|
+
e.external || Object.keys(o).length > 0 && (e.target === "draft-2020-12" ? i.$defs = o : i.definitions = o);
|
|
2578
|
+
try {
|
|
2579
|
+
let n = JSON.parse(JSON.stringify(i));
|
|
2580
|
+
return Object.defineProperty(n, "~standard", {
|
|
2581
|
+
value: {
|
|
2582
|
+
...t["~standard"],
|
|
2583
|
+
jsonSchema: {
|
|
2584
|
+
input: gi(t, "input", e.processors),
|
|
2585
|
+
output: gi(t, "output", e.processors)
|
|
2586
|
+
}
|
|
2587
|
+
},
|
|
2588
|
+
enumerable: !1,
|
|
2589
|
+
writable: !1
|
|
2590
|
+
}), n;
|
|
2591
|
+
} catch {
|
|
2592
|
+
throw Error("Error converting schema to JSON.");
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
function G(e, t) {
|
|
2596
|
+
let n = t ?? { seen: /* @__PURE__ */ new Set() };
|
|
2597
|
+
if (n.seen.has(e)) return !1;
|
|
2598
|
+
n.seen.add(e);
|
|
2599
|
+
let r = e._zod.def;
|
|
2600
|
+
if (r.type === "transform") return !0;
|
|
2601
|
+
if (r.type === "array") return G(r.element, n);
|
|
2602
|
+
if (r.type === "set") return G(r.valueType, n);
|
|
2603
|
+
if (r.type === "lazy") return G(r.getter(), n);
|
|
2604
|
+
if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault") return G(r.innerType, n);
|
|
2605
|
+
if (r.type === "intersection") return G(r.left, n) || G(r.right, n);
|
|
2606
|
+
if (r.type === "record" || r.type === "map") return G(r.keyType, n) || G(r.valueType, n);
|
|
2607
|
+
if (r.type === "pipe") return e._zod.traits.has("$ZodCodec") ? !0 : G(r.in, n) || G(r.out, n);
|
|
2608
|
+
if (r.type === "object") {
|
|
2609
|
+
for (let e in r.shape) if (G(r.shape[e], n)) return !0;
|
|
2610
|
+
return !1;
|
|
2611
|
+
}
|
|
2612
|
+
if (r.type === "union") {
|
|
2613
|
+
for (let e of r.options) if (G(e, n)) return !0;
|
|
2614
|
+
return !1;
|
|
2615
|
+
}
|
|
2616
|
+
if (r.type === "tuple") {
|
|
2617
|
+
for (let e of r.items) if (G(e, n)) return !0;
|
|
2618
|
+
return !!(r.rest && G(r.rest, n));
|
|
2619
|
+
}
|
|
2620
|
+
return !1;
|
|
2621
|
+
}
|
|
2622
|
+
var hi = (e, t = {}) => (n) => {
|
|
2623
|
+
let r = fi({
|
|
2624
|
+
...n,
|
|
2625
|
+
processors: t
|
|
2626
|
+
});
|
|
2627
|
+
return W(e, r), pi(r, e), mi(r, e);
|
|
2628
|
+
}, gi = (e, t, n = {}) => (r) => {
|
|
2629
|
+
let { libraryOptions: i, target: a } = r ?? {}, o = fi({
|
|
2630
|
+
...i ?? {},
|
|
2631
|
+
target: a,
|
|
2632
|
+
io: t,
|
|
2633
|
+
processors: n
|
|
2634
|
+
});
|
|
2635
|
+
return W(e, o), pi(o, e), mi(o, e);
|
|
2636
|
+
}, _i = {
|
|
2637
|
+
guid: "uuid",
|
|
2638
|
+
url: "uri",
|
|
2639
|
+
datetime: "date-time",
|
|
2640
|
+
json_string: "json-string",
|
|
2641
|
+
regex: ""
|
|
2642
|
+
}, vi = (e, t, n, r) => {
|
|
2643
|
+
let i = n;
|
|
2644
|
+
i.type = "string";
|
|
2645
|
+
let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l } = e._zod.bag;
|
|
2646
|
+
if (typeof a == "number" && (i.minLength = a), typeof o == "number" && (i.maxLength = o), s && (i.format = _i[s] ?? s, i.format === "" && delete i.format, s === "time" && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) {
|
|
2647
|
+
let e = [...c];
|
|
2648
|
+
e.length === 1 ? i.pattern = e[0].source : e.length > 1 && (i.allOf = [...e.map((e) => ({
|
|
2649
|
+
...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
|
|
2650
|
+
pattern: e.source
|
|
2651
|
+
}))]);
|
|
2652
|
+
}
|
|
2653
|
+
}, yi = (e, t, n, r) => {
|
|
2654
|
+
let i = n, { minimum: a, maximum: o, format: s, multipleOf: c, exclusiveMaximum: l, exclusiveMinimum: u } = e._zod.bag;
|
|
2655
|
+
typeof s == "string" && s.includes("int") ? i.type = "integer" : i.type = "number";
|
|
2656
|
+
let d = typeof u == "number" && u >= (a ?? -Infinity), f = typeof l == "number" && l <= (o ?? Infinity), p = t.target === "draft-04" || t.target === "openapi-3.0";
|
|
2657
|
+
d ? p ? (i.minimum = u, i.exclusiveMinimum = !0) : i.exclusiveMinimum = u : typeof a == "number" && (i.minimum = a), f ? p ? (i.maximum = l, i.exclusiveMaximum = !0) : i.exclusiveMaximum = l : typeof o == "number" && (i.maximum = o), typeof c == "number" && (i.multipleOf = c);
|
|
2658
|
+
}, bi = (e, t, n, r) => {
|
|
2659
|
+
n.type = "boolean";
|
|
2660
|
+
}, xi = (e, t, n, r) => {
|
|
2661
|
+
n.not = {};
|
|
2662
|
+
}, Si = (e, t, n, r) => {
|
|
2663
|
+
let i = e._zod.def, a = ue(i.entries);
|
|
2664
|
+
a.every((e) => typeof e == "number") && (n.type = "number"), a.every((e) => typeof e == "string") && (n.type = "string"), n.enum = a;
|
|
2665
|
+
}, Ci = (e, t, n, r) => {
|
|
2666
|
+
let i = e._zod.def, a = [];
|
|
2667
|
+
for (let e of i.values) if (e === void 0) {
|
|
2668
|
+
if (t.unrepresentable === "throw") throw Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
2669
|
+
} else if (typeof e == "bigint") {
|
|
2670
|
+
if (t.unrepresentable === "throw") throw Error("BigInt literals cannot be represented in JSON Schema");
|
|
2671
|
+
a.push(Number(e));
|
|
2672
|
+
} else a.push(e);
|
|
2673
|
+
if (a.length !== 0) if (a.length === 1) {
|
|
2674
|
+
let e = a[0];
|
|
2675
|
+
n.type = e === null ? "null" : typeof e, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [e] : n.const = e;
|
|
2676
|
+
} else a.every((e) => typeof e == "number") && (n.type = "number"), a.every((e) => typeof e == "string") && (n.type = "string"), a.every((e) => typeof e == "boolean") && (n.type = "boolean"), a.every((e) => e === null) && (n.type = "null"), n.enum = a;
|
|
2677
|
+
}, wi = (e, t, n, r) => {
|
|
2678
|
+
if (t.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
|
|
2679
|
+
}, Ti = (e, t, n, r) => {
|
|
2680
|
+
if (t.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
|
|
2681
|
+
}, Ei = (e, t, n, r) => {
|
|
2682
|
+
let i = n, a = e._zod.def, { minimum: o, maximum: s } = e._zod.bag;
|
|
2683
|
+
typeof o == "number" && (i.minItems = o), typeof s == "number" && (i.maxItems = s), i.type = "array", i.items = W(a.element, t, {
|
|
2684
|
+
...r,
|
|
2685
|
+
path: [...r.path, "items"]
|
|
2686
|
+
});
|
|
2687
|
+
}, Di = (e, t, n, r) => {
|
|
2688
|
+
let i = n, a = e._zod.def;
|
|
2689
|
+
i.type = "object", i.properties = {};
|
|
2690
|
+
let o = a.shape;
|
|
2691
|
+
for (let e in o) i.properties[e] = W(o[e], t, {
|
|
2692
|
+
...r,
|
|
2693
|
+
path: [
|
|
2694
|
+
...r.path,
|
|
2695
|
+
"properties",
|
|
2696
|
+
e
|
|
2697
|
+
]
|
|
2698
|
+
});
|
|
2699
|
+
let s = new Set(Object.keys(o)), c = new Set([...s].filter((e) => {
|
|
2700
|
+
let n = a.shape[e]._zod;
|
|
2701
|
+
return t.io === "input" ? n.optin === void 0 : n.optout === void 0;
|
|
2702
|
+
}));
|
|
2703
|
+
c.size > 0 && (i.required = Array.from(c)), a.catchall?._zod.def.type === "never" ? i.additionalProperties = !1 : a.catchall ? a.catchall && (i.additionalProperties = W(a.catchall, t, {
|
|
2704
|
+
...r,
|
|
2705
|
+
path: [...r.path, "additionalProperties"]
|
|
2706
|
+
})) : t.io === "output" && (i.additionalProperties = !1);
|
|
2707
|
+
}, Oi = (e, t, n, r) => {
|
|
2708
|
+
let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => W(e, t, {
|
|
2709
|
+
...r,
|
|
2710
|
+
path: [
|
|
2711
|
+
...r.path,
|
|
2712
|
+
a ? "oneOf" : "anyOf",
|
|
2713
|
+
n
|
|
2714
|
+
]
|
|
2715
|
+
}));
|
|
2716
|
+
a ? n.oneOf = o : n.anyOf = o;
|
|
2717
|
+
}, ki = (e, t, n, r) => {
|
|
2718
|
+
let i = e._zod.def, a = W(i.left, t, {
|
|
2719
|
+
...r,
|
|
2720
|
+
path: [
|
|
2721
|
+
...r.path,
|
|
2722
|
+
"allOf",
|
|
2723
|
+
0
|
|
2724
|
+
]
|
|
2725
|
+
}), o = W(i.right, t, {
|
|
2726
|
+
...r,
|
|
2727
|
+
path: [
|
|
2728
|
+
...r.path,
|
|
2729
|
+
"allOf",
|
|
2730
|
+
1
|
|
2731
|
+
]
|
|
2732
|
+
}), s = (e) => "allOf" in e && Object.keys(e).length === 1;
|
|
2733
|
+
n.allOf = [...s(a) ? a.allOf : [a], ...s(o) ? o.allOf : [o]];
|
|
2734
|
+
}, Ai = (e, t, n, r) => {
|
|
2735
|
+
let i = n, a = e._zod.def;
|
|
2736
|
+
i.type = "object";
|
|
2737
|
+
let o = a.keyType, s = o._zod.bag?.patterns;
|
|
2738
|
+
if (a.mode === "loose" && s && s.size > 0) {
|
|
2739
|
+
let e = W(a.valueType, t, {
|
|
2740
|
+
...r,
|
|
2741
|
+
path: [
|
|
2742
|
+
...r.path,
|
|
2743
|
+
"patternProperties",
|
|
2744
|
+
"*"
|
|
2745
|
+
]
|
|
2746
|
+
});
|
|
2747
|
+
i.patternProperties = {};
|
|
2748
|
+
for (let t of s) i.patternProperties[t.source] = e;
|
|
2749
|
+
} else (t.target === "draft-07" || t.target === "draft-2020-12") && (i.propertyNames = W(a.keyType, t, {
|
|
2750
|
+
...r,
|
|
2751
|
+
path: [...r.path, "propertyNames"]
|
|
2752
|
+
})), i.additionalProperties = W(a.valueType, t, {
|
|
2753
|
+
...r,
|
|
2754
|
+
path: [...r.path, "additionalProperties"]
|
|
2755
|
+
});
|
|
2756
|
+
let c = o._zod.values;
|
|
2757
|
+
if (c) {
|
|
2758
|
+
let e = [...c].filter((e) => typeof e == "string" || typeof e == "number");
|
|
2759
|
+
e.length > 0 && (i.required = e);
|
|
2760
|
+
}
|
|
2761
|
+
}, ji = (e, t, n, r) => {
|
|
2762
|
+
let i = e._zod.def, a = W(i.innerType, t, r), o = t.seen.get(e);
|
|
2763
|
+
t.target === "openapi-3.0" ? (o.ref = i.innerType, n.nullable = !0) : n.anyOf = [a, { type: "null" }];
|
|
2764
|
+
}, Mi = (e, t, n, r) => {
|
|
2765
|
+
let i = e._zod.def;
|
|
2766
|
+
W(i.innerType, t, r);
|
|
2767
|
+
let a = t.seen.get(e);
|
|
2768
|
+
a.ref = i.innerType;
|
|
2769
|
+
}, Ni = (e, t, n, r) => {
|
|
2770
|
+
let i = e._zod.def;
|
|
2771
|
+
W(i.innerType, t, r);
|
|
2772
|
+
let a = t.seen.get(e);
|
|
2773
|
+
a.ref = i.innerType, n.default = JSON.parse(JSON.stringify(i.defaultValue));
|
|
2774
|
+
}, Pi = (e, t, n, r) => {
|
|
2775
|
+
let i = e._zod.def;
|
|
2776
|
+
W(i.innerType, t, r);
|
|
2777
|
+
let a = t.seen.get(e);
|
|
2778
|
+
a.ref = i.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
|
|
2779
|
+
}, Fi = (e, t, n, r) => {
|
|
2780
|
+
let i = e._zod.def;
|
|
2781
|
+
W(i.innerType, t, r);
|
|
2782
|
+
let a = t.seen.get(e);
|
|
2783
|
+
a.ref = i.innerType;
|
|
2784
|
+
let o;
|
|
2785
|
+
try {
|
|
2786
|
+
o = i.catchValue(void 0);
|
|
2787
|
+
} catch {
|
|
2788
|
+
throw Error("Dynamic catch values are not supported in JSON Schema");
|
|
2789
|
+
}
|
|
2790
|
+
n.default = o;
|
|
2791
|
+
}, Ii = (e, t, n, r) => {
|
|
2792
|
+
let i = e._zod.def, a = i.in._zod.traits.has("$ZodTransform"), o = t.io === "input" ? a ? i.out : i.in : i.out;
|
|
2793
|
+
W(o, t, r);
|
|
2794
|
+
let s = t.seen.get(e);
|
|
2795
|
+
s.ref = o;
|
|
2796
|
+
}, Li = (e, t, n, r) => {
|
|
2797
|
+
let i = e._zod.def;
|
|
2798
|
+
W(i.innerType, t, r);
|
|
2799
|
+
let a = t.seen.get(e);
|
|
2800
|
+
a.ref = i.innerType, n.readOnly = !0;
|
|
2801
|
+
}, Ri = (e, t, n, r) => {
|
|
2802
|
+
let i = e._zod.def;
|
|
2803
|
+
W(i.innerType, t, r);
|
|
2804
|
+
let a = t.seen.get(e);
|
|
2805
|
+
a.ref = i.innerType;
|
|
2806
|
+
}, zi = /*@__PURE__*/ T("ZodISODateTime", (e, t) => {
|
|
2807
|
+
cn.init(e, t), Y.init(e, t);
|
|
2808
|
+
});
|
|
2809
|
+
function Bi(e) {
|
|
2810
|
+
return /* @__PURE__ */ Nr(zi, e);
|
|
2811
|
+
}
|
|
2812
|
+
var Vi = /*@__PURE__*/ T("ZodISODate", (e, t) => {
|
|
2813
|
+
ln.init(e, t), Y.init(e, t);
|
|
2814
|
+
});
|
|
2815
|
+
function Hi(e) {
|
|
2816
|
+
return /* @__PURE__ */ Pr(Vi, e);
|
|
2817
|
+
}
|
|
2818
|
+
var Ui = /*@__PURE__*/ T("ZodISOTime", (e, t) => {
|
|
2819
|
+
un.init(e, t), Y.init(e, t);
|
|
2820
|
+
});
|
|
2821
|
+
function Wi(e) {
|
|
2822
|
+
return /* @__PURE__ */ Fr(Ui, e);
|
|
2823
|
+
}
|
|
2824
|
+
var Gi = /*@__PURE__*/ T("ZodISODuration", (e, t) => {
|
|
2825
|
+
dn.init(e, t), Y.init(e, t);
|
|
2826
|
+
});
|
|
2827
|
+
function Ki(e) {
|
|
2828
|
+
return /* @__PURE__ */ Ir(Gi, e);
|
|
2829
|
+
}
|
|
2830
|
+
var K = /*@__PURE__*/ T("ZodError", (e, t) => {
|
|
2831
|
+
Ie.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2832
|
+
format: { value: (t) => ze(e, t) },
|
|
2833
|
+
flatten: { value: (t) => Re(e, t) },
|
|
2834
|
+
addIssue: { value: (t) => {
|
|
2835
|
+
e.issues.push(t), e.message = JSON.stringify(e.issues, de, 2);
|
|
2836
|
+
} },
|
|
2837
|
+
addIssues: { value: (t) => {
|
|
2838
|
+
e.issues.push(...t), e.message = JSON.stringify(e.issues, de, 2);
|
|
2839
|
+
} },
|
|
2840
|
+
isEmpty: { get() {
|
|
2841
|
+
return e.issues.length === 0;
|
|
2842
|
+
} }
|
|
2843
|
+
});
|
|
2844
|
+
}, { Parent: Error }), qi = /* @__PURE__ */ Be(K), Ji = /* @__PURE__ */ Ve(K), Yi = /* @__PURE__ */ He(K), Xi = /* @__PURE__ */ We(K), Zi = /* @__PURE__ */ Ke(K), Qi = /* @__PURE__ */ qe(K), $i = /* @__PURE__ */ Je(K), ea = /* @__PURE__ */ Ye(K), ta = /* @__PURE__ */ Xe(K), na = /* @__PURE__ */ Ze(K), ra = /* @__PURE__ */ Qe(K), ia = /* @__PURE__ */ $e(K), aa = /* @__PURE__ */ new WeakMap();
|
|
2845
|
+
function oa(e, t, n) {
|
|
2846
|
+
let r = Object.getPrototypeOf(e), i = aa.get(r);
|
|
2847
|
+
if (i || (i = /* @__PURE__ */ new Set(), aa.set(r, i)), !i.has(t)) {
|
|
2848
|
+
i.add(t);
|
|
2849
|
+
for (let e in n) {
|
|
2850
|
+
let t = n[e];
|
|
2851
|
+
Object.defineProperty(r, e, {
|
|
2852
|
+
configurable: !0,
|
|
2853
|
+
enumerable: !1,
|
|
2854
|
+
get() {
|
|
2855
|
+
let n = t.bind(this);
|
|
2856
|
+
return Object.defineProperty(this, e, {
|
|
2857
|
+
configurable: !0,
|
|
2858
|
+
writable: !0,
|
|
2859
|
+
enumerable: !0,
|
|
2860
|
+
value: n
|
|
2861
|
+
}), n;
|
|
2862
|
+
},
|
|
2863
|
+
set(t) {
|
|
2864
|
+
Object.defineProperty(this, e, {
|
|
2865
|
+
configurable: !0,
|
|
2866
|
+
writable: !0,
|
|
2867
|
+
enumerable: !0,
|
|
2868
|
+
value: t
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
var q = /*@__PURE__*/ T("ZodType", (e, t) => (H.init(e, t), Object.assign(e["~standard"], { jsonSchema: {
|
|
2876
|
+
input: gi(e, "input"),
|
|
2877
|
+
output: gi(e, "output")
|
|
2878
|
+
} }), e.toJSONSchema = hi(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (t, n) => qi(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => Yi(e, t, n), e.parseAsync = async (t, n) => Ji(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => Xi(e, t, n), e.spa = e.safeParseAsync, e.encode = (t, n) => Zi(e, t, n), e.decode = (t, n) => Qi(e, t, n), e.encodeAsync = async (t, n) => $i(e, t, n), e.decodeAsync = async (t, n) => ea(e, t, n), e.safeEncode = (t, n) => ta(e, t, n), e.safeDecode = (t, n) => na(e, t, n), e.safeEncodeAsync = async (t, n) => ra(e, t, n), e.safeDecodeAsync = async (t, n) => ia(e, t, n), oa(e, "ZodType", {
|
|
2879
|
+
check(...e) {
|
|
2880
|
+
let t = this.def;
|
|
2881
|
+
return this.clone(M(t, { checks: [...t.checks ?? [], ...e.map((e) => typeof e == "function" ? { _zod: {
|
|
2882
|
+
check: e,
|
|
2883
|
+
def: { check: "custom" },
|
|
2884
|
+
onattach: []
|
|
2885
|
+
} } : e)] }), { parent: !0 });
|
|
2886
|
+
},
|
|
2887
|
+
with(...e) {
|
|
2888
|
+
return this.check(...e);
|
|
2889
|
+
},
|
|
2890
|
+
clone(e, t) {
|
|
2891
|
+
return I(this, e, t);
|
|
2892
|
+
},
|
|
2893
|
+
brand() {
|
|
2894
|
+
return this;
|
|
2895
|
+
},
|
|
2896
|
+
register(e, t) {
|
|
2897
|
+
return e.add(this, t), this;
|
|
2898
|
+
},
|
|
2899
|
+
refine(e, t) {
|
|
2900
|
+
return this.check(vo(e, t));
|
|
2901
|
+
},
|
|
2902
|
+
superRefine(e, t) {
|
|
2903
|
+
return this.check(yo(e, t));
|
|
2904
|
+
},
|
|
2905
|
+
overwrite(e) {
|
|
2906
|
+
return this.check(/* @__PURE__ */ ni(e));
|
|
2907
|
+
},
|
|
2908
|
+
optional() {
|
|
2909
|
+
return $a(this);
|
|
2910
|
+
},
|
|
2911
|
+
exactOptional() {
|
|
2912
|
+
return to(this);
|
|
2913
|
+
},
|
|
2914
|
+
nullable() {
|
|
2915
|
+
return ro(this);
|
|
2916
|
+
},
|
|
2917
|
+
nullish() {
|
|
2918
|
+
return $a(ro(this));
|
|
2919
|
+
},
|
|
2920
|
+
nonoptional(e) {
|
|
2921
|
+
return lo(this, e);
|
|
2922
|
+
},
|
|
2923
|
+
array() {
|
|
2924
|
+
return za(this);
|
|
2925
|
+
},
|
|
2926
|
+
or(e) {
|
|
2927
|
+
return Ha([this, e]);
|
|
2928
|
+
},
|
|
2929
|
+
and(e) {
|
|
2930
|
+
return Wa(this, e);
|
|
2931
|
+
},
|
|
2932
|
+
transform(e) {
|
|
2933
|
+
return mo(this, Za(e));
|
|
2934
|
+
},
|
|
2935
|
+
default(e) {
|
|
2936
|
+
return ao(this, e);
|
|
2937
|
+
},
|
|
2938
|
+
prefault(e) {
|
|
2939
|
+
return so(this, e);
|
|
2940
|
+
},
|
|
2941
|
+
catch(e) {
|
|
2942
|
+
return fo(this, e);
|
|
2943
|
+
},
|
|
2944
|
+
pipe(e) {
|
|
2945
|
+
return mo(this, e);
|
|
2946
|
+
},
|
|
2947
|
+
readonly() {
|
|
2948
|
+
return go(this);
|
|
2949
|
+
},
|
|
2950
|
+
describe(e) {
|
|
2951
|
+
let t = this.clone();
|
|
2952
|
+
return lr.add(t, { description: e }), t;
|
|
2953
|
+
},
|
|
2954
|
+
meta(...e) {
|
|
2955
|
+
if (e.length === 0) return lr.get(this);
|
|
2956
|
+
let t = this.clone();
|
|
2957
|
+
return lr.add(t, e[0]), t;
|
|
2958
|
+
},
|
|
2959
|
+
isOptional() {
|
|
2960
|
+
return this.safeParse(void 0).success;
|
|
2961
|
+
},
|
|
2962
|
+
isNullable() {
|
|
2963
|
+
return this.safeParse(null).success;
|
|
2964
|
+
},
|
|
2965
|
+
apply(e) {
|
|
2966
|
+
return e(this);
|
|
2967
|
+
}
|
|
2968
|
+
}), Object.defineProperty(e, "description", {
|
|
2969
|
+
get() {
|
|
2970
|
+
return lr.get(e)?.description;
|
|
2971
|
+
},
|
|
2972
|
+
configurable: !0
|
|
2973
|
+
}), e)), sa = /*@__PURE__*/ T("_ZodString", (e, t) => {
|
|
2974
|
+
Yt.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => vi(e, t, n, r);
|
|
2975
|
+
let n = e._zod.bag;
|
|
2976
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, oa(e, "_ZodString", {
|
|
2977
|
+
regex(...e) {
|
|
2978
|
+
return this.check(/* @__PURE__ */ Xr(...e));
|
|
2979
|
+
},
|
|
2980
|
+
includes(...e) {
|
|
2981
|
+
return this.check(/* @__PURE__ */ $r(...e));
|
|
2982
|
+
},
|
|
2983
|
+
startsWith(...e) {
|
|
2984
|
+
return this.check(/* @__PURE__ */ ei(...e));
|
|
2985
|
+
},
|
|
2986
|
+
endsWith(...e) {
|
|
2987
|
+
return this.check(/* @__PURE__ */ ti(...e));
|
|
2988
|
+
},
|
|
2989
|
+
min(...e) {
|
|
2990
|
+
return this.check(/* @__PURE__ */ Jr(...e));
|
|
2991
|
+
},
|
|
2992
|
+
max(...e) {
|
|
2993
|
+
return this.check(/* @__PURE__ */ qr(...e));
|
|
2994
|
+
},
|
|
2995
|
+
length(...e) {
|
|
2996
|
+
return this.check(/* @__PURE__ */ Yr(...e));
|
|
2997
|
+
},
|
|
2998
|
+
nonempty(...e) {
|
|
2999
|
+
return this.check(/* @__PURE__ */ Jr(1, ...e));
|
|
3000
|
+
},
|
|
3001
|
+
lowercase(e) {
|
|
3002
|
+
return this.check(/* @__PURE__ */ Zr(e));
|
|
3003
|
+
},
|
|
3004
|
+
uppercase(e) {
|
|
3005
|
+
return this.check(/* @__PURE__ */ Qr(e));
|
|
3006
|
+
},
|
|
3007
|
+
trim() {
|
|
3008
|
+
return this.check(/* @__PURE__ */ ii());
|
|
3009
|
+
},
|
|
3010
|
+
normalize(...e) {
|
|
3011
|
+
return this.check(/* @__PURE__ */ ri(...e));
|
|
3012
|
+
},
|
|
3013
|
+
toLowerCase() {
|
|
3014
|
+
return this.check(/* @__PURE__ */ ai());
|
|
3015
|
+
},
|
|
3016
|
+
toUpperCase() {
|
|
3017
|
+
return this.check(/* @__PURE__ */ oi());
|
|
3018
|
+
},
|
|
3019
|
+
slugify() {
|
|
3020
|
+
return this.check(/* @__PURE__ */ si());
|
|
3021
|
+
}
|
|
3022
|
+
});
|
|
3023
|
+
}), ca = /*@__PURE__*/ T("ZodString", (e, t) => {
|
|
3024
|
+
Yt.init(e, t), sa.init(e, t), e.email = (t) => e.check(/* @__PURE__ */ dr(la, t)), e.url = (t) => e.check(/* @__PURE__ */ _r(fa, t)), e.jwt = (t) => e.check(/* @__PURE__ */ Mr(Da, t)), e.emoji = (t) => e.check(/* @__PURE__ */ vr(pa, t)), e.guid = (t) => e.check(/* @__PURE__ */ fr(ua, t)), e.uuid = (t) => e.check(/* @__PURE__ */ pr(da, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ mr(da, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ hr(da, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ gr(da, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ yr(ma, t)), e.guid = (t) => e.check(/* @__PURE__ */ fr(ua, t)), e.cuid = (t) => e.check(/* @__PURE__ */ br(ha, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ xr(ga, t)), e.ulid = (t) => e.check(/* @__PURE__ */ Sr(_a, t)), e.base64 = (t) => e.check(/* @__PURE__ */ kr(wa, t)), e.base64url = (t) => e.check(/* @__PURE__ */ Ar(Ta, t)), e.xid = (t) => e.check(/* @__PURE__ */ Cr(va, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ wr(ya, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ Tr(ba, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ Er(xa, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ Dr(Sa, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ Or(Ca, t)), e.e164 = (t) => e.check(/* @__PURE__ */ jr(Ea, t)), e.datetime = (t) => e.check(Bi(t)), e.date = (t) => e.check(Hi(t)), e.time = (t) => e.check(Wi(t)), e.duration = (t) => e.check(Ki(t));
|
|
3025
|
+
});
|
|
3026
|
+
function J(e) {
|
|
3027
|
+
return /* @__PURE__ */ ur(ca, e);
|
|
3028
|
+
}
|
|
3029
|
+
var Y = /*@__PURE__*/ T("ZodStringFormat", (e, t) => {
|
|
3030
|
+
U.init(e, t), sa.init(e, t);
|
|
3031
|
+
}), la = /*@__PURE__*/ T("ZodEmail", (e, t) => {
|
|
3032
|
+
Qt.init(e, t), Y.init(e, t);
|
|
3033
|
+
}), ua = /*@__PURE__*/ T("ZodGUID", (e, t) => {
|
|
3034
|
+
Xt.init(e, t), Y.init(e, t);
|
|
3035
|
+
}), da = /*@__PURE__*/ T("ZodUUID", (e, t) => {
|
|
3036
|
+
Zt.init(e, t), Y.init(e, t);
|
|
3037
|
+
}), fa = /*@__PURE__*/ T("ZodURL", (e, t) => {
|
|
3038
|
+
$t.init(e, t), Y.init(e, t);
|
|
3039
|
+
}), pa = /*@__PURE__*/ T("ZodEmoji", (e, t) => {
|
|
3040
|
+
en.init(e, t), Y.init(e, t);
|
|
3041
|
+
}), ma = /*@__PURE__*/ T("ZodNanoID", (e, t) => {
|
|
3042
|
+
tn.init(e, t), Y.init(e, t);
|
|
3043
|
+
}), ha = /*@__PURE__*/ T("ZodCUID", (e, t) => {
|
|
3044
|
+
nn.init(e, t), Y.init(e, t);
|
|
3045
|
+
}), ga = /*@__PURE__*/ T("ZodCUID2", (e, t) => {
|
|
3046
|
+
rn.init(e, t), Y.init(e, t);
|
|
3047
|
+
}), _a = /*@__PURE__*/ T("ZodULID", (e, t) => {
|
|
3048
|
+
an.init(e, t), Y.init(e, t);
|
|
3049
|
+
}), va = /*@__PURE__*/ T("ZodXID", (e, t) => {
|
|
3050
|
+
on.init(e, t), Y.init(e, t);
|
|
3051
|
+
}), ya = /*@__PURE__*/ T("ZodKSUID", (e, t) => {
|
|
3052
|
+
sn.init(e, t), Y.init(e, t);
|
|
3053
|
+
}), ba = /*@__PURE__*/ T("ZodIPv4", (e, t) => {
|
|
3054
|
+
fn.init(e, t), Y.init(e, t);
|
|
3055
|
+
}), xa = /*@__PURE__*/ T("ZodIPv6", (e, t) => {
|
|
3056
|
+
pn.init(e, t), Y.init(e, t);
|
|
3057
|
+
}), Sa = /*@__PURE__*/ T("ZodCIDRv4", (e, t) => {
|
|
3058
|
+
mn.init(e, t), Y.init(e, t);
|
|
3059
|
+
}), Ca = /*@__PURE__*/ T("ZodCIDRv6", (e, t) => {
|
|
3060
|
+
hn.init(e, t), Y.init(e, t);
|
|
3061
|
+
}), wa = /*@__PURE__*/ T("ZodBase64", (e, t) => {
|
|
3062
|
+
_n.init(e, t), Y.init(e, t);
|
|
3063
|
+
}), Ta = /*@__PURE__*/ T("ZodBase64URL", (e, t) => {
|
|
3064
|
+
yn.init(e, t), Y.init(e, t);
|
|
3065
|
+
}), Ea = /*@__PURE__*/ T("ZodE164", (e, t) => {
|
|
3066
|
+
bn.init(e, t), Y.init(e, t);
|
|
3067
|
+
}), Da = /*@__PURE__*/ T("ZodJWT", (e, t) => {
|
|
3068
|
+
Sn.init(e, t), Y.init(e, t);
|
|
3069
|
+
}), Oa = /*@__PURE__*/ T("ZodNumber", (e, t) => {
|
|
3070
|
+
Cn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => yi(e, t, n, r), oa(e, "ZodNumber", {
|
|
3071
|
+
gt(e, t) {
|
|
3072
|
+
return this.check(/* @__PURE__ */ Wr(e, t));
|
|
3073
|
+
},
|
|
3074
|
+
gte(e, t) {
|
|
3075
|
+
return this.check(/* @__PURE__ */ Gr(e, t));
|
|
3076
|
+
},
|
|
3077
|
+
min(e, t) {
|
|
3078
|
+
return this.check(/* @__PURE__ */ Gr(e, t));
|
|
3079
|
+
},
|
|
3080
|
+
lt(e, t) {
|
|
3081
|
+
return this.check(/* @__PURE__ */ Hr(e, t));
|
|
3082
|
+
},
|
|
3083
|
+
lte(e, t) {
|
|
3084
|
+
return this.check(/* @__PURE__ */ Ur(e, t));
|
|
3085
|
+
},
|
|
3086
|
+
max(e, t) {
|
|
3087
|
+
return this.check(/* @__PURE__ */ Ur(e, t));
|
|
3088
|
+
},
|
|
3089
|
+
int(e) {
|
|
3090
|
+
return this.check(ja(e));
|
|
3091
|
+
},
|
|
3092
|
+
safe(e) {
|
|
3093
|
+
return this.check(ja(e));
|
|
3094
|
+
},
|
|
3095
|
+
positive(e) {
|
|
3096
|
+
return this.check(/* @__PURE__ */ Wr(0, e));
|
|
3097
|
+
},
|
|
3098
|
+
nonnegative(e) {
|
|
3099
|
+
return this.check(/* @__PURE__ */ Gr(0, e));
|
|
3100
|
+
},
|
|
3101
|
+
negative(e) {
|
|
3102
|
+
return this.check(/* @__PURE__ */ Hr(0, e));
|
|
3103
|
+
},
|
|
3104
|
+
nonpositive(e) {
|
|
3105
|
+
return this.check(/* @__PURE__ */ Ur(0, e));
|
|
3106
|
+
},
|
|
3107
|
+
multipleOf(e, t) {
|
|
3108
|
+
return this.check(/* @__PURE__ */ Kr(e, t));
|
|
3109
|
+
},
|
|
3110
|
+
step(e, t) {
|
|
3111
|
+
return this.check(/* @__PURE__ */ Kr(e, t));
|
|
3112
|
+
},
|
|
3113
|
+
finite() {
|
|
3114
|
+
return this;
|
|
3115
|
+
}
|
|
3116
|
+
});
|
|
3117
|
+
let n = e._zod.bag;
|
|
3118
|
+
e.minValue = Math.max(n.minimum ?? -Infinity, n.exclusiveMinimum ?? -Infinity) ?? null, e.maxValue = Math.min(n.maximum ?? Infinity, n.exclusiveMaximum ?? Infinity) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? .5), e.isFinite = !0, e.format = n.format ?? null;
|
|
3119
|
+
});
|
|
3120
|
+
function ka(e) {
|
|
3121
|
+
return /* @__PURE__ */ Lr(Oa, e);
|
|
3122
|
+
}
|
|
3123
|
+
var Aa = /*@__PURE__*/ T("ZodNumberFormat", (e, t) => {
|
|
3124
|
+
wn.init(e, t), Oa.init(e, t);
|
|
3125
|
+
});
|
|
3126
|
+
function ja(e) {
|
|
3127
|
+
return /* @__PURE__ */ Rr(Aa, e);
|
|
3128
|
+
}
|
|
3129
|
+
var Ma = /*@__PURE__*/ T("ZodBoolean", (e, t) => {
|
|
3130
|
+
Tn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => bi(e, t, n, r);
|
|
3131
|
+
});
|
|
3132
|
+
function Na(e) {
|
|
3133
|
+
return /* @__PURE__ */ zr(Ma, e);
|
|
3134
|
+
}
|
|
3135
|
+
var Pa = /*@__PURE__*/ T("ZodUnknown", (e, t) => {
|
|
3136
|
+
En.init(e, t), q.init(e, t), e._zod.processJSONSchema = (e, t, n) => void 0;
|
|
3137
|
+
});
|
|
3138
|
+
function Fa() {
|
|
3139
|
+
return /* @__PURE__ */ Br(Pa);
|
|
3140
|
+
}
|
|
3141
|
+
var Ia = /*@__PURE__*/ T("ZodNever", (e, t) => {
|
|
3142
|
+
Dn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => xi(e, t, n, r);
|
|
3143
|
+
});
|
|
3144
|
+
function La(e) {
|
|
3145
|
+
return /* @__PURE__ */ Vr(Ia, e);
|
|
3146
|
+
}
|
|
3147
|
+
var Ra = /*@__PURE__*/ T("ZodArray", (e, t) => {
|
|
3148
|
+
kn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ei(e, t, n, r), e.element = t.element, oa(e, "ZodArray", {
|
|
3149
|
+
min(e, t) {
|
|
3150
|
+
return this.check(/* @__PURE__ */ Jr(e, t));
|
|
3151
|
+
},
|
|
3152
|
+
nonempty(e) {
|
|
3153
|
+
return this.check(/* @__PURE__ */ Jr(1, e));
|
|
3154
|
+
},
|
|
3155
|
+
max(e, t) {
|
|
3156
|
+
return this.check(/* @__PURE__ */ qr(e, t));
|
|
3157
|
+
},
|
|
3158
|
+
length(e, t) {
|
|
3159
|
+
return this.check(/* @__PURE__ */ Yr(e, t));
|
|
3160
|
+
},
|
|
3161
|
+
unwrap() {
|
|
3162
|
+
return this.element;
|
|
3163
|
+
}
|
|
3164
|
+
});
|
|
3165
|
+
});
|
|
3166
|
+
function za(e, t) {
|
|
3167
|
+
return /* @__PURE__ */ ci(Ra, e, t);
|
|
3168
|
+
}
|
|
3169
|
+
var Ba = /*@__PURE__*/ T("ZodObject", (e, t) => {
|
|
3170
|
+
Pn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Di(e, t, n, r), A(e, "shape", () => t.shape), oa(e, "ZodObject", {
|
|
3171
|
+
keyof() {
|
|
3172
|
+
return Z(Object.keys(this._zod.def.shape));
|
|
3173
|
+
},
|
|
3174
|
+
catchall(e) {
|
|
3175
|
+
return this.clone({
|
|
3176
|
+
...this._zod.def,
|
|
3177
|
+
catchall: e
|
|
3178
|
+
});
|
|
3179
|
+
},
|
|
3180
|
+
passthrough() {
|
|
3181
|
+
return this.clone({
|
|
3182
|
+
...this._zod.def,
|
|
3183
|
+
catchall: Fa()
|
|
3184
|
+
});
|
|
3185
|
+
},
|
|
3186
|
+
loose() {
|
|
3187
|
+
return this.clone({
|
|
3188
|
+
...this._zod.def,
|
|
3189
|
+
catchall: Fa()
|
|
3190
|
+
});
|
|
3191
|
+
},
|
|
3192
|
+
strict() {
|
|
3193
|
+
return this.clone({
|
|
3194
|
+
...this._zod.def,
|
|
3195
|
+
catchall: La()
|
|
3196
|
+
});
|
|
3197
|
+
},
|
|
3198
|
+
strip() {
|
|
3199
|
+
return this.clone({
|
|
3200
|
+
...this._zod.def,
|
|
3201
|
+
catchall: void 0
|
|
3202
|
+
});
|
|
3203
|
+
},
|
|
3204
|
+
extend(e) {
|
|
3205
|
+
return Ee(this, e);
|
|
3206
|
+
},
|
|
3207
|
+
safeExtend(e) {
|
|
3208
|
+
return De(this, e);
|
|
3209
|
+
},
|
|
3210
|
+
merge(e) {
|
|
3211
|
+
return Oe(this, e);
|
|
3212
|
+
},
|
|
3213
|
+
pick(e) {
|
|
3214
|
+
return we(this, e);
|
|
3215
|
+
},
|
|
3216
|
+
omit(e) {
|
|
3217
|
+
return Te(this, e);
|
|
3218
|
+
},
|
|
3219
|
+
partial(...e) {
|
|
3220
|
+
return ke(Qa, this, e[0]);
|
|
3221
|
+
},
|
|
3222
|
+
required(...e) {
|
|
3223
|
+
return Ae(co, this, e[0]);
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
});
|
|
3227
|
+
function X(e, t) {
|
|
3228
|
+
return new Ba({
|
|
3229
|
+
type: "object",
|
|
3230
|
+
shape: e ?? {},
|
|
3231
|
+
...L(t)
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
var Va = /*@__PURE__*/ T("ZodUnion", (e, t) => {
|
|
3235
|
+
In.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Oi(e, t, n, r), e.options = t.options;
|
|
3236
|
+
});
|
|
3237
|
+
function Ha(e, t) {
|
|
3238
|
+
return new Va({
|
|
3239
|
+
type: "union",
|
|
3240
|
+
options: e,
|
|
3241
|
+
...L(t)
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
var Ua = /*@__PURE__*/ T("ZodIntersection", (e, t) => {
|
|
3245
|
+
Ln.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => ki(e, t, n, r);
|
|
3246
|
+
});
|
|
3247
|
+
function Wa(e, t) {
|
|
3248
|
+
return new Ua({
|
|
3249
|
+
type: "intersection",
|
|
3250
|
+
left: e,
|
|
3251
|
+
right: t
|
|
3252
|
+
});
|
|
3253
|
+
}
|
|
3254
|
+
var Ga = /*@__PURE__*/ T("ZodRecord", (e, t) => {
|
|
3255
|
+
Bn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ai(e, t, n, r), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
3256
|
+
});
|
|
3257
|
+
function Ka(e, t, n) {
|
|
3258
|
+
return !t || !t._zod ? new Ga({
|
|
3259
|
+
type: "record",
|
|
3260
|
+
keyType: J(),
|
|
3261
|
+
valueType: e,
|
|
3262
|
+
...L(t)
|
|
3263
|
+
}) : new Ga({
|
|
3264
|
+
type: "record",
|
|
3265
|
+
keyType: e,
|
|
3266
|
+
valueType: t,
|
|
3267
|
+
...L(n)
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
var qa = /*@__PURE__*/ T("ZodEnum", (e, t) => {
|
|
3271
|
+
Vn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Si(e, t, n, r), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
3272
|
+
let n = new Set(Object.keys(t.entries));
|
|
3273
|
+
e.extract = (e, r) => {
|
|
3274
|
+
let i = {};
|
|
3275
|
+
for (let r of e) if (n.has(r)) i[r] = t.entries[r];
|
|
3276
|
+
else throw Error(`Key ${r} not found in enum`);
|
|
3277
|
+
return new qa({
|
|
3278
|
+
...t,
|
|
3279
|
+
checks: [],
|
|
3280
|
+
...L(r),
|
|
3281
|
+
entries: i
|
|
3282
|
+
});
|
|
3283
|
+
}, e.exclude = (e, r) => {
|
|
3284
|
+
let i = { ...t.entries };
|
|
3285
|
+
for (let t of e) if (n.has(t)) delete i[t];
|
|
3286
|
+
else throw Error(`Key ${t} not found in enum`);
|
|
3287
|
+
return new qa({
|
|
3288
|
+
...t,
|
|
3289
|
+
checks: [],
|
|
3290
|
+
...L(r),
|
|
3291
|
+
entries: i
|
|
3292
|
+
});
|
|
3293
|
+
};
|
|
3294
|
+
});
|
|
3295
|
+
function Z(e, t) {
|
|
3296
|
+
return new qa({
|
|
3297
|
+
type: "enum",
|
|
3298
|
+
entries: Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e,
|
|
3299
|
+
...L(t)
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3302
|
+
var Ja = /*@__PURE__*/ T("ZodLiteral", (e, t) => {
|
|
3303
|
+
Hn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ci(e, t, n, r), e.values = new Set(t.values), Object.defineProperty(e, "value", { get() {
|
|
3304
|
+
if (t.values.length > 1) throw Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
3305
|
+
return t.values[0];
|
|
3306
|
+
} });
|
|
3307
|
+
});
|
|
3308
|
+
function Ya(e, t) {
|
|
3309
|
+
return new Ja({
|
|
3310
|
+
type: "literal",
|
|
3311
|
+
values: Array.isArray(e) ? e : [e],
|
|
3312
|
+
...L(t)
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3315
|
+
var Xa = /*@__PURE__*/ T("ZodTransform", (e, t) => {
|
|
3316
|
+
Un.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ti(e, t, n, r), e._zod.parse = (n, r) => {
|
|
3317
|
+
if (r.direction === "backward") throw new le(e.constructor.name);
|
|
3318
|
+
n.addIssue = (r) => {
|
|
3319
|
+
if (typeof r == "string") n.issues.push(Pe(r, n.value, t));
|
|
3320
|
+
else {
|
|
3321
|
+
let t = r;
|
|
3322
|
+
t.fatal && (t.continue = !1), t.code ??= "custom", t.input ??= n.value, t.inst ??= e, n.issues.push(Pe(t));
|
|
3323
|
+
}
|
|
3324
|
+
};
|
|
3325
|
+
let i = t.transform(n.value, n);
|
|
3326
|
+
return i instanceof Promise ? i.then((e) => (n.value = e, n.fallback = !0, n)) : (n.value = i, n.fallback = !0, n);
|
|
3327
|
+
};
|
|
3328
|
+
});
|
|
3329
|
+
function Za(e) {
|
|
3330
|
+
return new Xa({
|
|
3331
|
+
type: "transform",
|
|
3332
|
+
transform: e
|
|
3333
|
+
});
|
|
3334
|
+
}
|
|
3335
|
+
var Qa = /*@__PURE__*/ T("ZodOptional", (e, t) => {
|
|
3336
|
+
Gn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ri(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3337
|
+
});
|
|
3338
|
+
function $a(e) {
|
|
3339
|
+
return new Qa({
|
|
3340
|
+
type: "optional",
|
|
3341
|
+
innerType: e
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
var eo = /*@__PURE__*/ T("ZodExactOptional", (e, t) => {
|
|
3345
|
+
Kn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ri(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3346
|
+
});
|
|
3347
|
+
function to(e) {
|
|
3348
|
+
return new eo({
|
|
3349
|
+
type: "optional",
|
|
3350
|
+
innerType: e
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
var no = /*@__PURE__*/ T("ZodNullable", (e, t) => {
|
|
3354
|
+
qn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => ji(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3355
|
+
});
|
|
3356
|
+
function ro(e) {
|
|
3357
|
+
return new no({
|
|
3358
|
+
type: "nullable",
|
|
3359
|
+
innerType: e
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
var io = /*@__PURE__*/ T("ZodDefault", (e, t) => {
|
|
3363
|
+
Jn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ni(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
3364
|
+
});
|
|
3365
|
+
function ao(e, t) {
|
|
3366
|
+
return new io({
|
|
3367
|
+
type: "default",
|
|
3368
|
+
innerType: e,
|
|
3369
|
+
get defaultValue() {
|
|
3370
|
+
return typeof t == "function" ? t() : P(t);
|
|
3371
|
+
}
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
var oo = /*@__PURE__*/ T("ZodPrefault", (e, t) => {
|
|
3375
|
+
Xn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Pi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3376
|
+
});
|
|
3377
|
+
function so(e, t) {
|
|
3378
|
+
return new oo({
|
|
3379
|
+
type: "prefault",
|
|
3380
|
+
innerType: e,
|
|
3381
|
+
get defaultValue() {
|
|
3382
|
+
return typeof t == "function" ? t() : P(t);
|
|
3383
|
+
}
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
var co = /*@__PURE__*/ T("ZodNonOptional", (e, t) => {
|
|
3387
|
+
Zn.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Mi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3388
|
+
});
|
|
3389
|
+
function lo(e, t) {
|
|
3390
|
+
return new co({
|
|
3391
|
+
type: "nonoptional",
|
|
3392
|
+
innerType: e,
|
|
3393
|
+
...L(t)
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
var uo = /*@__PURE__*/ T("ZodCatch", (e, t) => {
|
|
3397
|
+
$n.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Fi(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
3398
|
+
});
|
|
3399
|
+
function fo(e, t) {
|
|
3400
|
+
return new uo({
|
|
3401
|
+
type: "catch",
|
|
3402
|
+
innerType: e,
|
|
3403
|
+
catchValue: typeof t == "function" ? t : () => t
|
|
3404
|
+
});
|
|
3405
|
+
}
|
|
3406
|
+
var po = /*@__PURE__*/ T("ZodPipe", (e, t) => {
|
|
3407
|
+
er.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ii(e, t, n, r), e.in = t.in, e.out = t.out;
|
|
3408
|
+
});
|
|
3409
|
+
function mo(e, t) {
|
|
3410
|
+
return new po({
|
|
3411
|
+
type: "pipe",
|
|
3412
|
+
in: e,
|
|
3413
|
+
out: t
|
|
3414
|
+
});
|
|
3415
|
+
}
|
|
3416
|
+
var ho = /*@__PURE__*/ T("ZodReadonly", (e, t) => {
|
|
3417
|
+
nr.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => Li(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
3418
|
+
});
|
|
3419
|
+
function go(e) {
|
|
3420
|
+
return new ho({
|
|
3421
|
+
type: "readonly",
|
|
3422
|
+
innerType: e
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
var _o = /*@__PURE__*/ T("ZodCustom", (e, t) => {
|
|
3426
|
+
ir.init(e, t), q.init(e, t), e._zod.processJSONSchema = (t, n, r) => wi(e, t, n, r);
|
|
3427
|
+
});
|
|
3428
|
+
function vo(e, t = {}) {
|
|
3429
|
+
return /* @__PURE__ */ li(_o, e, t);
|
|
3430
|
+
}
|
|
3431
|
+
function yo(e, t) {
|
|
3432
|
+
return /* @__PURE__ */ ui(e, t);
|
|
3433
|
+
}
|
|
3434
|
+
//#endregion
|
|
3435
|
+
//#region src/v2/types/sessionManifestSchema.ts
|
|
3436
|
+
var bo = X({
|
|
3437
|
+
visible: Na().optional(),
|
|
3438
|
+
style: Z(["icon", "text"]).optional(),
|
|
3439
|
+
label: J().nullable().optional(),
|
|
3440
|
+
position: J().optional()
|
|
3441
|
+
}).nullable().optional(), xo = X({
|
|
3442
|
+
returnUrl: J().optional(),
|
|
3443
|
+
navigateOnClose: Na().optional()
|
|
3444
|
+
}).optional(), So = X({
|
|
3445
|
+
label: J().min(1).max(80).optional(),
|
|
3446
|
+
ariaLabel: J().min(1).max(120).optional(),
|
|
3447
|
+
placement: Z([
|
|
3448
|
+
"center",
|
|
3449
|
+
"bottom-center",
|
|
3450
|
+
"bottom-left",
|
|
3451
|
+
"bottom-right"
|
|
3452
|
+
]).optional(),
|
|
3453
|
+
variant: Z([
|
|
3454
|
+
"primary",
|
|
3455
|
+
"secondary",
|
|
3456
|
+
"minimal"
|
|
3457
|
+
]).optional(),
|
|
3458
|
+
appearance: X({
|
|
3459
|
+
backgroundColor: J().min(1).max(64).optional(),
|
|
3460
|
+
textColor: J().min(1).max(64).optional(),
|
|
3461
|
+
borderColor: J().min(1).max(64).optional(),
|
|
3462
|
+
borderRadiusPx: ka().min(0).max(999).optional(),
|
|
3463
|
+
size: Z([
|
|
3464
|
+
"small",
|
|
3465
|
+
"medium",
|
|
3466
|
+
"large"
|
|
3467
|
+
]).optional(),
|
|
3468
|
+
shadow: Z([
|
|
3469
|
+
"none",
|
|
3470
|
+
"soft",
|
|
3471
|
+
"strong"
|
|
3472
|
+
]).optional()
|
|
3473
|
+
}).optional()
|
|
3474
|
+
}), Co = X({
|
|
3475
|
+
characterId: J().min(1),
|
|
3476
|
+
displayName: J().min(1),
|
|
3477
|
+
avatarId: J().min(1),
|
|
3478
|
+
voiceId: J().min(1),
|
|
3479
|
+
sttLang: J().min(1),
|
|
3480
|
+
agentId: J().min(1),
|
|
3481
|
+
appearance: X({
|
|
3482
|
+
costume: J().optional(),
|
|
3483
|
+
costumeClothes: J().optional(),
|
|
3484
|
+
hair: J().optional()
|
|
3485
|
+
}).optional()
|
|
3486
|
+
}), wo = X({
|
|
3487
|
+
cx: ka(),
|
|
3488
|
+
cy: ka(),
|
|
3489
|
+
scale: ka(),
|
|
3490
|
+
distanceM: ka()
|
|
3491
|
+
}), To = X({
|
|
3492
|
+
type: Ya("image"),
|
|
3493
|
+
layers: za(J()),
|
|
3494
|
+
assets: Ka(J(), Ka(J(), J()))
|
|
3495
|
+
}), Eo = Z(["browser", "cloud"]), Do = X({
|
|
3496
|
+
placement: Eo,
|
|
3497
|
+
provider: J().min(1),
|
|
3498
|
+
model: J().min(1).optional(),
|
|
3499
|
+
config: Ka(J(), Fa()).default({})
|
|
3500
|
+
}), Oo = X({
|
|
3501
|
+
stt: Do,
|
|
3502
|
+
llm: Do,
|
|
3503
|
+
tts: Do,
|
|
3504
|
+
animation: X({
|
|
3505
|
+
enabled: Na(),
|
|
3506
|
+
placement: Eo.optional(),
|
|
3507
|
+
source: Z([
|
|
3508
|
+
"azureViseme",
|
|
3509
|
+
"speechToAnimation",
|
|
3510
|
+
"none"
|
|
3511
|
+
]),
|
|
3512
|
+
provider: J().min(1).optional(),
|
|
3513
|
+
model: J().min(1).optional(),
|
|
3514
|
+
config: Ka(J(), Fa()).default({})
|
|
3515
|
+
})
|
|
3516
|
+
}), ko = X({
|
|
3517
|
+
schemaVersion: Ya(1),
|
|
3518
|
+
sessionId: J().min(1),
|
|
3519
|
+
experienceId: J().min(1),
|
|
3520
|
+
expiresAt: J().min(1),
|
|
3521
|
+
sessionToken: J().min(1),
|
|
3522
|
+
experience: X({
|
|
3523
|
+
title: J(),
|
|
3524
|
+
slug: J(),
|
|
3525
|
+
mode: Z(["conversation", "presenter"]),
|
|
3526
|
+
responseMode: Z([
|
|
3527
|
+
"managed",
|
|
3528
|
+
"custom",
|
|
3529
|
+
"manual"
|
|
3530
|
+
]),
|
|
3531
|
+
speechInputMode: Z([
|
|
3532
|
+
"auto",
|
|
3533
|
+
"manual",
|
|
3534
|
+
"off"
|
|
3535
|
+
]),
|
|
3536
|
+
startButton: So.optional(),
|
|
3537
|
+
openingMessage: J().optional()
|
|
3538
|
+
}),
|
|
3539
|
+
transport: X({
|
|
3540
|
+
type: Ya("http"),
|
|
3541
|
+
config: X({ apiBaseUrl: J().min(1) })
|
|
3542
|
+
}),
|
|
3543
|
+
runtime: X({
|
|
3544
|
+
cdnBaseUrl: J().min(1),
|
|
3545
|
+
input: Ya("browserStt"),
|
|
3546
|
+
renderer: Ya("morph2d")
|
|
3547
|
+
}),
|
|
3548
|
+
pipeline: Oo.optional(),
|
|
3549
|
+
capabilities: za(J()),
|
|
3550
|
+
characters: za(Co).min(1),
|
|
3551
|
+
activeCharacterId: J().min(1),
|
|
3552
|
+
location: X({
|
|
3553
|
+
locationId: J(),
|
|
3554
|
+
title: J(),
|
|
3555
|
+
scene: To.optional(),
|
|
3556
|
+
placement: wo.optional(),
|
|
3557
|
+
metersPerDepth: ka().positive().optional(),
|
|
3558
|
+
hasZoomVariant: Na().optional()
|
|
3559
|
+
}).optional(),
|
|
3560
|
+
world: X({
|
|
3561
|
+
worldId: J(),
|
|
3562
|
+
rulesetVersion: ka()
|
|
3563
|
+
}).optional(),
|
|
3564
|
+
state: X({
|
|
3565
|
+
schemaVersion: Ya(1),
|
|
3566
|
+
values: Ka(J(), Fa())
|
|
3567
|
+
}),
|
|
3568
|
+
tools: za(Fa()),
|
|
3569
|
+
integration: xo,
|
|
3570
|
+
closeButton: bo,
|
|
3571
|
+
billing: X({
|
|
3572
|
+
payer: Ya("creator"),
|
|
3573
|
+
meterId: J()
|
|
3574
|
+
}).optional(),
|
|
3575
|
+
language: Z(["en", "es"]).optional(),
|
|
3576
|
+
languagePackRevision: J().optional(),
|
|
3577
|
+
processorId: J().optional()
|
|
3578
|
+
}).superRefine((e, t) => {
|
|
3579
|
+
let n = e.activeCharacterId;
|
|
3580
|
+
e.characters.some((e) => e.characterId === n) || t.addIssue({
|
|
3581
|
+
code: "custom",
|
|
3582
|
+
message: "activeCharacterId must reference a character in characters[]",
|
|
3583
|
+
path: ["activeCharacterId"]
|
|
3584
|
+
});
|
|
3585
|
+
});
|
|
3586
|
+
function Ao(e) {
|
|
3587
|
+
if (!e || typeof e != "object") return e;
|
|
3588
|
+
let t = { ...e }, n = t.experience;
|
|
3589
|
+
if (!n || typeof n != "object") return t;
|
|
3590
|
+
let r = { ...n }, i = r.mode === "presenter" ? "presenter" : "conversation";
|
|
3591
|
+
return r.responseMode === void 0 && (r.responseMode = i === "presenter" ? "manual" : "managed"), r.speechInputMode === void 0 && (r.speechInputMode = i === "presenter" ? "manual" : "auto"), t.experience = r, t;
|
|
3592
|
+
}
|
|
3593
|
+
function jo(e) {
|
|
3594
|
+
return e.issues.map((e) => `${e.path.length > 0 ? e.path.join(".") : "(root)"}: ${e.message}`).join("; ");
|
|
3595
|
+
}
|
|
3596
|
+
function Mo(e) {
|
|
3597
|
+
let t = ko.safeParse(Ao(e));
|
|
3598
|
+
if (!t.success) throw Error(`Invalid Session Manifest from Liforma API — ${jo(t.error)}`);
|
|
3599
|
+
return t.data;
|
|
3600
|
+
}
|
|
3601
|
+
function No(e) {
|
|
3602
|
+
return e.sessionToken.trim().length > 0;
|
|
3603
|
+
}
|
|
3604
|
+
//#endregion
|
|
3605
|
+
//#region src/v2/api/mintPublicSession.ts
|
|
3606
|
+
function Po() {
|
|
3607
|
+
try {
|
|
3608
|
+
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
3609
|
+
} catch {}
|
|
3610
|
+
}
|
|
3611
|
+
function Fo(e, t, n) {
|
|
3612
|
+
let r;
|
|
3613
|
+
try {
|
|
3614
|
+
r = JSON.parse(n);
|
|
3615
|
+
} catch {}
|
|
3616
|
+
let i = Po(), a = r?.message?.trim(), o = r?.code;
|
|
3617
|
+
if (o === "origin_not_allowed" || /^Origin not allowed/i.test(a ?? "") && i) {
|
|
3618
|
+
if (a && a.includes(e) && a.includes("allowed origin")) return a;
|
|
3619
|
+
let t = r?.origin ?? i ?? "(unknown origin)";
|
|
3620
|
+
return `Your origin ${t} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${t} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`;
|
|
3621
|
+
}
|
|
3622
|
+
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})`;
|
|
3623
|
+
}
|
|
3624
|
+
async function Io(e, t) {
|
|
3625
|
+
let n = C(), r = { experienceId: e };
|
|
3626
|
+
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);
|
|
3627
|
+
let i = await fetch(`${n}/v1/public-sessions`, {
|
|
3628
|
+
method: "POST",
|
|
3629
|
+
headers: { "Content-Type": "application/json" },
|
|
3630
|
+
body: JSON.stringify(r)
|
|
3631
|
+
});
|
|
3632
|
+
if (!i.ok) {
|
|
3633
|
+
let t = await i.text();
|
|
3634
|
+
throw Error(Fo(e, i.status, t));
|
|
3635
|
+
}
|
|
3636
|
+
let a;
|
|
3637
|
+
try {
|
|
3638
|
+
a = await i.json();
|
|
3639
|
+
} catch {
|
|
3640
|
+
throw Error("Public session mint returned invalid JSON.");
|
|
3641
|
+
}
|
|
3642
|
+
return Mo(a);
|
|
3643
|
+
}
|
|
3644
|
+
async function Lo(e, t) {
|
|
3645
|
+
let n = se(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
3646
|
+
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
3647
|
+
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
3648
|
+
try {
|
|
3649
|
+
o = await fetch(n.url, {
|
|
3650
|
+
...n.init,
|
|
3651
|
+
signal: r.signal
|
|
3652
|
+
});
|
|
3653
|
+
} finally {
|
|
3654
|
+
globalThis.clearTimeout(a), t.signal?.removeEventListener("abort", i);
|
|
3655
|
+
}
|
|
3656
|
+
if (!o.ok) {
|
|
3657
|
+
let e = await o.text(), t = e.slice(0, 500) || `Session endpoint failed (${o.status})`;
|
|
3658
|
+
try {
|
|
3659
|
+
let n = JSON.parse(e);
|
|
3660
|
+
n.message && (t = n.message);
|
|
3661
|
+
} catch {}
|
|
3662
|
+
throw Error(t);
|
|
3663
|
+
}
|
|
3664
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw Error("Session endpoint must return a JSON Session Manifest.");
|
|
3665
|
+
let s;
|
|
3666
|
+
try {
|
|
3667
|
+
s = await o.json();
|
|
3668
|
+
} catch {
|
|
3669
|
+
throw Error("Session endpoint returned invalid JSON.");
|
|
3670
|
+
}
|
|
3671
|
+
return Mo(s);
|
|
3672
|
+
}
|
|
3673
|
+
//#endregion
|
|
3674
|
+
//#region src/v2/conversationProcessor.ts
|
|
3675
|
+
function Ro(e) {
|
|
3676
|
+
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
3677
|
+
}
|
|
3678
|
+
function zo(e) {
|
|
3679
|
+
if (typeof e == "string") {
|
|
3680
|
+
let t = e.trim();
|
|
3681
|
+
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
3682
|
+
return { text: t };
|
|
3683
|
+
}
|
|
3684
|
+
let t = e.text.trim();
|
|
3685
|
+
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
3686
|
+
return {
|
|
3687
|
+
text: t,
|
|
3688
|
+
...e.characterId ? { characterId: e.characterId } : {},
|
|
3689
|
+
...e.behavior ? { behavior: e.behavior } : {}
|
|
3690
|
+
};
|
|
3691
|
+
}
|
|
3692
|
+
async function Bo(e, t) {
|
|
3693
|
+
let n = await e(t);
|
|
3694
|
+
return Ro(n) ? {
|
|
3695
|
+
kind: "stream",
|
|
3696
|
+
stream: n
|
|
3697
|
+
} : {
|
|
3698
|
+
kind: "complete",
|
|
3699
|
+
speech: zo(n)
|
|
3700
|
+
};
|
|
3701
|
+
}
|
|
3702
|
+
//#endregion
|
|
3703
|
+
//#region src/v2/embed/playerReachability.ts
|
|
3704
|
+
var Vo = "3002";
|
|
3705
|
+
function Ho(e) {
|
|
3706
|
+
let t = new URL(e);
|
|
3707
|
+
return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || Vo}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
|
|
3708
|
+
}
|
|
3709
|
+
async function Uo(e, t) {
|
|
3710
|
+
try {
|
|
3711
|
+
await fetch(e, {
|
|
3712
|
+
method: "GET",
|
|
3713
|
+
mode: "no-cors",
|
|
3714
|
+
signal: AbortSignal.timeout(8e3)
|
|
3715
|
+
});
|
|
3716
|
+
} catch {
|
|
3717
|
+
throw Error(Ho(t));
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
function Wo(e, t, n) {
|
|
3721
|
+
try {
|
|
3722
|
+
e.postMessage(t, n);
|
|
3723
|
+
} catch (e) {
|
|
3724
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ho(n), { cause: e }) : e;
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
var Go = new Set([1, 2]);
|
|
3728
|
+
function Ko(e) {
|
|
3729
|
+
return typeof e == "number" && Go.has(e);
|
|
3730
|
+
}
|
|
3731
|
+
var qo = new Set([
|
|
3732
|
+
"close",
|
|
3733
|
+
"stateUpdate",
|
|
3734
|
+
"commandResult",
|
|
3735
|
+
"userTranscript",
|
|
3736
|
+
"characterSpeechStarted",
|
|
3737
|
+
"characterSpeechEnded",
|
|
3738
|
+
"conversationUpdate",
|
|
3739
|
+
"listeningState",
|
|
3740
|
+
"userSpeechStarted",
|
|
3741
|
+
"userSpeechEnded",
|
|
3742
|
+
"modeChange",
|
|
3743
|
+
"message",
|
|
3744
|
+
"started",
|
|
3745
|
+
"widgetReady",
|
|
3746
|
+
"widgetExpand",
|
|
3747
|
+
"widgetCollapse",
|
|
3748
|
+
"widgetAudioSettings"
|
|
3749
|
+
]);
|
|
3750
|
+
function Jo(e) {
|
|
3751
|
+
if (!e || typeof e != "object") return null;
|
|
3752
|
+
let t = e;
|
|
3753
|
+
if (!Ko(t.schemaVersion) || !t.type || !qo.has(t.type)) return null;
|
|
3754
|
+
if (t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
3755
|
+
if (t.type === "widgetAudioSettings") {
|
|
3756
|
+
let e = t.payload;
|
|
3757
|
+
return !e || typeof e != "object" || typeof e.open != "boolean" ? null : t;
|
|
3758
|
+
}
|
|
3759
|
+
return !t.payload || typeof t.payload != "object" ? null : t;
|
|
3760
|
+
}
|
|
3761
|
+
function Yo(e) {
|
|
3762
|
+
return {
|
|
3763
|
+
type: "manifest",
|
|
3764
|
+
schemaVersion: 2,
|
|
3765
|
+
payload: { manifest: e }
|
|
3766
|
+
};
|
|
3767
|
+
}
|
|
3768
|
+
function Xo() {
|
|
3769
|
+
return {
|
|
3770
|
+
type: "parentHello",
|
|
3771
|
+
schemaVersion: 2
|
|
3772
|
+
};
|
|
3773
|
+
}
|
|
3774
|
+
function Zo(e) {
|
|
3775
|
+
return {
|
|
3776
|
+
type: "widgetSetChrome",
|
|
3777
|
+
schemaVersion: 2,
|
|
3778
|
+
payload: { mode: e }
|
|
3779
|
+
};
|
|
3780
|
+
}
|
|
3781
|
+
function Qo() {
|
|
3782
|
+
return {
|
|
3783
|
+
type: "widgetToggleAudioSettings",
|
|
3784
|
+
schemaVersion: 2,
|
|
3785
|
+
payload: {}
|
|
3786
|
+
};
|
|
3787
|
+
}
|
|
3788
|
+
//#endregion
|
|
3789
|
+
//#region src/v2/embed/iframeHost.ts
|
|
3790
|
+
function $o() {
|
|
3791
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `cmd_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `cmd_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
3792
|
+
}
|
|
3793
|
+
function es(e) {
|
|
3794
|
+
let t = e.container;
|
|
3795
|
+
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
3796
|
+
let n = document.createElement("iframe");
|
|
3797
|
+
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true");
|
|
3798
|
+
let r = !1, i = /* @__PURE__ */ new Map(), a = new Promise((t, r) => {
|
|
3799
|
+
let i = () => {
|
|
3800
|
+
o(), Uo(e.src, e.playerOrigin).then(t, r);
|
|
3801
|
+
}, a = () => {
|
|
3802
|
+
o(), r(Error(Ho(e.playerOrigin)));
|
|
3803
|
+
}, o = () => {
|
|
3804
|
+
n.removeEventListener("load", i), n.removeEventListener("error", a);
|
|
3805
|
+
};
|
|
3806
|
+
n.addEventListener("load", i), n.addEventListener("error", a);
|
|
3807
|
+
}), o = (t) => {
|
|
3808
|
+
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
3809
|
+
let a = Jo(t.data);
|
|
3810
|
+
if (a) switch (a.type) {
|
|
3811
|
+
case "close":
|
|
3812
|
+
e.onClose?.(a.payload);
|
|
3813
|
+
break;
|
|
3814
|
+
case "stateUpdate":
|
|
3815
|
+
e.onStateUpdate?.(a.payload.state);
|
|
3816
|
+
break;
|
|
3817
|
+
case "commandResult": {
|
|
3818
|
+
let e = i.get(a.payload.correlationId);
|
|
3819
|
+
if (!e) return;
|
|
3820
|
+
i.delete(a.payload.correlationId), a.payload.ok ? e.resolve(a.payload.result) : e.reject(Error(a.payload.error ?? "Command failed."));
|
|
3821
|
+
break;
|
|
3822
|
+
}
|
|
3823
|
+
case "userTranscript":
|
|
3824
|
+
e.onUserTranscript?.(a.payload);
|
|
3825
|
+
break;
|
|
3826
|
+
case "characterSpeechStarted":
|
|
3827
|
+
e.onCharacterSpeechStarted?.(a.payload);
|
|
3828
|
+
break;
|
|
3829
|
+
case "characterSpeechEnded":
|
|
3830
|
+
e.onCharacterSpeechEnded?.(a.payload);
|
|
3831
|
+
break;
|
|
3832
|
+
case "conversationUpdate":
|
|
3833
|
+
e.onConversationUpdate?.(a.payload.conversation);
|
|
3834
|
+
break;
|
|
3835
|
+
case "listeningState":
|
|
3836
|
+
e.onListeningState?.(a.payload.listening);
|
|
3837
|
+
break;
|
|
3838
|
+
case "userSpeechStarted":
|
|
3839
|
+
e.onUserSpeechStarted?.(a.payload);
|
|
3840
|
+
break;
|
|
3841
|
+
case "userSpeechEnded":
|
|
3842
|
+
e.onUserSpeechEnded?.(a.payload);
|
|
3843
|
+
break;
|
|
3844
|
+
case "modeChange":
|
|
3845
|
+
e.onModeChange?.(a.payload.mode);
|
|
3846
|
+
break;
|
|
3847
|
+
case "message":
|
|
3848
|
+
e.onMessage?.(a.payload);
|
|
3849
|
+
break;
|
|
3850
|
+
case "started":
|
|
3851
|
+
e.onStarted?.(a.payload);
|
|
3852
|
+
break;
|
|
3853
|
+
case "widgetReady":
|
|
3854
|
+
e.onWidgetReady?.();
|
|
3855
|
+
break;
|
|
3856
|
+
case "widgetExpand":
|
|
3857
|
+
e.onWidgetExpand?.();
|
|
3858
|
+
break;
|
|
3859
|
+
case "widgetCollapse":
|
|
3860
|
+
e.onWidgetCollapse?.();
|
|
3861
|
+
break;
|
|
3862
|
+
case "widgetAudioSettings":
|
|
3863
|
+
e.onWidgetAudioSettings?.(a.payload.open);
|
|
3864
|
+
break;
|
|
3865
|
+
}
|
|
3866
|
+
};
|
|
3867
|
+
if (window.addEventListener("message", o), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
|
|
3868
|
+
let e = getComputedStyle(t).minHeight;
|
|
3869
|
+
(e === "0px" || e === "auto") && (t.style.minHeight = "480px");
|
|
3870
|
+
}
|
|
3871
|
+
let s = (t) => {
|
|
3872
|
+
if (r) return;
|
|
3873
|
+
let i = n.contentWindow;
|
|
3874
|
+
if (!i) throw Error(Ho(e.playerOrigin));
|
|
3875
|
+
Wo(i, t, e.playerOrigin);
|
|
3876
|
+
}, c = (e, t = 12e4) => {
|
|
3877
|
+
let n = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : $o();
|
|
3878
|
+
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = n), new Promise((r, a) => {
|
|
3879
|
+
i.set(n, {
|
|
3880
|
+
resolve: (e) => r(e),
|
|
3881
|
+
reject: a
|
|
3882
|
+
}), s(e), setTimeout(() => {
|
|
3883
|
+
i.has(n) && (i.delete(n), a(/* @__PURE__ */ Error("Timed out waiting for player command result.")));
|
|
3884
|
+
}, t);
|
|
3885
|
+
});
|
|
3886
|
+
};
|
|
3887
|
+
return {
|
|
3888
|
+
waitForLoad() {
|
|
3889
|
+
return a;
|
|
3890
|
+
},
|
|
3891
|
+
postParentHello() {
|
|
3892
|
+
s(Xo());
|
|
3893
|
+
},
|
|
3894
|
+
postManifest(t) {
|
|
3895
|
+
if (r) return;
|
|
3896
|
+
let i = n.contentWindow;
|
|
3897
|
+
if (!i) throw Error("Liforma embed iframe is not ready.");
|
|
3898
|
+
let a = Yo(t), o = () => {
|
|
3899
|
+
r || Wo(i, a, e.playerOrigin);
|
|
3900
|
+
};
|
|
3901
|
+
o();
|
|
3902
|
+
for (let e = 1; e <= 12; e += 1) window.setTimeout(o, e * 75);
|
|
3903
|
+
},
|
|
3904
|
+
postWidgetSetChrome(e) {
|
|
3905
|
+
s(Zo(e));
|
|
3906
|
+
},
|
|
3907
|
+
postWidgetToggleAudioSettings() {
|
|
3908
|
+
s(Qo());
|
|
3909
|
+
},
|
|
3910
|
+
speak(e) {
|
|
3911
|
+
return c({
|
|
3912
|
+
type: "speak",
|
|
3913
|
+
schemaVersion: 2,
|
|
3914
|
+
payload: {
|
|
3915
|
+
correlationId: $o(),
|
|
3916
|
+
text: e.text,
|
|
3917
|
+
...e.characterId ? { characterId: e.characterId } : {},
|
|
3918
|
+
...e.behavior ? { behavior: e.behavior } : {}
|
|
3919
|
+
}
|
|
3920
|
+
});
|
|
3921
|
+
},
|
|
3922
|
+
startListening() {
|
|
3923
|
+
return c({
|
|
3924
|
+
type: "startListening",
|
|
3925
|
+
schemaVersion: 2,
|
|
3926
|
+
payload: { correlationId: $o() }
|
|
3927
|
+
});
|
|
3928
|
+
},
|
|
3929
|
+
stopListening() {
|
|
3930
|
+
return c({
|
|
3931
|
+
type: "stopListening",
|
|
3932
|
+
schemaVersion: 2,
|
|
3933
|
+
payload: { correlationId: $o() }
|
|
3934
|
+
});
|
|
3935
|
+
},
|
|
3936
|
+
listenOnce(e) {
|
|
3937
|
+
return c({
|
|
3938
|
+
type: "listenOnce",
|
|
3939
|
+
schemaVersion: 2,
|
|
3940
|
+
payload: {
|
|
3941
|
+
correlationId: $o(),
|
|
3942
|
+
...e?.timeoutMs === void 0 ? {} : { timeoutMs: e.timeoutMs }
|
|
3943
|
+
}
|
|
3944
|
+
});
|
|
3945
|
+
},
|
|
3946
|
+
async speakProcessorStream(e, t) {
|
|
3947
|
+
let n = $o(), r = $o(), i = (await c({
|
|
3948
|
+
type: "speakStreamStart",
|
|
3949
|
+
schemaVersion: 2,
|
|
3950
|
+
payload: {
|
|
3951
|
+
correlationId: n,
|
|
3952
|
+
...t?.characterId ? { characterId: t.characterId } : {},
|
|
3953
|
+
...t?.behavior ? { behavior: t.behavior } : {}
|
|
3954
|
+
}
|
|
3955
|
+
})).streamId;
|
|
3956
|
+
try {
|
|
3957
|
+
for await (let n of e) {
|
|
3958
|
+
if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
|
|
3959
|
+
n && s({
|
|
3960
|
+
type: "speakStreamChunk",
|
|
3961
|
+
schemaVersion: 2,
|
|
3962
|
+
payload: {
|
|
3963
|
+
streamId: i,
|
|
3964
|
+
text: n
|
|
3965
|
+
}
|
|
3966
|
+
});
|
|
3967
|
+
}
|
|
3968
|
+
if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
|
|
3969
|
+
return await c({
|
|
3970
|
+
type: "speakStreamEnd",
|
|
3971
|
+
schemaVersion: 2,
|
|
3972
|
+
payload: {
|
|
3973
|
+
correlationId: r,
|
|
3974
|
+
streamId: i
|
|
3975
|
+
}
|
|
3976
|
+
});
|
|
3977
|
+
} catch (e) {
|
|
3978
|
+
try {
|
|
3979
|
+
await c({
|
|
3980
|
+
type: "speakStreamEnd",
|
|
3981
|
+
schemaVersion: 2,
|
|
3982
|
+
payload: {
|
|
3983
|
+
correlationId: r,
|
|
3984
|
+
streamId: i
|
|
3985
|
+
}
|
|
3986
|
+
});
|
|
3987
|
+
} catch {}
|
|
3988
|
+
throw e;
|
|
3989
|
+
}
|
|
3990
|
+
},
|
|
3991
|
+
getConversation() {
|
|
3992
|
+
return c({
|
|
3993
|
+
type: "getConversation",
|
|
3994
|
+
schemaVersion: 2,
|
|
3995
|
+
payload: { correlationId: $o() }
|
|
3996
|
+
});
|
|
3997
|
+
},
|
|
3998
|
+
destroy() {
|
|
3999
|
+
if (!r) {
|
|
4000
|
+
r = !0;
|
|
4001
|
+
for (let e of i.values()) e.reject(/* @__PURE__ */ Error("Iframe host destroyed."));
|
|
4002
|
+
i.clear(), window.removeEventListener("message", o), n.remove();
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
4007
|
+
//#endregion
|
|
4008
|
+
//#region src/v2/embed/readyGate.ts
|
|
4009
|
+
function ts(e) {
|
|
4010
|
+
let t, n = !1, r = !1, i = () => {
|
|
4011
|
+
r || !n || t === void 0 || (r = !0, e(t));
|
|
4012
|
+
};
|
|
4013
|
+
return {
|
|
4014
|
+
setValue(e) {
|
|
4015
|
+
t = e, i();
|
|
4016
|
+
},
|
|
4017
|
+
markReady() {
|
|
4018
|
+
n = !0, i();
|
|
4019
|
+
}
|
|
4020
|
+
};
|
|
4021
|
+
}
|
|
4022
|
+
//#endregion
|
|
4023
|
+
//#region src/v2/shims/embedBaseUrl.ts
|
|
4024
|
+
var ns = "https://player.liforma.ai/embed", rs = "http://localhost:3002/embed";
|
|
4025
|
+
function is() {
|
|
4026
|
+
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
4027
|
+
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
4028
|
+
if (typeof document > "u") return null;
|
|
4029
|
+
let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-player-embed-url")?.trim();
|
|
4030
|
+
return t ? t.replace(/\/$/, "") : null;
|
|
4031
|
+
}
|
|
4032
|
+
function as() {
|
|
4033
|
+
let e = is();
|
|
4034
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : s() ? rs : ns;
|
|
4035
|
+
}
|
|
4036
|
+
function os(e, t, n, r, i, a, o) {
|
|
4037
|
+
let s = (e ?? as()).replace(/\/$/, ""), c = s.endsWith("/embed") ? s : `${s}/embed`, l = new URL(c), u = n?.trim();
|
|
4038
|
+
u && l.searchParams.set("locationId", u);
|
|
4039
|
+
let d = r?.trim();
|
|
4040
|
+
return d && l.searchParams.set("avatarId", d), i === "face" && l.searchParams.set("fit", "face"), a === "widget" && l.searchParams.set("ui", "widget"), o && l.searchParams.set("close", "1"), t && l.searchParams.set("debug", "true"), ss(l.toString());
|
|
4041
|
+
}
|
|
4042
|
+
function ss(e) {
|
|
4043
|
+
if (typeof location > "u") return e;
|
|
4044
|
+
let t = new URL(e);
|
|
4045
|
+
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
4046
|
+
}
|
|
4047
|
+
function cs(e) {
|
|
4048
|
+
return new URL(e).origin;
|
|
4049
|
+
}
|
|
4050
|
+
//#endregion
|
|
4051
|
+
//#region src/v2/speechOnlyManifest.ts
|
|
4052
|
+
function ls(e) {
|
|
4053
|
+
let t = e.filter((e) => e !== "avatar");
|
|
4054
|
+
return t.includes("voice") ? t : ["voice", ...t];
|
|
4055
|
+
}
|
|
4056
|
+
function us(e) {
|
|
4057
|
+
return Mo({
|
|
4058
|
+
...e,
|
|
4059
|
+
capabilities: ls(e.capabilities),
|
|
4060
|
+
pipeline: {
|
|
4061
|
+
...e.pipeline,
|
|
4062
|
+
animation: {
|
|
4063
|
+
enabled: !1,
|
|
4064
|
+
source: "none",
|
|
4065
|
+
config: {}
|
|
4066
|
+
}
|
|
4067
|
+
},
|
|
4068
|
+
location: {
|
|
4069
|
+
locationId: e.location?.locationId?.trim() || "speech-only",
|
|
4070
|
+
title: e.location?.title?.trim() || ""
|
|
4071
|
+
}
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
//#endregion
|
|
4075
|
+
//#region src/v2/experienceEvents.ts
|
|
4076
|
+
function ds() {
|
|
4077
|
+
return {
|
|
4078
|
+
ready: /* @__PURE__ */ new Set(),
|
|
4079
|
+
started: /* @__PURE__ */ new Set(),
|
|
4080
|
+
userTranscript: /* @__PURE__ */ new Set(),
|
|
4081
|
+
userSpeechStarted: /* @__PURE__ */ new Set(),
|
|
4082
|
+
userSpeechEnded: /* @__PURE__ */ new Set(),
|
|
4083
|
+
characterSpeechStarted: /* @__PURE__ */ new Set(),
|
|
4084
|
+
characterSpeechEnded: /* @__PURE__ */ new Set(),
|
|
4085
|
+
conversationUpdate: /* @__PURE__ */ new Set(),
|
|
4086
|
+
message: /* @__PURE__ */ new Set(),
|
|
4087
|
+
listeningState: /* @__PURE__ */ new Set(),
|
|
4088
|
+
modeChange: /* @__PURE__ */ new Set(),
|
|
4089
|
+
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
4090
|
+
};
|
|
4091
|
+
}
|
|
4092
|
+
function fs(e, t, n) {
|
|
4093
|
+
return e[t].add(n), () => e[t].delete(n);
|
|
4094
|
+
}
|
|
4095
|
+
function Q(e, t, n) {
|
|
4096
|
+
for (let r of e[t]) r(n);
|
|
4097
|
+
}
|
|
4098
|
+
function ps(e) {
|
|
4099
|
+
for (let t of Object.keys(e)) e[t].clear();
|
|
4100
|
+
}
|
|
4101
|
+
//#endregion
|
|
4102
|
+
//#region src/v2/experience.ts
|
|
4103
|
+
function ms(e, t) {
|
|
4104
|
+
return t ? Mo({
|
|
4105
|
+
...e,
|
|
4106
|
+
experience: {
|
|
4107
|
+
...e.experience,
|
|
4108
|
+
startButton: t
|
|
4109
|
+
}
|
|
4110
|
+
}) : e;
|
|
4111
|
+
}
|
|
4112
|
+
var hs = class e {
|
|
4113
|
+
launch;
|
|
4114
|
+
conversationProcessor;
|
|
4115
|
+
iframeHost = null;
|
|
4116
|
+
attachInFlight = null;
|
|
4117
|
+
endpointAbortController = null;
|
|
4118
|
+
processorAbortController = null;
|
|
4119
|
+
processorChain = Promise.resolve();
|
|
4120
|
+
resolvedManifest;
|
|
4121
|
+
closed = !1;
|
|
4122
|
+
attached = !1;
|
|
4123
|
+
closeHandlers = [];
|
|
4124
|
+
eventRegistry = ds();
|
|
4125
|
+
readyEvent = null;
|
|
4126
|
+
startedEvent = null;
|
|
4127
|
+
conversationCache = [];
|
|
4128
|
+
constructor(e) {
|
|
4129
|
+
this.launch = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedManifest = e.kind === "manifest" ? e.manifest : null;
|
|
4130
|
+
}
|
|
4131
|
+
static async startSession(t) {
|
|
4132
|
+
if ("sessionEndpoint" in t) return new e({
|
|
4133
|
+
kind: "sessionEndpoint",
|
|
4134
|
+
experienceId: t.experienceId,
|
|
4135
|
+
sessionEndpoint: t.sessionEndpoint,
|
|
4136
|
+
language: t.language,
|
|
4137
|
+
locationId: t.locationId,
|
|
4138
|
+
avatarId: t.avatarId,
|
|
4139
|
+
embedBaseUrl: t.embedBaseUrl,
|
|
4140
|
+
debug: t.debug,
|
|
4141
|
+
mode: t.mode,
|
|
4142
|
+
responseMode: t.responseMode,
|
|
4143
|
+
speechInputMode: t.speechInputMode,
|
|
4144
|
+
startButton: t.startButton,
|
|
4145
|
+
speechOnly: t.speechOnly,
|
|
4146
|
+
fit: t.fit,
|
|
4147
|
+
ui: t.ui,
|
|
4148
|
+
onStart: t.onStart,
|
|
4149
|
+
onUserTranscript: t.onUserTranscript,
|
|
4150
|
+
conversationProcessor: t.conversationProcessor
|
|
4151
|
+
});
|
|
4152
|
+
if ("experienceId" in t) return new e({
|
|
4153
|
+
kind: "public",
|
|
4154
|
+
experienceId: t.experienceId,
|
|
4155
|
+
language: t.language,
|
|
4156
|
+
locationId: t.locationId,
|
|
4157
|
+
avatarId: t.avatarId,
|
|
4158
|
+
embedBaseUrl: t.embedBaseUrl,
|
|
4159
|
+
debug: t.debug,
|
|
4160
|
+
mode: t.mode,
|
|
4161
|
+
responseMode: t.responseMode,
|
|
4162
|
+
speechInputMode: t.speechInputMode,
|
|
4163
|
+
startButton: t.startButton,
|
|
4164
|
+
speechOnly: t.speechOnly,
|
|
4165
|
+
fit: t.fit,
|
|
4166
|
+
ui: t.ui,
|
|
4167
|
+
onStart: t.onStart,
|
|
4168
|
+
onUserTranscript: t.onUserTranscript,
|
|
4169
|
+
conversationProcessor: t.conversationProcessor
|
|
4170
|
+
});
|
|
4171
|
+
let n = Mo(t.manifest);
|
|
4172
|
+
if (No(n) && !t.acceptCredentialExposure) throw Error("Credential-bearing Session Manifest requires acceptCredentialExposure: true. Prefer experienceId, sessionEndpoint, or client-side mint instead of SSR page data.");
|
|
4173
|
+
return new e({
|
|
4174
|
+
kind: "manifest",
|
|
4175
|
+
manifest: t.speechOnly ? us(n) : n,
|
|
4176
|
+
embedBaseUrl: t.embedBaseUrl,
|
|
4177
|
+
debug: t.debug,
|
|
4178
|
+
startButton: t.startButton,
|
|
4179
|
+
speechOnly: t.speechOnly,
|
|
4180
|
+
fit: t.fit,
|
|
4181
|
+
ui: t.ui,
|
|
4182
|
+
onStart: t.onStart,
|
|
4183
|
+
onUserTranscript: t.onUserTranscript,
|
|
4184
|
+
conversationProcessor: t.conversationProcessor
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
getManifest() {
|
|
4188
|
+
return this.resolvedManifest;
|
|
4189
|
+
}
|
|
4190
|
+
on(e, t) {
|
|
4191
|
+
let n = fs(this.eventRegistry, e, t);
|
|
4192
|
+
return e === "ready" && this.readyEvent && queueMicrotask(() => t(this.readyEvent)), e === "started" && this.startedEvent && queueMicrotask(() => t(this.startedEvent)), n;
|
|
4193
|
+
}
|
|
4194
|
+
async attach(e) {
|
|
4195
|
+
if (this.closed) throw Error("Session has ended.");
|
|
4196
|
+
if (!e.container) throw Error("Experience.attach requires a DOM container element.");
|
|
4197
|
+
return this.attached && this.iframeHost ? this.createPlayerFacade() : (this.attachInFlight ||= this.attachInternal(e).finally(() => {
|
|
4198
|
+
this.attachInFlight = null;
|
|
4199
|
+
}), this.attachInFlight);
|
|
4200
|
+
}
|
|
4201
|
+
async attachInternal(e) {
|
|
4202
|
+
if (this.closed) throw Error("Session has ended.");
|
|
4203
|
+
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
4204
|
+
this.iframeHost &&= (this.iframeHost.destroy(), null);
|
|
4205
|
+
let t = this.launch.embedBaseUrl ?? as(), n = this.launch.debug === !0, r = this.launch.speechOnly === !0, i = os(t, n, r || this.launch.kind === "manifest" ? void 0 : this.launch.locationId, r || this.launch.kind === "manifest" ? void 0 : this.launch.avatarId, this.launch.fit, this.launch.ui, e.showClose === !0), a = cs(i), o = null, s = new Promise((e) => {
|
|
4206
|
+
o = e;
|
|
4207
|
+
}), c = null, l = new Promise((e) => {
|
|
4208
|
+
c = e;
|
|
4209
|
+
}), u = ts((e) => {
|
|
4210
|
+
this.readyEvent || (this.readyEvent = { manifest: e }, Q(this.eventRegistry, "ready", this.readyEvent));
|
|
4211
|
+
}), d = this.launch.onUserTranscript, f = es({
|
|
4212
|
+
container: e.container,
|
|
4213
|
+
src: i,
|
|
4214
|
+
playerOrigin: a,
|
|
4215
|
+
transparent: this.launch.ui === "widget",
|
|
4216
|
+
onClose: (e) => {
|
|
4217
|
+
for (let t of this.closeHandlers) t(e);
|
|
4218
|
+
},
|
|
4219
|
+
onStateUpdate: (t) => {
|
|
4220
|
+
e.onStateUpdate?.(t), t === "loading" && o && (o(), o = null), t === "ready" && c && (c(), c = null), t === "ready" && u.markReady();
|
|
4221
|
+
},
|
|
4222
|
+
onUserTranscript: (e) => {
|
|
4223
|
+
Q(this.eventRegistry, "userTranscript", e), d?.(e), this.queueProcessorTurn(e);
|
|
4224
|
+
},
|
|
4225
|
+
onUserSpeechStarted: (e) => {
|
|
4226
|
+
Q(this.eventRegistry, "userSpeechStarted", e);
|
|
4227
|
+
},
|
|
4228
|
+
onUserSpeechEnded: (e) => {
|
|
4229
|
+
Q(this.eventRegistry, "userSpeechEnded", e);
|
|
4230
|
+
},
|
|
4231
|
+
onCharacterSpeechStarted: (e) => {
|
|
4232
|
+
Q(this.eventRegistry, "characterSpeechStarted", e);
|
|
4233
|
+
},
|
|
4234
|
+
onCharacterSpeechEnded: (e) => {
|
|
4235
|
+
Q(this.eventRegistry, "characterSpeechEnded", e);
|
|
4236
|
+
},
|
|
4237
|
+
onListeningState: (e) => {
|
|
4238
|
+
Q(this.eventRegistry, "listeningState", e);
|
|
4239
|
+
},
|
|
4240
|
+
onModeChange: (e) => {
|
|
4241
|
+
Q(this.eventRegistry, "modeChange", e);
|
|
4242
|
+
},
|
|
4243
|
+
onMessage: (e) => {
|
|
4244
|
+
Q(this.eventRegistry, "message", e);
|
|
4245
|
+
},
|
|
4246
|
+
onStarted: (e) => {
|
|
4247
|
+
this.startedEvent || (this.startedEvent = e, Q(this.eventRegistry, "started", e), this.launch.onStart?.(e));
|
|
4248
|
+
},
|
|
4249
|
+
onConversationUpdate: (e) => {
|
|
4250
|
+
this.conversationCache = e, Q(this.eventRegistry, "conversationUpdate", e);
|
|
4251
|
+
},
|
|
4252
|
+
onWidgetReady: () => e.onWidgetReady?.(),
|
|
4253
|
+
onWidgetExpand: () => e.onWidgetExpand?.(),
|
|
4254
|
+
onWidgetCollapse: () => e.onWidgetCollapse?.(),
|
|
4255
|
+
onWidgetAudioSettings: (t) => e.onWidgetAudioSettings?.(t)
|
|
4256
|
+
});
|
|
4257
|
+
this.iframeHost = f;
|
|
4258
|
+
let p = this.resolveMintInteraction(), ee = this.launch.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Lo(this.launch.sessionEndpoint, {
|
|
4259
|
+
experienceId: this.launch.experienceId,
|
|
4260
|
+
language: this.launch.language,
|
|
4261
|
+
mode: p.mode,
|
|
4262
|
+
responseMode: p.responseMode,
|
|
4263
|
+
speechInputMode: p.speechInputMode,
|
|
4264
|
+
startButton: this.launch.startButton,
|
|
4265
|
+
speechOnly: this.launch.speechOnly,
|
|
4266
|
+
signal: this.endpointAbortController.signal
|
|
4267
|
+
})) : this.launch.kind === "public" ? Io(this.launch.experienceId, {
|
|
4268
|
+
language: this.launch.language,
|
|
4269
|
+
mode: p.mode,
|
|
4270
|
+
responseMode: p.responseMode,
|
|
4271
|
+
speechInputMode: p.speechInputMode,
|
|
4272
|
+
startButton: this.launch.startButton,
|
|
4273
|
+
speechOnly: this.launch.speechOnly
|
|
4274
|
+
}) : Promise.resolve(this.launch.kind === "manifest" ? this.launch.manifest : null), m;
|
|
4275
|
+
try {
|
|
4276
|
+
[, m] = await Promise.all([f.waitForLoad(), ee]);
|
|
4277
|
+
} catch (e) {
|
|
4278
|
+
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
4279
|
+
} finally {
|
|
4280
|
+
this.endpointAbortController = null;
|
|
4281
|
+
}
|
|
4282
|
+
if (f.postParentHello(), m) {
|
|
4283
|
+
let e = ms(m, this.launch.startButton);
|
|
4284
|
+
this.launch.speechOnly && (e = us(e)), this.assertBrowserCustomManifest(e), this.resolvedManifest = e, f.postManifest(e), u.setValue(e);
|
|
4285
|
+
}
|
|
4286
|
+
return await Promise.race([s, new Promise((e, t) => {
|
|
4287
|
+
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
4288
|
+
})]), await Promise.race([l, new Promise((e, t) => {
|
|
4289
|
+
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
|
|
4290
|
+
})]), this.attached = !0, this.createPlayerFacade();
|
|
4291
|
+
}
|
|
4292
|
+
async speak(e) {
|
|
4293
|
+
return this.assertSessionStarted(), e.behavior === "interrupt" && (this.processorAbortController?.abort(), this.processorAbortController = null), this.iframeHost.speak({
|
|
4294
|
+
text: e.text,
|
|
4295
|
+
characterId: e.characterId,
|
|
4296
|
+
behavior: e.behavior
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
async startListening() {
|
|
4300
|
+
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
4301
|
+
}
|
|
4302
|
+
async stopListening() {
|
|
4303
|
+
return this.assertSessionStarted(), this.iframeHost.stopListening();
|
|
4304
|
+
}
|
|
4305
|
+
async listenOnce(e) {
|
|
4306
|
+
return this.assertSessionStarted(), this.iframeHost.listenOnce({ timeoutMs: e?.timeoutMs });
|
|
4307
|
+
}
|
|
4308
|
+
getConversation() {
|
|
4309
|
+
return this.conversationCache;
|
|
4310
|
+
}
|
|
4311
|
+
setWidgetChrome(e) {
|
|
4312
|
+
this.iframeHost?.postWidgetSetChrome(e);
|
|
4313
|
+
}
|
|
4314
|
+
toggleAudioSettings() {
|
|
4315
|
+
this.iframeHost?.postWidgetToggleAudioSettings();
|
|
4316
|
+
}
|
|
4317
|
+
getLastTurn() {
|
|
4318
|
+
if (this.conversationCache.length === 0) return [];
|
|
4319
|
+
let e = this.conversationCache[this.conversationCache.length - 1].turnId;
|
|
4320
|
+
return this.conversationCache.filter((t) => t.turnId === e);
|
|
4321
|
+
}
|
|
4322
|
+
async end() {
|
|
4323
|
+
this.close();
|
|
4324
|
+
}
|
|
4325
|
+
destroy() {
|
|
4326
|
+
this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, ps(this.eventRegistry), this.readyEvent = null, this.startedEvent = null, this.closeHandlers.length = 0, this.attached = !1);
|
|
4327
|
+
}
|
|
4328
|
+
resolveMintInteraction() {
|
|
4329
|
+
if (this.launch.kind === "manifest") return {};
|
|
4330
|
+
let e = this.conversationProcessor !== null;
|
|
4331
|
+
return {
|
|
4332
|
+
mode: this.launch.mode,
|
|
4333
|
+
responseMode: e ? "custom" : this.launch.responseMode,
|
|
4334
|
+
speechInputMode: this.launch.speechInputMode
|
|
4335
|
+
};
|
|
4336
|
+
}
|
|
4337
|
+
assertBrowserCustomManifest(e) {
|
|
4338
|
+
if (this.conversationProcessor) {
|
|
4339
|
+
if (e.experience.responseMode !== "custom") throw Error("conversationProcessor requires responseMode custom in the Session Manifest.");
|
|
4340
|
+
if (e.processorId) throw Error("Browser conversationProcessor cannot be used with a registered processorId.");
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
queueProcessorTurn(e) {
|
|
4344
|
+
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
4345
|
+
let t = this.conversationProcessor;
|
|
4346
|
+
this.processorAbortController?.abort(), this.processorAbortController = new AbortController();
|
|
4347
|
+
let n = this.processorAbortController.signal;
|
|
4348
|
+
this.processorChain = this.processorChain.then(async () => {
|
|
4349
|
+
if (!n.aborted) try {
|
|
4350
|
+
let r = await Bo(t, {
|
|
4351
|
+
utteranceId: e.utteranceId,
|
|
4352
|
+
text: e.text,
|
|
4353
|
+
conversation: this.conversationCache,
|
|
4354
|
+
signal: n
|
|
4355
|
+
});
|
|
4356
|
+
if (n.aborted) return;
|
|
4357
|
+
if (r.kind === "complete") {
|
|
4358
|
+
let e = r.speech;
|
|
4359
|
+
await this.speak({
|
|
4360
|
+
text: e.text,
|
|
4361
|
+
...e.characterId ? { characterId: e.characterId } : {},
|
|
4362
|
+
...e.behavior ? { behavior: e.behavior } : {}
|
|
4363
|
+
});
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
await this.iframeHost.speakProcessorStream(r.stream, { signal: n });
|
|
4367
|
+
} catch (t) {
|
|
4368
|
+
if (n.aborted) return;
|
|
4369
|
+
let r = t instanceof Error ? t.message : String(t);
|
|
4370
|
+
Q(this.eventRegistry, "conversationProcessorError", {
|
|
4371
|
+
utteranceId: e.utteranceId,
|
|
4372
|
+
message: r
|
|
4373
|
+
});
|
|
4374
|
+
}
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
assertAttached() {
|
|
4378
|
+
if (!this.attached || !this.iframeHost) throw Error("Call Experience.attach() before using speech APIs.");
|
|
4379
|
+
}
|
|
4380
|
+
assertSessionStarted() {
|
|
4381
|
+
if (this.assertAttached(), !this.startedEvent) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
|
|
4382
|
+
}
|
|
4383
|
+
close() {
|
|
4384
|
+
this.closed || (this.closed = !0, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, this.attached = !1);
|
|
4385
|
+
}
|
|
4386
|
+
createPlayerFacade() {
|
|
4387
|
+
return {
|
|
4388
|
+
close: () => {
|
|
4389
|
+
this.close();
|
|
4390
|
+
},
|
|
4391
|
+
destroy: () => {
|
|
4392
|
+
this.destroy();
|
|
4393
|
+
},
|
|
4394
|
+
on: (e, t) => {
|
|
4395
|
+
e === "close" && this.closeHandlers.push(t);
|
|
4396
|
+
}
|
|
4397
|
+
};
|
|
4398
|
+
}
|
|
4399
|
+
}, gs = "(min-width: 768px)", _s = 24, vs = .5, ys = 1200, bs = .85, xs = 9 / 16;
|
|
4400
|
+
function Ss() {
|
|
4401
|
+
if (typeof window > "u") return 800;
|
|
4402
|
+
let e = window.screen?.availHeight;
|
|
4403
|
+
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
4404
|
+
}
|
|
4405
|
+
function Cs(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = _s, r = typeof window < "u" ? Ss() : 800) {
|
|
4406
|
+
let i = Math.max(160, Math.min(t - n * 2, t * bs)), a = Math.max(120, e - n * 2), o = Math.min(r * vs, ys, i), s = o * xs;
|
|
4407
|
+
return s > a && (s = a, o = s / xs, o > i && (o = i, s = o * xs)), {
|
|
4408
|
+
width: Math.round(s),
|
|
4409
|
+
height: Math.round(o)
|
|
4410
|
+
};
|
|
4411
|
+
}
|
|
4412
|
+
function ws(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = _s) {
|
|
4413
|
+
return {
|
|
4414
|
+
left: Math.max(r, t - e.width - r),
|
|
4415
|
+
top: Math.max(r, n - e.height - r)
|
|
4416
|
+
};
|
|
4417
|
+
}
|
|
4418
|
+
function Ts(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = _s) {
|
|
4419
|
+
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
4420
|
+
return {
|
|
4421
|
+
left: Math.min(Math.max(a, e), o),
|
|
4422
|
+
top: Math.min(Math.max(a, t), s)
|
|
4423
|
+
};
|
|
4424
|
+
}
|
|
4425
|
+
function Es(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
4426
|
+
return e(gs).matches;
|
|
4427
|
+
}
|
|
4428
|
+
//#endregion
|
|
4429
|
+
//#region src/widget/mountExperienceWidget.ts
|
|
4430
|
+
function Ds(e) {
|
|
4431
|
+
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
4432
|
+
}
|
|
4433
|
+
function Os(e) {
|
|
4434
|
+
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
4435
|
+
let t = typeof e == "string" ? e.trim() : "";
|
|
4436
|
+
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
4437
|
+
}
|
|
4438
|
+
function $(e) {
|
|
4439
|
+
return e === "expanded" || e === "docked";
|
|
4440
|
+
}
|
|
4441
|
+
var ks = "<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>", As = "<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>", js = "<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>", Ms = "<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>";
|
|
4442
|
+
function Ns(e, t, n) {
|
|
4443
|
+
b(v);
|
|
4444
|
+
let r = o({
|
|
4445
|
+
galleryThumb: t.galleryThumb,
|
|
4446
|
+
avatarImage: t.avatarImage,
|
|
4447
|
+
backgroundImage: t.backgroundImage,
|
|
4448
|
+
foregroundImage: t.foregroundImage,
|
|
4449
|
+
fallbackImage: t.fallbackImage
|
|
4450
|
+
});
|
|
4451
|
+
if (!r) return e.replaceChildren(), null;
|
|
4452
|
+
let i = document.createElement("div");
|
|
4453
|
+
i.className = `liforma-et${r.backgroundImage ? " liforma-et--scene" : ""} liforma-et--revealed`, i.setAttribute("aria-hidden", "true");
|
|
4454
|
+
let a = document.createElement("span");
|
|
4455
|
+
a.className = "liforma-et__placeholder", a.setAttribute("aria-hidden", "true"), i.append(a);
|
|
4456
|
+
let s = (e) => {
|
|
4457
|
+
e.classList.add("liforma-et__media--ready");
|
|
4458
|
+
};
|
|
4459
|
+
if (r.backgroundImage) {
|
|
4460
|
+
let e = document.createElement("img");
|
|
4461
|
+
e.className = "liforma-et__background liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.backgroundImage, e.addEventListener("load", () => s(e), { once: !0 }), i.append(e);
|
|
4462
|
+
}
|
|
4463
|
+
let c = document.createElement("img");
|
|
4464
|
+
if (c.className = "liforma-et__avatar liforma-et__media", c.alt = "", c.decoding = "async", c.src = r.avatarImage, c.addEventListener("load", () => s(c), { once: !0 }), c.addEventListener("error", () => {
|
|
4465
|
+
r.fallbackImage && (c.src = r.fallbackImage);
|
|
4466
|
+
}, { once: !0 }), i.append(c), r.foregroundImage) {
|
|
4467
|
+
let e = document.createElement("img");
|
|
4468
|
+
e.className = "liforma-et__foreground liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.foregroundImage, e.addEventListener("load", () => s(e), { once: !0 }), i.append(e);
|
|
4469
|
+
}
|
|
4470
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : _(i);
|
|
4471
|
+
}
|
|
4472
|
+
function Ps(e) {
|
|
4473
|
+
return e.startButton ? {
|
|
4474
|
+
...e.startButton,
|
|
4475
|
+
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
4476
|
+
placement: e.startButton.placement ?? "bottom-center",
|
|
4477
|
+
variant: e.startButton.variant ?? "primary"
|
|
4478
|
+
} : {
|
|
4479
|
+
label: e.startButtonLabel ?? "Tap to talk",
|
|
4480
|
+
placement: "bottom-center",
|
|
4481
|
+
variant: "primary"
|
|
4482
|
+
};
|
|
4483
|
+
}
|
|
4484
|
+
function Fs(e) {
|
|
4485
|
+
let t = !1, n = () => {
|
|
4486
|
+
t || e();
|
|
4487
|
+
}, r = () => {
|
|
4488
|
+
if (t) return;
|
|
4489
|
+
let e = window.requestIdleCallback;
|
|
4490
|
+
if (typeof e == "function") {
|
|
4491
|
+
let t = e(n, { timeout: 3e3 });
|
|
4492
|
+
i = () => {
|
|
4493
|
+
window.cancelIdleCallback?.(t);
|
|
4494
|
+
};
|
|
4495
|
+
return;
|
|
4496
|
+
}
|
|
4497
|
+
let r = window.setTimeout(n, 1);
|
|
4498
|
+
i = () => window.clearTimeout(r);
|
|
4499
|
+
}, i = null;
|
|
4500
|
+
return document.readyState === "complete" ? r() : window.addEventListener("load", r, { once: !0 }), () => {
|
|
4501
|
+
t = !0, window.removeEventListener("load", r), i?.();
|
|
4502
|
+
};
|
|
4503
|
+
}
|
|
4504
|
+
function Is(e, t) {
|
|
4505
|
+
ie(ne);
|
|
4506
|
+
let n = t.experienceId?.trim();
|
|
4507
|
+
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
4508
|
+
let r = t.prefetch ?? "onExpand", i = Ds(t.position), a = document.createElement("div");
|
|
4509
|
+
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", Os(t.offset));
|
|
4510
|
+
let o = document.createElement("button");
|
|
4511
|
+
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
4512
|
+
let s = document.createElement("div");
|
|
4513
|
+
s.className = "liforma-ew__face", o.append(s);
|
|
4514
|
+
let c = document.createElement("div");
|
|
4515
|
+
c.className = "liforma-ew__face-status", c.textContent = "Loading…", s.append(c);
|
|
4516
|
+
let l = document.createElement("div");
|
|
4517
|
+
l.className = "liforma-ew__warm", l.hidden = !0, l.setAttribute("aria-hidden", "true");
|
|
4518
|
+
let u = document.createElement("div");
|
|
4519
|
+
u.className = "liforma-ew__overlay", u.hidden = !0, u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "true"), u.setAttribute("aria-label", t.alt);
|
|
4520
|
+
let d = document.createElement("button");
|
|
4521
|
+
d.type = "button", d.className = "liforma-ew__backdrop", d.setAttribute("aria-label", "Close experience");
|
|
4522
|
+
let f = document.createElement("div");
|
|
4523
|
+
f.className = "liforma-ew__panel";
|
|
4524
|
+
let p = document.createElement("div");
|
|
4525
|
+
p.className = "liforma-ew__toolbar", p.hidden = !0;
|
|
4526
|
+
let ee = document.createElement("span");
|
|
4527
|
+
ee.className = "liforma-ew__drag-grip", ee.setAttribute("aria-hidden", "true");
|
|
4528
|
+
let m = document.createElement("button");
|
|
4529
|
+
m.type = "button", m.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", m.innerHTML = js, m.setAttribute("aria-label", "Reduce");
|
|
4530
|
+
let h = document.createElement("button");
|
|
4531
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__settings", h.innerHTML = ks, h.setAttribute("aria-label", "Audio settings"), h.setAttribute("aria-pressed", "false");
|
|
4532
|
+
let g = document.createElement("button");
|
|
4533
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__close", g.innerHTML = As, g.setAttribute("aria-label", "Close"), p.append(ee, m, h, g);
|
|
4534
|
+
let te = document.createElement("div");
|
|
4535
|
+
te.className = "liforma-ew__stage";
|
|
4536
|
+
let _ = document.createElement("div");
|
|
4537
|
+
_.className = "liforma-ew__status", _.hidden = !0, f.append(te, _), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
|
|
4538
|
+
let v = null, y = !1, b = !1, re = !1, x = !1, ae = !1, S = !1, C = !1, w = 0, se = "", ce = null, T = null, E = null, le = null, D = null, O = null, ue = null, de = 0, fe = 0, pe = new AbortController(), me = t.parallax !== !1, k = () => {
|
|
4539
|
+
let e = a.dataset.state;
|
|
4540
|
+
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
4541
|
+
}, he = () => {
|
|
4542
|
+
E !== null && (clearTimeout(E), E = null);
|
|
4543
|
+
}, A = () => {
|
|
4544
|
+
le !== null && (clearTimeout(le), le = null), a.classList.remove("liforma-ew--layout-settling");
|
|
4545
|
+
}, j = () => {
|
|
4546
|
+
for (let e of [
|
|
4547
|
+
f,
|
|
4548
|
+
l,
|
|
4549
|
+
p
|
|
4550
|
+
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
4551
|
+
p.classList.remove("liforma-ew__toolbar--dragging");
|
|
4552
|
+
}, M = (e, t, n, r) => {
|
|
4553
|
+
let i = (i) => {
|
|
4554
|
+
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";
|
|
4555
|
+
};
|
|
4556
|
+
i(f), i(l);
|
|
4557
|
+
let a = p.offsetWidth || 120;
|
|
4558
|
+
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";
|
|
4559
|
+
}, N = () => {
|
|
4560
|
+
let e = Es(), t = k();
|
|
4561
|
+
if (!e || t !== "expanded" && t !== "docked") {
|
|
4562
|
+
m.hidden = !0;
|
|
4563
|
+
return;
|
|
4564
|
+
}
|
|
4565
|
+
m.hidden = !1, t === "docked" ? (m.innerHTML = Ms, m.setAttribute("aria-label", "Maximize")) : (m.innerHTML = js, m.setAttribute("aria-label", "Reduce"));
|
|
4566
|
+
}, ge = (e) => {
|
|
4567
|
+
let t = Cs(), n = e && D !== null && O !== null ? Ts(D, O, t) : ws(t);
|
|
4568
|
+
n = Ts(n.left, n.top, t), D = n.left, O = n.top, M(n.left, n.top, t.width, t.height), N();
|
|
4569
|
+
}, _e = () => {
|
|
4570
|
+
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
4571
|
+
requestAnimationFrame(() => {
|
|
4572
|
+
b || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
4573
|
+
});
|
|
4574
|
+
});
|
|
4575
|
+
}, ve = (e) => {
|
|
4576
|
+
if (A(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !C) {
|
|
4577
|
+
a.classList.remove("liforma-ew--layout-settling");
|
|
4578
|
+
return;
|
|
4579
|
+
}
|
|
4580
|
+
le = setTimeout(() => {
|
|
4581
|
+
if (le = null, b || !$(a.dataset.state)) {
|
|
4582
|
+
a.classList.remove("liforma-ew--layout-settling");
|
|
4583
|
+
return;
|
|
4584
|
+
}
|
|
4585
|
+
a.classList.remove("liforma-ew--layout-settling"), _e();
|
|
4586
|
+
}, 220);
|
|
4587
|
+
}, ye = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
4588
|
+
he(), E = setTimeout(() => {
|
|
4589
|
+
E = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
4590
|
+
}, 280);
|
|
4591
|
+
})), be = {
|
|
4592
|
+
galleryThumb: t.galleryThumb,
|
|
4593
|
+
avatarImage: t.avatarImage,
|
|
4594
|
+
backgroundImage: t.backgroundImage,
|
|
4595
|
+
foregroundImage: t.foregroundImage,
|
|
4596
|
+
fallbackImage: t.fallbackImage
|
|
4597
|
+
}, P = (e) => {
|
|
4598
|
+
if (!e) {
|
|
4599
|
+
_.hidden = !0, _.textContent = "";
|
|
4600
|
+
return;
|
|
4601
|
+
}
|
|
4602
|
+
_.hidden = !1, _.textContent = e;
|
|
4603
|
+
}, xe = (e) => {
|
|
4604
|
+
if (!e) {
|
|
4605
|
+
c.hidden = !0, c.textContent = "";
|
|
4606
|
+
return;
|
|
4607
|
+
}
|
|
4608
|
+
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
4609
|
+
}, F = () => {
|
|
4610
|
+
re = !0, o.disabled = !1, xe(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
4611
|
+
}, I = () => {
|
|
4612
|
+
x = !0, a.dataset.warm = "true", l.hidden = !1, C || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
4613
|
+
}, L = (e) => {
|
|
4614
|
+
ce?.(), ce = null;
|
|
4615
|
+
let t = Ns(s, e, { parallax: me });
|
|
4616
|
+
return t ? (ce = t, !0) : !1;
|
|
4617
|
+
}, Se = () => {
|
|
4618
|
+
if (L(be)) {
|
|
4619
|
+
F();
|
|
4620
|
+
return;
|
|
4621
|
+
}
|
|
4622
|
+
xe("Loading…"), oe(n, { signal: pe.signal }).then((e) => {
|
|
4623
|
+
if (!b) {
|
|
4624
|
+
if (!L({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
4625
|
+
F();
|
|
4626
|
+
}
|
|
4627
|
+
}).catch((e) => {
|
|
4628
|
+
if (b || pe.signal.aborted) return;
|
|
4629
|
+
let n = e instanceof Error ? e : Error(String(e));
|
|
4630
|
+
xe("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
4631
|
+
});
|
|
4632
|
+
}, Ce = () => ({
|
|
4633
|
+
experienceId: n,
|
|
4634
|
+
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
4635
|
+
...t.language ? { language: t.language } : {},
|
|
4636
|
+
...t.mode ? { mode: t.mode } : {},
|
|
4637
|
+
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
4638
|
+
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
4639
|
+
...t.fit ? { fit: t.fit } : {},
|
|
4640
|
+
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {},
|
|
4641
|
+
startButton: Ps(t)
|
|
4642
|
+
}), we = (e = !0) => {
|
|
4643
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), j(), a.dataset.state = "expanded", P(null), typeof document < "u" && (se = document.body.style.overflow, document.body.style.overflow = "hidden"), N(), e && t.onExpanded?.();
|
|
4644
|
+
}, Te = () => {
|
|
4645
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", P(null), typeof document < "u" && (document.body.style.overflow = se), ge(!0), N();
|
|
4646
|
+
}, Ee = (e) => {
|
|
4647
|
+
e.on("started", () => {
|
|
4648
|
+
b || (C = !0, a.dataset.live = "true", P(null), t.onStarted?.(), $(a.dataset.state) && _e());
|
|
4649
|
+
});
|
|
4650
|
+
}, De = () => {
|
|
4651
|
+
A(), u.hidden = !0, p.hidden = !0, j(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), h.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), re && (o.disabled = !1), P(null), typeof document < "u" && (document.body.style.overflow = se), N();
|
|
4652
|
+
}, Oe = () => {
|
|
4653
|
+
he(), A(), w += 1, y = !1, x = !1, ae = !1, S = !1, C = !1;
|
|
4654
|
+
let e = v;
|
|
4655
|
+
v = null, e?.destroy(), te.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
|
|
4656
|
+
}, ke = () => {
|
|
4657
|
+
if (!b && $(a.dataset.state)) {
|
|
4658
|
+
if (y = !1, v && S) {
|
|
4659
|
+
let e = v;
|
|
4660
|
+
(async () => {
|
|
4661
|
+
C && (await ye(), b || v !== e) || (x && e.setWidgetChrome("collapsed"), De(), C ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : x && I(), t.onCollapsed?.(), t.onClose?.());
|
|
4662
|
+
})();
|
|
4663
|
+
return;
|
|
4664
|
+
}
|
|
4665
|
+
Oe(), De(), t.onCollapsed?.(), t.onClose?.();
|
|
4666
|
+
}
|
|
4667
|
+
}, Ae = () => {
|
|
4668
|
+
b || Es() && k() === "expanded" && ve(() => {
|
|
4669
|
+
Te();
|
|
4670
|
+
});
|
|
4671
|
+
}, R = () => {
|
|
4672
|
+
b || k() === "docked" && ve(() => {
|
|
4673
|
+
j(), we(!1), v?.setWidgetChrome("expanded");
|
|
4674
|
+
});
|
|
4675
|
+
}, je = () => {
|
|
4676
|
+
!v || !C || (he(), a.classList.remove("liforma-ew--session-revealed"), we(), v.setWidgetChrome("expanded"), y = !1, _e());
|
|
4677
|
+
}, z = () => {
|
|
4678
|
+
!v || !S || C || (he(), a.classList.remove("liforma-ew--session-revealed"), we(), y = !1, x && v.setWidgetChrome("expanded"));
|
|
4679
|
+
}, Me = (e) => {
|
|
4680
|
+
b || e !== w && !C || (he(), a.classList.remove("liforma-ew--session-revealed"), we(), y = !1, v?.setWidgetChrome("expanded"), C && _e());
|
|
4681
|
+
}, B = () => {
|
|
4682
|
+
if (b || ae || x || v || $(a.dataset.state)) return;
|
|
4683
|
+
ae = !0;
|
|
4684
|
+
let e = w;
|
|
4685
|
+
l.hidden = !1, (async () => {
|
|
4686
|
+
try {
|
|
4687
|
+
let t = await hs.startSession({
|
|
4688
|
+
...Ce(),
|
|
4689
|
+
ui: "widget"
|
|
4690
|
+
});
|
|
4691
|
+
if (b || e !== w) {
|
|
4692
|
+
t.destroy();
|
|
4693
|
+
return;
|
|
4694
|
+
}
|
|
4695
|
+
v = t, Ee(t);
|
|
4696
|
+
let n = await t.attach({
|
|
4697
|
+
container: l,
|
|
4698
|
+
onWidgetReady: () => {
|
|
4699
|
+
b || e !== w || (ae = !1, S = !0, I());
|
|
4700
|
+
},
|
|
4701
|
+
onWidgetExpand: () => {
|
|
4702
|
+
Me(e);
|
|
4703
|
+
},
|
|
4704
|
+
onWidgetAudioSettings: (e) => {
|
|
4705
|
+
b || Ie(e);
|
|
4706
|
+
},
|
|
4707
|
+
onStateUpdate: (e) => {
|
|
4708
|
+
b || e === "error" && $(a.dataset.state) && P("Could not load the experience.");
|
|
4709
|
+
}
|
|
4710
|
+
});
|
|
4711
|
+
if (b || e !== w) {
|
|
4712
|
+
t.destroy(), v === t && (v = null);
|
|
4713
|
+
return;
|
|
4714
|
+
}
|
|
4715
|
+
S = !0, n.on("close", () => {
|
|
4716
|
+
b || ke();
|
|
4717
|
+
});
|
|
4718
|
+
} catch (n) {
|
|
4719
|
+
if (b || e !== w) return;
|
|
4720
|
+
ae = !1, l.hidden = !0, l.replaceChildren(), v = null;
|
|
4721
|
+
let r = n instanceof Error ? n : Error(String(n));
|
|
4722
|
+
t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
|
|
4723
|
+
}
|
|
4724
|
+
})();
|
|
4725
|
+
}, Ne = () => {
|
|
4726
|
+
if (b || y || !re || $(a.dataset.state)) return;
|
|
4727
|
+
if (v && C) {
|
|
4728
|
+
je();
|
|
4729
|
+
return;
|
|
4730
|
+
}
|
|
4731
|
+
if (v && S) {
|
|
4732
|
+
z();
|
|
4733
|
+
return;
|
|
4734
|
+
}
|
|
4735
|
+
let e = ++w;
|
|
4736
|
+
y = !0, x = !1, ae = !1, S = !1, C = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), v &&= (v.destroy(), null), (async () => {
|
|
4737
|
+
try {
|
|
4738
|
+
we();
|
|
4739
|
+
let t = await hs.startSession(Ce());
|
|
4740
|
+
if (b || e !== w) {
|
|
4741
|
+
t.destroy();
|
|
4742
|
+
return;
|
|
4743
|
+
}
|
|
4744
|
+
v = t, Ee(t);
|
|
4745
|
+
let n = await t.attach({
|
|
4746
|
+
container: te,
|
|
4747
|
+
onWidgetAudioSettings: (e) => {
|
|
4748
|
+
b || Ie(e);
|
|
4749
|
+
},
|
|
4750
|
+
onStateUpdate: (e) => {
|
|
4751
|
+
b || (e === "error" ? P("Could not load the experience.") : $(a.dataset.state) && P(null));
|
|
4752
|
+
}
|
|
4753
|
+
});
|
|
4754
|
+
if (b || e !== w) {
|
|
4755
|
+
t.destroy(), v === t && (v = null);
|
|
4756
|
+
return;
|
|
4757
|
+
}
|
|
4758
|
+
S = !0, n.on("close", () => {
|
|
4759
|
+
b || ke();
|
|
4760
|
+
});
|
|
4761
|
+
} catch (n) {
|
|
4762
|
+
if (b || e !== w) return;
|
|
4763
|
+
let r = n instanceof Error ? n : Error(String(n));
|
|
4764
|
+
P(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
4765
|
+
} finally {
|
|
4766
|
+
e === w && (y = !1);
|
|
4767
|
+
}
|
|
4768
|
+
})();
|
|
4769
|
+
}, Pe = () => {
|
|
4770
|
+
if (!(b || $(a.dataset.state))) {
|
|
4771
|
+
if (v && C) {
|
|
4772
|
+
je();
|
|
4773
|
+
return;
|
|
4774
|
+
}
|
|
4775
|
+
if (v && S) {
|
|
4776
|
+
z();
|
|
4777
|
+
return;
|
|
4778
|
+
}
|
|
4779
|
+
Ne();
|
|
4780
|
+
}
|
|
4781
|
+
}, Fe = (e) => {
|
|
4782
|
+
if (e.stopPropagation(), k() === "expanded") {
|
|
4783
|
+
Ae();
|
|
4784
|
+
return;
|
|
4785
|
+
}
|
|
4786
|
+
k() === "docked" && R();
|
|
4787
|
+
}, Ie = (e) => {
|
|
4788
|
+
h.setAttribute("aria-pressed", e ? "true" : "false");
|
|
4789
|
+
}, Le = (e) => {
|
|
4790
|
+
e.stopPropagation(), $(a.dataset.state) && v?.toggleAudioSettings();
|
|
4791
|
+
}, Re = (e) => {
|
|
4792
|
+
if (k() !== "docked" || !Es() || e.target?.closest("button")) return;
|
|
4793
|
+
e.preventDefault(), ue = e.pointerId, p.classList.add("liforma-ew__toolbar--dragging"), p.setPointerCapture(e.pointerId);
|
|
4794
|
+
let t = f.getBoundingClientRect();
|
|
4795
|
+
de = e.clientX - t.left, fe = e.clientY - t.top;
|
|
4796
|
+
}, ze = (e) => {
|
|
4797
|
+
if (ue === null || e.pointerId !== ue || k() !== "docked") return;
|
|
4798
|
+
let t = Cs(), n = Ts(e.clientX - de, e.clientY - fe, t);
|
|
4799
|
+
D = n.left, O = n.top, M(n.left, n.top, t.width, t.height);
|
|
4800
|
+
}, Be = (e) => {
|
|
4801
|
+
if (!(ue === null || e.pointerId !== ue)) {
|
|
4802
|
+
ue = null, p.classList.remove("liforma-ew__toolbar--dragging");
|
|
4803
|
+
try {
|
|
4804
|
+
p.releasePointerCapture(e.pointerId);
|
|
4805
|
+
} catch {}
|
|
4806
|
+
}
|
|
4807
|
+
}, Ve = (e) => {
|
|
4808
|
+
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), ke());
|
|
4809
|
+
}, He = () => {
|
|
4810
|
+
if (!b) {
|
|
4811
|
+
if (k() === "docked") {
|
|
4812
|
+
if (!Es()) {
|
|
4813
|
+
R();
|
|
4814
|
+
return;
|
|
4815
|
+
}
|
|
4816
|
+
C ? ve(() => {
|
|
4817
|
+
ge(!0);
|
|
4818
|
+
}) : ge(!0);
|
|
4819
|
+
return;
|
|
4820
|
+
}
|
|
4821
|
+
N();
|
|
4822
|
+
}
|
|
4823
|
+
}, Ue = typeof window < "u" ? window.matchMedia(gs) : null, We = () => {
|
|
4824
|
+
if (!b) {
|
|
4825
|
+
if (k() === "docked" && !Es()) {
|
|
4826
|
+
R();
|
|
4827
|
+
return;
|
|
4828
|
+
}
|
|
4829
|
+
N();
|
|
4830
|
+
}
|
|
4831
|
+
};
|
|
4832
|
+
return o.addEventListener("click", Pe), d.addEventListener("click", ke), g.addEventListener("click", (e) => {
|
|
4833
|
+
e.stopPropagation(), ke();
|
|
4834
|
+
}), m.addEventListener("click", Fe), h.addEventListener("click", Le), p.addEventListener("pointerdown", Re), p.addEventListener("pointermove", ze), p.addEventListener("pointerup", Be), p.addEventListener("pointercancel", Be), window.addEventListener("keydown", Ve), window.addEventListener("resize", He), Ue?.addEventListener("change", We), Se(), N(), r === "eager" ? queueMicrotask(() => {
|
|
4835
|
+
b || B();
|
|
4836
|
+
}) : r === "idle" && (T = Fs(() => {
|
|
4837
|
+
b || B();
|
|
4838
|
+
})), {
|
|
4839
|
+
root: a,
|
|
4840
|
+
expand: Pe,
|
|
4841
|
+
collapse: ke,
|
|
4842
|
+
dock: Ae,
|
|
4843
|
+
maximize: R,
|
|
4844
|
+
prefetch() {
|
|
4845
|
+
if (r === "onExpand") {
|
|
4846
|
+
B();
|
|
4847
|
+
return;
|
|
4848
|
+
}
|
|
4849
|
+
B();
|
|
4850
|
+
},
|
|
4851
|
+
destroy() {
|
|
4852
|
+
b || (b = !0, T?.(), T = null, pe.abort(), ce?.(), ce = null, window.removeEventListener("keydown", Ve), window.removeEventListener("resize", He), Ue?.removeEventListener("change", We), Oe(), De(), e.replaceChildren());
|
|
4853
|
+
}
|
|
4854
|
+
};
|
|
4855
|
+
}
|
|
4856
|
+
//#endregion
|
|
4857
|
+
export { v as EXPERIENCE_THUMBNAIL_CSS, ne as EXPERIENCE_WIDGET_CSS, hs as Experience, m as attachImageReady, ee as attachLazyThumb, te as attachScrollLinkedParallax, f as buildHostedLaunchUrl, b as ensureExperienceThumbnailStyles, ie as ensureExperienceWidgetStyles, oe as fetchExperiencePreview, g as horizontalParallaxFromViewportY, Is as mountExperienceWidget, n as navigateOnExperienceClose, p as resolveThumbnailHref, u as resolveThumbnailInteraction, o as resolveThumbnailLayers, a as toGalleryThumbUrl };
|
|
4858
|
+
|
|
4859
|
+
//# sourceMappingURL=index.js.map
|