import { h as e } from "./chunk.BlbRoQQ3.js";
import { J as t, V as n } from "./use-page-data.Cb2SuuwJ.js";
import "./chunk-LSPN22SI.D75E3zS-.js";
import { b as r, c as i } from "./twind.BiM9xcCd.js";
import { b as a } from "./jsx-runtime.DF4K5VCp.js";
import "./chroma-js.Dcir27CH.js";
import "./color-system.Dp99zR0T.js";
import "./react.BZZIbN3T.js";
import "./schema-resolver.p7B_pu36.js";
import { b as o } from "./use-brick-style.DDPl-_C1.js";
import "./use-brick-manifest.Iv9SG-7-.js";
import { b as s } from "./BrickRoot.DbISziyH.js";
var c = /* @__PURE__ */ e(a());
function l({ brick: e, editable: a }) {
	let l = o(e), { props: u } = e, d = Object.values(l), f = t(), p = (e) => {
		if (a) {
			e.preventDefault();
			return;
		}
		if (u.linkToUrlOrPageId) if (u.linkToUrlOrPageId.startsWith("http")) window.open(u.linkToUrlOrPageId, "_blank");
		else {
			let e = f.find((e) => e.id === u.linkToUrlOrPageId);
			e && (window.location.href = e.path);
		}
	};
	return /* @__PURE__ */ (0, c.jsx)(s, {
		brick: e,
		manifest: n,
		editable: a,
		as: "button",
		type: "button",
		className: i(d, "btn", r({ "&:hover": { filter: "brightness(1.15)" } }), a && "pointer-events-none"),
		"data-prevented-by-editor": a ? "true" : "false",
		onClick: p,
		children: u.label
	});
}
export { l as default };

//# sourceMappingURL=button.ghxV8G2A.js.map