import { jsx as s, jsxs as g, Fragment as S } from "react/jsx-runtime";
import * as r from "react";
import { useRef as j, useState as K, useEffect as J, forwardRef as V, useCallback as Fe, startTransition as $e } from "react";
import { h as Y, r as Xe, p as je, b as Q, g as q, U as Ke, J as Je, K as Ye, t as Z, X as Qe, n as qe } from "./use-editor.BDnIlF7c.js";
import "./index.Bxix3KXR.js";
import { a as Ze, o as et, b as tt, c as nt, s as ot, d as rt, u as at, F as st, e as it } from "./floating-ui.react.CZVVTXoO.js";
import { c as ct, B as lt } from "./use-section-style.D7ZN4IXn.js";
import { c as X, w as ut, ab as dt } from "./_commonjsHelpers.DgVrNa4W.js";
import { m as pt } from "./menubar-styles.DM8mXdFr.js";
import { u as W } from "./schema-resolver.iYlSHQsB.js";
import { _ as O } from "./twind.D7be0E5m.js";
import { P as mt } from "./dnd.esm.ByOls-Fs.js";
import "@sinclair/typebox";
import { H as ft, I as ee, a as ht } from "./theme.BGpzuiJ2.js";
import { h as xt, c as Ct, P as gt, b as k, a as Mt, y as v, j as U } from "./index.DTgp6yvu.js";
import { c as te, R as vt, A as wt, P as bt, C as Pt, G as Nt, L as It, b as St, S as yt, l as Et, g as Rt, h as Bt, a as kt, I as _t, d as Tt, e as Ot, f as At, n as T, i as ne, k as zt, j as Dt, p as Gt } from "./base-menu.props.ApxznpLd.js";
import { a as Lt, l as Ht, t as oe } from "./index.Ha48YvQU.js";
import { v as re } from "./radius.prop.D_pLV_J5.js";
import { c as _ } from "./index.BJ4j-pYz.js";
var F = "ContextMenu", [Vt, Fn] = Ct(F, [
  te
]), M = te(), [Wt, ae] = Vt(F), se = (e) => {
  const { __scopeContextMenu: t, children: n, onOpenChange: a, dir: o, modal: i = !0 } = e, [c, l] = r.useState(!1), m = M(t), f = xt(a), p = r.useCallback(
    (h) => {
      l(h), f(h);
    },
    [f]
  );
  return /* @__PURE__ */ s(
    Wt,
    {
      scope: t,
      open: c,
      onOpenChange: p,
      modal: i,
      children: /* @__PURE__ */ s(
        vt,
        {
          ...m,
          dir: o,
          open: c,
          onOpenChange: p,
          modal: i,
          children: n
        }
      )
    }
  );
};
se.displayName = F;
var ie = "ContextMenuTrigger", ce = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: n, disabled: a = !1, ...o } = e, i = ae(ie, n), c = M(n), l = r.useRef({ x: 0, y: 0 }), m = r.useRef({
      getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...l.current })
    }), f = r.useRef(0), p = r.useCallback(
      () => window.clearTimeout(f.current),
      []
    ), h = (u) => {
      l.current = { x: u.clientX, y: u.clientY }, i.onOpenChange(!0);
    };
    return r.useEffect(() => p, [p]), r.useEffect(() => void (a && p()), [a, p]), /* @__PURE__ */ g(S, { children: [
      /* @__PURE__ */ s(wt, { ...c, virtualRef: m }),
      /* @__PURE__ */ s(
        gt.span,
        {
          "data-state": i.open ? "open" : "closed",
          "data-disabled": a ? "" : void 0,
          ...o,
          ref: t,
          style: { WebkitTouchCallout: "none", ...e.style },
          onContextMenu: a ? e.onContextMenu : k(e.onContextMenu, (u) => {
            p(), h(u), u.preventDefault();
          }),
          onPointerDown: a ? e.onPointerDown : k(
            e.onPointerDown,
            A((u) => {
              p(), f.current = window.setTimeout(() => h(u), 700);
            })
          ),
          onPointerMove: a ? e.onPointerMove : k(e.onPointerMove, A(p)),
          onPointerCancel: a ? e.onPointerCancel : k(e.onPointerCancel, A(p)),
          onPointerUp: a ? e.onPointerUp : k(e.onPointerUp, A(p))
        }
      )
    ] });
  }
);
ce.displayName = ie;
var Ut = "ContextMenuPortal", le = (e) => {
  const { __scopeContextMenu: t, ...n } = e, a = M(t);
  return /* @__PURE__ */ s(bt, { ...a, ...n });
};
le.displayName = Ut;
var ue = "ContextMenuContent", de = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: n, ...a } = e, o = ae(ue, n), i = M(n), c = r.useRef(!1);
    return /* @__PURE__ */ s(
      Pt,
      {
        ...i,
        ...a,
        ref: t,
        side: "right",
        sideOffset: 2,
        align: "start",
        onCloseAutoFocus: (l) => {
          var m;
          (m = e.onCloseAutoFocus) == null || m.call(e, l), !l.defaultPrevented && c.current && l.preventDefault(), c.current = !1;
        },
        onInteractOutside: (l) => {
          var m;
          (m = e.onInteractOutside) == null || m.call(e, l), !l.defaultPrevented && !o.modal && (c.current = !0);
        },
        style: {
          ...e.style,
          "--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
          "--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
          "--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
          "--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
          "--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
        }
      }
    );
  }
);
de.displayName = ue;
var Ft = "ContextMenuGroup", pe = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: n, ...a } = e, o = M(n);
    return /* @__PURE__ */ s(Nt, { ...o, ...a, ref: t });
  }
);
pe.displayName = Ft;
var $t = "ContextMenuLabel", me = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: n, ...a } = e, o = M(n);
    return /* @__PURE__ */ s(It, { ...o, ...a, ref: t });
  }
);
me.displayName = $t;
var Xt = "ContextMenuItem", fe = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: n, ...a } = e, o = M(n);
    return /* @__PURE__ */ s(St, { ...o, ...a, ref: t });
  }
);
fe.displayName = Xt;
var jt = "ContextMenuCheckboxItem", he = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(kt, { ...o, ...a, ref: t });
});
he.displayName = jt;
var Kt = "ContextMenuRadioGroup", xe = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(Tt, { ...o, ...a, ref: t });
});
xe.displayName = Kt;
var Jt = "ContextMenuRadioItem", Ce = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(Ot, { ...o, ...a, ref: t });
});
Ce.displayName = Jt;
var Yt = "ContextMenuItemIndicator", ge = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(_t, { ...o, ...a, ref: t });
});
ge.displayName = Yt;
var Qt = "ContextMenuSeparator", Me = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(yt, { ...o, ...a, ref: t });
});
Me.displayName = Qt;
var qt = "ContextMenuArrow", Zt = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: n, ...a } = e, o = M(n);
    return /* @__PURE__ */ s(At, { ...o, ...a, ref: t });
  }
);
Zt.displayName = qt;
var en = "ContextMenuSub", ve = (e) => {
  const { __scopeContextMenu: t, children: n, onOpenChange: a, open: o, defaultOpen: i } = e, c = M(t), [l, m] = Mt({
    prop: o,
    defaultProp: i,
    onChange: a
  });
  return /* @__PURE__ */ s(Et, { ...c, open: l, onOpenChange: m, children: n });
};
ve.displayName = en;
var tn = "ContextMenuSubTrigger", we = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(Rt, { ...o, ...a, ref: t });
});
we.displayName = tn;
var nn = "ContextMenuSubContent", be = r.forwardRef((e, t) => {
  const { __scopeContextMenu: n, ...a } = e, o = M(n);
  return /* @__PURE__ */ s(
    Bt,
    {
      ...o,
      ...a,
      ref: t,
      style: {
        ...e.style,
        "--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
        "--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
        "--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
        "--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
        "--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
      }
    }
  );
});
be.displayName = nn;
function A(e) {
  return (t) => t.pointerType !== "mouse" ? e(t) : void 0;
}
var on = se, rn = ce, Pe = le, an = de, sn = pe, cn = me, ln = fe, un = he, dn = xe, pn = Ce, Ne = ge, mn = Me, fn = ve, hn = we, xn = be;
const Ie = (e) => r.createElement(on, { ...e });
Ie.displayName = "ContextMenu.Root";
const Se = r.forwardRef(({ children: e, ...t }, n) => r.createElement(rn, { ...t, ref: n, asChild: !0 }, Lt(e)));
Se.displayName = "ContextMenu.Trigger";
const ye = r.createContext({}), Ee = r.forwardRef((e, t) => {
  const n = ft(), { size: a = T.size.default, variant: o = T.variant.default, highContrast: i = T.highContrast.default } = e, { className: c, children: l, color: m, container: f, forceMount: p, ...h } = re(e, T), u = m || n.accentColor;
  return r.createElement(Pe, { container: f, forceMount: p }, r.createElement(ee, { asChild: !0 }, r.createElement(an, { "data-accent-color": u, alignOffset: -Number(a) * 4, collisionPadding: 10, ...h, asChild: !1, ref: t, className: v("rt-PopperContent", "rt-BaseMenuContent", "rt-ContextMenuContent", c) }, r.createElement(ne, { type: "auto" }, r.createElement("div", { className: v("rt-BaseMenuViewport", "rt-ContextMenuViewport") }, r.createElement(ye.Provider, { value: r.useMemo(() => ({ size: a, variant: o, color: u, highContrast: i }), [a, o, u, i]) }, l))))));
});
Ee.displayName = "ContextMenu.Content";
const Re = r.forwardRef(({ className: e, ...t }, n) => r.createElement(cn, { ...t, asChild: !1, ref: n, className: v("rt-BaseMenuLabel", "rt-ContextMenuLabel", e) }));
Re.displayName = "ContextMenu.Label";
const b = r.forwardRef((e, t) => {
  const { className: n, children: a, color: o = zt.color.default, shortcut: i, ...c } = e;
  return r.createElement(ln, { "data-accent-color": o, ...c, ref: t, className: v("rt-reset", "rt-BaseMenuItem", "rt-ContextMenuItem", n) }, r.createElement(U, null, a), i && r.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, i));
});
b.displayName = "ContextMenu.Item";
const Cn = r.forwardRef(({ className: e, ...t }, n) => r.createElement(sn, { ...t, asChild: !1, ref: n, className: v("rt-BaseMenuGroup", "rt-ContextMenuGroup", e) }));
Cn.displayName = "ContextMenu.Group";
const Be = r.forwardRef(({ className: e, ...t }, n) => r.createElement(dn, { ...t, asChild: !1, ref: n, className: v("rt-BaseMenuRadioGroup", "rt-ContextMenuRadioGroup", e) }));
Be.displayName = "ContextMenu.RadioGroup";
const ke = r.forwardRef((e, t) => {
  const { children: n, className: a, color: o = Gt.color.default, ...i } = e;
  return r.createElement(pn, { ...i, asChild: !1, ref: t, "data-accent-color": o, className: v("rt-BaseMenuItem", "rt-BaseMenuRadioItem", "rt-ContextMenuItem", "rt-ContextMenuRadioItem", a) }, r.createElement(U, null, n), r.createElement(Ne, { className: "rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator" }, r.createElement(oe, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })));
});
ke.displayName = "ContextMenu.RadioItem";
const z = r.forwardRef((e, t) => {
  const { children: n, className: a, shortcut: o, color: i = Dt.color.default, ...c } = e;
  return r.createElement(un, { ...c, asChild: !1, ref: t, "data-accent-color": i, className: v("rt-BaseMenuItem", "rt-BaseMenuCheckboxItem", "rt-ContextMenuItem", "rt-ContextMenuCheckboxItem", a) }, r.createElement(U, null, n), r.createElement(Ne, { className: "rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator" }, r.createElement(oe, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })), o && r.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, o));
});
z.displayName = "ContextMenu.CheckboxItem";
const D = (e) => r.createElement(fn, { ...e });
D.displayName = "ContextMenu.Sub";
const G = r.forwardRef((e, t) => {
  const { className: n, children: a, ...o } = e;
  return r.createElement(hn, { ...o, asChild: !1, ref: t, className: v("rt-BaseMenuItem", "rt-BaseMenuSubTrigger", "rt-ContextMenuItem", "rt-ContextMenuSubTrigger", n) }, a, r.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, r.createElement(Ht, { className: "rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon" })));
});
G.displayName = "ContextMenu.SubTrigger";
const L = r.forwardRef((e, t) => {
  const { size: n, variant: a, color: o, highContrast: i } = r.useContext(ye), { className: c, children: l, container: m, forceMount: f, ...p } = re({ size: n, variant: a, color: o, highContrast: i, ...e }, T);
  return r.createElement(Pe, { container: m, forceMount: f }, r.createElement(ee, { asChild: !0 }, r.createElement(xn, { "data-accent-color": o, alignOffset: -Number(n) * 4, sideOffset: 1, collisionPadding: 10, ...p, asChild: !1, ref: t, className: v("rt-PopperContent", "rt-BaseMenuContent", "rt-BaseMenuSubContent", "rt-ContextMenuContent", "rt-ContextMenuSubContent", c) }, r.createElement(ne, { type: "auto" }, r.createElement("div", { className: v("rt-BaseMenuViewport", "rt-ContextMenuViewport") }, l)))));
});
L.displayName = "ContextMenu.SubContent";
const H = r.forwardRef(({ className: e, ...t }, n) => r.createElement(mn, { ...t, asChild: !1, ref: n, className: v("rt-BaseMenuSeparator", "rt-ContextMenuSeparator", e) }));
H.displayName = "ContextMenu.Separator";
function I({
  direction: e,
  show: t,
  manifest: n
}) {
  return /* @__PURE__ */ s(
    "button",
    {
      type: "button",
      className: O(
        "resizable-handle absolute focus:outline-none",
        "overflow-visible z-[9998]",
        `resizable-handle-${e}`,
        {
          "-bottom-[2px] left-0 right-0 h-[6px] cursor-row-resize": e === "s",
          "-top-[2px] left-0 right-0 h-[6px] cursor-row-resize": e === "n",
          "top-0 -left-[2px] bottom-0 w-[6px] cursor-col-resize": e === "w",
          "top-0 -right-[2px] bottom-0 w-[6px] cursor-col-resize": e === "e",
          // sw and nw
          "-bottom-[2px] -left-[2px] w-[6px] h-[6px] cursor-nesw-resize": e === "sw",
          "-top-[2px] -left-[2px] w-[6px] h-[6px] cursor-nwse-resize": e === "nw",
          // se and ne
          "-bottom-[2px] -right-[2px] w-[6px] h-[6px] cursor-nwse-resize": e === "se",
          "-top-[2px] -right-[2px] w-[6px] h-[6px] cursor-nesw-resize": e === "ne"
        }
      ),
      children: /* @__PURE__ */ s(
        "div",
        {
          className: O(
            "opacity-0 z-[9999] group-hover/brick:opacity-100 transition-opacity absolute w-[10px] h-[10px] bg-white border-2 rounded-full shadow-md resizable-handle-dot",
            n.isContainer ? "border-orange-500" : "border-upstart-500",
            t && "opacity-100",
            {
              "top-1/2 -translate-y-1/2 -left-[5px]": e === "w",
              "top-1/2 -translate-y-1/2 -right-[5px]": e === "e",
              "left-1/2 -translate-x-1/2 -top-[5px]": e === "n",
              "left-1/2 -translate-x-1/2 -bottom-[5px]": e === "s",
              // sw and nw
              "-bottom-[5px] -left-[5px]": e === "sw",
              "-top-[5px] -left-[5px]": e === "nw",
              // se and ne
              "-bottom-[5px] -right-[5px]": e === "se",
              "-top-[5px] -right-[5px]": e === "ne"
            }
          )
        }
      )
    }
  );
}
function gn(e) {
  const { resizable: t } = e;
  return {
    canGrowVertical: t === !0 || t === "vertical",
    canGrowHorizontal: t === !0 || t === "horizontal",
    canShrinkVertical: t === !0 || t === "vertical",
    canShrinkHorizontal: t === !0 || t === "horizontal"
  };
}
function Mn(e = {}) {
  const { tolerance: t = 0, deepCheck: n = !1 } = e, a = j(null), [o, i] = K(!1);
  return J(() => {
    const c = a.current;
    if (!c) return;
    const l = (f) => {
      const p = c.getBoundingClientRect(), { clientX: h, clientY: u } = f;
      if (!(h >= p.left - t && h <= p.right + t && u >= p.top - t && u <= p.bottom + t)) {
        i(!1);
        return;
      }
      if (n) {
        const P = document.elementFromPoint(h, u), E = P === c || c.contains(P);
        i(E);
      } else
        i(!0);
    }, m = () => {
      i(!1);
    };
    return document.addEventListener("mousemove", l), c.addEventListener("mouseleave", m), () => {
      document.removeEventListener("mousemove", l), c.removeEventListener("mouseleave", m);
    };
  }, [t, n]), { ref: a, isHovered: o };
}
function vn(e, t, n) {
  if (!(n != null && n.isDropAnimating) || !n.dropAnimation)
    return t;
  const { draggingOver: a } = n, { moveTo: o } = n.dropAnimation;
  if (a === e) {
    const i = `translate(${o.x}px, 0px)`;
    return {
      ...t,
      transform: `${i}`
    };
  }
  return {
    ...t
  };
}
function wn(e) {
  return ["bottom", "top"];
}
const $n = V(
  ({ brick: e, children: t, isContainerChild: n, index: a }, o) => {
    const i = j(!1), c = Y(), l = Xe(), { panelPosition: m } = je(), f = Q(), { getParentBrick: p } = q(), h = Ke(e.id), u = W(e.type), d = p(e.id), [P, E] = K(!1), _e = wn(), Te = Je(), Oe = Ye(), {
      refs: R,
      floatingStyles: Ae,
      update: $,
      context: ze
    } = Ze({
      open: P,
      onOpenChange: E,
      whileElementsMounted: it,
      transform: !0,
      middleware: [
        et(u.isContainer ? { mainAxis: 8, crossAxis: 0 } : { mainAxis: 6, crossAxis: 0 }),
        tt({
          allowedPlacements: _e
        })
      ]
    }), De = nt(ze, {
      handleClose: ot(),
      delay: {
        open: 50,
        close: 200
      }
    }), { getReferenceProps: Ge, getFloatingProps: Le } = rt([De]);
    J(() => {
      if (R.reference.current) {
        const C = () => {
          i.current = !0;
        }, w = () => {
          i.current = !1;
        }, y = () => {
          $(), setTimeout(() => {
            i.current = !1;
          }, 200);
        }, x = R.reference.current;
        return x.addEventListener("mousedown", w), x.addEventListener("mouseup", y), x.addEventListener("mousemove", C), () => {
          x.removeEventListener("mousedown", w), x.removeEventListener("mouseup", y), x.removeEventListener("mousemove", C);
        };
      }
    }, [R.reference, $]);
    const He = Fe(
      (C) => {
        const w = C.target, y = C.currentTarget;
        if (i.current || !y.matches("[data-brick]") || C.defaultPrevented && !w.closest('[data-prevented-by-editor="true"]')) {
          console.log(
            "EditableBrickWrapper: Click ignored due to mouse movement or default prevented",
            w
          );
          return;
        }
        let x = e, B = "brick";
        C.shiftKey ? d && (x = d) : (C.ctrlKey || C.metaKey) && h && (B = "section", x = h), f.hidePanel(), (m === "left" && C.clientX < window.innerWidth * 0.25 || m === "right" && C.clientX > window.innerWidth * 0.75) && f.togglePanelPosition(), $e(() => {
          B === "section" ? f.setSelectedSectionId(x.id) : f.setSelectedBrickId(x.id), f.setPanel("inspector");
        }), i.current = !1, C.stopPropagation();
      },
      [m]
    ), { ref: Ve, isHovered: N } = Mn({ tolerance: 6, deepCheck: !0 }), We = ct({
      brick: e,
      editable: !0,
      selected: c === e.id,
      isContainerChild: n
    }), Ue = Oe || !u.movable || n || l === "mobile";
    return /* @__PURE__ */ s(mt, { draggableId: e.id, index: a, isDragDisabled: Ue, children: (C, w) => {
      var B;
      const y = at([C.innerRef, R.setReference, o, Ve]), x = gn(X[e.type]);
      return /* @__PURE__ */ s(In, { brick: e, isContainerChild: n, children: /* @__PURE__ */ g(
        "div",
        {
          ref: y,
          ...C.draggableProps,
          ...C.dragHandleProps,
          ...Ge(),
          id: e.id,
          "data-brick": !0,
          "data-brick-id": e.id,
          "data-brick-type": e.type,
          "data-last-touched": e.props.lastTouched ?? "0",
          "data-container-child": n,
          "data-draggable-for-brick-id": e.id,
          "data-brick-width": e.props.width,
          "data-brick-height": e.props.height,
          "data-brick-max-width": JSON.stringify(u.maxWidth),
          "data-brick-min-width": JSON.stringify(u.minWidth),
          style: vn(h == null ? void 0 : h.id, C.draggableProps.style, w),
          className: O(
            We,
            w.isDragging ? "opacity-90 !z-[9999] shadow-xl overflow-hidden !cursor-grabbing" : "hover:cursor-auto"
          ),
          onClick: He,
          children: [
            /* @__PURE__ */ s(lt, { brick: e, selectedBrickId: c, editable: !0 }),
            !u.isContainer && /* @__PURE__ */ s(bn, { brick: e }),
            /* @__PURE__ */ s(st, { children: /* @__PURE__ */ s(
              Pn,
              {
                ref: R.setFloating,
                brick: e,
                isContainerChild: n,
                style: Ae,
                show: P,
                ...Le()
              }
            ) }),
            ((B = X[e.type]) == null ? void 0 : B.resizable) && !n && !Te && !w.isDragging && /* @__PURE__ */ g(S, { children: [
              (x.canGrowVertical || x.canShrinkVertical) && /* @__PURE__ */ g(S, { children: [
                /* @__PURE__ */ s(I, { direction: "s", show: N, manifest: u }),
                /* @__PURE__ */ s(I, { direction: "n", show: N, manifest: u })
              ] }),
              (x.canGrowHorizontal || x.canShrinkHorizontal) && l === "desktop" && /* @__PURE__ */ g(S, { children: [
                /* @__PURE__ */ s(I, { direction: "w", show: N, manifest: u }),
                /* @__PURE__ */ s(I, { direction: "e", show: N, manifest: u })
              ] }),
              (x.canGrowVertical && x.canGrowHorizontal || x.canShrinkVertical && x.canShrinkHorizontal) && l === "desktop" && /* @__PURE__ */ g(S, { children: [
                /* @__PURE__ */ s(I, { direction: "se", show: N, manifest: u }),
                /* @__PURE__ */ s(I, { direction: "sw", show: N, manifest: u }),
                /* @__PURE__ */ s(I, { direction: "ne", show: N, manifest: u }),
                /* @__PURE__ */ s(I, { direction: "nw", show: N, manifest: u })
              ] })
            ] })
          ]
        }
      ) });
    } }, e.id);
  }
);
function bn({ brick: e }) {
  return Z() ? /* @__PURE__ */ s("div", { className: "absolute hidden group-hover/brick:block bottom-1 right-1 text-xs text-black/40", children: e.id }) : null;
}
const Pn = V(
  ({ brick: e, style: t, isContainerChild: n, show: a, ...o }, i) => {
    const c = Y(), l = W(e.type), m = Qe(), f = a && l.isContainer && !c || a && !l.isContainer && !n || c === e.id;
    return !f || m ? null : /* @__PURE__ */ s(
      "div",
      {
        ref: i,
        "data-ui": !0,
        "data-ui-menu-bars-container": !0,
        role: "navigation",
        className: O(
          "z-[99999] isolate text-base items-center gap-1",
          "transition-opacity duration-150 border rounded-lg",
          f ? "opacity-100 flex" : "opacity-0 hidden",
          l.isContainer ? "border-orange-300" : "border-transparent"
        ),
        style: t,
        ...o,
        children: /* @__PURE__ */ s(Nn, { brick: e })
      }
    );
  }
);
function Nn({ brick: e }) {
  return /* @__PURE__ */ s(
    "div",
    {
      id: `text-editor-menu-${e.id}`,
      className: O("contents", pt, "!empty:hidden")
    }
  );
}
const In = V(
  ({ brick: e, isContainerChild: t, children: n }, a) => {
    var h, u;
    const o = q(), i = Q(), c = Z(), l = W(e.type), m = o.canMoveToWithinParent(e.id, "previous"), f = o.canMoveToWithinParent(e.id, "next"), p = o.getParentBrick(e.id);
    return /* @__PURE__ */ g(
      Ie,
      {
        modal: !1,
        onOpenChange: (d) => {
          i.setContextMenuVisible(d);
        },
        children: [
          /* @__PURE__ */ s(Se, { disabled: c, ref: a, children: n }),
          /* @__PURE__ */ s(ht, { children: /* @__PURE__ */ g(Ee, { className: "nodrag", size: "2", children: [
            /* @__PURE__ */ g(Re, { className: "!text-sm", children: [
              l.name,
              " (brick)"
            ] }),
            l.duplicatable && /* @__PURE__ */ s(
              b,
              {
                shortcut: "⌘D",
                onClick: (d) => {
                  d.stopPropagation(), o.duplicateBrick(e.id);
                },
                children: "Duplicate"
              }
            ),
            m && /* @__PURE__ */ s(
              b,
              {
                shortcut: t ? "⌘↑" : "⌘←",
                onClick: (d) => {
                  d.stopPropagation(), o.moveBrickWithin(e.id, "previous");
                },
                children: t ? "Move up" : "Move left"
              }
            ),
            f && /* @__PURE__ */ s(
              b,
              {
                shortcut: t ? "⌘↓" : "⌘→",
                onClick: (d) => {
                  d.stopPropagation(), o.moveBrickWithin(e.id, "next");
                },
                children: t ? "Move down" : "Move right"
              }
            ),
            /* @__PURE__ */ g(D, { children: [
              /* @__PURE__ */ s(G, { children: "Visible on" }),
              /* @__PURE__ */ g(L, { children: [
                /* @__PURE__ */ s(
                  z,
                  {
                    checked: !((h = e.props.hidden) != null && h.mobile),
                    onClick: (d) => d.stopPropagation(),
                    onCheckedChange: () => o.toggleBrickVisibilityPerBreakpoint(e.id, "mobile"),
                    children: "Mobile"
                  }
                ),
                /* @__PURE__ */ s(
                  z,
                  {
                    checked: !((u = e.props.hidden) != null && u.desktop),
                    onClick: (d) => d.stopPropagation(),
                    onCheckedChange: () => o.toggleBrickVisibilityPerBreakpoint(e.id, "desktop"),
                    children: "Desktop"
                  }
                )
              ] })
            ] }),
            !t && /* @__PURE__ */ s(
              z,
              {
                checked: e.props.growHorizontally,
                onCheckedChange: (d) => {
                  o.updateBrickProps(e.id, {
                    growHorizontally: d
                  });
                },
                children: "Grow horizontally"
              }
            ),
            !t && /* @__PURE__ */ g(D, { children: [
              /* @__PURE__ */ s(G, { children: "Vertical Position" }),
              /* @__PURE__ */ s(L, { children: /* @__PURE__ */ s(
                Be,
                {
                  value: e.props.alignSelf,
                  onValueChange: (d) => {
                    o.updateBrickProps(e.id, {
                      alignSelf: d
                    });
                  },
                  children: Object.entries(ut(dt.alignSelf)).map(([d, P]) => /* @__PURE__ */ s(
                    ke,
                    {
                      value: P.const,
                      onClick: (E) => E.stopPropagation(),
                      children: P.title
                    },
                    d
                  ))
                }
              ) })
            ] }),
            p && /* @__PURE__ */ g(S, { children: [
              /* @__PURE__ */ s(H, {}),
              /* @__PURE__ */ g(D, { children: [
                /* @__PURE__ */ s(G, { children: "Parent container" }),
                /* @__PURE__ */ g(L, { children: [
                  /* @__PURE__ */ s(
                    b,
                    {
                      onClick: (d) => {
                        d.stopPropagation(), o.duplicateBrick(p.id);
                      },
                      children: "Duplicate container"
                    }
                  ),
                  /* @__PURE__ */ s(
                    b,
                    {
                      onClick: (d) => {
                        d.stopPropagation(), i.setSelectedBrickId(p.id), i.setPanel("inspector");
                      },
                      children: "Edit container"
                    }
                  ),
                  /* @__PURE__ */ s(H, {}),
                  /* @__PURE__ */ s(
                    b,
                    {
                      shortcut: "⌫",
                      color: "red",
                      onClick: (d) => {
                        d.stopPropagation(), o.deleteBrick(p.id), i.deselectBrick(p.id), i.hidePanel("inspector");
                      },
                      children: "Delete container"
                    }
                  )
                ] })
              ] }),
              /* @__PURE__ */ s(
                b,
                {
                  onClick: (d) => {
                    d.stopPropagation(), o.detachBrickFromContainer(e.id);
                  },
                  children: "Detach from parent"
                }
              )
            ] }),
            l.deletable && /* @__PURE__ */ g(S, { children: [
              /* @__PURE__ */ s(H, {}),
              /* @__PURE__ */ s(
                b,
                {
                  shortcut: "⌫",
                  color: "red",
                  onClick: (d) => {
                    d.stopPropagation(), o.deleteBrick(e.id), i.deselectBrick(e.id), i.hidePanel("inspector");
                  },
                  children: "Delete"
                }
              )
            ] })
          ] }) })
        ]
      }
    );
  }
);
function Xn() {
  const e = qe(), t = _("(max-width: 768px)"), n = _("(min-width: 769px) and (max-width: 1024px)"), a = _("(min-width: 1025px)"), o = _("(min-width: 1420px)"), i = _("(min-width: 1200px)");
  return {
    isMobile: t,
    isTablet: n,
    isDesktop: a,
    canUseDnd: !e && i || e && o
  };
}
export {
  $n as E,
  Cn as N,
  b as R,
  Re as S,
  H as W,
  Se as g,
  Ie as h,
  Xn as u,
  Ee as y
};
//# sourceMappingURL=use-device-info.Dvyud5vF.js.map
