import { jsx as r } from "react/jsx-runtime";
import { forwardRef as d } from "react";
import { u as a, a as p } from "../../index.esm-BQxOvVZs.js";
import m from "../Icons.js";
import { useModalContext as l } from "../../context/generalContext/index.js";
import { cn as i } from "../../utils/functions.js";
import { ButtonVariants as f } from "./variants.js";
const c = d(({ className: o, type: t = "button", variant: n, ...e }, s) => /* @__PURE__ */ r("button", { type: t, className: i(f({ variant: n }), o), ref: s, ...e })), _ = ({ className: o, ...t }) => {
  const {
    formState: { isValid: n, isDirty: e }
  } = a();
  return /* @__PURE__ */ r(c, { type: "submit", disabled: !n && e, className: o, ...t });
}, y = ({ className: o, targetId: t, index: n, ...e }) => {
  const { setModal: s } = l();
  return /* @__PURE__ */ r(c, { type: "button", onClick: () => {
    s({
      type: "activities",
      content: {
        activityCode: "",
        ciiu: "",
        index: n
      },
      id: t,
      componentKey: "ActivityModal"
    });
  }, className: i("_flex _justify-center _items-center !_p-2.5 _mt-6", o), ...e, children: /* @__PURE__ */ r(m.SearchIcon, { className: "_h-6 _w-6" }) });
}, C = ({ className: o, targetId: t, ...n }) => {
  const { setModal: e } = l(), s = p({ name: t });
  return /* @__PURE__ */ r(c, { type: "button", onClick: () => {
    e({
      type: "map",
      content: {
        direction: s
      },
      id: t,
      componentKey: "DirectionModal",
      className: "!_max-w-none !_w-fit !_pt-0"
    });
  }, className: i("_flex _justify-center _items-center !_p-2.5 _mt-6", o), ...n, children: /* @__PURE__ */ r(m.LocationIcon, { className: "_h-5 _w-5" }) });
}, M = ({ className: o, cancelCallback: t, ...n }) => /* @__PURE__ */ r(c, { variant: "error", type: "button", onClick: () => {
  t ? t() : window.close();
}, className: o, ...n }), h = ({ className: o, ...t }) => {
  const { trigger: n } = a();
  return /* @__PURE__ */ r(c, { variant: "bordered", type: "button", onClick: () => {
    n();
  }, className: o, ...t });
}, S = {
  Button: c,
  FormButton: _,
  Activities: y,
  Maps: C,
  CancelButton: M,
  CheckFormButton: h
};
export {
  S as default
};
