@wirecat/yandex-disk-cli 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +204 -0
  3. package/README.md +243 -2
  4. package/contracts/wirecat.json +1554 -0
  5. package/dist/bin/ydisk.d.ts +3 -0
  6. package/dist/bin/ydisk.d.ts.map +1 -0
  7. package/dist/bin/ydisk.js +40 -0
  8. package/dist/bin/ydisk.js.map +1 -0
  9. package/dist/bundle/all-profiles-4OLZF3RT.js +279 -0
  10. package/dist/bundle/anthropic-DKB4OJXZ.js +91 -0
  11. package/dist/bundle/app-server-G4545SSV.js +247 -0
  12. package/dist/bundle/bun-RXEQKFED.js +169 -0
  13. package/dist/bundle/bun-sqlite-VHT5LN7U.js +76 -0
  14. package/dist/bundle/chunk-2BITUXGC.js +12289 -0
  15. package/dist/bundle/chunk-2CLWDQKA.js +39330 -0
  16. package/dist/bundle/chunk-2JFDOPKA.js +9575 -0
  17. package/dist/bundle/chunk-3GVI2MAO.js +106 -0
  18. package/dist/bundle/chunk-3SZBWBMI.js +131 -0
  19. package/dist/bundle/chunk-44VSEXW6.js +4054 -0
  20. package/dist/bundle/chunk-4YPRRQBE.js +95 -0
  21. package/dist/bundle/chunk-5COYRL5B.js +379 -0
  22. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  23. package/dist/bundle/chunk-5DM7DIZL.js +1402 -0
  24. package/dist/bundle/chunk-6R2DVTVZ.js +24 -0
  25. package/dist/bundle/chunk-762BS35H.js +2787 -0
  26. package/dist/bundle/chunk-AG64V7AB.js +1233 -0
  27. package/dist/bundle/chunk-BC5HGIXB.js +334 -0
  28. package/dist/bundle/chunk-BH7LFEX7.js +36 -0
  29. package/dist/bundle/chunk-BLNPGY7N.js +53 -0
  30. package/dist/bundle/chunk-CNIA2LJF.js +372 -0
  31. package/dist/bundle/chunk-COSXMDC7.js +230 -0
  32. package/dist/bundle/chunk-D72URWJE.js +532 -0
  33. package/dist/bundle/chunk-D7FO33KU.js +785 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DJH26PQ3.js +1396 -0
  36. package/dist/bundle/chunk-DJPT7IUC.js +64567 -0
  37. package/dist/bundle/chunk-DTMSCZDW.js +209 -0
  38. package/dist/bundle/chunk-E6LGZ5LX.js +16 -0
  39. package/dist/bundle/chunk-E6YRIHS5.js +92 -0
  40. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  41. package/dist/bundle/chunk-F3DDSZTF.js +78 -0
  42. package/dist/bundle/chunk-F4WWTQNL.js +188 -0
  43. package/dist/bundle/chunk-FDDAUASC.js +1028 -0
  44. package/dist/bundle/chunk-FMNPG6N2.js +170 -0
  45. package/dist/bundle/chunk-FOKJ4POB.js +274 -0
  46. package/dist/bundle/chunk-G22C7JG6.js +731 -0
  47. package/dist/bundle/chunk-GA442SYZ.js +161 -0
  48. package/dist/bundle/chunk-GEBSW7UK.js +6848 -0
  49. package/dist/bundle/chunk-GGRKWAOK.js +594 -0
  50. package/dist/bundle/chunk-HHINRNZA.js +788 -0
  51. package/dist/bundle/chunk-HUZCL33L.js +128 -0
  52. package/dist/bundle/chunk-IALSIQVT.js +142 -0
  53. package/dist/bundle/chunk-IOXR2QBX.js +398 -0
  54. package/dist/bundle/chunk-J5CXR6VX.js +63 -0
  55. package/dist/bundle/chunk-J5PWSTOX.js +82 -0
  56. package/dist/bundle/chunk-J7BVAEHR.js +364 -0
  57. package/dist/bundle/chunk-JH46HMZW.js +1334 -0
  58. package/dist/bundle/chunk-JOBO7F6W.js +52 -0
  59. package/dist/bundle/chunk-JXZ5B3L5.js +2333 -0
  60. package/dist/bundle/chunk-KBIAMDZN.js +66 -0
  61. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  62. package/dist/bundle/chunk-LNHTLSR5.js +288 -0
  63. package/dist/bundle/chunk-M24RAKMJ.js +58 -0
  64. package/dist/bundle/chunk-MDQ57Q3H.js +1197 -0
  65. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  66. package/dist/bundle/chunk-MLXQ4X5L.js +206 -0
  67. package/dist/bundle/chunk-NQAKARHE.js +54 -0
  68. package/dist/bundle/chunk-OF7VVUDQ.js +23 -0
  69. package/dist/bundle/chunk-OQVPE3XK.js +324 -0
  70. package/dist/bundle/chunk-OR3QG7UR.js +259 -0
  71. package/dist/bundle/chunk-OUUYVROP.js +76 -0
  72. package/dist/bundle/chunk-PQBAM64O.js +168 -0
  73. package/dist/bundle/chunk-PYVIA7WF.js +88 -0
  74. package/dist/bundle/chunk-Q6HK3PHE.js +72 -0
  75. package/dist/bundle/chunk-QB3KECV2.js +218 -0
  76. package/dist/bundle/chunk-QGWXSFYN.js +73 -0
  77. package/dist/bundle/chunk-RC5QAAAE.js +29 -0
  78. package/dist/bundle/chunk-RMJ26HLB.js +18 -0
  79. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  80. package/dist/bundle/chunk-T7ZUDA4C.js +72 -0
  81. package/dist/bundle/chunk-TRCSMVV5.js +72 -0
  82. package/dist/bundle/chunk-UD2BQEKA.js +46 -0
  83. package/dist/bundle/chunk-V4TL55GS.js +1068 -0
  84. package/dist/bundle/chunk-VJNWN5VU.js +4072 -0
  85. package/dist/bundle/chunk-VRRNBLMA.js +1227 -0
  86. package/dist/bundle/chunk-WUCMMNFJ.js +771 -0
  87. package/dist/bundle/chunk-XDESE3NY.js +44 -0
  88. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  91. package/dist/bundle/chunk-Z2QEON7B.js +2275 -0
  92. package/dist/bundle/chunk-ZMJ56GME.js +7 -0
  93. package/dist/bundle/chunk-ZTSB3D7Q.js +100 -0
  94. package/dist/bundle/chunk-ZVJWD3FK.js +38 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-YIOYGPJA.js +40 -0
  97. package/dist/bundle/command-server-entry-MHBQDXS4.js +169 -0
  98. package/dist/bundle/decode-NUGJIOUW.js +297 -0
  99. package/dist/bundle/definitions-AILHKEQT.js +2005 -0
  100. package/dist/bundle/dispatch-5LC4UEGY.js +411 -0
  101. package/dist/bundle/dist-4I2W6X2I.js +7577 -0
  102. package/dist/bundle/echarts-MHSH6PGC.js +42501 -0
  103. package/dist/bundle/embed-ZDXTHHYS.js +38 -0
  104. package/dist/bundle/embedder-XFEELFUL.js +111 -0
  105. package/dist/bundle/failure-5S7VPBYK.js +25 -0
  106. package/dist/bundle/first-run-JHCHT3RJ.js +29 -0
  107. package/dist/bundle/first-screen-FHGQ6QRV.js +40 -0
  108. package/dist/bundle/instructions-WKSMBUFX.js +11 -0
  109. package/dist/bundle/mcp-HS2ZDUVR.js +167 -0
  110. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  111. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  112. package/dist/bundle/meeting-combined-K4U4NYRZ.js +25 -0
  113. package/dist/bundle/meeting-model-KCEG6Y5O.js +26 -0
  114. package/dist/bundle/meeting-semantic-VYGSV3H6.js +22 -0
  115. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  116. package/dist/bundle/node-CM6NC6UE.js +176 -0
  117. package/dist/bundle/node-KM3CUABH.js +2340 -0
  118. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  119. package/dist/bundle/node-sqlite-5YDQ3LIJ.js +74 -0
  120. package/dist/bundle/notes-search-PGO7KM2U.js +62 -0
  121. package/dist/bundle/oauth-NY4C5UCK.js +20 -0
  122. package/dist/bundle/open-YNUTA6ZE.js +23 -0
  123. package/dist/bundle/openai-4CVT5PHH.js +241 -0
  124. package/dist/bundle/process-2XT3TL27.js +91 -0
  125. package/dist/bundle/program-FMIVF5T6.js +31904 -0
  126. package/dist/bundle/prompt-VNWY3H6S.js +17 -0
  127. package/dist/bundle/recognize-JS4PBPSZ.js +26 -0
  128. package/dist/bundle/remote-RCLFH4V2.js +32 -0
  129. package/dist/bundle/rerank-EG6VKYGO.js +52 -0
  130. package/dist/bundle/schemas-ED2LHKXK.js +645 -0
  131. package/dist/bundle/serve-AHG25QXB.js +199 -0
  132. package/dist/bundle/server-5FTB7WM3.js +78 -0
  133. package/dist/bundle/server-JNZVSAZE.js +209 -0
  134. package/dist/bundle/sqlite-runtime-XSZOAQPF.js +20 -0
  135. package/dist/bundle/state-XGVAJFF7.js +36 -0
  136. package/dist/bundle/store-OHSCWZEV.js +177 -0
  137. package/dist/bundle/store-PKSPKJXL.js +293 -0
  138. package/dist/bundle/store-maintenance-command-KAWGBSWK.js +69 -0
  139. package/dist/bundle/ydisk.js +183 -0
  140. package/dist/commands/api.d.ts +9 -0
  141. package/dist/commands/api.d.ts.map +1 -0
  142. package/dist/commands/api.js +59 -0
  143. package/dist/commands/api.js.map +1 -0
  144. package/dist/commands/comments.d.ts +3 -0
  145. package/dist/commands/comments.d.ts.map +1 -0
  146. package/dist/commands/comments.js +114 -0
  147. package/dist/commands/comments.js.map +1 -0
  148. package/dist/commands/files.d.ts +3 -0
  149. package/dist/commands/files.d.ts.map +1 -0
  150. package/dist/commands/files.js +272 -0
  151. package/dist/commands/files.js.map +1 -0
  152. package/dist/commands/library.d.ts +13 -0
  153. package/dist/commands/library.d.ts.map +1 -0
  154. package/dist/commands/library.js +118 -0
  155. package/dist/commands/library.js.map +1 -0
  156. package/dist/commands/session.d.ts +3 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +99 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +18 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +62 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +80 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +77 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/generated/definitions.d.ts +3 -0
  169. package/dist/generated/definitions.d.ts.map +1 -0
  170. package/dist/generated/definitions.js +2001 -0
  171. package/dist/generated/definitions.js.map +1 -0
  172. package/dist/generated/manifest.d.ts +6 -0
  173. package/dist/generated/manifest.d.ts.map +1 -0
  174. package/dist/generated/manifest.js +1473 -0
  175. package/dist/generated/manifest.js.map +1 -0
  176. package/dist/generated/schemas.d.ts +127 -0
  177. package/dist/generated/schemas.d.ts.map +1 -0
  178. package/dist/generated/schemas.js +545 -0
  179. package/dist/generated/schemas.js.map +1 -0
  180. package/dist/generated/types.d.ts +829 -0
  181. package/dist/generated/types.d.ts.map +1 -0
  182. package/dist/generated/types.js +5 -0
  183. package/dist/generated/types.js.map +1 -0
  184. package/dist/identity.d.ts +10 -0
  185. package/dist/identity.d.ts.map +1 -0
  186. package/dist/identity.js +33 -0
  187. package/dist/identity.js.map +1 -0
  188. package/dist/index.d.ts +3 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +3 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/program.d.ts +6 -0
  193. package/dist/program.d.ts.map +1 -0
  194. package/dist/program.js +65 -0
  195. package/dist/program.js.map +1 -0
  196. package/dist/sample/comments.d.ts +61 -0
  197. package/dist/sample/comments.d.ts.map +1 -0
  198. package/dist/sample/comments.js +39 -0
  199. package/dist/sample/comments.js.map +1 -0
  200. package/dist/sample/records.d.ts +16 -0
  201. package/dist/sample/records.d.ts.map +1 -0
  202. package/dist/sample/records.js +22 -0
  203. package/dist/sample/records.js.map +1 -0
  204. package/dist/sample/transport.d.ts +42 -0
  205. package/dist/sample/transport.d.ts.map +1 -0
  206. package/dist/sample/transport.js +153 -0
  207. package/dist/sample/transport.js.map +1 -0
  208. package/dist/version.d.ts +2 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +2 -0
  211. package/dist/version.js.map +1 -0
  212. package/dist/wcat.d.ts +3 -0
  213. package/dist/wcat.d.ts.map +1 -0
  214. package/dist/wcat.js +4 -0
  215. package/dist/wcat.js.map +1 -0
  216. package/dist/yandex/source.d.ts +39 -0
  217. package/dist/yandex/source.d.ts.map +1 -0
  218. package/dist/yandex/source.js +189 -0
  219. package/dist/yandex/source.js.map +1 -0
  220. package/dist/yandex/transport.d.ts +41 -0
  221. package/dist/yandex/transport.d.ts.map +1 -0
  222. package/dist/yandex/transport.js +152 -0
  223. package/dist/yandex/transport.js.map +1 -0
  224. package/dist/yandex/writes.d.ts +27 -0
  225. package/dist/yandex/writes.d.ts.map +1 -0
  226. package/dist/yandex/writes.js +61 -0
  227. package/dist/yandex/writes.js.map +1 -0
  228. package/package.json +88 -4
  229. package/skills/yandex-disk-cli/SKILL.md +46 -0
  230. package/skills/yandex-disk-cli/references/api/api-disk-operations-operation-id.md +13 -0
  231. package/skills/yandex-disk-cli/references/api/api-disk-public-resources.md +50 -0
  232. package/skills/yandex-disk-cli/references/api/api-disk-resources.md +171 -0
  233. package/skills/yandex-disk-cli/references/api/api-disk-trash-resources.md +48 -0
  234. package/skills/yandex-disk-cli/references/api/api-disk.md +13 -0
  235. package/skills/yandex-disk-cli/references/api.md +17 -0
