"use client";
'use strict';

const React = require('react');
const index$2 = require('../../../../../@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.cjs');
const index = require('../../../../../@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs');
const index$1 = require('../../../../../@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596/node_modules/@radix-ui/react-primitive/dist/index.cjs');
const jsxRuntime = require('react/jsx-runtime');

function _interopNamespaceCompat(e) {
  if (e && typeof e === 'object' && 'default' in e) return e;
  const n = Object.create(null);
  if (e) {
    for (const k in e) {
      n[k] = e[k];
    }
  }
  n.default = e;
  return n;
}

const React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);

var NAME = "Toggle";
var Toggle = React__namespace.forwardRef((props, forwardedRef) => {
  const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
  const [pressed, setPressed] = index.useControllableState({
    prop: pressedProp,
    onChange: onPressedChange,
    defaultProp: defaultPressed ?? false,
    caller: NAME
  });
  return /* @__PURE__ */ jsxRuntime.jsx(
    index$1.Primitive.button,
    {
      type: "button",
      "aria-pressed": pressed,
      "data-state": pressed ? "on" : "off",
      "data-disabled": props.disabled ? "" : void 0,
      ...buttonProps,
      ref: forwardedRef,
      onClick: index$2.composeEventHandlers(props.onClick, () => {
        if (!props.disabled) {
          setPressed(!pressed);
        }
      })
    }
  );
});
Toggle.displayName = NAME;
var Root = Toggle;

exports.Root = Root;
exports.Toggle = Toggle;
