@fiction/sdk 1.0.3 → 1.0.4

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/sdk.js CHANGED
@@ -79,11 +79,11 @@ function Ie(e) {
79
79
  return e == null;
80
80
  }
81
81
  s(Ie, "nullish");
82
- function Se(e) {
82
+ function Ae(e) {
83
83
  const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
84
84
  return e.slice(t, n);
85
85
  }
86
- s(Se, "cleanRegex");
86
+ s(Ae, "cleanRegex");
87
87
  function qt(e, t) {
88
88
  const n = (e.toString().split(".")[1] || "").length, o = t.toString();
89
89
  let r = (o.split(".")[1] || "").length;
@@ -358,10 +358,10 @@ function R(e, t, n) {
358
358
  return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
359
359
  }
360
360
  s(R, "finalizeIssue");
361
- function Ae(e) {
361
+ function Se(e) {
362
362
  return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
363
363
  }
364
- s(Ae, "getLengthableOrigin");
364
+ s(Se, "getLengthableOrigin");
365
365
  function q(...e) {
366
366
  const [t, n, o] = e;
367
367
  return typeof t == "string" ? {
@@ -459,7 +459,7 @@ const Ee = /* @__PURE__ */ s((e) => (t, n, o, r) => {
459
459
  }, "_safeEncode"), vn = /* @__PURE__ */ s((e) => (t, n, o) => fe(e)(t, n, o), "_safeDecode"), _n = /* @__PURE__ */ s((e) => async (t, n, o) => {
460
460
  const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
461
461
  return me(e)(t, n, r);
462
- }, "_safeEncodeAsync"), bn = /* @__PURE__ */ s((e) => async (t, n, o) => me(e)(t, n, o), "_safeDecodeAsync"), wn = /^[cC][^\s-]{8,}$/, kn = /^[0-9a-z]+$/, zn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Zn = /^[0-9a-vA-V]{20}$/, $n = /^[A-Za-z0-9]{27}$/, yn = /^[a-zA-Z0-9_-]{21}$/, In = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Sn = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, We = /* @__PURE__ */ s((e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, "uuid"), An = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, En = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
462
+ }, "_safeEncodeAsync"), bn = /* @__PURE__ */ s((e) => async (t, n, o) => me(e)(t, n, o), "_safeDecodeAsync"), wn = /^[cC][^\s-]{8,}$/, kn = /^[0-9a-z]+$/, zn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Zn = /^[0-9a-vA-V]{20}$/, $n = /^[A-Za-z0-9]{27}$/, yn = /^[a-zA-Z0-9_-]{21}$/, In = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, An = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, We = /* @__PURE__ */ s((e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, "uuid"), Sn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, En = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
463
463
  function Tn() {
464
464
  return new RegExp(En, "u");
465
465
  }
@@ -484,7 +484,7 @@ s(Rn, "datetime$1");
484
484
  const Ln = /* @__PURE__ */ s((e) => {
485
485
  const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
486
486
  return new RegExp(`^${t}$`);
487
- }, "string$1"), Mn = /^-?\d+$/, Vn = /^-?\d+(?:\.\d+)?/, Bn = /^(?:true|false)$/i, Wn = /^[^A-Z]*$/, Gn = /^[^a-z]*$/, A = /* @__PURE__ */ u("$ZodCheck", (e, t) => {
487
+ }, "string$1"), Mn = /^-?\d+$/, Vn = /^-?\d+(?:\.\d+)?/, Bn = /^(?:true|false)$/i, Wn = /^[^A-Z]*$/, Gn = /^[^a-z]*$/, S = /* @__PURE__ */ u("$ZodCheck", (e, t) => {
488
488
  var n;
489
489
  e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
490
490
  }), kt = {
@@ -492,7 +492,7 @@ const Ln = /* @__PURE__ */ s((e) => {
492
492
  bigint: "bigint",
493
493
  object: "date"
494
494
  }, zt = /* @__PURE__ */ u("$ZodCheckLessThan", (e, t) => {
495
- A.init(e, t);
495
+ S.init(e, t);
496
496
  const n = kt[typeof t.value];
497
497
  e._zod.onattach.push((o) => {
498
498
  const r = o._zod.bag, i = (t.inclusive ? r.maximum : r.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
@@ -509,7 +509,7 @@ const Ln = /* @__PURE__ */ s((e) => {
509
509
  });
510
510
  };
511
511
  }), Zt = /* @__PURE__ */ u("$ZodCheckGreaterThan", (e, t) => {
512
- A.init(e, t);
512
+ S.init(e, t);
513
513
  const n = kt[typeof t.value];
514
514
  e._zod.onattach.push((o) => {
515
515
  const r = o._zod.bag, i = (t.inclusive ? r.minimum : r.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
@@ -526,7 +526,7 @@ const Ln = /* @__PURE__ */ s((e) => {
526
526
  });
527
527
  };
528
528
  }), Jn = /* @__PURE__ */ u("$ZodCheckMultipleOf", (e, t) => {
529
- A.init(e, t), e._zod.onattach.push((n) => {
529
+ S.init(e, t), e._zod.onattach.push((n) => {
530
530
  var o;
531
531
  (o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
532
532
  }), e._zod.check = (n) => {
@@ -542,7 +542,7 @@ const Ln = /* @__PURE__ */ s((e) => {
542
542
  });
543
543
  };
544
544
  }), Kn = /* @__PURE__ */ u("$ZodCheckNumberFormat", (e, t) => {
545
- A.init(e, t), t.format = t.format || "float64";
545
+ S.init(e, t), t.format = t.format || "float64";
546
546
  const n = t.format?.includes("int"), o = n ? "int" : "number", [r, i] = Qt[t.format];
547
547
  e._zod.onattach.push((a) => {
548
548
  const c = a._zod.bag;
@@ -600,7 +600,7 @@ const Ln = /* @__PURE__ */ s((e) => {
600
600
  };
601
601
  }), qn = /* @__PURE__ */ u("$ZodCheckMaxLength", (e, t) => {
602
602
  var n;
603
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
603
+ S.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
604
604
  const r = o.value;
605
605
  return !Ie(r) && r.length !== void 0;
606
606
  }), e._zod.onattach.push((o) => {
@@ -610,7 +610,7 @@ const Ln = /* @__PURE__ */ s((e) => {
610
610
  const r = o.value;
611
611
  if (r.length <= t.maximum)
612
612
  return;
613
- const a = Ae(r);
613
+ const a = Se(r);
614
614
  o.issues.push({
615
615
  origin: a,
616
616
  code: "too_big",
@@ -623,7 +623,7 @@ const Ln = /* @__PURE__ */ s((e) => {
623
623
  };
624
624
  }), Yn = /* @__PURE__ */ u("$ZodCheckMinLength", (e, t) => {
625
625
  var n;
626
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
626
+ S.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
627
627
  const r = o.value;
628
628
  return !Ie(r) && r.length !== void 0;
629
629
  }), e._zod.onattach.push((o) => {
@@ -633,7 +633,7 @@ const Ln = /* @__PURE__ */ s((e) => {
633
633
  const r = o.value;
634
634
  if (r.length >= t.minimum)
635
635
  return;
636
- const a = Ae(r);
636
+ const a = Se(r);
637
637
  o.issues.push({
638
638
  origin: a,
639
639
  code: "too_small",
@@ -646,7 +646,7 @@ const Ln = /* @__PURE__ */ s((e) => {
646
646
  };
647
647
  }), Xn = /* @__PURE__ */ u("$ZodCheckLengthEquals", (e, t) => {
648
648
  var n;
649
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
649
+ S.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
650
650
  const r = o.value;
651
651
  return !Ie(r) && r.length !== void 0;
652
652
  }), e._zod.onattach.push((o) => {
@@ -656,7 +656,7 @@ const Ln = /* @__PURE__ */ s((e) => {
656
656
  const r = o.value, i = r.length;
657
657
  if (i === t.length)
658
658
  return;
659
- const a = Ae(r), c = i > t.length;
659
+ const a = Se(r), c = i > t.length;
660
660
  o.issues.push({
661
661
  origin: a,
662
662
  ...c ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
@@ -669,7 +669,7 @@ const Ln = /* @__PURE__ */ s((e) => {
669
669
  };
670
670
  }), ge = /* @__PURE__ */ u("$ZodCheckStringFormat", (e, t) => {
671
671
  var n, o;
672
- A.init(e, t), e._zod.onattach.push((r) => {
672
+ S.init(e, t), e._zod.onattach.push((r) => {
673
673
  const i = r._zod.bag;
674
674
  i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
675
675
  }), t.pattern ? (n = e._zod).check ?? (n.check = (r) => {
@@ -701,7 +701,7 @@ const Ln = /* @__PURE__ */ s((e) => {
701
701
  }), eo = /* @__PURE__ */ u("$ZodCheckUpperCase", (e, t) => {
702
702
  t.pattern ?? (t.pattern = Gn), ge.init(e, t);
703
703
  }), to = /* @__PURE__ */ u("$ZodCheckIncludes", (e, t) => {
704
- A.init(e, t);
704
+ S.init(e, t);
705
705
  const n = B(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
706
706
  t.pattern = o, e._zod.onattach.push((r) => {
707
707
  const i = r._zod.bag;
@@ -718,7 +718,7 @@ const Ln = /* @__PURE__ */ s((e) => {
718
718
  });
719
719
  };
720
720
  }), no = /* @__PURE__ */ u("$ZodCheckStartsWith", (e, t) => {
721
- A.init(e, t);
721
+ S.init(e, t);
722
722
  const n = new RegExp(`^${B(t.prefix)}.*`);
723
723
  t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
724
724
  const r = o._zod.bag;
@@ -735,7 +735,7 @@ const Ln = /* @__PURE__ */ s((e) => {
735
735
  });
736
736
  };
737
737
  }), oo = /* @__PURE__ */ u("$ZodCheckEndsWith", (e, t) => {
738
- A.init(e, t);
738
+ S.init(e, t);
739
739
  const n = new RegExp(`.*${B(t.suffix)}$`);
740
740
  t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
741
741
  const r = o._zod.bag;
@@ -752,7 +752,7 @@ const Ln = /* @__PURE__ */ s((e) => {
752
752
  });
753
753
  };
754
754
  }), ro = /* @__PURE__ */ u("$ZodCheckOverwrite", (e, t) => {
755
- A.init(e, t), e._zod.check = (n) => {
755
+ S.init(e, t), e._zod.check = (n) => {
756
756
  n.value = t.tx(n.value);
757
757
  };
758
758
  }), je = class je {
@@ -875,7 +875,7 @@ const io = {
875
875
  }), v = /* @__PURE__ */ u("$ZodStringFormat", (e, t) => {
876
876
  ge.init(e, t), Pe.init(e, t);
877
877
  }), ao = /* @__PURE__ */ u("$ZodGUID", (e, t) => {
878
- t.pattern ?? (t.pattern = Sn), v.init(e, t);
878
+ t.pattern ?? (t.pattern = An), v.init(e, t);
879
879
  }), so = /* @__PURE__ */ u("$ZodUUID", (e, t) => {
880
880
  if (t.version) {
881
881
  const o = {
@@ -895,7 +895,7 @@ const io = {
895
895
  t.pattern ?? (t.pattern = We());
896
896
  v.init(e, t);
897
897
  }), uo = /* @__PURE__ */ u("$ZodEmail", (e, t) => {
898
- t.pattern ?? (t.pattern = An), v.init(e, t);
898
+ t.pattern ?? (t.pattern = Sn), v.init(e, t);
899
899
  }), co = /* @__PURE__ */ u("$ZodURL", (e, t) => {
900
900
  v.init(e, t), e._zod.check = (n) => {
901
901
  try {
@@ -1025,18 +1025,18 @@ const Io = /* @__PURE__ */ u("$ZodBase64", (e, t) => {
1025
1025
  });
1026
1026
  };
1027
1027
  });
1028
- function So(e) {
1028
+ function Ao(e) {
1029
1029
  if (!_t.test(e))
1030
1030
  return !1;
1031
1031
  const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
1032
1032
  return $t(n);
1033
1033
  }
1034
- s(So, "isValidBase64URL");
1035
- const Ao = /* @__PURE__ */ u("$ZodBase64URL", (e, t) => {
1034
+ s(Ao, "isValidBase64URL");
1035
+ const So = /* @__PURE__ */ u("$ZodBase64URL", (e, t) => {
1036
1036
  t.pattern ?? (t.pattern = _t), v.init(e, t), e._zod.onattach.push((n) => {
1037
1037
  n._zod.bag.contentEncoding = "base64url";
1038
1038
  }), e._zod.check = (n) => {
1039
- So(n.value) || n.issues.push({
1039
+ Ao(n.value) || n.issues.push({
1040
1040
  code: "invalid_format",
1041
1041
  format: "base64url",
1042
1042
  input: n.value,
@@ -1181,7 +1181,7 @@ function It(e) {
1181
1181
  };
1182
1182
  }
1183
1183
  s(It, "normalizeDef");
1184
- function St(e, t, n, o, r, i) {
1184
+ function At(e, t, n, o, r, i) {
1185
1185
  const a = [], c = r.keySet, d = r.catchall._zod, p = d.def.type;
1186
1186
  for (const f of Object.keys(t)) {
1187
1187
  if (c.has(f))
@@ -1200,7 +1200,7 @@ function St(e, t, n, o, r, i) {
1200
1200
  inst: i
1201
1201
  }), e.length ? Promise.all(e).then(() => n) : n;
1202
1202
  }
1203
- s(St, "handleCatchall");
1203
+ s(At, "handleCatchall");
1204
1204
  const Fo = /* @__PURE__ */ u("$ZodObject", (e, t) => {
1205
1205
  if (g.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
1206
1206
  const c = t.shape;
@@ -1244,7 +1244,7 @@ const Fo = /* @__PURE__ */ u("$ZodObject", (e, t) => {
1244
1244
  const E = k[w]._zod.run({ value: p[w], issues: [] }, d);
1245
1245
  E instanceof Promise ? f.push(E.then((ve) => ce(ve, c, w, p))) : ce(E, c, w, p);
1246
1246
  }
1247
- return i ? St(f, p, c, d, o.value, e) : f.length ? Promise.all(f).then(() => c) : c;
1247
+ return i ? At(f, p, c, d, o.value, e) : f.length ? Promise.all(f).then(() => c) : c;
1248
1248
  };
1249
1249
  }), Ro = /* @__PURE__ */ u("$ZodObjectJIT", (e, t) => {
1250
1250
  Fo.init(e, t);
@@ -1290,7 +1290,7 @@ const Fo = /* @__PURE__ */ u("$ZodObject", (e, t) => {
1290
1290
  e._zod.parse = (w, $) => {
1291
1291
  k ?? (k = o.value);
1292
1292
  const E = w.value;
1293
- return a(E) ? c && p && $?.async === !1 && $.jitless !== !0 ? (i || (i = r(t.shape)), w = i(w, $), f ? St([], E, w, $, k, e) : w) : n(w, $) : (w.issues.push({
1293
+ return a(E) ? c && p && $?.async === !1 && $.jitless !== !0 ? (i || (i = r(t.shape)), w = i(w, $), f ? At([], E, w, $, k, e) : w) : n(w, $) : (w.issues.push({
1294
1294
  expected: "object",
1295
1295
  code: "invalid_type",
1296
1296
  input: E,
@@ -1311,14 +1311,14 @@ function Je(e, t, n, o) {
1311
1311
  }), t);
1312
1312
  }
1313
1313
  s(Je, "handleUnionResults");
1314
- const At = /* @__PURE__ */ u("$ZodUnion", (e, t) => {
1314
+ const St = /* @__PURE__ */ u("$ZodUnion", (e, t) => {
1315
1315
  g.init(e, t), m(e._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), m(e._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), m(e._zod, "values", () => {
1316
1316
  if (t.options.every((r) => r._zod.values))
1317
1317
  return new Set(t.options.flatMap((r) => Array.from(r._zod.values)));
1318
1318
  }), m(e._zod, "pattern", () => {
1319
1319
  if (t.options.every((r) => r._zod.pattern)) {
1320
1320
  const r = t.options.map((i) => i._zod.pattern);
1321
- return new RegExp(`^(${r.map((i) => Se(i.source)).join("|")})$`);
1321
+ return new RegExp(`^(${r.map((i) => Ae(i.source)).join("|")})$`);
1322
1322
  }
1323
1323
  });
1324
1324
  const n = t.options.length === 1, o = t.options[0]._zod.run;
@@ -1343,7 +1343,7 @@ const At = /* @__PURE__ */ u("$ZodUnion", (e, t) => {
1343
1343
  return a ? Promise.all(c).then((d) => Je(d, r, e, i)) : Je(c, r, e, i);
1344
1344
  };
1345
1345
  }), Lo = /* @__PURE__ */ u("$ZodDiscriminatedUnion", (e, t) => {
1346
- At.init(e, t);
1346
+ St.init(e, t);
1347
1347
  const n = e._zod.parse;
1348
1348
  m(e._zod, "propValues", () => {
1349
1349
  const r = {};
@@ -1487,7 +1487,7 @@ s(qe, "handleOptionalResult");
1487
1487
  const Go = /* @__PURE__ */ u("$ZodOptional", (e, t) => {
1488
1488
  g.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", m(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), m(e._zod, "pattern", () => {
1489
1489
  const n = t.innerType._zod.pattern;
1490
- return n ? new RegExp(`^(${Se(n.source)})?$`) : void 0;
1490
+ return n ? new RegExp(`^(${Ae(n.source)})?$`) : void 0;
1491
1491
  }), e._zod.parse = (n, o) => {
1492
1492
  if (t.innerType._zod.optin === "optional") {
1493
1493
  const r = t.innerType._zod.run(n, o);
@@ -1498,7 +1498,7 @@ const Go = /* @__PURE__ */ u("$ZodOptional", (e, t) => {
1498
1498
  }), Jo = /* @__PURE__ */ u("$ZodNullable", (e, t) => {
1499
1499
  g.init(e, t), m(e._zod, "optin", () => t.innerType._zod.optin), m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "pattern", () => {
1500
1500
  const n = t.innerType._zod.pattern;
1501
- return n ? new RegExp(`^(${Se(n.source)}|null)$`) : void 0;
1501
+ return n ? new RegExp(`^(${Ae(n.source)}|null)$`) : void 0;
1502
1502
  }), m(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o);
1503
1503
  }), Ko = /* @__PURE__ */ u("$ZodDefault", (e, t) => {
1504
1504
  g.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
@@ -1580,7 +1580,7 @@ function He(e) {
1580
1580
  }
1581
1581
  s(He, "handleReadonlyResult");
1582
1582
  const er = /* @__PURE__ */ u("$ZodCustom", (e, t) => {
1583
- A.init(e, t), g.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
1583
+ S.init(e, t), g.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
1584
1584
  const o = n.value, r = t.fn(o);
1585
1585
  if (r instanceof Promise)
1586
1586
  return r.then((i) => Qe(i, n, o, e));
@@ -1905,7 +1905,7 @@ function Ir(e, t) {
1905
1905
  });
1906
1906
  }
1907
1907
  s(Ir, "_isoTime");
1908
- function Sr(e, t) {
1908
+ function Ar(e, t) {
1909
1909
  return new e({
1910
1910
  type: "string",
1911
1911
  format: "duration",
@@ -1913,15 +1913,15 @@ function Sr(e, t) {
1913
1913
  ...h(t)
1914
1914
  });
1915
1915
  }
1916
- s(Sr, "_isoDuration");
1917
- function Ar(e, t) {
1916
+ s(Ar, "_isoDuration");
1917
+ function Sr(e, t) {
1918
1918
  return new e({
1919
1919
  type: "number",
1920
1920
  checks: [],
1921
1921
  ...h(t)
1922
1922
  });
1923
1923
  }
1924
- s(Ar, "_number");
1924
+ s(Sr, "_number");
1925
1925
  function Er(e, t) {
1926
1926
  return new e({
1927
1927
  type: "number",
@@ -2141,7 +2141,7 @@ function Jr(e) {
2141
2141
  }
2142
2142
  s(Jr, "_superRefine");
2143
2143
  function Kr(e, t) {
2144
- const n = new A({
2144
+ const n = new S({
2145
2145
  check: "custom",
2146
2146
  ...h(t)
2147
2147
  });
@@ -2173,7 +2173,7 @@ const ti = /* @__PURE__ */ u("ZodISODuration", (e, t) => {
2173
2173
  ko.init(e, t), b.init(e, t);
2174
2174
  });
2175
2175
  function ni(e) {
2176
- return Sr(ti, e);
2176
+ return Ar(ti, e);
2177
2177
  }
2178
2178
  s(ni, "duration");
2179
2179
  const oi = /* @__PURE__ */ s((e, t) => {
@@ -2230,7 +2230,7 @@ const oi = /* @__PURE__ */ s((e, t) => {
2230
2230
  const n = e._zod.bag;
2231
2231
  e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(Nr(...o)), e.includes = (...o) => e.check(Ur(...o)), e.startsWith = (...o) => e.check(Fr(...o)), e.endsWith = (...o) => e.check(Rr(...o)), e.min = (...o) => e.check(le(...o)), e.max = (...o) => e.check(Et(...o)), e.length = (...o) => e.check(Tt(...o)), e.nonempty = (...o) => e.check(le(1, ...o)), e.lowercase = (o) => e.check(Cr(o)), e.uppercase = (o) => e.check(Dr(o)), e.trim = () => e.check(Mr()), e.normalize = (...o) => e.check(Lr(...o)), e.toLowerCase = () => e.check(Vr()), e.toUpperCase = () => e.check(Br());
2232
2232
  }), gi = /* @__PURE__ */ u("ZodString", (e, t) => {
2233
- Pe.init(e, t), Pt.init(e, t), e.email = (n) => e.check(or(vi, n)), e.url = (n) => e.check(ur(_i, n)), e.jwt = (n) => e.check(Zr(xi, n)), e.emoji = (n) => e.check(cr(bi, n)), e.guid = (n) => e.check(et(rt, n)), e.uuid = (n) => e.check(rr(ne, n)), e.uuidv4 = (n) => e.check(ir(ne, n)), e.uuidv6 = (n) => e.check(ar(ne, n)), e.uuidv7 = (n) => e.check(sr(ne, n)), e.nanoid = (n) => e.check(lr(wi, n)), e.guid = (n) => e.check(et(rt, n)), e.cuid = (n) => e.check(dr(ki, n)), e.cuid2 = (n) => e.check(pr(zi, n)), e.ulid = (n) => e.check(hr(Zi, n)), e.base64 = (n) => e.check(wr(Ti, n)), e.base64url = (n) => e.check(kr(Pi, n)), e.xid = (n) => e.check(fr($i, n)), e.ksuid = (n) => e.check(mr(yi, n)), e.ipv4 = (n) => e.check(gr(Ii, n)), e.ipv6 = (n) => e.check(vr(Si, n)), e.cidrv4 = (n) => e.check(_r(Ai, n)), e.cidrv6 = (n) => e.check(br(Ei, n)), e.e164 = (n) => e.check(zr(Oi, n)), e.datetime = (n) => e.check(Yr(n)), e.date = (n) => e.check(Hr(n)), e.time = (n) => e.check(ei(n)), e.duration = (n) => e.check(ni(n));
2233
+ Pe.init(e, t), Pt.init(e, t), e.email = (n) => e.check(or(vi, n)), e.url = (n) => e.check(ur(_i, n)), e.jwt = (n) => e.check(Zr(xi, n)), e.emoji = (n) => e.check(cr(bi, n)), e.guid = (n) => e.check(et(rt, n)), e.uuid = (n) => e.check(rr(ne, n)), e.uuidv4 = (n) => e.check(ir(ne, n)), e.uuidv6 = (n) => e.check(ar(ne, n)), e.uuidv7 = (n) => e.check(sr(ne, n)), e.nanoid = (n) => e.check(lr(wi, n)), e.guid = (n) => e.check(et(rt, n)), e.cuid = (n) => e.check(dr(ki, n)), e.cuid2 = (n) => e.check(pr(zi, n)), e.ulid = (n) => e.check(hr(Zi, n)), e.base64 = (n) => e.check(wr(Ti, n)), e.base64url = (n) => e.check(kr(Pi, n)), e.xid = (n) => e.check(fr($i, n)), e.ksuid = (n) => e.check(mr(yi, n)), e.ipv4 = (n) => e.check(gr(Ii, n)), e.ipv6 = (n) => e.check(vr(Ai, n)), e.cidrv4 = (n) => e.check(_r(Si, n)), e.cidrv6 = (n) => e.check(br(Ei, n)), e.e164 = (n) => e.check(zr(Oi, n)), e.datetime = (n) => e.check(Yr(n)), e.date = (n) => e.check(Hr(n)), e.time = (n) => e.check(ei(n)), e.duration = (n) => e.check(ni(n));
2234
2234
  });
2235
2235
  function l(e) {
2236
2236
  return nr(gi, e);
@@ -2262,16 +2262,16 @@ const b = /* @__PURE__ */ u("ZodStringFormat", (e, t) => {
2262
2262
  vo.init(e, t), b.init(e, t);
2263
2263
  }), Ii = /* @__PURE__ */ u("ZodIPv4", (e, t) => {
2264
2264
  zo.init(e, t), b.init(e, t);
2265
- }), Si = /* @__PURE__ */ u("ZodIPv6", (e, t) => {
2265
+ }), Ai = /* @__PURE__ */ u("ZodIPv6", (e, t) => {
2266
2266
  Zo.init(e, t), b.init(e, t);
2267
- }), Ai = /* @__PURE__ */ u("ZodCIDRv4", (e, t) => {
2267
+ }), Si = /* @__PURE__ */ u("ZodCIDRv4", (e, t) => {
2268
2268
  $o.init(e, t), b.init(e, t);
2269
2269
  }), Ei = /* @__PURE__ */ u("ZodCIDRv6", (e, t) => {
2270
2270
  yo.init(e, t), b.init(e, t);
2271
2271
  }), Ti = /* @__PURE__ */ u("ZodBase64", (e, t) => {
2272
2272
  Io.init(e, t), b.init(e, t);
2273
2273
  }), Pi = /* @__PURE__ */ u("ZodBase64URL", (e, t) => {
2274
- Ao.init(e, t), b.init(e, t);
2274
+ So.init(e, t), b.init(e, t);
2275
2275
  }), Oi = /* @__PURE__ */ u("ZodE164", (e, t) => {
2276
2276
  Eo.init(e, t), b.init(e, t);
2277
2277
  }), xi = /* @__PURE__ */ u("ZodJWT", (e, t) => {
@@ -2281,10 +2281,10 @@ const b = /* @__PURE__ */ u("ZodStringFormat", (e, t) => {
2281
2281
  const n = e._zod.bag;
2282
2282
  e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
2283
2283
  });
2284
- function S(e) {
2285
- return Ar(Ot, e);
2284
+ function A(e) {
2285
+ return Sr(Ot, e);
2286
2286
  }
2287
- s(S, "number");
2287
+ s(A, "number");
2288
2288
  const ji = /* @__PURE__ */ u("ZodNumberFormat", (e, t) => {
2289
2289
  Oo.init(e, t), Ot.init(e, t);
2290
2290
  });
@@ -2349,7 +2349,7 @@ function Z(e, t) {
2349
2349
  }
2350
2350
  s(Z, "object");
2351
2351
  const xt = /* @__PURE__ */ u("ZodUnion", (e, t) => {
2352
- At.init(e, t), _.init(e, t), e.options = t.options;
2352
+ St.init(e, t), _.init(e, t), e.options = t.options;
2353
2353
  });
2354
2354
  function pe(e, t) {
2355
2355
  return new xt({
@@ -2570,7 +2570,7 @@ const ca = z(["image", "video", "audio"]), la = z(["avatar", "cover", "voice", "
2570
2570
  selfId: l().nullable().optional(),
2571
2571
  filename: l(),
2572
2572
  mimeType: l(),
2573
- size: S(),
2573
+ size: A(),
2574
2574
  src: l(),
2575
2575
  alt: l().optional(),
2576
2576
  context: la.default("general"),
@@ -2586,14 +2586,14 @@ const ca = z(["image", "video", "audio"]), la = z(["avatar", "cover", "voice", "
2586
2586
  className: l().optional(),
2587
2587
  // CSS classes for rendering
2588
2588
  // Image/video dimensions
2589
- width: S().optional(),
2590
- height: S().optional(),
2589
+ width: A().optional(),
2590
+ height: A().optional(),
2591
2591
  // Audio/video duration
2592
- duration: S().optional(),
2592
+ duration: A().optional(),
2593
2593
  // Image blur hash for loading placeholders
2594
2594
  blurhash: l().optional()
2595
2595
  }).partial(), ga = Z({
2596
- duration: S().optional(),
2596
+ duration: A().optional(),
2597
2597
  // in seconds
2598
2598
  thumbnail: l().optional(),
2599
2599
  autoplay: I().optional(),
@@ -2601,7 +2601,7 @@ const ca = z(["image", "video", "audio"]), la = z(["avatar", "cover", "voice", "
2601
2601
  muted: I().optional(),
2602
2602
  controls: I().optional()
2603
2603
  }), va = Z({
2604
- duration: S().optional(),
2604
+ duration: A().optional(),
2605
2605
  // in seconds
2606
2606
  autoplay: I().optional(),
2607
2607
  loop: I().optional(),
@@ -2666,7 +2666,7 @@ Z({
2666
2666
  lastSeenAt: ze().optional(),
2667
2667
  // Virtual/computed fields
2668
2668
  onboarded: I().optional(),
2669
- selfCount: S().optional(),
2669
+ selfCount: A().optional(),
2670
2670
  // Nested relationships (for enriched responses)
2671
2671
  memberships: D(Z({
2672
2672
  membershipId: l(),
@@ -2703,8 +2703,8 @@ Z({
2703
2703
  subscriptionStatus: z(["trial", "active", "canceled", "past_due"]).optional(),
2704
2704
  trialEndsAt: l().optional(),
2705
2705
  // Virtual/computed fields
2706
- memberCount: S().optional(),
2707
- selfCount: S().optional(),
2706
+ memberCount: A().optional(),
2707
+ selfCount: A().optional(),
2708
2708
  // Nested relationships
2709
2709
  members: D(Z({
2710
2710
  userId: l(),
@@ -2739,12 +2739,12 @@ Z({
2739
2739
  avatar: l().optional(),
2740
2740
  voiceId: l().optional(),
2741
2741
  voiceSettings: Z({
2742
- speed: S().optional(),
2743
- pitch: S().optional(),
2744
- volume: S().optional()
2742
+ speed: A().optional(),
2743
+ pitch: A().optional(),
2744
+ volume: A().optional()
2745
2745
  }).optional(),
2746
2746
  // Virtual/computed fields
2747
- interactionCount: S().optional(),
2747
+ interactionCount: A().optional(),
2748
2748
  lastActiveAt: ze().optional(),
2749
2749
  // Nested relationships
2750
2750
  owner: Z({
@@ -2782,10 +2782,10 @@ const za = Z({
2782
2782
  // Screen reader label
2783
2783
  subLabel: l().optional(),
2784
2784
  // Secondary text
2785
- value: pe([l(), S()]).optional(),
2785
+ value: pe([l(), A()]).optional(),
2786
2786
  description: l().optional(),
2787
2787
  info: l().optional(),
2788
- count: S().optional(),
2788
+ count: A().optional(),
2789
2789
  className: l().optional(),
2790
2790
  // Visual elements
2791
2791
  media: C.optional(),
@@ -2803,7 +2803,7 @@ const za = Z({
2803
2803
  isDisabled: I().optional(),
2804
2804
  isHidden: I().optional(),
2805
2805
  // Organization
2806
- priority: S().optional(),
2806
+ priority: A().optional(),
2807
2807
  testId: l().optional(),
2808
2808
  // Simple nested items (one level only)
2809
2809
  items: D(de()).optional()
@@ -3082,7 +3082,11 @@ const Ue = class Ue extends Gt {
3082
3082
  this.processApiResponse.bind(this)
3083
3083
  ), this.logger.info("FictionSDK initialized"), this.storage.loadFromStorage(this.activeUser, this.token), this.storage.syncWithGlobalStores(this.activeUser, this.token), this.initialized = new Promise((o) => {
3084
3084
  this.resolveUser = o;
3085
- }), this.activeUser.value && this.resolveUser?.(this.activeUser.value);
3085
+ }), this.token.value && !this.activeUser.value ? this.getCurrentUser().then((o) => {
3086
+ this.resolveUser && (this.resolveUser(o), this.resolveUser = void 0);
3087
+ }).catch((o) => {
3088
+ this.logger.error("Auto user fetch failed", { data: o }), this.resolveUser && (this.resolveUser(void 0), this.resolveUser = void 0);
3089
+ }) : this.activeUser.value ? this.resolveUser?.(this.activeUser.value) : this.resolveUser?.(void 0);
3086
3090
  }
3087
3091
  get isDev() {
3088
3092
  return this.settings.isDev ?? (typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1);