import { jsx as i } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import g from "../../../../../../../hooks/useUniqueId.js";
import { useCallback as m, useMemo as l } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { validationErrors as _ } from "../../../../../../internal/FormFields/FileInput/constants.js";
import E from "../../../../../../internal/FormFields/FileInput/helpers/defaultMapError.js";
import p from "../../../../../../internal/Typography/Typography.js";
import { TypographyVariant as d, TypographyElement as f } from "../../../../../../internal/Typography/types.js";
import { FileInput as O } from "../../../../../../internal/FormFields/FileInput/FileInput.js";
import { LogoLabel as D, THEME_FORM_ALLOWED_FILE_TYPES as I, THEME_FORM_UPLOAD_DOCUMENT_MAX_SIZE as y, logoOptions as u } from "../ThemeForm/constants.js";
import M from "../LogoRequirements/LogoRequirements.js";
import F from "../../../../../../../core/Context/preact/useCoreContext.js";
import { Fragment as N } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
const b = (o) => {
  switch (o) {
    case u.LOGO:
      return { width: 200, height: 200 };
    case u.FULL_WIDTH_LOGO:
    default:
      return { width: 300, height: 30 };
  }
}, R = ({
  disabled: o,
  logoType: e,
  onFileInputChange: a
}) => {
  const { i18n: t } = F(), n = g(), c = m(
    (r) => {
      a(e, r);
    },
    [e, a]
  ), h = l(() => b(e), [e]), s = l(
    () => e === "logo" ? "payByLink.settings.themes.inputs.file.errors.logo.invalidDimensions" : "payByLink.settings.themes.inputs.file.errors.fullWidthLogo.invalidDimensions",
    [e]
  ), L = m(
    (r) => {
      switch (r) {
        case _.INVALID_DIMENSIONS:
          return t.get(s);
        default:
          return t.get(E(r));
      }
    },
    [t, s]
  );
  return /* @__PURE__ */ i(N, { children: [
    /* @__PURE__ */ i("label", { htmlFor: n, "aria-labelledby": n, className: "adyen-pe-payment-link-theme-form__file-input", children: [
      /* @__PURE__ */ i(p, { el: f.SPAN, variant: d.BODY, stronger: !0, children: t.get(D[e]) }),
      /* @__PURE__ */ i(
        p,
        {
          el: f.SPAN,
          variant: d.BODY,
          className: "adyen-pe-payment-link-theme-form__field-label-optional",
          children: `(${t.get("payByLink.common.fields.optional.label")})`
        }
      )
    ] }),
    /* @__PURE__ */ i(
      O,
      {
        disabled: o,
        validDimensions: h,
        maxFileSize: y,
        allowedFileTypes: I,
        onChange: c,
        id: n,
        mapError: L
      }
    ),
    /* @__PURE__ */ i(M, { logoType: e })
  ] });
};
export {
  R as default
};
