@heybox/hb-sdk 0.9.1-alpha.0 → 0.9.1-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +123 -2
  2. package/README.md +45 -7
  3. package/dist/card-controller.cjs.js +194 -0
  4. package/dist/card-controller.esm.js +159 -0
  5. package/dist/cli-chunks/_commonjs-dynamic-modules-DUamuDzp.cjs +7 -0
  6. package/dist/cli-chunks/{build-DqZ4DwUv.cjs → build-BK0MOduC.cjs} +15 -7
  7. package/dist/cli-chunks/{context-D_VhP5QF.cjs → context-D7AFyc_9.cjs} +14 -14
  8. package/dist/cli-chunks/{create-xNSgjouq.cjs → create-C-pAXZR_.cjs} +5 -3
  9. package/dist/cli-chunks/{dev-IsUsrbjC.cjs → dev-CONKtd6c.cjs} +59 -14
  10. package/dist/cli-chunks/{doctor-BD-IXRyP.cjs → doctor-D18leeH7.cjs} +8 -5
  11. package/dist/cli-chunks/{index-CUebAm7J.cjs → index-BWRDIX1T.cjs} +7851 -486
  12. package/dist/cli-chunks/{index-HUjK7vn8.cjs → index-DJoBhXcG.cjs} +9 -13
  13. package/dist/cli-chunks/{index.esm-Bj9uKrhv.cjs → index.esm-CtAKePcf.cjs} +36 -37
  14. package/dist/cli-chunks/{login-D8GoAMYG.cjs → login-BHq8vDRt.cjs} +36 -36
  15. package/dist/cli-chunks/{project-vite-CzIodp6y.cjs → project-vite-DD3bmbqm.cjs} +1 -1
  16. package/dist/cli-chunks/{remote-nQq3nAUy.cjs → remote-DeLLzkXt.cjs} +71 -90
  17. package/dist/cli-chunks/runtime-gate-wKj1l5xM.cjs +201946 -0
  18. package/dist/cli-chunks/{runtime-permission-env-B_poIoGP.cjs → runtime-permission-env-DBra_0-U.cjs} +7012 -3305
  19. package/dist/cli-chunks/{skill-DZK8UAXb.cjs → skill-Cq3wjRBj.cjs} +9 -6
  20. package/dist/cli-chunks/{version-CNYpJdS7.cjs → version-BF4JQQCU.cjs} +1 -1
  21. package/dist/cli.cjs +10 -7
  22. package/dist/devtools/browser-dev-host/assets/browser-dev-host-C4b9nlYA.js +102 -0
  23. package/dist/devtools/browser-dev-host/assets/desktop-app-launch-DXmUwcoE.js +6 -0
  24. package/dist/devtools/browser-dev-host/assets/index-BRxbUJVN.css +1 -0
  25. package/dist/devtools/browser-dev-host/assets/{index-IDyoULwK.js → index-CVZ3CdPt.js} +4 -4
  26. package/dist/devtools/browser-dev-host/index.html +3 -3
  27. package/dist/index.cjs.js +6333 -282
  28. package/dist/index.esm.js +6333 -283
  29. package/dist/miniapp-publish.cjs.js +6613 -157
  30. package/dist/miniapp-publish.esm.js +6613 -158
  31. package/dist/protocol.cjs.js +5824 -0
  32. package/dist/protocol.esm.js +5823 -1
  33. package/dist/vite.cjs.js +7476 -206
  34. package/dist/vite.esm.js +7475 -207
  35. package/dist/workspace-card-build-sandbox-worker.mjs +72 -0
  36. package/package.json +33 -18
  37. package/skill/SKILL.md +15 -0
  38. package/skill/skill.json +5 -5
  39. package/types/card-controller.d.ts +3682 -0
  40. package/types/index.d.ts +7639 -35
  41. package/types/miniapp-publish/index.d.ts +542 -64
  42. package/types/protocol.d.ts +2094 -9
  43. package/types/vite/index.d.ts +25 -12
  44. package/dist/cli-chunks/runtime-gate-uTsNPu3U.cjs +0 -65
  45. package/dist/cli-chunks/session-DDNple9k.cjs +0 -3403
  46. package/dist/devtools/browser-dev-host/assets/browser-dev-host-YJT0-SwX.js +0 -102
  47. package/dist/devtools/browser-dev-host/assets/desktop-app-launch-GMEmtpsR.js +0 -6
  48. package/dist/devtools/browser-dev-host/assets/index-DRM3hPNc.css +0 -1
  49. package/types/core/client.d.ts +0 -108
  50. package/types/core/csp-violation.d.ts +0 -5
  51. package/types/core/errors.d.ts +0 -78
  52. package/types/core/event-bus.d.ts +0 -11
  53. package/types/core/handshake-state.d.ts +0 -54
  54. package/types/core/history-observer.d.ts +0 -4
  55. package/types/core/mini-dev-console.d.ts +0 -36
  56. package/types/core/network-sanitize.d.ts +0 -31
  57. package/types/core/sdk.d.ts +0 -104
  58. package/types/core/singleton.d.ts +0 -372
  59. package/types/core/utils.d.ts +0 -10
  60. package/types/core/version.d.ts +0 -2
  61. package/types/devtools/device-logs.d.ts +0 -48
  62. package/types/miniapp-manifest/basic-info-browser.d.ts +0 -37
  63. package/types/miniapp-manifest/basic-info-image-header.d.ts +0 -6
  64. package/types/miniapp-manifest/basic-info-node.d.ts +0 -17
  65. package/types/miniapp-manifest/basic-info-placeholder.d.ts +0 -1
  66. package/types/miniapp-manifest/basic-info.d.ts +0 -33
  67. package/types/miniapp-manifest/bindings.d.ts +0 -70
  68. package/types/miniapp-manifest/category.d.ts +0 -11
  69. package/types/miniapp-manifest/companion-directory.d.ts +0 -2
  70. package/types/miniapp-manifest/companion-executable.d.ts +0 -4
  71. package/types/miniapp-manifest/companion-types.d.ts +0 -63
  72. package/types/miniapp-manifest/companions.d.ts +0 -17
  73. package/types/miniapp-manifest/index.d.ts +0 -7
  74. package/types/miniapp-manifest/node.d.ts +0 -22
  75. package/types/miniapp-manifest/permissions.d.ts +0 -48
  76. package/types/miniapp-manifest/runtime-gate.d.ts +0 -12
  77. package/types/miniapp-manifest/schema.d.ts +0 -302
  78. package/types/modules/auth/index.d.ts +0 -201
  79. package/types/modules/cloud/index.d.ts +0 -669
  80. package/types/modules/companion/index.d.ts +0 -1619
  81. package/types/modules/device/index.d.ts +0 -193
  82. package/types/modules/environment/index.d.ts +0 -238
  83. package/types/modules/files/index.d.ts +0 -5
  84. package/types/modules/files/registry.d.ts +0 -35
  85. package/types/modules/files/types.d.ts +0 -1548
  86. package/types/modules/navigation/app-pages/index.d.ts +0 -4
  87. package/types/modules/navigation/app-pages/types.d.ts +0 -135
  88. package/types/modules/navigation/index.d.ts +0 -312
  89. package/types/modules/network/index.d.ts +0 -457
  90. package/types/modules/network/observability.d.ts +0 -38
  91. package/types/modules/network/request-shape.d.ts +0 -44
  92. package/types/modules/share/copy-link.d.ts +0 -46
  93. package/types/modules/share/extra.d.ts +0 -5
  94. package/types/modules/share/index.d.ts +0 -294
  95. package/types/modules/share/screenshot.d.ts +0 -34
  96. package/types/modules/share/show-share-menu.d.ts +0 -29
  97. package/types/modules/share/types.d.ts +0 -201
  98. package/types/modules/storage/index.d.ts +0 -214
  99. package/types/modules/ui/index.d.ts +0 -315
  100. package/types/modules/user/get-info.d.ts +0 -44
  101. package/types/modules/user/index.d.ts +0 -245
  102. package/types/modules/user/revoke-authorization.d.ts +0 -31
  103. package/types/modules/user/steam-game-list.d.ts +0 -153
  104. package/types/modules/user/types.d.ts +0 -2
  105. package/types/modules/viewport/index.d.ts +0 -319
  106. package/types/protocol/capabilities.d.ts +0 -2
  107. package/types/protocol/constants.d.ts +0 -1
  108. package/types/protocol/dev-session.d.ts +0 -74
  109. package/types/protocol/guards.d.ts +0 -1
  110. package/types/protocol/runtime-permissions.d.ts +0 -2
  111. package/types/protocol/types.d.ts +0 -22
  112. package/types/skill-metadata.d.ts +0 -18
  113. package/types/vite/html-policy.d.ts +0 -6
  114. package/types/vite/runtime-permission-env.d.ts +0 -9
