import { c as compute_rest_props } from './lifecycle-px-3doLe.js'; import { c as create_ssr_component, v as validate_component, s as spread, d as escape_attribute_value, f as escape_object, b as add_attribute } from './ssr-ipqebOFl.js'; import { q as buttonVariants, i as is_void } from './index3-4H3SMWet.js'; import { clsx } from 'clsx'; import { twMerge } from 'tailwind-merge'; function getAttrs(builders) { const attrs = {}; builders.forEach((builder) => { Object.keys(builder).forEach((key) => { if (key !== "action") { attrs[key] = builder[key]; } }); }); return attrs; } const Button$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["href", "type", "builders", "el"]); let { href = void 0 } = $$props; let { type = void 0 } = $$props; let { builders = [] } = $$props; let { el = void 0 } = $$props; const attrs = { "data-button-root": "" }; if ($$props.href === void 0 && $$bindings.href && href !== void 0) $$bindings.href(href); if ($$props.type === void 0 && $$bindings.type && type !== void 0) $$bindings.type(type); if ($$props.builders === void 0 && $$bindings.builders && builders !== void 0) $$bindings.builders(builders); if ($$props.el === void 0 && $$bindings.el && el !== void 0) $$bindings.el(el); return `${builders && builders.length ? ` ${((tag) => { return tag ? `<${href ? "a" : "button"}${spread( [ { type: escape_attribute_value(href ? void 0 : type) }, { href: escape_attribute_value(href) }, { tabindex: "0" }, escape_object(getAttrs(builders)), escape_object($$restProps), escape_object(attrs) ], {} )}${add_attribute("this", el, 0)}>${is_void(tag) ? "" : `${slots.default ? slots.default({}) : ``}`}${is_void(tag) ? "" : ``}` : ""; })(href ? "a" : "button")}` : ` ${((tag) => { return tag ? `<${href ? "a" : "button"}${spread( [ { type: escape_attribute_value(href ? void 0 : type) }, { href: escape_attribute_value(href) }, { tabindex: "0" }, escape_object($$restProps), escape_object(attrs) ], {} )}${add_attribute("this", el, 0)}>${is_void(tag) ? "" : `${slots.default ? slots.default({}) : ``}`}${is_void(tag) ? "" : ``}` : ""; })(href ? "a" : "button")}`}`; }); function cubicOut(t) { const f = t - 1; return f * f * f + 1; } function cn(...inputs) { return twMerge(clsx(inputs)); } const flyAndScale = (node, params = { y: -8, x: 0, start: 0.95, duration: 150 }) => { const style = getComputedStyle(node); const transform = style.transform === "none" ? "" : style.transform; const scaleConversion = (valueA, scaleA, scaleB) => { const [minA, maxA] = scaleA; const [minB, maxB] = scaleB; const percentage = (valueA - minA) / (maxA - minA); const valueB = percentage * (maxB - minB) + minB; return valueB; }; const styleToString = (style2) => { return Object.keys(style2).reduce((str, key) => { if (style2[key] === void 0) return str; return str + `${key}:${style2[key]};`; }, ""); }; return { duration: params.duration ?? 200, delay: 0, css: (t) => { const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]); const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]); const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]); return styleToString({ transform: `${transform} translate3d(${x}px, ${y}px, 0) scale(${scale})`, opacity: t }); }, easing: cubicOut }; }; const Button = create_ssr_component(($$result, $$props, $$bindings, slots) => { let $$restProps = compute_rest_props($$props, ["class", "variant", "size", "builders"]); let { class: className = void 0 } = $$props; let { variant = "default" } = $$props; let { size = "default" } = $$props; let { builders = [] } = $$props; if ($$props.class === void 0 && $$bindings.class && className !== void 0) $$bindings.class(className); if ($$props.variant === void 0 && $$bindings.variant && variant !== void 0) $$bindings.variant(variant); if ($$props.size === void 0 && $$bindings.size && size !== void 0) $$bindings.size(size); if ($$props.builders === void 0 && $$bindings.builders && builders !== void 0) $$bindings.builders(builders); return `${validate_component(Button$1, "ButtonPrimitive.Root").$$render( $$result, Object.assign( {}, { builders }, { class: cn(buttonVariants({ variant, size, className })) }, { type: "button" }, $$restProps ), {}, { default: () => { return `${slots.default ? slots.default({}) : ``}`; } } )}`; }); export { Button as B, cubicOut as a, cn as c, flyAndScale as f }; //# sourceMappingURL=button-CeH7Xj2c.js.map