@critical-path/svelte 0.10.2 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { CriticalPathClient as e } from "@critical-path/client";
2
2
  import * as t from "svelte/internal/client";
3
+ import { resolveStatusDefinition as n } from "@critical-path/core";
3
4
  //#region src/project-state.svelte.ts
4
- var n = class {
5
+ var r = class {
5
6
  client;
6
7
  #e = t.state(t.proxy([]));
7
8
  get data() {
@@ -55,12 +56,12 @@ var n = class {
55
56
  }
56
57
  }
57
58
  };
58
- function r(e) {
59
- return new n(e);
59
+ function i(e) {
60
+ return new r(e);
60
61
  }
61
62
  //#endregion
62
63
  //#region src/task-state.svelte.ts
63
- var i = class {
64
+ var a = class {
64
65
  client;
65
66
  projectId;
66
67
  #e = t.state(t.proxy([]));
@@ -181,12 +182,12 @@ var i = class {
181
182
  }
182
183
  }
183
184
  };
184
- function a(e, t) {
185
- return new i(e, t);
185
+ function o(e, t) {
186
+ return new a(e, t);
186
187
  }
187
188
  //#endregion
188
189
  //#region src/workflow-state.svelte.ts
189
- var o = class {
190
+ var s = class {
190
191
  client;
191
192
  #e = t.state(t.proxy([]));
192
193
  get data() {
@@ -249,12 +250,12 @@ var o = class {
249
250
  }
250
251
  }
251
252
  };
252
- function s(e) {
253
- return new o(e);
253
+ function c(e) {
254
+ return new s(e);
254
255
  }
255
256
  //#endregion
256
257
  //#region src/comment-state.svelte.ts
257
- var c = class {
258
+ var ee = class {
258
259
  client;
259
260
  taskId;
260
261
  #e = t.state(t.proxy([]));
@@ -372,12 +373,12 @@ var c = class {
372
373
  }
373
374
  }
374
375
  };
375
- function l(e, t) {
376
- return new c(e, t);
376
+ function te(e, t) {
377
+ return new ee(e, t);
377
378
  }
378
379
  //#endregion
379
380
  //#region src/attachment-state.svelte.ts
380
- var u = class {
381
+ var ne = class {
381
382
  client;
382
383
  filter;
383
384
  #e = t.state(t.proxy([]));
@@ -435,12 +436,12 @@ var u = class {
435
436
  }
436
437
  }
437
438
  };
438
- function d(e, t) {
439
- return new u(e, t);
439
+ function re(e, t) {
440
+ return new ne(e, t);
440
441
  }
441
442
  //#endregion
442
443
  //#region src/activity-state.svelte.ts
443
- var f = class {
444
+ var ie = class {
444
445
  client;
445
446
  taskId;
446
447
  #e = t.state(t.proxy([]));
@@ -597,12 +598,12 @@ var f = class {
597
598
  }
598
599
  }
599
600
  };
600
- function p(e, t) {
601
- return new f(e, t);
601
+ function ae(e, t) {
602
+ return new ie(e, t);
602
603
  }
603
604
  //#endregion
604
605
  //#region src/deliverable-state.svelte.ts
605
- var m = class {
606
+ var oe = class {
606
607
  client;
607
608
  projectId;
608
609
  #e = t.state(t.proxy([]));
@@ -680,13 +681,3447 @@ var m = class {
680
681
  return this.client.getDeliverableSummary(e);
681
682
  }
682
683
  };
683
- function h(e, t) {
684
- return new m(e, t);
684
+ function se(e, t) {
685
+ return new oe(e, t);
686
+ }
687
+ //#endregion
688
+ //#region src/deliverable-summary-state.svelte.ts
689
+ var ce = class {
690
+ client;
691
+ deliverableId;
692
+ #e = t.state(null);
693
+ get summary() {
694
+ return t.get(this.#e);
695
+ }
696
+ set summary(e) {
697
+ t.set(this.#e, e, !0);
698
+ }
699
+ #t = t.state(!1);
700
+ get loading() {
701
+ return t.get(this.#t);
702
+ }
703
+ set loading(e) {
704
+ t.set(this.#t, e, !0);
705
+ }
706
+ #n = t.state(null);
707
+ get error() {
708
+ return t.get(this.#n);
709
+ }
710
+ set error(e) {
711
+ t.set(this.#n, e, !0);
712
+ }
713
+ get data() {
714
+ return this.summary;
715
+ }
716
+ constructor(e, t) {
717
+ this.client = e, this.deliverableId = t;
718
+ }
719
+ async fetch(e) {
720
+ let t = e || this.deliverableId;
721
+ if (!t) {
722
+ this.summary = null, this.loading = !1;
723
+ return;
724
+ }
725
+ this.deliverableId = t, this.loading = !0, this.error = null;
726
+ try {
727
+ this.summary = await this.client.getDeliverableSummary(t);
728
+ } catch (e) {
729
+ this.error = e instanceof Error ? e : Error(String(e));
730
+ } finally {
731
+ this.loading = !1;
732
+ }
733
+ }
734
+ };
735
+ function le(e, t) {
736
+ return new ce(e, t);
737
+ }
738
+ //#endregion
739
+ //#region src/kanban-state.svelte.ts
740
+ var ue = class {
741
+ projectId;
742
+ options;
743
+ taskState;
744
+ get data() {
745
+ return this.taskState.data;
746
+ }
747
+ get tasks() {
748
+ return this.taskState.data;
749
+ }
750
+ get loading() {
751
+ return this.taskState.loading;
752
+ }
753
+ get error() {
754
+ return this.taskState.error;
755
+ }
756
+ #e = t.derived(() => {
757
+ let e = this.taskState.data;
758
+ if (this.options?.groupBy === "semantic") {
759
+ let t = {
760
+ not_started: [],
761
+ in_progress: [],
762
+ completed: [],
763
+ canceled: []
764
+ };
765
+ for (let r of e) {
766
+ let e = r.semanticStatus || n(r.status, this.options?.customDefinitions).category;
767
+ t[e] ? t[e].push(r) : t.not_started.push(r);
768
+ }
769
+ return t;
770
+ }
771
+ let t = {};
772
+ if (this.options?.customDefinitions && this.options.customDefinitions.length > 0) for (let e of this.options.customDefinitions) t[e.key] = [];
773
+ else t.backlog = [], t.todo = [], t.in_progress = [], t.in_review = [], t.done = [], t.canceled = [];
774
+ for (let n of e) t[n.status] || (t[n.status] = []), t[n.status].push(n);
775
+ return t;
776
+ });
777
+ get columns() {
778
+ return t.get(this.#e);
779
+ }
780
+ set columns(e) {
781
+ t.set(this.#e, e);
782
+ }
783
+ constructor(e, t, n = {}) {
784
+ this.projectId = t, this.options = n, this.taskState = new a(e, t);
785
+ }
786
+ async fetch() {
787
+ return this.taskState.fetch();
788
+ }
789
+ async createTask(e) {
790
+ return this.taskState.createTask(e);
791
+ }
792
+ async moveTask(e, t) {
793
+ return this.taskState.updateTaskStatus(e, t);
794
+ }
795
+ async updateTaskStatus(e, t) {
796
+ return this.taskState.updateTaskStatus(e, t);
797
+ }
798
+ async deleteTask(e) {
799
+ return this.taskState.deleteTask(e);
800
+ }
801
+ };
802
+ function de(e, t, n) {
803
+ return new ue(e, t, n);
804
+ }
805
+ //#endregion
806
+ //#region src/task-transitions-state.svelte.ts
807
+ var fe = class {
808
+ client;
809
+ taskId;
810
+ #e = t.state(t.proxy([]));
811
+ get allowedTransitions() {
812
+ return t.get(this.#e);
813
+ }
814
+ set allowedTransitions(e) {
815
+ t.set(this.#e, e, !0);
816
+ }
817
+ #t = t.state(!1);
818
+ get loading() {
819
+ return t.get(this.#t);
820
+ }
821
+ set loading(e) {
822
+ t.set(this.#t, e, !0);
823
+ }
824
+ #n = t.state(null);
825
+ get error() {
826
+ return t.get(this.#n);
827
+ }
828
+ set error(e) {
829
+ t.set(this.#n, e, !0);
830
+ }
831
+ constructor(e, t) {
832
+ this.client = e, this.taskId = t;
833
+ }
834
+ async fetch(e) {
835
+ let t = e || this.taskId;
836
+ if (!t) {
837
+ this.allowedTransitions = [], this.loading = !1;
838
+ return;
839
+ }
840
+ this.taskId = t, this.loading = !0, this.error = null;
841
+ try {
842
+ this.allowedTransitions = await this.client.getAllowedTaskTransitions(t);
843
+ } catch (e) {
844
+ this.error = e instanceof Error ? e : Error(String(e));
845
+ } finally {
846
+ this.loading = !1;
847
+ }
848
+ }
849
+ };
850
+ function pe(e, t) {
851
+ return new fe(e, t);
852
+ }
853
+ //#endregion
854
+ //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
855
+ var l;
856
+ (function(e) {
857
+ e.assertEqual = (e) => {};
858
+ function t(e) {}
859
+ e.assertIs = t;
860
+ function n(e) {
861
+ throw Error();
862
+ }
863
+ e.assertNever = n, e.arrayToEnum = (e) => {
864
+ let t = {};
865
+ for (let n of e) t[n] = n;
866
+ return t;
867
+ }, e.getValidEnumValues = (t) => {
868
+ let n = e.objectKeys(t).filter((e) => typeof t[t[e]] != "number"), r = {};
869
+ for (let e of n) r[e] = t[e];
870
+ return e.objectValues(r);
871
+ }, e.objectValues = (t) => e.objectKeys(t).map(function(e) {
872
+ return t[e];
873
+ }), e.objectKeys = typeof Object.keys == "function" ? (e) => Object.keys(e) : (e) => {
874
+ let t = [];
875
+ for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
876
+ return t;
877
+ }, e.find = (e, t) => {
878
+ for (let n of e) if (t(n)) return n;
879
+ }, e.isInteger = typeof Number.isInteger == "function" ? (e) => Number.isInteger(e) : (e) => typeof e == "number" && Number.isFinite(e) && Math.floor(e) === e;
880
+ function r(e, t = " | ") {
881
+ return e.map((e) => typeof e == "string" ? `'${e}'` : e).join(t);
882
+ }
883
+ e.joinValues = r, e.jsonStringifyReplacer = (e, t) => typeof t == "bigint" ? t.toString() : t;
884
+ })(l ||= {});
885
+ var me;
886
+ (function(e) {
887
+ e.mergeShapes = (e, t) => ({
888
+ ...e,
889
+ ...t
890
+ });
891
+ })(me ||= {});
892
+ var u = l.arrayToEnum([
893
+ "string",
894
+ "nan",
895
+ "number",
896
+ "integer",
897
+ "float",
898
+ "boolean",
899
+ "date",
900
+ "bigint",
901
+ "symbol",
902
+ "function",
903
+ "undefined",
904
+ "null",
905
+ "array",
906
+ "object",
907
+ "unknown",
908
+ "promise",
909
+ "void",
910
+ "never",
911
+ "map",
912
+ "set"
913
+ ]), d = (e) => {
914
+ switch (typeof e) {
915
+ case "undefined": return u.undefined;
916
+ case "string": return u.string;
917
+ case "number": return Number.isNaN(e) ? u.nan : u.number;
918
+ case "boolean": return u.boolean;
919
+ case "function": return u.function;
920
+ case "bigint": return u.bigint;
921
+ case "symbol": return u.symbol;
922
+ case "object": return Array.isArray(e) ? u.array : e === null ? u.null : e.then && typeof e.then == "function" && e.catch && typeof e.catch == "function" ? u.promise : typeof Map < "u" && e instanceof Map ? u.map : typeof Set < "u" && e instanceof Set ? u.set : typeof Date < "u" && e instanceof Date ? u.date : u.object;
923
+ default: return u.unknown;
924
+ }
925
+ }, f = l.arrayToEnum([
926
+ "invalid_type",
927
+ "invalid_literal",
928
+ "custom",
929
+ "invalid_union",
930
+ "invalid_union_discriminator",
931
+ "invalid_enum_value",
932
+ "unrecognized_keys",
933
+ "invalid_arguments",
934
+ "invalid_return_type",
935
+ "invalid_date",
936
+ "invalid_string",
937
+ "too_small",
938
+ "too_big",
939
+ "invalid_intersection_types",
940
+ "not_multiple_of",
941
+ "not_finite"
942
+ ]), p = class e extends Error {
943
+ get errors() {
944
+ return this.issues;
945
+ }
946
+ constructor(e) {
947
+ super(), this.issues = [], this.addIssue = (e) => {
948
+ this.issues = [...this.issues, e];
949
+ }, this.addIssues = (e = []) => {
950
+ this.issues = [...this.issues, ...e];
951
+ };
952
+ let t = new.target.prototype;
953
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
954
+ }
955
+ format(e) {
956
+ let t = e || function(e) {
957
+ return e.message;
958
+ }, n = { _errors: [] }, r = (e) => {
959
+ for (let i of e.issues) if (i.code === "invalid_union") i.unionErrors.map(r);
960
+ else if (i.code === "invalid_return_type") r(i.returnTypeError);
961
+ else if (i.code === "invalid_arguments") r(i.argumentsError);
962
+ else if (i.path.length === 0) n._errors.push(t(i));
963
+ else {
964
+ let e = n, r = 0;
965
+ for (; r < i.path.length;) {
966
+ let n = i.path[r];
967
+ r === i.path.length - 1 ? (e[n] = e[n] || { _errors: [] }, e[n]._errors.push(t(i))) : e[n] = e[n] || { _errors: [] }, e = e[n], r++;
968
+ }
969
+ }
970
+ };
971
+ return r(this), n;
972
+ }
973
+ static assert(t) {
974
+ if (!(t instanceof e)) throw Error(`Not a ZodError: ${t}`);
975
+ }
976
+ toString() {
977
+ return this.message;
978
+ }
979
+ get message() {
980
+ return JSON.stringify(this.issues, l.jsonStringifyReplacer, 2);
981
+ }
982
+ get isEmpty() {
983
+ return this.issues.length === 0;
984
+ }
985
+ flatten(e = (e) => e.message) {
986
+ let t = {}, n = [];
987
+ for (let r of this.issues) if (r.path.length > 0) {
988
+ let n = r.path[0];
989
+ t[n] = t[n] || [], t[n].push(e(r));
990
+ } else n.push(e(r));
991
+ return {
992
+ formErrors: n,
993
+ fieldErrors: t
994
+ };
995
+ }
996
+ get formErrors() {
997
+ return this.flatten();
998
+ }
999
+ };
1000
+ p.create = (e) => new p(e);
1001
+ //#endregion
1002
+ //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
1003
+ var m = (e, t) => {
1004
+ let n;
1005
+ switch (e.code) {
1006
+ case f.invalid_type:
1007
+ n = e.received === u.undefined ? "Required" : `Expected ${e.expected}, received ${e.received}`;
1008
+ break;
1009
+ case f.invalid_literal:
1010
+ n = `Invalid literal value, expected ${JSON.stringify(e.expected, l.jsonStringifyReplacer)}`;
1011
+ break;
1012
+ case f.unrecognized_keys:
1013
+ n = `Unrecognized key(s) in object: ${l.joinValues(e.keys, ", ")}`;
1014
+ break;
1015
+ case f.invalid_union:
1016
+ n = "Invalid input";
1017
+ break;
1018
+ case f.invalid_union_discriminator:
1019
+ n = `Invalid discriminator value. Expected ${l.joinValues(e.options)}`;
1020
+ break;
1021
+ case f.invalid_enum_value:
1022
+ n = `Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;
1023
+ break;
1024
+ case f.invalid_arguments:
1025
+ n = "Invalid function arguments";
1026
+ break;
1027
+ case f.invalid_return_type:
1028
+ n = "Invalid function return type";
1029
+ break;
1030
+ case f.invalid_date:
1031
+ n = "Invalid date";
1032
+ break;
1033
+ case f.invalid_string:
1034
+ typeof e.validation == "object" ? "includes" in e.validation ? (n = `Invalid input: must include "${e.validation.includes}"`, typeof e.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${e.validation.position}`)) : "startsWith" in e.validation ? n = `Invalid input: must start with "${e.validation.startsWith}"` : "endsWith" in e.validation ? n = `Invalid input: must end with "${e.validation.endsWith}"` : l.assertNever(e.validation) : n = e.validation === "regex" ? "Invalid" : `Invalid ${e.validation}`;
1035
+ break;
1036
+ case f.too_small:
1037
+ n = e.type === "array" ? `Array must contain ${e.exact ? "exactly" : e.inclusive ? "at least" : "more than"} ${e.minimum} element(s)` : e.type === "string" ? `String must contain ${e.exact ? "exactly" : e.inclusive ? "at least" : "over"} ${e.minimum} character(s)` : e.type === "number" || e.type === "bigint" ? `Number must be ${e.exact ? "exactly equal to " : e.inclusive ? "greater than or equal to " : "greater than "}${e.minimum}` : e.type === "date" ? `Date must be ${e.exact ? "exactly equal to " : e.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(e.minimum))}` : "Invalid input";
1038
+ break;
1039
+ case f.too_big:
1040
+ n = e.type === "array" ? `Array must contain ${e.exact ? "exactly" : e.inclusive ? "at most" : "less than"} ${e.maximum} element(s)` : e.type === "string" ? `String must contain ${e.exact ? "exactly" : e.inclusive ? "at most" : "under"} ${e.maximum} character(s)` : e.type === "number" ? `Number must be ${e.exact ? "exactly" : e.inclusive ? "less than or equal to" : "less than"} ${e.maximum}` : e.type === "bigint" ? `BigInt must be ${e.exact ? "exactly" : e.inclusive ? "less than or equal to" : "less than"} ${e.maximum}` : e.type === "date" ? `Date must be ${e.exact ? "exactly" : e.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(e.maximum))}` : "Invalid input";
1041
+ break;
1042
+ case f.custom:
1043
+ n = "Invalid input";
1044
+ break;
1045
+ case f.invalid_intersection_types:
1046
+ n = "Intersection results could not be merged";
1047
+ break;
1048
+ case f.not_multiple_of:
1049
+ n = `Number must be a multiple of ${e.multipleOf}`;
1050
+ break;
1051
+ case f.not_finite:
1052
+ n = "Number must be finite";
1053
+ break;
1054
+ default: n = t.defaultError, l.assertNever(e);
1055
+ }
1056
+ return { message: n };
1057
+ }, he = m;
1058
+ function ge() {
1059
+ return he;
1060
+ }
1061
+ //#endregion
1062
+ //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
1063
+ var h = (e) => {
1064
+ let { data: t, path: n, errorMaps: r, issueData: i } = e, a = [...n, ...i.path || []], o = {
1065
+ ...i,
1066
+ path: a
1067
+ };
1068
+ if (i.message !== void 0) return {
1069
+ ...i,
1070
+ path: a,
1071
+ message: i.message
1072
+ };
1073
+ let s = "", c = r.filter((e) => !!e).slice().reverse();
1074
+ for (let e of c) s = e(o, {
1075
+ data: t,
1076
+ defaultError: s
1077
+ }).message;
1078
+ return {
1079
+ ...i,
1080
+ path: a,
1081
+ message: s
1082
+ };
1083
+ };
1084
+ function g(e, t) {
1085
+ let n = ge(), r = h({
1086
+ issueData: t,
1087
+ data: e.data,
1088
+ path: e.path,
1089
+ errorMaps: [
1090
+ e.common.contextualErrorMap,
1091
+ e.schemaErrorMap,
1092
+ n,
1093
+ n === m ? void 0 : m
1094
+ ].filter((e) => !!e)
1095
+ });
1096
+ e.common.issues.push(r);
1097
+ }
1098
+ var _ = class e {
1099
+ constructor() {
1100
+ this.value = "valid";
1101
+ }
1102
+ dirty() {
1103
+ this.value === "valid" && (this.value = "dirty");
1104
+ }
1105
+ abort() {
1106
+ this.value !== "aborted" && (this.value = "aborted");
1107
+ }
1108
+ static mergeArray(e, t) {
1109
+ let n = [];
1110
+ for (let r of t) {
1111
+ if (r.status === "aborted") return v;
1112
+ r.status === "dirty" && e.dirty(), n.push(r.value);
1113
+ }
1114
+ return {
1115
+ status: e.value,
1116
+ value: n
1117
+ };
1118
+ }
1119
+ static async mergeObjectAsync(t, n) {
1120
+ let r = [];
1121
+ for (let e of n) {
1122
+ let t = await e.key, n = await e.value;
1123
+ r.push({
1124
+ key: t,
1125
+ value: n
1126
+ });
1127
+ }
1128
+ return e.mergeObjectSync(t, r);
1129
+ }
1130
+ static mergeObjectSync(e, t) {
1131
+ let n = {};
1132
+ for (let r of t) {
1133
+ let { key: t, value: i } = r;
1134
+ if (t.status === "aborted" || i.status === "aborted") return v;
1135
+ t.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), t.value !== "__proto__" && (i.value !== void 0 || r.alwaysSet) && (n[t.value] = i.value);
1136
+ }
1137
+ return {
1138
+ status: e.value,
1139
+ value: n
1140
+ };
1141
+ }
1142
+ }, v = Object.freeze({ status: "aborted" }), _e = (e) => ({
1143
+ status: "dirty",
1144
+ value: e
1145
+ }), y = (e) => ({
1146
+ status: "valid",
1147
+ value: e
1148
+ }), ve = (e) => e.status === "aborted", ye = (e) => e.status === "dirty", b = (e) => e.status === "valid", x = (e) => typeof Promise < "u" && e instanceof Promise, S;
1149
+ (function(e) {
1150
+ e.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, e.toString = (e) => typeof e == "string" ? e : e?.message;
1151
+ })(S ||= {});
1152
+ //#endregion
1153
+ //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
1154
+ var C = class {
1155
+ constructor(e, t, n, r) {
1156
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = r;
1157
+ }
1158
+ get path() {
1159
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
1160
+ }
1161
+ }, be = (e, t) => {
1162
+ if (b(t)) return {
1163
+ success: !0,
1164
+ data: t.value
1165
+ };
1166
+ if (!e.common.issues.length) throw Error("Validation failed but no issues detected.");
1167
+ return {
1168
+ success: !1,
1169
+ get error() {
1170
+ if (this._error) return this._error;
1171
+ let t = new p(e.common.issues);
1172
+ return this._error = t, this._error;
1173
+ }
1174
+ };
1175
+ };
1176
+ function w(e) {
1177
+ if (!e) return {};
1178
+ let { errorMap: t, invalid_type_error: n, required_error: r, description: i } = e;
1179
+ if (t && (n || r)) throw Error("Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.");
1180
+ return t ? {
1181
+ errorMap: t,
1182
+ description: i
1183
+ } : {
1184
+ errorMap: (t, i) => {
1185
+ let { message: a } = e;
1186
+ return t.code === "invalid_enum_value" ? { message: a ?? i.defaultError } : i.data === void 0 ? { message: a ?? r ?? i.defaultError } : t.code === "invalid_type" ? { message: a ?? n ?? i.defaultError } : { message: i.defaultError };
1187
+ },
1188
+ description: i
1189
+ };
1190
+ }
1191
+ var T = class {
1192
+ get description() {
1193
+ return this._def.description;
1194
+ }
1195
+ _getType(e) {
1196
+ return d(e.data);
1197
+ }
1198
+ _getOrReturnCtx(e, t) {
1199
+ return t || {
1200
+ common: e.parent.common,
1201
+ data: e.data,
1202
+ parsedType: d(e.data),
1203
+ schemaErrorMap: this._def.errorMap,
1204
+ path: e.path,
1205
+ parent: e.parent
1206
+ };
1207
+ }
1208
+ _processInputParams(e) {
1209
+ return {
1210
+ status: new _(),
1211
+ ctx: {
1212
+ common: e.parent.common,
1213
+ data: e.data,
1214
+ parsedType: d(e.data),
1215
+ schemaErrorMap: this._def.errorMap,
1216
+ path: e.path,
1217
+ parent: e.parent
1218
+ }
1219
+ };
1220
+ }
1221
+ _parseSync(e) {
1222
+ let t = this._parse(e);
1223
+ if (x(t)) throw Error("Synchronous parse encountered promise.");
1224
+ return t;
1225
+ }
1226
+ _parseAsync(e) {
1227
+ let t = this._parse(e);
1228
+ return Promise.resolve(t);
1229
+ }
1230
+ parse(e, t) {
1231
+ let n = this.safeParse(e, t);
1232
+ if (n.success) return n.data;
1233
+ throw n.error;
1234
+ }
1235
+ safeParse(e, t) {
1236
+ let n = {
1237
+ common: {
1238
+ issues: [],
1239
+ async: t?.async ?? !1,
1240
+ contextualErrorMap: t?.errorMap
1241
+ },
1242
+ path: t?.path || [],
1243
+ schemaErrorMap: this._def.errorMap,
1244
+ parent: null,
1245
+ data: e,
1246
+ parsedType: d(e)
1247
+ };
1248
+ return be(n, this._parseSync({
1249
+ data: e,
1250
+ path: n.path,
1251
+ parent: n
1252
+ }));
1253
+ }
1254
+ "~validate"(e) {
1255
+ let t = {
1256
+ common: {
1257
+ issues: [],
1258
+ async: !!this["~standard"].async
1259
+ },
1260
+ path: [],
1261
+ schemaErrorMap: this._def.errorMap,
1262
+ parent: null,
1263
+ data: e,
1264
+ parsedType: d(e)
1265
+ };
1266
+ if (!this["~standard"].async) try {
1267
+ let n = this._parseSync({
1268
+ data: e,
1269
+ path: [],
1270
+ parent: t
1271
+ });
1272
+ return b(n) ? { value: n.value } : { issues: t.common.issues };
1273
+ } catch (e) {
1274
+ e?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
1275
+ issues: [],
1276
+ async: !0
1277
+ };
1278
+ }
1279
+ return this._parseAsync({
1280
+ data: e,
1281
+ path: [],
1282
+ parent: t
1283
+ }).then((e) => b(e) ? { value: e.value } : { issues: t.common.issues });
1284
+ }
1285
+ async parseAsync(e, t) {
1286
+ let n = await this.safeParseAsync(e, t);
1287
+ if (n.success) return n.data;
1288
+ throw n.error;
1289
+ }
1290
+ async safeParseAsync(e, t) {
1291
+ let n = {
1292
+ common: {
1293
+ issues: [],
1294
+ contextualErrorMap: t?.errorMap,
1295
+ async: !0
1296
+ },
1297
+ path: t?.path || [],
1298
+ schemaErrorMap: this._def.errorMap,
1299
+ parent: null,
1300
+ data: e,
1301
+ parsedType: d(e)
1302
+ }, r = this._parse({
1303
+ data: e,
1304
+ path: n.path,
1305
+ parent: n
1306
+ });
1307
+ return be(n, await (x(r) ? r : Promise.resolve(r)));
1308
+ }
1309
+ refine(e, t) {
1310
+ let n = (e) => typeof t == "string" || t === void 0 ? { message: t } : typeof t == "function" ? t(e) : t;
1311
+ return this._refinement((t, r) => {
1312
+ let i = e(t), a = () => r.addIssue({
1313
+ code: f.custom,
1314
+ ...n(t)
1315
+ });
1316
+ return typeof Promise < "u" && i instanceof Promise ? i.then((e) => e ? !0 : (a(), !1)) : i ? !0 : (a(), !1);
1317
+ });
1318
+ }
1319
+ refinement(e, t) {
1320
+ return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof t == "function" ? t(n, r) : t), !1));
1321
+ }
1322
+ _refinement(e) {
1323
+ return new G({
1324
+ schema: this,
1325
+ typeName: Z.ZodEffects,
1326
+ effect: {
1327
+ type: "refinement",
1328
+ refinement: e
1329
+ }
1330
+ });
1331
+ }
1332
+ superRefine(e) {
1333
+ return this._refinement(e);
1334
+ }
1335
+ constructor(e) {
1336
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
1337
+ version: 1,
1338
+ vendor: "zod",
1339
+ validate: (e) => this["~validate"](e)
1340
+ };
1341
+ }
1342
+ optional() {
1343
+ return K.create(this, this._def);
1344
+ }
1345
+ nullable() {
1346
+ return q.create(this, this._def);
1347
+ }
1348
+ nullish() {
1349
+ return this.nullable().optional();
1350
+ }
1351
+ array() {
1352
+ return N.create(this);
1353
+ }
1354
+ promise() {
1355
+ return W.create(this, this._def);
1356
+ }
1357
+ or(e) {
1358
+ return I.create([this, e], this._def);
1359
+ }
1360
+ and(e) {
1361
+ return R.create(this, e, this._def);
1362
+ }
1363
+ transform(e) {
1364
+ return new G({
1365
+ ...w(this._def),
1366
+ schema: this,
1367
+ typeName: Z.ZodEffects,
1368
+ effect: {
1369
+ type: "transform",
1370
+ transform: e
1371
+ }
1372
+ });
1373
+ }
1374
+ default(e) {
1375
+ let t = typeof e == "function" ? e : () => e;
1376
+ return new J({
1377
+ ...w(this._def),
1378
+ innerType: this,
1379
+ defaultValue: t,
1380
+ typeName: Z.ZodDefault
1381
+ });
1382
+ }
1383
+ brand() {
1384
+ return new at({
1385
+ typeName: Z.ZodBranded,
1386
+ type: this,
1387
+ ...w(this._def)
1388
+ });
1389
+ }
1390
+ catch(e) {
1391
+ let t = typeof e == "function" ? e : () => e;
1392
+ return new Y({
1393
+ ...w(this._def),
1394
+ innerType: this,
1395
+ catchValue: t,
1396
+ typeName: Z.ZodCatch
1397
+ });
1398
+ }
1399
+ describe(e) {
1400
+ let t = this.constructor;
1401
+ return new t({
1402
+ ...this._def,
1403
+ description: e
1404
+ });
1405
+ }
1406
+ pipe(e) {
1407
+ return ot.create(this, e);
1408
+ }
1409
+ readonly() {
1410
+ return X.create(this);
1411
+ }
1412
+ isOptional() {
1413
+ return this.safeParse(void 0).success;
1414
+ }
1415
+ isNullable() {
1416
+ return this.safeParse(null).success;
1417
+ }
1418
+ }, xe = /^c[^\s-]{8,}$/i, Se = /^[0-9a-z]+$/, Ce = /^[0-9A-HJKMNP-TV-Z]{26}$/i, we = /^[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, Te = /^[a-z0-9_-]{21}$/i, Ee = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, De = /^[-+]?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)?)??$/, Oe = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ke = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", Ae, je = /^(?:(?: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])$/, Me = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, Ne = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pe = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Fe = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ie = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Le = "((\\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])))", Re = RegExp(`^${Le}$`);
1419
+ function ze(e) {
1420
+ let t = "[0-5]\\d";
1421
+ e.precision ? t = `${t}\\.\\d{${e.precision}}` : e.precision ?? (t = `${t}(\\.\\d+)?`);
1422
+ let n = e.precision ? "+" : "?";
1423
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`;
1424
+ }
1425
+ function Be(e) {
1426
+ return RegExp(`^${ze(e)}$`);
1427
+ }
1428
+ function Ve(e) {
1429
+ let t = `${Le}T${ze(e)}`, n = [];
1430
+ return n.push(e.local ? "Z?" : "Z"), e.offset && n.push("([+-]\\d{2}:?\\d{2})"), t = `${t}(${n.join("|")})`, RegExp(`^${t}$`);
1431
+ }
1432
+ function He(e, t) {
1433
+ return !!((t === "v4" || !t) && je.test(e) || (t === "v6" || !t) && Ne.test(e));
1434
+ }
1435
+ function Ue(e, t) {
1436
+ if (!Ee.test(e)) return !1;
1437
+ try {
1438
+ let [n] = e.split(".");
1439
+ if (!n) return !1;
1440
+ let r = n.replace(/-/g, "+").replace(/_/g, "/").padEnd(n.length + (4 - n.length % 4) % 4, "="), i = JSON.parse(atob(r));
1441
+ return !(typeof i != "object" || !i || "typ" in i && i?.typ !== "JWT" || !i.alg || t && i.alg !== t);
1442
+ } catch {
1443
+ return !1;
1444
+ }
1445
+ }
1446
+ function We(e, t) {
1447
+ return !!((t === "v4" || !t) && Me.test(e) || (t === "v6" || !t) && Pe.test(e));
1448
+ }
1449
+ var E = class e extends T {
1450
+ _parse(e) {
1451
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
1452
+ let t = this._getOrReturnCtx(e);
1453
+ return g(t, {
1454
+ code: f.invalid_type,
1455
+ expected: u.string,
1456
+ received: t.parsedType
1457
+ }), v;
1458
+ }
1459
+ let t = new _(), n;
1460
+ for (let r of this._def.checks) if (r.kind === "min") e.data.length < r.value && (n = this._getOrReturnCtx(e, n), g(n, {
1461
+ code: f.too_small,
1462
+ minimum: r.value,
1463
+ type: "string",
1464
+ inclusive: !0,
1465
+ exact: !1,
1466
+ message: r.message
1467
+ }), t.dirty());
1468
+ else if (r.kind === "max") e.data.length > r.value && (n = this._getOrReturnCtx(e, n), g(n, {
1469
+ code: f.too_big,
1470
+ maximum: r.value,
1471
+ type: "string",
1472
+ inclusive: !0,
1473
+ exact: !1,
1474
+ message: r.message
1475
+ }), t.dirty());
1476
+ else if (r.kind === "length") {
1477
+ let i = e.data.length > r.value, a = e.data.length < r.value;
1478
+ (i || a) && (n = this._getOrReturnCtx(e, n), i ? g(n, {
1479
+ code: f.too_big,
1480
+ maximum: r.value,
1481
+ type: "string",
1482
+ inclusive: !0,
1483
+ exact: !0,
1484
+ message: r.message
1485
+ }) : a && g(n, {
1486
+ code: f.too_small,
1487
+ minimum: r.value,
1488
+ type: "string",
1489
+ inclusive: !0,
1490
+ exact: !0,
1491
+ message: r.message
1492
+ }), t.dirty());
1493
+ } else if (r.kind === "email") Oe.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1494
+ validation: "email",
1495
+ code: f.invalid_string,
1496
+ message: r.message
1497
+ }), t.dirty());
1498
+ else if (r.kind === "emoji") Ae ||= new RegExp(ke, "u"), Ae.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1499
+ validation: "emoji",
1500
+ code: f.invalid_string,
1501
+ message: r.message
1502
+ }), t.dirty());
1503
+ else if (r.kind === "uuid") we.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1504
+ validation: "uuid",
1505
+ code: f.invalid_string,
1506
+ message: r.message
1507
+ }), t.dirty());
1508
+ else if (r.kind === "nanoid") Te.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1509
+ validation: "nanoid",
1510
+ code: f.invalid_string,
1511
+ message: r.message
1512
+ }), t.dirty());
1513
+ else if (r.kind === "cuid") xe.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1514
+ validation: "cuid",
1515
+ code: f.invalid_string,
1516
+ message: r.message
1517
+ }), t.dirty());
1518
+ else if (r.kind === "cuid2") Se.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1519
+ validation: "cuid2",
1520
+ code: f.invalid_string,
1521
+ message: r.message
1522
+ }), t.dirty());
1523
+ else if (r.kind === "ulid") Ce.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1524
+ validation: "ulid",
1525
+ code: f.invalid_string,
1526
+ message: r.message
1527
+ }), t.dirty());
1528
+ else if (r.kind === "url") try {
1529
+ new URL(e.data);
1530
+ } catch {
1531
+ n = this._getOrReturnCtx(e, n), g(n, {
1532
+ validation: "url",
1533
+ code: f.invalid_string,
1534
+ message: r.message
1535
+ }), t.dirty();
1536
+ }
1537
+ else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1538
+ validation: "regex",
1539
+ code: f.invalid_string,
1540
+ message: r.message
1541
+ }), t.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (n = this._getOrReturnCtx(e, n), g(n, {
1542
+ code: f.invalid_string,
1543
+ validation: {
1544
+ includes: r.value,
1545
+ position: r.position
1546
+ },
1547
+ message: r.message
1548
+ }), t.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (n = this._getOrReturnCtx(e, n), g(n, {
1549
+ code: f.invalid_string,
1550
+ validation: { startsWith: r.value },
1551
+ message: r.message
1552
+ }), t.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (n = this._getOrReturnCtx(e, n), g(n, {
1553
+ code: f.invalid_string,
1554
+ validation: { endsWith: r.value },
1555
+ message: r.message
1556
+ }), t.dirty()) : r.kind === "datetime" ? Ve(r).test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1557
+ code: f.invalid_string,
1558
+ validation: "datetime",
1559
+ message: r.message
1560
+ }), t.dirty()) : r.kind === "date" ? Re.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1561
+ code: f.invalid_string,
1562
+ validation: "date",
1563
+ message: r.message
1564
+ }), t.dirty()) : r.kind === "time" ? Be(r).test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1565
+ code: f.invalid_string,
1566
+ validation: "time",
1567
+ message: r.message
1568
+ }), t.dirty()) : r.kind === "duration" ? De.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1569
+ validation: "duration",
1570
+ code: f.invalid_string,
1571
+ message: r.message
1572
+ }), t.dirty()) : r.kind === "ip" ? He(e.data, r.version) || (n = this._getOrReturnCtx(e, n), g(n, {
1573
+ validation: "ip",
1574
+ code: f.invalid_string,
1575
+ message: r.message
1576
+ }), t.dirty()) : r.kind === "jwt" ? Ue(e.data, r.alg) || (n = this._getOrReturnCtx(e, n), g(n, {
1577
+ validation: "jwt",
1578
+ code: f.invalid_string,
1579
+ message: r.message
1580
+ }), t.dirty()) : r.kind === "cidr" ? We(e.data, r.version) || (n = this._getOrReturnCtx(e, n), g(n, {
1581
+ validation: "cidr",
1582
+ code: f.invalid_string,
1583
+ message: r.message
1584
+ }), t.dirty()) : r.kind === "base64" ? Fe.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1585
+ validation: "base64",
1586
+ code: f.invalid_string,
1587
+ message: r.message
1588
+ }), t.dirty()) : r.kind === "base64url" ? Ie.test(e.data) || (n = this._getOrReturnCtx(e, n), g(n, {
1589
+ validation: "base64url",
1590
+ code: f.invalid_string,
1591
+ message: r.message
1592
+ }), t.dirty()) : l.assertNever(r);
1593
+ return {
1594
+ status: t.value,
1595
+ value: e.data
1596
+ };
1597
+ }
1598
+ _regex(e, t, n) {
1599
+ return this.refinement((t) => e.test(t), {
1600
+ validation: t,
1601
+ code: f.invalid_string,
1602
+ ...S.errToObj(n)
1603
+ });
1604
+ }
1605
+ _addCheck(t) {
1606
+ return new e({
1607
+ ...this._def,
1608
+ checks: [...this._def.checks, t]
1609
+ });
1610
+ }
1611
+ email(e) {
1612
+ return this._addCheck({
1613
+ kind: "email",
1614
+ ...S.errToObj(e)
1615
+ });
1616
+ }
1617
+ url(e) {
1618
+ return this._addCheck({
1619
+ kind: "url",
1620
+ ...S.errToObj(e)
1621
+ });
1622
+ }
1623
+ emoji(e) {
1624
+ return this._addCheck({
1625
+ kind: "emoji",
1626
+ ...S.errToObj(e)
1627
+ });
1628
+ }
1629
+ uuid(e) {
1630
+ return this._addCheck({
1631
+ kind: "uuid",
1632
+ ...S.errToObj(e)
1633
+ });
1634
+ }
1635
+ nanoid(e) {
1636
+ return this._addCheck({
1637
+ kind: "nanoid",
1638
+ ...S.errToObj(e)
1639
+ });
1640
+ }
1641
+ cuid(e) {
1642
+ return this._addCheck({
1643
+ kind: "cuid",
1644
+ ...S.errToObj(e)
1645
+ });
1646
+ }
1647
+ cuid2(e) {
1648
+ return this._addCheck({
1649
+ kind: "cuid2",
1650
+ ...S.errToObj(e)
1651
+ });
1652
+ }
1653
+ ulid(e) {
1654
+ return this._addCheck({
1655
+ kind: "ulid",
1656
+ ...S.errToObj(e)
1657
+ });
1658
+ }
1659
+ base64(e) {
1660
+ return this._addCheck({
1661
+ kind: "base64",
1662
+ ...S.errToObj(e)
1663
+ });
1664
+ }
1665
+ base64url(e) {
1666
+ return this._addCheck({
1667
+ kind: "base64url",
1668
+ ...S.errToObj(e)
1669
+ });
1670
+ }
1671
+ jwt(e) {
1672
+ return this._addCheck({
1673
+ kind: "jwt",
1674
+ ...S.errToObj(e)
1675
+ });
1676
+ }
1677
+ ip(e) {
1678
+ return this._addCheck({
1679
+ kind: "ip",
1680
+ ...S.errToObj(e)
1681
+ });
1682
+ }
1683
+ cidr(e) {
1684
+ return this._addCheck({
1685
+ kind: "cidr",
1686
+ ...S.errToObj(e)
1687
+ });
1688
+ }
1689
+ datetime(e) {
1690
+ return typeof e == "string" ? this._addCheck({
1691
+ kind: "datetime",
1692
+ precision: null,
1693
+ offset: !1,
1694
+ local: !1,
1695
+ message: e
1696
+ }) : this._addCheck({
1697
+ kind: "datetime",
1698
+ precision: e?.precision === void 0 ? null : e?.precision,
1699
+ offset: e?.offset ?? !1,
1700
+ local: e?.local ?? !1,
1701
+ ...S.errToObj(e?.message)
1702
+ });
1703
+ }
1704
+ date(e) {
1705
+ return this._addCheck({
1706
+ kind: "date",
1707
+ message: e
1708
+ });
1709
+ }
1710
+ time(e) {
1711
+ return typeof e == "string" ? this._addCheck({
1712
+ kind: "time",
1713
+ precision: null,
1714
+ message: e
1715
+ }) : this._addCheck({
1716
+ kind: "time",
1717
+ precision: e?.precision === void 0 ? null : e?.precision,
1718
+ ...S.errToObj(e?.message)
1719
+ });
1720
+ }
1721
+ duration(e) {
1722
+ return this._addCheck({
1723
+ kind: "duration",
1724
+ ...S.errToObj(e)
1725
+ });
1726
+ }
1727
+ regex(e, t) {
1728
+ return this._addCheck({
1729
+ kind: "regex",
1730
+ regex: e,
1731
+ ...S.errToObj(t)
1732
+ });
1733
+ }
1734
+ includes(e, t) {
1735
+ return this._addCheck({
1736
+ kind: "includes",
1737
+ value: e,
1738
+ position: t?.position,
1739
+ ...S.errToObj(t?.message)
1740
+ });
1741
+ }
1742
+ startsWith(e, t) {
1743
+ return this._addCheck({
1744
+ kind: "startsWith",
1745
+ value: e,
1746
+ ...S.errToObj(t)
1747
+ });
1748
+ }
1749
+ endsWith(e, t) {
1750
+ return this._addCheck({
1751
+ kind: "endsWith",
1752
+ value: e,
1753
+ ...S.errToObj(t)
1754
+ });
1755
+ }
1756
+ min(e, t) {
1757
+ return this._addCheck({
1758
+ kind: "min",
1759
+ value: e,
1760
+ ...S.errToObj(t)
1761
+ });
1762
+ }
1763
+ max(e, t) {
1764
+ return this._addCheck({
1765
+ kind: "max",
1766
+ value: e,
1767
+ ...S.errToObj(t)
1768
+ });
1769
+ }
1770
+ length(e, t) {
1771
+ return this._addCheck({
1772
+ kind: "length",
1773
+ value: e,
1774
+ ...S.errToObj(t)
1775
+ });
1776
+ }
1777
+ nonempty(e) {
1778
+ return this.min(1, S.errToObj(e));
1779
+ }
1780
+ trim() {
1781
+ return new e({
1782
+ ...this._def,
1783
+ checks: [...this._def.checks, { kind: "trim" }]
1784
+ });
1785
+ }
1786
+ toLowerCase() {
1787
+ return new e({
1788
+ ...this._def,
1789
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1790
+ });
1791
+ }
1792
+ toUpperCase() {
1793
+ return new e({
1794
+ ...this._def,
1795
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1796
+ });
1797
+ }
1798
+ get isDatetime() {
1799
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1800
+ }
1801
+ get isDate() {
1802
+ return !!this._def.checks.find((e) => e.kind === "date");
1803
+ }
1804
+ get isTime() {
1805
+ return !!this._def.checks.find((e) => e.kind === "time");
1806
+ }
1807
+ get isDuration() {
1808
+ return !!this._def.checks.find((e) => e.kind === "duration");
1809
+ }
1810
+ get isEmail() {
1811
+ return !!this._def.checks.find((e) => e.kind === "email");
1812
+ }
1813
+ get isURL() {
1814
+ return !!this._def.checks.find((e) => e.kind === "url");
1815
+ }
1816
+ get isEmoji() {
1817
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1818
+ }
1819
+ get isUUID() {
1820
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1821
+ }
1822
+ get isNANOID() {
1823
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1824
+ }
1825
+ get isCUID() {
1826
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1827
+ }
1828
+ get isCUID2() {
1829
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1830
+ }
1831
+ get isULID() {
1832
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1833
+ }
1834
+ get isIP() {
1835
+ return !!this._def.checks.find((e) => e.kind === "ip");
1836
+ }
1837
+ get isCIDR() {
1838
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1839
+ }
1840
+ get isBase64() {
1841
+ return !!this._def.checks.find((e) => e.kind === "base64");
1842
+ }
1843
+ get isBase64url() {
1844
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1845
+ }
1846
+ get minLength() {
1847
+ let e = null;
1848
+ for (let t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1849
+ return e;
1850
+ }
1851
+ get maxLength() {
1852
+ let e = null;
1853
+ for (let t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1854
+ return e;
1855
+ }
1856
+ };
1857
+ E.create = (e) => new E({
1858
+ checks: [],
1859
+ typeName: Z.ZodString,
1860
+ coerce: e?.coerce ?? !1,
1861
+ ...w(e)
1862
+ });
1863
+ function Ge(e, t) {
1864
+ let n = (e.toString().split(".")[1] || "").length, r = (t.toString().split(".")[1] || "").length, i = n > r ? n : r;
1865
+ return Number.parseInt(e.toFixed(i).replace(".", "")) % Number.parseInt(t.toFixed(i).replace(".", "")) / 10 ** i;
1866
+ }
1867
+ var D = class e extends T {
1868
+ constructor() {
1869
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1870
+ }
1871
+ _parse(e) {
1872
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== u.number) {
1873
+ let t = this._getOrReturnCtx(e);
1874
+ return g(t, {
1875
+ code: f.invalid_type,
1876
+ expected: u.number,
1877
+ received: t.parsedType
1878
+ }), v;
1879
+ }
1880
+ let t, n = new _();
1881
+ for (let r of this._def.checks) r.kind === "int" ? l.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), g(t, {
1882
+ code: f.invalid_type,
1883
+ expected: "integer",
1884
+ received: "float",
1885
+ message: r.message
1886
+ }), n.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (t = this._getOrReturnCtx(e, t), g(t, {
1887
+ code: f.too_small,
1888
+ minimum: r.value,
1889
+ type: "number",
1890
+ inclusive: r.inclusive,
1891
+ exact: !1,
1892
+ message: r.message
1893
+ }), n.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (t = this._getOrReturnCtx(e, t), g(t, {
1894
+ code: f.too_big,
1895
+ maximum: r.value,
1896
+ type: "number",
1897
+ inclusive: r.inclusive,
1898
+ exact: !1,
1899
+ message: r.message
1900
+ }), n.dirty()) : r.kind === "multipleOf" ? Ge(e.data, r.value) !== 0 && (t = this._getOrReturnCtx(e, t), g(t, {
1901
+ code: f.not_multiple_of,
1902
+ multipleOf: r.value,
1903
+ message: r.message
1904
+ }), n.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (t = this._getOrReturnCtx(e, t), g(t, {
1905
+ code: f.not_finite,
1906
+ message: r.message
1907
+ }), n.dirty()) : l.assertNever(r);
1908
+ return {
1909
+ status: n.value,
1910
+ value: e.data
1911
+ };
1912
+ }
1913
+ gte(e, t) {
1914
+ return this.setLimit("min", e, !0, S.toString(t));
1915
+ }
1916
+ gt(e, t) {
1917
+ return this.setLimit("min", e, !1, S.toString(t));
1918
+ }
1919
+ lte(e, t) {
1920
+ return this.setLimit("max", e, !0, S.toString(t));
1921
+ }
1922
+ lt(e, t) {
1923
+ return this.setLimit("max", e, !1, S.toString(t));
1924
+ }
1925
+ setLimit(t, n, r, i) {
1926
+ return new e({
1927
+ ...this._def,
1928
+ checks: [...this._def.checks, {
1929
+ kind: t,
1930
+ value: n,
1931
+ inclusive: r,
1932
+ message: S.toString(i)
1933
+ }]
1934
+ });
1935
+ }
1936
+ _addCheck(t) {
1937
+ return new e({
1938
+ ...this._def,
1939
+ checks: [...this._def.checks, t]
1940
+ });
1941
+ }
1942
+ int(e) {
1943
+ return this._addCheck({
1944
+ kind: "int",
1945
+ message: S.toString(e)
1946
+ });
1947
+ }
1948
+ positive(e) {
1949
+ return this._addCheck({
1950
+ kind: "min",
1951
+ value: 0,
1952
+ inclusive: !1,
1953
+ message: S.toString(e)
1954
+ });
1955
+ }
1956
+ negative(e) {
1957
+ return this._addCheck({
1958
+ kind: "max",
1959
+ value: 0,
1960
+ inclusive: !1,
1961
+ message: S.toString(e)
1962
+ });
1963
+ }
1964
+ nonpositive(e) {
1965
+ return this._addCheck({
1966
+ kind: "max",
1967
+ value: 0,
1968
+ inclusive: !0,
1969
+ message: S.toString(e)
1970
+ });
1971
+ }
1972
+ nonnegative(e) {
1973
+ return this._addCheck({
1974
+ kind: "min",
1975
+ value: 0,
1976
+ inclusive: !0,
1977
+ message: S.toString(e)
1978
+ });
1979
+ }
1980
+ multipleOf(e, t) {
1981
+ return this._addCheck({
1982
+ kind: "multipleOf",
1983
+ value: e,
1984
+ message: S.toString(t)
1985
+ });
1986
+ }
1987
+ finite(e) {
1988
+ return this._addCheck({
1989
+ kind: "finite",
1990
+ message: S.toString(e)
1991
+ });
1992
+ }
1993
+ safe(e) {
1994
+ return this._addCheck({
1995
+ kind: "min",
1996
+ inclusive: !0,
1997
+ value: -(2 ** 53 - 1),
1998
+ message: S.toString(e)
1999
+ })._addCheck({
2000
+ kind: "max",
2001
+ inclusive: !0,
2002
+ value: 2 ** 53 - 1,
2003
+ message: S.toString(e)
2004
+ });
2005
+ }
2006
+ get minValue() {
2007
+ let e = null;
2008
+ for (let t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2009
+ return e;
2010
+ }
2011
+ get maxValue() {
2012
+ let e = null;
2013
+ for (let t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2014
+ return e;
2015
+ }
2016
+ get isInt() {
2017
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && l.isInteger(e.value));
2018
+ }
2019
+ get isFinite() {
2020
+ let e = null, t = null;
2021
+ for (let n of this._def.checks) if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf") return !0;
2022
+ else n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
2023
+ return Number.isFinite(t) && Number.isFinite(e);
2024
+ }
2025
+ };
2026
+ D.create = (e) => new D({
2027
+ checks: [],
2028
+ typeName: Z.ZodNumber,
2029
+ coerce: e?.coerce || !1,
2030
+ ...w(e)
2031
+ });
2032
+ var O = class e extends T {
2033
+ constructor() {
2034
+ super(...arguments), this.min = this.gte, this.max = this.lte;
2035
+ }
2036
+ _parse(e) {
2037
+ if (this._def.coerce) try {
2038
+ e.data = BigInt(e.data);
2039
+ } catch {
2040
+ return this._getInvalidInput(e);
2041
+ }
2042
+ if (this._getType(e) !== u.bigint) return this._getInvalidInput(e);
2043
+ let t, n = new _();
2044
+ for (let r of this._def.checks) r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (t = this._getOrReturnCtx(e, t), g(t, {
2045
+ code: f.too_small,
2046
+ type: "bigint",
2047
+ minimum: r.value,
2048
+ inclusive: r.inclusive,
2049
+ message: r.message
2050
+ }), n.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (t = this._getOrReturnCtx(e, t), g(t, {
2051
+ code: f.too_big,
2052
+ type: "bigint",
2053
+ maximum: r.value,
2054
+ inclusive: r.inclusive,
2055
+ message: r.message
2056
+ }), n.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (t = this._getOrReturnCtx(e, t), g(t, {
2057
+ code: f.not_multiple_of,
2058
+ multipleOf: r.value,
2059
+ message: r.message
2060
+ }), n.dirty()) : l.assertNever(r);
2061
+ return {
2062
+ status: n.value,
2063
+ value: e.data
2064
+ };
2065
+ }
2066
+ _getInvalidInput(e) {
2067
+ let t = this._getOrReturnCtx(e);
2068
+ return g(t, {
2069
+ code: f.invalid_type,
2070
+ expected: u.bigint,
2071
+ received: t.parsedType
2072
+ }), v;
2073
+ }
2074
+ gte(e, t) {
2075
+ return this.setLimit("min", e, !0, S.toString(t));
2076
+ }
2077
+ gt(e, t) {
2078
+ return this.setLimit("min", e, !1, S.toString(t));
2079
+ }
2080
+ lte(e, t) {
2081
+ return this.setLimit("max", e, !0, S.toString(t));
2082
+ }
2083
+ lt(e, t) {
2084
+ return this.setLimit("max", e, !1, S.toString(t));
2085
+ }
2086
+ setLimit(t, n, r, i) {
2087
+ return new e({
2088
+ ...this._def,
2089
+ checks: [...this._def.checks, {
2090
+ kind: t,
2091
+ value: n,
2092
+ inclusive: r,
2093
+ message: S.toString(i)
2094
+ }]
2095
+ });
2096
+ }
2097
+ _addCheck(t) {
2098
+ return new e({
2099
+ ...this._def,
2100
+ checks: [...this._def.checks, t]
2101
+ });
2102
+ }
2103
+ positive(e) {
2104
+ return this._addCheck({
2105
+ kind: "min",
2106
+ value: BigInt(0),
2107
+ inclusive: !1,
2108
+ message: S.toString(e)
2109
+ });
2110
+ }
2111
+ negative(e) {
2112
+ return this._addCheck({
2113
+ kind: "max",
2114
+ value: BigInt(0),
2115
+ inclusive: !1,
2116
+ message: S.toString(e)
2117
+ });
2118
+ }
2119
+ nonpositive(e) {
2120
+ return this._addCheck({
2121
+ kind: "max",
2122
+ value: BigInt(0),
2123
+ inclusive: !0,
2124
+ message: S.toString(e)
2125
+ });
2126
+ }
2127
+ nonnegative(e) {
2128
+ return this._addCheck({
2129
+ kind: "min",
2130
+ value: BigInt(0),
2131
+ inclusive: !0,
2132
+ message: S.toString(e)
2133
+ });
2134
+ }
2135
+ multipleOf(e, t) {
2136
+ return this._addCheck({
2137
+ kind: "multipleOf",
2138
+ value: e,
2139
+ message: S.toString(t)
2140
+ });
2141
+ }
2142
+ get minValue() {
2143
+ let e = null;
2144
+ for (let t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2145
+ return e;
2146
+ }
2147
+ get maxValue() {
2148
+ let e = null;
2149
+ for (let t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2150
+ return e;
2151
+ }
2152
+ };
2153
+ O.create = (e) => new O({
2154
+ checks: [],
2155
+ typeName: Z.ZodBigInt,
2156
+ coerce: e?.coerce ?? !1,
2157
+ ...w(e)
2158
+ });
2159
+ var Ke = class extends T {
2160
+ _parse(e) {
2161
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
2162
+ let t = this._getOrReturnCtx(e);
2163
+ return g(t, {
2164
+ code: f.invalid_type,
2165
+ expected: u.boolean,
2166
+ received: t.parsedType
2167
+ }), v;
2168
+ }
2169
+ return y(e.data);
2170
+ }
2171
+ };
2172
+ Ke.create = (e) => new Ke({
2173
+ typeName: Z.ZodBoolean,
2174
+ coerce: e?.coerce || !1,
2175
+ ...w(e)
2176
+ });
2177
+ var qe = class e extends T {
2178
+ _parse(e) {
2179
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
2180
+ let t = this._getOrReturnCtx(e);
2181
+ return g(t, {
2182
+ code: f.invalid_type,
2183
+ expected: u.date,
2184
+ received: t.parsedType
2185
+ }), v;
2186
+ }
2187
+ if (Number.isNaN(e.data.getTime())) return g(this._getOrReturnCtx(e), { code: f.invalid_date }), v;
2188
+ let t = new _(), n;
2189
+ for (let r of this._def.checks) r.kind === "min" ? e.data.getTime() < r.value && (n = this._getOrReturnCtx(e, n), g(n, {
2190
+ code: f.too_small,
2191
+ message: r.message,
2192
+ inclusive: !0,
2193
+ exact: !1,
2194
+ minimum: r.value,
2195
+ type: "date"
2196
+ }), t.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (n = this._getOrReturnCtx(e, n), g(n, {
2197
+ code: f.too_big,
2198
+ message: r.message,
2199
+ inclusive: !0,
2200
+ exact: !1,
2201
+ maximum: r.value,
2202
+ type: "date"
2203
+ }), t.dirty()) : l.assertNever(r);
2204
+ return {
2205
+ status: t.value,
2206
+ value: new Date(e.data.getTime())
2207
+ };
2208
+ }
2209
+ _addCheck(t) {
2210
+ return new e({
2211
+ ...this._def,
2212
+ checks: [...this._def.checks, t]
2213
+ });
2214
+ }
2215
+ min(e, t) {
2216
+ return this._addCheck({
2217
+ kind: "min",
2218
+ value: e.getTime(),
2219
+ message: S.toString(t)
2220
+ });
2221
+ }
2222
+ max(e, t) {
2223
+ return this._addCheck({
2224
+ kind: "max",
2225
+ value: e.getTime(),
2226
+ message: S.toString(t)
2227
+ });
2228
+ }
2229
+ get minDate() {
2230
+ let e = null;
2231
+ for (let t of this._def.checks) t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2232
+ return e == null ? null : new Date(e);
2233
+ }
2234
+ get maxDate() {
2235
+ let e = null;
2236
+ for (let t of this._def.checks) t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2237
+ return e == null ? null : new Date(e);
2238
+ }
2239
+ };
2240
+ qe.create = (e) => new qe({
2241
+ checks: [],
2242
+ coerce: e?.coerce || !1,
2243
+ typeName: Z.ZodDate,
2244
+ ...w(e)
2245
+ });
2246
+ var Je = class extends T {
2247
+ _parse(e) {
2248
+ if (this._getType(e) !== u.symbol) {
2249
+ let t = this._getOrReturnCtx(e);
2250
+ return g(t, {
2251
+ code: f.invalid_type,
2252
+ expected: u.symbol,
2253
+ received: t.parsedType
2254
+ }), v;
2255
+ }
2256
+ return y(e.data);
2257
+ }
2258
+ };
2259
+ Je.create = (e) => new Je({
2260
+ typeName: Z.ZodSymbol,
2261
+ ...w(e)
2262
+ });
2263
+ var k = class extends T {
2264
+ _parse(e) {
2265
+ if (this._getType(e) !== u.undefined) {
2266
+ let t = this._getOrReturnCtx(e);
2267
+ return g(t, {
2268
+ code: f.invalid_type,
2269
+ expected: u.undefined,
2270
+ received: t.parsedType
2271
+ }), v;
2272
+ }
2273
+ return y(e.data);
2274
+ }
2275
+ };
2276
+ k.create = (e) => new k({
2277
+ typeName: Z.ZodUndefined,
2278
+ ...w(e)
2279
+ });
2280
+ var A = class extends T {
2281
+ _parse(e) {
2282
+ if (this._getType(e) !== u.null) {
2283
+ let t = this._getOrReturnCtx(e);
2284
+ return g(t, {
2285
+ code: f.invalid_type,
2286
+ expected: u.null,
2287
+ received: t.parsedType
2288
+ }), v;
2289
+ }
2290
+ return y(e.data);
2291
+ }
2292
+ };
2293
+ A.create = (e) => new A({
2294
+ typeName: Z.ZodNull,
2295
+ ...w(e)
2296
+ });
2297
+ var Ye = class extends T {
2298
+ constructor() {
2299
+ super(...arguments), this._any = !0;
2300
+ }
2301
+ _parse(e) {
2302
+ return y(e.data);
2303
+ }
2304
+ };
2305
+ Ye.create = (e) => new Ye({
2306
+ typeName: Z.ZodAny,
2307
+ ...w(e)
2308
+ });
2309
+ var j = class extends T {
2310
+ constructor() {
2311
+ super(...arguments), this._unknown = !0;
2312
+ }
2313
+ _parse(e) {
2314
+ return y(e.data);
2315
+ }
2316
+ };
2317
+ j.create = (e) => new j({
2318
+ typeName: Z.ZodUnknown,
2319
+ ...w(e)
2320
+ });
2321
+ var M = class extends T {
2322
+ _parse(e) {
2323
+ let t = this._getOrReturnCtx(e);
2324
+ return g(t, {
2325
+ code: f.invalid_type,
2326
+ expected: u.never,
2327
+ received: t.parsedType
2328
+ }), v;
2329
+ }
2330
+ };
2331
+ M.create = (e) => new M({
2332
+ typeName: Z.ZodNever,
2333
+ ...w(e)
2334
+ });
2335
+ var Xe = class extends T {
2336
+ _parse(e) {
2337
+ if (this._getType(e) !== u.undefined) {
2338
+ let t = this._getOrReturnCtx(e);
2339
+ return g(t, {
2340
+ code: f.invalid_type,
2341
+ expected: u.void,
2342
+ received: t.parsedType
2343
+ }), v;
2344
+ }
2345
+ return y(e.data);
2346
+ }
2347
+ };
2348
+ Xe.create = (e) => new Xe({
2349
+ typeName: Z.ZodVoid,
2350
+ ...w(e)
2351
+ });
2352
+ var N = class e extends T {
2353
+ _parse(e) {
2354
+ let { ctx: t, status: n } = this._processInputParams(e), r = this._def;
2355
+ if (t.parsedType !== u.array) return g(t, {
2356
+ code: f.invalid_type,
2357
+ expected: u.array,
2358
+ received: t.parsedType
2359
+ }), v;
2360
+ if (r.exactLength !== null) {
2361
+ let e = t.data.length > r.exactLength.value, i = t.data.length < r.exactLength.value;
2362
+ (e || i) && (g(t, {
2363
+ code: e ? f.too_big : f.too_small,
2364
+ minimum: i ? r.exactLength.value : void 0,
2365
+ maximum: e ? r.exactLength.value : void 0,
2366
+ type: "array",
2367
+ inclusive: !0,
2368
+ exact: !0,
2369
+ message: r.exactLength.message
2370
+ }), n.dirty());
2371
+ }
2372
+ if (r.minLength !== null && t.data.length < r.minLength.value && (g(t, {
2373
+ code: f.too_small,
2374
+ minimum: r.minLength.value,
2375
+ type: "array",
2376
+ inclusive: !0,
2377
+ exact: !1,
2378
+ message: r.minLength.message
2379
+ }), n.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (g(t, {
2380
+ code: f.too_big,
2381
+ maximum: r.maxLength.value,
2382
+ type: "array",
2383
+ inclusive: !0,
2384
+ exact: !1,
2385
+ message: r.maxLength.message
2386
+ }), n.dirty()), t.common.async) return Promise.all([...t.data].map((e, n) => r.type._parseAsync(new C(t, e, t.path, n)))).then((e) => _.mergeArray(n, e));
2387
+ let i = [...t.data].map((e, n) => r.type._parseSync(new C(t, e, t.path, n)));
2388
+ return _.mergeArray(n, i);
2389
+ }
2390
+ get element() {
2391
+ return this._def.type;
2392
+ }
2393
+ min(t, n) {
2394
+ return new e({
2395
+ ...this._def,
2396
+ minLength: {
2397
+ value: t,
2398
+ message: S.toString(n)
2399
+ }
2400
+ });
2401
+ }
2402
+ max(t, n) {
2403
+ return new e({
2404
+ ...this._def,
2405
+ maxLength: {
2406
+ value: t,
2407
+ message: S.toString(n)
2408
+ }
2409
+ });
2410
+ }
2411
+ length(t, n) {
2412
+ return new e({
2413
+ ...this._def,
2414
+ exactLength: {
2415
+ value: t,
2416
+ message: S.toString(n)
2417
+ }
2418
+ });
2419
+ }
2420
+ nonempty(e) {
2421
+ return this.min(1, e);
2422
+ }
2423
+ };
2424
+ N.create = (e, t) => new N({
2425
+ type: e,
2426
+ minLength: null,
2427
+ maxLength: null,
2428
+ exactLength: null,
2429
+ typeName: Z.ZodArray,
2430
+ ...w(t)
2431
+ });
2432
+ function P(e) {
2433
+ if (e instanceof F) {
2434
+ let t = {};
2435
+ for (let n in e.shape) {
2436
+ let r = e.shape[n];
2437
+ t[n] = K.create(P(r));
2438
+ }
2439
+ return new F({
2440
+ ...e._def,
2441
+ shape: () => t
2442
+ });
2443
+ }
2444
+ return e instanceof N ? new N({
2445
+ ...e._def,
2446
+ type: P(e.element)
2447
+ }) : e instanceof K ? K.create(P(e.unwrap())) : e instanceof q ? q.create(P(e.unwrap())) : e instanceof z ? z.create(e.items.map((e) => P(e))) : e;
2448
+ }
2449
+ var F = class e extends T {
2450
+ constructor() {
2451
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
2452
+ }
2453
+ _getCached() {
2454
+ if (this._cached !== null) return this._cached;
2455
+ let e = this._def.shape(), t = l.objectKeys(e);
2456
+ return this._cached = {
2457
+ shape: e,
2458
+ keys: t
2459
+ }, this._cached;
2460
+ }
2461
+ _parse(e) {
2462
+ if (this._getType(e) !== u.object) {
2463
+ let t = this._getOrReturnCtx(e);
2464
+ return g(t, {
2465
+ code: f.invalid_type,
2466
+ expected: u.object,
2467
+ received: t.parsedType
2468
+ }), v;
2469
+ }
2470
+ let { status: t, ctx: n } = this._processInputParams(e), { shape: r, keys: i } = this._getCached(), a = [];
2471
+ if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip")) for (let e in n.data) i.includes(e) || a.push(e);
2472
+ let o = [];
2473
+ for (let e of i) {
2474
+ let t = r[e], i = n.data[e];
2475
+ o.push({
2476
+ key: {
2477
+ status: "valid",
2478
+ value: e
2479
+ },
2480
+ value: t._parse(new C(n, i, n.path, e)),
2481
+ alwaysSet: e in n.data
2482
+ });
2483
+ }
2484
+ if (this._def.catchall instanceof M) {
2485
+ let e = this._def.unknownKeys;
2486
+ if (e === "passthrough") for (let e of a) o.push({
2487
+ key: {
2488
+ status: "valid",
2489
+ value: e
2490
+ },
2491
+ value: {
2492
+ status: "valid",
2493
+ value: n.data[e]
2494
+ }
2495
+ });
2496
+ else if (e === "strict") a.length > 0 && (g(n, {
2497
+ code: f.unrecognized_keys,
2498
+ keys: a
2499
+ }), t.dirty());
2500
+ else if (e !== "strip") throw Error("Internal ZodObject error: invalid unknownKeys value.");
2501
+ } else {
2502
+ let e = this._def.catchall;
2503
+ for (let t of a) {
2504
+ let r = n.data[t];
2505
+ o.push({
2506
+ key: {
2507
+ status: "valid",
2508
+ value: t
2509
+ },
2510
+ value: e._parse(new C(n, r, n.path, t)),
2511
+ alwaysSet: t in n.data
2512
+ });
2513
+ }
2514
+ }
2515
+ return n.common.async ? Promise.resolve().then(async () => {
2516
+ let e = [];
2517
+ for (let t of o) {
2518
+ let n = await t.key, r = await t.value;
2519
+ e.push({
2520
+ key: n,
2521
+ value: r,
2522
+ alwaysSet: t.alwaysSet
2523
+ });
2524
+ }
2525
+ return e;
2526
+ }).then((e) => _.mergeObjectSync(t, e)) : _.mergeObjectSync(t, o);
2527
+ }
2528
+ get shape() {
2529
+ return this._def.shape();
2530
+ }
2531
+ strict(t) {
2532
+ return S.errToObj, new e({
2533
+ ...this._def,
2534
+ unknownKeys: "strict",
2535
+ ...t === void 0 ? {} : { errorMap: (e, n) => {
2536
+ let r = this._def.errorMap?.(e, n).message ?? n.defaultError;
2537
+ return e.code === "unrecognized_keys" ? { message: S.errToObj(t).message ?? r } : { message: r };
2538
+ } }
2539
+ });
2540
+ }
2541
+ strip() {
2542
+ return new e({
2543
+ ...this._def,
2544
+ unknownKeys: "strip"
2545
+ });
2546
+ }
2547
+ passthrough() {
2548
+ return new e({
2549
+ ...this._def,
2550
+ unknownKeys: "passthrough"
2551
+ });
2552
+ }
2553
+ extend(t) {
2554
+ return new e({
2555
+ ...this._def,
2556
+ shape: () => ({
2557
+ ...this._def.shape(),
2558
+ ...t
2559
+ })
2560
+ });
2561
+ }
2562
+ merge(t) {
2563
+ return new e({
2564
+ unknownKeys: t._def.unknownKeys,
2565
+ catchall: t._def.catchall,
2566
+ shape: () => ({
2567
+ ...this._def.shape(),
2568
+ ...t._def.shape()
2569
+ }),
2570
+ typeName: Z.ZodObject
2571
+ });
2572
+ }
2573
+ setKey(e, t) {
2574
+ return this.augment({ [e]: t });
2575
+ }
2576
+ catchall(t) {
2577
+ return new e({
2578
+ ...this._def,
2579
+ catchall: t
2580
+ });
2581
+ }
2582
+ pick(t) {
2583
+ let n = {};
2584
+ for (let e of l.objectKeys(t)) t[e] && this.shape[e] && (n[e] = this.shape[e]);
2585
+ return new e({
2586
+ ...this._def,
2587
+ shape: () => n
2588
+ });
2589
+ }
2590
+ omit(t) {
2591
+ let n = {};
2592
+ for (let e of l.objectKeys(this.shape)) t[e] || (n[e] = this.shape[e]);
2593
+ return new e({
2594
+ ...this._def,
2595
+ shape: () => n
2596
+ });
2597
+ }
2598
+ deepPartial() {
2599
+ return P(this);
2600
+ }
2601
+ partial(t) {
2602
+ let n = {};
2603
+ for (let e of l.objectKeys(this.shape)) {
2604
+ let r = this.shape[e];
2605
+ n[e] = t && !t[e] ? r : r.optional();
2606
+ }
2607
+ return new e({
2608
+ ...this._def,
2609
+ shape: () => n
2610
+ });
2611
+ }
2612
+ required(t) {
2613
+ let n = {};
2614
+ for (let e of l.objectKeys(this.shape)) if (t && !t[e]) n[e] = this.shape[e];
2615
+ else {
2616
+ let t = this.shape[e];
2617
+ for (; t instanceof K;) t = t._def.innerType;
2618
+ n[e] = t;
2619
+ }
2620
+ return new e({
2621
+ ...this._def,
2622
+ shape: () => n
2623
+ });
2624
+ }
2625
+ keyof() {
2626
+ return rt(l.objectKeys(this.shape));
2627
+ }
2628
+ };
2629
+ F.create = (e, t) => new F({
2630
+ shape: () => e,
2631
+ unknownKeys: "strip",
2632
+ catchall: M.create(),
2633
+ typeName: Z.ZodObject,
2634
+ ...w(t)
2635
+ }), F.strictCreate = (e, t) => new F({
2636
+ shape: () => e,
2637
+ unknownKeys: "strict",
2638
+ catchall: M.create(),
2639
+ typeName: Z.ZodObject,
2640
+ ...w(t)
2641
+ }), F.lazycreate = (e, t) => new F({
2642
+ shape: e,
2643
+ unknownKeys: "strip",
2644
+ catchall: M.create(),
2645
+ typeName: Z.ZodObject,
2646
+ ...w(t)
2647
+ });
2648
+ var I = class extends T {
2649
+ _parse(e) {
2650
+ let { ctx: t } = this._processInputParams(e), n = this._def.options;
2651
+ function r(e) {
2652
+ for (let t of e) if (t.result.status === "valid") return t.result;
2653
+ for (let n of e) if (n.result.status === "dirty") return t.common.issues.push(...n.ctx.common.issues), n.result;
2654
+ let n = e.map((e) => new p(e.ctx.common.issues));
2655
+ return g(t, {
2656
+ code: f.invalid_union,
2657
+ unionErrors: n
2658
+ }), v;
2659
+ }
2660
+ if (t.common.async) return Promise.all(n.map(async (e) => {
2661
+ let n = {
2662
+ ...t,
2663
+ common: {
2664
+ ...t.common,
2665
+ issues: []
2666
+ },
2667
+ parent: null
2668
+ };
2669
+ return {
2670
+ result: await e._parseAsync({
2671
+ data: t.data,
2672
+ path: t.path,
2673
+ parent: n
2674
+ }),
2675
+ ctx: n
2676
+ };
2677
+ })).then(r);
2678
+ {
2679
+ let e, r = [];
2680
+ for (let i of n) {
2681
+ let n = {
2682
+ ...t,
2683
+ common: {
2684
+ ...t.common,
2685
+ issues: []
2686
+ },
2687
+ parent: null
2688
+ }, a = i._parseSync({
2689
+ data: t.data,
2690
+ path: t.path,
2691
+ parent: n
2692
+ });
2693
+ if (a.status === "valid") return a;
2694
+ a.status === "dirty" && !e && (e = {
2695
+ result: a,
2696
+ ctx: n
2697
+ }), n.common.issues.length && r.push(n.common.issues);
2698
+ }
2699
+ if (e) return t.common.issues.push(...e.ctx.common.issues), e.result;
2700
+ let i = r.map((e) => new p(e));
2701
+ return g(t, {
2702
+ code: f.invalid_union,
2703
+ unionErrors: i
2704
+ }), v;
2705
+ }
2706
+ }
2707
+ get options() {
2708
+ return this._def.options;
2709
+ }
2710
+ };
2711
+ I.create = (e, t) => new I({
2712
+ options: e,
2713
+ typeName: Z.ZodUnion,
2714
+ ...w(t)
2715
+ });
2716
+ var L = (e) => e instanceof B ? L(e.schema) : e instanceof G ? L(e.innerType()) : e instanceof V ? [e.value] : e instanceof H ? e.options : e instanceof U ? l.objectValues(e.enum) : e instanceof J ? L(e._def.innerType) : e instanceof k ? [void 0] : e instanceof A ? [null] : e instanceof K ? [void 0, ...L(e.unwrap())] : e instanceof q ? [null, ...L(e.unwrap())] : e instanceof at || e instanceof X ? L(e.unwrap()) : e instanceof Y ? L(e._def.innerType) : [], Ze = class e extends T {
2717
+ _parse(e) {
2718
+ let { ctx: t } = this._processInputParams(e);
2719
+ if (t.parsedType !== u.object) return g(t, {
2720
+ code: f.invalid_type,
2721
+ expected: u.object,
2722
+ received: t.parsedType
2723
+ }), v;
2724
+ let n = this.discriminator, r = t.data[n], i = this.optionsMap.get(r);
2725
+ return i ? t.common.async ? i._parseAsync({
2726
+ data: t.data,
2727
+ path: t.path,
2728
+ parent: t
2729
+ }) : i._parseSync({
2730
+ data: t.data,
2731
+ path: t.path,
2732
+ parent: t
2733
+ }) : (g(t, {
2734
+ code: f.invalid_union_discriminator,
2735
+ options: Array.from(this.optionsMap.keys()),
2736
+ path: [n]
2737
+ }), v);
2738
+ }
2739
+ get discriminator() {
2740
+ return this._def.discriminator;
2741
+ }
2742
+ get options() {
2743
+ return this._def.options;
2744
+ }
2745
+ get optionsMap() {
2746
+ return this._def.optionsMap;
2747
+ }
2748
+ static create(t, n, r) {
2749
+ let i = /* @__PURE__ */ new Map();
2750
+ for (let e of n) {
2751
+ let n = L(e.shape[t]);
2752
+ if (!n.length) throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);
2753
+ for (let r of n) {
2754
+ if (i.has(r)) throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);
2755
+ i.set(r, e);
2756
+ }
2757
+ }
2758
+ return new e({
2759
+ typeName: Z.ZodDiscriminatedUnion,
2760
+ discriminator: t,
2761
+ options: n,
2762
+ optionsMap: i,
2763
+ ...w(r)
2764
+ });
2765
+ }
2766
+ };
2767
+ function Qe(e, t) {
2768
+ let n = d(e), r = d(t);
2769
+ if (e === t) return {
2770
+ valid: !0,
2771
+ data: e
2772
+ };
2773
+ if (n === u.object && r === u.object) {
2774
+ let n = l.objectKeys(t), r = l.objectKeys(e).filter((e) => n.indexOf(e) !== -1), i = {
2775
+ ...e,
2776
+ ...t
2777
+ };
2778
+ for (let n of r) {
2779
+ let r = Qe(e[n], t[n]);
2780
+ if (!r.valid) return { valid: !1 };
2781
+ i[n] = r.data;
2782
+ }
2783
+ return {
2784
+ valid: !0,
2785
+ data: i
2786
+ };
2787
+ }
2788
+ if (n === u.array && r === u.array) {
2789
+ if (e.length !== t.length) return { valid: !1 };
2790
+ let n = [];
2791
+ for (let r = 0; r < e.length; r++) {
2792
+ let i = e[r], a = t[r], o = Qe(i, a);
2793
+ if (!o.valid) return { valid: !1 };
2794
+ n.push(o.data);
2795
+ }
2796
+ return {
2797
+ valid: !0,
2798
+ data: n
2799
+ };
2800
+ }
2801
+ return n === u.date && r === u.date && +e == +t ? {
2802
+ valid: !0,
2803
+ data: e
2804
+ } : { valid: !1 };
2805
+ }
2806
+ var R = class extends T {
2807
+ _parse(e) {
2808
+ let { status: t, ctx: n } = this._processInputParams(e), r = (e, r) => {
2809
+ if (ve(e) || ve(r)) return v;
2810
+ let i = Qe(e.value, r.value);
2811
+ return i.valid ? ((ye(e) || ye(r)) && t.dirty(), {
2812
+ status: t.value,
2813
+ value: i.data
2814
+ }) : (g(n, { code: f.invalid_intersection_types }), v);
2815
+ };
2816
+ return n.common.async ? Promise.all([this._def.left._parseAsync({
2817
+ data: n.data,
2818
+ path: n.path,
2819
+ parent: n
2820
+ }), this._def.right._parseAsync({
2821
+ data: n.data,
2822
+ path: n.path,
2823
+ parent: n
2824
+ })]).then(([e, t]) => r(e, t)) : r(this._def.left._parseSync({
2825
+ data: n.data,
2826
+ path: n.path,
2827
+ parent: n
2828
+ }), this._def.right._parseSync({
2829
+ data: n.data,
2830
+ path: n.path,
2831
+ parent: n
2832
+ }));
2833
+ }
2834
+ };
2835
+ R.create = (e, t, n) => new R({
2836
+ left: e,
2837
+ right: t,
2838
+ typeName: Z.ZodIntersection,
2839
+ ...w(n)
2840
+ });
2841
+ var z = class e extends T {
2842
+ _parse(e) {
2843
+ let { status: t, ctx: n } = this._processInputParams(e);
2844
+ if (n.parsedType !== u.array) return g(n, {
2845
+ code: f.invalid_type,
2846
+ expected: u.array,
2847
+ received: n.parsedType
2848
+ }), v;
2849
+ if (n.data.length < this._def.items.length) return g(n, {
2850
+ code: f.too_small,
2851
+ minimum: this._def.items.length,
2852
+ inclusive: !0,
2853
+ exact: !1,
2854
+ type: "array"
2855
+ }), v;
2856
+ !this._def.rest && n.data.length > this._def.items.length && (g(n, {
2857
+ code: f.too_big,
2858
+ maximum: this._def.items.length,
2859
+ inclusive: !0,
2860
+ exact: !1,
2861
+ type: "array"
2862
+ }), t.dirty());
2863
+ let r = [...n.data].map((e, t) => {
2864
+ let r = this._def.items[t] || this._def.rest;
2865
+ return r ? r._parse(new C(n, e, n.path, t)) : null;
2866
+ }).filter((e) => !!e);
2867
+ return n.common.async ? Promise.all(r).then((e) => _.mergeArray(t, e)) : _.mergeArray(t, r);
2868
+ }
2869
+ get items() {
2870
+ return this._def.items;
2871
+ }
2872
+ rest(t) {
2873
+ return new e({
2874
+ ...this._def,
2875
+ rest: t
2876
+ });
2877
+ }
2878
+ };
2879
+ z.create = (e, t) => {
2880
+ if (!Array.isArray(e)) throw Error("You must pass an array of schemas to z.tuple([ ... ])");
2881
+ return new z({
2882
+ items: e,
2883
+ typeName: Z.ZodTuple,
2884
+ rest: null,
2885
+ ...w(t)
2886
+ });
2887
+ };
2888
+ var $e = class e extends T {
2889
+ get keySchema() {
2890
+ return this._def.keyType;
2891
+ }
2892
+ get valueSchema() {
2893
+ return this._def.valueType;
2894
+ }
2895
+ _parse(e) {
2896
+ let { status: t, ctx: n } = this._processInputParams(e);
2897
+ if (n.parsedType !== u.object) return g(n, {
2898
+ code: f.invalid_type,
2899
+ expected: u.object,
2900
+ received: n.parsedType
2901
+ }), v;
2902
+ let r = [], i = this._def.keyType, a = this._def.valueType;
2903
+ for (let e in n.data) r.push({
2904
+ key: i._parse(new C(n, e, n.path, e)),
2905
+ value: a._parse(new C(n, n.data[e], n.path, e)),
2906
+ alwaysSet: e in n.data
2907
+ });
2908
+ return n.common.async ? _.mergeObjectAsync(t, r) : _.mergeObjectSync(t, r);
2909
+ }
2910
+ get element() {
2911
+ return this._def.valueType;
2912
+ }
2913
+ static create(t, n, r) {
2914
+ return n instanceof T ? new e({
2915
+ keyType: t,
2916
+ valueType: n,
2917
+ typeName: Z.ZodRecord,
2918
+ ...w(r)
2919
+ }) : new e({
2920
+ keyType: E.create(),
2921
+ valueType: t,
2922
+ typeName: Z.ZodRecord,
2923
+ ...w(n)
2924
+ });
2925
+ }
2926
+ }, et = class extends T {
2927
+ get keySchema() {
2928
+ return this._def.keyType;
2929
+ }
2930
+ get valueSchema() {
2931
+ return this._def.valueType;
2932
+ }
2933
+ _parse(e) {
2934
+ let { status: t, ctx: n } = this._processInputParams(e);
2935
+ if (n.parsedType !== u.map) return g(n, {
2936
+ code: f.invalid_type,
2937
+ expected: u.map,
2938
+ received: n.parsedType
2939
+ }), v;
2940
+ let r = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([e, t], a) => ({
2941
+ key: r._parse(new C(n, e, n.path, [a, "key"])),
2942
+ value: i._parse(new C(n, t, n.path, [a, "value"]))
2943
+ }));
2944
+ if (n.common.async) {
2945
+ let e = /* @__PURE__ */ new Map();
2946
+ return Promise.resolve().then(async () => {
2947
+ for (let n of a) {
2948
+ let r = await n.key, i = await n.value;
2949
+ if (r.status === "aborted" || i.status === "aborted") return v;
2950
+ (r.status === "dirty" || i.status === "dirty") && t.dirty(), e.set(r.value, i.value);
2951
+ }
2952
+ return {
2953
+ status: t.value,
2954
+ value: e
2955
+ };
2956
+ });
2957
+ }
2958
+ {
2959
+ let e = /* @__PURE__ */ new Map();
2960
+ for (let n of a) {
2961
+ let r = n.key, i = n.value;
2962
+ if (r.status === "aborted" || i.status === "aborted") return v;
2963
+ (r.status === "dirty" || i.status === "dirty") && t.dirty(), e.set(r.value, i.value);
2964
+ }
2965
+ return {
2966
+ status: t.value,
2967
+ value: e
2968
+ };
2969
+ }
2970
+ }
2971
+ };
2972
+ et.create = (e, t, n) => new et({
2973
+ valueType: t,
2974
+ keyType: e,
2975
+ typeName: Z.ZodMap,
2976
+ ...w(n)
2977
+ });
2978
+ var tt = class e extends T {
2979
+ _parse(e) {
2980
+ let { status: t, ctx: n } = this._processInputParams(e);
2981
+ if (n.parsedType !== u.set) return g(n, {
2982
+ code: f.invalid_type,
2983
+ expected: u.set,
2984
+ received: n.parsedType
2985
+ }), v;
2986
+ let r = this._def;
2987
+ r.minSize !== null && n.data.size < r.minSize.value && (g(n, {
2988
+ code: f.too_small,
2989
+ minimum: r.minSize.value,
2990
+ type: "set",
2991
+ inclusive: !0,
2992
+ exact: !1,
2993
+ message: r.minSize.message
2994
+ }), t.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (g(n, {
2995
+ code: f.too_big,
2996
+ maximum: r.maxSize.value,
2997
+ type: "set",
2998
+ inclusive: !0,
2999
+ exact: !1,
3000
+ message: r.maxSize.message
3001
+ }), t.dirty());
3002
+ let i = this._def.valueType;
3003
+ function a(e) {
3004
+ let n = /* @__PURE__ */ new Set();
3005
+ for (let r of e) {
3006
+ if (r.status === "aborted") return v;
3007
+ r.status === "dirty" && t.dirty(), n.add(r.value);
3008
+ }
3009
+ return {
3010
+ status: t.value,
3011
+ value: n
3012
+ };
3013
+ }
3014
+ let o = [...n.data.values()].map((e, t) => i._parse(new C(n, e, n.path, t)));
3015
+ return n.common.async ? Promise.all(o).then((e) => a(e)) : a(o);
3016
+ }
3017
+ min(t, n) {
3018
+ return new e({
3019
+ ...this._def,
3020
+ minSize: {
3021
+ value: t,
3022
+ message: S.toString(n)
3023
+ }
3024
+ });
3025
+ }
3026
+ max(t, n) {
3027
+ return new e({
3028
+ ...this._def,
3029
+ maxSize: {
3030
+ value: t,
3031
+ message: S.toString(n)
3032
+ }
3033
+ });
3034
+ }
3035
+ size(e, t) {
3036
+ return this.min(e, t).max(e, t);
3037
+ }
3038
+ nonempty(e) {
3039
+ return this.min(1, e);
3040
+ }
3041
+ };
3042
+ tt.create = (e, t) => new tt({
3043
+ valueType: e,
3044
+ minSize: null,
3045
+ maxSize: null,
3046
+ typeName: Z.ZodSet,
3047
+ ...w(t)
3048
+ });
3049
+ var nt = class e extends T {
3050
+ constructor() {
3051
+ super(...arguments), this.validate = this.implement;
3052
+ }
3053
+ _parse(e) {
3054
+ let { ctx: t } = this._processInputParams(e);
3055
+ if (t.parsedType !== u.function) return g(t, {
3056
+ code: f.invalid_type,
3057
+ expected: u.function,
3058
+ received: t.parsedType
3059
+ }), v;
3060
+ function n(e, n) {
3061
+ return h({
3062
+ data: e,
3063
+ path: t.path,
3064
+ errorMaps: [
3065
+ t.common.contextualErrorMap,
3066
+ t.schemaErrorMap,
3067
+ ge(),
3068
+ m
3069
+ ].filter((e) => !!e),
3070
+ issueData: {
3071
+ code: f.invalid_arguments,
3072
+ argumentsError: n
3073
+ }
3074
+ });
3075
+ }
3076
+ function r(e, n) {
3077
+ return h({
3078
+ data: e,
3079
+ path: t.path,
3080
+ errorMaps: [
3081
+ t.common.contextualErrorMap,
3082
+ t.schemaErrorMap,
3083
+ ge(),
3084
+ m
3085
+ ].filter((e) => !!e),
3086
+ issueData: {
3087
+ code: f.invalid_return_type,
3088
+ returnTypeError: n
3089
+ }
3090
+ });
3091
+ }
3092
+ let i = { errorMap: t.common.contextualErrorMap }, a = t.data;
3093
+ if (this._def.returns instanceof W) {
3094
+ let e = this;
3095
+ return y(async function(...t) {
3096
+ let o = new p([]), s = await e._def.args.parseAsync(t, i).catch((e) => {
3097
+ throw o.addIssue(n(t, e)), o;
3098
+ }), c = await Reflect.apply(a, this, s);
3099
+ return await e._def.returns._def.type.parseAsync(c, i).catch((e) => {
3100
+ throw o.addIssue(r(c, e)), o;
3101
+ });
3102
+ });
3103
+ }
3104
+ {
3105
+ let e = this;
3106
+ return y(function(...t) {
3107
+ let o = e._def.args.safeParse(t, i);
3108
+ if (!o.success) throw new p([n(t, o.error)]);
3109
+ let s = Reflect.apply(a, this, o.data), c = e._def.returns.safeParse(s, i);
3110
+ if (!c.success) throw new p([r(s, c.error)]);
3111
+ return c.data;
3112
+ });
3113
+ }
3114
+ }
3115
+ parameters() {
3116
+ return this._def.args;
3117
+ }
3118
+ returnType() {
3119
+ return this._def.returns;
3120
+ }
3121
+ args(...t) {
3122
+ return new e({
3123
+ ...this._def,
3124
+ args: z.create(t).rest(j.create())
3125
+ });
3126
+ }
3127
+ returns(t) {
3128
+ return new e({
3129
+ ...this._def,
3130
+ returns: t
3131
+ });
3132
+ }
3133
+ implement(e) {
3134
+ return this.parse(e);
3135
+ }
3136
+ strictImplement(e) {
3137
+ return this.parse(e);
3138
+ }
3139
+ static create(t, n, r) {
3140
+ return new e({
3141
+ args: t || z.create([]).rest(j.create()),
3142
+ returns: n || j.create(),
3143
+ typeName: Z.ZodFunction,
3144
+ ...w(r)
3145
+ });
3146
+ }
3147
+ }, B = class extends T {
3148
+ get schema() {
3149
+ return this._def.getter();
3150
+ }
3151
+ _parse(e) {
3152
+ let { ctx: t } = this._processInputParams(e);
3153
+ return this._def.getter()._parse({
3154
+ data: t.data,
3155
+ path: t.path,
3156
+ parent: t
3157
+ });
3158
+ }
3159
+ };
3160
+ B.create = (e, t) => new B({
3161
+ getter: e,
3162
+ typeName: Z.ZodLazy,
3163
+ ...w(t)
3164
+ });
3165
+ var V = class extends T {
3166
+ _parse(e) {
3167
+ if (e.data !== this._def.value) {
3168
+ let t = this._getOrReturnCtx(e);
3169
+ return g(t, {
3170
+ received: t.data,
3171
+ code: f.invalid_literal,
3172
+ expected: this._def.value
3173
+ }), v;
3174
+ }
3175
+ return {
3176
+ status: "valid",
3177
+ value: e.data
3178
+ };
3179
+ }
3180
+ get value() {
3181
+ return this._def.value;
3182
+ }
3183
+ };
3184
+ V.create = (e, t) => new V({
3185
+ value: e,
3186
+ typeName: Z.ZodLiteral,
3187
+ ...w(t)
3188
+ });
3189
+ function rt(e, t) {
3190
+ return new H({
3191
+ values: e,
3192
+ typeName: Z.ZodEnum,
3193
+ ...w(t)
3194
+ });
3195
+ }
3196
+ var H = class e extends T {
3197
+ _parse(e) {
3198
+ if (typeof e.data != "string") {
3199
+ let t = this._getOrReturnCtx(e), n = this._def.values;
3200
+ return g(t, {
3201
+ expected: l.joinValues(n),
3202
+ received: t.parsedType,
3203
+ code: f.invalid_type
3204
+ }), v;
3205
+ }
3206
+ if (this._cache ||= new Set(this._def.values), !this._cache.has(e.data)) {
3207
+ let t = this._getOrReturnCtx(e), n = this._def.values;
3208
+ return g(t, {
3209
+ received: t.data,
3210
+ code: f.invalid_enum_value,
3211
+ options: n
3212
+ }), v;
3213
+ }
3214
+ return y(e.data);
3215
+ }
3216
+ get options() {
3217
+ return this._def.values;
3218
+ }
3219
+ get enum() {
3220
+ let e = {};
3221
+ for (let t of this._def.values) e[t] = t;
3222
+ return e;
3223
+ }
3224
+ get Values() {
3225
+ let e = {};
3226
+ for (let t of this._def.values) e[t] = t;
3227
+ return e;
3228
+ }
3229
+ get Enum() {
3230
+ let e = {};
3231
+ for (let t of this._def.values) e[t] = t;
3232
+ return e;
3233
+ }
3234
+ extract(t, n = this._def) {
3235
+ return e.create(t, {
3236
+ ...this._def,
3237
+ ...n
3238
+ });
3239
+ }
3240
+ exclude(t, n = this._def) {
3241
+ return e.create(this.options.filter((e) => !t.includes(e)), {
3242
+ ...this._def,
3243
+ ...n
3244
+ });
3245
+ }
3246
+ };
3247
+ H.create = rt;
3248
+ var U = class extends T {
3249
+ _parse(e) {
3250
+ let t = l.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
3251
+ if (n.parsedType !== u.string && n.parsedType !== u.number) {
3252
+ let e = l.objectValues(t);
3253
+ return g(n, {
3254
+ expected: l.joinValues(e),
3255
+ received: n.parsedType,
3256
+ code: f.invalid_type
3257
+ }), v;
3258
+ }
3259
+ if (this._cache ||= new Set(l.getValidEnumValues(this._def.values)), !this._cache.has(e.data)) {
3260
+ let e = l.objectValues(t);
3261
+ return g(n, {
3262
+ received: n.data,
3263
+ code: f.invalid_enum_value,
3264
+ options: e
3265
+ }), v;
3266
+ }
3267
+ return y(e.data);
3268
+ }
3269
+ get enum() {
3270
+ return this._def.values;
3271
+ }
3272
+ };
3273
+ U.create = (e, t) => new U({
3274
+ values: e,
3275
+ typeName: Z.ZodNativeEnum,
3276
+ ...w(t)
3277
+ });
3278
+ var W = class extends T {
3279
+ unwrap() {
3280
+ return this._def.type;
3281
+ }
3282
+ _parse(e) {
3283
+ let { ctx: t } = this._processInputParams(e);
3284
+ return t.parsedType !== u.promise && t.common.async === !1 ? (g(t, {
3285
+ code: f.invalid_type,
3286
+ expected: u.promise,
3287
+ received: t.parsedType
3288
+ }), v) : y((t.parsedType === u.promise ? t.data : Promise.resolve(t.data)).then((e) => this._def.type.parseAsync(e, {
3289
+ path: t.path,
3290
+ errorMap: t.common.contextualErrorMap
3291
+ })));
3292
+ }
3293
+ };
3294
+ W.create = (e, t) => new W({
3295
+ type: e,
3296
+ typeName: Z.ZodPromise,
3297
+ ...w(t)
3298
+ });
3299
+ var G = class extends T {
3300
+ innerType() {
3301
+ return this._def.schema;
3302
+ }
3303
+ sourceType() {
3304
+ return this._def.schema._def.typeName === Z.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3305
+ }
3306
+ _parse(e) {
3307
+ let { status: t, ctx: n } = this._processInputParams(e), r = this._def.effect || null, i = {
3308
+ addIssue: (e) => {
3309
+ g(n, e), e.fatal ? t.abort() : t.dirty();
3310
+ },
3311
+ get path() {
3312
+ return n.path;
3313
+ }
3314
+ };
3315
+ if (i.addIssue = i.addIssue.bind(i), r.type === "preprocess") {
3316
+ let e = r.transform(n.data, i);
3317
+ if (n.common.async) return Promise.resolve(e).then(async (e) => {
3318
+ if (t.value === "aborted") return v;
3319
+ let r = await this._def.schema._parseAsync({
3320
+ data: e,
3321
+ path: n.path,
3322
+ parent: n
3323
+ });
3324
+ return r.status === "aborted" ? v : r.status === "dirty" || t.value === "dirty" ? _e(r.value) : r;
3325
+ });
3326
+ {
3327
+ if (t.value === "aborted") return v;
3328
+ let r = this._def.schema._parseSync({
3329
+ data: e,
3330
+ path: n.path,
3331
+ parent: n
3332
+ });
3333
+ return r.status === "aborted" ? v : r.status === "dirty" || t.value === "dirty" ? _e(r.value) : r;
3334
+ }
3335
+ }
3336
+ if (r.type === "refinement") {
3337
+ let e = (e) => {
3338
+ let t = r.refinement(e, i);
3339
+ if (n.common.async) return Promise.resolve(t);
3340
+ if (t instanceof Promise) throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3341
+ return e;
3342
+ };
3343
+ if (n.common.async === !1) {
3344
+ let r = this._def.schema._parseSync({
3345
+ data: n.data,
3346
+ path: n.path,
3347
+ parent: n
3348
+ });
3349
+ return r.status === "aborted" ? v : (r.status === "dirty" && t.dirty(), e(r.value), {
3350
+ status: t.value,
3351
+ value: r.value
3352
+ });
3353
+ }
3354
+ return this._def.schema._parseAsync({
3355
+ data: n.data,
3356
+ path: n.path,
3357
+ parent: n
3358
+ }).then((n) => n.status === "aborted" ? v : (n.status === "dirty" && t.dirty(), e(n.value).then(() => ({
3359
+ status: t.value,
3360
+ value: n.value
3361
+ }))));
3362
+ }
3363
+ if (r.type === "transform") {
3364
+ if (n.common.async === !1) {
3365
+ let e = this._def.schema._parseSync({
3366
+ data: n.data,
3367
+ path: n.path,
3368
+ parent: n
3369
+ });
3370
+ if (!b(e)) return v;
3371
+ let a = r.transform(e.value, i);
3372
+ if (a instanceof Promise) throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
3373
+ return {
3374
+ status: t.value,
3375
+ value: a
3376
+ };
3377
+ }
3378
+ return this._def.schema._parseAsync({
3379
+ data: n.data,
3380
+ path: n.path,
3381
+ parent: n
3382
+ }).then((e) => b(e) ? Promise.resolve(r.transform(e.value, i)).then((e) => ({
3383
+ status: t.value,
3384
+ value: e
3385
+ })) : v);
3386
+ }
3387
+ l.assertNever(r);
3388
+ }
3389
+ };
3390
+ G.create = (e, t, n) => new G({
3391
+ schema: e,
3392
+ typeName: Z.ZodEffects,
3393
+ effect: t,
3394
+ ...w(n)
3395
+ }), G.createWithPreprocess = (e, t, n) => new G({
3396
+ schema: t,
3397
+ effect: {
3398
+ type: "preprocess",
3399
+ transform: e
3400
+ },
3401
+ typeName: Z.ZodEffects,
3402
+ ...w(n)
3403
+ });
3404
+ var K = class extends T {
3405
+ _parse(e) {
3406
+ return this._getType(e) === u.undefined ? y(void 0) : this._def.innerType._parse(e);
3407
+ }
3408
+ unwrap() {
3409
+ return this._def.innerType;
3410
+ }
3411
+ };
3412
+ K.create = (e, t) => new K({
3413
+ innerType: e,
3414
+ typeName: Z.ZodOptional,
3415
+ ...w(t)
3416
+ });
3417
+ var q = class extends T {
3418
+ _parse(e) {
3419
+ return this._getType(e) === u.null ? y(null) : this._def.innerType._parse(e);
3420
+ }
3421
+ unwrap() {
3422
+ return this._def.innerType;
3423
+ }
3424
+ };
3425
+ q.create = (e, t) => new q({
3426
+ innerType: e,
3427
+ typeName: Z.ZodNullable,
3428
+ ...w(t)
3429
+ });
3430
+ var J = class extends T {
3431
+ _parse(e) {
3432
+ let { ctx: t } = this._processInputParams(e), n = t.data;
3433
+ return t.parsedType === u.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
3434
+ data: n,
3435
+ path: t.path,
3436
+ parent: t
3437
+ });
3438
+ }
3439
+ removeDefault() {
3440
+ return this._def.innerType;
3441
+ }
3442
+ };
3443
+ J.create = (e, t) => new J({
3444
+ innerType: e,
3445
+ typeName: Z.ZodDefault,
3446
+ defaultValue: typeof t.default == "function" ? t.default : () => t.default,
3447
+ ...w(t)
3448
+ });
3449
+ var Y = class extends T {
3450
+ _parse(e) {
3451
+ let { ctx: t } = this._processInputParams(e), n = {
3452
+ ...t,
3453
+ common: {
3454
+ ...t.common,
3455
+ issues: []
3456
+ }
3457
+ }, r = this._def.innerType._parse({
3458
+ data: n.data,
3459
+ path: n.path,
3460
+ parent: { ...n }
3461
+ });
3462
+ return x(r) ? r.then((e) => ({
3463
+ status: "valid",
3464
+ value: e.status === "valid" ? e.value : this._def.catchValue({
3465
+ get error() {
3466
+ return new p(n.common.issues);
3467
+ },
3468
+ input: n.data
3469
+ })
3470
+ })) : {
3471
+ status: "valid",
3472
+ value: r.status === "valid" ? r.value : this._def.catchValue({
3473
+ get error() {
3474
+ return new p(n.common.issues);
3475
+ },
3476
+ input: n.data
3477
+ })
3478
+ };
3479
+ }
3480
+ removeCatch() {
3481
+ return this._def.innerType;
3482
+ }
3483
+ };
3484
+ Y.create = (e, t) => new Y({
3485
+ innerType: e,
3486
+ typeName: Z.ZodCatch,
3487
+ catchValue: typeof t.catch == "function" ? t.catch : () => t.catch,
3488
+ ...w(t)
3489
+ });
3490
+ var it = class extends T {
3491
+ _parse(e) {
3492
+ if (this._getType(e) !== u.nan) {
3493
+ let t = this._getOrReturnCtx(e);
3494
+ return g(t, {
3495
+ code: f.invalid_type,
3496
+ expected: u.nan,
3497
+ received: t.parsedType
3498
+ }), v;
3499
+ }
3500
+ return {
3501
+ status: "valid",
3502
+ value: e.data
3503
+ };
3504
+ }
3505
+ };
3506
+ it.create = (e) => new it({
3507
+ typeName: Z.ZodNaN,
3508
+ ...w(e)
3509
+ });
3510
+ var at = class extends T {
3511
+ _parse(e) {
3512
+ let { ctx: t } = this._processInputParams(e), n = t.data;
3513
+ return this._def.type._parse({
3514
+ data: n,
3515
+ path: t.path,
3516
+ parent: t
3517
+ });
3518
+ }
3519
+ unwrap() {
3520
+ return this._def.type;
3521
+ }
3522
+ }, ot = class e extends T {
3523
+ _parse(e) {
3524
+ let { status: t, ctx: n } = this._processInputParams(e);
3525
+ if (n.common.async) return (async () => {
3526
+ let e = await this._def.in._parseAsync({
3527
+ data: n.data,
3528
+ path: n.path,
3529
+ parent: n
3530
+ });
3531
+ return e.status === "aborted" ? v : e.status === "dirty" ? (t.dirty(), _e(e.value)) : this._def.out._parseAsync({
3532
+ data: e.value,
3533
+ path: n.path,
3534
+ parent: n
3535
+ });
3536
+ })();
3537
+ {
3538
+ let e = this._def.in._parseSync({
3539
+ data: n.data,
3540
+ path: n.path,
3541
+ parent: n
3542
+ });
3543
+ return e.status === "aborted" ? v : e.status === "dirty" ? (t.dirty(), {
3544
+ status: "dirty",
3545
+ value: e.value
3546
+ }) : this._def.out._parseSync({
3547
+ data: e.value,
3548
+ path: n.path,
3549
+ parent: n
3550
+ });
3551
+ }
3552
+ }
3553
+ static create(t, n) {
3554
+ return new e({
3555
+ in: t,
3556
+ out: n,
3557
+ typeName: Z.ZodPipeline
3558
+ });
3559
+ }
3560
+ }, X = class extends T {
3561
+ _parse(e) {
3562
+ let t = this._def.innerType._parse(e), n = (e) => (b(e) && (e.value = Object.freeze(e.value)), e);
3563
+ return x(t) ? t.then((e) => n(e)) : n(t);
3564
+ }
3565
+ unwrap() {
3566
+ return this._def.innerType;
3567
+ }
3568
+ };
3569
+ X.create = (e, t) => new X({
3570
+ innerType: e,
3571
+ typeName: Z.ZodReadonly,
3572
+ ...w(t)
3573
+ }), F.lazycreate;
3574
+ var Z;
3575
+ (function(e) {
3576
+ e.ZodString = "ZodString", e.ZodNumber = "ZodNumber", e.ZodNaN = "ZodNaN", e.ZodBigInt = "ZodBigInt", e.ZodBoolean = "ZodBoolean", e.ZodDate = "ZodDate", e.ZodSymbol = "ZodSymbol", e.ZodUndefined = "ZodUndefined", e.ZodNull = "ZodNull", e.ZodAny = "ZodAny", e.ZodUnknown = "ZodUnknown", e.ZodNever = "ZodNever", e.ZodVoid = "ZodVoid", e.ZodArray = "ZodArray", e.ZodObject = "ZodObject", e.ZodUnion = "ZodUnion", e.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", e.ZodIntersection = "ZodIntersection", e.ZodTuple = "ZodTuple", e.ZodRecord = "ZodRecord", e.ZodMap = "ZodMap", e.ZodSet = "ZodSet", e.ZodFunction = "ZodFunction", e.ZodLazy = "ZodLazy", e.ZodLiteral = "ZodLiteral", e.ZodEnum = "ZodEnum", e.ZodEffects = "ZodEffects", e.ZodNativeEnum = "ZodNativeEnum", e.ZodOptional = "ZodOptional", e.ZodNullable = "ZodNullable", e.ZodDefault = "ZodDefault", e.ZodCatch = "ZodCatch", e.ZodPromise = "ZodPromise", e.ZodBranded = "ZodBranded", e.ZodPipeline = "ZodPipeline", e.ZodReadonly = "ZodReadonly";
3577
+ })(Z ||= {});
3578
+ var Q = E.create, st = D.create;
3579
+ it.create, O.create, Ke.create, qe.create, Je.create, k.create, A.create, Ye.create, j.create, M.create, Xe.create;
3580
+ var ct = N.create, $ = F.create;
3581
+ F.strictCreate, I.create, Ze.create, R.create, z.create, $e.create, et.create, tt.create, nt.create, B.create, V.create;
3582
+ var lt = H.create;
3583
+ U.create, W.create, G.create, K.create, q.create, G.createWithPreprocess, ot.create;
3584
+ var ut = [
3585
+ {
3586
+ name: "list_projects",
3587
+ title: "List Projects",
3588
+ description: "Retrieve all projects in the workspace.",
3589
+ zodSchema: $({}),
3590
+ inputSchema: {
3591
+ type: "object",
3592
+ properties: {},
3593
+ additionalProperties: !1
3594
+ },
3595
+ annotations: { readOnlyHint: !0 },
3596
+ execute: async (e, t) => t.getProjects()
3597
+ },
3598
+ {
3599
+ name: "get_project",
3600
+ title: "Get Project",
3601
+ description: "Get details of a specific project by its ID.",
3602
+ zodSchema: $({ id: Q().describe("The project ID") }),
3603
+ inputSchema: {
3604
+ type: "object",
3605
+ properties: { id: {
3606
+ type: "string",
3607
+ description: "The project ID"
3608
+ } },
3609
+ required: ["id"],
3610
+ additionalProperties: !1
3611
+ },
3612
+ annotations: { readOnlyHint: !0 },
3613
+ execute: async (e, t) => t.getProject(e.id)
3614
+ },
3615
+ {
3616
+ name: "create_project",
3617
+ title: "Create Project",
3618
+ description: "Create a new project workspace.",
3619
+ zodSchema: $({
3620
+ name: Q().describe("Name of the project"),
3621
+ description: Q().optional().describe("Description of the project"),
3622
+ key: Q().optional().describe("Short project key/prefix (e.g. \"PROJ\")")
3623
+ }),
3624
+ inputSchema: {
3625
+ type: "object",
3626
+ properties: {
3627
+ name: {
3628
+ type: "string",
3629
+ description: "Name of the project"
3630
+ },
3631
+ description: {
3632
+ type: "string",
3633
+ description: "Description of the project"
3634
+ },
3635
+ key: {
3636
+ type: "string",
3637
+ description: "Short project key/prefix (e.g. \"PROJ\")"
3638
+ }
3639
+ },
3640
+ required: ["name"],
3641
+ additionalProperties: !1
3642
+ },
3643
+ execute: async (e, t) => t.createProject(e)
3644
+ },
3645
+ {
3646
+ name: "list_tasks",
3647
+ title: "List Tasks",
3648
+ description: "List tasks, optionally filtered by project, status, priority, or assignee.",
3649
+ zodSchema: $({
3650
+ projectId: Q().optional().describe("Filter by project ID"),
3651
+ status: Q().optional().describe("Filter by task status key"),
3652
+ priority: lt([
3653
+ "urgent",
3654
+ "high",
3655
+ "medium",
3656
+ "low",
3657
+ "none"
3658
+ ]).optional().describe("Filter by priority"),
3659
+ assigneeId: Q().optional().describe("Filter by assignee ID")
3660
+ }),
3661
+ inputSchema: {
3662
+ type: "object",
3663
+ properties: {
3664
+ projectId: {
3665
+ type: "string",
3666
+ description: "Filter by project ID"
3667
+ },
3668
+ status: {
3669
+ type: "string",
3670
+ description: "Filter by task status key"
3671
+ },
3672
+ priority: {
3673
+ type: "string",
3674
+ enum: [
3675
+ "urgent",
3676
+ "high",
3677
+ "medium",
3678
+ "low",
3679
+ "none"
3680
+ ],
3681
+ description: "Filter by priority"
3682
+ },
3683
+ assigneeId: {
3684
+ type: "string",
3685
+ description: "Filter by assignee ID"
3686
+ }
3687
+ },
3688
+ additionalProperties: !1
3689
+ },
3690
+ annotations: { readOnlyHint: !0 },
3691
+ execute: async (e, t, n) => {
3692
+ let r = e.projectId || n?.projectId, i = await t.getTasks(r);
3693
+ return e.status && (i = i.filter((t) => t.status === e.status)), e.priority && (i = i.filter((t) => t.priority === e.priority)), e.assigneeId && (i = i.filter((t) => t.assigneeId === e.assigneeId)), i;
3694
+ }
3695
+ },
3696
+ {
3697
+ name: "get_task",
3698
+ title: "Get Task",
3699
+ description: "Get task details by ID.",
3700
+ zodSchema: $({ id: Q().describe("The task ID") }),
3701
+ inputSchema: {
3702
+ type: "object",
3703
+ properties: { id: {
3704
+ type: "string",
3705
+ description: "The task ID"
3706
+ } },
3707
+ required: ["id"],
3708
+ additionalProperties: !1
3709
+ },
3710
+ annotations: { readOnlyHint: !0 },
3711
+ execute: async (e, t) => t.getTask(e.id)
3712
+ },
3713
+ {
3714
+ name: "create_task",
3715
+ title: "Create Task",
3716
+ description: "Create a new task within a project.",
3717
+ zodSchema: $({
3718
+ projectId: Q().optional().describe("Project ID (inferred from active view in browser if omitted)"),
3719
+ title: Q().describe("Title of the task"),
3720
+ description: Q().optional().describe("Detailed description / markdown"),
3721
+ status: Q().optional().describe("Status (defaults to \"todo\" or first workflow status)"),
3722
+ priority: lt([
3723
+ "urgent",
3724
+ "high",
3725
+ "medium",
3726
+ "low",
3727
+ "none"
3728
+ ]).optional().default("none").describe("Task priority"),
3729
+ assigneeId: Q().optional().describe("User ID to assign task to"),
3730
+ dueDate: Q().optional().describe("Due date (ISO string)"),
3731
+ tags: ct(Q()).optional().describe("Tags for categorization"),
3732
+ estimatedHours: st().optional().describe("Estimated hours to complete")
3733
+ }),
3734
+ inputSchema: {
3735
+ type: "object",
3736
+ properties: {
3737
+ projectId: {
3738
+ type: "string",
3739
+ description: "Project ID (inferred from active view if omitted)"
3740
+ },
3741
+ title: {
3742
+ type: "string",
3743
+ description: "Title of the task"
3744
+ },
3745
+ description: {
3746
+ type: "string",
3747
+ description: "Detailed description"
3748
+ },
3749
+ status: {
3750
+ type: "string",
3751
+ description: "Status key"
3752
+ },
3753
+ priority: {
3754
+ type: "string",
3755
+ enum: [
3756
+ "urgent",
3757
+ "high",
3758
+ "medium",
3759
+ "low",
3760
+ "none"
3761
+ ]
3762
+ },
3763
+ assigneeId: {
3764
+ type: "string",
3765
+ description: "User ID of assignee"
3766
+ },
3767
+ dueDate: {
3768
+ type: "string",
3769
+ description: "Due date in ISO 8601 format"
3770
+ },
3771
+ tags: {
3772
+ type: "array",
3773
+ items: { type: "string" }
3774
+ },
3775
+ estimatedHours: { type: "number" }
3776
+ },
3777
+ required: ["title"],
3778
+ additionalProperties: !1
3779
+ },
3780
+ execute: async (e, t, n) => {
3781
+ let r = e.projectId || n?.projectId;
3782
+ if (!r) throw Error("projectId is required to create a task, but none was provided or active in context.");
3783
+ let i = {
3784
+ projectId: r,
3785
+ title: e.title,
3786
+ description: e.description,
3787
+ status: e.status || "todo",
3788
+ priority: e.priority || "none",
3789
+ assigneeId: e.assigneeId,
3790
+ dueDate: e.dueDate,
3791
+ tags: e.tags || [],
3792
+ estimatedHours: e.estimatedHours
3793
+ };
3794
+ return t.createTask(i);
3795
+ }
3796
+ },
3797
+ {
3798
+ name: "update_task",
3799
+ title: "Update Task",
3800
+ description: "Update fields of an existing task (e.g. title, status, priority, assignee).",
3801
+ zodSchema: $({
3802
+ id: Q().describe("The task ID"),
3803
+ title: Q().optional(),
3804
+ description: Q().optional(),
3805
+ status: Q().optional(),
3806
+ priority: lt([
3807
+ "urgent",
3808
+ "high",
3809
+ "medium",
3810
+ "low",
3811
+ "none"
3812
+ ]).optional(),
3813
+ assigneeId: Q().optional(),
3814
+ dueDate: Q().optional(),
3815
+ tags: ct(Q()).optional(),
3816
+ estimatedHours: st().optional(),
3817
+ loggedHours: st().optional()
3818
+ }),
3819
+ inputSchema: {
3820
+ type: "object",
3821
+ properties: {
3822
+ id: {
3823
+ type: "string",
3824
+ description: "Task ID"
3825
+ },
3826
+ title: { type: "string" },
3827
+ description: { type: "string" },
3828
+ status: { type: "string" },
3829
+ priority: {
3830
+ type: "string",
3831
+ enum: [
3832
+ "urgent",
3833
+ "high",
3834
+ "medium",
3835
+ "low",
3836
+ "none"
3837
+ ]
3838
+ },
3839
+ assigneeId: { type: "string" },
3840
+ dueDate: { type: "string" },
3841
+ tags: {
3842
+ type: "array",
3843
+ items: { type: "string" }
3844
+ },
3845
+ estimatedHours: { type: "number" },
3846
+ loggedHours: { type: "number" }
3847
+ },
3848
+ required: ["id"],
3849
+ additionalProperties: !1
3850
+ },
3851
+ execute: async (e, t) => {
3852
+ let { id: n, ...r } = e;
3853
+ return t.updateTask(n, r);
3854
+ }
3855
+ },
3856
+ {
3857
+ name: "delete_task",
3858
+ title: "Delete Task",
3859
+ description: "Delete a task by ID.",
3860
+ zodSchema: $({ id: Q().describe("The task ID to delete") }),
3861
+ inputSchema: {
3862
+ type: "object",
3863
+ properties: { id: {
3864
+ type: "string",
3865
+ description: "The task ID"
3866
+ } },
3867
+ required: ["id"],
3868
+ additionalProperties: !1
3869
+ },
3870
+ annotations: { requiresConfirmation: !0 },
3871
+ execute: async (e, t) => ({ success: await t.deleteTask(e.id) })
3872
+ },
3873
+ {
3874
+ name: "list_deliverables",
3875
+ title: "List Deliverables",
3876
+ description: "List deliverables/milestones for a project.",
3877
+ zodSchema: $({ projectId: Q().optional().describe("Project ID") }),
3878
+ inputSchema: {
3879
+ type: "object",
3880
+ properties: { projectId: {
3881
+ type: "string",
3882
+ description: "Project ID"
3883
+ } },
3884
+ additionalProperties: !1
3885
+ },
3886
+ annotations: { readOnlyHint: !0 },
3887
+ execute: async (e, t, n) => {
3888
+ let r = e.projectId || n?.projectId;
3889
+ if (!r) throw Error("projectId is required to list deliverables.");
3890
+ return "getDeliverables" in t && typeof t.getDeliverables == "function" ? t.getDeliverables(r) : [];
3891
+ }
3892
+ },
3893
+ {
3894
+ name: "create_deliverable",
3895
+ title: "Create Deliverable",
3896
+ description: "Create a milestone deliverable within a project.",
3897
+ zodSchema: $({
3898
+ projectId: Q().optional(),
3899
+ title: Q(),
3900
+ description: Q().optional(),
3901
+ dueDate: Q().optional(),
3902
+ taskIds: ct(Q()).optional()
3903
+ }),
3904
+ inputSchema: {
3905
+ type: "object",
3906
+ properties: {
3907
+ projectId: { type: "string" },
3908
+ title: { type: "string" },
3909
+ description: { type: "string" },
3910
+ dueDate: { type: "string" },
3911
+ taskIds: {
3912
+ type: "array",
3913
+ items: { type: "string" }
3914
+ }
3915
+ },
3916
+ required: ["title"],
3917
+ additionalProperties: !1
3918
+ },
3919
+ execute: async (e, t, n) => {
3920
+ let r = e.projectId || n?.projectId;
3921
+ if (!r) throw Error("projectId is required to create a deliverable.");
3922
+ if ("createDeliverable" in t && typeof t.createDeliverable == "function") return t.createDeliverable({
3923
+ ...e,
3924
+ projectId: r
3925
+ });
3926
+ throw Error("createDeliverable is not supported by this backend target.");
3927
+ }
3928
+ },
3929
+ {
3930
+ name: "list_comments",
3931
+ title: "List Comments",
3932
+ description: "List comments associated with a task.",
3933
+ zodSchema: $({ taskId: Q().describe("The task ID") }),
3934
+ inputSchema: {
3935
+ type: "object",
3936
+ properties: { taskId: {
3937
+ type: "string",
3938
+ description: "The task ID"
3939
+ } },
3940
+ required: ["taskId"],
3941
+ additionalProperties: !1
3942
+ },
3943
+ annotations: { readOnlyHint: !0 },
3944
+ execute: async (e, t) => "getComments" in t && typeof t.getComments == "function" ? t.getComments(e.taskId) : []
3945
+ },
3946
+ {
3947
+ name: "add_comment",
3948
+ title: "Add Comment",
3949
+ description: "Add a comment to a task.",
3950
+ zodSchema: $({
3951
+ taskId: Q().describe("The task ID"),
3952
+ content: Q().describe("Comment body/markdown"),
3953
+ authorId: Q().describe("Author user ID")
3954
+ }),
3955
+ inputSchema: {
3956
+ type: "object",
3957
+ properties: {
3958
+ taskId: {
3959
+ type: "string",
3960
+ description: "The task ID"
3961
+ },
3962
+ content: {
3963
+ type: "string",
3964
+ description: "Comment body/markdown"
3965
+ },
3966
+ authorId: {
3967
+ type: "string",
3968
+ description: "Author user ID"
3969
+ }
3970
+ },
3971
+ required: [
3972
+ "taskId",
3973
+ "content",
3974
+ "authorId"
3975
+ ],
3976
+ additionalProperties: !1
3977
+ },
3978
+ execute: async (e, t) => t.addComment({
3979
+ taskId: e.taskId,
3980
+ content: e.content,
3981
+ authorId: e.authorId
3982
+ })
3983
+ }
3984
+ ];
3985
+ new Map(ut.map((e) => [e.name, e]));
3986
+ //#endregion
3987
+ //#region ../mcp/dist/web/index.js
3988
+ function dt(e = typeof document < "u" ? document : null) {
3989
+ if (!e) return null;
3990
+ if (!e.modelContext) {
3991
+ let t = /* @__PURE__ */ new Map();
3992
+ e.modelContext = {
3993
+ registerTool(e, n) {
3994
+ t.set(e.name, e), n?.signal && n.signal.addEventListener("abort", () => {
3995
+ t.delete(e.name);
3996
+ }, { once: !0 });
3997
+ },
3998
+ unregisterTool(e) {
3999
+ t.delete(e);
4000
+ },
4001
+ async getTools() {
4002
+ return Array.from(t.values());
4003
+ },
4004
+ async executeTool(e, n) {
4005
+ let r = t.get(e);
4006
+ if (!r) throw Error(`Tool "${e}" is not registered on modelContext.`);
4007
+ return r.execute(n || {});
4008
+ }
4009
+ };
4010
+ }
4011
+ return e.modelContext;
4012
+ }
4013
+ function ft(e) {
4014
+ let t = e.document ?? (typeof document < "u" ? document : null), n = e.navigator ?? (typeof navigator < "u" ? navigator : null), r = e.window ?? (typeof window < "u" ? window : null), i;
4015
+ t?.modelContext ? i = t.modelContext : n?.modelContext ? i = n.modelContext : t && (i = dt(t) ?? void 0);
4016
+ let a = e.tools ? ut.filter((t) => e.tools.includes(t.name)) : ut, o = [], s = new AbortController();
4017
+ e.signal && e.signal.addEventListener("abort", () => s.abort(), { once: !0 });
4018
+ for (let t of a) {
4019
+ let n = {
4020
+ name: t.name,
4021
+ title: t.title,
4022
+ description: t.description,
4023
+ inputSchema: t.inputSchema,
4024
+ annotations: t.annotations,
4025
+ execute: async (n) => {
4026
+ let r = e.projectId ? { projectId: e.projectId } : void 0, i = await t.execute(n, e.client, r);
4027
+ return e.onToolExecuted?.(t.name, n, i), i;
4028
+ }
4029
+ };
4030
+ if (o.push(n), i?.registerTool) try {
4031
+ i.registerTool(n, { signal: s.signal });
4032
+ } catch (e) {
4033
+ console.warn(`[Critical Path WebMCP] Failed to register tool "${n.name}":`, e);
4034
+ }
4035
+ }
4036
+ return r && (r.__CRITICAL_PATH_WEBMCP__ = {
4037
+ projectId: e.projectId,
4038
+ tools: o,
4039
+ execute: async (e, t) => {
4040
+ let n = o.find((t) => t.name === e);
4041
+ if (!n) throw Error(`WebMCP tool "${e}" not found in Critical Path registry.`);
4042
+ return n.execute(t);
4043
+ }
4044
+ }), {
4045
+ unregister: () => {
4046
+ if (s.abort(), i?.unregisterTool) for (let e of o) i.unregisterTool(e.name);
4047
+ r && r.__CRITICAL_PATH_WEBMCP__?.tools === o && delete r.__CRITICAL_PATH_WEBMCP__;
4048
+ },
4049
+ getRegisteredTools: () => o
4050
+ };
4051
+ }
4052
+ //#endregion
4053
+ //#region src/webmcp-state.svelte.ts
4054
+ var pt = class {
4055
+ client;
4056
+ options;
4057
+ #e = t.state(!1);
4058
+ get registered() {
4059
+ return t.get(this.#e);
4060
+ }
4061
+ set registered(e) {
4062
+ t.set(this.#e, e, !0);
4063
+ }
4064
+ #t = t.state(void 0);
4065
+ get activeProjectId() {
4066
+ return t.get(this.#t);
4067
+ }
4068
+ set activeProjectId(e) {
4069
+ t.set(this.#t, e, !0);
4070
+ }
4071
+ #n = t.state(t.proxy([]));
4072
+ get tools() {
4073
+ return t.get(this.#n);
4074
+ }
4075
+ set tools(e) {
4076
+ t.set(this.#n, e, !0);
4077
+ }
4078
+ #r = t.state(null);
4079
+ get error() {
4080
+ return t.get(this.#r);
4081
+ }
4082
+ set error(e) {
4083
+ t.set(this.#r, e, !0);
4084
+ }
4085
+ handle = null;
4086
+ abortController = null;
4087
+ constructor(e, t = {}) {
4088
+ this.client = e, this.options = t, this.activeProjectId = t.projectId, (t.autoRegister ?? !0) && this.register();
4089
+ }
4090
+ register() {
4091
+ if (!this.registered) {
4092
+ this.error = null;
4093
+ try {
4094
+ this.abortController = new AbortController(), this.handle = ft({
4095
+ client: this.client,
4096
+ projectId: this.activeProjectId,
4097
+ tools: this.options.tools,
4098
+ signal: this.abortController.signal,
4099
+ document: this.options.document,
4100
+ navigator: this.options.navigator,
4101
+ window: this.options.window,
4102
+ onToolExecuted: (e, t, n) => {
4103
+ this.options.onToolExecuted?.(e, t, n);
4104
+ }
4105
+ }), this.tools = this.handle.getRegisteredTools().map((e) => e.name), this.registered = !0;
4106
+ } catch (e) {
4107
+ this.error = e instanceof Error ? e : Error(String(e)), this.registered = !1;
4108
+ }
4109
+ }
4110
+ }
4111
+ unregister() {
4112
+ this.registered && (this.abortController?.abort(), this.handle?.unregister(), this.handle = null, this.abortController = null, this.registered = !1, this.tools = []);
4113
+ }
4114
+ setProjectId(e) {
4115
+ this.activeProjectId !== e && (this.activeProjectId = e, this.registered && (this.unregister(), this.register()));
4116
+ }
4117
+ };
4118
+ function mt(e, t) {
4119
+ return new pt(e, t);
685
4120
  }
686
4121
  //#endregion
687
4122
  //#region src/index.ts
688
- function g(t) {
4123
+ function ht(t) {
689
4124
  return new e(t);
690
4125
  }
691
4126
  //#endregion
692
- export { u as AttachmentState, c as CommentState, m as DeliverableState, n as ProjectState, f as TaskActivityState, i as TaskState, o as WorkflowState, d as createAttachmentState, l as createCommentState, g as createCriticalPathClient, h as createDeliverableState, r as createProjectState, p as createTaskActivityState, a as createTaskState, s as createWorkflowState };
4127
+ export { ne as AttachmentState, ee as CommentState, oe as DeliverableState, ce as DeliverableSummaryState, ue as KanbanState, r as ProjectState, ie as TaskActivityState, a as TaskState, fe as TaskTransitionsState, pt as WebMcpState, s as WorkflowState, re as createAttachmentState, te as createCommentState, ht as createCriticalPathClient, se as createDeliverableState, le as createDeliverableSummaryState, de as createKanbanState, i as createProjectState, ae as createTaskActivityState, o as createTaskState, pe as createTaskTransitionsState, mt as createWebMcpState, c as createWorkflowState };