import "./Picker.css";
import {AvatarContext as $3ffa2cd930156220$export$a20dad690e1279e2} from "./Avatar.mjs";
import {box as $9b405e0f8095dce0$export$827f4ee28efc37, iconStyles as $9b405e0f8095dce0$export$2c99b98b77550cb4} from "./Checkbox.mjs";
import {centerBaseline as $1f4b04be3f24aae3$export$9d7e2342a7e53afa} from "./CenterBaseline.mjs";
import {checkbox as $13afb0ea5f0ed767$export$b07e517d22efa1ca, checkmark as $13afb0ea5f0ed767$export$292abbf31ed842a, description as $13afb0ea5f0ed767$export$6d59db4903f20f7d, icon as $13afb0ea5f0ed767$export$1ca1ec8b29a4ce27, iconCenterWrapper as $13afb0ea5f0ed767$export$31d1842a0fd736e6, label as $13afb0ea5f0ed767$export$1237798dc640739a, sectionHeading as $13afb0ea5f0ed767$export$300ac6f106ef584d} from "./Menu.mjs";
import $81cf3d4588736e7d$export$2e2bcd8739ae039 from "./Checkmark.mjs";
import $4b69f02ec06b9226$export$2e2bcd8739ae039 from "./Chevron.mjs";
import {Divider as $a2f262fac286a920$export$2e0a83ec2e27ecbb, listbox as $a2f262fac286a920$export$9901d82449b93cea, listboxHeader as $a2f262fac286a920$export$c040ba7a724e8da1, listboxItem as $a2f262fac286a920$export$68265fb354482bae, LOADER_ROW_HEIGHTS as $a2f262fac286a920$export$83379f5245567d78} from "./ComboBox.mjs";
import {FieldErrorIcon as $9afd80978c252040$export$bda0d075e0e342c9, FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414, HelpText as $9afd80978c252040$export$a67c0bc59081311a} from "./Field.mjs";
import {FormContext as $9b916426527cebe7$export$c24727297075ec6a, useFormProps as $9b916426527cebe7$export$a6b5be5c6b451665} from "./Form.mjs";
import {HeaderContext as $8e847109a6ab556d$export$e0e4026c12a8bdbb, HeadingContext as $8e847109a6ab556d$export$d688439359537581, Text as $8e847109a6ab556d$export$5f1af8db9871e1d6, TextContext as $8e847109a6ab556d$export$9afb8bc826b033ea} from "./Content.mjs";
import {IconContext as $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed} from "../icons/Icon.mjs";
import $c77I5$intlStringsmjs from "./intlStrings.mjs";
import {mergeStyles as $feb886035e0d4633$export$e618dc39ac9ad607} from "../icons/runtime.mjs";
import {Popover as $88b746eba92c8d0d$export$5b6b19405a83ff9d} from "./Popover.mjs";
import {pressScale as $10ea7662e51a285b$export$56e8cba416805d8d} from "./pressScale.mjs";
import {ProgressCircle as $41ddd91dbbf0c389$export$c79b9d6b4cc92af7} from "./ProgressCircle.mjs";
import {useScale as $859432f3b3573fcb$export$a8d2043b2d807f4d} from "./utils.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $c77I5$jsx, jsxs as $c77I5$jsxs, Fragment as $c77I5$Fragment} from "react/jsx-runtime";
import {ListBoxLoadMoreItem as $c77I5$ListBoxLoadMoreItem, Collection as $c77I5$Collection, Select as $c77I5$Select, Virtualizer as $c77I5$Virtualizer, ListLayout as $c77I5$ListLayout, Provider as $c77I5$Provider, ListBox as $c77I5$ListBox, SelectStateContext as $c77I5$SelectStateContext, Button as $c77I5$Button, SelectValue as $c77I5$SelectValue, DEFAULT_SLOT as $c77I5$DEFAULT_SLOT, ListBoxItem as $c77I5$ListBoxItem, ListBoxSection as $c77I5$ListBoxSection} from "react-aria-components";
import {createHideableComponent as $c77I5$createHideableComponent} from "@react-aria/collections";
import {useSlotId as $c77I5$useSlotId, getOwnerDocument as $c77I5$getOwnerDocument, createShadowTreeWalker as $c77I5$createShadowTreeWalker, isFocusable as $c77I5$isFocusable, useGlobalListeners as $c77I5$useGlobalListeners} from "@react-aria/utils";
import {PressResponder as $c77I5$PressResponder} from "@react-aria/interactions";
import {createContext as $c77I5$createContext, forwardRef as $c77I5$forwardRef, useContext as $c77I5$useContext, useMemo as $c77I5$useMemo, useRef as $c77I5$useRef, useEffect as $c77I5$useEffect, useState as $c77I5$useState} from "react";
import {useFocusableRef as $c77I5$useFocusableRef} from "@react-spectrum/utils";
import {useLocalizedStringFormatter as $c77I5$useLocalizedStringFormatter, useLocale as $c77I5$useLocale} from "@react-aria/i18n";


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}
/*
 * 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 $b41c15d27fbaff7d$export$b72b8dade9393cd5 = /*#__PURE__*/ (0, $c77I5$createContext)(null);
