import { b1 as Qe, aK as Fe, aJ as D, k as er, e as Ce } from "./index-THhC4TET.js";
import k, { useState as le, useEffect as Ue } from "react";
var Te = {};
Object.defineProperty(Te, "__esModule", { value: !0 });
function ue(r) {
  "@babel/helpers - typeof";
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? ue = function(e) {
    return typeof e;
  } : ue = function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, ue(r);
}
var Be = "https://js.stripe.com/v3", rr = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/, xe = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used", tr = function() {
  for (var e = document.querySelectorAll('script[src^="'.concat(Be, '"]')), t = 0; t < e.length; t++) {
    var n = e[t];
    if (rr.test(n.src))
      return n;
  }
  return null;
}, nr = function(e) {
  var t = e && !e.advancedFraudSignals ? "?advancedFraudSignals=false" : "", n = document.createElement("script");
  n.src = "".concat(Be).concat(t);
  var u = document.head || document.body;
  if (!u)
    throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
  return u.appendChild(n), n;
}, or = function(e, t) {
  !e || !e._registerWrapper || e._registerWrapper({
    name: "stripe-js",
    version: "1.35.0",
    startTime: t
  });
}, se = null, ar = function(e) {
  return se !== null || (se = new Promise(function(t, n) {
    if (typeof window > "u") {
      t(null);
      return;
    }
    if (window.Stripe && e && console.warn(xe), window.Stripe) {
      t(window.Stripe);
      return;
    }
    try {
      var u = tr();
      u && e ? console.warn(xe) : u || (u = nr(e)), u.addEventListener("load", function() {
        window.Stripe ? t(window.Stripe) : n(new Error("Stripe.js not available"));
      }), u.addEventListener("error", function() {
        n(new Error("Failed to load Stripe.js"));
      });
    } catch (a) {
      n(a);
      return;
    }
  })), se;
}, ir = function(e, t, n) {
  if (e === null)
    return null;
  var u = e.apply(void 0, t);
  return or(u, n), u;
}, sr = function(e) {
  var t = `invalid load parameters; expected object of shape

    {advancedFraudSignals: boolean}

but received

    `.concat(JSON.stringify(e), `
`);
  if (e === null || ue(e) !== "object")
    throw new Error(t);
  if (Object.keys(e).length === 1 && typeof e.advancedFraudSignals == "boolean")
    return e;
  throw new Error(t);
}, ze, He = !1, Ke = function() {
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
    t[n] = arguments[n];
  He = !0;
  var u = Date.now();
  return ar(ze).then(function(a) {
    return ir(a, t, u);
  });
};
Ke.setLoadParameters = function(r) {
  if (He)
    throw new Error("You cannot change load parameters after calling loadStripe");
  ze = sr(r);
};
Te.loadStripe = Ke;
var cr = Te;
const ur = process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY || "";
let pe;
const fr = (r) => (pe || (pe = cr.loadStripe(
  r || ur
  /* , {
    locale: "es-419" TODO: Handle multiple locales,
  } */
)), pe), lr = fr;
var ge = { exports: {} }, ye, we;
function Oe() {
  if (we)
    return ye;
  we = 1;
  var r = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
  return ye = r, ye;
}
var ve, Re;
function dr() {
  if (Re)
    return ve;
  Re = 1;
  var r = Oe();
  function e() {
  }
  function t() {
  }
  return t.resetWarningCache = e, ve = function() {
    function n(v, l, f, d, y, h) {
      if (h !== r) {
        var b = new Error(
          "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
        );
        throw b.name = "Invariant Violation", b;
      }
    }
    n.isRequired = n;
    function u() {
      return n;
    }
    var a = {
      array: n,
      bigint: n,
      bool: n,
      func: n,
      number: n,
      object: n,
      string: n,
      symbol: n,
      any: n,
      arrayOf: u,
      element: n,
      elementType: n,
      instanceOf: u,
      node: n,
      objectOf: u,
      oneOf: u,
      oneOfType: u,
      shape: u,
      exact: u,
      checkPropTypes: t,
      resetWarningCache: e
    };
    return a.PropTypes = a, a;
  }, ve;
}
var ce = { exports: {} }, C = {};
/** @license React v16.13.1
 * react-is.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var je;
function pr() {
  return je || (je = 1, process.env.NODE_ENV !== "production" && function() {
    var r = typeof Symbol == "function" && Symbol.for, e = r ? Symbol.for("react.element") : 60103, t = r ? Symbol.for("react.portal") : 60106, n = r ? Symbol.for("react.fragment") : 60107, u = r ? Symbol.for("react.strict_mode") : 60108, a = r ? Symbol.for("react.profiler") : 60114, v = r ? Symbol.for("react.provider") : 60109, l = r ? Symbol.for("react.context") : 60110, f = r ? Symbol.for("react.async_mode") : 60111, d = r ? Symbol.for("react.concurrent_mode") : 60111, y = r ? Symbol.for("react.forward_ref") : 60112, h = r ? Symbol.for("react.suspense") : 60113, b = r ? Symbol.for("react.suspense_list") : 60120, R = r ? Symbol.for("react.memo") : 60115, A = r ? Symbol.for("react.lazy") : 60116, _ = r ? Symbol.for("react.block") : 60121, j = r ? Symbol.for("react.fundamental") : 60117, L = r ? Symbol.for("react.responder") : 60118, J = r ? Symbol.for("react.scope") : 60119;
    function I(s) {
      return typeof s == "string" || typeof s == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
      s === n || s === d || s === a || s === u || s === h || s === b || typeof s == "object" && s !== null && (s.$$typeof === A || s.$$typeof === R || s.$$typeof === v || s.$$typeof === l || s.$$typeof === y || s.$$typeof === j || s.$$typeof === L || s.$$typeof === J || s.$$typeof === _);
    }
    function $(s) {
      if (typeof s == "object" && s !== null) {
        var U = s.$$typeof;
        switch (U) {
          case e:
            var ie = s.type;
            switch (ie) {
              case f:
              case d:
              case n:
              case a:
              case u:
              case h:
                return ie;
              default:
                var _e = ie && ie.$$typeof;
                switch (_e) {
                  case l:
                  case y:
                  case A:
                  case R:
                  case v:
                    return _e;
                  default:
                    return U;
                }
            }
          case t:
            return U;
        }
      }
    }
    var i = f, B = d, X = l, re = v, Z = e, te = y, G = n, ne = A, oe = R, z = t, F = a, W = u, H = h, Q = !1;
    function ae(s) {
      return Q || (Q = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), o(s) || $(s) === f;
    }
    function o(s) {
      return $(s) === d;
    }
    function c(s) {
      return $(s) === l;
    }
    function g(s) {
      return $(s) === v;
    }
    function E(s) {
      return typeof s == "object" && s !== null && s.$$typeof === e;
    }
    function m(s) {
      return $(s) === y;
    }
    function T(s) {
      return $(s) === n;
    }
    function p(s) {
      return $(s) === A;
    }
    function S(s) {
      return $(s) === R;
    }
    function O(s) {
      return $(s) === t;
    }
    function w(s) {
      return $(s) === a;
    }
    function P(s) {
      return $(s) === u;
    }
    function Y(s) {
      return $(s) === h;
    }
    C.AsyncMode = i, C.ConcurrentMode = B, C.ContextConsumer = X, C.ContextProvider = re, C.Element = Z, C.ForwardRef = te, C.Fragment = G, C.Lazy = ne, C.Memo = oe, C.Portal = z, C.Profiler = F, C.StrictMode = W, C.Suspense = H, C.isAsyncMode = ae, C.isConcurrentMode = o, C.isContextConsumer = c, C.isContextProvider = g, C.isElement = E, C.isForwardRef = m, C.isFragment = T, C.isLazy = p, C.isMemo = S, C.isPortal = O, C.isProfiler = w, C.isStrictMode = P, C.isSuspense = Y, C.isValidElementType = I, C.typeOf = $;
  }()), C;
}
var x = {};
/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var Ae;
function yr() {
  if (Ae)
    return x;
  Ae = 1;
  var r = typeof Symbol == "function" && Symbol.for, e = r ? Symbol.for("react.element") : 60103, t = r ? Symbol.for("react.portal") : 60106, n = r ? Symbol.for("react.fragment") : 60107, u = r ? Symbol.for("react.strict_mode") : 60108, a = r ? Symbol.for("react.profiler") : 60114, v = r ? Symbol.for("react.provider") : 60109, l = r ? Symbol.for("react.context") : 60110, f = r ? Symbol.for("react.async_mode") : 60111, d = r ? Symbol.for("react.concurrent_mode") : 60111, y = r ? Symbol.for("react.forward_ref") : 60112, h = r ? Symbol.for("react.suspense") : 60113, b = r ? Symbol.for("react.suspense_list") : 60120, R = r ? Symbol.for("react.memo") : 60115, A = r ? Symbol.for("react.lazy") : 60116, _ = r ? Symbol.for("react.block") : 60121, j = r ? Symbol.for("react.fundamental") : 60117, L = r ? Symbol.for("react.responder") : 60118, J = r ? Symbol.for("react.scope") : 60119;
  function I(i) {
    if (typeof i == "object" && i !== null) {
      var B = i.$$typeof;
      switch (B) {
        case e:
          switch (i = i.type, i) {
            case f:
            case d:
            case n:
            case a:
            case u:
            case h:
              return i;
            default:
              switch (i = i && i.$$typeof, i) {
                case l:
                case y:
                case A:
                case R:
                case v:
                  return i;
                default:
                  return B;
              }
          }
        case t:
          return B;
      }
    }
  }
  function $(i) {
    return I(i) === d;
  }
  return x.AsyncMode = f, x.ConcurrentMode = d, x.ContextConsumer = l, x.ContextProvider = v, x.Element = e, x.ForwardRef = y, x.Fragment = n, x.Lazy = A, x.Memo = R, x.Portal = t, x.Profiler = a, x.StrictMode = u, x.Suspense = h, x.isAsyncMode = function(i) {
    return $(i) || I(i) === f;
  }, x.isConcurrentMode = $, x.isContextConsumer = function(i) {
    return I(i) === l;
  }, x.isContextProvider = function(i) {
    return I(i) === v;
  }, x.isElement = function(i) {
    return typeof i == "object" && i !== null && i.$$typeof === e;
  }, x.isForwardRef = function(i) {
    return I(i) === y;
  }, x.isFragment = function(i) {
    return I(i) === n;
  }, x.isLazy = function(i) {
    return I(i) === A;
  }, x.isMemo = function(i) {
    return I(i) === R;
  }, x.isPortal = function(i) {
    return I(i) === t;
  }, x.isProfiler = function(i) {
    return I(i) === a;
  }, x.isStrictMode = function(i) {
    return I(i) === u;
  }, x.isSuspense = function(i) {
    return I(i) === h;
  }, x.isValidElementType = function(i) {
    return typeof i == "string" || typeof i == "function" || i === n || i === d || i === a || i === u || i === h || i === b || typeof i == "object" && i !== null && (i.$$typeof === A || i.$$typeof === R || i.$$typeof === v || i.$$typeof === l || i.$$typeof === y || i.$$typeof === j || i.$$typeof === L || i.$$typeof === J || i.$$typeof === _);
  }, x.typeOf = I, x;
}
var Ie;
function Ve() {
  return Ie || (Ie = 1, process.env.NODE_ENV === "production" ? ce.exports = yr() : ce.exports = pr()), ce.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var me, $e;
function vr() {
  if ($e)
    return me;
  $e = 1;
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
  function n(a) {
    if (a == null)
      throw new TypeError("Object.assign cannot be called with null or undefined");
    return Object(a);
  }
  function u() {
    try {
      if (!Object.assign)
        return !1;
      var a = new String("abc");
      if (a[5] = "de", Object.getOwnPropertyNames(a)[0] === "5")
        return !1;
      for (var v = {}, l = 0; l < 10; l++)
        v["_" + String.fromCharCode(l)] = l;
      var f = Object.getOwnPropertyNames(v).map(function(y) {
        return v[y];
      });
      if (f.join("") !== "0123456789")
        return !1;
      var d = {};
      return "abcdefghijklmnopqrst".split("").forEach(function(y) {
        d[y] = y;
      }), Object.keys(Object.assign({}, d)).join("") === "abcdefghijklmnopqrst";
    } catch {
      return !1;
    }
  }
  return me = u() ? Object.assign : function(a, v) {
    for (var l, f = n(a), d, y = 1; y < arguments.length; y++) {
      l = Object(arguments[y]);
      for (var h in l)
        e.call(l, h) && (f[h] = l[h]);
      if (r) {
        d = r(l);
        for (var b = 0; b < d.length; b++)
          t.call(l, d[b]) && (f[d[b]] = l[d[b]]);
      }
    }
    return f;
  }, me;
}
var be, ke;
function Je() {
  return ke || (ke = 1, be = Function.call.bind(Object.prototype.hasOwnProperty)), be;
}
var he, Le;
function mr() {
  if (Le)
    return he;
  Le = 1;
  var r = function() {
  };
  if (process.env.NODE_ENV !== "production") {
    var e = Oe(), t = {}, n = Je();
    r = function(a) {
      var v = "Warning: " + a;
      typeof console < "u" && console.error(v);
      try {
        throw new Error(v);
      } catch {
      }
    };
  }
  function u(a, v, l, f, d) {
    if (process.env.NODE_ENV !== "production") {
      for (var y in a)
        if (n(a, y)) {
          var h;
          try {
            if (typeof a[y] != "function") {
              var b = Error(
                (f || "React class") + ": " + l + " type `" + y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[y] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
              );
              throw b.name = "Invariant Violation", b;
            }
            h = a[y](v, y, f, l, null, e);
          } catch (A) {
            h = A;
          }
          if (h && !(h instanceof Error) && r(
            (f || "React class") + ": type specification of " + l + " `" + y + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof h + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
          ), h instanceof Error && !(h.message in t)) {
            t[h.message] = !0;
            var R = d ? d() : "";
            r(
              "Failed " + l + " type: " + h.message + (R ?? "")
            );
          }
        }
    }
  }
  return u.resetWarningCache = function() {
    process.env.NODE_ENV !== "production" && (t = {});
  }, he = u, he;
}
var Ee, Me;
function br() {
  if (Me)
    return Ee;
  Me = 1;
  var r = Ve(), e = vr(), t = Oe(), n = Je(), u = mr(), a = function() {
  };
  process.env.NODE_ENV !== "production" && (a = function(l) {
    var f = "Warning: " + l;
    typeof console < "u" && console.error(f);
    try {
      throw new Error(f);
    } catch {
    }
  });
  function v() {
    return null;
  }
  return Ee = function(l, f) {
    var d = typeof Symbol == "function" && Symbol.iterator, y = "@@iterator";
    function h(o) {
      var c = o && (d && o[d] || o[y]);
      if (typeof c == "function")
        return c;
    }
    var b = "<<anonymous>>", R = {
      array: L("array"),
      bigint: L("bigint"),
      bool: L("boolean"),
      func: L("function"),
      number: L("number"),
      object: L("object"),
      string: L("string"),
      symbol: L("symbol"),
      any: J(),
      arrayOf: I,
      element: $(),
      elementType: i(),
      instanceOf: B,
      node: te(),
      objectOf: re,
      oneOf: X,
      oneOfType: Z,
      shape: ne,
      exact: oe
    };
    function A(o, c) {
      return o === c ? o !== 0 || 1 / o === 1 / c : o !== o && c !== c;
    }
    function _(o, c) {
      this.message = o, this.data = c && typeof c == "object" ? c : {}, this.stack = "";
    }
    _.prototype = Error.prototype;
    function j(o) {
      if (process.env.NODE_ENV !== "production")
        var c = {}, g = 0;
      function E(T, p, S, O, w, P, Y) {
        if (O = O || b, P = P || S, Y !== t) {
          if (f) {
            var s = new Error(
              "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
            );
            throw s.name = "Invariant Violation", s;
          } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
            var U = O + ":" + S;
            !c[U] && // Avoid spamming the console because they are often not actionable except for lib authors
            g < 3 && (a(
              "You are manually calling a React.PropTypes validation function for the `" + P + "` prop on `" + O + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
            ), c[U] = !0, g++);
          }
        }
        return p[S] == null ? T ? p[S] === null ? new _("The " + w + " `" + P + "` is marked as required " + ("in `" + O + "`, but its value is `null`.")) : new _("The " + w + " `" + P + "` is marked as required in " + ("`" + O + "`, but its value is `undefined`.")) : null : o(p, S, O, w, P);
      }
      var m = E.bind(null, !1);
      return m.isRequired = E.bind(null, !0), m;
    }
    function L(o) {
      function c(g, E, m, T, p, S) {
        var O = g[E], w = W(O);
        if (w !== o) {
          var P = H(O);
          return new _(
            "Invalid " + T + " `" + p + "` of type " + ("`" + P + "` supplied to `" + m + "`, expected ") + ("`" + o + "`."),
            { expectedType: o }
          );
        }
        return null;
      }
      return j(c);
    }
    function J() {
      return j(v);
    }
    function I(o) {
      function c(g, E, m, T, p) {
        if (typeof o != "function")
          return new _("Property `" + p + "` of component `" + m + "` has invalid PropType notation inside arrayOf.");
        var S = g[E];
        if (!Array.isArray(S)) {
          var O = W(S);
          return new _("Invalid " + T + " `" + p + "` of type " + ("`" + O + "` supplied to `" + m + "`, expected an array."));
        }
        for (var w = 0; w < S.length; w++) {
          var P = o(S, w, m, T, p + "[" + w + "]", t);
          if (P instanceof Error)
            return P;
        }
        return null;
      }
      return j(c);
    }
    function $() {
      function o(c, g, E, m, T) {
        var p = c[g];
        if (!l(p)) {
          var S = W(p);
          return new _("Invalid " + m + " `" + T + "` of type " + ("`" + S + "` supplied to `" + E + "`, expected a single ReactElement."));
        }
        return null;
      }
      return j(o);
    }
    function i() {
      function o(c, g, E, m, T) {
        var p = c[g];
        if (!r.isValidElementType(p)) {
          var S = W(p);
          return new _("Invalid " + m + " `" + T + "` of type " + ("`" + S + "` supplied to `" + E + "`, expected a single ReactElement type."));
        }
        return null;
      }
      return j(o);
    }
    function B(o) {
      function c(g, E, m, T, p) {
        if (!(g[E] instanceof o)) {
          var S = o.name || b, O = ae(g[E]);
          return new _("Invalid " + T + " `" + p + "` of type " + ("`" + O + "` supplied to `" + m + "`, expected ") + ("instance of `" + S + "`."));
        }
        return null;
      }
      return j(c);
    }
    function X(o) {
      if (!Array.isArray(o))
        return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? a(
          "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
        ) : a("Invalid argument supplied to oneOf, expected an array.")), v;
      function c(g, E, m, T, p) {
        for (var S = g[E], O = 0; O < o.length; O++)
          if (A(S, o[O]))
            return null;
        var w = JSON.stringify(o, function(Y, s) {
          var U = H(s);
          return U === "symbol" ? String(s) : s;
        });
        return new _("Invalid " + T + " `" + p + "` of value `" + String(S) + "` " + ("supplied to `" + m + "`, expected one of " + w + "."));
      }
      return j(c);
    }
    function re(o) {
      function c(g, E, m, T, p) {
        if (typeof o != "function")
          return new _("Property `" + p + "` of component `" + m + "` has invalid PropType notation inside objectOf.");
        var S = g[E], O = W(S);
        if (O !== "object")
          return new _("Invalid " + T + " `" + p + "` of type " + ("`" + O + "` supplied to `" + m + "`, expected an object."));
        for (var w in S)
          if (n(S, w)) {
            var P = o(S, w, m, T, p + "." + w, t);
            if (P instanceof Error)
              return P;
          }
        return null;
      }
      return j(c);
    }
    function Z(o) {
      if (!Array.isArray(o))
        return process.env.NODE_ENV !== "production" && a("Invalid argument supplied to oneOfType, expected an instance of array."), v;
      for (var c = 0; c < o.length; c++) {
        var g = o[c];
        if (typeof g != "function")
          return a(
            "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + Q(g) + " at index " + c + "."
          ), v;
      }
      function E(m, T, p, S, O) {
        for (var w = [], P = 0; P < o.length; P++) {
          var Y = o[P], s = Y(m, T, p, S, O, t);
          if (s == null)
            return null;
          s.data && n(s.data, "expectedType") && w.push(s.data.expectedType);
        }
        var U = w.length > 0 ? ", expected one of type [" + w.join(", ") + "]" : "";
        return new _("Invalid " + S + " `" + O + "` supplied to " + ("`" + p + "`" + U + "."));
      }
      return j(E);
    }
    function te() {
      function o(c, g, E, m, T) {
        return z(c[g]) ? null : new _("Invalid " + m + " `" + T + "` supplied to " + ("`" + E + "`, expected a ReactNode."));
      }
      return j(o);
    }
    function G(o, c, g, E, m) {
      return new _(
        (o || "React class") + ": " + c + " type `" + g + "." + E + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + m + "`."
      );
    }
    function ne(o) {
      function c(g, E, m, T, p) {
        var S = g[E], O = W(S);
        if (O !== "object")
          return new _("Invalid " + T + " `" + p + "` of type `" + O + "` " + ("supplied to `" + m + "`, expected `object`."));
        for (var w in o) {
          var P = o[w];
          if (typeof P != "function")
            return G(m, T, p, w, H(P));
          var Y = P(S, w, m, T, p + "." + w, t);
          if (Y)
            return Y;
        }
        return null;
      }
      return j(c);
    }
    function oe(o) {
      function c(g, E, m, T, p) {
        var S = g[E], O = W(S);
        if (O !== "object")
          return new _("Invalid " + T + " `" + p + "` of type `" + O + "` " + ("supplied to `" + m + "`, expected `object`."));
        var w = e({}, g[E], o);
        for (var P in w) {
          var Y = o[P];
          if (n(o, P) && typeof Y != "function")
            return G(m, T, p, P, H(Y));
          if (!Y)
            return new _(
              "Invalid " + T + " `" + p + "` key `" + P + "` supplied to `" + m + "`.\nBad object: " + JSON.stringify(g[E], null, "  ") + `
Valid keys: ` + JSON.stringify(Object.keys(o), null, "  ")
            );
          var s = Y(S, P, m, T, p + "." + P, t);
          if (s)
            return s;
        }
        return null;
      }
      return j(c);
    }
    function z(o) {
      switch (typeof o) {
        case "number":
        case "string":
        case "undefined":
          return !0;
        case "boolean":
          return !o;
        case "object":
          if (Array.isArray(o))
            return o.every(z);
          if (o === null || l(o))
            return !0;
          var c = h(o);
          if (c) {
            var g = c.call(o), E;
            if (c !== o.entries) {
              for (; !(E = g.next()).done; )
                if (!z(E.value))
                  return !1;
            } else
              for (; !(E = g.next()).done; ) {
                var m = E.value;
                if (m && !z(m[1]))
                  return !1;
              }
          } else
            return !1;
          return !0;
        default:
          return !1;
      }
    }
    function F(o, c) {
      return o === "symbol" ? !0 : c ? c["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && c instanceof Symbol : !1;
    }
    function W(o) {
      var c = typeof o;
      return Array.isArray(o) ? "array" : o instanceof RegExp ? "object" : F(c, o) ? "symbol" : c;
    }
    function H(o) {
      if (typeof o > "u" || o === null)
        return "" + o;
      var c = W(o);
      if (c === "object") {
        if (o instanceof Date)
          return "date";
        if (o instanceof RegExp)
          return "regexp";
      }
      return c;
    }
    function Q(o) {
      var c = H(o);
      switch (c) {
        case "array":
        case "object":
          return "an " + c;
        case "boolean":
        case "date":
        case "regexp":
          return "a " + c;
        default:
          return c;
      }
    }
    function ae(o) {
      return !o.constructor || !o.constructor.name ? b : o.constructor.name;
    }
    return R.checkPropTypes = u, R.resetWarningCache = u.resetWarningCache, R.PropTypes = R, R;
  }, Ee;
}
if (process.env.NODE_ENV !== "production") {
  var hr = Ve(), Er = !0;
  ge.exports = br()(hr.isElement, Er);
} else
  ge.exports = dr()();
var gr = ge.exports;
const N = /* @__PURE__ */ Qe(gr);
function qe(r, e) {
  var t = Object.keys(r);
  if (Object.getOwnPropertySymbols) {
    var n = Object.getOwnPropertySymbols(r);
    e && (n = n.filter(function(u) {
      return Object.getOwnPropertyDescriptor(r, u).enumerable;
    })), t.push.apply(t, n);
  }
  return t;
}
function De(r) {
  for (var e = 1; e < arguments.length; e++) {
    var t = arguments[e] != null ? arguments[e] : {};
    e % 2 ? qe(Object(t), !0).forEach(function(n) {
      Ge(r, n, t[n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : qe(Object(t)).forEach(function(n) {
      Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(t, n));
    });
  }
  return r;
}
function fe(r) {
  "@babel/helpers - typeof";
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? fe = function(e) {
    return typeof e;
  } : fe = function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, fe(r);
}
function Ge(r, e, t) {
  return e in r ? Object.defineProperty(r, e, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : r[e] = t, r;
}
function Sr(r, e) {
  return Tr(r) || Or(r, e) || Pr(r, e) || _r();
}
function Tr(r) {
  if (Array.isArray(r))
    return r;
}
function Or(r, e) {
  var t = r && (typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"]);
  if (t != null) {
    var n = [], u = !0, a = !1, v, l;
    try {
      for (t = t.call(r); !(u = (v = t.next()).done) && (n.push(v.value), !(e && n.length === e)); u = !0)
        ;
    } catch (f) {
      a = !0, l = f;
    } finally {
      try {
        !u && t.return != null && t.return();
      } finally {
        if (a)
          throw l;
      }
    }
    return n;
  }
}
function Pr(r, e) {
  if (r) {
    if (typeof r == "string")
      return We(r, e);
    var t = Object.prototype.toString.call(r).slice(8, -1);
    if (t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set")
      return Array.from(r);
    if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
      return We(r, e);
  }
}
function We(r, e) {
  (e == null || e > r.length) && (e = r.length);
  for (var t = 0, n = new Array(e); t < e; t++)
    n[t] = r[t];
  return n;
}
function _r() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var Se = function(e) {
  var t = k.useRef(e);
  return k.useEffect(function() {
    t.current = e;
  }, [e]), t.current;
}, ee = function(e) {
  return e !== null && fe(e) === "object";
}, Cr = function(e) {
  return ee(e) && typeof e.then == "function";
}, xr = function(e) {
  return ee(e) && typeof e.elements == "function" && typeof e.createToken == "function" && typeof e.createPaymentMethod == "function" && typeof e.confirmCardPayment == "function";
}, Ye = "[object Object]", wr = function r(e, t) {
  if (!ee(e) || !ee(t))
    return e === t;
  var n = Array.isArray(e), u = Array.isArray(t);
  if (n !== u)
    return !1;
  var a = Object.prototype.toString.call(e) === Ye, v = Object.prototype.toString.call(t) === Ye;
  if (a !== v)
    return !1;
  if (!a && !n)
    return e === t;
  var l = Object.keys(e), f = Object.keys(t);
  if (l.length !== f.length)
    return !1;
  for (var d = {}, y = 0; y < l.length; y += 1)
    d[l[y]] = !0;
  for (var h = 0; h < f.length; h += 1)
    d[f[h]] = !0;
  var b = Object.keys(d);
  if (b.length !== l.length)
    return !1;
  var R = e, A = t, _ = function(L) {
    return r(R[L], A[L]);
  };
  return b.every(_);
}, Xe = function(e, t, n) {
  return ee(e) ? Object.keys(e).reduce(function(u, a) {
    var v = !ee(t) || !wr(e[a], t[a]);
    return n.includes(a) ? (v && console.warn("Unsupported prop change: options.".concat(a, " is not a mutable property.")), u) : v ? De(De({}, u || {}), {}, Ge({}, a, e[a])) : u;
  }, null) : null;
}, Rr = "Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.", Ne = function(e) {
  if (e === null || xr(e))
    return e;
  throw new Error(Rr);
}, jr = function(e) {
  if (Cr(e))
    return {
      tag: "async",
      stripePromise: Promise.resolve(e).then(Ne)
    };
  var t = Ne(e);
  return t === null ? {
    tag: "empty"
  } : {
    tag: "sync",
    stripe: t
  };
}, Pe = /* @__PURE__ */ k.createContext(null);
Pe.displayName = "ElementsContext";
var Ar = function(e, t) {
  if (!e)
    throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t, " in an <Elements> provider."));
  return e;
}, Ze = function(e) {
  var t = e.stripe, n = e.options, u = e.children, a = k.useMemo(function() {
    return jr(t);
  }, [t]), v = k.useState(function() {
    return {
      stripe: a.tag === "sync" ? a.stripe : null,
      elements: a.tag === "sync" ? a.stripe.elements(n) : null
    };
  }), l = Sr(v, 2), f = l[0], d = l[1];
  k.useEffect(function() {
    var b = !0, R = function(_) {
      d(function(j) {
        return j.stripe ? j : {
          stripe: _,
          elements: _.elements(n)
        };
      });
    };
    return a.tag === "async" && !f.stripe ? a.stripePromise.then(function(A) {
      A && b && R(A);
    }) : a.tag === "sync" && !f.stripe && R(a.stripe), function() {
      b = !1;
    };
  }, [a, f, n]);
  var y = Se(t);
  k.useEffect(function() {
    y !== null && y !== t && console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.");
  }, [y, t]);
  var h = Se(n);
  return k.useEffect(function() {
    if (f.elements) {
      var b = Xe(n, h, ["clientSecret", "fonts"]);
      b && f.elements.update(b);
    }
  }, [n, h, f.elements]), k.useEffect(function() {
    var b = f.stripe;
    !b || !b._registerWrapper || !b.registerAppInfo || (b._registerWrapper({
      name: "react-stripe-js",
      version: "1.10.0"
    }), b.registerAppInfo({
      name: "react-stripe-js",
      version: "1.10.0",
      url: "https://stripe.com/docs/stripe-js/react"
    }));
  }, [f.stripe]), /* @__PURE__ */ k.createElement(Pe.Provider, {
    value: f
  }, u);
};
Ze.propTypes = {
  stripe: N.any,
  options: N.object
};
var de = function(e) {
  var t = k.useContext(Pe);
  return Ar(t, e);
}, Ir = function() {
  var e = de("calls useElements()"), t = e.elements;
  return t;
}, $r = function() {
  var e = de("calls useStripe()"), t = e.stripe;
  return t;
};
N.func.isRequired;
var K = function(e) {
  var t = k.useRef(e);
  return k.useEffect(function() {
    t.current = e;
  }, [e]), function() {
    t.current && t.current.apply(t, arguments);
  };
}, V = function() {
}, kr = function(e) {
  return e.charAt(0).toUpperCase() + e.slice(1);
}, M = function(e, t) {
  var n = "".concat(kr(e), "Element"), u = function(f) {
    var d = f.id, y = f.className, h = f.options, b = h === void 0 ? {} : h, R = f.onBlur, A = R === void 0 ? V : R, _ = f.onFocus, j = _ === void 0 ? V : _, L = f.onReady, J = L === void 0 ? V : L, I = f.onChange, $ = I === void 0 ? V : I, i = f.onEscape, B = i === void 0 ? V : i, X = f.onClick, re = X === void 0 ? V : X, Z = f.onLoadError, te = Z === void 0 ? V : Z, G = f.onLoaderStart, ne = G === void 0 ? V : G, oe = de("mounts <".concat(n, ">")), z = oe.elements, F = k.useRef(null), W = k.useRef(null), H = K(J), Q = K(A), ae = K(j), o = K(re), c = K($), g = K(B), E = K(te), m = K(ne);
    k.useLayoutEffect(function() {
      if (F.current == null && z && W.current != null) {
        var p = z.create(e, b);
        F.current = p, p.mount(W.current), p.on("ready", function() {
          return H(p);
        }), p.on("change", c), p.on("blur", Q), p.on("focus", ae), p.on("escape", g), p.on("loaderror", E), p.on("loaderstart", m), p.on("click", o);
      }
    });
    var T = Se(b);
    return k.useEffect(function() {
      if (F.current) {
        var p = Xe(b, T, ["paymentRequest"]);
        p && F.current.update(p);
      }
    }, [b, T]), k.useLayoutEffect(function() {
      return function() {
        F.current && (F.current.destroy(), F.current = null);
      };
    }, []), /* @__PURE__ */ k.createElement("div", {
      id: d,
      className: y,
      ref: W
    });
  }, a = function(f) {
    de("mounts <".concat(n, ">"));
    var d = f.id, y = f.className;
    return /* @__PURE__ */ k.createElement("div", {
      id: d,
      className: y
    });
  }, v = t ? a : u;
  return v.propTypes = {
    id: N.string,
    className: N.string,
    onChange: N.func,
    onBlur: N.func,
    onFocus: N.func,
    onReady: N.func,
    onClick: N.func,
    onLoadError: N.func,
    onLoaderStart: N.func,
    options: N.object
  }, v.displayName = n, v.__elementType = e, v;
}, q = typeof window > "u";
M("auBankAccount", q);
M("card", q);
M("cardNumber", q);
M("cardExpiry", q);
M("cardCvc", q);
M("fpxBank", q);
M("iban", q);
M("idealBank", q);
M("p24Bank", q);
M("epsBank", q);
var Lr = M("payment", q);
M("paymentRequestButton", q);
M("linkAuthentication", q);
M("shippingAddress", q);
M("affirmMessage", q);
M("afterpayClearpayMessage", q);
const Mr = (r) => {
  const { t: e, i18n: t } = Fe(), { paymentOption: n, elements: u, state: a, onPaymentElementChange: v } = r, [l, f] = le(!1), [d, y] = le(n !== "HOLD"), h = l || !d || ["processing", "error"].includes(a.status);
  return Ue(() => {
    u == null || u.update({ locale: t.language });
  }, [u, t.language]), /* @__PURE__ */ D.jsxs("form", { id: "payment-form", className: "bg-subtle mt-4 rounded-md p-6", onSubmit: r.onSubmit, children: [
    /* @__PURE__ */ D.jsx("div", { children: /* @__PURE__ */ D.jsx(Lr, { onChange: () => v() }) }),
    n === "HOLD" && /* @__PURE__ */ D.jsx("div", { className: "bg-info mb-5 mt-2 rounded-md p-3", children: /* @__PURE__ */ D.jsx(
      er,
      {
        description: e("acknowledge_booking_no_show_fee", {
          amount: r.payment.amount / 100,
          formatParams: { amount: { currency: r.payment.currency } }
        }),
        onChange: (b) => y(b.target.checked),
        descriptionClassName: "text-info font-semibold"
      }
    ) }),
    /* @__PURE__ */ D.jsxs("div", { className: "mt-2 flex justify-end space-x-2", children: [
      /* @__PURE__ */ D.jsx(
        Ce,
        {
          color: "minimal",
          disabled: h,
          id: "cancel",
          type: "button",
          loading: l,
          onClick: () => {
            f(!0), r.onCancel();
          },
          children: /* @__PURE__ */ D.jsx("span", { id: "button-text", children: e("cancel") })
        }
      ),
      /* @__PURE__ */ D.jsx(
        Ce,
        {
          type: "submit",
          disabled: h,
          loading: a.status === "processing",
          id: "submit",
          color: "secondary",
          children: /* @__PURE__ */ D.jsx("span", { id: "button-text", children: a.status === "processing" ? /* @__PURE__ */ D.jsx("div", { className: "spinner", id: "spinner" }) : e(n === "HOLD" ? "submit_card" : "pay_now") })
        }
      )
    ] }),
    a.status === "error" && /* @__PURE__ */ D.jsx("div", { className: "mt-4 text-center text-red-900 dark:text-gray-300", role: "alert", children: a.error.message })
  ] });
}, qr = (r) => {
  const { t: e } = Fe(), t = Ir(), n = r.payment.paymentOption, u = r.booking.attendees[0].email, a = $r(), [v, l] = le({ status: "idle" });
  return /* @__PURE__ */ D.jsx(
    Mr,
    {
      ...r,
      elements: t,
      paymentOption: n,
      state: v,
      onSubmit: async (f) => {
        var y;
        if (f.preventDefault(), !a || !t)
          return;
        l({ status: "processing" });
        let d;
        r.booking.uid, n === "HOLD" && "setupIntent" in r.payment.data ? (d = await a.confirmSetup({
          elements: t,
          redirect: "if_required"
        }), d.setupIntent && (d.setupIntent.id, d.setupIntent.client_secret, d.setupIntent.status)) : n === "ON_BOOKING" && (d = await a.confirmPayment({
          elements: t,
          redirect: "if_required"
        }), d.paymentIntent && (d.paymentIntent.id, d.paymentIntent.client_secret, d.paymentIntent.status)), d != null && d.error ? l({
          status: "error",
          error: new Error(`Payment failed: ${d.error.message}`)
        }) : (l({ status: "idle" }), (y = r.onPaymentSuccess) == null || y.call(r, r), r.location && (r.location.includes("integration") ? e("web_conferencing_details_to_follow") : r.location));
      },
      onCancel: () => {
        var f;
        (f = r.onPaymentCancellation) == null || f.call(r, r);
      },
      onPaymentElementChange: () => {
        l({ status: "idle" });
      }
    }
  );
}, Yr = (r) => {
  const e = lr(r.payment.data.stripe_publishable_key), [t, n] = le("stripe");
  return Ue(() => {
    document.documentElement.classList.contains("dark") && n("night");
  }, []), /* @__PURE__ */ D.jsx(
    Ze,
    {
      stripe: e,
      options: {
        clientSecret: r.clientSecret,
        appearance: {
          theme: t
        }
      },
      children: /* @__PURE__ */ D.jsx(qr, { ...r })
    }
  );
};
export {
  Yr as default
};
