@betterstore/react 0.3.17 → 0.3.19

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.cjs.js CHANGED
@@ -3406,7 +3406,7 @@ const createI18nInstance = (locale) => __awaiter(void 0, void 0, void 0, functio
3406
3406
  return instance;
3407
3407
  });
3408
3408
 
3409
- var M$1=(e,i,s,u,m,a,l,h)=>{let d=document.documentElement,w=["light","dark"];function p(n){(Array.isArray(e)?e:[e]).forEach(y=>{let k=y==="class",S=k&&a?m.map(f=>a[f]||f):m;k?(d.classList.remove(...S),d.classList.add(a&&a[n]?a[n]:n)):d.setAttribute(y,n);}),R(n);}function R(n){h&&w.includes(n)&&(d.style.colorScheme=n);}function c(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(u)p(u);else try{let n=localStorage.getItem(i)||s,y=l&&n==="system"?c():n;p(y);}catch(n){}};var x=React__namespace.createContext(void 0),U$1={setTheme:e=>{},themes:[]},z$1=()=>{var e;return (e=React__namespace.useContext(x))!=null?e:U$1};React__namespace.memo(({forcedTheme:e,storageKey:i,attribute:s,enableSystem:u,enableColorScheme:m,defaultTheme:a,value:l,themes:h,nonce:d,scriptProps:w})=>{let p=JSON.stringify([s,i,a,e,h,l,u,m]).slice(1,-1);return React__namespace.createElement("script",{...w,suppressHydrationWarning:true,nonce:typeof window=="undefined"?d:"",dangerouslySetInnerHTML:{__html:`(${M$1.toString()})(${p})`}})});
3409
+ var M$1=(e,i,s,u,m,a,l,h)=>{let d=document.documentElement,w=["light","dark"];function p(n){(Array.isArray(e)?e:[e]).forEach(y=>{let k=y==="class",S=k&&a?m.map(f=>a[f]||f):m;k?(d.classList.remove(...S),d.classList.add(a&&a[n]?a[n]:n)):d.setAttribute(y,n);}),R(n);}function R(n){h&&w.includes(n)&&(d.style.colorScheme=n);}function c(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(u)p(u);else try{let n=localStorage.getItem(i)||s,y=l&&n==="system"?c():n;p(y);}catch(n){}};var x=React__namespace.createContext(void 0),U$1={setTheme:e=>{},themes:[]},z=()=>{var e;return (e=React__namespace.useContext(x))!=null?e:U$1};React__namespace.memo(({forcedTheme:e,storageKey:i,attribute:s,enableSystem:u,enableColorScheme:m,defaultTheme:a,value:l,themes:h,nonce:d,scriptProps:w})=>{let p=JSON.stringify([s,i,a,e,h,l,u,m]).slice(1,-1);return React__namespace.createElement("script",{...w,suppressHydrationWarning:true,nonce:typeof window=="undefined"?d:"",dangerouslySetInnerHTML:{__html:`(${M$1.toString()})(${p})`}})});
3410
3410
 
3411
3411
  function __insertCSS(code) {
3412
3412
  if (typeof document == 'undefined') return
@@ -4527,7 +4527,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
4527
4527
 
4528
4528
  const Toaster = (_a) => {
4529
4529
  var props = __rest(_a, []);
4530
- const { theme = "system" } = z$1();
4530
+ const { theme = "system" } = z();
4531
4531
  return (React.createElement(Toaster$1, Object.assign({ theme: theme, className: "toaster group", style: {
4532
4532
  "--normal-bg": "var(--popover)",
4533
4533
  "--normal-text": "var(--popover-foreground)",
@@ -14844,7 +14844,7 @@ const motion = /*@__PURE__*/ createDOMMotionComponentProxy(createMotionComponent
14844
14844
 
14845
14845
  var util;
14846
14846
  (function (util) {
14847
- util.assertEqual = (val) => val;
14847
+ util.assertEqual = (_) => { };
14848
14848
  function assertIs(_arg) { }
14849
14849
  util.assertIs = assertIs;
14850
14850
  function assertNever(_x) {
@@ -14891,11 +14891,9 @@ var util;
14891
14891
  };
14892
14892
  util.isInteger = typeof Number.isInteger === "function"
14893
14893
  ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
14894
- : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
14894
+ : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
14895
14895
  function joinValues(array, separator = " | ") {
14896
- return array
14897
- .map((val) => (typeof val === "string" ? `'${val}'` : val))
14898
- .join(separator);
14896
+ return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
14899
14897
  }
14900
14898
  util.joinValues = joinValues;
14901
14899
  util.jsonStringifyReplacer = (_, value) => {
@@ -14944,7 +14942,7 @@ const getParsedType = (data) => {
14944
14942
  case "string":
14945
14943
  return ZodParsedType.string;
14946
14944
  case "number":
14947
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
14945
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
14948
14946
  case "boolean":
14949
14947
  return ZodParsedType.boolean;
14950
14948
  case "function":
@@ -14960,10 +14958,7 @@ const getParsedType = (data) => {
14960
14958
  if (data === null) {
14961
14959
  return ZodParsedType.null;
14962
14960
  }
14963
- if (data.then &&
14964
- typeof data.then === "function" &&
14965
- data.catch &&
14966
- typeof data.catch === "function") {
14961
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
14967
14962
  return ZodParsedType.promise;
14968
14963
  }
14969
14964
  if (typeof Map !== "undefined" && data instanceof Map) {
@@ -14999,10 +14994,6 @@ const ZodIssueCode = util.arrayToEnum([
14999
14994
  "not_multiple_of",
15000
14995
  "not_finite",
15001
14996
  ]);
15002
- const quotelessJson = (obj) => {
15003
- const json = JSON.stringify(obj, null, 2);
15004
- return json.replace(/"([^"]+)":/g, "$1:");
15005
- };
15006
14997
  class ZodError extends Error {
15007
14998
  get errors() {
15008
14999
  return this.issues;
@@ -15179,17 +15170,9 @@ const errorMap = (issue, _ctx) => {
15179
15170
  else if (issue.type === "string")
15180
15171
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
15181
15172
  else if (issue.type === "number")
15182
- message = `Number must be ${issue.exact
15183
- ? `exactly equal to `
15184
- : issue.inclusive
15185
- ? `greater than or equal to `
15186
- : `greater than `}${issue.minimum}`;
15173
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
15187
15174
  else if (issue.type === "date")
15188
- message = `Date must be ${issue.exact
15189
- ? `exactly equal to `
15190
- : issue.inclusive
15191
- ? `greater than or equal to `
15192
- : `greater than `}${new Date(Number(issue.minimum))}`;
15175
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
15193
15176
  else
15194
15177
  message = "Invalid input";
15195
15178
  break;
@@ -15199,23 +15182,11 @@ const errorMap = (issue, _ctx) => {
15199
15182
  else if (issue.type === "string")
15200
15183
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
15201
15184
  else if (issue.type === "number")
15202
- message = `Number must be ${issue.exact
15203
- ? `exactly`
15204
- : issue.inclusive
15205
- ? `less than or equal to`
15206
- : `less than`} ${issue.maximum}`;
15185
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
15207
15186
  else if (issue.type === "bigint")
15208
- message = `BigInt must be ${issue.exact
15209
- ? `exactly`
15210
- : issue.inclusive
15211
- ? `less than or equal to`
15212
- : `less than`} ${issue.maximum}`;
15187
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
15213
15188
  else if (issue.type === "date")
15214
- message = `Date must be ${issue.exact
15215
- ? `exactly`
15216
- : issue.inclusive
15217
- ? `smaller than or equal to`
15218
- : `smaller than`} ${new Date(Number(issue.maximum))}`;
15189
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
15219
15190
  else
15220
15191
  message = "Invalid input";
15221
15192
  break;
@@ -15239,9 +15210,6 @@ const errorMap = (issue, _ctx) => {
15239
15210
  };
15240
15211
 
15241
15212
  let overrideErrorMap = errorMap;
15242
- function setErrorMap(map) {
15243
- overrideErrorMap = map;
15244
- }
15245
15213
  function getErrorMap() {
15246
15214
  return overrideErrorMap;
15247
15215
  }
@@ -15274,7 +15242,6 @@ const makeIssue = (params) => {
15274
15242
  message: errorMessage,
15275
15243
  };
15276
15244
  };
15277
- const EMPTY_PATH = [];
15278
15245
  function addIssueToContext(ctx, issueData) {
15279
15246
  const overrideMap = getErrorMap();
15280
15247
  const issue = makeIssue({
@@ -15337,8 +15304,7 @@ class ParseStatus {
15337
15304
  status.dirty();
15338
15305
  if (value.status === "dirty")
15339
15306
  status.dirty();
15340
- if (key.value !== "__proto__" &&
15341
- (typeof value.value !== "undefined" || pair.alwaysSet)) {
15307
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
15342
15308
  finalObject[key.value] = value.value;
15343
15309
  }
15344
15310
  }
@@ -15355,42 +15321,24 @@ const isDirty = (x) => x.status === "dirty";
15355
15321
  const isValid = (x) => x.status === "valid";
15356
15322
  const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
15357
15323
 
15358
- /******************************************************************************
15359
- Copyright (c) Microsoft Corporation.
15360
-
15361
- Permission to use, copy, modify, and/or distribute this software for any
15362
- purpose with or without fee is hereby granted.
15363
-
15364
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15365
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15366
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15367
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15368
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15369
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15370
- PERFORMANCE OF THIS SOFTWARE.
15371
- ***************************************************************************** */
15372
-
15373
- function __classPrivateFieldGet(receiver, state, kind, f) {
15374
- 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");
15375
- return state.get(receiver);
15376
- }
15377
-
15378
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
15379
- 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");
15380
- return (state.set(receiver, value)), value;
15381
- }
15382
-
15383
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
15384
- var e = new Error(message);
15385
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
15386
- };
15387
-
15388
15324
  var errorUtil;
15389
15325
  (function (errorUtil) {
15390
15326
  errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
15391
- errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
15327
+ // biome-ignore lint:
15328
+ errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
15392
15329
  })(errorUtil || (errorUtil = {}));
15393
15330
 
15331
+ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15332
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15333
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
15334
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15335
+ };
15336
+ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15337
+ if (kind === "m") throw new TypeError("Private method is not writable");
15338
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15339
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15340
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15341
+ };
15394
15342
  var _ZodEnum_cache, _ZodNativeEnum_cache;
15395
15343
  class ParseInputLazyPath {
15396
15344
  constructor(parent, value, path, key) {
@@ -15402,7 +15350,7 @@ class ParseInputLazyPath {
15402
15350
  }
15403
15351
  get path() {
15404
15352
  if (!this._cachedPath.length) {
15405
- if (this._key instanceof Array) {
15353
+ if (Array.isArray(this._key)) {
15406
15354
  this._cachedPath.push(...this._path, ...this._key);
15407
15355
  }
15408
15356
  else {
@@ -15442,17 +15390,16 @@ function processCreateParams(params) {
15442
15390
  if (errorMap)
15443
15391
  return { errorMap: errorMap, description };
15444
15392
  const customMap = (iss, ctx) => {
15445
- var _a, _b;
15446
15393
  const { message } = params;
15447
15394
  if (iss.code === "invalid_enum_value") {
15448
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
15395
+ return { message: message ?? ctx.defaultError };
15449
15396
  }
15450
15397
  if (typeof ctx.data === "undefined") {
15451
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
15398
+ return { message: message ?? required_error ?? ctx.defaultError };
15452
15399
  }
15453
15400
  if (iss.code !== "invalid_type")
15454
15401
  return { message: ctx.defaultError };
15455
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
15402
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
15456
15403
  };
15457
15404
  return { errorMap: customMap, description };
15458
15405
  }
@@ -15504,14 +15451,13 @@ class ZodType {
15504
15451
  throw result.error;
15505
15452
  }
15506
15453
  safeParse(data, params) {
15507
- var _a;
15508
15454
  const ctx = {
15509
15455
  common: {
15510
15456
  issues: [],
15511
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
15512
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
15457
+ async: params?.async ?? false,
15458
+ contextualErrorMap: params?.errorMap,
15513
15459
  },
15514
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
15460
+ path: params?.path || [],
15515
15461
  schemaErrorMap: this._def.errorMap,
15516
15462
  parent: null,
15517
15463
  data,
@@ -15521,7 +15467,6 @@ class ZodType {
15521
15467
  return handleResult(ctx, result);
15522
15468
  }
15523
15469
  "~validate"(data) {
15524
- var _a, _b;
15525
15470
  const ctx = {
15526
15471
  common: {
15527
15472
  issues: [],
@@ -15545,7 +15490,7 @@ class ZodType {
15545
15490
  };
15546
15491
  }
15547
15492
  catch (err) {
15548
- 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")) {
15493
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
15549
15494
  this["~standard"].async = true;
15550
15495
  }
15551
15496
  ctx.common = {
@@ -15572,19 +15517,17 @@ class ZodType {
15572
15517
  const ctx = {
15573
15518
  common: {
15574
15519
  issues: [],
15575
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
15520
+ contextualErrorMap: params?.errorMap,
15576
15521
  async: true,
15577
15522
  },
15578
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
15523
+ path: params?.path || [],
15579
15524
  schemaErrorMap: this._def.errorMap,
15580
15525
  parent: null,
15581
15526
  data,
15582
15527
  parsedType: getParsedType(data),
15583
15528
  };
15584
15529
  const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
15585
- const result = await (isAsync(maybeAsyncResult)
15586
- ? maybeAsyncResult
15587
- : Promise.resolve(maybeAsyncResult));
15530
+ const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
15588
15531
  return handleResult(ctx, result);
15589
15532
  }
15590
15533
  refine(check, message) {
@@ -15628,9 +15571,7 @@ class ZodType {
15628
15571
  refinement(check, refinementData) {
15629
15572
  return this._refinement((val, ctx) => {
15630
15573
  if (!check(val)) {
15631
- ctx.addIssue(typeof refinementData === "function"
15632
- ? refinementData(val, ctx)
15633
- : refinementData);
15574
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
15634
15575
  return false;
15635
15576
  }
15636
15577
  else {
@@ -15847,13 +15788,15 @@ function isValidJWT(jwt, alg) {
15847
15788
  const decoded = JSON.parse(atob(base64));
15848
15789
  if (typeof decoded !== "object" || decoded === null)
15849
15790
  return false;
15850
- if (!decoded.typ || !decoded.alg)
15791
+ if ("typ" in decoded && decoded?.typ !== "JWT")
15792
+ return false;
15793
+ if (!decoded.alg)
15851
15794
  return false;
15852
15795
  if (alg && decoded.alg !== alg)
15853
15796
  return false;
15854
15797
  return true;
15855
15798
  }
15856
- catch (_a) {
15799
+ catch {
15857
15800
  return false;
15858
15801
  }
15859
15802
  }
@@ -16024,7 +15967,7 @@ class ZodString extends ZodType {
16024
15967
  try {
16025
15968
  new URL(input.data);
16026
15969
  }
16027
- catch (_a) {
15970
+ catch {
16028
15971
  ctx = this._getOrReturnCtx(input, ctx);
16029
15972
  addIssueToContext(ctx, {
16030
15973
  validation: "url",
@@ -16254,7 +16197,6 @@ class ZodString extends ZodType {
16254
16197
  return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
16255
16198
  }
16256
16199
  datetime(options) {
16257
- var _a, _b;
16258
16200
  if (typeof options === "string") {
16259
16201
  return this._addCheck({
16260
16202
  kind: "datetime",
@@ -16266,10 +16208,10 @@ class ZodString extends ZodType {
16266
16208
  }
16267
16209
  return this._addCheck({
16268
16210
  kind: "datetime",
16269
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
16270
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
16271
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
16272
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
16211
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
16212
+ offset: options?.offset ?? false,
16213
+ local: options?.local ?? false,
16214
+ ...errorUtil.errToObj(options?.message),
16273
16215
  });
16274
16216
  }
16275
16217
  date(message) {
@@ -16285,8 +16227,8 @@ class ZodString extends ZodType {
16285
16227
  }
16286
16228
  return this._addCheck({
16287
16229
  kind: "time",
16288
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
16289
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
16230
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
16231
+ ...errorUtil.errToObj(options?.message),
16290
16232
  });
16291
16233
  }
16292
16234
  duration(message) {
@@ -16303,8 +16245,8 @@ class ZodString extends ZodType {
16303
16245
  return this._addCheck({
16304
16246
  kind: "includes",
16305
16247
  value: value,
16306
- position: options === null || options === void 0 ? void 0 : options.position,
16307
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
16248
+ position: options?.position,
16249
+ ...errorUtil.errToObj(options?.message),
16308
16250
  });
16309
16251
  }
16310
16252
  startsWith(value, message) {
@@ -16437,11 +16379,10 @@ class ZodString extends ZodType {
16437
16379
  }
16438
16380
  }
16439
16381
  ZodString.create = (params) => {
16440
- var _a;
16441
16382
  return new ZodString({
16442
16383
  checks: [],
16443
16384
  typeName: ZodFirstPartyTypeKind.ZodString,
16444
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
16385
+ coerce: params?.coerce ?? false,
16445
16386
  ...processCreateParams(params),
16446
16387
  });
16447
16388
  };
@@ -16450,9 +16391,9 @@ function floatSafeRemainder(val, step) {
16450
16391
  const valDecCount = (val.toString().split(".")[1] || "").length;
16451
16392
  const stepDecCount = (step.toString().split(".")[1] || "").length;
16452
16393
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
16453
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
16454
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
16455
- return (valInt % stepInt) / Math.pow(10, decCount);
16394
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
16395
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
16396
+ return (valInt % stepInt) / 10 ** decCount;
16456
16397
  }
16457
16398
  class ZodNumber extends ZodType {
16458
16399
  constructor() {
@@ -16491,9 +16432,7 @@ class ZodNumber extends ZodType {
16491
16432
  }
16492
16433
  }
16493
16434
  else if (check.kind === "min") {
16494
- const tooSmall = check.inclusive
16495
- ? input.data < check.value
16496
- : input.data <= check.value;
16435
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
16497
16436
  if (tooSmall) {
16498
16437
  ctx = this._getOrReturnCtx(input, ctx);
16499
16438
  addIssueToContext(ctx, {
@@ -16508,9 +16447,7 @@ class ZodNumber extends ZodType {
16508
16447
  }
16509
16448
  }
16510
16449
  else if (check.kind === "max") {
16511
- const tooBig = check.inclusive
16512
- ? input.data > check.value
16513
- : input.data >= check.value;
16450
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
16514
16451
  if (tooBig) {
16515
16452
  ctx = this._getOrReturnCtx(input, ctx);
16516
16453
  addIssueToContext(ctx, {
@@ -16668,15 +16605,13 @@ class ZodNumber extends ZodType {
16668
16605
  return max;
16669
16606
  }
16670
16607
  get isInt() {
16671
- return !!this._def.checks.find((ch) => ch.kind === "int" ||
16672
- (ch.kind === "multipleOf" && util.isInteger(ch.value)));
16608
+ return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util.isInteger(ch.value)));
16673
16609
  }
16674
16610
  get isFinite() {
16675
- let max = null, min = null;
16611
+ let max = null;
16612
+ let min = null;
16676
16613
  for (const ch of this._def.checks) {
16677
- if (ch.kind === "finite" ||
16678
- ch.kind === "int" ||
16679
- ch.kind === "multipleOf") {
16614
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
16680
16615
  return true;
16681
16616
  }
16682
16617
  else if (ch.kind === "min") {
@@ -16695,7 +16630,7 @@ ZodNumber.create = (params) => {
16695
16630
  return new ZodNumber({
16696
16631
  checks: [],
16697
16632
  typeName: ZodFirstPartyTypeKind.ZodNumber,
16698
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
16633
+ coerce: params?.coerce || false,
16699
16634
  ...processCreateParams(params),
16700
16635
  });
16701
16636
  };
@@ -16710,7 +16645,7 @@ class ZodBigInt extends ZodType {
16710
16645
  try {
16711
16646
  input.data = BigInt(input.data);
16712
16647
  }
16713
- catch (_a) {
16648
+ catch {
16714
16649
  return this._getInvalidInput(input);
16715
16650
  }
16716
16651
  }
@@ -16722,9 +16657,7 @@ class ZodBigInt extends ZodType {
16722
16657
  const status = new ParseStatus();
16723
16658
  for (const check of this._def.checks) {
16724
16659
  if (check.kind === "min") {
16725
- const tooSmall = check.inclusive
16726
- ? input.data < check.value
16727
- : input.data <= check.value;
16660
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
16728
16661
  if (tooSmall) {
16729
16662
  ctx = this._getOrReturnCtx(input, ctx);
16730
16663
  addIssueToContext(ctx, {
@@ -16738,9 +16671,7 @@ class ZodBigInt extends ZodType {
16738
16671
  }
16739
16672
  }
16740
16673
  else if (check.kind === "max") {
16741
- const tooBig = check.inclusive
16742
- ? input.data > check.value
16743
- : input.data >= check.value;
16674
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
16744
16675
  if (tooBig) {
16745
16676
  ctx = this._getOrReturnCtx(input, ctx);
16746
16677
  addIssueToContext(ctx, {
@@ -16872,11 +16803,10 @@ class ZodBigInt extends ZodType {
16872
16803
  }
16873
16804
  }
16874
16805
  ZodBigInt.create = (params) => {
16875
- var _a;
16876
16806
  return new ZodBigInt({
16877
16807
  checks: [],
16878
16808
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
16879
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
16809
+ coerce: params?.coerce ?? false,
16880
16810
  ...processCreateParams(params),
16881
16811
  });
16882
16812
  };
@@ -16901,7 +16831,7 @@ class ZodBoolean extends ZodType {
16901
16831
  ZodBoolean.create = (params) => {
16902
16832
  return new ZodBoolean({
16903
16833
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
16904
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
16834
+ coerce: params?.coerce || false,
16905
16835
  ...processCreateParams(params),
16906
16836
  });
16907
16837
  };
@@ -16920,7 +16850,7 @@ class ZodDate extends ZodType {
16920
16850
  });
16921
16851
  return INVALID;
16922
16852
  }
16923
- if (isNaN(input.data.getTime())) {
16853
+ if (Number.isNaN(input.data.getTime())) {
16924
16854
  const ctx = this._getOrReturnCtx(input);
16925
16855
  addIssueToContext(ctx, {
16926
16856
  code: ZodIssueCode.invalid_date,
@@ -17011,7 +16941,7 @@ class ZodDate extends ZodType {
17011
16941
  ZodDate.create = (params) => {
17012
16942
  return new ZodDate({
17013
16943
  checks: [],
17014
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
16944
+ coerce: params?.coerce || false,
17015
16945
  typeName: ZodFirstPartyTypeKind.ZodDate,
17016
16946
  ...processCreateParams(params),
17017
16947
  });
@@ -17333,7 +17263,8 @@ class ZodObject extends ZodType {
17333
17263
  return this._cached;
17334
17264
  const shape = this._def.shape();
17335
17265
  const keys = util.objectKeys(shape);
17336
- return (this._cached = { shape, keys });
17266
+ this._cached = { shape, keys };
17267
+ return this._cached;
17337
17268
  }
17338
17269
  _parse(input) {
17339
17270
  const parsedType = this._getType(input);
@@ -17349,8 +17280,7 @@ class ZodObject extends ZodType {
17349
17280
  const { status, ctx } = this._processInputParams(input);
17350
17281
  const { shape, keys: shapeKeys } = this._getCached();
17351
17282
  const extraKeys = [];
17352
- if (!(this._def.catchall instanceof ZodNever &&
17353
- this._def.unknownKeys === "strip")) {
17283
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
17354
17284
  for (const key in ctx.data) {
17355
17285
  if (!shapeKeys.includes(key)) {
17356
17286
  extraKeys.push(key);
@@ -17438,11 +17368,10 @@ class ZodObject extends ZodType {
17438
17368
  ...(message !== undefined
17439
17369
  ? {
17440
17370
  errorMap: (issue, ctx) => {
17441
- var _a, _b, _c, _d;
17442
- 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;
17371
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
17443
17372
  if (issue.code === "unrecognized_keys")
17444
17373
  return {
17445
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
17374
+ message: errorUtil.errToObj(message).message ?? defaultError,
17446
17375
  };
17447
17376
  return {
17448
17377
  message: defaultError,
@@ -17574,11 +17503,11 @@ class ZodObject extends ZodType {
17574
17503
  }
17575
17504
  pick(mask) {
17576
17505
  const shape = {};
17577
- util.objectKeys(mask).forEach((key) => {
17506
+ for (const key of util.objectKeys(mask)) {
17578
17507
  if (mask[key] && this.shape[key]) {
17579
17508
  shape[key] = this.shape[key];
17580
17509
  }
17581
- });
17510
+ }
17582
17511
  return new ZodObject({
17583
17512
  ...this._def,
17584
17513
  shape: () => shape,
@@ -17586,11 +17515,11 @@ class ZodObject extends ZodType {
17586
17515
  }
17587
17516
  omit(mask) {
17588
17517
  const shape = {};
17589
- util.objectKeys(this.shape).forEach((key) => {
17518
+ for (const key of util.objectKeys(this.shape)) {
17590
17519
  if (!mask[key]) {
17591
17520
  shape[key] = this.shape[key];
17592
17521
  }
17593
- });
17522
+ }
17594
17523
  return new ZodObject({
17595
17524
  ...this._def,
17596
17525
  shape: () => shape,
@@ -17604,7 +17533,7 @@ class ZodObject extends ZodType {
17604
17533
  }
17605
17534
  partial(mask) {
17606
17535
  const newShape = {};
17607
- util.objectKeys(this.shape).forEach((key) => {
17536
+ for (const key of util.objectKeys(this.shape)) {
17608
17537
  const fieldSchema = this.shape[key];
17609
17538
  if (mask && !mask[key]) {
17610
17539
  newShape[key] = fieldSchema;
@@ -17612,7 +17541,7 @@ class ZodObject extends ZodType {
17612
17541
  else {
17613
17542
  newShape[key] = fieldSchema.optional();
17614
17543
  }
17615
- });
17544
+ }
17616
17545
  return new ZodObject({
17617
17546
  ...this._def,
17618
17547
  shape: () => newShape,
@@ -17620,7 +17549,7 @@ class ZodObject extends ZodType {
17620
17549
  }
17621
17550
  required(mask) {
17622
17551
  const newShape = {};
17623
- util.objectKeys(this.shape).forEach((key) => {
17552
+ for (const key of util.objectKeys(this.shape)) {
17624
17553
  if (mask && !mask[key]) {
17625
17554
  newShape[key] = this.shape[key];
17626
17555
  }
@@ -17632,7 +17561,7 @@ class ZodObject extends ZodType {
17632
17561
  }
17633
17562
  newShape[key] = newField;
17634
17563
  }
17635
- });
17564
+ }
17636
17565
  return new ZodObject({
17637
17566
  ...this._def,
17638
17567
  shape: () => newShape,
@@ -17765,137 +17694,6 @@ ZodUnion.create = (types, params) => {
17765
17694
  ...processCreateParams(params),
17766
17695
  });
17767
17696
  };
17768
- /////////////////////////////////////////////////////
17769
- /////////////////////////////////////////////////////
17770
- ////////// //////////
17771
- ////////// ZodDiscriminatedUnion //////////
17772
- ////////// //////////
17773
- /////////////////////////////////////////////////////
17774
- /////////////////////////////////////////////////////
17775
- const getDiscriminator = (type) => {
17776
- if (type instanceof ZodLazy) {
17777
- return getDiscriminator(type.schema);
17778
- }
17779
- else if (type instanceof ZodEffects) {
17780
- return getDiscriminator(type.innerType());
17781
- }
17782
- else if (type instanceof ZodLiteral) {
17783
- return [type.value];
17784
- }
17785
- else if (type instanceof ZodEnum) {
17786
- return type.options;
17787
- }
17788
- else if (type instanceof ZodNativeEnum) {
17789
- // eslint-disable-next-line ban/ban
17790
- return util.objectValues(type.enum);
17791
- }
17792
- else if (type instanceof ZodDefault) {
17793
- return getDiscriminator(type._def.innerType);
17794
- }
17795
- else if (type instanceof ZodUndefined) {
17796
- return [undefined];
17797
- }
17798
- else if (type instanceof ZodNull) {
17799
- return [null];
17800
- }
17801
- else if (type instanceof ZodOptional) {
17802
- return [undefined, ...getDiscriminator(type.unwrap())];
17803
- }
17804
- else if (type instanceof ZodNullable) {
17805
- return [null, ...getDiscriminator(type.unwrap())];
17806
- }
17807
- else if (type instanceof ZodBranded) {
17808
- return getDiscriminator(type.unwrap());
17809
- }
17810
- else if (type instanceof ZodReadonly) {
17811
- return getDiscriminator(type.unwrap());
17812
- }
17813
- else if (type instanceof ZodCatch) {
17814
- return getDiscriminator(type._def.innerType);
17815
- }
17816
- else {
17817
- return [];
17818
- }
17819
- };
17820
- class ZodDiscriminatedUnion extends ZodType {
17821
- _parse(input) {
17822
- const { ctx } = this._processInputParams(input);
17823
- if (ctx.parsedType !== ZodParsedType.object) {
17824
- addIssueToContext(ctx, {
17825
- code: ZodIssueCode.invalid_type,
17826
- expected: ZodParsedType.object,
17827
- received: ctx.parsedType,
17828
- });
17829
- return INVALID;
17830
- }
17831
- const discriminator = this.discriminator;
17832
- const discriminatorValue = ctx.data[discriminator];
17833
- const option = this.optionsMap.get(discriminatorValue);
17834
- if (!option) {
17835
- addIssueToContext(ctx, {
17836
- code: ZodIssueCode.invalid_union_discriminator,
17837
- options: Array.from(this.optionsMap.keys()),
17838
- path: [discriminator],
17839
- });
17840
- return INVALID;
17841
- }
17842
- if (ctx.common.async) {
17843
- return option._parseAsync({
17844
- data: ctx.data,
17845
- path: ctx.path,
17846
- parent: ctx,
17847
- });
17848
- }
17849
- else {
17850
- return option._parseSync({
17851
- data: ctx.data,
17852
- path: ctx.path,
17853
- parent: ctx,
17854
- });
17855
- }
17856
- }
17857
- get discriminator() {
17858
- return this._def.discriminator;
17859
- }
17860
- get options() {
17861
- return this._def.options;
17862
- }
17863
- get optionsMap() {
17864
- return this._def.optionsMap;
17865
- }
17866
- /**
17867
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
17868
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
17869
- * have a different value for each object in the union.
17870
- * @param discriminator the name of the discriminator property
17871
- * @param types an array of object schemas
17872
- * @param params
17873
- */
17874
- static create(discriminator, options, params) {
17875
- // Get all the valid discriminator values
17876
- const optionsMap = new Map();
17877
- // try {
17878
- for (const type of options) {
17879
- const discriminatorValues = getDiscriminator(type.shape[discriminator]);
17880
- if (!discriminatorValues.length) {
17881
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
17882
- }
17883
- for (const value of discriminatorValues) {
17884
- if (optionsMap.has(value)) {
17885
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
17886
- }
17887
- optionsMap.set(value, type);
17888
- }
17889
- }
17890
- return new ZodDiscriminatedUnion({
17891
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
17892
- discriminator,
17893
- options,
17894
- optionsMap,
17895
- ...processCreateParams(params),
17896
- });
17897
- }
17898
- }
17899
17697
  function mergeValues(a, b) {
17900
17698
  const aType = getParsedType(a);
17901
17699
  const bType = getParsedType(b);
@@ -17904,9 +17702,7 @@ function mergeValues(a, b) {
17904
17702
  }
17905
17703
  else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
17906
17704
  const bKeys = util.objectKeys(b);
17907
- const sharedKeys = util
17908
- .objectKeys(a)
17909
- .filter((key) => bKeys.indexOf(key) !== -1);
17705
+ const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
17910
17706
  const newObj = { ...a, ...b };
17911
17707
  for (const key of sharedKeys) {
17912
17708
  const sharedValue = mergeValues(a[key], b[key]);
@@ -17933,9 +17729,7 @@ function mergeValues(a, b) {
17933
17729
  }
17934
17730
  return { valid: true, data: newArray };
17935
17731
  }
17936
- else if (aType === ZodParsedType.date &&
17937
- bType === ZodParsedType.date &&
17938
- +a === +b) {
17732
+ else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
17939
17733
  return { valid: true, data: a };
17940
17734
  }
17941
17735
  else {
@@ -17996,6 +17790,7 @@ ZodIntersection.create = (left, right, params) => {
17996
17790
  ...processCreateParams(params),
17997
17791
  });
17998
17792
  };
17793
+ // type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
17999
17794
  class ZodTuple extends ZodType {
18000
17795
  _parse(input) {
18001
17796
  const { status, ctx } = this._processInputParams(input);
@@ -18066,60 +17861,6 @@ ZodTuple.create = (schemas, params) => {
18066
17861
  ...processCreateParams(params),
18067
17862
  });
18068
17863
  };
18069
- class ZodRecord extends ZodType {
18070
- get keySchema() {
18071
- return this._def.keyType;
18072
- }
18073
- get valueSchema() {
18074
- return this._def.valueType;
18075
- }
18076
- _parse(input) {
18077
- const { status, ctx } = this._processInputParams(input);
18078
- if (ctx.parsedType !== ZodParsedType.object) {
18079
- addIssueToContext(ctx, {
18080
- code: ZodIssueCode.invalid_type,
18081
- expected: ZodParsedType.object,
18082
- received: ctx.parsedType,
18083
- });
18084
- return INVALID;
18085
- }
18086
- const pairs = [];
18087
- const keyType = this._def.keyType;
18088
- const valueType = this._def.valueType;
18089
- for (const key in ctx.data) {
18090
- pairs.push({
18091
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
18092
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
18093
- alwaysSet: key in ctx.data,
18094
- });
18095
- }
18096
- if (ctx.common.async) {
18097
- return ParseStatus.mergeObjectAsync(status, pairs);
18098
- }
18099
- else {
18100
- return ParseStatus.mergeObjectSync(status, pairs);
18101
- }
18102
- }
18103
- get element() {
18104
- return this._def.valueType;
18105
- }
18106
- static create(first, second, third) {
18107
- if (second instanceof ZodType) {
18108
- return new ZodRecord({
18109
- keyType: first,
18110
- valueType: second,
18111
- typeName: ZodFirstPartyTypeKind.ZodRecord,
18112
- ...processCreateParams(third),
18113
- });
18114
- }
18115
- return new ZodRecord({
18116
- keyType: ZodString.create(),
18117
- valueType: first,
18118
- typeName: ZodFirstPartyTypeKind.ZodRecord,
18119
- ...processCreateParams(second),
18120
- });
18121
- }
18122
- }
18123
17864
  class ZodMap extends ZodType {
18124
17865
  get keySchema() {
18125
17866
  return this._def.keyType;
@@ -18273,134 +18014,6 @@ ZodSet.create = (valueType, params) => {
18273
18014
  ...processCreateParams(params),
18274
18015
  });
18275
18016
  };
18276
- class ZodFunction extends ZodType {
18277
- constructor() {
18278
- super(...arguments);
18279
- this.validate = this.implement;
18280
- }
18281
- _parse(input) {
18282
- const { ctx } = this._processInputParams(input);
18283
- if (ctx.parsedType !== ZodParsedType.function) {
18284
- addIssueToContext(ctx, {
18285
- code: ZodIssueCode.invalid_type,
18286
- expected: ZodParsedType.function,
18287
- received: ctx.parsedType,
18288
- });
18289
- return INVALID;
18290
- }
18291
- function makeArgsIssue(args, error) {
18292
- return makeIssue({
18293
- data: args,
18294
- path: ctx.path,
18295
- errorMaps: [
18296
- ctx.common.contextualErrorMap,
18297
- ctx.schemaErrorMap,
18298
- getErrorMap(),
18299
- errorMap,
18300
- ].filter((x) => !!x),
18301
- issueData: {
18302
- code: ZodIssueCode.invalid_arguments,
18303
- argumentsError: error,
18304
- },
18305
- });
18306
- }
18307
- function makeReturnsIssue(returns, error) {
18308
- return makeIssue({
18309
- data: returns,
18310
- path: ctx.path,
18311
- errorMaps: [
18312
- ctx.common.contextualErrorMap,
18313
- ctx.schemaErrorMap,
18314
- getErrorMap(),
18315
- errorMap,
18316
- ].filter((x) => !!x),
18317
- issueData: {
18318
- code: ZodIssueCode.invalid_return_type,
18319
- returnTypeError: error,
18320
- },
18321
- });
18322
- }
18323
- const params = { errorMap: ctx.common.contextualErrorMap };
18324
- const fn = ctx.data;
18325
- if (this._def.returns instanceof ZodPromise) {
18326
- // Would love a way to avoid disabling this rule, but we need
18327
- // an alias (using an arrow function was what caused 2651).
18328
- // eslint-disable-next-line @typescript-eslint/no-this-alias
18329
- const me = this;
18330
- return OK(async function (...args) {
18331
- const error = new ZodError([]);
18332
- const parsedArgs = await me._def.args
18333
- .parseAsync(args, params)
18334
- .catch((e) => {
18335
- error.addIssue(makeArgsIssue(args, e));
18336
- throw error;
18337
- });
18338
- const result = await Reflect.apply(fn, this, parsedArgs);
18339
- const parsedReturns = await me._def.returns._def.type
18340
- .parseAsync(result, params)
18341
- .catch((e) => {
18342
- error.addIssue(makeReturnsIssue(result, e));
18343
- throw error;
18344
- });
18345
- return parsedReturns;
18346
- });
18347
- }
18348
- else {
18349
- // Would love a way to avoid disabling this rule, but we need
18350
- // an alias (using an arrow function was what caused 2651).
18351
- // eslint-disable-next-line @typescript-eslint/no-this-alias
18352
- const me = this;
18353
- return OK(function (...args) {
18354
- const parsedArgs = me._def.args.safeParse(args, params);
18355
- if (!parsedArgs.success) {
18356
- throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
18357
- }
18358
- const result = Reflect.apply(fn, this, parsedArgs.data);
18359
- const parsedReturns = me._def.returns.safeParse(result, params);
18360
- if (!parsedReturns.success) {
18361
- throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
18362
- }
18363
- return parsedReturns.data;
18364
- });
18365
- }
18366
- }
18367
- parameters() {
18368
- return this._def.args;
18369
- }
18370
- returnType() {
18371
- return this._def.returns;
18372
- }
18373
- args(...items) {
18374
- return new ZodFunction({
18375
- ...this._def,
18376
- args: ZodTuple.create(items).rest(ZodUnknown.create()),
18377
- });
18378
- }
18379
- returns(returnType) {
18380
- return new ZodFunction({
18381
- ...this._def,
18382
- returns: returnType,
18383
- });
18384
- }
18385
- implement(func) {
18386
- const validatedFunc = this.parse(func);
18387
- return validatedFunc;
18388
- }
18389
- strictImplement(func) {
18390
- const validatedFunc = this.parse(func);
18391
- return validatedFunc;
18392
- }
18393
- static create(args, returns, params) {
18394
- return new ZodFunction({
18395
- args: (args
18396
- ? args
18397
- : ZodTuple.create([]).rest(ZodUnknown.create())),
18398
- returns: returns || ZodUnknown.create(),
18399
- typeName: ZodFirstPartyTypeKind.ZodFunction,
18400
- ...processCreateParams(params),
18401
- });
18402
- }
18403
- }
18404
18017
  class ZodLazy extends ZodType {
18405
18018
  get schema() {
18406
18019
  return this._def.getter();
@@ -18465,10 +18078,10 @@ class ZodEnum extends ZodType {
18465
18078
  });
18466
18079
  return INVALID;
18467
18080
  }
18468
- if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
18469
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
18081
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
18082
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
18470
18083
  }
18471
- if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
18084
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
18472
18085
  const ctx = this._getOrReturnCtx(input);
18473
18086
  const expectedValues = this._def.values;
18474
18087
  addIssueToContext(ctx, {
@@ -18527,8 +18140,7 @@ class ZodNativeEnum extends ZodType {
18527
18140
  _parse(input) {
18528
18141
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
18529
18142
  const ctx = this._getOrReturnCtx(input);
18530
- if (ctx.parsedType !== ZodParsedType.string &&
18531
- ctx.parsedType !== ZodParsedType.number) {
18143
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
18532
18144
  const expectedValues = util.objectValues(nativeEnumValues);
18533
18145
  addIssueToContext(ctx, {
18534
18146
  expected: util.joinValues(expectedValues),
@@ -18537,10 +18149,10 @@ class ZodNativeEnum extends ZodType {
18537
18149
  });
18538
18150
  return INVALID;
18539
18151
  }
18540
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
18541
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)));
18152
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
18153
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
18542
18154
  }
18543
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
18155
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
18544
18156
  const expectedValues = util.objectValues(nativeEnumValues);
18545
18157
  addIssueToContext(ctx, {
18546
18158
  received: ctx.data,
@@ -18569,8 +18181,7 @@ class ZodPromise extends ZodType {
18569
18181
  }
18570
18182
  _parse(input) {
18571
18183
  const { ctx } = this._processInputParams(input);
18572
- if (ctx.parsedType !== ZodParsedType.promise &&
18573
- ctx.common.async === false) {
18184
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
18574
18185
  addIssueToContext(ctx, {
18575
18186
  code: ZodIssueCode.invalid_type,
18576
18187
  expected: ZodParsedType.promise,
@@ -18578,9 +18189,7 @@ class ZodPromise extends ZodType {
18578
18189
  });
18579
18190
  return INVALID;
18580
18191
  }
18581
- const promisified = ctx.parsedType === ZodParsedType.promise
18582
- ? ctx.data
18583
- : Promise.resolve(ctx.data);
18192
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
18584
18193
  return OK(promisified.then((data) => {
18585
18194
  return this._def.type.parseAsync(data, {
18586
18195
  path: ctx.path,
@@ -18686,9 +18295,7 @@ class ZodEffects extends ZodType {
18686
18295
  return { status: status.value, value: inner.value };
18687
18296
  }
18688
18297
  else {
18689
- return this._def.schema
18690
- ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
18691
- .then((inner) => {
18298
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
18692
18299
  if (inner.status === "aborted")
18693
18300
  return INVALID;
18694
18301
  if (inner.status === "dirty")
@@ -18715,12 +18322,13 @@ class ZodEffects extends ZodType {
18715
18322
  return { status: status.value, value: result };
18716
18323
  }
18717
18324
  else {
18718
- return this._def.schema
18719
- ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
18720
- .then((base) => {
18325
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
18721
18326
  if (!isValid(base))
18722
18327
  return base;
18723
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
18328
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
18329
+ status: status.value,
18330
+ value: result,
18331
+ }));
18724
18332
  });
18725
18333
  }
18726
18334
  }
@@ -18802,9 +18410,7 @@ ZodDefault.create = (type, params) => {
18802
18410
  return new ZodDefault({
18803
18411
  innerType: type,
18804
18412
  typeName: ZodFirstPartyTypeKind.ZodDefault,
18805
- defaultValue: typeof params.default === "function"
18806
- ? params.default
18807
- : () => params.default,
18413
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
18808
18414
  ...processCreateParams(params),
18809
18415
  });
18810
18416
  };
@@ -18888,7 +18494,6 @@ ZodNaN.create = (params) => {
18888
18494
  ...processCreateParams(params),
18889
18495
  });
18890
18496
  };
18891
- const BRAND = Symbol("zod_brand");
18892
18497
  class ZodBranded extends ZodType {
18893
18498
  _parse(input) {
18894
18499
  const { ctx } = this._processInputParams(input);
@@ -18970,9 +18575,7 @@ class ZodReadonly extends ZodType {
18970
18575
  }
18971
18576
  return data;
18972
18577
  };
18973
- return isAsync(result)
18974
- ? result.then((data) => freeze(data))
18975
- : freeze(result);
18578
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
18976
18579
  }
18977
18580
  unwrap() {
18978
18581
  return this._def.innerType;
@@ -18985,60 +18588,6 @@ ZodReadonly.create = (type, params) => {
18985
18588
  ...processCreateParams(params),
18986
18589
  });
18987
18590
  };
18988
- ////////////////////////////////////////
18989
- ////////////////////////////////////////
18990
- ////////// //////////
18991
- ////////// z.custom //////////
18992
- ////////// //////////
18993
- ////////////////////////////////////////
18994
- ////////////////////////////////////////
18995
- function cleanParams(params, data) {
18996
- const p = typeof params === "function"
18997
- ? params(data)
18998
- : typeof params === "string"
18999
- ? { message: params }
19000
- : params;
19001
- const p2 = typeof p === "string" ? { message: p } : p;
19002
- return p2;
19003
- }
19004
- function custom(check, _params = {},
19005
- /**
19006
- * @deprecated
19007
- *
19008
- * Pass `fatal` into the params object instead:
19009
- *
19010
- * ```ts
19011
- * z.string().custom((val) => val.length > 5, { fatal: false })
19012
- * ```
19013
- *
19014
- */
19015
- fatal) {
19016
- if (check)
19017
- return ZodAny.create().superRefine((data, ctx) => {
19018
- var _a, _b;
19019
- const r = check(data);
19020
- if (r instanceof Promise) {
19021
- return r.then((r) => {
19022
- var _a, _b;
19023
- if (!r) {
19024
- const params = cleanParams(_params, data);
19025
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
19026
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
19027
- }
19028
- });
19029
- }
19030
- if (!r) {
19031
- const params = cleanParams(_params, data);
19032
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
19033
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
19034
- }
19035
- return;
19036
- });
19037
- return ZodAny.create();
19038
- }
19039
- const late = {
19040
- object: ZodObject.lazycreate,
19041
- };
19042
18591
  var ZodFirstPartyTypeKind;
19043
18592
  (function (ZodFirstPartyTypeKind) {
19044
18593
  ZodFirstPartyTypeKind["ZodString"] = "ZodString";
@@ -19078,203 +18627,52 @@ var ZodFirstPartyTypeKind;
19078
18627
  ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
19079
18628
  ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
19080
18629
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
19081
- const instanceOfType = (
19082
- // const instanceOfType = <T extends new (...args: any[]) => any>(
19083
- cls, params = {
19084
- message: `Input not instance of ${cls.name}`,
19085
- }) => custom((data) => data instanceof cls, params);
19086
18630
  const stringType = ZodString.create;
19087
18631
  const numberType = ZodNumber.create;
19088
- const nanType = ZodNaN.create;
19089
- const bigIntType = ZodBigInt.create;
19090
18632
  const booleanType = ZodBoolean.create;
19091
- const dateType = ZodDate.create;
19092
- const symbolType = ZodSymbol.create;
19093
- const undefinedType = ZodUndefined.create;
19094
- const nullType = ZodNull.create;
19095
- const anyType = ZodAny.create;
19096
- const unknownType = ZodUnknown.create;
19097
- const neverType = ZodNever.create;
19098
- const voidType = ZodVoid.create;
19099
- const arrayType = ZodArray.create;
18633
+ ZodNever.create;
18634
+ ZodArray.create;
19100
18635
  const objectType = ZodObject.create;
19101
- const strictObjectType = ZodObject.strictCreate;
19102
- const unionType = ZodUnion.create;
19103
- const discriminatedUnionType = ZodDiscriminatedUnion.create;
19104
- const intersectionType = ZodIntersection.create;
19105
- const tupleType = ZodTuple.create;
19106
- const recordType = ZodRecord.create;
19107
- const mapType = ZodMap.create;
19108
- const setType = ZodSet.create;
19109
- const functionType = ZodFunction.create;
19110
- const lazyType = ZodLazy.create;
19111
- const literalType = ZodLiteral.create;
19112
- const enumType = ZodEnum.create;
19113
- const nativeEnumType = ZodNativeEnum.create;
19114
- const promiseType = ZodPromise.create;
19115
- const effectsType = ZodEffects.create;
19116
- const optionalType = ZodOptional.create;
19117
- const nullableType = ZodNullable.create;
19118
- const preprocessType = ZodEffects.createWithPreprocess;
19119
- const pipelineType = ZodPipeline.create;
19120
- const ostring = () => stringType().optional();
19121
- const onumber = () => numberType().optional();
19122
- const oboolean = () => booleanType().optional();
19123
- const coerce = {
19124
- string: ((arg) => ZodString.create({ ...arg, coerce: true })),
19125
- number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
19126
- boolean: ((arg) => ZodBoolean.create({
19127
- ...arg,
19128
- coerce: true,
19129
- })),
19130
- bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
19131
- date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
19132
- };
19133
- const NEVER = INVALID;
19134
-
19135
- var z = /*#__PURE__*/Object.freeze({
19136
- __proto__: null,
19137
- defaultErrorMap: errorMap,
19138
- setErrorMap: setErrorMap,
19139
- getErrorMap: getErrorMap,
19140
- makeIssue: makeIssue,
19141
- EMPTY_PATH: EMPTY_PATH,
19142
- addIssueToContext: addIssueToContext,
19143
- ParseStatus: ParseStatus,
19144
- INVALID: INVALID,
19145
- DIRTY: DIRTY,
19146
- OK: OK,
19147
- isAborted: isAborted,
19148
- isDirty: isDirty,
19149
- isValid: isValid,
19150
- isAsync: isAsync,
19151
- get util () { return util; },
19152
- get objectUtil () { return objectUtil; },
19153
- ZodParsedType: ZodParsedType,
19154
- getParsedType: getParsedType,
19155
- ZodType: ZodType,
19156
- datetimeRegex: datetimeRegex,
19157
- ZodString: ZodString,
19158
- ZodNumber: ZodNumber,
19159
- ZodBigInt: ZodBigInt,
19160
- ZodBoolean: ZodBoolean,
19161
- ZodDate: ZodDate,
19162
- ZodSymbol: ZodSymbol,
19163
- ZodUndefined: ZodUndefined,
19164
- ZodNull: ZodNull,
19165
- ZodAny: ZodAny,
19166
- ZodUnknown: ZodUnknown,
19167
- ZodNever: ZodNever,
19168
- ZodVoid: ZodVoid,
19169
- ZodArray: ZodArray,
19170
- ZodObject: ZodObject,
19171
- ZodUnion: ZodUnion,
19172
- ZodDiscriminatedUnion: ZodDiscriminatedUnion,
19173
- ZodIntersection: ZodIntersection,
19174
- ZodTuple: ZodTuple,
19175
- ZodRecord: ZodRecord,
19176
- ZodMap: ZodMap,
19177
- ZodSet: ZodSet,
19178
- ZodFunction: ZodFunction,
19179
- ZodLazy: ZodLazy,
19180
- ZodLiteral: ZodLiteral,
19181
- ZodEnum: ZodEnum,
19182
- ZodNativeEnum: ZodNativeEnum,
19183
- ZodPromise: ZodPromise,
19184
- ZodEffects: ZodEffects,
19185
- ZodTransformer: ZodEffects,
19186
- ZodOptional: ZodOptional,
19187
- ZodNullable: ZodNullable,
19188
- ZodDefault: ZodDefault,
19189
- ZodCatch: ZodCatch,
19190
- ZodNaN: ZodNaN,
19191
- BRAND: BRAND,
19192
- ZodBranded: ZodBranded,
19193
- ZodPipeline: ZodPipeline,
19194
- ZodReadonly: ZodReadonly,
19195
- custom: custom,
19196
- Schema: ZodType,
19197
- ZodSchema: ZodType,
19198
- late: late,
19199
- get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
19200
- coerce: coerce,
19201
- any: anyType,
19202
- array: arrayType,
19203
- bigint: bigIntType,
19204
- boolean: booleanType,
19205
- date: dateType,
19206
- discriminatedUnion: discriminatedUnionType,
19207
- effect: effectsType,
19208
- 'enum': enumType,
19209
- 'function': functionType,
19210
- 'instanceof': instanceOfType,
19211
- intersection: intersectionType,
19212
- lazy: lazyType,
19213
- literal: literalType,
19214
- map: mapType,
19215
- nan: nanType,
19216
- nativeEnum: nativeEnumType,
19217
- never: neverType,
19218
- 'null': nullType,
19219
- nullable: nullableType,
19220
- number: numberType,
19221
- object: objectType,
19222
- oboolean: oboolean,
19223
- onumber: onumber,
19224
- optional: optionalType,
19225
- ostring: ostring,
19226
- pipeline: pipelineType,
19227
- preprocess: preprocessType,
19228
- promise: promiseType,
19229
- record: recordType,
19230
- set: setType,
19231
- strictObject: strictObjectType,
19232
- string: stringType,
19233
- symbol: symbolType,
19234
- transformer: effectsType,
19235
- tuple: tupleType,
19236
- 'undefined': undefinedType,
19237
- union: unionType,
19238
- unknown: unknownType,
19239
- 'void': voidType,
19240
- NEVER: NEVER,
19241
- ZodIssueCode: ZodIssueCode,
19242
- quotelessJson: quotelessJson,
19243
- ZodError: ZodError
19244
- });
18636
+ ZodUnion.create;
18637
+ ZodIntersection.create;
18638
+ ZodTuple.create;
18639
+ ZodEnum.create;
18640
+ ZodPromise.create;
18641
+ ZodOptional.create;
18642
+ ZodNullable.create;
19245
18643
 
19246
18644
  const phoneRegex = new RegExp(/^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)])?([-]?[\s]?[0-9])+$/);
19247
18645
  // Shipping address schema
19248
- const customerSchema = z.object({
19249
- email: z.string().email("invalid_email"),
19250
- firstName: z.string().min(1, "required_error"),
19251
- lastName: z.string().min(1, "required_error"),
19252
- address: z.object({
19253
- line1: z.string().min(1, "required_error"),
19254
- line2: z.string().optional(),
19255
- city: z.string().min(1, "required_error"),
19256
- state: z.string().optional(),
19257
- zipCode: z.string().min(5, "invalid_zipCode"),
19258
- country: z.string().min(1, "required_error"),
19259
- countryCode: z.string().min(1, "required_error"),
18646
+ const customerSchema = objectType({
18647
+ email: stringType().email("invalid_email"),
18648
+ firstName: stringType().min(1, "required_error"),
18649
+ lastName: stringType().min(1, "required_error"),
18650
+ address: objectType({
18651
+ line1: stringType().min(1, "required_error"),
18652
+ line2: stringType().optional(),
18653
+ city: stringType().min(1, "required_error"),
18654
+ state: stringType().optional(),
18655
+ zipCode: stringType().min(5, "invalid_zipCode"),
18656
+ country: stringType().min(1, "required_error"),
18657
+ countryCode: stringType().min(1, "required_error"),
19260
18658
  }),
19261
- saveInfo: z.boolean().optional(),
19262
- phone: z.string().regex(phoneRegex, "invalid_phone"),
18659
+ saveInfo: booleanType().optional(),
18660
+ phone: stringType().regex(phoneRegex, "invalid_phone"),
19263
18661
  });
19264
18662
  // Shipping method schema
19265
- const shippingMethodSchema = z.object({
19266
- rateId: z.string().min(1, "required_error"),
19267
- provider: z.string().min(1, "required_error"),
19268
- price: z.number().min(1, "required_error"),
19269
- name: z.string().min(1, "required_error"),
19270
- pickupPointId: z.string().optional(),
19271
- pickupPointDisplayName: z.string().optional(),
18663
+ const shippingMethodSchema = objectType({
18664
+ rateId: stringType().min(1, "required_error"),
18665
+ provider: stringType().min(1, "required_error"),
18666
+ price: numberType().min(1, "required_error"),
18667
+ name: stringType().min(1, "required_error"),
18668
+ pickupPointId: stringType().optional(),
18669
+ pickupPointDisplayName: stringType().optional(),
19272
18670
  });
19273
18671
  // Combined checkout schema
19274
- z.object({
18672
+ objectType({
19275
18673
  customer: customerSchema,
19276
18674
  shipping: shippingMethodSchema,
19277
- customerId: z.string().optional(),
18675
+ customerId: stringType().optional(),
19278
18676
  });
19279
18677
 
19280
18678
  const formatAddress = (address) => {
@@ -35764,32 +35162,48 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
35764
35162
  "hidden md:grid": !isOpen,
35765
35163
  grid: isOpen,
35766
35164
  }) }, lineItems.map((item, index) => {
35767
- var _a, _b, _c, _d, _e, _f, _g;
35768
- const productAppliedDiscounts = appliedDiscounts.filter(({ discount }) => discount.allowedProductIDs.includes(item.productData.productId));
35769
- const discount = productAppliedDiscounts.length > 0
35770
- ? productAppliedDiscounts.reduce((acc, curr) => {
35771
- return curr.amount > acc.amount ? curr : acc;
35772
- }, productAppliedDiscounts[0])
35165
+ var _a, _b, _c, _d, _e, _f;
35166
+ const finalItem = ((_a = item.productData) === null || _a === void 0 ? void 0 : _a.selectedVariant) || item.productData;
35167
+ const productAppliedDiscounts = appliedDiscounts.filter((discount) => discount.allowedLineItems.some((allowedLineItem) => allowedLineItem.productId === item.productData.productId));
35168
+ const formattedProductAppliedDiscounts = productAppliedDiscounts.map((discount) => {
35169
+ var _a;
35170
+ const elegibleLineItems = discount.allowedLineItems.find((allowedLineItem) => allowedLineItem.productId === item.productData.productId);
35171
+ if (!elegibleLineItems)
35172
+ return 0;
35173
+ const elegibleQuantity = elegibleLineItems.quantity;
35174
+ const elegibleTotalAmount = ((_a = finalItem === null || finalItem === void 0 ? void 0 : finalItem.priceInCents) !== null && _a !== void 0 ? _a : 0) * elegibleQuantity;
35175
+ if (discount.discount.valueType === "PERCENTAGE") {
35176
+ const percentage = discount.discount.value / 100;
35177
+ return elegibleTotalAmount * percentage;
35178
+ }
35179
+ else if (discount.discount.valueType === "FREE") {
35180
+ return elegibleTotalAmount;
35181
+ }
35182
+ return elegibleQuantity * discount.discount.value;
35183
+ });
35184
+ const totalDiscountAmount = formattedProductAppliedDiscounts.length > 0
35185
+ ? formattedProductAppliedDiscounts.reduce((acc, curr) => {
35186
+ return acc + curr;
35187
+ }, 0)
35773
35188
  : null;
35774
- const isDiscounted = !!discount;
35775
- const productItem = ((_a = item.productData) === null || _a === void 0 ? void 0 : _a.selectedVariant) || item.productData;
35776
- const discountedPrice = productItem.priceInCents - ((_b = discount === null || discount === void 0 ? void 0 : discount.amount) !== null && _b !== void 0 ? _b : 0);
35189
+ const isDiscounted = !!totalDiscountAmount;
35190
+ const discountedPrice = finalItem.priceInCents - (totalDiscountAmount !== null && totalDiscountAmount !== void 0 ? totalDiscountAmount : 0);
35777
35191
  return (React.createElement("div", { key: index, className: "flex items-center" },
35778
35192
  React.createElement("div", { className: "relative" },
35779
- React.createElement("div", { className: "w-16 h-16 bg-secondary rounded-lg overflow-hidden relative" }, (productItem === null || productItem === void 0 ? void 0 : productItem.images[0]) && (React.createElement("img", { src: productItem.images[0] ||
35780
- ((_c = item === null || item === void 0 ? void 0 : item.productData) === null || _c === void 0 ? void 0 : _c.images[0]) ||
35781
- "/placeholder.svg", alt: ((_d = item.productData) === null || _d === void 0 ? void 0 : _d.title) || "", className: "object-cover w-full h-full", sizes: "64px" }))),
35193
+ React.createElement("div", { className: "w-16 h-16 bg-secondary rounded-lg overflow-hidden relative" }, (finalItem === null || finalItem === void 0 ? void 0 : finalItem.images[0]) && (React.createElement("img", { src: finalItem.images[0] ||
35194
+ ((_b = item === null || item === void 0 ? void 0 : item.productData) === null || _b === void 0 ? void 0 : _b.images[0]) ||
35195
+ "/placeholder.svg", alt: ((_c = item.productData) === null || _c === void 0 ? void 0 : _c.title) || "", className: "object-cover w-full h-full", sizes: "64px" }))),
35782
35196
  React.createElement("div", { className: "absolute -top-2 -right-2 w-6 h-6 bg-primary rounded-full flex items-center text-background justify-center text-sm" }, item.quantity)),
35783
35197
  React.createElement("div", { className: "ml-4 flex-1" },
35784
- React.createElement("h3", { className: "text-lg font-medium" }, (_e = item.productData) === null || _e === void 0 ? void 0 : _e.title),
35198
+ React.createElement("h3", { className: "text-lg font-medium" }, (_d = item.productData) === null || _d === void 0 ? void 0 : _d.title),
35785
35199
  React.createElement("p", { className: "text-muted-foreground text-ellipsis line-clamp-1 md:max-w-[75%] text-sm" }, item.variantOptions
35786
35200
  .map((option) => `${option.name}: ${option.value}`)
35787
35201
  .join(", "))),
35788
35202
  React.createElement("div", { className: "text-right" }, isDiscounted ? (React.createElement("div", { className: "flex flex-col" },
35789
- React.createElement("p", { className: "text-sm font-medium -mb-0.5 line-through text-muted-foreground" }, storeHelpers.formatPrice((_f = productItem === null || productItem === void 0 ? void 0 : productItem.priceInCents) !== null && _f !== void 0 ? _f : 0, currency, exchangeRate)),
35203
+ React.createElement("p", { className: "text-sm font-medium -mb-0.5 line-through text-muted-foreground" }, storeHelpers.formatPrice((_e = finalItem === null || finalItem === void 0 ? void 0 : finalItem.priceInCents) !== null && _e !== void 0 ? _e : 0, currency, exchangeRate)),
35790
35204
  React.createElement("p", { className: "text-lg font-medium" }, discountedPrice <= 0
35791
35205
  ? t("CheckoutEmbed.Summary.free")
35792
- : storeHelpers.formatPrice(discountedPrice, currency, exchangeRate)))) : (React.createElement("p", { className: "text-lg font-medium" }, storeHelpers.formatPrice((_g = productItem === null || productItem === void 0 ? void 0 : productItem.priceInCents) !== null && _g !== void 0 ? _g : 0, currency, exchangeRate))))));
35206
+ : storeHelpers.formatPrice(discountedPrice, currency, exchangeRate)))) : (React.createElement("p", { className: "text-lg font-medium" }, storeHelpers.formatPrice((_f = finalItem === null || finalItem === void 0 ? void 0 : finalItem.priceInCents) !== null && _f !== void 0 ? _f : 0, currency, exchangeRate))))));
35793
35207
  }))));
35794
35208
  }
35795
35209
  function DiscountItem({ id, removeDiscount, label, canRemove, }) {