@@ -0,0 +1,3682 @@
1
+ import { WorkspaceCardJson, WorkspaceCardInputSchema, WorkspaceCardControllerContext, WorkspaceCardControllerResult, WorkspaceCardSize, WorkspaceCardDocuments, WorkspaceCardController } from '@heybox/hb-sdk-protocol';
2
+ export { WorkspaceCardController, WorkspaceCardControllerContext, WorkspaceCardControllerResult, WorkspaceCardDefinition, WorkspaceCardDocuments, WorkspaceCardJson, WorkspaceCardRefreshContext, WorkspaceCardSize, WorkspaceCardState } from '@heybox/hb-sdk-protocol';
3
+
4
+ type _JSONSchema = boolean | JSONSchema;
5
+ type JSONSchema = {
6
+ [k: string]: unknown;
7
+ $schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
8
+ $id?: string;
9
+ $anchor?: string;
10
+ $ref?: string;
11
+ $dynamicRef?: string;
12
+ $dynamicAnchor?: string;
13
+ $vocabulary?: Record<string, boolean>;
14
+ $comment?: string;
15
+ $defs?: Record<string, JSONSchema>;
16
+ type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
17
+ additionalItems?: _JSONSchema;
18
+ unevaluatedItems?: _JSONSchema;
19
+ prefixItems?: _JSONSchema[];
20
+ items?: _JSONSchema | _JSONSchema[];
21
+ contains?: _JSONSchema;
22
+ additionalProperties?: _JSONSchema;
23
+ unevaluatedProperties?: _JSONSchema;
24
+ properties?: Record<string, _JSONSchema>;
25
+ patternProperties?: Record<string, _JSONSchema>;
26
+ dependentSchemas?: Record<string, _JSONSchema>;
27
+ propertyNames?: _JSONSchema;
28
+ if?: _JSONSchema;
29
+ then?: _JSONSchema;
30
+ else?: _JSONSchema;
31
+ allOf?: JSONSchema[];
32
+ anyOf?: JSONSchema[];
33
+ oneOf?: JSONSchema[];
34
+ not?: _JSONSchema;
35
+ multipleOf?: number;
36
+ maximum?: number;
37
+ exclusiveMaximum?: number | boolean;
38
+ minimum?: number;
39
+ exclusiveMinimum?: number | boolean;
40
+ maxLength?: number;
41
+ minLength?: number;
42
+ pattern?: string;
43
+ maxItems?: number;
44
+ minItems?: number;
45
+ uniqueItems?: boolean;
46
+ maxContains?: number;
47
+ minContains?: number;
48
+ maxProperties?: number;
49
+ minProperties?: number;
50
+ required?: string[];
51
+ dependentRequired?: Record<string, string[]>;
52
+ enum?: Array<string | number | boolean | null>;
53
+ const?: string | number | boolean | null;
54
+ id?: string;
55
+ title?: string;
56
+ description?: string;
57
+ default?: unknown;
58
+ deprecated?: boolean;
59
+ readOnly?: boolean;
60
+ writeOnly?: boolean;
61
+ nullable?: boolean;
62
+ examples?: unknown[];
63
+ format?: string;
64
+ contentMediaType?: string;
65
+ contentEncoding?: string;
66
+ contentSchema?: JSONSchema;
67
+ _prefault?: unknown;
68
+ };
69
+ type BaseSchema = JSONSchema;
70
+
71
+ /** The Standard interface. */
72
+ interface StandardTypedV1<Input = unknown, Output = Input> {
73
+ /** The Standard properties. */
74
+ readonly "~standard": StandardTypedV1.Props<Input, Output>;
75
+ }
76
+ declare namespace StandardTypedV1 {
77
+ /** The Standard properties interface. */
78
+ interface Props<Input = unknown, Output = Input> {
79
+ /** The version number of the standard. */
80
+ readonly version: 1;
81
+ /** The vendor name of the schema library. */
82
+ readonly vendor: string;
83
+ /** Inferred types associated with the schema. */
84
+ readonly types?: Types<Input, Output> | undefined;
85
+ }
86
+ /** The Standard types interface. */
87
+ interface Types<Input = unknown, Output = Input> {
88
+ /** The input type of the schema. */
89
+ readonly input: Input;
90
+ /** The output type of the schema. */
91
+ readonly output: Output;
92
+ }
93
+ /** Infers the input type of a Standard. */
94
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
95
+ /** Infers the output type of a Standard. */
96
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
97
+ }
98
+ /** The Standard Schema interface. */
99
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
100
+ /** The Standard Schema properties. */
101
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
102
+ }
103
+ declare namespace StandardSchemaV1 {
104
+ /** The Standard Schema properties interface. */
105
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
106
+ /** Validates unknown input values. */
107
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
108
+ }
109
+ /** The result interface of the validate function. */
110
+ type Result<Output> = SuccessResult<Output> | FailureResult;
111
+ /** The result interface if validation succeeds. */
112
+ interface SuccessResult<Output> {
113
+ /** The typed output value. */
114
+ readonly value: Output;
115
+ /** The absence of issues indicates success. */
116
+ readonly issues?: undefined;
117
+ }
118
+ interface Options {
119
+ /** Implicit support for additional vendor-specific parameters, if needed. */
120
+ readonly libraryOptions?: Record<string, unknown> | undefined;
121
+ }
122
+ /** The result interface if validation fails. */
123
+ interface FailureResult {
124
+ /** The issues of failed validation. */
125
+ readonly issues: ReadonlyArray<Issue>;
126
+ }
127
+ /** The issue interface of the failure output. */
128
+ interface Issue {
129
+ /** The error message of the issue. */
130
+ readonly message: string;
131
+ /** The path of the issue, if any. */
132
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
133
+ }
134
+ /** The path segment interface of the issue. */
135
+ interface PathSegment {
136
+ /** The key representing a path segment. */
137
+ readonly key: PropertyKey;
138
+ }
139
+ /** The Standard types interface. */
140
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
141
+ }
142
+ /** Infers the input type of a Standard. */
143
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
144
+ /** Infers the output type of a Standard. */
145
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
146
+ }
147
+ /** The Standard JSON Schema interface. */
148
+ interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
149
+ /** The Standard JSON Schema properties. */
150
+ readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
151
+ }
152
+ declare namespace StandardJSONSchemaV1 {
153
+ /** The Standard JSON Schema properties interface. */
154
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
155
+ /** Methods for generating the input/output JSON Schema. */
156
+ readonly jsonSchema: Converter;
157
+ }
158
+ /** The Standard JSON Schema converter interface. */
159
+ interface Converter {
160
+ /** Converts the input type to JSON Schema. May throw if conversion is not supported. */
161
+ readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
162
+ /** Converts the output type to JSON Schema. May throw if conversion is not supported. */
163
+ readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
164
+ }
165
+ /** The target version of the generated JSON Schema.
166
+ *
167
+ * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use.
168
+ *
169
+ * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
170
+ *
171
+ * All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
172
+ */
173
+ type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
174
+ /** The options for the input/output methods. */
175
+ interface Options {
176
+ /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
177
+ readonly target: Target;
178
+ /** Implicit support for additional vendor-specific parameters, if needed. */
179
+ readonly libraryOptions?: Record<string, unknown> | undefined;
180
+ }
181
+ /** The Standard types interface. */
182
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
183
+ }
184
+ /** Infers the input type of a Standard. */
185
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
186
+ /** Infers the output type of a Standard. */
187
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
188
+ }
189
+ interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {
190
+ }
191
+
192
+ declare const $output: unique symbol;
193
+ type $output = typeof $output;
194
+ declare const $input: unique symbol;
195
+ type $input = typeof $input;
196
+ type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {
197
+ [K in keyof P]: $replace<P[K], S>;
198
+ }) => $replace<R, S> : Meta extends object ? {
199
+ [K in keyof Meta]: $replace<Meta[K], S>;
200
+ } : Meta;
201
+ type MetadataType = object | undefined;
202
+ declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
203
+ _meta: Meta;
204
+ _schema: Schema;
205
+ _map: WeakMap<Schema, $replace<Meta, Schema>>;
206
+ _idmap: Map<string, Schema>;
207
+ add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;
208
+ clear(): this;
209
+ remove(schema: Schema): this;
210
+ get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;
211
+ has(schema: Schema): boolean;
212
+ }
213
+ interface JSONSchemaMeta {
214
+ id?: string | undefined;
215
+ title?: string | undefined;
216
+ description?: string | undefined;
217
+ deprecated?: boolean | undefined;
218
+ [k: string]: unknown;
219
+ }
220
+ interface GlobalMeta extends JSONSchemaMeta {
221
+ }
222
+
223
+ type Processor<T extends $ZodType = $ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void;
224
+ interface JSONSchemaGeneratorParams {
225
+ processors: Record<string, Processor>;
226
+ /** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
227
+ * @default globalRegistry */
228
+ metadata?: $ZodRegistry<Record<string, any>>;
229
+ /** The JSON Schema version to target.
230
+ * - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
231
+ * - `"draft-07"` — JSON Schema Draft 7
232
+ * - `"draft-04"` — JSON Schema Draft 4
233
+ * - `"openapi-3.0"` — OpenAPI 3.0 Schema Object */
234
+ target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined;
235
+ /** How to handle unrepresentable types.
236
+ * - `"throw"` — Default. Unrepresentable types throw an error
237
+ * - `"any"` — Unrepresentable types become `{}` */
238
+ unrepresentable?: "throw" | "any";
239
+ /** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
240
+ override?: (ctx: {
241
+ zodSchema: $ZodTypes;
242
+ jsonSchema: BaseSchema;
243
+ path: (string | number)[];
244
+ }) => void;
245
+ /** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, defaults, coerced primitives, etc.
246
+ * - `"output"` — Default. Convert the output schema.
247
+ * - `"input"` — Convert the input schema. */
248
+ io?: "input" | "output";
249
+ cycles?: "ref" | "throw";
250
+ reused?: "ref" | "inline";
251
+ external?: {
252
+ registry: $ZodRegistry<{
253
+ id?: string | undefined;
254
+ }>;
255
+ uri?: ((id: string) => string) | undefined;
256
+ defs: Record<string, BaseSchema>;
257
+ } | undefined;
258
+ }
259
+ /**
260
+ * Parameters for the toJSONSchema function.
261
+ */
262
+ type ToJSONSchemaParams = Omit<JSONSchemaGeneratorParams, "processors" | "external">;
263
+ interface ProcessParams {
264
+ schemaPath: $ZodType[];
265
+ path: (string | number)[];
266
+ }
267
+ interface Seen {
268
+ /** JSON Schema result for this Zod schema */
269
+ schema: BaseSchema;
270
+ /** A cached version of the schema that doesn't get overwritten during ref resolution */
271
+ def?: BaseSchema;
272
+ defId?: string | undefined;
273
+ /** Number of times this schema was encountered during traversal */
274
+ count: number;
275
+ /** Cycle path */
276
+ cycle?: (string | number)[] | undefined;
277
+ isParent?: boolean | undefined;
278
+ /** Schema to inherit JSON Schema properties from (set by processor for wrappers) */
279
+ ref?: $ZodType | null;
280
+ /** JSON Schema property path for this schema */
281
+ path?: (string | number)[] | undefined;
282
+ }
283
+ interface ToJSONSchemaContext {
284
+ processors: Record<string, Processor>;
285
+ metadataRegistry: $ZodRegistry<Record<string, any>>;
286
+ target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string);
287
+ unrepresentable: "throw" | "any";
288
+ override: (ctx: {
289
+ zodSchema: $ZodType;
290
+ jsonSchema: BaseSchema;
291
+ path: (string | number)[];
292
+ }) => void;
293
+ io: "input" | "output";
294
+ counter: number;
295
+ seen: Map<$ZodType, Seen>;
296
+ cycles: "ref" | "throw";
297
+ reused: "ref" | "inline";
298
+ external?: {
299
+ registry: $ZodRegistry<{
300
+ id?: string | undefined;
301
+ }>;
302
+ uri?: ((id: string) => string) | undefined;
303
+ defs: Record<string, BaseSchema>;
304
+ } | undefined;
305
+ }
306
+ type ZodStandardSchemaWithJSON$1<T> = StandardSchemaWithJSONProps<input<T>, output<T>>;
307
+ interface ZodStandardJSONSchemaPayload<T> extends BaseSchema {
308
+ "~standard": ZodStandardSchemaWithJSON$1<T>;
309
+ }
310
+
311
+ type JSONType = string | number | boolean | null | JSONType[] | {
312
+ [key: string]: JSONType;
313
+ };
314
+ type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
315
+ type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {});
316
+ type IsAny<T> = 0 extends 1 & T ? true : false;
317
+ type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
318
+ type MakePartial<T, K extends keyof T> = Omit$1<T, K> & InexactPartial<Pick<T, K>>;
319
+ type NoUndefined<T> = T extends undefined ? never : T;
320
+ type LoosePartial<T extends object> = InexactPartial<T> & {
321
+ [k: string]: unknown;
322
+ };
323
+ type Mask<Keys extends PropertyKey> = {
324
+ [K in Keys]?: true;
325
+ };
326
+ type Writeable<T> = {
327
+ -readonly [P in keyof T]: T[P];
328
+ } & {};
329
+ type InexactPartial<T> = {
330
+ [P in keyof T]?: T[P] | undefined;
331
+ };
332
+ type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
333
+ readonly [Symbol.toStringTag]: string;
334
+ } | Date | Error | Generator | Promise<unknown> | RegExp;
335
+ type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
336
+ type SomeObject = Record<PropertyKey, any>;
337
+ type Identity<T> = T;
338
+ type Flatten<T> = Identity<{
339
+ [k in keyof T]: T[k];
340
+ }>;
341
+ type Prettify<T> = {
342
+ [K in keyof T]: T[K];
343
+ } & {};
344
+ type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : {
345
+ [K in keyof A as K extends keyof B ? never : K]: A[K];
346
+ } & {
347
+ [K in keyof B]: B[K];
348
+ }>;
349
+ type TupleItems = ReadonlyArray<SomeType>;
350
+ type AnyFunc = (...args: any[]) => any;
351
+ type MaybeAsync<T> = T | Promise<T>;
352
+ type EnumValue = string | number;
353
+ type EnumLike = Readonly<Record<string, EnumValue>>;
354
+ type ToEnum<T extends EnumValue> = Flatten<{
355
+ [k in T]: k;
356
+ }>;
357
+ type Literal = string | number | bigint | boolean | null | undefined;
358
+ type Primitive = string | number | symbol | bigint | boolean | null | undefined;
359
+ type HasLength = {
360
+ length: number;
361
+ };
362
+ type Numeric = number | bigint | Date;
363
+ type PropValues = Record<string, Set<Primitive>>;
364
+ type PrimitiveSet = Set<Primitive>;
365
+ type EmptyToNever<T> = keyof T extends never ? never : T;
366
+ declare abstract class Class {
367
+ constructor(..._args: any[]);
368
+ }
369
+
370
+ declare const version: {
371
+ readonly major: 4;
372
+ readonly minor: 4;
373
+ readonly patch: number;
374
+ };
375
+
376
+ interface ParseContext<T extends $ZodIssueBase = never> {
377
+ /** Customize error messages. */
378
+ readonly error?: $ZodErrorMap<T>;
379
+ /** Include the `input` field in issue objects. Default `false`. */
380
+ readonly reportInput?: boolean;
381
+ /** Skip eval-based fast path. Default `false`. */
382
+ readonly jitless?: boolean;
383
+ }
384
+ /** @internal */
385
+ interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseContext<T> {
386
+ readonly async?: boolean | undefined;
387
+ readonly direction?: "forward" | "backward";
388
+ readonly skipChecks?: boolean;
389
+ }
390
+ interface ParsePayload<T = unknown> {
391
+ value: T;
392
+ issues: $ZodRawIssue[];
393
+ /** A way to mark a whole payload as aborted. Used in codecs/pipes. */
394
+ aborted?: boolean;
395
+ /** @internal Marks a value as a fallback that an outer wrapper (e.g.
396
+ * $ZodOptional) may override with its own interpretation when input was
397
+ * undefined. Set by $ZodCatch when catchValue substitutes and by every
398
+ * $ZodTransform invocation. */
399
+ fallback?: boolean | undefined;
400
+ }
401
+ type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
402
+ interface $ZodTypeDef {
403
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
404
+ error?: $ZodErrorMap<never> | undefined;
405
+ checks?: $ZodCheck<never>[];
406
+ }
407
+ interface _$ZodTypeInternals {
408
+ /** The `@zod/core` version of this schema */
409
+ version: typeof version;
410
+ /** Schema definition. */
411
+ def: $ZodTypeDef;
412
+ /** @internal Randomly generated ID for this schema. */
413
+ /** @internal List of deferred initializers. */
414
+ deferred: AnyFunc[] | undefined;
415
+ /** @internal Parses input and runs all checks (refinements). */
416
+ run(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
417
+ /** @internal Parses input, doesn't run checks. */
418
+ parse(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
419
+ /** @internal Stores identifiers for the set of traits implemented by this schema. */
420
+ traits: Set<string>;
421
+ /** @internal Indicates that a schema output type should be considered optional inside objects.
422
+ * @default Required
423
+ */
424
+ /** @internal */
425
+ optin?: "optional" | undefined;
426
+ /** @internal */
427
+ optout?: "optional" | undefined;
428
+ /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
429
+ *
430
+ * Defined on: enum, const, literal, null, undefined
431
+ * Passthrough: optional, nullable, branded, default, catch, pipe
432
+ * Todo: unions?
433
+ */
434
+ values?: PrimitiveSet | undefined;
435
+ /** Default value bubbled up from */
436
+ /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
437
+ propValues?: PropValues | undefined;
438
+ /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
439
+ pattern: RegExp | undefined;
440
+ /** @internal The constructor function of this schema. */
441
+ constr: new (def: any) => $ZodType;
442
+ /** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
443
+ bag: Record<string, unknown>;
444
+ /** @internal The set of issues this schema might throw during type checking. */
445
+ isst: $ZodIssueBase;
446
+ /** @internal Subject to change, not a public API. */
447
+ processJSONSchema?: ((ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void) | undefined;
448
+ /** An optional method used to override `toJSONSchema` logic. */
449
+ toJSONSchema?: () => unknown;
450
+ /** @internal The parent of this schema. Only set during certain clone operations. */
451
+ parent?: $ZodType | undefined;
452
+ }
453
+ /** @internal */
454
+ interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
455
+ /** @internal The inferred output type */
456
+ output: O;
457
+ /** @internal The inferred input type */
458
+ input: I;
459
+ }
460
+ type $ZodStandardSchema<T> = StandardSchemaV1.Props<input<T>, output<T>>;
461
+ type SomeType = {
462
+ _zod: _$ZodTypeInternals;
463
+ };
464
+ interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals> extends $ZodType<T["output"], T["input"], T> {
465
+ }
466
+ interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> {
467
+ _zod: Internals;
468
+ "~standard": $ZodStandardSchema<this>;
469
+ }
470
+ declare const $ZodType: $constructor<$ZodType>;
471
+
472
+ interface $ZodStringDef extends $ZodTypeDef {
473
+ type: "string";
474
+ coerce?: boolean;
475
+ checks?: $ZodCheck<string>[];
476
+ }
477
+ interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
478
+ def: $ZodStringDef;
479
+ /** @deprecated Internal API, use with caution (not deprecated) */
480
+ pattern: RegExp;
481
+ /** @deprecated Internal API, use with caution (not deprecated) */
482
+ isst: $ZodIssueInvalidType;
483
+ bag: LoosePartial<{
484
+ minimum: number;
485
+ maximum: number;
486
+ patterns: Set<RegExp>;
487
+ format: string;
488
+ contentEncoding: string;
489
+ }>;
490
+ }
491
+ interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {
492
+ }
493
+ declare const $ZodString: $constructor<$ZodString>;
494
+ interface $ZodStringFormatDef<Format extends string = string> extends $ZodStringDef, $ZodCheckStringFormatDef<Format> {
495
+ }
496
+ interface $ZodStringFormatInternals<Format extends string = string> extends $ZodStringInternals<string>, $ZodCheckStringFormatInternals {
497
+ def: $ZodStringFormatDef<Format>;
498
+ }
499
+ interface $ZodStringFormat<Format extends string = string> extends $ZodType {
500
+ _zod: $ZodStringFormatInternals<Format>;
501
+ }
502
+ declare const $ZodStringFormat: $constructor<$ZodStringFormat>;
503
+ interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> {
504
+ }
505
+ interface $ZodGUID extends $ZodType {
506
+ _zod: $ZodGUIDInternals;
507
+ }
508
+ declare const $ZodGUID: $constructor<$ZodGUID>;
509
+ interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> {
510
+ version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8";
511
+ }
512
+ interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> {
513
+ def: $ZodUUIDDef;
514
+ }
515
+ interface $ZodUUID extends $ZodType {
516
+ _zod: $ZodUUIDInternals;
517
+ }
518
+ declare const $ZodUUID: $constructor<$ZodUUID>;
519
+ interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> {
520
+ }
521
+ interface $ZodEmail extends $ZodType {
522
+ _zod: $ZodEmailInternals;
523
+ }
524
+ declare const $ZodEmail: $constructor<$ZodEmail>;
525
+ interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
526
+ hostname?: RegExp | undefined;
527
+ protocol?: RegExp | undefined;
528
+ normalize?: boolean | undefined;
529
+ }
530
+ interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
531
+ def: $ZodURLDef;
532
+ }
533
+ interface $ZodURL extends $ZodType {
534
+ _zod: $ZodURLInternals;
535
+ }
536
+ declare const $ZodURL: $constructor<$ZodURL>;
537
+ interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> {
538
+ }
539
+ interface $ZodEmoji extends $ZodType {
540
+ _zod: $ZodEmojiInternals;
541
+ }
542
+ declare const $ZodEmoji: $constructor<$ZodEmoji>;
543
+ interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
544
+ }
545
+ interface $ZodNanoID extends $ZodType {
546
+ _zod: $ZodNanoIDInternals;
547
+ }
548
+ declare const $ZodNanoID: $constructor<$ZodNanoID>;
549
+ /**
550
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
551
+ * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
552
+ * See https://github.com/paralleldrive/cuid.
553
+ */
554
+ interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {
555
+ }
556
+ /**
557
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
558
+ * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
559
+ * See https://github.com/paralleldrive/cuid.
560
+ */
561
+ interface $ZodCUID extends $ZodType {
562
+ _zod: $ZodCUIDInternals;
563
+ }
564
+ /**
565
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
566
+ * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
567
+ * See https://github.com/paralleldrive/cuid.
568
+ */
569
+ declare const $ZodCUID: $constructor<$ZodCUID>;
570
+ interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {
571
+ }
572
+ interface $ZodCUID2 extends $ZodType {
573
+ _zod: $ZodCUID2Internals;
574
+ }
575
+ declare const $ZodCUID2: $constructor<$ZodCUID2>;
576
+ interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> {
577
+ }
578
+ interface $ZodULID extends $ZodType {
579
+ _zod: $ZodULIDInternals;
580
+ }
581
+ declare const $ZodULID: $constructor<$ZodULID>;
582
+ interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> {
583
+ }
584
+ interface $ZodXID extends $ZodType {
585
+ _zod: $ZodXIDInternals;
586
+ }
587
+ declare const $ZodXID: $constructor<$ZodXID>;
588
+ interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> {
589
+ }
590
+ interface $ZodKSUID extends $ZodType {
591
+ _zod: $ZodKSUIDInternals;
592
+ }
593
+ declare const $ZodKSUID: $constructor<$ZodKSUID>;
594
+ interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> {
595
+ precision: number | null;
596
+ offset: boolean;
597
+ local: boolean;
598
+ }
599
+ interface $ZodISODateTimeInternals extends $ZodStringFormatInternals {
600
+ def: $ZodISODateTimeDef;
601
+ }
602
+ interface $ZodISODateTime extends $ZodType {
603
+ _zod: $ZodISODateTimeInternals;
604
+ }
605
+ declare const $ZodISODateTime: $constructor<$ZodISODateTime>;
606
+ interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> {
607
+ }
608
+ interface $ZodISODate extends $ZodType {
609
+ _zod: $ZodISODateInternals;
610
+ }
611
+ declare const $ZodISODate: $constructor<$ZodISODate>;
612
+ interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> {
613
+ precision?: number | null;
614
+ }
615
+ interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> {
616
+ def: $ZodISOTimeDef;
617
+ }
618
+ interface $ZodISOTime extends $ZodType {
619
+ _zod: $ZodISOTimeInternals;
620
+ }
621
+ declare const $ZodISOTime: $constructor<$ZodISOTime>;
622
+ interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> {
623
+ }
624
+ interface $ZodISODuration extends $ZodType {
625
+ _zod: $ZodISODurationInternals;
626
+ }
627
+ declare const $ZodISODuration: $constructor<$ZodISODuration>;
628
+ interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> {
629
+ version?: "v4";
630
+ }
631
+ interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> {
632
+ def: $ZodIPv4Def;
633
+ }
634
+ interface $ZodIPv4 extends $ZodType {
635
+ _zod: $ZodIPv4Internals;
636
+ }
637
+ declare const $ZodIPv4: $constructor<$ZodIPv4>;
638
+ interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> {
639
+ version?: "v6";
640
+ }
641
+ interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
642
+ def: $ZodIPv6Def;
643
+ }
644
+ interface $ZodIPv6 extends $ZodType {
645
+ _zod: $ZodIPv6Internals;
646
+ }
647
+ declare const $ZodIPv6: $constructor<$ZodIPv6>;
648
+ interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
649
+ version?: "v4";
650
+ }
651
+ interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> {
652
+ def: $ZodCIDRv4Def;
653
+ }
654
+ interface $ZodCIDRv4 extends $ZodType {
655
+ _zod: $ZodCIDRv4Internals;
656
+ }
657
+ declare const $ZodCIDRv4: $constructor<$ZodCIDRv4>;
658
+ interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> {
659
+ version?: "v6";
660
+ }
661
+ interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> {
662
+ def: $ZodCIDRv6Def;
663
+ }
664
+ interface $ZodCIDRv6 extends $ZodType {
665
+ _zod: $ZodCIDRv6Internals;
666
+ }
667
+ declare const $ZodCIDRv6: $constructor<$ZodCIDRv6>;
668
+ interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> {
669
+ }
670
+ interface $ZodBase64 extends $ZodType {
671
+ _zod: $ZodBase64Internals;
672
+ }
673
+ declare const $ZodBase64: $constructor<$ZodBase64>;
674
+ interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> {
675
+ }
676
+ interface $ZodBase64URL extends $ZodType {
677
+ _zod: $ZodBase64URLInternals;
678
+ }
679
+ declare const $ZodBase64URL: $constructor<$ZodBase64URL>;
680
+ interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> {
681
+ }
682
+ interface $ZodE164 extends $ZodType {
683
+ _zod: $ZodE164Internals;
684
+ }
685
+ declare const $ZodE164: $constructor<$ZodE164>;
686
+ interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
687
+ alg?: JWTAlgorithm | undefined;
688
+ }
689
+ interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> {
690
+ def: $ZodJWTDef;
691
+ }
692
+ interface $ZodJWT extends $ZodType {
693
+ _zod: $ZodJWTInternals;
694
+ }
695
+ declare const $ZodJWT: $constructor<$ZodJWT>;
696
+ interface $ZodNumberDef extends $ZodTypeDef {
697
+ type: "number";
698
+ coerce?: boolean;
699
+ }
700
+ interface $ZodNumberInternals<Input = unknown> extends $ZodTypeInternals<number, Input> {
701
+ def: $ZodNumberDef;
702
+ /** @deprecated Internal API, use with caution (not deprecated) */
703
+ pattern: RegExp;
704
+ /** @deprecated Internal API, use with caution (not deprecated) */
705
+ isst: $ZodIssueInvalidType;
706
+ bag: LoosePartial<{
707
+ minimum: number;
708
+ maximum: number;
709
+ exclusiveMinimum: number;
710
+ exclusiveMaximum: number;
711
+ format: string;
712
+ pattern: RegExp;
713
+ }>;
714
+ }
715
+ interface $ZodNumber<Input = unknown> extends $ZodType {
716
+ _zod: $ZodNumberInternals<Input>;
717
+ }
718
+ declare const $ZodNumber: $constructor<$ZodNumber>;
719
+ interface $ZodBooleanDef extends $ZodTypeDef {
720
+ type: "boolean";
721
+ coerce?: boolean;
722
+ checks?: $ZodCheck<boolean>[];
723
+ }
724
+ interface $ZodBooleanInternals<T = unknown> extends $ZodTypeInternals<boolean, T> {
725
+ pattern: RegExp;
726
+ def: $ZodBooleanDef;
727
+ isst: $ZodIssueInvalidType;
728
+ }
729
+ interface $ZodBoolean<T = unknown> extends $ZodType {
730
+ _zod: $ZodBooleanInternals<T>;
731
+ }
732
+ declare const $ZodBoolean: $constructor<$ZodBoolean>;
733
+ interface $ZodBigIntDef extends $ZodTypeDef {
734
+ type: "bigint";
735
+ coerce?: boolean;
736
+ }
737
+ interface $ZodBigIntInternals<T = unknown> extends $ZodTypeInternals<bigint, T> {
738
+ pattern: RegExp;
739
+ /** @internal Internal API, use with caution */
740
+ def: $ZodBigIntDef;
741
+ isst: $ZodIssueInvalidType;
742
+ bag: LoosePartial<{
743
+ minimum: bigint;
744
+ maximum: bigint;
745
+ format: string;
746
+ }>;
747
+ }
748
+ interface $ZodBigInt<T = unknown> extends $ZodType {
749
+ _zod: $ZodBigIntInternals<T>;
750
+ }
751
+ declare const $ZodBigInt: $constructor<$ZodBigInt>;
752
+ interface $ZodSymbolDef extends $ZodTypeDef {
753
+ type: "symbol";
754
+ }
755
+ interface $ZodSymbolInternals extends $ZodTypeInternals<symbol, symbol> {
756
+ def: $ZodSymbolDef;
757
+ isst: $ZodIssueInvalidType;
758
+ }
759
+ interface $ZodSymbol extends $ZodType {
760
+ _zod: $ZodSymbolInternals;
761
+ }
762
+ declare const $ZodSymbol: $constructor<$ZodSymbol>;
763
+ interface $ZodUndefinedDef extends $ZodTypeDef {
764
+ type: "undefined";
765
+ }
766
+ interface $ZodUndefinedInternals extends $ZodTypeInternals<undefined, undefined> {
767
+ pattern: RegExp;
768
+ def: $ZodUndefinedDef;
769
+ values: PrimitiveSet;
770
+ isst: $ZodIssueInvalidType;
771
+ }
772
+ interface $ZodUndefined extends $ZodType {
773
+ _zod: $ZodUndefinedInternals;
774
+ }
775
+ declare const $ZodUndefined: $constructor<$ZodUndefined>;
776
+ interface $ZodNullDef extends $ZodTypeDef {
777
+ type: "null";
778
+ }
779
+ interface $ZodNullInternals extends $ZodTypeInternals<null, null> {
780
+ pattern: RegExp;
781
+ def: $ZodNullDef;
782
+ values: PrimitiveSet;
783
+ isst: $ZodIssueInvalidType;
784
+ }
785
+ interface $ZodNull extends $ZodType {
786
+ _zod: $ZodNullInternals;
787
+ }
788
+ declare const $ZodNull: $constructor<$ZodNull>;
789
+ interface $ZodAnyDef extends $ZodTypeDef {
790
+ type: "any";
791
+ }
792
+ interface $ZodAnyInternals extends $ZodTypeInternals<any, any> {
793
+ def: $ZodAnyDef;
794
+ isst: never;
795
+ }
796
+ interface $ZodAny extends $ZodType {
797
+ _zod: $ZodAnyInternals;
798
+ }
799
+ declare const $ZodAny: $constructor<$ZodAny>;
800
+ interface $ZodUnknownDef extends $ZodTypeDef {
801
+ type: "unknown";
802
+ }
803
+ interface $ZodUnknownInternals extends $ZodTypeInternals<unknown, unknown> {
804
+ def: $ZodUnknownDef;
805
+ isst: never;
806
+ }
807
+ interface $ZodUnknown extends $ZodType {
808
+ _zod: $ZodUnknownInternals;
809
+ }
810
+ declare const $ZodUnknown: $constructor<$ZodUnknown>;
811
+ interface $ZodNeverDef extends $ZodTypeDef {
812
+ type: "never";
813
+ }
814
+ interface $ZodNeverInternals extends $ZodTypeInternals<never, never> {
815
+ def: $ZodNeverDef;
816
+ isst: $ZodIssueInvalidType;
817
+ }
818
+ interface $ZodNever extends $ZodType {
819
+ _zod: $ZodNeverInternals;
820
+ }
821
+ declare const $ZodNever: $constructor<$ZodNever>;
822
+ interface $ZodVoidDef extends $ZodTypeDef {
823
+ type: "void";
824
+ }
825
+ interface $ZodVoidInternals extends $ZodTypeInternals<void, void> {
826
+ def: $ZodVoidDef;
827
+ isst: $ZodIssueInvalidType;
828
+ }
829
+ interface $ZodVoid extends $ZodType {
830
+ _zod: $ZodVoidInternals;
831
+ }
832
+ declare const $ZodVoid: $constructor<$ZodVoid>;
833
+ interface $ZodDateDef extends $ZodTypeDef {
834
+ type: "date";
835
+ coerce?: boolean;
836
+ }
837
+ interface $ZodDateInternals<T = unknown> extends $ZodTypeInternals<Date, T> {
838
+ def: $ZodDateDef;
839
+ isst: $ZodIssueInvalidType;
840
+ bag: LoosePartial<{
841
+ minimum: Date;
842
+ maximum: Date;
843
+ format: string;
844
+ }>;
845
+ }
846
+ interface $ZodDate<T = unknown> extends $ZodType {
847
+ _zod: $ZodDateInternals<T>;
848
+ }
849
+ declare const $ZodDate: $constructor<$ZodDate>;
850
+ interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
851
+ type: "array";
852
+ element: T;
853
+ }
854
+ interface $ZodArrayInternals<T extends SomeType = $ZodType> extends _$ZodTypeInternals {
855
+ def: $ZodArrayDef<T>;
856
+ isst: $ZodIssueInvalidType;
857
+ output: output<T>[];
858
+ input: input<T>[];
859
+ }
860
+ interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<any, any, $ZodArrayInternals<T>> {
861
+ }
862
+ declare const $ZodArray: $constructor<$ZodArray>;
863
+ type OptionalOutSchema = {
864
+ _zod: {
865
+ optout: "optional";
866
+ };
867
+ };
868
+ type OptionalInSchema = {
869
+ _zod: {
870
+ optin: "optional";
871
+ };
872
+ };
873
+ type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
874
+ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
875
+ } & {
876
+ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
877
+ } & Extra>;
878
+ type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
879
+ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
880
+ } & {
881
+ -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
882
+ } & Extra>;
883
+ type $ZodObjectConfig = {
884
+ out: Record<string, unknown>;
885
+ in: Record<string, unknown>;
886
+ };
887
+ type $loose = {
888
+ out: Record<string, unknown>;
889
+ in: Record<string, unknown>;
890
+ };
891
+ type $strict = {
892
+ out: {};
893
+ in: {};
894
+ };
895
+ type $strip = {
896
+ out: {};
897
+ in: {};
898
+ };
899
+ type $catchall<T extends SomeType> = {
900
+ out: {
901
+ [k: string]: output<T>;
902
+ };
903
+ in: {
904
+ [k: string]: input<T>;
905
+ };
906
+ };
907
+ type $ZodShape = Readonly<{
908
+ [k: string]: $ZodType;
909
+ }>;
910
+ interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
911
+ type: "object";
912
+ shape: Shape;
913
+ catchall?: $ZodType | undefined;
914
+ }
915
+ interface $ZodObjectInternals<
916
+ /** @ts-ignore Cast variance */
917
+ out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
918
+ def: $ZodObjectDef<Shape>;
919
+ config: Config;
920
+ isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
921
+ propValues: PropValues;
922
+ output: $InferObjectOutput<Shape, Config["out"]>;
923
+ input: $InferObjectInput<Shape, Config["in"]>;
924
+ optin?: "optional" | undefined;
925
+ optout?: "optional" | undefined;
926
+ }
927
+ type $ZodLooseShape = Record<string, any>;
928
+ interface $ZodObject<
929
+ /** @ts-ignore Cast variance */
930
+ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
931
+ }
932
+ declare const $ZodObject: $constructor<$ZodObject>;
933
+ type $InferUnionOutput<T extends SomeType> = T extends any ? output<T> : never;
934
+ type $InferUnionInput<T extends SomeType> = T extends any ? input<T> : never;
935
+ interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
936
+ type: "union";
937
+ options: Options;
938
+ inclusive?: boolean;
939
+ }
940
+ type IsOptionalIn<T extends SomeType> = T extends OptionalInSchema ? true : false;
941
+ type IsOptionalOut<T extends SomeType> = T extends OptionalOutSchema ? true : false;
942
+ interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends _$ZodTypeInternals {
943
+ def: $ZodUnionDef<T>;
944
+ isst: $ZodIssueInvalidUnion;
945
+ pattern: T[number]["_zod"]["pattern"];
946
+ values: T[number]["_zod"]["values"];
947
+ output: $InferUnionOutput<T[number]>;
948
+ input: $InferUnionInput<T[number]>;
949
+ optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
950
+ optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
951
+ }
952
+ interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType<any, any, $ZodUnionInternals<T>> {
953
+ _zod: $ZodUnionInternals<T>;
954
+ }
955
+ declare const $ZodUnion: $constructor<$ZodUnion>;
956
+ interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType> extends $ZodTypeDef {
957
+ type: "intersection";
958
+ left: Left;
959
+ right: Right;
960
+ }
961
+ interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _$ZodTypeInternals {
962
+ def: $ZodIntersectionDef<A, B>;
963
+ isst: never;
964
+ optin: A["_zod"]["optin"] | B["_zod"]["optin"];
965
+ optout: A["_zod"]["optout"] | B["_zod"]["optout"];
966
+ output: output<A> & output<B>;
967
+ input: input<A> & input<B>;
968
+ }
969
+ interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
970
+ _zod: $ZodIntersectionInternals<A, B>;
971
+ }
972
+ declare const $ZodIntersection: $constructor<$ZodIntersection>;
973
+ interface $ZodTupleDef<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeDef {
974
+ type: "tuple";
975
+ items: T;
976
+ rest: Rest;
977
+ }
978
+ type $InferTupleInputType<T extends TupleItems, Rest extends SomeType | null> = [
979
+ ...TupleInputTypeWithOptionals<T>,
980
+ ...(Rest extends SomeType ? input<Rest>[] : [])
981
+ ];
982
+ type TupleInputTypeNoOptionals<T extends TupleItems> = {
983
+ [k in keyof T]: input<T[k]>;
984
+ };
985
+ type TupleInputTypeWithOptionals<T extends TupleItems> = T extends readonly [
986
+ ...infer Prefix extends SomeType[],
987
+ infer Tail extends SomeType
988
+ ] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
989
+ type $InferTupleOutputType<T extends TupleItems, Rest extends SomeType | null> = [
990
+ ...TupleOutputTypeWithOptionals<T>,
991
+ ...(Rest extends SomeType ? output<Rest>[] : [])
992
+ ];
993
+ type TupleOutputTypeNoOptionals<T extends TupleItems> = {
994
+ [k in keyof T]: output<T[k]>;
995
+ };
996
+ type TupleOutputTypeWithOptionals<T extends TupleItems> = T extends readonly [
997
+ ...infer Prefix extends SomeType[],
998
+ infer Tail extends SomeType
999
+ ] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
1000
+ interface $ZodTupleInternals<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _$ZodTypeInternals {
1001
+ def: $ZodTupleDef<T, Rest>;
1002
+ isst: $ZodIssueInvalidType | $ZodIssueTooBig<unknown[]> | $ZodIssueTooSmall<unknown[]>;
1003
+ output: $InferTupleOutputType<T, Rest>;
1004
+ input: $InferTupleInputType<T, Rest>;
1005
+ }
1006
+ interface $ZodTuple<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodType {
1007
+ _zod: $ZodTupleInternals<T, Rest>;
1008
+ }
1009
+ declare const $ZodTuple: $constructor<$ZodTuple>;
1010
+ type $ZodRecordKey = $ZodType<string | number | symbol, unknown>;
1011
+ interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeDef {
1012
+ type: "record";
1013
+ keyType: Key;
1014
+ valueType: Value;
1015
+ /** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
1016
+ mode?: "strict" | "loose";
1017
+ }
1018
+ type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<output<Key>, output<Value>>> : Record<output<Key>, output<Value>>;
1019
+ type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<input<Key> & PropertyKey, input<Value>>> : Record<input<Key> & PropertyKey, input<Value>>;
1020
+ interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
1021
+ def: $ZodRecordDef<Key, Value>;
1022
+ isst: $ZodIssueInvalidType | $ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
1023
+ optin?: "optional" | undefined;
1024
+ optout?: "optional" | undefined;
1025
+ }
1026
+ type $partial = {
1027
+ "~~partial": true;
1028
+ };
1029
+ interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodType {
1030
+ _zod: $ZodRecordInternals<Key, Value>;
1031
+ }
1032
+ declare const $ZodRecord: $constructor<$ZodRecord>;
1033
+ interface $ZodMapDef<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeDef {
1034
+ type: "map";
1035
+ keyType: Key;
1036
+ valueType: Value;
1037
+ }
1038
+ interface $ZodMapInternals<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeInternals<Map<output<Key>, output<Value>>, Map<input<Key>, input<Value>>> {
1039
+ def: $ZodMapDef<Key, Value>;
1040
+ isst: $ZodIssueInvalidType | $ZodIssueInvalidKey | $ZodIssueInvalidElement<unknown>;
1041
+ optin?: "optional" | undefined;
1042
+ optout?: "optional" | undefined;
1043
+ }
1044
+ interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodType {
1045
+ _zod: $ZodMapInternals<Key, Value>;
1046
+ }
1047
+ declare const $ZodMap: $constructor<$ZodMap>;
1048
+ interface $ZodSetDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1049
+ type: "set";
1050
+ valueType: T;
1051
+ }
1052
+ interface $ZodSetInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Set<output<T>>, Set<input<T>>> {
1053
+ def: $ZodSetDef<T>;
1054
+ isst: $ZodIssueInvalidType;
1055
+ optin?: "optional" | undefined;
1056
+ optout?: "optional" | undefined;
1057
+ }
1058
+ interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
1059
+ _zod: $ZodSetInternals<T>;
1060
+ }
1061
+ declare const $ZodSet: $constructor<$ZodSet>;
1062
+ type $InferEnumOutput<T extends EnumLike> = T[keyof T] & {};
1063
+ type $InferEnumInput<T extends EnumLike> = T[keyof T] & {};
1064
+ interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
1065
+ type: "enum";
1066
+ entries: T;
1067
+ }
1068
+ interface $ZodEnumInternals<
1069
+ /** @ts-ignore Cast variance */
1070
+ out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
1071
+ def: $ZodEnumDef<T>;
1072
+ /** @deprecated Internal API, use with caution (not deprecated) */
1073
+ values: PrimitiveSet;
1074
+ /** @deprecated Internal API, use with caution (not deprecated) */
1075
+ pattern: RegExp;
1076
+ isst: $ZodIssueInvalidValue;
1077
+ }
1078
+ interface $ZodEnum<T extends EnumLike = EnumLike> extends $ZodType {
1079
+ _zod: $ZodEnumInternals<T>;
1080
+ }
1081
+ declare const $ZodEnum: $constructor<$ZodEnum>;
1082
+ interface $ZodLiteralDef<T extends Literal> extends $ZodTypeDef {
1083
+ type: "literal";
1084
+ values: T[];
1085
+ }
1086
+ interface $ZodLiteralInternals<T extends Literal = Literal> extends $ZodTypeInternals<T, T> {
1087
+ def: $ZodLiteralDef<T>;
1088
+ values: Set<T>;
1089
+ pattern: RegExp;
1090
+ isst: $ZodIssueInvalidValue;
1091
+ }
1092
+ interface $ZodLiteral<T extends Literal = Literal> extends $ZodType {
1093
+ _zod: $ZodLiteralInternals<T>;
1094
+ }
1095
+ declare const $ZodLiteral: $constructor<$ZodLiteral>;
1096
+ type _File = typeof globalThis extends {
1097
+ File: infer F extends new (...args: any[]) => any;
1098
+ } ? InstanceType<F> : {};
1099
+ /** Do not reference this directly. */
1100
+ interface File extends _File {
1101
+ readonly type: string;
1102
+ readonly size: number;
1103
+ }
1104
+ interface $ZodFileDef extends $ZodTypeDef {
1105
+ type: "file";
1106
+ }
1107
+ interface $ZodFileInternals extends $ZodTypeInternals<File, File> {
1108
+ def: $ZodFileDef;
1109
+ isst: $ZodIssueInvalidType;
1110
+ bag: LoosePartial<{
1111
+ minimum: number;
1112
+ maximum: number;
1113
+ mime: MimeTypes[];
1114
+ }>;
1115
+ }
1116
+ interface $ZodFile extends $ZodType {
1117
+ _zod: $ZodFileInternals;
1118
+ }
1119
+ declare const $ZodFile: $constructor<$ZodFile>;
1120
+ interface $ZodTransformDef extends $ZodTypeDef {
1121
+ type: "transform";
1122
+ transform: (input: unknown, payload: ParsePayload<unknown>) => MaybeAsync<unknown>;
1123
+ }
1124
+ interface $ZodTransformInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I> {
1125
+ def: $ZodTransformDef;
1126
+ isst: never;
1127
+ }
1128
+ interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
1129
+ _zod: $ZodTransformInternals<O, I>;
1130
+ }
1131
+ declare const $ZodTransform: $constructor<$ZodTransform>;
1132
+ interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1133
+ type: "optional";
1134
+ innerType: T;
1135
+ }
1136
+ interface $ZodOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | undefined, input<T> | undefined> {
1137
+ def: $ZodOptionalDef<T>;
1138
+ optin: "optional";
1139
+ optout: "optional";
1140
+ isst: never;
1141
+ values: T["_zod"]["values"];
1142
+ pattern: T["_zod"]["pattern"];
1143
+ }
1144
+ interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
1145
+ _zod: $ZodOptionalInternals<T>;
1146
+ }
1147
+ declare const $ZodOptional: $constructor<$ZodOptional>;
1148
+ interface $ZodExactOptionalDef<T extends SomeType = $ZodType> extends $ZodOptionalDef<T> {
1149
+ }
1150
+ interface $ZodExactOptionalInternals<T extends SomeType = $ZodType> extends $ZodOptionalInternals<T> {
1151
+ def: $ZodExactOptionalDef<T>;
1152
+ output: output<T>;
1153
+ input: input<T>;
1154
+ }
1155
+ interface $ZodExactOptional<T extends SomeType = $ZodType> extends $ZodType {
1156
+ _zod: $ZodExactOptionalInternals<T>;
1157
+ }
1158
+ declare const $ZodExactOptional: $constructor<$ZodExactOptional>;
1159
+ interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1160
+ type: "nullable";
1161
+ innerType: T;
1162
+ }
1163
+ interface $ZodNullableInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | null, input<T> | null> {
1164
+ def: $ZodNullableDef<T>;
1165
+ optin: T["_zod"]["optin"];
1166
+ optout: T["_zod"]["optout"];
1167
+ isst: never;
1168
+ values: T["_zod"]["values"];
1169
+ pattern: T["_zod"]["pattern"];
1170
+ }
1171
+ interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
1172
+ _zod: $ZodNullableInternals<T>;
1173
+ }
1174
+ declare const $ZodNullable: $constructor<$ZodNullable>;
1175
+ interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1176
+ type: "default";
1177
+ innerType: T;
1178
+ /** The default value. May be a getter. */
1179
+ defaultValue: NoUndefined<output<T>>;
1180
+ }
1181
+ interface $ZodDefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
1182
+ def: $ZodDefaultDef<T>;
1183
+ optin: "optional";
1184
+ optout?: "optional" | undefined;
1185
+ isst: never;
1186
+ values: T["_zod"]["values"];
1187
+ }
1188
+ interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
1189
+ _zod: $ZodDefaultInternals<T>;
1190
+ }
1191
+ declare const $ZodDefault: $constructor<$ZodDefault>;
1192
+ interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1193
+ type: "prefault";
1194
+ innerType: T;
1195
+ /** The default value. May be a getter. */
1196
+ defaultValue: input<T>;
1197
+ }
1198
+ interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
1199
+ def: $ZodPrefaultDef<T>;
1200
+ optin: "optional";
1201
+ optout?: "optional" | undefined;
1202
+ isst: never;
1203
+ values: T["_zod"]["values"];
1204
+ }
1205
+ interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
1206
+ _zod: $ZodPrefaultInternals<T>;
1207
+ }
1208
+ declare const $ZodPrefault: $constructor<$ZodPrefault>;
1209
+ interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1210
+ type: "nonoptional";
1211
+ innerType: T;
1212
+ }
1213
+ interface $ZodNonOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, NoUndefined<input<T>>> {
1214
+ def: $ZodNonOptionalDef<T>;
1215
+ isst: $ZodIssueInvalidType;
1216
+ values: T["_zod"]["values"];
1217
+ optin: "optional" | undefined;
1218
+ optout: "optional" | undefined;
1219
+ }
1220
+ interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
1221
+ _zod: $ZodNonOptionalInternals<T>;
1222
+ }
1223
+ declare const $ZodNonOptional: $constructor<$ZodNonOptional>;
1224
+ interface $ZodSuccessDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1225
+ type: "success";
1226
+ innerType: T;
1227
+ }
1228
+ interface $ZodSuccessInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<boolean, input<T>> {
1229
+ def: $ZodSuccessDef<T>;
1230
+ isst: never;
1231
+ optin: T["_zod"]["optin"];
1232
+ optout: "optional" | undefined;
1233
+ }
1234
+ interface $ZodSuccess<T extends SomeType = $ZodType> extends $ZodType {
1235
+ _zod: $ZodSuccessInternals<T>;
1236
+ }
1237
+ declare const $ZodSuccess: $constructor<$ZodSuccess>;
1238
+ interface $ZodCatchCtx extends ParsePayload {
1239
+ /** @deprecated Use `ctx.issues` */
1240
+ error: {
1241
+ issues: $ZodIssue[];
1242
+ };
1243
+ /** @deprecated Use `ctx.value` */
1244
+ input: unknown;
1245
+ }
1246
+ interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1247
+ type: "catch";
1248
+ innerType: T;
1249
+ catchValue: (ctx: $ZodCatchCtx) => unknown;
1250
+ }
1251
+ interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>, input<T>> {
1252
+ def: $ZodCatchDef<T>;
1253
+ optin: T["_zod"]["optin"];
1254
+ optout: T["_zod"]["optout"];
1255
+ isst: never;
1256
+ values: T["_zod"]["values"];
1257
+ }
1258
+ interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
1259
+ _zod: $ZodCatchInternals<T>;
1260
+ }
1261
+ declare const $ZodCatch: $constructor<$ZodCatch>;
1262
+ interface $ZodNaNDef extends $ZodTypeDef {
1263
+ type: "nan";
1264
+ }
1265
+ interface $ZodNaNInternals extends $ZodTypeInternals<number, number> {
1266
+ def: $ZodNaNDef;
1267
+ isst: $ZodIssueInvalidType;
1268
+ }
1269
+ interface $ZodNaN extends $ZodType {
1270
+ _zod: $ZodNaNInternals;
1271
+ }
1272
+ declare const $ZodNaN: $constructor<$ZodNaN>;
1273
+ interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
1274
+ type: "pipe";
1275
+ in: A;
1276
+ out: B;
1277
+ /** Only defined inside $ZodCodec instances. */
1278
+ transform?: (value: output<A>, payload: ParsePayload<output<A>>) => MaybeAsync<input<B>>;
1279
+ /** Only defined inside $ZodCodec instances. */
1280
+ reverseTransform?: (value: input<B>, payload: ParsePayload<input<B>>) => MaybeAsync<output<A>>;
1281
+ }
1282
+ interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<output<B>, input<A>> {
1283
+ def: $ZodPipeDef<A, B>;
1284
+ isst: never;
1285
+ values: A["_zod"]["values"];
1286
+ optin: A["_zod"]["optin"];
1287
+ optout: B["_zod"]["optout"];
1288
+ propValues: A["_zod"]["propValues"];
1289
+ }
1290
+ interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
1291
+ _zod: $ZodPipeInternals<A, B>;
1292
+ }
1293
+ declare const $ZodPipe: $constructor<$ZodPipe>;
1294
+ interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1295
+ type: "readonly";
1296
+ innerType: T;
1297
+ }
1298
+ interface $ZodReadonlyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<MakeReadonly<output<T>>, MakeReadonly<input<T>>> {
1299
+ def: $ZodReadonlyDef<T>;
1300
+ optin: T["_zod"]["optin"];
1301
+ optout: T["_zod"]["optout"];
1302
+ isst: never;
1303
+ propValues: T["_zod"]["propValues"];
1304
+ values: T["_zod"]["values"];
1305
+ }
1306
+ interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
1307
+ _zod: $ZodReadonlyInternals<T>;
1308
+ }
1309
+ declare const $ZodReadonly: $constructor<$ZodReadonly>;
1310
+ interface $ZodTemplateLiteralDef extends $ZodTypeDef {
1311
+ type: "template_literal";
1312
+ parts: $ZodTemplateLiteralPart[];
1313
+ format?: string | undefined;
1314
+ }
1315
+ interface $ZodTemplateLiteralInternals<Template extends string = string> extends $ZodTypeInternals<Template, Template> {
1316
+ pattern: RegExp;
1317
+ def: $ZodTemplateLiteralDef;
1318
+ isst: $ZodIssueInvalidType;
1319
+ }
1320
+ type LiteralPart = Exclude<Literal, symbol>;
1321
+ interface SchemaPartInternals extends $ZodTypeInternals<LiteralPart, LiteralPart> {
1322
+ pattern: RegExp;
1323
+ }
1324
+ interface SchemaPart extends $ZodType {
1325
+ _zod: SchemaPartInternals;
1326
+ }
1327
+ type $ZodTemplateLiteralPart = LiteralPart | SchemaPart;
1328
+ interface $ZodTemplateLiteral<Template extends string = string> extends $ZodType {
1329
+ _zod: $ZodTemplateLiteralInternals<Template>;
1330
+ }
1331
+ declare const $ZodTemplateLiteral: $constructor<$ZodTemplateLiteral>;
1332
+ type $ZodFunctionArgs = $ZodType<unknown[], unknown[]>;
1333
+ type $ZodFunctionIn = $ZodFunctionArgs;
1334
+ type $ZodFunctionOut = $ZodType;
1335
+ type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : output<Args>) => input<Returns>;
1336
+ type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : output<Args>) => MaybeAsync<input<Returns>>;
1337
+ type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : input<Args>) => output<Returns>;
1338
+ type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : input<Args>) => Promise<output<Returns>>;
1339
+ interface $ZodFunctionDef<In extends $ZodFunctionIn = $ZodFunctionIn, Out extends $ZodFunctionOut = $ZodFunctionOut> extends $ZodTypeDef {
1340
+ type: "function";
1341
+ input: In;
1342
+ output: Out;
1343
+ }
1344
+ interface $ZodFunctionInternals<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> extends $ZodTypeInternals<$InferOuterFunctionType<Args, Returns>, $InferInnerFunctionType<Args, Returns>> {
1345
+ def: $ZodFunctionDef<Args, Returns>;
1346
+ isst: $ZodIssueInvalidType;
1347
+ }
1348
+ interface $ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn, Returns extends $ZodFunctionOut = $ZodFunctionOut> extends $ZodType<any, any, $ZodFunctionInternals<Args, Returns>> {
1349
+ /** @deprecated */
1350
+ _def: $ZodFunctionDef<Args, Returns>;
1351
+ _input: $InferInnerFunctionType<Args, Returns>;
1352
+ _output: $InferOuterFunctionType<Args, Returns>;
1353
+ implement<F extends $InferInnerFunctionType<Args, Returns>>(func: F): (...args: Parameters<this["_output"]>) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]>;
1354
+ implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(func: F): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns>;
1355
+ input<const Items extends TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(args: Items, rest?: Rest): $ZodFunction<$ZodTuple<Items, Rest>, Returns>;
1356
+ input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
1357
+ input(...args: any[]): $ZodFunction<any, Returns>;
1358
+ output<NewReturns extends $ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns>;
1359
+ }
1360
+ declare const $ZodFunction: $constructor<$ZodFunction>;
1361
+ interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1362
+ type: "promise";
1363
+ innerType: T;
1364
+ }
1365
+ interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Promise<output<T>>, MaybeAsync<input<T>>> {
1366
+ def: $ZodPromiseDef<T>;
1367
+ isst: never;
1368
+ }
1369
+ interface $ZodPromise<T extends SomeType = $ZodType> extends $ZodType {
1370
+ _zod: $ZodPromiseInternals<T>;
1371
+ }
1372
+ declare const $ZodPromise: $constructor<$ZodPromise>;
1373
+ interface $ZodLazyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
1374
+ type: "lazy";
1375
+ getter: () => T;
1376
+ }
1377
+ interface $ZodLazyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>, input<T>> {
1378
+ def: $ZodLazyDef<T>;
1379
+ isst: never;
1380
+ /** Auto-cached way to retrieve the inner schema */
1381
+ innerType: T;
1382
+ pattern: T["_zod"]["pattern"];
1383
+ propValues: T["_zod"]["propValues"];
1384
+ optin: T["_zod"]["optin"];
1385
+ optout: T["_zod"]["optout"];
1386
+ }
1387
+ interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
1388
+ _zod: $ZodLazyInternals<T>;
1389
+ }
1390
+ declare const $ZodLazy: $constructor<$ZodLazy>;
1391
+ interface $ZodCustomDef<O = unknown> extends $ZodTypeDef, $ZodCheckDef {
1392
+ type: "custom";
1393
+ check: "custom";
1394
+ path?: PropertyKey[] | undefined;
1395
+ error?: $ZodErrorMap | undefined;
1396
+ params?: Record<string, any> | undefined;
1397
+ fn: (arg: O) => unknown;
1398
+ }
1399
+ interface $ZodCustomInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I>, $ZodCheckInternals<O> {
1400
+ def: $ZodCustomDef;
1401
+ issc: $ZodIssue;
1402
+ isst: never;
1403
+ bag: LoosePartial<{
1404
+ Class: typeof Class;
1405
+ }>;
1406
+ }
1407
+ interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1408
+ _zod: $ZodCustomInternals<O, I>;
1409
+ }
1410
+ declare const $ZodCustom: $constructor<$ZodCustom>;
1411
+ type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1412
+
1413
+ interface $ZodCheckDef {
1414
+ check: string;
1415
+ error?: $ZodErrorMap<never> | undefined;
1416
+ /** If true, no later checks will be executed if this check fails. Default `false`. */
1417
+ abort?: boolean | undefined;
1418
+ /** If provided, the check runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
1419
+ when?: ((payload: ParsePayload) => boolean) | undefined;
1420
+ }
1421
+ interface $ZodCheckInternals<T> {
1422
+ def: $ZodCheckDef;
1423
+ /** The set of issues this check might throw. */
1424
+ issc?: $ZodIssueBase;
1425
+ check(payload: ParsePayload<T>): MaybeAsync<void>;
1426
+ onattach: ((schema: $ZodType) => void)[];
1427
+ }
1428
+ interface $ZodCheck<in T = never> {
1429
+ _zod: $ZodCheckInternals<T>;
1430
+ }
1431
+ declare const $ZodCheck: $constructor<$ZodCheck<any>>;
1432
+ interface $ZodCheckLessThanDef extends $ZodCheckDef {
1433
+ check: "less_than";
1434
+ value: Numeric;
1435
+ inclusive: boolean;
1436
+ }
1437
+ interface $ZodCheckLessThanInternals<T extends Numeric = Numeric> extends $ZodCheckInternals<T> {
1438
+ def: $ZodCheckLessThanDef;
1439
+ issc: $ZodIssueTooBig<T>;
1440
+ }
1441
+ interface $ZodCheckLessThan<T extends Numeric = Numeric> extends $ZodCheck<T> {
1442
+ _zod: $ZodCheckLessThanInternals<T>;
1443
+ }
1444
+ declare const $ZodCheckLessThan: $constructor<$ZodCheckLessThan>;
1445
+ interface $ZodCheckGreaterThanDef extends $ZodCheckDef {
1446
+ check: "greater_than";
1447
+ value: Numeric;
1448
+ inclusive: boolean;
1449
+ }
1450
+ interface $ZodCheckGreaterThanInternals<T extends Numeric = Numeric> extends $ZodCheckInternals<T> {
1451
+ def: $ZodCheckGreaterThanDef;
1452
+ issc: $ZodIssueTooSmall<T>;
1453
+ }
1454
+ interface $ZodCheckGreaterThan<T extends Numeric = Numeric> extends $ZodCheck<T> {
1455
+ _zod: $ZodCheckGreaterThanInternals<T>;
1456
+ }
1457
+ declare const $ZodCheckGreaterThan: $constructor<$ZodCheckGreaterThan>;
1458
+ interface $ZodCheckMultipleOfDef<T extends number | bigint = number | bigint> extends $ZodCheckDef {
1459
+ check: "multiple_of";
1460
+ value: T;
1461
+ }
1462
+ interface $ZodCheckMultipleOfInternals<T extends number | bigint = number | bigint> extends $ZodCheckInternals<T> {
1463
+ def: $ZodCheckMultipleOfDef<T>;
1464
+ issc: $ZodIssueNotMultipleOf;
1465
+ }
1466
+ interface $ZodCheckMultipleOf<T extends number | bigint = number | bigint> extends $ZodCheck<T> {
1467
+ _zod: $ZodCheckMultipleOfInternals<T>;
1468
+ }
1469
+ declare const $ZodCheckMultipleOf: $constructor<$ZodCheckMultipleOf<number | bigint>>;
1470
+ type $ZodNumberFormats = "int32" | "uint32" | "float32" | "float64" | "safeint";
1471
+ interface $ZodCheckNumberFormatDef extends $ZodCheckDef {
1472
+ check: "number_format";
1473
+ format: $ZodNumberFormats;
1474
+ }
1475
+ interface $ZodCheckNumberFormatInternals extends $ZodCheckInternals<number> {
1476
+ def: $ZodCheckNumberFormatDef;
1477
+ issc: $ZodIssueInvalidType | $ZodIssueTooBig<"number"> | $ZodIssueTooSmall<"number">;
1478
+ }
1479
+ interface $ZodCheckNumberFormat extends $ZodCheck<number> {
1480
+ _zod: $ZodCheckNumberFormatInternals;
1481
+ }
1482
+ declare const $ZodCheckNumberFormat: $constructor<$ZodCheckNumberFormat>;
1483
+ interface $ZodCheckMaxLengthDef extends $ZodCheckDef {
1484
+ check: "max_length";
1485
+ maximum: number;
1486
+ }
1487
+ interface $ZodCheckMaxLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
1488
+ def: $ZodCheckMaxLengthDef;
1489
+ issc: $ZodIssueTooBig<T>;
1490
+ }
1491
+ interface $ZodCheckMaxLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
1492
+ _zod: $ZodCheckMaxLengthInternals<T>;
1493
+ }
1494
+ declare const $ZodCheckMaxLength: $constructor<$ZodCheckMaxLength>;
1495
+ interface $ZodCheckMinLengthDef extends $ZodCheckDef {
1496
+ check: "min_length";
1497
+ minimum: number;
1498
+ }
1499
+ interface $ZodCheckMinLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
1500
+ def: $ZodCheckMinLengthDef;
1501
+ issc: $ZodIssueTooSmall<T>;
1502
+ }
1503
+ interface $ZodCheckMinLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
1504
+ _zod: $ZodCheckMinLengthInternals<T>;
1505
+ }
1506
+ declare const $ZodCheckMinLength: $constructor<$ZodCheckMinLength>;
1507
+ interface $ZodCheckLengthEqualsDef extends $ZodCheckDef {
1508
+ check: "length_equals";
1509
+ length: number;
1510
+ }
1511
+ interface $ZodCheckLengthEqualsInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
1512
+ def: $ZodCheckLengthEqualsDef;
1513
+ issc: $ZodIssueTooBig<T> | $ZodIssueTooSmall<T>;
1514
+ }
1515
+ interface $ZodCheckLengthEquals<T extends HasLength = HasLength> extends $ZodCheck<T> {
1516
+ _zod: $ZodCheckLengthEqualsInternals<T>;
1517
+ }
1518
+ declare const $ZodCheckLengthEquals: $constructor<$ZodCheckLengthEquals>;
1519
+ type $ZodStringFormats = "email" | "url" | "emoji" | "uuid" | "guid" | "nanoid" | "cuid" | "cuid2" | "ulid" | "xid" | "ksuid" | "datetime" | "date" | "time" | "duration" | "ipv4" | "ipv6" | "cidrv4" | "cidrv6" | "base64" | "base64url" | "json_string" | "e164" | "lowercase" | "uppercase" | "regex" | "jwt" | "starts_with" | "ends_with" | "includes";
1520
+ interface $ZodCheckStringFormatDef<Format extends string = string> extends $ZodCheckDef {
1521
+ check: "string_format";
1522
+ format: Format;
1523
+ pattern?: RegExp | undefined;
1524
+ }
1525
+ interface $ZodCheckStringFormatInternals extends $ZodCheckInternals<string> {
1526
+ def: $ZodCheckStringFormatDef;
1527
+ issc: $ZodIssueInvalidStringFormat;
1528
+ }
1529
+ interface $ZodCheckRegexDef extends $ZodCheckStringFormatDef {
1530
+ format: "regex";
1531
+ pattern: RegExp;
1532
+ }
1533
+ interface $ZodCheckRegexInternals extends $ZodCheckInternals<string> {
1534
+ def: $ZodCheckRegexDef;
1535
+ issc: $ZodIssueInvalidStringFormat;
1536
+ }
1537
+ interface $ZodCheckRegex extends $ZodCheck<string> {
1538
+ _zod: $ZodCheckRegexInternals;
1539
+ }
1540
+ declare const $ZodCheckRegex: $constructor<$ZodCheckRegex>;
1541
+ interface $ZodCheckLowerCaseDef extends $ZodCheckStringFormatDef<"lowercase"> {
1542
+ }
1543
+ interface $ZodCheckLowerCaseInternals extends $ZodCheckInternals<string> {
1544
+ def: $ZodCheckLowerCaseDef;
1545
+ issc: $ZodIssueInvalidStringFormat;
1546
+ }
1547
+ interface $ZodCheckLowerCase extends $ZodCheck<string> {
1548
+ _zod: $ZodCheckLowerCaseInternals;
1549
+ }
1550
+ declare const $ZodCheckLowerCase: $constructor<$ZodCheckLowerCase>;
1551
+ interface $ZodCheckUpperCaseDef extends $ZodCheckStringFormatDef<"uppercase"> {
1552
+ }
1553
+ interface $ZodCheckUpperCaseInternals extends $ZodCheckInternals<string> {
1554
+ def: $ZodCheckUpperCaseDef;
1555
+ issc: $ZodIssueInvalidStringFormat;
1556
+ }
1557
+ interface $ZodCheckUpperCase extends $ZodCheck<string> {
1558
+ _zod: $ZodCheckUpperCaseInternals;
1559
+ }
1560
+ declare const $ZodCheckUpperCase: $constructor<$ZodCheckUpperCase>;
1561
+ interface $ZodCheckIncludesDef extends $ZodCheckStringFormatDef<"includes"> {
1562
+ includes: string;
1563
+ position?: number | undefined;
1564
+ }
1565
+ interface $ZodCheckIncludesInternals extends $ZodCheckInternals<string> {
1566
+ def: $ZodCheckIncludesDef;
1567
+ issc: $ZodIssueInvalidStringFormat;
1568
+ }
1569
+ interface $ZodCheckIncludes extends $ZodCheck<string> {
1570
+ _zod: $ZodCheckIncludesInternals;
1571
+ }
1572
+ declare const $ZodCheckIncludes: $constructor<$ZodCheckIncludes>;
1573
+ interface $ZodCheckStartsWithDef extends $ZodCheckStringFormatDef<"starts_with"> {
1574
+ prefix: string;
1575
+ }
1576
+ interface $ZodCheckStartsWithInternals extends $ZodCheckInternals<string> {
1577
+ def: $ZodCheckStartsWithDef;
1578
+ issc: $ZodIssueInvalidStringFormat;
1579
+ }
1580
+ interface $ZodCheckStartsWith extends $ZodCheck<string> {
1581
+ _zod: $ZodCheckStartsWithInternals;
1582
+ }
1583
+ declare const $ZodCheckStartsWith: $constructor<$ZodCheckStartsWith>;
1584
+ interface $ZodCheckEndsWithDef extends $ZodCheckStringFormatDef<"ends_with"> {
1585
+ suffix: string;
1586
+ }
1587
+ interface $ZodCheckEndsWithInternals extends $ZodCheckInternals<string> {
1588
+ def: $ZodCheckEndsWithDef;
1589
+ issc: $ZodIssueInvalidStringFormat;
1590
+ }
1591
+ interface $ZodCheckEndsWith extends $ZodCheckInternals<string> {
1592
+ _zod: $ZodCheckEndsWithInternals;
1593
+ }
1594
+ declare const $ZodCheckEndsWith: $constructor<$ZodCheckEndsWith>;
1595
+
1596
+ interface $ZodIssueBase {
1597
+ readonly code?: string;
1598
+ readonly input?: unknown;
1599
+ readonly path: PropertyKey[];
1600
+ readonly message: string;
1601
+ }
1602
+ type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
1603
+ interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
1604
+ readonly code: "invalid_type";
1605
+ readonly expected: $ZodInvalidTypeExpected;
1606
+ readonly input?: Input;
1607
+ }
1608
+ interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
1609
+ readonly code: "too_big";
1610
+ readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
1611
+ readonly maximum: number | bigint;
1612
+ readonly inclusive?: boolean;
1613
+ readonly exact?: boolean;
1614
+ readonly input?: Input;
1615
+ }
1616
+ interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
1617
+ readonly code: "too_small";
1618
+ readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
1619
+ readonly minimum: number | bigint;
1620
+ /** True if the allowable range includes the minimum */
1621
+ readonly inclusive?: boolean;
1622
+ /** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
1623
+ readonly exact?: boolean;
1624
+ readonly input?: Input;
1625
+ }
1626
+ interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
1627
+ readonly code: "invalid_format";
1628
+ readonly format: $ZodStringFormats | (string & {});
1629
+ readonly pattern?: string;
1630
+ readonly input?: string;
1631
+ }
1632
+ interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
1633
+ readonly code: "not_multiple_of";
1634
+ readonly divisor: number;
1635
+ readonly input?: Input;
1636
+ }
1637
+ interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
1638
+ readonly code: "unrecognized_keys";
1639
+ readonly keys: string[];
1640
+ readonly input?: Record<string, unknown>;
1641
+ }
1642
+ interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
1643
+ readonly code: "invalid_union";
1644
+ readonly errors: $ZodIssue[][];
1645
+ readonly input?: unknown;
1646
+ readonly discriminator?: string | undefined;
1647
+ readonly options?: Primitive[];
1648
+ readonly inclusive?: true;
1649
+ }
1650
+ interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
1651
+ readonly code: "invalid_union";
1652
+ readonly errors: [];
1653
+ readonly input?: unknown;
1654
+ readonly discriminator?: string | undefined;
1655
+ readonly inclusive: false;
1656
+ }
1657
+ type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
1658
+ interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
1659
+ readonly code: "invalid_key";
1660
+ readonly origin: "map" | "record";
1661
+ readonly issues: $ZodIssue[];
1662
+ readonly input?: Input;
1663
+ }
1664
+ interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
1665
+ readonly code: "invalid_element";
1666
+ readonly origin: "map" | "set";
1667
+ readonly key: unknown;
1668
+ readonly issues: $ZodIssue[];
1669
+ readonly input?: Input;
1670
+ }
1671
+ interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
1672
+ readonly code: "invalid_value";
1673
+ readonly values: Primitive[];
1674
+ readonly input?: Input;
1675
+ }
1676
+ interface $ZodIssueCustom extends $ZodIssueBase {
1677
+ readonly code: "custom";
1678
+ readonly params?: Record<string, any> | undefined;
1679
+ readonly input?: unknown;
1680
+ }
1681
+ type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
1682
+ type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue$1<T> : never;
1683
+ type RawIssue$1<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
1684
+ /** The input data */
1685
+ readonly input: unknown;
1686
+ /** The schema or check that originated this issue. */
1687
+ readonly inst?: $ZodType | $ZodCheck;
1688
+ /** If `true`, Zod will continue executing checks/refinements after this issue. */
1689
+ readonly continue?: boolean | undefined;
1690
+ } & Record<string, unknown>> : never;
1691
+ type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
1692
+ interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
1693
+ (issue: $ZodRawIssue<T>): {
1694
+ message: string;
1695
+ } | string | undefined | null;
1696
+ }
1697
+ interface $ZodError<T = unknown> extends Error {
1698
+ type: T;
1699
+ issues: $ZodIssue[];
1700
+ _zod: {
1701
+ output: T;
1702
+ def: $ZodIssue[];
1703
+ };
1704
+ stack?: string;
1705
+ name: string;
1706
+ }
1707
+ declare const $ZodError: $constructor<$ZodError>;
1708
+ type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
1709
+ type _FlattenedError<T, U = string> = {
1710
+ formErrors: U[];
1711
+ fieldErrors: {
1712
+ [P in keyof T]?: U[];
1713
+ };
1714
+ };
1715
+ type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
1716
+ [K in keyof T]?: $ZodFormattedError<T[K], U>;
1717
+ } : T extends any[] ? {
1718
+ [k: number]: $ZodFormattedError<T[number], U>;
1719
+ } : T extends object ? Flatten<{
1720
+ [K in keyof T]?: $ZodFormattedError<T[K], U>;
1721
+ }> : any;
1722
+ type $ZodFormattedError<T, U = string> = {
1723
+ _errors: U[];
1724
+ } & Flatten<_ZodFormattedError<T, U>>;
1725
+
1726
+ type ZodTrait = {
1727
+ _zod: {
1728
+ def: any;
1729
+ [k: string]: any;
1730
+ };
1731
+ };
1732
+ interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
1733
+ new (def: D): T;
1734
+ init(inst: T, def: D): asserts inst is T;
1735
+ }
1736
+ declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
1737
+ Parent?: typeof Class;
1738
+ }): $constructor<T, D>;
1739
+ declare const $brand: unique symbol;
1740
+ type $brand<T extends string | number | symbol = string | number | symbol> = {
1741
+ [$brand]: {
1742
+ [k in T]: true;
1743
+ };
1744
+ };
1745
+ type $ZodBranded<T extends SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
1746
+ _zod: {
1747
+ input: input<T> & $brand<Brand>;
1748
+ output: output<T> & $brand<Brand>;
1749
+ };
1750
+ } : Dir extends "in" ? {
1751
+ _zod: {
1752
+ input: input<T> & $brand<Brand>;
1753
+ };
1754
+ } : {
1755
+ _zod: {
1756
+ output: output<T> & $brand<Brand>;
1757
+ };
1758
+ });
1759
+ type input<T> = T extends {
1760
+ _zod: {
1761
+ input: any;
1762
+ };
1763
+ } ? T["_zod"]["input"] : unknown;
1764
+ type output<T> = T extends {
1765
+ _zod: {
1766
+ output: any;
1767
+ };
1768
+ } ? T["_zod"]["output"] : unknown;
1769
+
1770
+ type Params<T extends $ZodType | $ZodCheck, IssueTypes extends $ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = Flatten<Partial<EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
1771
+ error?: string | $ZodErrorMap<IssueTypes> | undefined;
1772
+ /** @deprecated This parameter is deprecated. Use `error` instead. */
1773
+ message?: string | undefined;
1774
+ })>>>;
1775
+ type TypeParams<T extends $ZodType = $ZodType & {
1776
+ _isst: never;
1777
+ }, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
1778
+ type CheckParams<T extends $ZodCheck = $ZodCheck, // & { _issc: never },
1779
+ AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
1780
+ type CheckStringFormatParams<T extends $ZodStringFormat = $ZodStringFormat, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "coerce" | "checks" | "error" | "check" | "format"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "type" | "coerce" | "checks" | "error" | "check" | "format" | AlsoOmit>;
1781
+ type CheckTypeParams<T extends $ZodType & $ZodCheck = $ZodType & $ZodCheck, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
1782
+ type $ZodCheckEmailParams = CheckStringFormatParams<$ZodEmail, "when">;
1783
+ type $ZodCheckGUIDParams = CheckStringFormatParams<$ZodGUID, "pattern" | "when">;
1784
+ type $ZodCheckUUIDParams = CheckStringFormatParams<$ZodUUID, "pattern" | "when">;
1785
+ type $ZodCheckURLParams = CheckStringFormatParams<$ZodURL, "when">;
1786
+ type $ZodCheckEmojiParams = CheckStringFormatParams<$ZodEmoji, "when">;
1787
+ type $ZodCheckNanoIDParams = CheckStringFormatParams<$ZodNanoID, "when">;
1788
+ /**
1789
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
1790
+ * (timestamps embedded in the id). Use {@link _cuid2} instead.
1791
+ * See https://github.com/paralleldrive/cuid.
1792
+ */
1793
+ type $ZodCheckCUIDParams = CheckStringFormatParams<$ZodCUID, "when">;
1794
+ type $ZodCheckCUID2Params = CheckStringFormatParams<$ZodCUID2, "when">;
1795
+ type $ZodCheckULIDParams = CheckStringFormatParams<$ZodULID, "when">;
1796
+ type $ZodCheckXIDParams = CheckStringFormatParams<$ZodXID, "when">;
1797
+ type $ZodCheckKSUIDParams = CheckStringFormatParams<$ZodKSUID, "when">;
1798
+ type $ZodCheckIPv4Params = CheckStringFormatParams<$ZodIPv4, "pattern" | "when" | "version">;
1799
+ type $ZodCheckIPv6Params = CheckStringFormatParams<$ZodIPv6, "pattern" | "when" | "version">;
1800
+ type $ZodCheckCIDRv4Params = CheckStringFormatParams<$ZodCIDRv4, "pattern" | "when">;
1801
+ type $ZodCheckCIDRv6Params = CheckStringFormatParams<$ZodCIDRv6, "pattern" | "when">;
1802
+ type $ZodCheckBase64Params = CheckStringFormatParams<$ZodBase64, "pattern" | "when">;
1803
+ type $ZodCheckBase64URLParams = CheckStringFormatParams<$ZodBase64URL, "pattern" | "when">;
1804
+ type $ZodCheckE164Params = CheckStringFormatParams<$ZodE164, "when">;
1805
+ type $ZodCheckJWTParams = CheckStringFormatParams<$ZodJWT, "pattern" | "when">;
1806
+ type $ZodCheckISODateTimeParams = CheckStringFormatParams<$ZodISODateTime, "pattern" | "when">;
1807
+ type $ZodCheckISODateParams = CheckStringFormatParams<$ZodISODate, "pattern" | "when">;
1808
+ type $ZodCheckISOTimeParams = CheckStringFormatParams<$ZodISOTime, "pattern" | "when">;
1809
+ type $ZodCheckISODurationParams = CheckStringFormatParams<$ZodISODuration, "when">;
1810
+ type $ZodCheckNumberFormatParams = CheckParams<$ZodCheckNumberFormat, "format" | "when">;
1811
+ type $ZodCheckLessThanParams = CheckParams<$ZodCheckLessThan, "inclusive" | "value" | "when">;
1812
+ type $ZodCheckGreaterThanParams = CheckParams<$ZodCheckGreaterThan, "inclusive" | "value" | "when">;
1813
+ type $ZodCheckMultipleOfParams = CheckParams<$ZodCheckMultipleOf, "value" | "when">;
1814
+ type $ZodCheckMaxLengthParams = CheckParams<$ZodCheckMaxLength, "maximum" | "when">;
1815
+ type $ZodCheckMinLengthParams = CheckParams<$ZodCheckMinLength, "minimum" | "when">;
1816
+ type $ZodCheckLengthEqualsParams = CheckParams<$ZodCheckLengthEquals, "length" | "when">;
1817
+ type $ZodCheckRegexParams = CheckParams<$ZodCheckRegex, "format" | "pattern" | "when">;
1818
+ type $ZodCheckLowerCaseParams = CheckParams<$ZodCheckLowerCase, "format" | "when">;
1819
+ type $ZodCheckUpperCaseParams = CheckParams<$ZodCheckUpperCase, "format" | "when">;
1820
+ type $ZodCheckIncludesParams = CheckParams<$ZodCheckIncludes, "includes" | "format" | "when" | "pattern">;
1821
+ type $ZodCheckStartsWithParams = CheckParams<$ZodCheckStartsWith, "prefix" | "format" | "when" | "pattern">;
1822
+ type $ZodCheckEndsWithParams = CheckParams<$ZodCheckEndsWith, "suffix" | "format" | "pattern" | "when">;
1823
+ type $ZodEnumParams = TypeParams<$ZodEnum, "entries">;
1824
+ type $ZodNonOptionalParams = TypeParams<$ZodNonOptional, "innerType">;
1825
+ type $ZodCustomParams = CheckTypeParams<$ZodCustom, "fn">;
1826
+ type $ZodSuperRefineIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
1827
+ type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
1828
+ /** The schema or check that originated this issue. */
1829
+ readonly inst?: $ZodType | $ZodCheck;
1830
+ /** If `true`, Zod will execute subsequent checks/refinements instead of immediately aborting */
1831
+ readonly continue?: boolean | undefined;
1832
+ } & Record<string, unknown>> : never;
1833
+ interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
1834
+ addIssue(arg: string | $ZodSuperRefineIssue): void;
1835
+ }
1836
+ interface $ZodSuperRefineParams {
1837
+ /** If provided, the refinement runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
1838
+ when?: ((payload: ParsePayload) => boolean) | undefined;
1839
+ }
1840
+
1841
+ /** An Error-like class used to store Zod validation issues. */
1842
+ interface ZodError<T = unknown> extends $ZodError<T> {
1843
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
1844
+ format(): $ZodFormattedError<T>;
1845
+ format<U>(mapper: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
1846
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
1847
+ flatten(): $ZodFlattenedError<T>;
1848
+ flatten<U>(mapper: (issue: $ZodIssue) => U): $ZodFlattenedError<T, U>;
1849
+ /** @deprecated Push directly to `.issues` instead. */
1850
+ addIssue(issue: $ZodIssue): void;
1851
+ /** @deprecated Push directly to `.issues` instead. */
1852
+ addIssues(issues: $ZodIssue[]): void;
1853
+ /** @deprecated Check `err.issues.length === 0` instead. */
1854
+ isEmpty: boolean;
1855
+ }
1856
+ declare const ZodError: $constructor<ZodError>;
1857
+
1858
+ type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
1859
+ type ZodSafeParseSuccess<T> = {
1860
+ success: true;
1861
+ data: T;
1862
+ error?: never;
1863
+ };
1864
+ type ZodSafeParseError<T> = {
1865
+ success: false;
1866
+ data?: never;
1867
+ error: ZodError<T>;
1868
+ };
1869
+
1870
+ type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<input<T>, output<T>>;
1871
+ interface _ZodType<out Internals extends $ZodTypeInternals = $ZodTypeInternals> extends ZodType<any, any, Internals> {
1872
+ }
1873
+ interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
1874
+ def: Internals["def"];
1875
+ type: Internals["def"]["type"];
1876
+ /** @deprecated Use `.def` instead. */
1877
+ _def: Internals["def"];
1878
+ /** @deprecated Use `z.output<typeof schema>` instead. */
1879
+ _output: Internals["output"];
1880
+ /** @deprecated Use `z.input<typeof schema>` instead. */
1881
+ _input: Internals["input"];
1882
+ "~standard": ZodStandardSchemaWithJSON<this>;
1883
+ /** Converts this schema to a JSON Schema representation. */
1884
+ toJSONSchema(params?: ToJSONSchemaParams): ZodStandardJSONSchemaPayload<this>;
1885
+ check(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
1886
+ with(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
1887
+ clone(def?: Internals["def"], params?: {
1888
+ parent: boolean;
1889
+ }): this;
1890
+ register<R extends $ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [$replace<R["_meta"], this>?] : [$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
1891
+ brand<T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(value?: T): PropertyKey extends T ? this : $ZodBranded<this, T, Dir>;
1892
+ parse(data: unknown, params?: ParseContext<$ZodIssue>): output<this>;
1893
+ safeParse(data: unknown, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<output<this>>;
1894
+ parseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
1895
+ safeParseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
1896
+ spa: (data: unknown, params?: ParseContext<$ZodIssue>) => Promise<ZodSafeParseResult<output<this>>>;
1897
+ encode(data: output<this>, params?: ParseContext<$ZodIssue>): input<this>;
1898
+ decode(data: input<this>, params?: ParseContext<$ZodIssue>): output<this>;
1899
+ encodeAsync(data: output<this>, params?: ParseContext<$ZodIssue>): Promise<input<this>>;
1900
+ decodeAsync(data: input<this>, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
1901
+ safeEncode(data: output<this>, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<input<this>>;
1902
+ safeDecode(data: input<this>, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<output<this>>;
1903
+ safeEncodeAsync(data: output<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<input<this>>>;
1904
+ safeDecodeAsync(data: input<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
1905
+ refine<Ch extends (arg: output<this>) => unknown | Promise<unknown>>(check: Ch, params?: string | $ZodCustomParams): Ch extends (arg: any) => arg is infer R ? this & ZodType<R, input<this>> : this;
1906
+ superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void>, params?: $ZodSuperRefineParams): this;
1907
+ overwrite(fn: (x: output<this>) => output<this>): this;
1908
+ optional(): ZodOptional<this>;
1909
+ exactOptional(): ZodExactOptional<this>;
1910
+ nonoptional(params?: string | $ZodNonOptionalParams): ZodNonOptional<this>;
1911
+ nullable(): ZodNullable<this>;
1912
+ nullish(): ZodOptional<ZodNullable<this>>;
1913
+ default(def: NoUndefined<output<this>>): ZodDefault<this>;
1914
+ default(def: () => NoUndefined<output<this>>): ZodDefault<this>;
1915
+ prefault(def: () => input<this>): ZodPrefault<this>;
1916
+ prefault(def: input<this>): ZodPrefault<this>;
1917
+ array(): ZodArray<this>;
1918
+ or<T extends SomeType>(option: T): ZodUnion<[this, T]>;
1919
+ and<T extends SomeType>(incoming: T): ZodIntersection<this, T>;
1920
+ transform<NewOut>(transform: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, output<this>>>;
1921
+ catch(def: output<this>): ZodCatch<this>;
1922
+ catch(def: (ctx: $ZodCatchCtx) => output<this>): ZodCatch<this>;
1923
+ pipe<T extends $ZodType<any, output<this>>>(target: T | $ZodType<any, output<this>>): ZodPipe<this, T>;
1924
+ readonly(): ZodReadonly<this>;
1925
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
1926
+ describe(description: string): this;
1927
+ description?: string;
1928
+ /** Returns the metadata associated with this instance in `z.globalRegistry` */
1929
+ meta(): $replace<GlobalMeta, this> | undefined;
1930
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
1931
+ meta(data: $replace<GlobalMeta, this>): this;
1932
+ /** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
1933
+ *
1934
+ * ```ts
1935
+ * const schema = z.string().optional();
1936
+ * const isOptional = schema.safeParse(undefined).success; // true
1937
+ * ```
1938
+ */
1939
+ isOptional(): boolean;
1940
+ /**
1941
+ * @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
1942
+ *
1943
+ * ```ts
1944
+ * const schema = z.string().nullable();
1945
+ * const isNullable = schema.safeParse(null).success; // true
1946
+ * ```
1947
+ */
1948
+ isNullable(): boolean;
1949
+ apply<T>(fn: (schema: this) => T): T;
1950
+ }
1951
+ declare const ZodType: $constructor<ZodType>;
1952
+ interface _ZodString<T extends $ZodStringInternals<unknown> = $ZodStringInternals<unknown>> extends _ZodType<T> {
1953
+ format: string | null;
1954
+ minLength: number | null;
1955
+ maxLength: number | null;
1956
+ regex(regex: RegExp, params?: string | $ZodCheckRegexParams): this;
1957
+ includes(value: string, params?: string | $ZodCheckIncludesParams): this;
1958
+ startsWith(value: string, params?: string | $ZodCheckStartsWithParams): this;
1959
+ endsWith(value: string, params?: string | $ZodCheckEndsWithParams): this;
1960
+ min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
1961
+ max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
1962
+ length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
1963
+ nonempty(params?: string | $ZodCheckMinLengthParams): this;
1964
+ lowercase(params?: string | $ZodCheckLowerCaseParams): this;
1965
+ uppercase(params?: string | $ZodCheckUpperCaseParams): this;
1966
+ trim(): this;
1967
+ normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
1968
+ toLowerCase(): this;
1969
+ toUpperCase(): this;
1970
+ slugify(): this;
1971
+ }
1972
+ /** @internal */
1973
+ declare const _ZodString: $constructor<_ZodString>;
1974
+ interface ZodString extends _ZodString<$ZodStringInternals<string>> {
1975
+ /** @deprecated Use `z.email()` instead. */
1976
+ email(params?: string | $ZodCheckEmailParams): this;
1977
+ /** @deprecated Use `z.url()` instead. */
1978
+ url(params?: string | $ZodCheckURLParams): this;
1979
+ /** @deprecated Use `z.jwt()` instead. */
1980
+ jwt(params?: string | $ZodCheckJWTParams): this;
1981
+ /** @deprecated Use `z.emoji()` instead. */
1982
+ emoji(params?: string | $ZodCheckEmojiParams): this;
1983
+ /** @deprecated Use `z.guid()` instead. */
1984
+ guid(params?: string | $ZodCheckGUIDParams): this;
1985
+ /** @deprecated Use `z.uuid()` instead. */
1986
+ uuid(params?: string | $ZodCheckUUIDParams): this;
1987
+ /** @deprecated Use `z.uuid()` instead. */
1988
+ uuidv4(params?: string | $ZodCheckUUIDParams): this;
1989
+ /** @deprecated Use `z.uuid()` instead. */
1990
+ uuidv6(params?: string | $ZodCheckUUIDParams): this;
1991
+ /** @deprecated Use `z.uuid()` instead. */
1992
+ uuidv7(params?: string | $ZodCheckUUIDParams): this;
1993
+ /** @deprecated Use `z.nanoid()` instead. */
1994
+ nanoid(params?: string | $ZodCheckNanoIDParams): this;
1995
+ /** @deprecated Use `z.guid()` instead. */
1996
+ guid(params?: string | $ZodCheckGUIDParams): this;
1997
+ /**
1998
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
1999
+ * (timestamps embedded in the id). Use `z.cuid2()` instead.
2000
+ * See https://github.com/paralleldrive/cuid.
2001
+ */
2002
+ cuid(params?: string | $ZodCheckCUIDParams): this;
2003
+ /** @deprecated Use `z.cuid2()` instead. */
2004
+ cuid2(params?: string | $ZodCheckCUID2Params): this;
2005
+ /** @deprecated Use `z.ulid()` instead. */
2006
+ ulid(params?: string | $ZodCheckULIDParams): this;
2007
+ /** @deprecated Use `z.base64()` instead. */
2008
+ base64(params?: string | $ZodCheckBase64Params): this;
2009
+ /** @deprecated Use `z.base64url()` instead. */
2010
+ base64url(params?: string | $ZodCheckBase64URLParams): this;
2011
+ /** @deprecated Use `z.xid()` instead. */
2012
+ xid(params?: string | $ZodCheckXIDParams): this;
2013
+ /** @deprecated Use `z.ksuid()` instead. */
2014
+ ksuid(params?: string | $ZodCheckKSUIDParams): this;
2015
+ /** @deprecated Use `z.ipv4()` instead. */
2016
+ ipv4(params?: string | $ZodCheckIPv4Params): this;
2017
+ /** @deprecated Use `z.ipv6()` instead. */
2018
+ ipv6(params?: string | $ZodCheckIPv6Params): this;
2019
+ /** @deprecated Use `z.cidrv4()` instead. */
2020
+ cidrv4(params?: string | $ZodCheckCIDRv4Params): this;
2021
+ /** @deprecated Use `z.cidrv6()` instead. */
2022
+ cidrv6(params?: string | $ZodCheckCIDRv6Params): this;
2023
+ /** @deprecated Use `z.e164()` instead. */
2024
+ e164(params?: string | $ZodCheckE164Params): this;
2025
+ /** @deprecated Use `z.iso.datetime()` instead. */
2026
+ datetime(params?: string | $ZodCheckISODateTimeParams): this;
2027
+ /** @deprecated Use `z.iso.date()` instead. */
2028
+ date(params?: string | $ZodCheckISODateParams): this;
2029
+ /** @deprecated Use `z.iso.time()` instead. */
2030
+ time(params?: string | $ZodCheckISOTimeParams): this;
2031
+ /** @deprecated Use `z.iso.duration()` instead. */
2032
+ duration(params?: string | $ZodCheckISODurationParams): this;
2033
+ }
2034
+ declare const ZodString: $constructor<ZodString>;
2035
+ interface _ZodNumber<Internals extends $ZodNumberInternals = $ZodNumberInternals> extends _ZodType<Internals> {
2036
+ gt(value: number, params?: string | $ZodCheckGreaterThanParams): this;
2037
+ /** Identical to .min() */
2038
+ gte(value: number, params?: string | $ZodCheckGreaterThanParams): this;
2039
+ min(value: number, params?: string | $ZodCheckGreaterThanParams): this;
2040
+ lt(value: number, params?: string | $ZodCheckLessThanParams): this;
2041
+ /** Identical to .max() */
2042
+ lte(value: number, params?: string | $ZodCheckLessThanParams): this;
2043
+ max(value: number, params?: string | $ZodCheckLessThanParams): this;
2044
+ /** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
2045
+ int(params?: string | $ZodCheckNumberFormatParams): this;
2046
+ /** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
2047
+ safe(params?: string | $ZodCheckNumberFormatParams): this;
2048
+ positive(params?: string | $ZodCheckGreaterThanParams): this;
2049
+ nonnegative(params?: string | $ZodCheckGreaterThanParams): this;
2050
+ negative(params?: string | $ZodCheckLessThanParams): this;
2051
+ nonpositive(params?: string | $ZodCheckLessThanParams): this;
2052
+ multipleOf(value: number, params?: string | $ZodCheckMultipleOfParams): this;
2053
+ /** @deprecated Use `.multipleOf()` instead. */
2054
+ step(value: number, params?: string | $ZodCheckMultipleOfParams): this;
2055
+ /** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
2056
+ finite(params?: unknown): this;
2057
+ minValue: number | null;
2058
+ maxValue: number | null;
2059
+ /** @deprecated Check the `format` property instead. */
2060
+ isInt: boolean;
2061
+ /** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
2062
+ isFinite: boolean;
2063
+ format: string | null;
2064
+ }
2065
+ interface ZodNumber extends _ZodNumber<$ZodNumberInternals<number>> {
2066
+ }
2067
+ declare const ZodNumber: $constructor<ZodNumber>;
2068
+ interface _ZodBoolean<T extends $ZodBooleanInternals = $ZodBooleanInternals> extends _ZodType<T> {
2069
+ }
2070
+ interface ZodBoolean extends _ZodBoolean<$ZodBooleanInternals<boolean>> {
2071
+ }
2072
+ declare const ZodBoolean: $constructor<ZodBoolean>;
2073
+ interface ZodNull extends _ZodType<$ZodNullInternals> {
2074
+ }
2075
+ declare const ZodNull: $constructor<ZodNull>;
2076
+ interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInternals<T>>, $ZodArray<T> {
2077
+ element: T;
2078
+ min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
2079
+ nonempty(params?: string | $ZodCheckMinLengthParams): this;
2080
+ max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
2081
+ length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
2082
+ unwrap(): T;
2083
+ "~standard": ZodStandardSchemaWithJSON<this>;
2084
+ }
2085
+ declare const ZodArray: $constructor<ZodArray>;
2086
+ type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = {
2087
+ [K in keyof Ext]: K extends keyof Base ? output<Ext[K]> extends output<Base[K]> ? input<Ext[K]> extends input<Base[K]> ? Ext[K] : never : never : Ext[K];
2088
+ };
2089
+ interface ZodObject<
2090
+ /** @ts-ignore Cast variance */
2091
+ out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
2092
+ "~standard": ZodStandardSchemaWithJSON<this>;
2093
+ shape: Shape;
2094
+ keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
2095
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
2096
+ catchall<T extends SomeType>(schema: T): ZodObject<Shape, $catchall<T>>;
2097
+ /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
2098
+ passthrough(): ZodObject<Shape, $loose>;
2099
+ /** Consider `z.looseObject(A.shape)` instead */
2100
+ loose(): ZodObject<Shape, $loose>;
2101
+ /** Consider `z.strictObject(A.shape)` instead */
2102
+ strict(): ZodObject<Shape, $strict>;
2103
+ /** This is the default behavior. This method call is likely unnecessary. */
2104
+ strip(): ZodObject<Shape, $strip>;
2105
+ extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, Writeable<U>>, Config>;
2106
+ safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, Writeable<U>>, Config>;
2107
+ /**
2108
+ * @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
2109
+ */
2110
+ merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
2111
+ pick<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
2112
+ omit<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
2113
+ partial(): ZodObject<{
2114
+ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>;
2115
+ }, Config>;
2116
+ partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{
2117
+ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k];
2118
+ }, Config>;
2119
+ required(): ZodObject<{
2120
+ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>;
2121
+ }, Config>;
2122
+ required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{
2123
+ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
2124
+ }, Config>;
2125
+ }
2126
+ declare const ZodObject: $constructor<ZodObject>;
2127
+ interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
2128
+ "~standard": ZodStandardSchemaWithJSON<this>;
2129
+ options: T;
2130
+ }
2131
+ declare const ZodUnion: $constructor<ZodUnion>;
2132
+ interface ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodIntersectionInternals<A, B>>, $ZodIntersection<A, B> {
2133
+ "~standard": ZodStandardSchemaWithJSON<this>;
2134
+ }
2135
+ declare const ZodIntersection: $constructor<ZodIntersection>;
2136
+ interface ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends _ZodType<$ZodRecordInternals<Key, Value>>, $ZodRecord<Key, Value> {
2137
+ "~standard": ZodStandardSchemaWithJSON<this>;
2138
+ keyType: Key;
2139
+ valueType: Value;
2140
+ }
2141
+ declare const ZodRecord: $constructor<ZodRecord>;
2142
+ interface ZodEnum<
2143
+ /** @ts-ignore Cast variance */
2144
+ out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
2145
+ "~standard": ZodStandardSchemaWithJSON<this>;
2146
+ enum: T;
2147
+ options: Array<T[keyof T]>;
2148
+ extract<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Pick<T, U[number]>>>;
2149
+ exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Omit<T, U[number]>>>;
2150
+ }
2151
+ declare const ZodEnum: $constructor<ZodEnum>;
2152
+ interface ZodLiteral<T extends Literal = Literal> extends _ZodType<$ZodLiteralInternals<T>>, $ZodLiteral<T> {
2153
+ "~standard": ZodStandardSchemaWithJSON<this>;
2154
+ values: Set<T>;
2155
+ /** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
2156
+ value: T;
2157
+ }
2158
+ declare const ZodLiteral: $constructor<ZodLiteral>;
2159
+ interface ZodTransform<O = unknown, I = unknown> extends _ZodType<$ZodTransformInternals<O, I>>, $ZodTransform<O, I> {
2160
+ "~standard": ZodStandardSchemaWithJSON<this>;
2161
+ }
2162
+ declare const ZodTransform: $constructor<ZodTransform>;
2163
+ interface ZodOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodOptionalInternals<T>>, $ZodOptional<T> {
2164
+ "~standard": ZodStandardSchemaWithJSON<this>;
2165
+ unwrap(): T;
2166
+ }
2167
+ declare const ZodOptional: $constructor<ZodOptional>;
2168
+ interface ZodExactOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodExactOptionalInternals<T>>, $ZodExactOptional<T> {
2169
+ "~standard": ZodStandardSchemaWithJSON<this>;
2170
+ unwrap(): T;
2171
+ }
2172
+ declare const ZodExactOptional: $constructor<ZodExactOptional>;
2173
+ interface ZodNullable<T extends SomeType = $ZodType> extends _ZodType<$ZodNullableInternals<T>>, $ZodNullable<T> {
2174
+ "~standard": ZodStandardSchemaWithJSON<this>;
2175
+ unwrap(): T;
2176
+ }
2177
+ declare const ZodNullable: $constructor<ZodNullable>;
2178
+ interface ZodDefault<T extends SomeType = $ZodType> extends _ZodType<$ZodDefaultInternals<T>>, $ZodDefault<T> {
2179
+ "~standard": ZodStandardSchemaWithJSON<this>;
2180
+ unwrap(): T;
2181
+ /** @deprecated Use `.unwrap()` instead. */
2182
+ removeDefault(): T;
2183
+ }
2184
+ declare const ZodDefault: $constructor<ZodDefault>;
2185
+ interface ZodPrefault<T extends SomeType = $ZodType> extends _ZodType<$ZodPrefaultInternals<T>>, $ZodPrefault<T> {
2186
+ "~standard": ZodStandardSchemaWithJSON<this>;
2187
+ unwrap(): T;
2188
+ }
2189
+ declare const ZodPrefault: $constructor<ZodPrefault>;
2190
+ interface ZodNonOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodNonOptionalInternals<T>>, $ZodNonOptional<T> {
2191
+ "~standard": ZodStandardSchemaWithJSON<this>;
2192
+ unwrap(): T;
2193
+ }
2194
+ declare const ZodNonOptional: $constructor<ZodNonOptional>;
2195
+ interface ZodCatch<T extends SomeType = $ZodType> extends _ZodType<$ZodCatchInternals<T>>, $ZodCatch<T> {
2196
+ "~standard": ZodStandardSchemaWithJSON<this>;
2197
+ unwrap(): T;
2198
+ /** @deprecated Use `.unwrap()` instead. */
2199
+ removeCatch(): T;
2200
+ }
2201
+ declare const ZodCatch: $constructor<ZodCatch>;
2202
+ interface ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodPipeInternals<A, B>>, $ZodPipe<A, B> {
2203
+ "~standard": ZodStandardSchemaWithJSON<this>;
2204
+ in: A;
2205
+ out: B;
2206
+ }
2207
+ declare const ZodPipe: $constructor<ZodPipe>;
2208
+ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadonlyInternals<T>>, $ZodReadonly<T> {
2209
+ "~standard": ZodStandardSchemaWithJSON<this>;
2210
+ unwrap(): T;
2211
+ }
2212
+ declare const ZodReadonly: $constructor<ZodReadonly>;
2213
+ type _ZodJSONSchema = ZodUnion<[
2214
+ ZodString,
2215
+ ZodNumber,
2216
+ ZodBoolean,
2217
+ ZodNull,
2218
+ ZodArray<ZodJSONSchema>,
2219
+ ZodRecord<ZodString, ZodJSONSchema>
2220
+ ]>;
2221
+ type _ZodJSONSchemaInternals = _ZodJSONSchema["_zod"];
2222
+ interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
2223
+ output: JSONType;
2224
+ input: JSONType;
2225
+ }
2226
+ interface ZodJSONSchema extends _ZodJSONSchema {
2227
+ _zod: ZodJSONSchemaInternals;
2228
+ }
2229
+
2230
+ /**
2231
+ * 间距档位;DSL 不提供自由数值,间距只能取自 design token 档位。
2232
+ *
2233
+ * 同一档位在纵向与横向映射到不同 token 家族(`space-stack-*` 与 `space-inline-*`),
2234
+ * 因此插件声明的是节奏而不是像素。
2235
+ */
2236
+ declare const viewGapSchema: ZodEnum<{
2237
+ none: "none";
2238
+ micro: "micro";
2239
+ xs: "xs";
2240
+ compact: "compact";
2241
+ sm: "sm";
2242
+ related: "related";
2243
+ md: "md";
2244
+ emphasis: "emphasis";
2245
+ section: "section";
2246
+ lg: "lg";
2247
+ }>;
2248
+ /** 容器内边距档位;`block-xs` / `block-sm` 仅上下留白 4px / 8px,不改变文案左右对齐,其余映射到 inset token,`card` 为 20px 安全区。 */
2249
+ declare const viewPaddingSchema: ZodEnum<{
2250
+ none: "none";
2251
+ sm: "sm";
2252
+ md: "md";
2253
+ lg: "lg";
2254
+ "block-xs": "block-xs";
2255
+ "block-sm": "block-sm";
2256
+ balanced: "balanced";
2257
+ card: "card";
2258
+ }>;
2259
+ /** 交叉轴对齐方式。 */
2260
+ declare const viewAlignSchema: ZodEnum<{
2261
+ start: "start";
2262
+ center: "center";
2263
+ end: "end";
2264
+ stretch: "stretch";
2265
+ }>;
2266
+ /** 主轴分布方式。 */
2267
+ declare const viewDistributeSchema: ZodEnum<{
2268
+ start: "start";
2269
+ center: "center";
2270
+ end: "end";
2271
+ between: "between";
2272
+ }>;
2273
+ /**
2274
+ * 容器表面配方。
2275
+ *
2276
+ * 插件只声明「这是一块什么」,具体底色、描边与圆角由宿主决定,宿主因此可以整体改版而不需要插件跟进。
2277
+ */
2278
+ declare const viewSurfaceSchema: ZodEnum<{
2279
+ none: "none";
2280
+ card: "card";
2281
+ panel: "panel";
2282
+ inset: "inset";
2283
+ outline: "outline";
2284
+ tint: "tint";
2285
+ }>;
2286
+ /**
2287
+ * 容器出血档位。
2288
+ *
2289
+ * `card-top` 只把容器表面延伸到标准 Card 的顶部与左右内边界;容器内容仍由宿主按 Card
2290
+ * 安全区内收。旧宿主忽略该新增属性后仍渲染同一内容,只是退回普通内嵌表面。
2291
+ */
2292
+ declare const viewBleedSchema: ZodEnum<{
2293
+ "card-top": "card-top";
2294
+ }>;
2295
+ /** 圆角档位;映射到 `radius-surface-*`、`radius-dialog` 与圆形控件使用的 `full`。 */
2296
+ declare const viewRadiusSchema: ZodEnum<{
2297
+ none: "none";
2298
+ sm: "sm";
2299
+ md: "md";
2300
+ lg: "lg";
2301
+ full: "full";
2302
+ }>;
2303
+ /** 层次档位;`raised` 同时切换局部 color context。 */
2304
+ declare const viewElevationSchema: ZodEnum<{
2305
+ flat: "flat";
2306
+ raised: "raised";
2307
+ }>;
2308
+ /** 容器横向尺寸档位;`auto` 使用内容固有宽度,`fill` 贯通父容器,DSL 不提供自由宽度。 */
2309
+ declare const viewWidthSchema: ZodEnum<{
2310
+ auto: "auto";
2311
+ fill: "fill";
2312
+ }>;
2313
+ /** 容器固定正方形尺寸;`md` 为 48×48 媒体槽,`hero` 为与头部主图一致的 60×60 占位槽。 */
2314
+ declare const viewBoxSizeSchema: ZodEnum<{
2315
+ md: "md";
2316
+ hero: "hero";
2317
+ }>;
2318
+ /** 容器纵向固定尺寸档位;只开放已有固定卡板合同需要的结构高度。 */
2319
+ declare const viewHeightSchema: ZodEnum<{
2320
+ "data-tile": "data-tile";
2321
+ }>;
2322
+ /** 网格列数;固定档位而不是自由数值,避免出现宿主无法保证可读性的窄列。 */
2323
+ declare const viewGridColumnsSchema: ZodUnion<readonly [ZodLiteral<2>, ZodLiteral<3>, ZodLiteral<4>]>;
2324
+ /** 文本语义层级。 */
2325
+ declare const viewTextVariantSchema: ZodEnum<{
2326
+ display: "display";
2327
+ title: "title";
2328
+ "title-large": "title-large";
2329
+ subtitle: "subtitle";
2330
+ body: "body";
2331
+ "body-large": "body-large";
2332
+ caption: "caption";
2333
+ label: "label";
2334
+ status: "status";
2335
+ "status-large": "status-large";
2336
+ meta: "meta";
2337
+ "meta-large": "meta-large";
2338
+ "meta-compact": "meta-compact";
2339
+ "data-label": "data-label";
2340
+ }>;
2341
+ /** 文本字重覆写;缺省时使用语义层级自带的字重。 */
2342
+ declare const viewTextWeightSchema: ZodEnum<{
2343
+ regular: "regular";
2344
+ medium: "medium";
2345
+ semibold: "semibold";
2346
+ }>;
2347
+ /**
2348
+ * 宿主批准的文本完整 Paint;只表达完整视觉配方,不接受插件传入自由颜色或渐变字面量。
2349
+ *
2350
+ * 不认识该字段的旧宿主会忽略它,因此调用方仍应同时声明可读的 `tone` 作为降级语义色。
2351
+ */
2352
+ declare const viewTextPaintSchema: ZodEnum<{
2353
+ "achievement-completion": "achievement-completion";
2354
+ }>;
2355
+ /** 内容语气;映射到 semantic token 或宿主提供的上下文强调色,不接受任意颜色。 */
2356
+ declare const viewToneSchema: ZodEnum<{
2357
+ success: "success";
2358
+ default: "default";
2359
+ accent: "accent";
2360
+ muted: "muted";
2361
+ warning: "warning";
2362
+ danger: "danger";
2363
+ }>;
2364
+ /** 文本专用语气;额外开放 `Text/Strong` 和 `Text/Tertiary`。 */
2365
+ declare const viewTextToneSchema: ZodEnum<{
2366
+ success: "success";
2367
+ default: "default";
2368
+ strong: "strong";
2369
+ accent: "accent";
2370
+ muted: "muted";
2371
+ warning: "warning";
2372
+ danger: "danger";
2373
+ tertiary: "tertiary";
2374
+ }>;
2375
+ /** 比例条厚度档位;`sm` 保持既有细条,`md`/`lg` 服务高信息密度图表。 */
2376
+ declare const viewMeterSizeSchema: ZodEnum<{
2377
+ sm: "sm";
2378
+ md: "md";
2379
+ lg: "lg";
2380
+ }>;
2381
+ /** 环形进度尺寸档位;`hero` 对应卡片头部稳定使用的 60px 视觉锚点。 */
2382
+ declare const viewRadialProgressSizeSchema: ZodEnum<{
2383
+ sm: "sm";
2384
+ md: "md";
2385
+ hero: "hero";
2386
+ }>;
2387
+ /** 环形进度中心的宿主批准图形;不接受 Runtime 自由图片地址。 */
2388
+ declare const viewRadialProgressCenterGraphicSchema: ZodEnum<{
2389
+ "achievement-completion-medal": "achievement-completion-medal";
2390
+ }>;
2391
+ /** 分类柱图柱宽档位;`md` 对应 PC 1×1 卡片的 22px 主柱。 */
2392
+ declare const viewBarChartSizeSchema: ZodEnum<{
2393
+ sm: "sm";
2394
+ md: "md";
2395
+ }>;
2396
+ /** 按钮视觉层级。 */
2397
+ declare const viewButtonVariantSchema: ZodEnum<{
2398
+ primary: "primary";
2399
+ secondary: "secondary";
2400
+ ghost: "ghost";
2401
+ }>;
2402
+ /** 图片填充方式。 */
2403
+ declare const viewImageFitSchema: ZodEnum<{
2404
+ cover: "cover";
2405
+ contain: "contain";
2406
+ }>;
2407
+ /**
2408
+ * 图片呈现强度。
2409
+ *
2410
+ * `deemphasized` 只表达内容尚不可用或需要弱化,宿主统一映射为灰阶与受控透明度;它不携带
2411
+ * disabled、锁定或业务分类语义,调用方仍需用可读文本、图标或整体可访问名称表达真实状态。
2412
+ */
2413
+ declare const viewImageAppearanceSchema: ZodEnum<{
2414
+ default: "default";
2415
+ deemphasized: "deemphasized";
2416
+ }>;
2417
+ /** 图片色彩语义;semantic 表示颜色承载业务含义,两类图片均保留原色,不随卡片主次添加滤镜。 */
2418
+ declare const viewImageColorRoleSchema: ZodEnum<{
2419
+ content: "content";
2420
+ semantic: "semantic";
2421
+ }>;
2422
+ /**
2423
+ * 图片尺寸档位。
2424
+ *
2425
+ * 只用于必须固定边长的图:缺省时图片由容器与自身固有像素决定宽度,在宽卡的网格里会被
2426
+ * 撑到整格宽,那是媒体图的行为而不是图标或列表缩略图的行为。档位而非自由数值,保证同一份
2427
+ * 文档在不同卡片尺寸下呈现一致。`thumb` 对应列表行 40px 方图;`hero` 对应 60px 头部视觉锚点;
2428
+ * `xl` 对应 80px 独立装饰层;`content` 对应 128px 内容列表图;`feature` 是宽卡主图固定边长;
2429
+ * `landscape-compact` 与 `landscape-content` 分别提供 82×48px、128×74px 的整数横图槽。
2430
+ */
2431
+ declare const viewImageSizeSchema: ZodEnum<{
2432
+ sm: "sm";
2433
+ md: "md";
2434
+ lg: "lg";
2435
+ hero: "hero";
2436
+ content: "content";
2437
+ thumb: "thumb";
2438
+ xl: "xl";
2439
+ feature: "feature";
2440
+ "landscape-compact": "landscape-compact";
2441
+ "landscape-content": "landscape-content";
2442
+ }>;
2443
+ /** 图标边长档位;只开放宿主批准的 16px、20px 与 24px,不接受自由尺寸。 */
2444
+ declare const viewIconSizeSchema: ZodUnion<readonly [ZodLiteral<16>, ZodLiteral<20>, ZodLiteral<24>]>;
2445
+ /** 图标颜色语义;disabled 对应 Text/Disabled 弱色,仅改变颜色,不禁用交互。实际色值由宿主主题映射。 */
2446
+ declare const viewIconColorSchema: ZodEnum<{
2447
+ default: "default";
2448
+ accent: "accent";
2449
+ tertiary: "tertiary";
2450
+ secondary: "secondary";
2451
+ disabled: "disabled";
2452
+ }>;
2453
+ /** 图片遮罩;`fadeBottom` 在中段渐隐,`fadeBottomContent` 为底部短摘要保留更大画面,`fadeBottomEdge` 在底边收口。 */
2454
+ declare const viewImageOverlaySchema: ZodEnum<{
2455
+ none: "none";
2456
+ scrim: "scrim";
2457
+ gradientBottom: "gradientBottom";
2458
+ gradientTopBottom: "gradientTopBottom";
2459
+ fadeBottom: "fadeBottom";
2460
+ fadeBottomContent: "fadeBottomContent";
2461
+ fadeBottomEdge: "fadeBottomEdge";
2462
+ }>;
2463
+ /** 列表条目排版。 */
2464
+ declare const viewListVariantSchema: ZodEnum<{
2465
+ compact: "compact";
2466
+ media: "media";
2467
+ plain: "plain";
2468
+ }>;
2469
+ /** 轮播页指示器形态;具体视觉由宿主统一提供。 */
2470
+ declare const viewCarouselPaginationSchema: ZodEnum<{
2471
+ none: "none";
2472
+ bullets: "bullets";
2473
+ fraction: "fraction";
2474
+ }>;
2475
+ /** 轮播页指示器相对内容的放置方式。 */
2476
+ declare const viewCarouselPaginationPlacementSchema: ZodEnum<{
2477
+ inside: "inside";
2478
+ outside: "outside";
2479
+ }>;
2480
+ /** 单个视口同时展示的轮播页数档位。 */
2481
+ declare const viewCarouselSlidesPerViewSchema: ZodUnion<readonly [ZodLiteral<1>, ZodLiteral<2>, ZodLiteral<3>]>;
2482
+ /**
2483
+ * 新文档到达时使用的过渡配置。
2484
+ *
2485
+ * 配置只选择宿主受控的语义效果,不开放时长、缓动、位移或任意 CSS;旧宿主会剥离这个
2486
+ * 可选根属性并直接显示新文档,因此它属于向前兼容的渐进增强。
2487
+ */
2488
+ declare const viewTransitionSchema: ZodObject<{
2489
+ effect: ZodEnum<{
2490
+ crossfade: "crossfade";
2491
+ morph: "morph";
2492
+ }>;
2493
+ }, $strip>;
2494
+ /**
2495
+ * 节点动作。
2496
+ *
2497
+ * `input` 是 Runtime 在构建文档时就已确定的静态 JSON;`inputFrom` 把「宿主此刻持有的用户输入」
2498
+ * 并进同一份 input,取值按「input 键 → `textField` 节点 id」映射。做成显式映射而不是隐式约定,
2499
+ * 是因为一个提交按钮可能收集多个字段,而字段与按钮在文档里往往不相邻。
2500
+ *
2501
+ * 不认识 `inputFrom` 的旧宿主会忽略它并只发送静态 `input`,因此声明该绑定的 Command 必须把对应
2502
+ * 键声明为必填,让缺失在 Runtime 侧稳定失败,而不是拿着空值执行。
2503
+ */
2504
+ declare const viewActionSchema: ZodObject<{
2505
+ commandId: ZodString;
2506
+ input: ZodOptional<ZodJSONSchema>;
2507
+ inputFrom: ZodOptional<ZodRecord<ZodString, ZodString>>;
2508
+ }, $strip>;
2509
+ /** 比例条中的一个语义数据段;颜色只能来自宿主语气映射。 */
2510
+ declare const viewMeterSegmentSchema: ZodObject<{
2511
+ value: ZodNumber;
2512
+ label: ZodString;
2513
+ tone: ZodOptional<ZodEnum<{
2514
+ success: "success";
2515
+ default: "default";
2516
+ accent: "accent";
2517
+ muted: "muted";
2518
+ warning: "warning";
2519
+ danger: "danger";
2520
+ }>>;
2521
+ }, $strip>;
2522
+ /** 分类柱图中的一个数据项;标签和数值由 Runtime 提供,视觉归一化由宿主持有。 */
2523
+ declare const viewBarChartItemSchema: ZodObject<{
2524
+ label: ZodString;
2525
+ value: ZodNumber;
2526
+ valueLabel: ZodOptional<ZodString>;
2527
+ }, $strip>;
2528
+ /**
2529
+ * 文本节点的行内富文本片段。
2530
+ *
2531
+ * `spans` 是 `value` 的并行表达而不是替代品:不认识它的宿主把它当未知属性剥离后仍渲染 `value`,
2532
+ * 富文本因此走「未知属性静默忽略」这条向前兼容路径,不需要递增文档 schema major。
2533
+ * 代价是两处文本必须始终一致,该不变量由 `parseViewDocument` 结算。
2534
+ */
2535
+ declare const viewTextSpanSchema: ZodObject<{
2536
+ text: ZodString;
2537
+ marks: ZodOptional<ZodArray<ZodEnum<{
2538
+ strong: "strong";
2539
+ em: "em";
2540
+ }>>>;
2541
+ }, $strip>;
2542
+ /** 图片缺失或加载失败时的回退表达。 */
2543
+ declare const viewImageFallbackSchema: ZodObject<{
2544
+ source: ZodOptional<ZodLiteral<"app-ambient">>;
2545
+ icon: ZodOptional<ZodString>;
2546
+ text: ZodOptional<ZodString>;
2547
+ }, $strip>;
2548
+ /** 字段组条目;`value` 缺省时渲染 `placeholder`,不虚构字段。 */
2549
+ declare const viewFieldItemSchema: ZodObject<{
2550
+ label: ZodString;
2551
+ value: ZodOptional<ZodString>;
2552
+ placeholder: ZodOptional<ZodString>;
2553
+ }, $strip>;
2554
+ /**
2555
+ * 列表条目;`action` 缺省即为不可点击条目,不显示点击暗示。
2556
+ *
2557
+ * `disabled` 表达「这条现在点不了」,与「不给 action」不同:后者是静态信息行,前者必须同时给出
2558
+ * 可读原因,否则用户只会看到一行点不动的东西。
2559
+ */
2560
+ declare const viewListItemSchema: ZodObject<{
2561
+ id: ZodString;
2562
+ title: ZodString;
2563
+ subtitle: ZodOptional<ZodString>;
2564
+ meta: ZodOptional<ZodString>;
2565
+ image: ZodOptional<ZodString>;
2566
+ imageFallback: ZodOptional<ZodObject<{
2567
+ source: ZodOptional<ZodLiteral<"app-ambient">>;
2568
+ icon: ZodOptional<ZodString>;
2569
+ text: ZodOptional<ZodString>;
2570
+ }, $strip>>;
2571
+ imageShape: ZodOptional<ZodEnum<{
2572
+ landscape: "landscape";
2573
+ square: "square";
2574
+ circle: "circle";
2575
+ }>>;
2576
+ imageFit: ZodOptional<ZodEnum<{
2577
+ cover: "cover";
2578
+ contain: "contain";
2579
+ }>>;
2580
+ imageAppearance: ZodOptional<ZodEnum<{
2581
+ default: "default";
2582
+ deemphasized: "deemphasized";
2583
+ }>>;
2584
+ imageColorRole: ZodOptional<ZodEnum<{
2585
+ content: "content";
2586
+ semantic: "semantic";
2587
+ }>>;
2588
+ icon: ZodOptional<ZodString>;
2589
+ tone: ZodOptional<ZodEnum<{
2590
+ success: "success";
2591
+ default: "default";
2592
+ accent: "accent";
2593
+ muted: "muted";
2594
+ warning: "warning";
2595
+ danger: "danger";
2596
+ }>>;
2597
+ badge: ZodOptional<ZodObject<{
2598
+ text: ZodString;
2599
+ tone: ZodOptional<ZodEnum<{
2600
+ success: "success";
2601
+ default: "default";
2602
+ accent: "accent";
2603
+ muted: "muted";
2604
+ warning: "warning";
2605
+ danger: "danger";
2606
+ }>>;
2607
+ }, $strip>>;
2608
+ current: ZodOptional<ZodBoolean>;
2609
+ disabled: ZodOptional<ZodBoolean>;
2610
+ disabledReason: ZodOptional<ZodString>;
2611
+ action: ZodOptional<ZodObject<{
2612
+ commandId: ZodString;
2613
+ input: ZodOptional<ZodJSONSchema>;
2614
+ inputFrom: ZodOptional<ZodRecord<ZodString, ZodString>>;
2615
+ }, $strip>>;
2616
+ secondaryAction: ZodOptional<ZodObject<{
2617
+ text: ZodString;
2618
+ variant: ZodOptional<ZodEnum<{
2619
+ primary: "primary";
2620
+ secondary: "secondary";
2621
+ ghost: "ghost";
2622
+ }>>;
2623
+ tone: ZodOptional<ZodEnum<{
2624
+ success: "success";
2625
+ default: "default";
2626
+ accent: "accent";
2627
+ muted: "muted";
2628
+ warning: "warning";
2629
+ danger: "danger";
2630
+ }>>;
2631
+ disabled: ZodOptional<ZodBoolean>;
2632
+ disabledReason: ZodOptional<ZodString>;
2633
+ action: ZodOptional<ZodObject<{
2634
+ commandId: ZodString;
2635
+ input: ZodOptional<ZodJSONSchema>;
2636
+ inputFrom: ZodOptional<ZodRecord<ZodString, ZodString>>;
2637
+ }, $strip>>;
2638
+ }, $strip>>;
2639
+ }, $strip>;
2640
+ /**
2641
+ * Region 顶部的瞬时说明。
2642
+ *
2643
+ * 做成 Region 字段而不是节点:提示属于领域状态,出现与消失不应该让内容重排;宿主把它渲染在
2644
+ * 固定槽位并置 `role="status"`。Runtime 通过移除该字段来收回提示,宿主不自动过期。
2645
+ */
2646
+ declare const viewRegionNoticeSchema: ZodObject<{
2647
+ id: ZodString;
2648
+ text: ZodString;
2649
+ tone: ZodOptional<ZodEnum<{
2650
+ success: "success";
2651
+ default: "default";
2652
+ accent: "accent";
2653
+ muted: "muted";
2654
+ warning: "warning";
2655
+ danger: "danger";
2656
+ }>>;
2657
+ dismissible: ZodOptional<ZodBoolean>;
2658
+ }, $strip>;
2659
+ /**
2660
+ * 容器节点共享的修饰。
2661
+ *
2662
+ * 做成属性而不是包装节点:包装会让每一层留白或表面都额外吃掉一层树深度,很快顶爆 `maxDepth`;
2663
+ * 平铺成可选属性则深度不变,并且天然走「未知属性静默忽略」这条向前兼容路径。
2664
+ */
2665
+ interface ViewBoxModifiers {
2666
+ /** 宿主自持呈现状态时使用的稳定键。 */
2667
+ readonly id?: string;
2668
+ /** 子节点间距档位。 */
2669
+ readonly gap?: ViewGap;
2670
+ /** 容器内边距档位;声明了表面时缺省为 `md`。 */
2671
+ readonly padding?: ViewPadding;
2672
+ /** 交叉轴对齐。 */
2673
+ readonly align?: ViewAlign;
2674
+ /** 主轴分布。 */
2675
+ readonly distribute?: ViewDistribute;
2676
+ /** 表面配方。 */
2677
+ readonly surface?: ViewSurface;
2678
+ /** 让表面延伸到宿主持有的受控边界,内容仍保留安全区。 */
2679
+ readonly bleed?: ViewBleed;
2680
+ /** 圆角档位;声明了表面时缺省为 `md`。 */
2681
+ readonly radius?: ViewRadius;
2682
+ /** 层次档位。 */
2683
+ readonly elevation?: ViewElevation;
2684
+ /** 横向尺寸档位;`auto` 使用内容固有宽度,`fill` 贯通父容器。 */
2685
+ readonly width?: ViewWidth;
2686
+ /** 固定正方形尺寸;用于标准媒体/图标槽,不接受自由宽高。 */
2687
+ readonly size?: ViewBoxSize;
2688
+ /** 纵向固定尺寸档位。 */
2689
+ readonly height?: ViewHeight;
2690
+ /** 是否吃掉父容器主轴的剩余空间。 */
2691
+ readonly grow?: boolean;
2692
+ /** 整个容器可点击时回送的 Command。 */
2693
+ readonly action?: ViewAction;
2694
+ /** 图标等无可见文字的点击容器使用的可访问名称。 */
2695
+ readonly accessibilityLabel?: string;
2696
+ /** 可选交互外观;soft 用带留白的淡底,media 仅增强图片和标题,text 仅改变文字反馈,content 仅增强内部强调文案和缩略图,默认不改变布局。 */
2697
+ readonly interaction?: 'soft' | 'media' | 'text' | 'content';
2698
+ }
2699
+ /**
2700
+ * 宿主无法识别的节点;只要求 `type`,并允许携带降级子树。
2701
+ *
2702
+ * 额外属性在运行时始终是 JSON(schema 只接受 JSON 输入),但静态类型保持 `unknown`:渲染层不应
2703
+ * 依赖任何未知属性的形状。跨进程边界的 JSON 断言集中在 Host 快照一处,不散落到词表定义。
2704
+ */
2705
+ type ViewUnknownNode = {
2706
+ /** 宿主未知的节点类型。 */
2707
+ type: string;
2708
+ /** 供旧宿主渲染的降级子树。 */
2709
+ fallback?: ViewNode;
2710
+ /** 其余未知属性一律忽略。 */
2711
+ [key: string]: unknown;
2712
+ };
2713
+ /** 分段容器的一段。 */
2714
+ interface ViewTabItem {
2715
+ /** 稳定键;宿主用它记住当前分段并生成可访问控件 id。 */
2716
+ readonly id: string;
2717
+ /** 分段标签。 */
2718
+ readonly label: string;
2719
+ /** 标签上的计数或状态标记。 */
2720
+ readonly badge?: string;
2721
+ /** 该段内容;只在被选中时渲染。 */
2722
+ readonly children: ViewNode[];
2723
+ }
2724
+ /** `frame` 节点 `params` 的 JSON 值;必须能原样跨进程复制。 */
2725
+ type ViewFrameParams = null | boolean | number | string | readonly ViewFrameParams[] | {
2726
+ readonly [key: string]: ViewFrameParams;
2727
+ };
2728
+ /** `renderer` 节点引用的当前 Extension 实例运行期资源。 */
2729
+ interface ViewRendererContent {
2730
+ /** 实例资源空间中的逻辑 key;Host 结合当前 Extension 身份构造最终地址。 */
2731
+ readonly resourceKey: string;
2732
+ /** 读取当前实例私有空间或同 Package 共享空间;缺省为 `instance`。 */
2733
+ readonly space?: 'instance' | 'shared';
2734
+ }
2735
+ /**
2736
+ * 宿主已知词表内的节点。
2737
+ *
2738
+ * 与 `ViewUnknownNode` 分开声明:未知节点带索引签名,若并入同一 union 会让 TypeScript 无法按
2739
+ * `type` 收窄,渲染层也就失去类型安全。
2740
+ */
2741
+ type ViewKnownNode = (ViewBoxModifiers & {
2742
+ type: 'vstack';
2743
+ children: ViewNode[];
2744
+ }) | (ViewBoxModifiers & {
2745
+ type: 'hstack';
2746
+ wrap?: boolean;
2747
+ children: ViewNode[];
2748
+ }) | (ViewBoxModifiers & {
2749
+ type: 'zstack';
2750
+ children: ViewNode[];
2751
+ }) | (ViewBoxModifiers & {
2752
+ type: 'grid';
2753
+ columns: ViewGridColumns;
2754
+ children: ViewNode[];
2755
+ }) | {
2756
+ readonly type: 'carousel';
2757
+ /** 宿主保存当前页与生成可访问控件 id 使用的稳定键。 */
2758
+ readonly id: string;
2759
+ /** 轮播区域的可访问名称。 */
2760
+ readonly label: string;
2761
+ /** 每个直接子节点是一页。 */
2762
+ readonly children: ViewNode[];
2763
+ /** 旧宿主不认识 `carousel` 时渲染的降级内容。 */
2764
+ readonly fallback?: ViewNode;
2765
+ /** 单个视口同时展示的页数,缺省为 1。 */
2766
+ readonly slidesPerView?: ViewCarouselSlidesPerView;
2767
+ /** 页间距档位,缺省为 `sm`。 */
2768
+ readonly gap?: ViewGap;
2769
+ /** 是否首尾循环;页数不足时宿主自动退回非循环。 */
2770
+ readonly loop?: boolean;
2771
+ /** 是否让当前页居中。 */
2772
+ readonly centered?: boolean;
2773
+ /** 是否显示上一页/下一页按钮,缺省显示。 */
2774
+ readonly navigation?: boolean;
2775
+ /** 页指示器形态,缺省为 `bullets`。 */
2776
+ readonly pagination?: ViewCarouselPagination;
2777
+ /** 页指示器位于内容内部或外部,缺省为 `outside`。 */
2778
+ readonly paginationPlacement?: ViewCarouselPaginationPlacement;
2779
+ /** 自动播放间隔(毫秒);缺省不自动播放,系统要求减少动态效果时宿主忽略此值。 */
2780
+ readonly autoplayDelay?: number;
2781
+ } | (Omit<ViewBoxModifiers, 'action'> & {
2782
+ type: 'group';
2783
+ title?: string;
2784
+ /** 标题可作为折叠开关;声明后必须提供 `id`。 */
2785
+ collapsible?: boolean;
2786
+ /** 折叠开关的初始状态,缺省展开。 */
2787
+ defaultExpanded?: boolean;
2788
+ /** 标题在可滚动容器内保持吸顶。 */
2789
+ stickyTitle?: boolean;
2790
+ children: ViewNode[];
2791
+ }) | {
2792
+ type: 'spacer';
2793
+ id?: string;
2794
+ } | {
2795
+ type: 'text';
2796
+ id?: string;
2797
+ value: string;
2798
+ /** 行内富文本片段;缺省时按 `value` 渲染纯文本。 */
2799
+ spans?: ViewTextSpan[];
2800
+ variant?: ViewTextVariant;
2801
+ weight?: ViewTextWeight;
2802
+ tone?: ViewTextTone;
2803
+ /** 宿主批准的完整文本 Paint;旧宿主忽略时由 `tone` 保证可读降级。 */
2804
+ paint?: ViewTextPaint;
2805
+ maxLines?: number;
2806
+ /** 按 maxLines 预留完整行高,短文案也保持同一布局高度。 */
2807
+ reserveLines?: boolean;
2808
+ } | {
2809
+ type: 'image';
2810
+ id?: string;
2811
+ src: string;
2812
+ aspectRatio?: string;
2813
+ /** 固定尺寸档位;缺省时宽度由容器与图片固有像素决定。除两个 landscape 档位外均只固定宽度并由宽高比结算高度。 */
2814
+ size?: ViewImageSize;
2815
+ fit?: ViewImageFit;
2816
+ /** 呈现强度;缺省完整显示。 */
2817
+ appearance?: ViewImageAppearance;
2818
+ /** semantic 用于颜色承担信息的图片;两类图片在标准态与强调态均保留原色。 */
2819
+ colorRole?: output<typeof viewImageColorRoleSchema>;
2820
+ radius?: ViewRadius;
2821
+ overlay?: ViewImageOverlay;
2822
+ fallback?: ViewImageFallback;
2823
+ } | {
2824
+ readonly type: 'icon';
2825
+ readonly id?: string;
2826
+ readonly name: string;
2827
+ /** 图标边长档位;缺省跟随宿主正文尺寸。 */
2828
+ readonly size?: ViewIconSize;
2829
+ /** 图标颜色语义;优先于旧文档的 `tone`。 */
2830
+ readonly color?: ViewIconColor;
2831
+ readonly tone?: ViewTone;
2832
+ } | {
2833
+ readonly type: 'fields';
2834
+ readonly id?: string;
2835
+ items: ViewFieldItem[];
2836
+ } | {
2837
+ readonly type: 'list';
2838
+ readonly id?: string;
2839
+ readonly variant?: ViewListVariant;
2840
+ /** 初始展示条数;其余条目由宿主用「显示全部」就地展开,声明后必须提供 `id`。 */
2841
+ readonly initialCount?: number;
2842
+ items: ViewListItem[];
2843
+ } | {
2844
+ type: 'badge';
2845
+ id?: string;
2846
+ text: string;
2847
+ /** `primary` 跟随明暗模式;`primary-media` 固定使用媒体上的深色模式主色配对,均不读取游戏强调色。 */
2848
+ tone?: ViewTone | 'primary' | 'primary-media';
2849
+ } | {
2850
+ readonly type: 'divider';
2851
+ readonly id?: string;
2852
+ } | {
2853
+ type: 'button';
2854
+ id?: string;
2855
+ text: string;
2856
+ variant?: ViewButtonVariant;
2857
+ /** 意图语气;映射规则见 schema 内 `tone` 字段说明。 */
2858
+ tone?: ViewTone;
2859
+ disabled?: boolean;
2860
+ disabledReason?: string;
2861
+ busy?: boolean;
2862
+ action?: ViewAction;
2863
+ } | {
2864
+ readonly type: 'switch';
2865
+ /** 稳定键;用于关联可见标签与不可用原因。 */
2866
+ readonly id: string;
2867
+ /** 用户可见且可访问的开关名称。 */
2868
+ readonly label: string;
2869
+ /** Runtime 已确认的当前状态。 */
2870
+ readonly checked: boolean;
2871
+ /** 当前不可切换。 */
2872
+ readonly disabled?: boolean;
2873
+ /** 不可切换的可见原因。 */
2874
+ readonly disabledReason?: string;
2875
+ /** 切换请求正在由 Runtime 结算。 */
2876
+ readonly busy?: boolean;
2877
+ /** 用户请求切换时回送的 Command。 */
2878
+ readonly action?: ViewAction;
2879
+ /** 旧宿主不认识 `switch` 时渲染的降级内容。 */
2880
+ readonly fallback?: ViewNode;
2881
+ } | {
2882
+ type: 'expandable';
2883
+ id: string;
2884
+ collapsedLines: number;
2885
+ expandText: string;
2886
+ collapseText: string;
2887
+ children: ViewNode[];
2888
+ } | {
2889
+ type: 'renderer';
2890
+ id: string;
2891
+ /** Manifest 顶层 Renderer View 目录中的稳定 id。 */
2892
+ rendererViewId: string;
2893
+ /** 可选运行期内容;只允许 HTML adapter 使用。 */
2894
+ content?: ViewRendererContent;
2895
+ aspectRatio?: string;
2896
+ height?: number;
2897
+ } | {
2898
+ type: 'frame';
2899
+ id: string;
2900
+ /** Manifest `frames` 目录中的稳定 id;引擎由 Runtime 侧工厂创建并拥有 iframe。 */
2901
+ frameId: string;
2902
+ /** 引擎身份键:同 `(frameId, key)` 命中同一个引擎与同一个 iframe;缺省为共享引擎。 */
2903
+ key?: string;
2904
+ /** 本次引用的用法参数;变化只通知引擎,从不销毁或重建它。 */
2905
+ params?: ViewFrameParams;
2906
+ aspectRatio?: string;
2907
+ height?: number;
2908
+ } | {
2909
+ type: 'meter';
2910
+ id?: string;
2911
+ /** 比例值,值域 [0,1]。 */
2912
+ value: number;
2913
+ /** 可访问名称;缺省时宿主以百分比文本兜底。 */
2914
+ label?: string;
2915
+ tone?: ViewTone;
2916
+ /** 可选分段;各段之和必须等于 `value`,使旧宿主仍可用单段比例降级。 */
2917
+ segments?: ViewMeterSegment[];
2918
+ /** 厚度档位;缺省 `sm` 保持旧视觉。 */
2919
+ size?: ViewMeterSize;
2920
+ /** 是否显示由宿主按实际宽度均匀计算的容量刻度。 */
2921
+ ticks?: boolean;
2922
+ } | {
2923
+ readonly type: 'radialProgress';
2924
+ readonly id?: string;
2925
+ /** 完成比例,值域 [0,1]。 */
2926
+ readonly value: number;
2927
+ /** 环形进度的可访问名称。 */
2928
+ readonly label: string;
2929
+ /** 环内显示文本;缺省时由宿主显示四舍五入后的百分比。 */
2930
+ readonly valueLabel?: string;
2931
+ /** 宿主批准的环内图形;新宿主以它替换可见环内文本,旧宿主仍显示 `valueLabel`。 */
2932
+ readonly centerGraphic?: ViewRadialProgressCenterGraphic;
2933
+ /** 环形进度尺寸档位;缺省为 `sm`。 */
2934
+ readonly size?: ViewRadialProgressSize;
2935
+ /** 进度语气;缺省使用当前应用 accent。 */
2936
+ readonly tone?: ViewTone;
2937
+ /** 旧宿主不认识 `radialProgress` 时渲染的降级内容。 */
2938
+ readonly fallback?: ViewNode;
2939
+ } | {
2940
+ type: 'sparkline';
2941
+ id?: string;
2942
+ /** 原始数值序列,宿主归一化绘制。 */
2943
+ values: number[];
2944
+ /** 可访问名称;缺省时宿主以末值文本兜底。 */
2945
+ label?: string;
2946
+ tone?: ViewTone;
2947
+ } | {
2948
+ readonly type: 'barChart';
2949
+ readonly id?: string;
2950
+ /** 有限分类数据项;宿主按同组最大值归一化柱高。 */
2951
+ readonly items: ViewBarChartItem[];
2952
+ /** 整张图的可访问名称,应包含数据口径。 */
2953
+ readonly label: string;
2954
+ /** 柱宽档位;缺省为 `sm`。 */
2955
+ readonly size?: ViewBarChartSize;
2956
+ /** 柱体语气;缺省使用当前应用 accent。 */
2957
+ readonly tone?: ViewTone;
2958
+ /** 旧宿主不认识 `barChart` 时渲染的降级内容。 */
2959
+ readonly fallback?: ViewNode;
2960
+ } | {
2961
+ readonly type: 'tabs';
2962
+ /** 宿主保存当前分段使用的稳定键。 */
2963
+ readonly id: string;
2964
+ /** 分段列表;每段的 `children` 只在该段被选中时渲染。 */
2965
+ readonly items: ViewTabItem[];
2966
+ /** 旧宿主不认识 `tabs` 时渲染的降级内容。 */
2967
+ readonly fallback?: ViewNode;
2968
+ } | {
2969
+ readonly type: 'textField';
2970
+ /** 稳定键;动作用 `inputFrom` 按该键取值。 */
2971
+ readonly id: string;
2972
+ /** 用户可见且可访问的字段名。 */
2973
+ readonly label: string;
2974
+ /** 输入提示。 */
2975
+ readonly placeholder?: string;
2976
+ /** Runtime 提供的初始值;用户开始编辑后宿主持有草稿,不再被同一份值覆盖。 */
2977
+ readonly value?: string;
2978
+ /** 最大字符数;宿主同时用于截断提交值。 */
2979
+ readonly maxLength?: number;
2980
+ /** 当前不可编辑。 */
2981
+ readonly disabled?: boolean;
2982
+ /** 是否提供清空按钮。 */
2983
+ readonly clearable?: boolean;
2984
+ /** 变化时丢弃宿主草稿并重新取用 `value`;Runtime 用它在提交成功后清空输入。 */
2985
+ readonly resetToken?: string;
2986
+ /** 在字段内按下回车时回送的 Command;取值仍由 `inputFrom` 显式声明。 */
2987
+ readonly submitAction?: ViewAction;
2988
+ /** 旧宿主不认识 `textField` 时渲染的降级内容。 */
2989
+ readonly fallback?: ViewNode;
2990
+ };
2991
+ /** 视图文档中的一个内容节点。 */
2992
+ type ViewNode = ViewKnownNode | ViewUnknownNode;
2993
+ /** Region 重试动作的宿主呈现方式。 */
2994
+ declare const viewRetryPresentationSchema: ZodEnum<{
2995
+ button: "button";
2996
+ inline: "inline";
2997
+ }>;
2998
+ /**
2999
+ * 视图文档中的一个内容区域。
3000
+ *
3001
+ * `loading`、`empty`、`error` 的状态文案与交互统一由宿主提供;`loading` 携带布局蓝图节点,
3002
+ * 宿主保留布局 footprint 并占位渲染叶子内容。`empty` 与 `error` 可选携带不改变状态语义的业务视觉锚点,
3003
+ * 未提供节点时仍使用纯宿主状态。`refreshing` 仅与 `ready` 同时出现,表示保留当前内容的局部刷新。
3004
+ * 一个 Region 失败不得遮挡或替换同卡其他已成功 Region。
3005
+ */
3006
+ declare const viewRegionSchema: ZodObject<{
3007
+ id: ZodString;
3008
+ title: ZodOptional<ZodString>;
3009
+ status: ZodEnum<{
3010
+ error: "error";
3011
+ ready: "ready";
3012
+ loading: "loading";
3013
+ empty: "empty";
3014
+ }>;
3015
+ refreshing: ZodOptional<ZodBoolean>;
3016
+ retry: ZodOptional<ZodObject<{
3017
+ commandId: ZodString;
3018
+ input: ZodOptional<ZodJSONSchema>;
3019
+ inputFrom: ZodOptional<ZodRecord<ZodString, ZodString>>;
3020
+ }, $strip>>;
3021
+ errorText: ZodOptional<ZodString>;
3022
+ retryPresentation: ZodOptional<ZodEnum<{
3023
+ button: "button";
3024
+ inline: "inline";
3025
+ }>>;
3026
+ emptyText: ZodOptional<ZodString>;
3027
+ notice: ZodOptional<ZodObject<{
3028
+ id: ZodString;
3029
+ text: ZodString;
3030
+ tone: ZodOptional<ZodEnum<{
3031
+ success: "success";
3032
+ default: "default";
3033
+ accent: "accent";
3034
+ muted: "muted";
3035
+ warning: "warning";
3036
+ danger: "danger";
3037
+ }>>;
3038
+ dismissible: ZodOptional<ZodBoolean>;
3039
+ }, $strip>>;
3040
+ nodes: ZodDefault<ZodArray<ZodType<ViewNode, unknown, $ZodTypeInternals<ViewNode, unknown>>>>;
3041
+ }, $strip>;
3042
+ /** Runtime 产出的视图文档根。 */
3043
+ declare const viewDocumentSchema: ZodObject<{
3044
+ schema: ZodNumber;
3045
+ transition: ZodOptional<ZodObject<{
3046
+ effect: ZodEnum<{
3047
+ crossfade: "crossfade";
3048
+ morph: "morph";
3049
+ }>;
3050
+ }, $strip>>;
3051
+ regions: ZodArray<ZodObject<{
3052
+ id: ZodString;
3053
+ title: ZodOptional<ZodString>;
3054
+ status: ZodEnum<{
3055
+ error: "error";
3056
+ ready: "ready";
3057
+ loading: "loading";
3058
+ empty: "empty";
3059
+ }>;
3060
+ refreshing: ZodOptional<ZodBoolean>;
3061
+ retry: ZodOptional<ZodObject<{
3062
+ commandId: ZodString;
3063
+ input: ZodOptional<ZodJSONSchema>;
3064
+ inputFrom: ZodOptional<ZodRecord<ZodString, ZodString>>;
3065
+ }, $strip>>;
3066
+ errorText: ZodOptional<ZodString>;
3067
+ retryPresentation: ZodOptional<ZodEnum<{
3068
+ button: "button";
3069
+ inline: "inline";
3070
+ }>>;
3071
+ emptyText: ZodOptional<ZodString>;
3072
+ notice: ZodOptional<ZodObject<{
3073
+ id: ZodString;
3074
+ text: ZodString;
3075
+ tone: ZodOptional<ZodEnum<{
3076
+ success: "success";
3077
+ default: "default";
3078
+ accent: "accent";
3079
+ muted: "muted";
3080
+ warning: "warning";
3081
+ danger: "danger";
3082
+ }>>;
3083
+ dismissible: ZodOptional<ZodBoolean>;
3084
+ }, $strip>>;
3085
+ nodes: ZodDefault<ZodArray<ZodType<ViewNode, unknown, $ZodTypeInternals<ViewNode, unknown>>>>;
3086
+ }, $strip>>;
3087
+ }, $strip>;
3088
+ /** 间距档位;`micro` 是高密度文字栈使用的 2px 光学间距,其余档位映射语义空间 token。 */
3089
+ type ViewGap = output<typeof viewGapSchema>;
3090
+ /** 内边距档位。 */
3091
+ type ViewPadding = output<typeof viewPaddingSchema>;
3092
+ /** 交叉轴对齐方式。 */
3093
+ type ViewAlign = output<typeof viewAlignSchema>;
3094
+ /** 主轴分布方式。 */
3095
+ type ViewDistribute = output<typeof viewDistributeSchema>;
3096
+ /** 表面配方。 */
3097
+ type ViewSurface = output<typeof viewSurfaceSchema>;
3098
+ /** 容器出血档位。 */
3099
+ type ViewBleed = output<typeof viewBleedSchema>;
3100
+ /** 圆角档位。 */
3101
+ type ViewRadius = output<typeof viewRadiusSchema>;
3102
+ /** 层次档位。 */
3103
+ type ViewElevation = output<typeof viewElevationSchema>;
3104
+ /** 横向尺寸档位。 */
3105
+ type ViewWidth = output<typeof viewWidthSchema>;
3106
+ /** 容器固定正方形尺寸档位。 */
3107
+ type ViewBoxSize = output<typeof viewBoxSizeSchema>;
3108
+ /** 容器纵向固定尺寸档位。 */
3109
+ type ViewHeight = output<typeof viewHeightSchema>;
3110
+ /** 网格列数。 */
3111
+ type ViewGridColumns = output<typeof viewGridColumnsSchema>;
3112
+ /** 文本语义层级。 */
3113
+ type ViewTextVariant = output<typeof viewTextVariantSchema>;
3114
+ /** 文本字重。 */
3115
+ type ViewTextWeight = output<typeof viewTextWeightSchema>;
3116
+ /** 宿主批准的文本完整 Paint。 */
3117
+ type ViewTextPaint = output<typeof viewTextPaintSchema>;
3118
+ /** 文本专用语气。 */
3119
+ type ViewTextTone = output<typeof viewTextToneSchema>;
3120
+ /** 行内富文本片段。 */
3121
+ type ViewTextSpan = output<typeof viewTextSpanSchema>;
3122
+ /** 内容语气。 */
3123
+ type ViewTone = output<typeof viewToneSchema>;
3124
+ /** 比例条厚度档位。 */
3125
+ type ViewMeterSize = output<typeof viewMeterSizeSchema>;
3126
+ /** 比例条语义数据段。 */
3127
+ type ViewMeterSegment = output<typeof viewMeterSegmentSchema>;
3128
+ /** 环形进度尺寸档位。 */
3129
+ type ViewRadialProgressSize = output<typeof viewRadialProgressSizeSchema>;
3130
+ /** 环形进度中心的宿主批准图形。 */
3131
+ type ViewRadialProgressCenterGraphic = output<typeof viewRadialProgressCenterGraphicSchema>;
3132
+ /** 分类柱图柱宽档位。 */
3133
+ type ViewBarChartSize = output<typeof viewBarChartSizeSchema>;
3134
+ /** 分类柱图中的一个数据项。 */
3135
+ type ViewBarChartItem = output<typeof viewBarChartItemSchema>;
3136
+ /** 按钮视觉层级。 */
3137
+ type ViewButtonVariant = output<typeof viewButtonVariantSchema>;
3138
+ /** 图片填充方式。 */
3139
+ type ViewImageFit = output<typeof viewImageFitSchema>;
3140
+ /** 图片呈现强度。 */
3141
+ type ViewImageAppearance = output<typeof viewImageAppearanceSchema>;
3142
+ /** 图片尺寸档位。 */
3143
+ type ViewImageSize = output<typeof viewImageSizeSchema>;
3144
+ /** 图标边长档位。 */
3145
+ type ViewIconSize = output<typeof viewIconSizeSchema>;
3146
+ /** 图标颜色语义。 */
3147
+ type ViewIconColor = output<typeof viewIconColorSchema>;
3148
+ /** 图片遮罩。 */
3149
+ type ViewImageOverlay = output<typeof viewImageOverlaySchema>;
3150
+ /** 列表条目排版。 */
3151
+ type ViewListVariant = output<typeof viewListVariantSchema>;
3152
+ /** 轮播页指示器形态。 */
3153
+ type ViewCarouselPagination = output<typeof viewCarouselPaginationSchema>;
3154
+ /** 轮播页指示器相对内容的放置方式。 */
3155
+ type ViewCarouselPaginationPlacement = output<typeof viewCarouselPaginationPlacementSchema>;
3156
+ /** 单个视口同时展示的轮播页数档位。 */
3157
+ type ViewCarouselSlidesPerView = output<typeof viewCarouselSlidesPerViewSchema>;
3158
+ /** 文档更新的过渡配置。 */
3159
+ type ViewTransition = output<typeof viewTransitionSchema>;
3160
+ /** 节点动作。 */
3161
+ type ViewAction = output<typeof viewActionSchema>;
3162
+ /** 图片回退表达。 */
3163
+ type ViewImageFallback = output<typeof viewImageFallbackSchema>;
3164
+ /** 字段组条目。 */
3165
+ type ViewFieldItem = output<typeof viewFieldItemSchema>;
3166
+ /** 列表条目。 */
3167
+ type ViewListItem = output<typeof viewListItemSchema>;
3168
+ /** Region 顶部瞬时说明。 */
3169
+ type ViewRegionNotice = output<typeof viewRegionNoticeSchema>;
3170
+ /** Region 重试动作的宿主呈现方式。 */
3171
+ type ViewRetryPresentation = output<typeof viewRetryPresentationSchema>;
3172
+ /** 视图内容区域。 */
3173
+ type ViewRegion = output<typeof viewRegionSchema>;
3174
+ /** 视图文档根。 */
3175
+ type ViewDocument = output<typeof viewDocumentSchema>;
3176
+
3177
+ /**
3178
+ * @file 为 Extension Runtime 提供构造视图文档的类型安全 builder。
3179
+ *
3180
+ * builder 只是编写期语法糖,产出的始终是可序列化 JSON;跨进程边界传输的是文档本身,不是函数。
3181
+ */
3182
+ /** 容器节点的可选项;与 `ViewBoxModifiers` 同形。 */
3183
+ type BoxOptions = ViewBoxModifiers;
3184
+ /** `hstack` 节点的可选项。 */
3185
+ interface HStackOptions extends BoxOptions {
3186
+ /** 是否允许换行。 */
3187
+ readonly wrap?: boolean;
3188
+ }
3189
+ /** `group` 节点的可选项。 */
3190
+ interface GroupOptions extends BoxOptions {
3191
+ /** 分组小标题。 */
3192
+ readonly title?: string;
3193
+ /** 标题兼作折叠开关;声明后必须提供 `id`。 */
3194
+ readonly collapsible?: boolean;
3195
+ /** 折叠开关初始状态,缺省展开。 */
3196
+ readonly defaultExpanded?: boolean;
3197
+ /** 标题在可滚动容器内吸顶。 */
3198
+ readonly stickyTitle?: boolean;
3199
+ }
3200
+ /** `carousel` 节点的可选项。 */
3201
+ interface CarouselOptions {
3202
+ /** 单个视口同时展示的页数,缺省为 1。 */
3203
+ readonly slidesPerView?: ViewCarouselSlidesPerView;
3204
+ /** 页间距档位,缺省为 `sm`。 */
3205
+ readonly gap?: ViewGap;
3206
+ /** 是否首尾循环。 */
3207
+ readonly loop?: boolean;
3208
+ /** 是否让当前页居中。 */
3209
+ readonly centered?: boolean;
3210
+ /** 是否显示上一页/下一页按钮,缺省显示。 */
3211
+ readonly navigation?: boolean;
3212
+ /** 页指示器形态,缺省为 `bullets`。 */
3213
+ readonly pagination?: ViewCarouselPagination;
3214
+ /** 页指示器位于内容内部或外部,缺省为 `outside`。 */
3215
+ readonly paginationPlacement?: ViewCarouselPaginationPlacement;
3216
+ /** 自动播放间隔(毫秒);缺省不自动播放。 */
3217
+ readonly autoplayDelay?: number;
3218
+ /** 旧宿主不认识 `carousel` 时渲染的降级内容。 */
3219
+ readonly fallback?: ViewNode;
3220
+ }
3221
+ /** `text` 节点的可选项。 */
3222
+ interface TextOptions {
3223
+ /** 稳定键。 */
3224
+ readonly id?: string;
3225
+ /**
3226
+ * 行内富文本片段。
3227
+ *
3228
+ * 调用方仍必须给出与片段拼接一致的 `value`:它是不认识 `spans` 的宿主的降级渲染源。
3229
+ */
3230
+ readonly spans?: readonly ViewTextSpan[];
3231
+ /** 语义层级。 */
3232
+ readonly variant?: ViewTextVariant;
3233
+ /** 字重覆写。 */
3234
+ readonly weight?: ViewTextWeight;
3235
+ /** 语气。 */
3236
+ readonly tone?: ViewTextTone;
3237
+ /** 宿主批准的完整文本 Paint;应同时声明 `tone` 供旧宿主降级。 */
3238
+ readonly paint?: ViewTextPaint;
3239
+ /** 截断行数。 */
3240
+ readonly maxLines?: number;
3241
+ /** 按 maxLines 预留完整行高,使短标题与多行标题对齐。 */
3242
+ readonly reserveLines?: boolean;
3243
+ }
3244
+ /** `image` 节点的可选项。 */
3245
+ interface ImageOptions {
3246
+ /** 稳定键。 */
3247
+ readonly id?: string;
3248
+ /** 宽高比,例如 `16/9`。 */
3249
+ readonly aspectRatio?: string;
3250
+ /** 固定尺寸档位;入口图标与列表缩略图这类不该被容器撑开的图必须声明,整数横图槽使用 landscape 档位。 */
3251
+ readonly size?: ViewImageSize;
3252
+ /** 填充方式。 */
3253
+ readonly fit?: ViewImageFit;
3254
+ /** 呈现强度;`deemphasized` 由宿主统一弱化,不改变图片本身。 */
3255
+ readonly appearance?: ViewImageAppearance;
3256
+ /** 圆角档位。 */
3257
+ readonly radius?: ViewRadius;
3258
+ /** 遮罩;在图片之上叠加文字时保证对比度。 */
3259
+ readonly overlay?: ViewImageOverlay;
3260
+ /** 缺失或加载失败时的回退表达。 */
3261
+ readonly fallback?: ViewImageFallback;
3262
+ }
3263
+ /** `button` 节点的可选项。 */
3264
+ interface ButtonOptions {
3265
+ /** 稳定键。 */
3266
+ readonly id?: string;
3267
+ /** 视觉层级。 */
3268
+ readonly variant?: ViewButtonVariant;
3269
+ /** 意图语气;`primary` 映射为对应 intent 实底,`secondary`/`ghost` 只着色文字。 */
3270
+ readonly tone?: ViewTone;
3271
+ /** 当前不可用。 */
3272
+ readonly disabled?: boolean;
3273
+ /** 不可用的可见原因;`disabled` 为真时应当提供。 */
3274
+ readonly disabledReason?: string;
3275
+ /** 已接受且处理中;与 `disabled` 语义不同,不可互相替代。 */
3276
+ readonly busy?: boolean;
3277
+ /** 点击后回送的 Command。 */
3278
+ readonly action?: ViewAction;
3279
+ }
3280
+ /** `switch` 节点的可选项。 */
3281
+ interface ToggleOptions {
3282
+ /** 当前不可切换。 */
3283
+ readonly disabled?: boolean;
3284
+ /** 不可切换的可见原因;`disabled` 为真时应当提供。 */
3285
+ readonly disabledReason?: string;
3286
+ /** 切换请求正在由 Runtime 结算。 */
3287
+ readonly busy?: boolean;
3288
+ /** 用户请求切换时回送的 Command;input 应携带目标状态以便 Runtime 幂等结算。 */
3289
+ readonly action?: ViewAction;
3290
+ /** 旧宿主不认识 `switch` 时渲染的降级内容。 */
3291
+ readonly fallback?: ViewNode;
3292
+ }
3293
+ /** `list` 节点的可选项。 */
3294
+ interface ListOptions {
3295
+ /** 稳定键。 */
3296
+ readonly id?: string;
3297
+ /** 条目排版。 */
3298
+ readonly variant?: ViewListVariant;
3299
+ /** 初始展示条数;其余条目由宿主就地展开,声明后必须提供 `id`。 */
3300
+ readonly initialCount?: number;
3301
+ }
3302
+ /** `tabs` 节点的可选项。 */
3303
+ interface TabsOptions {
3304
+ /** 旧宿主不认识 `tabs` 时渲染的降级内容。 */
3305
+ readonly fallback?: ViewNode;
3306
+ }
3307
+ /** `textField` 节点的可选项。 */
3308
+ interface TextFieldOptions {
3309
+ /** 输入提示。 */
3310
+ readonly placeholder?: string;
3311
+ /** Runtime 提供的初始值。 */
3312
+ readonly value?: string;
3313
+ /** 最大字符数。 */
3314
+ readonly maxLength?: number;
3315
+ /** 当前不可编辑。 */
3316
+ readonly disabled?: boolean;
3317
+ /** 是否提供清空按钮。 */
3318
+ readonly clearable?: boolean;
3319
+ /** 变化时丢弃宿主草稿并重新取用 `value`。 */
3320
+ readonly resetToken?: string;
3321
+ /** 在字段内按下回车时回送的 Command。 */
3322
+ readonly submitAction?: ViewAction;
3323
+ /** 旧宿主不认识 `textField` 时渲染的降级内容。 */
3324
+ readonly fallback?: ViewNode;
3325
+ }
3326
+ /** `meter` 节点的可选项。 */
3327
+ interface MeterOptions {
3328
+ /** 稳定键。 */
3329
+ readonly id?: string;
3330
+ /** 可访问名称;缺省时宿主使用百分比文本。 */
3331
+ readonly label?: string;
3332
+ /** 单段比例条语气;分段存在时由各段自己的语气覆盖。 */
3333
+ readonly tone?: ViewTone;
3334
+ /** 可选数据段;总和必须等于 `value`,以保持旧宿主降级语义。 */
3335
+ readonly segments?: readonly ViewMeterSegment[];
3336
+ /** 厚度档位;缺省 `sm` 保持既有细条。 */
3337
+ readonly size?: ViewMeterSize;
3338
+ /** 是否按实际宽度显示约 24px 一档、首尾均匀分布的刻度。 */
3339
+ readonly ticks?: boolean;
3340
+ }
3341
+ /** `radialProgress` 节点的可选项。 */
3342
+ interface RadialProgressOptions {
3343
+ /** 稳定键。 */
3344
+ readonly id?: string;
3345
+ /** 环内显示文本;缺省时由宿主显示四舍五入后的百分比。 */
3346
+ readonly valueLabel?: string;
3347
+ /** 宿主批准的环内图形;旧宿主仍显示 `valueLabel`。 */
3348
+ readonly centerGraphic?: ViewRadialProgressCenterGraphic;
3349
+ /** 环形进度尺寸档位;缺省使用宿主紧凑档。 */
3350
+ readonly size?: ViewRadialProgressSize;
3351
+ /** 进度语气;缺省使用当前应用 accent。 */
3352
+ readonly tone?: ViewTone;
3353
+ /** 旧宿主不认识 `radialProgress` 时渲染的降级内容。 */
3354
+ readonly fallback?: ViewNode;
3355
+ }
3356
+ /** `barChart` 节点的可选项。 */
3357
+ interface BarChartOptions {
3358
+ /** 稳定键。 */
3359
+ readonly id?: string;
3360
+ /** 柱宽档位;缺省使用宿主紧凑档。 */
3361
+ readonly size?: ViewBarChartSize;
3362
+ /** 柱体语气;缺省使用当前应用 accent。 */
3363
+ readonly tone?: ViewTone;
3364
+ /** 旧宿主不认识 `barChart` 时渲染的降级内容。 */
3365
+ readonly fallback?: ViewNode;
3366
+ }
3367
+ /** `frame` 节点的可选项。 */
3368
+ interface FrameOptions {
3369
+ /** 引擎身份键;同 `(frameId, key)` 命中同一个引擎与同一个 iframe,缺省为共享引擎。 */
3370
+ readonly key?: string;
3371
+ /** 本次引用的用法参数;变化只通知引擎,从不销毁或重建它。 */
3372
+ readonly params?: ViewFrameParams;
3373
+ /** 宽高比,例如 `16/9`。 */
3374
+ readonly aspectRatio?: string;
3375
+ /** 固定高度,单位为 CSS 像素。 */
3376
+ readonly height?: number;
3377
+ }
3378
+ /** `renderer` 节点的可选项。 */
3379
+ interface RendererOptions {
3380
+ /** 由 Host 按当前 Extension 身份解析的运行期内容引用。 */
3381
+ readonly content?: ViewRendererContent;
3382
+ /** 宽高比,例如 `16/9`。 */
3383
+ readonly aspectRatio?: string;
3384
+ /** 固定高度,单位为 CSS 像素。 */
3385
+ readonly height?: number;
3386
+ }
3387
+ /** Region 的可选项。 */
3388
+ interface RegionOptions {
3389
+ /** 区域标题。 */
3390
+ readonly title?: string;
3391
+ /** 已有内容正在原位刷新;仅用于 `ready` Region。 */
3392
+ readonly refreshing?: boolean;
3393
+ /** 失败时的重试动作。 */
3394
+ readonly retry?: ViewAction;
3395
+ /** 覆盖宿主默认错误文案;仅用于 `error` Region。 */
3396
+ readonly errorText?: string;
3397
+ /** 重试动作的宿主呈现方式;`inline` 使用 Accent 文字动作。 */
3398
+ readonly retryPresentation?: ViewRetryPresentation;
3399
+ /** 覆盖宿主默认空态文案。 */
3400
+ readonly emptyText?: string;
3401
+ /** 顶部瞬时说明;不参与节点预算,也不引起内容重排。 */
3402
+ readonly notice?: ViewRegionNotice;
3403
+ }
3404
+ /** ViewDocument 根的可选配置。 */
3405
+ interface ViewDocumentOptions {
3406
+ /** 新文档替换旧文档时由包内 renderer 执行的受控过渡。 */
3407
+ readonly transition?: ViewTransition;
3408
+ }
3409
+ /**
3410
+ * 纵向排列子节点。
3411
+ *
3412
+ * @param children - 子节点。
3413
+ * @param options - 间距、留白、对齐与表面配方。
3414
+ */
3415
+ declare function vstack(children: readonly ViewNode[], options?: BoxOptions): ViewNode;
3416
+ /**
3417
+ * 横向排列子节点。
3418
+ *
3419
+ * @param children - 子节点。
3420
+ * @param options - 间距、留白、对齐、分布、换行与表面配方。
3421
+ */
3422
+ declare function hstack(children: readonly ViewNode[], options?: HStackOptions): ViewNode;
3423
+ /**
3424
+ * 层叠排列子节点;首个子节点决定尺寸,其余子节点铺满其上。
3425
+ *
3426
+ * `padding` 只作用于覆盖层,底层子节点保持出血,因此封面加标题不需要额外的负边距技巧。
3427
+ *
3428
+ * @param children - 子节点,第一个为底层。
3429
+ * @param options - 覆盖层对齐、留白与表面配方。
3430
+ */
3431
+ declare function zstack(children: readonly ViewNode[], options?: BoxOptions): ViewNode;
3432
+ /**
3433
+ * 等宽多列网格。
3434
+ *
3435
+ * @param columns - 列数档位。
3436
+ * @param children - 子节点。
3437
+ * @param options - 间距、留白与表面配方。
3438
+ */
3439
+ declare function grid(columns: ViewGridColumns, children: readonly ViewNode[], options?: BoxOptions): ViewNode;
3440
+ /**
3441
+ * 可触摸、鼠标拖拽及键盘翻页的轮播容器;每个直接子节点是一页。
3442
+ *
3443
+ * @param id - 宿主保存当前页与生成可访问控件 id 使用的稳定键。
3444
+ * @param label - 轮播区域的可访问名称。
3445
+ * @param children - 轮播页。
3446
+ * @param options - 页数、间距、循环、导航、指示器与自动播放参数。
3447
+ */
3448
+ declare function carousel(id: string, label: string, children: readonly ViewNode[], options?: CarouselOptions): ViewNode;
3449
+ /**
3450
+ * 带可选小标题的语义分组;渲染为带标题的 section,纵向排列。
3451
+ *
3452
+ * @param children - 子节点。
3453
+ * @param options - 标题与容器修饰。
3454
+ */
3455
+ declare function group(children: readonly ViewNode[], options?: GroupOptions): ViewNode;
3456
+ /**
3457
+ * 吃掉父容器主轴剩余空间的弹性空隙;用于把同一行的内容推向两端。
3458
+ *
3459
+ * @param options - 稳定键。
3460
+ */
3461
+ declare function spacer(options?: {
3462
+ readonly id?: string;
3463
+ }): ViewNode;
3464
+ /**
3465
+ * 文本节点。
3466
+ *
3467
+ * @param value - 文本内容;给出 `spans` 时它同时是不认识富文本的宿主的降级渲染源,两者必须一致。
3468
+ * @param options - 层级、字重、语气、截断与行内富文本片段。
3469
+ */
3470
+ declare function text(value: string, options?: TextOptions): ViewNode;
3471
+ /**
3472
+ * 图片节点。
3473
+ *
3474
+ * @param src - 图片地址。
3475
+ * @param options - 宽高比、尺寸档位、填充方式、呈现强度、圆角、遮罩与回退。
3476
+ */
3477
+ declare function image(src: string, options?: ImageOptions): ViewNode;
3478
+ /**
3479
+ * 图标节点。
3480
+ *
3481
+ * @param name - 图标名。
3482
+ * @param options - 语气与稳定键。
3483
+ */
3484
+ declare function icon(name: string, options?: {
3485
+ readonly id?: string;
3486
+ readonly size?: ViewIconSize;
3487
+ readonly color?: ViewIconColor;
3488
+ readonly tone?: ViewTone;
3489
+ }): ViewNode;
3490
+ /**
3491
+ * 标签值字段组;`value` 缺省时渲染 `placeholder`,不虚构字段。
3492
+ *
3493
+ * @param items - 字段条目。
3494
+ * @param options - 稳定键。
3495
+ */
3496
+ declare function fields(items: readonly ViewFieldItem[], options?: {
3497
+ readonly id?: string;
3498
+ }): ViewNode;
3499
+ /**
3500
+ * 列表节点;条目 `action` 缺省即不可点击。
3501
+ *
3502
+ * 列表是同构条目的紧凑表达:一个节点承载全部条目,因此长列表不会吃掉节点预算。需要逐条自定义排版时
3503
+ * 改用容器手写,代价是节点数按条目线性增长。
3504
+ *
3505
+ * @param items - 列表条目。
3506
+ * @param options - 排版与稳定键。
3507
+ */
3508
+ declare function list(items: readonly ViewListItem[], options?: ListOptions): ViewNode;
3509
+ /**
3510
+ * 状态标记。
3511
+ *
3512
+ * @param value - 标记文本。
3513
+ * @param options - 语气与稳定键。
3514
+ */
3515
+ declare function badge(value: string, options?: {
3516
+ readonly id?: string;
3517
+ /** `primary` 使用主色标签;`primary-media` 固定白底黑字,均不随游戏强调色变化。 */
3518
+ readonly tone?: ViewTone | 'primary' | 'primary-media';
3519
+ }): ViewNode;
3520
+ /**
3521
+ * 分隔线。
3522
+ *
3523
+ * @param options - 稳定键。
3524
+ */
3525
+ declare function divider(options?: {
3526
+ readonly id?: string;
3527
+ }): ViewNode;
3528
+ /**
3529
+ * 按钮节点。
3530
+ *
3531
+ * @param value - 按钮文案。
3532
+ * @param options - 视觉层级、可用性与动作。
3533
+ */
3534
+ declare function button(value: string, options?: ButtonOptions): ViewNode;
3535
+ /**
3536
+ * 分段容器;当前分段由宿主自持,不产生 Command 往返。
3537
+ *
3538
+ * @param id - 宿主保存当前分段使用的稳定键。
3539
+ * @param items - 分段列表。
3540
+ * @param options - 降级内容。
3541
+ */
3542
+ declare function tabs(id: string, items: readonly ViewTabItem[], options?: TabsOptions): ViewNode;
3543
+ /**
3544
+ * 文本输入字段;草稿由宿主持有,只有动作按 `inputFrom` 提交时才回送 Runtime。
3545
+ *
3546
+ * @param id - 稳定键;动作用 `inputFrom` 按该键取值。
3547
+ * @param label - 用户可见且可访问的字段名。
3548
+ * @param options - 初始值、上限与提交动作。
3549
+ */
3550
+ declare function textField(id: string, label: string, options?: TextFieldOptions): ViewNode;
3551
+ /**
3552
+ * 胶囊开关;状态由 Runtime 持有,宿主只回送切换请求并等待新文档确认。
3553
+ *
3554
+ * @param id - 关联标签、原因与更新时身份使用的稳定键。
3555
+ * @param label - 用户可见且可访问的开关名称。
3556
+ * @param checked - Runtime 已确认的当前状态。
3557
+ * @param options - 可用性、结算状态、动作与旧宿主降级内容。
3558
+ */
3559
+ declare function toggle(id: string, label: string, checked: boolean, options?: ToggleOptions): ViewNode;
3560
+ /**
3561
+ * 长文本展开控件;展开状态由宿主自持,不产生 Command 往返。
3562
+ *
3563
+ * @param id - 宿主记忆展开状态使用的稳定键。
3564
+ * @param children - 被截断的子节点。
3565
+ * @param options - 折叠行数与展开/收起文案。
3566
+ */
3567
+ declare function expandable(id: string, children: readonly ViewNode[], options: {
3568
+ readonly collapsedLines: number;
3569
+ readonly expandText: string;
3570
+ readonly collapseText: string;
3571
+ }): ViewNode;
3572
+ /**
3573
+ * Renderer Module 逃生舱节点;尺寸静态声明,宿主渲染前即可预留空间。
3574
+ *
3575
+ * @param id - 稳定键。
3576
+ * @param rendererViewId - Manifest 顶层 Renderer View 目录中的稳定 id。
3577
+ * @param options - 运行期内容引用、宽高比或固定高度。
3578
+ */
3579
+ declare function renderer(id: string, rendererViewId: string, options?: RendererOptions): ViewNode;
3580
+ /**
3581
+ * Frame 引用节点:文档只声明"在这里显示哪个引擎",iframe 与视图端口归 Runtime 侧的 frame 引擎。
3582
+ *
3583
+ * 引用它的节点或实例销毁不会销毁引擎;引擎按 Manifest `frames[].ttlMs` 存活,窗口内再次引用
3584
+ * 同一 `(frameId, key)` 会命中同一个 iframe。尺寸静态声明,宿主渲染前即可预留空间。
3585
+ *
3586
+ * @param id - 稳定键。
3587
+ * @param frameId - Manifest `frames` 目录中的稳定 id。
3588
+ * @param options - 引擎身份键、用法参数、宽高比或固定高度。
3589
+ */
3590
+ declare function frame(id: string, frameId: string, options?: FrameOptions): ViewNode;
3591
+ /**
3592
+ * 横向比例条;可渐进增强为受控厚度、均匀刻度和多数据段。
3593
+ *
3594
+ * @param value - 已用比例,也是旧宿主剥离新增属性后的单段降级值。
3595
+ * @param options - 可访问名称、语气、分段、厚度与刻度。
3596
+ */
3597
+ declare function meter(value: number, options?: MeterOptions): ViewNode;
3598
+ /**
3599
+ * 环形进度;同时保留可访问名称与环内文本,不能只靠圆弧传达结果。
3600
+ *
3601
+ * @param value - 完成比例,值域 [0,1]。
3602
+ * @param label - 包含完整数值口径的可访问名称。
3603
+ * @param options - 环内文本、尺寸、语气与旧宿主降级内容。
3604
+ */
3605
+ declare function radialProgress(value: number, label: string, options?: RadialProgressOptions): ViewNode;
3606
+ /**
3607
+ * 有限分类柱图;Runtime 提交原始非负值,宿主负责归一化和视觉配方。
3608
+ *
3609
+ * @param label - 整张图的可访问名称。
3610
+ * @param items - 分类标签与原始值。
3611
+ * @param options - 柱宽、语气与旧宿主降级内容。
3612
+ */
3613
+ declare function barChart(label: string, items: readonly ViewBarChartItem[], options?: BarChartOptions): ViewNode;
3614
+ /**
3615
+ * 构造一个内容区域。
3616
+ *
3617
+ * @param id - 区域稳定键。
3618
+ * @param status - 区域状态。
3619
+ * @param nodes - `ready` 时的内容、`loading` 时的布局蓝图,或 `empty/error` 的可选视觉锚点。
3620
+ * @param options - 标题、刷新、错误/空态文案与重试呈现。
3621
+ */
3622
+ declare function region(id: string, status: ViewRegion['status'], nodes?: readonly ViewNode[], options?: RegionOptions): ViewRegion;
3623
+ /**
3624
+ * 构造一个携带当前 schema 版本的视图文档。
3625
+ *
3626
+ * @param regions - 文档区域。
3627
+ * @param options - 文档级过渡等渐进增强配置。
3628
+ */
3629
+ declare function viewDocument(regions: readonly ViewRegion[], options?: ViewDocumentOptions): ViewDocument;
3630
+
3631
+ /** 直接复用 PC DSL 的受限 Controller 作者入口。 */
3632
+
3633
+ interface WorkspaceCardAuthorDefinition {
3634
+ title: string;
3635
+ sizes: readonly WorkspaceCardSize[];
3636
+ defaultSize: WorkspaceCardSize;
3637
+ documents?: WorkspaceCardDocuments;
3638
+ loadingDocuments?: WorkspaceCardDocuments;
3639
+ errorDocuments?: WorkspaceCardDocuments;
3640
+ }
3641
+ type WorkspaceCardActionInputSchema = WorkspaceCardInputSchema;
3642
+ interface WorkspaceCardActionHandle<Input extends WorkspaceCardJson = WorkspaceCardJson> {
3643
+ (input: Input): ViewAction;
3644
+ kind: 'invoke' | 'openMiniProgram';
3645
+ input?: WorkspaceCardActionInputSchema;
3646
+ run?: (ctx: WorkspaceCardControllerContext, input: Input) => WorkspaceCardControllerResult | Promise<WorkspaceCardControllerResult>;
3647
+ }
3648
+ interface WorkspaceCardsControllerAuthoring {
3649
+ networkOrigins?: readonly string[];
3650
+ cards: Readonly<Record<string, WorkspaceCardAuthorDefinition>>;
3651
+ actions?: Readonly<Record<string, WorkspaceCardActionHandle>>;
3652
+ refresh?: WorkspaceCardController['refresh'];
3653
+ }
3654
+ declare function defineCard<T extends WorkspaceCardAuthorDefinition>(definition: T): T;
3655
+ declare const actionInput: {
3656
+ readonly string: (options?: {
3657
+ maxLength?: number;
3658
+ }) => WorkspaceCardActionInputSchema;
3659
+ readonly number: () => WorkspaceCardActionInputSchema;
3660
+ readonly boolean: () => WorkspaceCardActionInputSchema;
3661
+ readonly array: (items: WorkspaceCardActionInputSchema, options?: {
3662
+ maxItems?: number;
3663
+ }) => WorkspaceCardActionInputSchema;
3664
+ readonly object: (properties: Readonly<Record<string, WorkspaceCardActionInputSchema>>) => WorkspaceCardActionInputSchema;
3665
+ };
3666
+ declare function defineAction<Input extends WorkspaceCardJson>(definition: {
3667
+ input?: WorkspaceCardActionInputSchema;
3668
+ run(ctx: WorkspaceCardControllerContext, input: Input): WorkspaceCardControllerResult | Promise<WorkspaceCardControllerResult>;
3669
+ }): WorkspaceCardActionHandle<Input>;
3670
+ declare function defineOpenMiniProgramAction<Input extends WorkspaceCardJson = WorkspaceCardJson>(options?: {
3671
+ input?: WorkspaceCardActionInputSchema;
3672
+ }): WorkspaceCardActionHandle<Input>;
3673
+ declare function defineWorkspaceCardsController<T extends WorkspaceCardsControllerAuthoring>(controller: T): T;
3674
+ /** 定义控制器;构建器和 Host 分别验证静态 action 表。 */
3675
+ declare function defineWorkspaceCardController<T extends WorkspaceCardController>(controller: T): T;
3676
+ /** 生成固定受管 invoke 入口;身份由 Host 根据真实卡片绑定。 */
3677
+ declare function invoke(actionId: string, params?: WorkspaceCardJson): ViewAction;
3678
+ /** 只允许打开当前小程序。 */
3679
+ declare function openMiniProgram(actionId: string, params?: WorkspaceCardJson): ViewAction;
3680
+
3681
+ export { actionInput, badge, barChart, button, carousel, defineAction, defineCard, defineOpenMiniProgramAction, defineWorkspaceCardController, defineWorkspaceCardsController, divider, expandable, fields, frame, grid, group, hstack, icon, image, invoke, list, meter, openMiniProgram, radialProgress, region, renderer, spacer, tabs, text, textField, toggle, viewDocument, vstack, zstack };
3682
+ export type { BarChartOptions, BoxOptions, ButtonOptions, CarouselOptions, FrameOptions, GroupOptions, HStackOptions, ImageOptions, ListOptions, MeterOptions, RadialProgressOptions, RegionOptions, RendererOptions, TabsOptions, TextFieldOptions, TextOptions, ToggleOptions, ViewAction, ViewDocument, ViewDocumentOptions, ViewNode, WorkspaceCardActionHandle, WorkspaceCardActionInputSchema, WorkspaceCardAuthorDefinition, WorkspaceCardsControllerAuthoring };