import { useHotkeys as t } from "../../../../../node_modules/.pnpm/react-hotkeys-hook@4.6.1_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-canary_491cd93b885e50c46ba63c9769517513/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js";
import { useEditorHelpers as u, usePreviewMode as g, useSelectedBrickId as m, useSelectedSectionId as k } from "../../../../../use-editor.js";
import "react";
import "../../../../../node_modules/.pnpm/@formkit_auto-animate@0.8.2/node_modules/@formkit/auto-animate/index.js";
import { toast as v } from "../../../../../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 { useDraftHelpers as w, useDraft as D, useBrick as B, useDraftUndoManager as b } from "../../../../../use-page-data.js";
function A() {
  const i = u(), n = w(), a = D(), d = g(), o = m(), c = k(), l = B(o), { undo: p, redo: f } = b();
  t("esc", () => {
    i.deselectBrick(), i.setSelectedSectionId(), i.hidePanel();
  }), t("mod+c", () => {
    window.getSelection()?.rangeCount || console.debug("mod+c pressed");
  }), t(["backspace", "del"], (e) => {
    o && (e.preventDefault(), n.deleteBrick(o), i.deselectBrick(o), i.hidePanel("inspector"));
  }), t("s", (e) => {
    e.preventDefault(), i.togglePanel("settings");
  }), t("l", (e) => {
    e.preventDefault(), i.togglePanel("library");
  }), t("t", (e) => {
    e.preventDefault(), i.togglePanel("theme");
  }), t("p", (e) => {
    e.preventDefault(), i.togglePanel();
  }), t(["mod+z", "ctrl+z"], (e) => {
    e.preventDefault(), p();
  }), t(["mod+shift+z", "ctrl+shift+z"], (e) => {
    e.preventDefault(), f();
  }), t(
    ["up", "left"],
    (e) => {
      if (o) {
        e.preventDefault();
        const r = n.getParentBrick(o);
        r ? (r.props.direction === "flex-row" ? "ArrowLeft" : "ArrowUp") === e.key && n.moveBrick(o, "previous") : e.key === "ArrowLeft" && n.moveBrick(o, "previous");
      } else if (c && e.key === "ArrowUp") {
        e.preventDefault(), n.moveSectionUp(c);
        const r = document.getElementById(c);
        r && r.scrollIntoView({ behavior: "smooth", block: "center" });
      }
    },
    {
      enableOnContentEditable: !1
    }
  ), t(
    ["down", "right"],
    (e) => {
      if (o) {
        e.preventDefault();
        const r = n.getParentBrick(o);
        r ? (r.props.direction === "flex-row" ? "ArrowRight" : "ArrowDown") === e.key && n.moveBrick(o, "next") : e.key === "ArrowRight" && n.moveBrick(o, "next");
      } else if (c && e.key === "ArrowDown") {
        e.preventDefault(), n.moveSectionDown(c);
        const r = document.getElementById(c);
        r && r.scrollIntoView({ behavior: "smooth", block: "center" });
      }
    },
    {
      enableOnContentEditable: !1
    }
  ), t("mod+d", (e) => {
    e.preventDefault(), o && (n.duplicateBrick(o), v("Brick duplicated", {
      id: "duplicate-brick"
    }));
  }), t("mod+j", (e) => {
    e.preventDefault(), i.toggleEditorEnabled();
  }), t("mod+g", (e) => {
    e.preventDefault(), console.log("Debugging draft:");
    const { page: r, site: s } = a;
    console.log({ page: r, site: s });
  }), t(
    "space",
    (e) => {
      e.target.classList.contains("tiptap") || (e.preventDefault(), e.stopPropagation(), l && n.updateBrickProps(
        l.id,
        {
          grow: !l.props.grow
        },
        d === "mobile"
      ));
    },
    {
      enableOnContentEditable: !0
    }
  );
}
export {
  A as useEditorHotKeys
};
//# sourceMappingURL=use-editor-hot-keys.js.map
