require("./Tabs.css");
var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
var $9d2c38978395d44a$exports = require("./TabsPicker.cjs");
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $5oxdw$reactjsxruntime = require("react/jsx-runtime");
var $5oxdw$react = require("react");
var $5oxdw$reactariacomponents = require("react-aria-components");
var $5oxdw$reactariacollections = require("@react-aria/collections");
var $5oxdw$reactariautils = require("@react-aria/utils");
var $5oxdw$reactstatelyutils = require("@react-stately/utils");
var $5oxdw$reactspectrumutils = require("@react-spectrum/utils");
var $5oxdw$reactariafocus = require("@react-aria/focus");
var $5oxdw$reactariai18n = require("@react-aria/i18n");


function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "TabsContext", () => $b27519d6a701105b$export$cfa7aa87c26e7d1f);
$parcel$export(module.exports, "Tabs", () => $b27519d6a701105b$export$b2539bed5023c21c);
$parcel$export(module.exports, "TabList", () => $b27519d6a701105b$export$e51a686c67fdaa2d);
$parcel$export(module.exports, "Tab", () => $b27519d6a701105b$export$3e41faf802a29e71);
$parcel$export(module.exports, "TabPanel", () => $b27519d6a701105b$export$3d96ec278d3efce4);
/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 













const $b27519d6a701105b$export$cfa7aa87c26e7d1f = /*#__PURE__*/ (0, $5oxdw$react.createContext)(null);
const $b27519d6a701105b$var$InternalTabsContext = /*#__PURE__*/ (0, $5oxdw$react.createContext)({});
const $b27519d6a701105b$var$CollapseContext = /*#__PURE__*/ (0, $5oxdw$react.createContext)({
    showTabs: true,
    menuId: '',
    valueId: '',
    tabs: []
});
const $b27519d6a701105b$var$tabs = function anonymous(props, overrides) {
    let rules = " ";
    let position = false;
    let flexShrink = false;
    let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L|F|M|K)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "_P") position = true;
        if (p[1] === "_v") flexShrink = true;
        rules += p[0];
    }
    if (!position) rules += ' _Pc12';
    rules += ' sd12';
    if (!flexShrink) rules += ' _va12';
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' -_6BNtrc-c12';
    rules += ' vx12';
    rules += ' xb12';
    rules += ' _xa12';
    rules += ' _Fd12';
    rules += ' _FnuYUweb12';
    rules += ' pt12';
    if (props.orientation === "horizontal") rules += ' _ta12';
    return rules;
};
const $b27519d6a701105b$export$b2539bed5023c21c = /*#__PURE__*/ (0, $5oxdw$react.forwardRef)(function Tabs(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $b27519d6a701105b$export$cfa7aa87c26e7d1f);
    let { density: density = 'regular', isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation = 'horizontal', labelBehavior: labelBehavior = 'show' } = props;
    let domRef = (0, $5oxdw$reactspectrumutils.useDOMRef)(ref);
    let [value, setValue] = (0, $5oxdw$reactstatelyutils.useControlledState)(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange);
    if (!props['aria-label'] && !props['aria-labelledby']) throw new Error('An aria-label or aria-labelledby prop is required on Tabs for accessibility.');
    let tablistRef = (0, $5oxdw$react.useRef)(null);
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
        values: [
            [
                $b27519d6a701105b$var$InternalTabsContext,
                {
                    density: density,
                    isDisabled: isDisabled,
                    orientation: orientation,
                    disabledKeys: disabledKeys,
                    selectedKey: value,
                    tablistRef: tablistRef,
                    onSelectionChange: setValue,
                    labelBehavior: labelBehavior,
                    'aria-label': props['aria-label'],
                    'aria-labelledby': props['aria-labelledby']
                }
            ]
        ],
        children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacollections.CollectionBuilder), {
            content: props.children,
            children: (collection)=>/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapsingTabs, {
                    ...props,
                    selectedKey: value,
                    onSelectionChange: setValue,
                    collection: collection,
                    containerRef: domRef
                })
        })
    });
});
const $b27519d6a701105b$var$tablist = function anonymous(props) {
    let rules = " ";
    rules += ' sd12';
    if (props.orientation === "horizontal") {
        if (props.labelBehavior === "hide") {
            if (props.density === "regular") rules += ' Uj12';
            else if (props.density === "compact") rules += ' Ul12';
        } else if (props.density === "regular") rules += ' Up12';
        else if (props.density === "compact") rules += ' Uj12';
    }
    if (props.orientation === "horizontal") {
        if (props.labelBehavior === "hide") {
            if (props.density === "regular") rules += ' qj12';
            else if (props.density === "compact") rules += ' ql12';
        } else if (props.density === "regular") rules += ' qp12';
        else if (props.density === "compact") rules += ' qj12';
    }
    if (props.orientation === "vertical") rules += ' _ta12';
    if (props.orientation === "vertical") rules += ' Hz12';
    if (props.orientation === "vertical") rules += ' Ix12';
    rules += ' Nq12';
    return rules;
};
const $b27519d6a701105b$var$tablistWrapper = function anonymous(props, overrides) {
    let rules = " ";
    let position = false;
    let minWidth = false;
    let flexShrink = false;
    let flexGrow = false;
    let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "_P") position = true;
        if (p[1] === "N") minWidth = true;
        if (p[1] === "_v") flexShrink = true;
        if (p[1] === "_u") flexGrow = true;
        rules += p[0];
    }
    if (!position) rules += ' _Pc12';
    if (!minWidth) rules += ' Na12';
    if (!flexShrink) rules += ' _va12';
    if (!flexGrow) rules += ' _ua12';
    return rules;
};
function $b27519d6a701105b$export$e51a686c67fdaa2d(props) {
    let { showTabs: showTabs, menuId: menuId, valueId: valueId, tabs: tabs, listRef: listRef, onSelectionChange: onSelectionChange, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext) ?? {};
    let { density: density, orientation: orientation, labelBehavior: labelBehavior } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
    if (showTabs) return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabListInner, {
        ...props
    });
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)("div", {
        className: $b27519d6a701105b$var$tablistWrapper(null, props.styles),
        children: [
            listRef && /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
                className: $b27519d6a701105b$var$tablist({
                    orientation: orientation,
                    labelBehavior: labelBehavior,
                    density: density
                }),
                children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$HiddenTabs, {
                    items: tabs,
                    density: density,
                    listRef: listRef
                })
            }),
            /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabsMenu, {
                id: menuId,
                valueId: valueId,
                items: tabs,
                onSelectionChange: onSelectionChange,
                "aria-label": ariaLabel,
                "aria-describedby": ariaDescribedBy
            })
        ]
    });
}
function $b27519d6a701105b$var$TabListInner(props) {
    let { tablistRef: tablistRef, orientation: orientation, density: density, labelBehavior: labelBehavior, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext) ?? {};
    let { tabs: tabs, listRef: listRef } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext) ?? {};
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)("div", {
        style: props.UNSAFE_style,
        className: (props.UNSAFE_className || '') + $b27519d6a701105b$var$tablistWrapper(null, props.styles),
        children: [
            listRef && /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
                className: $b27519d6a701105b$var$tablist({
                    orientation: orientation,
                    labelBehavior: labelBehavior,
                    density: density
                }),
                children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$HiddenTabs, {
                    items: tabs,
                    density: density,
                    listRef: listRef
                })
            }),
            /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.TabList), {
                ...props,
                "aria-label": ariaLabel,
                "aria-labelledby": ariaLabelledBy,
                ref: tablistRef,
                className: (renderProps)=>$b27519d6a701105b$var$tablist({
                        ...renderProps,
                        labelBehavior: labelBehavior,
                        density: density
                    })
            })
        ]
    });
}
const $b27519d6a701105b$var$selectedIndicator = function anonymous(props) {
    let rules = " ";
    rules += ' _Pa12';
    if (props.isDisabled) rules += ' gH12';
    else rules += ' g012';
    if (props.isDisabled) rules += ' gld12';
    else rules += ' gle12';
    if (props.orientation === "horizontal") rules += ' FLvNfn12';
    else rules += ' Fb12';
    if (props.orientation === "vertical") rules += ' ZLvNfn12';
    else rules += ' Za12';
    rules += ' _qg12';
    rules += ' YIRyJjb12';
    rules += ' Ydklsgce12';
    rules += ' Xc12';
    rules += ' _2a12';
    rules += ' _lr12';
    if (props.orientation === "vertical") rules += ' Wr12';
    if (props.orientation === "horizontal") rules += ' _Er12';
    if (props.orientation === "vertical") rules += ' _Aa12';
    rules += ' _je12';
    rules += ' og12';
    rules += ' ng12';
    rules += ' kg12';
    rules += ' jg12';
    return rules;
};
const $b27519d6a701105b$var$tab = function anonymous(props, overrides) {
    let rules = " ";
    let position = false;
    let flexShrink = false;
    let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "_P") position = true;
        if (p[1] === "_v") flexShrink = true;
        rules += p[0];
    }
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    rules += ' sd12';
    if (props.isDisabled) rules += ' pp12';
    else if (props.isSelected) {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    } else {
        if (props.isPressed) rules += ' pt12';
        else if (props.isFocusVisible) rules += ' pt12';
        else if (props.isHovered) rules += ' pt12';
        else rules += ' pv12';
    }
    if (props.isDisabled) rules += ' plc12';
    else if (props.isSelected) rules += ' pld12';
    rules += ' oa12';
    rules += ' na12';
    rules += ' ka12';
    rules += ' ja12';
    rules += ' Uc12';
    rules += ' Usd12';
    rules += ' qc12';
    rules += ' qsd12';
    if (props.orientation === "horizontal") {
        if (props.density === "regular") rules += ' Fz12';
        else if (props.density === "compact") rules += ' Fx12';
    }
    if (props.orientation === "vertical") {
        if (props.density === "regular") rules += ' Mk12';
        else if (props.density === "compact") rules += ' Mi12';
    }
    rules += ' eb12';
    if (!position) rules += ' _Pc12';
    rules += ' ri12';
    rules += ' _Xa12';
    if (!flexShrink) rules += ' _va12';
    rules += ' Yd12';
    rules += ' Xb12';
    rules += ' _2b12';
    if (props.labelBehavior === "hide") rules += ' SssxDec12';
    if (props.labelBehavior === "hide") rules += ' RssxDec12';
    rules += ' __ca12';
    return rules;
};
const $b27519d6a701105b$var$icon = " sb12 _va12 -_8sjo0b-t5ZbAob12";
function $b27519d6a701105b$export$3e41faf802a29e71(props1) {
    let { density: density, orientation: orientation, labelBehavior: labelBehavior } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext) ?? {};
    let contentId = (0, $5oxdw$reactariautils.useId)();
    let ariaLabelledBy = props1['aria-labelledby'] || '';
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tab), {
        ...props1,
        // @ts-ignore
        originalProps: props1,
        "aria-labelledby": `${labelBehavior === 'hide' ? contentId : ''} ${ariaLabelledBy}`,
        style: props1.UNSAFE_style,
        className: (renderProps)=>(props1.UNSAFE_className || '') + $b27519d6a701105b$var$tab({
                ...renderProps,
                density: density,
                labelBehavior: labelBehavior,
                orientation: orientation
            }, props1.styles),
        children: ({ isMenu: // @ts-ignore
        isMenu, isDisabled: isDisabled })=>{
            if (isMenu) return props1.children;
            else return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
                values: [
                    [
                        (0, $6367bc87eb7d24ad$exports.TextContext),
                        {
                            id: contentId,
                            styles: function anonymous(props) {
                                let rules = " ";
                                rules += ' _Jb12';
                                if (props.labelBehavior === "hide") rules += ' sk12';
                                return rules;
                            }({
                                labelBehavior: labelBehavior
                            })
                        }
                    ],
                    [
                        (0, $bde97c91243ed164$exports.IconContext),
                        {
                            render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
                                slot: 'icon',
                                styles: " _Ja12"
                            }),
                            styles: $b27519d6a701105b$var$icon
                        }
                    ]
                ],
                children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabInner, {
                    orientation: orientation,
                    isDisabled: isDisabled,
                    children: typeof props1.children === 'string' ? /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
                        children: props1.children
                    }) : props1.children
                })
            });
        }
    });
}
function $b27519d6a701105b$var$TabInner({ isDisabled: isDisabled, orientation: orientation, children: children }) {
    let ref = (0, $5oxdw$react.useRef)(null);
    let isHidden = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$HiddenTabsContext);
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)((0, $5oxdw$reactjsxruntime.Fragment), {
        children: [
            !isHidden && /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.SelectionIndicator), {
                ref: ref,
                className: $b27519d6a701105b$var$selectedIndicator({
                    isDisabled: isDisabled,
                    orientation: orientation
                })
            }),
            children
        ]
    });
}
const $b27519d6a701105b$var$tabPanel = function anonymous(props, overrides) {
    let rules = " ";
    let marginTop = false;
    let flexGrow = false;
    let minHeight = false;
    let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L|F|M|K)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "J") marginTop = true;
        if (p[1] === "_u") flexGrow = true;
        if (p[1] === "M") minHeight = true;
        rules += p[0];
    }
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    if (!marginTop) rules += ' Js12';
    rules += ' pt12';
    if (!flexGrow) rules += ' _ub12';
    if (!minHeight) rules += ' Ma12';
    if (props.isInert) rules += ' sk12';
    else rules += ' sb12';
    return rules;
};
function $b27519d6a701105b$export$3d96ec278d3efce4(props) {
    let { showTabs: showTabs } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext);
    let { selectedKey: selectedKey } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
    if (showTabs) return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.TabPanel), {
        ...props,
        style: props.UNSAFE_style,
        className: (renderProps)=>(props.UNSAFE_className ?? '') + $b27519d6a701105b$var$tabPanel(renderProps, props.styles)
    });
    if (props.id !== selectedKey) return null;
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapsedTabPanel, {
        ...props
    });
}
function $b27519d6a701105b$var$CollapsedTabPanel(props) {
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', id: id, ...otherProps } = props;
    let { menuId: menuId, valueId: valueId } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext);
    let ref = (0, $5oxdw$react.useRef)(null);
    let tabIndex = (0, $5oxdw$reactariafocus.useHasTabbableChild)(ref) ? undefined : 0;
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Group), {
        ...otherProps,
        ref: ref,
        "aria-labelledby": menuId + ' ' + valueId,
        tabIndex: tabIndex,
        style: UNSAFE_style,
        className: (renderProps)=>UNSAFE_className + $b27519d6a701105b$var$tabPanel(renderProps, props.styles)
    });
}
function $b27519d6a701105b$var$isEveryTabDisabled(collection, disabledKeys) {
    let testKey = null;
    if (collection && collection.size > 0) {
        testKey = collection.getFirstKey();
        let index = 0;
        while(testKey && index < collection.size){
            // We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it
            if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) return false;
            testKey = collection.getKeyAfter(testKey);
            index++;
        }
        return true;
    }
    return false;
}
const $b27519d6a701105b$var$HiddenTabsContext = /*#__PURE__*/ (0, $5oxdw$react.createContext)(false);
let $b27519d6a701105b$var$HiddenTabs = function(props) {
    let { listRef: listRef, items: items = [], size: size, density: density } = props;
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
        // @ts-ignore
        inert: (0, $5oxdw$reactariautils.inertValue)(true),
        ref: listRef,
        className: " s40ub4c12 _t40ub4c12 U40ub4c12 q40ub4c12 _w40ub4c12 _Pa12 Wr12 _lr12 _Ar12 _zr12 _6b12 _Nc12 Pc12 _Ia12",
        children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$HiddenTabsContext.Provider, {
            value: true,
            children: items.map((item)=>{
                // pull off individual props as an allow list, don't want refs or other props getting through
                return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
                    "data-hidden-tab": true,
                    style: item.props.UNSAFE_style,
                    className: item.props.className({
                        size: size,
                        density: density
                    }),
                    children: item.props.children({
                        size: size,
                        density: density
                    })
                }, item.key);
            })
        })
    });
};
let $b27519d6a701105b$var$TabsMenu = (props1)=>{
    let { id: id, items: items, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, valueId: valueId } = props1;
    let { density: density, onSelectionChange: _onSelectionChange, selectedKey: selectedKey, isDisabled: isDisabled, disabledKeys: disabledKeys, labelBehavior: labelBehavior } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
    let onSelectionChange = (0, $5oxdw$react.useCallback)((key)=>{
        if (key != null) _onSelectionChange?.(key);
    }, [
        _onSelectionChange
    ]);
    let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
    let allKeysDisabled = (0, $5oxdw$react.useMemo)(()=>{
        return $b27519d6a701105b$var$isEveryTabDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());
    }, [
        state?.collection,
        disabledKeys
    ]);
    let labelProps = (0, $5oxdw$reactariautils.useLabels)({
        id: id,
        'aria-label': ariaLabel,
        'aria-labelledby': ariaLabelledBy
    });
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
        className: function anonymous(props) {
            let rules = " ";
            rules += ' sd12';
            rules += ' _va12';
            rules += ' eb12';
            if (props.density === "regular") rules += ' Fz12';
            else if (props.density === "compact") rules += ' Fx12';
            return rules;
        }({
            density: density
        }),
        children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $9d2c38978395d44a$exports.Picker), {
            id: id,
            valueId: valueId,
            ...labelProps,
            "aria-describedby": props1['aria-describedby'],
            "aria-details": props1['aria-details'],
            isDisabled: isDisabled || allKeysDisabled,
            density: density,
            labelBehavior: labelBehavior,
            items: items,
            disabledKeys: disabledKeys,
            selectedKey: selectedKey,
            onSelectionChange: onSelectionChange,
            children: (item)=>{
                return /*#__PURE__*/ (0, $5oxdw$react.createElement)((0, $9d2c38978395d44a$exports.PickerItem), {
                    ...item.props.originalProps,
                    isDisabled: isDisabled || allKeysDisabled,
                    key: item.key
                }, item.props.children({
                    density: density,
                    isMenu: true
                }));
            }
        })
    });
};
let $b27519d6a701105b$var$CollapsingTabs = ({ collection: collection, containerRef: containerRef, ...props })=>{
    let { orientation: orientation = 'horizontal', onSelectionChange: onSelectionChange } = props;
    let [showItems, _setShowItems] = (0, $5oxdw$react.useState)(true);
    showItems = orientation === 'vertical' ? true : showItems;
    let setShowItems = (0, $5oxdw$react.useCallback)((value)=>{
        if (orientation === 'vertical') // if orientation is vertical, we always show the items
        _setShowItems(true);
        else _setShowItems(value);
    }, [
        orientation
    ]);
    let { direction: direction } = (0, $5oxdw$reactariai18n.useLocale)();
    let children = (0, $5oxdw$react.useMemo)(()=>[
            ...collection
        ], [
        collection
    ]);
    let listRef = (0, $5oxdw$react.useRef)(null);
    let updateOverflow = ()=>{
        if (orientation === 'vertical' || !listRef.current || !containerRef?.current) return;
        let container = listRef.current;
        let containerRect = container.getBoundingClientRect();
        let tabs = container.querySelectorAll('[data-hidden-tab]');
        let lastTab = tabs[tabs.length - 1];
        let lastTabRect = lastTab.getBoundingClientRect();
        if (direction === 'ltr') setShowItems?.(lastTabRect.right <= containerRect.right);
        else setShowItems?.(lastTabRect.left >= containerRect.left);
    };
    let updateOverflowEffect = (0, $5oxdw$reactariautils.useEffectEvent)(updateOverflow);
    (0, $5oxdw$reactariautils.useResizeObserver)({
        ref: containerRef,
        onResize: updateOverflow
    });
    (0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
        if (collection.size > 0) queueMicrotask(updateOverflowEffect);
    }, [
        collection.size
    ]);
    // start with null so that the first render won't have a flicker
    let prevOrientation = (0, $5oxdw$react.useRef)(null);
    (0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
        if (collection.size > 0 && prevOrientation.current !== orientation) updateOverflowEffect();
        prevOrientation.current = orientation;
    }, [
        collection.size,
        orientation
    ]);
    (0, $5oxdw$react.useEffect)(()=>{
        // Recalculate visible tags when fonts are loaded.
        document.fonts?.ready.then(()=>updateOverflowEffect());
    }, []);
    let menuId = (0, $5oxdw$reactariautils.useId)();
    let valueId = (0, $5oxdw$reactariautils.useId)();
    let contents;
    if (showItems) contents = /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tabs), {
        ...props,
        style: {
            display: 'contents'
        },
        children: props.children
    });
    else contents = /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactjsxruntime.Fragment), {
        children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapseContext.Provider, {
            value: {
                showTabs: false,
                tabs: children,
                menuId: menuId,
                valueId: valueId,
                listRef: listRef,
                onSelectionChange: onSelectionChange,
                ariaLabel: props['aria-label'],
                ariaDescribedBy: props['aria-labelledby']
            },
            children: props.children
        })
    });
    return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
        style: props.UNSAFE_style,
        className: (props.UNSAFE_className || '') + $b27519d6a701105b$var$tabs({
            orientation: orientation
        }, props.styles),
        ref: containerRef,
        children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapseContext.Provider, {
            value: {
                showTabs: true,
                menuId: menuId,
                valueId: valueId,
                tabs: children,
                listRef: listRef
            },
            children: contents
        })
    });
};


//# sourceMappingURL=Tabs.cjs.map
