import { jsx as o, jsxs as s } from "react/jsx-runtime";
import { a as c } from "../useQuery-n4ls1rLk.js";
import l from "../components/Layouts.js";
import n from "../composables/FormInputs.js";
import { formClient as a } from "../config/index.js";
import "react";
import "../hooks/useHasNextSiblingByAttribute.js";
import "../utils/functions.js";
import "../clsx-7d8NmkQq.js";
import "../index-20bzTFSx.js";
import "../utils/components/RenderEach.js";
import "../utils/components/RenderIf.js";
import "../components/Icons.js";
import "../components/Inputs/variants.js";
import "../index-xVF7D3FM.js";
import "../motion-dVICNqWI.js";
import "../SVGVisualElement-aqO4D4Z5.js";
import "../LayoutGroupContext-3euHzeKi.js";
import "../index.esm-BQxOvVZs.js";
import "../context/generalContext/index.js";
import "../context/index.js";
import "../axios-f2q_J-wz.js";
const u = async () => {
  const r = await a.post("external/departments").then((t) => t.data).catch((t) => {
    console.error(t);
  });
  return (r == null ? void 0 : r.Departamentos) ?? [];
}, d = async (r) => {
  const t = await a.post("external/municipalities", { departmentId: r }).then((e) => e.data).catch((e) => {
    console.error(e);
  });
  return (t == null ? void 0 : t.Municipios) ?? [];
}, A = ({ className: r, prefix: t = "", style: e }) => {
  const { data: p = [], error: i, isPending: m } = c({ queryKey: ["departments"], queryFn: u });
  return i ? /* @__PURE__ */ o("span", { className: "_text-red-500", children: i.message }) : m ? /* @__PURE__ */ o("div", { className: "_h-[42px] _w-full loader _mt-2" }) : /* @__PURE__ */ s(l.InputsWrapper, { className: r, style: e, children: [
    /* @__PURE__ */ o(n.SelectFormCntx, { currentId: t + "department", optionsEntries: ["Key", "Value"], selectOptions: p, label: "Departamento*" }),
    /* @__PURE__ */ o(
      n.SelectByAnotherField,
      {
        targetValue: t + "department",
        optionsEntries: ["Key", "Value"],
        currentId: t + "municipality",
        fetchOptions: d,
        label: "Municipio*"
      }
    )
  ] });
};
export {
  A as SelectMunicipality
};
