@bpinternal/billing-ui 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var bo = Object.defineProperty;
3
3
  var fo = (t, e, a) => e in t ? bo(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
4
4
  var or = (t, e, a) => fo(t, typeof e != "symbol" ? e + "" : e, a);
5
5
  import { jsx as l, jsxs as p, Fragment as Te } from "react/jsx-runtime";
6
- import { QueryClient as yo, hydrate as vo, dehydrate as _o, useQuery as $e, useMutation as Jt } from "@tanstack/react-query";
6
+ import { QueryClient as yo, hydrate as vo, dehydrate as _o, useQuery as Ve, useMutation as Jt } from "@tanstack/react-query";
7
7
  import { createElement as bt, isValidElement as Va, Fragment as No, cloneElement as Co, Children as So, createContext as qr, useContext as Ta, useCallback as It, useState as J, useRef as rn, useEffect as Oe, useMemo as Re, useSyncExternalStore as ko, useId as wo } from "react";
8
8
  import { loadStripe as To } from "@stripe/stripe-js";
9
9
  import { createPortal as Io } from "react-dom";
@@ -3501,7 +3501,7 @@ const $c = ({
3501
3501
  }
3502
3502
  ) }) });
3503
3503
  };
3504
- function re() {
3504
+ function ne() {
3505
3505
  const t = Ta(on);
3506
3506
  if (!t)
3507
3507
  throw new Error("@bpinternal/billing-ui components must be rendered inside <BillingProvider>");
@@ -3542,7 +3542,7 @@ const we = {
3542
3542
  function Ri(t) {
3543
3543
  return typeof t == "object" && t !== null && t.code === 403;
3544
3544
  }
3545
- const Ae = {
3545
+ const Ie = {
3546
3546
  /** Everything for one workspace — use to invalidate/clear the whole scope. */
3547
3547
  root: (t) => ["bpb", t],
3548
3548
  plans: (t) => ["bpb", t, "plans"],
@@ -3559,18 +3559,18 @@ const Ae = {
3559
3559
  usageByBot: (t, e, a) => ["bpb", t, "usage-by-bot", e, a]
3560
3560
  };
3561
3561
  function rt() {
3562
- const { client: t, queryClient: e, scope: a } = re();
3563
- return $e({ queryKey: Ae.plans(a), queryFn: () => t.listPlans({}) }, e);
3562
+ const { client: t, queryClient: e, scope: a } = ne();
3563
+ return Ve({ queryKey: Ie.plans(a), queryFn: () => t.listPlans({}) }, e);
3564
3564
  }
3565
3565
  function Qt() {
3566
- const { client: t, queryClient: e, scope: a } = re();
3567
- return $e({ queryKey: Ae.addons(a), queryFn: () => t.listAddons({}) }, e);
3566
+ const { client: t, queryClient: e, scope: a } = ne();
3567
+ return Ve({ queryKey: Ie.addons(a), queryFn: () => t.listAddons({}) }, e);
3568
3568
  }
3569
- function Ve(t) {
3570
- const { client: e, queryClient: a, scope: n, refetchInterval: r } = re();
3571
- return $e(
3569
+ function $e(t) {
3570
+ const { client: e, queryClient: a, scope: n, refetchInterval: r } = ne();
3571
+ return Ve(
3572
3572
  {
3573
- queryKey: Ae.subscription(n),
3573
+ queryKey: Ie.subscription(n),
3574
3574
  queryFn: () => e.getSubscription({}),
3575
3575
  enabled: (t == null ? void 0 : t.enabled) ?? !0,
3576
3576
  refetchInterval: r
@@ -3579,14 +3579,21 @@ function Ve(t) {
3579
3579
  );
3580
3580
  }
3581
3581
  function Hc() {
3582
- const { data: t, error: e } = Ve();
3583
- return e ? Ri(e) ? !1 : e : t ? !0 : void 0;
3582
+ const { client: t, queryClient: e, scope: a } = ne(), { data: n, error: r } = Ve(
3583
+ {
3584
+ queryKey: Ie.subscription(a),
3585
+ queryFn: () => t.getSubscription({}),
3586
+ refetchInterval: !1
3587
+ },
3588
+ e
3589
+ );
3590
+ return r ? Ri(r) ? !1 : r : n ? !0 : void 0;
3584
3591
  }
3585
3592
  function ns(t, e) {
3586
- const { client: a, queryClient: n, scope: r } = re();
3587
- return $e(
3593
+ const { client: a, queryClient: n, scope: r } = ne();
3594
+ return Ve(
3588
3595
  {
3589
- queryKey: Ae.preview(r, t),
3596
+ queryKey: Ie.preview(r, t),
3590
3597
  queryFn: () => a.previewSubscriptionUpdate(t),
3591
3598
  enabled: (e == null ? void 0 : e.enabled) ?? !0
3592
3599
  },
@@ -3594,10 +3601,10 @@ function ns(t, e) {
3594
3601
  );
3595
3602
  }
3596
3603
  function rs(t) {
3597
- const { client: e, queryClient: a, scope: n } = re();
3598
- return $e(
3604
+ const { client: e, queryClient: a, scope: n } = ne();
3605
+ return Ve(
3599
3606
  {
3600
- queryKey: Ae.paymentMethod(n),
3607
+ queryKey: Ie.paymentMethod(n),
3601
3608
  queryFn: () => e.getPaymentMethod({}),
3602
3609
  enabled: (t == null ? void 0 : t.enabled) ?? !0
3603
3610
  },
@@ -3605,10 +3612,10 @@ function rs(t) {
3605
3612
  );
3606
3613
  }
3607
3614
  function ss(t) {
3608
- const { client: e, queryClient: a, scope: n } = re();
3609
- return $e(
3615
+ const { client: e, queryClient: a, scope: n } = ne();
3616
+ return Ve(
3610
3617
  {
3611
- queryKey: Ae.customer(n),
3618
+ queryKey: Ie.customer(n),
3612
3619
  queryFn: () => e.getCustomer({}),
3613
3620
  enabled: (t == null ? void 0 : t.enabled) ?? !0
3614
3621
  },
@@ -3616,10 +3623,10 @@ function ss(t) {
3616
3623
  );
3617
3624
  }
3618
3625
  function Ei(t) {
3619
- const { client: e, queryClient: a, scope: n, refetchInterval: r } = re();
3620
- return $e(
3626
+ const { client: e, queryClient: a, scope: n, refetchInterval: r } = ne();
3627
+ return Ve(
3621
3628
  {
3622
- queryKey: Ae.invoices(n),
3629
+ queryKey: Ie.invoices(n),
3623
3630
  queryFn: () => e.listInvoices({}),
3624
3631
  enabled: (t == null ? void 0 : t.enabled) ?? !0,
3625
3632
  refetchInterval: r
@@ -3628,10 +3635,10 @@ function Ei(t) {
3628
3635
  );
3629
3636
  }
3630
3637
  function os(t) {
3631
- const { client: e, queryClient: a, scope: n } = re();
3632
- return $e(
3638
+ const { client: e, queryClient: a, scope: n } = ne();
3639
+ return Ve(
3633
3640
  {
3634
- queryKey: Ae.readonly(n),
3641
+ queryKey: Ie.readonly(n),
3635
3642
  queryFn: () => e.getBillingReadonly({}),
3636
3643
  enabled: (t == null ? void 0 : t.enabled) ?? !0
3637
3644
  },
@@ -3639,10 +3646,10 @@ function os(t) {
3639
3646
  );
3640
3647
  }
3641
3648
  function is(t) {
3642
- const { client: e, queryClient: a, scope: n } = re();
3643
- return $e(
3649
+ const { client: e, queryClient: a, scope: n } = ne();
3650
+ return Ve(
3644
3651
  {
3645
- queryKey: Ae.autoRecharge(n),
3652
+ queryKey: Ie.autoRecharge(n),
3646
3653
  queryFn: () => e.getAutoRechargeSettings({}).then((r) => r.settings),
3647
3654
  enabled: (t == null ? void 0 : t.enabled) ?? !0
3648
3655
  },
@@ -3650,22 +3657,22 @@ function is(t) {
3650
3657
  );
3651
3658
  }
3652
3659
  function Li() {
3653
- const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = re();
3660
+ const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = ne();
3654
3661
  return Jt(
3655
3662
  {
3656
3663
  mutationFn: (r) => t.setAutoRechargeSettings(r).then((s) => s.settings),
3657
3664
  onSuccess: async (r) => {
3658
- e.setQueryData(Ae.autoRecharge(a), r), n({ type: "auto-recharge" });
3665
+ e.setQueryData(Ie.autoRecharge(a), r), n({ type: "auto-recharge" });
3659
3666
  }
3660
3667
  },
3661
3668
  e
3662
3669
  );
3663
3670
  }
3664
3671
  function Xt(t) {
3665
- const { client: e, queryClient: a, scope: n, refetchInterval: r } = re(), s = t != null && t.period ? new Date(t.period) : /* @__PURE__ */ new Date(), o = `${s.getUTCFullYear()}-${String(s.getUTCMonth() + 1).padStart(2, "0")}`;
3666
- return $e(
3672
+ const { client: e, queryClient: a, scope: n, refetchInterval: r } = ne(), s = t != null && t.period ? new Date(t.period) : /* @__PURE__ */ new Date(), o = `${s.getUTCFullYear()}-${String(s.getUTCMonth() + 1).padStart(2, "0")}`;
3673
+ return Ve(
3667
3674
  {
3668
- queryKey: Ae.usages(n, o),
3675
+ queryKey: Ie.usages(n, o),
3669
3676
  // Send a concrete datetime within the month; the API infers the month from it.
3670
3677
  queryFn: () => e.getWorkspaceUsages({ period: `${o}-01T00:00:00.000Z` }).then((i) => i.quotas),
3671
3678
  enabled: (t == null ? void 0 : t.enabled) ?? !0,
@@ -3675,10 +3682,10 @@ function Xt(t) {
3675
3682
  );
3676
3683
  }
3677
3684
  function Oi(t, e) {
3678
- const { client: a, queryClient: n, scope: r, refetchInterval: s } = re(), o = a.breakDownWorkspaceUsageByBot, i = a.listBots, d = typeof o == "function" && typeof i == "function", c = e != null && e.period ? new Date(e.period) : /* @__PURE__ */ new Date(), u = `${c.getUTCFullYear()}-${String(c.getUTCMonth() + 1).padStart(2, "0")}`;
3679
- return $e(
3685
+ const { client: a, queryClient: n, scope: r, refetchInterval: s } = ne(), o = a.breakDownWorkspaceUsageByBot, i = a.listBots, d = typeof o == "function" && typeof i == "function", c = e != null && e.period ? new Date(e.period) : /* @__PURE__ */ new Date(), u = `${c.getUTCFullYear()}-${String(c.getUTCMonth() + 1).padStart(2, "0")}`;
3686
+ return Ve(
3680
3687
  {
3681
- queryKey: Ae.usageByBot(r, t, u),
3688
+ queryKey: Ie.usageByBot(r, t, u),
3682
3689
  queryFn: async () => {
3683
3690
  const [m, h] = await Promise.all([
3684
3691
  o({ id: r, type: t, period: `${u}-01T00:00:00.000Z` }),
@@ -3693,39 +3700,39 @@ function Oi(t, e) {
3693
3700
  );
3694
3701
  }
3695
3702
  function Fi() {
3696
- const { client: t } = re();
3703
+ const { client: t } = ne();
3697
3704
  return typeof t.breakDownWorkspaceUsageByBot == "function" && typeof t.listBots == "function";
3698
3705
  }
3699
3706
  function ls() {
3700
- const { client: t, queryClient: e } = re();
3707
+ const { client: t, queryClient: e } = ne();
3701
3708
  return Jt({ mutationFn: () => t.createPaymentMethodIntent({}) }, e);
3702
3709
  }
3703
3710
  function ds() {
3704
- const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = re();
3711
+ const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = ne();
3705
3712
  return Jt(
3706
3713
  {
3707
3714
  mutationFn: (r) => t.setPaymentMethod(r),
3708
3715
  onSuccess: async () => {
3709
- await e.invalidateQueries({ queryKey: Ae.paymentMethod(a) }), n({ type: "payment-method" });
3716
+ await e.invalidateQueries({ queryKey: Ie.paymentMethod(a) }), n({ type: "payment-method" });
3710
3717
  }
3711
3718
  },
3712
3719
  e
3713
3720
  );
3714
3721
  }
3715
3722
  function cs() {
3716
- const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = re();
3723
+ const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = ne();
3717
3724
  return Jt(
3718
3725
  {
3719
3726
  mutationFn: (r) => t.setCustomer(r),
3720
3727
  onSuccess: async (r, s) => {
3721
- await e.invalidateQueries({ queryKey: Ae.customer(a) }), s.address && n({ type: "billing-address" });
3728
+ await e.invalidateQueries({ queryKey: Ie.customer(a) }), s.address && n({ type: "billing-address" });
3722
3729
  }
3723
3730
  },
3724
3731
  e
3725
3732
  );
3726
3733
  }
3727
3734
  function Mi() {
3728
- const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = re();
3735
+ const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = ne();
3729
3736
  return Jt(
3730
3737
  {
3731
3738
  mutationFn: async (r) => {
@@ -3733,8 +3740,8 @@ function Mi() {
3733
3740
  },
3734
3741
  onSuccess: async () => {
3735
3742
  await Promise.all([
3736
- e.invalidateQueries({ queryKey: Ae.subscription(a) }),
3737
- e.invalidateQueries({ queryKey: Ae.invoices(a) }),
3743
+ e.invalidateQueries({ queryKey: Ie.subscription(a) }),
3744
+ e.invalidateQueries({ queryKey: Ie.invoices(a) }),
3738
3745
  e.invalidateQueries({ queryKey: ["bpb", a, "preview"] })
3739
3746
  ]), n({ type: "addons" });
3740
3747
  }
@@ -3743,7 +3750,7 @@ function Mi() {
3743
3750
  );
3744
3751
  }
3745
3752
  function us() {
3746
- const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = re();
3753
+ const { client: t, queryClient: e, scope: a, notifyBillingChange: n } = ne();
3747
3754
  return Jt(
3748
3755
  {
3749
3756
  mutationFn: async (r) => {
@@ -3751,9 +3758,9 @@ function us() {
3751
3758
  },
3752
3759
  onSuccess: async () => {
3753
3760
  await Promise.all([
3754
- e.invalidateQueries({ queryKey: Ae.subscription(a) }),
3755
- e.invalidateQueries({ queryKey: Ae.plans(a) }),
3756
- e.invalidateQueries({ queryKey: Ae.invoices(a) }),
3761
+ e.invalidateQueries({ queryKey: Ie.subscription(a) }),
3762
+ e.invalidateQueries({ queryKey: Ie.plans(a) }),
3763
+ e.invalidateQueries({ queryKey: Ie.invoices(a) }),
3757
3764
  e.invalidateQueries({ queryKey: ["bpb", a, "preview"] })
3758
3765
  ]), n({ type: "subscription" });
3759
3766
  }
@@ -4060,7 +4067,7 @@ const Ui = (t, e) => {
4060
4067
  return r(d, u), u;
4061
4068
  };
4062
4069
  return s = o, (...d) => s(sl(...d));
4063
- }, il = [], Ie = (t) => {
4070
+ }, il = [], Ae = (t) => {
4064
4071
  const e = (a) => a[t] || il;
4065
4072
  return e.isThemeGetter = !0, e;
4066
4073
  }, fs = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, ys = /^\((?:(\w[\w-]*):)?(.+)\)$/i, ll = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/, dl = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, cl = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, ul = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, pl = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, ml = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, ht = (t) => ll.test(t), ie = (t) => !!t && !Number.isNaN(Number(t)), Ye = (t) => !!t && Number.isInteger(Number(t)), Tn = (t) => t.endsWith("%") && ie(t.slice(0, -1)), it = (t) => dl.test(t), vs = () => !0, hl = (t) => (
@@ -4075,7 +4082,7 @@ const Ui = (t, e) => {
4075
4082
  const n = ys.exec(t);
4076
4083
  return n ? n[1] ? e(n[1]) : a : !1;
4077
4084
  }, _s = (t) => t === "position" || t === "percentage", Ns = (t) => t === "image" || t === "url", Cs = (t) => t === "length" || t === "size" || t === "bg-size", Ss = (t) => t === "length", Il = (t) => t === "number", ks = (t) => t === "family-name", ws = (t) => t === "number" || t === "weight", Ts = (t) => t === "shadow", Al = () => {
4078
- const t = Ie("color"), e = Ie("font"), a = Ie("text"), n = Ie("font-weight"), r = Ie("tracking"), s = Ie("leading"), o = Ie("breakpoint"), i = Ie("container"), d = Ie("spacing"), c = Ie("radius"), u = Ie("shadow"), m = Ie("inset-shadow"), h = Ie("text-shadow"), g = Ie("drop-shadow"), b = Ie("blur"), C = Ie("perspective"), _ = Ie("aspect"), v = Ie("ease"), N = Ie("animate"), S = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], T = () => [
4085
+ const t = Ae("color"), e = Ae("font"), a = Ae("text"), n = Ae("font-weight"), r = Ae("tracking"), s = Ae("leading"), o = Ae("breakpoint"), i = Ae("container"), d = Ae("spacing"), c = Ae("radius"), u = Ae("shadow"), m = Ae("inset-shadow"), h = Ae("text-shadow"), g = Ae("drop-shadow"), b = Ae("blur"), C = Ae("perspective"), _ = Ae("aspect"), v = Ae("ease"), N = Ae("animate"), S = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], T = () => [
4079
4086
  "center",
4080
4087
  "top",
4081
4088
  "bottom",
@@ -7276,7 +7283,7 @@ const Fe = ({
7276
7283
  document.body
7277
7284
  ) : null;
7278
7285
  }, Rt = () => {
7279
- const { manageBillingUrl: t } = re(), { t: e } = ge();
7286
+ const { manageBillingUrl: t } = ne(), { t: e } = ge();
7280
7287
  return /* @__PURE__ */ p("div", { className: "bpb-outdated", children: [
7281
7288
  /* @__PURE__ */ l("h3", { className: "bpb-outdated__title", children: e("outdatedTitle") }),
7282
7289
  /* @__PURE__ */ l("p", { className: "bpb-outdated__text", children: e("outdatedText") }),
@@ -7416,7 +7423,7 @@ const rd = ({
7416
7423
  featureDescriptions: i
7417
7424
  }) => {
7418
7425
  var M, K, G;
7419
- const { isOutdatedBilling: d, toast: c, analytics: u } = re(), { t: m } = ge(), [h, g] = J(r), { data: b, isLoading: C } = rt(), { data: _ } = Qt(), { data: v } = Ve({ enabled: t }), { data: N } = os({ enabled: t }), S = us(), T = (N == null ? void 0 : N.planReadonly) ?? !1;
7426
+ const { isOutdatedBilling: d, toast: c, analytics: u } = ne(), { t: m } = ge(), [h, g] = J(r), { data: b, isLoading: C } = rt(), { data: _ } = Qt(), { data: v } = $e({ enabled: t }), { data: N } = os({ enabled: t }), S = us(), T = (N == null ? void 0 : N.planReadonly) ?? !1;
7420
7427
  Oe(() => {
7421
7428
  t && u.capture(we.PLAN_PICKER_VIEWED, { interval: h });
7422
7429
  }, [t, u]);
@@ -7776,7 +7783,7 @@ const id = 4, ld = ({
7776
7783
  onSubscribe: d
7777
7784
  }) => {
7778
7785
  var H, W, X, D, ue;
7779
- const { locale: c } = re(), { t: u } = ge(), { data: m } = Qt(), h = ((H = t == null ? void 0 : t.prices.month) == null ? void 0 : H.currency) ?? ((W = t == null ? void 0 : t.prices.year) == null ? void 0 : W.currency) ?? "usd", g = t == null ? void 0 : t.features.conversation_sessions, b = t && _e(t) === "community" ? u("conversationsUnit") : u("conversationsPerMonth"), C = t ? Gn(m, t, e) : null, _ = (a == null ? void 0 : a.costs.immediate.amountDue) ?? 0, v = (a == null ? void 0 : a.costs.immediate.accountBalance) ?? 0, N = (a == null ? void 0 : a.costs.nextCycle.total) ?? 0, S = a != null && a.nextBillingDate ? Pl(a.nextBillingDate, 1) : null, T = S && !Xa(S) ? ct(S, c) : null, I = t ? $n[_e(t)].slice(0, id) : [], k = t == null ? void 0 : t.features.ai_spend, A = k !== void 0 ? u("planFeatureAiUsageIncluded", { amount: le(k / tt, h, 0) }) : void 0, w = t ? ((X = t.prices[e]) == null ? void 0 : X.amount) ?? 0 : 0, E = (a == null ? void 0 : a.costs.immediate.lineItems) ?? [], L = E.filter((ee) => ee.type === "discount"), O = E.filter((ee) => ee.type === "proration_credit" || ee.type === "proration_charge").reduce((ee, ce) => ee + ce.amount, 0), Z = !!(a != null && a.subscription.plan.effectiveDate), V = ((D = t == null ? void 0 : t.prices.month) == null ? void 0 : D.amount) ?? 0, $ = ((ue = t == null ? void 0 : t.prices.year) == null ? void 0 : ue.amount) ?? 0, B = e === "year" && V > 0 && $ > 0 ? Math.round(V * 12 - $) : 0, x = Math.round(B / 12);
7786
+ const { locale: c } = ne(), { t: u } = ge(), { data: m } = Qt(), h = ((H = t == null ? void 0 : t.prices.month) == null ? void 0 : H.currency) ?? ((W = t == null ? void 0 : t.prices.year) == null ? void 0 : W.currency) ?? "usd", g = t == null ? void 0 : t.features.conversation_sessions, b = t && _e(t) === "community" ? u("conversationsUnit") : u("conversationsPerMonth"), C = t ? Gn(m, t, e) : null, _ = (a == null ? void 0 : a.costs.immediate.amountDue) ?? 0, v = (a == null ? void 0 : a.costs.immediate.accountBalance) ?? 0, N = (a == null ? void 0 : a.costs.nextCycle.total) ?? 0, S = a != null && a.nextBillingDate ? Pl(a.nextBillingDate, 1) : null, T = S && !Xa(S) ? ct(S, c) : null, I = t ? $n[_e(t)].slice(0, id) : [], k = t == null ? void 0 : t.features.ai_spend, A = k !== void 0 ? u("planFeatureAiUsageIncluded", { amount: le(k / tt, h, 0) }) : void 0, w = t ? ((X = t.prices[e]) == null ? void 0 : X.amount) ?? 0 : 0, E = (a == null ? void 0 : a.costs.immediate.lineItems) ?? [], L = E.filter((ee) => ee.type === "discount"), O = E.filter((ee) => ee.type === "proration_credit" || ee.type === "proration_charge").reduce((ee, ce) => ee + ce.amount, 0), Z = !!(a != null && a.subscription.plan.effectiveDate), V = ((D = t == null ? void 0 : t.prices.month) == null ? void 0 : D.amount) ?? 0, $ = ((ue = t == null ? void 0 : t.prices.year) == null ? void 0 : ue.amount) ?? 0, B = e === "year" && V > 0 && $ > 0 ? Math.round(V * 12 - $) : 0, x = Math.round(B / 12);
7780
7787
  return /* @__PURE__ */ p("div", { className: "bpb-summary-wrap", children: [
7781
7788
  /* @__PURE__ */ p("div", { className: "bpb-summary bpb-glow", children: [
7782
7789
  /* @__PURE__ */ l("h3", { className: "bpb-summary__title", children: t ? `${Ne(t.name)} plan` : /* @__PURE__ */ l(me, { width: 140, height: 24 }) }),
@@ -8285,7 +8292,7 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8285
8292
  ] });
8286
8293
  }, gd = ({ planId: t, initialInterval: e, onSuccess: a }) => {
8287
8294
  var na;
8288
- const n = Gr(), r = Kr(), { email: s, toast: o, analytics: i, isDark: d } = re(), { t: c } = ge(), [u, m] = J(e), [h, g] = J("payment"), [b, C] = J(null), [_, v] = J(!1), [N, S] = J(!1), [T, I] = J(!1), [k, A] = J(void 0), [w, E] = J(!1), [L, O] = J(""), [Z, V] = J(""), [$, B] = J(""), [x, H] = J(!1), [W, X] = J({}), [D, ue] = J(!1), ee = ls(), { data: ce } = rt(), { data: M } = Ve(), { data: K, isLoading: G } = rs(), { data: P, isLoading: be, isError: te } = ss(), de = ce == null ? void 0 : ce.find((xe) => xe.id === t), pe = ((na = K == null ? void 0 : K.paymentMethod) == null ? void 0 : na.card) ?? null, ae = (P == null ? void 0 : P.address) ?? null;
8295
+ const n = Gr(), r = Kr(), { email: s, toast: o, analytics: i, isDark: d } = ne(), { t: c } = ge(), [u, m] = J(e), [h, g] = J("payment"), [b, C] = J(null), [_, v] = J(!1), [N, S] = J(!1), [T, I] = J(!1), [k, A] = J(void 0), [w, E] = J(!1), [L, O] = J(""), [Z, V] = J(""), [$, B] = J(""), [x, H] = J(!1), [W, X] = J({}), [D, ue] = J(!1), ee = ls(), { data: ce } = rt(), { data: M } = $e(), { data: K, isLoading: G } = rs(), { data: P, isLoading: be, isError: te } = ss(), de = ce == null ? void 0 : ce.find((xe) => xe.id === t), pe = ((na = K == null ? void 0 : K.paymentMethod) == null ? void 0 : na.card) ?? null, ae = (P == null ? void 0 : P.address) ?? null;
8289
8296
  Oe(() => {
8290
8297
  b === null && !G && K !== void 0 && C(pe ? "saved" : "new");
8291
8298
  }, [b, G, K, pe]), Oe(() => {
@@ -8447,7 +8454,7 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8447
8454
  ) })
8448
8455
  ] });
8449
8456
  }, bd = ({ open: t, onOpenChange: e, planId: a, interval: n, onBack: r, onSuccess: s }) => {
8450
- const { stripePromise: o, isDark: i, locale: d, isOutdatedBilling: c } = re(), { t: u } = ge(), m = Re(
8457
+ const { stripePromise: o, isDark: i, locale: d, isOutdatedBilling: c } = ne(), { t: u } = ge(), m = Re(
8451
8458
  () => ({
8452
8459
  appearance: Rs(i),
8453
8460
  locale: Ls(d)
@@ -8510,7 +8517,7 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8510
8517
  /* @__PURE__ */ l("div", { className: "bpb-upgrade-gate__actions", children: n ? /* @__PURE__ */ l(ke, { variant: "primary", className: "bpb-upgrade-gate__cta", onClick: n, children: a }) : /* @__PURE__ */ l(ke, { variant: "outline", onClick: r, children: s("close") }) })
8511
8518
  ] });
8512
8519
  }, eu = ({ open: t, onOpenChange: e, onSuccess: a, onUpgrade: n }) => {
8513
- const { isOutdatedBilling: r } = re(), { t: s } = ge();
8520
+ const { isOutdatedBilling: r } = ne(), { t: s } = ge();
8514
8521
  return r ? /* @__PURE__ */ l(
8515
8522
  Fe,
8516
8523
  {
@@ -8528,7 +8535,7 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8528
8535
  onUpgrade: a
8529
8536
  }) => {
8530
8537
  var D, ue, ee, ce;
8531
- const { toast: n, locale: r } = re(), { t: s } = ge(), { data: o } = Ve(), { data: i } = Qt(), { data: d } = rt(), { data: c } = os(), u = Mi(), [m, h] = J(null), g = d == null ? void 0 : d.find((M) => M.id === (o == null ? void 0 : o.plan.current.planId)), b = (o == null ? void 0 : o.plan.current.interval) ?? "month", C = (c == null ? void 0 : c.addonsReadonly) ?? !1, _ = o == null ? void 0 : o.plan.current.periodEnd, v = _ && !Xa(_) ? ct(_, r) : null, N = Re(() => {
8538
+ const { toast: n, locale: r } = ne(), { t: s } = ge(), { data: o } = $e(), { data: i } = Qt(), { data: d } = rt(), { data: c } = os(), u = Mi(), [m, h] = J(null), g = d == null ? void 0 : d.find((M) => M.id === (o == null ? void 0 : o.plan.current.planId)), b = (o == null ? void 0 : o.plan.current.interval) ?? "month", C = (c == null ? void 0 : c.addonsReadonly) ?? !1, _ = o == null ? void 0 : o.plan.current.periodEnd, v = _ && !Xa(_) ? ct(_, r) : null, N = Re(() => {
8532
8539
  var K;
8533
8540
  if (!o || !i)
8534
8541
  return null;
@@ -8699,10 +8706,10 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8699
8706
  ] })
8700
8707
  ] });
8701
8708
  }, tu = ({ open: t, onOpenChange: e }) => {
8702
- const { isOutdatedBilling: a } = re(), { t: n } = ge();
8709
+ const { isOutdatedBilling: a } = ne(), { t: n } = ge();
8703
8710
  return a ? /* @__PURE__ */ l(Fe, { open: t, onOpenChange: e, size: "md", "aria-label": n("invoicesTitle"), className: "bpb-scope", children: /* @__PURE__ */ l(Rt, {}) }) : /* @__PURE__ */ l(Fe, { open: t, onOpenChange: e, size: "md", "aria-label": n("invoicesTitle"), className: "bpb-scope", children: /* @__PURE__ */ l(vd, { open: t }) });
8704
8711
  }, vd = ({ open: t }) => {
8705
- const { locale: e, analytics: a } = re(), { t: n } = ge(), { data: r, isLoading: s, isError: o } = Ei({ enabled: t }), i = (r == null ? void 0 : r.invoices) ?? [], d = {
8712
+ const { locale: e, analytics: a } = ne(), { t: n } = ge(), { data: r, isLoading: s, isError: o } = Ei({ enabled: t }), i = (r == null ? void 0 : r.invoices) ?? [], d = {
8706
8713
  paid: n("invoiceStatusPaid"),
8707
8714
  open: n("invoiceStatusDue"),
8708
8715
  draft: n("invoiceStatusDraft"),
@@ -8739,7 +8746,7 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8739
8746
  ] });
8740
8747
  }, au = ({ open: t, onOpenChange: e, onSuccess: a }) => {
8741
8748
  var g;
8742
- const { stripePromise: n, isDark: r, locale: s, isOutdatedBilling: o } = re(), { t: i } = ge(), d = ls(), c = (g = d.data) == null ? void 0 : g.clientSecret, { mutate: u, reset: m } = d;
8749
+ const { stripePromise: n, isDark: r, locale: s, isOutdatedBilling: o } = ne(), { t: i } = ge(), d = ls(), c = (g = d.data) == null ? void 0 : g.clientSecret, { mutate: u, reset: m } = d;
8743
8750
  Oe(() => {
8744
8751
  t && !o ? u() : m();
8745
8752
  }, [t, o, u, m]);
@@ -8787,7 +8794,7 @@ const Bn = ({ label: t, invalid: e, className: a, id: n, ...r }) => t ? /* @__PU
8787
8794
  onSuccess: a
8788
8795
  }) => {
8789
8796
  var pe;
8790
- const n = Gr(), r = Kr(), { toast: s, analytics: o } = re(), { t: i } = ge(), { data: d, isLoading: c } = rs(), { data: u, isLoading: m } = ss(), h = ds(), g = cs(), b = ((pe = d == null ? void 0 : d.paymentMethod) == null ? void 0 : pe.card) ?? null, C = (u == null ? void 0 : u.address) ?? null, _ = (u == null ? void 0 : u.taxIds) ?? [], [v, N] = J(!1), [S, T] = J(!1), [I, k] = J(!1), [A, w] = J(!1), [E, L] = J(null), [O, Z] = J(!1), [V, $] = J(!1), [B, x] = J({}), [H, W] = J(C == null ? void 0 : C.country), [X, D] = J(_.length > 0), [ue, ee] = J(null), ce = ue ?? _.map((ae) => ({ type: ae.type, value: ae.value })), M = Ms(H), K = v || !b, G = (ae, fe) => ee(ce.map((se, Ee) => Ee === ae ? { ...se, ...fe } : se)), P = () => {
8797
+ const n = Gr(), r = Kr(), { toast: s, analytics: o } = ne(), { t: i } = ge(), { data: d, isLoading: c } = rs(), { data: u, isLoading: m } = ss(), h = ds(), g = cs(), b = ((pe = d == null ? void 0 : d.paymentMethod) == null ? void 0 : pe.card) ?? null, C = (u == null ? void 0 : u.address) ?? null, _ = (u == null ? void 0 : u.taxIds) ?? [], [v, N] = J(!1), [S, T] = J(!1), [I, k] = J(!1), [A, w] = J(!1), [E, L] = J(null), [O, Z] = J(!1), [V, $] = J(!1), [B, x] = J({}), [H, W] = J(C == null ? void 0 : C.country), [X, D] = J(_.length > 0), [ue, ee] = J(null), ce = ue ?? _.map((ae) => ({ type: ae.type, value: ae.value })), M = Ms(H), K = v || !b, G = (ae, fe) => ee(ce.map((se, Ee) => Ee === ae ? { ...se, ...fe } : se)), P = () => {
8791
8798
  var ae;
8792
8799
  return ee([...ce, { type: ((ae = M[0]) == null ? void 0 : ae.type) ?? "", value: "" }]);
8793
8800
  }, be = (ae) => ee(ce.filter((fe, se) => se !== ae)), te = async () => {
@@ -10159,7 +10166,7 @@ const Fr = (t, e) => {
10159
10166
  }
10160
10167
  };
10161
10168
  };
10162
- function ne(t) {
10169
+ function re(t) {
10163
10170
  if (!t)
10164
10171
  return {};
10165
10172
  const { errorMap: e, invalid_type_error: a, required_error: n, description: r } = t;
@@ -10338,7 +10345,7 @@ class oe {
10338
10345
  }
10339
10346
  transform(e) {
10340
10347
  return new Ke({
10341
- ...ne(this._def),
10348
+ ...re(this._def),
10342
10349
  schema: this,
10343
10350
  typeName: Y.ZodEffects,
10344
10351
  effect: { type: "transform", transform: e }
@@ -10347,7 +10354,7 @@ class oe {
10347
10354
  default(e) {
10348
10355
  const a = typeof e == "function" ? e : () => e;
10349
10356
  return new Ca({
10350
- ...ne(this._def),
10357
+ ...re(this._def),
10351
10358
  innerType: this,
10352
10359
  defaultValue: a,
10353
10360
  typeName: Y.ZodDefault
@@ -10357,13 +10364,13 @@ class oe {
10357
10364
  return new nr({
10358
10365
  typeName: Y.ZodBranded,
10359
10366
  type: this,
10360
- ...ne(this._def)
10367
+ ...re(this._def)
10361
10368
  });
10362
10369
  }
10363
10370
  catch(e) {
10364
10371
  const a = typeof e == "function" ? e : () => e;
10365
10372
  return new Sa({
10366
- ...ne(this._def),
10373
+ ...re(this._def),
10367
10374
  innerType: this,
10368
10375
  catchValue: a,
10369
10376
  typeName: Y.ZodCatch
@@ -10810,7 +10817,7 @@ We.create = (t) => new We({
10810
10817
  checks: [],
10811
10818
  typeName: Y.ZodString,
10812
10819
  coerce: (t == null ? void 0 : t.coerce) ?? !1,
10813
- ...ne(t)
10820
+ ...re(t)
10814
10821
  });
10815
10822
  function Gd(t, e) {
10816
10823
  const a = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = a > n ? a : n, s = Number.parseInt(t.toFixed(r).replace(".", "")), o = Number.parseInt(e.toFixed(r).replace(".", ""));
@@ -10987,7 +10994,7 @@ vt.create = (t) => new vt({
10987
10994
  checks: [],
10988
10995
  typeName: Y.ZodNumber,
10989
10996
  coerce: (t == null ? void 0 : t.coerce) || !1,
10990
- ...ne(t)
10997
+ ...re(t)
10991
10998
  });
10992
10999
  class _t extends oe {
10993
11000
  constructor() {
@@ -11121,7 +11128,7 @@ _t.create = (t) => new _t({
11121
11128
  checks: [],
11122
11129
  typeName: Y.ZodBigInt,
11123
11130
  coerce: (t == null ? void 0 : t.coerce) ?? !1,
11124
- ...ne(t)
11131
+ ...re(t)
11125
11132
  });
11126
11133
  class ma extends oe {
11127
11134
  _parse(e) {
@@ -11140,7 +11147,7 @@ f.ZodBoolean = ma;
11140
11147
  ma.create = (t) => new ma({
11141
11148
  typeName: Y.ZodBoolean,
11142
11149
  coerce: (t == null ? void 0 : t.coerce) || !1,
11143
- ...ne(t)
11150
+ ...re(t)
11144
11151
  });
11145
11152
  class xt extends oe {
11146
11153
  _parse(e) {
@@ -11219,7 +11226,7 @@ xt.create = (t) => new xt({
11219
11226
  checks: [],
11220
11227
  coerce: (t == null ? void 0 : t.coerce) || !1,
11221
11228
  typeName: Y.ZodDate,
11222
- ...ne(t)
11229
+ ...re(t)
11223
11230
  });
11224
11231
  class en extends oe {
11225
11232
  _parse(e) {
@@ -11237,7 +11244,7 @@ class en extends oe {
11237
11244
  f.ZodSymbol = en;
11238
11245
  en.create = (t) => new en({
11239
11246
  typeName: Y.ZodSymbol,
11240
- ...ne(t)
11247
+ ...re(t)
11241
11248
  });
11242
11249
  class ha extends oe {
11243
11250
  _parse(e) {
@@ -11255,7 +11262,7 @@ class ha extends oe {
11255
11262
  f.ZodUndefined = ha;
11256
11263
  ha.create = (t) => new ha({
11257
11264
  typeName: Y.ZodUndefined,
11258
- ...ne(t)
11265
+ ...re(t)
11259
11266
  });
11260
11267
  class ga extends oe {
11261
11268
  _parse(e) {
@@ -11273,7 +11280,7 @@ class ga extends oe {
11273
11280
  f.ZodNull = ga;
11274
11281
  ga.create = (t) => new ga({
11275
11282
  typeName: Y.ZodNull,
11276
- ...ne(t)
11283
+ ...re(t)
11277
11284
  });
11278
11285
  class Ht extends oe {
11279
11286
  constructor() {
@@ -11286,7 +11293,7 @@ class Ht extends oe {
11286
11293
  f.ZodAny = Ht;
11287
11294
  Ht.create = (t) => new Ht({
11288
11295
  typeName: Y.ZodAny,
11289
- ...ne(t)
11296
+ ...re(t)
11290
11297
  });
11291
11298
  class At extends oe {
11292
11299
  constructor() {
@@ -11299,7 +11306,7 @@ class At extends oe {
11299
11306
  f.ZodUnknown = At;
11300
11307
  At.create = (t) => new At({
11301
11308
  typeName: Y.ZodUnknown,
11302
- ...ne(t)
11309
+ ...re(t)
11303
11310
  });
11304
11311
  class ut extends oe {
11305
11312
  _parse(e) {
@@ -11314,7 +11321,7 @@ class ut extends oe {
11314
11321
  f.ZodNever = ut;
11315
11322
  ut.create = (t) => new ut({
11316
11323
  typeName: Y.ZodNever,
11317
- ...ne(t)
11324
+ ...re(t)
11318
11325
  });
11319
11326
  class tn extends oe {
11320
11327
  _parse(e) {
@@ -11332,7 +11339,7 @@ class tn extends oe {
11332
11339
  f.ZodVoid = tn;
11333
11340
  tn.create = (t) => new tn({
11334
11341
  typeName: Y.ZodVoid,
11335
- ...ne(t)
11342
+ ...re(t)
11336
11343
  });
11337
11344
  class Ge extends oe {
11338
11345
  _parse(e) {
@@ -11406,7 +11413,7 @@ Ge.create = (t, e) => new Ge({
11406
11413
  maxLength: null,
11407
11414
  exactLength: null,
11408
11415
  typeName: Y.ZodArray,
11409
- ...ne(e)
11416
+ ...re(e)
11410
11417
  });
11411
11418
  function jt(t) {
11412
11419
  if (t instanceof Se) {
@@ -11697,21 +11704,21 @@ Se.create = (t, e) => new Se({
11697
11704
  unknownKeys: "strip",
11698
11705
  catchall: ut.create(),
11699
11706
  typeName: Y.ZodObject,
11700
- ...ne(e)
11707
+ ...re(e)
11701
11708
  });
11702
11709
  Se.strictCreate = (t, e) => new Se({
11703
11710
  shape: () => t,
11704
11711
  unknownKeys: "strict",
11705
11712
  catchall: ut.create(),
11706
11713
  typeName: Y.ZodObject,
11707
- ...ne(e)
11714
+ ...re(e)
11708
11715
  });
11709
11716
  Se.lazycreate = (t, e) => new Se({
11710
11717
  shape: t,
11711
11718
  unknownKeys: "strip",
11712
11719
  catchall: ut.create(),
11713
11720
  typeName: Y.ZodObject,
11714
- ...ne(e)
11721
+ ...re(e)
11715
11722
  });
11716
11723
  class ba extends oe {
11717
11724
  _parse(e) {
@@ -11785,7 +11792,7 @@ f.ZodUnion = ba;
11785
11792
  ba.create = (t, e) => new ba({
11786
11793
  options: t,
11787
11794
  typeName: Y.ZodUnion,
11788
- ...ne(e)
11795
+ ...re(e)
11789
11796
  });
11790
11797
  const lt = (t) => t instanceof va ? lt(t.schema) : t instanceof Ke ? lt(t.innerType()) : t instanceof _a ? [t.value] : t instanceof Nt ? t.options : t instanceof Na ? F.util.objectValues(t.enum) : t instanceof Ca ? lt(t._def.innerType) : t instanceof ha ? [void 0] : t instanceof ga ? [null] : t instanceof et ? [void 0, ...lt(t.unwrap())] : t instanceof Ct ? [null, ...lt(t.unwrap())] : t instanceof nr || t instanceof ka ? lt(t.unwrap()) : t instanceof Sa ? lt(t._def.innerType) : [];
11791
11798
  class fn extends oe {
@@ -11846,7 +11853,7 @@ class fn extends oe {
11846
11853
  discriminator: e,
11847
11854
  options: a,
11848
11855
  optionsMap: r,
11849
- ...ne(n)
11856
+ ...re(n)
11850
11857
  });
11851
11858
  }
11852
11859
  }
@@ -11914,7 +11921,7 @@ fa.create = (t, e, a) => new fa({
11914
11921
  left: t,
11915
11922
  right: e,
11916
11923
  typeName: Y.ZodIntersection,
11917
- ...ne(a)
11924
+ ...re(a)
11918
11925
  });
11919
11926
  class nt extends oe {
11920
11927
  _parse(e) {
@@ -11964,7 +11971,7 @@ nt.create = (t, e) => {
11964
11971
  items: t,
11965
11972
  typeName: Y.ZodTuple,
11966
11973
  rest: null,
11967
- ...ne(e)
11974
+ ...re(e)
11968
11975
  });
11969
11976
  };
11970
11977
  class ya extends oe {
@@ -11999,12 +12006,12 @@ class ya extends oe {
11999
12006
  keyType: e,
12000
12007
  valueType: a,
12001
12008
  typeName: Y.ZodRecord,
12002
- ...ne(n)
12009
+ ...re(n)
12003
12010
  }) : new ya({
12004
12011
  keyType: We.create(),
12005
12012
  valueType: e,
12006
12013
  typeName: Y.ZodRecord,
12007
- ...ne(a)
12014
+ ...re(a)
12008
12015
  });
12009
12016
  }
12010
12017
  }
@@ -12056,7 +12063,7 @@ an.create = (t, e, a) => new an({
12056
12063
  valueType: e,
12057
12064
  keyType: t,
12058
12065
  typeName: Y.ZodMap,
12059
- ...ne(a)
12066
+ ...re(a)
12060
12067
  });
12061
12068
  class Pt extends oe {
12062
12069
  _parse(e) {
@@ -12121,7 +12128,7 @@ Pt.create = (t, e) => new Pt({
12121
12128
  minSize: null,
12122
12129
  maxSize: null,
12123
12130
  typeName: Y.ZodSet,
12124
- ...ne(e)
12131
+ ...re(e)
12125
12132
  });
12126
12133
  class Gt extends oe {
12127
12134
  constructor() {
@@ -12210,7 +12217,7 @@ class Gt extends oe {
12210
12217
  args: e || nt.create([]).rest(At.create()),
12211
12218
  returns: a || At.create(),
12212
12219
  typeName: Y.ZodFunction,
12213
- ...ne(n)
12220
+ ...re(n)
12214
12221
  });
12215
12222
  }
12216
12223
  }
@@ -12228,7 +12235,7 @@ f.ZodLazy = va;
12228
12235
  va.create = (t, e) => new va({
12229
12236
  getter: t,
12230
12237
  typeName: Y.ZodLazy,
12231
- ...ne(e)
12238
+ ...re(e)
12232
12239
  });
12233
12240
  class _a extends oe {
12234
12241
  _parse(e) {
@@ -12250,13 +12257,13 @@ f.ZodLiteral = _a;
12250
12257
  _a.create = (t, e) => new _a({
12251
12258
  value: t,
12252
12259
  typeName: Y.ZodLiteral,
12253
- ...ne(e)
12260
+ ...re(e)
12254
12261
  });
12255
12262
  function no(t, e) {
12256
12263
  return new Nt({
12257
12264
  values: t,
12258
12265
  typeName: Y.ZodEnum,
12259
- ...ne(e)
12266
+ ...re(e)
12260
12267
  });
12261
12268
  }
12262
12269
  class Nt extends oe {
@@ -12344,7 +12351,7 @@ f.ZodNativeEnum = Na;
12344
12351
  Na.create = (t, e) => new Na({
12345
12352
  values: t,
12346
12353
  typeName: Y.ZodNativeEnum,
12347
- ...ne(e)
12354
+ ...re(e)
12348
12355
  });
12349
12356
  class Yt extends oe {
12350
12357
  unwrap() {
@@ -12369,7 +12376,7 @@ f.ZodPromise = Yt;
12369
12376
  Yt.create = (t, e) => new Yt({
12370
12377
  type: t,
12371
12378
  typeName: Y.ZodPromise,
12372
- ...ne(e)
12379
+ ...re(e)
12373
12380
  });
12374
12381
  class Ke extends oe {
12375
12382
  innerType() {
@@ -12457,13 +12464,13 @@ Ke.create = (t, e, a) => new Ke({
12457
12464
  schema: t,
12458
12465
  typeName: Y.ZodEffects,
12459
12466
  effect: e,
12460
- ...ne(a)
12467
+ ...re(a)
12461
12468
  });
12462
12469
  Ke.createWithPreprocess = (t, e, a) => new Ke({
12463
12470
  schema: e,
12464
12471
  effect: { type: "preprocess", transform: t },
12465
12472
  typeName: Y.ZodEffects,
12466
- ...ne(a)
12473
+ ...re(a)
12467
12474
  });
12468
12475
  class et extends oe {
12469
12476
  _parse(e) {
@@ -12477,7 +12484,7 @@ f.ZodOptional = et;
12477
12484
  et.create = (t, e) => new et({
12478
12485
  innerType: t,
12479
12486
  typeName: Y.ZodOptional,
12480
- ...ne(e)
12487
+ ...re(e)
12481
12488
  });
12482
12489
  class Ct extends oe {
12483
12490
  _parse(e) {
@@ -12491,7 +12498,7 @@ f.ZodNullable = Ct;
12491
12498
  Ct.create = (t, e) => new Ct({
12492
12499
  innerType: t,
12493
12500
  typeName: Y.ZodNullable,
12494
- ...ne(e)
12501
+ ...re(e)
12495
12502
  });
12496
12503
  class Ca extends oe {
12497
12504
  _parse(e) {
@@ -12512,7 +12519,7 @@ Ca.create = (t, e) => new Ca({
12512
12519
  innerType: t,
12513
12520
  typeName: Y.ZodDefault,
12514
12521
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
12515
- ...ne(e)
12522
+ ...re(e)
12516
12523
  });
12517
12524
  class Sa extends oe {
12518
12525
  _parse(e) {
@@ -12556,7 +12563,7 @@ Sa.create = (t, e) => new Sa({
12556
12563
  innerType: t,
12557
12564
  typeName: Y.ZodCatch,
12558
12565
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
12559
- ...ne(e)
12566
+ ...re(e)
12560
12567
  });
12561
12568
  class nn extends oe {
12562
12569
  _parse(e) {
@@ -12574,7 +12581,7 @@ class nn extends oe {
12574
12581
  f.ZodNaN = nn;
12575
12582
  nn.create = (t) => new nn({
12576
12583
  typeName: Y.ZodNaN,
12577
- ...ne(t)
12584
+ ...re(t)
12578
12585
  });
12579
12586
  f.BRAND = Symbol("zod_brand");
12580
12587
  class nr extends oe {
@@ -12645,7 +12652,7 @@ f.ZodReadonly = ka;
12645
12652
  ka.create = (t, e) => new ka({
12646
12653
  innerType: t,
12647
12654
  typeName: Y.ZodReadonly,
12648
- ...ne(e)
12655
+ ...re(e)
12649
12656
  });
12650
12657
  function Mr(t, e) {
12651
12658
  const a = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
@@ -13251,7 +13258,7 @@ const nu = ({
13251
13258
  period: i
13252
13259
  }) => {
13253
13260
  var $, B;
13254
- const { isOutdatedBilling: d, analytics: c, scope: u } = re(), { t: m } = ge(), { data: h } = rt(), { data: g } = Qt(), { data: b } = Ve({ enabled: !d }), { data: C } = Xt({ period: i, enabled: !d }), _ = t !== void 0, [v, N] = J(!1), S = h == null ? void 0 : h.find((x) => x.id === (b == null ? void 0 : b.plan.current.planId)), T = b ? S ? _e(S) === "community" : !0 : !1, I = Re(() => yn(C).find((x) => x.key === "conversation_sessions"), [C]), k = !_ && !d && T && !!I && I.pct / 100 >= Pc && !v && !Zs(zr, u, "modal"), A = _ ? !!t : k;
13261
+ const { isOutdatedBilling: d, analytics: c, scope: u } = ne(), { t: m } = ge(), { data: h } = rt(), { data: g } = Qt(), { data: b } = $e({ enabled: !d }), { data: C } = Xt({ period: i, enabled: !d }), _ = t !== void 0, [v, N] = J(!1), S = h == null ? void 0 : h.find((x) => x.id === (b == null ? void 0 : b.plan.current.planId)), T = b ? S ? _e(S) === "community" : !0 : !1, I = Re(() => yn(C).find((x) => x.key === "conversation_sessions"), [C]), k = !_ && !d && T && !!I && I.pct / 100 >= Pc && !v && !Zs(zr, u, "modal"), A = _ ? !!t : k;
13255
13262
  Oe(() => {
13256
13263
  A && c.capture(we.PLAN_PICKER_VIEWED, {
13257
13264
  source: _ ? "outgrow_free" : "outgrow_free_auto",
@@ -13482,13 +13489,13 @@ const nu = ({
13482
13489
  onIncreaseLimits: r
13483
13490
  }) => {
13484
13491
  var Z;
13485
- const { isOutdatedBilling: s, locale: o } = re(), { t: i } = ge(), d = Re(() => Lc(a, o), [a, o]), [c, u] = J(t ?? ((Z = d[0]) == null ? void 0 : Z.value) ?? ""), m = Fi(), h = Math.max(
13492
+ const { isOutdatedBilling: s, locale: o } = ne(), { t: i } = ge(), d = Re(() => Lc(a, o), [a, o]), [c, u] = J(t ?? ((Z = d[0]) == null ? void 0 : Z.value) ?? ""), m = Fi(), h = Math.max(
13486
13493
  0,
13487
13494
  d.findIndex((V) => V.value === c)
13488
13495
  ), g = (V) => {
13489
13496
  const $ = d[h + V];
13490
13497
  $ && u($.value);
13491
- }, { data: b, isLoading: C, isError: _ } = Xt({ period: c, enabled: !s }), { data: v } = Ve({ enabled: !s }), { data: N } = rt(), S = N == null ? void 0 : N.find((V) => V.id === (v == null ? void 0 : v.plan.current.planId)), T = S ? Ne(S.name) : void 0, I = S ? _e(S) : "community", k = I === "enterprise" || I === "managed", A = (V) => S == null ? void 0 : S.features[V];
13498
+ }, { data: b, isLoading: C, isError: _ } = Xt({ period: c, enabled: !s }), { data: v } = $e({ enabled: !s }), { data: N } = rt(), S = N == null ? void 0 : N.find((V) => V.id === (v == null ? void 0 : v.plan.current.planId)), T = S ? Ne(S.name) : void 0, I = S ? _e(S) : "community", k = I === "enterprise" || I === "managed", A = (V) => S == null ? void 0 : S.features[V];
13492
13499
  if (s)
13493
13500
  return /* @__PURE__ */ l("div", { className: j("bpb-usage bpb-scope", n), children: /* @__PURE__ */ l(Rt, {}) });
13494
13501
  if (C)
@@ -13607,7 +13614,7 @@ const nu = ({
13607
13614
  period: o,
13608
13615
  className: i
13609
13616
  }) => {
13610
- const { isOutdatedBilling: d, analytics: c, scope: u } = re(), { t: m } = ge(), { data: h } = Xt({ period: o, enabled: !d }), [g, b] = J({}), [C, _] = J(!1), [v, N] = J(null), S = h ? Object.entries(h).map(([O, Z]) => ({ key: O, pct: Z.quota > 0 ? (Z.usage ?? 0) / Z.quota : 0 })).filter((O) => O.pct >= e).sort((O, Z) => Z.pct - O.pct)[0] : void 0, T = !!S && (g[S.key] || Zs(jr, u, S.key));
13617
+ const { isOutdatedBilling: d, analytics: c, scope: u } = ne(), { t: m } = ge(), { data: h } = Xt({ period: o, enabled: !d }), [g, b] = J({}), [C, _] = J(!1), [v, N] = J(null), S = h ? Object.entries(h).map(([O, Z]) => ({ key: O, pct: Z.quota > 0 ? (Z.usage ?? 0) / Z.quota : 0 })).filter((O) => O.pct >= e).sort((O, Z) => Z.pct - O.pct)[0] : void 0, T = !!S && (g[S.key] || Zs(jr, u, S.key));
13611
13618
  if (d || !S || T)
13612
13619
  return null;
13613
13620
  const k = {
@@ -13690,7 +13697,7 @@ const nu = ({
13690
13697
  ] }),
13691
13698
  /* @__PURE__ */ l("p", { className: "bpb-action-card__description", children: a })
13692
13699
  ] }), wa = ({ children: t }) => /* @__PURE__ */ l("span", { className: "bpb-summary-card__icon", "aria-hidden": "true", children: t }), po = ({ isAddons: t, className: e }) => {
13693
- const { manageBillingUrl: a } = re(), { t: n } = ge(), r = () => a && window.open(a, "_blank", "noopener");
13700
+ const { manageBillingUrl: a } = ne(), { t: n } = ge(), r = () => a && window.open(a, "_blank", "noopener");
13694
13701
  return /* @__PURE__ */ p(
13695
13702
  "button",
13696
13703
  {
@@ -13720,7 +13727,7 @@ const nu = ({
13720
13727
  );
13721
13728
  }, iu = ({ onManage: t, className: e }) => {
13722
13729
  var C, _;
13723
- const { isOutdatedBilling: a } = re(), { t: n } = ge(), { data: r, isLoading: s } = Ve({ enabled: !a }), { data: o, isLoading: i } = rt();
13730
+ const { isOutdatedBilling: a } = ne(), { t: n } = ge(), { data: r, isLoading: s } = $e({ enabled: !a }), { data: o, isLoading: i } = rt();
13724
13731
  if (a)
13725
13732
  return /* @__PURE__ */ l(po, { isAddons: !1, className: e });
13726
13733
  if (s || i)
@@ -13756,7 +13763,7 @@ const nu = ({
13756
13763
  }
13757
13764
  );
13758
13765
  }, lu = ({ onManage: t, className: e }) => {
13759
- const { isOutdatedBilling: a } = re(), { t: n } = ge(), { data: r, isLoading: s } = Ve({ enabled: !a }), { data: o, isLoading: i } = Qt();
13766
+ const { isOutdatedBilling: a } = ne(), { t: n } = ge(), { data: r, isLoading: s } = $e({ enabled: !a }), { data: o, isLoading: i } = Qt();
13760
13767
  if (a)
13761
13768
  return /* @__PURE__ */ l(po, { isAddons: !0, className: e });
13762
13769
  if (s || i)
@@ -13798,7 +13805,7 @@ const nu = ({
13798
13805
  }
13799
13806
  );
13800
13807
  }, du = ({ onManage: t, className: e }) => {
13801
- const { isOutdatedBilling: a } = re(), { t: n } = ge(), { data: r, isLoading: s, isError: o } = is({ enabled: !a });
13808
+ const { isOutdatedBilling: a } = ne(), { t: n } = ge(), { data: r, isLoading: s, isError: o } = is({ enabled: !a });
13802
13809
  if (a)
13803
13810
  return null;
13804
13811
  if (s)
@@ -13857,7 +13864,7 @@ const nu = ({
13857
13864
  );
13858
13865
  }, cu = ({ onManage: t, className: e }) => {
13859
13866
  var W, X;
13860
- const { isOutdatedBilling: a, locale: n, manageBillingUrl: r, analytics: s } = re(), { t: o } = ge(), { data: i, isLoading: d } = Ve({ enabled: !a }), { data: c, isLoading: u } = rt(), { data: m, isLoading: h } = Qt();
13867
+ const { isOutdatedBilling: a, locale: n, manageBillingUrl: r, analytics: s } = ne(), { t: o } = ge(), { data: i, isLoading: d } = $e({ enabled: !a }), { data: c, isLoading: u } = rt(), { data: m, isLoading: h } = Qt();
13861
13868
  if (a) {
13862
13869
  const D = () => r && window.open(r, "_blank", "noopener");
13863
13870
  return /* @__PURE__ */ p(
@@ -13950,7 +13957,7 @@ const nu = ({
13950
13957
  className: r,
13951
13958
  style: s
13952
13959
  }) => {
13953
- const { isOutdatedBilling: o, locale: i } = re(), { t: d } = ge(), { data: c, isLoading: u } = Ve({ enabled: !o }), { data: m, isLoading: h } = rt(), { data: g, isLoading: b } = Xt({ period: e, enabled: !o });
13960
+ const { isOutdatedBilling: o, locale: i } = ne(), { t: d } = ge(), { data: c, isLoading: u } = $e({ enabled: !o }), { data: m, isLoading: h } = rt(), { data: g, isLoading: b } = Xt({ period: e, enabled: !o });
13954
13961
  if (o)
13955
13962
  return null;
13956
13963
  if (u || h || b)
@@ -14025,7 +14032,7 @@ const nu = ({
14025
14032
  block: o = !1,
14026
14033
  className: i
14027
14034
  }) => {
14028
- const { isOutdatedBilling: d, analytics: c, locale: u } = re(), { t: m } = ge(), { data: h } = Xt({ period: r, enabled: !d }), { data: g } = Ve({ enabled: !d }), { data: b } = rt(), [C, _] = J(!1), v = rn(null), N = () => {
14035
+ const { isOutdatedBilling: d, analytics: c, locale: u } = ne(), { t: m } = ge(), { data: h } = Xt({ period: r, enabled: !d }), { data: g } = $e({ enabled: !d }), { data: b } = rt(), [C, _] = J(!1), v = rn(null), N = () => {
14029
14036
  v.current && (clearTimeout(v.current), v.current = null);
14030
14037
  };
14031
14038
  Oe(() => N, []);
@@ -14115,7 +14122,7 @@ const nu = ({
14115
14122
  className: d,
14116
14123
  ...c
14117
14124
  }) => {
14118
- const { isOutdatedBilling: u } = re(), { data: m } = Xt({ period: i, enabled: !u }), h = yn(m);
14125
+ const { isOutdatedBilling: u } = ne(), { data: m } = Xt({ period: i, enabled: !u }), h = yn(m);
14119
14126
  if (u || h.length === 0)
14120
14127
  return null;
14121
14128
  const g = h[0], b = rr(g.pct), C = g.pct > 0 ? Math.max(5, g.pct) : 0, _ = (t - e) / 2, v = 2 * Math.PI * _, N = v * (1 - C / 100), S = c["aria-label"] ?? `${Math.round(g.pct)}% of your ${g.label.toLowerCase()} used`, T = /* @__PURE__ */ p(Te, { children: [
@@ -14166,7 +14173,7 @@ const nu = ({
14166
14173
  children: /* @__PURE__ */ l("span", { className: "bpb-switch__thumb" })
14167
14174
  }
14168
14175
  ), Vr = "ai_spend", Bc = 5, Pn = (t) => (t ?? 0) / tt, Dn = (t) => Math.round(t * tt), Zr = (t) => Number.isInteger(t) && t >= Bc, Uc = (t, e) => Number.isInteger(t) && t >= 0 && e > 0 && t % e === 0, mu = ({ open: t, onOpenChange: e, onSuccess: a, onUpgrade: n }) => {
14169
- const { isOutdatedBilling: r } = re(), { t: s } = ge();
14176
+ const { isOutdatedBilling: r } = ne(), { t: s } = ge();
14170
14177
  return r ? /* @__PURE__ */ l(
14171
14178
  Fe,
14172
14179
  {
@@ -14183,12 +14190,12 @@ const nu = ({
14183
14190
  onSuccess: e,
14184
14191
  onUpgrade: a
14185
14192
  }) => {
14186
- const { toast: n, analytics: r } = re(), { t: s } = ge(), {
14193
+ const { toast: n, analytics: r } = ne(), { t: s } = ge(), {
14187
14194
  data: o,
14188
14195
  isLoading: i,
14189
14196
  isError: d,
14190
14197
  refetch: c
14191
- } = Ve(), { data: u, isLoading: m, isError: h, refetch: g } = rt(), {
14198
+ } = $e(), { data: u, isLoading: m, isError: h, refetch: g } = rt(), {
14192
14199
  data: b,
14193
14200
  isLoading: C,
14194
14201
  isError: _,
@@ -14491,7 +14498,7 @@ export {
14491
14498
  ja as addonDisplayName,
14492
14499
  Ll as addonLimitsPreview,
14493
14500
  Wn as addonPrice,
14494
- Ae as billingKeys,
14501
+ Ie as billingKeys,
14495
14502
  j as cn,
14496
14503
  Gn as conversationPackPrice,
14497
14504
  El as conversationsAddon,
@@ -14514,7 +14521,7 @@ export {
14514
14521
  rr as usageTier,
14515
14522
  Qt as useAddons,
14516
14523
  is as useAutoRechargeSettings,
14517
- re as useBilling,
14524
+ ne as useBilling,
14518
14525
  os as useBillingReadonly,
14519
14526
  ls as useCreatePaymentMethodIntent,
14520
14527
  ss as useCustomer,
@@ -14527,7 +14534,7 @@ export {
14527
14534
  cs as useSetCustomer,
14528
14535
  ds as useSetPaymentMethod,
14529
14536
  us as useSetSubscription,
14530
- Ve as useSubscription,
14537
+ $e as useSubscription,
14531
14538
  ns as useSubscriptionPreview,
14532
14539
  Fi as useSupportsUsageByBot,
14533
14540
  Xt as useUsage,