mlform 0.1.9 → 0.1.11

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 (224) hide show
  1. package/README.md +18 -16
  2. package/dist/builtins-D8rXH4ED.js +725 -0
  3. package/dist/{design-system-CIU_vH6O.js → design-6suKVQDo.js} +15 -15
  4. package/dist/mlform/builtins.mjs +2 -0
  5. package/dist/mlform/{design-system.mjs → design.mjs} +2 -2
  6. package/dist/mlform/kit.mjs +1896 -3
  7. package/dist/mlform/primitives.mjs +2 -2
  8. package/dist/mlform/runtime.mjs +3 -4
  9. package/dist/mlform/schema.mjs +2 -102
  10. package/dist/mlform/transport.mjs +2 -2
  11. package/dist/{primitives-Di95y_ur.js → primitives-k9HTnd72.js} +2303 -3384
  12. package/dist/{runtime-C5iTM3uu.js → runtime-CI7vlp9i.js} +655 -791
  13. package/dist/schema-DSAZ6bts.js +88 -0
  14. package/dist/{transport-B6ePTLFK.js → transport-CO6udZ6z.js} +605 -575
  15. package/dist/types/{builtins-ml/definitions/index.d.ts → builtins/definitions/collections.d.ts} +1 -15
  16. package/dist/types/{shared/object.d.ts → builtins/definitions/fields/value-helpers.d.ts} +1 -0
  17. package/dist/types/builtins/definitions/index.d.ts +16 -0
  18. package/dist/types/{builtins-ml → builtins}/definitions/shared.d.ts +2 -9
  19. package/dist/types/builtins/index.d.ts +6 -0
  20. package/dist/types/builtins/mapped-category-behavior.d.ts +2 -0
  21. package/dist/types/builtins/registry-pack.d.ts +10 -0
  22. package/dist/types/{design-system → design}/index.d.ts +1 -1
  23. package/dist/types/{design-system/recipes/index.d.ts → design/recipes/collections.d.ts} +0 -1
  24. package/dist/types/design/recipes/index.d.ts +2 -0
  25. package/dist/types/design/resolve/index.d.ts +4 -0
  26. package/dist/types/{design-system/resolve/index.d.ts → design/resolve/resolve-design.d.ts} +0 -3
  27. package/dist/types/{design-system → design}/runtime/index.d.ts +3 -3
  28. package/dist/types/{design-system/themes/index.d.ts → design/themes/collections.d.ts} +0 -2
  29. package/dist/types/design/themes/index.d.ts +3 -0
  30. package/dist/types/{design-system → design}/types.d.ts +1 -1
  31. package/dist/types/kit/constants.d.ts +2 -10
  32. package/dist/types/kit/defaults.d.ts +1 -1
  33. package/dist/types/kit/disclosure-root-styles.d.ts +1 -0
  34. package/dist/types/kit/error-navigation.d.ts +2 -1
  35. package/dist/types/kit/index.d.ts +4 -5
  36. package/dist/types/{presentation → kit/kinds}/define-field-kind.d.ts +11 -3
  37. package/dist/types/kit/kinds/define-report-kind.d.ts +40 -0
  38. package/dist/types/kit/kinds/index.d.ts +3 -0
  39. package/dist/types/kit/kinds/register-kind.d.ts +5 -0
  40. package/dist/types/kit/layout-helpers.d.ts +7 -11
  41. package/dist/types/kit/layout-node-render.d.ts +4 -4
  42. package/dist/types/kit/layout-node-resolver.d.ts +1 -1
  43. package/dist/types/kit/{accordion-root.d.ts → layout-root.d.ts} +3 -4
  44. package/dist/types/kit/layout-types.d.ts +8 -36
  45. package/dist/types/kit/layout-utils.d.ts +0 -1
  46. package/dist/types/kit/layout.d.ts +2 -2
  47. package/dist/types/kit/mount-types.d.ts +8 -7
  48. package/dist/types/kit/panel-nav.d.ts +1 -1
  49. package/dist/types/kit/tabs-root.d.ts +1 -2
  50. package/dist/types/kit/types.d.ts +2 -3
  51. package/dist/types/kit/view-core-types.d.ts +110 -0
  52. package/dist/types/kit/view-layout-state.d.ts +10 -3
  53. package/dist/types/kit/view-navigation.d.ts +3 -3
  54. package/dist/types/kit/view-snapshot-cache.d.ts +3 -3
  55. package/dist/types/kit/view-snapshot.d.ts +4 -4
  56. package/dist/types/kit/view-types.d.ts +1 -172
  57. package/dist/types/kit/view.d.ts +2 -8
  58. package/dist/types/kit/wizard-root.d.ts +1 -2
  59. package/dist/types/primitives/base-async-report-element.d.ts +1 -1
  60. package/dist/types/primitives/base-field-element.d.ts +3 -3
  61. package/dist/types/primitives/base-report-element.d.ts +3 -3
  62. package/dist/types/primitives/components/descriptor-content.d.ts +4 -0
  63. package/dist/types/primitives/components/error-focus.d.ts +3 -2
  64. package/dist/types/primitives/components/field-frame-feedback.d.ts +3 -3
  65. package/dist/types/primitives/components/field-frame.d.ts +3 -3
  66. package/dist/types/primitives/components/form-errors.d.ts +2 -2
  67. package/dist/types/primitives/components/form-root-presenters.d.ts +6 -11
  68. package/dist/types/primitives/components/form-root-state.d.ts +4 -6
  69. package/dist/types/primitives/components/form-root-templates.d.ts +4 -8
  70. package/dist/types/primitives/components/form-root.d.ts +4 -4
  71. package/dist/types/primitives/components/report-frame.d.ts +4 -4
  72. package/dist/types/primitives/components/submit-button.d.ts +2 -2
  73. package/dist/types/primitives/constants.d.ts +6 -9
  74. package/dist/types/primitives/controller-types.d.ts +96 -0
  75. package/dist/types/primitives/descriptor-resolution.d.ts +6 -0
  76. package/dist/types/primitives/descriptors/content.d.ts +61 -0
  77. package/dist/types/primitives/descriptors/field.d.ts +32 -0
  78. package/dist/types/primitives/descriptors/index.d.ts +5 -0
  79. package/dist/types/primitives/descriptors/registry.d.ts +11 -0
  80. package/dist/types/primitives/descriptors/report.d.ts +20 -0
  81. package/dist/types/primitives/index.d.ts +8 -3
  82. package/dist/types/primitives/mount-form.d.ts +2 -2
  83. package/dist/types/primitives/request-runner.d.ts +13 -0
  84. package/dist/types/primitives/types.d.ts +16 -53
  85. package/dist/types/runtime/errors.d.ts +1 -2
  86. package/dist/types/runtime/index.d.ts +2 -4
  87. package/dist/types/runtime/reports/controller.d.ts +3 -2
  88. package/dist/types/runtime/runtime-controller.d.ts +1 -5
  89. package/dist/types/runtime/state/engine.d.ts +1 -2
  90. package/dist/types/runtime/submission/create-submitter.d.ts +1 -1
  91. package/dist/types/runtime/submission/index.d.ts +1 -1
  92. package/dist/types/runtime/submission/lifecycle.d.ts +1 -2
  93. package/dist/types/runtime/submission/pipeline.d.ts +1 -1
  94. package/dist/types/runtime/submission/report-fetches.d.ts +2 -0
  95. package/dist/types/runtime/submission/types.d.ts +1 -2
  96. package/dist/types/runtime/types/form.d.ts +9 -13
  97. package/dist/types/runtime/types/index.d.ts +0 -1
  98. package/dist/types/runtime/types/pipeline.d.ts +10 -10
  99. package/dist/types/runtime/types/registry.d.ts +2 -3
  100. package/dist/types/runtime/types/report.d.ts +4 -1
  101. package/dist/types/runtime/types/transport.d.ts +3 -4
  102. package/dist/types/runtime/utils.d.ts +1 -3
  103. package/dist/types/runtime/validation/form.d.ts +1 -1
  104. package/dist/types/schema/ids.d.ts +1 -0
  105. package/dist/types/schema/index.d.ts +3 -1
  106. package/dist/types/schema/registry.d.ts +2 -4
  107. package/dist/types/schema/report-fetch-request.d.ts +6 -0
  108. package/dist/types/schema/types/form.d.ts +0 -3
  109. package/dist/types/schema/types/registry.d.ts +0 -5
  110. package/dist/types/schema/types/report.d.ts +25 -3
  111. package/dist/types/schema/types/submit.d.ts +11 -0
  112. package/dist/types/transport/errors.d.ts +1 -2
  113. package/dist/types/transport/index.d.ts +2 -0
  114. package/dist/types/transport/request-runner.d.ts +16 -0
  115. package/package.json +14 -27
  116. package/dist/builtins-ml-pjab8_gu.js +0 -3878
  117. package/dist/errors-CTNw8fwS.js +0 -8
  118. package/dist/kit-QY6zff-h.js +0 -1888
  119. package/dist/mlform/behaviors.mjs +0 -32
  120. package/dist/mlform/builtins-ml.mjs +0 -2
  121. package/dist/mlform/presentation.mjs +0 -2
  122. package/dist/mlform.mjs +0 -8
  123. package/dist/presentation-BrlVO4oV.js +0 -200
  124. package/dist/strings-CWwrrYzz.js +0 -4
  125. package/dist/types/behaviors/index.d.ts +0 -3
  126. package/dist/types/builtins-ml/index.d.ts +0 -5
  127. package/dist/types/index.d.ts +0 -13
  128. package/dist/types/kit/accordion-root-styles.d.ts +0 -1
  129. package/dist/types/kit/accordion.d.ts +0 -2
  130. package/dist/types/kit/tabs.d.ts +0 -2
  131. package/dist/types/kit/wizard.d.ts +0 -2
  132. package/dist/types/packs/default.d.ts +0 -2
  133. package/dist/types/packs/index.d.ts +0 -3
  134. package/dist/types/packs/ml.d.ts +0 -2
  135. package/dist/types/packs/shared.d.ts +0 -24
  136. package/dist/types/presentation/define-explanation-kind.d.ts +0 -11
  137. package/dist/types/presentation/define-report-kind.d.ts +0 -15
  138. package/dist/types/presentation/index.d.ts +0 -10
  139. package/dist/types/presentation/register-kind.d.ts +0 -6
  140. package/dist/types/presentation/registry.d.ts +0 -15
  141. package/dist/types/presentation/types/explanation.d.ts +0 -32
  142. package/dist/types/presentation/types/field.d.ts +0 -36
  143. package/dist/types/presentation/types/presentation.d.ts +0 -61
  144. package/dist/types/presentation/types/report.d.ts +0 -41
  145. package/dist/types/primitives/base-explanation-element.d.ts +0 -22
  146. package/dist/types/primitives/components/declarative-explanation.d.ts +0 -5
  147. package/dist/types/primitives/components/explanation-panel.d.ts +0 -24
  148. package/dist/types/primitives/components/presentation.d.ts +0 -4
  149. package/dist/types/primitives/presentation.d.ts +0 -8
  150. package/dist/types/runtime/explanations/controller.d.ts +0 -13
  151. package/dist/types/runtime/explanations/index.d.ts +0 -1
  152. package/dist/types/runtime/schema/index.d.ts +0 -7
  153. package/dist/types/runtime/submission/explanations.d.ts +0 -2
  154. package/dist/types/runtime/types/explanation.d.ts +0 -15
  155. package/dist/types/schema/types/explanation.d.ts +0 -43
  156. package/dist/types/shared/errors.d.ts +0 -3
  157. package/dist/types/shared/index.d.ts +0 -3
  158. package/dist/types/shared/strings.d.ts +0 -1
  159. package/dist/utils-J5o8lkea.js +0 -29
  160. /package/dist/types/{runtime → builtins}/constants.d.ts +0 -0
  161. /package/dist/types/{builtins-ml → builtins}/definitions/fields/boolean.d.ts +0 -0
  162. /package/dist/types/{builtins-ml → builtins}/definitions/fields/category.d.ts +0 -0
  163. /package/dist/types/{builtins-ml → builtins}/definitions/fields/date.d.ts +0 -0
  164. /package/dist/types/{builtins-ml → builtins}/definitions/fields/long-text.d.ts +0 -0
  165. /package/dist/types/{builtins-ml → builtins}/definitions/fields/mapped-category.d.ts +0 -0
  166. /package/dist/types/{builtins-ml → builtins}/definitions/fields/multi-choice.d.ts +0 -0
  167. /package/dist/types/{builtins-ml → builtins}/definitions/fields/number.d.ts +0 -0
  168. /package/dist/types/{builtins-ml → builtins}/definitions/fields/rating.d.ts +0 -0
  169. /package/dist/types/{builtins-ml → builtins}/definitions/fields/series-helpers.d.ts +0 -0
  170. /package/dist/types/{builtins-ml → builtins}/definitions/fields/series.d.ts +0 -0
  171. /package/dist/types/{builtins-ml → builtins}/definitions/fields/single-choice.d.ts +0 -0
  172. /package/dist/types/{builtins-ml → builtins}/definitions/fields/text.d.ts +0 -0
  173. /package/dist/types/{builtins-ml → builtins}/definitions/reports/classifier.d.ts +0 -0
  174. /package/dist/types/{builtins-ml → builtins}/definitions/reports/regressor.d.ts +0 -0
  175. /package/dist/types/{design-system → design}/constants.d.ts +0 -0
  176. /package/dist/types/{design-system → design}/contract/component-keys.d.ts +0 -0
  177. /package/dist/types/{design-system → design}/contract/component-tokens.d.ts +0 -0
  178. /package/dist/types/{design-system → design}/contract/global-tokens.d.ts +0 -0
  179. /package/dist/types/{design-system → design}/contract/index.d.ts +0 -0
  180. /package/dist/types/{design-system → design}/contract/token-keys.d.ts +0 -0
  181. /package/dist/types/{design-system → design}/recipes/contrast.d.ts +0 -0
  182. /package/dist/types/{design-system → design}/recipes/default.d.ts +0 -0
  183. /package/dist/types/{design-system → design}/recipes/minimal.d.ts +0 -0
  184. /package/dist/types/{design-system → design}/recipes/soft.d.ts +0 -0
  185. /package/dist/types/{design-system → design}/registry/builtins.d.ts +0 -0
  186. /package/dist/types/{design-system → design}/registry/create-registry.d.ts +0 -0
  187. /package/dist/types/{design-system → design}/registry/deep-freeze.d.ts +0 -0
  188. /package/dist/types/{design-system → design}/registry/define-recipe.d.ts +0 -0
  189. /package/dist/types/{design-system → design}/registry/define-theme.d.ts +0 -0
  190. /package/dist/types/{design-system → design}/registry/define-token-maps.d.ts +0 -0
  191. /package/dist/types/{design-system → design}/registry/index.d.ts +0 -0
  192. /package/dist/types/{design-system → design}/resolve/diagnostics.d.ts +0 -0
  193. /package/dist/types/{design-system → design}/resolve/merge-config.d.ts +0 -0
  194. /package/dist/types/{design-system → design}/resolve/migrate-tokens.d.ts +0 -0
  195. /package/dist/types/{design-system → design}/resolve/resolve-mode.d.ts +0 -0
  196. /package/dist/types/{design-system → design}/resolve/resolve-recipe.d.ts +0 -0
  197. /package/dist/types/{design-system → design}/resolve/resolve-theme.d.ts +0 -0
  198. /package/dist/types/{design-system → design}/resolve/resolve-tokens.d.ts +0 -0
  199. /package/dist/types/{design-system → design}/runtime/apply-tokens.d.ts +0 -0
  200. /package/dist/types/{design-system/runtime/attach-design-system.d.ts → design/runtime/attach-design.d.ts} +0 -0
  201. /package/dist/types/{design-system → design}/runtime/controller-helpers.d.ts +0 -0
  202. /package/dist/types/{design-system → design}/runtime/create-stylesheet.d.ts +0 -0
  203. /package/dist/types/{design-system → design}/runtime/declarations.d.ts +0 -0
  204. /package/dist/types/{design-system/runtime/design-system-controller.d.ts → design/runtime/design-controller.d.ts} +0 -0
  205. /package/dist/types/{design-system → design}/runtime/fingerprint.d.ts +0 -0
  206. /package/dist/types/{design-system → design}/runtime/host-observer.d.ts +0 -0
  207. /package/dist/types/{design-system → design}/runtime/host-state.d.ts +0 -0
  208. /package/dist/types/{design-system/runtime/hydrate-design-system.d.ts → design/runtime/hydrate-design.d.ts} +0 -0
  209. /package/dist/types/{design-system → design}/runtime/hydration-state.d.ts +0 -0
  210. /package/dist/types/{design-system → design}/runtime/inherited-scheme.d.ts +0 -0
  211. /package/dist/types/{design-system → design}/runtime/media.d.ts +0 -0
  212. /package/dist/types/{design-system → design}/themes/airbnb.d.ts +0 -0
  213. /package/dist/types/{design-system → design}/themes/clickhouse.d.ts +0 -0
  214. /package/dist/types/{design-system → design}/themes/cobalt.d.ts +0 -0
  215. /package/dist/types/{design-system → design}/themes/graphite.d.ts +0 -0
  216. /package/dist/types/{design-system → design}/themes/neutral.d.ts +0 -0
  217. /package/dist/types/{design-system → design}/themes/sage.d.ts +0 -0
  218. /package/dist/types/{design-system → design}/themes/sunset.d.ts +0 -0
  219. /package/dist/types/{design-system → design}/tokens/base.d.ts +0 -0
  220. /package/dist/types/{design-system → design}/tokens/contrast.d.ts +0 -0
  221. /package/dist/types/{design-system → design}/tokens/density.d.ts +0 -0
  222. /package/dist/types/{design-system → design}/tokens/forced-colors.d.ts +0 -0
  223. /package/dist/types/{design-system → design}/tokens/index.d.ts +0 -0
  224. /package/dist/types/{design-system → design}/tokens/motion.d.ts +0 -0
