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