'use strict';

var _extends = require('../../../../../@babel_runtime@7.24.8/node_modules/@babel/runtime/helpers/esm/extends.cjs');
var React = require('react');
var index = require('../../../../../@radix-ui_react-context@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.cjs');
var index$4 = require('../../../../../@radix-ui_react-primitive@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._44pjkdrkjq3hxuh62jsxoggm4e/node_modules/@radix-ui/react-primitive/dist/index.cjs');
var index$1 = require('../../../../../@radix-ui_react-roving-focus@1.0.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18_753i7szl5dwsjermawvfyhbcfq/node_modules/@radix-ui/react-roving-focus/dist/index.cjs');
var index$5 = require('../../../../../@radix-ui_react-toggle@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-toggle/dist/index.cjs');
var index$2 = require('../../../../../@radix-ui_react-use-controllable-state@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs');
var index$3 = require('../../../../../@radix-ui_react-direction@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-direction/dist/index.cjs');

/* -------------------------------------------------------------------------------------------------
 * ToggleGroup
 * -----------------------------------------------------------------------------------------------*/ const $6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME = 'ToggleGroup';
const [$6c1fd9e6a8969628$var$createToggleGroupContext, $6c1fd9e6a8969628$export$d1c7c4bcd9f26dd4] = index.createContextScope($6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME, [
    index$1.createRovingFocusGroupScope
]);
const $6c1fd9e6a8969628$var$useRovingFocusGroupScope = index$1.createRovingFocusGroupScope();
const $6c1fd9e6a8969628$export$af3ec21f6cfb5e30 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { type: type , ...toggleGroupProps } = props;
    if (type === 'single') {
        const singleProps = toggleGroupProps;
        return /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupImplSingle, _extends.default({}, singleProps, {
            ref: forwardedRef
        }));
    }
    if (type === 'multiple') {
        const multipleProps = toggleGroupProps;
        return /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupImplMultiple, _extends.default({}, multipleProps, {
            ref: forwardedRef
        }));
    }
    throw new Error(`Missing prop \`type\` expected on \`${$6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME}\``);
});
/* -----------------------------------------------------------------------------------------------*/ const [$6c1fd9e6a8969628$var$ToggleGroupValueProvider, $6c1fd9e6a8969628$var$useToggleGroupValueContext] = $6c1fd9e6a8969628$var$createToggleGroupContext($6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME);
const $6c1fd9e6a8969628$var$ToggleGroupImplSingle = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , ...toggleGroupSingleProps } = props;
    const [value, setValue] = index$2.useControllableState({
        prop: valueProp,
        defaultProp: defaultValue,
        onChange: onValueChange
    });
    return /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupValueProvider, {
        scope: props.__scopeToggleGroup,
        type: "single",
        value: value ? [
            value
        ] : [],
        onItemActivate: setValue,
        onItemDeactivate: React.useCallback(()=>setValue('')
        , [
            setValue
        ])
    }, /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupImpl, _extends.default({}, toggleGroupSingleProps, {
        ref: forwardedRef
    })));
});
const $6c1fd9e6a8969628$var$ToggleGroupImplMultiple = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , ...toggleGroupMultipleProps } = props;
    const [value1 = [], setValue] = index$2.useControllableState({
        prop: valueProp,
        defaultProp: defaultValue,
        onChange: onValueChange
    });
    const handleButtonActivate = React.useCallback((itemValue)=>setValue((prevValue = [])=>[
                ...prevValue,
                itemValue
            ]
        )
    , [
        setValue
    ]);
    const handleButtonDeactivate = React.useCallback((itemValue)=>setValue((prevValue = [])=>prevValue.filter((value)=>value !== itemValue
            )
        )
    , [
        setValue
    ]);
    return /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupValueProvider, {
        scope: props.__scopeToggleGroup,
        type: "multiple",
        value: value1,
        onItemActivate: handleButtonActivate,
        onItemDeactivate: handleButtonDeactivate
    }, /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupImpl, _extends.default({}, toggleGroupMultipleProps, {
        ref: forwardedRef
    })));
});
/* -----------------------------------------------------------------------------------------------*/ const [$6c1fd9e6a8969628$var$ToggleGroupContext, $6c1fd9e6a8969628$var$useToggleGroupContext] = $6c1fd9e6a8969628$var$createToggleGroupContext($6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME);
const $6c1fd9e6a8969628$var$ToggleGroupImpl = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { __scopeToggleGroup: __scopeToggleGroup , disabled: disabled = false , rovingFocus: rovingFocus = true , orientation: orientation , dir: dir , loop: loop = true , ...toggleGroupProps } = props;
    const rovingFocusGroupScope = $6c1fd9e6a8969628$var$useRovingFocusGroupScope(__scopeToggleGroup);
    const direction = index$3.useDirection(dir);
    const commonProps = {
        role: 'group',
        dir: direction,
        ...toggleGroupProps
    };
    return /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupContext, {
        scope: __scopeToggleGroup,
        rovingFocus: rovingFocus,
        disabled: disabled
    }, rovingFocus ? /*#__PURE__*/ React.createElement(index$1.Root, _extends.default({
        asChild: true
    }, rovingFocusGroupScope, {
        orientation: orientation,
        dir: direction,
        loop: loop
    }), /*#__PURE__*/ React.createElement(index$4.Primitive.div, _extends.default({}, commonProps, {
        ref: forwardedRef
    }))) : /*#__PURE__*/ React.createElement(index$4.Primitive.div, _extends.default({}, commonProps, {
        ref: forwardedRef
    })));
});
/* -------------------------------------------------------------------------------------------------
 * ToggleGroupItem
 * -----------------------------------------------------------------------------------------------*/ const $6c1fd9e6a8969628$var$ITEM_NAME = 'ToggleGroupItem';
