"use client";
import { jsxs as o, jsx as a } from "react/jsx-runtime";
import { Select as t } from "./select.js";
import { Tooltip as n } from "./tooltip.js";
import { setCurrentLanguage as p } from "../../store/builder-slice.js";
import { getCurrentLocale as d } from "../../../../../store/selectors.js";
import { useAppDispatch as g } from "../../hooks/use-app-dispatch.js";
import { useAppSelector as u } from "../../hooks/use-app-selector.js";
import { classNames as h } from "../../utils/index.js";
import { FiGlobe as f, FiCheck as C } from "../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.0.0/node_modules/react-icons/fi/index.js";
const s = [
  {
    name: "English",
    code: "en",
    tag: "en-US"
  },
  {
    name: "Español",
    code: "es",
    tag: "es-ES"
  },
  {
    name: "Português",
    code: "pt",
    tag: "pt-BR"
  },
  {
    name: "Deutsch",
    code: "de",
    tag: "de-DE"
  },
  {
    name: "Français",
    code: "fr",
    tag: "fr-FR"
  },
  {
    name: "Nederlands",
    code: "nl",
    tag: "nl-NL"
  },
  {
    name: "Turkish",
    code: "tr",
    tag: "tr-TR"
  },
  {
    name: "العربية",
    code: "ar",
    tag: "ar-SA"
  },
  {
    name: "বাংলা",
    code: "bn",
    tag: "bn-BD"
  },
  {
    name: "हिन्दी",
    code: "hi",
    tag: "hi-IN"
  }
], U = ({ className: l }) => {
  const r = u(d), m = g(), i = s.reduce(
    (e, c) => (e[c.code] = c.name, e),
    {}
  )[r];
  return /* @__PURE__ */ o(
    t,
    {
      onValueChange: (e) => {
        m(p(e));
      },
      value: r,
      defaultValue: "en",
      children: [
        /* @__PURE__ */ a(
          t.Trigger,
          {
            className: h(
              "h-3 w-[40px] border-0 p-1 focus:ring-0 focus:ring-offset-0",
              l
            ),
            chevronDown: !1,
            children: /* @__PURE__ */ o(n, { children: [
              /* @__PURE__ */ a(n.Trigger, { asChild: !0, children: /* @__PURE__ */ o("span", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ a(f, {}),
                r.toLocaleUpperCase()
              ] }) }),
              /* @__PURE__ */ o(n.Content, { side: "right", children: [
                i,
                " (",
                r.toLocaleUpperCase(),
                ")"
              ] })
            ] })
          }
        ),
        /* @__PURE__ */ a(t.Content, { sideOffset: -23, className: "min-w-[30px] border-0", align: "end", children: /* @__PURE__ */ a(t.Group, { children: s.map((e) => /* @__PURE__ */ a(
          t.Item,
          {
            className: "flex py-2 pe-3 ps-3",
            value: e.code,
            showCheck: !1,
            children: /* @__PURE__ */ o("span", { className: "flex items-center gap-2", children: [
              e.name,
              " (",
              e.code.toLocaleUpperCase(),
              ")",
              r === e.code && /* @__PURE__ */ a(C, {})
            ] })
          },
          e.code
        )) }) })
      ]
    }
  );
};
export {
  U as LanguageSelector
};
//# sourceMappingURL=language-selector.js.map
