@modelcontextprotocol/ext-apps 0.0.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/src/app-bridge.d.ts +341 -26
- package/dist/src/app-bridge.js +38 -25
- package/dist/src/app.d.ts +141 -10
- package/dist/src/app.js +38 -25
- package/dist/src/generated/schema.d.ts +708 -0
- package/dist/src/generated/schema.test.d.ts +33 -0
- package/dist/src/react/index.d.ts +4 -0
- package/dist/src/react/index.js +38 -25
- package/dist/src/react/useDocumentTheme.d.ts +46 -0
- package/dist/src/react/useHostStyles.d.ts +56 -0
- package/dist/src/server/index.d.ts +109 -0
- package/dist/src/server/index.js +42 -0
- package/dist/src/server/index.test.d.ts +1 -0
- package/dist/src/spec.types.d.ts +412 -0
- package/dist/src/styles.d.ts +89 -0
- package/dist/src/types.d.ts +28 -836
- package/package.json +55 -16
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { McpUiTheme } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* React hook that provides the current document theme reactively.
|
|
4
|
+
*
|
|
5
|
+
* Uses a MutationObserver to watch for changes to the `data-theme` attribute
|
|
6
|
+
* or `class` on `document.documentElement`. When the theme changes (e.g., from
|
|
7
|
+
* host context updates), the hook automatically re-renders your component with
|
|
8
|
+
* the new theme value.
|
|
9
|
+
*
|
|
10
|
+
* @returns The current theme ("light" or "dark")
|
|
11
|
+
*
|
|
12
|
+
* @example Conditionally render based on theme
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { useDocumentTheme } from '@modelcontextprotocol/ext-apps/react';
|
|
15
|
+
*
|
|
16
|
+
* function MyApp() {
|
|
17
|
+
* const theme = useDocumentTheme();
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {theme === 'dark' ? <DarkIcon /> : <LightIcon />}
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Use with theme-aware styling
|
|
28
|
+
* ```tsx
|
|
29
|
+
* function ThemedButton() {
|
|
30
|
+
* const theme = useDocumentTheme();
|
|
31
|
+
*
|
|
32
|
+
* return (
|
|
33
|
+
* <button style={{
|
|
34
|
+
* background: theme === 'dark' ? '#333' : '#fff',
|
|
35
|
+
* color: theme === 'dark' ? '#fff' : '#333',
|
|
36
|
+
* }}>
|
|
37
|
+
* Click me
|
|
38
|
+
* </button>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @see {@link getDocumentTheme} for the underlying function
|
|
44
|
+
* @see {@link applyDocumentTheme} to set the theme
|
|
45
|
+
*/
|
|
46
|
+
export declare function useDocumentTheme(): McpUiTheme;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { App } from "../app";
|
|
2
|
+
import { McpUiHostContext } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* React hook that applies host style variables and theme as CSS custom properties.
|
|
5
|
+
*
|
|
6
|
+
* This hook listens to host context changes and automatically applies:
|
|
7
|
+
* - `styles.variables` CSS variables to `document.documentElement` (e.g., `--color-background-primary`)
|
|
8
|
+
* - `theme` via `color-scheme` CSS property, enabling `light-dark()` CSS function support
|
|
9
|
+
*
|
|
10
|
+
* The hook also applies styles and theme from the initial host context when
|
|
11
|
+
* the app first connects.
|
|
12
|
+
*
|
|
13
|
+
* **Note:** If the host provides style values using CSS `light-dark()` function,
|
|
14
|
+
* this hook ensures they work correctly by setting the `color-scheme` property
|
|
15
|
+
* based on the host's theme preference.
|
|
16
|
+
*
|
|
17
|
+
* @param app - The connected App instance, or null during initialization
|
|
18
|
+
* @param initialContext - Initial host context from the connection (optional).
|
|
19
|
+
* If provided, styles and theme will be applied immediately on mount.
|
|
20
|
+
*
|
|
21
|
+
* @example Basic usage with useApp
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { useApp } from '@modelcontextprotocol/ext-apps/react';
|
|
24
|
+
* import { useHostStyleVariables } from '@modelcontextprotocol/ext-apps/react';
|
|
25
|
+
*
|
|
26
|
+
* function MyApp() {
|
|
27
|
+
* const { app, isConnected } = useApp({
|
|
28
|
+
* appInfo: { name: "MyApp", version: "1.0.0" },
|
|
29
|
+
* capabilities: {},
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Automatically apply host style variables and theme
|
|
33
|
+
* useHostStyleVariables(app);
|
|
34
|
+
*
|
|
35
|
+
* return (
|
|
36
|
+
* <div style={{ background: 'var(--color-background-primary)' }}>
|
|
37
|
+
* Hello!
|
|
38
|
+
* </div>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example With initial context
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const [hostContext, setHostContext] = useState<McpUiHostContext | null>(null);
|
|
46
|
+
*
|
|
47
|
+
* // ... get initial context from app.connect() result
|
|
48
|
+
*
|
|
49
|
+
* useHostStyleVariables(app, hostContext);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see {@link applyHostStyleVariables} for the underlying styles function
|
|
53
|
+
* @see {@link applyDocumentTheme} for the underlying theme function
|
|
54
|
+
* @see {@link McpUiStyles} for available CSS variables
|
|
55
|
+
*/
|
|
56
|
+
export declare function useHostStyleVariables(app: App | null, initialContext?: McpUiHostContext | null): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Helpers for MCP Apps.
|
|
3
|
+
*
|
|
4
|
+
* @module server-helpers
|
|
5
|
+
*/
|
|
6
|
+
import { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE, McpUiResourceMeta, McpUiToolMeta } from "../app.js";
|
|
7
|
+
import type { McpServer, ResourceMetadata, ToolCallback, ReadResourceCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
9
|
+
import type { ZodRawShape } from "zod";
|
|
10
|
+
export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE };
|
|
11
|
+
export type { ResourceMetadata, ToolCallback, ReadResourceCallback };
|
|
12
|
+
/**
|
|
13
|
+
* Tool configuration (same as McpServer.registerTool).
|
|
14
|
+
*/
|
|
15
|
+
export interface ToolConfig {
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
inputSchema?: ZodRawShape;
|
|
19
|
+
annotations?: ToolAnnotations;
|
|
20
|
+
_meta?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* MCP App Tool configuration for `registerAppTool`.
|
|
24
|
+
*/
|
|
25
|
+
export interface McpUiAppToolConfig extends ToolConfig {
|
|
26
|
+
_meta: {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
} & ({
|
|
29
|
+
ui: McpUiToolMeta;
|
|
30
|
+
} | {
|
|
31
|
+
/**
|
|
32
|
+
* URI of the UI resource to display for this tool.
|
|
33
|
+
* This is converted to `_meta["ui/resourceUri"]`.
|
|
34
|
+
*
|
|
35
|
+
* @example "ui://weather/widget.html"
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Use `_meta.ui.resourceUri` instead.
|
|
38
|
+
*/
|
|
39
|
+
[RESOURCE_URI_META_KEY]?: string;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* MCP App Resource configuration for `registerAppResource`.
|
|
44
|
+
*/
|
|
45
|
+
export interface McpUiAppResourceConfig extends ResourceMetadata {
|
|
46
|
+
_meta: {
|
|
47
|
+
ui: McpUiResourceMeta;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Register an app tool with the MCP server.
|
|
53
|
+
*
|
|
54
|
+
* This is a convenience wrapper around `server.registerTool` that will allow more backwards-compatibility.
|
|
55
|
+
*
|
|
56
|
+
* @param server - The MCP server instance
|
|
57
|
+
* @param name - Tool name/identifier
|
|
58
|
+
* @param config - Tool configuration with required `ui` field
|
|
59
|
+
* @param handler - Tool handler function
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
|
|
64
|
+
* import { z } from 'zod';
|
|
65
|
+
*
|
|
66
|
+
* registerAppTool(server, "get-weather", {
|
|
67
|
+
* title: "Get Weather",
|
|
68
|
+
* description: "Get current weather for a location",
|
|
69
|
+
* inputSchema: { location: z.string() },
|
|
70
|
+
* _meta: {
|
|
71
|
+
* [RESOURCE_URI_META_KEY]: "ui://weather/widget.html",
|
|
72
|
+
* },
|
|
73
|
+
* }, async (args) => {
|
|
74
|
+
* const weather = await fetchWeather(args.location);
|
|
75
|
+
* return { content: [{ type: "text", text: JSON.stringify(weather) }] };
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function registerAppTool(server: Pick<McpServer, "registerTool">, name: string, config: McpUiAppToolConfig, handler: ToolCallback<ZodRawShape>): void;
|
|
80
|
+
/**
|
|
81
|
+
* Register an app resource with the MCP server.
|
|
82
|
+
*
|
|
83
|
+
* This is a convenience wrapper around `server.registerResource` that:
|
|
84
|
+
* - Defaults the MIME type to "text/html;profile=mcp-app"
|
|
85
|
+
* - Provides a cleaner API matching the SDK's callback signature
|
|
86
|
+
*
|
|
87
|
+
* @param server - The MCP server instance
|
|
88
|
+
* @param name - Human-readable resource name
|
|
89
|
+
* @param uri - Resource URI (should match the `ui` field in tool config)
|
|
90
|
+
* @param config - Resource configuration
|
|
91
|
+
* @param readCallback - Callback that returns the resource contents
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { registerAppResource } from '@modelcontextprotocol/ext-apps/server';
|
|
96
|
+
*
|
|
97
|
+
* registerAppResource(server, "Weather Widget", "ui://weather/widget.html", {
|
|
98
|
+
* description: "Interactive weather display",
|
|
99
|
+
* mimeType: RESOURCE_MIME_TYPE,
|
|
100
|
+
* }, async () => ({
|
|
101
|
+
* contents: [{
|
|
102
|
+
* uri: "ui://weather/widget.html",
|
|
103
|
+
* mimeType: RESOURCE_MIME_TYPE,
|
|
104
|
+
* text: await fs.readFile("dist/widget.html", "utf-8"),
|
|
105
|
+
* }],
|
|
106
|
+
* }));
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function registerAppResource(server: Pick<McpServer, "registerResource">, name: string, uri: string, config: McpUiAppResourceConfig, readCallback: ReadResourceCallback): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var Z3=Object.defineProperty;var j3=(Q,X)=>{for(var W in X)Z3(Q,W,{get:X[W],enumerable:!0,configurable:!0,set:(Y)=>X[W]=()=>Y})};import{Protocol as hX}from"@modelcontextprotocol/sdk/shared/protocol.js";import{CallToolRequestSchema as xX,CallToolResultSchema as uX,ListToolsRequestSchema as cX,PingRequestSchema as yX}from"@modelcontextprotocol/sdk/types.js";import{JSONRPCMessageSchema as C3}from"@modelcontextprotocol/sdk/types.js";class OQ{eventTarget;eventSource;messageListener;constructor(Q=window.parent,X){this.eventTarget=Q;this.eventSource=X;this.messageListener=(W)=>{if(X&&W.source!==this.eventSource){console.error("Ignoring message from unknown source",W);return}let Y=C3.safeParse(W.data);if(Y.success)console.debug("Parsed message",Y.data),this.onmessage?.(Y.data);else console.error("Failed to parse message",Y.error.message,W),this.onerror?.(Error("Invalid JSON-RPC message received: "+Y.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(Q,X){console.debug("Sending message",Q),this.eventTarget.postMessage(Q,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var gQ="2025-11-21";var iX=Object.freeze({status:"aborted"});function w(Q,X,W){function Y(K,A){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:A,constr:q,traits:new Set},enumerable:!1});if(K._zod.traits.has(Q))return;K._zod.traits.add(Q),X(K,A);let L=q.prototype,N=Object.keys(L);for(let O=0;O<N.length;O++){let E=N[O];if(!(E in K))K[E]=L[E].bind(K)}}let G=W?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:Q});function q(K){var A;let L=W?.Parent?new J:this;Y(L,K),(A=L._zod).deferred??(A.deferred=[]);for(let N of L._zod.deferred)N();return L}return Object.defineProperty(q,"init",{value:Y}),Object.defineProperty(q,Symbol.hasInstance,{value:(K)=>{if(W?.Parent&&K instanceof W.Parent)return!0;return K?._zod?.traits?.has(Q)}}),Object.defineProperty(q,"name",{value:Q}),q}var nX=Symbol("zod_brand");class h extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class XQ extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var EQ={};function v(Q){if(Q)Object.assign(EQ,Q);return EQ}var D={};j3(D,{unwrapMessage:()=>WQ,uint8ArrayToHex:()=>G9,uint8ArrayToBase64url:()=>W9,uint8ArrayToBase64:()=>k0,stringifyPrimitive:()=>b0,slugify:()=>uQ,shallowClone:()=>_0,safeExtend:()=>e3,required:()=>s3,randomString:()=>o3,propertyKeyTypes:()=>yQ,promiseAllObject:()=>f3,primitiveTypes:()=>T0,prefixIssues:()=>u,pick:()=>d3,partial:()=>a3,optionalKeys:()=>mQ,omit:()=>i3,objectClone:()=>c3,numKeys:()=>r3,nullish:()=>JQ,normalizeParams:()=>B,mergeDefs:()=>f,merge:()=>t3,jsonStringifyReplacer:()=>e,joinValues:()=>u3,issue:()=>t,isPlainObject:()=>o,isObject:()=>n,hexToUint8Array:()=>Y9,getSizableOrigin:()=>j0,getParsedType:()=>l3,getLengthableOrigin:()=>KQ,getEnumValues:()=>YQ,getElementAtPath:()=>m3,floatSafeRemainder:()=>xQ,finalizeIssue:()=>j,extend:()=>n3,escapeRegex:()=>x,esc:()=>DQ,defineLazy:()=>F,createTransparentProxy:()=>p3,cloneDef:()=>y3,clone:()=>Z,cleanRegex:()=>qQ,cleanEnum:()=>Q9,captureStackTrace:()=>FQ,cached:()=>GQ,base64urlToUint8Array:()=>X9,base64ToUint8Array:()=>C0,assignProp:()=>m,assertNotEqual:()=>v3,assertNever:()=>h3,assertIs:()=>g3,assertEqual:()=>k3,assert:()=>x3,allowsEval:()=>cQ,aborted:()=>r,NUMBER_FORMAT_RANGES:()=>fQ,Class:()=>v0,BIGINT_FORMAT_RANGES:()=>Z0});function k3(Q){return Q}function v3(Q){return Q}function g3(Q){}function h3(Q){throw Error("Unexpected value in exhaustive check")}function x3(Q){}function YQ(Q){let X=Object.values(Q).filter((Y)=>typeof Y==="number");return Object.entries(Q).filter(([Y,G])=>X.indexOf(+Y)===-1).map(([Y,G])=>G)}function u3(Q,X="|"){return Q.map((W)=>b0(W)).join(X)}function e(Q,X){if(typeof X==="bigint")return X.toString();return X}function GQ(Q){return{get value(){{let W=Q();return Object.defineProperty(this,"value",{value:W}),W}throw Error("cached value already set")}}}function JQ(Q){return Q===null||Q===void 0}function qQ(Q){let X=Q.startsWith("^")?1:0,W=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,W)}function xQ(Q,X){let W=(Q.toString().split(".")[1]||"").length,Y=X.toString(),G=(Y.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(Y)){let A=Y.match(/\d?e-(\d?)/);if(A?.[1])G=Number.parseInt(A[1])}let J=W>G?W:G,q=Number.parseInt(Q.toFixed(J).replace(".","")),K=Number.parseInt(X.toFixed(J).replace(".",""));return q%K/10**J}var S0=Symbol("evaluating");function F(Q,X,W){let Y=void 0;Object.defineProperty(Q,X,{get(){if(Y===S0)return;if(Y===void 0)Y=S0,Y=W();return Y},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function c3(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function m(Q,X,W){Object.defineProperty(Q,X,{value:W,writable:!0,enumerable:!0,configurable:!0})}function f(...Q){let X={};for(let W of Q){let Y=Object.getOwnPropertyDescriptors(W);Object.assign(X,Y)}return Object.defineProperties({},X)}function y3(Q){return f(Q._zod.def)}function m3(Q,X){if(!X)return Q;return X.reduce((W,Y)=>W?.[Y],Q)}function f3(Q){let X=Object.keys(Q),W=X.map((Y)=>Q[Y]);return Promise.all(W).then((Y)=>{let G={};for(let J=0;J<X.length;J++)G[X[J]]=Y[J];return G})}function o3(Q=10){let W="";for(let Y=0;Y<Q;Y++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function DQ(Q){return JSON.stringify(Q)}function uQ(Q){return Q.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var FQ="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function n(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var cQ=GQ(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function o(Q){if(n(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let W=X.prototype;if(n(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function _0(Q){if(o(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function r3(Q){let X=0;for(let W in Q)if(Object.prototype.hasOwnProperty.call(Q,W))X++;return X}var l3=(Q)=>{let X=typeof Q;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(Q)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return"promise";if(typeof Map<"u"&&Q instanceof Map)return"map";if(typeof Set<"u"&&Q instanceof Set)return"set";if(typeof Date<"u"&&Q instanceof Date)return"date";if(typeof File<"u"&&Q instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},yQ=new Set(["string","number","symbol"]),T0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function x(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(Q,X,W){let Y=new Q._zod.constr(X??Q._zod.def);if(!X||W?.parent)Y._zod.parent=Q;return Y}function B(Q){let X=Q;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function p3(Q){let X;return new Proxy({},{get(W,Y,G){return X??(X=Q()),Reflect.get(X,Y,G)},set(W,Y,G,J){return X??(X=Q()),Reflect.set(X,Y,G,J)},has(W,Y){return X??(X=Q()),Reflect.has(X,Y)},deleteProperty(W,Y){return X??(X=Q()),Reflect.deleteProperty(X,Y)},ownKeys(W){return X??(X=Q()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(W,Y){return X??(X=Q()),Reflect.getOwnPropertyDescriptor(X,Y)},defineProperty(W,Y,G){return X??(X=Q()),Reflect.defineProperty(X,Y,G)}})}function b0(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function mQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var fQ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Z0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function d3(Q,X){let W=Q._zod.def,Y=f(Q._zod.def,{get shape(){let G={};for(let J in X){if(!(J in W.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;G[J]=W.shape[J]}return m(this,"shape",G),G},checks:[]});return Z(Q,Y)}function i3(Q,X){let W=Q._zod.def,Y=f(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let J in X){if(!(J in W.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;delete G[J]}return m(this,"shape",G),G},checks:[]});return Z(Q,Y)}function n3(Q,X){if(!o(X))throw Error("Invalid input to extend: expected a plain object");let W=Q._zod.def.checks;if(W&&W.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=f(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return m(this,"shape",J),J},checks:[]});return Z(Q,G)}function e3(Q,X){if(!o(X))throw Error("Invalid input to safeExtend: expected a plain object");let W={...Q._zod.def,get shape(){let Y={...Q._zod.def.shape,...X};return m(this,"shape",Y),Y},checks:Q._zod.def.checks};return Z(Q,W)}function t3(Q,X){let W=f(Q._zod.def,{get shape(){let Y={...Q._zod.def.shape,...X._zod.def.shape};return m(this,"shape",Y),Y},get catchall(){return X._zod.def.catchall},checks:[]});return Z(Q,W)}function a3(Q,X,W){let Y=f(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(W)for(let q in W){if(!(q in G))throw Error(`Unrecognized key: "${q}"`);if(!W[q])continue;J[q]=Q?new Q({type:"optional",innerType:G[q]}):G[q]}else for(let q in G)J[q]=Q?new Q({type:"optional",innerType:G[q]}):G[q];return m(this,"shape",J),J},checks:[]});return Z(X,Y)}function s3(Q,X,W){let Y=f(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(W)for(let q in W){if(!(q in J))throw Error(`Unrecognized key: "${q}"`);if(!W[q])continue;J[q]=new Q({type:"nonoptional",innerType:G[q]})}else for(let q in G)J[q]=new Q({type:"nonoptional",innerType:G[q]});return m(this,"shape",J),J},checks:[]});return Z(X,Y)}function r(Q,X=0){if(Q.aborted===!0)return!0;for(let W=X;W<Q.issues.length;W++)if(Q.issues[W]?.continue!==!0)return!0;return!1}function u(Q,X){return X.map((W)=>{var Y;return(Y=W).path??(Y.path=[]),W.path.unshift(Q),W})}function WQ(Q){return typeof Q==="string"?Q:Q?.message}function j(Q,X,W){let Y={...Q,path:Q.path??[]};if(!Q.message){let G=WQ(Q.inst?._zod.def?.error?.(Q))??WQ(X?.error?.(Q))??WQ(W.customError?.(Q))??WQ(W.localeError?.(Q))??"Invalid input";Y.message=G}if(delete Y.inst,delete Y.continue,!X?.reportInput)delete Y.input;return Y}function j0(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function KQ(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function t(...Q){let[X,W,Y]=Q;if(typeof X==="string")return{message:X,code:"custom",input:W,inst:Y};return{...X}}function Q9(Q){return Object.entries(Q).filter(([X,W])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function C0(Q){let X=atob(Q),W=new Uint8Array(X.length);for(let Y=0;Y<X.length;Y++)W[Y]=X.charCodeAt(Y);return W}function k0(Q){let X="";for(let W=0;W<Q.length;W++)X+=String.fromCharCode(Q[W]);return btoa(X)}function X9(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),W="=".repeat((4-X.length%4)%4);return C0(X+W)}function W9(Q){return k0(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Y9(Q){let X=Q.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let W=new Uint8Array(X.length/2);for(let Y=0;Y<X.length;Y+=2)W[Y/2]=Number.parseInt(X.slice(Y,Y+2),16);return W}function G9(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class v0{constructor(...Q){}}var g0=(Q,X)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:X,enumerable:!1}),Q.message=JSON.stringify(X,e,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},IQ=w("$ZodError",g0),oQ=w("$ZodError",g0,{Parent:Error});function h0(Q,X=(W)=>W.message){let W={},Y=[];for(let G of Q.issues)if(G.path.length>0)W[G.path[0]]=W[G.path[0]]||[],W[G.path[0]].push(X(G));else Y.push(X(G));return{formErrors:Y,fieldErrors:W}}function x0(Q,X=(W)=>W.message){let W={_errors:[]},Y=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((q)=>Y({issues:q}));else if(J.code==="invalid_key")Y({issues:J.issues});else if(J.code==="invalid_element")Y({issues:J.issues});else if(J.path.length===0)W._errors.push(X(J));else{let q=W,K=0;while(K<J.path.length){let A=J.path[K];if(K!==J.path.length-1)q[A]=q[A]||{_errors:[]};else q[A]=q[A]||{_errors:[]},q[A]._errors.push(X(J));q=q[A],K++}}};return Y(Q),W}var VQ=(Q)=>(X,W,Y,G)=>{let J=Y?Object.assign(Y,{async:!1}):{async:!1},q=X._zod.run({value:W,issues:[]},J);if(q instanceof Promise)throw new h;if(q.issues.length){let K=new(G?.Err??Q)(q.issues.map((A)=>j(A,J,v())));throw FQ(K,G?.callee),K}return q.value};var MQ=(Q)=>async(X,W,Y,G)=>{let J=Y?Object.assign(Y,{async:!0}):{async:!0},q=X._zod.run({value:W,issues:[]},J);if(q instanceof Promise)q=await q;if(q.issues.length){let K=new(G?.Err??Q)(q.issues.map((A)=>j(A,J,v())));throw FQ(K,G?.callee),K}return q.value};var wQ=(Q)=>(X,W,Y)=>{let G=Y?{...Y,async:!1}:{async:!1},J=X._zod.run({value:W,issues:[]},G);if(J instanceof Promise)throw new h;return J.issues.length?{success:!1,error:new(Q??IQ)(J.issues.map((q)=>j(q,G,v())))}:{success:!0,data:J.value}},u0=wQ(oQ),AQ=(Q)=>async(X,W,Y)=>{let G=Y?Object.assign(Y,{async:!0}):{async:!0},J=X._zod.run({value:W,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map((q)=>j(q,G,v())))}:{success:!0,data:J.value}},c0=AQ(oQ),y0=(Q)=>(X,W,Y)=>{let G=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return VQ(Q)(X,W,G)};var m0=(Q)=>(X,W,Y)=>{return VQ(Q)(X,W,Y)};var f0=(Q)=>async(X,W,Y)=>{let G=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return MQ(Q)(X,W,G)};var o0=(Q)=>async(X,W,Y)=>{return MQ(Q)(X,W,Y)};var r0=(Q)=>(X,W,Y)=>{let G=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return wQ(Q)(X,W,G)};var l0=(Q)=>(X,W,Y)=>{return wQ(Q)(X,W,Y)};var p0=(Q)=>async(X,W,Y)=>{let G=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return AQ(Q)(X,W,G)};var d0=(Q)=>async(X,W,Y)=>{return AQ(Q)(X,W,Y)};var i0=/^[cC][^\s-]{8,}$/,n0=/^[0-9a-z]+$/,e0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,t0=/^[0-9a-vA-V]{20}$/,a0=/^[A-Za-z0-9]{27}$/,s0=/^[a-zA-Z0-9_-]{21}$/,Q1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var X1=/^([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})$/,rQ=(Q)=>{if(!Q)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${Q}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var W1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var q9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Y1(){return new RegExp(q9,"u")}var G1=/^(?:(?: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])$/,J1=/^(([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}|:))$/;var q1=/^((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])$/,K1=/^(([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])$/,w1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lQ=/^[A-Za-z0-9_-]*$/;var A1=/^\+(?:[0-9]){6,14}[0-9]$/,L1="(?:(?:\\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])))",H1=new RegExp(`^${L1}$`);function N1(Q){return typeof Q.precision==="number"?Q.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":Q.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${Q.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function B1(Q){return new RegExp(`^${N1(Q)}$`)}function z1(Q){let X=N1({precision:Q.precision}),W=["Z"];if(Q.local)W.push("");if(Q.offset)W.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Y=`${X}(?:${W.join("|")})`;return new RegExp(`^${L1}T(?:${Y})$`)}var O1=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var E1=/^-?\d+$/,D1=/^-?\d+(?:\.\d+)?/,F1=/^(?:true|false)$/i;var I1=/^undefined$/i;var V1=/^[^A-Z]*$/,M1=/^[^a-z]*$/;var S=w("$ZodCheck",(Q,X)=>{var W;Q._zod??(Q._zod={}),Q._zod.def=X,(W=Q._zod).onattach??(W.onattach=[])}),$1={number:"number",bigint:"bigint",object:"date"},pQ=w("$ZodCheckLessThan",(Q,X)=>{S.init(Q,X);let W=$1[typeof X.value];Q._zod.onattach.push((Y)=>{let G=Y._zod.bag,J=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<J)if(X.inclusive)G.maximum=X.value;else G.exclusiveMaximum=X.value}),Q._zod.check=(Y)=>{if(X.inclusive?Y.value<=X.value:Y.value<X.value)return;Y.issues.push({origin:W,code:"too_big",maximum:X.value,input:Y.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),dQ=w("$ZodCheckGreaterThan",(Q,X)=>{S.init(Q,X);let W=$1[typeof X.value];Q._zod.onattach.push((Y)=>{let G=Y._zod.bag,J=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>J)if(X.inclusive)G.minimum=X.value;else G.exclusiveMinimum=X.value}),Q._zod.check=(Y)=>{if(X.inclusive?Y.value>=X.value:Y.value>X.value)return;Y.issues.push({origin:W,code:"too_small",minimum:X.value,input:Y.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),P1=w("$ZodCheckMultipleOf",(Q,X)=>{S.init(Q,X),Q._zod.onattach.push((W)=>{var Y;(Y=W._zod.bag).multipleOf??(Y.multipleOf=X.value)}),Q._zod.check=(W)=>{if(typeof W.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%X.value===BigInt(0):xQ(W.value,X.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:X.value,input:W.value,inst:Q,continue:!X.abort})}}),U1=w("$ZodCheckNumberFormat",(Q,X)=>{S.init(Q,X),X.format=X.format||"float64";let W=X.format?.includes("int"),Y=W?"int":"number",[G,J]=fQ[X.format];Q._zod.onattach.push((q)=>{let K=q._zod.bag;if(K.format=X.format,K.minimum=G,K.maximum=J,W)K.pattern=E1}),Q._zod.check=(q)=>{let K=q.value;if(W){if(!Number.isInteger(K)){q.issues.push({expected:Y,format:X.format,code:"invalid_type",continue:!1,input:K,inst:Q});return}if(!Number.isSafeInteger(K)){if(K>0)q.issues.push({input:K,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:Y,continue:!X.abort});else q.issues.push({input:K,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:Y,continue:!X.abort});return}}if(K<G)q.issues.push({origin:"number",input:K,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!X.abort});if(K>J)q.issues.push({origin:"number",input:K,code:"too_big",maximum:J,inst:Q})}});var R1=w("$ZodCheckMaxLength",(Q,X)=>{var W;S.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let G=Y.value;return!JQ(G)&&G.length!==void 0}),Q._zod.onattach.push((Y)=>{let G=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)Y._zod.bag.maximum=X.maximum}),Q._zod.check=(Y)=>{let G=Y.value;if(G.length<=X.maximum)return;let q=KQ(G);Y.issues.push({origin:q,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),S1=w("$ZodCheckMinLength",(Q,X)=>{var W;S.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let G=Y.value;return!JQ(G)&&G.length!==void 0}),Q._zod.onattach.push((Y)=>{let G=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)Y._zod.bag.minimum=X.minimum}),Q._zod.check=(Y)=>{let G=Y.value;if(G.length>=X.minimum)return;let q=KQ(G);Y.issues.push({origin:q,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),_1=w("$ZodCheckLengthEquals",(Q,X)=>{var W;S.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let G=Y.value;return!JQ(G)&&G.length!==void 0}),Q._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),Q._zod.check=(Y)=>{let G=Y.value,J=G.length;if(J===X.length)return;let q=KQ(G),K=J>X.length;Y.issues.push({origin:q,...K?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:Y.value,inst:Q,continue:!X.abort})}}),LQ=w("$ZodCheckStringFormat",(Q,X)=>{var W,Y;if(S.init(Q,X),Q._zod.onattach.push((G)=>{let J=G._zod.bag;if(J.format=X.format,X.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(X.pattern)}),X.pattern)(W=Q._zod).check??(W.check=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(Y=Q._zod).check??(Y.check=()=>{})}),T1=w("$ZodCheckRegex",(Q,X)=>{LQ.init(Q,X),Q._zod.check=(W)=>{if(X.pattern.lastIndex=0,X.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:X.pattern.toString(),inst:Q,continue:!X.abort})}}),b1=w("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=V1),LQ.init(Q,X)}),Z1=w("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=M1),LQ.init(Q,X)}),j1=w("$ZodCheckIncludes",(Q,X)=>{S.init(Q,X);let W=x(X.includes),Y=new RegExp(typeof X.position==="number"?`^.{${X.position}}${W}`:W);X.pattern=Y,Q._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(Y)}),Q._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:Q,continue:!X.abort})}}),C1=w("$ZodCheckStartsWith",(Q,X)=>{S.init(Q,X);let W=new RegExp(`^${x(X.prefix)}.*`);X.pattern??(X.pattern=W),Q._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(W)}),Q._zod.check=(Y)=>{if(Y.value.startsWith(X.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:Y.value,inst:Q,continue:!X.abort})}}),k1=w("$ZodCheckEndsWith",(Q,X)=>{S.init(Q,X);let W=new RegExp(`.*${x(X.suffix)}$`);X.pattern??(X.pattern=W),Q._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(W)}),Q._zod.check=(Y)=>{if(Y.value.endsWith(X.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:Y.value,inst:Q,continue:!X.abort})}});var v1=w("$ZodCheckOverwrite",(Q,X)=>{S.init(Q,X),Q._zod.check=(W)=>{W.value=X.tx(W.value)}});class iQ{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let W=Q.split(`
|
|
2
|
+
`).filter((J)=>J),Y=Math.min(...W.map((J)=>J.length-J.trimStart().length)),G=W.map((J)=>J.slice(Y)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of G)this.content.push(J)}compile(){let Q=Function,X=this?.args,Y=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...X,Y.join(`
|
|
3
|
+
`))}}var h1={major:4,minor:2,patch:1};var I=w("$ZodType",(Q,X)=>{var W;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=h1;let Y=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))Y.unshift(Q);for(let G of Y)for(let J of G._zod.onattach)J(Q);if(Y.length===0)(W=Q._zod).deferred??(W.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let G=(q,K,A)=>{let L=r(q),N;for(let O of K){if(O._zod.def.when){if(!O._zod.def.when(q))continue}else if(L)continue;let E=q.issues.length,$=O._zod.check(q);if($ instanceof Promise&&A?.async===!1)throw new h;if(N||$ instanceof Promise)N=(N??Promise.resolve()).then(async()=>{if(await $,q.issues.length===E)return;if(!L)L=r(q,E)});else{if(q.issues.length===E)continue;if(!L)L=r(q,E)}}if(N)return N.then(()=>{return q});return q},J=(q,K,A)=>{if(r(q))return q.aborted=!0,q;let L=G(K,Y,A);if(L instanceof Promise){if(A.async===!1)throw new h;return L.then((N)=>Q._zod.parse(N,A))}return Q._zod.parse(L,A)};Q._zod.run=(q,K)=>{if(K.skipChecks)return Q._zod.parse(q,K);if(K.direction==="backward"){let L=Q._zod.parse({value:q.value,issues:[]},{...K,skipChecks:!0});if(L instanceof Promise)return L.then((N)=>{return J(N,q,K)});return J(L,q,K)}let A=Q._zod.parse(q,K);if(A instanceof Promise){if(K.async===!1)throw new h;return A.then((L)=>G(L,Y,K))}return G(A,Y,K)}}Q["~standard"]={validate:(G)=>{try{let J=u0(Q,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return c0(Q,G).then((q)=>q.success?{value:q.data}:{issues:q.error?.issues})}},vendor:"zod",version:1}}),RQ=w("$ZodString",(Q,X)=>{I.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??O1(Q._zod.bag),Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=String(W.value)}catch(G){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:Q}),W}}),V=w("$ZodStringFormat",(Q,X)=>{LQ.init(Q,X),RQ.init(Q,X)}),l1=w("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=X1),V.init(Q,X)}),p1=w("$ZodUUID",(Q,X)=>{if(X.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(Y===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=rQ(Y))}else X.pattern??(X.pattern=rQ());V.init(Q,X)}),d1=w("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=W1),V.init(Q,X)}),i1=w("$ZodURL",(Q,X)=>{V.init(Q,X),Q._zod.check=(W)=>{try{let Y=W.value.trim(),G=new URL(Y);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:W.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:W.value,inst:Q,continue:!X.abort})}if(X.normalize)W.value=G.href;else W.value=Y;return}catch(Y){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:Q,continue:!X.abort})}}}),n1=w("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=Y1()),V.init(Q,X)}),e1=w("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=s0),V.init(Q,X)}),t1=w("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=i0),V.init(Q,X)}),a1=w("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=n0),V.init(Q,X)}),s1=w("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=e0),V.init(Q,X)}),Q4=w("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=t0),V.init(Q,X)}),X4=w("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=a0),V.init(Q,X)}),W4=w("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=z1(X)),V.init(Q,X)}),Y4=w("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=H1),V.init(Q,X)}),G4=w("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=B1(X)),V.init(Q,X)}),J4=w("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=Q1),V.init(Q,X)}),q4=w("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=G1),V.init(Q,X),Q._zod.bag.format="ipv4"}),K4=w("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=J1),V.init(Q,X),Q._zod.bag.format="ipv6",Q._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:Q,continue:!X.abort})}}});var w4=w("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=q1),V.init(Q,X)}),A4=w("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=K1),V.init(Q,X),Q._zod.check=(W)=>{let Y=W.value.split("/");try{if(Y.length!==2)throw Error();let[G,J]=Y;if(!J)throw Error();let q=Number(J);if(`${q}`!==J)throw Error();if(q<0||q>128)throw Error();new URL(`http://[${G}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:Q,continue:!X.abort})}}});function L4(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var H4=w("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=w1),V.init(Q,X),Q._zod.bag.contentEncoding="base64",Q._zod.check=(W)=>{if(L4(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:Q,continue:!X.abort})}});function K9(Q){if(!lQ.test(Q))return!1;let X=Q.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),W=X.padEnd(Math.ceil(X.length/4)*4,"=");return L4(W)}var N4=w("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=lQ),V.init(Q,X),Q._zod.bag.contentEncoding="base64url",Q._zod.check=(W)=>{if(K9(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:Q,continue:!X.abort})}}),B4=w("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=A1),V.init(Q,X)});function w9(Q,X=null){try{let W=Q.split(".");if(W.length!==3)return!1;let[Y]=W;if(!Y)return!1;let G=JSON.parse(atob(Y));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}var z4=w("$ZodJWT",(Q,X)=>{V.init(Q,X),Q._zod.check=(W)=>{if(w9(W.value,X.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:Q,continue:!X.abort})}});var eQ=w("$ZodNumber",(Q,X)=>{I.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??D1,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=Number(W.value)}catch(q){}let G=W.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return W;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return W.issues.push({expected:"number",code:"invalid_type",input:G,inst:Q,...J?{received:J}:{}}),W}}),O4=w("$ZodNumberFormat",(Q,X)=>{U1.init(Q,X),eQ.init(Q,X)}),E4=w("$ZodBoolean",(Q,X)=>{I.init(Q,X),Q._zod.pattern=F1,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=Boolean(W.value)}catch(J){}let G=W.value;if(typeof G==="boolean")return W;return W.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:Q}),W}});var D4=w("$ZodUndefined",(Q,X)=>{I.init(Q,X),Q._zod.pattern=I1,Q._zod.values=new Set([void 0]),Q._zod.optin="optional",Q._zod.optout="optional",Q._zod.parse=(W,Y)=>{let G=W.value;if(typeof G>"u")return W;return W.issues.push({expected:"undefined",code:"invalid_type",input:G,inst:Q}),W}});var F4=w("$ZodUnknown",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W)=>W}),I4=w("$ZodNever",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:Q}),W}});function x1(Q,X,W){if(Q.issues.length)X.issues.push(...u(W,Q.issues));X.value[W]=Q.value}var V4=w("$ZodArray",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{let G=W.value;if(!Array.isArray(G))return W.issues.push({expected:"array",code:"invalid_type",input:G,inst:Q}),W;W.value=Array(G.length);let J=[];for(let q=0;q<G.length;q++){let K=G[q],A=X.element._zod.run({value:K,issues:[]},Y);if(A instanceof Promise)J.push(A.then((L)=>x1(L,W,q)));else x1(A,W,q)}if(J.length)return Promise.all(J).then(()=>W);return W}});function UQ(Q,X,W,Y){if(Q.issues.length)X.issues.push(...u(W,Q.issues));if(Q.value===void 0){if(W in Y)X.value[W]=void 0}else X.value[W]=Q.value}function M4(Q){let X=Object.keys(Q.shape);for(let Y of X)if(!Q.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let W=mQ(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(W)}}function $4(Q,X,W,Y,G,J){let q=[],K=G.keySet,A=G.catchall._zod,L=A.def.type;for(let N in X){if(K.has(N))continue;if(L==="never"){q.push(N);continue}let O=A.run({value:X[N],issues:[]},Y);if(O instanceof Promise)Q.push(O.then((E)=>UQ(E,W,N,X)));else UQ(O,W,N,X)}if(q.length)W.issues.push({code:"unrecognized_keys",keys:q,input:X,inst:J});if(!Q.length)return W;return Promise.all(Q).then(()=>{return W})}var A9=w("$ZodObject",(Q,X)=>{if(I.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let K=X.shape;Object.defineProperty(X,"shape",{get:()=>{let A={...K};return Object.defineProperty(X,"shape",{value:A}),A}})}let Y=GQ(()=>M4(X));F(Q._zod,"propValues",()=>{let K=X.shape,A={};for(let L in K){let N=K[L]._zod;if(N.values){A[L]??(A[L]=new Set);for(let O of N.values)A[L].add(O)}}return A});let G=n,J=X.catchall,q;Q._zod.parse=(K,A)=>{q??(q=Y.value);let L=K.value;if(!G(L))return K.issues.push({expected:"object",code:"invalid_type",input:L,inst:Q}),K;K.value={};let N=[],O=q.shape;for(let E of q.keys){let T=O[E]._zod.run({value:L[E],issues:[]},A);if(T instanceof Promise)N.push(T.then((vQ)=>UQ(vQ,K,E,L)));else UQ(T,K,E,L)}if(!J)return N.length?Promise.all(N).then(()=>K):K;return $4(N,L,K,A,Y.value,Q)}}),P4=w("$ZodObjectJIT",(Q,X)=>{A9.init(Q,X);let W=Q._zod.parse,Y=GQ(()=>M4(X)),G=(E)=>{let $=new iQ(["shape","payload","ctx"]),T=Y.value,vQ=(g)=>{let k=DQ(g);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};$.write("const input = payload.value;");let R0=Object.create(null),T3=0;for(let g of T.keys)R0[g]=`key_${T3++}`;$.write("const newResult = {};");for(let g of T.keys){let k=R0[g],QQ=DQ(g);$.write(`const ${k} = ${vQ(g)};`),$.write(`
|
|
4
|
+
if (${k}.issues.length) {
|
|
5
|
+
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
6
|
+
...iss,
|
|
7
|
+
path: iss.path ? [${QQ}, ...iss.path] : [${QQ}]
|
|
8
|
+
})));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if (${k}.value === undefined) {
|
|
13
|
+
if (${QQ} in input) {
|
|
14
|
+
newResult[${QQ}] = undefined;
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
newResult[${QQ}] = ${k}.value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`)}$.write("payload.value = newResult;"),$.write("return payload;");let b3=$.compile();return(g,k)=>b3(E,g,k)},J,q=n,K=!EQ.jitless,L=K&&cQ.value,N=X.catchall,O;Q._zod.parse=(E,$)=>{O??(O=Y.value);let T=E.value;if(!q(T))return E.issues.push({expected:"object",code:"invalid_type",input:T,inst:Q}),E;if(K&&L&&$?.async===!1&&$.jitless!==!0){if(!J)J=G(X.shape);if(E=J(E,$),!N)return E;return $4([],T,E,$,O,Q)}return W(E,$)}});function u1(Q,X,W,Y){for(let J of Q)if(J.issues.length===0)return X.value=J.value,X;let G=Q.filter((J)=>!r(J));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:W,errors:Q.map((J)=>J.issues.map((q)=>j(q,Y,v())))}),X}var U4=w("$ZodUnion",(Q,X)=>{I.init(Q,X),F(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),F(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),F(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),F(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>qQ(J.source)).join("|")})$`)}return});let W=X.options.length===1,Y=X.options[0]._zod.run;Q._zod.parse=(G,J)=>{if(W)return Y(G,J);let q=!1,K=[];for(let A of X.options){let L=A._zod.run({value:G.value,issues:[]},J);if(L instanceof Promise)K.push(L),q=!0;else{if(L.issues.length===0)return L;K.push(L)}}if(!q)return u1(K,G,Q,J);return Promise.all(K).then((A)=>{return u1(A,G,Q,J)})}});var R4=w("$ZodIntersection",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{let G=W.value,J=X.left._zod.run({value:G,issues:[]},Y),q=X.right._zod.run({value:G,issues:[]},Y);if(J instanceof Promise||q instanceof Promise)return Promise.all([J,q]).then(([A,L])=>{return c1(W,A,L)});return c1(W,J,q)}});function nQ(Q,X){if(Q===X)return{valid:!0,data:Q};if(Q instanceof Date&&X instanceof Date&&+Q===+X)return{valid:!0,data:Q};if(o(Q)&&o(X)){let W=Object.keys(X),Y=Object.keys(Q).filter((J)=>W.indexOf(J)!==-1),G={...Q,...X};for(let J of Y){let q=nQ(Q[J],X[J]);if(!q.valid)return{valid:!1,mergeErrorPath:[J,...q.mergeErrorPath]};G[J]=q.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let Y=0;Y<Q.length;Y++){let G=Q[Y],J=X[Y],q=nQ(G,J);if(!q.valid)return{valid:!1,mergeErrorPath:[Y,...q.mergeErrorPath]};W.push(q.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function c1(Q,X,W){if(X.issues.length)Q.issues.push(...X.issues);if(W.issues.length)Q.issues.push(...W.issues);if(r(Q))return Q;let Y=nQ(X.value,W.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return Q.value=Y.data,Q}var S4=w("$ZodRecord",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{let G=W.value;if(!o(G))return W.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),W;let J=[],q=X.keyType._zod.values;if(q){W.value={};let K=new Set;for(let L of q)if(typeof L==="string"||typeof L==="number"||typeof L==="symbol"){K.add(typeof L==="number"?L.toString():L);let N=X.valueType._zod.run({value:G[L],issues:[]},Y);if(N instanceof Promise)J.push(N.then((O)=>{if(O.issues.length)W.issues.push(...u(L,O.issues));W.value[L]=O.value}));else{if(N.issues.length)W.issues.push(...u(L,N.issues));W.value[L]=N.value}}let A;for(let L in G)if(!K.has(L))A=A??[],A.push(L);if(A&&A.length>0)W.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:A})}else{W.value={};for(let K of Reflect.ownKeys(G)){if(K==="__proto__")continue;let A=X.keyType._zod.run({value:K,issues:[]},Y);if(A instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(A.issues.length){if(X.mode==="loose")W.value[K]=G[K];else W.issues.push({code:"invalid_key",origin:"record",issues:A.issues.map((N)=>j(N,Y,v())),input:K,path:[K],inst:Q});continue}let L=X.valueType._zod.run({value:G[K],issues:[]},Y);if(L instanceof Promise)J.push(L.then((N)=>{if(N.issues.length)W.issues.push(...u(K,N.issues));W.value[A.value]=N.value}));else{if(L.issues.length)W.issues.push(...u(K,L.issues));W.value[A.value]=L.value}}}if(J.length)return Promise.all(J).then(()=>W);return W}});var _4=w("$ZodEnum",(Q,X)=>{I.init(Q,X);let W=YQ(X.entries),Y=new Set(W);Q._zod.values=Y,Q._zod.pattern=new RegExp(`^(${W.filter((G)=>yQ.has(typeof G)).map((G)=>typeof G==="string"?x(G):G.toString()).join("|")})$`),Q._zod.parse=(G,J)=>{let q=G.value;if(Y.has(q))return G;return G.issues.push({code:"invalid_value",values:W,input:q,inst:Q}),G}}),T4=w("$ZodLiteral",(Q,X)=>{if(I.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let W=new Set(X.values);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?x(Y):Y?x(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,G)=>{let J=Y.value;if(W.has(J))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:J,inst:Q}),Y}});var b4=w("$ZodTransform",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")throw new XQ(Q.constructor.name);let G=X.transform(W.value,W);if(Y.async)return(G instanceof Promise?G:Promise.resolve(G)).then((q)=>{return W.value=q,W});if(G instanceof Promise)throw new h;return W.value=G,W}});function y1(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var Z4=w("$ZodOptional",(Q,X)=>{I.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",F(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),F(Q._zod,"pattern",()=>{let W=X.innerType._zod.pattern;return W?new RegExp(`^(${qQ(W.source)})?$`):void 0}),Q._zod.parse=(W,Y)=>{if(X.innerType._zod.optin==="optional"){let G=X.innerType._zod.run(W,Y);if(G instanceof Promise)return G.then((J)=>y1(J,W.value));return y1(G,W.value)}if(W.value===void 0)return W;return X.innerType._zod.run(W,Y)}}),j4=w("$ZodNullable",(Q,X)=>{I.init(Q,X),F(Q._zod,"optin",()=>X.innerType._zod.optin),F(Q._zod,"optout",()=>X.innerType._zod.optout),F(Q._zod,"pattern",()=>{let W=X.innerType._zod.pattern;return W?new RegExp(`^(${qQ(W.source)}|null)$`):void 0}),F(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(W,Y)=>{if(W.value===null)return W;return X.innerType._zod.run(W,Y)}}),C4=w("$ZodDefault",(Q,X)=>{I.init(Q,X),Q._zod.optin="optional",F(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);if(W.value===void 0)return W.value=X.defaultValue,W;let G=X.innerType._zod.run(W,Y);if(G instanceof Promise)return G.then((J)=>m1(J,X));return m1(G,X)}});function m1(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var k4=w("$ZodPrefault",(Q,X)=>{I.init(Q,X),Q._zod.optin="optional",F(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);if(W.value===void 0)W.value=X.defaultValue;return X.innerType._zod.run(W,Y)}}),v4=w("$ZodNonOptional",(Q,X)=>{I.init(Q,X),F(Q._zod,"values",()=>{let W=X.innerType._zod.values;return W?new Set([...W].filter((Y)=>Y!==void 0)):void 0}),Q._zod.parse=(W,Y)=>{let G=X.innerType._zod.run(W,Y);if(G instanceof Promise)return G.then((J)=>f1(J,Q));return f1(G,Q)}});function f1(Q,X){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:X});return Q}var g4=w("$ZodCatch",(Q,X)=>{I.init(Q,X),F(Q._zod,"optin",()=>X.innerType._zod.optin),F(Q._zod,"optout",()=>X.innerType._zod.optout),F(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);let G=X.innerType._zod.run(W,Y);if(G instanceof Promise)return G.then((J)=>{if(W.value=J.value,J.issues.length)W.value=X.catchValue({...W,error:{issues:J.issues.map((q)=>j(q,Y,v()))},input:W.value}),W.issues=[];return W});if(W.value=G.value,G.issues.length)W.value=X.catchValue({...W,error:{issues:G.issues.map((J)=>j(J,Y,v()))},input:W.value}),W.issues=[];return W}});var h4=w("$ZodPipe",(Q,X)=>{I.init(Q,X),F(Q._zod,"values",()=>X.in._zod.values),F(Q._zod,"optin",()=>X.in._zod.optin),F(Q._zod,"optout",()=>X.out._zod.optout),F(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward"){let J=X.out._zod.run(W,Y);if(J instanceof Promise)return J.then((q)=>PQ(q,X.in,Y));return PQ(J,X.in,Y)}let G=X.in._zod.run(W,Y);if(G instanceof Promise)return G.then((J)=>PQ(J,X.out,Y));return PQ(G,X.out,Y)}});function PQ(Q,X,W){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},W)}var x4=w("$ZodReadonly",(Q,X)=>{I.init(Q,X),F(Q._zod,"propValues",()=>X.innerType._zod.propValues),F(Q._zod,"values",()=>X.innerType._zod.values),F(Q._zod,"optin",()=>X.innerType?._zod?.optin),F(Q._zod,"optout",()=>X.innerType?._zod?.optout),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);let G=X.innerType._zod.run(W,Y);if(G instanceof Promise)return G.then(o1);return o1(G)}});function o1(Q){return Q.value=Object.freeze(Q.value),Q}var u4=w("$ZodCustom",(Q,X)=>{S.init(Q,X),I.init(Q,X),Q._zod.parse=(W,Y)=>{return W},Q._zod.check=(W)=>{let Y=W.value,G=X.fn(Y);if(G instanceof Promise)return G.then((J)=>r1(J,W,Y,Q));r1(G,W,Y,Q);return}});function r1(Q,X,W,Y){if(!Q){let G={code:"custom",input:W,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)G.params=Y._zod.def.params;X.issues.push(t(G))}}var c4,H6=Symbol("ZodOutput"),N6=Symbol("ZodInput");class y4{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...X){let W=X[0];if(this._map.set(Q,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let X=this._map.get(Q);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(Q),this}get(Q){let X=Q._zod.parent;if(X){let W={...this.get(X)??{}};delete W.id;let Y={...W,...this._map.get(Q)};return Object.keys(Y).length?Y:void 0}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function L9(){return new y4}(c4=globalThis).__zod_globalRegistry??(c4.__zod_globalRegistry=L9());var d=globalThis.__zod_globalRegistry;function m4(Q,X){return new Q({type:"string",...B(X)})}function f4(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...B(X)})}function tQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...B(X)})}function o4(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...B(X)})}function r4(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(X)})}function l4(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(X)})}function p4(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(X)})}function d4(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...B(X)})}function i4(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...B(X)})}function n4(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(X)})}function e4(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...B(X)})}function t4(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(X)})}function a4(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...B(X)})}function s4(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...B(X)})}function Q2(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(X)})}function X2(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(X)})}function W2(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(X)})}function Y2(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(X)})}function G2(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(X)})}function J2(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...B(X)})}function q2(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...B(X)})}function K2(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...B(X)})}function w2(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...B(X)})}function A2(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(X)})}function L2(Q,X){return new Q({type:"string",format:"date",check:"string_format",...B(X)})}function H2(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...B(X)})}function N2(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...B(X)})}function B2(Q,X){return new Q({type:"number",checks:[],...B(X)})}function z2(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...B(X)})}function O2(Q,X){return new Q({type:"boolean",...B(X)})}function E2(Q,X){return new Q({type:"undefined",...B(X)})}function D2(Q){return new Q({type:"unknown"})}function F2(Q,X){return new Q({type:"never",...B(X)})}function SQ(Q,X){return new pQ({check:"less_than",...B(X),value:Q,inclusive:!1})}function HQ(Q,X){return new pQ({check:"less_than",...B(X),value:Q,inclusive:!0})}function _Q(Q,X){return new dQ({check:"greater_than",...B(X),value:Q,inclusive:!1})}function NQ(Q,X){return new dQ({check:"greater_than",...B(X),value:Q,inclusive:!0})}function TQ(Q,X){return new P1({check:"multiple_of",...B(X),value:Q})}function bQ(Q,X){return new R1({check:"max_length",...B(X),maximum:Q})}function a(Q,X){return new S1({check:"min_length",...B(X),minimum:Q})}function ZQ(Q,X){return new _1({check:"length_equals",...B(X),length:Q})}function aQ(Q,X){return new T1({check:"string_format",format:"regex",...B(X),pattern:Q})}function sQ(Q){return new b1({check:"string_format",format:"lowercase",...B(Q)})}function Q0(Q){return new Z1({check:"string_format",format:"uppercase",...B(Q)})}function X0(Q,X){return new j1({check:"string_format",format:"includes",...B(X),includes:Q})}function W0(Q,X){return new C1({check:"string_format",format:"starts_with",...B(X),prefix:Q})}function Y0(Q,X){return new k1({check:"string_format",format:"ends_with",...B(X),suffix:Q})}function l(Q){return new v1({check:"overwrite",tx:Q})}function G0(Q){return l((X)=>X.normalize(Q))}function J0(){return l((Q)=>Q.trim())}function q0(){return l((Q)=>Q.toLowerCase())}function K0(){return l((Q)=>Q.toUpperCase())}function w0(){return l((Q)=>uQ(Q))}function I2(Q,X,W){return new Q({type:"array",element:X,...B(W)})}function V2(Q,X,W){return new Q({type:"custom",check:"custom",fn:X,...B(W)})}function M2(Q){let X=H9((W)=>{return W.addIssue=(Y)=>{if(typeof Y==="string")W.issues.push(t(Y,W.value,X._zod.def));else{let G=Y;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=W.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),W.issues.push(t(G))}},Q(W.value,W)});return X}function H9(Q,X){let W=new S({check:"custom",...B(X)});return W._zod.check=Q,W}function A0(Q){let X=Q?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:Q.processors??{},metadataRegistry:Q?.metadata??d,target:X,unrepresentable:Q?.unrepresentable??"throw",override:Q?.override??(()=>{}),io:Q?.io??"output",counter:0,seen:new Map,cycles:Q?.cycles??"ref",reused:Q?.reused??"inline",external:Q?.external??void 0}}function R(Q,X,W={path:[],schemaPath:[]}){var Y;let G=Q._zod.def,J=X.seen.get(Q);if(J){if(J.count++,W.schemaPath.includes(Q))J.cycle=W.path;return J.schema}let q={schema:{},count:1,cycle:void 0,path:W.path};X.seen.set(Q,q);let K=Q._zod.toJSONSchema?.();if(K)q.schema=K;else{let N={...W,schemaPath:[...W.schemaPath,Q],path:W.path},O=Q._zod.parent;if(O)q.ref=O,R(O,X,N),X.seen.get(O).isParent=!0;else if(Q._zod.processJSONSchema)Q._zod.processJSONSchema(X,q.schema,N);else{let E=q.schema,$=X.processors[G.type];if(!$)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);$(Q,X,E,N)}}let A=X.metadataRegistry.get(Q);if(A)Object.assign(q.schema,A);if(X.io==="input"&&_(Q))delete q.schema.examples,delete q.schema.default;if(X.io==="input"&&q.schema._prefault)(Y=q.schema).default??(Y.default=q.schema._prefault);return delete q.schema._prefault,X.seen.get(Q).schema}function L0(Q,X){let W=Q.seen.get(X);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(J)=>{let q=Q.target==="draft-2020-12"?"$defs":"definitions";if(Q.external){let N=Q.external.registry.get(J[0])?.id,O=Q.external.uri??(($)=>$);if(N)return{ref:O(N)};let E=J[1].defId??J[1].schema.id??`schema${Q.counter++}`;return J[1].defId=E,{defId:E,ref:`${O("__shared")}#/${q}/${E}`}}if(J[1]===W)return{ref:"#"};let A=`${"#"}/${q}/`,L=J[1].schema.id??`__schema${Q.counter++}`;return{defId:L,ref:A+L}},G=(J)=>{if(J[1].schema.$ref)return;let q=J[1],{ref:K,defId:A}=Y(J);if(q.def={...q.schema},A)q.defId=A;let L=q.schema;for(let N in L)delete L[N];L.$ref=K};if(Q.cycles==="throw")for(let J of Q.seen.entries()){let q=J[1];if(q.cycle)throw Error(`Cycle detected: #/${q.cycle?.join("/")}/<root>
|
|
21
|
+
|
|
22
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of Q.seen.entries()){let q=J[1];if(X===J[0]){G(J);continue}if(Q.external){let A=Q.external.registry.get(J[0])?.id;if(X!==J[0]&&A){G(J);continue}}if(Q.metadataRegistry.get(J[0])?.id){G(J);continue}if(q.cycle){G(J);continue}if(q.count>1){if(Q.reused==="ref"){G(J);continue}}}}function H0(Q,X){let W=Q.seen.get(X);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(q)=>{let K=Q.seen.get(q),A=K.def??K.schema,L={...A};if(K.ref===null)return;let N=K.ref;if(K.ref=null,N){Y(N);let O=Q.seen.get(N).schema;if(O.$ref&&(Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"))A.allOf=A.allOf??[],A.allOf.push(O);else Object.assign(A,O),Object.assign(A,L)}if(!K.isParent)Q.override({zodSchema:q,jsonSchema:A,path:K.path??[]})};for(let q of[...Q.seen.entries()].reverse())Y(q[0]);let G={};if(Q.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(Q.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(Q.target==="openapi-3.0");if(Q.external?.uri){let q=Q.external.registry.get(X)?.id;if(!q)throw Error("Schema is missing an `id` property");G.$id=Q.external.uri(q)}Object.assign(G,W.def??W.schema);let J=Q.external?.defs??{};for(let q of Q.seen.entries()){let K=q[1];if(K.def&&K.defId)J[K.defId]=K.def}if(Q.external);else if(Object.keys(J).length>0)if(Q.target==="draft-2020-12")G.$defs=J;else G.definitions=J;try{let q=JSON.parse(JSON.stringify(G));return Object.defineProperty(q,"~standard",{value:{...X["~standard"],jsonSchema:{input:BQ(X,"input"),output:BQ(X,"output")}},enumerable:!1,writable:!1}),q}catch(q){throw Error("Error converting schema to JSON.")}}function _(Q,X){let W=X??{seen:new Set};if(W.seen.has(Q))return!1;W.seen.add(Q);let Y=Q._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return _(Y.element,W);if(Y.type==="set")return _(Y.valueType,W);if(Y.type==="lazy")return _(Y.getter(),W);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return _(Y.innerType,W);if(Y.type==="intersection")return _(Y.left,W)||_(Y.right,W);if(Y.type==="record"||Y.type==="map")return _(Y.keyType,W)||_(Y.valueType,W);if(Y.type==="pipe")return _(Y.in,W)||_(Y.out,W);if(Y.type==="object"){for(let G in Y.shape)if(_(Y.shape[G],W))return!0;return!1}if(Y.type==="union"){for(let G of Y.options)if(_(G,W))return!0;return!1}if(Y.type==="tuple"){for(let G of Y.items)if(_(G,W))return!0;if(Y.rest&&_(Y.rest,W))return!0;return!1}return!1}var $2=(Q,X={})=>(W)=>{let Y=A0({...W,processors:X});return R(Q,Y),L0(Y,Q),H0(Y,Q)},BQ=(Q,X)=>(W)=>{let{libraryOptions:Y,target:G}=W??{},J=A0({...Y??{},target:G,io:X,processors:{}});return R(Q,J),L0(J,Q),H0(J,Q)};var N9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},P2=(Q,X,W,Y)=>{let G=W;G.type="string";let{minimum:J,maximum:q,format:K,patterns:A,contentEncoding:L}=Q._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof q==="number")G.maxLength=q;if(K){if(G.format=N9[K]??K,G.format==="")delete G.format}if(L)G.contentEncoding=L;if(A&&A.size>0){let N=[...A];if(N.length===1)G.pattern=N[0].source;else if(N.length>1)G.allOf=[...N.map((O)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:O.source}))]}},U2=(Q,X,W,Y)=>{let G=W,{minimum:J,maximum:q,format:K,multipleOf:A,exclusiveMaximum:L,exclusiveMinimum:N}=Q._zod.bag;if(typeof K==="string"&&K.includes("int"))G.type="integer";else G.type="number";if(typeof N==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")G.minimum=N,G.exclusiveMinimum=!0;else G.exclusiveMinimum=N;if(typeof J==="number"){if(G.minimum=J,typeof N==="number"&&X.target!=="draft-04")if(N>=J)delete G.minimum;else delete G.exclusiveMinimum}if(typeof L==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")G.maximum=L,G.exclusiveMaximum=!0;else G.exclusiveMaximum=L;if(typeof q==="number"){if(G.maximum=q,typeof L==="number"&&X.target!=="draft-04")if(L<=q)delete G.maximum;else delete G.exclusiveMaximum}if(typeof A==="number")G.multipleOf=A},R2=(Q,X,W,Y)=>{W.type="boolean"};var S2=(Q,X,W,Y)=>{if(X.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")};var _2=(Q,X,W,Y)=>{W.not={}};var T2=(Q,X,W,Y)=>{};var b2=(Q,X,W,Y)=>{let G=Q._zod.def,J=YQ(G.entries);if(J.every((q)=>typeof q==="number"))W.type="number";if(J.every((q)=>typeof q==="string"))W.type="string";W.enum=J},Z2=(Q,X,W,Y)=>{let G=Q._zod.def,J=[];for(let q of G.values)if(q===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof q==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number(q));else J.push(q);if(J.length===0);else if(J.length===1){let q=J[0];if(W.type=q===null?"null":typeof q,X.target==="draft-04"||X.target==="openapi-3.0")W.enum=[q];else W.const=q}else{if(J.every((q)=>typeof q==="number"))W.type="number";if(J.every((q)=>typeof q==="string"))W.type="string";if(J.every((q)=>typeof q==="boolean"))W.type="boolean";if(J.every((q)=>q===null))W.type="null";W.enum=J}};var j2=(Q,X,W,Y)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var C2=(Q,X,W,Y)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var k2=(Q,X,W,Y)=>{let G=W,J=Q._zod.def,{minimum:q,maximum:K}=Q._zod.bag;if(typeof q==="number")G.minItems=q;if(typeof K==="number")G.maxItems=K;G.type="array",G.items=R(J.element,X,{...Y,path:[...Y.path,"items"]})},v2=(Q,X,W,Y)=>{let G=W,J=Q._zod.def;G.type="object",G.properties={};let q=J.shape;for(let L in q)G.properties[L]=R(q[L],X,{...Y,path:[...Y.path,"properties",L]});let K=new Set(Object.keys(q)),A=new Set([...K].filter((L)=>{let N=J.shape[L]._zod;if(X.io==="input")return N.optin===void 0;else return N.optout===void 0}));if(A.size>0)G.required=Array.from(A);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(X.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=R(J.catchall,X,{...Y,path:[...Y.path,"additionalProperties"]})},g2=(Q,X,W,Y)=>{let G=Q._zod.def,J=G.inclusive===!1,q=G.options.map((K,A)=>R(K,X,{...Y,path:[...Y.path,J?"oneOf":"anyOf",A]}));if(J)W.oneOf=q;else W.anyOf=q},h2=(Q,X,W,Y)=>{let G=Q._zod.def,J=R(G.left,X,{...Y,path:[...Y.path,"allOf",0]}),q=R(G.right,X,{...Y,path:[...Y.path,"allOf",1]}),K=(L)=>("allOf"in L)&&Object.keys(L).length===1,A=[...K(J)?J.allOf:[J],...K(q)?q.allOf:[q]];W.allOf=A};var x2=(Q,X,W,Y)=>{let G=W,J=Q._zod.def;if(G.type="object",X.target==="draft-07"||X.target==="draft-2020-12")G.propertyNames=R(J.keyType,X,{...Y,path:[...Y.path,"propertyNames"]});G.additionalProperties=R(J.valueType,X,{...Y,path:[...Y.path,"additionalProperties"]})},u2=(Q,X,W,Y)=>{let G=Q._zod.def,J=R(G.innerType,X,Y),q=X.seen.get(Q);if(X.target==="openapi-3.0")q.ref=G.innerType,W.nullable=!0;else W.anyOf=[J,{type:"null"}]},c2=(Q,X,W,Y)=>{let G=Q._zod.def;R(G.innerType,X,Y);let J=X.seen.get(Q);J.ref=G.innerType},y2=(Q,X,W,Y)=>{let G=Q._zod.def;R(G.innerType,X,Y);let J=X.seen.get(Q);J.ref=G.innerType,W.default=JSON.parse(JSON.stringify(G.defaultValue))},m2=(Q,X,W,Y)=>{let G=Q._zod.def;R(G.innerType,X,Y);let J=X.seen.get(Q);if(J.ref=G.innerType,X.io==="input")W._prefault=JSON.parse(JSON.stringify(G.defaultValue))},f2=(Q,X,W,Y)=>{let G=Q._zod.def;R(G.innerType,X,Y);let J=X.seen.get(Q);J.ref=G.innerType;let q;try{q=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}W.default=q},o2=(Q,X,W,Y)=>{let G=Q._zod.def,J=X.io==="input"?G.in._zod.def.type==="transform"?G.out:G.in:G.out;R(J,X,Y);let q=X.seen.get(Q);q.ref=J},r2=(Q,X,W,Y)=>{let G=Q._zod.def;R(G.innerType,X,Y);let J=X.seen.get(Q);J.ref=G.innerType,W.readOnly=!0};var l2=(Q,X,W,Y)=>{let G=Q._zod.def;R(G.innerType,X,Y);let J=X.seen.get(Q);J.ref=G.innerType};var I9=w("ZodISODateTime",(Q,X)=>{W4.init(Q,X),M.init(Q,X)});function p2(Q){return A2(I9,Q)}var V9=w("ZodISODate",(Q,X)=>{Y4.init(Q,X),M.init(Q,X)});function d2(Q){return L2(V9,Q)}var M9=w("ZodISOTime",(Q,X)=>{G4.init(Q,X),M.init(Q,X)});function i2(Q){return H2(M9,Q)}var $9=w("ZodISODuration",(Q,X)=>{J4.init(Q,X),M.init(Q,X)});function n2(Q){return N2($9,Q)}var e2=(Q,X)=>{IQ.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(W)=>x0(Q,W)},flatten:{value:(W)=>h0(Q,W)},addIssue:{value:(W)=>{Q.issues.push(W),Q.message=JSON.stringify(Q.issues,e,2)}},addIssues:{value:(W)=>{Q.issues.push(...W),Q.message=JSON.stringify(Q.issues,e,2)}},isEmpty:{get(){return Q.issues.length===0}}})},o6=w("ZodError",e2),b=w("ZodError",e2,{Parent:Error});var t2=VQ(b),a2=MQ(b),s2=wQ(b),Q3=AQ(b),X3=y0(b),W3=m0(b),Y3=f0(b),G3=o0(b),J3=r0(b),q3=l0(b),K3=p0(b),w3=d0(b);var P=w("ZodType",(Q,X)=>{return I.init(Q,X),Object.assign(Q["~standard"],{jsonSchema:{input:BQ(Q,"input"),output:BQ(Q,"output")}}),Q.toJSONSchema=$2(Q,{}),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...W)=>{return Q.clone(D.mergeDefs(X,{checks:[...X.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]}))},Q.clone=(W,Y)=>Z(Q,W,Y),Q.brand=()=>Q,Q.register=(W,Y)=>{return W.add(Q,Y),Q},Q.parse=(W,Y)=>t2(Q,W,Y,{callee:Q.parse}),Q.safeParse=(W,Y)=>s2(Q,W,Y),Q.parseAsync=async(W,Y)=>a2(Q,W,Y,{callee:Q.parseAsync}),Q.safeParseAsync=async(W,Y)=>Q3(Q,W,Y),Q.spa=Q.safeParseAsync,Q.encode=(W,Y)=>X3(Q,W,Y),Q.decode=(W,Y)=>W3(Q,W,Y),Q.encodeAsync=async(W,Y)=>Y3(Q,W,Y),Q.decodeAsync=async(W,Y)=>G3(Q,W,Y),Q.safeEncode=(W,Y)=>J3(Q,W,Y),Q.safeDecode=(W,Y)=>q3(Q,W,Y),Q.safeEncodeAsync=async(W,Y)=>K3(Q,W,Y),Q.safeDecodeAsync=async(W,Y)=>w3(Q,W,Y),Q.refine=(W,Y)=>Q.check(DX(W,Y)),Q.superRefine=(W)=>Q.check(FX(W)),Q.overwrite=(W)=>Q.check(l(W)),Q.optional=()=>H3(Q),Q.nullable=()=>N3(Q),Q.nullish=()=>H3(N3(Q)),Q.nonoptional=(W)=>LX(Q,W),Q.array=()=>y(Q),Q.or=(W)=>p([Q,W]),Q.and=(W)=>s9(Q,W),Q.transform=(W)=>B3(Q,GX(W)),Q.default=(W)=>KX(Q,W),Q.prefault=(W)=>AX(Q,W),Q.catch=(W)=>NX(Q,W),Q.pipe=(W)=>B3(Q,W),Q.readonly=()=>OX(Q),Q.describe=(W)=>{let Y=Q.clone();return d.add(Y,{description:W}),Y},Object.defineProperty(Q,"description",{get(){return d.get(Q)?.description},configurable:!0}),Q.meta=(...W)=>{if(W.length===0)return d.get(Q);let Y=Q.clone();return d.add(Y,W[0]),Y},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),z3=w("_ZodString",(Q,X)=>{RQ.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(Y,G,J)=>P2(Q,Y,G,J);let W=Q._zod.bag;Q.format=W.format??null,Q.minLength=W.minimum??null,Q.maxLength=W.maximum??null,Q.regex=(...Y)=>Q.check(aQ(...Y)),Q.includes=(...Y)=>Q.check(X0(...Y)),Q.startsWith=(...Y)=>Q.check(W0(...Y)),Q.endsWith=(...Y)=>Q.check(Y0(...Y)),Q.min=(...Y)=>Q.check(a(...Y)),Q.max=(...Y)=>Q.check(bQ(...Y)),Q.length=(...Y)=>Q.check(ZQ(...Y)),Q.nonempty=(...Y)=>Q.check(a(1,...Y)),Q.lowercase=(Y)=>Q.check(sQ(Y)),Q.uppercase=(Y)=>Q.check(Q0(Y)),Q.trim=()=>Q.check(J0()),Q.normalize=(...Y)=>Q.check(G0(...Y)),Q.toLowerCase=()=>Q.check(q0()),Q.toUpperCase=()=>Q.check(K0()),Q.slugify=()=>Q.check(w0())}),S9=w("ZodString",(Q,X)=>{RQ.init(Q,X),z3.init(Q,X),Q.email=(W)=>Q.check(f4(_9,W)),Q.url=(W)=>Q.check(d4(T9,W)),Q.jwt=(W)=>Q.check(w2(o9,W)),Q.emoji=(W)=>Q.check(i4(b9,W)),Q.guid=(W)=>Q.check(tQ(A3,W)),Q.uuid=(W)=>Q.check(o4(CQ,W)),Q.uuidv4=(W)=>Q.check(r4(CQ,W)),Q.uuidv6=(W)=>Q.check(l4(CQ,W)),Q.uuidv7=(W)=>Q.check(p4(CQ,W)),Q.nanoid=(W)=>Q.check(n4(Z9,W)),Q.guid=(W)=>Q.check(tQ(A3,W)),Q.cuid=(W)=>Q.check(e4(j9,W)),Q.cuid2=(W)=>Q.check(t4(C9,W)),Q.ulid=(W)=>Q.check(a4(k9,W)),Q.base64=(W)=>Q.check(J2(y9,W)),Q.base64url=(W)=>Q.check(q2(m9,W)),Q.xid=(W)=>Q.check(s4(v9,W)),Q.ksuid=(W)=>Q.check(Q2(g9,W)),Q.ipv4=(W)=>Q.check(X2(h9,W)),Q.ipv6=(W)=>Q.check(W2(x9,W)),Q.cidrv4=(W)=>Q.check(Y2(u9,W)),Q.cidrv6=(W)=>Q.check(G2(c9,W)),Q.e164=(W)=>Q.check(K2(f9,W)),Q.datetime=(W)=>Q.check(p2(W)),Q.date=(W)=>Q.check(d2(W)),Q.time=(W)=>Q.check(i2(W)),Q.duration=(W)=>Q.check(n2(W))});function U(Q){return m4(S9,Q)}var M=w("ZodStringFormat",(Q,X)=>{V.init(Q,X),z3.init(Q,X)}),_9=w("ZodEmail",(Q,X)=>{d1.init(Q,X),M.init(Q,X)});var A3=w("ZodGUID",(Q,X)=>{l1.init(Q,X),M.init(Q,X)});var CQ=w("ZodUUID",(Q,X)=>{p1.init(Q,X),M.init(Q,X)});var T9=w("ZodURL",(Q,X)=>{i1.init(Q,X),M.init(Q,X)});var b9=w("ZodEmoji",(Q,X)=>{n1.init(Q,X),M.init(Q,X)});var Z9=w("ZodNanoID",(Q,X)=>{e1.init(Q,X),M.init(Q,X)});var j9=w("ZodCUID",(Q,X)=>{t1.init(Q,X),M.init(Q,X)});var C9=w("ZodCUID2",(Q,X)=>{a1.init(Q,X),M.init(Q,X)});var k9=w("ZodULID",(Q,X)=>{s1.init(Q,X),M.init(Q,X)});var v9=w("ZodXID",(Q,X)=>{Q4.init(Q,X),M.init(Q,X)});var g9=w("ZodKSUID",(Q,X)=>{X4.init(Q,X),M.init(Q,X)});var h9=w("ZodIPv4",(Q,X)=>{q4.init(Q,X),M.init(Q,X)});var x9=w("ZodIPv6",(Q,X)=>{K4.init(Q,X),M.init(Q,X)});var u9=w("ZodCIDRv4",(Q,X)=>{w4.init(Q,X),M.init(Q,X)});var c9=w("ZodCIDRv6",(Q,X)=>{A4.init(Q,X),M.init(Q,X)});var y9=w("ZodBase64",(Q,X)=>{H4.init(Q,X),M.init(Q,X)});var m9=w("ZodBase64URL",(Q,X)=>{N4.init(Q,X),M.init(Q,X)});var f9=w("ZodE164",(Q,X)=>{B4.init(Q,X),M.init(Q,X)});var o9=w("ZodJWT",(Q,X)=>{z4.init(Q,X),M.init(Q,X)});var O3=w("ZodNumber",(Q,X)=>{eQ.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(Y,G,J)=>U2(Q,Y,G,J),Q.gt=(Y,G)=>Q.check(_Q(Y,G)),Q.gte=(Y,G)=>Q.check(NQ(Y,G)),Q.min=(Y,G)=>Q.check(NQ(Y,G)),Q.lt=(Y,G)=>Q.check(SQ(Y,G)),Q.lte=(Y,G)=>Q.check(HQ(Y,G)),Q.max=(Y,G)=>Q.check(HQ(Y,G)),Q.int=(Y)=>Q.check(L3(Y)),Q.safe=(Y)=>Q.check(L3(Y)),Q.positive=(Y)=>Q.check(_Q(0,Y)),Q.nonnegative=(Y)=>Q.check(NQ(0,Y)),Q.negative=(Y)=>Q.check(SQ(0,Y)),Q.nonpositive=(Y)=>Q.check(HQ(0,Y)),Q.multipleOf=(Y,G)=>Q.check(TQ(Y,G)),Q.step=(Y,G)=>Q.check(TQ(Y,G)),Q.finite=()=>Q;let W=Q._zod.bag;Q.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),Q.isFinite=!0,Q.format=W.format??null});function C(Q){return B2(O3,Q)}var r9=w("ZodNumberFormat",(Q,X)=>{O4.init(Q,X),O3.init(Q,X)});function L3(Q){return z2(r9,Q)}var l9=w("ZodBoolean",(Q,X)=>{E4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>R2(Q,W,Y,G)});function c(Q){return O2(l9,Q)}var p9=w("ZodUndefined",(Q,X)=>{D4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>S2(Q,W,Y,G)});function E3(Q){return E2(p9,Q)}var d9=w("ZodUnknown",(Q,X)=>{F4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>T2(Q,W,Y,G)});function i(){return D2(d9)}var i9=w("ZodNever",(Q,X)=>{I4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>_2(Q,W,Y,G)});function n9(Q){return F2(i9,Q)}var e9=w("ZodArray",(Q,X)=>{V4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>k2(Q,W,Y,G),Q.element=X.element,Q.min=(W,Y)=>Q.check(a(W,Y)),Q.nonempty=(W)=>Q.check(a(1,W)),Q.max=(W,Y)=>Q.check(bQ(W,Y)),Q.length=(W,Y)=>Q.check(ZQ(W,Y)),Q.unwrap=()=>Q.element});function y(Q,X){return I2(e9,Q,X)}var D3=w("ZodObject",(Q,X)=>{P4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>v2(Q,W,Y,G),D.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>XX(Object.keys(Q._zod.def.shape)),Q.catchall=(W)=>Q.clone({...Q._zod.def,catchall:W}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:i()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:i()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:n9()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(W)=>{return D.extend(Q,W)},Q.safeExtend=(W)=>{return D.safeExtend(Q,W)},Q.merge=(W)=>D.merge(Q,W),Q.pick=(W)=>D.pick(Q,W),Q.omit=(W)=>D.omit(Q,W),Q.partial=(...W)=>D.partial(F3,Q,W[0]),Q.required=(...W)=>D.required(I3,Q,W[0])});function z(Q,X){let W={type:"object",shape:Q??{},...D.normalizeParams(X)};return new D3(W)}function s(Q,X){return new D3({type:"object",shape:Q,catchall:i(),...D.normalizeParams(X)})}var t9=w("ZodUnion",(Q,X)=>{U4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>g2(Q,W,Y,G),Q.options=X.options});function p(Q,X){return new t9({type:"union",options:Q,...D.normalizeParams(X)})}var a9=w("ZodIntersection",(Q,X)=>{R4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>h2(Q,W,Y,G)});function s9(Q,X){return new a9({type:"intersection",left:Q,right:X})}var QX=w("ZodRecord",(Q,X)=>{S4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>x2(Q,W,Y,G),Q.keyType=X.keyType,Q.valueType=X.valueType});function zQ(Q,X,W){return new QX({type:"record",keyType:Q,valueType:X,...D.normalizeParams(W)})}var N0=w("ZodEnum",(Q,X)=>{_4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(Y,G,J)=>b2(Q,Y,G,J),Q.enum=X.entries,Q.options=Object.values(X.entries);let W=new Set(Object.keys(X.entries));Q.extract=(Y,G)=>{let J={};for(let q of Y)if(W.has(q))J[q]=X.entries[q];else throw Error(`Key ${q} not found in enum`);return new N0({...X,checks:[],...D.normalizeParams(G),entries:J})},Q.exclude=(Y,G)=>{let J={...X.entries};for(let q of Y)if(W.has(q))delete J[q];else throw Error(`Key ${q} not found in enum`);return new N0({...X,checks:[],...D.normalizeParams(G),entries:J})}});function XX(Q,X){let W=Array.isArray(Q)?Object.fromEntries(Q.map((Y)=>[Y,Y])):Q;return new N0({type:"enum",entries:W,...D.normalizeParams(X)})}var WX=w("ZodLiteral",(Q,X)=>{T4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>Z2(Q,W,Y,G),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function H(Q,X){return new WX({type:"literal",values:Array.isArray(Q)?Q:[Q],...D.normalizeParams(X)})}var YX=w("ZodTransform",(Q,X)=>{b4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>C2(Q,W,Y,G),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")throw new XQ(Q.constructor.name);W.addIssue=(J)=>{if(typeof J==="string")W.issues.push(D.issue(J,W.value,X));else{let q=J;if(q.fatal)q.continue=!1;q.code??(q.code="custom"),q.input??(q.input=W.value),q.inst??(q.inst=Q),W.issues.push(D.issue(q))}};let G=X.transform(W.value,W);if(G instanceof Promise)return G.then((J)=>{return W.value=J,W});return W.value=G,W}});function GX(Q){return new YX({type:"transform",transform:Q})}var F3=w("ZodOptional",(Q,X)=>{Z4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>l2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType});function H3(Q){return new F3({type:"optional",innerType:Q})}var JX=w("ZodNullable",(Q,X)=>{j4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>u2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType});function N3(Q){return new JX({type:"nullable",innerType:Q})}var qX=w("ZodDefault",(Q,X)=>{C4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>y2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function KX(Q,X){return new qX({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():D.shallowClone(X)}})}var wX=w("ZodPrefault",(Q,X)=>{k4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>m2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType});function AX(Q,X){return new wX({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():D.shallowClone(X)}})}var I3=w("ZodNonOptional",(Q,X)=>{v4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>c2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType});function LX(Q,X){return new I3({type:"nonoptional",innerType:Q,...D.normalizeParams(X)})}var HX=w("ZodCatch",(Q,X)=>{g4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>f2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function NX(Q,X){return new HX({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var BX=w("ZodPipe",(Q,X)=>{h4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>o2(Q,W,Y,G),Q.in=X.in,Q.out=X.out});function B3(Q,X){return new BX({type:"pipe",in:Q,out:X})}var zX=w("ZodReadonly",(Q,X)=>{x4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>r2(Q,W,Y,G),Q.unwrap=()=>Q._zod.def.innerType});function OX(Q){return new zX({type:"readonly",innerType:Q})}var EX=w("ZodCustom",(Q,X)=>{u4.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,G)=>j2(Q,W,Y,G)});function DX(Q,X={}){return V2(EX,Q,X)}function FX(Q){return M2(Q)}import{ContentBlockSchema as IX,CallToolResultSchema as VX,ImplementationSchema as V3,RequestIdSchema as MX,ToolSchema as $X}from"@modelcontextprotocol/sdk/types.js";var M3=p([H("light"),H("dark")]).describe("Color theme preference for the host environment."),kQ=p([H("inline"),H("fullscreen"),H("pip")]).describe("Display mode for UI presentation."),PX=p([H("--color-background-primary"),H("--color-background-secondary"),H("--color-background-tertiary"),H("--color-background-inverse"),H("--color-background-ghost"),H("--color-background-info"),H("--color-background-danger"),H("--color-background-success"),H("--color-background-warning"),H("--color-background-disabled"),H("--color-text-primary"),H("--color-text-secondary"),H("--color-text-tertiary"),H("--color-text-inverse"),H("--color-text-info"),H("--color-text-danger"),H("--color-text-success"),H("--color-text-warning"),H("--color-text-disabled"),H("--color-border-primary"),H("--color-border-secondary"),H("--color-border-tertiary"),H("--color-border-inverse"),H("--color-border-ghost"),H("--color-border-info"),H("--color-border-danger"),H("--color-border-success"),H("--color-border-warning"),H("--color-border-disabled"),H("--color-ring-primary"),H("--color-ring-secondary"),H("--color-ring-inverse"),H("--color-ring-info"),H("--color-ring-danger"),H("--color-ring-success"),H("--color-ring-warning"),H("--font-sans"),H("--font-mono"),H("--font-weight-normal"),H("--font-weight-medium"),H("--font-weight-semibold"),H("--font-weight-bold"),H("--font-text-xs-size"),H("--font-text-sm-size"),H("--font-text-md-size"),H("--font-text-lg-size"),H("--font-heading-xs-size"),H("--font-heading-sm-size"),H("--font-heading-md-size"),H("--font-heading-lg-size"),H("--font-heading-xl-size"),H("--font-heading-2xl-size"),H("--font-heading-3xl-size"),H("--font-text-xs-line-height"),H("--font-text-sm-line-height"),H("--font-text-md-line-height"),H("--font-text-lg-line-height"),H("--font-heading-xs-line-height"),H("--font-heading-sm-line-height"),H("--font-heading-md-line-height"),H("--font-heading-lg-line-height"),H("--font-heading-xl-line-height"),H("--font-heading-2xl-line-height"),H("--font-heading-3xl-line-height"),H("--border-radius-xs"),H("--border-radius-sm"),H("--border-radius-md"),H("--border-radius-lg"),H("--border-radius-xl"),H("--border-radius-full"),H("--border-width-regular"),H("--shadow-hairline"),H("--shadow-sm"),H("--shadow-md"),H("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),UX=zQ(PX.describe(`Style variables for theming MCP apps.
|
|
23
|
+
|
|
24
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
25
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
26
|
+
|
|
27
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
28
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),p([U(),E3()]).describe(`Style variables for theming MCP apps.
|
|
29
|
+
|
|
30
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
31
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
32
|
+
|
|
33
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
34
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
35
|
+
|
|
36
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
37
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
38
|
+
|
|
39
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
40
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),RX=z({method:H("ui/open-link"),params:z({url:U().describe("URL to open in the host's browser")})}),B0=s({isError:c().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}),z0=s({isError:c().optional().describe("True if the host rejected or failed to deliver the message.")}),SX=z({method:H("ui/notifications/sandbox-proxy-ready"),params:z({})}),_X=z({method:H("ui/notifications/sandbox-resource-ready"),params:z({html:U().describe("HTML content to load into the inner iframe."),sandbox:U().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:z({connectDomains:y(U()).optional().describe("Origins for network requests (fetch/XHR/WebSocket)."),resourceDomains:y(U()).optional().describe("Origins for static resources (scripts, images, styles, fonts).")}).optional().describe("CSP configuration from resource metadata.")})}),TX=z({method:H("ui/notifications/size-changed"),params:z({width:C().optional().describe("New width in pixels."),height:C().optional().describe("New height in pixels.")})}),O0=z({method:H("ui/notifications/tool-input"),params:z({arguments:zQ(U(),i().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),E0=z({method:H("ui/notifications/tool-input-partial"),params:z({arguments:zQ(U(),i().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),D0=z({method:H("ui/notifications/tool-cancelled"),params:z({reason:U().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),$3=z({variables:UX.optional().describe("CSS variables for theming the app.")}),F0=z({method:H("ui/resource-teardown"),params:z({})}),bX=zQ(U(),i()),P3=z({experimental:z({}).optional().describe("Experimental features (structure TBD)."),openLinks:z({}).optional().describe("Host supports opening external URLs."),serverTools:z({listChanged:c().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:z({listChanged:c().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:z({}).optional().describe("Host accepts log messages.")}),U3=z({experimental:z({}).optional().describe("Experimental features (structure TBD)."),tools:z({listChanged:c().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call.")}),ZX=z({method:H("ui/notifications/initialized"),params:z({}).optional()}),R3=z({connectDomains:y(U()).optional().describe("Origins for network requests (fetch/XHR/WebSocket)."),resourceDomains:y(U()).optional().describe("Origins for static resources (scripts, images, styles, fonts).")}),jX=z({csp:R3.optional().describe("Content Security Policy configuration."),domain:U().optional().describe("Dedicated origin for widget sandbox."),prefersBorder:c().optional().describe("Visual boundary preference - true if UI prefers a visible border.")}),CX=z({method:H("ui/request-display-mode"),params:z({mode:kQ.describe("The display mode being requested.")})}),I0=s({mode:kQ.describe("The display mode that was actually set. May differ from requested if not supported.")}),S3=p([H("model"),H("app")]).describe("Tool visibility scope - who can access the tool."),kX=z({resourceUri:U(),visibility:y(S3).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
41
|
+
- "model": Tool visible to and callable by the agent
|
|
42
|
+
- "app": Tool callable by the app from this server only`)}),vX=z({method:H("ui/message"),params:z({role:H("user").describe('Message role, currently only "user" is supported.'),content:y(IX).describe("Message content blocks (text, image, etc.).")})}),V0=z({method:H("ui/notifications/tool-result"),params:VX.describe("Standard MCP tool execution result.")}),M0=s({toolInfo:z({id:MX.describe("JSON-RPC id of the tools/call request."),tool:$X.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:M3.optional().describe("Current color theme preference."),styles:$3.optional().describe("Style configuration for theming the app."),displayMode:kQ.optional().describe("How the UI is currently displayed."),availableDisplayModes:y(U()).optional().describe("Display modes the host supports."),viewport:z({width:C().describe("Current viewport width in pixels."),height:C().describe("Current viewport height in pixels."),maxHeight:C().optional().describe("Maximum available height in pixels (if constrained)."),maxWidth:C().optional().describe("Maximum available width in pixels (if constrained).")}).optional().describe("Current and maximum dimensions available to the UI."),locale:U().optional().describe("User's language and region preference in BCP 47 format."),timeZone:U().optional().describe("User's timezone in IANA format."),userAgent:U().optional().describe("Host application identifier."),platform:p([H("web"),H("desktop"),H("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:z({touch:c().optional().describe("Whether the device supports touch input."),hover:c().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:z({top:C().describe("Top safe area inset in pixels."),right:C().describe("Right safe area inset in pixels."),bottom:C().describe("Bottom safe area inset in pixels."),left:C().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}),$0=z({method:H("ui/notifications/host-context-changed"),params:M0.describe("Partial context update containing only changed fields.")}),gX=z({method:H("ui/initialize"),params:z({appInfo:V3.describe("App identification (name and version)."),appCapabilities:U3.describe("Features and capabilities this app provides."),protocolVersion:U().describe("Protocol version this app supports.")})}),P0=s({protocolVersion:U().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:V3.describe("Host application identification and version."),hostCapabilities:P3.describe("Features and capabilities provided by the host."),hostContext:M0.describe("Rich context about the host environment.")});var U0="ui/resourceUri",_3="text/html;profile=mcp-app";class mX extends hX{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(Q,X={},W={autoResize:!0}){super(W);this._appInfo=Q;this._capabilities=X;this.options=W;this.setRequestHandler(yX,(Y)=>{return console.log("Received ping:",Y.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(Q){this.setNotificationHandler(O0,(X)=>Q(X.params))}set ontoolinputpartial(Q){this.setNotificationHandler(E0,(X)=>Q(X.params))}set ontoolresult(Q){this.setNotificationHandler(V0,(X)=>Q(X.params))}set ontoolcancelled(Q){this.setNotificationHandler(D0,(X)=>Q(X.params))}set onhostcontextchanged(Q){this.setNotificationHandler($0,(X)=>{this._hostContext={...this._hostContext,...X.params},Q(X.params)})}set onteardown(Q){this.setRequestHandler(F0,(X,W)=>Q(X.params,W))}set oncalltool(Q){this.setRequestHandler(xX,(X,W)=>Q(X.params,W))}set onlisttools(Q){this.setRequestHandler(cX,(X,W)=>Q(X.params,W))}assertCapabilityForMethod(Q){}assertRequestHandlerCapability(Q){switch(Q){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${Q})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${Q} registered`)}}assertNotificationCapability(Q){}assertTaskCapability(Q){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(Q){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(Q,X){return await this.request({method:"tools/call",params:Q},uX,X)}sendMessage(Q,X){return this.request({method:"ui/message",params:Q},z0,X)}sendLog(Q){return this.notification({method:"notifications/message",params:Q})}openLink(Q,X){return this.request({method:"ui/open-link",params:Q},B0,X)}sendOpenLink=this.openLink;requestDisplayMode(Q,X){return this.request({method:"ui/request-display-mode",params:Q},I0,X)}sendSizeChanged(Q){return this.notification({method:"ui/notifications/size-changed",params:Q})}setupSizeChangedNotifications(){let Q=!1,X=0,W=0,Y=()=>{if(Q)return;Q=!0,requestAnimationFrame(()=>{Q=!1;let J=document.documentElement,q=J.style.width,K=J.style.height;J.style.width="fit-content",J.style.height="fit-content";let A=J.getBoundingClientRect();J.style.width=q,J.style.height=K;let L=window.innerWidth-J.clientWidth,N=Math.ceil(A.width+L),O=Math.ceil(A.height);if(N!==X||O!==W)X=N,W=O,this.sendSizeChanged({width:N,height:O})})};Y();let G=new ResizeObserver(Y);return G.observe(document.documentElement),G.observe(document.body),()=>G.disconnect()}async connect(Q=new OQ(window.parent),X){await super.connect(Q);try{let W=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:gQ}},P0,X);if(W===void 0)throw Error(`Server sent invalid initialize result: ${W}`);if(this._hostCapabilities=W.hostCapabilities,this._hostInfo=W.hostInfo,this._hostContext=W.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(W){throw this.close(),W}}}function mW(Q,X,W,Y){let G=W._meta,J=G.ui,q=G[U0],K=G;if(J?.resourceUri&&!q)K={...G,[U0]:J.resourceUri};else if(q&&!J?.resourceUri)K={...G,ui:{...J,resourceUri:q}};Q.registerTool(X,{...W,_meta:K},Y)}function fW(Q,X,W,Y,G){Q.registerResource(X,W,{mimeType:_3,...Y},G)}export{mW as registerAppTool,fW as registerAppResource,U0 as RESOURCE_URI_META_KEY,_3 as RESOURCE_MIME_TYPE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|