import { jsx as n, Fragment as D, jsxs as c } from "react/jsx-runtime";
import { useState as P, useEffect as T } from "react";
import { o as R, X as t, t as f, d as w, S as y } from "./index-C62tPk5p.js";
const i = [
  { label: "SATS", value: "BTC", unit: "SATS" },
  { label: "USD- US Dollar", value: "USD", unit: "USD" },
  { label: "EUR- Euro", value: "EUR", unit: "EUR" },
  { label: "JPY- Japanese Yen", value: "JPY", unit: "JPY" },
  { label: "CNY- Yuan Renminbi", value: "CNY", unit: "CNY" },
  { label: "GBP- Pounds Sterling", value: "GBP", unit: "GBP" },
  { label: "AED- UAE Dirham", value: "AED", unit: "AED" },
  { label: "ZAR- South African Rand", value: "ZAR", unit: "ZAR" },
  { label: "HKD- Hong Kong Dollar", value: "HKD", unit: "HKD" },
  { label: "BRL- Brazilian Real", value: "BRL", unit: "BRL" },
  { label: "AUD- Australian Dollar", value: "AUD", unit: "AUD" },
  { label: "CAD- Canadian Dollar", value: "CAD", unit: "CAD" },
  { label: "CZK- Czech Koruna", value: "CZK", unit: "CZK" },
  { label: "DKK- Danish Krone", value: "DKK", unit: "DKK" },
  { label: "NZD- New Zealand Dollar", value: "NZD", unit: "NZD" },
  { label: "MYR- Malaysian Ringgit", value: "MYR", unit: "MYR" },
  { label: "PHP- Philippine Peso", value: "PHP", unit: "PHP" },
  { label: "CHF- Swiss Franc", value: "CHF", unit: "CHF" },
  { label: "NOK- Norwegian Krone", value: "NOK", unit: "NOK" },
  { label: "THB- Thai Baht", value: "THB", unit: "THB" },
  { label: "SEK- Swedish Krona", value: "SEK", unit: "SEK" },
  { label: "SGD- Singapore Dollar", value: "SGD", unit: "SGD" },
  { label: "PLN- Polish Zloty", value: "PLN", unit: "PLN" },
  { label: "TWD- New Taiwan Dollar", value: "TWD", unit: "TWD" },
  { label: "MXN- Mexican Peso", value: "MXN", unit: "MXN" },
  { label: "ILS- New Isreali Shekel", value: "ILS", unit: "ILS" },
  { label: "NGN- Nigerian Naira", value: "NGN", unit: "NGN" }
], C = ["SATS", "BTC", "JPY"], E = (r, l) => C.includes(l.toUpperCase()) ? r : Math.round(r * 100), x = (r, l) => C.includes(l.toUpperCase()) ? r : r / 100, Y = ({
  eventType: r,
  getAppData: l,
  setAppData: u
}) => {
  var h, S;
  const { t: a } = R(), s = l("price"), o = l("currency") || (i.length > 0 ? i[0].value : ""), [v, K] = P(
    i.find((e) => e.value === o) || (i.length > 0 ? {
      label: i[0].label,
      value: i[0].value
    } : null)
  ), d = l("paymentOption"), b = ((h = t) == null ? void 0 : h.find((e) => d === e.value)) || {
    label: t.length > 0 ? t[0].label : "",
    value: t.length > 0 ? t[0].value : ""
  }, N = !!r.seatsPerTimeSlot, [m, U] = P(l("enabled")), p = ((S = r.recurringEvent) == null ? void 0 : S.count) !== void 0;
  T(() => {
    m && !l("currency") && u("currency", i[0].value);
  }, [m, l, u]);
  const g = (e) => Math.floor(e);
  return /* @__PURE__ */ n(D, { children: p ? /* @__PURE__ */ n(f, { className: "mt-2", severity: "warning", title: a("warning_recurring_event_payment") }) : m && /* @__PURE__ */ c(D, { children: [
    /* @__PURE__ */ c("div", { className: "mt-4 inline-block", children: [
      /* @__PURE__ */ n("label", { className: "text-default block text-sm font-medium mb-1", htmlFor: "price", children: a("price") }),
      /* @__PURE__ */ n(
        w,
        {
          label: a("price"),
          className: "text-black dark:text-white w-auto",
          addOnClassname: "h-[38px]",
          min: "1",
          type: "number",
          required: !0,
          placeholder: "Price",
          onChange: (e) => {
            u("price", E(Number(e.target.value), o));
          },
          value: s && s > 0 ? g(x(s, o)) : void 0
        }
      )
    ] }),
    /* @__PURE__ */ c("div", { className: "mt-5 w-60", children: [
      /* @__PURE__ */ n("label", { className: "text-default block text-sm font-medium", htmlFor: "currency", children: a("currency") }),
      /* @__PURE__ */ n(
        y,
        {
          variant: "default",
          options: i,
          value: v,
          defaultValue: v,
          onChange: (e) => {
            e && (K(e), u("currency", e.value));
          }
        }
      )
    ] }),
    /* @__PURE__ */ c("div", { className: "mt-2 w-60", children: [
      /* @__PURE__ */ n("label", { className: "text-default block text-sm font-medium", htmlFor: "paymentOption", children: a("payment_option") }),
      /* @__PURE__ */ n(
        y,
        {
          defaultValue: b ? { ...b, label: a(b.label) } : t.length > 0 ? { ...t[0], label: a(t[0].label) } : void 0,
          options: t.map((e) => ({ ...e, label: a(e.label) || e.label })),
          onChange: (e) => {
            e && u("paymentOption", e.value);
          },
          className: "mb-1 h-[38px] w-full",
          isDisabled: N
        }
      )
    ] }),
    N && d === "HOLD" && /* @__PURE__ */ n(f, { className: "mt-2", severity: "warning", title: a("seats_and_no_show_fee_error") })
  ] }) });
};
export {
  Y as default
};
