import { jsx as $ } from "react/jsx-runtime";
import { useRef as u } from "react";
import { $ as i } from "./Button-BjcDZ5eb.es.js";
import { $ as x } from "./utils-B6pV5ewr.es.js";
import { createRecipeContext as R, mergeRefs as P } from "@chakra-ui/react";
import { b as h } from "./toggle-button-group.recipe-Cl3PTeGf.es.js";
import { i as y } from "./emotion-is-prop-valid.esm-BUuA3iy8.es.js";
import { s as B } from "./index-C2qW4ynb.es.js";
import { $ as C } from "./useObjectRef-CaJ5pgjX.es.js";
import { $ as v } from "./mergeProps-Dsl8k3Ig.es.js";
import { $ as w } from "./useButton-CiPiehgC.es.js";
const { withContext: g } = /* @__PURE__ */ R({
  recipe: h
}), j = /* @__PURE__ */ g(
  "button",
  {
    defaultProps: {
      type: "button"
    },
    /** make sure the `onPress` properties won't end up as attribute on the rendered DOM element */
    shouldForwardProp(o, e) {
      const t = !e?.includes(o) && !B.isValidProperty(o);
      return y(o) && t && !o.includes("onPress");
    }
  }
), c = (o) => {
  const { ref: e, as: t, asChild: a, children: d, ...f } = o, m = u(null), p = C(P(m, e)), [s, n] = x(
    f,
    p,
    i
  ), b = t || (a ? "a" : "button"), { buttonProps: l } = w(
    {
      ...s,
      elementType: b
    },
    n
  ), r = v(s, l, {
    as: t,
    asChild: a,
    /**
     * In case `slot` was null, the `useContextProps` hook already
     * processed it at this point, so it's safe to not attach it
     * to the DOM element
     */
    slot: s.slot || void 0
  });
  return /* @__PURE__ */ $(
    j,
    {
      ref: n,
      ...r,
      "aria-disabled": r.isDisabled || void 0,
      "data-disabled": r.isDisabled || void 0,
      children: d
    }
  );
};
c.displayName = "Button";
const E = /* @__PURE__ */ Object.assign(c, {
  Context: i
});
export {
  E as B
};
//# sourceMappingURL=button-BEJnxXsL.es.js.map
