@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,806 @@
|
|
|
1
|
+
var Liforma=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(){if(globalThis.__LIFORMA_STACK===`local`)return!0;if(typeof location>`u`)return!1;try{return new URLSearchParams(location.search).get(`stack`)===`local`}catch{return!1}}var n=`https://api.liforma.ai`,r=`http://localhost:3001`;function i(){let e=globalThis.__LIFORMA_API_BASE_URL;if(e?.trim())return e.trim().replace(/\/$/,``);if(typeof document>`u`)return null;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();return t?t.replace(/\/$/,``):null}function a(){return i()||(t()?r:n)}function o(e,t){let n=e.trim();if(!n)throw Error(`sessionEndpoint must not be empty.`);if(typeof location>`u`)throw Error(`sessionEndpoint is only available in a browser.`);let r=new URL(n,location.href);if(r.origin!==location.origin)throw Error(`sessionEndpoint must be same-origin.`);let i=t.experienceId.trim();if(!i)throw Error(`sessionEndpoint requires experienceId.`);return{url:r.toString(),init:{method:`POST`,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({experienceId:i,...t.language?{language:t.language}:{},...t.mode?{mode:t.mode}:{},...t.responseMode?{responseMode:t.responseMode}:{},...t.speechInputMode?{speechInputMode:t.speechInputMode}:{},...t.startButton?{startButton:t.startButton}:{},...t.speechOnly===void 0?{}:{speechOnly:t.speechOnly}})}}}var s;function c(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}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}var l=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},u=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(s=globalThis).__zod_globalConfig??(s.__zod_globalConfig={});var d=globalThis.__zod_globalConfig;function f(e){return e&&Object.assign(d,e),d}function p(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function m(e,t){return typeof t==`bigint`?t.toString():t}function h(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function g(e){return e==null}function _(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var v=Symbol(`evaluating`);function y(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==v)return r===void 0&&(r=v,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function b(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function x(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function te(e){return JSON.stringify(e)}function S(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var C=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var T=h(()=>{if(d.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function E(e){if(w(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(w(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ne(e){return E(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var re=new Set([`string`,`number`,`symbol`]);function D(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function O(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function k(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ie(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ae={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function oe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return O(e,x(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return b(this,`shape`,e),e},checks:[]}))}function se(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return O(e,x(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return b(this,`shape`,r),r},checks:[]}))}function ce(e,t){if(!E(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;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.")}return O(e,x(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return b(this,`shape`,n),n}}))}function le(e,t){if(!E(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return O(e,x(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return b(this,`shape`,n),n}}))}function ue(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return O(e,x(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return b(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function A(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return O(t,x(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return b(this,`shape`,i),i},checks:[]}))}function de(e,t,n){return O(t,x(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return b(this,`shape`,i),i}}))}function j(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function fe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function M(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function N(e){return typeof e==`string`?e:e?.message}function P(e,t,n){let r=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(n.customError?.(e))??N(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function F(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function I(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var pe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,m,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},me=c(`$ZodError`,pe),L=c(`$ZodError`,pe,{Parent:Error});function he(e,t=e=>e.message){let n={},r=[];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));return{formErrors:r,fieldErrors:n}}function ge(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var _e=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new l;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>P(e,a,f())));throw C(t,i?.callee),t}return o.value},ve=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>P(e,a,f())));throw C(t,i?.callee),t}return o.value},ye=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new l;return a.issues.length?{success:!1,error:new(e??me)(a.issues.map(e=>P(e,i,f())))}:{success:!0,data:a.value}},be=ye(L),R=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>P(e,i,f())))}:{success:!0,data:a.value}},xe=R(L),Se=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _e(e)(t,n,i)},Ce=e=>(t,n,r)=>_e(e)(t,n,r),we=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ve(e)(t,n,i)},z=e=>async(t,n,r)=>ve(e)(t,n,r),Te=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ye(e)(t,n,i)},Ee=e=>(t,n,r)=>ye(e)(t,n,r),De=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return R(e)(t,n,i)},Oe=e=>async(t,n,r)=>R(e)(t,n,r),ke=/^[cC][0-9a-z]{6,}$/,Ae=/^[0-9a-z]+$/,je=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Me=/^[0-9a-vA-V]{20}$/,Ne=/^[A-Za-z0-9]{27}$/,Pe=/^[a-zA-Z0-9_-]{21}$/,Fe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ie=/^([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})$/,Le=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)$/,Re=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ze=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Be(){return new RegExp(ze,`u`)}var Ve=/^(?:(?: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])$/,He=/^(([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}|:))$/,Ue=/^((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])$/,We=/^(([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])$/,Ge=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ke=/^[A-Za-z0-9_-]*$/,qe=/^https?$/,Je=/^\+[1-9]\d{6,14}$/,Ye=`(?:(?:\\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])))`,Xe=RegExp(`^${Ye}$`);function Ze(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;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+)?)?`}function Qe(e){return RegExp(`^${Ze(e)}$`)}function $e(e){let t=Ze({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Ye}T(?:${r})$`)}var et=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},tt=/^-?\d+$/,nt=/^-?\d+(?:\.\d+)?$/,rt=/^(?:true|false)$/i,it=/^[^A-Z]*$/,at=/^[^a-z]*$/,B=c(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ot={number:`number`,bigint:`bigint`,object:`date`},st=c(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=ot[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ct=c(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=ot[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lt=c(`$ZodCheckMultipleOf`,(e,t)=>{B.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ut=c(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ae[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=tt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),dt=c(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!g(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=F(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ft=c(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!g(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=F(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pt=c(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!g(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=F(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),mt=c(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ht=c(`$ZodCheckRegex`,(e,t)=>{mt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gt=c(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=it,mt.init(e,t)}),_t=c(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=at,mt.init(e,t)}),vt=c(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=D(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),yt=c(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${D(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),bt=c(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${D(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),xt=c(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),St=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`).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);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
|
+
`))}},Ct={major:4,minor:4,patch:3},V=c(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ct;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=j(e),i;for(let a of t){if(a._zod.def.when){if(fe(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new l;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=j(e,t))});else{if(e.issues.length===t)continue;r||=j(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(j(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new l;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new l;return o.then(e=>t(e,r,a))}return t(o,r,a)}}y(e,`~standard`,()=>({validate:t=>{try{let n=be(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),wt=c(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??et(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),H=c(`$ZodStringFormat`,(e,t)=>{mt.init(e,t),wt.init(e,t)}),Tt=c(`$ZodGUID`,(e,t)=>{t.pattern??=Ie,H.init(e,t)}),Et=c(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Le(e)}else t.pattern??=Le();H.init(e,t)}),Dt=c(`$ZodEmail`,(e,t)=>{t.pattern??=Re,H.init(e,t)}),Ot=c(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===qe.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),kt=c(`$ZodEmoji`,(e,t)=>{t.pattern??=Be(),H.init(e,t)}),At=c(`$ZodNanoID`,(e,t)=>{t.pattern??=Pe,H.init(e,t)}),jt=c(`$ZodCUID`,(e,t)=>{t.pattern??=ke,H.init(e,t)}),Mt=c(`$ZodCUID2`,(e,t)=>{t.pattern??=Ae,H.init(e,t)}),Nt=c(`$ZodULID`,(e,t)=>{t.pattern??=je,H.init(e,t)}),Pt=c(`$ZodXID`,(e,t)=>{t.pattern??=Me,H.init(e,t)}),Ft=c(`$ZodKSUID`,(e,t)=>{t.pattern??=Ne,H.init(e,t)}),It=c(`$ZodISODateTime`,(e,t)=>{t.pattern??=$e(t),H.init(e,t)}),Lt=c(`$ZodISODate`,(e,t)=>{t.pattern??=Xe,H.init(e,t)}),Rt=c(`$ZodISOTime`,(e,t)=>{t.pattern??=Qe(t),H.init(e,t)}),zt=c(`$ZodISODuration`,(e,t)=>{t.pattern??=Fe,H.init(e,t)}),Bt=c(`$ZodIPv4`,(e,t)=>{t.pattern??=Ve,H.init(e,t),e._zod.bag.format=`ipv4`}),Vt=c(`$ZodIPv6`,(e,t)=>{t.pattern??=He,H.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Ht=c(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ue,H.init(e,t)}),Ut=c(`$ZodCIDRv6`,(e,t)=>{t.pattern??=We,H.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Wt(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Gt=c(`$ZodBase64`,(e,t)=>{t.pattern??=Ge,H.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Wt(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Kt(e){if(!Ke.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Wt(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var qt=c(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ke,H.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Kt(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Jt=c(`$ZodE164`,(e,t)=>{t.pattern??=Je,H.init(e,t)});function Yt(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Xt=c(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{Yt(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Zt=c(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??nt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Qt=c(`$ZodNumberFormat`,(e,t)=>{ut.init(e,t),Zt.init(e,t)}),$t=c(`$ZodBoolean`,(e,t)=>{V.init(e,t),e._zod.pattern=rt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),en=c(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),tn=c(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function nn(e,t,n){e.issues.length&&t.issues.push(...M(n,e.issues)),t.value[n]=e.value}var rn=c(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>nn(t,n,e))):nn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function an(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...M(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function on(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ie(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function sn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>an(e,n,i,t,u,d))):an(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var cn=c(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=h(()=>on(t));y(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=w,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>an(n,t,e,s,r,i))):an(a,t,e,s,r,i)}return i?sn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ln=c(`$ZodObjectJIT`,(e,t)=>{cn.init(e,t);let n=e._zod.parse,r=h(()=>on(t)),i=e=>{let t=new St([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=te(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=te(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
4
|
+
if (${n}.issues.length) {
|
|
5
|
+
if (${o} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${n}.value === undefined) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
newResult[${o}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${o}] = ${n}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):c?t.write(`
|
|
22
|
+
if (${n}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${n}.value === undefined) {
|
|
30
|
+
if (${o} in input) {
|
|
31
|
+
newResult[${o}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${o}] = ${n}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`):t.write(`
|
|
38
|
+
const ${n}_present = ${o} in input;
|
|
39
|
+
if (${n}.issues.length) {
|
|
40
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
41
|
+
...iss,
|
|
42
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
46
|
+
payload.issues.push({
|
|
47
|
+
code: "invalid_type",
|
|
48
|
+
expected: "nonoptional",
|
|
49
|
+
input: undefined,
|
|
50
|
+
path: [${o}]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${n}_present) {
|
|
55
|
+
if (${n}.value === undefined) {
|
|
56
|
+
newResult[${o}] = undefined;
|
|
57
|
+
} else {
|
|
58
|
+
newResult[${o}] = ${n}.value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=w,s=!d.jitless,c=s&&T.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?sn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function un(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!j(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>P(e,r,f())))}),t)}var dn=c(`$ZodUnion`,(e,t)=>{V.init(e,t),y(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),y(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),y(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),y(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>_(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>un(t,r,e,i)):un(o,r,e,i)}}),fn=c(`$ZodIntersection`,(e,t)=>{V.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>mn(e,t,n)):mn(e,i,a)}});function pn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(E(e)&&E(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=pn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=pn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);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;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),j(e))return e;let o=pn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var hn=c(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!E(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>P(e,r,f())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...M(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...M(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&nt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>P(e,r,f())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...M(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...M(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),gn=c(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=p(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>re.has(typeof e)).map(e=>typeof e==`string`?D(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_n=c(`$ZodLiteral`,(e,t)=>{if(V.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?D(e):e?D(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vn=c(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new u(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new l;return n.value=i,n.fallback=!0,n}});function yn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var bn=c(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,y(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),y(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>yn(e,r)):yn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),xn=c(`$ZodExactOptional`,(e,t)=>{bn.init(e,t),y(e._zod,`values`,()=>t.innerType._zod.values),y(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sn=c(`$ZodNullable`,(e,t)=>{V.init(e,t),y(e._zod,`optin`,()=>t.innerType._zod.optin),y(e._zod,`optout`,()=>t.innerType._zod.optout),y(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_(e.source)}|null)$`):void 0}),y(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)}),Cn=c(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,y(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wn(e,t)):wn(r,t)}});function wn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Tn=c(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,y(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))}),En=c(`$ZodNonOptional`,(e,t)=>{V.init(e,t),y(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Dn(t,e)):Dn(i,e)}});function Dn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var On=c(`$ZodCatch`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,y(e._zod,`optout`,()=>t.innerType._zod.optout),y(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,f()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,f()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),kn=c(`$ZodPipe`,(e,t)=>{V.init(e,t),y(e._zod,`values`,()=>t.in._zod.values),y(e._zod,`optin`,()=>t.in._zod.optin),y(e._zod,`optout`,()=>t.out._zod.optout),y(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>An(e,t.in,n)):An(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>An(e,t.out,n)):An(r,t.out,n)}});function An(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var jn=c(`$ZodReadonly`,(e,t)=>{V.init(e,t),y(e._zod,`propValues`,()=>t.innerType._zod.propValues),y(e._zod,`values`,()=>t.innerType._zod.values),y(e._zod,`optin`,()=>t.innerType?._zod?.optin),y(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Mn):Mn(r)}});function Mn(e){return e.value=Object.freeze(e.value),e}var Nn=c(`$ZodCustom`,(e,t)=>{B.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Pn(t,n,r,e));Pn(i,n,r,e)}});function Pn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(I(e))}}var Fn,In=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ln(){return new In}(Fn=globalThis).__zod_globalRegistry??(Fn.__zod_globalRegistry=Ln());var Rn=globalThis.__zod_globalRegistry;function zn(e,t){return new e({type:`string`,...k(t)})}function Bn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...k(t)})}function Vn(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...k(t)})}function Hn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...k(t)})}function Un(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...k(t)})}function Wn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...k(t)})}function Gn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...k(t)})}function Kn(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...k(t)})}function qn(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...k(t)})}function Jn(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...k(t)})}function Yn(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...k(t)})}function Xn(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...k(t)})}function Zn(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...k(t)})}function Qn(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...k(t)})}function $n(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...k(t)})}function er(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...k(t)})}function tr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...k(t)})}function nr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...k(t)})}function rr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...k(t)})}function ir(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...k(t)})}function ar(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...k(t)})}function or(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...k(t)})}function sr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...k(t)})}function cr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...k(t)})}function lr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...k(t)})}function ur(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...k(t)})}function dr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...k(t)})}function fr(e,t){return new e({type:`number`,checks:[],...k(t)})}function pr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...k(t)})}function mr(e,t){return new e({type:`boolean`,...k(t)})}function hr(e){return new e({type:`unknown`})}function gr(e,t){return new e({type:`never`,...k(t)})}function _r(e,t){return new st({check:`less_than`,...k(t),value:e,inclusive:!1})}function vr(e,t){return new st({check:`less_than`,...k(t),value:e,inclusive:!0})}function yr(e,t){return new ct({check:`greater_than`,...k(t),value:e,inclusive:!1})}function br(e,t){return new ct({check:`greater_than`,...k(t),value:e,inclusive:!0})}function xr(e,t){return new lt({check:`multiple_of`,...k(t),value:e})}function Sr(e,t){return new dt({check:`max_length`,...k(t),maximum:e})}function Cr(e,t){return new ft({check:`min_length`,...k(t),minimum:e})}function wr(e,t){return new pt({check:`length_equals`,...k(t),length:e})}function Tr(e,t){return new ht({check:`string_format`,format:`regex`,...k(t),pattern:e})}function Er(e){return new gt({check:`string_format`,format:`lowercase`,...k(e)})}function Dr(e){return new _t({check:`string_format`,format:`uppercase`,...k(e)})}function Or(e,t){return new vt({check:`string_format`,format:`includes`,...k(t),includes:e})}function kr(e,t){return new yt({check:`string_format`,format:`starts_with`,...k(t),prefix:e})}function Ar(e,t){return new bt({check:`string_format`,format:`ends_with`,...k(t),suffix:e})}function jr(e){return new xt({check:`overwrite`,tx:e})}function Mr(e){return jr(t=>t.normalize(e))}function Nr(){return jr(e=>e.trim())}function Pr(){return jr(e=>e.toLowerCase())}function Fr(){return jr(e=>e.toUpperCase())}function Ir(){return jr(e=>S(e))}function Lr(e,t,n){return new e({type:`array`,element:t,...k(n)})}function Rr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...k(n)})}function zr(e,t){let n=Br(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(I(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(I(r))}},e(t.value,t)),t);return n}function Br(e,t){let n=new B({check:`custom`,...k(t)});return n._zod.check=e,n}function Vr(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Rn,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function U(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,U(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&W(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}function Hr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);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.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
|
+
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ur(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;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];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]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);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]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};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){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Gr(t,`input`,e.processors),output:Gr(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}var Wr=(e,t={})=>n=>{let r=Vr({...n,processors:t});return U(e,r),Hr(r,e),Ur(r,e)},Gr=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Vr({...i??{},target:a,io:t,processors:n});return U(e,o),Hr(o,e),Ur(o,e)},Kr={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},qr=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Kr[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Jr=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;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)},Yr=(e,t,n,r)=>{n.type=`boolean`},Xr=(e,t,n,r)=>{n.not={}},Zr=(e,t,n,r)=>{let i=e._zod.def,a=p(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Qr=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}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},$r=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ti=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=U(a.element,t,{...r,path:[...r.path,`items`]})},ni=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=U(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ri=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ii=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ai=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=U(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=U(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=U(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},oi=(e,t,n,r)=>{let i=e._zod.def,a=U(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},si=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ci=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},li=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ui=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},di=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;U(o,t,r);let s=t.seen.get(e);s.ref=o},fi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},pi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},mi=c(`ZodISODateTime`,(e,t)=>{It.init(e,t),J.init(e,t)});function hi(e){return cr(mi,e)}var gi=c(`ZodISODate`,(e,t)=>{Lt.init(e,t),J.init(e,t)});function _i(e){return lr(gi,e)}var vi=c(`ZodISOTime`,(e,t)=>{Rt.init(e,t),J.init(e,t)});function yi(e){return ur(vi,e)}var bi=c(`ZodISODuration`,(e,t)=>{zt.init(e,t),J.init(e,t)});function xi(e){return dr(bi,e)}var G=c(`ZodError`,(e,t)=>{me.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ge(e,t)},flatten:{value:t=>he(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,m,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,m,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Si=_e(G),Ci=ve(G),wi=ye(G),Ti=R(G),Ei=Se(G),Di=Ce(G),Oi=we(G),ki=z(G),Ai=Te(G),ji=Ee(G),Mi=De(G),Ni=Oe(G),Pi=new WeakMap;function Fi(e,t,n){let r=Object.getPrototypeOf(e),i=Pi.get(r);if(i||(i=new Set,Pi.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var K=c(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Gr(e,`input`),output:Gr(e,`output`)}}),e.toJSONSchema=Wr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Si(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>wi(e,t,n),e.parseAsync=async(t,n)=>Ci(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ti(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ei(e,t,n),e.decode=(t,n)=>Di(e,t,n),e.encodeAsync=async(t,n)=>Oi(e,t,n),e.decodeAsync=async(t,n)=>ki(e,t,n),e.safeEncode=(t,n)=>Ai(e,t,n),e.safeDecode=(t,n)=>ji(e,t,n),e.safeEncodeAsync=async(t,n)=>Mi(e,t,n),e.safeDecodeAsync=async(t,n)=>Ni(e,t,n),Fi(e,`ZodType`,{check(...e){let t=this.def;return this.clone(x(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return O(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ka(e,t))},superRefine(e,t){return this.check(qa(e,t))},overwrite(e){return this.check(jr(e))},optional(){return Oa(this)},exactOptional(){return Aa(this)},nullable(){return Ma(this)},nullish(){return Oa(Ma(this))},nonoptional(e){return Ra(this,e)},array(){return ma(this)},or(e){return _a([this,e])},and(e){return ya(this,e)},transform(e){return Ha(this,Ea(e))},default(e){return Pa(this,e)},prefault(e){return Ia(this,e)},catch(e){return Ba(this,e)},pipe(e){return Ha(this,e)},readonly(){return Wa(this)},describe(e){let t=this.clone();return Rn.add(t,{description:e}),t},meta(...e){if(e.length===0)return Rn.get(this);let t=this.clone();return Rn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Rn.get(e)?.description},configurable:!0}),e)),Ii=c(`_ZodString`,(e,t)=>{wt.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qr(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Fi(e,`_ZodString`,{regex(...e){return this.check(Tr(...e))},includes(...e){return this.check(Or(...e))},startsWith(...e){return this.check(kr(...e))},endsWith(...e){return this.check(Ar(...e))},min(...e){return this.check(Cr(...e))},max(...e){return this.check(Sr(...e))},length(...e){return this.check(wr(...e))},nonempty(...e){return this.check(Cr(1,...e))},lowercase(e){return this.check(Er(e))},uppercase(e){return this.check(Dr(e))},trim(){return this.check(Nr())},normalize(...e){return this.check(Mr(...e))},toLowerCase(){return this.check(Pr())},toUpperCase(){return this.check(Fr())},slugify(){return this.check(Ir())}})}),Li=c(`ZodString`,(e,t)=>{wt.init(e,t),Ii.init(e,t),e.email=t=>e.check(Bn(Ri,t)),e.url=t=>e.check(Kn(Vi,t)),e.jwt=t=>e.check(sr(na,t)),e.emoji=t=>e.check(qn(Hi,t)),e.guid=t=>e.check(Vn(zi,t)),e.uuid=t=>e.check(Hn(Bi,t)),e.uuidv4=t=>e.check(Un(Bi,t)),e.uuidv6=t=>e.check(Wn(Bi,t)),e.uuidv7=t=>e.check(Gn(Bi,t)),e.nanoid=t=>e.check(Jn(Ui,t)),e.guid=t=>e.check(Vn(zi,t)),e.cuid=t=>e.check(Yn(Wi,t)),e.cuid2=t=>e.check(Xn(Gi,t)),e.ulid=t=>e.check(Zn(Ki,t)),e.base64=t=>e.check(ir($i,t)),e.base64url=t=>e.check(ar(ea,t)),e.xid=t=>e.check(Qn(qi,t)),e.ksuid=t=>e.check($n(Ji,t)),e.ipv4=t=>e.check(er(Yi,t)),e.ipv6=t=>e.check(tr(Xi,t)),e.cidrv4=t=>e.check(nr(Zi,t)),e.cidrv6=t=>e.check(rr(Qi,t)),e.e164=t=>e.check(or(ta,t)),e.datetime=t=>e.check(hi(t)),e.date=t=>e.check(_i(t)),e.time=t=>e.check(yi(t)),e.duration=t=>e.check(xi(t))});function q(e){return zn(Li,e)}var J=c(`ZodStringFormat`,(e,t)=>{H.init(e,t),Ii.init(e,t)}),Ri=c(`ZodEmail`,(e,t)=>{Dt.init(e,t),J.init(e,t)}),zi=c(`ZodGUID`,(e,t)=>{Tt.init(e,t),J.init(e,t)}),Bi=c(`ZodUUID`,(e,t)=>{Et.init(e,t),J.init(e,t)}),Vi=c(`ZodURL`,(e,t)=>{Ot.init(e,t),J.init(e,t)}),Hi=c(`ZodEmoji`,(e,t)=>{kt.init(e,t),J.init(e,t)}),Ui=c(`ZodNanoID`,(e,t)=>{At.init(e,t),J.init(e,t)}),Wi=c(`ZodCUID`,(e,t)=>{jt.init(e,t),J.init(e,t)}),Gi=c(`ZodCUID2`,(e,t)=>{Mt.init(e,t),J.init(e,t)}),Ki=c(`ZodULID`,(e,t)=>{Nt.init(e,t),J.init(e,t)}),qi=c(`ZodXID`,(e,t)=>{Pt.init(e,t),J.init(e,t)}),Ji=c(`ZodKSUID`,(e,t)=>{Ft.init(e,t),J.init(e,t)}),Yi=c(`ZodIPv4`,(e,t)=>{Bt.init(e,t),J.init(e,t)}),Xi=c(`ZodIPv6`,(e,t)=>{Vt.init(e,t),J.init(e,t)}),Zi=c(`ZodCIDRv4`,(e,t)=>{Ht.init(e,t),J.init(e,t)}),Qi=c(`ZodCIDRv6`,(e,t)=>{Ut.init(e,t),J.init(e,t)}),$i=c(`ZodBase64`,(e,t)=>{Gt.init(e,t),J.init(e,t)}),ea=c(`ZodBase64URL`,(e,t)=>{qt.init(e,t),J.init(e,t)}),ta=c(`ZodE164`,(e,t)=>{Jt.init(e,t),J.init(e,t)}),na=c(`ZodJWT`,(e,t)=>{Xt.init(e,t),J.init(e,t)}),ra=c(`ZodNumber`,(e,t)=>{Zt.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jr(e,t,n,r),Fi(e,`ZodNumber`,{gt(e,t){return this.check(yr(e,t))},gte(e,t){return this.check(br(e,t))},min(e,t){return this.check(br(e,t))},lt(e,t){return this.check(_r(e,t))},lte(e,t){return this.check(vr(e,t))},max(e,t){return this.check(vr(e,t))},int(e){return this.check(oa(e))},safe(e){return this.check(oa(e))},positive(e){return this.check(yr(0,e))},nonnegative(e){return this.check(br(0,e))},negative(e){return this.check(_r(0,e))},nonpositive(e){return this.check(vr(0,e))},multipleOf(e,t){return this.check(xr(e,t))},step(e,t){return this.check(xr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ia(e){return fr(ra,e)}var aa=c(`ZodNumberFormat`,(e,t)=>{Qt.init(e,t),ra.init(e,t)});function oa(e){return pr(aa,e)}var sa=c(`ZodBoolean`,(e,t)=>{$t.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yr(e,t,n,r)});function ca(e){return mr(sa,e)}var la=c(`ZodUnknown`,(e,t)=>{en.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ua(){return hr(la)}var da=c(`ZodNever`,(e,t)=>{tn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,n,r)});function fa(e){return gr(da,e)}var pa=c(`ZodArray`,(e,t)=>{rn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ti(e,t,n,r),e.element=t.element,Fi(e,`ZodArray`,{min(e,t){return this.check(Cr(e,t))},nonempty(e){return this.check(Cr(1,e))},max(e,t){return this.check(Sr(e,t))},length(e,t){return this.check(wr(e,t))},unwrap(){return this.element}})});function ma(e,t){return Lr(pa,e,t)}var ha=c(`ZodObject`,(e,t)=>{ln.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,n,r),y(e,`shape`,()=>t.shape),Fi(e,`ZodObject`,{keyof(){return X(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ua()})},loose(){return this.clone({...this._zod.def,catchall:ua()})},strict(){return this.clone({...this._zod.def,catchall:fa()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ce(this,e)},safeExtend(e){return le(this,e)},merge(e){return ue(this,e)},pick(e){return oe(this,e)},omit(e){return se(this,e)},partial(...e){return A(Da,this,e[0])},required(...e){return de(La,this,e[0])}})});function Y(e,t){return new ha({type:`object`,shape:e??{},...k(t)})}var ga=c(`ZodUnion`,(e,t)=>{dn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ri(e,t,n,r),e.options=t.options});function _a(e,t){return new ga({type:`union`,options:e,...k(t)})}var va=c(`ZodIntersection`,(e,t)=>{fn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ii(e,t,n,r)});function ya(e,t){return new va({type:`intersection`,left:e,right:t})}var ba=c(`ZodRecord`,(e,t)=>{hn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xa(e,t,n){return!t||!t._zod?new ba({type:`record`,keyType:q(),valueType:e,...k(t)}):new ba({type:`record`,keyType:e,valueType:t,...k(n)})}var Sa=c(`ZodEnum`,(e,t)=>{gn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Sa({...t,checks:[],...k(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Sa({...t,checks:[],...k(r),entries:i})}});function X(e,t){return new Sa({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...k(t)})}var Ca=c(`ZodLiteral`,(e,t)=>{_n.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qr(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function wa(e,t){return new Ca({type:`literal`,values:Array.isArray(e)?e:[e],...k(t)})}var Ta=c(`ZodTransform`,(e,t)=>{vn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ei(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new u(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(I(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(I(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ea(e){return new Ta({type:`transform`,transform:e})}var Da=c(`ZodOptional`,(e,t)=>{bn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oa(e){return new Da({type:`optional`,innerType:e})}var ka=c(`ZodExactOptional`,(e,t)=>{xn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Aa(e){return new ka({type:`optional`,innerType:e})}var ja=c(`ZodNullable`,(e,t)=>{Sn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ma(e){return new ja({type:`nullable`,innerType:e})}var Na=c(`ZodDefault`,(e,t)=>{Cn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pa(e,t){return new Na({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ne(t)}})}var Fa=c(`ZodPrefault`,(e,t)=>{Tn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ia(e,t){return new Fa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ne(t)}})}var La=c(`ZodNonOptional`,(e,t)=>{En.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ra(e,t){return new La({type:`nonoptional`,innerType:e,...k(t)})}var za=c(`ZodCatch`,(e,t)=>{On.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ba(e,t){return new za({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Va=c(`ZodPipe`,(e,t)=>{kn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r),e.in=t.in,e.out=t.out});function Ha(e,t){return new Va({type:`pipe`,in:e,out:t})}var Ua=c(`ZodReadonly`,(e,t)=>{jn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wa(e){return new Ua({type:`readonly`,innerType:e})}var Ga=c(`ZodCustom`,(e,t)=>{Nn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$r(e,t,n,r)});function Ka(e,t={}){return Rr(Ga,e,t)}function qa(e,t){return zr(e,t)}var Ja=Y({visible:ca().optional(),style:X([`icon`,`text`]).optional(),label:q().nullable().optional(),position:q().optional()}).nullable().optional(),Ya=Y({returnUrl:q().optional(),navigateOnClose:ca().optional()}).optional(),Xa=Y({label:q().min(1).max(80).optional(),ariaLabel:q().min(1).max(120).optional(),placement:X([`center`,`bottom-center`,`bottom-left`,`bottom-right`]).optional(),variant:X([`primary`,`secondary`,`minimal`]).optional(),appearance:Y({backgroundColor:q().min(1).max(64).optional(),textColor:q().min(1).max(64).optional(),borderColor:q().min(1).max(64).optional(),borderRadiusPx:ia().min(0).max(999).optional(),size:X([`small`,`medium`,`large`]).optional(),shadow:X([`none`,`soft`,`strong`]).optional()}).optional()}),Za=Y({characterId:q().min(1),displayName:q().min(1),avatarId:q().min(1),voiceId:q().min(1),sttLang:q().min(1),agentId:q().min(1),appearance:Y({costume:q().optional(),costumeClothes:q().optional(),hair:q().optional()}).optional()}),Qa=Y({cx:ia(),cy:ia(),scale:ia(),distanceM:ia()}),$a=Y({type:wa(`image`),layers:ma(q()),assets:xa(q(),xa(q(),q()))}),eo=X([`browser`,`cloud`]),to=Y({placement:eo,provider:q().min(1),model:q().min(1).optional(),config:xa(q(),ua()).default({})}),no=Y({stt:to,llm:to,tts:to,animation:Y({enabled:ca(),placement:eo.optional(),source:X([`azureViseme`,`speechToAnimation`,`none`]),provider:q().min(1).optional(),model:q().min(1).optional(),config:xa(q(),ua()).default({})})}),ro=Y({schemaVersion:wa(1),sessionId:q().min(1),experienceId:q().min(1),expiresAt:q().min(1),sessionToken:q().min(1),experience:Y({title:q(),slug:q(),mode:X([`conversation`,`presenter`]),responseMode:X([`managed`,`custom`,`manual`]),speechInputMode:X([`auto`,`manual`,`off`]),startButton:Xa.optional(),openingMessage:q().optional()}),transport:Y({type:wa(`http`),config:Y({apiBaseUrl:q().min(1)})}),runtime:Y({cdnBaseUrl:q().min(1),input:wa(`browserStt`),renderer:wa(`morph2d`)}),pipeline:no.optional(),capabilities:ma(q()),characters:ma(Za).min(1),activeCharacterId:q().min(1),location:Y({locationId:q(),title:q(),scene:$a.optional(),placement:Qa.optional(),metersPerDepth:ia().positive().optional(),hasZoomVariant:ca().optional()}).optional(),world:Y({worldId:q(),rulesetVersion:ia()}).optional(),state:Y({schemaVersion:wa(1),values:xa(q(),ua())}),tools:ma(ua()),integration:Ya,closeButton:Ja,billing:Y({payer:wa(`creator`),meterId:q()}).optional(),language:X([`en`,`es`]).optional(),languagePackRevision:q().optional(),processorId:q().optional()}).superRefine((e,t)=>{let n=e.activeCharacterId;e.characters.some(e=>e.characterId===n)||t.addIssue({code:`custom`,message:`activeCharacterId must reference a character in characters[]`,path:[`activeCharacterId`]})});function io(e){if(!e||typeof e!=`object`)return e;let t={...e},n=t.experience;if(!n||typeof n!=`object`)return t;let r={...n},i=r.mode===`presenter`?`presenter`:`conversation`;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}function ao(e){return e.issues.map(e=>`${e.path.length>0?e.path.join(`.`):`(root)`}: ${e.message}`).join(`; `)}function oo(e){let t=ro.safeParse(io(e));if(!t.success)throw Error(`Invalid Session Manifest from Liforma API — ${ao(t.error)}`);return t.data}function so(e){return e.sessionToken.trim().length>0}function co(){try{if(typeof globalThis.location?.origin==`string`&&globalThis.location.origin)return globalThis.location.origin}catch{}}function lo(e,t,n){let r;try{r=JSON.parse(n)}catch{}let i=co(),a=r?.message?.trim(),o=r?.code;if(o===`origin_not_allowed`||/^Origin not allowed/i.test(a??``)&&i){if(a&&a.includes(e)&&a.includes(`allowed origin`))return a;let t=r?.origin??i??`(unknown origin)`;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.`}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})`}async function uo(e,t){let n=a(),r={experienceId:e};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);let i=await fetch(`${n}/v1/public-sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let t=await i.text();throw Error(lo(e,i.status,t))}let o;try{o=await i.json()}catch{throw Error(`Public session mint returned invalid JSON.`)}return oo(o)}async function fo(e,t){let n=o(e,t),r=new AbortController,i=()=>r.abort(t.signal?.reason);t.signal?.aborted?i():t.signal?.addEventListener(`abort`,i,{once:!0});let a=globalThis.setTimeout(()=>r.abort(new DOMException(`Session endpoint timed out.`,`TimeoutError`)),t.timeoutMs??3e4),s;try{s=await fetch(n.url,{...n.init,signal:r.signal})}finally{globalThis.clearTimeout(a),t.signal?.removeEventListener(`abort`,i)}if(!s.ok){let e=await s.text(),t=e.slice(0,500)||`Session endpoint failed (${s.status})`;try{let n=JSON.parse(e);n.message&&(t=n.message)}catch{}throw Error(t)}if(!s.headers.get(`content-type`)?.toLowerCase().includes(`application/json`))throw Error(`Session endpoint must return a JSON Session Manifest.`);let c;try{c=await s.json()}catch{throw Error(`Session endpoint returned invalid JSON.`)}return oo(c)}function po(e){return typeof e!=`object`||!e?!1:typeof e[Symbol.asyncIterator]==`function`}function mo(e){if(typeof e==`string`){let t=e.trim();if(!t)throw Error(`conversationProcessor returned empty text.`);return{text:t}}let t=e.text.trim();if(!t)throw Error(`conversationProcessor returned empty text.`);return{text:t,...e.characterId?{characterId:e.characterId}:{},...e.behavior?{behavior:e.behavior}:{}}}async function ho(e,t){let n=await e(t);return po(n)?{kind:`stream`,stream:n}:{kind:`complete`,speech:mo(n)}}var go=`3002`;function _o(e){let t=new URL(e);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||go}. 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.`}async function vo(e,t){try{await fetch(e,{method:`GET`,mode:`no-cors`,signal:AbortSignal.timeout(8e3)})}catch{throw Error(_o(t))}}function yo(e,t,n){try{e.postMessage(t,n)}catch(e){throw e instanceof DOMException&&e.name===`SecurityError`?Error(_o(n),{cause:e}):e}}var bo=new Set([1,2]);function xo(e){return typeof e==`number`&&bo.has(e)}var So=new Set([`close`,`stateUpdate`,`commandResult`,`userTranscript`,`characterSpeechStarted`,`characterSpeechEnded`,`conversationUpdate`,`listeningState`,`userSpeechStarted`,`userSpeechEnded`,`modeChange`,`message`,`started`,`widgetReady`,`widgetExpand`,`widgetCollapse`,`widgetAudioSettings`]);function Co(e){if(!e||typeof e!=`object`)return null;let t=e;if(!xo(t.schemaVersion)||!t.type||!So.has(t.type))return null;if(t.type===`widgetReady`||t.type===`widgetExpand`||t.type===`widgetCollapse`)return t;if(t.type===`widgetAudioSettings`){let e=t.payload;return!e||typeof e!=`object`||typeof e.open!=`boolean`?null:t}return!t.payload||typeof t.payload!=`object`?null:t}function wo(e){return{type:`manifest`,schemaVersion:2,payload:{manifest:e}}}function To(){return{type:`parentHello`,schemaVersion:2}}function Eo(e){return{type:`widgetSetChrome`,schemaVersion:2,payload:{mode:e}}}function Do(){return{type:`widgetToggleAudioSettings`,schemaVersion:2,payload:{}}}function Z(){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)}`}function Oo(e){let t=e.container;getComputedStyle(t).position===`static`&&(t.style.position=`relative`);let n=document.createElement(`iframe`);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`);let r=!1,i=new Map,a=new Promise((t,r)=>{let i=()=>{o(),vo(e.src,e.playerOrigin).then(t,r)},a=()=>{o(),r(Error(_o(e.playerOrigin)))},o=()=>{n.removeEventListener(`load`,i),n.removeEventListener(`error`,a)};n.addEventListener(`load`,i),n.addEventListener(`error`,a)}),o=t=>{if(r||t.source!==n.contentWindow||t.origin!==e.playerOrigin)return;let a=Co(t.data);if(a)switch(a.type){case`close`:e.onClose?.(a.payload);break;case`stateUpdate`:e.onStateUpdate?.(a.payload.state);break;case`commandResult`:{let e=i.get(a.payload.correlationId);if(!e)return;i.delete(a.payload.correlationId),a.payload.ok?e.resolve(a.payload.result):e.reject(Error(a.payload.error??`Command failed.`));break}case`userTranscript`:e.onUserTranscript?.(a.payload);break;case`characterSpeechStarted`:e.onCharacterSpeechStarted?.(a.payload);break;case`characterSpeechEnded`:e.onCharacterSpeechEnded?.(a.payload);break;case`conversationUpdate`:e.onConversationUpdate?.(a.payload.conversation);break;case`listeningState`:e.onListeningState?.(a.payload.listening);break;case`userSpeechStarted`:e.onUserSpeechStarted?.(a.payload);break;case`userSpeechEnded`:e.onUserSpeechEnded?.(a.payload);break;case`modeChange`:e.onModeChange?.(a.payload.mode);break;case`message`:e.onMessage?.(a.payload);break;case`started`:e.onStarted?.(a.payload);break;case`widgetReady`:e.onWidgetReady?.();break;case`widgetExpand`:e.onWidgetExpand?.();break;case`widgetCollapse`:e.onWidgetCollapse?.();break;case`widgetAudioSettings`:e.onWidgetAudioSettings?.(a.payload.open);break}};if(window.addEventListener(`message`,o),t.replaceChildren(n),t.clientHeight<2&&!t.style.minHeight){let e=getComputedStyle(t).minHeight;(e===`0px`||e===`auto`)&&(t.style.minHeight=`480px`)}let s=t=>{if(r)return;let i=n.contentWindow;if(!i)throw Error(_o(e.playerOrigin));yo(i,t,e.playerOrigin)},c=(e,t=12e4)=>{let n=e.type!==`parentHello`&&e.payload&&`correlationId`in e.payload?e.payload.correlationId:Z();return e.type!==`parentHello`&&e.payload&&`correlationId`in e.payload||e.type!==`parentHello`&&e.payload&&(e.payload.correlationId=n),new Promise((r,a)=>{i.set(n,{resolve:e=>r(e),reject:a}),s(e),setTimeout(()=>{i.has(n)&&(i.delete(n),a(Error(`Timed out waiting for player command result.`)))},t)})};return{waitForLoad(){return a},postParentHello(){s(To())},postManifest(t){if(r)return;let i=n.contentWindow;if(!i)throw Error(`Liforma embed iframe is not ready.`);let a=wo(t),o=()=>{r||yo(i,a,e.playerOrigin)};o();for(let e=1;e<=12;e+=1)window.setTimeout(o,e*75)},postWidgetSetChrome(e){s(Eo(e))},postWidgetToggleAudioSettings(){s(Do())},speak(e){return c({type:`speak`,schemaVersion:2,payload:{correlationId:Z(),text:e.text,...e.characterId?{characterId:e.characterId}:{},...e.behavior?{behavior:e.behavior}:{}}})},startListening(){return c({type:`startListening`,schemaVersion:2,payload:{correlationId:Z()}})},stopListening(){return c({type:`stopListening`,schemaVersion:2,payload:{correlationId:Z()}})},listenOnce(e){return c({type:`listenOnce`,schemaVersion:2,payload:{correlationId:Z(),...e?.timeoutMs===void 0?{}:{timeoutMs:e.timeoutMs}}})},async speakProcessorStream(e,t){let n=Z(),r=Z(),i=(await c({type:`speakStreamStart`,schemaVersion:2,payload:{correlationId:n,...t?.characterId?{characterId:t.characterId}:{},...t?.behavior?{behavior:t.behavior}:{}}})).streamId;try{for await(let n of e){if(t?.signal?.aborted)throw new DOMException(`Processor stream aborted.`,`AbortError`);n&&s({type:`speakStreamChunk`,schemaVersion:2,payload:{streamId:i,text:n}})}if(t?.signal?.aborted)throw new DOMException(`Processor stream aborted.`,`AbortError`);return await c({type:`speakStreamEnd`,schemaVersion:2,payload:{correlationId:r,streamId:i}})}catch(e){try{await c({type:`speakStreamEnd`,schemaVersion:2,payload:{correlationId:r,streamId:i}})}catch{}throw e}},getConversation(){return c({type:`getConversation`,schemaVersion:2,payload:{correlationId:Z()}})},destroy(){if(!r){r=!0;for(let e of i.values())e.reject(Error(`Iframe host destroyed.`));i.clear(),window.removeEventListener(`message`,o),n.remove()}}}}function ko(e){let t,n=!1,r=!1,i=()=>{r||!n||t===void 0||(r=!0,e(t))};return{setValue(e){t=e,i()},markReady(){n=!0,i()}}}var Ao=`https://player.liforma.ai/embed`,jo=`http://localhost:3002/embed`;function Mo(){let e=globalThis.__LIFORMA_PLAYER_EMBED_URL;if(e?.trim())return e.trim().replace(/\/$/,``);if(typeof document>`u`)return null;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();return t?t.replace(/\/$/,``):null}function No(){let e=Mo();return e?e.endsWith(`/embed`)?e:`${e}/embed`:t()?jo:Ao}function Po(e,t,n,r,i,a,o){let s=(e??No()).replace(/\/$/,``),c=s.endsWith(`/embed`)?s:`${s}/embed`,l=new URL(c),u=n?.trim();u&&l.searchParams.set(`locationId`,u);let d=r?.trim();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`),Fo(l.toString())}function Fo(e){if(typeof location>`u`)return e;let t=new URL(e);return t.searchParams.set(`parentOrigin`,location.origin),t.toString()}function Io(e){return new URL(e).origin}function Lo(e){let t=e.filter(e=>e!==`avatar`);return t.includes(`voice`)?t:[`voice`,...t]}function Ro(e){return oo({...e,capabilities:Lo(e.capabilities),pipeline:{...e.pipeline,animation:{enabled:!1,source:`none`,config:{}}},location:{locationId:e.location?.locationId?.trim()||`speech-only`,title:e.location?.title?.trim()||``}})}function zo(){return{ready:new Set,started:new Set,userTranscript:new Set,userSpeechStarted:new Set,userSpeechEnded:new Set,characterSpeechStarted:new Set,characterSpeechEnded:new Set,conversationUpdate:new Set,message:new Set,listeningState:new Set,modeChange:new Set,conversationProcessorError:new Set}}function Bo(e,t,n){return e[t].add(n),()=>e[t].delete(n)}function Q(e,t,n){for(let r of e[t])r(n)}function Vo(e){for(let t of Object.keys(e))e[t].clear()}function Ho(e,t){return t?oo({...e,experience:{...e.experience,startButton:t}}):e}var Uo=class e{launch;conversationProcessor;iframeHost=null;attachInFlight=null;endpointAbortController=null;processorAbortController=null;processorChain=Promise.resolve();resolvedManifest;closed=!1;attached=!1;closeHandlers=[];eventRegistry=zo();readyEvent=null;startedEvent=null;conversationCache=[];constructor(e){this.launch=e,this.conversationProcessor=e.conversationProcessor??null,this.resolvedManifest=e.kind===`manifest`?e.manifest:null}static async startSession(t){if(`sessionEndpoint`in t)return new e({kind:`sessionEndpoint`,experienceId:t.experienceId,sessionEndpoint:t.sessionEndpoint,language:t.language,locationId:t.locationId,avatarId:t.avatarId,embedBaseUrl:t.embedBaseUrl,debug:t.debug,mode:t.mode,responseMode:t.responseMode,speechInputMode:t.speechInputMode,startButton:t.startButton,speechOnly:t.speechOnly,fit:t.fit,ui:t.ui,onStart:t.onStart,onUserTranscript:t.onUserTranscript,conversationProcessor:t.conversationProcessor});if(`experienceId`in t)return new e({kind:`public`,experienceId:t.experienceId,language:t.language,locationId:t.locationId,avatarId:t.avatarId,embedBaseUrl:t.embedBaseUrl,debug:t.debug,mode:t.mode,responseMode:t.responseMode,speechInputMode:t.speechInputMode,startButton:t.startButton,speechOnly:t.speechOnly,fit:t.fit,ui:t.ui,onStart:t.onStart,onUserTranscript:t.onUserTranscript,conversationProcessor:t.conversationProcessor});let n=oo(t.manifest);if(so(n)&&!t.acceptCredentialExposure)throw Error(`Credential-bearing Session Manifest requires acceptCredentialExposure: true. Prefer experienceId, sessionEndpoint, or client-side mint instead of SSR page data.`);return new e({kind:`manifest`,manifest:t.speechOnly?Ro(n):n,embedBaseUrl:t.embedBaseUrl,debug:t.debug,startButton:t.startButton,speechOnly:t.speechOnly,fit:t.fit,ui:t.ui,onStart:t.onStart,onUserTranscript:t.onUserTranscript,conversationProcessor:t.conversationProcessor})}getManifest(){return this.resolvedManifest}on(e,t){let n=Bo(this.eventRegistry,e,t);return e===`ready`&&this.readyEvent&&queueMicrotask(()=>t(this.readyEvent)),e===`started`&&this.startedEvent&&queueMicrotask(()=>t(this.startedEvent)),n}async attach(e){if(this.closed)throw Error(`Session has ended.`);if(!e.container)throw Error(`Experience.attach requires a DOM container element.`);return this.attached&&this.iframeHost?this.createPlayerFacade():(this.attachInFlight||=this.attachInternal(e).finally(()=>{this.attachInFlight=null}),this.attachInFlight)}async attachInternal(e){if(this.closed)throw Error(`Session has ended.`);if(this.attached&&this.iframeHost)return this.createPlayerFacade();this.iframeHost&&=(this.iframeHost.destroy(),null);let t=this.launch.embedBaseUrl??No(),n=this.launch.debug===!0,r=this.launch.speechOnly===!0,i=Po(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=Io(i),o=null,s=new Promise(e=>{o=e}),c=null,l=new Promise(e=>{c=e}),u=ko(e=>{this.readyEvent||(this.readyEvent={manifest:e},Q(this.eventRegistry,`ready`,this.readyEvent))}),d=this.launch.onUserTranscript,f=Oo({container:e.container,src:i,playerOrigin:a,transparent:this.launch.ui===`widget`,onClose:e=>{for(let t of this.closeHandlers)t(e)},onStateUpdate:t=>{e.onStateUpdate?.(t),t===`loading`&&o&&(o(),o=null),t===`ready`&&c&&(c(),c=null),t===`ready`&&u.markReady()},onUserTranscript:e=>{Q(this.eventRegistry,`userTranscript`,e),d?.(e),this.queueProcessorTurn(e)},onUserSpeechStarted:e=>{Q(this.eventRegistry,`userSpeechStarted`,e)},onUserSpeechEnded:e=>{Q(this.eventRegistry,`userSpeechEnded`,e)},onCharacterSpeechStarted:e=>{Q(this.eventRegistry,`characterSpeechStarted`,e)},onCharacterSpeechEnded:e=>{Q(this.eventRegistry,`characterSpeechEnded`,e)},onListeningState:e=>{Q(this.eventRegistry,`listeningState`,e)},onModeChange:e=>{Q(this.eventRegistry,`modeChange`,e)},onMessage:e=>{Q(this.eventRegistry,`message`,e)},onStarted:e=>{this.startedEvent||(this.startedEvent=e,Q(this.eventRegistry,`started`,e),this.launch.onStart?.(e))},onConversationUpdate:e=>{this.conversationCache=e,Q(this.eventRegistry,`conversationUpdate`,e)},onWidgetReady:()=>e.onWidgetReady?.(),onWidgetExpand:()=>e.onWidgetExpand?.(),onWidgetCollapse:()=>e.onWidgetCollapse?.(),onWidgetAudioSettings:t=>e.onWidgetAudioSettings?.(t)});this.iframeHost=f;let p=this.resolveMintInteraction(),m=this.launch.kind===`sessionEndpoint`?(this.endpointAbortController=new AbortController,fo(this.launch.sessionEndpoint,{experienceId:this.launch.experienceId,language:this.launch.language,mode:p.mode,responseMode:p.responseMode,speechInputMode:p.speechInputMode,startButton:this.launch.startButton,speechOnly:this.launch.speechOnly,signal:this.endpointAbortController.signal})):this.launch.kind===`public`?uo(this.launch.experienceId,{language:this.launch.language,mode:p.mode,responseMode:p.responseMode,speechInputMode:p.speechInputMode,startButton:this.launch.startButton,speechOnly:this.launch.speechOnly}):Promise.resolve(this.launch.kind===`manifest`?this.launch.manifest:null),h;try{[,h]=await Promise.all([f.waitForLoad(),m])}catch(e){throw f.destroy(),this.iframeHost===f&&(this.iframeHost=null),e}finally{this.endpointAbortController=null}if(f.postParentHello(),h){let e=Ho(h,this.launch.startButton);this.launch.speechOnly&&(e=Ro(e)),this.assertBrowserCustomManifest(e),this.resolvedManifest=e,f.postManifest(e),u.setValue(e)}return await Promise.race([s,new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out waiting for player loading UI.`)),12e4)})]),await Promise.race([l,new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out waiting for player ready state.`)),12e4)})]),this.attached=!0,this.createPlayerFacade()}async speak(e){return this.assertSessionStarted(),e.behavior===`interrupt`&&(this.processorAbortController?.abort(),this.processorAbortController=null),this.iframeHost.speak({text:e.text,characterId:e.characterId,behavior:e.behavior})}async startListening(){this.assertSessionStarted(),await this.iframeHost.startListening()}async stopListening(){return this.assertSessionStarted(),this.iframeHost.stopListening()}async listenOnce(e){return this.assertSessionStarted(),this.iframeHost.listenOnce({timeoutMs:e?.timeoutMs})}getConversation(){return this.conversationCache}setWidgetChrome(e){this.iframeHost?.postWidgetSetChrome(e)}toggleAudioSettings(){this.iframeHost?.postWidgetToggleAudioSettings()}getLastTurn(){if(this.conversationCache.length===0)return[];let e=this.conversationCache[this.conversationCache.length-1].turnId;return this.conversationCache.filter(t=>t.turnId===e)}async end(){this.close()}destroy(){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,Vo(this.eventRegistry),this.readyEvent=null,this.startedEvent=null,this.closeHandlers.length=0,this.attached=!1)}resolveMintInteraction(){if(this.launch.kind===`manifest`)return{};let e=this.conversationProcessor!==null;return{mode:this.launch.mode,responseMode:e?`custom`:this.launch.responseMode,speechInputMode:this.launch.speechInputMode}}assertBrowserCustomManifest(e){if(this.conversationProcessor){if(e.experience.responseMode!==`custom`)throw Error(`conversationProcessor requires responseMode custom in the Session Manifest.`);if(e.processorId)throw Error(`Browser conversationProcessor cannot be used with a registered processorId.`)}}queueProcessorTurn(e){if(!e.isFinal||!e.text.trim()||!this.conversationProcessor)return;let t=this.conversationProcessor;this.processorAbortController?.abort(),this.processorAbortController=new AbortController;let n=this.processorAbortController.signal;this.processorChain=this.processorChain.then(async()=>{if(!n.aborted)try{let r=await ho(t,{utteranceId:e.utteranceId,text:e.text,conversation:this.conversationCache,signal:n});if(n.aborted)return;if(r.kind===`complete`){let e=r.speech;await this.speak({text:e.text,...e.characterId?{characterId:e.characterId}:{},...e.behavior?{behavior:e.behavior}:{}});return}await this.iframeHost.speakProcessorStream(r.stream,{signal:n})}catch(t){if(n.aborted)return;let r=t instanceof Error?t.message:String(t);Q(this.eventRegistry,`conversationProcessorError`,{utteranceId:e.utteranceId,message:r})}})}assertAttached(){if(!this.attached||!this.iframeHost)throw Error(`Call Experience.attach() before using speech APIs.`)}assertSessionStarted(){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.`)}close(){this.closed||(this.closed=!0,this.endpointAbortController?.abort(),this.endpointAbortController=null,this.attachInFlight=null,this.iframeHost?.destroy(),this.iframeHost=null,this.attached=!1)}createPlayerFacade(){return{close:()=>{this.close()},destroy:()=>{this.destroy()},on:(e,t)=>{e===`close`&&this.closeHandlers.push(t)}}}};function Wo(e,t){let n=e.trim();if(!n)return null;if(/^https?:\/\//i.test(n))try{return new URL(n)}catch{return null}let r=t.replace(/\/$/,``),i=n.startsWith(`/`)?n:`/${n}`;try{return new URL(i,`${r}/`)}catch{return null}}function Go(e){try{if(document.referrer){let e=new URL(document.referrer);if(e.origin===window.location.origin&&e.pathname!==window.location.pathname)return`${e.pathname}${e.search}${e.hash}`}}catch{}return e}function Ko(e,t=`/meet`){if(e.reason!==`user`)return;let n=Wo(e.returnUrl?.trim()||Go(t),window.location.origin);n?.protocol.startsWith(`http`)&&window.location.assign(n.toString())}var qo=/\b(exp_[A-Za-z0-9][A-Za-z0-9_-]{2,127})\b/,Jo=/(?:Your origin|origin)\s+(\S+)\s+is not an allowed origin/i;function Yo(e){return e instanceof Error?e.message:String(e)}function Xo(){try{if(typeof globalThis.location?.origin==`string`&&globalThis.location.origin)return globalThis.location.origin}catch{}}function Zo(e){return qo.exec(e)?.[1]}function Qo(e){return Jo.exec(e)?.[1]}function $o(e,t){let n=Yo(e).trim()||`Unknown error`,r=t?.experienceId?.trim()||Zo(n)||void 0,i=t?.origin?.trim()||Qo(n)||Xo()||void 0;return/No playable experience found/i.test(n)||/^Experience is not available\.?$/i.test(n)||/^Unknown experience\.?$/i.test(n)||/experience_unavailable/i.test(n)?{kind:`not_found`,title:`The application tried to load an avatar experience that doesn’t exist.`,detail:`Experience with id ${r??`the requested experience`} does not exist`,technicalMessage:n,experienceId:r,origin:i}:/origin_not_allowed/i.test(n)||/is not an allowed origin/i.test(n)||/^Origin not allowed/i.test(n)?{kind:`origin_not_allowed`,title:`The application tried to load an avatar experience from a website that isn’t allowed.`,detail:`Origin ${i??`this page`} is not allowed for experience ${r??`the requested experience`}`,technicalMessage:n,experienceId:r,origin:i}:/browser_embeds_disabled/i.test(n)||/^Browser embeds are not enabled/i.test(n)?{kind:`browser_embeds_disabled`,title:`The application tried to load an avatar experience that isn’t enabled for browser embeds.`,detail:`Browser embeds are not enabled for experience ${r??`the requested experience`}`,technicalMessage:n,experienceId:r,origin:i}:{kind:`generic`,title:`This avatar experience couldn’t be started.`,detail:n,technicalMessage:n,experienceId:r,origin:i}}var es=`liforma-experience-load-error-styles`;function ts(){if(typeof document>`u`||document.getElementById(`liforma-experience-load-error-styles`))return;let e=document.createElement(`style`);e.id=es,e.textContent=ns,document.head.append(e)}var ns=`
|
|
65
|
+
.liforma-loading-screen {
|
|
66
|
+
inset: 0;
|
|
67
|
+
z-index: 20;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
overflow-x: clip;
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
max-width: 100vw;
|
|
73
|
+
background:
|
|
74
|
+
radial-gradient(circle at 50% 60%, rgba(79, 126, 196, 0.18), transparent 38%),
|
|
75
|
+
#030508;
|
|
76
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
77
|
+
color: #e8f0ff;
|
|
78
|
+
text-align: center;
|
|
79
|
+
}
|
|
80
|
+
.liforma-loading-screen-absolute {
|
|
81
|
+
position: absolute;
|
|
82
|
+
}
|
|
83
|
+
.liforma-loading-card {
|
|
84
|
+
position: absolute;
|
|
85
|
+
left: 50%;
|
|
86
|
+
top: 60%;
|
|
87
|
+
transform: translate(-50%, -50%);
|
|
88
|
+
width: min(22rem, calc(100% - 2.5rem));
|
|
89
|
+
max-width: calc(100% - max(1.25rem, env(safe-area-inset-left, 0px)) - max(1.25rem, env(safe-area-inset-right, 0px)));
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
margin: 0;
|
|
92
|
+
padding: 0;
|
|
93
|
+
border: 0;
|
|
94
|
+
background: transparent;
|
|
95
|
+
box-shadow: none;
|
|
96
|
+
}
|
|
97
|
+
.liforma-loading-card-error {
|
|
98
|
+
display: block;
|
|
99
|
+
text-align: center;
|
|
100
|
+
padding: 1rem 1.05rem;
|
|
101
|
+
border-radius: 14px;
|
|
102
|
+
border: 1px solid rgba(255, 154, 154, 0.28);
|
|
103
|
+
background:
|
|
104
|
+
linear-gradient(180deg, rgba(21, 29, 42, 0.92), rgba(9, 13, 20, 0.92));
|
|
105
|
+
}
|
|
106
|
+
.liforma-loading-kicker {
|
|
107
|
+
margin: 0 0 0.18rem;
|
|
108
|
+
color: #8ba4c5;
|
|
109
|
+
font-size: 0.68rem;
|
|
110
|
+
font-weight: 700;
|
|
111
|
+
text-transform: uppercase;
|
|
112
|
+
letter-spacing: 0.08em;
|
|
113
|
+
}
|
|
114
|
+
.liforma-loading-error {
|
|
115
|
+
margin: 0;
|
|
116
|
+
max-width: 28rem;
|
|
117
|
+
color: #ffb4b4;
|
|
118
|
+
font-size: 0.92rem;
|
|
119
|
+
line-height: 1.4;
|
|
120
|
+
}
|
|
121
|
+
.liforma-loading-error-title {
|
|
122
|
+
margin: 0;
|
|
123
|
+
color: #f6ebe8;
|
|
124
|
+
font-size: 0.98rem;
|
|
125
|
+
font-weight: 650;
|
|
126
|
+
line-height: 1.35;
|
|
127
|
+
}
|
|
128
|
+
.liforma-loading-error-advanced {
|
|
129
|
+
margin: 0.85rem 0 0;
|
|
130
|
+
padding: 0;
|
|
131
|
+
border: 0;
|
|
132
|
+
background: transparent;
|
|
133
|
+
color: #9eb7d8;
|
|
134
|
+
font: inherit;
|
|
135
|
+
font-size: 0.78rem;
|
|
136
|
+
font-weight: 650;
|
|
137
|
+
letter-spacing: 0.02em;
|
|
138
|
+
text-decoration: underline;
|
|
139
|
+
text-underline-offset: 0.18em;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
}
|
|
142
|
+
.liforma-loading-error-advanced:hover,
|
|
143
|
+
.liforma-loading-error-advanced:focus-visible {
|
|
144
|
+
color: #d7e6ff;
|
|
145
|
+
outline: none;
|
|
146
|
+
}
|
|
147
|
+
.liforma-loading-error-detail {
|
|
148
|
+
margin: 0.7rem 0 0;
|
|
149
|
+
padding: 0.65rem 0.7rem;
|
|
150
|
+
border-radius: 10px;
|
|
151
|
+
border: 1px solid rgba(158, 191, 255, 0.16);
|
|
152
|
+
background: rgba(3, 5, 8, 0.45);
|
|
153
|
+
color: #c6d4e8;
|
|
154
|
+
font-size: 0.78rem;
|
|
155
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
156
|
+
line-height: 1.4;
|
|
157
|
+
text-align: left;
|
|
158
|
+
word-break: break-word;
|
|
159
|
+
}
|
|
160
|
+
.liforma-loading-error-detail[hidden] {
|
|
161
|
+
display: none;
|
|
162
|
+
}
|
|
163
|
+
`;function rs(e,t){ts();let n=t,r=!1,i=document.createElement(`div`);i.className=`liforma-loading-screen liforma-loading-screen-absolute`,i.setAttribute(`role`,`alert`),i.setAttribute(`aria-live`,`assertive`);let a=document.createElement(`div`);a.className=`liforma-loading-card liforma-loading-card-error`;let o=document.createElement(`p`);o.className=`liforma-loading-kicker`,o.textContent=`Avatar experience`;let s=document.createElement(`p`);s.className=`liforma-loading-error-title`;let c=document.createElement(`button`);c.type=`button`,c.className=`liforma-loading-error-advanced`;let l=document.createElement(`p`);l.className=`liforma-loading-error-detail`,c.addEventListener(`click`,()=>{r=!r,u()}),a.append(o,s,c,l),i.append(a),e.append(i);function u(){s.textContent=n.title,l.textContent=n.detail,l.hidden=!r,c.textContent=r?`Hide details`:`Advanced`,c.setAttribute(`aria-expanded`,r?`true`:`false`)}return u(),{root:i,setPresentation(e){n=e,r=!1,u()},remove(){i.remove()}}}var is=`liforma-experience`;function as(e){let t=e?.trim();return t===`conversation`||t===`presenter`?t:void 0}function os(e){let t=e?.trim();return t===`auto`||t===`manual`||t===`off`?t:void 0}function ss(e){let t=e?.trim();return t===`full`||t===`face`?t:void 0}var cs=class extends HTMLElement{host=null;errorHost=null;errorOverlay=null;experience=null;bootstrapGeneration=0;static get observedAttributes(){return[`experience-id`,`language`,`session-endpoint`,`speech-only`,`mode`,`speech-input-mode`,`fit`]}connectedCallback(){this.style.display=`block`,this.style.position=`relative`,this.style.overflow=`hidden`,this.style.width||(this.style.width=`100%`),this.style.height||(this.style.height=`100%`);let e=getComputedStyle(this).minHeight;!this.style.minHeight&&(e===`0px`||e===`auto`)&&(this.style.minHeight=`480px`),this.errorHost||(this.errorHost=document.createElement(`div`),this.errorHost.style.cssText=`position:absolute;inset:0;z-index:20;pointer-events:none;`,this.append(this.errorHost)),this.host||(this.host=document.createElement(`div`),this.host.style.cssText=`position:absolute;inset:0;overflow:hidden;`,this.append(this.host)),this.bootstrap()}disconnectedCallback(){this.bootstrapGeneration+=1,this.experience?.destroy(),this.experience=null,this.clearError()}attributeChangedCallback(e,t,n){e!==`experience-id`&&e!==`language`&&e!==`session-endpoint`&&e!==`speech-only`&&e!==`mode`&&e!==`speech-input-mode`&&e!==`fit`||t===n||!this.isConnected||(this.bootstrapGeneration+=1,this.experience?.destroy(),this.experience=null,this.clearError(),this.host&&this.host.replaceChildren(),this.bootstrap())}async bootstrap(){let e=this.getAttribute(`experience-id`)?.trim(),t=this.getAttribute(`session-endpoint`)?.trim(),n=this.getAttribute(`language`)?.trim(),r=n===`es`||n===`en`?n:void 0,i=this.getAttribute(`speech-only`)===`true`,a=as(this.getAttribute(`mode`)),o=os(this.getAttribute(`speech-input-mode`)),s=ss(this.getAttribute(`fit`));if(!e||!this.host)return;let c=++this.bootstrapGeneration;this.clearError();try{let n=await Uo.startSession(t?{experienceId:e,sessionEndpoint:t,language:r,speechOnly:i,mode:a,speechInputMode:o,fit:s}:{experienceId:e,language:r,speechOnly:i,mode:a,speechInputMode:o,fit:s});if(c!==this.bootstrapGeneration){n.destroy();return}this.experience=n;let l=await n.attach({container:this.host});if(c!==this.bootstrapGeneration){n.destroy(),this.experience=null;return}l.on(`close`,e=>{this.dispatchEvent(new CustomEvent(`close`,{detail:e,bubbles:!0})),Ko(e)})}catch(t){if(c!==this.bootstrapGeneration)return;this.showError(t,e),console.error(`[liforma-experience]`,t),this.experience?.destroy(),this.experience=null}}showError(e,t){this.clearError(),this.errorHost&&(this.errorHost.style.pointerEvents=`auto`,this.errorOverlay=rs(this.errorHost,$o(e,{experienceId:t})))}clearError(){this.errorOverlay?.remove(),this.errorOverlay=null,this.errorHost&&(this.errorHost.style.pointerEvents=`none`,this.errorHost.replaceChildren())}};typeof customElements<`u`&&!customElements.get(is)&&customElements.define(is,cs);var ls=/(\/avatars\/[^/]+\/)(\d+)(\/)/i,us=/(-)(\d+x\d+)(\.webp)(\?|$)/i;function ds(e){let t=e.trim();if(!t)return t;let n=t.replace(ls,(e,t,n,r)=>n===`256`?`${t}${n}${r}`:`${t}256${r}`);return n=n.replace(us,(e,t,n,r,i)=>n===`256x256`?`${t}${n}${r}${i}`:`${t}256x256${r}${i}`),n}function fs(e){let t=e.avatarImage?.trim()||e.galleryThumb?.avatarImage?.trim()||``;if(!t)return null;let n=e.backgroundImage?.trim()||e.galleryThumb?.backgroundImage?.trim()||``,r=e.foregroundImage?.trim()||e.galleryThumb?.foregroundImage?.trim()||``,i=e.fallbackImage?.trim()||``;return{avatarImage:ds(t),...n?{backgroundImage:ds(n)}:{},...r?{foregroundImage:ds(r)}:{},...i?{fallbackImage:ds(i)}:{}}}var ps=`https://player.liforma.ai`,ms=`http://localhost:3002`;function hs(e){return e.href?.trim()?`anchor`:e.hasClickHandler?`button`:e.experienceId?.trim()?`anchor`:`presentational`}function gs(e){let n=e?.trim();return n?n.replace(/\/$/,``):t()?ms:ps}function _s(e){let t=e.experienceId.trim(),n=gs(e.playerBaseUrl),r=new URL(`${n}/${encodeURIComponent(t)}`),i=e.returnUrl?.trim();return i&&r.searchParams.set(`returnUrl`,i),r.toString()}function vs(e){let t=e.href?.trim();if(t)return t;let n=e.experienceId?.trim();if(!n)return;let r=e.returnUrl?.trim();return!r&&e.useCurrentPageAsReturnUrl&&typeof window<`u`&&(r=window.location.href),_s({experienceId:n,...r?{returnUrl:r}:{},playerBaseUrl:e.playerBaseUrl})}function ys(e,t){let{rootMargin:n=`280px 0px`,onVisibleChange:r}=t,i=!1;if(typeof IntersectionObserver>`u`)return r(!0),()=>{};let a=new IntersectionObserver(e=>{let t=e.some(e=>e.isIntersecting);t!==i&&(i=t,r(i))},{root:null,rootMargin:n,threshold:0});a.observe(e);let o=e.getBoundingClientRect();return typeof window<`u`&&o.bottom>=-280&&o.top<=window.innerHeight+280&&(i=!0,r(!0)),()=>a.disconnect()}function bs(e,t){let n=()=>t();return e.complete?queueMicrotask(n):(e.addEventListener(`load`,n,{once:!0}),e.addEventListener(`error`,n,{once:!0})),()=>{e.removeEventListener(`load`,n),e.removeEventListener(`error`,n)}}function xs(){return typeof window>`u`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?!1:window.matchMedia(`(hover: none), (pointer: coarse)`).matches}function Ss(e,t){return((e.top+e.height/2)/Math.max(t,1)-.5)*2}function Cs(e,t){if(!xs())return()=>{};let n=0,r=()=>{n=0,!t.pointerActive?.()&&t.onParallax(Ss(e.getBoundingClientRect(),window.innerHeight))},i=()=>{n===0&&(n=requestAnimationFrame(r))};return r(),window.addEventListener(`scroll`,i,{passive:!0}),window.addEventListener(`resize`,i,{passive:!0}),()=>{n!==0&&cancelAnimationFrame(n),window.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i)}}function ws(e){let t=0,n=0,r=!1,i=!1,a=!1,o=()=>{let a=r||i;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))},s=Cs(e,{onParallax:e=>{i=!0,a||(t=e,n=0,o())},pointerActive:()=>a}),c=r=>{if(i)return;let a=e.getBoundingClientRect();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())},l=e=>{a=!0,e.pointerType===`mouse`&&(r=!0),o()},u=()=>{let s=a;a=!1,r=!1,i&&s?(t=Ss(e.getBoundingClientRect(),window.innerHeight),n=0):i||(t=0,n=0),o()},d=e=>{e.pointerType===`mouse`&&(r=!0,o())},f=()=>{a||(r=!1,i||(t=0,n=0),o())};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),()=>{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`)}}var Ts=`.liforma-et {
|
|
164
|
+
--liforma-et-parallax-x: 0;
|
|
165
|
+
--liforma-et-parallax-y: 0;
|
|
166
|
+
--liforma-et-bg-scale: 1;
|
|
167
|
+
--liforma-et-fg-scale: 1;
|
|
168
|
+
--liforma-et-avatar-scale: 1;
|
|
169
|
+
--liforma-et-bg-shift: 0px;
|
|
170
|
+
--liforma-et-fg-shift: 0px;
|
|
171
|
+
--liforma-et-avatar-shift: 0px;
|
|
172
|
+
--liforma-et-reveal-duration: 420ms;
|
|
173
|
+
|
|
174
|
+
box-sizing: border-box;
|
|
175
|
+
position: relative;
|
|
176
|
+
display: block;
|
|
177
|
+
width: 100%;
|
|
178
|
+
height: 100%;
|
|
179
|
+
min-height: 0;
|
|
180
|
+
margin: 0;
|
|
181
|
+
padding: 0;
|
|
182
|
+
border: 0;
|
|
183
|
+
border-radius: 0.65rem;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
background: #111;
|
|
186
|
+
color: inherit;
|
|
187
|
+
text-decoration: none;
|
|
188
|
+
cursor: inherit;
|
|
189
|
+
-webkit-tap-highlight-color: transparent;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
a.liforma-et,
|
|
193
|
+
button.liforma-et {
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
button.liforma-et {
|
|
198
|
+
font: inherit;
|
|
199
|
+
appearance: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.liforma-et__placeholder {
|
|
203
|
+
position: absolute;
|
|
204
|
+
inset: 0;
|
|
205
|
+
z-index: 0;
|
|
206
|
+
background:
|
|
207
|
+
radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),
|
|
208
|
+
linear-gradient(180deg, #1a1a1a 0%, #101010 100%);
|
|
209
|
+
opacity: 1;
|
|
210
|
+
transition: opacity var(--liforma-et-reveal-duration) ease;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.liforma-et--revealed .liforma-et__placeholder {
|
|
214
|
+
opacity: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.liforma-et__media {
|
|
218
|
+
opacity: 0;
|
|
219
|
+
transition: opacity var(--liforma-et-reveal-duration) ease;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.liforma-et__media--ready {
|
|
223
|
+
opacity: 1;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.liforma-et__background {
|
|
227
|
+
position: absolute;
|
|
228
|
+
inset: 0;
|
|
229
|
+
z-index: 1;
|
|
230
|
+
width: 100%;
|
|
231
|
+
height: 100%;
|
|
232
|
+
object-fit: cover;
|
|
233
|
+
object-position: center center;
|
|
234
|
+
transform: translate(
|
|
235
|
+
calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),
|
|
236
|
+
calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))
|
|
237
|
+
)
|
|
238
|
+
scale(var(--liforma-et-bg-scale));
|
|
239
|
+
transform-origin: center center;
|
|
240
|
+
transition:
|
|
241
|
+
opacity var(--liforma-et-reveal-duration) ease,
|
|
242
|
+
transform 160ms ease;
|
|
243
|
+
will-change: transform;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.liforma-et__avatar {
|
|
247
|
+
position: relative;
|
|
248
|
+
z-index: 2;
|
|
249
|
+
display: block;
|
|
250
|
+
width: 100%;
|
|
251
|
+
height: 100%;
|
|
252
|
+
object-fit: cover;
|
|
253
|
+
object-position: 50% 30%;
|
|
254
|
+
transform: scale(var(--liforma-et-avatar-scale))
|
|
255
|
+
translate(
|
|
256
|
+
calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),
|
|
257
|
+
calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))
|
|
258
|
+
);
|
|
259
|
+
transform-origin: center center;
|
|
260
|
+
transition:
|
|
261
|
+
opacity var(--liforma-et-reveal-duration) ease,
|
|
262
|
+
transform 160ms ease;
|
|
263
|
+
will-change: transform;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.liforma-et--scene .liforma-et__avatar {
|
|
267
|
+
object-fit: contain;
|
|
268
|
+
object-position: center bottom;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.liforma-et__foreground {
|
|
272
|
+
position: absolute;
|
|
273
|
+
inset: 0;
|
|
274
|
+
z-index: 3;
|
|
275
|
+
width: 100%;
|
|
276
|
+
height: 100%;
|
|
277
|
+
object-fit: cover;
|
|
278
|
+
object-position: center center;
|
|
279
|
+
pointer-events: none;
|
|
280
|
+
transform: translate(
|
|
281
|
+
calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),
|
|
282
|
+
calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)
|
|
283
|
+
)
|
|
284
|
+
scale(var(--liforma-et-fg-scale));
|
|
285
|
+
transform-origin: center center;
|
|
286
|
+
transition:
|
|
287
|
+
opacity var(--liforma-et-reveal-duration) ease,
|
|
288
|
+
transform 160ms ease;
|
|
289
|
+
will-change: transform;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.liforma-et--parallax {
|
|
293
|
+
--liforma-et-bg-scale: 1.08;
|
|
294
|
+
--liforma-et-fg-scale: 1.05;
|
|
295
|
+
--liforma-et-avatar-scale: 1.08;
|
|
296
|
+
--liforma-et-bg-shift: 10px;
|
|
297
|
+
--liforma-et-fg-shift: 4px;
|
|
298
|
+
--liforma-et-avatar-shift: 4px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.liforma-et--parallax:not(.liforma-et--scene) {
|
|
302
|
+
--liforma-et-avatar-scale: 1.05;
|
|
303
|
+
--liforma-et-avatar-shift: 0px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.liforma-et--scroll-parallax .liforma-et__background,
|
|
307
|
+
.liforma-et--scroll-parallax .liforma-et__foreground,
|
|
308
|
+
.liforma-et--scroll-parallax .liforma-et__avatar {
|
|
309
|
+
transition: opacity var(--liforma-et-reveal-duration) ease;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
@media (prefers-reduced-motion: reduce) {
|
|
313
|
+
.liforma-et {
|
|
314
|
+
--liforma-et-reveal-duration: 0ms;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.liforma-et--parallax {
|
|
318
|
+
--liforma-et-bg-scale: 1;
|
|
319
|
+
--liforma-et-fg-scale: 1;
|
|
320
|
+
--liforma-et-avatar-scale: 1;
|
|
321
|
+
--liforma-et-bg-shift: 0px;
|
|
322
|
+
--liforma-et-fg-shift: 0px;
|
|
323
|
+
--liforma-et-avatar-shift: 0px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.liforma-et__background,
|
|
327
|
+
.liforma-et__foreground,
|
|
328
|
+
.liforma-et__avatar {
|
|
329
|
+
transition: none;
|
|
330
|
+
}
|
|
331
|
+
}`,Es=!1;function Ds(e){if(typeof document>`u`||Es)return;if(document.querySelector(`style[data-liforma-et]`)){Es=!0;return}let t=document.createElement(`style`);t.setAttribute(`data-liforma-et`,``),t.textContent=e,document.head.appendChild(t),Es=!0}var Os=`liforma-experience-thumbnail`;function ks(e){if(e?.trim())try{let t=JSON.parse(e);if(t&&typeof t.avatarImage==`string`)return t}catch{}}var As=class extends HTMLElement{static get observedAttributes(){return[`experience-id`,`gallery-thumb`,`avatar-image`,`background-image`,`foreground-image`,`fallback-image`,`alt`,`href`,`target`,`rel`,`return-url`,`player-base-url`,`parallax`,`lazy`]}#e=null;#t=[];#n=!1;#r=!1;#i=!1;#a=!1;#o=0;#s=0;#c=!1;#l=!1;#u=!1;#d=!1;connectedCallback(){this.#m()}disconnectedCallback(){this.#f()}attributeChangedCallback(){this.isConnected&&this.#m()}#f(){for(let e of this.#t)e();this.#t=[],this.#e=null}#p(e,t){if(!this.hasAttribute(e))return t;let n=this.getAttribute(e);return n===null||n===``||n===`true`?!0:n===`false`?!1:t}#m(){this.#f();let e=this.shadowRoot??this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.textContent=Ts,e.replaceChildren(t);let n=this.getAttribute(`alt`)?.trim()||`Experience`,r=this.getAttribute(`href`),i=this.getAttribute(`experience-id`),a=hs({href:r,hasClickHandler:this.hasAttribute(`onclick`)||typeof this.onclick==`function`,experienceId:i}),o=fs({galleryThumb:ks(this.getAttribute(`gallery-thumb`)),avatarImage:this.getAttribute(`avatar-image`)??void 0,backgroundImage:this.getAttribute(`background-image`)??void 0,foregroundImage:this.getAttribute(`foreground-image`)??void 0,fallbackImage:this.getAttribute(`fallback-image`)??void 0});if(!o)return;let s=this.#p(`parallax`,!0),c=this.#p(`lazy`,!0);this.#n=!c;let l=a===`anchor`&&!r?.trim()&&!!i?.trim(),u=vs({href:r??void 0,experienceId:i??void 0,returnUrl:this.getAttribute(`return-url`)??void 0,playerBaseUrl:this.getAttribute(`player-base-url`)??void 0,useCurrentPageAsReturnUrl:l&&!this.getAttribute(`return-url`)?.trim()}),d;if(a===`anchor`&&u){let e=document.createElement(`a`);e.href=u;let t=this.getAttribute(`target`),n=this.getAttribute(`rel`);t&&(e.target=t),n&&(e.rel=n),d=e}else if(a===`button`){let e=document.createElement(`button`);e.type=`button`,d=e}else d=document.createElement(`div`),d.setAttribute(`role`,`img`);d.className=`liforma-et`,d.setAttribute(`aria-label`,n),this.#e=d,e.appendChild(d);let f=()=>{let e=!!o.backgroundImage,t=s&&(this.#r||this.#a),n=this.#n&&(!o.backgroundImage||this.#l)&&this.#u&&(!o.foregroundImage||this.#d);d.className=[`liforma-et`,e?`liforma-et--scene`:``,t?`liforma-et--parallax`:``,this.#a?`liforma-et--scroll-parallax`:``,this.#n&&!n?`liforma-et--loading`:``,n?`liforma-et--revealed`:``].filter(Boolean).join(` `),d.style.setProperty(`--liforma-et-parallax-x`,String(this.#o)),d.style.setProperty(`--liforma-et-parallax-y`,String(this.#s))},p=document.createElement(`span`);p.className=`liforma-et__placeholder`,p.setAttribute(`aria-hidden`,`true`),d.appendChild(p);let m=()=>{if(!this.#n)return;let e=this.#c&&o.fallbackImage?o.fallbackImage:o.avatarImage;if(o.backgroundImage&&!d.querySelector(`.liforma-et__background`)){let e=document.createElement(`img`);e.className=`liforma-et__background liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=o.backgroundImage,this.#t.push(bs(e,()=>{this.#l=!0,e.classList.add(`liforma-et__media--ready`),f()})),d.appendChild(e)}let t=d.querySelector(`.liforma-et__avatar`);if(t||(t=document.createElement(`img`),t.className=`liforma-et__avatar liforma-et__media`,t.alt=``,t.decoding=`async`,t.addEventListener(`error`,()=>{o.fallbackImage&&!this.#c?(this.#c=!0,t.src=o.fallbackImage):(this.#u=!0,f())}),this.#t.push(bs(t,()=>{this.#u=!0,t.classList.add(`liforma-et__media--ready`),f()})),d.appendChild(t)),t.src!==e&&(t.src=e),o.foregroundImage&&!d.querySelector(`.liforma-et__foreground`)){let e=document.createElement(`img`);e.className=`liforma-et__foreground liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=o.foregroundImage,this.#t.push(bs(e,()=>{this.#d=!0,e.classList.add(`liforma-et__media--ready`),f()})),d.appendChild(e)}f()};if(c?this.#t.push(ys(d,{onVisibleChange:e=>{e&&(this.#n=!0,m(),f())}})):m(),s){this.#t.push(Cs(d,{onParallax:e=>{this.#a=!0,this.#i||(this.#o=e,this.#s=0,f())},pointerActive:()=>this.#i}));let e=e=>{if(this.#a)return;let t=d.getBoundingClientRect();t.width<=0||t.height<=0||(this.#o=((e.clientX-t.left)/t.width-.5)*2,this.#s=((e.clientY-t.top)/t.height-.5)*2,f())},t=e=>{this.#i=!0,e.pointerType===`mouse`&&(this.#r=!0),f()},n=()=>{let e=this.#i;this.#i=!1,this.#r=!1,this.#a&&e?(this.#o=Ss(d.getBoundingClientRect(),window.innerHeight),this.#s=0):this.#a||(this.#o=0,this.#s=0),f()};d.addEventListener(`pointermove`,e),d.addEventListener(`pointerdown`,t),d.addEventListener(`pointerup`,n),d.addEventListener(`pointercancel`,n),d.addEventListener(`pointerenter`,e=>{e.pointerType===`mouse`&&(this.#r=!0,f())}),d.addEventListener(`pointerleave`,()=>{this.#i||(this.#r=!1,this.#a||(this.#o=0,this.#s=0),f())}),this.#t.push(()=>{d.removeEventListener(`pointermove`,e),d.removeEventListener(`pointerdown`,t),d.removeEventListener(`pointerup`,n),d.removeEventListener(`pointercancel`,n)})}d.addEventListener(`click`,e=>{if(l&&!this.getAttribute(`return-url`)?.trim()){let t=vs({experienceId:i??void 0,playerBaseUrl:this.getAttribute(`player-base-url`)??void 0,useCurrentPageAsReturnUrl:!0});t&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),window.location.assign(t))}}),f()}};customElements.get(Os)||customElements.define(Os,As);function js(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.avatarImage==`string`?t.avatarImage.trim():``;return n?{avatarImage:n,...typeof t.backgroundImage==`string`&&t.backgroundImage.trim()?{backgroundImage:t.backgroundImage.trim()}:{},...typeof t.foregroundImage==`string`&&t.foregroundImage.trim()?{foregroundImage:t.foregroundImage.trim()}:{}}:null}async function Ms(e,t){let n=e.trim();if(!n)throw Error(`Experience preview requires experienceId.`);let r=(t?.apiBaseUrl??a()).replace(/\/$/,``),i=await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`,{method:`GET`,headers:{Accept:`application/json`},signal:t?.signal});if(!i.ok){let e=`Experience preview failed (${i.status})`;try{let t=await i.json();t.message?.trim()&&(e=t.message.trim())}catch{}throw Error(e)}let o;try{o=await i.json()}catch{throw Error(`Experience preview returned invalid JSON.`)}if(!o||typeof o!=`object`)throw Error(`Experience preview returned an invalid payload.`);let s=o,c=typeof s.experienceId==`string`?s.experienceId.trim():n,l=typeof s.title==`string`?s.title.trim():``,u=js(s.galleryThumb);if(!u)throw Error(`Experience preview is missing gallery thumb images.`);return{experienceId:c||n,title:l||c||n,galleryThumb:u}}var Ns=`(min-width: 768px)`,Ps=24,Fs=.5,Is=1200,Ls=.85,Rs=9/16;function zs(){if(typeof window>`u`)return 800;let e=window.screen?.availHeight;return typeof e==`number`&&e>0?e:window.innerHeight}function Bs(e=typeof window<`u`?window.innerWidth:1280,t=typeof window<`u`?window.innerHeight:800,n=Ps,r=typeof window<`u`?zs():800){let i=Math.max(160,Math.min(t-n*2,t*Ls)),a=Math.max(120,e-n*2),o=Math.min(r*Fs,Is,i),s=o*Rs;return s>a&&(s=a,o=s/Rs,o>i&&(o=i,s=o*Rs)),{width:Math.round(s),height:Math.round(o)}}function Vs(e,t=typeof window<`u`?window.innerWidth:1280,n=typeof window<`u`?window.innerHeight:800,r=Ps){return{left:Math.max(r,t-e.width-r),top:Math.max(r,n-e.height-r)}}function Hs(e,t,n,r=typeof window<`u`?window.innerWidth:1280,i=typeof window<`u`?window.innerHeight:800,a=Ps){let o=Math.max(a,r-n.width-a),s=Math.max(a,i-n.height-a);return{left:Math.min(Math.max(a,e),o),top:Math.min(Math.max(a,t),s)}}function Us(e=typeof window<`u`?window.matchMedia.bind(window):()=>({matches:!0})){return e(Ns).matches}var Ws=`
|
|
332
|
+
.liforma-ew {
|
|
333
|
+
box-sizing: border-box;
|
|
334
|
+
position: relative;
|
|
335
|
+
display: block;
|
|
336
|
+
width: 100%;
|
|
337
|
+
height: 100%;
|
|
338
|
+
min-height: 0;
|
|
339
|
+
margin: 0;
|
|
340
|
+
padding: 0;
|
|
341
|
+
border: 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* Optional self-positioned FAB (position=bottom-right|bottom-left).
|
|
345
|
+
* Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */
|
|
346
|
+
.liforma-ew[data-position='bottom-right'],
|
|
347
|
+
.liforma-ew[data-position='bottom-left'] {
|
|
348
|
+
position: fixed;
|
|
349
|
+
width: min(var(--liforma-ew-fab-size, 224px), 50vmin);
|
|
350
|
+
height: min(var(--liforma-ew-fab-size, 224px), 50vmin);
|
|
351
|
+
bottom: var(--liforma-ew-offset, 16px);
|
|
352
|
+
z-index: 2147482900;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.liforma-ew[data-position='bottom-right'] {
|
|
356
|
+
right: var(--liforma-ew-offset, 16px);
|
|
357
|
+
left: auto;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.liforma-ew[data-position='bottom-left'] {
|
|
361
|
+
left: var(--liforma-ew-offset, 16px);
|
|
362
|
+
right: auto;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/* While open, collapse the FAB box so a corner hole / thumb never remains. */
|
|
366
|
+
.liforma-ew[data-position='bottom-right'][data-state='expanded'],
|
|
367
|
+
.liforma-ew[data-position='bottom-right'][data-state='docked'],
|
|
368
|
+
.liforma-ew[data-position='bottom-left'][data-state='expanded'],
|
|
369
|
+
.liforma-ew[data-position='bottom-left'][data-state='docked'] {
|
|
370
|
+
width: 0;
|
|
371
|
+
height: 0;
|
|
372
|
+
min-width: 0;
|
|
373
|
+
min-height: 0;
|
|
374
|
+
overflow: visible;
|
|
375
|
+
pointer-events: none;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__warm,
|
|
379
|
+
.liforma-ew[data-state='docked'] .liforma-ew__warm,
|
|
380
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__overlay,
|
|
381
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,
|
|
382
|
+
.liforma-ew[data-state='docked'] .liforma-ew__toolbar {
|
|
383
|
+
pointer-events: auto;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.liforma-ew[data-state='docked'] .liforma-ew__overlay {
|
|
387
|
+
pointer-events: none;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.liforma-ew[data-state='docked'] .liforma-ew__panel {
|
|
391
|
+
pointer-events: auto;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.liforma-ew__hit {
|
|
395
|
+
box-sizing: border-box;
|
|
396
|
+
display: block;
|
|
397
|
+
width: 100%;
|
|
398
|
+
height: 100%;
|
|
399
|
+
margin: 0;
|
|
400
|
+
padding: 0;
|
|
401
|
+
border: 0;
|
|
402
|
+
background: transparent;
|
|
403
|
+
cursor: pointer;
|
|
404
|
+
font: inherit;
|
|
405
|
+
appearance: none;
|
|
406
|
+
-webkit-tap-highlight-color: transparent;
|
|
407
|
+
transform: scale(1);
|
|
408
|
+
transform-origin: center center;
|
|
409
|
+
transition:
|
|
410
|
+
transform 180ms ease,
|
|
411
|
+
filter 180ms ease;
|
|
412
|
+
will-change: transform;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Author display must not defeat the HTML hidden attribute. */
|
|
416
|
+
.liforma-ew__hit[hidden] {
|
|
417
|
+
display: none !important;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.liforma-ew__hit:focus-visible {
|
|
421
|
+
outline: 2px solid #5b8def;
|
|
422
|
+
outline-offset: 3px;
|
|
423
|
+
border-radius: 0.75rem;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
@media (hover: hover) and (pointer: fine) {
|
|
427
|
+
/* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */
|
|
428
|
+
.liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,
|
|
429
|
+
.liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {
|
|
430
|
+
transform: scale(1.06);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,
|
|
434
|
+
.liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {
|
|
435
|
+
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.liforma-ew__face {
|
|
440
|
+
width: 100%;
|
|
441
|
+
height: 100%;
|
|
442
|
+
min-height: 0;
|
|
443
|
+
position: relative;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.liforma-ew__face-status {
|
|
447
|
+
position: absolute;
|
|
448
|
+
inset: 0;
|
|
449
|
+
z-index: 1;
|
|
450
|
+
display: grid;
|
|
451
|
+
place-items: center;
|
|
452
|
+
padding: 0.5rem;
|
|
453
|
+
text-align: center;
|
|
454
|
+
font: 600 0.75rem/1.3 system-ui, sans-serif;
|
|
455
|
+
color: #e8ecf4;
|
|
456
|
+
background: rgba(10, 12, 18, 0.72);
|
|
457
|
+
border-radius: 0.75rem;
|
|
458
|
+
pointer-events: none;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.liforma-ew__face-status[hidden] {
|
|
462
|
+
display: none !important;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.liforma-ew__hit:disabled {
|
|
466
|
+
cursor: default;
|
|
467
|
+
opacity: 0.85;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.liforma-ew__face .liforma-et {
|
|
471
|
+
border-radius: 0.75rem;
|
|
472
|
+
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
|
|
473
|
+
transition: box-shadow 180ms ease;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.liforma-ew__warm {
|
|
477
|
+
box-sizing: border-box;
|
|
478
|
+
position: absolute;
|
|
479
|
+
inset: 0;
|
|
480
|
+
z-index: 2;
|
|
481
|
+
border-radius: 0.75rem;
|
|
482
|
+
overflow: hidden;
|
|
483
|
+
background: transparent;
|
|
484
|
+
pointer-events: none;
|
|
485
|
+
opacity: 1;
|
|
486
|
+
transition: opacity 1000ms ease;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/*
|
|
490
|
+
* Collapsed: keep the warm iframe as an invisible hit target only.
|
|
491
|
+
* Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).
|
|
492
|
+
*/
|
|
493
|
+
.liforma-ew[data-state='collapsed'] .liforma-ew__warm {
|
|
494
|
+
opacity: 0;
|
|
495
|
+
transition: none;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.liforma-ew[data-warm='true'] .liforma-ew__warm {
|
|
499
|
+
pointer-events: auto;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {
|
|
503
|
+
pointer-events: none;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {
|
|
507
|
+
pointer-events: auto;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.liforma-ew[data-live='true'] .liforma-ew__warm,
|
|
511
|
+
.liforma-ew[data-live='true'] .liforma-ew__stage {
|
|
512
|
+
/* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */
|
|
513
|
+
opacity: 0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,
|
|
517
|
+
.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,
|
|
518
|
+
.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,
|
|
519
|
+
.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {
|
|
520
|
+
opacity: 1;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.liforma-ew--session-concealing .liforma-ew__warm,
|
|
524
|
+
.liforma-ew--session-concealing .liforma-ew__stage {
|
|
525
|
+
transition-duration: 280ms;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */
|
|
529
|
+
.liforma-ew--layout-settling .liforma-ew__warm,
|
|
530
|
+
.liforma-ew--layout-settling .liforma-ew__stage {
|
|
531
|
+
opacity: 0 !important;
|
|
532
|
+
transition: none !important;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {
|
|
536
|
+
/* Keep the live iframe under the thumb; FAB click resumes the shell. */
|
|
537
|
+
pointer-events: none;
|
|
538
|
+
opacity: 0;
|
|
539
|
+
/* Instant hide when collapsed so the FAB never shows a resized live mesh. */
|
|
540
|
+
transition: none;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__warm {
|
|
544
|
+
position: fixed;
|
|
545
|
+
/* Match overlay panel inset so the warm iframe fills the conversation shell. */
|
|
546
|
+
inset: clamp(12px, 3vw, 28px);
|
|
547
|
+
z-index: 2147483001;
|
|
548
|
+
width: auto;
|
|
549
|
+
height: auto;
|
|
550
|
+
border-radius: 16px;
|
|
551
|
+
pointer-events: auto;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.liforma-ew[data-state='docked'] .liforma-ew__warm {
|
|
555
|
+
position: fixed;
|
|
556
|
+
inset: auto;
|
|
557
|
+
z-index: 2147483001;
|
|
558
|
+
border-radius: 16px;
|
|
559
|
+
pointer-events: auto;
|
|
560
|
+
/* left/top/width/height set inline from dock geometry */
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.liforma-ew__toolbar {
|
|
564
|
+
display: none;
|
|
565
|
+
position: fixed;
|
|
566
|
+
z-index: 2147483002;
|
|
567
|
+
pointer-events: auto;
|
|
568
|
+
box-sizing: border-box;
|
|
569
|
+
align-items: center;
|
|
570
|
+
gap: 0.35rem;
|
|
571
|
+
padding: 0.35rem 0.4rem;
|
|
572
|
+
border-radius: 999px;
|
|
573
|
+
background: rgba(12, 14, 20, 0.72);
|
|
574
|
+
backdrop-filter: blur(8px);
|
|
575
|
+
-webkit-backdrop-filter: blur(8px);
|
|
576
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {
|
|
580
|
+
display: flex;
|
|
581
|
+
top: calc(clamp(12px, 3vw, 28px) + 10px);
|
|
582
|
+
right: calc(clamp(12px, 3vw, 28px) + 10px);
|
|
583
|
+
left: auto;
|
|
584
|
+
cursor: default;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.liforma-ew[data-state='docked'] .liforma-ew__toolbar {
|
|
588
|
+
display: flex;
|
|
589
|
+
/* left/top set inline to track the panel; strip is the drag handle */
|
|
590
|
+
cursor: grab;
|
|
591
|
+
touch-action: none;
|
|
592
|
+
user-select: none;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging {
|
|
596
|
+
cursor: grabbing;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.liforma-ew__toolbar[hidden] {
|
|
600
|
+
display: none !important;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.liforma-ew__icon-btn {
|
|
604
|
+
appearance: none;
|
|
605
|
+
box-sizing: border-box;
|
|
606
|
+
display: inline-grid;
|
|
607
|
+
place-items: center;
|
|
608
|
+
width: 2rem;
|
|
609
|
+
height: 2rem;
|
|
610
|
+
margin: 0;
|
|
611
|
+
padding: 0;
|
|
612
|
+
border: 0;
|
|
613
|
+
border-radius: 999px;
|
|
614
|
+
color: #f5f7fb;
|
|
615
|
+
background: transparent;
|
|
616
|
+
cursor: pointer;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.liforma-ew__icon-btn:hover {
|
|
620
|
+
background: rgba(255, 255, 255, 0.12);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.liforma-ew__icon-btn[aria-pressed='true'] {
|
|
624
|
+
background: rgba(255, 255, 255, 0.2);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.liforma-ew__icon-btn:focus-visible {
|
|
628
|
+
outline: 2px solid #5b8def;
|
|
629
|
+
outline-offset: 2px;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
.liforma-ew__icon-btn svg {
|
|
633
|
+
width: 1.05rem;
|
|
634
|
+
height: 1.05rem;
|
|
635
|
+
display: block;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.liforma-ew__drag-grip {
|
|
639
|
+
display: none;
|
|
640
|
+
width: 0.85rem;
|
|
641
|
+
height: 1.25rem;
|
|
642
|
+
margin: 0 0.15rem 0 0.25rem;
|
|
643
|
+
background:
|
|
644
|
+
radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,
|
|
645
|
+
radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;
|
|
646
|
+
background-repeat: repeat-y;
|
|
647
|
+
opacity: 0.55;
|
|
648
|
+
color: #f5f7fb;
|
|
649
|
+
pointer-events: none;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {
|
|
653
|
+
display: block;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.liforma-ew__dock-toggle[hidden] {
|
|
657
|
+
display: none !important;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.liforma-ew__overlay {
|
|
661
|
+
position: fixed;
|
|
662
|
+
inset: 0;
|
|
663
|
+
z-index: 2147483000;
|
|
664
|
+
display: flex;
|
|
665
|
+
align-items: center;
|
|
666
|
+
justify-content: center;
|
|
667
|
+
padding: clamp(12px, 3vw, 28px);
|
|
668
|
+
box-sizing: border-box;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.liforma-ew[data-state='docked'] .liforma-ew__overlay {
|
|
672
|
+
padding: 0;
|
|
673
|
+
align-items: stretch;
|
|
674
|
+
justify-content: stretch;
|
|
675
|
+
pointer-events: none;
|
|
676
|
+
background: transparent;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.liforma-ew__overlay[hidden] {
|
|
680
|
+
display: none !important;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
.liforma-ew__backdrop {
|
|
684
|
+
position: absolute;
|
|
685
|
+
inset: 0;
|
|
686
|
+
border: 0;
|
|
687
|
+
padding: 0;
|
|
688
|
+
margin: 0;
|
|
689
|
+
background: rgba(6, 8, 14, 0.62);
|
|
690
|
+
cursor: pointer;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.liforma-ew[data-state='docked'] .liforma-ew__backdrop {
|
|
694
|
+
display: none !important;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.liforma-ew__panel {
|
|
698
|
+
position: relative;
|
|
699
|
+
z-index: 1;
|
|
700
|
+
display: flex;
|
|
701
|
+
flex-direction: column;
|
|
702
|
+
/* Fill the overlay so player loading / start UI centers in the visible window. */
|
|
703
|
+
width: var(--liforma-ew-max-w, 100%);
|
|
704
|
+
height: var(--liforma-ew-max-h, 100%);
|
|
705
|
+
max-width: 100%;
|
|
706
|
+
max-height: 100%;
|
|
707
|
+
border-radius: 16px;
|
|
708
|
+
overflow: hidden;
|
|
709
|
+
background: #030508;
|
|
710
|
+
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
|
|
711
|
+
/* Warm iframe sits above as a sibling; keep panel as chrome shell. */
|
|
712
|
+
pointer-events: none;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
.liforma-ew[data-state='docked'] .liforma-ew__panel {
|
|
716
|
+
position: fixed;
|
|
717
|
+
inset: auto;
|
|
718
|
+
max-width: none;
|
|
719
|
+
max-height: none;
|
|
720
|
+
pointer-events: auto;
|
|
721
|
+
/* left/top/width/height set inline from dock geometry */
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
.liforma-ew:not([data-warm='true']) .liforma-ew__panel {
|
|
725
|
+
pointer-events: auto;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
.liforma-ew__stage {
|
|
729
|
+
position: relative;
|
|
730
|
+
flex: 1;
|
|
731
|
+
min-height: 0;
|
|
732
|
+
width: 100%;
|
|
733
|
+
height: 100%;
|
|
734
|
+
background: #030508;
|
|
735
|
+
opacity: 1;
|
|
736
|
+
transition: opacity 1000ms ease;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.liforma-ew__status {
|
|
740
|
+
position: absolute;
|
|
741
|
+
inset: 0;
|
|
742
|
+
z-index: 1;
|
|
743
|
+
display: grid;
|
|
744
|
+
place-items: center;
|
|
745
|
+
padding: 1.5rem;
|
|
746
|
+
text-align: center;
|
|
747
|
+
color: #d7dde8;
|
|
748
|
+
font: 500 0.9375rem/1.45 system-ui, sans-serif;
|
|
749
|
+
background: rgba(3, 5, 8, 0.92);
|
|
750
|
+
pointer-events: none;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
.liforma-ew__status[hidden] {
|
|
754
|
+
display: none !important;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/* Mobile expanded: ~90% viewport, no reduce control. */
|
|
758
|
+
@media (max-width: 767px) {
|
|
759
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__overlay {
|
|
760
|
+
padding: 5vh 5vw;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__panel {
|
|
764
|
+
width: 90vw;
|
|
765
|
+
height: 90vh;
|
|
766
|
+
max-width: 90vw;
|
|
767
|
+
max-height: 90vh;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__warm {
|
|
771
|
+
inset: 5vh 5vw;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {
|
|
775
|
+
top: calc(5vh + 10px);
|
|
776
|
+
right: calc(5vw + 10px);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
.liforma-ew__dock-toggle {
|
|
780
|
+
display: none !important;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
@media (prefers-reduced-motion: reduce) {
|
|
785
|
+
.liforma-ew__hit {
|
|
786
|
+
transition: none;
|
|
787
|
+
will-change: auto;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
.liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,
|
|
791
|
+
.liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {
|
|
792
|
+
transform: none;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
.liforma-ew__face .liforma-et {
|
|
796
|
+
box-shadow: none;
|
|
797
|
+
transition: none;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.liforma-ew__warm,
|
|
801
|
+
.liforma-ew__stage {
|
|
802
|
+
transition: none;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
`,Gs=`liforma-experience-widget-styles`;function Ks(e=Ws){if(typeof document>`u`)return;let t=document.getElementById(Gs);if(t){t.textContent=e;return}let n=document.createElement(`style`);n.id=Gs,n.textContent=e,document.head.append(n)}function qs(e){return e===`bottom-right`||e===`bottom-left`?e:`static`}function Js(e){if(typeof e==`number`&&Number.isFinite(e))return`${e}px`;let t=typeof e==`string`?e.trim():``;return t?/^\d+(\.\d+)?$/.test(t)?`${t}px`:t:`16px`}function $(e){return e===`expanded`||e===`docked`}var Ys=`<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>`,Xs=`<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>`,Zs=`<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>`,Qs=`<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>`;function $s(e,t,n){Ds(Ts);let r=fs({galleryThumb:t.galleryThumb,avatarImage:t.avatarImage,backgroundImage:t.backgroundImage,foregroundImage:t.foregroundImage,fallbackImage:t.fallbackImage});if(!r)return e.replaceChildren(),null;let i=document.createElement(`div`);i.className=`liforma-et${r.backgroundImage?` liforma-et--scene`:``} liforma-et--revealed`,i.setAttribute(`aria-hidden`,`true`);let a=document.createElement(`span`);a.className=`liforma-et__placeholder`,a.setAttribute(`aria-hidden`,`true`),i.append(a);let o=e=>{e.classList.add(`liforma-et__media--ready`)};if(r.backgroundImage){let e=document.createElement(`img`);e.className=`liforma-et__background liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=r.backgroundImage,e.addEventListener(`load`,()=>o(e),{once:!0}),i.append(e)}let s=document.createElement(`img`);if(s.className=`liforma-et__avatar liforma-et__media`,s.alt=``,s.decoding=`async`,s.src=r.avatarImage,s.addEventListener(`load`,()=>o(s),{once:!0}),s.addEventListener(`error`,()=>{r.fallbackImage&&(s.src=r.fallbackImage)},{once:!0}),i.append(s),r.foregroundImage){let e=document.createElement(`img`);e.className=`liforma-et__foreground liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=r.foregroundImage,e.addEventListener(`load`,()=>o(e),{once:!0}),i.append(e)}return e.replaceChildren(i),n?.parallax===!1?()=>{}:ws(i)}function ec(e){return e.startButton?{...e.startButton,label:e.startButton.label??e.startButtonLabel??`Tap to talk`,placement:e.startButton.placement??`bottom-center`,variant:e.startButton.variant??`primary`}:{label:e.startButtonLabel??`Tap to talk`,placement:`bottom-center`,variant:`primary`}}function tc(e){let t=!1,n=()=>{t||e()},r=()=>{if(t)return;let e=window.requestIdleCallback;if(typeof e==`function`){let t=e(n,{timeout:3e3});i=()=>{window.cancelIdleCallback?.(t)};return}let r=window.setTimeout(n,1);i=()=>window.clearTimeout(r)},i=null;return document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),()=>{t=!0,window.removeEventListener(`load`,r),i?.()}}function nc(e,t){Ks(Ws);let n=t.experienceId?.trim();if(!n)throw Error(`ExperienceWidget requires experienceId.`);let r=t.prefetch??`onExpand`,i=qs(t.position),a=document.createElement(`div`);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`,Js(t.offset));let o=document.createElement(`button`);o.type=`button`,o.className=`liforma-ew__hit`,o.setAttribute(`aria-label`,t.alt),o.disabled=!0;let s=document.createElement(`div`);s.className=`liforma-ew__face`,o.append(s);let c=document.createElement(`div`);c.className=`liforma-ew__face-status`,c.textContent=`Loading…`,s.append(c);let l=document.createElement(`div`);l.className=`liforma-ew__warm`,l.hidden=!0,l.setAttribute(`aria-hidden`,`true`);let u=document.createElement(`div`);u.className=`liforma-ew__overlay`,u.hidden=!0,u.setAttribute(`role`,`dialog`),u.setAttribute(`aria-modal`,`true`),u.setAttribute(`aria-label`,t.alt);let d=document.createElement(`button`);d.type=`button`,d.className=`liforma-ew__backdrop`,d.setAttribute(`aria-label`,`Close experience`);let f=document.createElement(`div`);f.className=`liforma-ew__panel`;let p=document.createElement(`div`);p.className=`liforma-ew__toolbar`,p.hidden=!0;let m=document.createElement(`span`);m.className=`liforma-ew__drag-grip`,m.setAttribute(`aria-hidden`,`true`);let h=document.createElement(`button`);h.type=`button`,h.className=`liforma-ew__icon-btn liforma-ew__dock-toggle`,h.innerHTML=Zs,h.setAttribute(`aria-label`,`Reduce`);let g=document.createElement(`button`);g.type=`button`,g.className=`liforma-ew__icon-btn liforma-ew__settings`,g.innerHTML=Ys,g.setAttribute(`aria-label`,`Audio settings`),g.setAttribute(`aria-pressed`,`false`);let _=document.createElement(`button`);_.type=`button`,_.className=`liforma-ew__icon-btn liforma-ew__close`,_.innerHTML=Xs,_.setAttribute(`aria-label`,`Close`),p.append(m,h,g,_);let ee=document.createElement(`div`);ee.className=`liforma-ew__stage`;let v=document.createElement(`div`);v.className=`liforma-ew__status`,v.hidden=!0,f.append(ee,v),u.append(d,f),a.append(o,l,u,p),e.replaceChildren(a);let y=null,b=!1,x=!1,te=!1,S=!1,C=!1,w=!1,T=!1,E=0,ne=``,re=null,D=null,O=null,k=null,ie=null,ae=null,oe=null,se=0,ce=0,le=new AbortController,ue=t.parallax!==!1,A=()=>{let e=a.dataset.state;return e===`expanded`||e===`docked`||e===`collapsed`?e:`collapsed`},de=()=>{O!==null&&(clearTimeout(O),O=null)},j=()=>{k!==null&&(clearTimeout(k),k=null),a.classList.remove(`liforma-ew--layout-settling`)},fe=()=>{for(let e of[f,l,p])e.style.removeProperty(`left`),e.style.removeProperty(`top`),e.style.removeProperty(`width`),e.style.removeProperty(`height`),e.style.removeProperty(`right`),e.style.removeProperty(`bottom`);p.classList.remove(`liforma-ew__toolbar--dragging`)},M=(e,t,n,r)=>{let i=i=>{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`};i(f),i(l);let a=p.offsetWidth||120;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`},N=()=>{let e=Us(),t=A();if(!e||t!==`expanded`&&t!==`docked`){h.hidden=!0;return}h.hidden=!1,t===`docked`?(h.innerHTML=Qs,h.setAttribute(`aria-label`,`Maximize`)):(h.innerHTML=Zs,h.setAttribute(`aria-label`,`Reduce`))},P=e=>{let t=Bs(),n=e&&ie!==null&&ae!==null?Hs(ie,ae,t):Vs(t);n=Hs(n.left,n.top,t),ie=n.left,ae=n.top,M(n.left,n.top,t.width,t.height),N()},F=()=>{a.classList.remove(`liforma-ew--session-revealed`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{x||!$(a.dataset.state)||a.classList.add(`liforma-ew--session-revealed`)})})},I=e=>{if(j(),a.classList.remove(`liforma-ew--session-revealed`),a.classList.add(`liforma-ew--layout-settling`),e(),!T){a.classList.remove(`liforma-ew--layout-settling`);return}k=setTimeout(()=>{if(k=null,x||!$(a.dataset.state)){a.classList.remove(`liforma-ew--layout-settling`);return}a.classList.remove(`liforma-ew--layout-settling`),F()},220)},pe=()=>(a.classList.add(`liforma-ew--session-concealing`),a.classList.remove(`liforma-ew--session-revealed`),new Promise(e=>{de(),O=setTimeout(()=>{O=null,a.classList.remove(`liforma-ew--session-concealing`),e()},280)})),me={galleryThumb:t.galleryThumb,avatarImage:t.avatarImage,backgroundImage:t.backgroundImage,foregroundImage:t.foregroundImage,fallbackImage:t.fallbackImage},L=e=>{if(!e){v.hidden=!0,v.textContent=``;return}v.hidden=!1,v.textContent=e},he=e=>{if(!e){c.hidden=!0,c.textContent=``;return}c.hidden=!1,c.textContent=e,s.contains(c)||s.append(c)},ge=()=>{te=!0,o.disabled=!1,he(null),r===`onExpand`&&t.onPrefetchReady?.()},_e=()=>{S=!0,a.dataset.warm=`true`,l.hidden=!1,T||(o.tabIndex=-1,o.setAttribute(`aria-hidden`,`true`)),t.onPrefetchReady?.()},ve=e=>{re?.(),re=null;let t=$s(s,e,{parallax:ue});return t?(re=t,!0):!1},ye=()=>{if(ve(me)){ge();return}he(`Loading…`),Ms(n,{signal:le.signal}).then(e=>{if(!x){if(!ve({galleryThumb:e.galleryThumb}))throw Error(`Experience preview is missing gallery thumb images.`);ge()}}).catch(e=>{if(x||le.signal.aborted)return;let n=e instanceof Error?e:Error(String(e));he(`Preview unavailable`),o.disabled=!0,t.onError?.(n),console.error(`[ExperienceWidget]`,n)})},be=()=>({experienceId:n,...t.sessionEndpoint?{sessionEndpoint:t.sessionEndpoint}:{},...t.language?{language:t.language}:{},...t.mode?{mode:t.mode}:{},...t.speechInputMode?{speechInputMode:t.speechInputMode}:{},...t.speechOnly===void 0?{}:{speechOnly:t.speechOnly},...t.fit?{fit:t.fit}:{},...t.embedBaseUrl?{embedBaseUrl:t.embedBaseUrl}:{},startButton:ec(t)}),R=(e=!0)=>{o.hidden=!0,u.hidden=!1,p.hidden=!1,u.setAttribute(`aria-modal`,`true`),fe(),a.dataset.state=`expanded`,L(null),typeof document<`u`&&(ne=document.body.style.overflow,document.body.style.overflow=`hidden`),N(),e&&t.onExpanded?.()},xe=()=>{o.hidden=!0,u.hidden=!1,p.hidden=!1,u.setAttribute(`aria-modal`,`false`),a.dataset.state=`docked`,L(null),typeof document<`u`&&(document.body.style.overflow=ne),P(!0),N()},Se=e=>{e.on(`started`,()=>{x||(T=!0,a.dataset.live=`true`,L(null),t.onStarted?.(),$(a.dataset.state)&&F())})},Ce=()=>{j(),u.hidden=!0,p.hidden=!0,fe(),a.dataset.state=`collapsed`,a.classList.remove(`liforma-ew--session-revealed`),a.classList.remove(`liforma-ew--session-concealing`),g.setAttribute(`aria-pressed`,`false`),o.hidden=!1,o.tabIndex=0,o.removeAttribute(`aria-hidden`),te&&(o.disabled=!1),L(null),typeof document<`u`&&(document.body.style.overflow=ne),N()},we=()=>{de(),j(),E+=1,b=!1,S=!1,C=!1,w=!1,T=!1;let e=y;y=null,e?.destroy(),ee.replaceChildren(),l.replaceChildren(),l.hidden=!0,delete a.dataset.warm,delete a.dataset.live,a.classList.remove(`liforma-ew--session-revealed`)},z=()=>{if(!x&&$(a.dataset.state)){if(b=!1,y&&w){let e=y;(async()=>{T&&(await pe(),x||y!==e)||(S&&e.setWidgetChrome(`collapsed`),Ce(),T?(a.dataset.live=`true`,o.tabIndex=0,o.removeAttribute(`aria-hidden`),o.disabled=!1):S&&_e(),t.onCollapsed?.(),t.onClose?.())})();return}we(),Ce(),t.onCollapsed?.(),t.onClose?.()}},Te=()=>{x||Us()&&A()===`expanded`&&I(()=>{xe()})},Ee=()=>{x||A()===`docked`&&I(()=>{fe(),R(!1),y?.setWidgetChrome(`expanded`)})},De=()=>{!y||!T||(de(),a.classList.remove(`liforma-ew--session-revealed`),R(),y.setWidgetChrome(`expanded`),b=!1,F())},Oe=()=>{!y||!w||T||(de(),a.classList.remove(`liforma-ew--session-revealed`),R(),b=!1,S&&y.setWidgetChrome(`expanded`))},ke=e=>{x||e!==E&&!T||(de(),a.classList.remove(`liforma-ew--session-revealed`),R(),b=!1,y?.setWidgetChrome(`expanded`),T&&F())},Ae=()=>{if(x||C||S||y||$(a.dataset.state))return;C=!0;let e=E;l.hidden=!1,(async()=>{try{let t=await Uo.startSession({...be(),ui:`widget`});if(x||e!==E){t.destroy();return}y=t,Se(t);let n=await t.attach({container:l,onWidgetReady:()=>{x||e!==E||(C=!1,w=!0,_e())},onWidgetExpand:()=>{ke(e)},onWidgetAudioSettings:e=>{x||Pe(e)},onStateUpdate:e=>{x||e===`error`&&$(a.dataset.state)&&L(`Could not load the experience.`)}});if(x||e!==E){t.destroy(),y===t&&(y=null);return}w=!0,n.on(`close`,()=>{x||z()})}catch(n){if(x||e!==E)return;C=!1,l.hidden=!0,l.replaceChildren(),y=null;let r=n instanceof Error?n:Error(String(n));t.onError?.(r),console.error(`[ExperienceWidget] warm prefetch failed`,r)}})()},je=()=>{if(x||b||!te||$(a.dataset.state))return;if(y&&T){De();return}if(y&&w){Oe();return}let e=++E;b=!0,S=!1,C=!1,w=!1,T=!1,delete a.dataset.warm,delete a.dataset.live,l.hidden=!0,l.replaceChildren(),y&&=(y.destroy(),null),(async()=>{try{R();let t=await Uo.startSession(be());if(x||e!==E){t.destroy();return}y=t,Se(t);let n=await t.attach({container:ee,onWidgetAudioSettings:e=>{x||Pe(e)},onStateUpdate:e=>{x||(e===`error`?L(`Could not load the experience.`):$(a.dataset.state)&&L(null))}});if(x||e!==E){t.destroy(),y===t&&(y=null);return}w=!0,n.on(`close`,()=>{x||z()})}catch(n){if(x||e!==E)return;let r=n instanceof Error?n:Error(String(n));L(r.message),t.onError?.(r),console.error(`[ExperienceWidget]`,r)}finally{e===E&&(b=!1)}})()},Me=()=>{if(!(x||$(a.dataset.state))){if(y&&T){De();return}if(y&&w){Oe();return}je()}},Ne=e=>{if(e.stopPropagation(),A()===`expanded`){Te();return}A()===`docked`&&Ee()},Pe=e=>{g.setAttribute(`aria-pressed`,e?`true`:`false`)},Fe=e=>{e.stopPropagation(),$(a.dataset.state)&&y?.toggleAudioSettings()},Ie=e=>{if(A()!==`docked`||!Us()||e.target?.closest(`button`))return;e.preventDefault(),oe=e.pointerId,p.classList.add(`liforma-ew__toolbar--dragging`),p.setPointerCapture(e.pointerId);let t=f.getBoundingClientRect();se=e.clientX-t.left,ce=e.clientY-t.top},Le=e=>{if(oe===null||e.pointerId!==oe||A()!==`docked`)return;let t=Bs(),n=Hs(e.clientX-se,e.clientY-ce,t);ie=n.left,ae=n.top,M(n.left,n.top,t.width,t.height)},Re=e=>{if(!(oe===null||e.pointerId!==oe)){oe=null,p.classList.remove(`liforma-ew__toolbar--dragging`);try{p.releasePointerCapture(e.pointerId)}catch{}}},ze=e=>{e.key===`Escape`&&$(a.dataset.state)&&(e.preventDefault(),z())},Be=()=>{if(!x){if(A()===`docked`){if(!Us()){Ee();return}T?I(()=>{P(!0)}):P(!0);return}N()}},Ve=typeof window<`u`?window.matchMedia(Ns):null,He=()=>{if(!x){if(A()===`docked`&&!Us()){Ee();return}N()}};return o.addEventListener(`click`,Me),d.addEventListener(`click`,z),_.addEventListener(`click`,e=>{e.stopPropagation(),z()}),h.addEventListener(`click`,Ne),g.addEventListener(`click`,Fe),p.addEventListener(`pointerdown`,Ie),p.addEventListener(`pointermove`,Le),p.addEventListener(`pointerup`,Re),p.addEventListener(`pointercancel`,Re),window.addEventListener(`keydown`,ze),window.addEventListener(`resize`,Be),Ve?.addEventListener(`change`,He),ye(),N(),r===`eager`?queueMicrotask(()=>{x||Ae()}):r===`idle`&&(D=tc(()=>{x||Ae()})),{root:a,expand:Me,collapse:z,dock:Te,maximize:Ee,prefetch(){if(r===`onExpand`){Ae();return}Ae()},destroy(){x||(x=!0,D?.(),D=null,le.abort(),re?.(),re=null,window.removeEventListener(`keydown`,ze),window.removeEventListener(`resize`,Be),Ve?.removeEventListener(`change`,He),we(),Ce(),e.replaceChildren())}}}var rc=`liforma-experience-widget`;function ic(e){if(e?.trim())try{let t=JSON.parse(e);if(t&&typeof t==`object`&&typeof t.avatarImage==`string`)return t}catch{}}function ac(e){let t=e?.trim();return t===`conversation`||t===`presenter`?t:void 0}function oc(e){let t=e?.trim();return t===`auto`||t===`manual`||t===`off`?t:void 0}function sc(e){let t=e?.trim();return t===`full`||t===`face`?t:void 0}function cc(e){let t=e?.trim();return t===`en`||t===`es`?t:void 0}function lc(e){let t=e?.trim();return t===`bottom-right`||t===`bottom-left`?t:`static`}var uc=class extends HTMLElement{static get observedAttributes(){return[`experience-id`,`alt`,`gallery-thumb`,`avatar-image`,`background-image`,`foreground-image`,`fallback-image`,`prefetch`,`parallax`,`position`,`offset`,`session-endpoint`,`language`,`mode`,`speech-input-mode`,`speech-only`,`fit`,`expanded-max-width`,`expanded-max-height`,`start-button-label`]}#e=null;#t=null;connectedCallback(){this.#n(),this.#r()}disconnectedCallback(){this.#e?.destroy(),this.#e=null}attributeChangedCallback(){this.isConnected&&(this.#n(),this.#r())}#n(){if(lc(this.getAttribute(`position`))!==`static`){this.style.display=`contents`,this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`min-height`);return}if(this.style.display=`block`,this.style.width||=`100%`,this.style.height||=`100%`,!this.style.minHeight){let e=getComputedStyle(this).minHeight;(e===`0px`||e===`auto`)&&(this.style.minHeight=`224px`)}}#r(){this.#e?.destroy(),this.#e=null;let e=this.getAttribute(`experience-id`)?.trim(),t=this.getAttribute(`alt`)?.trim()||`Open experience`;if(!e)return;let n=lc(this.getAttribute(`position`));this.#t||(this.#t=document.createElement(`div`),this.replaceChildren(this.#t)),this.#t.style.cssText=n===`static`?`width:100%;height:100%;min-height:inherit;`:`display:contents;`;let r=this.getAttribute(`prefetch`)?.trim(),i=r===`idle`||r===`eager`||r===`onExpand`?r:`onExpand`,a=this.getAttribute(`speech-only`),o=this.getAttribute(`offset`);try{this.#e=nc(this.#t,{experienceId:e,alt:t,galleryThumb:ic(this.getAttribute(`gallery-thumb`)),avatarImage:this.getAttribute(`avatar-image`)??void 0,backgroundImage:this.getAttribute(`background-image`)??void 0,foregroundImage:this.getAttribute(`foreground-image`)??void 0,fallbackImage:this.getAttribute(`fallback-image`)??void 0,prefetch:i,parallax:this.getAttribute(`parallax`)!==`false`,position:n,offset:o===null?void 0:o,sessionEndpoint:this.getAttribute(`session-endpoint`)??void 0,language:cc(this.getAttribute(`language`)),mode:ac(this.getAttribute(`mode`)),speechInputMode:oc(this.getAttribute(`speech-input-mode`)),speechOnly:a===null?void 0:a===``||a===`true`,fit:sc(this.getAttribute(`fit`)),expandedMaxWidth:this.getAttribute(`expanded-max-width`)??void 0,expandedMaxHeight:this.getAttribute(`expanded-max-height`)??void 0,startButtonLabel:this.getAttribute(`start-button-label`)??void 0,onExpanded:()=>{this.dispatchEvent(new CustomEvent(`expanded`,{bubbles:!0}))},onCollapsed:()=>{this.dispatchEvent(new CustomEvent(`collapsed`,{bubbles:!0}))},onStarted:()=>{this.dispatchEvent(new CustomEvent(`started`,{bubbles:!0}))},onClose:()=>{this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0}))},onError:e=>{this.dispatchEvent(new CustomEvent(`error`,{detail:e,bubbles:!0}))}})}catch(e){console.error(`[liforma-experience-widget]`,e)}}};return typeof customElements<`u`&&!customElements.get(rc)&&customElements.define(rc,uc),window.Liforma={Experience:Uo,sdkVersion:`v2`,features:{speakApi:!0}},e.Experience=Uo,e})({});
|
|
806
|
+
//# sourceMappingURL=client.js.map
|