@embeddable.com/sdk-core 4.1.10-next.0 → 4.1.11-next.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/lib/index.esm.js CHANGED
@@ -59,7 +59,7 @@ var findFiles = async (initialSrcDir, regex) => {
59
59
 
60
60
  var util$2;
61
61
  (function (util) {
62
- util.assertEqual = (val) => val;
62
+ util.assertEqual = (_) => { };
63
63
  function assertIs(_arg) { }
64
64
  util.assertIs = assertIs;
65
65
  function assertNever(_x) {
@@ -106,11 +106,9 @@ var util$2;
106
106
  };
107
107
  util.isInteger = typeof Number.isInteger === "function"
108
108
  ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
109
- : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
109
+ : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
110
110
  function joinValues(array, separator = " | ") {
111
- return array
112
- .map((val) => (typeof val === "string" ? `'${val}'` : val))
113
- .join(separator);
111
+ return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
114
112
  }
115
113
  util.joinValues = joinValues;
116
114
  util.jsonStringifyReplacer = (_, value) => {
@@ -262,8 +260,9 @@ let ZodError$1 = class ZodError extends Error {
262
260
  const formErrors = [];
263
261
  for (const sub of this.issues) {
264
262
  if (sub.path.length > 0) {
265
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
266
- fieldErrors[sub.path[0]].push(mapper(sub));
263
+ const firstEl = sub.path[0];
264
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
265
+ fieldErrors[firstEl].push(mapper(sub));
267
266
  }
268
267
  else {
269
268
  formErrors.push(mapper(sub));
@@ -279,56 +278,6 @@ ZodError$1.create = (issues) => {
279
278
  const error = new ZodError$1(issues);
280
279
  return error;
281
280
  };
282
-
283
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
284
- var e = new Error(message);
285
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
286
- };
287
-
288
- var errorUtil$1;
289
- (function (errorUtil) {
290
- errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
291
- errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
292
- })(errorUtil$1 || (errorUtil$1 = {}));
293
- var ZodFirstPartyTypeKind$1;
294
- (function (ZodFirstPartyTypeKind) {
295
- ZodFirstPartyTypeKind["ZodString"] = "ZodString";
296
- ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
297
- ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
298
- ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
299
- ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
300
- ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
301
- ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
302
- ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
303
- ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
304
- ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
305
- ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
306
- ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
307
- ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
308
- ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
309
- ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
310
- ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
311
- ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
312
- ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
313
- ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
314
- ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
315
- ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
316
- ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
317
- ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
318
- ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
319
- ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
320
- ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
321
- ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
322
- ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
323
- ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
324
- ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
325
- ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
326
- ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
327
- ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
328
- ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
329
- ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
330
- ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
331
- })(ZodFirstPartyTypeKind$1 || (ZodFirstPartyTypeKind$1 = {}));
332
281
 
333
282
  const errorFormatter = (issues) => {
334
283
  const errors = [];
@@ -1058,7 +1007,7 @@ async function moveBuildTOBuildDir(ctx) {
1058
1007
 
1059
1008
  var util$1;
1060
1009
  (function (util) {
1061
- util.assertEqual = (val) => val;
1010
+ util.assertEqual = (_) => { };
1062
1011
  function assertIs(_arg) { }
1063
1012
  util.assertIs = assertIs;
1064
1013
  function assertNever(_x) {
@@ -1105,11 +1054,9 @@ var util$1;
1105
1054
  };
1106
1055
  util.isInteger = typeof Number.isInteger === "function"
1107
1056
  ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
1108
- : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
1057
+ : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
1109
1058
  function joinValues(array, separator = " | ") {
1110
- return array
1111
- .map((val) => (typeof val === "string" ? `'${val}'` : val))
1112
- .join(separator);
1059
+ return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
1113
1060
  }
1114
1061
  util.joinValues = joinValues;
1115
1062
  util.jsonStringifyReplacer = (_, value) => {
@@ -1158,7 +1105,7 @@ const getParsedType = (data) => {
1158
1105
  case "string":
1159
1106
  return ZodParsedType.string;
1160
1107
  case "number":
1161
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1108
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1162
1109
  case "boolean":
1163
1110
  return ZodParsedType.boolean;
1164
1111
  case "function":
@@ -1174,10 +1121,7 @@ const getParsedType = (data) => {
1174
1121
  if (data === null) {
1175
1122
  return ZodParsedType.null;
1176
1123
  }
1177
- if (data.then &&
1178
- typeof data.then === "function" &&
1179
- data.catch &&
1180
- typeof data.catch === "function") {
1124
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
1181
1125
  return ZodParsedType.promise;
1182
1126
  }
1183
1127
  if (typeof Map !== "undefined" && data instanceof Map) {
@@ -1213,10 +1157,6 @@ const ZodIssueCode = util$1.arrayToEnum([
1213
1157
  "not_multiple_of",
1214
1158
  "not_finite",
1215
1159
  ]);
1216
- const quotelessJson = (obj) => {
1217
- const json = JSON.stringify(obj, null, 2);
1218
- return json.replace(/"([^"]+)":/g, "$1:");
1219
- };
1220
1160
  class ZodError extends Error {
1221
1161
  get errors() {
1222
1162
  return this.issues;
@@ -1309,8 +1249,9 @@ class ZodError extends Error {
1309
1249
  const formErrors = [];
1310
1250
  for (const sub of this.issues) {
1311
1251
  if (sub.path.length > 0) {
1312
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
1313
- fieldErrors[sub.path[0]].push(mapper(sub));
1252
+ const firstEl = sub.path[0];
1253
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
1254
+ fieldErrors[firstEl].push(mapper(sub));
1314
1255
  }
1315
1256
  else {
1316
1257
  formErrors.push(mapper(sub));
@@ -1393,17 +1334,11 @@ const errorMap = (issue, _ctx) => {
1393
1334
  else if (issue.type === "string")
1394
1335
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
1395
1336
  else if (issue.type === "number")
1396
- message = `Number must be ${issue.exact
1397
- ? `exactly equal to `
1398
- : issue.inclusive
1399
- ? `greater than or equal to `
1400
- : `greater than `}${issue.minimum}`;
1337
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
1338
+ else if (issue.type === "bigint")
1339
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
1401
1340
  else if (issue.type === "date")
1402
- message = `Date must be ${issue.exact
1403
- ? `exactly equal to `
1404
- : issue.inclusive
1405
- ? `greater than or equal to `
1406
- : `greater than `}${new Date(Number(issue.minimum))}`;
1341
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
1407
1342
  else
1408
1343
  message = "Invalid input";
1409
1344
  break;
@@ -1413,23 +1348,11 @@ const errorMap = (issue, _ctx) => {
1413
1348
  else if (issue.type === "string")
1414
1349
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
1415
1350
  else if (issue.type === "number")
1416
- message = `Number must be ${issue.exact
1417
- ? `exactly`
1418
- : issue.inclusive
1419
- ? `less than or equal to`
1420
- : `less than`} ${issue.maximum}`;
1351
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1421
1352
  else if (issue.type === "bigint")
1422
- message = `BigInt must be ${issue.exact
1423
- ? `exactly`
1424
- : issue.inclusive
1425
- ? `less than or equal to`
1426
- : `less than`} ${issue.maximum}`;
1353
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1427
1354
  else if (issue.type === "date")
1428
- message = `Date must be ${issue.exact
1429
- ? `exactly`
1430
- : issue.inclusive
1431
- ? `smaller than or equal to`
1432
- : `smaller than`} ${new Date(Number(issue.maximum))}`;
1355
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
1433
1356
  else
1434
1357
  message = "Invalid input";
1435
1358
  break;
@@ -1453,9 +1376,6 @@ const errorMap = (issue, _ctx) => {
1453
1376
  };
1454
1377
 
1455
1378
  let overrideErrorMap = errorMap;
1456
- function setErrorMap(map) {
1457
- overrideErrorMap = map;
1458
- }
1459
1379
  function getErrorMap() {
1460
1380
  return overrideErrorMap;
1461
1381
  }
@@ -1488,7 +1408,6 @@ const makeIssue = (params) => {
1488
1408
  message: errorMessage,
1489
1409
  };
1490
1410
  };
1491
- const EMPTY_PATH = [];
1492
1411
  function addIssueToContext(ctx, issueData) {
1493
1412
  const overrideMap = getErrorMap();
1494
1413
  const issue = makeIssue({
@@ -1551,8 +1470,7 @@ class ParseStatus {
1551
1470
  status.dirty();
1552
1471
  if (value.status === "dirty")
1553
1472
  status.dirty();
1554
- if (key.value !== "__proto__" &&
1555
- (typeof value.value !== "undefined" || pair.alwaysSet)) {
1473
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
1556
1474
  finalObject[key.value] = value.value;
1557
1475
  }
1558
1476
  }
@@ -1569,43 +1487,13 @@ const isDirty = (x) => x.status === "dirty";
1569
1487
  const isValid = (x) => x.status === "valid";
1570
1488
  const isAsync$1 = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1571
1489
 
1572
- /******************************************************************************
1573
- Copyright (c) Microsoft Corporation.
1574
-
1575
- Permission to use, copy, modify, and/or distribute this software for any
1576
- purpose with or without fee is hereby granted.
1577
-
1578
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1579
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1580
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1581
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1582
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1583
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1584
- PERFORMANCE OF THIS SOFTWARE.
1585
- ***************************************************************************** */
1586
-
1587
- function __classPrivateFieldGet(receiver, state, kind, f) {
1588
- if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1589
- return state.get(receiver);
1590
- }
1591
-
1592
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
1593
- if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1594
- return (state.set(receiver, value)), value;
1595
- }
1596
-
1597
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1598
- var e = new Error(message);
1599
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1600
- };
1601
-
1602
1490
  var errorUtil;
1603
1491
  (function (errorUtil) {
1604
1492
  errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1605
- errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1493
+ // biome-ignore lint:
1494
+ errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
1606
1495
  })(errorUtil || (errorUtil = {}));
1607
1496
 
1608
- var _ZodEnum_cache, _ZodNativeEnum_cache;
1609
1497
  class ParseInputLazyPath {
1610
1498
  constructor(parent, value, path, key) {
1611
1499
  this._cachedPath = [];
@@ -1616,7 +1504,7 @@ class ParseInputLazyPath {
1616
1504
  }
1617
1505
  get path() {
1618
1506
  if (!this._cachedPath.length) {
1619
- if (this._key instanceof Array) {
1507
+ if (Array.isArray(this._key)) {
1620
1508
  this._cachedPath.push(...this._path, ...this._key);
1621
1509
  }
1622
1510
  else {
@@ -1656,17 +1544,16 @@ function processCreateParams(params) {
1656
1544
  if (errorMap)
1657
1545
  return { errorMap: errorMap, description };
1658
1546
  const customMap = (iss, ctx) => {
1659
- var _a, _b;
1660
1547
  const { message } = params;
1661
1548
  if (iss.code === "invalid_enum_value") {
1662
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
1549
+ return { message: message ?? ctx.defaultError };
1663
1550
  }
1664
1551
  if (typeof ctx.data === "undefined") {
1665
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
1552
+ return { message: message ?? required_error ?? ctx.defaultError };
1666
1553
  }
1667
1554
  if (iss.code !== "invalid_type")
1668
1555
  return { message: ctx.defaultError };
1669
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1556
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
1670
1557
  };
1671
1558
  return { errorMap: customMap, description };
1672
1559
  }
@@ -1718,14 +1605,13 @@ class ZodType {
1718
1605
  throw result.error;
1719
1606
  }
1720
1607
  safeParse(data, params) {
1721
- var _a;
1722
1608
  const ctx = {
1723
1609
  common: {
1724
1610
  issues: [],
1725
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1726
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1611
+ async: params?.async ?? false,
1612
+ contextualErrorMap: params?.errorMap,
1727
1613
  },
1728
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1614
+ path: params?.path || [],
1729
1615
  schemaErrorMap: this._def.errorMap,
1730
1616
  parent: null,
1731
1617
  data,
@@ -1735,7 +1621,6 @@ class ZodType {
1735
1621
  return handleResult(ctx, result);
1736
1622
  }
1737
1623
  "~validate"(data) {
1738
- var _a, _b;
1739
1624
  const ctx = {
1740
1625
  common: {
1741
1626
  issues: [],
@@ -1759,7 +1644,7 @@ class ZodType {
1759
1644
  };
1760
1645
  }
1761
1646
  catch (err) {
1762
- if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
1647
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
1763
1648
  this["~standard"].async = true;
1764
1649
  }
1765
1650
  ctx.common = {
@@ -1786,19 +1671,17 @@ class ZodType {
1786
1671
  const ctx = {
1787
1672
  common: {
1788
1673
  issues: [],
1789
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1674
+ contextualErrorMap: params?.errorMap,
1790
1675
  async: true,
1791
1676
  },
1792
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1677
+ path: params?.path || [],
1793
1678
  schemaErrorMap: this._def.errorMap,
1794
1679
  parent: null,
1795
1680
  data,
1796
1681
  parsedType: getParsedType(data),
1797
1682
  };
1798
1683
  const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
1799
- const result = await (isAsync$1(maybeAsyncResult)
1800
- ? maybeAsyncResult
1801
- : Promise.resolve(maybeAsyncResult));
1684
+ const result = await (isAsync$1(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
1802
1685
  return handleResult(ctx, result);
1803
1686
  }
1804
1687
  refine(check, message) {
@@ -1842,9 +1725,7 @@ class ZodType {
1842
1725
  refinement(check, refinementData) {
1843
1726
  return this._refinement((val, ctx) => {
1844
1727
  if (!check(val)) {
1845
- ctx.addIssue(typeof refinementData === "function"
1846
- ? refinementData(val, ctx)
1847
- : refinementData);
1728
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
1848
1729
  return false;
1849
1730
  }
1850
1731
  else {
@@ -2016,15 +1897,15 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
2016
1897
  const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
2017
1898
  const dateRegex = new RegExp(`^${dateRegexSource}$`);
2018
1899
  function timeRegexSource(args) {
2019
- // let regex = `\\d{2}:\\d{2}:\\d{2}`;
2020
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
1900
+ let secondsRegexSource = `[0-5]\\d`;
2021
1901
  if (args.precision) {
2022
- regex = `${regex}\\.\\d{${args.precision}}`;
1902
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
2023
1903
  }
2024
1904
  else if (args.precision == null) {
2025
- regex = `${regex}(\\.\\d+)?`;
1905
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
2026
1906
  }
2027
- return regex;
1907
+ const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
1908
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
2028
1909
  }
2029
1910
  function timeRegex(args) {
2030
1911
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -2053,6 +1934,8 @@ function isValidJWT(jwt, alg) {
2053
1934
  return false;
2054
1935
  try {
2055
1936
  const [header] = jwt.split(".");
1937
+ if (!header)
1938
+ return false;
2056
1939
  // Convert base64url to base64
2057
1940
  const base64 = header
2058
1941
  .replace(/-/g, "+")
@@ -2061,13 +1944,15 @@ function isValidJWT(jwt, alg) {
2061
1944
  const decoded = JSON.parse(atob(base64));
2062
1945
  if (typeof decoded !== "object" || decoded === null)
2063
1946
  return false;
2064
- if (!decoded.typ || !decoded.alg)
1947
+ if ("typ" in decoded && decoded?.typ !== "JWT")
1948
+ return false;
1949
+ if (!decoded.alg)
2065
1950
  return false;
2066
1951
  if (alg && decoded.alg !== alg)
2067
1952
  return false;
2068
1953
  return true;
2069
1954
  }
2070
- catch (_a) {
1955
+ catch {
2071
1956
  return false;
2072
1957
  }
2073
1958
  }
@@ -2238,7 +2123,7 @@ class ZodString extends ZodType {
2238
2123
  try {
2239
2124
  new URL(input.data);
2240
2125
  }
2241
- catch (_a) {
2126
+ catch {
2242
2127
  ctx = this._getOrReturnCtx(input, ctx);
2243
2128
  addIssueToContext(ctx, {
2244
2129
  validation: "url",
@@ -2468,7 +2353,6 @@ class ZodString extends ZodType {
2468
2353
  return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2469
2354
  }
2470
2355
  datetime(options) {
2471
- var _a, _b;
2472
2356
  if (typeof options === "string") {
2473
2357
  return this._addCheck({
2474
2358
  kind: "datetime",
@@ -2480,10 +2364,10 @@ class ZodString extends ZodType {
2480
2364
  }
2481
2365
  return this._addCheck({
2482
2366
  kind: "datetime",
2483
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2484
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2485
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
2486
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
2367
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
2368
+ offset: options?.offset ?? false,
2369
+ local: options?.local ?? false,
2370
+ ...errorUtil.errToObj(options?.message),
2487
2371
  });
2488
2372
  }
2489
2373
  date(message) {
@@ -2499,8 +2383,8 @@ class ZodString extends ZodType {
2499
2383
  }
2500
2384
  return this._addCheck({
2501
2385
  kind: "time",
2502
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2503
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
2386
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
2387
+ ...errorUtil.errToObj(options?.message),
2504
2388
  });
2505
2389
  }
2506
2390
  duration(message) {
@@ -2517,8 +2401,8 @@ class ZodString extends ZodType {
2517
2401
  return this._addCheck({
2518
2402
  kind: "includes",
2519
2403
  value: value,
2520
- position: options === null || options === void 0 ? void 0 : options.position,
2521
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
2404
+ position: options?.position,
2405
+ ...errorUtil.errToObj(options?.message),
2522
2406
  });
2523
2407
  }
2524
2408
  startsWith(value, message) {
@@ -2651,11 +2535,10 @@ class ZodString extends ZodType {
2651
2535
  }
2652
2536
  }
2653
2537
  ZodString.create = (params) => {
2654
- var _a;
2655
2538
  return new ZodString({
2656
2539
  checks: [],
2657
2540
  typeName: ZodFirstPartyTypeKind.ZodString,
2658
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2541
+ coerce: params?.coerce ?? false,
2659
2542
  ...processCreateParams(params),
2660
2543
  });
2661
2544
  };
@@ -2664,9 +2547,9 @@ function floatSafeRemainder(val, step) {
2664
2547
  const valDecCount = (val.toString().split(".")[1] || "").length;
2665
2548
  const stepDecCount = (step.toString().split(".")[1] || "").length;
2666
2549
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
2667
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
2668
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
2669
- return (valInt % stepInt) / Math.pow(10, decCount);
2550
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
2551
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
2552
+ return (valInt % stepInt) / 10 ** decCount;
2670
2553
  }
2671
2554
  class ZodNumber extends ZodType {
2672
2555
  constructor() {
@@ -2705,9 +2588,7 @@ class ZodNumber extends ZodType {
2705
2588
  }
2706
2589
  }
2707
2590
  else if (check.kind === "min") {
2708
- const tooSmall = check.inclusive
2709
- ? input.data < check.value
2710
- : input.data <= check.value;
2591
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2711
2592
  if (tooSmall) {
2712
2593
  ctx = this._getOrReturnCtx(input, ctx);
2713
2594
  addIssueToContext(ctx, {
@@ -2722,9 +2603,7 @@ class ZodNumber extends ZodType {
2722
2603
  }
2723
2604
  }
2724
2605
  else if (check.kind === "max") {
2725
- const tooBig = check.inclusive
2726
- ? input.data > check.value
2727
- : input.data >= check.value;
2606
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2728
2607
  if (tooBig) {
2729
2608
  ctx = this._getOrReturnCtx(input, ctx);
2730
2609
  addIssueToContext(ctx, {
@@ -2882,15 +2761,13 @@ class ZodNumber extends ZodType {
2882
2761
  return max;
2883
2762
  }
2884
2763
  get isInt() {
2885
- return !!this._def.checks.find((ch) => ch.kind === "int" ||
2886
- (ch.kind === "multipleOf" && util$1.isInteger(ch.value)));
2764
+ return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util$1.isInteger(ch.value)));
2887
2765
  }
2888
2766
  get isFinite() {
2889
- let max = null, min = null;
2767
+ let max = null;
2768
+ let min = null;
2890
2769
  for (const ch of this._def.checks) {
2891
- if (ch.kind === "finite" ||
2892
- ch.kind === "int" ||
2893
- ch.kind === "multipleOf") {
2770
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2894
2771
  return true;
2895
2772
  }
2896
2773
  else if (ch.kind === "min") {
@@ -2909,7 +2786,7 @@ ZodNumber.create = (params) => {
2909
2786
  return new ZodNumber({
2910
2787
  checks: [],
2911
2788
  typeName: ZodFirstPartyTypeKind.ZodNumber,
2912
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2789
+ coerce: params?.coerce || false,
2913
2790
  ...processCreateParams(params),
2914
2791
  });
2915
2792
  };
@@ -2924,7 +2801,7 @@ class ZodBigInt extends ZodType {
2924
2801
  try {
2925
2802
  input.data = BigInt(input.data);
2926
2803
  }
2927
- catch (_a) {
2804
+ catch {
2928
2805
  return this._getInvalidInput(input);
2929
2806
  }
2930
2807
  }
@@ -2936,9 +2813,7 @@ class ZodBigInt extends ZodType {
2936
2813
  const status = new ParseStatus();
2937
2814
  for (const check of this._def.checks) {
2938
2815
  if (check.kind === "min") {
2939
- const tooSmall = check.inclusive
2940
- ? input.data < check.value
2941
- : input.data <= check.value;
2816
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2942
2817
  if (tooSmall) {
2943
2818
  ctx = this._getOrReturnCtx(input, ctx);
2944
2819
  addIssueToContext(ctx, {
@@ -2952,9 +2827,7 @@ class ZodBigInt extends ZodType {
2952
2827
  }
2953
2828
  }
2954
2829
  else if (check.kind === "max") {
2955
- const tooBig = check.inclusive
2956
- ? input.data > check.value
2957
- : input.data >= check.value;
2830
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2958
2831
  if (tooBig) {
2959
2832
  ctx = this._getOrReturnCtx(input, ctx);
2960
2833
  addIssueToContext(ctx, {
@@ -3086,11 +2959,10 @@ class ZodBigInt extends ZodType {
3086
2959
  }
3087
2960
  }
3088
2961
  ZodBigInt.create = (params) => {
3089
- var _a;
3090
2962
  return new ZodBigInt({
3091
2963
  checks: [],
3092
2964
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
3093
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2965
+ coerce: params?.coerce ?? false,
3094
2966
  ...processCreateParams(params),
3095
2967
  });
3096
2968
  };
@@ -3115,7 +2987,7 @@ class ZodBoolean extends ZodType {
3115
2987
  ZodBoolean.create = (params) => {
3116
2988
  return new ZodBoolean({
3117
2989
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
3118
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2990
+ coerce: params?.coerce || false,
3119
2991
  ...processCreateParams(params),
3120
2992
  });
3121
2993
  };
@@ -3134,7 +3006,7 @@ class ZodDate extends ZodType {
3134
3006
  });
3135
3007
  return INVALID;
3136
3008
  }
3137
- if (isNaN(input.data.getTime())) {
3009
+ if (Number.isNaN(input.data.getTime())) {
3138
3010
  const ctx = this._getOrReturnCtx(input);
3139
3011
  addIssueToContext(ctx, {
3140
3012
  code: ZodIssueCode.invalid_date,
@@ -3225,7 +3097,7 @@ class ZodDate extends ZodType {
3225
3097
  ZodDate.create = (params) => {
3226
3098
  return new ZodDate({
3227
3099
  checks: [],
3228
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
3100
+ coerce: params?.coerce || false,
3229
3101
  typeName: ZodFirstPartyTypeKind.ZodDate,
3230
3102
  ...processCreateParams(params),
3231
3103
  });
@@ -3547,7 +3419,8 @@ class ZodObject extends ZodType {
3547
3419
  return this._cached;
3548
3420
  const shape = this._def.shape();
3549
3421
  const keys = util$1.objectKeys(shape);
3550
- return (this._cached = { shape, keys });
3422
+ this._cached = { shape, keys };
3423
+ return this._cached;
3551
3424
  }
3552
3425
  _parse(input) {
3553
3426
  const parsedType = this._getType(input);
@@ -3563,8 +3436,7 @@ class ZodObject extends ZodType {
3563
3436
  const { status, ctx } = this._processInputParams(input);
3564
3437
  const { shape, keys: shapeKeys } = this._getCached();
3565
3438
  const extraKeys = [];
3566
- if (!(this._def.catchall instanceof ZodNever &&
3567
- this._def.unknownKeys === "strip")) {
3439
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
3568
3440
  for (const key in ctx.data) {
3569
3441
  if (!shapeKeys.includes(key)) {
3570
3442
  extraKeys.push(key);
@@ -3652,11 +3524,10 @@ class ZodObject extends ZodType {
3652
3524
  ...(message !== undefined
3653
3525
  ? {
3654
3526
  errorMap: (issue, ctx) => {
3655
- var _a, _b, _c, _d;
3656
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
3527
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
3657
3528
  if (issue.code === "unrecognized_keys")
3658
3529
  return {
3659
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
3530
+ message: errorUtil.errToObj(message).message ?? defaultError,
3660
3531
  };
3661
3532
  return {
3662
3533
  message: defaultError,
@@ -3788,11 +3659,11 @@ class ZodObject extends ZodType {
3788
3659
  }
3789
3660
  pick(mask) {
3790
3661
  const shape = {};
3791
- util$1.objectKeys(mask).forEach((key) => {
3662
+ for (const key of util$1.objectKeys(mask)) {
3792
3663
  if (mask[key] && this.shape[key]) {
3793
3664
  shape[key] = this.shape[key];
3794
3665
  }
3795
- });
3666
+ }
3796
3667
  return new ZodObject({
3797
3668
  ...this._def,
3798
3669
  shape: () => shape,
@@ -3800,11 +3671,11 @@ class ZodObject extends ZodType {
3800
3671
  }
3801
3672
  omit(mask) {
3802
3673
  const shape = {};
3803
- util$1.objectKeys(this.shape).forEach((key) => {
3674
+ for (const key of util$1.objectKeys(this.shape)) {
3804
3675
  if (!mask[key]) {
3805
3676
  shape[key] = this.shape[key];
3806
3677
  }
3807
- });
3678
+ }
3808
3679
  return new ZodObject({
3809
3680
  ...this._def,
3810
3681
  shape: () => shape,
@@ -3818,7 +3689,7 @@ class ZodObject extends ZodType {
3818
3689
  }
3819
3690
  partial(mask) {
3820
3691
  const newShape = {};
3821
- util$1.objectKeys(this.shape).forEach((key) => {
3692
+ for (const key of util$1.objectKeys(this.shape)) {
3822
3693
  const fieldSchema = this.shape[key];
3823
3694
  if (mask && !mask[key]) {
3824
3695
  newShape[key] = fieldSchema;
@@ -3826,7 +3697,7 @@ class ZodObject extends ZodType {
3826
3697
  else {
3827
3698
  newShape[key] = fieldSchema.optional();
3828
3699
  }
3829
- });
3700
+ }
3830
3701
  return new ZodObject({
3831
3702
  ...this._def,
3832
3703
  shape: () => newShape,
@@ -3834,7 +3705,7 @@ class ZodObject extends ZodType {
3834
3705
  }
3835
3706
  required(mask) {
3836
3707
  const newShape = {};
3837
- util$1.objectKeys(this.shape).forEach((key) => {
3708
+ for (const key of util$1.objectKeys(this.shape)) {
3838
3709
  if (mask && !mask[key]) {
3839
3710
  newShape[key] = this.shape[key];
3840
3711
  }
@@ -3846,7 +3717,7 @@ class ZodObject extends ZodType {
3846
3717
  }
3847
3718
  newShape[key] = newField;
3848
3719
  }
3849
- });
3720
+ }
3850
3721
  return new ZodObject({
3851
3722
  ...this._def,
3852
3723
  shape: () => newShape,
@@ -3979,137 +3850,6 @@ ZodUnion.create = (types, params) => {
3979
3850
  ...processCreateParams(params),
3980
3851
  });
3981
3852
  };
3982
- /////////////////////////////////////////////////////
3983
- /////////////////////////////////////////////////////
3984
- ////////// //////////
3985
- ////////// ZodDiscriminatedUnion //////////
3986
- ////////// //////////
3987
- /////////////////////////////////////////////////////
3988
- /////////////////////////////////////////////////////
3989
- const getDiscriminator = (type) => {
3990
- if (type instanceof ZodLazy) {
3991
- return getDiscriminator(type.schema);
3992
- }
3993
- else if (type instanceof ZodEffects) {
3994
- return getDiscriminator(type.innerType());
3995
- }
3996
- else if (type instanceof ZodLiteral) {
3997
- return [type.value];
3998
- }
3999
- else if (type instanceof ZodEnum) {
4000
- return type.options;
4001
- }
4002
- else if (type instanceof ZodNativeEnum) {
4003
- // eslint-disable-next-line ban/ban
4004
- return util$1.objectValues(type.enum);
4005
- }
4006
- else if (type instanceof ZodDefault) {
4007
- return getDiscriminator(type._def.innerType);
4008
- }
4009
- else if (type instanceof ZodUndefined) {
4010
- return [undefined];
4011
- }
4012
- else if (type instanceof ZodNull) {
4013
- return [null];
4014
- }
4015
- else if (type instanceof ZodOptional) {
4016
- return [undefined, ...getDiscriminator(type.unwrap())];
4017
- }
4018
- else if (type instanceof ZodNullable) {
4019
- return [null, ...getDiscriminator(type.unwrap())];
4020
- }
4021
- else if (type instanceof ZodBranded) {
4022
- return getDiscriminator(type.unwrap());
4023
- }
4024
- else if (type instanceof ZodReadonly) {
4025
- return getDiscriminator(type.unwrap());
4026
- }
4027
- else if (type instanceof ZodCatch) {
4028
- return getDiscriminator(type._def.innerType);
4029
- }
4030
- else {
4031
- return [];
4032
- }
4033
- };
4034
- class ZodDiscriminatedUnion extends ZodType {
4035
- _parse(input) {
4036
- const { ctx } = this._processInputParams(input);
4037
- if (ctx.parsedType !== ZodParsedType.object) {
4038
- addIssueToContext(ctx, {
4039
- code: ZodIssueCode.invalid_type,
4040
- expected: ZodParsedType.object,
4041
- received: ctx.parsedType,
4042
- });
4043
- return INVALID;
4044
- }
4045
- const discriminator = this.discriminator;
4046
- const discriminatorValue = ctx.data[discriminator];
4047
- const option = this.optionsMap.get(discriminatorValue);
4048
- if (!option) {
4049
- addIssueToContext(ctx, {
4050
- code: ZodIssueCode.invalid_union_discriminator,
4051
- options: Array.from(this.optionsMap.keys()),
4052
- path: [discriminator],
4053
- });
4054
- return INVALID;
4055
- }
4056
- if (ctx.common.async) {
4057
- return option._parseAsync({
4058
- data: ctx.data,
4059
- path: ctx.path,
4060
- parent: ctx,
4061
- });
4062
- }
4063
- else {
4064
- return option._parseSync({
4065
- data: ctx.data,
4066
- path: ctx.path,
4067
- parent: ctx,
4068
- });
4069
- }
4070
- }
4071
- get discriminator() {
4072
- return this._def.discriminator;
4073
- }
4074
- get options() {
4075
- return this._def.options;
4076
- }
4077
- get optionsMap() {
4078
- return this._def.optionsMap;
4079
- }
4080
- /**
4081
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
4082
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
4083
- * have a different value for each object in the union.
4084
- * @param discriminator the name of the discriminator property
4085
- * @param types an array of object schemas
4086
- * @param params
4087
- */
4088
- static create(discriminator, options, params) {
4089
- // Get all the valid discriminator values
4090
- const optionsMap = new Map();
4091
- // try {
4092
- for (const type of options) {
4093
- const discriminatorValues = getDiscriminator(type.shape[discriminator]);
4094
- if (!discriminatorValues.length) {
4095
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
4096
- }
4097
- for (const value of discriminatorValues) {
4098
- if (optionsMap.has(value)) {
4099
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
4100
- }
4101
- optionsMap.set(value, type);
4102
- }
4103
- }
4104
- return new ZodDiscriminatedUnion({
4105
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
4106
- discriminator,
4107
- options,
4108
- optionsMap,
4109
- ...processCreateParams(params),
4110
- });
4111
- }
4112
- }
4113
3853
  function mergeValues(a, b) {
4114
3854
  const aType = getParsedType(a);
4115
3855
  const bType = getParsedType(b);
@@ -4118,9 +3858,7 @@ function mergeValues(a, b) {
4118
3858
  }
4119
3859
  else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
4120
3860
  const bKeys = util$1.objectKeys(b);
4121
- const sharedKeys = util$1
4122
- .objectKeys(a)
4123
- .filter((key) => bKeys.indexOf(key) !== -1);
3861
+ const sharedKeys = util$1.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
4124
3862
  const newObj = { ...a, ...b };
4125
3863
  for (const key of sharedKeys) {
4126
3864
  const sharedValue = mergeValues(a[key], b[key]);
@@ -4147,9 +3885,7 @@ function mergeValues(a, b) {
4147
3885
  }
4148
3886
  return { valid: true, data: newArray };
4149
3887
  }
4150
- else if (aType === ZodParsedType.date &&
4151
- bType === ZodParsedType.date &&
4152
- +a === +b) {
3888
+ else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
4153
3889
  return { valid: true, data: a };
4154
3890
  }
4155
3891
  else {
@@ -4210,6 +3946,7 @@ ZodIntersection.create = (left, right, params) => {
4210
3946
  ...processCreateParams(params),
4211
3947
  });
4212
3948
  };
3949
+ // type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
4213
3950
  class ZodTuple extends ZodType {
4214
3951
  _parse(input) {
4215
3952
  const { status, ctx } = this._processInputParams(input);
@@ -4506,12 +4243,7 @@ class ZodFunction extends ZodType {
4506
4243
  return makeIssue({
4507
4244
  data: args,
4508
4245
  path: ctx.path,
4509
- errorMaps: [
4510
- ctx.common.contextualErrorMap,
4511
- ctx.schemaErrorMap,
4512
- getErrorMap(),
4513
- errorMap,
4514
- ].filter((x) => !!x),
4246
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), errorMap].filter((x) => !!x),
4515
4247
  issueData: {
4516
4248
  code: ZodIssueCode.invalid_arguments,
4517
4249
  argumentsError: error,
@@ -4522,12 +4254,7 @@ class ZodFunction extends ZodType {
4522
4254
  return makeIssue({
4523
4255
  data: returns,
4524
4256
  path: ctx.path,
4525
- errorMaps: [
4526
- ctx.common.contextualErrorMap,
4527
- ctx.schemaErrorMap,
4528
- getErrorMap(),
4529
- errorMap,
4530
- ].filter((x) => !!x),
4257
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), errorMap].filter((x) => !!x),
4531
4258
  issueData: {
4532
4259
  code: ZodIssueCode.invalid_return_type,
4533
4260
  returnTypeError: error,
@@ -4543,9 +4270,7 @@ class ZodFunction extends ZodType {
4543
4270
  const me = this;
4544
4271
  return OK(async function (...args) {
4545
4272
  const error = new ZodError([]);
4546
- const parsedArgs = await me._def.args
4547
- .parseAsync(args, params)
4548
- .catch((e) => {
4273
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
4549
4274
  error.addIssue(makeArgsIssue(args, e));
4550
4275
  throw error;
4551
4276
  });
@@ -4606,9 +4331,7 @@ class ZodFunction extends ZodType {
4606
4331
  }
4607
4332
  static create(args, returns, params) {
4608
4333
  return new ZodFunction({
4609
- args: (args
4610
- ? args
4611
- : ZodTuple.create([]).rest(ZodUnknown.create())),
4334
+ args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
4612
4335
  returns: returns || ZodUnknown.create(),
4613
4336
  typeName: ZodFirstPartyTypeKind.ZodFunction,
4614
4337
  ...processCreateParams(params),
@@ -4664,10 +4387,6 @@ function createZodEnum(values, params) {
4664
4387
  });
4665
4388
  }
4666
4389
  class ZodEnum extends ZodType {
4667
- constructor() {
4668
- super(...arguments);
4669
- _ZodEnum_cache.set(this, void 0);
4670
- }
4671
4390
  _parse(input) {
4672
4391
  if (typeof input.data !== "string") {
4673
4392
  const ctx = this._getOrReturnCtx(input);
@@ -4679,10 +4398,10 @@ class ZodEnum extends ZodType {
4679
4398
  });
4680
4399
  return INVALID;
4681
4400
  }
4682
- if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
4683
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
4401
+ if (!this._cache) {
4402
+ this._cache = new Set(this._def.values);
4684
4403
  }
4685
- if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
4404
+ if (!this._cache.has(input.data)) {
4686
4405
  const ctx = this._getOrReturnCtx(input);
4687
4406
  const expectedValues = this._def.values;
4688
4407
  addIssueToContext(ctx, {
@@ -4731,18 +4450,12 @@ class ZodEnum extends ZodType {
4731
4450
  });
4732
4451
  }
4733
4452
  }
4734
- _ZodEnum_cache = new WeakMap();
4735
4453
  ZodEnum.create = createZodEnum;
4736
4454
  class ZodNativeEnum extends ZodType {
4737
- constructor() {
4738
- super(...arguments);
4739
- _ZodNativeEnum_cache.set(this, void 0);
4740
- }
4741
4455
  _parse(input) {
4742
4456
  const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
4743
4457
  const ctx = this._getOrReturnCtx(input);
4744
- if (ctx.parsedType !== ZodParsedType.string &&
4745
- ctx.parsedType !== ZodParsedType.number) {
4458
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
4746
4459
  const expectedValues = util$1.objectValues(nativeEnumValues);
4747
4460
  addIssueToContext(ctx, {
4748
4461
  expected: util$1.joinValues(expectedValues),
@@ -4751,10 +4464,10 @@ class ZodNativeEnum extends ZodType {
4751
4464
  });
4752
4465
  return INVALID;
4753
4466
  }
4754
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
4755
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util$1.getValidEnumValues(this._def.values)));
4467
+ if (!this._cache) {
4468
+ this._cache = new Set(util$1.getValidEnumValues(this._def.values));
4756
4469
  }
4757
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
4470
+ if (!this._cache.has(input.data)) {
4758
4471
  const expectedValues = util$1.objectValues(nativeEnumValues);
4759
4472
  addIssueToContext(ctx, {
4760
4473
  received: ctx.data,
@@ -4769,7 +4482,6 @@ class ZodNativeEnum extends ZodType {
4769
4482
  return this._def.values;
4770
4483
  }
4771
4484
  }
4772
- _ZodNativeEnum_cache = new WeakMap();
4773
4485
  ZodNativeEnum.create = (values, params) => {
4774
4486
  return new ZodNativeEnum({
4775
4487
  values: values,
@@ -4783,8 +4495,7 @@ class ZodPromise extends ZodType {
4783
4495
  }
4784
4496
  _parse(input) {
4785
4497
  const { ctx } = this._processInputParams(input);
4786
- if (ctx.parsedType !== ZodParsedType.promise &&
4787
- ctx.common.async === false) {
4498
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
4788
4499
  addIssueToContext(ctx, {
4789
4500
  code: ZodIssueCode.invalid_type,
4790
4501
  expected: ZodParsedType.promise,
@@ -4792,9 +4503,7 @@ class ZodPromise extends ZodType {
4792
4503
  });
4793
4504
  return INVALID;
4794
4505
  }
4795
- const promisified = ctx.parsedType === ZodParsedType.promise
4796
- ? ctx.data
4797
- : Promise.resolve(ctx.data);
4506
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
4798
4507
  return OK(promisified.then((data) => {
4799
4508
  return this._def.type.parseAsync(data, {
4800
4509
  path: ctx.path,
@@ -4900,9 +4609,7 @@ class ZodEffects extends ZodType {
4900
4609
  return { status: status.value, value: inner.value };
4901
4610
  }
4902
4611
  else {
4903
- return this._def.schema
4904
- ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
4905
- .then((inner) => {
4612
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
4906
4613
  if (inner.status === "aborted")
4907
4614
  return INVALID;
4908
4615
  if (inner.status === "dirty")
@@ -4921,7 +4628,7 @@ class ZodEffects extends ZodType {
4921
4628
  parent: ctx,
4922
4629
  });
4923
4630
  if (!isValid(base))
4924
- return base;
4631
+ return INVALID;
4925
4632
  const result = effect.transform(base.value, checkCtx);
4926
4633
  if (result instanceof Promise) {
4927
4634
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -4929,12 +4636,13 @@ class ZodEffects extends ZodType {
4929
4636
  return { status: status.value, value: result };
4930
4637
  }
4931
4638
  else {
4932
- return this._def.schema
4933
- ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
4934
- .then((base) => {
4639
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
4935
4640
  if (!isValid(base))
4936
- return base;
4937
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
4641
+ return INVALID;
4642
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
4643
+ status: status.value,
4644
+ value: result,
4645
+ }));
4938
4646
  });
4939
4647
  }
4940
4648
  }
@@ -5016,9 +4724,7 @@ ZodDefault.create = (type, params) => {
5016
4724
  return new ZodDefault({
5017
4725
  innerType: type,
5018
4726
  typeName: ZodFirstPartyTypeKind.ZodDefault,
5019
- defaultValue: typeof params.default === "function"
5020
- ? params.default
5021
- : () => params.default,
4727
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
5022
4728
  ...processCreateParams(params),
5023
4729
  });
5024
4730
  };
@@ -5102,7 +4808,6 @@ ZodNaN.create = (params) => {
5102
4808
  ...processCreateParams(params),
5103
4809
  });
5104
4810
  };
5105
- const BRAND = Symbol("zod_brand");
5106
4811
  class ZodBranded extends ZodType {
5107
4812
  _parse(input) {
5108
4813
  const { ctx } = this._processInputParams(input);
@@ -5184,9 +4889,7 @@ class ZodReadonly extends ZodType {
5184
4889
  }
5185
4890
  return data;
5186
4891
  };
5187
- return isAsync$1(result)
5188
- ? result.then((data) => freeze(data))
5189
- : freeze(result);
4892
+ return isAsync$1(result) ? result.then((data) => freeze(data)) : freeze(result);
5190
4893
  }
5191
4894
  unwrap() {
5192
4895
  return this._def.innerType;
@@ -5199,60 +4902,6 @@ ZodReadonly.create = (type, params) => {
5199
4902
  ...processCreateParams(params),
5200
4903
  });
5201
4904
  };
5202
- ////////////////////////////////////////
5203
- ////////////////////////////////////////
5204
- ////////// //////////
5205
- ////////// z.custom //////////
5206
- ////////// //////////
5207
- ////////////////////////////////////////
5208
- ////////////////////////////////////////
5209
- function cleanParams(params, data) {
5210
- const p = typeof params === "function"
5211
- ? params(data)
5212
- : typeof params === "string"
5213
- ? { message: params }
5214
- : params;
5215
- const p2 = typeof p === "string" ? { message: p } : p;
5216
- return p2;
5217
- }
5218
- function custom(check, _params = {},
5219
- /**
5220
- * @deprecated
5221
- *
5222
- * Pass `fatal` into the params object instead:
5223
- *
5224
- * ```ts
5225
- * z.string().custom((val) => val.length > 5, { fatal: false })
5226
- * ```
5227
- *
5228
- */
5229
- fatal) {
5230
- if (check)
5231
- return ZodAny.create().superRefine((data, ctx) => {
5232
- var _a, _b;
5233
- const r = check(data);
5234
- if (r instanceof Promise) {
5235
- return r.then((r) => {
5236
- var _a, _b;
5237
- if (!r) {
5238
- const params = cleanParams(_params, data);
5239
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
5240
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
5241
- }
5242
- });
5243
- }
5244
- if (!r) {
5245
- const params = cleanParams(_params, data);
5246
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
5247
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
5248
- }
5249
- return;
5250
- });
5251
- return ZodAny.create();
5252
- }
5253
- const late = {
5254
- object: ZodObject.lazycreate,
5255
- };
5256
4905
  var ZodFirstPartyTypeKind;
5257
4906
  (function (ZodFirstPartyTypeKind) {
5258
4907
  ZodFirstPartyTypeKind["ZodString"] = "ZodString";
@@ -5292,170 +4941,23 @@ var ZodFirstPartyTypeKind;
5292
4941
  ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
5293
4942
  ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
5294
4943
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
5295
- const instanceOfType = (
5296
- // const instanceOfType = <T extends new (...args: any[]) => any>(
5297
- cls, params = {
5298
- message: `Input not instance of ${cls.name}`,
5299
- }) => custom((data) => data instanceof cls, params);
5300
4944
  const stringType = ZodString.create;
5301
- const numberType = ZodNumber.create;
5302
- const nanType = ZodNaN.create;
5303
- const bigIntType = ZodBigInt.create;
5304
4945
  const booleanType = ZodBoolean.create;
5305
- const dateType = ZodDate.create;
5306
- const symbolType = ZodSymbol.create;
5307
- const undefinedType = ZodUndefined.create;
5308
- const nullType = ZodNull.create;
5309
4946
  const anyType = ZodAny.create;
5310
- const unknownType = ZodUnknown.create;
5311
- const neverType = ZodNever.create;
5312
- const voidType = ZodVoid.create;
4947
+ ZodUnknown.create;
4948
+ ZodNever.create;
5313
4949
  const arrayType = ZodArray.create;
5314
4950
  const objectType = ZodObject.create;
5315
- const strictObjectType = ZodObject.strictCreate;
5316
4951
  const unionType = ZodUnion.create;
5317
- const discriminatedUnionType = ZodDiscriminatedUnion.create;
5318
- const intersectionType = ZodIntersection.create;
5319
- const tupleType = ZodTuple.create;
4952
+ ZodIntersection.create;
4953
+ ZodTuple.create;
5320
4954
  const recordType = ZodRecord.create;
5321
- const mapType = ZodMap.create;
5322
- const setType = ZodSet.create;
5323
4955
  const functionType = ZodFunction.create;
5324
- const lazyType = ZodLazy.create;
5325
4956
  const literalType = ZodLiteral.create;
5326
4957
  const enumType = ZodEnum.create;
5327
- const nativeEnumType = ZodNativeEnum.create;
5328
- const promiseType = ZodPromise.create;
5329
- const effectsType = ZodEffects.create;
5330
- const optionalType = ZodOptional.create;
5331
- const nullableType = ZodNullable.create;
5332
- const preprocessType = ZodEffects.createWithPreprocess;
5333
- const pipelineType = ZodPipeline.create;
5334
- const ostring = () => stringType().optional();
5335
- const onumber = () => numberType().optional();
5336
- const oboolean = () => booleanType().optional();
5337
- const coerce = {
5338
- string: ((arg) => ZodString.create({ ...arg, coerce: true })),
5339
- number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
5340
- boolean: ((arg) => ZodBoolean.create({
5341
- ...arg,
5342
- coerce: true,
5343
- })),
5344
- bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
5345
- date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
5346
- };
5347
- const NEVER = INVALID;
5348
-
5349
- var z = /*#__PURE__*/Object.freeze({
5350
- __proto__: null,
5351
- defaultErrorMap: errorMap,
5352
- setErrorMap: setErrorMap,
5353
- getErrorMap: getErrorMap,
5354
- makeIssue: makeIssue,
5355
- EMPTY_PATH: EMPTY_PATH,
5356
- addIssueToContext: addIssueToContext,
5357
- ParseStatus: ParseStatus,
5358
- INVALID: INVALID,
5359
- DIRTY: DIRTY,
5360
- OK: OK,
5361
- isAborted: isAborted,
5362
- isDirty: isDirty,
5363
- isValid: isValid,
5364
- isAsync: isAsync$1,
5365
- get util () { return util$1; },
5366
- get objectUtil () { return objectUtil; },
5367
- ZodParsedType: ZodParsedType,
5368
- getParsedType: getParsedType,
5369
- ZodType: ZodType,
5370
- datetimeRegex: datetimeRegex,
5371
- ZodString: ZodString,
5372
- ZodNumber: ZodNumber,
5373
- ZodBigInt: ZodBigInt,
5374
- ZodBoolean: ZodBoolean,
5375
- ZodDate: ZodDate,
5376
- ZodSymbol: ZodSymbol,
5377
- ZodUndefined: ZodUndefined,
5378
- ZodNull: ZodNull,
5379
- ZodAny: ZodAny,
5380
- ZodUnknown: ZodUnknown,
5381
- ZodNever: ZodNever,
5382
- ZodVoid: ZodVoid,
5383
- ZodArray: ZodArray,
5384
- ZodObject: ZodObject,
5385
- ZodUnion: ZodUnion,
5386
- ZodDiscriminatedUnion: ZodDiscriminatedUnion,
5387
- ZodIntersection: ZodIntersection,
5388
- ZodTuple: ZodTuple,
5389
- ZodRecord: ZodRecord,
5390
- ZodMap: ZodMap,
5391
- ZodSet: ZodSet,
5392
- ZodFunction: ZodFunction,
5393
- ZodLazy: ZodLazy,
5394
- ZodLiteral: ZodLiteral,
5395
- ZodEnum: ZodEnum,
5396
- ZodNativeEnum: ZodNativeEnum,
5397
- ZodPromise: ZodPromise,
5398
- ZodEffects: ZodEffects,
5399
- ZodTransformer: ZodEffects,
5400
- ZodOptional: ZodOptional,
5401
- ZodNullable: ZodNullable,
5402
- ZodDefault: ZodDefault,
5403
- ZodCatch: ZodCatch,
5404
- ZodNaN: ZodNaN,
5405
- BRAND: BRAND,
5406
- ZodBranded: ZodBranded,
5407
- ZodPipeline: ZodPipeline,
5408
- ZodReadonly: ZodReadonly,
5409
- custom: custom,
5410
- Schema: ZodType,
5411
- ZodSchema: ZodType,
5412
- late: late,
5413
- get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
5414
- coerce: coerce,
5415
- any: anyType,
5416
- array: arrayType,
5417
- bigint: bigIntType,
5418
- boolean: booleanType,
5419
- date: dateType,
5420
- discriminatedUnion: discriminatedUnionType,
5421
- effect: effectsType,
5422
- 'enum': enumType,
5423
- 'function': functionType,
5424
- 'instanceof': instanceOfType,
5425
- intersection: intersectionType,
5426
- lazy: lazyType,
5427
- literal: literalType,
5428
- map: mapType,
5429
- nan: nanType,
5430
- nativeEnum: nativeEnumType,
5431
- never: neverType,
5432
- 'null': nullType,
5433
- nullable: nullableType,
5434
- number: numberType,
5435
- object: objectType,
5436
- oboolean: oboolean,
5437
- onumber: onumber,
5438
- optional: optionalType,
5439
- ostring: ostring,
5440
- pipeline: pipelineType,
5441
- preprocess: preprocessType,
5442
- promise: promiseType,
5443
- record: recordType,
5444
- set: setType,
5445
- strictObject: strictObjectType,
5446
- string: stringType,
5447
- symbol: symbolType,
5448
- transformer: effectsType,
5449
- tuple: tupleType,
5450
- 'undefined': undefinedType,
5451
- union: unionType,
5452
- unknown: unknownType,
5453
- 'void': voidType,
5454
- NEVER: NEVER,
5455
- ZodIssueCode: ZodIssueCode,
5456
- quotelessJson: quotelessJson,
5457
- ZodError: ZodError
5458
- });
4958
+ ZodPromise.create;
4959
+ ZodOptional.create;
4960
+ ZodNullable.create;
5459
4961
 
5460
4962
  const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
5461
4963
  const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
@@ -5563,22 +5065,18 @@ async function clientContextValidation(filesList) {
5563
5065
  }
5564
5066
  return errors;
5565
5067
  }
5566
- const cubeModelSchema = z
5567
- .object({
5568
- cubes: z
5569
- .object({
5570
- name: z.string(),
5571
- dimensions: z
5572
- .object({
5573
- name: z.string(),
5574
- type: z.enum(DIMENSION_TYPES),
5068
+ const cubeModelSchema = objectType({
5069
+ cubes: objectType({
5070
+ name: stringType(),
5071
+ dimensions: objectType({
5072
+ name: stringType(),
5073
+ type: enumType(DIMENSION_TYPES),
5575
5074
  })
5576
5075
  .array()
5577
5076
  .optional(),
5578
- measures: z
5579
- .object({
5580
- name: z.string(),
5581
- type: z.enum(MEASURE_TYPES),
5077
+ measures: objectType({
5078
+ name: stringType(),
5079
+ type: enumType(MEASURE_TYPES),
5582
5080
  })
5583
5081
  .array()
5584
5082
  .optional(),
@@ -5590,35 +5088,31 @@ const cubeModelSchema = z
5590
5088
  message: "At least one measure or dimension must be defined",
5591
5089
  path: ["cubes"],
5592
5090
  });
5593
- const viewModelSchema = z.object({
5594
- views: z
5595
- .object({
5596
- name: z.string(),
5597
- cubes: z
5598
- .object({
5599
- join_path: z.string(),
5091
+ const viewModelSchema = objectType({
5092
+ views: objectType({
5093
+ name: stringType(),
5094
+ cubes: objectType({
5095
+ join_path: stringType(),
5600
5096
  })
5601
5097
  .array(),
5602
5098
  })
5603
5099
  .array()
5604
5100
  .min(1),
5605
5101
  });
5606
- const securityContextSchema = z.array(z
5607
- .object({
5608
- name: z.string(),
5609
- securityContext: z.object({}), // can be any object
5610
- environment: z.string().optional(),
5611
- useQueryRewrite: z.boolean().optional(),
5612
- dataProvider: z.string().optional(),
5613
- roles: z.array(z.string()).optional(),
5102
+ const securityContextSchema = arrayType(objectType({
5103
+ name: stringType(),
5104
+ securityContext: objectType({}), // can be any object
5105
+ environment: stringType().optional(),
5106
+ useQueryRewrite: booleanType().optional(),
5107
+ dataProvider: stringType().optional(),
5108
+ roles: arrayType(stringType()).optional(),
5614
5109
  })
5615
5110
  .strict());
5616
- const clientContextSchema = z.array(z
5617
- .object({
5618
- name: z.string(),
5619
- clientContext: z.object({}), // can be any object
5620
- variables: z.record(z.any()).optional(), // variables key-value pairs
5621
- canvas: z.object({}).optional(),
5111
+ const clientContextSchema = arrayType(objectType({
5112
+ name: stringType(),
5113
+ clientContext: objectType({}), // can be any object
5114
+ variables: recordType(anyType()).optional(), // variables key-value pairs
5115
+ canvas: objectType({}).optional(),
5622
5116
  })
5623
5117
  .strict());
5624
5118
 
@@ -5646,7 +5140,11 @@ function getAugmentedNamespace(n) {
5646
5140
  var f = n.default;
5647
5141
  if (typeof f == "function") {
5648
5142
  var a = function a () {
5649
- if (this instanceof a) {
5143
+ var isInstance = false;
5144
+ try {
5145
+ isInstance = this instanceof a;
5146
+ } catch {}
5147
+ if (isInstance) {
5650
5148
  return Reflect.construct(f, arguments, this.constructor);
5651
5149
  }
5652
5150
  return f.apply(this, arguments);
@@ -8010,9 +7508,9 @@ var hasRequiredStringify;
8010
7508
  function requireStringify () {
8011
7509
  if (hasRequiredStringify) return stringify.exports;
8012
7510
  hasRequiredStringify = 1;
8013
- (function (module, exports) {
8014
- exports = module.exports = stringify;
8015
- exports.getSerialize = serializer;
7511
+ (function (module, exports$1) {
7512
+ exports$1 = module.exports = stringify;
7513
+ exports$1.getSerialize = serializer;
8016
7514
 
8017
7515
  function stringify(obj, replacer, spaces, cycleReplacer) {
8018
7516
  return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
@@ -15380,7 +14878,7 @@ var hasRequiredUtil;
15380
14878
  function requireUtil () {
15381
14879
  if (hasRequiredUtil) return util;
15382
14880
  hasRequiredUtil = 1;
15383
- (function (exports) {
14881
+ (function (exports$1) {
15384
14882
  /*
15385
14883
  * Copyright 2011 Mozilla Foundation and contributors
15386
14884
  * Licensed under the New BSD license. See LICENSE or:
@@ -15406,7 +14904,7 @@ function requireUtil () {
15406
14904
  throw new Error('"' + aName + '" is a required argument.');
15407
14905
  }
15408
14906
  }
15409
- exports.getArg = getArg;
14907
+ exports$1.getArg = getArg;
15410
14908
 
15411
14909
  var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
15412
14910
  var dataUrlRegexp = /^data:.+\,.+$/;
@@ -15424,7 +14922,7 @@ function requireUtil () {
15424
14922
  path: match[5]
15425
14923
  };
15426
14924
  }
15427
- exports.urlParse = urlParse;
14925
+ exports$1.urlParse = urlParse;
15428
14926
 
15429
14927
  function urlGenerate(aParsedUrl) {
15430
14928
  var url = '';
@@ -15446,7 +14944,7 @@ function requireUtil () {
15446
14944
  }
15447
14945
  return url;
15448
14946
  }
15449
- exports.urlGenerate = urlGenerate;
14947
+ exports$1.urlGenerate = urlGenerate;
15450
14948
 
15451
14949
  /**
15452
14950
  * Normalizes a path, or the path portion of a URL:
@@ -15468,7 +14966,7 @@ function requireUtil () {
15468
14966
  }
15469
14967
  path = url.path;
15470
14968
  }
15471
- var isAbsolute = exports.isAbsolute(path);
14969
+ var isAbsolute = exports$1.isAbsolute(path);
15472
14970
 
15473
14971
  var parts = path.split(/\/+/);
15474
14972
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
@@ -15502,7 +15000,7 @@ function requireUtil () {
15502
15000
  }
15503
15001
  return path;
15504
15002
  }
15505
- exports.normalize = normalize;
15003
+ exports$1.normalize = normalize;
15506
15004
 
15507
15005
  /**
15508
15006
  * Joins two paths/URLs.
@@ -15561,9 +15059,9 @@ function requireUtil () {
15561
15059
  }
15562
15060
  return joined;
15563
15061
  }
15564
- exports.join = join;
15062
+ exports$1.join = join;
15565
15063
 
15566
- exports.isAbsolute = function (aPath) {
15064
+ exports$1.isAbsolute = function (aPath) {
15567
15065
  return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
15568
15066
  };
15569
15067
 
@@ -15605,7 +15103,7 @@ function requireUtil () {
15605
15103
  // Make sure we add a "../" for each component we removed from the root.
15606
15104
  return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
15607
15105
  }
15608
- exports.relative = relative;
15106
+ exports$1.relative = relative;
15609
15107
 
15610
15108
  var supportsNullProto = (function () {
15611
15109
  var obj = Object.create(null);
@@ -15632,7 +15130,7 @@ function requireUtil () {
15632
15130
 
15633
15131
  return aStr;
15634
15132
  }
15635
- exports.toSetString = supportsNullProto ? identity : toSetString;
15133
+ exports$1.toSetString = supportsNullProto ? identity : toSetString;
15636
15134
 
15637
15135
  function fromSetString(aStr) {
15638
15136
  if (isProtoString(aStr)) {
@@ -15641,7 +15139,7 @@ function requireUtil () {
15641
15139
 
15642
15140
  return aStr;
15643
15141
  }
15644
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
15142
+ exports$1.fromSetString = supportsNullProto ? identity : fromSetString;
15645
15143
 
15646
15144
  function isProtoString(s) {
15647
15145
  if (!s) {
@@ -15711,7 +15209,7 @@ function requireUtil () {
15711
15209
 
15712
15210
  return mappingA.name - mappingB.name;
15713
15211
  }
15714
- exports.compareByOriginalPositions = compareByOriginalPositions;
15212
+ exports$1.compareByOriginalPositions = compareByOriginalPositions;
15715
15213
 
15716
15214
  /**
15717
15215
  * Comparator between two mappings with deflated source and name indices where
@@ -15750,7 +15248,7 @@ function requireUtil () {
15750
15248
 
15751
15249
  return mappingA.name - mappingB.name;
15752
15250
  }
15753
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
15251
+ exports$1.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
15754
15252
 
15755
15253
  function strcmp(aStr1, aStr2) {
15756
15254
  if (aStr1 === aStr2) {
@@ -15796,7 +15294,7 @@ function requireUtil () {
15796
15294
 
15797
15295
  return strcmp(mappingA.name, mappingB.name);
15798
15296
  }
15799
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
15297
+ exports$1.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
15800
15298
  } (util));
15801
15299
  return util;
15802
15300
  }
@@ -16459,15 +15957,15 @@ var hasRequiredBinarySearch;
16459
15957
  function requireBinarySearch () {
16460
15958
  if (hasRequiredBinarySearch) return binarySearch;
16461
15959
  hasRequiredBinarySearch = 1;
16462
- (function (exports) {
15960
+ (function (exports$1) {
16463
15961
  /*
16464
15962
  * Copyright 2011 Mozilla Foundation and contributors
16465
15963
  * Licensed under the New BSD license. See LICENSE or:
16466
15964
  * http://opensource.org/licenses/BSD-3-Clause
16467
15965
  */
16468
15966
 
16469
- exports.GREATEST_LOWER_BOUND = 1;
16470
- exports.LEAST_UPPER_BOUND = 2;
15967
+ exports$1.GREATEST_LOWER_BOUND = 1;
15968
+ exports$1.LEAST_UPPER_BOUND = 2;
16471
15969
 
16472
15970
  /**
16473
15971
  * Recursive implementation of binary search.
@@ -16507,7 +16005,7 @@ function requireBinarySearch () {
16507
16005
 
16508
16006
  // The exact needle element was not found in this haystack. Determine if
16509
16007
  // we are in termination case (3) or (2) and return the appropriate thing.
16510
- if (aBias == exports.LEAST_UPPER_BOUND) {
16008
+ if (aBias == exports$1.LEAST_UPPER_BOUND) {
16511
16009
  return aHigh < aHaystack.length ? aHigh : -1;
16512
16010
  } else {
16513
16011
  return mid;
@@ -16521,7 +16019,7 @@ function requireBinarySearch () {
16521
16019
  }
16522
16020
 
16523
16021
  // we are in termination case (3) or (2) and return the appropriate thing.
16524
- if (aBias == exports.LEAST_UPPER_BOUND) {
16022
+ if (aBias == exports$1.LEAST_UPPER_BOUND) {
16525
16023
  return mid;
16526
16024
  } else {
16527
16025
  return aLow < 0 ? -1 : aLow;
@@ -16547,13 +16045,13 @@ function requireBinarySearch () {
16547
16045
  * searching for, respectively, if the exact element cannot be found.
16548
16046
  * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
16549
16047
  */
16550
- exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
16048
+ exports$1.search = function search(aNeedle, aHaystack, aCompare, aBias) {
16551
16049
  if (aHaystack.length === 0) {
16552
16050
  return -1;
16553
16051
  }
16554
16052
 
16555
16053
  var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
16556
- aCompare, aBias || exports.GREATEST_LOWER_BOUND);
16054
+ aCompare, aBias || exports$1.GREATEST_LOWER_BOUND);
16557
16055
  if (index < 0) {
16558
16056
  return -1;
16559
16057
  }
@@ -18442,7 +17940,7 @@ var hasRequiredParser;
18442
17940
  function requireParser () {
18443
17941
  if (hasRequiredParser) return parser;
18444
17942
  hasRequiredParser = 1;
18445
- (function (exports) {
17943
+ (function (exports$1) {
18446
17944
 
18447
17945
  var logger = requireLogger();
18448
17946
  var async = require$$0;
@@ -18461,8 +17959,8 @@ function requireParser () {
18461
17959
  var cache = new lru({ max: 100 });
18462
17960
  var pendingReads = {};
18463
17961
 
18464
- exports.cache = cache;
18465
- exports.pendingReads = pendingReads;
17962
+ exports$1.cache = cache;
17963
+ exports$1.pendingReads = pendingReads;
18466
17964
 
18467
17965
  /*
18468
17966
  * Internal
@@ -18740,10 +18238,10 @@ function requireParser () {
18740
18238
  * Public API
18741
18239
  */
18742
18240
 
18743
- exports.parseException = function (exc, options, item, callback) {
18241
+ exports$1.parseException = function (exc, options, item, callback) {
18744
18242
  var multipleErrs = getMultipleErrors(exc.errors);
18745
18243
 
18746
- return exports.parseStack(exc.stack, options, item, function (err, stack) {
18244
+ return exports$1.parseStack(exc.stack, options, item, function (err, stack) {
18747
18245
  var message, clss, ret, firstErr, jadeMatch, jadeData;
18748
18246
 
18749
18247
  if (err) {
@@ -18797,7 +18295,7 @@ function requireParser () {
18797
18295
  });
18798
18296
  };
18799
18297
 
18800
- exports.parseStack = function (stack, options, item, callback) {
18298
+ exports$1.parseStack = function (stack, options, item, callback) {
18801
18299
  var lines,
18802
18300
  _stack = stack;
18803
18301
 
@@ -22504,47 +22002,42 @@ const REGION_CONFIGS = {
22504
22002
  authClientId: "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
22505
22003
  },
22506
22004
  };
22507
- const ComponentLibraryConfigSchema = z.object({
22508
- name: z.string(),
22509
- include: z.array(z.string()).optional(),
22510
- exclude: z.array(z.string()).optional(),
22005
+ const ComponentLibraryConfigSchema = objectType({
22006
+ name: stringType(),
22007
+ include: arrayType(stringType()).optional(),
22008
+ exclude: arrayType(stringType()).optional(),
22511
22009
  });
22512
- const embeddableConfigSchema = z
22513
- .object({
22514
- plugins: z.array(z.function()),
22515
- region: z
22516
- .union([z.literal("EU"), z.literal("US"), z.literal("legacy-US")])
22010
+ const embeddableConfigSchema = objectType({
22011
+ plugins: arrayType(functionType()),
22012
+ region: unionType([literalType("EU"), literalType("US"), literalType("legacy-US")])
22517
22013
  .optional(),
22518
- starterEmbeddables: z.record(z.enum(["EU", "US", "legacy-US"]), z.array(z.string().uuid())).optional(),
22519
- pushModels: z.boolean().optional(),
22520
- pushComponents: z.boolean().optional(),
22521
- pushBaseUrl: z.string().optional(),
22522
- audienceUrl: z.string().optional(),
22523
- authDomain: z.string().optional(),
22524
- authClientId: z.string().optional(),
22525
- errorFallbackComponent: z.string().optional(),
22526
- applicationEnvironment: z.string().optional(),
22527
- rollbarAccessToken: z.string().optional(),
22528
- previewBaseUrl: z.string().optional(),
22529
- modelsSrc: z.string().optional(),
22530
- presetsSrc: z.string().optional(),
22531
- componentsSrc: z.string().optional(),
22532
- customCanvasCss: z.string().optional(),
22533
- customizationFile: z.string().optional(),
22534
- lifecycleHooksFile: z.string().optional(),
22535
- componentLibraries: z
22536
- .union([z.array(z.string()), z.array(ComponentLibraryConfigSchema)])
22014
+ starterEmbeddables: recordType(enumType(["EU", "US", "legacy-US"]), arrayType(stringType().uuid())).optional(),
22015
+ pushModels: booleanType().optional(),
22016
+ pushComponents: booleanType().optional(),
22017
+ pushBaseUrl: stringType().optional(),
22018
+ audienceUrl: stringType().optional(),
22019
+ authDomain: stringType().optional(),
22020
+ authClientId: stringType().optional(),
22021
+ errorFallbackComponent: stringType().optional(),
22022
+ applicationEnvironment: stringType().optional(),
22023
+ rollbarAccessToken: stringType().optional(),
22024
+ previewBaseUrl: stringType().optional(),
22025
+ modelsSrc: stringType().optional(),
22026
+ presetsSrc: stringType().optional(),
22027
+ componentsSrc: stringType().optional(),
22028
+ customCanvasCss: stringType().optional(),
22029
+ customizationFile: stringType().optional(),
22030
+ lifecycleHooksFile: stringType().optional(),
22031
+ componentLibraries: unionType([arrayType(stringType()), arrayType(ComponentLibraryConfigSchema)])
22537
22032
  .optional(),
22538
- viteConfig: z
22539
- .object({
22540
- resolve: z
22541
- .object({
22542
- alias: z.record(z.string()),
22033
+ viteConfig: objectType({
22034
+ resolve: objectType({
22035
+ alias: recordType(stringType()),
22543
22036
  })
22544
22037
  .optional(),
22545
22038
  })
22546
22039
  .optional(),
22547
- rollupOptions: z.object({}).optional(),
22040
+ rollupOptions: objectType({}).optional(),
22548
22041
  })
22549
22042
  .strict();
22550
22043
  var defineConfig = (config) => {