import { j as l } from "../../../../../_virtual/jsx-runtime.js";
import { a as f } from "../../../../sdk/dist/shared/chunk-STDCM2KD.js";
import "../../../../sdk/dist/shared/chunk-6PGAWO4H.js";
import "../../../../sdk/dist/shared/chunk-F4JNKU7J.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-7UBMXMNJ.js";
import "../../../../sdk/dist/shared/chunk-JRCVYDCD.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
