drizzle-kit 0.20.17-8b4d89e → 0.20.17-940f46c

Sign up to get free protection for your applications and to get access to all the features.
package/utils-studio.mjs CHANGED
@@ -34,6 +34,516 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
38
+ function assembleStyles() {
39
+ const codes = /* @__PURE__ */ new Map();
40
+ for (const [groupName, group] of Object.entries(styles)) {
41
+ for (const [styleName, style] of Object.entries(group)) {
42
+ styles[styleName] = {
43
+ open: `\x1B[${style[0]}m`,
44
+ close: `\x1B[${style[1]}m`
45
+ };
46
+ group[styleName] = styles[styleName];
47
+ codes.set(style[0], style[1]);
48
+ }
49
+ Object.defineProperty(styles, groupName, {
50
+ value: group,
51
+ enumerable: false
52
+ });
53
+ }
54
+ Object.defineProperty(styles, "codes", {
55
+ value: codes,
56
+ enumerable: false
57
+ });
58
+ styles.color.close = "\x1B[39m";
59
+ styles.bgColor.close = "\x1B[49m";
60
+ styles.color.ansi = wrapAnsi16();
61
+ styles.color.ansi256 = wrapAnsi256();
62
+ styles.color.ansi16m = wrapAnsi16m();
63
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
64
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
65
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
66
+ Object.defineProperties(styles, {
67
+ rgbToAnsi256: {
68
+ value(red, green, blue) {
69
+ if (red === green && green === blue) {
70
+ if (red < 8) {
71
+ return 16;
72
+ }
73
+ if (red > 248) {
74
+ return 231;
75
+ }
76
+ return Math.round((red - 8) / 247 * 24) + 232;
77
+ }
78
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
79
+ },
80
+ enumerable: false
81
+ },
82
+ hexToRgb: {
83
+ value(hex) {
84
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
85
+ if (!matches) {
86
+ return [0, 0, 0];
87
+ }
88
+ let [colorString] = matches;
89
+ if (colorString.length === 3) {
90
+ colorString = [...colorString].map((character) => character + character).join("");
91
+ }
92
+ const integer = Number.parseInt(colorString, 16);
93
+ return [
94
+ /* eslint-disable no-bitwise */
95
+ integer >> 16 & 255,
96
+ integer >> 8 & 255,
97
+ integer & 255
98
+ /* eslint-enable no-bitwise */
99
+ ];
100
+ },
101
+ enumerable: false
102
+ },
103
+ hexToAnsi256: {
104
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
105
+ enumerable: false
106
+ },
107
+ ansi256ToAnsi: {
108
+ value(code) {
109
+ if (code < 8) {
110
+ return 30 + code;
111
+ }
112
+ if (code < 16) {
113
+ return 90 + (code - 8);
114
+ }
115
+ let red;
116
+ let green;
117
+ let blue;
118
+ if (code >= 232) {
119
+ red = ((code - 232) * 10 + 8) / 255;
120
+ green = red;
121
+ blue = red;
122
+ } else {
123
+ code -= 16;
124
+ const remainder = code % 36;
125
+ red = Math.floor(code / 36) / 5;
126
+ green = Math.floor(remainder / 6) / 5;
127
+ blue = remainder % 6 / 5;
128
+ }
129
+ const value = Math.max(red, green, blue) * 2;
130
+ if (value === 0) {
131
+ return 30;
132
+ }
133
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
134
+ if (value === 2) {
135
+ result += 60;
136
+ }
137
+ return result;
138
+ },
139
+ enumerable: false
140
+ },
141
+ rgbToAnsi: {
142
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
143
+ enumerable: false
144
+ },
145
+ hexToAnsi: {
146
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
147
+ enumerable: false
148
+ }
149
+ });
150
+ return styles;
151
+ }
152
+ var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
153
+ var init_ansi_styles = __esm({
154
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
155
+ ANSI_BACKGROUND_OFFSET = 10;
156
+ wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
157
+ wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
158
+ wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
159
+ styles = {
160
+ modifier: {
161
+ reset: [0, 0],
162
+ // 21 isn't widely supported and 22 does the same thing
163
+ bold: [1, 22],
164
+ dim: [2, 22],
165
+ italic: [3, 23],
166
+ underline: [4, 24],
167
+ overline: [53, 55],
168
+ inverse: [7, 27],
169
+ hidden: [8, 28],
170
+ strikethrough: [9, 29]
171
+ },
172
+ color: {
173
+ black: [30, 39],
174
+ red: [31, 39],
175
+ green: [32, 39],
176
+ yellow: [33, 39],
177
+ blue: [34, 39],
178
+ magenta: [35, 39],
179
+ cyan: [36, 39],
180
+ white: [37, 39],
181
+ // Bright color
182
+ blackBright: [90, 39],
183
+ gray: [90, 39],
184
+ // Alias of `blackBright`
185
+ grey: [90, 39],
186
+ // Alias of `blackBright`
187
+ redBright: [91, 39],
188
+ greenBright: [92, 39],
189
+ yellowBright: [93, 39],
190
+ blueBright: [94, 39],
191
+ magentaBright: [95, 39],
192
+ cyanBright: [96, 39],
193
+ whiteBright: [97, 39]
194
+ },
195
+ bgColor: {
196
+ bgBlack: [40, 49],
197
+ bgRed: [41, 49],
198
+ bgGreen: [42, 49],
199
+ bgYellow: [43, 49],
200
+ bgBlue: [44, 49],
201
+ bgMagenta: [45, 49],
202
+ bgCyan: [46, 49],
203
+ bgWhite: [47, 49],
204
+ // Bright color
205
+ bgBlackBright: [100, 49],
206
+ bgGray: [100, 49],
207
+ // Alias of `bgBlackBright`
208
+ bgGrey: [100, 49],
209
+ // Alias of `bgBlackBright`
210
+ bgRedBright: [101, 49],
211
+ bgGreenBright: [102, 49],
212
+ bgYellowBright: [103, 49],
213
+ bgBlueBright: [104, 49],
214
+ bgMagentaBright: [105, 49],
215
+ bgCyanBright: [106, 49],
216
+ bgWhiteBright: [107, 49]
217
+ }
218
+ };
219
+ modifierNames = Object.keys(styles.modifier);
220
+ foregroundColorNames = Object.keys(styles.color);
221
+ backgroundColorNames = Object.keys(styles.bgColor);
222
+ colorNames = [...foregroundColorNames, ...backgroundColorNames];
223
+ ansiStyles = assembleStyles();
224
+ ansi_styles_default = ansiStyles;
225
+ }
226
+ });
227
+
228
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
229
+ import process2 from "node:process";
230
+ import os from "node:os";
231
+ import tty from "node:tty";
232
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
233
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
234
+ const position = argv.indexOf(prefix + flag);
235
+ const terminatorPosition = argv.indexOf("--");
236
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
237
+ }
238
+ function envForceColor() {
239
+ if ("FORCE_COLOR" in env) {
240
+ if (env.FORCE_COLOR === "true") {
241
+ return 1;
242
+ }
243
+ if (env.FORCE_COLOR === "false") {
244
+ return 0;
245
+ }
246
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
247
+ }
248
+ }
249
+ function translateLevel(level) {
250
+ if (level === 0) {
251
+ return false;
252
+ }
253
+ return {
254
+ level,
255
+ hasBasic: true,
256
+ has256: level >= 2,
257
+ has16m: level >= 3
258
+ };
259
+ }
260
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
261
+ const noFlagForceColor = envForceColor();
262
+ if (noFlagForceColor !== void 0) {
263
+ flagForceColor = noFlagForceColor;
264
+ }
265
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
266
+ if (forceColor === 0) {
267
+ return 0;
268
+ }
269
+ if (sniffFlags) {
270
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
271
+ return 3;
272
+ }
273
+ if (hasFlag("color=256")) {
274
+ return 2;
275
+ }
276
+ }
277
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
278
+ return 1;
279
+ }
280
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
281
+ return 0;
282
+ }
283
+ const min = forceColor || 0;
284
+ if (env.TERM === "dumb") {
285
+ return min;
286
+ }
287
+ if (process2.platform === "win32") {
288
+ const osRelease = os.release().split(".");
289
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
290
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
291
+ }
292
+ return 1;
293
+ }
294
+ if ("CI" in env) {
295
+ if ("GITHUB_ACTIONS" in env) {
296
+ return 3;
297
+ }
298
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
299
+ return 1;
300
+ }
301
+ return min;
302
+ }
303
+ if ("TEAMCITY_VERSION" in env) {
304
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
305
+ }
306
+ if (env.COLORTERM === "truecolor") {
307
+ return 3;
308
+ }
309
+ if (env.TERM === "xterm-kitty") {
310
+ return 3;
311
+ }
312
+ if ("TERM_PROGRAM" in env) {
313
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
314
+ switch (env.TERM_PROGRAM) {
315
+ case "iTerm.app": {
316
+ return version >= 3 ? 3 : 2;
317
+ }
318
+ case "Apple_Terminal": {
319
+ return 2;
320
+ }
321
+ }
322
+ }
323
+ if (/-256(color)?$/i.test(env.TERM)) {
324
+ return 2;
325
+ }
326
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
327
+ return 1;
328
+ }
329
+ if ("COLORTERM" in env) {
330
+ return 1;
331
+ }
332
+ return min;
333
+ }
334
+ function createSupportsColor(stream, options = {}) {
335
+ const level = _supportsColor(stream, {
336
+ streamIsTTY: stream && stream.isTTY,
337
+ ...options
338
+ });
339
+ return translateLevel(level);
340
+ }
341
+ var env, flagForceColor, supportsColor, supports_color_default;
342
+ var init_supports_color = __esm({
343
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
344
+ ({ env } = process2);
345
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
346
+ flagForceColor = 0;
347
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
348
+ flagForceColor = 1;
349
+ }
350
+ supportsColor = {
351
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
352
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
353
+ };
354
+ supports_color_default = supportsColor;
355
+ }
356
+ });
357
+
358
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
359
+ function stringReplaceAll(string, substring, replacer) {
360
+ let index4 = string.indexOf(substring);
361
+ if (index4 === -1) {
362
+ return string;
363
+ }
364
+ const substringLength = substring.length;
365
+ let endIndex = 0;
366
+ let returnValue = "";
367
+ do {
368
+ returnValue += string.slice(endIndex, index4) + substring + replacer;
369
+ endIndex = index4 + substringLength;
370
+ index4 = string.indexOf(substring, endIndex);
371
+ } while (index4 !== -1);
372
+ returnValue += string.slice(endIndex);
373
+ return returnValue;
374
+ }
375
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
376
+ let endIndex = 0;
377
+ let returnValue = "";
378
+ do {
379
+ const gotCR = string[index4 - 1] === "\r";
380
+ returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
381
+ endIndex = index4 + 1;
382
+ index4 = string.indexOf("\n", endIndex);
383
+ } while (index4 !== -1);
384
+ returnValue += string.slice(endIndex);
385
+ return returnValue;
386
+ }
387
+ var init_utilities = __esm({
388
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js"() {
389
+ }
390
+ });
391
+
392
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
393
+ function createChalk(options) {
394
+ return chalkFactory(options);
395
+ }
396
+ var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr;
397
+ var init_source = __esm({
398
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js"() {
399
+ init_ansi_styles();
400
+ init_supports_color();
401
+ init_utilities();
402
+ init_ansi_styles();
403
+ ({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
404
+ GENERATOR = Symbol("GENERATOR");
405
+ STYLER = Symbol("STYLER");
406
+ IS_EMPTY = Symbol("IS_EMPTY");
407
+ levelMapping = [
408
+ "ansi",
409
+ "ansi",
410
+ "ansi256",
411
+ "ansi16m"
412
+ ];
413
+ styles2 = /* @__PURE__ */ Object.create(null);
414
+ applyOptions = (object, options = {}) => {
415
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
416
+ throw new Error("The `level` option should be an integer from 0 to 3");
417
+ }
418
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
419
+ object.level = options.level === void 0 ? colorLevel : options.level;
420
+ };
421
+ chalkFactory = (options) => {
422
+ const chalk2 = (...strings) => strings.join(" ");
423
+ applyOptions(chalk2, options);
424
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
425
+ return chalk2;
426
+ };
427
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
428
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
429
+ styles2[styleName] = {
430
+ get() {
431
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
432
+ Object.defineProperty(this, styleName, { value: builder });
433
+ return builder;
434
+ }
435
+ };
436
+ }
437
+ styles2.visible = {
438
+ get() {
439
+ const builder = createBuilder(this, this[STYLER], true);
440
+ Object.defineProperty(this, "visible", { value: builder });
441
+ return builder;
442
+ }
443
+ };
444
+ getModelAnsi = (model, level, type, ...arguments_) => {
445
+ if (model === "rgb") {
446
+ if (level === "ansi16m") {
447
+ return ansi_styles_default[type].ansi16m(...arguments_);
448
+ }
449
+ if (level === "ansi256") {
450
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
451
+ }
452
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
453
+ }
454
+ if (model === "hex") {
455
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
456
+ }
457
+ return ansi_styles_default[type][model](...arguments_);
458
+ };
459
+ usedModels = ["rgb", "hex", "ansi256"];
460
+ for (const model of usedModels) {
461
+ styles2[model] = {
462
+ get() {
463
+ const { level } = this;
464
+ return function(...arguments_) {
465
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
466
+ return createBuilder(this, styler, this[IS_EMPTY]);
467
+ };
468
+ }
469
+ };
470
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
471
+ styles2[bgModel] = {
472
+ get() {
473
+ const { level } = this;
474
+ return function(...arguments_) {
475
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
476
+ return createBuilder(this, styler, this[IS_EMPTY]);
477
+ };
478
+ }
479
+ };
480
+ }
481
+ proto = Object.defineProperties(() => {
482
+ }, {
483
+ ...styles2,
484
+ level: {
485
+ enumerable: true,
486
+ get() {
487
+ return this[GENERATOR].level;
488
+ },
489
+ set(level) {
490
+ this[GENERATOR].level = level;
491
+ }
492
+ }
493
+ });
494
+ createStyler = (open, close, parent) => {
495
+ let openAll;
496
+ let closeAll;
497
+ if (parent === void 0) {
498
+ openAll = open;
499
+ closeAll = close;
500
+ } else {
501
+ openAll = parent.openAll + open;
502
+ closeAll = close + parent.closeAll;
503
+ }
504
+ return {
505
+ open,
506
+ close,
507
+ openAll,
508
+ closeAll,
509
+ parent
510
+ };
511
+ };
512
+ createBuilder = (self2, _styler, _isEmpty) => {
513
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
514
+ Object.setPrototypeOf(builder, proto);
515
+ builder[GENERATOR] = self2;
516
+ builder[STYLER] = _styler;
517
+ builder[IS_EMPTY] = _isEmpty;
518
+ return builder;
519
+ };
520
+ applyStyle = (self2, string) => {
521
+ if (self2.level <= 0 || !string) {
522
+ return self2[IS_EMPTY] ? "" : string;
523
+ }
524
+ let styler = self2[STYLER];
525
+ if (styler === void 0) {
526
+ return string;
527
+ }
528
+ const { openAll, closeAll } = styler;
529
+ if (string.includes("\x1B")) {
530
+ while (styler !== void 0) {
531
+ string = stringReplaceAll(string, styler.close, styler.open);
532
+ styler = styler.parent;
533
+ }
534
+ }
535
+ const lfIndex = string.indexOf("\n");
536
+ if (lfIndex !== -1) {
537
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
538
+ }
539
+ return openAll + string + closeAll;
540
+ };
541
+ Object.defineProperties(createChalk.prototype, styles2);
542
+ chalk = createChalk();
543
+ chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
544
+ }
545
+ });
546
+
37
547
  // node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
38
548
  var require_readline = __commonJS({
39
549
  "node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
@@ -574,12 +1084,11 @@ var init_global = __esm({
574
1084
  }
575
1085
  });
576
1086
 
577
- // node_modules/.pnpm/zod@3.23.3/node_modules/zod/lib/index.mjs
1087
+ // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
578
1088
  function getErrorMap() {
579
1089
  return overrideErrorMap;
580
1090
  }
581
1091
  function addIssueToContext(ctx, issueData) {
582
- const overrideMap = getErrorMap();
583
1092
  const issue = makeIssue({
584
1093
  issueData,
585
1094
  data: ctx.data,
@@ -587,29 +1096,13 @@ function addIssueToContext(ctx, issueData) {
587
1096
  errorMaps: [
588
1097
  ctx.common.contextualErrorMap,
589
1098
  ctx.schemaErrorMap,
590
- overrideMap,
591
- overrideMap === errorMap ? void 0 : errorMap
1099
+ getErrorMap(),
1100
+ errorMap
592
1101
  // then global default map
593
1102
  ].filter((x) => !!x)
594
1103
  });
595
1104
  ctx.common.issues.push(issue);
596
1105
  }
597
- function __classPrivateFieldGet(receiver, state, kind, f) {
598
- if (kind === "a" && !f)
599
- throw new TypeError("Private accessor was defined without a getter");
600
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
601
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
602
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
603
- }
604
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
605
- if (kind === "m")
606
- throw new TypeError("Private method is not writable");
607
- if (kind === "a" && !f)
608
- throw new TypeError("Private accessor was defined without a setter");
609
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
610
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
611
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
612
- }
613
1106
  function processCreateParams(params) {
614
1107
  if (!params)
615
1108
  return {};
@@ -620,50 +1113,15 @@ function processCreateParams(params) {
620
1113
  if (errorMap2)
621
1114
  return { errorMap: errorMap2, description };
622
1115
  const customMap = (iss, ctx) => {
623
- var _a, _b;
624
- const { message } = params;
625
- if (iss.code === "invalid_enum_value") {
626
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
627
- }
628
- if (typeof ctx.data === "undefined") {
629
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
630
- }
631
1116
  if (iss.code !== "invalid_type")
632
1117
  return { message: ctx.defaultError };
633
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1118
+ if (typeof ctx.data === "undefined") {
1119
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
1120
+ }
1121
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
634
1122
  };
635
1123
  return { errorMap: customMap, description };
636
1124
  }
637
- function timeRegexSource(args) {
638
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
639
- if (args.precision) {
640
- regex = `${regex}\\.\\d{${args.precision}}`;
641
- } else if (args.precision == null) {
642
- regex = `${regex}(\\.\\d+)?`;
643
- }
644
- return regex;
645
- }
646
- function timeRegex(args) {
647
- return new RegExp(`^${timeRegexSource(args)}$`);
648
- }
649
- function datetimeRegex(args) {
650
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
651
- const opts = [];
652
- opts.push(args.local ? `Z?` : `Z`);
653
- if (args.offset)
654
- opts.push(`([+-]\\d{2}:?\\d{2})`);
655
- regex = `${regex}(${opts.join("|")})`;
656
- return new RegExp(`^${regex}$`);
657
- }
658
- function isValidIP(ip, version) {
659
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
660
- return true;
661
- }
662
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
663
- return true;
664
- }
665
- return false;
666
- }
667
1125
  function floatSafeRemainder(val, step) {
668
1126
  const valDecCount = (val.toString().split(".")[1] || "").length;
669
1127
  const stepDecCount = (step.toString().split(".")[1] || "").length;
@@ -684,10 +1142,7 @@ function deepPartialify(schema3) {
684
1142
  shape: () => newShape
685
1143
  });
686
1144
  } else if (schema3 instanceof ZodArray) {
687
- return new ZodArray({
688
- ...schema3._def,
689
- type: deepPartialify(schema3.element)
690
- });
1145
+ return ZodArray.create(deepPartialify(schema3.element));
691
1146
  } else if (schema3 instanceof ZodOptional) {
692
1147
  return ZodOptional.create(deepPartialify(schema3.unwrap()));
693
1148
  } else if (schema3 instanceof ZodNullable) {
@@ -743,9 +1198,9 @@ function createZodEnum(values, params) {
743
1198
  ...processCreateParams(params)
744
1199
  });
745
1200
  }
