"use client";
import { jsx as r, jsxs as d } from "react/jsx-runtime";
import K from "../../../components/base/add-new-section.js";
import { EditorRenderBlock as M } from "../../../components/base/editor-render-block.js";
import { Popover as l } from "../../../components/shared/popover.js";
import { RenderIcon as Q } from "../../../components/shared/render-icon.js";
import { useBreakpoint as V } from "../../../hooks/use-breakpoint.js";
const t = ({
  id: L,
  settings: o,
  children: P,
  meta: a,
  isEditable: m
}) => {
  var n, p, e, b, u, w, N, h, x, O, k, v, B, C, S, j, I, R, T, y, z, A, D;
  const c = V(), U = (a == null ? void 0 : a.locale) || "en", i = (e = (p = (n = o == null ? void 0 : o.button) == null ? void 0 : n.text) == null ? void 0 : p.content) == null ? void 0 : e[U], f = (w = (u = (b = o == null ? void 0 : o.button) == null ? void 0 : b.image) == null ? void 0 : u.media) == null ? void 0 : w.url, q = ((h = (N = o == null ? void 0 : o.content) == null ? void 0 : N.side) == null ? void 0 : h[c]) ?? "bottom", F = ((O = (x = o == null ? void 0 : o.content) == null ? void 0 : x.sideOffset) == null ? void 0 : O[c]) ?? 0, G = ((v = (k = o == null ? void 0 : o.content) == null ? void 0 : k.align) == null ? void 0 : v[c]) ?? "start", H = ((C = (B = o == null ? void 0 : o.content) == null ? void 0 : B.alignOffset) == null ? void 0 : C[c]) ?? 0;
  return /* @__PURE__ */ r("div", { className: "dropdown", children: /* @__PURE__ */ d(l, { children: [
    /* @__PURE__ */ d(l.Trigger, { className: "reset dropdown-button flex items-center gap-1", children: [
      f && /* @__PURE__ */ r(
        "img",
        {
          className: "dropdown-button-image h-6 w-6",
          src: f,
          alt: ((I = (j = (S = o == null ? void 0 : o.button) == null ? void 0 : S.image) == null ? void 0 : j.media) == null ? void 0 : I.name) ?? "dropdown-image"
        }
      ),
      /* @__PURE__ */ r("span", { className: "dropdown-button-text", children: i }),
      /* @__PURE__ */ r(
        Q,
        {
          className: "dropdown-button-icon",
          iconName: (T = (R = o == null ? void 0 : o.button) == null ? void 0 : R.icon) == null ? void 0 : T.iconName,
          iconSet: (z = (y = o == null ? void 0 : o.button) == null ? void 0 : y.icon) == null ? void 0 : z.iconSet
        }
      )
    ] }),
    /* @__PURE__ */ d(
      l.Content,
      {
        className: "dropdown-content z-[1000]",
        side: q,
        sideOffset: Number(F),
        align: G,
        alignOffset: Number(H),
        avoidCollisions: ((D = (A = o == null ? void 0 : o.content) == null ? void 0 : A.avoidCollisions) == null ? void 0 : D[c]) ?? !1,
        children: [
          P.map((J, E) => /* @__PURE__ */ r(
            M,
            {
              block: J,
              index: E,
              meta: a,
              isEditable: m ?? !1
            },
            E
          )),
          m && /* @__PURE__ */ r(K, { blockId: L, showBlockLibrary: !1 })
        ]
      }
    )
  ] }) });
};
export {
  t as default
};
//# sourceMappingURL=dropdown.block.js.map