const $b41c15d27fbaff7d$var$inputButton = function anonymous(props) {
    let rules = " ";
    if (props.isQuiet) rules += ' _Le11';
    else if (props.isFocusVisible) rules += ' _Lf11';
    else rules += ' _Le11';
    rules += ' Oh11';
    rules += ' Olc11';
    rules += ' _Mc11';
    rules += ' _Kd11';
    if (props.size === "XL") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else if (props.size === "L") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else if (props.size === "S") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else if (props.size === "XS") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e11';
        rules += ' vx11';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d11';
        rules += ' vx11';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b11';
        rules += ' vx11';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a11';
        rules += ' vx11';
    } else {
        rules += ' -_6BNtrc-c11';
        rules += ' vx11';
    }
    if (props.size === "XL") {
        rules += ' xb11';
        rules += ' _xa11';
    } else if (props.size === "L") {
        rules += ' xb11';
        rules += ' _xa11';
    } else if (props.size === "S") {
        rules += ' xb11';
        rules += ' _xa11';
    } else if (props.size === "XS") {
        rules += ' xb11';
        rules += ' _xa11';
    } else {
        rules += ' xb11';
        rules += ' _xa11';
    }
    if (props.size === "XL") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else if (props.size === "L") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else if (props.size === "S") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else if (props.size === "XS") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    }
    if (props.isDisabled) rules += ' pp11';
    else {
        if (props.isPressed) rules += ' po11';
        else if (props.isFocusVisible) rules += ' po11';
        else if (props.isHovered) rules += ' po11';
        else rules += ' pt11';
    }
    rules += ' sd11';
    rules += ' eb11';
    rules += ' _oa11';
    rules += ' SMBFGYc11';
    rules += ' RfBFGYc11';
    if (props.size === "XL") rules += ' Nl11';
    else if (props.size === "L") rules += ' Nj11';
    else if (props.size === "S") rules += ' Nf11';
    else if (props.size === "XS") rules += ' Ne11';
    else rules += ' Nk11';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec11';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn11';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b11';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd11';
    else rules += ' -SFnbic-_Jb11';
    rules += ' -Bu7z1c-ob11';
    rules += ' oj11';
    rules += ' nj11';
    rules += ' kj11';
    rules += ' jj11';
    rules += ' qc11';
    rules += ' qsd11';
    rules += ' -Qg41Lb-IAxCW0c11';
    rules += ' -Qg41Lb-gLWx3bIy11';
    rules += ' FRuFGYc11';
    rules += ' zXcEWr11';
    rules += ' yXcEWr11';
    rules += ' BXcEWr11';
    rules += ' AXcEWr11';
    if (props.isQuiet) rules += ' _qd11';
    else rules += ' _qtb11';
    if (props.size === "XL") rules += ' -Anxdcc-Zt11';
    else if (props.size === "L") rules += ' -Anxdcc-ZStdtne11';
    else if (props.size === "S") rules += ' -Anxdcc-Zr11';
    else rules += ' -Anxdcc-Z3fn9H11';
    rules += ' __v6TNLWb11';
    rules += ' _Pc11';
    rules += ' _Wd11';
    rules += ' _je11';
    rules += ' _jlf11';
    if (props.isDisabled) rules += ' ilc11';
    else rules += ' ilb11';
    rules += ' Yd11';
    rules += ' Xb11';
    rules += ' _2b11';
    if (props.isQuiet) rules += ' g911';
    else if (props.isDisabled) rules += ' gH11';
    else if (props.isOpen) rules += ' gF11';
    else {
        if (props.isPressed) rules += ' gF11';
        else if (props.isFocusVisible) rules += ' gF11';
        else if (props.isHovered) rules += ' gF11';
        else rules += ' gH11';
    }
    if (props.isQuiet) rules += ' Ln11';
    rules += ' __ca11';
    if (props.size === "XL") rules += ' -F_-Fz11';
    else if (props.size === "L") rules += ' -F_-Fv11';
    else if (props.size === "S") rules += ' -F_-Fp11';
    else if (props.size === "XS") rules += ' -F_-Fn11';
    else rules += ' -F_-Fx11';
    if (props.isQuiet) rules += ' -S_-Sd11';
    else rules += ' -S_-Sv11';
    if (props.isQuiet) rules += ' -R_-Rd11';
    else rules += ' -R_-Rv11';
    return rules;
};
const $b41c15d27fbaff7d$var$quietFocusLine = " Za11 FLvNfn11 _Pa11 _lr11 og11 ng11 kg11 jg11 g_h11 gle11";
let $b41c15d27fbaff7d$export$b1e5508a851be14d = function anonymous(props) {
    let rules = " ";
    rules += ' _Le11';
    rules += ' se11';
    rules += ' Za11';
    if (props.size === "XL") rules += ' Dk92HIe11';
    else if (props.size === "L") rules += ' DyaX9Fb11';
    else if (props.size === "M") rules += ' Deb5jcb11';
    else if (props.size === "S") rules += ' DGTLJAe11';
    rules += ' _oa11';
    rules += ' K40ub4c11';
    rules += ' _Na11';
    rules += ' Pa11';
    rules += ' Tt11';
    rules += ' Qt11';
    rules += ' St11';
    rules += ' Rt11';
    rules += ' uk11';
    rules += ' ucJ9TBTb11';
    rules += ' ud3Euai11';
    rules += ' uea11';
    rules += ' ugb11';
    rules += ' uhd11';
    rules += ' uje11';
    rules += ' u2NhKxcl11';
    rules += ' uic11';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e11';
        rules += ' vx11';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d11';
        rules += ' vx11';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b11';
        rules += ' vx11';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a11';
        rules += ' vx11';
    } else {
        rules += ' -_6BNtrc-c11';
        rules += ' vx11';
    }
    rules += ' __ya11';
    return rules;
};
const $b41c15d27fbaff7d$var$invalidBorder = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec11';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn11';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b11';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd11';
    else rules += ' -SFnbic-_Jb11';
    rules += ' -Bu7z1c-ob11';
    rules += ' oj11';
    rules += ' nj11';
    rules += ' kj11';
    rules += ' jj11';
    rules += ' _Pa11';
    rules += ' Wr11';
    rules += ' _Er11';
    rules += ' _lr11';
    rules += ' _Rr11';
    rules += ' _Ob11';
    rules += ' _jf11';
    rules += ' _kc11';
    rules += ' hc11';
    rules += ' mc11';
    rules += ' lc11';
    if (props.isPressed) rules += ' im11';
    else if (props.isFocusVisible) rules += ' im11';
    else if (props.isHovered) rules += ' im11';
    else rules += ' ip11';
    rules += ' Yd11';
    rules += ' Xb11';
    rules += ' _2b11';
    return rules;
};
const $b41c15d27fbaff7d$var$valueStyles = function anonymous(props) {
    let rules = " ";
    if (props.isQuiet) rules += ' _ua11';
    else rules += ' _ub11';
    rules += ' _Nc11';
    rules += ' Pc11';
    rules += ' _Yb11';
    rules += ' _7c11';
    rules += ' sd11';
    rules += ' eb11';
    rules += ' Fb11';
    return rules;
};
const $b41c15d27fbaff7d$var$iconStyles = function anonymous(props) {
    let rules = " ";
    rules += ' _va11';
    rules += ' _Sd11';
    rules += ' -_8sjo0b-t5ZbAob11';
    if (props.isLoading) rules += ' pp11';
    return rules;
};
const $b41c15d27fbaff7d$var$avatar = " z2U5Crc11 y2U5Crc11 B2U5Crc11 A2U5Crc11 Ht11 Hsu11";
const $b41c15d27fbaff7d$var$loadingWrapperStyles = " z2mU11 yzZKy11 sd11 eb11 _Ca11 Jv11 Gv11";
const $b41c15d27fbaff7d$var$progressCircleStyles = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' Zp11';
    else if (props.size === "L") rules += ' Zn11';
    else if (props.size === "M") rules += ' Zm11';
    else if (props.size === "S") rules += ' Zu11';
    if (props.size === "XL") rules += ' Fq11';
    else if (props.size === "L") rules += ' Fo11';
    else if (props.size === "M") rules += ' Fn11';
    else if (props.size === "S") rules += ' Ft11';
    return rules;
};
let $b41c15d27fbaff7d$var$InternalPickerContext = /*#__PURE__*/ (0, $c77I5$createContext)({
    size: 'M'
});
let $b41c15d27fbaff7d$var$InsideSelectValueContext = /*#__PURE__*/ (0, $c77I5$createContext)(false);
const $b41c15d27fbaff7d$export$ba25329847403e11 = /*#__PURE__*/ (0, $c77I5$forwardRef)(function Picker(props1, ref) {
    let stringFormatter = (0, $c77I5$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c77I5$intlStringsmjs))), '@react-spectrum/s2');
    [props1, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props1, ref, $b41c15d27fbaff7d$export$b72b8dade9393cd5);
    let domRef = (0, $c77I5$useFocusableRef)(ref);
    let formContext = (0, $c77I5$useContext)((0, $9b916426527cebe7$export$c24727297075ec6a));
    props1 = (0, $9b916426527cebe7$export$a6b5be5c6b451665)(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, renderValue: renderValue, 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, $c77I5$useMemo)(()=>loadingState === 'loading', [
        loadingState
    ]);
    let spinnerId = (0, $c77I5$useSlotId)([
        showButtonSpinner
    ]);
    let listBoxLoadingCircle = /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBoxLoadMoreItem), {
        className: $b41c15d27fbaff7d$var$loadingWrapperStyles,
        isLoading: loadingState === 'loadingMore',
        onLoadMore: onLoadMore,
        children: /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$PickerProgressCircle, {
            size: size,
            "aria-label": stringFormatter.format('table.loadingMore')
        })
    });
    if (typeof children === 'function' && items) renderer = /*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
        children: [
            /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Collection), {
                items: items,
                dependencies: props1.dependencies,
                children: children
            }),
            listBoxLoadingCircle
        ]
    });
    else renderer = /*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
        children: [
            children,
            listBoxLoadingCircle
        ]
    });
    let scale = (0, $859432f3b3573fcb$export$a8d2043b2d807f4d)();
    let { direction: dir } = (0, $c77I5$useLocale)();
    let RTLFlipOffset = dir === 'rtl' ? -1 : 1;
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$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 = String(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 += ' se11';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU11';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG11';
                }
            }
            if (props.isInForm) rules += ' DLwlgod11';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb11';
                else if (props.labelPosition === "top") rules += ' DM8Mfn11';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb11';
            else if (props.labelPosition === "top") rules += ' E4w1sLc11';
            if (props.labelPosition === "side") rules += ' CbRM95c11';
            else if (props.labelPosition === "top") rules += ' Cxaocre11';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e11';
                rules += ' vx11';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d11';
                rules += ' vx11';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b11';
                rules += ' vx11';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a11';
                rules += ' vx11';
            } else {
                rules += ' -_6BNtrc-c11';
                rules += ' vx11';
            }
            rules += ' ea11';
            rules += ' _Fd11';
            rules += ' _FnuYUweb11';
            if (props.size === "XL") rules += ' -BhX7R-Fz11';
            else if (props.size === "L") rules += ' -BhX7R-Fv11';
            else if (props.size === "S") rules += ' -BhX7R-Fp11';
            else if (props.size === "XS") rules += ' -BhX7R-Fn11';
            else rules += ' -BhX7R-Fx11';
            rules += ' -AJjOLd-UVkF0Db11';
            rules += ' qg11';
            rules += ' __ca11';
            return rules;
        }({
            isInForm: !!formContext,
            labelPosition: labelPosition,
            size: size
        }, props1.styles),
        children: ({ isDisabled: isDisabled, isOpen: isOpen, isFocusVisible: isFocusVisible, isInvalid: isInvalid, isRequired: isRequired })=>/*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Fragment), {
                children: /*#__PURE__*/ (0, $c77I5$jsxs)($b41c15d27fbaff7d$var$InternalPickerContext.Provider, {
                    value: {
                        size: size
                    },
                    children: [
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                            includeNecessityIndicatorInAccessibilityName: true,
                            isDisabled: isDisabled,
                            isRequired: isRequired,
                            size: size,
                            labelPosition: labelPosition,
                            labelAlign: labelAlign,
                            isQuiet: isQuiet,
                            necessityIndicator: necessityIndicator,
                            contextualHelp: props1.contextualHelp,
                            children: label
                        }),
                        /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$PickerButton, {
                            loadingState: loadingState,
                            renderValue: renderValue,
                            isOpen: isOpen,
                            isQuiet: isQuiet,
                            isFocusVisible: isFocusVisible,
                            size: size,
                            isInvalid: isInvalid,
                            isDisabled: isDisabled,
                            buttonRef: domRef,
                            loadingCircle: /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$PickerProgressCircle, {
                                id: spinnerId,
                                size: size,
                                "aria-label": stringFormatter.format('table.loading')
                            })
                        }),
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $9afd80978c252040$export$a67c0bc59081311a), {
                            size: size,
                            isDisabled: isDisabled,
                            isInvalid: isInvalid,
                            description: descriptionMessage,
                            children: errorMessage
                        }),
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Virtualizer), {
                            layout: (0, $c77I5$ListLayout),
                            layoutOptions: {
                                estimatedRowHeight: 32,
                                estimatedHeadingHeight: 50,
                                padding: 8,
                                loaderHeight: (0, $a2f262fac286a920$export$83379f5245567d78)[size][scale]
                            },
                            children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $88b746eba92c8d0d$export$5b6b19405a83ff9d), {
                                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 += ' Nh11';
                                    else rules += ' NuHSBze11';
                                    if (props.isQuiet) rules += ' ZbWuche11';
                                    else rules += ' ZuHSBze11';
                                    return rules;
                                }(props1),
                                children: /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                                    className: " sd11 Za11 Fb11",
                                    children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Provider), {
                                        values: [
                                            [
                                                (0, $8e847109a6ab556d$export$e0e4026c12a8bdbb),
                                                {
                                                    styles: (0, $a2f262fac286a920$export$c040ba7a724e8da1)({
                                                        size: size
                                                    })
                                                }
                                            ],
                                            [
                                                (0, $8e847109a6ab556d$export$d688439359537581),
                                                {
                                                    // @ts-ignore
                                                    role: 'presentation',
                                                    styles: (0, $13afb0ea5f0ed767$export$300ac6f106ef584d)
                                                }
                                            ],
                                            [
                                                (0, $8e847109a6ab556d$export$9afb8bc826b033ea),
                                                {
                                                    slots: {
                                                        description: {
                                                            styles: (0, $13afb0ea5f0ed767$export$6d59db4903f20f7d)({
                                                                size: size
                                                            })
                                                        }
                                                    }
                                                }
                                            ]
                                        ],
                                        children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBox), {
                                            dependencies: props1.dependencies,
                                            items: items,
                                            className: (0, $a2f262fac286a920$export$9901d82449b93cea)({
                                                size: size
                                            }),
                                            children: renderer
                                        })
                                    })
                                })
                            })
                        })
                    ]
                })
            })
    });
});
function $b41c15d27fbaff7d$var$PickerProgressCircle(props) {
    let { id: id, size: size, 'aria-label': ariaLabel } = props;
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $41ddd91dbbf0c389$export$c79b9d6b4cc92af7), {
        id: id,
        isIndeterminate: true,
        size: "S",
        "aria-label": ariaLabel,
        styles: $b41c15d27fbaff7d$var$progressCircleStyles({
            size: size
        })
    });
}
const $b41c15d27fbaff7d$var$avatarSize = {
    S: 16,
    M: 20,
    L: 22,
    XL: 26
};
// https://w3c.github.io/aria/#widget_roles
let $b41c15d27fbaff7d$var$INTERACTIVE_ARIA_ROLES = new Set([
    'application',
    'button',
    'checkbox',
    'combobox',
    'gridcell',
    'link',
    'menuitem',
    'menuitemcheckbox',
    'menuitemradio',
    'option',
    'radio',
    'searchbox',
    'separator',
    'slider',
    'spinbutton',
    'switch',
    'tab',
    'textbox',
    'treeitem'
]);
// Needs to be hidable component or otherwise the PressResponder throws a warning when rendered in the fake DOM and tries to register
const $b41c15d27fbaff7d$var$PickerButton = (0, $c77I5$createHideableComponent)(function PickerButton(props) {
    let { isOpen: isOpen, isQuiet: isQuiet, isFocusVisible: isFocusVisible, size: size, isInvalid: isInvalid, isDisabled: isDisabled, loadingState: loadingState, loadingCircle: loadingCircle, buttonRef: buttonRef, renderValue: renderValue } = props;
    let stringFormatter = (0, $c77I5$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c77I5$intlStringsmjs))), '@react-spectrum/s2');
    let renderValueRef = (0, $c77I5$useRef)(null);
    let state = (0, $c77I5$useContext)((0, $c77I5$SelectStateContext));
    (0, $c77I5$useEffect)(()=>{
        if (process.env.NODE_ENV === 'production' || !renderValue) return;
        if (!renderValueRef.current) return;
        let doc = (0, $c77I5$getOwnerDocument)(renderValueRef.current);
        let walker = (0, $c77I5$createShadowTreeWalker)(doc, renderValueRef.current, NodeFilter.SHOW_ELEMENT, {
            acceptNode (node) {
                let role = node.getAttribute('role');
                let interactive = (0, $c77I5$isFocusable)(node) || role != null && $b41c15d27fbaff7d$var$INTERACTIVE_ARIA_ROLES.has(role);
                return interactive ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
            }
        });
        let next = walker.nextNode();
        if (next) console.warn('Picker\'s value should not have interactive children for accessibility.');
    }, [
        state.selectedItems,
        renderValue
    ]);
    // 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, $c77I5$useState)(false);
    let { addGlobalListener: addGlobalListener } = (0, $c77I5$useGlobalListeners)();
    let onPressStart = (e)=>{
        if (e.pointerType !== 'mouse') return;
        setPressed(true);
        addGlobalListener(document, 'pointerup', ()=>{
            setPressed(false);
        }, {
            once: true,
            capture: true
        });
    };
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$PressResponder), {
        onPressStart: onPressStart,
        isPressed: isPressed,
        children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Button), {
            ref: buttonRef,
            style: (renderProps)=>(0, $10ea7662e51a285b$export$56e8cba416805d8d)(buttonRef)(renderProps),
            // Prevent press scale from sticking while Picker is open.
            // @ts-ignore
            isPressed: false,
            className: (renderProps)=>$b41c15d27fbaff7d$var$inputButton({
                    ...renderProps,
                    size: size,
                    isOpen: isOpen,
                    isQuiet: isQuiet
                }),
            children: (renderProps)=>/*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
                    children: [
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$SelectValue), {
                            className: $b41c15d27fbaff7d$var$valueStyles({
                                isQuiet: isQuiet
                            }) + (renderValue ? '' : " pqYuhc"),
                            children: ({ selectedItems: selectedItems, defaultChildren: defaultChildren })=>{
                                const selectedValues = selectedItems.filter((item)=>item != null);
                                const defaultRenderedValue = selectedItems.length <= 1 ? defaultChildren : /*#__PURE__*/ (0, $c77I5$jsx)((0, $8e847109a6ab556d$export$5f1af8db9871e1d6), {
                                    slot: "label",
                                    children: stringFormatter.format('picker.selectedCount', {
                                        count: selectedItems.length
                                    })
                                });
                                const renderedValue = selectedItems.length > 0 && renderValue ? renderValue(selectedValues) : defaultRenderedValue;
                                return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Provider), {
                                    values: [
                                        [
                                            (0, $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed),
                                            {
                                                slots: {
                                                    icon: {
                                                        render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
                                                            slot: 'icon',
                                                            styles: (0, $13afb0ea5f0ed767$export$31d1842a0fd736e6)
                                                        }),
                                                        styles: (0, $13afb0ea5f0ed767$export$1ca1ec8b29a4ce27)
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            (0, $3ffa2cd930156220$export$a20dad690e1279e2),
                                            {
                                                slots: {
                                                    avatar: {
                                                        size: $b41c15d27fbaff7d$var$avatarSize[size ?? 'M'],
                                                        styles: $b41c15d27fbaff7d$var$avatar
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            (0, $8e847109a6ab556d$export$9afb8bc826b033ea),
                                            {
                                                slots: {
                                                    description: {},
                                                    [(0, $c77I5$DEFAULT_SLOT)]: {
                                                        styles: " sb11 _ub11 _Nc11 Pc11 _Yb11 _7c11",
                                                        // @ts-ignore
                                                        'data-slot': 'label'
                                                    },
                                                    label: {
                                                        styles: " sb11 _ub11 _Nc11 Pc11 _Yb11 _7c11",
                                                        // @ts-ignore not technically necessary, but good for consistency
                                                        'data-slot': 'label'
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            $b41c15d27fbaff7d$var$InsideSelectValueContext,
                                            true
                                        ]
                                    ],
                                    children: renderValue ? /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                                        ref: renderValueRef,
                                        style: {
                                            display: 'contents'
                                        },
                                        children: renderedValue
                                    }) : renderedValue
                                });
                            }
                        }),
                        isInvalid && /*#__PURE__*/ (0, $c77I5$jsx)((0, $9afd80978c252040$export$bda0d075e0e342c9), {
                            isDisabled: isDisabled
                        }),
                        loadingState === 'loading' && !isOpen && loadingCircle,
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $4b69f02ec06b9226$export$2e2bcd8739ae039), {
                            size: size,
                            className: $b41c15d27fbaff7d$var$iconStyles({
                                isLoading: loadingState === 'loading'
                            })
                        }),
                        isFocusVisible && isQuiet && /*#__PURE__*/ (0, $c77I5$jsx)("span", {
                            className: $b41c15d27fbaff7d$var$quietFocusLine
                        }),
                        isInvalid && !isDisabled && !isQuiet && // @ts-ignore known limitation detecting functions from the theme
                        /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                            className: $b41c15d27fbaff7d$var$invalidBorder({
                                ...renderProps,
                                size: size
                            })
                        })
                    ]
                })
        })
    });
});
const $b41c15d27fbaff7d$var$checkmarkIconSize = {
    S: 'XS',
    M: 'M',
    L: 'L',
    XL: 'XL'
};
function $b41c15d27fbaff7d$export$d601881f38163e28(props) {
    let ref = (0, $c77I5$useRef)(null);
    let isLink = props.href != null;
    let { size: size } = (0, $c77I5$useContext)($b41c15d27fbaff7d$var$InternalPickerContext);
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBoxItem), {
        ...props,
        ref: ref,
        textValue: props.textValue || (typeof props.children === 'string' ? props.children : undefined),
        style: (0, $10ea7662e51a285b$export$56e8cba416805d8d)(ref, props.UNSAFE_style),
        className: (renderProps)=>(props.UNSAFE_className || '') + (0, $a2f262fac286a920$export$68265fb354482bae)({
                ...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, $c77I5$jsx)($b41c15d27fbaff7d$var$DefaultProvider, {
                context: (0, $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed),
                value: {
                    slots: {
                        icon: {
                            render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
                                slot: 'icon',
                                styles: (0, $13afb0ea5f0ed767$export$31d1842a0fd736e6)
                            }),
                            styles: (0, $13afb0ea5f0ed767$export$1ca1ec8b29a4ce27)
                        }
                    }
                },
                children: /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$DefaultProvider, {
                    context: (0, $3ffa2cd930156220$export$a20dad690e1279e2),
                    value: {
                        slots: {
                            avatar: {
                                size: $b41c15d27fbaff7d$var$avatarSize[size],
                                styles: $b41c15d27fbaff7d$var$avatar
                            }
                        }
                    },
                    children: /*#__PURE__*/ (0, $c77I5$jsxs)($b41c15d27fbaff7d$var$DefaultProvider, {
                        context: (0, $8e847109a6ab556d$export$9afb8bc826b033ea),
                        value: {
                            slots: {
                                [(0, $c77I5$DEFAULT_SLOT)]: {
                                    styles: (0, $13afb0ea5f0ed767$export$1237798dc640739a)({
                                        size: size
                                    })
                                },
                                label: {
                                    styles: (0, $13afb0ea5f0ed767$export$1237798dc640739a)({
                                        size: size
                                    })
                                },
                                description: {
                                    styles: (0, $13afb0ea5f0ed767$export$6d59db4903f20f7d)({
                                        ...renderProps,
                                        size: size
                                    })
                                }
                            }
                        },
                        children: [
                            renderProps.selectionMode === 'single' && !isLink && /*#__PURE__*/ (0, $c77I5$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
                                size: $b41c15d27fbaff7d$var$checkmarkIconSize[size],
                                className: (0, $13afb0ea5f0ed767$export$292abbf31ed842a)({
                                    ...renderProps,
                                    size: size
                                })
                            }),
                            renderProps.selectionMode === 'multiple' && !isLink && /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                                className: (0, $feb886035e0d4633$export$e618dc39ac9ad607)((0, $13afb0ea5f0ed767$export$b07e517d22efa1ca), (0, $9b405e0f8095dce0$export$827f4ee28efc37)(checkboxRenderProps)),
                                children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
                                    size: size,
                                    className: (0, $9b405e0f8095dce0$export$2c99b98b77550cb4)
                                })
                            }),
                            typeof children === 'string' ? /*#__PURE__*/ (0, $c77I5$jsx)((0, $8e847109a6ab556d$export$5f1af8db9871e1d6), {
                                slot: "label",
                                children: children
                            }) : children
                        ]
                    })
                })
            });
        }
    });
}
// A Context.Provider that only sets a value if not inside SelectValue.
function $b41c15d27fbaff7d$var$DefaultProvider({ context: context, value: value, children: children }) {
    let inSelectValue = (0, $c77I5$useContext)($b41c15d27fbaff7d$var$InsideSelectValueContext);
    if (inSelectValue) return children;
    return /*#__PURE__*/ (0, $c77I5$jsx)(context.Provider, {
        value: value,
        children: children
    });
}
function $b41c15d27fbaff7d$export$a340772aca6155cd(props) {
    let { size: size } = (0, $c77I5$useContext)($b41c15d27fbaff7d$var$InternalPickerContext);
    return /*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
        children: [
            /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBoxSection), {
                ...props,
                children: props.children
            }),
            /*#__PURE__*/ (0, $c77I5$jsx)((0, $a2f262fac286a920$export$2e0a83ec2e27ecbb), {
                size: size
            })
        ]
    });
}


export {$b41c15d27fbaff7d$export$b72b8dade9393cd5 as PickerContext, $b41c15d27fbaff7d$export$b1e5508a851be14d as menu, $b41c15d27fbaff7d$export$ba25329847403e11 as Picker, $b41c15d27fbaff7d$export$d601881f38163e28 as PickerItem, $b41c15d27fbaff7d$export$a340772aca6155cd as PickerSection};
//# sourceMappingURL=Picker.mjs.map