const $6c1fd9e6a8969628$export$b453109e13abe10b = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const valueContext = $6c1fd9e6a8969628$var$useToggleGroupValueContext($6c1fd9e6a8969628$var$ITEM_NAME, props.__scopeToggleGroup);
    const context = $6c1fd9e6a8969628$var$useToggleGroupContext($6c1fd9e6a8969628$var$ITEM_NAME, props.__scopeToggleGroup);
    const rovingFocusGroupScope = $6c1fd9e6a8969628$var$useRovingFocusGroupScope(props.__scopeToggleGroup);
    const pressed = valueContext.value.includes(props.value);
    const disabled = context.disabled || props.disabled;
    const commonProps = {
        ...props,
        pressed: pressed,
        disabled: disabled
    };
    const ref = React.useRef(null);
    return context.rovingFocus ? /*#__PURE__*/ React.createElement(index$1.Item, _extends.default({
        asChild: true
    }, rovingFocusGroupScope, {
        focusable: !disabled,
        active: pressed,
        ref: ref
    }), /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupItemImpl, _extends.default({}, commonProps, {
        ref: forwardedRef
    }))) : /*#__PURE__*/ React.createElement($6c1fd9e6a8969628$var$ToggleGroupItemImpl, _extends.default({}, commonProps, {
        ref: forwardedRef
    }));
});
/* -----------------------------------------------------------------------------------------------*/ const $6c1fd9e6a8969628$var$ToggleGroupItemImpl = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { __scopeToggleGroup: __scopeToggleGroup , value: value , ...itemProps } = props;
    const valueContext = $6c1fd9e6a8969628$var$useToggleGroupValueContext($6c1fd9e6a8969628$var$ITEM_NAME, __scopeToggleGroup);
    const singleProps = {
        role: 'radio',
        'aria-checked': props.pressed,
        'aria-pressed': undefined
    };
    const typeProps = valueContext.type === 'single' ? singleProps : undefined;
    return /*#__PURE__*/ React.createElement(index$5.Toggle, _extends.default({}, typeProps, itemProps, {
        ref: forwardedRef,
        onPressedChange: (pressed)=>{
            if (pressed) valueContext.onItemActivate(value);
            else valueContext.onItemDeactivate(value);
        }
    }));
});
/* -----------------------------------------------------------------------------------------------*/ const $6c1fd9e6a8969628$export$be92b6f5f03c0fe9 = $6c1fd9e6a8969628$export$af3ec21f6cfb5e30;
const $6c1fd9e6a8969628$export$6d08773d2e66f8f2 = $6c1fd9e6a8969628$export$b453109e13abe10b;

exports.Item = $6c1fd9e6a8969628$export$6d08773d2e66f8f2;
exports.Root = $6c1fd9e6a8969628$export$be92b6f5f03c0fe9;
exports.ToggleGroup = $6c1fd9e6a8969628$export$af3ec21f6cfb5e30;
exports.ToggleGroupItem = $6c1fd9e6a8969628$export$b453109e13abe10b;
exports.createToggleGroupScope = $6c1fd9e6a8969628$export$d1c7c4bcd9f26dd4;
//# sourceMappingURL=index.cjs.map