746
- var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
1201
+ var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, uuidRegex, emailRegex, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, objectUtil, AugmentFactory, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
747
1202
  var init_lib = __esm({
748
- "node_modules/.pnpm/zod@3.23.3/node_modules/zod/lib/index.mjs"() {
1203
+ "node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs"() {
749
1204
  (function(util2) {
750
1205
  util2.assertEqual = (val) => val;
751
1206
  function assertIs(_arg) {
@@ -803,15 +1258,6 @@ var init_lib = __esm({
803
1258
  return value;
804
1259
  };
805
1260
  })(util || (util = {}));
806
- (function(objectUtil2) {
807
- objectUtil2.mergeShapes = (first, second) => {
808
- return {
809
- ...first,
810
- ...second
811
- // second overwrites first
812
- };
813
- };
814
- })(objectUtil || (objectUtil = {}));
815
1261
  ZodParsedType = util.arrayToEnum([
816
1262
  "string",
817
1263
  "nan",
@@ -893,7 +1339,7 @@ var init_lib = __esm({
893
1339
  "not_multiple_of",
894
1340
  "not_finite"
895
1341
  ]);
896
- ZodError = class _ZodError extends Error {
1342
+ ZodError = class extends Error {
897
1343
  constructor(issues) {
898
1344
  super();
899
1345
  this.issues = [];
@@ -951,11 +1397,6 @@ var init_lib = __esm({
951
1397
  processError(this);
952
1398
  return fieldErrors;
953
1399
  }
954
- static assert(value) {
955
- if (!(value instanceof _ZodError)) {
956
- throw new Error(`Not a ZodError: ${value}`);
957
- }
958
- }
959
1400
  toString() {
960
1401
  return this.message;
961
1402
  }
@@ -1022,12 +1463,7 @@ var init_lib = __esm({
1022
1463
  break;
1023
1464
  case ZodIssueCode.invalid_string:
1024
1465
  if (typeof issue.validation === "object") {
1025
- if ("includes" in issue.validation) {
1026
- message = `Invalid input: must include "${issue.validation.includes}"`;
1027
- if (typeof issue.validation.position === "number") {
1028
- message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
1029
- }
1030
- } else if ("startsWith" in issue.validation) {
1466
+ if ("startsWith" in issue.validation) {
1031
1467
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
1032
1468
  } else if ("endsWith" in issue.validation) {
1033
1469
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -1048,7 +1484,7 @@ var init_lib = __esm({
1048
1484
  else if (issue.type === "number")
1049
1485
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
1050
1486
  else if (issue.type === "date")
1051
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
1487
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
1052
1488
  else
1053
1489
  message = "Invalid input";
1054
1490
  break;
@@ -1059,10 +1495,8 @@ var init_lib = __esm({
1059
1495
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
1060
1496
  else if (issue.type === "number")
1061
1497
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1062
- else if (issue.type === "bigint")
1063
- message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1064
1498
  else if (issue.type === "date")
1065
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
1499
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
1066
1500
  else
1067
1501
  message = "Invalid input";
1068
1502
  break;
@@ -1092,13 +1526,6 @@ var init_lib = __esm({
1092
1526
  ...issueData,
1093
1527
  path: fullPath
1094
1528
  };
1095
- if (issueData.message !== void 0) {
1096
- return {
1097
- ...issueData,
1098
- path: fullPath,
1099
- message: issueData.message
1100
- };
1101
- }
1102
1529
  let errorMessage = "";
1103
1530
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
1104
1531
  for (const map of maps) {
@@ -1107,7 +1534,7 @@ var init_lib = __esm({
1107
1534
  return {
1108
1535
  ...issueData,
1109
1536
  path: fullPath,
1110
- message: errorMessage
1537
+ message: issueData.message || errorMessage
1111
1538
  };
1112
1539
  };
1113
1540
  ParseStatus = class _ParseStatus {
@@ -1136,11 +1563,9 @@ var init_lib = __esm({
1136
1563
  static async mergeObjectAsync(status, pairs) {
1137
1564
  const syncPairs = [];
1138
1565
  for (const pair of pairs) {
1139
- const key = await pair.key;
1140
- const value = await pair.value;
1141
1566
  syncPairs.push({
1142
- key,
1143
- value
1567
+ key: await pair.key,
1568
+ value: await pair.value
1144
1569
  });
1145
1570
  }
1146
1571
  return _ParseStatus.mergeObjectSync(status, syncPairs);
@@ -1157,7 +1582,7 @@ var init_lib = __esm({
1157
1582
  status.dirty();
1158
1583
  if (value.status === "dirty")
1159
1584
  status.dirty();
1160
- if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
1585
+ if (typeof value.value !== "undefined" || pair.alwaysSet) {
1161
1586
  finalObject[key.value] = value.value;
1162
1587
  }
1163
1588
  }
@@ -1172,28 +1597,20 @@ var init_lib = __esm({
1172
1597
  isAborted = (x) => x.status === "aborted";
1173
1598
  isDirty = (x) => x.status === "dirty";
1174
1599
  isValid = (x) => x.status === "valid";
1175
- isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1600
+ isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
1176
1601
  (function(errorUtil2) {
1177
1602
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1178
1603
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1179
1604
  })(errorUtil || (errorUtil = {}));
1180
1605
  ParseInputLazyPath = class {
1181
1606
  constructor(parent, value, path2, key) {
1182
- this._cachedPath = [];
1183
1607
  this.parent = parent;
1184
1608
  this.data = value;
1185
1609
  this._path = path2;
1186
1610
  this._key = key;
1187
1611
  }
1188
1612
  get path() {
1189
- if (!this._cachedPath.length) {
1190
- if (this._key instanceof Array) {
1191
- this._cachedPath.push(...this._path, ...this._key);
1192
- } else {
1193
- this._cachedPath.push(...this._path, this._key);
1194
- }
1195
- }
1196
- return this._cachedPath;
1613
+ return this._path.concat(this._key);
1197
1614
  }
1198
1615
  };
1199
1616
  handleResult = (ctx, result) => {
@@ -1203,16 +1620,8 @@ var init_lib = __esm({
1203
1620
  if (!ctx.common.issues.length) {
1204
1621
  throw new Error("Validation failed but no issues detected.");
1205
1622
  }
1206
- return {
1207
- success: false,
1208
- get error() {
1209
- if (this._error)
1210
- return this._error;
1211
- const error2 = new ZodError(ctx.common.issues);
1212
- this._error = error2;
1213
- return this._error;
1214
- }
1215
- };
1623
+ const error2 = new ZodError(ctx.common.issues);
1624
+ return { success: false, error: error2 };
1216
1625
  }
1217
1626
  };
1218
1627
  ZodType = class {
@@ -1240,7 +1649,6 @@ var init_lib = __esm({
1240
1649
  this.catch = this.catch.bind(this);
1241
1650
  this.describe = this.describe.bind(this);
1242
1651
  this.pipe = this.pipe.bind(this);
1243
- this.readonly = this.readonly.bind(this);
1244
1652
  this.isNullable = this.isNullable.bind(this);
1245
1653
  this.isOptional = this.isOptional.bind(this);
1246
1654
  }
@@ -1385,29 +1793,28 @@ var init_lib = __esm({
1385
1793
  return this._refinement(refinement);
1386
1794
  }
1387
1795
  optional() {
1388
- return ZodOptional.create(this, this._def);
1796
+ return ZodOptional.create(this);
1389
1797
  }
1390
1798
  nullable() {
1391
- return ZodNullable.create(this, this._def);
1799
+ return ZodNullable.create(this);
1392
1800
  }
1393
1801
  nullish() {
1394
- return this.nullable().optional();
1802
+ return this.optional().nullable();
1395
1803
  }
1396
1804
  array() {
1397
- return ZodArray.create(this, this._def);
1805
+ return ZodArray.create(this);
1398
1806
  }
1399
1807
  promise() {
1400
- return ZodPromise.create(this, this._def);
1808
+ return ZodPromise.create(this);
1401
1809
  }
1402
1810
  or(option) {
1403
- return ZodUnion.create([this, option], this._def);
1811
+ return ZodUnion.create([this, option]);
1404
1812
  }
1405
1813
  and(incoming) {
1406
- return ZodIntersection.create(this, incoming, this._def);
1814
+ return ZodIntersection.create(this, incoming);
1407
1815
  }
1408
1816
  transform(transform) {
1409
1817
  return new ZodEffects({
1410
- ...processCreateParams(this._def),
1411
1818
  schema: this,
1412
1819
  typeName: ZodFirstPartyTypeKind.ZodEffects,
1413
1820
  effect: { type: "transform", transform }
@@ -1416,7 +1823,6 @@ var init_lib = __esm({
1416
1823
  default(def) {
1417
1824
  const defaultValueFunc = typeof def === "function" ? def : () => def;
1418
1825
  return new ZodDefault({
1419
- ...processCreateParams(this._def),
1420
1826
  innerType: this,
1421
1827
  defaultValue: defaultValueFunc,
1422
1828
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -1426,15 +1832,14 @@ var init_lib = __esm({
1426
1832
  return new ZodBranded({
1427
1833
  typeName: ZodFirstPartyTypeKind.ZodBranded,
1428
1834
  type: this,
1429
- ...processCreateParams(this._def)
1835
+ ...processCreateParams(void 0)
1430
1836
  });
1431
1837
  }
1432
1838
  catch(def) {
1433
- const catchValueFunc = typeof def === "function" ? def : () => def;
1839
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
1434
1840
  return new ZodCatch({
1435
- ...processCreateParams(this._def),
1436
1841
  innerType: this,
1437
- catchValue: catchValueFunc,
1842
+ defaultValue: defaultValueFunc,
1438
1843
  typeName: ZodFirstPartyTypeKind.ZodCatch
1439
1844
  });
1440
1845
  }
@@ -1448,9 +1853,6 @@ var init_lib = __esm({
1448
1853
  pipe(target) {
1449
1854
  return ZodPipeline.create(this, target);
1450
1855
  }
1451
- readonly() {
1452
- return ZodReadonly.create(this);
1453
- }
1454
1856
  isOptional() {
1455
1857
  return this.safeParse(void 0).success;
1456
1858
  }
@@ -1459,19 +1861,43 @@ var init_lib = __esm({
1459
1861
  }
1460
1862
  };
1461
1863
  cuidRegex = /^c[^\s-]{8,}$/i;
1462
- cuid2Regex = /^[0-9a-z]+$/;
1463
- ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1464
- uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
1465
- nanoidRegex = /^[a-z0-9_-]{21}$/i;
1466
- durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
1467
- emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1468
- _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1469
- ipv4Regex = /^(?:(?: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])$/;
1470
- ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
1471
- base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1472
- dateRegexSource = `((\\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])))`;
1473
- dateRegex = new RegExp(`^${dateRegexSource}$`);
1864
+ uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
1865
+ emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
1866
+ datetimeRegex = (args) => {
1867
+ if (args.precision) {
1868
+ if (args.offset) {
1869
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
1870
+ } else {
1871
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
1872
+ }
1873
+ } else if (args.precision === 0) {
1874
+ if (args.offset) {
1875
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
1876
+ } else {
1877
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
1878
+ }
1879
+ } else {
1880
+ if (args.offset) {
1881
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
1882
+ } else {
1883
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
1884
+ }
1885
+ }
1886
+ };
1474
1887
  ZodString = class _ZodString extends ZodType {
1888
+ constructor() {
1889
+ super(...arguments);
1890
+ this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
1891
+ validation,
1892
+ code: ZodIssueCode.invalid_string,
1893
+ ...errorUtil.errToObj(message)
1894
+ });
1895
+ this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
1896
+ this.trim = () => new _ZodString({
1897
+ ...this._def,
1898
+ checks: [...this._def.checks, { kind: "trim" }]
1899
+ });
1900
+ }
1475
1901
  _parse(input) {
1476
1902
  if (this._def.coerce) {
1477
1903
  input.data = String(input.data);
@@ -1479,11 +1905,15 @@ var init_lib = __esm({
1479
1905
  const parsedType = this._getType(input);
1480
1906
  if (parsedType !== ZodParsedType.string) {
1481
1907
  const ctx2 = this._getOrReturnCtx(input);
1482
- addIssueToContext(ctx2, {
1483
- code: ZodIssueCode.invalid_type,
1484
- expected: ZodParsedType.string,
1485
- received: ctx2.parsedType
1486
- });
1908
+ addIssueToContext(
1909
+ ctx2,
1910
+ {
1911
+ code: ZodIssueCode.invalid_type,
1912
+ expected: ZodParsedType.string,
1913
+ received: ctx2.parsedType
1914
+ }
1915
+ //
1916
+ );
1487
1917
  return INVALID;
1488
1918
  }
1489
1919
  const status = new ParseStatus();
@@ -1551,19 +1981,6 @@ var init_lib = __esm({
1551
1981
  });
1552
1982
  status.dirty();
1553
1983
  }
1554
- } else if (check.kind === "emoji") {
1555
- if (!emojiRegex) {
1556
- emojiRegex = new RegExp(_emojiRegex, "u");
1557
- }
1558
- if (!emojiRegex.test(input.data)) {
1559
- ctx = this._getOrReturnCtx(input, ctx);
1560
- addIssueToContext(ctx, {
1561
- validation: "emoji",
1562
- code: ZodIssueCode.invalid_string,
1563
- message: check.message
1564
- });
1565
- status.dirty();
1566
- }
1567
1984
  } else if (check.kind === "uuid") {
1568
1985
  if (!uuidRegex.test(input.data)) {
1569
1986
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1574,16 +1991,6 @@ var init_lib = __esm({
1574
1991
  });
1575
1992
  status.dirty();
1576
1993
  }
1577
- } else if (check.kind === "nanoid") {
1578
- if (!nanoidRegex.test(input.data)) {
1579
- ctx = this._getOrReturnCtx(input, ctx);
1580
- addIssueToContext(ctx, {
1581
- validation: "nanoid",
1582
- code: ZodIssueCode.invalid_string,
1583
- message: check.message
1584
- });
1585
- status.dirty();
1586
- }
1587
1994
  } else if (check.kind === "cuid") {
1588
1995
  if (!cuidRegex.test(input.data)) {
1589
1996
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1594,26 +2001,6 @@ var init_lib = __esm({
1594
2001
  });
1595
2002
  status.dirty();
1596
2003
  }
1597
- } else if (check.kind === "cuid2") {
1598
- if (!cuid2Regex.test(input.data)) {
1599
- ctx = this._getOrReturnCtx(input, ctx);
1600
- addIssueToContext(ctx, {
1601
- validation: "cuid2",
1602
- code: ZodIssueCode.invalid_string,
1603
- message: check.message
1604
- });
1605
- status.dirty();
1606
- }
1607
- } else if (check.kind === "ulid") {
1608
- if (!ulidRegex.test(input.data)) {
1609
- ctx = this._getOrReturnCtx(input, ctx);
1610
- addIssueToContext(ctx, {
1611
- validation: "ulid",
1612
- code: ZodIssueCode.invalid_string,
1613
- message: check.message
1614
- });
1615
- status.dirty();
1616
- }
1617
2004
  } else if (check.kind === "url") {
1618
2005
  try {
1619
2006
  new URL(input.data);
@@ -1640,20 +2027,6 @@ var init_lib = __esm({
1640
2027
  }
1641
2028
  } else if (check.kind === "trim") {
1642
2029
  input.data = input.data.trim();
1643
- } else if (check.kind === "includes") {
1644
- if (!input.data.includes(check.value, check.position)) {
1645
- ctx = this._getOrReturnCtx(input, ctx);
1646
- addIssueToContext(ctx, {
1647
- code: ZodIssueCode.invalid_string,
1648
- validation: { includes: check.value, position: check.position },
1649
- message: check.message
1650
- });
1651
- status.dirty();
1652
- }
1653
- } else if (check.kind === "toLowerCase") {
1654
- input.data = input.data.toLowerCase();
1655
- } else if (check.kind === "toUpperCase") {
1656
- input.data = input.data.toUpperCase();
1657
2030
  } else if (check.kind === "startsWith") {
1658
2031
  if (!input.data.startsWith(check.value)) {
1659
2032
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1685,71 +2058,12 @@ var init_lib = __esm({
1685
2058
  });
1686
2059
  status.dirty();
1687
2060
  }
1688
- } else if (check.kind === "date") {
1689
- const regex = dateRegex;
1690
- if (!regex.test(input.data)) {
1691
- ctx = this._getOrReturnCtx(input, ctx);
1692
- addIssueToContext(ctx, {
1693
- code: ZodIssueCode.invalid_string,
1694
- validation: "date",
1695
- message: check.message
1696
- });
1697
- status.dirty();
1698
- }
1699
- } else if (check.kind === "time") {
1700
- const regex = timeRegex(check);
1701
- if (!regex.test(input.data)) {
1702
- ctx = this._getOrReturnCtx(input, ctx);
1703
- addIssueToContext(ctx, {
1704
- code: ZodIssueCode.invalid_string,
1705
- validation: "time",
1706
- message: check.message
1707
- });
1708
- status.dirty();
1709
- }
1710
- } else if (check.kind === "duration") {
1711
- if (!durationRegex.test(input.data)) {
1712
- ctx = this._getOrReturnCtx(input, ctx);
1713
- addIssueToContext(ctx, {
1714
- validation: "duration",
1715
- code: ZodIssueCode.invalid_string,
1716
- message: check.message
1717
- });
1718
- status.dirty();
1719
- }
1720
- } else if (check.kind === "ip") {
1721
- if (!isValidIP(input.data, check.version)) {
1722
- ctx = this._getOrReturnCtx(input, ctx);
1723
- addIssueToContext(ctx, {
1724
- validation: "ip",
1725
- code: ZodIssueCode.invalid_string,
1726
- message: check.message
1727
- });
1728
- status.dirty();
1729
- }
1730
- } else if (check.kind === "base64") {
1731
- if (!base64Regex.test(input.data)) {
1732
- ctx = this._getOrReturnCtx(input, ctx);
1733
- addIssueToContext(ctx, {
1734
- validation: "base64",
1735
- code: ZodIssueCode.invalid_string,
1736
- message: check.message
1737
- });
1738
- status.dirty();
1739
- }
1740
2061
  } else {
1741
2062
  util.assertNever(check);
1742
2063
  }
1743
2064
  }
1744
2065
  return { status: status.value, value: input.data };
1745
2066
  }
1746
- _regex(regex, validation, message) {
1747
- return this.refinement((data) => regex.test(data), {
1748
- validation,
1749
- code: ZodIssueCode.invalid_string,
1750
- ...errorUtil.errToObj(message)
1751
- });
1752
- }
1753
2067
  _addCheck(check) {
1754
2068
  return new _ZodString({
1755
2069
  ...this._def,
@@ -1762,38 +2076,19 @@ var init_lib = __esm({
1762
2076
  url(message) {
1763
2077
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1764
2078
  }
1765
- emoji(message) {
1766
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1767
- }
1768
2079
  uuid(message) {
1769
2080
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1770
2081
  }
1771
- nanoid(message) {
1772
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1773
- }
1774
2082
  cuid(message) {
1775
2083
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1776
2084
  }
1777
- cuid2(message) {
1778
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1779
- }
1780
- ulid(message) {
1781
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1782
- }
1783
- base64(message) {
1784
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1785
- }
1786
- ip(options) {
1787
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1788
- }
1789
2085
  datetime(options) {
1790
- var _a, _b;
2086
+ var _a;
1791
2087
  if (typeof options === "string") {
1792
2088
  return this._addCheck({
1793
2089
  kind: "datetime",
1794
2090
  precision: null,
1795
2091
  offset: false,
1796
- local: false,
1797
2092
  message: options
1798
2093
  });
1799
2094
  }
@@ -1801,30 +2096,9 @@ var init_lib = __esm({
1801
2096
  kind: "datetime",
1802
2097
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1803
2098
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1804
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1805
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1806
- });
1807
- }
1808
- date(message) {
1809
- return this._addCheck({ kind: "date", message });
1810
- }
1811
- time(options) {
1812
- if (typeof options === "string") {
1813
- return this._addCheck({
1814
- kind: "time",
1815
- precision: null,
1816
- message: options
1817
- });
1818
- }
1819
- return this._addCheck({
1820
- kind: "time",
1821
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1822
2099
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1823
2100
  });
1824
2101
  }
1825
- duration(message) {
1826
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1827
- }
1828
2102
  regex(regex, message) {
1829
2103
  return this._addCheck({
1830
2104
  kind: "regex",
@@ -1832,14 +2106,6 @@ var init_lib = __esm({
1832
2106
  ...errorUtil.errToObj(message)
1833
2107
  });
1834
2108
  }
1835
- includes(value, options) {
1836
- return this._addCheck({
1837
- kind: "includes",
1838
- value,
1839
- position: options === null || options === void 0 ? void 0 : options.position,
1840
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1841
- });
1842
- }
1843
2109
  startsWith(value, message) {
1844
2110
  return this._addCheck({
1845
2111
  kind: "startsWith",
@@ -1875,73 +2141,21 @@ var init_lib = __esm({
1875
2141
  ...errorUtil.errToObj(message)
1876
2142
  });
1877
2143
  }
1878
- /**
1879
- * @deprecated Use z.string().min(1) instead.
1880
- * @see {@link ZodString.min}
1881
- */
1882
- nonempty(message) {
1883
- return this.min(1, errorUtil.errToObj(message));
1884
- }
1885
- trim() {
1886
- return new _ZodString({
1887
- ...this._def,
1888
- checks: [...this._def.checks, { kind: "trim" }]
1889
- });
1890
- }
1891
- toLowerCase() {
1892
- return new _ZodString({
1893
- ...this._def,
1894
- checks: [...this._def.checks, { kind: "toLowerCase" }]
1895
- });
1896
- }
1897
- toUpperCase() {
1898
- return new _ZodString({
1899
- ...this._def,
1900
- checks: [...this._def.checks, { kind: "toUpperCase" }]
1901
- });
1902
- }
1903
2144
  get isDatetime() {
1904
2145
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
1905
2146
  }
1906
- get isDate() {
1907
- return !!this._def.checks.find((ch) => ch.kind === "date");
1908
- }
1909
- get isTime() {
1910
- return !!this._def.checks.find((ch) => ch.kind === "time");
1911
- }
1912
- get isDuration() {
1913
- return !!this._def.checks.find((ch) => ch.kind === "duration");
1914
- }
1915
2147
  get isEmail() {
1916
2148
  return !!this._def.checks.find((ch) => ch.kind === "email");
1917
2149
  }
1918
2150
  get isURL() {
1919
2151
  return !!this._def.checks.find((ch) => ch.kind === "url");
1920
2152
  }
1921
- get isEmoji() {
1922
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
1923
- }
1924
2153
  get isUUID() {
1925
2154
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
1926
2155
  }
1927
- get isNANOID() {
1928
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1929
- }
1930
2156
  get isCUID() {
1931
2157
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1932
2158
  }
1933
- get isCUID2() {
1934
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1935
- }
1936
- get isULID() {
1937
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
1938
- }
1939
- get isIP() {
1940
- return !!this._def.checks.find((ch) => ch.kind === "ip");
1941
- }
1942
- get isBase64() {
1943
- return !!this._def.checks.find((ch) => ch.kind === "base64");
1944
- }
1945
2159
  get minLength() {
1946
2160
  let min = null;
1947
2161
  for (const ch of this._def.checks) {
@@ -2143,19 +2357,6 @@ var init_lib = __esm({
2143
2357
  message: errorUtil.toString(message)
2144
2358
  });
2145
2359
  }
2146
- safe(message) {
2147
- return this._addCheck({
2148
- kind: "min",
2149
- inclusive: true,
2150
- value: Number.MIN_SAFE_INTEGER,
2151
- message: errorUtil.toString(message)
2152
- })._addCheck({
2153
- kind: "max",
2154
- inclusive: true,
2155
- value: Number.MAX_SAFE_INTEGER,
2156
- message: errorUtil.toString(message)
2157
- });
2158
- }
2159
2360
  get minValue() {
2160
2361
  let min = null;
2161
2362
  for (const ch of this._def.checks) {
@@ -2177,22 +2378,7 @@ var init_lib = __esm({
2177
2378
  return max;
2178
2379
  }
2179
2380
  get isInt() {
2180
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2181
- }
2182
- get isFinite() {
2183
- let max = null, min = null;
2184
- for (const ch of this._def.checks) {
2185
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2186
- return true;
2187
- } else if (ch.kind === "min") {
2188
- if (min === null || ch.value > min)
2189
- min = ch.value;
2190
- } else if (ch.kind === "max") {
2191
- if (max === null || ch.value < max)
2192
- max = ch.value;
2193
- }
2194
- }
2195
- return Number.isFinite(min) && Number.isFinite(max);
2381
+ return !!this._def.checks.find((ch) => ch.kind === "int");
2196
2382
  }
2197
2383
  };
2198
2384
  ZodNumber.create = (params) => {
@@ -2203,167 +2389,27 @@ var init_lib = __esm({
2203
2389
  ...processCreateParams(params)
2204
2390
  });
2205
2391
  };
2206
- ZodBigInt = class _ZodBigInt extends ZodType {
2207
- constructor() {
2208
- super(...arguments);
2209
- this.min = this.gte;
2210
- this.max = this.lte;
2211
- }
2392
+ ZodBigInt = class extends ZodType {
2212
2393
  _parse(input) {
2213
2394
  if (this._def.coerce) {
2214
2395
  input.data = BigInt(input.data);
2215
2396
  }
2216
2397
  const parsedType = this._getType(input);
2217
2398
  if (parsedType !== ZodParsedType.bigint) {
2218
- const ctx2 = this._getOrReturnCtx(input);
2219
- addIssueToContext(ctx2, {
2399
+ const ctx = this._getOrReturnCtx(input);
2400
+ addIssueToContext(ctx, {
2220
2401
  code: ZodIssueCode.invalid_type,
2221
2402
  expected: ZodParsedType.bigint,
2222
- received: ctx2.parsedType
2403
+ received: ctx.parsedType
2223
2404
  });
2224
2405
  return INVALID;
2225
2406
  }
2226
- let ctx = void 0;
2227
- const status = new ParseStatus();
2228
- for (const check of this._def.checks) {
2229
- if (check.kind === "min") {
2230
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2231
- if (tooSmall) {
2232
- ctx = this._getOrReturnCtx(input, ctx);
2233
- addIssueToContext(ctx, {
2234
- code: ZodIssueCode.too_small,
2235
- type: "bigint",
2236
- minimum: check.value,
2237
- inclusive: check.inclusive,
2238
- message: check.message
2239
- });
2240
- status.dirty();
2241
- }
2242
- } else if (check.kind === "max") {
2243
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2244
- if (tooBig) {
2245
- ctx = this._getOrReturnCtx(input, ctx);
2246
- addIssueToContext(ctx, {
2247
- code: ZodIssueCode.too_big,
2248
- type: "bigint",
2249
- maximum: check.value,
2250
- inclusive: check.inclusive,
2251
- message: check.message
2252
- });
2253
- status.dirty();
2254
- }
2255
- } else if (check.kind === "multipleOf") {
2256
- if (input.data % check.value !== BigInt(0)) {
2257
- ctx = this._getOrReturnCtx(input, ctx);
2258
- addIssueToContext(ctx, {
2259
- code: ZodIssueCode.not_multiple_of,
2260
- multipleOf: check.value,
2261
- message: check.message
2262
- });
2263
- status.dirty();
2264
- }
2265
- } else {
2266
- util.assertNever(check);
2267
- }
2268
- }
2269
- return { status: status.value, value: input.data };
2270
- }
2271
- gte(value, message) {
2272
- return this.setLimit("min", value, true, errorUtil.toString(message));
2273
- }
2274
- gt(value, message) {
2275
- return this.setLimit("min", value, false, errorUtil.toString(message));
2276
- }
2277
- lte(value, message) {
2278
- return this.setLimit("max", value, true, errorUtil.toString(message));
2279
- }
2280
- lt(value, message) {
2281
- return this.setLimit("max", value, false, errorUtil.toString(message));
2282
- }
2283
- setLimit(kind, value, inclusive, message) {
2284
- return new _ZodBigInt({
2285
- ...this._def,
2286
- checks: [
2287
- ...this._def.checks,
2288
- {
2289
- kind,
2290
- value,
2291
- inclusive,
2292
- message: errorUtil.toString(message)
2293
- }
2294
- ]
2295
- });
2296
- }
2297
- _addCheck(check) {
2298
- return new _ZodBigInt({
2299
- ...this._def,
2300
- checks: [...this._def.checks, check]
2301
- });
2302
- }
2303
- positive(message) {
2304
- return this._addCheck({
2305
- kind: "min",
2306
- value: BigInt(0),
2307
- inclusive: false,
2308
- message: errorUtil.toString(message)
2309
- });
2310
- }
2311
- negative(message) {
2312
- return this._addCheck({
2313
- kind: "max",
2314
- value: BigInt(0),
2315
- inclusive: false,
2316
- message: errorUtil.toString(message)
2317
- });
2318
- }
2319
- nonpositive(message) {
2320
- return this._addCheck({
2321
- kind: "max",
2322
- value: BigInt(0),
2323
- inclusive: true,
2324
- message: errorUtil.toString(message)
2325
- });
2326
- }
2327
- nonnegative(message) {
2328
- return this._addCheck({
2329
- kind: "min",
2330
- value: BigInt(0),
2331
- inclusive: true,
2332
- message: errorUtil.toString(message)
2333
- });
2334
- }
2335
- multipleOf(value, message) {
2336
- return this._addCheck({
2337
- kind: "multipleOf",
2338
- value,
2339
- message: errorUtil.toString(message)
2340
- });
2341
- }
2342
- get minValue() {
2343
- let min = null;
2344
- for (const ch of this._def.checks) {
2345
- if (ch.kind === "min") {
2346
- if (min === null || ch.value > min)
2347
- min = ch.value;
2348
- }
2349
- }
2350
- return min;
2351
- }
2352
- get maxValue() {
2353
- let max = null;
2354
- for (const ch of this._def.checks) {
2355
- if (ch.kind === "max") {
2356
- if (max === null || ch.value < max)
2357
- max = ch.value;
2358
- }
2359
- }
2360
- return max;
2407
+ return OK(input.data);
2361
2408
  }
2362
2409
  };
2363
2410
  ZodBigInt.create = (params) => {
2364
2411
  var _a;
2365
2412
  return new ZodBigInt({
2366
- checks: [],
2367
2413
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2368
2414
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2369
2415
  ...processCreateParams(params)
@@ -2689,13 +2735,13 @@ var init_lib = __esm({
2689
2735
  }
2690
2736
  }
2691
2737
  if (ctx.common.async) {
2692
- return Promise.all([...ctx.data].map((item, i) => {
2738
+ return Promise.all(ctx.data.map((item, i) => {
2693
2739
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2694
2740
  })).then((result2) => {
2695
2741
  return ParseStatus.mergeArray(status, result2);
2696
2742
  });
2697
2743
  }
2698
- const result = [...ctx.data].map((item, i) => {
2744
+ const result = ctx.data.map((item, i) => {
2699
2745
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2700
2746
  });
2701
2747
  return ParseStatus.mergeArray(status, result);
@@ -2735,12 +2781,31 @@ var init_lib = __esm({
2735
2781
  ...processCreateParams(params)
2736
2782
  });
2737
2783
  };
2784
+ (function(objectUtil2) {
2785
+ objectUtil2.mergeShapes = (first, second) => {
2786
+ return {
2787
+ ...first,
2788
+ ...second
2789
+ // second overwrites first
2790
+ };
2791
+ };
2792
+ })(objectUtil || (objectUtil = {}));
2793
+ AugmentFactory = (def) => (augmentation) => {
2794
+ return new ZodObject({
2795
+ ...def,
2796
+ shape: () => ({
2797
+ ...def.shape(),
2798
+ ...augmentation
2799
+ })
2800
+ });
2801
+ };
2738
2802
  ZodObject = class _ZodObject extends ZodType {
2739
2803
  constructor() {
2740
2804
  super(...arguments);
2741
2805
  this._cached = null;
2742
2806
  this.nonstrict = this.passthrough;
2743
- this.augment = this.extend;
2807
+ this.augment = AugmentFactory(this._def);
2808
+ this.extend = AugmentFactory(this._def);
2744
2809
  }
2745
2810
  _getCached() {
2746
2811
  if (this._cached !== null)
@@ -2821,10 +2886,9 @@ var init_lib = __esm({
2821
2886
  const syncPairs = [];
2822
2887
  for (const pair of pairs) {
2823
2888
  const key = await pair.key;
2824
- const value = await pair.value;
2825
2889
  syncPairs.push({
2826
2890
  key,
2827
- value,
2891
+ value: await pair.value,
2828
2892
  alwaysSet: pair.alwaysSet
2829
2893
  });
2830
2894
  }
@@ -2871,31 +2935,8 @@ var init_lib = __esm({
2871
2935
  unknownKeys: "passthrough"
2872
2936
  });
2873
2937
  }
2874
- // const AugmentFactory =
2875
- // <Def extends ZodObjectDef>(def: Def) =>
2876
- // <Augmentation extends ZodRawShape>(
2877
- // augmentation: Augmentation
2878
- // ): ZodObject<
2879
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2880
- // Def["unknownKeys"],
2881
- // Def["catchall"]
2882
- // > => {
2883
- // return new ZodObject({
2884
- // ...def,
2885
- // shape: () => ({
2886
- // ...def.shape(),
2887
- // ...augmentation,
2888
- // }),
2889
- // }) as any;
2890
- // };
2891
- extend(augmentation) {
2892
- return new _ZodObject({
2893
- ...this._def,
2894
- shape: () => ({
2895
- ...this._def.shape(),
2896
- ...augmentation
2897
- })
2898
- });
2938
+ setKey(key, schema3) {
2939
+ return this.augment({ [key]: schema3 });
2899
2940
  }
2900
2941
  /**
2901
2942
  * Prior to zod@1.0.12 there was a bug in the
@@ -2906,73 +2947,11 @@ var init_lib = __esm({
2906
2947
  const merged = new _ZodObject({
2907
2948
  unknownKeys: merging._def.unknownKeys,
2908
2949
  catchall: merging._def.catchall,
2909
- shape: () => ({
2910
- ...this._def.shape(),
2911
- ...merging._def.shape()
2912
- }),
2950
+ shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2913
2951
  typeName: ZodFirstPartyTypeKind.ZodObject
2914
2952
  });
2915
2953
  return merged;
2916
2954
  }
2917
- // merge<
2918
- // Incoming extends AnyZodObject,
2919
- // Augmentation extends Incoming["shape"],
2920
- // NewOutput extends {
2921
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2922
- // ? Augmentation[k]["_output"]
2923
- // : k extends keyof Output
2924
- // ? Output[k]
2925
- // : never;
2926
- // },
2927
- // NewInput extends {
2928
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2929
- // ? Augmentation[k]["_input"]
2930
- // : k extends keyof Input
2931
- // ? Input[k]
2932
- // : never;
2933
- // }
2934
- // >(
2935
- // merging: Incoming
2936
- // ): ZodObject<
2937
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2938
- // Incoming["_def"]["unknownKeys"],
2939
- // Incoming["_def"]["catchall"],
2940
- // NewOutput,
2941
- // NewInput
2942
- // > {
2943
- // const merged: any = new ZodObject({
2944
- // unknownKeys: merging._def.unknownKeys,
2945
- // catchall: merging._def.catchall,
2946
- // shape: () =>
2947
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2948
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2949
- // }) as any;
2950
- // return merged;
2951
- // }
2952
- setKey(key, schema3) {
2953
- return this.augment({ [key]: schema3 });
2954
- }
2955
- // merge<Incoming extends AnyZodObject>(
2956
- // merging: Incoming
2957
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2958
- // ZodObject<
2959
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2960
- // Incoming["_def"]["unknownKeys"],
2961
- // Incoming["_def"]["catchall"]
2962
- // > {
2963
- // // const mergedShape = objectUtil.mergeShapes(
2964
- // // this._def.shape(),
2965
- // // merging._def.shape()
2966
- // // );
2967
- // const merged: any = new ZodObject({
2968
- // unknownKeys: merging._def.unknownKeys,
2969
- // catchall: merging._def.catchall,
2970
- // shape: () =>
2971
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2972
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2973
- // }) as any;
2974
- // return merged;
2975
- // }
2976
2955
  catchall(index4) {
2977
2956
  return new _ZodObject({
2978
2957
  ...this._def,
@@ -2981,10 +2960,9 @@ var init_lib = __esm({
2981
2960
  }
2982
2961
  pick(mask) {
2983
2962
  const shape = {};
2984
- util.objectKeys(mask).forEach((key) => {
2985
- if (mask[key] && this.shape[key]) {
2963
+ util.objectKeys(mask).map((key) => {
2964
+ if (this.shape[key])
2986
2965
  shape[key] = this.shape[key];
2987
- }
2988
2966
  });
2989
2967
  return new _ZodObject({
2990
2968
  ...this._def,
@@ -2993,8 +2971,8 @@ var init_lib = __esm({
2993
2971
  }
2994
2972
  omit(mask) {
2995
2973
  const shape = {};
2996
- util.objectKeys(this.shape).forEach((key) => {
2997
- if (!mask[key]) {
2974
+ util.objectKeys(this.shape).map((key) => {
2975
+ if (util.objectKeys(mask).indexOf(key) === -1) {
2998
2976
  shape[key] = this.shape[key];
2999
2977
  }
3000
2978
  });
@@ -3003,22 +2981,29 @@ var init_lib = __esm({
3003
2981
  shape: () => shape
3004
2982
  });
3005
2983
  }
3006
- /**
3007
- * @deprecated
3008
- */
3009
2984
  deepPartial() {
3010
2985
  return deepPartialify(this);
3011
2986
  }
3012
2987
  partial(mask) {
3013
2988
  const newShape = {};
3014
- util.objectKeys(this.shape).forEach((key) => {
3015
- const fieldSchema = this.shape[key];
3016
- if (mask && !mask[key]) {
3017
- newShape[key] = fieldSchema;
3018
- } else {
2989
+ if (mask) {
2990
+ util.objectKeys(this.shape).map((key) => {
2991
+ if (util.objectKeys(mask).indexOf(key) === -1) {
2992
+ newShape[key] = this.shape[key];
2993
+ } else {
2994
+ newShape[key] = this.shape[key].optional();
2995
+ }
2996
+ });
2997
+ return new _ZodObject({
2998
+ ...this._def,
2999
+ shape: () => newShape
3000
+ });
3001
+ } else {
3002
+ for (const key in this.shape) {
3003
+ const fieldSchema = this.shape[key];
3019
3004
  newShape[key] = fieldSchema.optional();
3020
3005
  }
3021
- });
3006
+ }
3022
3007
  return new _ZodObject({
3023
3008
  ...this._def,
3024
3009
  shape: () => newShape
@@ -3026,10 +3011,21 @@ var init_lib = __esm({
3026
3011
  }
3027
3012
  required(mask) {
3028
3013
  const newShape = {};
3029
- util.objectKeys(this.shape).forEach((key) => {
3030
- if (mask && !mask[key]) {
3031
- newShape[key] = this.shape[key];
3032
- } else {
3014
+ if (mask) {
3015
+ util.objectKeys(this.shape).map((key) => {
3016
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3017
+ newShape[key] = this.shape[key];
3018
+ } else {
3019
+ const fieldSchema = this.shape[key];
3020
+ let newField = fieldSchema;
3021
+ while (newField instanceof ZodOptional) {
3022
+ newField = newField._def.innerType;
3023
+ }
3024
+ newShape[key] = newField;
3025
+ }
3026
+ });
3027
+ } else {
3028
+ for (const key in this.shape) {
3033
3029
  const fieldSchema = this.shape[key];
3034
3030
  let newField = fieldSchema;
3035
3031
  while (newField instanceof ZodOptional) {
@@ -3037,7 +3033,7 @@ var init_lib = __esm({
3037
3033
  }
3038
3034
  newShape[key] = newField;
3039
3035
  }
3040
- });
3036
+ }
3041
3037
  return new _ZodObject({
3042
3038
  ...this._def,
3043
3039
  shape: () => newShape
@@ -3175,25 +3171,15 @@ var init_lib = __esm({
3175
3171
  } else if (type instanceof ZodEnum) {
3176
3172
  return type.options;
3177
3173
  } else if (type instanceof ZodNativeEnum) {
3178
- return util.objectValues(type.enum);
3174
+ return Object.keys(type.enum);
3179
3175
  } else if (type instanceof ZodDefault) {
3180
3176
  return getDiscriminator(type._def.innerType);
3181
3177
  } else if (type instanceof ZodUndefined) {
3182
3178
  return [void 0];
3183
3179
  } else if (type instanceof ZodNull) {
3184
3180
  return [null];
3185
- } else if (type instanceof ZodOptional) {
3186
- return [void 0, ...getDiscriminator(type.unwrap())];
3187
- } else if (type instanceof ZodNullable) {
3188
- return [null, ...getDiscriminator(type.unwrap())];
3189
- } else if (type instanceof ZodBranded) {
3190
- return getDiscriminator(type.unwrap());
3191
- } else if (type instanceof ZodReadonly) {
3192
- return getDiscriminator(type.unwrap());
3193
- } else if (type instanceof ZodCatch) {
3194
- return getDiscriminator(type._def.innerType);
3195
3181
  } else {
3196
- return [];
3182
+ return null;
3197
3183
  }
3198
3184
  };
3199
3185
  ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
@@ -3253,7 +3239,7 @@ var init_lib = __esm({
3253
3239
  const optionsMap = /* @__PURE__ */ new Map();
3254
3240
  for (const type of options) {
3255
3241
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
3256
- if (!discriminatorValues.length) {
3242
+ if (!discriminatorValues) {
3257
3243
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
3258
3244
  }
3259
3245
  for (const value of discriminatorValues) {
@@ -3357,7 +3343,7 @@ var init_lib = __esm({
3357
3343
  });
3358
3344
  status.dirty();
3359
3345
  }
3360
- const items = [...ctx.data].map((item, itemIndex) => {
3346
+ const items = ctx.data.map((item, itemIndex) => {
3361
3347
  const schema3 = this._def.items[itemIndex] || this._def.rest;
3362
3348
  if (!schema3)
3363
3349
  return null;
@@ -3415,8 +3401,7 @@ var init_lib = __esm({
3415
3401
  for (const key in ctx.data) {
3416
3402
  pairs.push({
3417
3403
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3418
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3419
- alwaysSet: key in ctx.data
3404
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
3420
3405
  });
3421
3406
  }
3422
3407
  if (ctx.common.async) {
@@ -3446,12 +3431,6 @@ var init_lib = __esm({
3446
3431
  }
3447
3432
  };
3448
3433
  ZodMap = class extends ZodType {
3449
- get keySchema() {
3450
- return this._def.keyType;
3451
- }
3452
- get valueSchema() {
3453
- return this._def.valueType;
3454
- }
3455
3434
  _parse(input) {
3456
3435
  const { status, ctx } = this._processInputParams(input);
3457
3436
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -3646,29 +3625,27 @@ var init_lib = __esm({
3646
3625
  const params = { errorMap: ctx.common.contextualErrorMap };
3647
3626
  const fn = ctx.data;
3648
3627
  if (this._def.returns instanceof ZodPromise) {
3649
- const me = this;
3650
- return OK(async function(...args) {
3628
+ return OK(async (...args) => {
3651
3629
  const error2 = new ZodError([]);
3652
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3630
+ const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3653
3631
  error2.addIssue(makeArgsIssue(args, e));
3654
3632
  throw error2;
3655
3633
  });
3656
- const result = await Reflect.apply(fn, this, parsedArgs);
3657
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3634
+ const result = await fn(...parsedArgs);
3635
+ const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3658
3636
  error2.addIssue(makeReturnsIssue(result, e));
3659
3637
  throw error2;
3660
3638
  });
3661
3639
  return parsedReturns;
3662
3640
  });
3663
3641
  } else {
3664
- const me = this;
3665
- return OK(function(...args) {
3666
- const parsedArgs = me._def.args.safeParse(args, params);
3642
+ return OK((...args) => {
3643
+ const parsedArgs = this._def.args.safeParse(args, params);
3667
3644
  if (!parsedArgs.success) {
3668
3645
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3669
3646
  }
3670
- const result = Reflect.apply(fn, this, parsedArgs.data);
3671
- const parsedReturns = me._def.returns.safeParse(result, params);
3647
+ const result = fn(...parsedArgs.data);
3648
+ const parsedReturns = this._def.returns.safeParse(result, params);
3672
3649
  if (!parsedReturns.success) {
3673
3650
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3674
3651
  }
@@ -3733,7 +3710,6 @@ var init_lib = __esm({
3733
3710
  if (input.data !== this._def.value) {
3734
3711
  const ctx = this._getOrReturnCtx(input);
3735
3712
  addIssueToContext(ctx, {
3736
- received: ctx.data,
3737
3713
  code: ZodIssueCode.invalid_literal,
3738
3714
  expected: this._def.value
3739
3715
  });
@@ -3752,11 +3728,7 @@ var init_lib = __esm({
3752
3728
  ...processCreateParams(params)
3753
3729
  });
3754
3730
  };
3755
- ZodEnum = class _ZodEnum extends ZodType {
3756
- constructor() {
3757
- super(...arguments);
3758
- _ZodEnum_cache.set(this, void 0);
3759
- }
3731
+ ZodEnum = class extends ZodType {
3760
3732
  _parse(input) {
3761
3733
  if (typeof input.data !== "string") {
3762
3734
  const ctx = this._getOrReturnCtx(input);
@@ -3768,10 +3740,7 @@ var init_lib = __esm({
3768
3740
  });
3769
3741
  return INVALID;
3770
3742
  }
3771
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3772
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3773
- }
3774
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
3743
+ if (this._def.values.indexOf(input.data) === -1) {
3775
3744
  const ctx = this._getOrReturnCtx(input);
3776
3745
  const expectedValues = this._def.values;
3777
3746
  addIssueToContext(ctx, {
@@ -3807,26 +3776,9 @@ var init_lib = __esm({
3807
3776
  }
3808
3777
  return enumValues;
3809
3778
  }
3810
- extract(values, newDef = this._def) {
3811
- return _ZodEnum.create(values, {
3812
- ...this._def,
3813
- ...newDef
3814
- });
3815
- }
3816
- exclude(values, newDef = this._def) {
3817
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3818
- ...this._def,
3819
- ...newDef
3820
- });
3821
- }
3822
3779
  };
3823
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
3824
3780
  ZodEnum.create = createZodEnum;
3825
3781
  ZodNativeEnum = class extends ZodType {
3826
- constructor() {
3827
- super(...arguments);
3828
- _ZodNativeEnum_cache.set(this, void 0);
3829
- }
3830
3782
  _parse(input) {
3831
3783
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
3832
3784
  const ctx = this._getOrReturnCtx(input);
@@ -3839,10 +3791,7 @@ var init_lib = __esm({
3839
3791
  });
3840
3792
  return INVALID;
3841
3793
  }
3842
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3843
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3844
- }
3845
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
3794
+ if (nativeEnumValues.indexOf(input.data) === -1) {
3846
3795
  const expectedValues = util.objectValues(nativeEnumValues);
3847
3796
  addIssueToContext(ctx, {
3848
3797
  received: ctx.data,
@@ -3857,7 +3806,6 @@ var init_lib = __esm({
3857
3806
  return this._def.values;
3858
3807
  }
3859
3808
  };
3860
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
3861
3809
  ZodNativeEnum.create = (values, params) => {
3862
3810
  return new ZodNativeEnum({
3863
3811
  values,
@@ -3866,9 +3814,6 @@ var init_lib = __esm({
3866
3814
  });
3867
3815
  };
3868
3816
  ZodPromise = class extends ZodType {
3869
- unwrap() {
3870
- return this._def.type;
3871
- }
3872
3817
  _parse(input) {
3873
3818
  const { ctx } = this._processInputParams(input);
3874
3819
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -3905,56 +3850,38 @@ var init_lib = __esm({
3905
3850
  _parse(input) {
3906
3851
  const { status, ctx } = this._processInputParams(input);
3907
3852
  const effect = this._def.effect || null;
3908
- const checkCtx = {
3909
- addIssue: (arg) => {
3910
- addIssueToContext(ctx, arg);
3911
- if (arg.fatal) {
3912
- status.abort();
3913
- } else {
3914
- status.dirty();
3915
- }
3916
- },
3917
- get path() {
3918
- return ctx.path;
3919
- }
3920
- };
3921
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3922
3853
  if (effect.type === "preprocess") {
3923
- const processed = effect.transform(ctx.data, checkCtx);
3854
+ const processed = effect.transform(ctx.data);
3924
3855
  if (ctx.common.async) {
3925
- return Promise.resolve(processed).then(async (processed2) => {
3926
- if (status.value === "aborted")
3927
- return INVALID;
3928
- const result = await this._def.schema._parseAsync({
3856
+ return Promise.resolve(processed).then((processed2) => {
3857
+ return this._def.schema._parseAsync({
3929
3858
  data: processed2,
3930
3859
  path: ctx.path,
3931
3860
  parent: ctx
3932
3861
  });
3933
- if (result.status === "aborted")
3934
- return INVALID;
3935
- if (result.status === "dirty")
3936
- return DIRTY(result.value);
3937
- if (status.value === "dirty")
3938
- return DIRTY(result.value);
3939
- return result;
3940
3862
  });
3941
3863
  } else {
3942
- if (status.value === "aborted")
3943
- return INVALID;
3944
- const result = this._def.schema._parseSync({
3864
+ return this._def.schema._parseSync({
3945
3865
  data: processed,
3946
3866
  path: ctx.path,
3947
3867
  parent: ctx
3948
3868
  });
3949
- if (result.status === "aborted")
3950
- return INVALID;
3951
- if (result.status === "dirty")
3952
- return DIRTY(result.value);
3953
- if (status.value === "dirty")
3954
- return DIRTY(result.value);
3955
- return result;
3956
3869
  }
3957
3870
  }
3871
+ const checkCtx = {
3872
+ addIssue: (arg) => {
3873
+ addIssueToContext(ctx, arg);
3874
+ if (arg.fatal) {
3875
+ status.abort();
3876
+ } else {
3877
+ status.dirty();
3878
+ }
3879
+ },
3880
+ get path() {
3881
+ return ctx.path;
3882
+ }
3883
+ };
3884
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3958
3885
  if (effect.type === "refinement") {
3959
3886
  const executeRefinement = (acc) => {
3960
3887
  const result = effect.refinement(acc, checkCtx);
@@ -4097,45 +4024,26 @@ var init_lib = __esm({
4097
4024
  ZodCatch = class extends ZodType {
4098
4025
  _parse(input) {
4099
4026
  const { ctx } = this._processInputParams(input);
4100
- const newCtx = {
4101
- ...ctx,
4102
- common: {
4103
- ...ctx.common,
4104
- issues: []
4105
- }
4106
- };
4107
4027
  const result = this._def.innerType._parse({
4108
- data: newCtx.data,
4109
- path: newCtx.path,
4110
- parent: {
4111
- ...newCtx
4112
- }
4028
+ data: ctx.data,
4029
+ path: ctx.path,
4030
+ parent: ctx
4113
4031
  });
4114
4032
  if (isAsync(result)) {
4115
4033
  return result.then((result2) => {
4116
4034
  return {
4117
4035
  status: "valid",
4118
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
4119
- get error() {
4120
- return new ZodError(newCtx.common.issues);
4121
- },
4122
- input: newCtx.data
4123
- })
4036
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
4124
4037
  };
4125
4038
  });
4126
4039
  } else {
4127
4040
  return {
4128
4041
  status: "valid",
4129
- value: result.status === "valid" ? result.value : this._def.catchValue({
4130
- get error() {
4131
- return new ZodError(newCtx.common.issues);
4132
- },
4133
- input: newCtx.data
4134
- })
4042
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
4135
4043
  };
4136
4044
  }
4137
4045
  }
4138
- removeCatch() {
4046
+ removeDefault() {
4139
4047
  return this._def.innerType;
4140
4048
  }
4141
4049
  };
@@ -4143,7 +4051,7 @@ var init_lib = __esm({
4143
4051
  return new ZodCatch({
4144
4052
  innerType: type,
4145
4053
  typeName: ZodFirstPartyTypeKind.ZodCatch,
4146
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
4054
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4147
4055
  ...processCreateParams(params)
4148
4056
  });
4149
4057
  };
@@ -4238,25 +4146,6 @@ var init_lib = __esm({
4238
4146
  });
4239
4147
  }
4240
4148
  };
4241
- ZodReadonly = class extends ZodType {
4242
- _parse(input) {
4243
- const result = this._def.innerType._parse(input);
4244
- if (isValid(result)) {
4245
- result.value = Object.freeze(result.value);
4246
- }
4247
- return result;
4248
- }
4249
- unwrap() {
4250
- return this._def.innerType;
4251
- }
4252
- };
4253
- ZodReadonly.create = (type, params) => {
4254
- return new ZodReadonly({
4255
- innerType: type,
4256
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
4257
- ...processCreateParams(params)
4258
- });
4259
- };
4260
4149
  late = {
4261
4150
  object: ZodObject.lazycreate
4262
4151
  };
@@ -4296,7 +4185,6 @@ var init_lib = __esm({
4296
4185
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
4297
4186
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
4298
4187
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
4299
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
4300
4188
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4301
4189
  stringType = ZodString.create;
4302
4190
  numberType = ZodNumber.create;
@@ -4336,7 +4224,7 @@ var init_lib = __esm({
4336
4224
  });
4337
4225
 
4338
4226
  // src/serializer/mysqlSchema.ts
4339
- var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternalV6, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, backwardCompatibleMysqlSchema, dryMySql;
4227
+ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, backwardCompatibleMysqlSchema, dryMySql;
4340
4228
  var init_mysqlSchema = __esm({
4341
4229
  "src/serializer/mysqlSchema.ts"() {
4342
4230
  "use strict";
@@ -4436,18 +4324,8 @@ var init_mysqlSchema = __esm({
4436
4324
  }),
4437
4325
  internal: kitInternals
4438
4326
  }).strict();
4439
- schemaInternalV6 = objectType({
4440
- version: literalType("6"),
4441
- dialect,
4442
- tables: recordType(stringType(), table),
4443
- _meta: objectType({
4444
- tables: recordType(stringType(), stringType()),
4445
- columns: recordType(stringType(), stringType())
4446
- }),
4447
- internal: kitInternals
4448
- }).strict();
4449
4327
  schemaInternal = objectType({
4450
- version: literalType("6"),
4328
+ version: literalType("5"),
4451
4329
  dialect,
4452
4330
  tables: recordType(stringType(), table),
4453
4331
  _meta: objectType({
@@ -4476,7 +4354,7 @@ var init_mysqlSchema = __esm({
4476
4354
  uniqueConstraints: recordType(stringType(), stringType()).default({})
4477
4355
  }).strict();
4478
4356
  schemaSquashed = objectType({
4479
- version: literalType("6"),
4357
+ version: literalType("5"),
4480
4358
  dialect,
4481
4359
  tables: recordType(stringType(), tableSquashed)
4482
4360
  }).strict();
@@ -4490,7 +4368,7 @@ var init_mysqlSchema = __esm({
4490
4368
  mysqlSchemaV5 = schemaV5;
4491
4369
  backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema]);
4492
4370
  dryMySql = mysqlSchema.parse({
4493
- version: snapshotVersion,
4371
+ version: "5",
4494
4372
  dialect: "mysql",
4495
4373
  id: originUUID,
4496
4374
  prevId: "",
@@ -4873,6 +4751,7 @@ var init_utils = __esm({
4873
4751
  init_mysqlSchema();
4874
4752
  init_pgSchema();
4875
4753
  init_sqliteSchema();
4754
+ init_source();
4876
4755
  init_global();
4877
4756
  }
4878
4757
  });
@@ -4882,2595 +4761,158 @@ var import_hanji;
4882
4761
  var init_views = __esm({
4883
4762
  "src/cli/views.ts"() {
4884
4763
  "use strict";
4764
+ init_source();
4885
4765
  import_hanji = __toESM(require_hanji());
4886
4766
  init_utils();
4887
4767
  }
4888
4768
  });
4889
4769
 
4890
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/constants.js
4891
- var require_constants = __commonJS({
4892
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/constants.js"(exports, module) {
4893
- var SEMVER_SPEC_VERSION = "2.0.0";
4894
- var MAX_LENGTH = 256;
4895
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
4896
- 9007199254740991;
4897
- var MAX_SAFE_COMPONENT_LENGTH = 16;
4898
- var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
4899
- var RELEASE_TYPES = [
4900
- "major",
4901
- "premajor",
4902
- "minor",
4903
- "preminor",
4904
- "patch",
4905
- "prepatch",
4906
- "prerelease"
4907
- ];
4908
- module.exports = {
4909
- MAX_LENGTH,
4910
- MAX_SAFE_COMPONENT_LENGTH,
4911
- MAX_SAFE_BUILD_LENGTH,
4912
- MAX_SAFE_INTEGER,
4913
- RELEASE_TYPES,
4914
- SEMVER_SPEC_VERSION,
4915
- FLAG_INCLUDE_PRERELEASE: 1,
4916
- FLAG_LOOSE: 2
4917
- };
4918
- }
4919
- });
4920
-
4921
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/debug.js
4922
- var require_debug = __commonJS({
4923
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/debug.js"(exports, module) {
4924
- var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
4925
- };
4926
- module.exports = debug;
4927
- }
4928
- });
4929
-
4930
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/re.js
4931
- var require_re = __commonJS({
4932
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/re.js"(exports, module) {
4933
- var {
4934
- MAX_SAFE_COMPONENT_LENGTH,
4935
- MAX_SAFE_BUILD_LENGTH,
4936
- MAX_LENGTH
4937
- } = require_constants();
4938
- var debug = require_debug();
4939
- exports = module.exports = {};
4940
- var re = exports.re = [];
4941
- var safeRe = exports.safeRe = [];
4942
- var src = exports.src = [];
4943
- var t = exports.t = {};
4944
- var R = 0;
4945
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
4946
- var safeRegexReplacements = [
4947
- ["\\s", 1],
4948
- ["\\d", MAX_LENGTH],
4949
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
4950
- ];
4951
- var makeSafeRegex = (value) => {
4952
- for (const [token, max] of safeRegexReplacements) {
4953
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
4954
- }
4955
- return value;
4956
- };
4957
- var createToken = (name, value, isGlobal) => {
4958
- const safe = makeSafeRegex(value);
4959
- const index4 = R++;
4960
- debug(name, index4, value);
4961
- t[name] = index4;
4962
- src[index4] = value;
4963
- re[index4] = new RegExp(value, isGlobal ? "g" : void 0);
4964
- safeRe[index4] = new RegExp(safe, isGlobal ? "g" : void 0);
4965
- };
4966
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
4967
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
4968
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
4969
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
4970
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
4971
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
4972
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
4973
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
4974
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
4975
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
4976
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
4977
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
4978
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
4979
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
4980
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
4981
- createToken("GTLT", "((?:<|>)?=?)");
4982
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
4983
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
4984
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
4985
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
4986
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
4987
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
4988
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
4989
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
4990
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
4991
- createToken("COERCERTL", src[t.COERCE], true);
4992
- createToken("COERCERTLFULL", src[t.COERCEFULL], true);
4993
- createToken("LONETILDE", "(?:~>?)");
4994
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
4995
- exports.tildeTrimReplace = "$1~";
4996
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
4997
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
4998
- createToken("LONECARET", "(?:\\^)");
4999
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
5000
- exports.caretTrimReplace = "$1^";
5001
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
5002
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
5003
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
5004
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
5005
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
5006
- exports.comparatorTrimReplace = "$1$2$3";
5007
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
5008
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
5009
- createToken("STAR", "(<|>)?=?\\s*\\*");
5010
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
5011
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
4770
+ // src/serializer/index.ts
4771
+ import * as glob from "glob";
4772
+ var init_serializer = __esm({
4773
+ "src/serializer/index.ts"() {
4774
+ "use strict";
4775
+ init_source();
4776
+ init_views();
5012
4777
  }
5013
4778
  });
5014
4779
 
5015
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/parse-options.js
5016
- var require_parse_options = __commonJS({
5017
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/parse-options.js"(exports, module) {
5018
- var looseOption = Object.freeze({ loose: true });
5019
- var emptyOpts = Object.freeze({});
5020
- var parseOptions = (options) => {
5021
- if (!options) {
5022
- return emptyOpts;
5023
- }
5024
- if (typeof options !== "object") {
5025
- return looseOption;
5026
- }
5027
- return options;
5028
- };
5029
- module.exports = parseOptions;
4780
+ // src/cli/validations/outputs.ts
4781
+ var init_outputs = __esm({
4782
+ "src/cli/validations/outputs.ts"() {
4783
+ "use strict";
4784
+ init_source();
5030
4785
  }
5031
4786
  });
5032
4787
 
5033
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/identifiers.js
5034
- var require_identifiers = __commonJS({
5035
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/identifiers.js"(exports, module) {
5036
- var numeric = /^[0-9]+$/;
5037
- var compareIdentifiers = (a, b) => {
5038
- const anum = numeric.test(a);
5039
- const bnum = numeric.test(b);
5040
- if (anum && bnum) {
5041
- a = +a;
5042
- b = +b;
5043
- }
5044
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
5045
- };
5046
- var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
5047
- module.exports = {
5048
- compareIdentifiers,
5049
- rcompareIdentifiers
5050
- };
4788
+ // src/serializer/sqliteSerializer.ts
4789
+ import { getTableName, is, SQL } from "drizzle-orm";
4790
+ import {
4791
+ getTableConfig,
4792
+ SQLiteBaseInteger,
4793
+ SQLiteSyncDialect,
4794
+ uniqueKeyName
4795
+ } from "drizzle-orm/sqlite-core";
4796
+ function mapSqlToSqliteType(sqlType) {
4797
+ const lowered = sqlType.toLowerCase();
4798
+ if ([
4799
+ "int",
4800
+ "integer",
4801
+ "integer auto_increment",
4802
+ "tinyint",
4803
+ "smallint",
4804
+ "mediumint",
4805
+ "bigint",
4806
+ "unsigned big int",
4807
+ "int2",
4808
+ "int8"
4809
+ ].some((it) => lowered.startsWith(it))) {
4810
+ return "integer";
4811
+ } else if ([
4812
+ "character",
4813
+ "varchar",
4814
+ "varying character",
4815
+ "national varying character",
4816
+ "nchar",
4817
+ "native character",
4818
+ "nvarchar",
4819
+ "text",
4820
+ "clob"
4821
+ ].some((it) => lowered.startsWith(it))) {
4822
+ const match2 = lowered.match(/\d+/);
4823
+ if (match2) {
4824
+ return `text(${match2[0]})`;
4825
+ }
4826
+ return "text";
4827
+ } else if (lowered.startsWith("blob")) {
4828
+ return "blob";
4829
+ } else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
4830
+ return "real";
4831
+ } else {
4832
+ return "numeric";
5051
4833
  }
5052
- });
5053
-
5054
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/semver.js
5055
- var require_semver = __commonJS({
5056
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/semver.js"(exports, module) {
5057
- var debug = require_debug();
5058
- var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
5059
- var { safeRe: re, t } = require_re();
5060
- var parseOptions = require_parse_options();
5061
- var { compareIdentifiers } = require_identifiers();
5062
- var SemVer = class _SemVer {
5063
- constructor(version, options) {
5064
- options = parseOptions(options);
5065
- if (version instanceof _SemVer) {
5066
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
5067
- return version;
4834
+ }
4835
+ var dialect3, fromDatabase;
4836
+ var init_sqliteSerializer = __esm({
4837
+ "src/serializer/sqliteSerializer.ts"() {
4838
+ "use strict";
4839
+ init_serializer();
4840
+ init_outputs();
4841
+ init_source();
4842
+ dialect3 = new SQLiteSyncDialect();
4843
+ fromDatabase = async (db, tablesFilter = (table4) => true, progressCallback) => {
4844
+ const result = {};
4845
+ const columns = await db.query(
4846
+ `SELECT
4847
+ m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
4848
+ FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
4849
+ WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table';
4850
+ `
4851
+ );
4852
+ const tablesWithSeq = [];
4853
+ const seq = await db.query(
4854
+ `SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock' and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
4855
+ );
4856
+ for (const s of seq) {
4857
+ tablesWithSeq.push(s.name);
4858
+ }
4859
+ let columnsCount = 0;
4860
+ let tablesCount = /* @__PURE__ */ new Set();
4861
+ let indexesCount = 0;
4862
+ let foreignKeysCount = 0;
4863
+ const tableToPk = {};
4864
+ for (const column4 of columns) {
4865
+ if (!tablesFilter(column4.tableName))
4866
+ continue;
4867
+ columnsCount += 1;
4868
+ if (progressCallback) {
4869
+ progressCallback("columns", columnsCount, "fetching");
4870
+ }
4871
+ const tableName = column4.tableName;
4872
+ tablesCount.add(tableName);
4873
+ if (progressCallback) {
4874
+ progressCallback("tables", tablesCount.size, "fetching");
4875
+ }
4876
+ const columnName = column4.columnName;
4877
+ const isNotNull = column4.notNull === 1;
4878
+ const columnType = column4.columnType;
4879
+ const isPrimary = column4.pk !== 0;
4880
+ const columnDefault = column4.defaultValue;
4881
+ const isAutoincrement = isPrimary && tablesWithSeq.includes(tableName);
4882
+ if (isPrimary) {
4883
+ if (typeof tableToPk[tableName] === "undefined") {
4884
+ tableToPk[tableName] = [columnName];
5068
4885
  } else {
5069
- version = version.version;
4886
+ tableToPk[tableName].push(columnName);
5070
4887
  }
5071
- } else if (typeof version !== "string") {
5072
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
5073
- }
5074
- if (version.length > MAX_LENGTH) {
5075
- throw new TypeError(
5076
- `version is longer than ${MAX_LENGTH} characters`
5077
- );
5078
4888
  }
5079
- debug("SemVer", version, options);
5080
- this.options = options;
5081
- this.loose = !!options.loose;
5082
- this.includePrerelease = !!options.includePrerelease;
5083
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
5084
- if (!m) {
5085
- throw new TypeError(`Invalid Version: ${version}`);
5086
- }
5087
- this.raw = version;
5088
- this.major = +m[1];
5089
- this.minor = +m[2];
5090
- this.patch = +m[3];
5091
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
5092
- throw new TypeError("Invalid major version");
5093
- }
5094
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
5095
- throw new TypeError("Invalid minor version");
5096
- }
5097
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
5098
- throw new TypeError("Invalid patch version");
5099
- }
5100
- if (!m[4]) {
5101
- this.prerelease = [];
4889
+ const table4 = result[tableName];
4890
+ const newColumn = {
4891
+ default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : ["CURRENT_TIME", "CURRENT_DATE", "CURRENT_TIMESTAMP"].includes(
4892
+ columnDefault
4893
+ ) ? `(${columnDefault})` : columnDefault === "false" ? false : columnDefault === "true" ? true : columnDefault.startsWith("'") && columnDefault.endsWith("'") ? columnDefault : (
4894
+ // ? columnDefault.substring(1, columnDefault.length - 1)
4895
+ `(${columnDefault})`
4896
+ ),
4897
+ autoincrement: isAutoincrement,
4898
+ name: columnName,
4899
+ type: mapSqlToSqliteType(columnType),
4900
+ primaryKey: false,
4901
+ notNull: isNotNull
4902
+ };
4903
+ if (!table4) {
4904
+ result[tableName] = {
4905
+ name: tableName,
4906
+ columns: {
4907
+ [columnName]: newColumn
4908
+ },
4909
+ compositePrimaryKeys: {},
4910
+ indexes: {},
4911
+ foreignKeys: {},
4912
+ uniqueConstraints: {}
4913
+ };
5102
4914
  } else {
5103
- this.prerelease = m[4].split(".").map((id) => {
5104
- if (/^[0-9]+$/.test(id)) {
5105
- const num = +id;
5106
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
5107
- return num;
5108
- }
5109
- }
5110
- return id;
5111
- });
5112
- }
5113
- this.build = m[5] ? m[5].split(".") : [];
5114
- this.format();
5115
- }
5116
- format() {
5117
- this.version = `${this.major}.${this.minor}.${this.patch}`;
5118
- if (this.prerelease.length) {
5119
- this.version += `-${this.prerelease.join(".")}`;
5120
- }
5121
- return this.version;
5122
- }
5123
- toString() {
5124
- return this.version;
5125
- }
5126
- compare(other) {
5127
- debug("SemVer.compare", this.version, this.options, other);
5128
- if (!(other instanceof _SemVer)) {
5129
- if (typeof other === "string" && other === this.version) {
5130
- return 0;
5131
- }
5132
- other = new _SemVer(other, this.options);
5133
- }
5134
- if (other.version === this.version) {
5135
- return 0;
5136
- }
5137
- return this.compareMain(other) || this.comparePre(other);
5138
- }
5139
- compareMain(other) {
5140
- if (!(other instanceof _SemVer)) {
5141
- other = new _SemVer(other, this.options);
5142
- }
5143
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
5144
- }
5145
- comparePre(other) {
5146
- if (!(other instanceof _SemVer)) {
5147
- other = new _SemVer(other, this.options);
5148
- }
5149
- if (this.prerelease.length && !other.prerelease.length) {
5150
- return -1;
5151
- } else if (!this.prerelease.length && other.prerelease.length) {
5152
- return 1;
5153
- } else if (!this.prerelease.length && !other.prerelease.length) {
5154
- return 0;
5155
- }
5156
- let i = 0;
5157
- do {
5158
- const a = this.prerelease[i];
5159
- const b = other.prerelease[i];
5160
- debug("prerelease compare", i, a, b);
5161
- if (a === void 0 && b === void 0) {
5162
- return 0;
5163
- } else if (b === void 0) {
5164
- return 1;
5165
- } else if (a === void 0) {
5166
- return -1;
5167
- } else if (a === b) {
5168
- continue;
5169
- } else {
5170
- return compareIdentifiers(a, b);
5171
- }
5172
- } while (++i);
5173
- }
5174
- compareBuild(other) {
5175
- if (!(other instanceof _SemVer)) {
5176
- other = new _SemVer(other, this.options);
5177
- }
5178
- let i = 0;
5179
- do {
5180
- const a = this.build[i];
5181
- const b = other.build[i];
5182
- debug("prerelease compare", i, a, b);
5183
- if (a === void 0 && b === void 0) {
5184
- return 0;
5185
- } else if (b === void 0) {
5186
- return 1;
5187
- } else if (a === void 0) {
5188
- return -1;
5189
- } else if (a === b) {
5190
- continue;
5191
- } else {
5192
- return compareIdentifiers(a, b);
5193
- }
5194
- } while (++i);
5195
- }
5196
- // preminor will bump the version up to the next minor release, and immediately
5197
- // down to pre-release. premajor and prepatch work the same way.
5198
- inc(release, identifier, identifierBase) {
5199
- switch (release) {
5200
- case "premajor":
5201
- this.prerelease.length = 0;
5202
- this.patch = 0;
5203
- this.minor = 0;
5204
- this.major++;
5205
- this.inc("pre", identifier, identifierBase);
5206
- break;
5207
- case "preminor":
5208
- this.prerelease.length = 0;
5209
- this.patch = 0;
5210
- this.minor++;
5211
- this.inc("pre", identifier, identifierBase);
5212
- break;
5213
- case "prepatch":
5214
- this.prerelease.length = 0;
5215
- this.inc("patch", identifier, identifierBase);
5216
- this.inc("pre", identifier, identifierBase);
5217
- break;
5218
- case "prerelease":
5219
- if (this.prerelease.length === 0) {
5220
- this.inc("patch", identifier, identifierBase);
5221
- }
5222
- this.inc("pre", identifier, identifierBase);
5223
- break;
5224
- case "major":
5225
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
5226
- this.major++;
5227
- }
5228
- this.minor = 0;
5229
- this.patch = 0;
5230
- this.prerelease = [];
5231
- break;
5232
- case "minor":
5233
- if (this.patch !== 0 || this.prerelease.length === 0) {
5234
- this.minor++;
5235
- }
5236
- this.patch = 0;
5237
- this.prerelease = [];
5238
- break;
5239
- case "patch":
5240
- if (this.prerelease.length === 0) {
5241
- this.patch++;
5242
- }
5243
- this.prerelease = [];
5244
- break;
5245
- case "pre": {
5246
- const base = Number(identifierBase) ? 1 : 0;
5247
- if (!identifier && identifierBase === false) {
5248
- throw new Error("invalid increment argument: identifier is empty");
5249
- }
5250
- if (this.prerelease.length === 0) {
5251
- this.prerelease = [base];
5252
- } else {
5253
- let i = this.prerelease.length;
5254
- while (--i >= 0) {
5255
- if (typeof this.prerelease[i] === "number") {
5256
- this.prerelease[i]++;
5257
- i = -2;
5258
- }
5259
- }
5260
- if (i === -1) {
5261
- if (identifier === this.prerelease.join(".") && identifierBase === false) {
5262
- throw new Error("invalid increment argument: identifier already exists");
5263
- }
5264
- this.prerelease.push(base);
5265
- }
5266
- }
5267
- if (identifier) {
5268
- let prerelease = [identifier, base];
5269
- if (identifierBase === false) {
5270
- prerelease = [identifier];
5271
- }
5272
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
5273
- if (isNaN(this.prerelease[1])) {
5274
- this.prerelease = prerelease;
5275
- }
5276
- } else {
5277
- this.prerelease = prerelease;
5278
- }
5279
- }
5280
- break;
5281
- }
5282
- default:
5283
- throw new Error(`invalid increment argument: ${release}`);
5284
- }
5285
- this.raw = this.format();
5286
- if (this.build.length) {
5287
- this.raw += `+${this.build.join(".")}`;
5288
- }
5289
- return this;
5290
- }
5291
- };
5292
- module.exports = SemVer;
5293
- }
5294
- });
5295
-
5296
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/parse.js
5297
- var require_parse = __commonJS({
5298
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/parse.js"(exports, module) {
5299
- var SemVer = require_semver();
5300
- var parse = (version, options, throwErrors = false) => {
5301
- if (version instanceof SemVer) {
5302
- return version;
5303
- }
5304
- try {
5305
- return new SemVer(version, options);
5306
- } catch (er) {
5307
- if (!throwErrors) {
5308
- return null;
5309
- }
5310
- throw er;
5311
- }
5312
- };
5313
- module.exports = parse;
5314
- }
5315
- });
5316
-
5317
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/valid.js
5318
- var require_valid = __commonJS({
5319
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/valid.js"(exports, module) {
5320
- var parse = require_parse();
5321
- var valid = (version, options) => {
5322
- const v = parse(version, options);
5323
- return v ? v.version : null;
5324
- };
5325
- module.exports = valid;
5326
- }
5327
- });
5328
-
5329
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/clean.js
5330
- var require_clean = __commonJS({
5331
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/clean.js"(exports, module) {
5332
- var parse = require_parse();
5333
- var clean = (version, options) => {
5334
- const s = parse(version.trim().replace(/^[=v]+/, ""), options);
5335
- return s ? s.version : null;
5336
- };
5337
- module.exports = clean;
5338
- }
5339
- });
5340
-
5341
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/inc.js
5342
- var require_inc = __commonJS({
5343
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/inc.js"(exports, module) {
5344
- var SemVer = require_semver();
5345
- var inc = (version, release, options, identifier, identifierBase) => {
5346
- if (typeof options === "string") {
5347
- identifierBase = identifier;
5348
- identifier = options;
5349
- options = void 0;
5350
- }
5351
- try {
5352
- return new SemVer(
5353
- version instanceof SemVer ? version.version : version,
5354
- options
5355
- ).inc(release, identifier, identifierBase).version;
5356
- } catch (er) {
5357
- return null;
5358
- }
5359
- };
5360
- module.exports = inc;
5361
- }
5362
- });
5363
-
5364
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/diff.js
5365
- var require_diff = __commonJS({
5366
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/diff.js"(exports, module) {
5367
- var parse = require_parse();
5368
- var diff = (version1, version2) => {
5369
- const v1 = parse(version1, null, true);
5370
- const v2 = parse(version2, null, true);
5371
- const comparison = v1.compare(v2);
5372
- if (comparison === 0) {
5373
- return null;
5374
- }
5375
- const v1Higher = comparison > 0;
5376
- const highVersion = v1Higher ? v1 : v2;
5377
- const lowVersion = v1Higher ? v2 : v1;
5378
- const highHasPre = !!highVersion.prerelease.length;
5379
- const lowHasPre = !!lowVersion.prerelease.length;
5380
- if (lowHasPre && !highHasPre) {
5381
- if (!lowVersion.patch && !lowVersion.minor) {
5382
- return "major";
5383
- }
5384
- if (highVersion.patch) {
5385
- return "patch";
5386
- }
5387
- if (highVersion.minor) {
5388
- return "minor";
5389
- }
5390
- return "major";
5391
- }
5392
- const prefix = highHasPre ? "pre" : "";
5393
- if (v1.major !== v2.major) {
5394
- return prefix + "major";
5395
- }
5396
- if (v1.minor !== v2.minor) {
5397
- return prefix + "minor";
5398
- }
5399
- if (v1.patch !== v2.patch) {
5400
- return prefix + "patch";
5401
- }
5402
- return "prerelease";
5403
- };
5404
- module.exports = diff;
5405
- }
5406
- });
5407
-
5408
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/major.js
5409
- var require_major = __commonJS({
5410
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/major.js"(exports, module) {
5411
- var SemVer = require_semver();
5412
- var major = (a, loose) => new SemVer(a, loose).major;
5413
- module.exports = major;
5414
- }
5415
- });
5416
-
5417
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/minor.js
5418
- var require_minor = __commonJS({
5419
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/minor.js"(exports, module) {
5420
- var SemVer = require_semver();
5421
- var minor = (a, loose) => new SemVer(a, loose).minor;
5422
- module.exports = minor;
5423
- }
5424
- });
5425
-
5426
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/patch.js
5427
- var require_patch = __commonJS({
5428
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/patch.js"(exports, module) {
5429
- var SemVer = require_semver();
5430
- var patch = (a, loose) => new SemVer(a, loose).patch;
5431
- module.exports = patch;
5432
- }
5433
- });
5434
-
5435
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/prerelease.js
5436
- var require_prerelease = __commonJS({
5437
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/prerelease.js"(exports, module) {
5438
- var parse = require_parse();
5439
- var prerelease = (version, options) => {
5440
- const parsed = parse(version, options);
5441
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
5442
- };
5443
- module.exports = prerelease;
5444
- }
5445
- });
5446
-
5447
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare.js
5448
- var require_compare = __commonJS({
5449
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare.js"(exports, module) {
5450
- var SemVer = require_semver();
5451
- var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
5452
- module.exports = compare;
5453
- }
5454
- });
5455
-
5456
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rcompare.js
5457
- var require_rcompare = __commonJS({
5458
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rcompare.js"(exports, module) {
5459
- var compare = require_compare();
5460
- var rcompare = (a, b, loose) => compare(b, a, loose);
5461
- module.exports = rcompare;
5462
- }
5463
- });
5464
-
5465
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-loose.js
5466
- var require_compare_loose = __commonJS({
5467
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-loose.js"(exports, module) {
5468
- var compare = require_compare();
5469
- var compareLoose = (a, b) => compare(a, b, true);
5470
- module.exports = compareLoose;
5471
- }
5472
- });
5473
-
5474
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-build.js
5475
- var require_compare_build = __commonJS({
5476
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-build.js"(exports, module) {
5477
- var SemVer = require_semver();
5478
- var compareBuild = (a, b, loose) => {
5479
- const versionA = new SemVer(a, loose);
5480
- const versionB = new SemVer(b, loose);
5481
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
5482
- };
5483
- module.exports = compareBuild;
5484
- }
5485
- });
5486
-
5487
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/sort.js
5488
- var require_sort = __commonJS({
5489
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/sort.js"(exports, module) {
5490
- var compareBuild = require_compare_build();
5491
- var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
5492
- module.exports = sort;
5493
- }
5494
- });
5495
-
5496
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rsort.js
5497
- var require_rsort = __commonJS({
5498
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rsort.js"(exports, module) {
5499
- var compareBuild = require_compare_build();
5500
- var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
5501
- module.exports = rsort;
5502
- }
5503
- });
5504
-
5505
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gt.js
5506
- var require_gt = __commonJS({
5507
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gt.js"(exports, module) {
5508
- var compare = require_compare();
5509
- var gt = (a, b, loose) => compare(a, b, loose) > 0;
5510
- module.exports = gt;
5511
- }
5512
- });
5513
-
5514
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lt.js
5515
- var require_lt = __commonJS({
5516
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lt.js"(exports, module) {
5517
- var compare = require_compare();
5518
- var lt = (a, b, loose) => compare(a, b, loose) < 0;
5519
- module.exports = lt;
5520
- }
5521
- });
5522
-
5523
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/eq.js
5524
- var require_eq = __commonJS({
5525
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/eq.js"(exports, module) {
5526
- var compare = require_compare();
5527
- var eq = (a, b, loose) => compare(a, b, loose) === 0;
5528
- module.exports = eq;
5529
- }
5530
- });
5531
-
5532
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/neq.js
5533
- var require_neq = __commonJS({
5534
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/neq.js"(exports, module) {
5535
- var compare = require_compare();
5536
- var neq = (a, b, loose) => compare(a, b, loose) !== 0;
5537
- module.exports = neq;
5538
- }
5539
- });
5540
-
5541
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gte.js
5542
- var require_gte = __commonJS({
5543
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gte.js"(exports, module) {
5544
- var compare = require_compare();
5545
- var gte = (a, b, loose) => compare(a, b, loose) >= 0;
5546
- module.exports = gte;
5547
- }
5548
- });
5549
-
5550
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lte.js
5551
- var require_lte = __commonJS({
5552
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lte.js"(exports, module) {
5553
- var compare = require_compare();
5554
- var lte = (a, b, loose) => compare(a, b, loose) <= 0;
5555
- module.exports = lte;
5556
- }
5557
- });
5558
-
5559
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/cmp.js
5560
- var require_cmp = __commonJS({
5561
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/cmp.js"(exports, module) {
5562
- var eq = require_eq();
5563
- var neq = require_neq();
5564
- var gt = require_gt();
5565
- var gte = require_gte();
5566
- var lt = require_lt();
5567
- var lte = require_lte();
5568
- var cmp = (a, op, b, loose) => {
5569
- switch (op) {
5570
- case "===":
5571
- if (typeof a === "object") {
5572
- a = a.version;
5573
- }
5574
- if (typeof b === "object") {
5575
- b = b.version;
5576
- }
5577
- return a === b;
5578
- case "!==":
5579
- if (typeof a === "object") {
5580
- a = a.version;
5581
- }
5582
- if (typeof b === "object") {
5583
- b = b.version;
5584
- }
5585
- return a !== b;
5586
- case "":
5587
- case "=":
5588
- case "==":
5589
- return eq(a, b, loose);
5590
- case "!=":
5591
- return neq(a, b, loose);
5592
- case ">":
5593
- return gt(a, b, loose);
5594
- case ">=":
5595
- return gte(a, b, loose);
5596
- case "<":
5597
- return lt(a, b, loose);
5598
- case "<=":
5599
- return lte(a, b, loose);
5600
- default:
5601
- throw new TypeError(`Invalid operator: ${op}`);
5602
- }
5603
- };
5604
- module.exports = cmp;
5605
- }
5606
- });
5607
-
5608
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/coerce.js
5609
- var require_coerce = __commonJS({
5610
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/coerce.js"(exports, module) {
5611
- var SemVer = require_semver();
5612
- var parse = require_parse();
5613
- var { safeRe: re, t } = require_re();
5614
- var coerce = (version, options) => {
5615
- if (version instanceof SemVer) {
5616
- return version;
5617
- }
5618
- if (typeof version === "number") {
5619
- version = String(version);
5620
- }
5621
- if (typeof version !== "string") {
5622
- return null;
5623
- }
5624
- options = options || {};
5625
- let match2 = null;
5626
- if (!options.rtl) {
5627
- match2 = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
5628
- } else {
5629
- const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
5630
- let next;
5631
- while ((next = coerceRtlRegex.exec(version)) && (!match2 || match2.index + match2[0].length !== version.length)) {
5632
- if (!match2 || next.index + next[0].length !== match2.index + match2[0].length) {
5633
- match2 = next;
5634
- }
5635
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
5636
- }
5637
- coerceRtlRegex.lastIndex = -1;
5638
- }
5639
- if (match2 === null) {
5640
- return null;
5641
- }
5642
- const major = match2[2];
5643
- const minor = match2[3] || "0";
5644
- const patch = match2[4] || "0";
5645
- const prerelease = options.includePrerelease && match2[5] ? `-${match2[5]}` : "";
5646
- const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : "";
5647
- return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
5648
- };
5649
- module.exports = coerce;
5650
- }
5651
- });
5652
-
5653
- // node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js
5654
- var require_iterator = __commonJS({
5655
- "node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js"(exports, module) {
5656
- "use strict";
5657
- module.exports = function(Yallist) {
5658
- Yallist.prototype[Symbol.iterator] = function* () {
5659
- for (let walker = this.head; walker; walker = walker.next) {
5660
- yield walker.value;
5661
- }
5662
- };
5663
- };
5664
- }
5665
- });
5666
-
5667
- // node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js
5668
- var require_yallist = __commonJS({
5669
- "node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js"(exports, module) {
5670
- "use strict";
5671
- module.exports = Yallist;
5672
- Yallist.Node = Node;
5673
- Yallist.create = Yallist;
5674
- function Yallist(list) {
5675
- var self2 = this;
5676
- if (!(self2 instanceof Yallist)) {
5677
- self2 = new Yallist();
5678
- }
5679
- self2.tail = null;
5680
- self2.head = null;
5681
- self2.length = 0;
5682
- if (list && typeof list.forEach === "function") {
5683
- list.forEach(function(item) {
5684
- self2.push(item);
5685
- });
5686
- } else if (arguments.length > 0) {
5687
- for (var i = 0, l = arguments.length; i < l; i++) {
5688
- self2.push(arguments[i]);
5689
- }
5690
- }
5691
- return self2;
5692
- }
5693
- Yallist.prototype.removeNode = function(node) {
5694
- if (node.list !== this) {
5695
- throw new Error("removing node which does not belong to this list");
5696
- }
5697
- var next = node.next;
5698
- var prev = node.prev;
5699
- if (next) {
5700
- next.prev = prev;
5701
- }
5702
- if (prev) {
5703
- prev.next = next;
5704
- }
5705
- if (node === this.head) {
5706
- this.head = next;
5707
- }
5708
- if (node === this.tail) {
5709
- this.tail = prev;
5710
- }
5711
- node.list.length--;
5712
- node.next = null;
5713
- node.prev = null;
5714
- node.list = null;
5715
- return next;
5716
- };
5717
- Yallist.prototype.unshiftNode = function(node) {
5718
- if (node === this.head) {
5719
- return;
5720
- }
5721
- if (node.list) {
5722
- node.list.removeNode(node);
5723
- }
5724
- var head = this.head;
5725
- node.list = this;
5726
- node.next = head;
5727
- if (head) {
5728
- head.prev = node;
5729
- }
5730
- this.head = node;
5731
- if (!this.tail) {
5732
- this.tail = node;
5733
- }
5734
- this.length++;
5735
- };
5736
- Yallist.prototype.pushNode = function(node) {
5737
- if (node === this.tail) {
5738
- return;
5739
- }
5740
- if (node.list) {
5741
- node.list.removeNode(node);
5742
- }
5743
- var tail = this.tail;
5744
- node.list = this;
5745
- node.prev = tail;
5746
- if (tail) {
5747
- tail.next = node;
5748
- }
5749
- this.tail = node;
5750
- if (!this.head) {
5751
- this.head = node;
5752
- }
5753
- this.length++;
5754
- };
5755
- Yallist.prototype.push = function() {
5756
- for (var i = 0, l = arguments.length; i < l; i++) {
5757
- push(this, arguments[i]);
5758
- }
5759
- return this.length;
5760
- };
5761
- Yallist.prototype.unshift = function() {
5762
- for (var i = 0, l = arguments.length; i < l; i++) {
5763
- unshift(this, arguments[i]);
5764
- }
5765
- return this.length;
5766
- };
5767
- Yallist.prototype.pop = function() {
5768
- if (!this.tail) {
5769
- return void 0;
5770
- }
5771
- var res = this.tail.value;
5772
- this.tail = this.tail.prev;
5773
- if (this.tail) {
5774
- this.tail.next = null;
5775
- } else {
5776
- this.head = null;
5777
- }
5778
- this.length--;
5779
- return res;
5780
- };
5781
- Yallist.prototype.shift = function() {
5782
- if (!this.head) {
5783
- return void 0;
5784
- }
5785
- var res = this.head.value;
5786
- this.head = this.head.next;
5787
- if (this.head) {
5788
- this.head.prev = null;
5789
- } else {
5790
- this.tail = null;
5791
- }
5792
- this.length--;
5793
- return res;
5794
- };
5795
- Yallist.prototype.forEach = function(fn, thisp) {
5796
- thisp = thisp || this;
5797
- for (var walker = this.head, i = 0; walker !== null; i++) {
5798
- fn.call(thisp, walker.value, i, this);
5799
- walker = walker.next;
5800
- }
5801
- };
5802
- Yallist.prototype.forEachReverse = function(fn, thisp) {
5803
- thisp = thisp || this;
5804
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
5805
- fn.call(thisp, walker.value, i, this);
5806
- walker = walker.prev;
5807
- }
5808
- };
5809
- Yallist.prototype.get = function(n) {
5810
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
5811
- walker = walker.next;
5812
- }
5813
- if (i === n && walker !== null) {
5814
- return walker.value;
5815
- }
5816
- };
5817
- Yallist.prototype.getReverse = function(n) {
5818
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
5819
- walker = walker.prev;
5820
- }
5821
- if (i === n && walker !== null) {
5822
- return walker.value;
5823
- }
5824
- };
5825
- Yallist.prototype.map = function(fn, thisp) {
5826
- thisp = thisp || this;
5827
- var res = new Yallist();
5828
- for (var walker = this.head; walker !== null; ) {
5829
- res.push(fn.call(thisp, walker.value, this));
5830
- walker = walker.next;
5831
- }
5832
- return res;
5833
- };
5834
- Yallist.prototype.mapReverse = function(fn, thisp) {
5835
- thisp = thisp || this;
5836
- var res = new Yallist();
5837
- for (var walker = this.tail; walker !== null; ) {
5838
- res.push(fn.call(thisp, walker.value, this));
5839
- walker = walker.prev;
5840
- }
5841
- return res;
5842
- };
5843
- Yallist.prototype.reduce = function(fn, initial) {
5844
- var acc;
5845
- var walker = this.head;
5846
- if (arguments.length > 1) {
5847
- acc = initial;
5848
- } else if (this.head) {
5849
- walker = this.head.next;
5850
- acc = this.head.value;
5851
- } else {
5852
- throw new TypeError("Reduce of empty list with no initial value");
5853
- }
5854
- for (var i = 0; walker !== null; i++) {
5855
- acc = fn(acc, walker.value, i);
5856
- walker = walker.next;
5857
- }
5858
- return acc;
5859
- };
5860
- Yallist.prototype.reduceReverse = function(fn, initial) {
5861
- var acc;
5862
- var walker = this.tail;
5863
- if (arguments.length > 1) {
5864
- acc = initial;
5865
- } else if (this.tail) {
5866
- walker = this.tail.prev;
5867
- acc = this.tail.value;
5868
- } else {
5869
- throw new TypeError("Reduce of empty list with no initial value");
5870
- }
5871
- for (var i = this.length - 1; walker !== null; i--) {
5872
- acc = fn(acc, walker.value, i);
5873
- walker = walker.prev;
5874
- }
5875
- return acc;
5876
- };
5877
- Yallist.prototype.toArray = function() {
5878
- var arr = new Array(this.length);
5879
- for (var i = 0, walker = this.head; walker !== null; i++) {
5880
- arr[i] = walker.value;
5881
- walker = walker.next;
5882
- }
5883
- return arr;
5884
- };
5885
- Yallist.prototype.toArrayReverse = function() {
5886
- var arr = new Array(this.length);
5887
- for (var i = 0, walker = this.tail; walker !== null; i++) {
5888
- arr[i] = walker.value;
5889
- walker = walker.prev;
5890
- }
5891
- return arr;
5892
- };
5893
- Yallist.prototype.slice = function(from, to) {
5894
- to = to || this.length;
5895
- if (to < 0) {
5896
- to += this.length;
5897
- }
5898
- from = from || 0;
5899
- if (from < 0) {
5900
- from += this.length;
5901
- }
5902
- var ret = new Yallist();
5903
- if (to < from || to < 0) {
5904
- return ret;
5905
- }
5906
- if (from < 0) {
5907
- from = 0;
5908
- }
5909
- if (to > this.length) {
5910
- to = this.length;
5911
- }
5912
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
5913
- walker = walker.next;
5914
- }
5915
- for (; walker !== null && i < to; i++, walker = walker.next) {
5916
- ret.push(walker.value);
5917
- }
5918
- return ret;
5919
- };
5920
- Yallist.prototype.sliceReverse = function(from, to) {
5921
- to = to || this.length;
5922
- if (to < 0) {
5923
- to += this.length;
5924
- }
5925
- from = from || 0;
5926
- if (from < 0) {
5927
- from += this.length;
5928
- }
5929
- var ret = new Yallist();
5930
- if (to < from || to < 0) {
5931
- return ret;
5932
- }
5933
- if (from < 0) {
5934
- from = 0;
5935
- }
5936
- if (to > this.length) {
5937
- to = this.length;
5938
- }
5939
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
5940
- walker = walker.prev;
5941
- }
5942
- for (; walker !== null && i > from; i--, walker = walker.prev) {
5943
- ret.push(walker.value);
5944
- }
5945
- return ret;
5946
- };
5947
- Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
5948
- if (start > this.length) {
5949
- start = this.length - 1;
5950
- }
5951
- if (start < 0) {
5952
- start = this.length + start;
5953
- }
5954
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
5955
- walker = walker.next;
5956
- }
5957
- var ret = [];
5958
- for (var i = 0; walker && i < deleteCount; i++) {
5959
- ret.push(walker.value);
5960
- walker = this.removeNode(walker);
5961
- }
5962
- if (walker === null) {
5963
- walker = this.tail;
5964
- }
5965
- if (walker !== this.head && walker !== this.tail) {
5966
- walker = walker.prev;
5967
- }
5968
- for (var i = 0; i < nodes.length; i++) {
5969
- walker = insert(this, walker, nodes[i]);
5970
- }
5971
- return ret;
5972
- };
5973
- Yallist.prototype.reverse = function() {
5974
- var head = this.head;
5975
- var tail = this.tail;
5976
- for (var walker = head; walker !== null; walker = walker.prev) {
5977
- var p = walker.prev;
5978
- walker.prev = walker.next;
5979
- walker.next = p;
5980
- }
5981
- this.head = tail;
5982
- this.tail = head;
5983
- return this;
5984
- };
5985
- function insert(self2, node, value) {
5986
- var inserted = node === self2.head ? new Node(value, null, node, self2) : new Node(value, node, node.next, self2);
5987
- if (inserted.next === null) {
5988
- self2.tail = inserted;
5989
- }
5990
- if (inserted.prev === null) {
5991
- self2.head = inserted;
5992
- }
5993
- self2.length++;
5994
- return inserted;
5995
- }
5996
- function push(self2, item) {
5997
- self2.tail = new Node(item, self2.tail, null, self2);
5998
- if (!self2.head) {
5999
- self2.head = self2.tail;
6000
- }
6001
- self2.length++;
6002
- }
6003
- function unshift(self2, item) {
6004
- self2.head = new Node(item, null, self2.head, self2);
6005
- if (!self2.tail) {
6006
- self2.tail = self2.head;
6007
- }
6008
- self2.length++;
6009
- }
6010
- function Node(value, prev, next, list) {
6011
- if (!(this instanceof Node)) {
6012
- return new Node(value, prev, next, list);
6013
- }
6014
- this.list = list;
6015
- this.value = value;
6016
- if (prev) {
6017
- prev.next = this;
6018
- this.prev = prev;
6019
- } else {
6020
- this.prev = null;
6021
- }
6022
- if (next) {
6023
- next.prev = this;
6024
- this.next = next;
6025
- } else {
6026
- this.next = null;
6027
- }
6028
- }
6029
- try {
6030
- require_iterator()(Yallist);
6031
- } catch (er) {
6032
- }
6033
- }
6034
- });
6035
-
6036
- // node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js
6037
- var require_lru_cache = __commonJS({
6038
- "node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js"(exports, module) {
6039
- "use strict";
6040
- var Yallist = require_yallist();
6041
- var MAX = Symbol("max");
6042
- var LENGTH = Symbol("length");
6043
- var LENGTH_CALCULATOR = Symbol("lengthCalculator");
6044
- var ALLOW_STALE = Symbol("allowStale");
6045
- var MAX_AGE = Symbol("maxAge");
6046
- var DISPOSE = Symbol("dispose");
6047
- var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
6048
- var LRU_LIST = Symbol("lruList");
6049
- var CACHE = Symbol("cache");
6050
- var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
6051
- var naiveLength = () => 1;
6052
- var LRUCache = class {
6053
- constructor(options) {
6054
- if (typeof options === "number")
6055
- options = { max: options };
6056
- if (!options)
6057
- options = {};
6058
- if (options.max && (typeof options.max !== "number" || options.max < 0))
6059
- throw new TypeError("max must be a non-negative number");
6060
- const max = this[MAX] = options.max || Infinity;
6061
- const lc = options.length || naiveLength;
6062
- this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
6063
- this[ALLOW_STALE] = options.stale || false;
6064
- if (options.maxAge && typeof options.maxAge !== "number")
6065
- throw new TypeError("maxAge must be a number");
6066
- this[MAX_AGE] = options.maxAge || 0;
6067
- this[DISPOSE] = options.dispose;
6068
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
6069
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
6070
- this.reset();
6071
- }
6072
- // resize the cache when the max changes.
6073
- set max(mL) {
6074
- if (typeof mL !== "number" || mL < 0)
6075
- throw new TypeError("max must be a non-negative number");
6076
- this[MAX] = mL || Infinity;
6077
- trim(this);
6078
- }
6079
- get max() {
6080
- return this[MAX];
6081
- }
6082
- set allowStale(allowStale) {
6083
- this[ALLOW_STALE] = !!allowStale;
6084
- }
6085
- get allowStale() {
6086
- return this[ALLOW_STALE];
6087
- }
6088
- set maxAge(mA) {
6089
- if (typeof mA !== "number")
6090
- throw new TypeError("maxAge must be a non-negative number");
6091
- this[MAX_AGE] = mA;
6092
- trim(this);
6093
- }
6094
- get maxAge() {
6095
- return this[MAX_AGE];
6096
- }
6097
- // resize the cache when the lengthCalculator changes.
6098
- set lengthCalculator(lC) {
6099
- if (typeof lC !== "function")
6100
- lC = naiveLength;
6101
- if (lC !== this[LENGTH_CALCULATOR]) {
6102
- this[LENGTH_CALCULATOR] = lC;
6103
- this[LENGTH] = 0;
6104
- this[LRU_LIST].forEach((hit) => {
6105
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
6106
- this[LENGTH] += hit.length;
6107
- });
6108
- }
6109
- trim(this);
6110
- }
6111
- get lengthCalculator() {
6112
- return this[LENGTH_CALCULATOR];
6113
- }
6114
- get length() {
6115
- return this[LENGTH];
6116
- }
6117
- get itemCount() {
6118
- return this[LRU_LIST].length;
6119
- }
6120
- rforEach(fn, thisp) {
6121
- thisp = thisp || this;
6122
- for (let walker = this[LRU_LIST].tail; walker !== null; ) {
6123
- const prev = walker.prev;
6124
- forEachStep(this, fn, walker, thisp);
6125
- walker = prev;
6126
- }
6127
- }
6128
- forEach(fn, thisp) {
6129
- thisp = thisp || this;
6130
- for (let walker = this[LRU_LIST].head; walker !== null; ) {
6131
- const next = walker.next;
6132
- forEachStep(this, fn, walker, thisp);
6133
- walker = next;
6134
- }
6135
- }
6136
- keys() {
6137
- return this[LRU_LIST].toArray().map((k) => k.key);
6138
- }
6139
- values() {
6140
- return this[LRU_LIST].toArray().map((k) => k.value);
6141
- }
6142
- reset() {
6143
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
6144
- this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
6145
- }
6146
- this[CACHE] = /* @__PURE__ */ new Map();
6147
- this[LRU_LIST] = new Yallist();
6148
- this[LENGTH] = 0;
6149
- }
6150
- dump() {
6151
- return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
6152
- k: hit.key,
6153
- v: hit.value,
6154
- e: hit.now + (hit.maxAge || 0)
6155
- }).toArray().filter((h) => h);
6156
- }
6157
- dumpLru() {
6158
- return this[LRU_LIST];
6159
- }
6160
- set(key, value, maxAge) {
6161
- maxAge = maxAge || this[MAX_AGE];
6162
- if (maxAge && typeof maxAge !== "number")
6163
- throw new TypeError("maxAge must be a number");
6164
- const now = maxAge ? Date.now() : 0;
6165
- const len = this[LENGTH_CALCULATOR](value, key);
6166
- if (this[CACHE].has(key)) {
6167
- if (len > this[MAX]) {
6168
- del(this, this[CACHE].get(key));
6169
- return false;
6170
- }
6171
- const node = this[CACHE].get(key);
6172
- const item = node.value;
6173
- if (this[DISPOSE]) {
6174
- if (!this[NO_DISPOSE_ON_SET])
6175
- this[DISPOSE](key, item.value);
6176
- }
6177
- item.now = now;
6178
- item.maxAge = maxAge;
6179
- item.value = value;
6180
- this[LENGTH] += len - item.length;
6181
- item.length = len;
6182
- this.get(key);
6183
- trim(this);
6184
- return true;
6185
- }
6186
- const hit = new Entry(key, value, len, now, maxAge);
6187
- if (hit.length > this[MAX]) {
6188
- if (this[DISPOSE])
6189
- this[DISPOSE](key, value);
6190
- return false;
6191
- }
6192
- this[LENGTH] += hit.length;
6193
- this[LRU_LIST].unshift(hit);
6194
- this[CACHE].set(key, this[LRU_LIST].head);
6195
- trim(this);
6196
- return true;
6197
- }
6198
- has(key) {
6199
- if (!this[CACHE].has(key))
6200
- return false;
6201
- const hit = this[CACHE].get(key).value;
6202
- return !isStale(this, hit);
6203
- }
6204
- get(key) {
6205
- return get(this, key, true);
6206
- }
6207
- peek(key) {
6208
- return get(this, key, false);
6209
- }
6210
- pop() {
6211
- const node = this[LRU_LIST].tail;
6212
- if (!node)
6213
- return null;
6214
- del(this, node);
6215
- return node.value;
6216
- }
6217
- del(key) {
6218
- del(this, this[CACHE].get(key));
6219
- }
6220
- load(arr) {
6221
- this.reset();
6222
- const now = Date.now();
6223
- for (let l = arr.length - 1; l >= 0; l--) {
6224
- const hit = arr[l];
6225
- const expiresAt = hit.e || 0;
6226
- if (expiresAt === 0)
6227
- this.set(hit.k, hit.v);
6228
- else {
6229
- const maxAge = expiresAt - now;
6230
- if (maxAge > 0) {
6231
- this.set(hit.k, hit.v, maxAge);
6232
- }
6233
- }
6234
- }
6235
- }
6236
- prune() {
6237
- this[CACHE].forEach((value, key) => get(this, key, false));
6238
- }
6239
- };
6240
- var get = (self2, key, doUse) => {
6241
- const node = self2[CACHE].get(key);
6242
- if (node) {
6243
- const hit = node.value;
6244
- if (isStale(self2, hit)) {
6245
- del(self2, node);
6246
- if (!self2[ALLOW_STALE])
6247
- return void 0;
6248
- } else {
6249
- if (doUse) {
6250
- if (self2[UPDATE_AGE_ON_GET])
6251
- node.value.now = Date.now();
6252
- self2[LRU_LIST].unshiftNode(node);
6253
- }
6254
- }
6255
- return hit.value;
6256
- }
6257
- };
6258
- var isStale = (self2, hit) => {
6259
- if (!hit || !hit.maxAge && !self2[MAX_AGE])
6260
- return false;
6261
- const diff = Date.now() - hit.now;
6262
- return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE];
6263
- };
6264
- var trim = (self2) => {
6265
- if (self2[LENGTH] > self2[MAX]) {
6266
- for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
6267
- const prev = walker.prev;
6268
- del(self2, walker);
6269
- walker = prev;
6270
- }
6271
- }
6272
- };
6273
- var del = (self2, node) => {
6274
- if (node) {
6275
- const hit = node.value;
6276
- if (self2[DISPOSE])
6277
- self2[DISPOSE](hit.key, hit.value);
6278
- self2[LENGTH] -= hit.length;
6279
- self2[CACHE].delete(hit.key);
6280
- self2[LRU_LIST].removeNode(node);
6281
- }
6282
- };
6283
- var Entry = class {
6284
- constructor(key, value, length, now, maxAge) {
6285
- this.key = key;
6286
- this.value = value;
6287
- this.length = length;
6288
- this.now = now;
6289
- this.maxAge = maxAge || 0;
6290
- }
6291
- };
6292
- var forEachStep = (self2, fn, node, thisp) => {
6293
- let hit = node.value;
6294
- if (isStale(self2, hit)) {
6295
- del(self2, node);
6296
- if (!self2[ALLOW_STALE])
6297
- hit = void 0;
6298
- }
6299
- if (hit)
6300
- fn.call(thisp, hit.value, hit.key, self2);
6301
- };
6302
- module.exports = LRUCache;
6303
- }
6304
- });
6305
-
6306
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/range.js
6307
- var require_range = __commonJS({
6308
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/range.js"(exports, module) {
6309
- var Range = class _Range {
6310
- constructor(range, options) {
6311
- options = parseOptions(options);
6312
- if (range instanceof _Range) {
6313
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
6314
- return range;
6315
- } else {
6316
- return new _Range(range.raw, options);
6317
- }
6318
- }
6319
- if (range instanceof Comparator) {
6320
- this.raw = range.value;
6321
- this.set = [[range]];
6322
- this.format();
6323
- return this;
6324
- }
6325
- this.options = options;
6326
- this.loose = !!options.loose;
6327
- this.includePrerelease = !!options.includePrerelease;
6328
- this.raw = range.trim().split(/\s+/).join(" ");
6329
- this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
6330
- if (!this.set.length) {
6331
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
6332
- }
6333
- if (this.set.length > 1) {
6334
- const first = this.set[0];
6335
- this.set = this.set.filter((c) => !isNullSet(c[0]));
6336
- if (this.set.length === 0) {
6337
- this.set = [first];
6338
- } else if (this.set.length > 1) {
6339
- for (const c of this.set) {
6340
- if (c.length === 1 && isAny(c[0])) {
6341
- this.set = [c];
6342
- break;
6343
- }
6344
- }
6345
- }
6346
- }
6347
- this.format();
6348
- }
6349
- format() {
6350
- this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
6351
- return this.range;
6352
- }
6353
- toString() {
6354
- return this.range;
6355
- }
6356
- parseRange(range) {
6357
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
6358
- const memoKey = memoOpts + ":" + range;
6359
- const cached = cache.get(memoKey);
6360
- if (cached) {
6361
- return cached;
6362
- }
6363
- const loose = this.options.loose;
6364
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
6365
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
6366
- debug("hyphen replace", range);
6367
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
6368
- debug("comparator trim", range);
6369
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
6370
- debug("tilde trim", range);
6371
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
6372
- debug("caret trim", range);
6373
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
6374
- if (loose) {
6375
- rangeList = rangeList.filter((comp) => {
6376
- debug("loose invalid filter", comp, this.options);
6377
- return !!comp.match(re[t.COMPARATORLOOSE]);
6378
- });
6379
- }
6380
- debug("range list", rangeList);
6381
- const rangeMap = /* @__PURE__ */ new Map();
6382
- const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
6383
- for (const comp of comparators) {
6384
- if (isNullSet(comp)) {
6385
- return [comp];
6386
- }
6387
- rangeMap.set(comp.value, comp);
6388
- }
6389
- if (rangeMap.size > 1 && rangeMap.has("")) {
6390
- rangeMap.delete("");
6391
- }
6392
- const result = [...rangeMap.values()];
6393
- cache.set(memoKey, result);
6394
- return result;
6395
- }
6396
- intersects(range, options) {
6397
- if (!(range instanceof _Range)) {
6398
- throw new TypeError("a Range is required");
6399
- }
6400
- return this.set.some((thisComparators) => {
6401
- return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
6402
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
6403
- return rangeComparators.every((rangeComparator) => {
6404
- return thisComparator.intersects(rangeComparator, options);
6405
- });
6406
- });
6407
- });
6408
- });
6409
- }
6410
- // if ANY of the sets match ALL of its comparators, then pass
6411
- test(version) {
6412
- if (!version) {
6413
- return false;
6414
- }
6415
- if (typeof version === "string") {
6416
- try {
6417
- version = new SemVer(version, this.options);
6418
- } catch (er) {
6419
- return false;
6420
- }
6421
- }
6422
- for (let i = 0; i < this.set.length; i++) {
6423
- if (testSet(this.set[i], version, this.options)) {
6424
- return true;
6425
- }
6426
- }
6427
- return false;
6428
- }
6429
- };
6430
- module.exports = Range;
6431
- var LRU = require_lru_cache();
6432
- var cache = new LRU({ max: 1e3 });
6433
- var parseOptions = require_parse_options();
6434
- var Comparator = require_comparator();
6435
- var debug = require_debug();
6436
- var SemVer = require_semver();
6437
- var {
6438
- safeRe: re,
6439
- t,
6440
- comparatorTrimReplace,
6441
- tildeTrimReplace,
6442
- caretTrimReplace
6443
- } = require_re();
6444
- var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
6445
- var isNullSet = (c) => c.value === "<0.0.0-0";
6446
- var isAny = (c) => c.value === "";
6447
- var isSatisfiable = (comparators, options) => {
6448
- let result = true;
6449
- const remainingComparators = comparators.slice();
6450
- let testComparator = remainingComparators.pop();
6451
- while (result && remainingComparators.length) {
6452
- result = remainingComparators.every((otherComparator) => {
6453
- return testComparator.intersects(otherComparator, options);
6454
- });
6455
- testComparator = remainingComparators.pop();
6456
- }
6457
- return result;
6458
- };
6459
- var parseComparator = (comp, options) => {
6460
- debug("comp", comp, options);
6461
- comp = replaceCarets(comp, options);
6462
- debug("caret", comp);
6463
- comp = replaceTildes(comp, options);
6464
- debug("tildes", comp);
6465
- comp = replaceXRanges(comp, options);
6466
- debug("xrange", comp);
6467
- comp = replaceStars(comp, options);
6468
- debug("stars", comp);
6469
- return comp;
6470
- };
6471
- var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
6472
- var replaceTildes = (comp, options) => {
6473
- return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
6474
- };
6475
- var replaceTilde = (comp, options) => {
6476
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
6477
- return comp.replace(r, (_, M, m, p, pr) => {
6478
- debug("tilde", comp, _, M, m, p, pr);
6479
- let ret;
6480
- if (isX(M)) {
6481
- ret = "";
6482
- } else if (isX(m)) {
6483
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
6484
- } else if (isX(p)) {
6485
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
6486
- } else if (pr) {
6487
- debug("replaceTilde pr", pr);
6488
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
6489
- } else {
6490
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
6491
- }
6492
- debug("tilde return", ret);
6493
- return ret;
6494
- });
6495
- };
6496
- var replaceCarets = (comp, options) => {
6497
- return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
6498
- };
6499
- var replaceCaret = (comp, options) => {
6500
- debug("caret", comp, options);
6501
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
6502
- const z = options.includePrerelease ? "-0" : "";
6503
- return comp.replace(r, (_, M, m, p, pr) => {
6504
- debug("caret", comp, _, M, m, p, pr);
6505
- let ret;
6506
- if (isX(M)) {
6507
- ret = "";
6508
- } else if (isX(m)) {
6509
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
6510
- } else if (isX(p)) {
6511
- if (M === "0") {
6512
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
6513
- } else {
6514
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
6515
- }
6516
- } else if (pr) {
6517
- debug("replaceCaret pr", pr);
6518
- if (M === "0") {
6519
- if (m === "0") {
6520
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
6521
- } else {
6522
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
6523
- }
6524
- } else {
6525
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
6526
- }
6527
- } else {
6528
- debug("no pr");
6529
- if (M === "0") {
6530
- if (m === "0") {
6531
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
6532
- } else {
6533
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
6534
- }
6535
- } else {
6536
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
6537
- }
6538
- }
6539
- debug("caret return", ret);
6540
- return ret;
6541
- });
6542
- };
6543
- var replaceXRanges = (comp, options) => {
6544
- debug("replaceXRanges", comp, options);
6545
- return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
6546
- };
6547
- var replaceXRange = (comp, options) => {
6548
- comp = comp.trim();
6549
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
6550
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
6551
- debug("xRange", comp, ret, gtlt, M, m, p, pr);
6552
- const xM = isX(M);
6553
- const xm = xM || isX(m);
6554
- const xp = xm || isX(p);
6555
- const anyX = xp;
6556
- if (gtlt === "=" && anyX) {
6557
- gtlt = "";
6558
- }
6559
- pr = options.includePrerelease ? "-0" : "";
6560
- if (xM) {
6561
- if (gtlt === ">" || gtlt === "<") {
6562
- ret = "<0.0.0-0";
6563
- } else {
6564
- ret = "*";
6565
- }
6566
- } else if (gtlt && anyX) {
6567
- if (xm) {
6568
- m = 0;
6569
- }
6570
- p = 0;
6571
- if (gtlt === ">") {
6572
- gtlt = ">=";
6573
- if (xm) {
6574
- M = +M + 1;
6575
- m = 0;
6576
- p = 0;
6577
- } else {
6578
- m = +m + 1;
6579
- p = 0;
6580
- }
6581
- } else if (gtlt === "<=") {
6582
- gtlt = "<";
6583
- if (xm) {
6584
- M = +M + 1;
6585
- } else {
6586
- m = +m + 1;
6587
- }
6588
- }
6589
- if (gtlt === "<") {
6590
- pr = "-0";
6591
- }
6592
- ret = `${gtlt + M}.${m}.${p}${pr}`;
6593
- } else if (xm) {
6594
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
6595
- } else if (xp) {
6596
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
6597
- }
6598
- debug("xRange return", ret);
6599
- return ret;
6600
- });
6601
- };
6602
- var replaceStars = (comp, options) => {
6603
- debug("replaceStars", comp, options);
6604
- return comp.trim().replace(re[t.STAR], "");
6605
- };
6606
- var replaceGTE0 = (comp, options) => {
6607
- debug("replaceGTE0", comp, options);
6608
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
6609
- };
6610
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
6611
- if (isX(fM)) {
6612
- from = "";
6613
- } else if (isX(fm)) {
6614
- from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
6615
- } else if (isX(fp)) {
6616
- from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
6617
- } else if (fpr) {
6618
- from = `>=${from}`;
6619
- } else {
6620
- from = `>=${from}${incPr ? "-0" : ""}`;
6621
- }
6622
- if (isX(tM)) {
6623
- to = "";
6624
- } else if (isX(tm)) {
6625
- to = `<${+tM + 1}.0.0-0`;
6626
- } else if (isX(tp)) {
6627
- to = `<${tM}.${+tm + 1}.0-0`;
6628
- } else if (tpr) {
6629
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
6630
- } else if (incPr) {
6631
- to = `<${tM}.${tm}.${+tp + 1}-0`;
6632
- } else {
6633
- to = `<=${to}`;
6634
- }
6635
- return `${from} ${to}`.trim();
6636
- };
6637
- var testSet = (set, version, options) => {
6638
- for (let i = 0; i < set.length; i++) {
6639
- if (!set[i].test(version)) {
6640
- return false;
6641
- }
6642
- }
6643
- if (version.prerelease.length && !options.includePrerelease) {
6644
- for (let i = 0; i < set.length; i++) {
6645
- debug(set[i].semver);
6646
- if (set[i].semver === Comparator.ANY) {
6647
- continue;
6648
- }
6649
- if (set[i].semver.prerelease.length > 0) {
6650
- const allowed = set[i].semver;
6651
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
6652
- return true;
6653
- }
6654
- }
6655
- }
6656
- return false;
6657
- }
6658
- return true;
6659
- };
6660
- }
6661
- });
6662
-
6663
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/comparator.js
6664
- var require_comparator = __commonJS({
6665
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/comparator.js"(exports, module) {
6666
- var ANY = Symbol("SemVer ANY");
6667
- var Comparator = class _Comparator {
6668
- static get ANY() {
6669
- return ANY;
6670
- }
6671
- constructor(comp, options) {
6672
- options = parseOptions(options);
6673
- if (comp instanceof _Comparator) {
6674
- if (comp.loose === !!options.loose) {
6675
- return comp;
6676
- } else {
6677
- comp = comp.value;
6678
- }
6679
- }
6680
- comp = comp.trim().split(/\s+/).join(" ");
6681
- debug("comparator", comp, options);
6682
- this.options = options;
6683
- this.loose = !!options.loose;
6684
- this.parse(comp);
6685
- if (this.semver === ANY) {
6686
- this.value = "";
6687
- } else {
6688
- this.value = this.operator + this.semver.version;
6689
- }
6690
- debug("comp", this);
6691
- }
6692
- parse(comp) {
6693
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
6694
- const m = comp.match(r);
6695
- if (!m) {
6696
- throw new TypeError(`Invalid comparator: ${comp}`);
6697
- }
6698
- this.operator = m[1] !== void 0 ? m[1] : "";
6699
- if (this.operator === "=") {
6700
- this.operator = "";
6701
- }
6702
- if (!m[2]) {
6703
- this.semver = ANY;
6704
- } else {
6705
- this.semver = new SemVer(m[2], this.options.loose);
6706
- }
6707
- }
6708
- toString() {
6709
- return this.value;
6710
- }
6711
- test(version) {
6712
- debug("Comparator.test", version, this.options.loose);
6713
- if (this.semver === ANY || version === ANY) {
6714
- return true;
6715
- }
6716
- if (typeof version === "string") {
6717
- try {
6718
- version = new SemVer(version, this.options);
6719
- } catch (er) {
6720
- return false;
6721
- }
6722
- }
6723
- return cmp(version, this.operator, this.semver, this.options);
6724
- }
6725
- intersects(comp, options) {
6726
- if (!(comp instanceof _Comparator)) {
6727
- throw new TypeError("a Comparator is required");
6728
- }
6729
- if (this.operator === "") {
6730
- if (this.value === "") {
6731
- return true;
6732
- }
6733
- return new Range(comp.value, options).test(this.value);
6734
- } else if (comp.operator === "") {
6735
- if (comp.value === "") {
6736
- return true;
6737
- }
6738
- return new Range(this.value, options).test(comp.semver);
6739
- }
6740
- options = parseOptions(options);
6741
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
6742
- return false;
6743
- }
6744
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
6745
- return false;
6746
- }
6747
- if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
6748
- return true;
6749
- }
6750
- if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
6751
- return true;
6752
- }
6753
- if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
6754
- return true;
6755
- }
6756
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
6757
- return true;
6758
- }
6759
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
6760
- return true;
6761
- }
6762
- return false;
6763
- }
6764
- };
6765
- module.exports = Comparator;
6766
- var parseOptions = require_parse_options();
6767
- var { safeRe: re, t } = require_re();
6768
- var cmp = require_cmp();
6769
- var debug = require_debug();
6770
- var SemVer = require_semver();
6771
- var Range = require_range();
6772
- }
6773
- });
6774
-
6775
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/satisfies.js
6776
- var require_satisfies = __commonJS({
6777
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/satisfies.js"(exports, module) {
6778
- var Range = require_range();
6779
- var satisfies = (version, range, options) => {
6780
- try {
6781
- range = new Range(range, options);
6782
- } catch (er) {
6783
- return false;
6784
- }
6785
- return range.test(version);
6786
- };
6787
- module.exports = satisfies;
6788
- }
6789
- });
6790
-
6791
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/to-comparators.js
6792
- var require_to_comparators = __commonJS({
6793
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/to-comparators.js"(exports, module) {
6794
- var Range = require_range();
6795
- var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
6796
- module.exports = toComparators;
6797
- }
6798
- });
6799
-
6800
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/max-satisfying.js
6801
- var require_max_satisfying = __commonJS({
6802
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/max-satisfying.js"(exports, module) {
6803
- var SemVer = require_semver();
6804
- var Range = require_range();
6805
- var maxSatisfying = (versions, range, options) => {
6806
- let max = null;
6807
- let maxSV = null;
6808
- let rangeObj = null;
6809
- try {
6810
- rangeObj = new Range(range, options);
6811
- } catch (er) {
6812
- return null;
6813
- }
6814
- versions.forEach((v) => {
6815
- if (rangeObj.test(v)) {
6816
- if (!max || maxSV.compare(v) === -1) {
6817
- max = v;
6818
- maxSV = new SemVer(max, options);
6819
- }
6820
- }
6821
- });
6822
- return max;
6823
- };
6824
- module.exports = maxSatisfying;
6825
- }
6826
- });
6827
-
6828
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-satisfying.js
6829
- var require_min_satisfying = __commonJS({
6830
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-satisfying.js"(exports, module) {
6831
- var SemVer = require_semver();
6832
- var Range = require_range();
6833
- var minSatisfying = (versions, range, options) => {
6834
- let min = null;
6835
- let minSV = null;
6836
- let rangeObj = null;
6837
- try {
6838
- rangeObj = new Range(range, options);
6839
- } catch (er) {
6840
- return null;
6841
- }
6842
- versions.forEach((v) => {
6843
- if (rangeObj.test(v)) {
6844
- if (!min || minSV.compare(v) === 1) {
6845
- min = v;
6846
- minSV = new SemVer(min, options);
6847
- }
6848
- }
6849
- });
6850
- return min;
6851
- };
6852
- module.exports = minSatisfying;
6853
- }
6854
- });
6855
-
6856
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-version.js
6857
- var require_min_version = __commonJS({
6858
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-version.js"(exports, module) {
6859
- var SemVer = require_semver();
6860
- var Range = require_range();
6861
- var gt = require_gt();
6862
- var minVersion = (range, loose) => {
6863
- range = new Range(range, loose);
6864
- let minver = new SemVer("0.0.0");
6865
- if (range.test(minver)) {
6866
- return minver;
6867
- }
6868
- minver = new SemVer("0.0.0-0");
6869
- if (range.test(minver)) {
6870
- return minver;
6871
- }
6872
- minver = null;
6873
- for (let i = 0; i < range.set.length; ++i) {
6874
- const comparators = range.set[i];
6875
- let setMin = null;
6876
- comparators.forEach((comparator) => {
6877
- const compver = new SemVer(comparator.semver.version);
6878
- switch (comparator.operator) {
6879
- case ">":
6880
- if (compver.prerelease.length === 0) {
6881
- compver.patch++;
6882
- } else {
6883
- compver.prerelease.push(0);
6884
- }
6885
- compver.raw = compver.format();
6886
- case "":
6887
- case ">=":
6888
- if (!setMin || gt(compver, setMin)) {
6889
- setMin = compver;
6890
- }
6891
- break;
6892
- case "<":
6893
- case "<=":
6894
- break;
6895
- default:
6896
- throw new Error(`Unexpected operation: ${comparator.operator}`);
6897
- }
6898
- });
6899
- if (setMin && (!minver || gt(minver, setMin))) {
6900
- minver = setMin;
6901
- }
6902
- }
6903
- if (minver && range.test(minver)) {
6904
- return minver;
6905
- }
6906
- return null;
6907
- };
6908
- module.exports = minVersion;
6909
- }
6910
- });
6911
-
6912
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/valid.js
6913
- var require_valid2 = __commonJS({
6914
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/valid.js"(exports, module) {
6915
- var Range = require_range();
6916
- var validRange = (range, options) => {
6917
- try {
6918
- return new Range(range, options).range || "*";
6919
- } catch (er) {
6920
- return null;
6921
- }
6922
- };
6923
- module.exports = validRange;
6924
- }
6925
- });
6926
-
6927
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/outside.js
6928
- var require_outside = __commonJS({
6929
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/outside.js"(exports, module) {
6930
- var SemVer = require_semver();
6931
- var Comparator = require_comparator();
6932
- var { ANY } = Comparator;
6933
- var Range = require_range();
6934
- var satisfies = require_satisfies();
6935
- var gt = require_gt();
6936
- var lt = require_lt();
6937
- var lte = require_lte();
6938
- var gte = require_gte();
6939
- var outside = (version, range, hilo, options) => {
6940
- version = new SemVer(version, options);
6941
- range = new Range(range, options);
6942
- let gtfn, ltefn, ltfn, comp, ecomp;
6943
- switch (hilo) {
6944
- case ">":
6945
- gtfn = gt;
6946
- ltefn = lte;
6947
- ltfn = lt;
6948
- comp = ">";
6949
- ecomp = ">=";
6950
- break;
6951
- case "<":
6952
- gtfn = lt;
6953
- ltefn = gte;
6954
- ltfn = gt;
6955
- comp = "<";
6956
- ecomp = "<=";
6957
- break;
6958
- default:
6959
- throw new TypeError('Must provide a hilo val of "<" or ">"');
6960
- }
6961
- if (satisfies(version, range, options)) {
6962
- return false;
6963
- }
6964
- for (let i = 0; i < range.set.length; ++i) {
6965
- const comparators = range.set[i];
6966
- let high = null;
6967
- let low = null;
6968
- comparators.forEach((comparator) => {
6969
- if (comparator.semver === ANY) {
6970
- comparator = new Comparator(">=0.0.0");
6971
- }
6972
- high = high || comparator;
6973
- low = low || comparator;
6974
- if (gtfn(comparator.semver, high.semver, options)) {
6975
- high = comparator;
6976
- } else if (ltfn(comparator.semver, low.semver, options)) {
6977
- low = comparator;
6978
- }
6979
- });
6980
- if (high.operator === comp || high.operator === ecomp) {
6981
- return false;
6982
- }
6983
- if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
6984
- return false;
6985
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
6986
- return false;
6987
- }
6988
- }
6989
- return true;
6990
- };
6991
- module.exports = outside;
6992
- }
6993
- });
6994
-
6995
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/gtr.js
6996
- var require_gtr = __commonJS({
6997
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/gtr.js"(exports, module) {
6998
- var outside = require_outside();
6999
- var gtr = (version, range, options) => outside(version, range, ">", options);
7000
- module.exports = gtr;
7001
- }
7002
- });
7003
-
7004
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/ltr.js
7005
- var require_ltr = __commonJS({
7006
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/ltr.js"(exports, module) {
7007
- var outside = require_outside();
7008
- var ltr = (version, range, options) => outside(version, range, "<", options);
7009
- module.exports = ltr;
7010
- }
7011
- });
7012
-
7013
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/intersects.js
7014
- var require_intersects = __commonJS({
7015
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/intersects.js"(exports, module) {
7016
- var Range = require_range();
7017
- var intersects = (r1, r2, options) => {
7018
- r1 = new Range(r1, options);
7019
- r2 = new Range(r2, options);
7020
- return r1.intersects(r2, options);
7021
- };
7022
- module.exports = intersects;
7023
- }
7024
- });
7025
-
7026
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/simplify.js
7027
- var require_simplify = __commonJS({
7028
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/simplify.js"(exports, module) {
7029
- var satisfies = require_satisfies();
7030
- var compare = require_compare();
7031
- module.exports = (versions, range, options) => {
7032
- const set = [];
7033
- let first = null;
7034
- let prev = null;
7035
- const v = versions.sort((a, b) => compare(a, b, options));
7036
- for (const version of v) {
7037
- const included = satisfies(version, range, options);
7038
- if (included) {
7039
- prev = version;
7040
- if (!first) {
7041
- first = version;
7042
- }
7043
- } else {
7044
- if (prev) {
7045
- set.push([first, prev]);
7046
- }
7047
- prev = null;
7048
- first = null;
7049
- }
7050
- }
7051
- if (first) {
7052
- set.push([first, null]);
7053
- }
7054
- const ranges = [];
7055
- for (const [min, max] of set) {
7056
- if (min === max) {
7057
- ranges.push(min);
7058
- } else if (!max && min === v[0]) {
7059
- ranges.push("*");
7060
- } else if (!max) {
7061
- ranges.push(`>=${min}`);
7062
- } else if (min === v[0]) {
7063
- ranges.push(`<=${max}`);
7064
- } else {
7065
- ranges.push(`${min} - ${max}`);
7066
- }
7067
- }
7068
- const simplified = ranges.join(" || ");
7069
- const original = typeof range.raw === "string" ? range.raw : String(range);
7070
- return simplified.length < original.length ? simplified : range;
7071
- };
7072
- }
7073
- });
7074
-
7075
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/subset.js
7076
- var require_subset = __commonJS({
7077
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/subset.js"(exports, module) {
7078
- var Range = require_range();
7079
- var Comparator = require_comparator();
7080
- var { ANY } = Comparator;
7081
- var satisfies = require_satisfies();
7082
- var compare = require_compare();
7083
- var subset = (sub, dom, options = {}) => {
7084
- if (sub === dom) {
7085
- return true;
7086
- }
7087
- sub = new Range(sub, options);
7088
- dom = new Range(dom, options);
7089
- let sawNonNull = false;
7090
- OUTER:
7091
- for (const simpleSub of sub.set) {
7092
- for (const simpleDom of dom.set) {
7093
- const isSub = simpleSubset(simpleSub, simpleDom, options);
7094
- sawNonNull = sawNonNull || isSub !== null;
7095
- if (isSub) {
7096
- continue OUTER;
7097
- }
7098
- }
7099
- if (sawNonNull) {
7100
- return false;
7101
- }
7102
- }
7103
- return true;
7104
- };
7105
- var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
7106
- var minimumVersion = [new Comparator(">=0.0.0")];
7107
- var simpleSubset = (sub, dom, options) => {
7108
- if (sub === dom) {
7109
- return true;
7110
- }
7111
- if (sub.length === 1 && sub[0].semver === ANY) {
7112
- if (dom.length === 1 && dom[0].semver === ANY) {
7113
- return true;
7114
- } else if (options.includePrerelease) {
7115
- sub = minimumVersionWithPreRelease;
7116
- } else {
7117
- sub = minimumVersion;
7118
- }
7119
- }
7120
- if (dom.length === 1 && dom[0].semver === ANY) {
7121
- if (options.includePrerelease) {
7122
- return true;
7123
- } else {
7124
- dom = minimumVersion;
7125
- }
7126
- }
7127
- const eqSet = /* @__PURE__ */ new Set();
7128
- let gt, lt;
7129
- for (const c of sub) {
7130
- if (c.operator === ">" || c.operator === ">=") {
7131
- gt = higherGT(gt, c, options);
7132
- } else if (c.operator === "<" || c.operator === "<=") {
7133
- lt = lowerLT(lt, c, options);
7134
- } else {
7135
- eqSet.add(c.semver);
7136
- }
7137
- }
7138
- if (eqSet.size > 1) {
7139
- return null;
7140
- }
7141
- let gtltComp;
7142
- if (gt && lt) {
7143
- gtltComp = compare(gt.semver, lt.semver, options);
7144
- if (gtltComp > 0) {
7145
- return null;
7146
- } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
7147
- return null;
7148
- }
7149
- }
7150
- for (const eq of eqSet) {
7151
- if (gt && !satisfies(eq, String(gt), options)) {
7152
- return null;
7153
- }
7154
- if (lt && !satisfies(eq, String(lt), options)) {
7155
- return null;
7156
- }
7157
- for (const c of dom) {
7158
- if (!satisfies(eq, String(c), options)) {
7159
- return false;
7160
- }
7161
- }
7162
- return true;
7163
- }
7164
- let higher, lower;
7165
- let hasDomLT, hasDomGT;
7166
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
7167
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
7168
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
7169
- needDomLTPre = false;
7170
- }
7171
- for (const c of dom) {
7172
- hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
7173
- hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
7174
- if (gt) {
7175
- if (needDomGTPre) {
7176
- if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
7177
- needDomGTPre = false;
7178
- }
7179
- }
7180
- if (c.operator === ">" || c.operator === ">=") {
7181
- higher = higherGT(gt, c, options);
7182
- if (higher === c && higher !== gt) {
7183
- return false;
7184
- }
7185
- } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
7186
- return false;
7187
- }
7188
- }
7189
- if (lt) {
7190
- if (needDomLTPre) {
7191
- if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
7192
- needDomLTPre = false;
7193
- }
7194
- }
7195
- if (c.operator === "<" || c.operator === "<=") {
7196
- lower = lowerLT(lt, c, options);
7197
- if (lower === c && lower !== lt) {
7198
- return false;
7199
- }
7200
- } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
7201
- return false;
7202
- }
7203
- }
7204
- if (!c.operator && (lt || gt) && gtltComp !== 0) {
7205
- return false;
7206
- }
7207
- }
7208
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
7209
- return false;
7210
- }
7211
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
7212
- return false;
7213
- }
7214
- if (needDomGTPre || needDomLTPre) {
7215
- return false;
7216
- }
7217
- return true;
7218
- };
7219
- var higherGT = (a, b, options) => {
7220
- if (!a) {
7221
- return b;
7222
- }
7223
- const comp = compare(a.semver, b.semver, options);
7224
- return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
7225
- };
7226
- var lowerLT = (a, b, options) => {
7227
- if (!a) {
7228
- return b;
7229
- }
7230
- const comp = compare(a.semver, b.semver, options);
7231
- return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
7232
- };
7233
- module.exports = subset;
7234
- }
7235
- });
7236
-
7237
- // node_modules/.pnpm/semver@7.6.0/node_modules/semver/index.js
7238
- var require_semver2 = __commonJS({
7239
- "node_modules/.pnpm/semver@7.6.0/node_modules/semver/index.js"(exports, module) {
7240
- var internalRe = require_re();
7241
- var constants = require_constants();
7242
- var SemVer = require_semver();
7243
- var identifiers = require_identifiers();
7244
- var parse = require_parse();
7245
- var valid = require_valid();
7246
- var clean = require_clean();
7247
- var inc = require_inc();
7248
- var diff = require_diff();
7249
- var major = require_major();
7250
- var minor = require_minor();
7251
- var patch = require_patch();
7252
- var prerelease = require_prerelease();
7253
- var compare = require_compare();
7254
- var rcompare = require_rcompare();
7255
- var compareLoose = require_compare_loose();
7256
- var compareBuild = require_compare_build();
7257
- var sort = require_sort();
7258
- var rsort = require_rsort();
7259
- var gt = require_gt();
7260
- var lt = require_lt();
7261
- var eq = require_eq();
7262
- var neq = require_neq();
7263
- var gte = require_gte();
7264
- var lte = require_lte();
7265
- var cmp = require_cmp();
7266
- var coerce = require_coerce();
7267
- var Comparator = require_comparator();
7268
- var Range = require_range();
7269
- var satisfies = require_satisfies();
7270
- var toComparators = require_to_comparators();
7271
- var maxSatisfying = require_max_satisfying();
7272
- var minSatisfying = require_min_satisfying();
7273
- var minVersion = require_min_version();
7274
- var validRange = require_valid2();
7275
- var outside = require_outside();
7276
- var gtr = require_gtr();
7277
- var ltr = require_ltr();
7278
- var intersects = require_intersects();
7279
- var simplifyRange = require_simplify();
7280
- var subset = require_subset();
7281
- module.exports = {
7282
- parse,
7283
- valid,
7284
- clean,
7285
- inc,
7286
- diff,
7287
- major,
7288
- minor,
7289
- patch,
7290
- prerelease,
7291
- compare,
7292
- rcompare,
7293
- compareLoose,
7294
- compareBuild,
7295
- sort,
7296
- rsort,
7297
- gt,
7298
- lt,
7299
- eq,
7300
- neq,
7301
- gte,
7302
- lte,
7303
- cmp,
7304
- coerce,
7305
- Comparator,
7306
- Range,
7307
- satisfies,
7308
- toComparators,
7309
- maxSatisfying,
7310
- minSatisfying,
7311
- minVersion,
7312
- validRange,
7313
- outside,
7314
- gtr,
7315
- ltr,
7316
- intersects,
7317
- simplifyRange,
7318
- subset,
7319
- SemVer,
7320
- re: internalRe.re,
7321
- src: internalRe.src,
7322
- tokens: internalRe.t,
7323
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
7324
- RELEASE_TYPES: constants.RELEASE_TYPES,
7325
- compareIdentifiers: identifiers.compareIdentifiers,
7326
- rcompareIdentifiers: identifiers.rcompareIdentifiers
7327
- };
7328
- }
7329
- });
7330
-
7331
- // src/serializer/index.ts
7332
- import * as glob from "glob";
7333
- var init_serializer = __esm({
7334
- "src/serializer/index.ts"() {
7335
- "use strict";
7336
- init_views();
7337
- }
7338
- });
7339
-
7340
- // src/cli/validations/outputs.ts
7341
- var init_outputs = __esm({
7342
- "src/cli/validations/outputs.ts"() {
7343
- "use strict";
7344
- }
7345
- });
7346
-
7347
- // src/serializer/sqliteSerializer.ts
7348
- import { getTableName, is, SQL } from "drizzle-orm";
7349
- import {
7350
- getTableConfig,
7351
- SQLiteBaseInteger,
7352
- SQLiteSyncDialect,
7353
- uniqueKeyName
7354
- } from "drizzle-orm/sqlite-core";
7355
- function mapSqlToSqliteType(sqlType) {
7356
- const lowered = sqlType.toLowerCase();
7357
- if ([
7358
- "int",
7359
- "integer",
7360
- "integer auto_increment",
7361
- "tinyint",
7362
- "smallint",
7363
- "mediumint",
7364
- "bigint",
7365
- "unsigned big int",
7366
- "int2",
7367
- "int8"
7368
- ].some((it) => lowered.startsWith(it))) {
7369
- return "integer";
7370
- } else if ([
7371
- "character",
7372
- "varchar",
7373
- "varying character",
7374
- "national varying character",
7375
- "nchar",
7376
- "native character",
7377
- "nvarchar",
7378
- "text",
7379
- "clob"
7380
- ].some((it) => lowered.startsWith(it))) {
7381
- const match2 = lowered.match(/\d+/);
7382
- if (match2) {
7383
- return `text(${match2[0]})`;
7384
- }
7385
- return "text";
7386
- } else if (lowered.startsWith("blob")) {
7387
- return "blob";
7388
- } else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
7389
- return "real";
7390
- } else {
7391
- return "numeric";
7392
- }
7393
- }
7394
- var dialect3, fromDatabase;
7395
- var init_sqliteSerializer = __esm({
7396
- "src/serializer/sqliteSerializer.ts"() {
7397
- "use strict";
7398
- init_serializer();
7399
- init_outputs();
7400
- dialect3 = new SQLiteSyncDialect();
7401
- fromDatabase = async (db, tablesFilter = (table4) => true, progressCallback) => {
7402
- const result = {};
7403
- const columns = await db.query(
7404
- `SELECT
7405
- m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
7406
- FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
7407
- WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table';
7408
- `
7409
- );
7410
- const tablesWithSeq = [];
7411
- const seq = await db.query(
7412
- `SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock' and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
7413
- );
7414
- for (const s of seq) {
7415
- tablesWithSeq.push(s.name);
7416
- }
7417
- let columnsCount = 0;
7418
- let tablesCount = /* @__PURE__ */ new Set();
7419
- let indexesCount = 0;
7420
- let foreignKeysCount = 0;
7421
- const tableToPk = {};
7422
- for (const column4 of columns) {
7423
- if (!tablesFilter(column4.tableName))
7424
- continue;
7425
- columnsCount += 1;
7426
- if (progressCallback) {
7427
- progressCallback("columns", columnsCount, "fetching");
7428
- }
7429
- const tableName = column4.tableName;
7430
- tablesCount.add(tableName);
7431
- if (progressCallback) {
7432
- progressCallback("tables", tablesCount.size, "fetching");
7433
- }
7434
- const columnName = column4.columnName;
7435
- const isNotNull = column4.notNull === 1;
7436
- const columnType = column4.columnType;
7437
- const isPrimary = column4.pk !== 0;
7438
- const columnDefault = column4.defaultValue;
7439
- const isAutoincrement = isPrimary && tablesWithSeq.includes(tableName);
7440
- if (isPrimary) {
7441
- if (typeof tableToPk[tableName] === "undefined") {
7442
- tableToPk[tableName] = [columnName];
7443
- } else {
7444
- tableToPk[tableName].push(columnName);
7445
- }
7446
- }
7447
- const table4 = result[tableName];
7448
- const newColumn = {
7449
- default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : ["CURRENT_TIME", "CURRENT_DATE", "CURRENT_TIMESTAMP"].includes(
7450
- columnDefault
7451
- ) ? `(${columnDefault})` : columnDefault === "false" ? false : columnDefault === "true" ? true : columnDefault.startsWith("'") && columnDefault.endsWith("'") ? columnDefault : (
7452
- // ? columnDefault.substring(1, columnDefault.length - 1)
7453
- `(${columnDefault})`
7454
- ),
7455
- autoincrement: isAutoincrement,
7456
- name: columnName,
7457
- type: mapSqlToSqliteType(columnType),
7458
- primaryKey: false,
7459
- notNull: isNotNull
7460
- };
7461
- if (!table4) {
7462
- result[tableName] = {
7463
- name: tableName,
7464
- columns: {
7465
- [columnName]: newColumn
7466
- },
7467
- compositePrimaryKeys: {},
7468
- indexes: {},
7469
- foreignKeys: {},
7470
- uniqueConstraints: {}
7471
- };
7472
- } else {
7473
- result[tableName].columns[columnName] = newColumn;
4915
+ result[tableName].columns[columnName] = newColumn;
7474
4916
  }
7475
4917
  }
7476
4918
  for (const [key, value] of Object.entries(tableToPk)) {
@@ -7819,6 +5261,7 @@ var init_pgSerializer = __esm({
7819
5261
  "src/serializer/pgSerializer.ts"() {
7820
5262
  "use strict";
7821
5263
  init_serializer();
5264
+ init_source();
7822
5265
  init_outputs();
7823
5266
  dialect4 = new PgDialect();
7824
5267
  trimChar = (str, char) => {
@@ -8423,10 +5866,6 @@ var sqliteSchemaToDrizzle = (schema3) => {
8423
5866
  return tables;
8424
5867
  };
8425
5868
 
8426
- // src/cli/utils.ts
8427
- init_views();
8428
- var import_semver = __toESM(require_semver2());
8429
-
8430
5869
  // src/cli/commands/sqliteIntrospect.ts
8431
5870
  init_views();
8432
5871
  init_global();
@@ -8537,10 +5976,10 @@ Array.prototype.random = function() {
8537
5976
  return this[~~(Math.random() * this.length)];
8538
5977
  };
8539
5978
 
8540
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js
5979
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/index.js
8541
5980
  var import_brace_expansion = __toESM(require_brace_expansion(), 1);
8542
5981
 
8543
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/brace-expressions.js
5982
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/brace-expressions.js
8544
5983
  var posixClasses = {
8545
5984
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
8546
5985
  "[:alpha:]": ["\\p{L}\\p{Nl}", true],
@@ -8650,17 +6089,17 @@ var parseClass = (glob2, position) => {
8650
6089
  return [comb, uflag, endPos - pos, true];
8651
6090
  };
8652
6091
 
8653
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/escape.js
6092
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/escape.js
8654
6093
  var escape = (s, { windowsPathsNoEscape = false } = {}) => {
8655
6094
  return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
8656
6095
  };
8657
6096
 
8658
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/unescape.js
6097
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/unescape.js
8659
6098
  var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
8660
6099
  return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
8661
6100
  };
8662
6101
 
8663
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js
6102
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/index.js
8664
6103
  var minimatch = (p, pattern, options = {}) => {
8665
6104
  assertValidPattern(pattern);
8666
6105
  if (!options.nocomment && pattern.charAt(0) === "#") {