@@ -0,0 +1,1410 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/valibot@1.5.0_typescript@7.0.2/node_modules/valibot/dist/index.mjs
8
+ var store$4;
9
+ var DEFAULT_CONFIG = {
10
+ lang: void 0,
11
+ message: void 0,
12
+ abortEarly: void 0,
13
+ abortPipeEarly: void 0
14
+ };
15
+ // @__NO_SIDE_EFFECTS__
16
+ function getGlobalConfig(config$1) {
17
+ if (!config$1 && !store$4) return DEFAULT_CONFIG;
18
+ return {
19
+ lang: config$1?.lang ?? store$4?.lang,
20
+ message: config$1?.message,
21
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
22
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
23
+ };
24
+ }
25
+ __name(getGlobalConfig, "getGlobalConfig");
26
+ var store$3;
27
+ // @__NO_SIDE_EFFECTS__
28
+ function getGlobalMessage(lang) {
29
+ return store$3?.get(lang);
30
+ }
31
+ __name(getGlobalMessage, "getGlobalMessage");
32
+ var store$2;
33
+ // @__NO_SIDE_EFFECTS__
34
+ function getSchemaMessage(lang) {
35
+ return store$2?.get(lang);
36
+ }
37
+ __name(getSchemaMessage, "getSchemaMessage");
38
+ var store$1;
39
+ // @__NO_SIDE_EFFECTS__
40
+ function getSpecificMessage(reference, lang) {
41
+ return store$1?.get(reference)?.get(lang);
42
+ }
43
+ __name(getSpecificMessage, "getSpecificMessage");
44
+ // @__NO_SIDE_EFFECTS__
45
+ function _stringify(input) {
46
+ const type = typeof input;
47
+ if (type === "string") return `"${input}"`;
48
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
49
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
50
+ return type;
51
+ }
52
+ __name(_stringify, "_stringify");
53
+ function _addIssue(context, label, dataset, config$1, other) {
54
+ const input = other && "input" in other ? other.input : dataset.value;
55
+ const expected = other?.expected ?? context.expects ?? null;
56
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
57
+ const issue = {
58
+ kind: context.kind,
59
+ type: context.type,
60
+ input,
61
+ expected,
62
+ received,
63
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
64
+ requirement: context.requirement,
65
+ path: other?.path,
66
+ issues: other?.issues,
67
+ lang: config$1.lang,
68
+ abortEarly: config$1.abortEarly,
69
+ abortPipeEarly: config$1.abortPipeEarly
70
+ };
71
+ const isSchema = context.kind === "schema";
72
+ const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
73
+ if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
74
+ if (isSchema) dataset.typed = false;
75
+ if (dataset.issues) dataset.issues.push(issue);
76
+ else dataset.issues = [issue];
77
+ }
78
+ __name(_addIssue, "_addIssue");
79
+ // @__NO_SIDE_EFFECTS__
80
+ function _isSameValueZero(value1, value2) {
81
+ return value1 === value2 || Number.isNaN(value1) && Number.isNaN(value2);
82
+ }
83
+ __name(_isSameValueZero, "_isSameValueZero");
84
+ // @__NO_SIDE_EFFECTS__
85
+ function _isValidObjectKey(object$1, key) {
86
+ return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
87
+ }
88
+ __name(_isValidObjectKey, "_isValidObjectKey");
89
+ // @__NO_SIDE_EFFECTS__
90
+ function _joinExpects(values$1, separator) {
91
+ const list = [...new Set(values$1)];
92
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
93
+ return list[0] ?? "never";
94
+ }
95
+ __name(_joinExpects, "_joinExpects");
96
+ function _standardSchema(schema) {
97
+ schema["~standard"] = {
98
+ version: 1,
99
+ vendor: "valibot",
100
+ validate: /* @__PURE__ */ __name((value$1) => schema["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig()), "validate")
101
+ };
102
+ return schema;
103
+ }
104
+ __name(_standardSchema, "_standardSchema");
105
+ // @__NO_SIDE_EFFECTS__
106
+ function getDotPath(issue) {
107
+ if (issue.path) {
108
+ let key = "";
109
+ for (const item of issue.path) if (typeof item.key === "string" || typeof item.key === "number") if (key) key += `.${item.key}`;
110
+ else key += item.key;
111
+ else return null;
112
+ return key;
113
+ }
114
+ return null;
115
+ }
116
+ __name(getDotPath, "getDotPath");
117
+ var ValiError = class extends Error {
118
+ static {
119
+ __name(this, "ValiError");
120
+ }
121
+ /**
122
+ * Creates a Valibot error with useful information.
123
+ *
124
+ * @param issues The error issues.
125
+ */
126
+ constructor(issues) {
127
+ super(issues[0].message);
128
+ this.name = "ValiError";
129
+ this.issues = issues;
130
+ }
131
+ };
132
+ var EMOJI_REGEX = new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$", "u");
133
+ var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
134
+ var ISO_TIMESTAMP_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;
135
+ // @__NO_SIDE_EFFECTS__
136
+ function check(requirement, message$1) {
137
+ return {
138
+ kind: "validation",
139
+ type: "check",
140
+ reference: check,
141
+ async: false,
142
+ expects: null,
143
+ requirement,
144
+ message: message$1,
145
+ "~run"(dataset, config$1) {
146
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
147
+ return dataset;
148
+ }
149
+ };
150
+ }
151
+ __name(check, "check");
152
+ // @__NO_SIDE_EFFECTS__
153
+ function description(description_) {
154
+ return {
155
+ kind: "metadata",
156
+ type: "description",
157
+ reference: description,
158
+ description: description_
159
+ };
160
+ }
161
+ __name(description, "description");
162
+ // @__NO_SIDE_EFFECTS__
163
+ function endsWith(requirement, message$1) {
164
+ return {
165
+ kind: "validation",
166
+ type: "ends_with",
167
+ reference: endsWith,
168
+ async: false,
169
+ expects: `"${requirement}"`,
170
+ requirement,
171
+ message: message$1,
172
+ "~run"(dataset, config$1) {
173
+ if (dataset.typed && !dataset.value.endsWith(this.requirement)) _addIssue(this, "end", dataset, config$1, { received: `"${dataset.value.slice(-this.requirement.length)}"` });
174
+ return dataset;
175
+ }
176
+ };
177
+ }
178
+ __name(endsWith, "endsWith");
179
+ // @__NO_SIDE_EFFECTS__
180
+ function finite(message$1) {
181
+ return {
182
+ kind: "validation",
183
+ type: "finite",
184
+ reference: finite,
185
+ async: false,
186
+ expects: null,
187
+ requirement: Number.isFinite,
188
+ message: message$1,
189
+ "~run"(dataset, config$1) {
190
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "finite", dataset, config$1);
191
+ return dataset;
192
+ }
193
+ };
194
+ }
195
+ __name(finite, "finite");
196
+ // @__NO_SIDE_EFFECTS__
197
+ function integer(message$1) {
198
+ return {
199
+ kind: "validation",
200
+ type: "integer",
201
+ reference: integer,
202
+ async: false,
203
+ expects: null,
204
+ requirement: Number.isInteger,
205
+ message: message$1,
206
+ "~run"(dataset, config$1) {
207
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
208
+ return dataset;
209
+ }
210
+ };
211
+ }
212
+ __name(integer, "integer");
213
+ // @__NO_SIDE_EFFECTS__
214
+ function isoDate(message$1) {
215
+ return {
216
+ kind: "validation",
217
+ type: "iso_date",
218
+ reference: isoDate,
219
+ async: false,
220
+ expects: null,
221
+ requirement: ISO_DATE_REGEX,
222
+ message: message$1,
223
+ "~run"(dataset, config$1) {
224
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
225
+ return dataset;
226
+ }
227
+ };
228
+ }
229
+ __name(isoDate, "isoDate");
230
+ // @__NO_SIDE_EFFECTS__
231
+ function isoTimestamp(message$1) {
232
+ return {
233
+ kind: "validation",
234
+ type: "iso_timestamp",
235
+ reference: isoTimestamp,
236
+ async: false,
237
+ expects: null,
238
+ requirement: ISO_TIMESTAMP_REGEX,
239
+ message: message$1,
240
+ "~run"(dataset, config$1) {
241
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
242
+ return dataset;
243
+ }
244
+ };
245
+ }
246
+ __name(isoTimestamp, "isoTimestamp");
247
+ // @__NO_SIDE_EFFECTS__
248
+ function maxEntries(requirement, message$1) {
249
+ return {
250
+ kind: "validation",
251
+ type: "max_entries",
252
+ reference: maxEntries,
253
+ async: false,
254
+ expects: `<=${requirement}`,
255
+ requirement,
256
+ message: message$1,
257
+ "~run"(dataset, config$1) {
258
+ if (!dataset.typed) return dataset;
259
+ const count = Object.keys(dataset.value).length;
260
+ if (dataset.typed && count > this.requirement) _addIssue(this, "entries", dataset, config$1, { received: `${count}` });
261
+ return dataset;
262
+ }
263
+ };
264
+ }
265
+ __name(maxEntries, "maxEntries");
266
+ // @__NO_SIDE_EFFECTS__
267
+ function maxLength(requirement, message$1) {
268
+ return {
269
+ kind: "validation",
270
+ type: "max_length",
271
+ reference: maxLength,
272
+ async: false,
273
+ expects: `<=${requirement}`,
274
+ requirement,
275
+ message: message$1,
276
+ "~run"(dataset, config$1) {
277
+ if (dataset.typed && dataset.value.length > this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
278
+ return dataset;
279
+ }
280
+ };
281
+ }
282
+ __name(maxLength, "maxLength");
283
+ // @__NO_SIDE_EFFECTS__
284
+ function maxValue(requirement, message$1) {
285
+ return {
286
+ kind: "validation",
287
+ type: "max_value",
288
+ reference: maxValue,
289
+ async: false,
290
+ expects: `<=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
291
+ requirement,
292
+ message: message$1,
293
+ "~run"(dataset, config$1) {
294
+ if (dataset.typed && !(dataset.value <= this.requirement)) _addIssue(this, "value", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });
295
+ return dataset;
296
+ }
297
+ };
298
+ }
299
+ __name(maxValue, "maxValue");
300
+ // @__NO_SIDE_EFFECTS__
301
+ function minLength(requirement, message$1) {
302
+ return {
303
+ kind: "validation",
304
+ type: "min_length",
305
+ reference: minLength,
306
+ async: false,
307
+ expects: `>=${requirement}`,
308
+ requirement,
309
+ message: message$1,
310
+ "~run"(dataset, config$1) {
311
+ if (dataset.typed && dataset.value.length < this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
312
+ return dataset;
313
+ }
314
+ };
315
+ }
316
+ __name(minLength, "minLength");
317
+ // @__NO_SIDE_EFFECTS__
318
+ function minValue(requirement, message$1) {
319
+ return {
320
+ kind: "validation",
321
+ type: "min_value",
322
+ reference: minValue,
323
+ async: false,
324
+ expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
325
+ requirement,
326
+ message: message$1,
327
+ "~run"(dataset, config$1) {
328
+ if (dataset.typed && !(dataset.value >= this.requirement)) _addIssue(this, "value", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });
329
+ return dataset;
330
+ }
331
+ };
332
+ }
333
+ __name(minValue, "minValue");
334
+ // @__NO_SIDE_EFFECTS__
335
+ function nonEmpty(message$1) {
336
+ return {
337
+ kind: "validation",
338
+ type: "non_empty",
339
+ reference: nonEmpty,
340
+ async: false,
341
+ expects: "!0",
342
+ message: message$1,
343
+ "~run"(dataset, config$1) {
344
+ if (dataset.typed && dataset.value.length === 0) _addIssue(this, "length", dataset, config$1, { received: "0" });
345
+ return dataset;
346
+ }
347
+ };
348
+ }
349
+ __name(nonEmpty, "nonEmpty");
350
+ // @__NO_SIDE_EFFECTS__
351
+ function regex(requirement, message$1) {
352
+ return {
353
+ kind: "validation",
354
+ type: "regex",
355
+ reference: regex,
356
+ async: false,
357
+ expects: `${requirement}`,
358
+ requirement,
359
+ message: message$1,
360
+ "~run"(dataset, config$1) {
361
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config$1);
362
+ return dataset;
363
+ }
364
+ };
365
+ }
366
+ __name(regex, "regex");
367
+ // @__NO_SIDE_EFFECTS__
368
+ function safeInteger(message$1) {
369
+ return {
370
+ kind: "validation",
371
+ type: "safe_integer",
372
+ reference: safeInteger,
373
+ async: false,
374
+ expects: null,
375
+ requirement: Number.isSafeInteger,
376
+ message: message$1,
377
+ "~run"(dataset, config$1) {
378
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "safe integer", dataset, config$1);
379
+ return dataset;
380
+ }
381
+ };
382
+ }
383
+ __name(safeInteger, "safeInteger");
384
+ // @__NO_SIDE_EFFECTS__
385
+ function startsWith(requirement, message$1) {
386
+ return {
387
+ kind: "validation",
388
+ type: "starts_with",
389
+ reference: startsWith,
390
+ async: false,
391
+ expects: `"${requirement}"`,
392
+ requirement,
393
+ message: message$1,
394
+ "~run"(dataset, config$1) {
395
+ if (dataset.typed && !dataset.value.startsWith(this.requirement)) _addIssue(this, "start", dataset, config$1, { received: `"${dataset.value.slice(0, this.requirement.length)}"` });
396
+ return dataset;
397
+ }
398
+ };
399
+ }
400
+ __name(startsWith, "startsWith");
401
+ // @__NO_SIDE_EFFECTS__
402
+ function transform(operation) {
403
+ return {
404
+ kind: "transformation",
405
+ type: "transform",
406
+ reference: transform,
407
+ async: false,
408
+ operation,
409
+ "~run"(dataset) {
410
+ dataset.value = this.operation(dataset.value);
411
+ return dataset;
412
+ }
413
+ };
414
+ }
415
+ __name(transform, "transform");
416
+ // @__NO_SIDE_EFFECTS__
417
+ function trim() {
418
+ return {
419
+ kind: "transformation",
420
+ type: "trim",
421
+ reference: trim,
422
+ async: false,
423
+ "~run"(dataset) {
424
+ dataset.value = dataset.value.trim();
425
+ return dataset;
426
+ }
427
+ };
428
+ }
429
+ __name(trim, "trim");
430
+ // @__NO_SIDE_EFFECTS__
431
+ function url(message$1) {
432
+ return {
433
+ kind: "validation",
434
+ type: "url",
435
+ reference: url,
436
+ async: false,
437
+ expects: null,
438
+ requirement(input) {
439
+ try {
440
+ if (URL.canParse) return URL.canParse(input);
441
+ new URL(input);
442
+ return true;
443
+ } catch {
444
+ return false;
445
+ }
446
+ },
447
+ message: message$1,
448
+ "~run"(dataset, config$1) {
449
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
450
+ return dataset;
451
+ }
452
+ };
453
+ }
454
+ __name(url, "url");
455
+ var ABORT_EARLY_CONFIG = { abortEarly: true };
456
+ // @__NO_SIDE_EFFECTS__
457
+ function getFallback(schema, dataset, config$1) {
458
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
459
+ }
460
+ __name(getFallback, "getFallback");
461
+ // @__NO_SIDE_EFFECTS__
462
+ function forward(action, path) {
463
+ return {
464
+ ...action,
465
+ "~run"(dataset, config$1) {
466
+ const prevIssues = dataset.issues && [...dataset.issues];
467
+ dataset = action["~run"](dataset, config$1);
468
+ if (dataset.issues) {
469
+ for (const issue of dataset.issues) if (!prevIssues?.includes(issue)) {
470
+ let pathInput = dataset.value;
471
+ for (const key of path) {
472
+ const pathValue = pathInput[key];
473
+ const pathItem = {
474
+ type: "unknown",
475
+ origin: "value",
476
+ input: pathInput,
477
+ key,
478
+ value: pathValue
479
+ };
480
+ if (issue.path) issue.path.push(pathItem);
481
+ else issue.path = [pathItem];
482
+ if (!pathValue) break;
483
+ pathInput = pathValue;
484
+ }
485
+ }
486
+ }
487
+ return dataset;
488
+ }
489
+ };
490
+ }
491
+ __name(forward, "forward");
492
+ // @__NO_SIDE_EFFECTS__
493
+ function getDefault(schema, dataset, config$1) {
494
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
495
+ }
496
+ __name(getDefault, "getDefault");
497
+ // @__NO_SIDE_EFFECTS__
498
+ function array(item, message$1) {
499
+ return _standardSchema({
500
+ kind: "schema",
501
+ type: "array",
502
+ reference: array,
503
+ expects: "Array",
504
+ async: false,
505
+ item,
506
+ message: message$1,
507
+ "~run"(dataset, config$1) {
508
+ const input = dataset.value;
509
+ if (Array.isArray(input)) {
510
+ dataset.typed = true;
511
+ dataset.value = [];
512
+ for (let key = 0; key < input.length; key++) {
513
+ const value$1 = input[key];
514
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
515
+ if (itemDataset.issues) {
516
+ const pathItem = {
517
+ type: "array",
518
+ origin: "value",
519
+ input,
520
+ key,
521
+ value: value$1
522
+ };
523
+ for (const issue of itemDataset.issues) {
524
+ if (issue.path) issue.path.unshift(pathItem);
525
+ else issue.path = [pathItem];
526
+ dataset.issues?.push(issue);
527
+ }
528
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
529
+ if (config$1.abortEarly) {
530
+ dataset.typed = false;
531
+ break;
532
+ }
533
+ }
534
+ if (!itemDataset.typed) dataset.typed = false;
535
+ dataset.value.push(itemDataset.value);
536
+ }
537
+ } else _addIssue(this, "type", dataset, config$1);
538
+ return dataset;
539
+ }
540
+ });
541
+ }
542
+ __name(array, "array");
543
+ // @__NO_SIDE_EFFECTS__
544
+ function boolean(message$1) {
545
+ return _standardSchema({
546
+ kind: "schema",
547
+ type: "boolean",
548
+ reference: boolean,
549
+ expects: "boolean",
550
+ async: false,
551
+ message: message$1,
552
+ "~run"(dataset, config$1) {
553
+ if (typeof dataset.value === "boolean") dataset.typed = true;
554
+ else _addIssue(this, "type", dataset, config$1);
555
+ return dataset;
556
+ }
557
+ });
558
+ }
559
+ __name(boolean, "boolean");
560
+ // @__NO_SIDE_EFFECTS__
561
+ function custom(check$1, message$1) {
562
+ return _standardSchema({
563
+ kind: "schema",
564
+ type: "custom",
565
+ reference: custom,
566
+ expects: "unknown",
567
+ async: false,
568
+ check: check$1,
569
+ message: message$1,
570
+ "~run"(dataset, config$1) {
571
+ if (this.check(dataset.value)) dataset.typed = true;
572
+ else _addIssue(this, "type", dataset, config$1);
573
+ return dataset;
574
+ }
575
+ });
576
+ }
577
+ __name(custom, "custom");
578
+ // @__NO_SIDE_EFFECTS__
579
+ function exactOptional(wrapped, default_) {
580
+ return _standardSchema({
581
+ kind: "schema",
582
+ type: "exact_optional",
583
+ reference: exactOptional,
584
+ expects: wrapped.expects,
585
+ async: false,
586
+ wrapped,
587
+ default: default_,
588
+ "~run"(dataset, config$1) {
589
+ return this.wrapped["~run"](dataset, config$1);
590
+ }
591
+ });
592
+ }
593
+ __name(exactOptional, "exactOptional");
594
+ // @__NO_SIDE_EFFECTS__
595
+ function function_(message$1) {
596
+ return _standardSchema({
597
+ kind: "schema",
598
+ type: "function",
599
+ reference: function_,
600
+ expects: "Function",
601
+ async: false,
602
+ message: message$1,
603
+ "~run"(dataset, config$1) {
604
+ if (typeof dataset.value === "function") dataset.typed = true;
605
+ else _addIssue(this, "type", dataset, config$1);
606
+ return dataset;
607
+ }
608
+ });
609
+ }
610
+ __name(function_, "function_");
611
+ // @__NO_SIDE_EFFECTS__
612
+ function lazy(getter) {
613
+ return _standardSchema({
614
+ kind: "schema",
615
+ type: "lazy",
616
+ reference: lazy,
617
+ expects: "unknown",
618
+ async: false,
619
+ getter,
620
+ "~run"(dataset, config$1) {
621
+ return this.getter(dataset.value)["~run"](dataset, config$1);
622
+ }
623
+ });
624
+ }
625
+ __name(lazy, "lazy");
626
+ // @__NO_SIDE_EFFECTS__
627
+ function literal(literal_, message$1) {
628
+ return _standardSchema({
629
+ kind: "schema",
630
+ type: "literal",
631
+ reference: literal,
632
+ expects: /* @__PURE__ */ _stringify(literal_),
633
+ async: false,
634
+ literal: literal_,
635
+ message: message$1,
636
+ "~run"(dataset, config$1) {
637
+ if (/* @__PURE__ */ _isSameValueZero(dataset.value, this.literal)) dataset.typed = true;
638
+ else _addIssue(this, "type", dataset, config$1);
639
+ return dataset;
640
+ }
641
+ });
642
+ }
643
+ __name(literal, "literal");
644
+ // @__NO_SIDE_EFFECTS__
645
+ function looseObject(entries$1, message$1) {
646
+ return _standardSchema({
647
+ kind: "schema",
648
+ type: "loose_object",
649
+ reference: looseObject,
650
+ expects: "Object",
651
+ async: false,
652
+ entries: entries$1,
653
+ message: message$1,
654
+ "~run"(dataset, config$1) {
655
+ const input = dataset.value;
656
+ if (input && typeof input === "object") {
657
+ dataset.typed = true;
658
+ dataset.value = {};
659
+ for (const key in this.entries) {
660
+ const valueSchema = this.entries[key];
661
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
662
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
663
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
664
+ if (valueDataset.issues) {
665
+ const pathItem = {
666
+ type: "object",
667
+ origin: "value",
668
+ input,
669
+ key,
670
+ value: value$1
671
+ };
672
+ for (const issue of valueDataset.issues) {
673
+ if (issue.path) issue.path.unshift(pathItem);
674
+ else issue.path = [pathItem];
675
+ dataset.issues?.push(issue);
676
+ }
677
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
678
+ if (config$1.abortEarly) {
679
+ dataset.typed = false;
680
+ break;
681
+ }
682
+ }
683
+ if (!valueDataset.typed) dataset.typed = false;
684
+ dataset.value[key] = valueDataset.value;
685
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
686
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
687
+ _addIssue(this, "key", dataset, config$1, {
688
+ input: void 0,
689
+ expected: `"${key}"`,
690
+ path: [{
691
+ type: "object",
692
+ origin: "key",
693
+ input,
694
+ key,
695
+ value: input[key]
696
+ }]
697
+ });
698
+ if (config$1.abortEarly) break;
699
+ }
700
+ }
701
+ if (!dataset.issues || !config$1.abortEarly) {
702
+ for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !Object.prototype.hasOwnProperty.call(this.entries, key)) dataset.value[key] = input[key];
703
+ }
704
+ } else _addIssue(this, "type", dataset, config$1);
705
+ return dataset;
706
+ }
707
+ });
708
+ }
709
+ __name(looseObject, "looseObject");
710
+ // @__NO_SIDE_EFFECTS__
711
+ function null_(message$1) {
712
+ return _standardSchema({
713
+ kind: "schema",
714
+ type: "null",
715
+ reference: null_,
716
+ expects: "null",
717
+ async: false,
718
+ message: message$1,
719
+ "~run"(dataset, config$1) {
720
+ if (dataset.value === null) dataset.typed = true;
721
+ else _addIssue(this, "type", dataset, config$1);
722
+ return dataset;
723
+ }
724
+ });
725
+ }
726
+ __name(null_, "null_");
727
+ // @__NO_SIDE_EFFECTS__
728
+ function nullable(wrapped, default_) {
729
+ return _standardSchema({
730
+ kind: "schema",
731
+ type: "nullable",
732
+ reference: nullable,
733
+ expects: `(${wrapped.expects} | null)`,
734
+ async: false,
735
+ wrapped,
736
+ default: default_,
737
+ "~run"(dataset, config$1) {
738
+ if (dataset.value === null) {
739
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
740
+ if (dataset.value === null) {
741
+ dataset.typed = true;
742
+ return dataset;
743
+ }
744
+ }
745
+ return this.wrapped["~run"](dataset, config$1);
746
+ }
747
+ });
748
+ }
749
+ __name(nullable, "nullable");
750
+ // @__NO_SIDE_EFFECTS__
751
+ function nullish(wrapped, default_) {
752
+ return _standardSchema({
753
+ kind: "schema",
754
+ type: "nullish",
755
+ reference: nullish,
756
+ expects: `(${wrapped.expects} | null | undefined)`,
757
+ async: false,
758
+ wrapped,
759
+ default: default_,
760
+ "~run"(dataset, config$1) {
761
+ if (dataset.value === null || dataset.value === void 0) {
762
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
763
+ if (dataset.value === null || dataset.value === void 0) {
764
+ dataset.typed = true;
765
+ return dataset;
766
+ }
767
+ }
768
+ return this.wrapped["~run"](dataset, config$1);
769
+ }
770
+ });
771
+ }
772
+ __name(nullish, "nullish");
773
+ // @__NO_SIDE_EFFECTS__
774
+ function number(message$1) {
775
+ return _standardSchema({
776
+ kind: "schema",
777
+ type: "number",
778
+ reference: number,
779
+ expects: "number",
780
+ async: false,
781
+ message: message$1,
782
+ "~run"(dataset, config$1) {
783
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
784
+ else _addIssue(this, "type", dataset, config$1);
785
+ return dataset;
786
+ }
787
+ });
788
+ }
789
+ __name(number, "number");
790
+ // @__NO_SIDE_EFFECTS__
791
+ function object(entries$1, message$1) {
792
+ return _standardSchema({
793
+ kind: "schema",
794
+ type: "object",
795
+ reference: object,
796
+ expects: "Object",
797
+ async: false,
798
+ entries: entries$1,
799
+ message: message$1,
800
+ "~run"(dataset, config$1) {
801
+ const input = dataset.value;
802
+ if (input && typeof input === "object") {
803
+ dataset.typed = true;
804
+ dataset.value = {};
805
+ for (const key in this.entries) {
806
+ const valueSchema = this.entries[key];
807
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
808
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
809
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
810
+ if (valueDataset.issues) {
811
+ const pathItem = {
812
+ type: "object",
813
+ origin: "value",
814
+ input,
815
+ key,
816
+ value: value$1
817
+ };
818
+ for (const issue of valueDataset.issues) {
819
+ if (issue.path) issue.path.unshift(pathItem);
820
+ else issue.path = [pathItem];
821
+ dataset.issues?.push(issue);
822
+ }
823
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
824
+ if (config$1.abortEarly) {
825
+ dataset.typed = false;
826
+ break;
827
+ }
828
+ }
829
+ if (!valueDataset.typed) dataset.typed = false;
830
+ dataset.value[key] = valueDataset.value;
831
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
832
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
833
+ _addIssue(this, "key", dataset, config$1, {
834
+ input: void 0,
835
+ expected: `"${key}"`,
836
+ path: [{
837
+ type: "object",
838
+ origin: "key",
839
+ input,
840
+ key,
841
+ value: input[key]
842
+ }]
843
+ });
844
+ if (config$1.abortEarly) break;
845
+ }
846
+ }
847
+ } else _addIssue(this, "type", dataset, config$1);
848
+ return dataset;
849
+ }
850
+ });
851
+ }
852
+ __name(object, "object");
853
+ // @__NO_SIDE_EFFECTS__
854
+ function objectWithRest(entries$1, rest, message$1) {
855
+ return _standardSchema({
856
+ kind: "schema",
857
+ type: "object_with_rest",
858
+ reference: objectWithRest,
859
+ expects: "Object",
860
+ async: false,
861
+ entries: entries$1,
862
+ rest,
863
+ message: message$1,
864
+ "~run"(dataset, config$1) {
865
+ const input = dataset.value;
866
+ if (input && typeof input === "object") {
867
+ dataset.typed = true;
868
+ dataset.value = {};
869
+ for (const key in this.entries) {
870
+ const valueSchema = this.entries[key];
871
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
872
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
873
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
874
+ if (valueDataset.issues) {
875
+ const pathItem = {
876
+ type: "object",
877
+ origin: "value",
878
+ input,
879
+ key,
880
+ value: value$1
881
+ };
882
+ for (const issue of valueDataset.issues) {
883
+ if (issue.path) issue.path.unshift(pathItem);
884
+ else issue.path = [pathItem];
885
+ dataset.issues?.push(issue);
886
+ }
887
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
888
+ if (config$1.abortEarly) {
889
+ dataset.typed = false;
890
+ break;
891
+ }
892
+ }
893
+ if (!valueDataset.typed) dataset.typed = false;
894
+ dataset.value[key] = valueDataset.value;
895
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
896
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
897
+ _addIssue(this, "key", dataset, config$1, {
898
+ input: void 0,
899
+ expected: `"${key}"`,
900
+ path: [{
901
+ type: "object",
902
+ origin: "key",
903
+ input,
904
+ key,
905
+ value: input[key]
906
+ }]
907
+ });
908
+ if (config$1.abortEarly) break;
909
+ }
910
+ }
911
+ if (!dataset.issues || !config$1.abortEarly) {
912
+ for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !Object.prototype.hasOwnProperty.call(this.entries, key)) {
913
+ const valueDataset = this.rest["~run"]({ value: input[key] }, config$1);
914
+ if (valueDataset.issues) {
915
+ const pathItem = {
916
+ type: "object",
917
+ origin: "value",
918
+ input,
919
+ key,
920
+ value: input[key]
921
+ };
922
+ for (const issue of valueDataset.issues) {
923
+ if (issue.path) issue.path.unshift(pathItem);
924
+ else issue.path = [pathItem];
925
+ dataset.issues?.push(issue);
926
+ }
927
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
928
+ if (config$1.abortEarly) {
929
+ dataset.typed = false;
930
+ break;
931
+ }
932
+ }
933
+ if (!valueDataset.typed) dataset.typed = false;
934
+ dataset.value[key] = valueDataset.value;
935
+ }
936
+ }
937
+ } else _addIssue(this, "type", dataset, config$1);
938
+ return dataset;
939
+ }
940
+ });
941
+ }
942
+ __name(objectWithRest, "objectWithRest");
943
+ // @__NO_SIDE_EFFECTS__
944
+ function optional(wrapped, default_) {
945
+ return _standardSchema({
946
+ kind: "schema",
947
+ type: "optional",
948
+ reference: optional,
949
+ expects: `(${wrapped.expects} | undefined)`,
950
+ async: false,
951
+ wrapped,
952
+ default: default_,
953
+ "~run"(dataset, config$1) {
954
+ if (dataset.value === void 0) {
955
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
956
+ if (dataset.value === void 0) {
957
+ dataset.typed = true;
958
+ return dataset;
959
+ }
960
+ }
961
+ return this.wrapped["~run"](dataset, config$1);
962
+ }
963
+ });
964
+ }
965
+ __name(optional, "optional");
966
+ // @__NO_SIDE_EFFECTS__
967
+ function picklist(options, message$1) {
968
+ return _standardSchema({
969
+ kind: "schema",
970
+ type: "picklist",
971
+ reference: picklist,
972
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
973
+ async: false,
974
+ options,
975
+ message: message$1,
976
+ "~run"(dataset, config$1) {
977
+ if (this.options.includes(dataset.value)) dataset.typed = true;
978
+ else _addIssue(this, "type", dataset, config$1);
979
+ return dataset;
980
+ }
981
+ });
982
+ }
983
+ __name(picklist, "picklist");
984
+ // @__NO_SIDE_EFFECTS__
985
+ function record(key, value$1, message$1) {
986
+ return _standardSchema({
987
+ kind: "schema",
988
+ type: "record",
989
+ reference: record,
990
+ expects: "Object",
991
+ async: false,
992
+ key,
993
+ value: value$1,
994
+ message: message$1,
995
+ "~run"(dataset, config$1) {
996
+ const input = dataset.value;
997
+ if (input && typeof input === "object") {
998
+ dataset.typed = true;
999
+ dataset.value = {};
1000
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
1001
+ const entryValue = input[entryKey];
1002
+ const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
1003
+ if (keyDataset.issues) {
1004
+ const pathItem = {
1005
+ type: "object",
1006
+ origin: "key",
1007
+ input,
1008
+ key: entryKey,
1009
+ value: entryValue
1010
+ };
1011
+ for (const issue of keyDataset.issues) {
1012
+ issue.path = [pathItem];
1013
+ dataset.issues?.push(issue);
1014
+ }
1015
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
1016
+ if (config$1.abortEarly) {
1017
+ dataset.typed = false;
1018
+ break;
1019
+ }
1020
+ }
1021
+ const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
1022
+ if (valueDataset.issues) {
1023
+ const pathItem = {
1024
+ type: "object",
1025
+ origin: "value",
1026
+ input,
1027
+ key: entryKey,
1028
+ value: entryValue
1029
+ };
1030
+ for (const issue of valueDataset.issues) {
1031
+ if (issue.path) issue.path.unshift(pathItem);
1032
+ else issue.path = [pathItem];
1033
+ dataset.issues?.push(issue);
1034
+ }
1035
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1036
+ if (config$1.abortEarly) {
1037
+ dataset.typed = false;
1038
+ break;
1039
+ }
1040
+ }
1041
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
1042
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
1043
+ }
1044
+ } else _addIssue(this, "type", dataset, config$1);
1045
+ return dataset;
1046
+ }
1047
+ });
1048
+ }
1049
+ __name(record, "record");
1050
+ // @__NO_SIDE_EFFECTS__
1051
+ function strictObject(entries$1, message$1) {
1052
+ return _standardSchema({
1053
+ kind: "schema",
1054
+ type: "strict_object",
1055
+ reference: strictObject,
1056
+ expects: "Object",
1057
+ async: false,
1058
+ entries: entries$1,
1059
+ message: message$1,
1060
+ "~run"(dataset, config$1) {
1061
+ const input = dataset.value;
1062
+ if (input && typeof input === "object") {
1063
+ dataset.typed = true;
1064
+ dataset.value = {};
1065
+ for (const key in this.entries) {
1066
+ const valueSchema = this.entries[key];
1067
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
1068
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
1069
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
1070
+ if (valueDataset.issues) {
1071
+ const pathItem = {
1072
+ type: "object",
1073
+ origin: "value",
1074
+ input,
1075
+ key,
1076
+ value: value$1
1077
+ };
1078
+ for (const issue of valueDataset.issues) {
1079
+ if (issue.path) issue.path.unshift(pathItem);
1080
+ else issue.path = [pathItem];
1081
+ dataset.issues?.push(issue);
1082
+ }
1083
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1084
+ if (config$1.abortEarly) {
1085
+ dataset.typed = false;
1086
+ break;
1087
+ }
1088
+ }
1089
+ if (!valueDataset.typed) dataset.typed = false;
1090
+ dataset.value[key] = valueDataset.value;
1091
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
1092
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
1093
+ _addIssue(this, "key", dataset, config$1, {
1094
+ input: void 0,
1095
+ expected: `"${key}"`,
1096
+ path: [{
1097
+ type: "object",
1098
+ origin: "key",
1099
+ input,
1100
+ key,
1101
+ value: input[key]
1102
+ }]
1103
+ });
1104
+ if (config$1.abortEarly) break;
1105
+ }
1106
+ }
1107
+ if (!dataset.issues || !config$1.abortEarly) {
1108
+ for (const key in input) if (!Object.prototype.hasOwnProperty.call(this.entries, key)) {
1109
+ _addIssue(this, "key", dataset, config$1, {
1110
+ input: key,
1111
+ expected: "never",
1112
+ path: [{
1113
+ type: "object",
1114
+ origin: "key",
1115
+ input,
1116
+ key,
1117
+ value: input[key]
1118
+ }]
1119
+ });
1120
+ break;
1121
+ }
1122
+ }
1123
+ } else _addIssue(this, "type", dataset, config$1);
1124
+ return dataset;
1125
+ }
1126
+ });
1127
+ }
1128
+ __name(strictObject, "strictObject");
1129
+ // @__NO_SIDE_EFFECTS__
1130
+ function string(message$1) {
1131
+ return _standardSchema({
1132
+ kind: "schema",
1133
+ type: "string",
1134
+ reference: string,
1135
+ expects: "string",
1136
+ async: false,
1137
+ message: message$1,
1138
+ "~run"(dataset, config$1) {
1139
+ if (typeof dataset.value === "string") dataset.typed = true;
1140
+ else _addIssue(this, "type", dataset, config$1);
1141
+ return dataset;
1142
+ }
1143
+ });
1144
+ }
1145
+ __name(string, "string");
1146
+ // @__NO_SIDE_EFFECTS__
1147
+ function _subIssues(datasets) {
1148
+ let issues;
1149
+ if (datasets) for (const dataset of datasets) if (issues) for (const issue of dataset.issues) issues.push(issue);
1150
+ else issues = dataset.issues;
1151
+ return issues;
1152
+ }
1153
+ __name(_subIssues, "_subIssues");
1154
+ // @__NO_SIDE_EFFECTS__
1155
+ function union(options, message$1) {
1156
+ return _standardSchema({
1157
+ kind: "schema",
1158
+ type: "union",
1159
+ reference: union,
1160
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1161
+ async: false,
1162
+ options,
1163
+ message: message$1,
1164
+ "~run"(dataset, config$1) {
1165
+ let validDataset;
1166
+ let typedDatasets;
1167
+ let untypedDatasets;
1168
+ for (const schema of this.options) {
1169
+ const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
1170
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1171
+ else typedDatasets = [optionDataset];
1172
+ else {
1173
+ validDataset = optionDataset;
1174
+ break;
1175
+ }
1176
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1177
+ else untypedDatasets = [optionDataset];
1178
+ }
1179
+ if (validDataset) return validDataset;
1180
+ if (typedDatasets) {
1181
+ if (typedDatasets.length === 1) return typedDatasets[0];
1182
+ _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1183
+ dataset.typed = true;
1184
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1185
+ else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1186
+ return dataset;
1187
+ }
1188
+ });
1189
+ }
1190
+ __name(union, "union");
1191
+ // @__NO_SIDE_EFFECTS__
1192
+ function unknown() {
1193
+ return _standardSchema({
1194
+ kind: "schema",
1195
+ type: "unknown",
1196
+ reference: unknown,
1197
+ expects: "unknown",
1198
+ async: false,
1199
+ "~run"(dataset) {
1200
+ dataset.typed = true;
1201
+ return dataset;
1202
+ }
1203
+ });
1204
+ }
1205
+ __name(unknown, "unknown");
1206
+ // @__NO_SIDE_EFFECTS__
1207
+ function variant(key, options, message$1) {
1208
+ return _standardSchema({
1209
+ kind: "schema",
1210
+ type: "variant",
1211
+ reference: variant,
1212
+ expects: "Object",
1213
+ async: false,
1214
+ key,
1215
+ options,
1216
+ message: message$1,
1217
+ "~run"(dataset, config$1) {
1218
+ const input = dataset.value;
1219
+ if (input && typeof input === "object") {
1220
+ let outputDataset;
1221
+ let maxDiscriminatorPriority = 0;
1222
+ let invalidDiscriminatorKey = this.key;
1223
+ let expectedDiscriminators = [];
1224
+ const parseOptions = /* @__PURE__ */ __name((variant$1, allKeys) => {
1225
+ for (const schema of variant$1.options) {
1226
+ if (schema.type === "variant") parseOptions(schema, new Set(allKeys).add(schema.key));
1227
+ else {
1228
+ let keysAreValid = true;
1229
+ let currentPriority = 0;
1230
+ for (const currentKey of allKeys) {
1231
+ const discriminatorSchema = schema.entries[currentKey];
1232
+ if (currentKey in input ? discriminatorSchema["~run"]({
1233
+ typed: false,
1234
+ value: input[currentKey]
1235
+ }, ABORT_EARLY_CONFIG).issues : discriminatorSchema.type !== "exact_optional" && discriminatorSchema.type !== "optional" && discriminatorSchema.type !== "nullish") {
1236
+ keysAreValid = false;
1237
+ if (invalidDiscriminatorKey !== currentKey && (maxDiscriminatorPriority < currentPriority || maxDiscriminatorPriority === currentPriority && currentKey in input && !(invalidDiscriminatorKey in input))) {
1238
+ maxDiscriminatorPriority = currentPriority;
1239
+ invalidDiscriminatorKey = currentKey;
1240
+ expectedDiscriminators = [];
1241
+ }
1242
+ if (invalidDiscriminatorKey === currentKey) expectedDiscriminators.push(schema.entries[currentKey].expects);
1243
+ break;
1244
+ }
1245
+ currentPriority++;
1246
+ }
1247
+ if (keysAreValid) {
1248
+ const optionDataset = schema["~run"]({ value: input }, config$1);
1249
+ if (!outputDataset || !outputDataset.typed && optionDataset.typed) outputDataset = optionDataset;
1250
+ }
1251
+ }
1252
+ if (outputDataset && !outputDataset.issues) break;
1253
+ }
1254
+ }, "parseOptions");
1255
+ parseOptions(this, /* @__PURE__ */ new Set([this.key]));
1256
+ if (outputDataset) return outputDataset;
1257
+ _addIssue(this, "type", dataset, config$1, {
1258
+ input: input[invalidDiscriminatorKey],
1259
+ expected: /* @__PURE__ */ _joinExpects(expectedDiscriminators, "|"),
1260
+ path: [{
1261
+ type: "object",
1262
+ origin: "value",
1263
+ input,
1264
+ key: invalidDiscriminatorKey,
1265
+ value: input[invalidDiscriminatorKey]
1266
+ }]
1267
+ });
1268
+ } else _addIssue(this, "type", dataset, config$1);
1269
+ return dataset;
1270
+ }
1271
+ });
1272
+ }
1273
+ __name(variant, "variant");
1274
+ // @__NO_SIDE_EFFECTS__
1275
+ function omit(schema, keys) {
1276
+ const entries$1 = { ...schema.entries };
1277
+ for (const key of keys) delete entries$1[key];
1278
+ return _standardSchema({
1279
+ ...schema,
1280
+ entries: entries$1
1281
+ });
1282
+ }
1283
+ __name(omit, "omit");
1284
+ function parse(schema, input, config$1) {
1285
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
1286
+ if (dataset.issues) throw new ValiError(dataset.issues);
1287
+ return dataset.value;
1288
+ }
1289
+ __name(parse, "parse");
1290
+ // @__NO_SIDE_EFFECTS__
1291
+ function partial(schema, keys) {
1292
+ const entries$1 = {};
1293
+ for (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
1294
+ return _standardSchema({
1295
+ ...schema,
1296
+ entries: entries$1
1297
+ });
1298
+ }
1299
+ __name(partial, "partial");
1300
+ // @__NO_SIDE_EFFECTS__
1301
+ function pick(schema, keys) {
1302
+ const entries$1 = {};
1303
+ for (const key of keys) entries$1[key] = schema.entries[key];
1304
+ return _standardSchema({
1305
+ ...schema,
1306
+ entries: entries$1
1307
+ });
1308
+ }
1309
+ __name(pick, "pick");
1310
+ // @__NO_SIDE_EFFECTS__
1311
+ function pipe(...pipe$1) {
1312
+ return _standardSchema({
1313
+ ...pipe$1[0],
1314
+ pipe: pipe$1,
1315
+ "~run"(dataset, config$1) {
1316
+ for (const item of pipe$1) if (item.kind !== "metadata") {
1317
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1318
+ dataset.typed = false;
1319
+ break;
1320
+ }
1321
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
1322
+ }
1323
+ return dataset;
1324
+ }
1325
+ });
1326
+ }
1327
+ __name(pipe, "pipe");
1328
+ // @__NO_SIDE_EFFECTS__
1329
+ function safeParse(schema, input, config$1) {
1330
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
1331
+ return {
1332
+ typed: dataset.typed,
1333
+ success: !dataset.issues,
1334
+ output: dataset.value,
1335
+ issues: dataset.issues
1336
+ };
1337
+ }
1338
+ __name(safeParse, "safeParse");
1339
+ // @__NO_SIDE_EFFECTS__
1340
+ function summarize(issues) {
1341
+ let summary = "";
1342
+ for (const issue of issues) {
1343
+ if (summary) summary += "\n";
1344
+ summary += `\xD7 ${issue.message}`;
1345
+ const dotPath = /* @__PURE__ */ getDotPath(issue);
1346
+ if (dotPath) summary += `
1347
+ \u2192 at ${dotPath}`;
1348
+ }
1349
+ return summary;
1350
+ }
1351
+ __name(summarize, "summarize");
1352
+ // @__NO_SIDE_EFFECTS__
1353
+ function unwrap(schema) {
1354
+ return schema.wrapped;
1355
+ }
1356
+ __name(unwrap, "unwrap");
1357
+
1358
+ export {
1359
+ getDotPath,
1360
+ check,
1361
+ description,
1362
+ endsWith,
1363
+ finite,
1364
+ integer,
1365
+ isoDate,
1366
+ isoTimestamp,
1367
+ maxEntries,
1368
+ maxLength,
1369
+ maxValue,
1370
+ minLength,
1371
+ minValue,
1372
+ nonEmpty,
1373
+ regex,
1374
+ safeInteger,
1375
+ startsWith,
1376
+ transform,
1377
+ trim,
1378
+ url,
1379
+ forward,
1380
+ array,
1381
+ boolean,
1382
+ custom,
1383
+ exactOptional,
1384
+ function_,
1385
+ lazy,
1386
+ literal,
1387
+ looseObject,
1388
+ null_,
1389
+ nullable,
1390
+ nullish,
1391
+ number,
1392
+ object,
1393
+ objectWithRest,
1394
+ optional,
1395
+ picklist,
1396
+ record,
1397
+ strictObject,
1398
+ string,
1399
+ union,
1400
+ unknown,
1401
+ variant,
1402
+ omit,
1403
+ parse,
1404
+ partial,
1405
+ pick,
1406
+ pipe,
1407
+ safeParse,
1408
+ summarize,
1409
+ unwrap
1410
+ };