import { j as m } from "../../../../../_virtual/jsx-runtime.js";
import { a as f } from "../../../../sdk/dist/shared/chunk-BZGNY7LB.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-UU2MSQXY.js";
import "../../../../sdk/dist/shared/chunk-T3LIA4YB.js";
import "../../../../sdk/dist/shared/chunk-UMHXXXVP.js";
import { tx as c, css as u } from "../../../../style-system/dist/twind.js";
import { useBrickStyle as d } from "../hooks/use-brick-style.js";
import h from "../components/BrickRoot.js";
import { useSitemap as k } from "../../../../../use-page-data.js";
function T({ brick: r, editable: o }) {
  const s = d(r), { props: t } = r, n = Object.values(s), i = k(), a = (p) => {
    if (o) {
      p.preventDefault();
      return;
    }
    if (t.linkToUrlOrPageId)
      if (t.linkToUrlOrPageId.startsWith("http"))
        window.open(t.linkToUrlOrPageId, "_blank");
      else {
        const e = i.find((l) => l.id === t.linkToUrlOrPageId);
        e && (window.location.href = e.path);
      }
  };
  return /* @__PURE__ */ m.jsx(
    h,
    {
      brick: r,
      manifest: f,
      editable: o,
      as: "button",
      type: "button",
      className: c(
        n,
        "btn",
        u({
          "&:hover": {
            filter: "brightness(1.15)"
          }
        }),
        o && "pointer-events-none"
      ),
      "data-prevented-by-editor": o ? "true" : "false",
      onClick: a,
      children: t.label
    }
  );
}
export {
  T as default
};
//# sourceMappingURL=button.js.map