@@ -1,3878 +0,0 @@
1
- import { o as e, s as t } from "./utils-J5o8lkea.js";
2
- import { createRegistry as n } from "./mlform/schema.mjs";
3
- import { createMappedCategoryBehavior as r } from "./mlform/behaviors.mjs";
4
- import { n as i } from "./presentation-BrlVO4oV.js";
5
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
6
- var a;
7
- function o(e, t, n) {
8
- function r(n, r) {
9
- if (n._zod || Object.defineProperty(n, "_zod", {
10
- value: {
11
- def: r,
12
- constr: o,
13
- traits: /* @__PURE__ */ new Set()
14
- },
15
- enumerable: !1
16
- }), n._zod.traits.has(e)) return;
17
- n._zod.traits.add(e), t(n, r);
18
- let i = o.prototype, a = Object.keys(i);
19
- for (let e = 0; e < a.length; e++) {
20
- let t = a[e];
21
- t in n || (n[t] = i[t].bind(n));
22
- }
23
- }
24
- let i = n?.Parent ?? Object;
25
- class a extends i {}
26
- Object.defineProperty(a, "name", { value: e });
27
- function o(e) {
28
- var t;
29
- let i = n?.Parent ? new a() : this;
30
- r(i, e), (t = i._zod).deferred ?? (t.deferred = []);
31
- for (let e of i._zod.deferred) e();
32
- return i;
33
- }
34
- return Object.defineProperty(o, "init", { value: r }), Object.defineProperty(o, Symbol.hasInstance, { value: (t) => n?.Parent && t instanceof n.Parent ? !0 : t?._zod?.traits?.has(e) }), Object.defineProperty(o, "name", { value: e }), o;
35
- }
36
- var s = class extends Error {
37
- constructor() {
38
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
39
- }
40
- }, c = class extends Error {
41
- constructor(e) {
42
- super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
43
- }
44
- };
45
- (a = globalThis).__zod_globalConfig ?? (a.__zod_globalConfig = {});
46
- var l = globalThis.__zod_globalConfig;
47
- function u(e) {
48
- return e && Object.assign(l, e), l;
49
- }
50
- //#endregion
51
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
52
- function d(e) {
53
- let t = Object.values(e).filter((e) => typeof e == "number");
54
- return Object.entries(e).filter(([e, n]) => t.indexOf(+e) === -1).map(([e, t]) => t);
55
- }
56
- function f(e, t) {
57
- return typeof t == "bigint" ? t.toString() : t;
58
- }
59
- function p(e) {
60
- return { get value() {
61
- {
62
- let t = e();
63
- return Object.defineProperty(this, "value", { value: t }), t;
64
- }
65
- throw Error("cached value already set");
66
- } };
67
- }
68
- function ee(e) {
69
- return e == null;
70
- }
71
- function te(e) {
72
- let t = +!!e.startsWith("^"), n = e.endsWith("$") ? e.length - 1 : e.length;
73
- return e.slice(t, n);
74
- }
75
- function ne(e, t) {
76
- let n = e / t, r = Math.round(n), i = 2 ** -52 * Math.max(Math.abs(n), 1);
77
- return Math.abs(n - r) < i ? 0 : n - r;
78
- }
79
- var re = /* @__PURE__ */ Symbol("evaluating");
80
- function m(e, t, n) {
81
- let r;
82
- Object.defineProperty(e, t, {
83
- get() {
84
- if (r !== re) return r === void 0 && (r = re, r = n()), r;
85
- },
86
- set(n) {
87
- Object.defineProperty(e, t, { value: n });
88
- },
89
- configurable: !0
90
- });
91
- }
92
- function h(e, t, n) {
93
- Object.defineProperty(e, t, {
94
- value: n,
95
- writable: !0,
96
- enumerable: !0,
97
- configurable: !0
98
- });
99
- }
100
- function g(...e) {
101
- let t = {};
102
- for (let n of e) Object.assign(t, Object.getOwnPropertyDescriptors(n));
103
- return Object.defineProperties({}, t);
104
- }
105
- function ie(e) {
106
- return JSON.stringify(e);
107
- }
108
- function ae(e) {
109
- return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
110
- }
111
- var oe = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {};
112
- function _(e) {
113
- return typeof e == "object" && !!e && !Array.isArray(e);
114
- }
115
- var se = /* @__PURE__ */ p(() => {
116
- if (l.jitless || typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
117
- try {
118
- return Function(""), !0;
119
- } catch {
120
- return !1;
121
- }
122
- });
123
- function v(e) {
124
- if (_(e) === !1) return !1;
125
- let t = e.constructor;
126
- if (t === void 0 || typeof t != "function") return !0;
127
- let n = t.prototype;
128
- return !(_(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
129
- }
130
- function ce(e) {
131
- return v(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e;
132
- }
133
- var le = /* @__PURE__ */ new Set([
134
- "string",
135
- "number",
136
- "symbol"
137
- ]);
138
- function y(e) {
139
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
140
- }
141
- function b(e, t, n) {
142
- let r = new e._zod.constr(t ?? e._zod.def);
143
- return (!t || n?.parent) && (r._zod.parent = e), r;
144
- }
145
- function x(e) {
146
- let t = e;
147
- if (!t) return {};
148
- if (typeof t == "string") return { error: () => t };
149
- if (t?.message !== void 0) {
150
- if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
151
- t.error = t.message;
152
- }
153
- return delete t.message, typeof t.error == "string" ? {
154
- ...t,
155
- error: () => t.error
156
- } : t;
157
- }
158
- function ue(e) {
159
- return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
160
- }
161
- var de = {
162
- safeint: [-(2 ** 53 - 1), 2 ** 53 - 1],
163
- int32: [-2147483648, 2147483647],
164
- uint32: [0, 4294967295],
165
- float32: [-34028234663852886e22, 34028234663852886e22],
166
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
167
- };
168
- function fe(e, t) {
169
- let n = e._zod.def, r = n.checks;
170
- if (r && r.length > 0) throw Error(".pick() cannot be used on object schemas containing refinements");
171
- return b(e, g(e._zod.def, {
172
- get shape() {
173
- let e = {};
174
- for (let r in t) {
175
- if (!(r in n.shape)) throw Error(`Unrecognized key: "${r}"`);
176
- t[r] && (e[r] = n.shape[r]);
177
- }
178
- return h(this, "shape", e), e;
179
- },
180
- checks: []
181
- }));
182
- }
183
- function pe(e, t) {
184
- let n = e._zod.def, r = n.checks;
185
- if (r && r.length > 0) throw Error(".omit() cannot be used on object schemas containing refinements");
186
- return b(e, g(e._zod.def, {
187
- get shape() {
188
- let r = { ...e._zod.def.shape };
189
- for (let e in t) {
190
- if (!(e in n.shape)) throw Error(`Unrecognized key: "${e}"`);
191
- t[e] && delete r[e];
192
- }
193
- return h(this, "shape", r), r;
194
- },
195
- checks: []
196
- }));
197
- }
198
- function me(e, t) {
199
- if (!v(t)) throw Error("Invalid input to extend: expected a plain object");
200
- let n = e._zod.def.checks;
201
- if (n && n.length > 0) {
202
- let n = e._zod.def.shape;
203
- for (let e in t) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
204
- }
205
- return b(e, g(e._zod.def, { get shape() {
206
- let n = {
207
- ...e._zod.def.shape,
208
- ...t
209
- };
210
- return h(this, "shape", n), n;
211
- } }));
212
- }
213
- function he(e, t) {
214
- if (!v(t)) throw Error("Invalid input to safeExtend: expected a plain object");
215
- return b(e, g(e._zod.def, { get shape() {
216
- let n = {
217
- ...e._zod.def.shape,
218
- ...t
219
- };
220
- return h(this, "shape", n), n;
221
- } }));
222
- }
223
- function ge(e, t) {
224
- if (e._zod.def.checks?.length) throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
225
- return b(e, g(e._zod.def, {
226
- get shape() {
227
- let n = {
228
- ...e._zod.def.shape,
229
- ...t._zod.def.shape
230
- };
231
- return h(this, "shape", n), n;
232
- },
233
- get catchall() {
234
- return t._zod.def.catchall;
235
- },
236
- checks: t._zod.def.checks ?? []
237
- }));
238
- }
239
- function _e(e, t, n) {
240
- let r = t._zod.def.checks;
241
- if (r && r.length > 0) throw Error(".partial() cannot be used on object schemas containing refinements");
242
- return b(t, g(t._zod.def, {
243
- get shape() {
244
- let r = t._zod.def.shape, i = { ...r };
245
- if (n) for (let t in n) {
246
- if (!(t in r)) throw Error(`Unrecognized key: "${t}"`);
247
- n[t] && (i[t] = e ? new e({
248
- type: "optional",
249
- innerType: r[t]
250
- }) : r[t]);
251
- }
252
- else for (let t in r) i[t] = e ? new e({
253
- type: "optional",
254
- innerType: r[t]
255
- }) : r[t];
256
- return h(this, "shape", i), i;
257
- },
258
- checks: []
259
- }));
260
- }
261
- function ve(e, t, n) {
262
- return b(t, g(t._zod.def, { get shape() {
263
- let r = t._zod.def.shape, i = { ...r };
264
- if (n) for (let t in n) {
265
- if (!(t in i)) throw Error(`Unrecognized key: "${t}"`);
266
- n[t] && (i[t] = new e({
267
- type: "nonoptional",
268
- innerType: r[t]
269
- }));
270
- }
271
- else for (let t in r) i[t] = new e({
272
- type: "nonoptional",
273
- innerType: r[t]
274
- });
275
- return h(this, "shape", i), i;
276
- } }));
277
- }
278
- function S(e, t = 0) {
279
- if (e.aborted === !0) return !0;
280
- for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0;
281
- return !1;
282
- }
283
- function ye(e, t = 0) {
284
- if (e.aborted === !0) return !0;
285
- for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0;
286
- return !1;
287
- }
288
- function C(e, t) {
289
- return t.map((t) => {
290
- var n;
291
- return (n = t).path ?? (n.path = []), t.path.unshift(e), t;
292
- });
293
- }
294
- function be(e) {
295
- return typeof e == "string" ? e : e?.message;
296
- }
297
- function w(e, t, n) {
298
- let r = e.message ? e.message : be(e.inst?._zod.def?.error?.(e)) ?? be(t?.error?.(e)) ?? be(n.customError?.(e)) ?? be(n.localeError?.(e)) ?? "Invalid input", { inst: i, continue: a, input: o, ...s } = e;
299
- return s.path ??= [], s.message = r, t?.reportInput && (s.input = o), s;
300
- }
301
- function xe(e) {
302
- return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
303
- }
304
- function T(...e) {
305
- let [t, n, r] = e;
306
- return typeof t == "string" ? {
307
- message: t,
308
- code: "custom",
309
- input: n,
310
- inst: r
311
- } : { ...t };
312
- }
313
- //#endregion
314
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
315
- var Se = (e, t) => {
316
- e.name = "$ZodError", Object.defineProperty(e, "_zod", {
317
- value: e._zod,
318
- enumerable: !1
319
- }), Object.defineProperty(e, "issues", {
320
- value: t,
321
- enumerable: !1
322
- }), e.message = JSON.stringify(t, f, 2), Object.defineProperty(e, "toString", {
323
- value: () => e.message,
324
- enumerable: !1
325
- });
326
- }, Ce = o("$ZodError", Se), we = o("$ZodError", Se, { Parent: Error });
327
- function Te(e, t = (e) => e.message) {
328
- let n = {}, r = [];
329
- for (let i of e.issues) i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : r.push(t(i));
330
- return {
331
- formErrors: r,
332
- fieldErrors: n
333
- };
334
- }
335
- function Ee(e, t = (e) => e.message) {
336
- let n = { _errors: [] }, r = (e, i = []) => {
337
- for (let a of e.issues) if (a.code === "invalid_union" && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path]));
338
- else if (a.code === "invalid_key") r({ issues: a.issues }, [...i, ...a.path]);
339
- else if (a.code === "invalid_element") r({ issues: a.issues }, [...i, ...a.path]);
340
- else {
341
- let e = [...i, ...a.path];
342
- if (e.length === 0) n._errors.push(t(a));
343
- else {
344
- let r = n, i = 0;
345
- for (; i < e.length;) {
346
- let n = e[i];
347
- i === e.length - 1 ? (r[n] = r[n] || { _errors: [] }, r[n]._errors.push(t(a))) : r[n] = r[n] || { _errors: [] }, r = r[n], i++;
348
- }
349
- }
350
- }
351
- };
352
- return r(e), n;
353
- }
354
- //#endregion
355
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
356
- var De = (e) => (t, n, r, i) => {
357
- let a = r ? {
358
- ...r,
359
- async: !1
360
- } : { async: !1 }, o = t._zod.run({
361
- value: n,
362
- issues: []
363
- }, a);
364
- if (o instanceof Promise) throw new s();
365
- if (o.issues.length) {
366
- let t = new (i?.Err ?? e)(o.issues.map((e) => w(e, a, u())));
367
- throw oe(t, i?.callee), t;
368
- }
369
- return o.value;
370
- }, Oe = (e) => async (t, n, r, i) => {
371
- let a = r ? {
372
- ...r,
373
- async: !0
374
- } : { async: !0 }, o = t._zod.run({
375
- value: n,
376
- issues: []
377
- }, a);
378
- if (o instanceof Promise && (o = await o), o.issues.length) {
379
- let t = new (i?.Err ?? e)(o.issues.map((e) => w(e, a, u())));
380
- throw oe(t, i?.callee), t;
381
- }
382
- return o.value;
383
- }, ke = (e) => (t, n, r) => {
384
- let i = r ? {
385
- ...r,
386
- async: !1
387
- } : { async: !1 }, a = t._zod.run({
388
- value: n,
389
- issues: []
390
- }, i);
391
- if (a instanceof Promise) throw new s();
392
- return a.issues.length ? {
393
- success: !1,
394
- error: new (e ?? Ce)(a.issues.map((e) => w(e, i, u())))
395
- } : {
396
- success: !0,
397
- data: a.value
398
- };
399
- }, Ae = /* @__PURE__ */ ke(we), je = (e) => async (t, n, r) => {
400
- let i = r ? {
401
- ...r,
402
- async: !0
403
- } : { async: !0 }, a = t._zod.run({
404
- value: n,
405
- issues: []
406
- }, i);
407
- return a instanceof Promise && (a = await a), a.issues.length ? {
408
- success: !1,
409
- error: new e(a.issues.map((e) => w(e, i, u())))
410
- } : {
411
- success: !0,
412
- data: a.value
413
- };
414
- }, Me = /* @__PURE__ */ je(we), Ne = (e) => (t, n, r) => {
415
- let i = r ? {
416
- ...r,
417
- direction: "backward"
418
- } : { direction: "backward" };
419
- return De(e)(t, n, i);
420
- }, Pe = (e) => (t, n, r) => De(e)(t, n, r), Fe = (e) => async (t, n, r) => {
421
- let i = r ? {
422
- ...r,
423
- direction: "backward"
424
- } : { direction: "backward" };
425
- return Oe(e)(t, n, i);
426
- }, Ie = (e) => async (t, n, r) => Oe(e)(t, n, r), Le = (e) => (t, n, r) => {
427
- let i = r ? {
428
- ...r,
429
- direction: "backward"
430
- } : { direction: "backward" };
431
- return ke(e)(t, n, i);
432
- }, Re = (e) => (t, n, r) => ke(e)(t, n, r), ze = (e) => async (t, n, r) => {
433
- let i = r ? {
434
- ...r,
435
- direction: "backward"
436
- } : { direction: "backward" };
437
- return je(e)(t, n, i);
438
- }, Be = (e) => async (t, n, r) => je(e)(t, n, r), Ve = /^[cC][0-9a-z]{6,}$/, He = /^[0-9a-z]+$/, Ue = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, We = /^[0-9a-vA-V]{20}$/, Ge = /^[A-Za-z0-9]{27}$/, Ke = /^[a-zA-Z0-9_-]{21}$/, qe = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Je = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Ye = (e) => e ? RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Xe = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Ze = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
439
- function Qe() {
440
- return new RegExp(Ze, "u");
441
- }
442
- var $e = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, et = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, tt = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, nt = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, rt = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, it = /^[A-Za-z0-9_-]*$/, at = /^https?$/, ot = /^\+[1-9]\d{6,14}$/, st = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", ct = /* @__PURE__ */ RegExp(`^${st}$`);
443
- function lt(e) {
444
- let t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
445
- return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
446
- }
447
- function ut(e) {
448
- return RegExp(`^${lt(e)}$`);
449
- }
450
- function dt(e) {
451
- let t = lt({ precision: e.precision }), n = ["Z"];
452
- e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
453
- let r = `${t}(?:${n.join("|")})`;
454
- return RegExp(`^${st}T(?:${r})$`);
455
- }
456
- var ft = (e) => {
457
- let t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
458
- return RegExp(`^${t}$`);
459
- }, pt = /^-?\d+$/, mt = /^-?\d+(?:\.\d+)?$/, ht = /^(?:true|false)$/i, gt = /^[^A-Z]*$/, _t = /^[^a-z]*$/, E = /* @__PURE__ */ o("$ZodCheck", (e, t) => {
460
- var n;
461
- e._zod ??= {}, e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
462
- }), vt = {
463
- number: "number",
464
- bigint: "bigint",
465
- object: "date"
466
- }, yt = /* @__PURE__ */ o("$ZodCheckLessThan", (e, t) => {
467
- E.init(e, t);
468
- let n = vt[typeof t.value];
469
- e._zod.onattach.push((e) => {
470
- let n = e._zod.bag, r = (t.inclusive ? n.maximum : n.exclusiveMaximum) ?? Infinity;
471
- t.value < r && (t.inclusive ? n.maximum = t.value : n.exclusiveMaximum = t.value);
472
- }), e._zod.check = (r) => {
473
- (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
474
- origin: n,
475
- code: "too_big",
476
- maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
477
- input: r.value,
478
- inclusive: t.inclusive,
479
- inst: e,
480
- continue: !t.abort
481
- });
482
- };
483
- }), bt = /* @__PURE__ */ o("$ZodCheckGreaterThan", (e, t) => {
484
- E.init(e, t);
485
- let n = vt[typeof t.value];
486
- e._zod.onattach.push((e) => {
487
- let n = e._zod.bag, r = (t.inclusive ? n.minimum : n.exclusiveMinimum) ?? -Infinity;
488
- t.value > r && (t.inclusive ? n.minimum = t.value : n.exclusiveMinimum = t.value);
489
- }), e._zod.check = (r) => {
490
- (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
491
- origin: n,
492
- code: "too_small",
493
- minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
494
- input: r.value,
495
- inclusive: t.inclusive,
496
- inst: e,
497
- continue: !t.abort
498
- });
499
- };
500
- }), xt = /* @__PURE__ */ o("$ZodCheckMultipleOf", (e, t) => {
501
- E.init(e, t), e._zod.onattach.push((e) => {
502
- var n;
503
- (n = e._zod.bag).multipleOf ?? (n.multipleOf = t.value);
504
- }), e._zod.check = (n) => {
505
- if (typeof n.value != typeof t.value) throw Error("Cannot mix number and bigint in multiple_of check.");
506
- (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : ne(n.value, t.value) === 0) || n.issues.push({
507
- origin: typeof n.value,
508
- code: "not_multiple_of",
509
- divisor: t.value,
510
- input: n.value,
511
- inst: e,
512
- continue: !t.abort
513
- });
514
- };
515
- }), St = /* @__PURE__ */ o("$ZodCheckNumberFormat", (e, t) => {
516
- E.init(e, t), t.format = t.format || "float64";
517
- let n = t.format?.includes("int"), r = n ? "int" : "number", [i, a] = de[t.format];
518
- e._zod.onattach.push((e) => {
519
- let r = e._zod.bag;
520
- r.format = t.format, r.minimum = i, r.maximum = a, n && (r.pattern = pt);
521
- }), e._zod.check = (o) => {
522
- let s = o.value;
523
- if (n) {
524
- if (!Number.isInteger(s)) {
525
- o.issues.push({
526
- expected: r,
527
- format: t.format,
528
- code: "invalid_type",
529
- continue: !1,
530
- input: s,
531
- inst: e
532
- });
533
- return;
534
- }
535
- if (!Number.isSafeInteger(s)) {
536
- s > 0 ? o.issues.push({
537
- input: s,
538
- code: "too_big",
539
- maximum: 2 ** 53 - 1,
540
- note: "Integers must be within the safe integer range.",
541
- inst: e,
542
- origin: r,
543
- inclusive: !0,
544
- continue: !t.abort
545
- }) : o.issues.push({
546
- input: s,
547
- code: "too_small",
548
- minimum: -(2 ** 53 - 1),
549
- note: "Integers must be within the safe integer range.",
550
- inst: e,
551
- origin: r,
552
- inclusive: !0,
553
- continue: !t.abort
554
- });
555
- return;
556
- }
557
- }
558
- s < i && o.issues.push({
559
- origin: "number",
560
- input: s,
561
- code: "too_small",
562
- minimum: i,
563
- inclusive: !0,
564
- inst: e,
565
- continue: !t.abort
566
- }), s > a && o.issues.push({
567
- origin: "number",
568
- input: s,
569
- code: "too_big",
570
- maximum: a,
571
- inclusive: !0,
572
- inst: e,
573
- continue: !t.abort
574
- });
575
- };
576
- }), Ct = /* @__PURE__ */ o("$ZodCheckMaxLength", (e, t) => {
577
- var n;
578
- E.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
579
- let t = e.value;
580
- return !ee(t) && t.length !== void 0;
581
- }), e._zod.onattach.push((e) => {
582
- let n = e._zod.bag.maximum ?? Infinity;
583
- t.maximum < n && (e._zod.bag.maximum = t.maximum);
584
- }), e._zod.check = (n) => {
585
- let r = n.value;
586
- if (r.length <= t.maximum) return;
587
- let i = xe(r);
588
- n.issues.push({
589
- origin: i,
590
- code: "too_big",
591
- maximum: t.maximum,
592
- inclusive: !0,
593
- input: r,
594
- inst: e,
595
- continue: !t.abort
596
- });
597
- };
598
- }), wt = /* @__PURE__ */ o("$ZodCheckMinLength", (e, t) => {
599
- var n;
600
- E.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
601
- let t = e.value;
602
- return !ee(t) && t.length !== void 0;
603
- }), e._zod.onattach.push((e) => {
604
- let n = e._zod.bag.minimum ?? -Infinity;
605
- t.minimum > n && (e._zod.bag.minimum = t.minimum);
606
- }), e._zod.check = (n) => {
607
- let r = n.value;
608
- if (r.length >= t.minimum) return;
609
- let i = xe(r);
610
- n.issues.push({
611
- origin: i,
612
- code: "too_small",
613
- minimum: t.minimum,
614
- inclusive: !0,
615
- input: r,
616
- inst: e,
617
- continue: !t.abort
618
- });
619
- };
620
- }), Tt = /* @__PURE__ */ o("$ZodCheckLengthEquals", (e, t) => {
621
- var n;
622
- E.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
623
- let t = e.value;
624
- return !ee(t) && t.length !== void 0;
625
- }), e._zod.onattach.push((e) => {
626
- let n = e._zod.bag;
627
- n.minimum = t.length, n.maximum = t.length, n.length = t.length;
628
- }), e._zod.check = (n) => {
629
- let r = n.value, i = r.length;
630
- if (i === t.length) return;
631
- let a = xe(r), o = i > t.length;
632
- n.issues.push({
633
- origin: a,
634
- ...o ? {
635
- code: "too_big",
636
- maximum: t.length
637
- } : {
638
- code: "too_small",
639
- minimum: t.length
640
- },
641
- inclusive: !0,
642
- exact: !0,
643
- input: n.value,
644
- inst: e,
645
- continue: !t.abort
646
- });
647
- };
648
- }), Et = /* @__PURE__ */ o("$ZodCheckStringFormat", (e, t) => {
649
- var n, r;
650
- E.init(e, t), e._zod.onattach.push((e) => {
651
- let n = e._zod.bag;
652
- n.format = t.format, t.pattern && (n.patterns ??= /* @__PURE__ */ new Set(), n.patterns.add(t.pattern));
653
- }), t.pattern ? (n = e._zod).check ?? (n.check = (n) => {
654
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
655
- origin: "string",
656
- code: "invalid_format",
657
- format: t.format,
658
- input: n.value,
659
- ...t.pattern ? { pattern: t.pattern.toString() } : {},
660
- inst: e,
661
- continue: !t.abort
662
- });
663
- }) : (r = e._zod).check ?? (r.check = () => {});
664
- }), Dt = /* @__PURE__ */ o("$ZodCheckRegex", (e, t) => {
665
- Et.init(e, t), e._zod.check = (n) => {
666
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
667
- origin: "string",
668
- code: "invalid_format",
669
- format: "regex",
670
- input: n.value,
671
- pattern: t.pattern.toString(),
672
- inst: e,
673
- continue: !t.abort
674
- });
675
- };
676
- }), Ot = /* @__PURE__ */ o("$ZodCheckLowerCase", (e, t) => {
677
- t.pattern ??= gt, Et.init(e, t);
678
- }), kt = /* @__PURE__ */ o("$ZodCheckUpperCase", (e, t) => {
679
- t.pattern ??= _t, Et.init(e, t);
680
- }), At = /* @__PURE__ */ o("$ZodCheckIncludes", (e, t) => {
681
- E.init(e, t);
682
- let n = y(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
683
- t.pattern = r, e._zod.onattach.push((e) => {
684
- let t = e._zod.bag;
685
- t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(r);
686
- }), e._zod.check = (n) => {
687
- n.value.includes(t.includes, t.position) || n.issues.push({
688
- origin: "string",
689
- code: "invalid_format",
690
- format: "includes",
691
- includes: t.includes,
692
- input: n.value,
693
- inst: e,
694
- continue: !t.abort
695
- });
696
- };
697
- }), jt = /* @__PURE__ */ o("$ZodCheckStartsWith", (e, t) => {
698
- E.init(e, t);
699
- let n = RegExp(`^${y(t.prefix)}.*`);
700
- t.pattern ??= n, e._zod.onattach.push((e) => {
701
- let t = e._zod.bag;
702
- t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
703
- }), e._zod.check = (n) => {
704
- n.value.startsWith(t.prefix) || n.issues.push({
705
- origin: "string",
706
- code: "invalid_format",
707
- format: "starts_with",
708
- prefix: t.prefix,
709
- input: n.value,
710
- inst: e,
711
- continue: !t.abort
712
- });
713
- };
714
- }), Mt = /* @__PURE__ */ o("$ZodCheckEndsWith", (e, t) => {
715
- E.init(e, t);
716
- let n = RegExp(`.*${y(t.suffix)}$`);
717
- t.pattern ??= n, e._zod.onattach.push((e) => {
718
- let t = e._zod.bag;
719
- t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
720
- }), e._zod.check = (n) => {
721
- n.value.endsWith(t.suffix) || n.issues.push({
722
- origin: "string",
723
- code: "invalid_format",
724
- format: "ends_with",
725
- suffix: t.suffix,
726
- input: n.value,
727
- inst: e,
728
- continue: !t.abort
729
- });
730
- };
731
- }), Nt = /* @__PURE__ */ o("$ZodCheckOverwrite", (e, t) => {
732
- E.init(e, t), e._zod.check = (e) => {
733
- e.value = t.tx(e.value);
734
- };
735
- }), Pt = class {
736
- constructor(e = []) {
737
- this.content = [], this.indent = 0, this && (this.args = e);
738
- }
739
- indented(e) {
740
- this.indent += 1, e(this), --this.indent;
741
- }
742
- write(e) {
743
- if (typeof e == "function") {
744
- e(this, { execution: "sync" }), e(this, { execution: "async" });
745
- return;
746
- }
747
- let t = e.split("\n").filter((e) => e), n = Math.min(...t.map((e) => e.length - e.trimStart().length)), r = t.map((e) => e.slice(n)).map((e) => " ".repeat(this.indent * 2) + e);
748
- for (let e of r) this.content.push(e);
749
- }
750
- compile() {
751
- let e = Function, t = this?.args, n = [...(this?.content ?? [""]).map((e) => ` ${e}`)];
752
- return new e(...t, n.join("\n"));
753
- }
754
- }, Ft = {
755
- major: 4,
756
- minor: 4,
757
- patch: 3
758
- }, D = /* @__PURE__ */ o("$ZodType", (e, t) => {
759
- var n;
760
- e ??= {}, e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Ft;
761
- let r = [...e._zod.def.checks ?? []];
762
- e._zod.traits.has("$ZodCheck") && r.unshift(e);
763
- for (let t of r) for (let n of t._zod.onattach) n(e);
764
- if (r.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
765
- e._zod.run = e._zod.parse;
766
- });
767
- else {
768
- let t = (e, t, n) => {
769
- let r = S(e), i;
770
- for (let a of t) {
771
- if (a._zod.def.when) {
772
- if (ye(e) || !a._zod.def.when(e)) continue;
773
- } else if (r) continue;
774
- let t = e.issues.length, o = a._zod.check(e);
775
- if (o instanceof Promise && n?.async === !1) throw new s();
776
- if (i || o instanceof Promise) i = (i ?? Promise.resolve()).then(async () => {
777
- await o, e.issues.length !== t && (r ||= S(e, t));
778
- });
779
- else {
780
- if (e.issues.length === t) continue;
781
- r ||= S(e, t);
782
- }
783
- }
784
- return i ? i.then(() => e) : e;
785
- }, n = (n, i, a) => {
786
- if (S(n)) return n.aborted = !0, n;
787
- let o = t(i, r, a);
788
- if (o instanceof Promise) {
789
- if (a.async === !1) throw new s();
790
- return o.then((t) => e._zod.parse(t, a));
791
- }
792
- return e._zod.parse(o, a);
793
- };
794
- e._zod.run = (i, a) => {
795
- if (a.skipChecks) return e._zod.parse(i, a);
796
- if (a.direction === "backward") {
797
- let t = e._zod.parse({
798
- value: i.value,
799
- issues: []
800
- }, {
801
- ...a,
802
- skipChecks: !0
803
- });
804
- return t instanceof Promise ? t.then((e) => n(e, i, a)) : n(t, i, a);
805
- }
806
- let o = e._zod.parse(i, a);
807
- if (o instanceof Promise) {
808
- if (a.async === !1) throw new s();
809
- return o.then((e) => t(e, r, a));
810
- }
811
- return t(o, r, a);
812
- };
813
- }
814
- m(e, "~standard", () => ({
815
- validate: (t) => {
816
- try {
817
- let n = Ae(e, t);
818
- return n.success ? { value: n.data } : { issues: n.error?.issues };
819
- } catch {
820
- return Me(e, t).then((e) => e.success ? { value: e.data } : { issues: e.error?.issues });
821
- }
822
- },
823
- vendor: "zod",
824
- version: 1
825
- }));
826
- }), It = /* @__PURE__ */ o("$ZodString", (e, t) => {
827
- D.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? ft(e._zod.bag), e._zod.parse = (n, r) => {
828
- if (t.coerce) try {
829
- n.value = String(n.value);
830
- } catch {}
831
- return typeof n.value == "string" || n.issues.push({
832
- expected: "string",
833
- code: "invalid_type",
834
- input: n.value,
835
- inst: e
836
- }), n;
837
- };
838
- }), O = /* @__PURE__ */ o("$ZodStringFormat", (e, t) => {
839
- Et.init(e, t), It.init(e, t);
840
- }), Lt = /* @__PURE__ */ o("$ZodGUID", (e, t) => {
841
- t.pattern ??= Je, O.init(e, t);
842
- }), Rt = /* @__PURE__ */ o("$ZodUUID", (e, t) => {
843
- if (t.version) {
844
- let e = {
845
- v1: 1,
846
- v2: 2,
847
- v3: 3,
848
- v4: 4,
849
- v5: 5,
850
- v6: 6,
851
- v7: 7,
852
- v8: 8
853
- }[t.version];
854
- if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`);
855
- t.pattern ??= Ye(e);
856
- } else t.pattern ??= Ye();
857
- O.init(e, t);
858
- }), zt = /* @__PURE__ */ o("$ZodEmail", (e, t) => {
859
- t.pattern ??= Xe, O.init(e, t);
860
- }), Bt = /* @__PURE__ */ o("$ZodURL", (e, t) => {
861
- O.init(e, t), e._zod.check = (n) => {
862
- try {
863
- let r = n.value.trim();
864
- if (!t.normalize && t.protocol?.source === at.source && !/^https?:\/\//i.test(r)) {
865
- n.issues.push({
866
- code: "invalid_format",
867
- format: "url",
868
- note: "Invalid URL format",
869
- input: n.value,
870
- inst: e,
871
- continue: !t.abort
872
- });
873
- return;
874
- }
875
- let i = new URL(r);
876
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(i.hostname) || n.issues.push({
877
- code: "invalid_format",
878
- format: "url",
879
- note: "Invalid hostname",
880
- pattern: t.hostname.source,
881
- input: n.value,
882
- inst: e,
883
- continue: !t.abort
884
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || n.issues.push({
885
- code: "invalid_format",
886
- format: "url",
887
- note: "Invalid protocol",
888
- pattern: t.protocol.source,
889
- input: n.value,
890
- inst: e,
891
- continue: !t.abort
892
- })), t.normalize ? n.value = i.href : n.value = r;
893
- return;
894
- } catch {
895
- n.issues.push({
896
- code: "invalid_format",
897
- format: "url",
898
- input: n.value,
899
- inst: e,
900
- continue: !t.abort
901
- });
902
- }
903
- };
904
- }), Vt = /* @__PURE__ */ o("$ZodEmoji", (e, t) => {
905
- t.pattern ??= Qe(), O.init(e, t);
906
- }), Ht = /* @__PURE__ */ o("$ZodNanoID", (e, t) => {
907
- t.pattern ??= Ke, O.init(e, t);
908
- }), Ut = /* @__PURE__ */ o("$ZodCUID", (e, t) => {
909
- t.pattern ??= Ve, O.init(e, t);
910
- }), Wt = /* @__PURE__ */ o("$ZodCUID2", (e, t) => {
911
- t.pattern ??= He, O.init(e, t);
912
- }), Gt = /* @__PURE__ */ o("$ZodULID", (e, t) => {
913
- t.pattern ??= Ue, O.init(e, t);
914
- }), Kt = /* @__PURE__ */ o("$ZodXID", (e, t) => {
915
- t.pattern ??= We, O.init(e, t);
916
- }), qt = /* @__PURE__ */ o("$ZodKSUID", (e, t) => {
917
- t.pattern ??= Ge, O.init(e, t);
918
- }), Jt = /* @__PURE__ */ o("$ZodISODateTime", (e, t) => {
919
- t.pattern ??= dt(t), O.init(e, t);
920
- }), Yt = /* @__PURE__ */ o("$ZodISODate", (e, t) => {
921
- t.pattern ??= ct, O.init(e, t);
922
- }), Xt = /* @__PURE__ */ o("$ZodISOTime", (e, t) => {
923
- t.pattern ??= ut(t), O.init(e, t);
924
- }), Zt = /* @__PURE__ */ o("$ZodISODuration", (e, t) => {
925
- t.pattern ??= qe, O.init(e, t);
926
- }), Qt = /* @__PURE__ */ o("$ZodIPv4", (e, t) => {
927
- t.pattern ??= $e, O.init(e, t), e._zod.bag.format = "ipv4";
928
- }), $t = /* @__PURE__ */ o("$ZodIPv6", (e, t) => {
929
- t.pattern ??= et, O.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
930
- try {
931
- new URL(`http://[${n.value}]`);
932
- } catch {
933
- n.issues.push({
934
- code: "invalid_format",
935
- format: "ipv6",
936
- input: n.value,
937
- inst: e,
938
- continue: !t.abort
939
- });
940
- }
941
- };
942
- }), en = /* @__PURE__ */ o("$ZodCIDRv4", (e, t) => {
943
- t.pattern ??= tt, O.init(e, t);
944
- }), tn = /* @__PURE__ */ o("$ZodCIDRv6", (e, t) => {
945
- t.pattern ??= nt, O.init(e, t), e._zod.check = (n) => {
946
- let r = n.value.split("/");
947
- try {
948
- if (r.length !== 2) throw Error();
949
- let [e, t] = r;
950
- if (!t) throw Error();
951
- let n = Number(t);
952
- if (`${n}` !== t || n < 0 || n > 128) throw Error();
953
- new URL(`http://[${e}]`);
954
- } catch {
955
- n.issues.push({
956
- code: "invalid_format",
957
- format: "cidrv6",
958
- input: n.value,
959
- inst: e,
960
- continue: !t.abort
961
- });
962
- }
963
- };
964
- });
965
- function nn(e) {
966
- if (e === "") return !0;
967
- if (/\s/.test(e) || e.length % 4 != 0) return !1;
968
- try {
969
- return atob(e), !0;
970
- } catch {
971
- return !1;
972
- }
973
- }
974
- var rn = /* @__PURE__ */ o("$ZodBase64", (e, t) => {
975
- t.pattern ??= rt, O.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
976
- nn(n.value) || n.issues.push({
977
- code: "invalid_format",
978
- format: "base64",
979
- input: n.value,
980
- inst: e,
981
- continue: !t.abort
982
- });
983
- };
984
- });
985
- function an(e) {
986
- if (!it.test(e)) return !1;
987
- let t = e.replace(/[-_]/g, (e) => e === "-" ? "+" : "/");
988
- return nn(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
989
- }
990
- var on = /* @__PURE__ */ o("$ZodBase64URL", (e, t) => {
991
- t.pattern ??= it, O.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
992
- an(n.value) || n.issues.push({
993
- code: "invalid_format",
994
- format: "base64url",
995
- input: n.value,
996
- inst: e,
997
- continue: !t.abort
998
- });
999
- };
1000
- }), sn = /* @__PURE__ */ o("$ZodE164", (e, t) => {
1001
- t.pattern ??= ot, O.init(e, t);
1002
- });
1003
- function cn(e, t = null) {
1004
- try {
1005
- let n = e.split(".");
1006
- if (n.length !== 3) return !1;
1007
- let [r] = n;
1008
- if (!r) return !1;
1009
- let i = JSON.parse(atob(r));
1010
- return !("typ" in i && i?.typ !== "JWT" || !i.alg || t && (!("alg" in i) || i.alg !== t));
1011
- } catch {
1012
- return !1;
1013
- }
1014
- }
1015
- var ln = /* @__PURE__ */ o("$ZodJWT", (e, t) => {
1016
- O.init(e, t), e._zod.check = (n) => {
1017
- cn(n.value, t.alg) || n.issues.push({
1018
- code: "invalid_format",
1019
- format: "jwt",
1020
- input: n.value,
1021
- inst: e,
1022
- continue: !t.abort
1023
- });
1024
- };
1025
- }), un = /* @__PURE__ */ o("$ZodNumber", (e, t) => {
1026
- D.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? mt, e._zod.parse = (n, r) => {
1027
- if (t.coerce) try {
1028
- n.value = Number(n.value);
1029
- } catch {}
1030
- let i = n.value;
1031
- if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i)) return n;
1032
- let a = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
1033
- return n.issues.push({
1034
- expected: "number",
1035
- code: "invalid_type",
1036
- input: i,
1037
- inst: e,
1038
- ...a ? { received: a } : {}
1039
- }), n;
1040
- };
1041
- }), dn = /* @__PURE__ */ o("$ZodNumberFormat", (e, t) => {
1042
- St.init(e, t), un.init(e, t);
1043
- }), fn = /* @__PURE__ */ o("$ZodBoolean", (e, t) => {
1044
- D.init(e, t), e._zod.pattern = ht, e._zod.parse = (n, r) => {
1045
- if (t.coerce) try {
1046
- n.value = !!n.value;
1047
- } catch {}
1048
- let i = n.value;
1049
- return typeof i == "boolean" || n.issues.push({
1050
- expected: "boolean",
1051
- code: "invalid_type",
1052
- input: i,
1053
- inst: e
1054
- }), n;
1055
- };
1056
- }), pn = /* @__PURE__ */ o("$ZodUnknown", (e, t) => {
1057
- D.init(e, t), e._zod.parse = (e) => e;
1058
- }), mn = /* @__PURE__ */ o("$ZodNever", (e, t) => {
1059
- D.init(e, t), e._zod.parse = (t, n) => (t.issues.push({
1060
- expected: "never",
1061
- code: "invalid_type",
1062
- input: t.value,
1063
- inst: e
1064
- }), t);
1065
- });
1066
- function hn(e, t, n) {
1067
- e.issues.length && t.issues.push(...C(n, e.issues)), t.value[n] = e.value;
1068
- }
1069
- var gn = /* @__PURE__ */ o("$ZodArray", (e, t) => {
1070
- D.init(e, t), e._zod.parse = (n, r) => {
1071
- let i = n.value;
1072
- if (!Array.isArray(i)) return n.issues.push({
1073
- expected: "array",
1074
- code: "invalid_type",
1075
- input: i,
1076
- inst: e
1077
- }), n;
1078
- n.value = Array(i.length);
1079
- let a = [];
1080
- for (let e = 0; e < i.length; e++) {
1081
- let o = i[e], s = t.element._zod.run({
1082
- value: o,
1083
- issues: []
1084
- }, r);
1085
- s instanceof Promise ? a.push(s.then((t) => hn(t, n, e))) : hn(s, n, e);
1086
- }
1087
- return a.length ? Promise.all(a).then(() => n) : n;
1088
- };
1089
- });
1090
- function k(e, t, n, r, i, a) {
1091
- let o = n in r;
1092
- if (e.issues.length) {
1093
- if (i && a && !o) return;
1094
- t.issues.push(...C(n, e.issues));
1095
- }
1096
- if (!o && !i) {
1097
- e.issues.length || t.issues.push({
1098
- code: "invalid_type",
1099
- expected: "nonoptional",
1100
- input: void 0,
1101
- path: [n]
1102
- });
1103
- return;
1104
- }
1105
- e.value === void 0 ? o && (t.value[n] = void 0) : t.value[n] = e.value;
1106
- }
1107
- function _n(e) {
1108
- let t = Object.keys(e.shape);
1109
- for (let n of t) if (!e.shape?.[n]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${n}": expected a Zod schema`);
1110
- let n = ue(e.shape);
1111
- return {
1112
- ...e,
1113
- keys: t,
1114
- keySet: new Set(t),
1115
- numKeys: t.length,
1116
- optionalKeys: new Set(n)
1117
- };
1118
- }
1119
- function vn(e, t, n, r, i, a) {
1120
- let o = [], s = i.keySet, c = i.catchall._zod, l = c.def.type, u = c.optin === "optional", d = c.optout === "optional";
1121
- for (let i in t) {
1122
- if (i === "__proto__" || s.has(i)) continue;
1123
- if (l === "never") {
1124
- o.push(i);
1125
- continue;
1126
- }
1127
- let a = c.run({
1128
- value: t[i],
1129
- issues: []
1130
- }, r);
1131
- a instanceof Promise ? e.push(a.then((e) => k(e, n, i, t, u, d))) : k(a, n, i, t, u, d);
1132
- }
1133
- return o.length && n.issues.push({
1134
- code: "unrecognized_keys",
1135
- keys: o,
1136
- input: t,
1137
- inst: a
1138
- }), e.length ? Promise.all(e).then(() => n) : n;
1139
- }
1140
- var yn = /* @__PURE__ */ o("$ZodObject", (e, t) => {
1141
- if (D.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
1142
- let e = t.shape;
1143
- Object.defineProperty(t, "shape", { get: () => {
1144
- let n = { ...e };
1145
- return Object.defineProperty(t, "shape", { value: n }), n;
1146
- } });
1147
- }
1148
- let n = p(() => _n(t));
1149
- m(e._zod, "propValues", () => {
1150
- let e = t.shape, n = {};
1151
- for (let t in e) {
1152
- let r = e[t]._zod;
1153
- if (r.values) {
1154
- n[t] ?? (n[t] = /* @__PURE__ */ new Set());
1155
- for (let e of r.values) n[t].add(e);
1156
- }
1157
- }
1158
- return n;
1159
- });
1160
- let r = _, i = t.catchall, a;
1161
- e._zod.parse = (t, o) => {
1162
- a ??= n.value;
1163
- let s = t.value;
1164
- if (!r(s)) return t.issues.push({
1165
- expected: "object",
1166
- code: "invalid_type",
1167
- input: s,
1168
- inst: e
1169
- }), t;
1170
- t.value = {};
1171
- let c = [], l = a.shape;
1172
- for (let e of a.keys) {
1173
- let n = l[e], r = n._zod.optin === "optional", i = n._zod.optout === "optional", a = n._zod.run({
1174
- value: s[e],
1175
- issues: []
1176
- }, o);
1177
- a instanceof Promise ? c.push(a.then((n) => k(n, t, e, s, r, i))) : k(a, t, e, s, r, i);
1178
- }
1179
- return i ? vn(c, s, t, o, n.value, e) : c.length ? Promise.all(c).then(() => t) : t;
1180
- };
1181
- }), bn = /* @__PURE__ */ o("$ZodObjectJIT", (e, t) => {
1182
- yn.init(e, t);
1183
- let n = e._zod.parse, r = p(() => _n(t)), i = (e) => {
1184
- let t = new Pt([
1185
- "shape",
1186
- "payload",
1187
- "ctx"
1188
- ]), n = r.value, i = (e) => {
1189
- let t = ie(e);
1190
- return `shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`;
1191
- };
1192
- t.write("const input = payload.value;");
1193
- let a = Object.create(null), o = 0;
1194
- for (let e of n.keys) a[e] = `key_${o++}`;
1195
- t.write("const newResult = {};");
1196
- for (let r of n.keys) {
1197
- let n = a[r], o = ie(r), s = e[r], c = s?._zod?.optin === "optional", l = s?._zod?.optout === "optional";
1198
- t.write(`const ${n} = ${i(r)};`), c && l ? t.write(`
1199
- if (${n}.issues.length) {
1200
- if (${o} in input) {
1201
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1202
- ...iss,
1203
- path: iss.path ? [${o}, ...iss.path] : [${o}]
1204
- })));
1205
- }
1206
- }
1207
-
1208
- if (${n}.value === undefined) {
1209
- if (${o} in input) {
1210
- newResult[${o}] = undefined;
1211
- }
1212
- } else {
1213
- newResult[${o}] = ${n}.value;
1214
- }
1215
-
1216
- `) : c ? t.write(`
1217
- if (${n}.issues.length) {
1218
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1219
- ...iss,
1220
- path: iss.path ? [${o}, ...iss.path] : [${o}]
1221
- })));
1222
- }
1223
-
1224
- if (${n}.value === undefined) {
1225
- if (${o} in input) {
1226
- newResult[${o}] = undefined;
1227
- }
1228
- } else {
1229
- newResult[${o}] = ${n}.value;
1230
- }
1231
-
1232
- `) : t.write(`
1233
- const ${n}_present = ${o} in input;
1234
- if (${n}.issues.length) {
1235
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1236
- ...iss,
1237
- path: iss.path ? [${o}, ...iss.path] : [${o}]
1238
- })));
1239
- }
1240
- if (!${n}_present && !${n}.issues.length) {
1241
- payload.issues.push({
1242
- code: "invalid_type",
1243
- expected: "nonoptional",
1244
- input: undefined,
1245
- path: [${o}]
1246
- });
1247
- }
1248
-
1249
- if (${n}_present) {
1250
- if (${n}.value === undefined) {
1251
- newResult[${o}] = undefined;
1252
- } else {
1253
- newResult[${o}] = ${n}.value;
1254
- }
1255
- }
1256
-
1257
- `);
1258
- }
1259
- t.write("payload.value = newResult;"), t.write("return payload;");
1260
- let s = t.compile();
1261
- return (t, n) => s(e, t, n);
1262
- }, a, o = _, s = !l.jitless, c = s && se.value, u = t.catchall, d;
1263
- e._zod.parse = (l, f) => {
1264
- d ??= r.value;
1265
- let p = l.value;
1266
- return o(p) ? s && c && f?.async === !1 && f.jitless !== !0 ? (a ||= i(t.shape), l = a(l, f), u ? vn([], p, l, f, d, e) : l) : n(l, f) : (l.issues.push({
1267
- expected: "object",
1268
- code: "invalid_type",
1269
- input: p,
1270
- inst: e
1271
- }), l);
1272
- };
1273
- });
1274
- function xn(e, t, n, r) {
1275
- for (let n of e) if (n.issues.length === 0) return t.value = n.value, t;
1276
- let i = e.filter((e) => !S(e));
1277
- return i.length === 1 ? (t.value = i[0].value, i[0]) : (t.issues.push({
1278
- code: "invalid_union",
1279
- input: t.value,
1280
- inst: n,
1281
- errors: e.map((e) => e.issues.map((e) => w(e, r, u())))
1282
- }), t);
1283
- }
1284
- var Sn = /* @__PURE__ */ o("$ZodUnion", (e, t) => {
1285
- D.init(e, t), m(e._zod, "optin", () => t.options.some((e) => e._zod.optin === "optional") ? "optional" : void 0), m(e._zod, "optout", () => t.options.some((e) => e._zod.optout === "optional") ? "optional" : void 0), m(e._zod, "values", () => {
1286
- if (t.options.every((e) => e._zod.values)) return new Set(t.options.flatMap((e) => Array.from(e._zod.values)));
1287
- }), m(e._zod, "pattern", () => {
1288
- if (t.options.every((e) => e._zod.pattern)) {
1289
- let e = t.options.map((e) => e._zod.pattern);
1290
- return RegExp(`^(${e.map((e) => te(e.source)).join("|")})$`);
1291
- }
1292
- });
1293
- let n = t.options.length === 1 ? t.options[0]._zod.run : null;
1294
- e._zod.parse = (r, i) => {
1295
- if (n) return n(r, i);
1296
- let a = !1, o = [];
1297
- for (let e of t.options) {
1298
- let t = e._zod.run({
1299
- value: r.value,
1300
- issues: []
1301
- }, i);
1302
- if (t instanceof Promise) o.push(t), a = !0;
1303
- else {
1304
- if (t.issues.length === 0) return t;
1305
- o.push(t);
1306
- }
1307
- }
1308
- return a ? Promise.all(o).then((t) => xn(t, r, e, i)) : xn(o, r, e, i);
1309
- };
1310
- }), Cn = /* @__PURE__ */ o("$ZodIntersection", (e, t) => {
1311
- D.init(e, t), e._zod.parse = (e, n) => {
1312
- let r = e.value, i = t.left._zod.run({
1313
- value: r,
1314
- issues: []
1315
- }, n), a = t.right._zod.run({
1316
- value: r,
1317
- issues: []
1318
- }, n);
1319
- return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => Tn(e, t, n)) : Tn(e, i, a);
1320
- };
1321
- });
1322
- function wn(e, t) {
1323
- if (e === t || e instanceof Date && t instanceof Date && +e == +t) return {
1324
- valid: !0,
1325
- data: e
1326
- };
1327
- if (v(e) && v(t)) {
1328
- let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = {
1329
- ...e,
1330
- ...t
1331
- };
1332
- for (let n of r) {
1333
- let r = wn(e[n], t[n]);
1334
- if (!r.valid) return {
1335
- valid: !1,
1336
- mergeErrorPath: [n, ...r.mergeErrorPath]
1337
- };
1338
- i[n] = r.data;
1339
- }
1340
- return {
1341
- valid: !0,
1342
- data: i
1343
- };
1344
- }
1345
- if (Array.isArray(e) && Array.isArray(t)) {
1346
- if (e.length !== t.length) return {
1347
- valid: !1,
1348
- mergeErrorPath: []
1349
- };
1350
- let n = [];
1351
- for (let r = 0; r < e.length; r++) {
1352
- let i = e[r], a = t[r], o = wn(i, a);
1353
- if (!o.valid) return {
1354
- valid: !1,
1355
- mergeErrorPath: [r, ...o.mergeErrorPath]
1356
- };
1357
- n.push(o.data);
1358
- }
1359
- return {
1360
- valid: !0,
1361
- data: n
1362
- };
1363
- }
1364
- return {
1365
- valid: !1,
1366
- mergeErrorPath: []
1367
- };
1368
- }
1369
- function Tn(e, t, n) {
1370
- let r = /* @__PURE__ */ new Map(), i;
1371
- for (let n of t.issues) if (n.code === "unrecognized_keys") {
1372
- i ??= n;
1373
- for (let e of n.keys) r.has(e) || r.set(e, {}), r.get(e).l = !0;
1374
- } else e.issues.push(n);
1375
- for (let t of n.issues) if (t.code === "unrecognized_keys") for (let e of t.keys) r.has(e) || r.set(e, {}), r.get(e).r = !0;
1376
- else e.issues.push(t);
1377
- let a = [...r].filter(([, e]) => e.l && e.r).map(([e]) => e);
1378
- if (a.length && i && e.issues.push({
1379
- ...i,
1380
- keys: a
1381
- }), S(e)) return e;
1382
- let o = wn(t.value, n.value);
1383
- if (!o.valid) throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
1384
- return e.value = o.data, e;
1385
- }
1386
- var En = /* @__PURE__ */ o("$ZodRecord", (e, t) => {
1387
- D.init(e, t), e._zod.parse = (n, r) => {
1388
- let i = n.value;
1389
- if (!v(i)) return n.issues.push({
1390
- expected: "record",
1391
- code: "invalid_type",
1392
- input: i,
1393
- inst: e
1394
- }), n;
1395
- let a = [], o = t.keyType._zod.values;
1396
- if (o) {
1397
- n.value = {};
1398
- let s = /* @__PURE__ */ new Set();
1399
- for (let c of o) if (typeof c == "string" || typeof c == "number" || typeof c == "symbol") {
1400
- s.add(typeof c == "number" ? c.toString() : c);
1401
- let o = t.keyType._zod.run({
1402
- value: c,
1403
- issues: []
1404
- }, r);
1405
- if (o instanceof Promise) throw Error("Async schemas not supported in object keys currently");
1406
- if (o.issues.length) {
1407
- n.issues.push({
1408
- code: "invalid_key",
1409
- origin: "record",
1410
- issues: o.issues.map((e) => w(e, r, u())),
1411
- input: c,
1412
- path: [c],
1413
- inst: e
1414
- });
1415
- continue;
1416
- }
1417
- let l = o.value, d = t.valueType._zod.run({
1418
- value: i[c],
1419
- issues: []
1420
- }, r);
1421
- d instanceof Promise ? a.push(d.then((e) => {
1422
- e.issues.length && n.issues.push(...C(c, e.issues)), n.value[l] = e.value;
1423
- })) : (d.issues.length && n.issues.push(...C(c, d.issues)), n.value[l] = d.value);
1424
- }
1425
- let c;
1426
- for (let e in i) s.has(e) || (c ??= [], c.push(e));
1427
- c && c.length > 0 && n.issues.push({
1428
- code: "unrecognized_keys",
1429
- input: i,
1430
- inst: e,
1431
- keys: c
1432
- });
1433
- } else {
1434
- n.value = {};
1435
- for (let o of Reflect.ownKeys(i)) {
1436
- if (o === "__proto__" || !Object.prototype.propertyIsEnumerable.call(i, o)) continue;
1437
- let s = t.keyType._zod.run({
1438
- value: o,
1439
- issues: []
1440
- }, r);
1441
- if (s instanceof Promise) throw Error("Async schemas not supported in object keys currently");
1442
- if (typeof o == "string" && mt.test(o) && s.issues.length) {
1443
- let e = t.keyType._zod.run({
1444
- value: Number(o),
1445
- issues: []
1446
- }, r);
1447
- if (e instanceof Promise) throw Error("Async schemas not supported in object keys currently");
1448
- e.issues.length === 0 && (s = e);
1449
- }
1450
- if (s.issues.length) {
1451
- t.mode === "loose" ? n.value[o] = i[o] : n.issues.push({
1452
- code: "invalid_key",
1453
- origin: "record",
1454
- issues: s.issues.map((e) => w(e, r, u())),
1455
- input: o,
1456
- path: [o],
1457
- inst: e
1458
- });
1459
- continue;
1460
- }
1461
- let c = t.valueType._zod.run({
1462
- value: i[o],
1463
- issues: []
1464
- }, r);
1465
- c instanceof Promise ? a.push(c.then((e) => {
1466
- e.issues.length && n.issues.push(...C(o, e.issues)), n.value[s.value] = e.value;
1467
- })) : (c.issues.length && n.issues.push(...C(o, c.issues)), n.value[s.value] = c.value);
1468
- }
1469
- }
1470
- return a.length ? Promise.all(a).then(() => n) : n;
1471
- };
1472
- }), Dn = /* @__PURE__ */ o("$ZodEnum", (e, t) => {
1473
- D.init(e, t);
1474
- let n = d(t.entries), r = new Set(n);
1475
- e._zod.values = r, e._zod.pattern = RegExp(`^(${n.filter((e) => le.has(typeof e)).map((e) => typeof e == "string" ? y(e) : e.toString()).join("|")})$`), e._zod.parse = (t, i) => {
1476
- let a = t.value;
1477
- return r.has(a) || t.issues.push({
1478
- code: "invalid_value",
1479
- values: n,
1480
- input: a,
1481
- inst: e
1482
- }), t;
1483
- };
1484
- }), On = /* @__PURE__ */ o("$ZodLiteral", (e, t) => {
1485
- if (D.init(e, t), t.values.length === 0) throw Error("Cannot create literal schema with no valid values");
1486
- let n = new Set(t.values);
1487
- e._zod.values = n, e._zod.pattern = RegExp(`^(${t.values.map((e) => typeof e == "string" ? y(e) : e ? y(e.toString()) : String(e)).join("|")})$`), e._zod.parse = (r, i) => {
1488
- let a = r.value;
1489
- return n.has(a) || r.issues.push({
1490
- code: "invalid_value",
1491
- values: t.values,
1492
- input: a,
1493
- inst: e
1494
- }), r;
1495
- };
1496
- }), kn = /* @__PURE__ */ o("$ZodTransform", (e, t) => {
1497
- D.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, r) => {
1498
- if (r.direction === "backward") throw new c(e.constructor.name);
1499
- let i = t.transform(n.value, n);
1500
- if (r.async) return (i instanceof Promise ? i : Promise.resolve(i)).then((e) => (n.value = e, n.fallback = !0, n));
1501
- if (i instanceof Promise) throw new s();
1502
- return n.value = i, n.fallback = !0, n;
1503
- };
1504
- });
1505
- function An(e, t) {
1506
- return t === void 0 && (e.issues.length || e.fallback) ? {
1507
- issues: [],
1508
- value: void 0
1509
- } : e;
1510
- }
1511
- var jn = /* @__PURE__ */ o("$ZodOptional", (e, t) => {
1512
- D.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", m(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, void 0]) : void 0), m(e._zod, "pattern", () => {
1513
- let e = t.innerType._zod.pattern;
1514
- return e ? RegExp(`^(${te(e.source)})?$`) : void 0;
1515
- }), e._zod.parse = (e, n) => {
1516
- if (t.innerType._zod.optin === "optional") {
1517
- let r = e.value, i = t.innerType._zod.run(e, n);
1518
- return i instanceof Promise ? i.then((e) => An(e, r)) : An(i, r);
1519
- }
1520
- return e.value === void 0 ? e : t.innerType._zod.run(e, n);
1521
- };
1522
- }), Mn = /* @__PURE__ */ o("$ZodExactOptional", (e, t) => {
1523
- jn.init(e, t), m(e._zod, "values", () => t.innerType._zod.values), m(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (e, n) => t.innerType._zod.run(e, n);
1524
- }), Nn = /* @__PURE__ */ o("$ZodNullable", (e, t) => {
1525
- D.init(e, t), m(e._zod, "optin", () => t.innerType._zod.optin), m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "pattern", () => {
1526
- let e = t.innerType._zod.pattern;
1527
- return e ? RegExp(`^(${te(e.source)}|null)$`) : void 0;
1528
- }), m(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run(e, n);
1529
- }), Pn = /* @__PURE__ */ o("$ZodDefault", (e, t) => {
1530
- D.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
1531
- if (n.direction === "backward") return t.innerType._zod.run(e, n);
1532
- if (e.value === void 0) return e.value = t.defaultValue, e;
1533
- let r = t.innerType._zod.run(e, n);
1534
- return r instanceof Promise ? r.then((e) => Fn(e, t)) : Fn(r, t);
1535
- };
1536
- });
1537
- function Fn(e, t) {
1538
- return e.value === void 0 && (e.value = t.defaultValue), e;
1539
- }
1540
- var In = /* @__PURE__ */ o("$ZodPrefault", (e, t) => {
1541
- D.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => (n.direction === "backward" || e.value === void 0 && (e.value = t.defaultValue), t.innerType._zod.run(e, n));
1542
- }), Ln = /* @__PURE__ */ o("$ZodNonOptional", (e, t) => {
1543
- D.init(e, t), m(e._zod, "values", () => {
1544
- let e = t.innerType._zod.values;
1545
- return e ? new Set([...e].filter((e) => e !== void 0)) : void 0;
1546
- }), e._zod.parse = (n, r) => {
1547
- let i = t.innerType._zod.run(n, r);
1548
- return i instanceof Promise ? i.then((t) => Rn(t, e)) : Rn(i, e);
1549
- };
1550
- });
1551
- function Rn(e, t) {
1552
- return !e.issues.length && e.value === void 0 && e.issues.push({
1553
- code: "invalid_type",
1554
- expected: "nonoptional",
1555
- input: e.value,
1556
- inst: t
1557
- }), e;
1558
- }
1559
- var zn = /* @__PURE__ */ o("$ZodCatch", (e, t) => {
1560
- D.init(e, t), e._zod.optin = "optional", m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
1561
- if (n.direction === "backward") return t.innerType._zod.run(e, n);
1562
- let r = t.innerType._zod.run(e, n);
1563
- return r instanceof Promise ? r.then((r) => (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1564
- ...e,
1565
- error: { issues: r.issues.map((e) => w(e, n, u())) },
1566
- input: e.value
1567
- }), e.issues = [], e.fallback = !0), e)) : (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1568
- ...e,
1569
- error: { issues: r.issues.map((e) => w(e, n, u())) },
1570
- input: e.value
1571
- }), e.issues = [], e.fallback = !0), e);
1572
- };
1573
- }), Bn = /* @__PURE__ */ o("$ZodPipe", (e, t) => {
1574
- D.init(e, t), m(e._zod, "values", () => t.in._zod.values), m(e._zod, "optin", () => t.in._zod.optin), m(e._zod, "optout", () => t.out._zod.optout), m(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (e, n) => {
1575
- if (n.direction === "backward") {
1576
- let r = t.out._zod.run(e, n);
1577
- return r instanceof Promise ? r.then((e) => A(e, t.in, n)) : A(r, t.in, n);
1578
- }
1579
- let r = t.in._zod.run(e, n);
1580
- return r instanceof Promise ? r.then((e) => A(e, t.out, n)) : A(r, t.out, n);
1581
- };
1582
- });
1583
- function A(e, t, n) {
1584
- return e.issues.length ? (e.aborted = !0, e) : t._zod.run({
1585
- value: e.value,
1586
- issues: e.issues,
1587
- fallback: e.fallback
1588
- }, n);
1589
- }
1590
- var Vn = /* @__PURE__ */ o("$ZodReadonly", (e, t) => {
1591
- D.init(e, t), m(e._zod, "propValues", () => t.innerType._zod.propValues), m(e._zod, "values", () => t.innerType._zod.values), m(e._zod, "optin", () => t.innerType?._zod?.optin), m(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (e, n) => {
1592
- if (n.direction === "backward") return t.innerType._zod.run(e, n);
1593
- let r = t.innerType._zod.run(e, n);
1594
- return r instanceof Promise ? r.then(Hn) : Hn(r);
1595
- };
1596
- });
1597
- function Hn(e) {
1598
- return e.value = Object.freeze(e.value), e;
1599
- }
1600
- var Un = /* @__PURE__ */ o("$ZodLazy", (e, t) => {
1601
- D.init(e, t), m(e._zod, "innerType", () => {
1602
- let e = t;
1603
- return e._cachedInner ||= t.getter(), e._cachedInner;
1604
- }), m(e._zod, "pattern", () => e._zod.innerType?._zod?.pattern), m(e._zod, "propValues", () => e._zod.innerType?._zod?.propValues), m(e._zod, "optin", () => e._zod.innerType?._zod?.optin ?? void 0), m(e._zod, "optout", () => e._zod.innerType?._zod?.optout ?? void 0), e._zod.parse = (t, n) => e._zod.innerType._zod.run(t, n);
1605
- }), Wn = /* @__PURE__ */ o("$ZodCustom", (e, t) => {
1606
- E.init(e, t), D.init(e, t), e._zod.parse = (e, t) => e, e._zod.check = (n) => {
1607
- let r = n.value, i = t.fn(r);
1608
- if (i instanceof Promise) return i.then((t) => Gn(t, n, r, e));
1609
- Gn(i, n, r, e);
1610
- };
1611
- });
1612
- function Gn(e, t, n, r) {
1613
- if (!e) {
1614
- let e = {
1615
- code: "custom",
1616
- input: n,
1617
- inst: r,
1618
- path: [...r._zod.def.path ?? []],
1619
- continue: !r._zod.def.abort
1620
- };
1621
- r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(T(e));
1622
- }
1623
- }
1624
- //#endregion
1625
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
1626
- var Kn, qn = class {
1627
- constructor() {
1628
- this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1629
- }
1630
- add(e, ...t) {
1631
- let n = t[0];
1632
- return this._map.set(e, n), n && typeof n == "object" && "id" in n && this._idmap.set(n.id, e), this;
1633
- }
1634
- clear() {
1635
- return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1636
- }
1637
- remove(e) {
1638
- let t = this._map.get(e);
1639
- return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(e), this;
1640
- }
1641
- get(e) {
1642
- let t = e._zod.parent;
1643
- if (t) {
1644
- let n = { ...this.get(t) ?? {} };
1645
- delete n.id;
1646
- let r = {
1647
- ...n,
1648
- ...this._map.get(e)
1649
- };
1650
- return Object.keys(r).length ? r : void 0;
1651
- }
1652
- return this._map.get(e);
1653
- }
1654
- has(e) {
1655
- return this._map.has(e);
1656
- }
1657
- };
1658
- function Jn() {
1659
- return new qn();
1660
- }
1661
- (Kn = globalThis).__zod_globalRegistry ?? (Kn.__zod_globalRegistry = Jn());
1662
- var j = globalThis.__zod_globalRegistry;
1663
- //#endregion
1664
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
1665
- /* @__NO_SIDE_EFFECTS__ */
1666
- function Yn(e, t) {
1667
- return new e({
1668
- type: "string",
1669
- ...x(t)
1670
- });
1671
- }
1672
- /* @__NO_SIDE_EFFECTS__ */
1673
- function Xn(e, t) {
1674
- return new e({
1675
- type: "string",
1676
- format: "email",
1677
- check: "string_format",
1678
- abort: !1,
1679
- ...x(t)
1680
- });
1681
- }
1682
- /* @__NO_SIDE_EFFECTS__ */
1683
- function Zn(e, t) {
1684
- return new e({
1685
- type: "string",
1686
- format: "guid",
1687
- check: "string_format",
1688
- abort: !1,
1689
- ...x(t)
1690
- });
1691
- }
1692
- /* @__NO_SIDE_EFFECTS__ */
1693
- function Qn(e, t) {
1694
- return new e({
1695
- type: "string",
1696
- format: "uuid",
1697
- check: "string_format",
1698
- abort: !1,
1699
- ...x(t)
1700
- });
1701
- }
1702
- /* @__NO_SIDE_EFFECTS__ */
1703
- function $n(e, t) {
1704
- return new e({
1705
- type: "string",
1706
- format: "uuid",
1707
- check: "string_format",
1708
- abort: !1,
1709
- version: "v4",
1710
- ...x(t)
1711
- });
1712
- }
1713
- /* @__NO_SIDE_EFFECTS__ */
1714
- function er(e, t) {
1715
- return new e({
1716
- type: "string",
1717
- format: "uuid",
1718
- check: "string_format",
1719
- abort: !1,
1720
- version: "v6",
1721
- ...x(t)
1722
- });
1723
- }
1724
- /* @__NO_SIDE_EFFECTS__ */
1725
- function tr(e, t) {
1726
- return new e({
1727
- type: "string",
1728
- format: "uuid",
1729
- check: "string_format",
1730
- abort: !1,
1731
- version: "v7",
1732
- ...x(t)
1733
- });
1734
- }
1735
- /* @__NO_SIDE_EFFECTS__ */
1736
- function nr(e, t) {
1737
- return new e({
1738
- type: "string",
1739
- format: "url",
1740
- check: "string_format",
1741
- abort: !1,
1742
- ...x(t)
1743
- });
1744
- }
1745
- /* @__NO_SIDE_EFFECTS__ */
1746
- function rr(e, t) {
1747
- return new e({
1748
- type: "string",
1749
- format: "emoji",
1750
- check: "string_format",
1751
- abort: !1,
1752
- ...x(t)
1753
- });
1754
- }
1755
- /* @__NO_SIDE_EFFECTS__ */
1756
- function ir(e, t) {
1757
- return new e({
1758
- type: "string",
1759
- format: "nanoid",
1760
- check: "string_format",
1761
- abort: !1,
1762
- ...x(t)
1763
- });
1764
- }
1765
- /* @__NO_SIDE_EFFECTS__ */
1766
- function ar(e, t) {
1767
- return new e({
1768
- type: "string",
1769
- format: "cuid",
1770
- check: "string_format",
1771
- abort: !1,
1772
- ...x(t)
1773
- });
1774
- }
1775
- /* @__NO_SIDE_EFFECTS__ */
1776
- function or(e, t) {
1777
- return new e({
1778
- type: "string",
1779
- format: "cuid2",
1780
- check: "string_format",
1781
- abort: !1,
1782
- ...x(t)
1783
- });
1784
- }
1785
- /* @__NO_SIDE_EFFECTS__ */
1786
- function sr(e, t) {
1787
- return new e({
1788
- type: "string",
1789
- format: "ulid",
1790
- check: "string_format",
1791
- abort: !1,
1792
- ...x(t)
1793
- });
1794
- }
1795
- /* @__NO_SIDE_EFFECTS__ */
1796
- function cr(e, t) {
1797
- return new e({
1798
- type: "string",
1799
- format: "xid",
1800
- check: "string_format",
1801
- abort: !1,
1802
- ...x(t)
1803
- });
1804
- }
1805
- /* @__NO_SIDE_EFFECTS__ */
1806
- function lr(e, t) {
1807
- return new e({
1808
- type: "string",
1809
- format: "ksuid",
1810
- check: "string_format",
1811
- abort: !1,
1812
- ...x(t)
1813
- });
1814
- }
1815
- /* @__NO_SIDE_EFFECTS__ */
1816
- function ur(e, t) {
1817
- return new e({
1818
- type: "string",
1819
- format: "ipv4",
1820
- check: "string_format",
1821
- abort: !1,
1822
- ...x(t)
1823
- });
1824
- }
1825
- /* @__NO_SIDE_EFFECTS__ */
1826
- function dr(e, t) {
1827
- return new e({
1828
- type: "string",
1829
- format: "ipv6",
1830
- check: "string_format",
1831
- abort: !1,
1832
- ...x(t)
1833
- });
1834
- }
1835
- /* @__NO_SIDE_EFFECTS__ */
1836
- function fr(e, t) {
1837
- return new e({
1838
- type: "string",
1839
- format: "cidrv4",
1840
- check: "string_format",
1841
- abort: !1,
1842
- ...x(t)
1843
- });
1844
- }
1845
- /* @__NO_SIDE_EFFECTS__ */
1846
- function pr(e, t) {
1847
- return new e({
1848
- type: "string",
1849
- format: "cidrv6",
1850
- check: "string_format",
1851
- abort: !1,
1852
- ...x(t)
1853
- });
1854
- }
1855
- /* @__NO_SIDE_EFFECTS__ */
1856
- function mr(e, t) {
1857
- return new e({
1858
- type: "string",
1859
- format: "base64",
1860
- check: "string_format",
1861
- abort: !1,
1862
- ...x(t)
1863
- });
1864
- }
1865
- /* @__NO_SIDE_EFFECTS__ */
1866
- function hr(e, t) {
1867
- return new e({
1868
- type: "string",
1869
- format: "base64url",
1870
- check: "string_format",
1871
- abort: !1,
1872
- ...x(t)
1873
- });
1874
- }
1875
- /* @__NO_SIDE_EFFECTS__ */
1876
- function gr(e, t) {
1877
- return new e({
1878
- type: "string",
1879
- format: "e164",
1880
- check: "string_format",
1881
- abort: !1,
1882
- ...x(t)
1883
- });
1884
- }
1885
- /* @__NO_SIDE_EFFECTS__ */
1886
- function _r(e, t) {
1887
- return new e({
1888
- type: "string",
1889
- format: "jwt",
1890
- check: "string_format",
1891
- abort: !1,
1892
- ...x(t)
1893
- });
1894
- }
1895
- /* @__NO_SIDE_EFFECTS__ */
1896
- function vr(e, t) {
1897
- return new e({
1898
- type: "string",
1899
- format: "datetime",
1900
- check: "string_format",
1901
- offset: !1,
1902
- local: !1,
1903
- precision: null,
1904
- ...x(t)
1905
- });
1906
- }
1907
- /* @__NO_SIDE_EFFECTS__ */
1908
- function yr(e, t) {
1909
- return new e({
1910
- type: "string",
1911
- format: "date",
1912
- check: "string_format",
1913
- ...x(t)
1914
- });
1915
- }
1916
- /* @__NO_SIDE_EFFECTS__ */
1917
- function br(e, t) {
1918
- return new e({
1919
- type: "string",
1920
- format: "time",
1921
- check: "string_format",
1922
- precision: null,
1923
- ...x(t)
1924
- });
1925
- }
1926
- /* @__NO_SIDE_EFFECTS__ */
1927
- function xr(e, t) {
1928
- return new e({
1929
- type: "string",
1930
- format: "duration",
1931
- check: "string_format",
1932
- ...x(t)
1933
- });
1934
- }
1935
- /* @__NO_SIDE_EFFECTS__ */
1936
- function Sr(e, t) {
1937
- return new e({
1938
- type: "number",
1939
- checks: [],
1940
- ...x(t)
1941
- });
1942
- }
1943
- /* @__NO_SIDE_EFFECTS__ */
1944
- function Cr(e, t) {
1945
- return new e({
1946
- type: "number",
1947
- check: "number_format",
1948
- abort: !1,
1949
- format: "safeint",
1950
- ...x(t)
1951
- });
1952
- }
1953
- /* @__NO_SIDE_EFFECTS__ */
1954
- function wr(e, t) {
1955
- return new e({
1956
- type: "boolean",
1957
- ...x(t)
1958
- });
1959
- }
1960
- /* @__NO_SIDE_EFFECTS__ */
1961
- function Tr(e) {
1962
- return new e({ type: "unknown" });
1963
- }
1964
- /* @__NO_SIDE_EFFECTS__ */
1965
- function Er(e, t) {
1966
- return new e({
1967
- type: "never",
1968
- ...x(t)
1969
- });
1970
- }
1971
- /* @__NO_SIDE_EFFECTS__ */
1972
- function Dr(e, t) {
1973
- return new yt({
1974
- check: "less_than",
1975
- ...x(t),
1976
- value: e,
1977
- inclusive: !1
1978
- });
1979
- }
1980
- /* @__NO_SIDE_EFFECTS__ */
1981
- function Or(e, t) {
1982
- return new yt({
1983
- check: "less_than",
1984
- ...x(t),
1985
- value: e,
1986
- inclusive: !0
1987
- });
1988
- }
1989
- /* @__NO_SIDE_EFFECTS__ */
1990
- function kr(e, t) {
1991
- return new bt({
1992
- check: "greater_than",
1993
- ...x(t),
1994
- value: e,
1995
- inclusive: !1
1996
- });
1997
- }
1998
- /* @__NO_SIDE_EFFECTS__ */
1999
- function Ar(e, t) {
2000
- return new bt({
2001
- check: "greater_than",
2002
- ...x(t),
2003
- value: e,
2004
- inclusive: !0
2005
- });
2006
- }
2007
- /* @__NO_SIDE_EFFECTS__ */
2008
- function jr(e, t) {
2009
- return new xt({
2010
- check: "multiple_of",
2011
- ...x(t),
2012
- value: e
2013
- });
2014
- }
2015
- /* @__NO_SIDE_EFFECTS__ */
2016
- function Mr(e, t) {
2017
- return new Ct({
2018
- check: "max_length",
2019
- ...x(t),
2020
- maximum: e
2021
- });
2022
- }
2023
- /* @__NO_SIDE_EFFECTS__ */
2024
- function M(e, t) {
2025
- return new wt({
2026
- check: "min_length",
2027
- ...x(t),
2028
- minimum: e
2029
- });
2030
- }
2031
- /* @__NO_SIDE_EFFECTS__ */
2032
- function Nr(e, t) {
2033
- return new Tt({
2034
- check: "length_equals",
2035
- ...x(t),
2036
- length: e
2037
- });
2038
- }
2039
- /* @__NO_SIDE_EFFECTS__ */
2040
- function Pr(e, t) {
2041
- return new Dt({
2042
- check: "string_format",
2043
- format: "regex",
2044
- ...x(t),
2045
- pattern: e
2046
- });
2047
- }
2048
- /* @__NO_SIDE_EFFECTS__ */
2049
- function Fr(e) {
2050
- return new Ot({
2051
- check: "string_format",
2052
- format: "lowercase",
2053
- ...x(e)
2054
- });
2055
- }
2056
- /* @__NO_SIDE_EFFECTS__ */
2057
- function Ir(e) {
2058
- return new kt({
2059
- check: "string_format",
2060
- format: "uppercase",
2061
- ...x(e)
2062
- });
2063
- }
2064
- /* @__NO_SIDE_EFFECTS__ */
2065
- function Lr(e, t) {
2066
- return new At({
2067
- check: "string_format",
2068
- format: "includes",
2069
- ...x(t),
2070
- includes: e
2071
- });
2072
- }
2073
- /* @__NO_SIDE_EFFECTS__ */
2074
- function Rr(e, t) {
2075
- return new jt({
2076
- check: "string_format",
2077
- format: "starts_with",
2078
- ...x(t),
2079
- prefix: e
2080
- });
2081
- }
2082
- /* @__NO_SIDE_EFFECTS__ */
2083
- function zr(e, t) {
2084
- return new Mt({
2085
- check: "string_format",
2086
- format: "ends_with",
2087
- ...x(t),
2088
- suffix: e
2089
- });
2090
- }
2091
- /* @__NO_SIDE_EFFECTS__ */
2092
- function N(e) {
2093
- return new Nt({
2094
- check: "overwrite",
2095
- tx: e
2096
- });
2097
- }
2098
- /* @__NO_SIDE_EFFECTS__ */
2099
- function Br(e) {
2100
- return /* @__PURE__ */ N((t) => t.normalize(e));
2101
- }
2102
- /* @__NO_SIDE_EFFECTS__ */
2103
- function Vr() {
2104
- return /* @__PURE__ */ N((e) => e.trim());
2105
- }
2106
- /* @__NO_SIDE_EFFECTS__ */
2107
- function Hr() {
2108
- return /* @__PURE__ */ N((e) => e.toLowerCase());
2109
- }
2110
- /* @__NO_SIDE_EFFECTS__ */
2111
- function Ur() {
2112
- return /* @__PURE__ */ N((e) => e.toUpperCase());
2113
- }
2114
- /* @__NO_SIDE_EFFECTS__ */
2115
- function Wr() {
2116
- return /* @__PURE__ */ N((e) => ae(e));
2117
- }
2118
- /* @__NO_SIDE_EFFECTS__ */
2119
- function Gr(e, t, n) {
2120
- return new e({
2121
- type: "array",
2122
- element: t,
2123
- ...x(n)
2124
- });
2125
- }
2126
- /* @__NO_SIDE_EFFECTS__ */
2127
- function Kr(e, t, n) {
2128
- let r = x(n);
2129
- return r.abort ??= !0, new e({
2130
- type: "custom",
2131
- check: "custom",
2132
- fn: t,
2133
- ...r
2134
- });
2135
- }
2136
- /* @__NO_SIDE_EFFECTS__ */
2137
- function qr(e, t, n) {
2138
- return new e({
2139
- type: "custom",
2140
- check: "custom",
2141
- fn: t,
2142
- ...x(n)
2143
- });
2144
- }
2145
- /* @__NO_SIDE_EFFECTS__ */
2146
- function Jr(e, t) {
2147
- let n = /* @__PURE__ */ Yr((t) => (t.addIssue = (e) => {
2148
- if (typeof e == "string") t.issues.push(T(e, t.value, n._zod.def));
2149
- else {
2150
- let r = e;
2151
- r.fatal && (r.continue = !1), r.code ??= "custom", r.input ??= t.value, r.inst ??= n, r.continue ??= !n._zod.def.abort, t.issues.push(T(r));
2152
- }
2153
- }, e(t.value, t)), t);
2154
- return n;
2155
- }
2156
- /* @__NO_SIDE_EFFECTS__ */
2157
- function Yr(e, t) {
2158
- let n = new E({
2159
- check: "custom",
2160
- ...x(t)
2161
- });
2162
- return n._zod.check = e, n;
2163
- }
2164
- //#endregion
2165
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
2166
- function Xr(e) {
2167
- let t = e?.target ?? "draft-2020-12";
2168
- return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
2169
- processors: e.processors ?? {},
2170
- metadataRegistry: e?.metadata ?? j,
2171
- target: t,
2172
- unrepresentable: e?.unrepresentable ?? "throw",
2173
- override: e?.override ?? (() => {}),
2174
- io: e?.io ?? "output",
2175
- counter: 0,
2176
- seen: /* @__PURE__ */ new Map(),
2177
- cycles: e?.cycles ?? "ref",
2178
- reused: e?.reused ?? "inline",
2179
- external: e?.external ?? void 0
2180
- };
2181
- }
2182
- function P(e, t, n = {
2183
- path: [],
2184
- schemaPath: []
2185
- }) {
2186
- var r;
2187
- let i = e._zod.def, a = t.seen.get(e);
2188
- if (a) return a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema;
2189
- let o = {
2190
- schema: {},
2191
- count: 1,
2192
- cycle: void 0,
2193
- path: n.path
2194
- };
2195
- t.seen.set(e, o);
2196
- let s = e._zod.toJSONSchema?.();
2197
- if (s) o.schema = s;
2198
- else {
2199
- let r = {
2200
- ...n,
2201
- schemaPath: [...n.schemaPath, e],
2202
- path: n.path
2203
- };
2204
- if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r);
2205
- else {
2206
- let n = o.schema, a = t.processors[i.type];
2207
- if (!a) throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
2208
- a(e, t, n, r);
2209
- }
2210
- let a = e._zod.parent;
2211
- a && (o.ref ||= a, P(a, t, r), t.seen.get(a).isParent = !0);
2212
- }
2213
- let c = t.metadataRegistry.get(e);
2214
- return c && Object.assign(o.schema, c), t.io === "input" && F(e) && (delete o.schema.examples, delete o.schema.default), t.io === "input" && "_prefault" in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema;
2215
- }
2216
- function Zr(e, t) {
2217
- let n = e.seen.get(t);
2218
- if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
2219
- let r = /* @__PURE__ */ new Map();
2220
- for (let t of e.seen.entries()) {
2221
- let n = e.metadataRegistry.get(t[0])?.id;
2222
- if (n) {
2223
- let e = r.get(n);
2224
- if (e && e !== t[0]) throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2225
- r.set(n, t[0]);
2226
- }
2227
- }
2228
- let i = (t) => {
2229
- let r = e.target === "draft-2020-12" ? "$defs" : "definitions";
2230
- if (e.external) {
2231
- let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e);
2232
- if (n) return { ref: i(n) };
2233
- let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`;
2234
- return t[1].defId = a, {
2235
- defId: a,
2236
- ref: `${i("__shared")}#/${r}/${a}`
2237
- };
2238
- }
2239
- if (t[1] === n) return { ref: "#" };
2240
- let i = `#/${r}/`, a = t[1].schema.id ?? `__schema${e.counter++}`;
2241
- return {
2242
- defId: a,
2243
- ref: i + a
2244
- };
2245
- }, a = (e) => {
2246
- if (e[1].schema.$ref) return;
2247
- let t = e[1], { ref: n, defId: r } = i(e);
2248
- t.def = { ...t.schema }, r && (t.defId = r);
2249
- let a = t.schema;
2250
- for (let e in a) delete a[e];
2251
- a.$ref = n;
2252
- };
2253
- if (e.cycles === "throw") for (let t of e.seen.entries()) {
2254
- let e = t[1];
2255
- if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
2256
-
2257
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2258
- }
2259
- for (let n of e.seen.entries()) {
2260
- let r = n[1];
2261
- if (t === n[0]) {
2262
- a(n);
2263
- continue;
2264
- }
2265
- if (e.external) {
2266
- let r = e.external.registry.get(n[0])?.id;
2267
- if (t !== n[0] && r) {
2268
- a(n);
2269
- continue;
2270
- }
2271
- }
2272
- if (e.metadataRegistry.get(n[0])?.id) {
2273
- a(n);
2274
- continue;
2275
- }
2276
- if (r.cycle) {
2277
- a(n);
2278
- continue;
2279
- }
2280
- if (r.count > 1 && e.reused === "ref") {
2281
- a(n);
2282
- continue;
2283
- }
2284
- }
2285
- }
2286
- function Qr(e, t) {
2287
- let n = e.seen.get(t);
2288
- if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
2289
- let r = (t) => {
2290
- let n = e.seen.get(t);
2291
- if (n.ref === null) return;
2292
- let i = n.def ?? n.schema, a = { ...i }, o = n.ref;
2293
- if (n.ref = null, o) {
2294
- r(o);
2295
- let n = e.seen.get(o), s = n.schema;
2296
- if (s.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (i.allOf = i.allOf ?? [], i.allOf.push(s)) : Object.assign(i, s), Object.assign(i, a), t._zod.parent === o) for (let e in i) e === "$ref" || e === "allOf" || e in a || delete i[e];
2297
- if (s.$ref && n.def) for (let e in i) e === "$ref" || e === "allOf" || e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e];
2298
- }
2299
- let s = t._zod.parent;
2300
- if (s && s !== o) {
2301
- r(s);
2302
- let t = e.seen.get(s);
2303
- if (t?.schema.$ref && (i.$ref = t.schema.$ref, t.def)) for (let e in i) e === "$ref" || e === "allOf" || e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e];
2304
- }
2305
- e.override({
2306
- zodSchema: t,
2307
- jsonSchema: i,
2308
- path: n.path ?? []
2309
- });
2310
- };
2311
- for (let t of [...e.seen.entries()].reverse()) r(t[0]);
2312
- let i = {};
2313
- if (e.target === "draft-2020-12" ? i.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? i.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? i.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
2314
- let n = e.external.registry.get(t)?.id;
2315
- if (!n) throw Error("Schema is missing an `id` property");
2316
- i.$id = e.external.uri(n);
2317
- }
2318
- Object.assign(i, n.def ?? n.schema);
2319
- let a = e.metadataRegistry.get(t)?.id;
2320
- a !== void 0 && i.id === a && delete i.id;
2321
- let o = e.external?.defs ?? {};
2322
- for (let t of e.seen.entries()) {
2323
- let e = t[1];
2324
- e.def && e.defId && (e.def.id === e.defId && delete e.def.id, o[e.defId] = e.def);
2325
- }
2326
- e.external || Object.keys(o).length > 0 && (e.target === "draft-2020-12" ? i.$defs = o : i.definitions = o);
2327
- try {
2328
- let n = JSON.parse(JSON.stringify(i));
2329
- return Object.defineProperty(n, "~standard", {
2330
- value: {
2331
- ...t["~standard"],
2332
- jsonSchema: {
2333
- input: I(t, "input", e.processors),
2334
- output: I(t, "output", e.processors)
2335
- }
2336
- },
2337
- enumerable: !1,
2338
- writable: !1
2339
- }), n;
2340
- } catch {
2341
- throw Error("Error converting schema to JSON.");
2342
- }
2343
- }
2344
- function F(e, t) {
2345
- let n = t ?? { seen: /* @__PURE__ */ new Set() };
2346
- if (n.seen.has(e)) return !1;
2347
- n.seen.add(e);
2348
- let r = e._zod.def;
2349
- if (r.type === "transform") return !0;
2350
- if (r.type === "array") return F(r.element, n);
2351
- if (r.type === "set") return F(r.valueType, n);
2352
- if (r.type === "lazy") return F(r.getter(), n);
2353
- if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault") return F(r.innerType, n);
2354
- if (r.type === "intersection") return F(r.left, n) || F(r.right, n);
2355
- if (r.type === "record" || r.type === "map") return F(r.keyType, n) || F(r.valueType, n);
2356
- if (r.type === "pipe") return e._zod.traits.has("$ZodCodec") ? !0 : F(r.in, n) || F(r.out, n);
2357
- if (r.type === "object") {
2358
- for (let e in r.shape) if (F(r.shape[e], n)) return !0;
2359
- return !1;
2360
- }
2361
- if (r.type === "union") {
2362
- for (let e of r.options) if (F(e, n)) return !0;
2363
- return !1;
2364
- }
2365
- if (r.type === "tuple") {
2366
- for (let e of r.items) if (F(e, n)) return !0;
2367
- return !!(r.rest && F(r.rest, n));
2368
- }
2369
- return !1;
2370
- }
2371
- var $r = (e, t = {}) => (n) => {
2372
- let r = Xr({
2373
- ...n,
2374
- processors: t
2375
- });
2376
- return P(e, r), Zr(r, e), Qr(r, e);
2377
- }, I = (e, t, n = {}) => (r) => {
2378
- let { libraryOptions: i, target: a } = r ?? {}, o = Xr({
2379
- ...i ?? {},
2380
- target: a,
2381
- io: t,
2382
- processors: n
2383
- });
2384
- return P(e, o), Zr(o, e), Qr(o, e);
2385
- }, ei = {
2386
- guid: "uuid",
2387
- url: "uri",
2388
- datetime: "date-time",
2389
- json_string: "json-string",
2390
- regex: ""
2391
- }, ti = (e, t, n, r) => {
2392
- let i = n;
2393
- i.type = "string";
2394
- let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l } = e._zod.bag;
2395
- if (typeof a == "number" && (i.minLength = a), typeof o == "number" && (i.maxLength = o), s && (i.format = ei[s] ?? s, i.format === "" && delete i.format, s === "time" && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) {
2396
- let e = [...c];
2397
- e.length === 1 ? i.pattern = e[0].source : e.length > 1 && (i.allOf = [...e.map((e) => ({
2398
- ...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
2399
- pattern: e.source
2400
- }))]);
2401
- }
2402
- }, ni = (e, t, n, r) => {
2403
- let i = n, { minimum: a, maximum: o, format: s, multipleOf: c, exclusiveMaximum: l, exclusiveMinimum: u } = e._zod.bag;
2404
- typeof s == "string" && s.includes("int") ? i.type = "integer" : i.type = "number";
2405
- let d = typeof u == "number" && u >= (a ?? -Infinity), f = typeof l == "number" && l <= (o ?? Infinity), p = t.target === "draft-04" || t.target === "openapi-3.0";
2406
- d ? p ? (i.minimum = u, i.exclusiveMinimum = !0) : i.exclusiveMinimum = u : typeof a == "number" && (i.minimum = a), f ? p ? (i.maximum = l, i.exclusiveMaximum = !0) : i.exclusiveMaximum = l : typeof o == "number" && (i.maximum = o), typeof c == "number" && (i.multipleOf = c);
2407
- }, ri = (e, t, n, r) => {
2408
- n.type = "boolean";
2409
- }, ii = (e, t, n, r) => {
2410
- n.not = {};
2411
- }, ai = (e, t, n, r) => {
2412
- let i = e._zod.def, a = d(i.entries);
2413
- a.every((e) => typeof e == "number") && (n.type = "number"), a.every((e) => typeof e == "string") && (n.type = "string"), n.enum = a;
2414
- }, oi = (e, t, n, r) => {
2415
- let i = e._zod.def, a = [];
2416
- for (let e of i.values) if (e === void 0) {
2417
- if (t.unrepresentable === "throw") throw Error("Literal `undefined` cannot be represented in JSON Schema");
2418
- } else if (typeof e == "bigint") {
2419
- if (t.unrepresentable === "throw") throw Error("BigInt literals cannot be represented in JSON Schema");
2420
- a.push(Number(e));
2421
- } else a.push(e);
2422
- if (a.length !== 0) if (a.length === 1) {
2423
- let e = a[0];
2424
- n.type = e === null ? "null" : typeof e, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [e] : n.const = e;
2425
- } else a.every((e) => typeof e == "number") && (n.type = "number"), a.every((e) => typeof e == "string") && (n.type = "string"), a.every((e) => typeof e == "boolean") && (n.type = "boolean"), a.every((e) => e === null) && (n.type = "null"), n.enum = a;
2426
- }, si = (e, t, n, r) => {
2427
- if (t.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
2428
- }, ci = (e, t, n, r) => {
2429
- if (t.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
2430
- }, li = (e, t, n, r) => {
2431
- let i = n, a = e._zod.def, { minimum: o, maximum: s } = e._zod.bag;
2432
- typeof o == "number" && (i.minItems = o), typeof s == "number" && (i.maxItems = s), i.type = "array", i.items = P(a.element, t, {
2433
- ...r,
2434
- path: [...r.path, "items"]
2435
- });
2436
- }, ui = (e, t, n, r) => {
2437
- let i = n, a = e._zod.def;
2438
- i.type = "object", i.properties = {};
2439
- let o = a.shape;
2440
- for (let e in o) i.properties[e] = P(o[e], t, {
2441
- ...r,
2442
- path: [
2443
- ...r.path,
2444
- "properties",
2445
- e
2446
- ]
2447
- });
2448
- let s = new Set(Object.keys(o)), c = new Set([...s].filter((e) => {
2449
- let n = a.shape[e]._zod;
2450
- return t.io === "input" ? n.optin === void 0 : n.optout === void 0;
2451
- }));
2452
- c.size > 0 && (i.required = Array.from(c)), a.catchall?._zod.def.type === "never" ? i.additionalProperties = !1 : a.catchall ? a.catchall && (i.additionalProperties = P(a.catchall, t, {
2453
- ...r,
2454
- path: [...r.path, "additionalProperties"]
2455
- })) : t.io === "output" && (i.additionalProperties = !1);
2456
- }, di = (e, t, n, r) => {
2457
- let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => P(e, t, {
2458
- ...r,
2459
- path: [
2460
- ...r.path,
2461
- a ? "oneOf" : "anyOf",
2462
- n
2463
- ]
2464
- }));
2465
- a ? n.oneOf = o : n.anyOf = o;
2466
- }, fi = (e, t, n, r) => {
2467
- let i = e._zod.def, a = P(i.left, t, {
2468
- ...r,
2469
- path: [
2470
- ...r.path,
2471
- "allOf",
2472
- 0
2473
- ]
2474
- }), o = P(i.right, t, {
2475
- ...r,
2476
- path: [
2477
- ...r.path,
2478
- "allOf",
2479
- 1
2480
- ]
2481
- }), s = (e) => "allOf" in e && Object.keys(e).length === 1;
2482
- n.allOf = [...s(a) ? a.allOf : [a], ...s(o) ? o.allOf : [o]];
2483
- }, pi = (e, t, n, r) => {
2484
- let i = n, a = e._zod.def;
2485
- i.type = "object";
2486
- let o = a.keyType, s = o._zod.bag?.patterns;
2487
- if (a.mode === "loose" && s && s.size > 0) {
2488
- let e = P(a.valueType, t, {
2489
- ...r,
2490
- path: [
2491
- ...r.path,
2492
- "patternProperties",
2493
- "*"
2494
- ]
2495
- });
2496
- i.patternProperties = {};
2497
- for (let t of s) i.patternProperties[t.source] = e;
2498
- } else (t.target === "draft-07" || t.target === "draft-2020-12") && (i.propertyNames = P(a.keyType, t, {
2499
- ...r,
2500
- path: [...r.path, "propertyNames"]
2501
- })), i.additionalProperties = P(a.valueType, t, {
2502
- ...r,
2503
- path: [...r.path, "additionalProperties"]
2504
- });
2505
- let c = o._zod.values;
2506
- if (c) {
2507
- let e = [...c].filter((e) => typeof e == "string" || typeof e == "number");
2508
- e.length > 0 && (i.required = e);
2509
- }
2510
- }, mi = (e, t, n, r) => {
2511
- let i = e._zod.def, a = P(i.innerType, t, r), o = t.seen.get(e);
2512
- t.target === "openapi-3.0" ? (o.ref = i.innerType, n.nullable = !0) : n.anyOf = [a, { type: "null" }];
2513
- }, hi = (e, t, n, r) => {
2514
- let i = e._zod.def;
2515
- P(i.innerType, t, r);
2516
- let a = t.seen.get(e);
2517
- a.ref = i.innerType;
2518
- }, gi = (e, t, n, r) => {
2519
- let i = e._zod.def;
2520
- P(i.innerType, t, r);
2521
- let a = t.seen.get(e);
2522
- a.ref = i.innerType, n.default = JSON.parse(JSON.stringify(i.defaultValue));
2523
- }, _i = (e, t, n, r) => {
2524
- let i = e._zod.def;
2525
- P(i.innerType, t, r);
2526
- let a = t.seen.get(e);
2527
- a.ref = i.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
2528
- }, vi = (e, t, n, r) => {
2529
- let i = e._zod.def;
2530
- P(i.innerType, t, r);
2531
- let a = t.seen.get(e);
2532
- a.ref = i.innerType;
2533
- let o;
2534
- try {
2535
- o = i.catchValue(void 0);
2536
- } catch {
2537
- throw Error("Dynamic catch values are not supported in JSON Schema");
2538
- }
2539
- n.default = o;
2540
- }, yi = (e, t, n, r) => {
2541
- let i = e._zod.def, a = i.in._zod.traits.has("$ZodTransform"), o = t.io === "input" ? a ? i.out : i.in : i.out;
2542
- P(o, t, r);
2543
- let s = t.seen.get(e);
2544
- s.ref = o;
2545
- }, bi = (e, t, n, r) => {
2546
- let i = e._zod.def;
2547
- P(i.innerType, t, r);
2548
- let a = t.seen.get(e);
2549
- a.ref = i.innerType, n.readOnly = !0;
2550
- }, xi = (e, t, n, r) => {
2551
- let i = e._zod.def;
2552
- P(i.innerType, t, r);
2553
- let a = t.seen.get(e);
2554
- a.ref = i.innerType;
2555
- }, Si = (e, t, n, r) => {
2556
- let i = e._zod.innerType;
2557
- P(i, t, r);
2558
- let a = t.seen.get(e);
2559
- a.ref = i;
2560
- }, Ci = /* @__PURE__ */ o("ZodISODateTime", (e, t) => {
2561
- Jt.init(e, t), V.init(e, t);
2562
- });
2563
- function wi(e) {
2564
- return /* @__PURE__ */ vr(Ci, e);
2565
- }
2566
- var Ti = /* @__PURE__ */ o("ZodISODate", (e, t) => {
2567
- Yt.init(e, t), V.init(e, t);
2568
- });
2569
- function Ei(e) {
2570
- return /* @__PURE__ */ yr(Ti, e);
2571
- }
2572
- var Di = /* @__PURE__ */ o("ZodISOTime", (e, t) => {
2573
- Xt.init(e, t), V.init(e, t);
2574
- });
2575
- function Oi(e) {
2576
- return /* @__PURE__ */ br(Di, e);
2577
- }
2578
- var ki = /* @__PURE__ */ o("ZodISODuration", (e, t) => {
2579
- Zt.init(e, t), V.init(e, t);
2580
- });
2581
- function Ai(e) {
2582
- return /* @__PURE__ */ xr(ki, e);
2583
- }
2584
- var L = /* @__PURE__ */ o("ZodError", (e, t) => {
2585
- Ce.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
2586
- format: { value: (t) => Ee(e, t) },
2587
- flatten: { value: (t) => Te(e, t) },
2588
- addIssue: { value: (t) => {
2589
- e.issues.push(t), e.message = JSON.stringify(e.issues, f, 2);
2590
- } },
2591
- addIssues: { value: (t) => {
2592
- e.issues.push(...t), e.message = JSON.stringify(e.issues, f, 2);
2593
- } },
2594
- isEmpty: { get() {
2595
- return e.issues.length === 0;
2596
- } }
2597
- });
2598
- }, { Parent: Error }), ji = /* @__PURE__ */ De(L), Mi = /* @__PURE__ */ Oe(L), Ni = /* @__PURE__ */ ke(L), Pi = /* @__PURE__ */ je(L), Fi = /* @__PURE__ */ Ne(L), Ii = /* @__PURE__ */ Pe(L), Li = /* @__PURE__ */ Fe(L), Ri = /* @__PURE__ */ Ie(L), zi = /* @__PURE__ */ Le(L), Bi = /* @__PURE__ */ Re(L), Vi = /* @__PURE__ */ ze(L), Hi = /* @__PURE__ */ Be(L), Ui = /* @__PURE__ */ new WeakMap();
2599
- function R(e, t, n) {
2600
- let r = Object.getPrototypeOf(e), i = Ui.get(r);
2601
- if (i || (i = /* @__PURE__ */ new Set(), Ui.set(r, i)), !i.has(t)) {
2602
- i.add(t);
2603
- for (let e in n) {
2604
- let t = n[e];
2605
- Object.defineProperty(r, e, {
2606
- configurable: !0,
2607
- enumerable: !1,
2608
- get() {
2609
- let n = t.bind(this);
2610
- return Object.defineProperty(this, e, {
2611
- configurable: !0,
2612
- writable: !0,
2613
- enumerable: !0,
2614
- value: n
2615
- }), n;
2616
- },
2617
- set(t) {
2618
- Object.defineProperty(this, e, {
2619
- configurable: !0,
2620
- writable: !0,
2621
- enumerable: !0,
2622
- value: t
2623
- });
2624
- }
2625
- });
2626
- }
2627
- }
2628
- }
2629
- var z = /* @__PURE__ */ o("ZodType", (e, t) => (D.init(e, t), Object.assign(e["~standard"], { jsonSchema: {
2630
- input: I(e, "input"),
2631
- output: I(e, "output")
2632
- } }), e.toJSONSchema = $r(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (t, n) => ji(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => Ni(e, t, n), e.parseAsync = async (t, n) => Mi(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => Pi(e, t, n), e.spa = e.safeParseAsync, e.encode = (t, n) => Fi(e, t, n), e.decode = (t, n) => Ii(e, t, n), e.encodeAsync = async (t, n) => Li(e, t, n), e.decodeAsync = async (t, n) => Ri(e, t, n), e.safeEncode = (t, n) => zi(e, t, n), e.safeDecode = (t, n) => Bi(e, t, n), e.safeEncodeAsync = async (t, n) => Vi(e, t, n), e.safeDecodeAsync = async (t, n) => Hi(e, t, n), R(e, "ZodType", {
2633
- check(...e) {
2634
- let t = this.def;
2635
- return this.clone(g(t, { checks: [...t.checks ?? [], ...e.map((e) => typeof e == "function" ? { _zod: {
2636
- check: e,
2637
- def: { check: "custom" },
2638
- onattach: []
2639
- } } : e)] }), { parent: !0 });
2640
- },
2641
- with(...e) {
2642
- return this.check(...e);
2643
- },
2644
- clone(e, t) {
2645
- return b(this, e, t);
2646
- },
2647
- brand() {
2648
- return this;
2649
- },
2650
- register(e, t) {
2651
- return e.add(this, t), this;
2652
- },
2653
- refine(e, t) {
2654
- return this.check(Za(e, t));
2655
- },
2656
- superRefine(e, t) {
2657
- return this.check(Qa(e, t));
2658
- },
2659
- overwrite(e) {
2660
- return this.check(/* @__PURE__ */ N(e));
2661
- },
2662
- optional() {
2663
- return Aa(this);
2664
- },
2665
- exactOptional() {
2666
- return Ma(this);
2667
- },
2668
- nullable() {
2669
- return Pa(this);
2670
- },
2671
- nullish() {
2672
- return Aa(Pa(this));
2673
- },
2674
- nonoptional(e) {
2675
- return Ba(this, e);
2676
- },
2677
- array() {
2678
- return G(this);
2679
- },
2680
- or(e) {
2681
- return q([this, e]);
2682
- },
2683
- and(e) {
2684
- return Sa(this, e);
2685
- },
2686
- transform(e) {
2687
- return Wa(this, Oa(e));
2688
- },
2689
- default(e) {
2690
- return Ia(this, e);
2691
- },
2692
- prefault(e) {
2693
- return Ra(this, e);
2694
- },
2695
- catch(e) {
2696
- return Ha(this, e);
2697
- },
2698
- pipe(e) {
2699
- return Wa(this, e);
2700
- },
2701
- readonly() {
2702
- return Ka(this);
2703
- },
2704
- describe(e) {
2705
- let t = this.clone();
2706
- return j.add(t, { description: e }), t;
2707
- },
2708
- meta(...e) {
2709
- if (e.length === 0) return j.get(this);
2710
- let t = this.clone();
2711
- return j.add(t, e[0]), t;
2712
- },
2713
- isOptional() {
2714
- return this.safeParse(void 0).success;
2715
- },
2716
- isNullable() {
2717
- return this.safeParse(null).success;
2718
- },
2719
- apply(e) {
2720
- return e(this);
2721
- }
2722
- }), Object.defineProperty(e, "description", {
2723
- get() {
2724
- return j.get(e)?.description;
2725
- },
2726
- configurable: !0
2727
- }), e)), Wi = /* @__PURE__ */ o("_ZodString", (e, t) => {
2728
- It.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ti(e, t, n, r);
2729
- let n = e._zod.bag;
2730
- e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, R(e, "_ZodString", {
2731
- regex(...e) {
2732
- return this.check(/* @__PURE__ */ Pr(...e));
2733
- },
2734
- includes(...e) {
2735
- return this.check(/* @__PURE__ */ Lr(...e));
2736
- },
2737
- startsWith(...e) {
2738
- return this.check(/* @__PURE__ */ Rr(...e));
2739
- },
2740
- endsWith(...e) {
2741
- return this.check(/* @__PURE__ */ zr(...e));
2742
- },
2743
- min(...e) {
2744
- return this.check(/* @__PURE__ */ M(...e));
2745
- },
2746
- max(...e) {
2747
- return this.check(/* @__PURE__ */ Mr(...e));
2748
- },
2749
- length(...e) {
2750
- return this.check(/* @__PURE__ */ Nr(...e));
2751
- },
2752
- nonempty(...e) {
2753
- return this.check(/* @__PURE__ */ M(1, ...e));
2754
- },
2755
- lowercase(e) {
2756
- return this.check(/* @__PURE__ */ Fr(e));
2757
- },
2758
- uppercase(e) {
2759
- return this.check(/* @__PURE__ */ Ir(e));
2760
- },
2761
- trim() {
2762
- return this.check(/* @__PURE__ */ Vr());
2763
- },
2764
- normalize(...e) {
2765
- return this.check(/* @__PURE__ */ Br(...e));
2766
- },
2767
- toLowerCase() {
2768
- return this.check(/* @__PURE__ */ Hr());
2769
- },
2770
- toUpperCase() {
2771
- return this.check(/* @__PURE__ */ Ur());
2772
- },
2773
- slugify() {
2774
- return this.check(/* @__PURE__ */ Wr());
2775
- }
2776
- });
2777
- }), Gi = /* @__PURE__ */ o("ZodString", (e, t) => {
2778
- It.init(e, t), Wi.init(e, t), e.email = (t) => e.check(/* @__PURE__ */ Xn(Ki, t)), e.url = (t) => e.check(/* @__PURE__ */ nr(Yi, t)), e.jwt = (t) => e.check(/* @__PURE__ */ _r(ua, t)), e.emoji = (t) => e.check(/* @__PURE__ */ rr(Xi, t)), e.guid = (t) => e.check(/* @__PURE__ */ Zn(qi, t)), e.uuid = (t) => e.check(/* @__PURE__ */ Qn(Ji, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ $n(Ji, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ er(Ji, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ tr(Ji, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ ir(Zi, t)), e.guid = (t) => e.check(/* @__PURE__ */ Zn(qi, t)), e.cuid = (t) => e.check(/* @__PURE__ */ ar(Qi, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ or($i, t)), e.ulid = (t) => e.check(/* @__PURE__ */ sr(ea, t)), e.base64 = (t) => e.check(/* @__PURE__ */ mr(sa, t)), e.base64url = (t) => e.check(/* @__PURE__ */ hr(ca, t)), e.xid = (t) => e.check(/* @__PURE__ */ cr(ta, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ lr(na, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ ur(ra, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ dr(ia, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ fr(aa, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ pr(oa, t)), e.e164 = (t) => e.check(/* @__PURE__ */ gr(la, t)), e.datetime = (t) => e.check(wi(t)), e.date = (t) => e.check(Ei(t)), e.time = (t) => e.check(Oi(t)), e.duration = (t) => e.check(Ai(t));
2779
- });
2780
- function B(e) {
2781
- return /* @__PURE__ */ Yn(Gi, e);
2782
- }
2783
- var V = /* @__PURE__ */ o("ZodStringFormat", (e, t) => {
2784
- O.init(e, t), Wi.init(e, t);
2785
- }), Ki = /* @__PURE__ */ o("ZodEmail", (e, t) => {
2786
- zt.init(e, t), V.init(e, t);
2787
- }), qi = /* @__PURE__ */ o("ZodGUID", (e, t) => {
2788
- Lt.init(e, t), V.init(e, t);
2789
- }), Ji = /* @__PURE__ */ o("ZodUUID", (e, t) => {
2790
- Rt.init(e, t), V.init(e, t);
2791
- }), Yi = /* @__PURE__ */ o("ZodURL", (e, t) => {
2792
- Bt.init(e, t), V.init(e, t);
2793
- }), Xi = /* @__PURE__ */ o("ZodEmoji", (e, t) => {
2794
- Vt.init(e, t), V.init(e, t);
2795
- }), Zi = /* @__PURE__ */ o("ZodNanoID", (e, t) => {
2796
- Ht.init(e, t), V.init(e, t);
2797
- }), Qi = /* @__PURE__ */ o("ZodCUID", (e, t) => {
2798
- Ut.init(e, t), V.init(e, t);
2799
- }), $i = /* @__PURE__ */ o("ZodCUID2", (e, t) => {
2800
- Wt.init(e, t), V.init(e, t);
2801
- }), ea = /* @__PURE__ */ o("ZodULID", (e, t) => {
2802
- Gt.init(e, t), V.init(e, t);
2803
- }), ta = /* @__PURE__ */ o("ZodXID", (e, t) => {
2804
- Kt.init(e, t), V.init(e, t);
2805
- }), na = /* @__PURE__ */ o("ZodKSUID", (e, t) => {
2806
- qt.init(e, t), V.init(e, t);
2807
- }), ra = /* @__PURE__ */ o("ZodIPv4", (e, t) => {
2808
- Qt.init(e, t), V.init(e, t);
2809
- }), ia = /* @__PURE__ */ o("ZodIPv6", (e, t) => {
2810
- $t.init(e, t), V.init(e, t);
2811
- }), aa = /* @__PURE__ */ o("ZodCIDRv4", (e, t) => {
2812
- en.init(e, t), V.init(e, t);
2813
- }), oa = /* @__PURE__ */ o("ZodCIDRv6", (e, t) => {
2814
- tn.init(e, t), V.init(e, t);
2815
- }), sa = /* @__PURE__ */ o("ZodBase64", (e, t) => {
2816
- rn.init(e, t), V.init(e, t);
2817
- }), ca = /* @__PURE__ */ o("ZodBase64URL", (e, t) => {
2818
- on.init(e, t), V.init(e, t);
2819
- }), la = /* @__PURE__ */ o("ZodE164", (e, t) => {
2820
- sn.init(e, t), V.init(e, t);
2821
- }), ua = /* @__PURE__ */ o("ZodJWT", (e, t) => {
2822
- ln.init(e, t), V.init(e, t);
2823
- }), da = /* @__PURE__ */ o("ZodNumber", (e, t) => {
2824
- un.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ni(e, t, n, r), R(e, "ZodNumber", {
2825
- gt(e, t) {
2826
- return this.check(/* @__PURE__ */ kr(e, t));
2827
- },
2828
- gte(e, t) {
2829
- return this.check(/* @__PURE__ */ Ar(e, t));
2830
- },
2831
- min(e, t) {
2832
- return this.check(/* @__PURE__ */ Ar(e, t));
2833
- },
2834
- lt(e, t) {
2835
- return this.check(/* @__PURE__ */ Dr(e, t));
2836
- },
2837
- lte(e, t) {
2838
- return this.check(/* @__PURE__ */ Or(e, t));
2839
- },
2840
- max(e, t) {
2841
- return this.check(/* @__PURE__ */ Or(e, t));
2842
- },
2843
- int(e) {
2844
- return this.check(pa(e));
2845
- },
2846
- safe(e) {
2847
- return this.check(pa(e));
2848
- },
2849
- positive(e) {
2850
- return this.check(/* @__PURE__ */ kr(0, e));
2851
- },
2852
- nonnegative(e) {
2853
- return this.check(/* @__PURE__ */ Ar(0, e));
2854
- },
2855
- negative(e) {
2856
- return this.check(/* @__PURE__ */ Dr(0, e));
2857
- },
2858
- nonpositive(e) {
2859
- return this.check(/* @__PURE__ */ Or(0, e));
2860
- },
2861
- multipleOf(e, t) {
2862
- return this.check(/* @__PURE__ */ jr(e, t));
2863
- },
2864
- step(e, t) {
2865
- return this.check(/* @__PURE__ */ jr(e, t));
2866
- },
2867
- finite() {
2868
- return this;
2869
- }
2870
- });
2871
- let n = e._zod.bag;
2872
- e.minValue = Math.max(n.minimum ?? -Infinity, n.exclusiveMinimum ?? -Infinity) ?? null, e.maxValue = Math.min(n.maximum ?? Infinity, n.exclusiveMaximum ?? Infinity) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? .5), e.isFinite = !0, e.format = n.format ?? null;
2873
- });
2874
- function H(e) {
2875
- return /* @__PURE__ */ Sr(da, e);
2876
- }
2877
- var fa = /* @__PURE__ */ o("ZodNumberFormat", (e, t) => {
2878
- dn.init(e, t), da.init(e, t);
2879
- });
2880
- function pa(e) {
2881
- return /* @__PURE__ */ Cr(fa, e);
2882
- }
2883
- var ma = /* @__PURE__ */ o("ZodBoolean", (e, t) => {
2884
- fn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ri(e, t, n, r);
2885
- });
2886
- function U(e) {
2887
- return /* @__PURE__ */ wr(ma, e);
2888
- }
2889
- var ha = /* @__PURE__ */ o("ZodUnknown", (e, t) => {
2890
- pn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (e, t, n) => void 0;
2891
- });
2892
- function W() {
2893
- return /* @__PURE__ */ Tr(ha);
2894
- }
2895
- var ga = /* @__PURE__ */ o("ZodNever", (e, t) => {
2896
- mn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ii(e, t, n, r);
2897
- });
2898
- function _a(e) {
2899
- return /* @__PURE__ */ Er(ga, e);
2900
- }
2901
- var va = /* @__PURE__ */ o("ZodArray", (e, t) => {
2902
- gn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => li(e, t, n, r), e.element = t.element, R(e, "ZodArray", {
2903
- min(e, t) {
2904
- return this.check(/* @__PURE__ */ M(e, t));
2905
- },
2906
- nonempty(e) {
2907
- return this.check(/* @__PURE__ */ M(1, e));
2908
- },
2909
- max(e, t) {
2910
- return this.check(/* @__PURE__ */ Mr(e, t));
2911
- },
2912
- length(e, t) {
2913
- return this.check(/* @__PURE__ */ Nr(e, t));
2914
- },
2915
- unwrap() {
2916
- return this.element;
2917
- }
2918
- });
2919
- });
2920
- function G(e, t) {
2921
- return /* @__PURE__ */ Gr(va, e, t);
2922
- }
2923
- var ya = /* @__PURE__ */ o("ZodObject", (e, t) => {
2924
- bn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ui(e, t, n, r), m(e, "shape", () => t.shape), R(e, "ZodObject", {
2925
- keyof() {
2926
- return J(Object.keys(this._zod.def.shape));
2927
- },
2928
- catchall(e) {
2929
- return this.clone({
2930
- ...this._zod.def,
2931
- catchall: e
2932
- });
2933
- },
2934
- passthrough() {
2935
- return this.clone({
2936
- ...this._zod.def,
2937
- catchall: W()
2938
- });
2939
- },
2940
- loose() {
2941
- return this.clone({
2942
- ...this._zod.def,
2943
- catchall: W()
2944
- });
2945
- },
2946
- strict() {
2947
- return this.clone({
2948
- ...this._zod.def,
2949
- catchall: _a()
2950
- });
2951
- },
2952
- strip() {
2953
- return this.clone({
2954
- ...this._zod.def,
2955
- catchall: void 0
2956
- });
2957
- },
2958
- extend(e) {
2959
- return me(this, e);
2960
- },
2961
- safeExtend(e) {
2962
- return he(this, e);
2963
- },
2964
- merge(e) {
2965
- return ge(this, e);
2966
- },
2967
- pick(e) {
2968
- return fe(this, e);
2969
- },
2970
- omit(e) {
2971
- return pe(this, e);
2972
- },
2973
- partial(...e) {
2974
- return _e(ka, this, e[0]);
2975
- },
2976
- required(...e) {
2977
- return ve(za, this, e[0]);
2978
- }
2979
- });
2980
- });
2981
- function K(e, t) {
2982
- return new ya({
2983
- type: "object",
2984
- shape: e ?? {},
2985
- ...x(t)
2986
- });
2987
- }
2988
- var ba = /* @__PURE__ */ o("ZodUnion", (e, t) => {
2989
- Sn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => di(e, t, n, r), e.options = t.options;
2990
- });
2991
- function q(e, t) {
2992
- return new ba({
2993
- type: "union",
2994
- options: e,
2995
- ...x(t)
2996
- });
2997
- }
2998
- var xa = /* @__PURE__ */ o("ZodIntersection", (e, t) => {
2999
- Cn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => fi(e, t, n, r);
3000
- });
3001
- function Sa(e, t) {
3002
- return new xa({
3003
- type: "intersection",
3004
- left: e,
3005
- right: t
3006
- });
3007
- }
3008
- var Ca = /* @__PURE__ */ o("ZodRecord", (e, t) => {
3009
- En.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => pi(e, t, n, r), e.keyType = t.keyType, e.valueType = t.valueType;
3010
- });
3011
- function wa(e, t, n) {
3012
- return !t || !t._zod ? new Ca({
3013
- type: "record",
3014
- keyType: B(),
3015
- valueType: e,
3016
- ...x(t)
3017
- }) : new Ca({
3018
- type: "record",
3019
- keyType: e,
3020
- valueType: t,
3021
- ...x(n)
3022
- });
3023
- }
3024
- var Ta = /* @__PURE__ */ o("ZodEnum", (e, t) => {
3025
- Dn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ai(e, t, n, r), e.enum = t.entries, e.options = Object.values(t.entries);
3026
- let n = new Set(Object.keys(t.entries));
3027
- e.extract = (e, r) => {
3028
- let i = {};
3029
- for (let r of e) if (n.has(r)) i[r] = t.entries[r];
3030
- else throw Error(`Key ${r} not found in enum`);
3031
- return new Ta({
3032
- ...t,
3033
- checks: [],
3034
- ...x(r),
3035
- entries: i
3036
- });
3037
- }, e.exclude = (e, r) => {
3038
- let i = { ...t.entries };
3039
- for (let t of e) if (n.has(t)) delete i[t];
3040
- else throw Error(`Key ${t} not found in enum`);
3041
- return new Ta({
3042
- ...t,
3043
- checks: [],
3044
- ...x(r),
3045
- entries: i
3046
- });
3047
- };
3048
- });
3049
- function J(e, t) {
3050
- return new Ta({
3051
- type: "enum",
3052
- entries: Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e,
3053
- ...x(t)
3054
- });
3055
- }
3056
- var Ea = /* @__PURE__ */ o("ZodLiteral", (e, t) => {
3057
- On.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => oi(e, t, n, r), e.values = new Set(t.values), Object.defineProperty(e, "value", { get() {
3058
- if (t.values.length > 1) throw Error("This schema contains multiple valid literal values. Use `.values` instead.");
3059
- return t.values[0];
3060
- } });
3061
- });
3062
- function Y(e, t) {
3063
- return new Ea({
3064
- type: "literal",
3065
- values: Array.isArray(e) ? e : [e],
3066
- ...x(t)
3067
- });
3068
- }
3069
- var Da = /* @__PURE__ */ o("ZodTransform", (e, t) => {
3070
- kn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => ci(e, t, n, r), e._zod.parse = (n, r) => {
3071
- if (r.direction === "backward") throw new c(e.constructor.name);
3072
- n.addIssue = (r) => {
3073
- if (typeof r == "string") n.issues.push(T(r, n.value, t));
3074
- else {
3075
- let t = r;
3076
- t.fatal && (t.continue = !1), t.code ??= "custom", t.input ??= n.value, t.inst ??= e, n.issues.push(T(t));
3077
- }
3078
- };
3079
- let i = t.transform(n.value, n);
3080
- return i instanceof Promise ? i.then((e) => (n.value = e, n.fallback = !0, n)) : (n.value = i, n.fallback = !0, n);
3081
- };
3082
- });
3083
- function Oa(e) {
3084
- return new Da({
3085
- type: "transform",
3086
- transform: e
3087
- });
3088
- }
3089
- var ka = /* @__PURE__ */ o("ZodOptional", (e, t) => {
3090
- jn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => xi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3091
- });
3092
- function Aa(e) {
3093
- return new ka({
3094
- type: "optional",
3095
- innerType: e
3096
- });
3097
- }
3098
- var ja = /* @__PURE__ */ o("ZodExactOptional", (e, t) => {
3099
- Mn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => xi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3100
- });
3101
- function Ma(e) {
3102
- return new ja({
3103
- type: "optional",
3104
- innerType: e
3105
- });
3106
- }
3107
- var Na = /* @__PURE__ */ o("ZodNullable", (e, t) => {
3108
- Nn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => mi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3109
- });
3110
- function Pa(e) {
3111
- return new Na({
3112
- type: "nullable",
3113
- innerType: e
3114
- });
3115
- }
3116
- var Fa = /* @__PURE__ */ o("ZodDefault", (e, t) => {
3117
- Pn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => gi(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
3118
- });
3119
- function Ia(e, t) {
3120
- return new Fa({
3121
- type: "default",
3122
- innerType: e,
3123
- get defaultValue() {
3124
- return typeof t == "function" ? t() : ce(t);
3125
- }
3126
- });
3127
- }
3128
- var La = /* @__PURE__ */ o("ZodPrefault", (e, t) => {
3129
- In.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => _i(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3130
- });
3131
- function Ra(e, t) {
3132
- return new La({
3133
- type: "prefault",
3134
- innerType: e,
3135
- get defaultValue() {
3136
- return typeof t == "function" ? t() : ce(t);
3137
- }
3138
- });
3139
- }
3140
- var za = /* @__PURE__ */ o("ZodNonOptional", (e, t) => {
3141
- Ln.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => hi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3142
- });
3143
- function Ba(e, t) {
3144
- return new za({
3145
- type: "nonoptional",
3146
- innerType: e,
3147
- ...x(t)
3148
- });
3149
- }
3150
- var Va = /* @__PURE__ */ o("ZodCatch", (e, t) => {
3151
- zn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => vi(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
3152
- });
3153
- function Ha(e, t) {
3154
- return new Va({
3155
- type: "catch",
3156
- innerType: e,
3157
- catchValue: typeof t == "function" ? t : () => t
3158
- });
3159
- }
3160
- var Ua = /* @__PURE__ */ o("ZodPipe", (e, t) => {
3161
- Bn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => yi(e, t, n, r), e.in = t.in, e.out = t.out;
3162
- });
3163
- function Wa(e, t) {
3164
- return new Ua({
3165
- type: "pipe",
3166
- in: e,
3167
- out: t
3168
- });
3169
- }
3170
- var Ga = /* @__PURE__ */ o("ZodReadonly", (e, t) => {
3171
- Vn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => bi(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3172
- });
3173
- function Ka(e) {
3174
- return new Ga({
3175
- type: "readonly",
3176
- innerType: e
3177
- });
3178
- }
3179
- var qa = /* @__PURE__ */ o("ZodLazy", (e, t) => {
3180
- Un.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => Si(e, t, n, r), e.unwrap = () => e._zod.def.getter();
3181
- });
3182
- function Ja(e) {
3183
- return new qa({
3184
- type: "lazy",
3185
- getter: e
3186
- });
3187
- }
3188
- var Ya = /* @__PURE__ */ o("ZodCustom", (e, t) => {
3189
- Wn.init(e, t), z.init(e, t), e._zod.processJSONSchema = (t, n, r) => si(e, t, n, r);
3190
- });
3191
- function Xa(e, t) {
3192
- return /* @__PURE__ */ Kr(Ya, e ?? (() => !0), t);
3193
- }
3194
- function Za(e, t = {}) {
3195
- return /* @__PURE__ */ qr(Ya, e, t);
3196
- }
3197
- function Qa(e, t) {
3198
- return /* @__PURE__ */ Jr(e, t);
3199
- }
3200
- //#endregion
3201
- //#region src/runtime/constants.ts
3202
- var $a = {
3203
- classifier: "classifier",
3204
- regressor: "regressor"
3205
- }, eo = {
3206
- classifier: $a.classifier,
3207
- regressor: $a.regressor
3208
- }, to = {
3209
- classifier: "Classifier report",
3210
- regressor: "Regressor report"
3211
- }, X = {
3212
- invalidNumber: "Value must be a valid number.",
3213
- textPatternMismatch: "Value does not match the expected pattern.",
3214
- booleanRequired: "This field must be accepted.",
3215
- categoryOptionMismatch: "Value must match one of the available options.",
3216
- invalidTextLengthRange: "Minimum length cannot exceed maximum length.",
3217
- invalidNumericRange: "Minimum value cannot exceed maximum value.",
3218
- invalidDateRange: "Minimum date cannot be after maximum date.",
3219
- invalidPointCountRange: "Minimum number of points cannot exceed maximum number of points.",
3220
- minLength: (e) => `Minimum length is ${e} characters.`,
3221
- maxLength: (e) => `Maximum length is ${e} characters.`,
3222
- minValue: (e) => `Minimum value is ${e}.`,
3223
- maxValue: (e) => `Maximum value is ${e}.`,
3224
- stepValue: (e) => `Value must be a multiple of ${e}.`,
3225
- dateOnOrAfter: (e) => `Date must be on or after ${e}.`,
3226
- dateOnOrBefore: (e) => `Date must be on or before ${e}.`,
3227
- stepDate: (e) => `Date must fall on a step of ${e} day(s) from the minimum date.`,
3228
- minPoints: (e) => `Minimum number of points is ${e}.`,
3229
- maxPoints: (e) => `Maximum number of points is ${e}.`,
3230
- timestampsUnique: "Timestamps must be unique.",
3231
- timestampsAscending: "Timestamps must be sorted in ascending order.",
3232
- timestampsDescending: "Timestamps must be sorted in descending order."
3233
- }, no = wa(B(), W()).optional(), ro = Xa((e) => typeof e == "function"), io = J([
3234
- "idle",
3235
- "editing",
3236
- "validating",
3237
- "submitting",
3238
- "success",
3239
- "error"
3240
- ]), ao = Ja(() => q([
3241
- K({
3242
- kind: Y("field-value"),
3243
- field: B().min(1),
3244
- equals: W().optional(),
3245
- notEquals: W().optional(),
3246
- greaterThan: W().optional(),
3247
- greaterThanOrEqual: W().optional(),
3248
- lessThan: W().optional(),
3249
- lessThanOrEqual: W().optional(),
3250
- in: G(W()).optional(),
3251
- notIn: G(W()).optional(),
3252
- empty: U().optional(),
3253
- notEmpty: U().optional(),
3254
- truthy: U().optional(),
3255
- falsy: U().optional()
3256
- }),
3257
- K({
3258
- kind: Y("field-comparison"),
3259
- field: B().min(1),
3260
- otherField: B().min(1),
3261
- operator: J([
3262
- "eq",
3263
- "neq",
3264
- "gt",
3265
- "gte",
3266
- "lt",
3267
- "lte"
3268
- ])
3269
- }),
3270
- K({
3271
- kind: Y("form-status"),
3272
- equals: q([io, G(io).min(1)])
3273
- }),
3274
- K({
3275
- kind: Y("submit-count"),
3276
- eq: H().int().nonnegative().optional(),
3277
- gte: H().int().nonnegative().optional(),
3278
- lte: H().int().nonnegative().optional()
3279
- }),
3280
- K({
3281
- kind: Y("all"),
3282
- conditions: G(ao).min(1)
3283
- }),
3284
- K({
3285
- kind: Y("any"),
3286
- conditions: G(ao).min(1)
3287
- }),
3288
- K({
3289
- kind: Y("not"),
3290
- condition: ao
3291
- })
3292
- ])), oo = q([ro, ao]), Z = {
3293
- id: B().optional(),
3294
- label: B().min(1),
3295
- description: B().optional(),
3296
- showDescriptionInline: U().optional().default(!1),
3297
- required: U().optional().default(!1),
3298
- disabled: U().optional().default(!1),
3299
- hidden: U().optional().default(!1),
3300
- readOnly: U().optional().default(!1),
3301
- disabledWhen: oo.optional(),
3302
- hiddenWhen: oo.optional(),
3303
- readOnlyWhen: oo.optional(),
3304
- asyncValidationDebounceMs: H().int().nonnegative().optional(),
3305
- inactiveFieldPolicy: J([
3306
- "include",
3307
- "omit",
3308
- "reset-on-hide"
3309
- ]).optional(),
3310
- includeInSubmission: U().optional(),
3311
- valuePath: q([B().min(1), G(B().min(1)).min(1)]).optional(),
3312
- defaultValue: W().optional(),
3313
- ui: no
3314
- }, so = {
3315
- id: B().optional(),
3316
- label: B().optional(),
3317
- description: B().optional(),
3318
- source: B().optional(),
3319
- ui: no
3320
- }, co = q([B(), K({
3321
- label: B(),
3322
- value: B()
3323
- })]), lo = (e, t) => {
3324
- let n = e.raw;
3325
- if (!(typeof n != "object" || !n || !("outputs" in n) || !Array.isArray(n.outputs))) return n.outputs.find((e) => e.type === t);
3326
- }, Q = (e, t, n) => ({
3327
- component: e,
3328
- props: {
3329
- id: t.id,
3330
- kind: t.kind,
3331
- label: t.label,
3332
- description: t.description ?? "",
3333
- showDescriptionInline: !!t.showDescriptionInline,
3334
- required: !!t.required,
3335
- disabled: !!t.disabled,
3336
- ...n,
3337
- ...t.ui
3338
- }
3339
- }), $ = {
3340
- kind: "boolean",
3341
- schema: K({
3342
- kind: Y("boolean"),
3343
- ...Z,
3344
- trueLabel: B().optional(),
3345
- falseLabel: B().optional()
3346
- }),
3347
- getDefaultValue(e) {
3348
- return typeof e.defaultValue == "boolean" ? e.defaultValue : !1;
3349
- },
3350
- normalizeValue(e) {
3351
- return !!e;
3352
- },
3353
- validate(e, t) {
3354
- return t.required && e !== !0 ? [X.booleanRequired] : [];
3355
- },
3356
- describe(e, t) {
3357
- return Q("boolean-field", e, {
3358
- checked: t.state.value,
3359
- trueLabel: e.trueLabel,
3360
- falseLabel: e.falseLabel,
3361
- state: t.state.status,
3362
- errors: t.state.errors
3363
- });
3364
- }
3365
- }, uo = {
3366
- kind: "category",
3367
- schema: K({
3368
- kind: Y("category"),
3369
- ...Z,
3370
- options: G(co).min(1)
3371
- }),
3372
- getDefaultValue(e) {
3373
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
3374
- },
3375
- normalizeValue(e) {
3376
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
3377
- },
3378
- validate(e, t) {
3379
- return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [X.categoryOptionMismatch];
3380
- },
3381
- describe(e, t) {
3382
- return Q("category-field", e, {
3383
- value: t.state.value,
3384
- options: e.options,
3385
- state: t.state.status,
3386
- errors: t.state.errors
3387
- });
3388
- }
3389
- }, fo = K({
3390
- label: B(),
3391
- value: B(),
3392
- mapping: wa(B(), W())
3393
- }), po = {
3394
- kind: "mapped-category",
3395
- schema: K({
3396
- kind: Y("mapped-category"),
3397
- ...Z,
3398
- includeInSubmission: U().optional().default(!1),
3399
- options: G(fo).min(1)
3400
- }),
3401
- getDefaultValue(e) {
3402
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
3403
- },
3404
- normalizeValue(e) {
3405
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
3406
- },
3407
- validate(e, t) {
3408
- return e === null || t.options.map((e) => e.value).includes(e) ? [] : [X.categoryOptionMismatch];
3409
- },
3410
- describe(e, t) {
3411
- return Q("category-field", e, {
3412
- value: t.state.value,
3413
- options: e.options.map((e) => ({
3414
- label: e.label,
3415
- value: e.value
3416
- })),
3417
- state: t.state.status,
3418
- errors: t.state.errors
3419
- });
3420
- }
3421
- }, mo = {
3422
- kind: "date",
3423
- schema: K({
3424
- kind: Y("date"),
3425
- ...Z,
3426
- min: B().optional(),
3427
- max: B().optional(),
3428
- step: H().positive().optional()
3429
- }),
3430
- getDefaultValue(t) {
3431
- return e(t.defaultValue) ?? null;
3432
- },
3433
- normalizeValue(t) {
3434
- return e(t);
3435
- },
3436
- serializeValue(e) {
3437
- return e instanceof Date ? e.toISOString() : e;
3438
- },
3439
- validate(t, n) {
3440
- let r = [], i = e(n.min), a = e(n.max);
3441
- if (i && a && i.getTime() > a.getTime() && r.push(X.invalidDateRange), t === null) return r;
3442
- if (i && t.getTime() < i.getTime() && r.push(X.dateOnOrAfter(String(n.min))), a && t.getTime() > a.getTime() && r.push(X.dateOnOrBefore(String(n.max))), n.step !== void 0) {
3443
- let e = i ?? /* @__PURE__ */ new Date("1970-01-01T00:00:00Z");
3444
- Math.round(Math.abs(t.getTime() - e.getTime()) / 864e5) % n.step !== 0 && r.push(X.stepDate(n.step));
3445
- }
3446
- return r;
3447
- },
3448
- describe(e, t) {
3449
- return Q("date-field", e, {
3450
- value: t.state.value instanceof Date ? t.state.value.toISOString().slice(0, 10) : t.state.value,
3451
- min: e.min,
3452
- max: e.max,
3453
- step: e.step,
3454
- state: t.state.status,
3455
- errors: t.state.errors
3456
- });
3457
- }
3458
- }, ho = {
3459
- kind: "long-text",
3460
- schema: K({
3461
- kind: Y("long-text"),
3462
- ...Z,
3463
- placeholder: B().optional(),
3464
- minLength: H().int().nonnegative().optional(),
3465
- maxLength: H().int().nonnegative().optional(),
3466
- rows: H().int().positive().optional()
3467
- }),
3468
- getDefaultValue(e) {
3469
- return typeof e.defaultValue == "string" ? e.defaultValue : "";
3470
- },
3471
- normalizeValue(e) {
3472
- return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : "";
3473
- },
3474
- validate(e, t) {
3475
- let n = [];
3476
- return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(X.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(X.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(X.maxLength(t.maxLength)), n);
3477
- },
3478
- describe(e, t) {
3479
- return Q("long-text-field", e, {
3480
- value: t.state.value,
3481
- placeholder: e.placeholder ?? "",
3482
- minLength: e.minLength,
3483
- maxLength: e.maxLength,
3484
- rows: e.rows,
3485
- state: t.state.status,
3486
- errors: t.state.errors
3487
- });
3488
- }
3489
- }, go = {
3490
- kind: "multi-choice",
3491
- schema: K({
3492
- kind: Y("multi-choice"),
3493
- ...Z,
3494
- options: G(co).min(1),
3495
- layout: J(["horizontal", "vertical"]).optional()
3496
- }),
3497
- getDefaultValue(e) {
3498
- return Array.isArray(e.defaultValue) ? e.defaultValue.filter((e) => typeof e == "string").map(String) : [];
3499
- },
3500
- normalizeValue(e) {
3501
- return Array.isArray(e) ? e.filter((e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint").map(String) : [];
3502
- },
3503
- cloneValue(e) {
3504
- return [...e];
3505
- },
3506
- isEqual(e, t) {
3507
- return e.length === t.length ? e.every((e, n) => e === t[n]) : !1;
3508
- },
3509
- validate(e, t) {
3510
- if (e.length === 0) return [];
3511
- let n = t.options.map((e) => typeof e == "string" ? e : e.value);
3512
- return e.filter((e) => !n.includes(e)).length > 0 ? [X.categoryOptionMismatch] : [];
3513
- },
3514
- describe(e, t) {
3515
- return Q("multi-choice-field", e, {
3516
- value: t.state.value,
3517
- options: e.options,
3518
- layout: e.layout ?? "vertical",
3519
- state: t.state.status,
3520
- errors: t.state.errors
3521
- });
3522
- }
3523
- }, _o = {
3524
- kind: "number",
3525
- schema: K({
3526
- kind: Y("number"),
3527
- ...Z,
3528
- min: H().optional(),
3529
- max: H().optional(),
3530
- step: H().positive().optional(),
3531
- unit: B().optional(),
3532
- placeholder: B().optional()
3533
- }),
3534
- getDefaultValue(e) {
3535
- return typeof e.defaultValue == "number" ? e.defaultValue : null;
3536
- },
3537
- normalizeValue(e) {
3538
- if (e == null || e === "") return null;
3539
- if (typeof e == "number") return Number.isNaN(e) ? null : e;
3540
- if (typeof e == "string") {
3541
- let t = e.trim();
3542
- if (t.length === 0) return null;
3543
- let n = Number(t);
3544
- return Number.isNaN(n) ? e : n;
3545
- }
3546
- let t = Number(e);
3547
- return Number.isNaN(t) ? null : t;
3548
- },
3549
- validate(e, t) {
3550
- let n = [];
3551
- if (t.min !== void 0 && t.max !== void 0 && t.min > t.max && n.push(X.invalidNumericRange), e === null) return n;
3552
- if (typeof e != "number") return n.push(X.invalidNumber), n;
3553
- if (t.min !== void 0 && e < t.min && n.push(X.minValue(t.min)), t.max !== void 0 && e > t.max && n.push(X.maxValue(t.max)), t.step !== void 0) {
3554
- let r = t.min ?? 0, i = Math.abs(e - r) % t.step, a = t.step * 1e-9;
3555
- i > a && Math.abs(i - t.step) > a && n.push(X.stepValue(t.step));
3556
- }
3557
- return n;
3558
- },
3559
- describe(e, t) {
3560
- let n = e.min !== void 0 && e.max !== void 0 && !e.required && t.state.value !== null;
3561
- return Q("number-field", e, {
3562
- value: t.state.value,
3563
- min: e.min,
3564
- max: e.max,
3565
- step: e.step,
3566
- unit: e.unit,
3567
- placeholder: e.placeholder ?? "",
3568
- input: n ? "range" : "text",
3569
- state: t.state.status,
3570
- errors: t.state.errors
3571
- });
3572
- }
3573
- }, vo = {
3574
- kind: "rating",
3575
- schema: K({
3576
- kind: Y("rating"),
3577
- ...Z,
3578
- min: H().int().optional(),
3579
- max: H().int().min(1),
3580
- step: H().int().positive().optional()
3581
- }),
3582
- getDefaultValue(e) {
3583
- return typeof e.defaultValue == "number" ? e.defaultValue : null;
3584
- },
3585
- normalizeValue(e) {
3586
- if (e == null) return null;
3587
- let t = typeof e == "number" ? e : Number(e);
3588
- return Number.isNaN(t) ? null : t;
3589
- },
3590
- validate(e, t) {
3591
- if (e === null) return [];
3592
- let n = [], r = t.min ?? 1, i = t.max;
3593
- return r > i ? (n.push(X.invalidNumericRange), n) : (e < r && n.push(X.minValue(r)), e > i && n.push(X.maxValue(i)), n);
3594
- },
3595
- describe(e, t) {
3596
- return Q("rating-field", e, {
3597
- value: t.state.value,
3598
- min: e.min ?? 1,
3599
- max: e.max,
3600
- step: e.step ?? 1,
3601
- state: t.state.status,
3602
- errors: t.state.errors
3603
- });
3604
- }
3605
- }, yo = {
3606
- kind: "text",
3607
- schema: K({
3608
- kind: Y("text"),
3609
- ...Z,
3610
- placeholder: B().optional(),
3611
- minLength: H().int().nonnegative().optional(),
3612
- maxLength: H().int().nonnegative().optional(),
3613
- pattern: B().optional()
3614
- }),
3615
- getDefaultValue(e) {
3616
- return typeof e.defaultValue == "string" ? e.defaultValue : "";
3617
- },
3618
- normalizeValue(e) {
3619
- return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : "";
3620
- },
3621
- validate(e, t) {
3622
- let n = [];
3623
- return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(X.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(X.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(X.maxLength(t.maxLength)), t.pattern && !new RegExp(t.pattern).test(e) && n.push(X.textPatternMismatch), n);
3624
- },
3625
- describe(e, t) {
3626
- return Q("text-field", e, {
3627
- value: t.state.value,
3628
- placeholder: e.placeholder ?? "",
3629
- minLength: e.minLength,
3630
- maxLength: e.maxLength,
3631
- pattern: e.pattern,
3632
- state: t.state.status,
3633
- errors: t.state.errors
3634
- });
3635
- }
3636
- }, bo = K({
3637
- kind: B().min(1),
3638
- label: B().min(1),
3639
- required: U().optional()
3640
- }).passthrough(), xo = K({
3641
- kind: Y("series"),
3642
- ...Z,
3643
- field1: bo,
3644
- field2: bo,
3645
- minPoints: H().int().nonnegative().optional(),
3646
- maxPoints: H().int().nonnegative().optional()
3647
- }), So = "This field is required.", Co = (e) => e.toISOString().slice(0, 10), wo = {
3648
- text: yo,
3649
- number: _o,
3650
- date: mo,
3651
- category: uo
3652
- }, To = (e) => wo[e], Eo = (e) => {
3653
- if (e == null || e === "") return null;
3654
- if (typeof e == "boolean") return e;
3655
- if (typeof e == "string") {
3656
- if (e === "true") return !0;
3657
- if (e === "false") return !1;
3658
- }
3659
- return !!e;
3660
- }, Do = (e, t) => {
3661
- if (e.kind === $.kind) return Eo(t);
3662
- let n = To(e.kind);
3663
- return n?.normalizeValue ? n.normalizeValue(t, e) : t;
3664
- }, Oo = (e, t) => {
3665
- if (t == null) return null;
3666
- if (e.kind === "date" && t instanceof Date) return Co(t);
3667
- let n = To(e.kind);
3668
- return n?.serializeValue ? n.serializeValue(t, e) : t;
3669
- }, ko = (e, t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : e.kind === $.kind ? t == null : !1, Ao = (e, t) => {
3670
- if (e.required && ko(e, t)) return [So];
3671
- if (e.kind === $.kind) {
3672
- if (t === null) return [];
3673
- let n = $.validate?.(t, e, {
3674
- field: {
3675
- ...e,
3676
- id: e.label
3677
- },
3678
- values: {},
3679
- submitCount: 0,
3680
- validationVersion: 0,
3681
- signal: void 0
3682
- });
3683
- return Array.isArray(n) ? n : [];
3684
- }
3685
- let n = To(e.kind);
3686
- if (!n?.validate) return [];
3687
- let r = n.validate(t, e, {
3688
- field: {
3689
- ...e,
3690
- id: e.label
3691
- },
3692
- values: {},
3693
- submitCount: 0,
3694
- validationVersion: 0,
3695
- signal: void 0
3696
- });
3697
- return Array.isArray(r) ? r : [];
3698
- }, jo = (e, t, n) => n.map((n) => `Row ${e + 1} (${t}): ${n}`), Mo = (e) => {
3699
- if (Array.isArray(e)) return e.length >= 2 ? {
3700
- field1: e[0],
3701
- field2: e[1]
3702
- } : null;
3703
- if (!t(e)) return null;
3704
- if ("field1" in e || "field2" in e) return {
3705
- field1: e.field1,
3706
- field2: e.field2
3707
- };
3708
- let n = Object.entries(e);
3709
- return n.length < 2 ? null : {
3710
- field1: n[0]?.[1],
3711
- field2: n[1]?.[1]
3712
- };
3713
- }, No = (e, t) => {
3714
- let n = Mo(e);
3715
- return n ? {
3716
- field1: Do(t.field1, n.field1),
3717
- field2: Do(t.field2, n.field2)
3718
- } : null;
3719
- }, Po = (e, t) => {
3720
- let n = /* @__PURE__ */ new Set();
3721
- return t.minPoints !== void 0 && t.maxPoints !== void 0 && t.minPoints > t.maxPoints && n.add(X.invalidPointCountRange), t.minPoints !== void 0 && e.length < t.minPoints && n.add(X.minPoints(t.minPoints)), t.maxPoints !== void 0 && e.length > t.maxPoints && n.add(X.maxPoints(t.maxPoints)), n;
3722
- }, Fo = {
3723
- kind: "series",
3724
- schema: xo,
3725
- getDefaultValue(e) {
3726
- return Array.isArray(e.defaultValue) ? e.defaultValue.map((t) => No(t, e)).filter((e) => e !== null) : [];
3727
- },
3728
- normalizeValue(e, t) {
3729
- return Array.isArray(e) ? e.map((e) => No(e, t)).filter((e) => e !== null) : [];
3730
- },
3731
- serializeValue(e, t) {
3732
- return e.map((e) => ({
3733
- field1: Oo(t.field1, e.field1),
3734
- field2: Oo(t.field2, e.field2)
3735
- }));
3736
- },
3737
- validate(e, t) {
3738
- let n = Po(e, t);
3739
- return e.forEach((e, r) => {
3740
- for (let i of jo(r, t.field1.label, Ao(t.field1, e.field1))) n.add(i);
3741
- for (let i of jo(r, t.field2.label, Ao(t.field2, e.field2))) n.add(i);
3742
- }), [...n];
3743
- },
3744
- describe(e, n) {
3745
- return Q("series-field", e, {
3746
- value: Array.isArray(n.state.value) ? n.state.value.map((n) => t(n) ? {
3747
- field1: Oo(e.field1, n.field1),
3748
- field2: Oo(e.field2, n.field2)
3749
- } : n) : [],
3750
- field1: e.field1,
3751
- field2: e.field2,
3752
- minPoints: e.minPoints,
3753
- maxPoints: e.maxPoints,
3754
- state: n.state.status,
3755
- errors: n.state.errors
3756
- });
3757
- }
3758
- }, Io = {
3759
- kind: "single-choice",
3760
- schema: K({
3761
- kind: Y("single-choice"),
3762
- ...Z,
3763
- options: G(co).min(1),
3764
- layout: J(["horizontal", "vertical"]).optional()
3765
- }),
3766
- getDefaultValue(e) {
3767
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
3768
- },
3769
- normalizeValue(e) {
3770
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
3771
- },
3772
- validate(e, t) {
3773
- return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [X.categoryOptionMismatch];
3774
- },
3775
- describe(e, t) {
3776
- return Q("single-choice-field", e, {
3777
- value: t.state.value,
3778
- options: e.options,
3779
- layout: e.layout ?? "vertical",
3780
- state: t.state.status,
3781
- errors: t.state.errors
3782
- });
3783
- }
3784
- }, Lo = {
3785
- kind: "classifier",
3786
- partialUpdatePolicy: "validate",
3787
- schema: K({
3788
- kind: Y("classifier"),
3789
- ...so,
3790
- labels: G(B()).optional(),
3791
- showClassProbabilities: U().optional().default(!0)
3792
- }),
3793
- resolvePayload(e, t) {
3794
- return t.result.reports[t.report.source] ?? lo(t.result, eo.classifier);
3795
- },
3796
- describe(e, t) {
3797
- return t.state.status === "idle" && t.payload === void 0 ? null : {
3798
- component: "classifier-report",
3799
- props: {
3800
- id: t.reportId,
3801
- kind: e.kind,
3802
- label: e.label ?? to.classifier,
3803
- description: e.description ?? "",
3804
- payload: t.payload,
3805
- error: t.state.error,
3806
- state: t.state.status,
3807
- showClassProbabilities: e.showClassProbabilities,
3808
- labels: e.labels,
3809
- ...e.ui
3810
- }
3811
- };
3812
- }
3813
- }, Ro = {
3814
- kind: "regressor",
3815
- partialUpdatePolicy: "validate",
3816
- schema: K({
3817
- kind: Y("regressor"),
3818
- ...so,
3819
- unit: B().optional(),
3820
- precision: H().int().nonnegative().optional().default(2)
3821
- }),
3822
- resolvePayload(e, t) {
3823
- return t.result.reports[t.report.source] ?? lo(t.result, eo.regressor);
3824
- },
3825
- describe(e, t) {
3826
- return t.state.status === "idle" && t.payload === void 0 ? null : {
3827
- component: "regressor-report",
3828
- props: {
3829
- id: t.reportId,
3830
- kind: e.kind,
3831
- label: e.label ?? to.regressor,
3832
- description: e.description ?? "",
3833
- payload: t.payload,
3834
- error: t.state.error,
3835
- state: t.state.status,
3836
- unit: e.unit,
3837
- precision: e.precision,
3838
- ...e.ui
3839
- }
3840
- };
3841
- }
3842
- }, zo = (e, t) => {
3843
- !t.describe || e.getField(t.kind) || e.registerField({
3844
- kind: t.kind,
3845
- describe: t.describe
3846
- });
3847
- }, Bo = (e, t) => {
3848
- !t.describe || e.getReport(t.kind) || e.registerReport({
3849
- kind: t.kind,
3850
- describe: t.describe
3851
- });
3852
- }, Vo = [
3853
- yo,
3854
- _o,
3855
- $,
3856
- uo,
3857
- po,
3858
- mo,
3859
- Fo,
3860
- ho,
3861
- Io,
3862
- go,
3863
- vo
3864
- ], Ho = () => {
3865
- let e = n(), t = i();
3866
- for (let n of Vo) e.registerField(n), zo(t, n);
3867
- return {
3868
- registry: e,
3869
- presentationRegistry: t,
3870
- behaviors: [r()]
3871
- };
3872
- }, Uo = [Lo, Ro], Wo = () => {
3873
- let e = Ho();
3874
- for (let t of Uo) e.registry.registerReport(t), Bo(e.presentationRegistry, t);
3875
- return e;
3876
- }, Go = () => n().registerReport(Lo).registerReport(Ro), Ko = Wo;
3877
- //#endregion
3878
- export { Lo as a, Ro as i, Ko as n, Ho as r, Go as t };