require("./Picker.css");
var $38071d9ce246d4cf$exports = require("./Avatar.cjs");
var $af04e099a53d3e85$exports = require("./Checkbox.cjs");
var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
var $e741ea6b88ce4866$exports = require("./Menu.cjs");
var $dba2b18fc5727f9b$exports = require("./Checkmark.cjs");
var $1df9f1c9262ce5df$exports = require("./Chevron.cjs");
var $a2d5b35c01bebcd6$exports = require("./ComboBox.cjs");
var $a0b996a550bb0891$exports = require("./Field.cjs");
var $bfa4962d90c8af48$exports = require("./Form.cjs");
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $308b180f49d82d28$exports = require("../icons/runtime.cjs");
var $493371ef39bf7a55$exports = require("./Popover.cjs");
var $2061c83559b50a66$exports = require("./pressScale.cjs");
var $1c116ea4b0d2d023$exports = require("./ProgressCircle.cjs");
var $ee7b4c497f520c08$exports = require("./utils.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $ceqeb$reactjsxruntime = require("react/jsx-runtime");
var $ceqeb$reactariacomponents = require("react-aria-components");
var $ceqeb$reactariacollections = require("@react-aria/collections");
var $ceqeb$reactariainteractions = require("@react-aria/interactions");
var $ceqeb$react = require("react");
var $ceqeb$reactspectrumutils = require("@react-spectrum/utils");
var $ceqeb$reactariautils = require("@react-aria/utils");
var $ceqeb$reactariai18n = require("@react-aria/i18n");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

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

$parcel$export(module.exports, "PickerContext", () => $b9c30139cd63c62a$export$b72b8dade9393cd5);
$parcel$export(module.exports, "Picker", () => $b9c30139cd63c62a$export$ba25329847403e11);
$parcel$export(module.exports, "PickerItem", () => $b9c30139cd63c62a$export$d601881f38163e28);
$parcel$export(module.exports, "PickerSection", () => $b9c30139cd63c62a$export$a340772aca6155cd);
/*
 * 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 $b9c30139cd63c62a$export$b72b8dade9393cd5 = /*#__PURE__*/ (0, $ceqeb$react.createContext)(null);
const $b9c30139cd63c62a$var$inputButton = function anonymous(props) {
    let rules = " ";
    if (props.isQuiet) rules += ' _Le1';
    else if (props.isFocusVisible) rules += ' _Lf1';
    else rules += ' _Le1';
    rules += ' Oh1';
    rules += ' Olc1';
    rules += ' _Mc1';
    rules += ' _Kd1';
    if (props.size === "XL") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "L") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "S") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "XS") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e1';
        rules += ' vx1';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d1';
        rules += ' vx1';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b1';
        rules += ' vx1';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a1';
        rules += ' vx1';
    } else {
        rules += ' -_6BNtrc-c1';
        rules += ' vx1';
    }
    if (props.size === "XL") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "L") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "S") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "XS") {
        rules += ' xb1';
        rules += ' _xa1';
    } else {
        rules += ' xb1';
        rules += ' _xa1';
    }
    if (props.size === "XL") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "L") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "S") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "XS") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    }
    if (props.isDisabled) rules += ' pp1';
    else {
        if (props.isPressed) rules += ' po1';
        else if (props.isFocusVisible) rules += ' po1';
        else if (props.isHovered) rules += ' po1';
        else rules += ' pt1';
    }
    rules += ' sd1';
    rules += ' eb1';
    rules += ' _oa1';
    rules += ' SMBFGYc1';
    rules += ' RfBFGYc1';
    if (props.size === "XL") rules += ' Nl1';
    else if (props.size === "L") rules += ' Nj1';
    else if (props.size === "S") rules += ' Nf1';
    else if (props.size === "XS") rules += ' Ne1';
    else rules += ' Nk1';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec1';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn1';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b1';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd1';
    else rules += ' -SFnbic-_Jb1';
    rules += ' -Bu7z1c-ob1';
    rules += ' oj1';
    rules += ' nj1';
    rules += ' kj1';
    rules += ' jj1';
    rules += ' qc1';
    rules += ' qsd1';
    rules += ' -Qg41Lb-IAxCW0c1';
    rules += ' -Qg41Lb-gLWx3bIy1';
    rules += ' FRuFGYc1';
    rules += ' zXcEWr1';
    rules += ' yXcEWr1';
    rules += ' BXcEWr1';
    rules += ' AXcEWr1';
    if (props.isQuiet) rules += ' _qd1';
    else rules += ' _qtb1';
    if (props.size === "XL") rules += ' -Anxdcc-Zt1';
    else if (props.size === "L") rules += ' -Anxdcc-ZStdtne1';
    else if (props.size === "S") rules += ' -Anxdcc-Zr1';
    else rules += ' -Anxdcc-Z3fn9H1';
    rules += ' __v6TNLWb1';
    rules += ' _Pc1';
    rules += ' _Wd1';
    rules += ' _je1';
    rules += ' _jlf1';
    if (props.isDisabled) rules += ' ilc1';
    else rules += ' ilb1';
    rules += ' Yd1';
    rules += ' Xb1';
    rules += ' _2b1';
    if (props.isQuiet) rules += ' g91';
    else if (props.isDisabled) rules += ' gH1';
    else if (props.isOpen) rules += ' gF1';
    else {
        if (props.isPressed) rules += ' gF1';
        else if (props.isFocusVisible) rules += ' gF1';
        else if (props.isHovered) rules += ' gF1';
        else rules += ' gH1';
    }
    if (props.isQuiet) rules += ' Ln1';
    rules += ' __ca1';
    if (props.size === "XL") rules += ' -F_-Fz1';
    else if (props.size === "L") rules += ' -F_-Fv1';
    else if (props.size === "S") rules += ' -F_-Fp1';
    else if (props.size === "XS") rules += ' -F_-Fn1';
    else rules += ' -F_-Fx1';
    if (props.isQuiet) rules += ' -S_-Sd1';
    else rules += ' -S_-Sv1';
    if (props.isQuiet) rules += ' -R_-Rd1';
    else rules += ' -R_-Rv1';
    return rules;
};
const $b9c30139cd63c62a$var$quietFocusLine = " Za1 FLvNfn1 _Pa1 _lr1 og1 ng1 kg1 jg1 g_h1 gle1";
let $b9c30139cd63c62a$export$b1e5508a851be14d = function anonymous(props) {
    let rules = " ";
    rules += ' _Le1';
    rules += ' se1';
    rules += ' Za1';
    if (props.size === "XL") rules += ' Dk92HIe1';
    else if (props.size === "L") rules += ' DyaX9Fb1';
    else if (props.size === "M") rules += ' Deb5jcb1';
    else if (props.size === "S") rules += ' DGTLJAe1';
    rules += ' _oa1';
    rules += ' K40ub4c1';
    rules += ' _Na1';
    rules += ' Pa1';
    rules += ' Tt1';
    rules += ' Qt1';
    rules += ' St1';
    rules += ' Rt1';
    rules += ' uk1';
    rules += ' ucJ9TBTb1';
    rules += ' ud3Euai1';
    rules += ' uea1';
    rules += ' ugb1';
    rules += ' uhd1';
    rules += ' uje1';
    rules += ' u2NhKxcl1';
    rules += ' uic1';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e1';
        rules += ' vx1';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d1';
        rules += ' vx1';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b1';
        rules += ' vx1';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a1';
        rules += ' vx1';
    } else {
        rules += ' -_6BNtrc-c1';
        rules += ' vx1';
    }
    rules += ' __ya1';
    return rules;
};
const $b9c30139cd63c62a$var$invalidBorder = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec1';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn1';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b1';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd1';
    else rules += ' -SFnbic-_Jb1';
    rules += ' -Bu7z1c-ob1';
    rules += ' oj1';
    rules += ' nj1';
    rules += ' kj1';
    rules += ' jj1';
    rules += ' _Pa1';
    rules += ' Wr1';
    rules += ' _Er1';
    rules += ' _lr1';
    rules += ' _Rr1';
    rules += ' _Ob1';
    rules += ' _jf1';
    rules += ' _kc1';
    rules += ' hc1';
    rules += ' mc1';
    rules += ' lc1';
    if (props.isPressed) rules += ' im1';
    else if (props.isFocusVisible) rules += ' im1';
    else if (props.isHovered) rules += ' im1';
    else rules += ' ip1';
    rules += ' Yd1';
    rules += ' Xb1';
    rules += ' _2b1';
    return rules;
};
const $b9c30139cd63c62a$var$valueStyles = function anonymous(props) {
    let rules = " ";
    if (props.isQuiet) rules += ' _ua1';
    else rules += ' _ub1';
    rules += ' _Nc1';
    rules += ' Pc1';
    rules += ' _Yb1';
    rules += ' _7c1';
    rules += ' sd1';
    rules += ' eb1';
    return rules;
};
const $b9c30139cd63c62a$var$iconStyles = function anonymous(props) {
    let rules = " ";
    rules += ' _va1';
    rules += ' _Sd1';
    rules += ' -_8sjo0b-t5ZbAob1';
    if (props.isLoading) rules += ' pp1';
    return rules;
};
const $b9c30139cd63c62a$var$avatar = " z2U5Crc1 y2U5Crc1 B2U5Crc1 A2U5Crc1 Ht1 Hsu1";
const $b9c30139cd63c62a$var$loadingWrapperStyles = " z2mU1 yzZKy1 sd1 eb1 _Ca1 Jv1 Gv1";
const $b9c30139cd63c62a$var$progressCircleStyles = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' Zp1';
    else if (props.size === "L") rules += ' Zn1';
    else if (props.size === "M") rules += ' Zm1';
    else if (props.size === "S") rules += ' Zu1';
    if (props.size === "XL") rules += ' Fq1';
    else if (props.size === "L") rules += ' Fo1';
    else if (props.size === "M") rules += ' Fn1';
    else if (props.size === "S") rules += ' Ft1';
    return rules;
};
let $b9c30139cd63c62a$var$InternalPickerContext = /*#__PURE__*/ (0, $ceqeb$react.createContext)({
    size: 'M'
});
let $b9c30139cd63c62a$var$InsideSelectValueContext = /*#__PURE__*/ (0, $ceqeb$react.createContext)(false);
const $b9c30139cd63c62a$export$ba25329847403e11 = /*#__PURE__*/ (0, $ceqeb$react.forwardRef)(function Picker(props1, ref) {
    let stringFormatter = (0, $ceqeb$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    [props1, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props1, ref, $b9c30139cd63c62a$export$b72b8dade9393cd5);
    let domRef = (0, $ceqeb$reactspectrumutils.useFocusableRef)(ref);
    let formContext = (0, $ceqeb$react.useContext)((0, $bfa4962d90c8af48$exports.FormContext));
    props1 = (0, $bfa4962d90c8af48$exports.useFormProps)(props1);
    let { direction: direction = 'bottom', align: align = 'start', shouldFlip: shouldFlip = true, menuWidth: menuWidth, label: label, description: descriptionMessage, errorMessage: errorMessage, children: children, items: items, size: size = 'M', labelPosition: labelPosition = 'top', labelAlign: labelAlign = 'start', necessityIndicator: necessityIndicator, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, placeholder: placeholder = stringFormatter.format('picker.placeholder'), isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, ...pickerProps } = props1;
    // Better way to encode this into a style? need to account for flipping
    let menuOffset;
    if (size === 'S') menuOffset = 6;
    else if (size === 'M') menuOffset = 6;
    else if (size === 'L') menuOffset = 7;
    else menuOffset = 8;
    let renderer;
    let showButtonSpinner = (0, $ceqeb$react.useMemo)(()=>loadingState === 'loading', [
        loadingState
    ]);
    let spinnerId = (0, $ceqeb$reactariautils.useSlotId)([
        showButtonSpinner
    ]);
    let listBoxLoadingCircle = /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.ListBoxLoadMoreItem), {
        className: $b9c30139cd63c62a$var$loadingWrapperStyles,
        isLoading: loadingState === 'loadingMore',
        onLoadMore: onLoadMore,
        children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)($b9c30139cd63c62a$var$PickerProgressCircle, {
            size: size,
            "aria-label": stringFormatter.format('table.loadingMore')
        })
    });
    if (typeof children === 'function' && items) renderer = /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsxs)((0, $ceqeb$reactjsxruntime.Fragment), {
        children: [
            /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.Collection), {
                items: items,
                dependencies: props1.dependencies,
                children: children
            }),
            listBoxLoadingCircle
        ]
    });
    else renderer = /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsxs)((0, $ceqeb$reactjsxruntime.Fragment), {
        children: [
            children,
            listBoxLoadingCircle
        ]
    });
    let scale = (0, $ee7b4c497f520c08$exports.useScale)();
    let { direction: dir } = (0, $ceqeb$reactariai18n.useLocale)();
    let RTLFlipOffset = dir === 'rtl' ? -1 : 1;
    return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.Select), {
        ...pickerProps,
        "aria-describedby": spinnerId,
        placeholder: placeholder,
        style: UNSAFE_style,
        className: UNSAFE_className + function anonymous(props, overrides) {
            let rules = " ";
            let gridColumnStart = false;
            let gridColumnEnd = 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] === "z") gridColumnStart = true;
                if (p[1] === "y") gridColumnEnd = true;
                rules += p[0];
            }
            rules += ' se1';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU1';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG1';
                }
            }
            if (props.isInForm) rules += ' DLwlgod1';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb1';
                else if (props.labelPosition === "top") rules += ' DM8Mfn1';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb1';
            else if (props.labelPosition === "top") rules += ' E4w1sLc1';
            if (props.labelPosition === "side") rules += ' CbRM95c1';
            else if (props.labelPosition === "top") rules += ' Cxaocre1';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e1';
                rules += ' vx1';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d1';
                rules += ' vx1';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b1';
                rules += ' vx1';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a1';
                rules += ' vx1';
            } else {
                rules += ' -_6BNtrc-c1';
                rules += ' vx1';
            }
            rules += ' ea1';
            rules += ' _Fd1';
            rules += ' _FnuYUweb1';
            if (props.size === "XL") rules += ' -BhX7R-Fz1';
            else if (props.size === "L") rules += ' -BhX7R-Fv1';
            else if (props.size === "S") rules += ' -BhX7R-Fp1';
            else if (props.size === "XS") rules += ' -BhX7R-Fn1';
            else rules += ' -BhX7R-Fx1';
            rules += ' -AJjOLd-UVkF0Db1';
            rules += ' qg1';
            rules += ' __ca1';
            return rules;
        }({
            isInForm: !!formContext,
            labelPosition: labelPosition,
            size: size
        }, props1.styles),
        children: ({ isDisabled: isDisabled, isOpen: isOpen, isFocusVisible: isFocusVisible, isInvalid: isInvalid, isRequired: isRequired })=>/*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactjsxruntime.Fragment), {
                children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsxs)($b9c30139cd63c62a$var$InternalPickerContext.Provider, {
                    value: {
                        size: size
                    },
                    children: [
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
                            includeNecessityIndicatorInAccessibilityName: true,
                            isDisabled: isDisabled,
                            isRequired: isRequired,
                            size: size,
                            labelPosition: labelPosition,
                            labelAlign: labelAlign,
                            isQuiet: isQuiet,
                            necessityIndicator: necessityIndicator,
                            contextualHelp: props1.contextualHelp,
                            children: label
                        }),
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)($b9c30139cd63c62a$var$PickerButton, {
                            loadingState: loadingState,
                            isOpen: isOpen,
                            isQuiet: isQuiet,
                            isFocusVisible: isFocusVisible,
                            size: size,
                            isInvalid: isInvalid,
                            isDisabled: isDisabled,
                            buttonRef: domRef,
                            loadingCircle: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)($b9c30139cd63c62a$var$PickerProgressCircle, {
                                id: spinnerId,
                                size: size,
                                "aria-label": stringFormatter.format('table.loading')
                            })
                        }),
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.HelpText), {
                            size: size,
                            isDisabled: isDisabled,
                            isInvalid: isInvalid,
                            description: descriptionMessage,
                            children: errorMessage
                        }),
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.Virtualizer), {
                            layout: (0, $ceqeb$reactariacomponents.ListLayout),
                            layoutOptions: {
                                estimatedRowHeight: 32,
                                estimatedHeadingHeight: 50,
                                padding: 8,
                                loaderHeight: (0, $a2d5b35c01bebcd6$exports.LOADER_ROW_HEIGHTS)[size][scale]
                            },
                            children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $493371ef39bf7a55$exports.Popover), {
                                hideArrow: true,
                                padding: "none",
                                offset: menuOffset,
                                crossOffset: isQuiet ? RTLFlipOffset * -12 : undefined,
                                placement: `${direction} ${align}`,
                                shouldFlip: shouldFlip,
                                UNSAFE_style: {
                                    width: menuWidth && !isQuiet ? `${menuWidth}px` : undefined
                                },
                                styles: function anonymous(props) {
                                    let rules = " ";
                                    if (props.isQuiet) rules += ' Nh1';
                                    else rules += ' NuHSBze1';
                                    if (props.isQuiet) rules += ' ZbWuche1';
                                    else rules += ' ZuHSBze1';
                                    return rules;
                                }(props1),
                                children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)("div", {
                                    className: " sd1 Za1 Fb1",
                                    children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.Provider), {
                                        values: [
                                            [
                                                (0, $6367bc87eb7d24ad$exports.HeaderContext),
                                                {
                                                    styles: (0, $a2d5b35c01bebcd6$exports.listboxHeader)({
                                                        size: size
                                                    })
                                                }
                                            ],
                                            [
                                                (0, $6367bc87eb7d24ad$exports.HeadingContext),
                                                {
                                                    // @ts-ignore
                                                    role: 'presentation',
                                                    styles: (0, $e741ea6b88ce4866$exports.sectionHeading)
                                                }
                                            ],
                                            [
                                                (0, $6367bc87eb7d24ad$exports.TextContext),
                                                {
                                                    slots: {
                                                        description: {
                                                            styles: (0, $e741ea6b88ce4866$exports.description)({
                                                                size: size
                                                            })
                                                        }
                                                    }
                                                }
                                            ]
                                        ],
                                        children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.ListBox), {
                                            dependencies: props1.dependencies,
                                            items: items,
                                            className: (0, $a2d5b35c01bebcd6$exports.listbox)({
                                                size: size
                                            }),
                                            children: renderer
                                        })
                                    })
                                })
                            })
                        })
                    ]
                })
            })
    });
});
function $b9c30139cd63c62a$var$PickerProgressCircle(props) {
    let { id: id, size: size, 'aria-label': ariaLabel } = props;
    return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $1c116ea4b0d2d023$exports.ProgressCircle), {
        id: id,
        isIndeterminate: true,
        size: "S",
        "aria-label": ariaLabel,
        styles: $b9c30139cd63c62a$var$progressCircleStyles({
            size: size
        })
    });
}
const $b9c30139cd63c62a$var$avatarSize = {
    S: 16,
    M: 20,
    L: 22,
    XL: 26
};
// Needs to be hidable component or otherwise the PressResponder throws a warning when rendered in the fake DOM and tries to register
const $b9c30139cd63c62a$var$PickerButton = (0, $ceqeb$reactariacollections.createHideableComponent)(function PickerButton(props) {
    let { isOpen: isOpen, isQuiet: isQuiet, isFocusVisible: isFocusVisible, size: size, isInvalid: isInvalid, isDisabled: isDisabled, loadingState: loadingState, loadingCircle: loadingCircle, buttonRef: buttonRef } = props;
    let stringFormatter = (0, $ceqeb$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    // For mouse interactions, pickers open on press start. When the popover underlay appears
    // it covers the trigger button, causing onPressEnd to fire immediately and no press scaling
    // to occur. We override this by listening for pointerup on the document ourselves.
    let [isPressed, setPressed] = (0, $ceqeb$react.useState)(false);
    let { addGlobalListener: addGlobalListener } = (0, $ceqeb$reactariautils.useGlobalListeners)();
    let onPressStart = (e)=>{
        if (e.pointerType !== 'mouse') return;
        setPressed(true);
        addGlobalListener(document, 'pointerup', ()=>{
            setPressed(false);
        }, {
            once: true,
            capture: true
        });
    };
    return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariainteractions.PressResponder), {
        onPressStart: onPressStart,
        isPressed: isPressed,
        children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.Button), {
            ref: buttonRef,
            style: (renderProps)=>(0, $2061c83559b50a66$exports.pressScale)(buttonRef)(renderProps),
            // Prevent press scale from sticking while Picker is open.
            // @ts-ignore
            isPressed: false,
            className: (renderProps)=>$b9c30139cd63c62a$var$inputButton({
                    ...renderProps,
                    size: size,
                    isOpen: isOpen,
                    isQuiet: isQuiet
                }),
            children: (renderProps)=>/*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsxs)((0, $ceqeb$reactjsxruntime.Fragment), {
                    children: [
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.SelectValue), {
                            className: $b9c30139cd63c62a$var$valueStyles({
                                isQuiet: isQuiet
                            }) + ' ' + "pqYuhc",
                            children: ({ selectedItems: selectedItems, defaultChildren: defaultChildren })=>{
                                return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.Provider), {
                                    values: [
                                        [
                                            (0, $bde97c91243ed164$exports.IconContext),
                                            {
                                                slots: {
                                                    icon: {
                                                        render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
                                                            slot: 'icon',
                                                            styles: (0, $e741ea6b88ce4866$exports.iconCenterWrapper)
                                                        }),
                                                        styles: (0, $e741ea6b88ce4866$exports.icon)
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            (0, $38071d9ce246d4cf$exports.AvatarContext),
                                            {
                                                slots: {
                                                    avatar: {
                                                        size: $b9c30139cd63c62a$var$avatarSize[size ?? 'M'],
                                                        styles: $b9c30139cd63c62a$var$avatar
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            (0, $6367bc87eb7d24ad$exports.TextContext),
                                            {
                                                slots: {
                                                    description: {},
                                                    [(0, $ceqeb$reactariacomponents.DEFAULT_SLOT)]: {
                                                        styles: " sb1 _ub1 _Nc1 Pc1 _Yb1 _7c1",
                                                        // @ts-ignore
                                                        'data-slot': 'label'
                                                    },
                                                    label: {
                                                        styles: " sb1 _ub1 _Nc1 Pc1 _Yb1 _7c1",
                                                        // @ts-ignore not technically necessary, but good for consistency
                                                        'data-slot': 'label'
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            $b9c30139cd63c62a$var$InsideSelectValueContext,
                                            true
                                        ]
                                    ],
                                    children: selectedItems.length <= 1 ? defaultChildren : /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
                                        slot: "label",
                                        children: stringFormatter.format('picker.selectedCount', {
                                            count: selectedItems.length
                                        })
                                    })
                                });
                            }
                        }),
                        isInvalid && /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldErrorIcon), {
                            isDisabled: isDisabled
                        }),
                        loadingState === 'loading' && !isOpen && loadingCircle,
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $1df9f1c9262ce5df$exports.default), {
                            size: size,
                            className: $b9c30139cd63c62a$var$iconStyles({
                                isLoading: loadingState === 'loading'
                            })
                        }),
                        isFocusVisible && isQuiet && /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)("span", {
                            className: $b9c30139cd63c62a$var$quietFocusLine
                        }),
                        isInvalid && !isDisabled && !isQuiet && // @ts-ignore known limitation detecting functions from the theme
                        /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)("div", {
                            className: $b9c30139cd63c62a$var$invalidBorder({
                                ...renderProps,
                                size: size
                            })
                        })
                    ]
                })
        })
    });
});
const $b9c30139cd63c62a$var$checkmarkIconSize = {
    S: 'XS',
    M: 'M',
    L: 'L',
    XL: 'XL'
};
function $b9c30139cd63c62a$export$d601881f38163e28(props) {
    let ref = (0, $ceqeb$react.useRef)(null);
    let isLink = props.href != null;
    let { size: size } = (0, $ceqeb$react.useContext)($b9c30139cd63c62a$var$InternalPickerContext);
    return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.ListBoxItem), {
        ...props,
        ref: ref,
        textValue: props.textValue || (typeof props.children === 'string' ? props.children : undefined),
        style: (0, $2061c83559b50a66$exports.pressScale)(ref, props.UNSAFE_style),
        className: (renderProps)=>(props.UNSAFE_className || '') + (0, $a2d5b35c01bebcd6$exports.listboxItem)({
                ...renderProps,
                size: size,
                isLink: isLink
            }, props.styles),
        children: (renderProps)=>{
            let { children: children } = props;
            let checkboxRenderProps = {
                ...renderProps,
                size: size,
                isFocused: false,
                isFocusVisible: false,
                isIndeterminate: false,
                isReadOnly: false,
                isInvalid: false,
                isRequired: false
            };
            return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)($b9c30139cd63c62a$var$DefaultProvider, {
                context: (0, $bde97c91243ed164$exports.IconContext),
                value: {
                    slots: {
                        icon: {
                            render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
                                slot: 'icon',
                                styles: (0, $e741ea6b88ce4866$exports.iconCenterWrapper)
                            }),
                            styles: (0, $e741ea6b88ce4866$exports.icon)
                        }
                    }
                },
                children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)($b9c30139cd63c62a$var$DefaultProvider, {
                    context: (0, $38071d9ce246d4cf$exports.AvatarContext),
                    value: {
                        slots: {
                            avatar: {
                                size: $b9c30139cd63c62a$var$avatarSize[size],
                                styles: $b9c30139cd63c62a$var$avatar
                            }
                        }
                    },
                    children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsxs)($b9c30139cd63c62a$var$DefaultProvider, {
                        context: (0, $6367bc87eb7d24ad$exports.TextContext),
                        value: {
                            slots: {
                                [(0, $ceqeb$reactariacomponents.DEFAULT_SLOT)]: {
                                    styles: (0, $e741ea6b88ce4866$exports.label)({
                                        size: size
                                    })
                                },
                                label: {
                                    styles: (0, $e741ea6b88ce4866$exports.label)({
                                        size: size
                                    })
                                },
                                description: {
                                    styles: (0, $e741ea6b88ce4866$exports.description)({
                                        ...renderProps,
                                        size: size
                                    })
                                }
                            }
                        },
                        children: [
                            renderProps.selectionMode === 'single' && !isLink && /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $dba2b18fc5727f9b$exports.default), {
                                size: $b9c30139cd63c62a$var$checkmarkIconSize[size],
                                className: (0, $e741ea6b88ce4866$exports.checkmark)({
                                    ...renderProps,
                                    size: size
                                })
                            }),
                            renderProps.selectionMode === 'multiple' && !isLink && /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)("div", {
                                className: (0, $308b180f49d82d28$exports.mergeStyles)((0, $e741ea6b88ce4866$exports.checkbox), (0, $af04e099a53d3e85$exports.box)(checkboxRenderProps)),
                                children: /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $dba2b18fc5727f9b$exports.default), {
                                    size: size,
                                    className: (0, $af04e099a53d3e85$exports.iconStyles)
                                })
                            }),
                            typeof children === 'string' ? /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
                                slot: "label",
                                children: children
                            }) : children
                        ]
                    })
                })
            });
        }
    });
}
// A Context.Provider that only sets a value if not inside SelectValue.
function $b9c30139cd63c62a$var$DefaultProvider({ context: context, value: value, children: children }) {
    let inSelectValue = (0, $ceqeb$react.useContext)($b9c30139cd63c62a$var$InsideSelectValueContext);
    if (inSelectValue) return children;
    return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)(context.Provider, {
        value: value,
        children: children
    });
}
function $b9c30139cd63c62a$export$a340772aca6155cd(props) {
    let { size: size } = (0, $ceqeb$react.useContext)($b9c30139cd63c62a$var$InternalPickerContext);
    return /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsxs)((0, $ceqeb$reactjsxruntime.Fragment), {
        children: [
            /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $ceqeb$reactariacomponents.ListBoxSection), {
                ...props,
                children: props.children
            }),
            /*#__PURE__*/ (0, $ceqeb$reactjsxruntime.jsx)((0, $a2d5b35c01bebcd6$exports.Divider), {
                size: size
            })
        ]
    });
}


//# sourceMappingURL=Picker.cjs.map
