import { j as e } from "../../../../../_virtual/jsx-runtime.js";
import { a as S } from "../../../../sdk/dist/shared/chunk-GOMXZC4B.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-PSCN3VVA.js";
import "../../../../sdk/dist/shared/chunk-R6ATC4TC.js";
import "../../../../sdk/dist/shared/chunk-CFF6Q7O7.js";
import "../../../../sdk/dist/shared/chunk-IKC3FK7L.js";
import "../../../../sdk/dist/shared/chunk-E6XEI7IK.js";
import "../../../../sdk/dist/shared/chunk-SQ5T4AT5.js";
import "../../../../sdk/dist/shared/chunk-G5CJU6RD.js";
import "../../../../sdk/dist/shared/chunk-PSTFJ5IJ.js";
import "../../../../sdk/dist/shared/chunk-NJGXC7D6.js";
import "../../../../sdk/dist/shared/chunk-SXHDQ64Z.js";
import "../../../../sdk/dist/shared/chunk-QX6OGRRT.js";
import "../../../../sdk/dist/shared/chunk-FLOMNC6J.js";
import "../../../../sdk/dist/shared/chunk-PLSV746R.js";
import "../../../../sdk/dist/shared/chunk-WBZW5LVH.js";
import "../../../../sdk/dist/shared/chunk-WYVJE6J5.js";
import "../../../../sdk/dist/shared/chunk-I3VL6SRH.js";
import "../../../../sdk/dist/shared/chunk-B3EATRFX.js";
import "../../../../sdk/dist/shared/chunk-IKHZD2JH.js";
import "../../../../sdk/dist/shared/chunk-PXI7AHWS.js";
import "lodash-es";
import "../../../../sdk/dist/shared/chunk-SY6DZLTC.js";
import "../../../../sdk/dist/shared/chunk-7A2JNQX3.js";
import "../../../../sdk/dist/shared/chunk-3YVJ2ELD.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.js";
import { useDebugMode as C, useEditorHelpers as y } from "../../../../../use-editor.js";
import { forwardRef as v } from "react";
import "../../../../../node_modules/.pnpm/@formkit_auto-animate@0.8.2/node_modules/@formkit/auto-animate/index.js";
import "../../../../../node_modules/.pnpm/react-hot-toast@2.5.2_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-canary-3d_c02c1e17bf76c343fd22d1f22394ecf5/node_modules/react-hot-toast/dist/index.js";
import { useSections as N, useDraftHelpers as b } from "../../../../../use-page-data.js";
import { Root as k, Trigger as w, Content as R, Group as d, Label as D, Item as s, Separator as c } from "../../../../../node_modules/.pnpm/@radix-ui_themes@3.1.4_@types_react-dom@18.3.6_@types_react@18.3.3__@types_react@18.3.3_46b1dabc193c5ff5696ee783983c694e/node_modules/@radix-ui/themes/dist/esm/components/context-menu.js";
import { Portal as I } from "../../../../../node_modules/.pnpm/@radix-ui_react-portal@1.1.1_@types_react-dom@18.3.6_@types_react@18.3.3__@types_react@_d91fd04d10d265136bf0d35a7b9375b2/node_modules/@radix-ui/react-portal/dist/index.js";
const le = v(
  ({ section: t, children: m }, l) => {
    const x = C(), p = N(), o = b(), { setSelectedSectionId: n, setPanel: a, setSelectedBrickId: j } = y(), h = p.reduce((r, i) => Math.max(r, i.order), -1), f = p.reduce((r, i) => Math.min(r, i.order), 1 / 0), u = t.order === h, g = t.order === f;
    return /* @__PURE__ */ e.jsxs(
      k,
      {
        modal: !1,
        onOpenChange: (r) => {
        },
        children: [
          /* @__PURE__ */ e.jsx(w, { disabled: x, ref: l, children: m }),
          /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsxs(R, { className: "nodrag", size: "2", children: [
            /* @__PURE__ */ e.jsxs(d, { children: [
              /* @__PURE__ */ e.jsxs(D, { children: [
                t.label ?? "Unnamed",
                " (section)"
              ] }),
              /* @__PURE__ */ e.jsx(
                s,
                {
                  onClick: () => {
                    n(t.id), a("inspector");
                  },
                  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Settings" }) })
                }
              ),
              /* @__PURE__ */ e.jsx(c, {}),
              !g && /* @__PURE__ */ e.jsx(s, { onClick: () => o.moveSectionUp(t.id), children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Reorder up" }) }) }),
              !u && /* @__PURE__ */ e.jsx(s, { onClick: () => o.moveSectionDown(t.id), children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Reorder down" }) }) })
            ] }),
            /* @__PURE__ */ e.jsx(c, {}),
            /* @__PURE__ */ e.jsxs(d, { children: [
              /* @__PURE__ */ e.jsx(
                s,
                {
                  onClick: (r) => {
                    r.stopPropagation();
                    const i = `s_${S()}`;
                    o.createEmptySection(i, t.id), n(i), a("inspector");
                  },
                  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Create new section below" }) })
                }
              ),
              /* @__PURE__ */ e.jsx(
                s,
                {
                  onClick: (r) => {
                    r.stopPropagation(), o.duplicateSection(t.id);
                  },
                  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Duplicate" }) })
                }
              )
            ] }),
            /* @__PURE__ */ e.jsx(c, {}),
            /* @__PURE__ */ e.jsx(
              s,
              {
                color: "red",
                onClick: (r) => {
                  r.stopPropagation(), o.deleteSection(t.id), n(), j(), a();
                },
                children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2.5", children: /* @__PURE__ */ e.jsx("span", { children: "Delete section" }) })
              }
            )
          ] }) })
        ]
      }
    );
  }
);
export {
  le as default
};
//# sourceMappingURL=EditableSectionContextMenu.js.map
