require("./ComboBox.css");
var $38071d9ce246d4cf$exports = require("./Avatar.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 $150382364eecc4bc$exports = require("./useDOMRef.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 $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 $1KUtr$reactjsxruntime = require("react/jsx-runtime");
var $1KUtr$reactariacomponentsComboBox = require("react-aria-components/ComboBox");
var $1KUtr$reactariacomponentsListBox = require("react-aria-components/ListBox");
var $1KUtr$reactariaprivatecollectionsBaseCollection = require("react-aria/private/collections/BaseCollection");
var $1KUtr$reactariacomponentsButton = require("react-aria-components/Button");
var $1KUtr$reactariaCollection = require("react-aria/Collection");
var $1KUtr$reactariacomponentsslots = require("react-aria-components/slots");
var $1KUtr$react = require("react");
var $1KUtr$reactariaCollectionBuilder = require("react-aria/CollectionBuilder");
var $1KUtr$reactariacomponentsInput = require("react-aria-components/Input");
var $1KUtr$reactstatelyuseVirtualizerState = require("react-stately/useVirtualizerState");
var $1KUtr$reactariamergeRefs = require("react-aria/mergeRefs");
var $1KUtr$reactariauseLocalizedStringFormatter = require("react-aria/useLocalizedStringFormatter");
var $1KUtr$reactariaprivateutilsuseResizeObserver = require("react-aria/private/utils/useResizeObserver");
var $1KUtr$reactariaprivateutilsuseId = require("react-aria/private/utils/useId");
var $1KUtr$reactariacomponentsVirtualizer = require("react-aria-components/Virtualizer");


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, "ComboBoxContext", () => $a2d5b35c01bebcd6$export$d414ccceff7063c3);
$parcel$export(module.exports, "listbox", () => $a2d5b35c01bebcd6$export$9901d82449b93cea);
$parcel$export(module.exports, "listboxItem", () => $a2d5b35c01bebcd6$export$68265fb354482bae);
$parcel$export(module.exports, "listboxHeader", () => $a2d5b35c01bebcd6$export$c040ba7a724e8da1);
$parcel$export(module.exports, "LOADER_ROW_HEIGHTS", () => $a2d5b35c01bebcd6$export$83379f5245567d78);
$parcel$export(module.exports, "ComboBox", () => $a2d5b35c01bebcd6$export$72b9695b8216309a);
$parcel$export(module.exports, "ComboBoxItem", () => $a2d5b35c01bebcd6$export$b674b8ff01584ab1);
$parcel$export(module.exports, "ComboBoxSection", () => $a2d5b35c01bebcd6$export$5510125537491b61);
$parcel$export(module.exports, "Divider", () => $a2d5b35c01bebcd6$export$2e0a83ec2e27ecbb);
/*
 * 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 $a2d5b35c01bebcd6$export$d414ccceff7063c3 = /*#__PURE__*/ (0, $1KUtr$react.createContext)(null);
const $a2d5b35c01bebcd6$var$inputButton = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec12';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn12';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b12';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd12';
    else rules += ' -SFnbic-_Jb12';
    rules += ' -Bu7z1c-oa12';
    rules += ' oj12';
    rules += ' nj12';
    rules += ' kj12';
    rules += ' jj12';
    rules += ' sd12';
    rules += ' _Le12';
    rules += ' _Wa12';
    rules += ' _je12';
    rules += ' eb12';
    rules += ' _Ca12';
    if (props.size === "XL") rules += ' ZC12';
    else if (props.size === "L") rules += ' Zo12';
    else if (props.size === "M") rules += ' Zm12';
    else if (props.size === "S") rules += ' Zu12';
    if (props.size === "XL") rules += ' Fx12';
    else if (props.size === "L") rules += ' Fp12';
    else if (props.size === "M") rules += ' Fn12';
    else if (props.size === "S") rules += ' Ft12';
    rules += ' Iw12';
    rules += ' fa12';
    rules += ' _va12';
    rules += ' Yd12';
    rules += ' Yle12';
    rules += ' Xb12';
    rules += ' Xlb12';
    rules += ' _2b12';
    rules += ' _2lb12';
    if (props.isDisabled) rules += ' gH12';
    else if (props.isOpen) rules += ' gF12';
    else {
        if (props.isPressed) rules += ' gF12';
        else if (props.isFocusVisible) rules += ' gF12';
        else if (props.isHovered) rules += ' gF12';
        else rules += ' gH12';
    }
    if (props.isDisabled) rules += ' gld12';
    else if (props.isOpen) rules += ' gle12';
    else if (props.isHovered) rules += ' gle12';
    else rules += ' glc12';
    if (props.isDisabled) rules += ' pp12';
    else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    rules += ' pla12';
    return rules;
};
const $a2d5b35c01bebcd6$var$iconStyles = " _va12 _Sd12 -_8sjo0b-t5ZbAob12";
const $a2d5b35c01bebcd6$var$loadingWrapperStyles = " z2mU12 yzZKy12 sd12 eb12 _Ca12 Jv12 Gv12";
const $a2d5b35c01bebcd6$var$progressCircleStyles = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' Zp12';
    else if (props.size === "L") rules += ' Zn12';
    else if (props.size === "M") rules += ' Zm12';
    else if (props.size === "S") rules += ' Zu12';
    if (props.size === "XL") rules += ' Fq12';
    else if (props.size === "L") rules += ' Fo12';
    else if (props.size === "M") rules += ' Fn12';
    else if (props.size === "S") rules += ' Ft12';
    if (props.isInput) {
        rules += ' It12';
        rules += ' Isu12';
    }
    return rules;
};
const $a2d5b35c01bebcd6$var$emptyStateText = function anonymous(props) {
    let rules = " ";
    rules += ' FRuFGYc12';
    if (props.size === "XL") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "L") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "M") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "S") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "M") {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    }
    if (props.size === "XL") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "L") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "M") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "S") {
        rules += ' xb12';
        rules += ' _xa12';
    }
    if (props.size === "XL") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "L") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "M") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "S") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    }
    if (props.size === "XL") rules += ' pt12';
    else if (props.size === "L") rules += ' pt12';
    else if (props.size === "M") rules += ' pt12';
    else if (props.size === "S") rules += ' pt12';
    rules += ' sd12';
    rules += ' eb12';
    rules += ' Sv12';
    if (props.size === "XL") rules += ' -F_-Fz12';
    else if (props.size === "L") rules += ' -F_-Fv12';
    else if (props.size === "M") rules += ' -F_-Fx12';
    else if (props.size === "S") rules += ' -F_-Fp12';
    return rules;
};
let $a2d5b35c01bebcd6$export$9901d82449b93cea = function anonymous(props) {
    let rules = " ";
    rules += ' Za12';
    rules += ' _oa12';
    rules += ' K40ub4c12';
    rules += ' Pa12';
    rules += ' _Nc12';
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    rules += ' _Le12';
    return rules;
};
let $a2d5b35c01bebcd6$export$68265fb354482bae = function anonymous(props, overrides) {
    let rules = " ";
    let minWidth = false;
    let position = false;
    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] === "N") minWidth = true;
        if (p[1] === "_P") position = true;
        if (p[1] === "z") gridColumnStart = true;
        if (p[1] === "y") gridColumnEnd = true;
        rules += p[0];
    }
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    if (props.size === "XL") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "L") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "S") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "XS") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    if (props.size === "XL") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "L") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "S") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "XS") {
        rules += ' xb12';
        rules += ' _xa12';
    } else {
        rules += ' xb12';
        rules += ' _xa12';
    }
    if (props.size === "XL") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "L") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "S") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "XS") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    }
    if (props.isDisabled) {
        rules += ' pp12';
        rules += ' plc12';
    } else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    rules += ' se12';
    rules += ' ea12';
    rules += ' _oa12';
    rules += ' Sd12';
    rules += ' Rd12';
    if (props.size === "XL") {
        if (!minWidth) rules += ' Nl12';
    } else if (props.size === "L") {
        if (!minWidth) rules += ' Nj12';
    } else if (props.size === "S") {
        if (!minWidth) rules += ' Nf12';
    } else if (props.size === "XS") {
        if (!minWidth) rules += ' Ne12';
    } else if (!minWidth) rules += ' Nk12';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec12';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn12';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b12';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd12';
    else rules += ' -SFnbic-_Jb12';
    rules += ' -Bu7z1c-ob12';
    rules += ' oj12';
    rules += ' nj12';
    rules += ' kj12';
    rules += ' jj12';
    rules += ' qh12';
    rules += ' -Qg41Lb-IAxCW0c12';
    rules += ' -Qg41Lb-gLWx3bIy12';
    rules += ' MAyFGYc12';
    rules += ' Td12';
    rules += ' QAzEcG12';
    rules += ' -aRvJDd-Tu7Fubd12';
    if (props.isFocused) rules += ' gF12';
    else rules += ' g912';
    if (!position) rules += ' _Pc12';
    if (!gridColumnStart) rules += ' z2mU12';
    if (!gridColumnEnd) rules += ' yzZKy12';
    rules += ' CHV1uCd12';
    if (props.size === "XL") rules += ' DTw5ujc12';
    else if (props.size === "L") rules += ' DdpPw412';
    else if (props.size === "M") rules += ' Dxy3qDe12';
    else if (props.size === "S") rules += ' DfLJE012';
    rules += ' EpvfBwb12';
    rules += ' EDNKd2dZQmDFe12';
    rules += ' UDNKd2dai5a012';
    rules += ' FF12';
    rules += ' _Xa12';
    if (props.isLink) rules += ' ry12';
    else rules += ' ri12';
    rules += ' Yd12';
    rules += ' Xb12';
    rules += ' _2b12';
    if (props.size === "XL") rules += ' -M_-Mk12';
    else if (props.size === "L") rules += ' -M_-Mh12';
    else if (props.size === "S") rules += ' -M_-Mg12';
    else if (props.size === "XS") rules += ' -M_-Mf12';
    else rules += ' -M_-Mi12';
    return rules;
};
let $a2d5b35c01bebcd6$export$c040ba7a724e8da1 = function anonymous(props) {
    let rules = " ";
    rules += ' pt12';
    rules += ' _oa12';
    rules += ' MAyFGYc12';
    rules += ' Tu7Fubd12';
    rules += ' Qu7Fubd12';
    if (props.size === "XL") rules += ' I2d3n12';
    else if (props.size === "L") rules += ' IaxPIqb12';
    else if (props.size === "M") rules += ' Ip2UVod12';
    else if (props.size === "S") rules += ' IH8XZ7c12';
    if (props.size === "XL") rules += ' H2d3n12';
    else if (props.size === "L") rules += ' HaxPIqb12';
    else if (props.size === "M") rules += ' Hp2UVod12';
    else if (props.size === "S") rules += ' HH8XZ7c12';
    if (props.size === "XL") rules += ' -M_-Mk12';
    else if (props.size === "L") rules += ' -M_-Mh12';
    else if (props.size === "S") rules += ' -M_-Mg12';
    else if (props.size === "XS") rules += ' -M_-Mf12';
    else rules += ' -M_-Mi12';
    return rules;
};
const $a2d5b35c01bebcd6$var$separatorWrapper = function anonymous(props) {
    let rules = " ";
    rules += ' sd12';
    if (props.size === "XL") rules += ' I2d3n12';
    else if (props.size === "L") rules += ' IaxPIqb12';
    else if (props.size === "M") rules += ' Ip2UVod12';
    else if (props.size === "S") rules += ' IH8XZ7c12';
    if (props.size === "XL") rules += ' H2d3n12';
    else if (props.size === "L") rules += ' HaxPIqb12';
    else if (props.size === "M") rules += ' Hp2UVod12';
    else if (props.size === "S") rules += ' HH8XZ7c12';
    rules += ' Fk12';
    rules += ' eb12';
    return rules;
};
const $a2d5b35c01bebcd6$var$dividerStyle = " gF12 gl_a12 og12 ng12 kg12 jg12 FLvNfn12 Za12";
const $a2d5b35c01bebcd6$var$avatar = " z2U5Crc12 y2U5Crc12 B2U5Crc12 A2U5Crc12 Ht12 Hsu12";
const $a2d5b35c01bebcd6$export$83379f5245567d78 = {
    S: {
        medium: 24,
        large: 30
    },
    M: {
        medium: 32,
        large: 40
    },
    L: {
        medium: 40,
        large: 50
    },
    XL: {
        medium: 48,
        large: 60
    }
};
let $a2d5b35c01bebcd6$var$InternalComboboxContext = /*#__PURE__*/ (0, $1KUtr$react.createContext)({
    size: 'M'
});
const $a2d5b35c01bebcd6$export$72b9695b8216309a = /*#__PURE__*/ (0, $1KUtr$react.forwardRef)(function ComboBox(props1, ref) {
    [props1, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props1, ref, $a2d5b35c01bebcd6$export$d414ccceff7063c3);
    let formContext = (0, $1KUtr$react.useContext)((0, $bfa4962d90c8af48$exports.FormContext));
    props1 = (0, $bfa4962d90c8af48$exports.useFormProps)(props1);
    let { size: size = 'M', labelPosition: labelPosition = 'top', UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, ...comboBoxProps } = props1;
    return /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsComboBox.ComboBox), {
        ...comboBoxProps,
        allowsEmptyCollection: true,
        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 += ' se12';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU12';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG12';
                }
            }
            if (props.isInForm) rules += ' DLwlgod12';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb12';
                else if (props.labelPosition === "top") rules += ' DM8Mfn12';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb12';
            else if (props.labelPosition === "top") rules += ' E4w1sLc12';
            if (props.labelPosition === "side") rules += ' CbRM95c12';
            else if (props.labelPosition === "top") rules += ' Cxaocre12';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e12';
                rules += ' vx12';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d12';
                rules += ' vx12';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b12';
                rules += ' vx12';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a12';
                rules += ' vx12';
            } else {
                rules += ' -_6BNtrc-c12';
                rules += ' vx12';
            }
            rules += ' ea12';
            rules += ' _Fd12';
            rules += ' _FnuYUweb12';
            if (props.size === "XL") rules += ' -BhX7R-Fz12';
            else if (props.size === "L") rules += ' -BhX7R-Fv12';
            else if (props.size === "S") rules += ' -BhX7R-Fp12';
            else if (props.size === "XS") rules += ' -BhX7R-Fn12';
            else rules += ' -BhX7R-Fx12';
            rules += ' -AJjOLd-UVkF0Db12';
            rules += ' qg12';
            rules += ' __ca12';
            return rules;
        }({
            isInForm: !!formContext,
            labelPosition: labelPosition,
            size: size
        }, props1.styles),
        children: ({ isDisabled: isDisabled, isOpen: isOpen, isRequired: isRequired, isInvalid: isInvalid })=>/*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)($a2d5b35c01bebcd6$var$ComboboxInner, {
                ...props1,
                isDisabled: isDisabled,
                isOpen: isOpen,
                isRequired: isRequired,
                isInvalid: isInvalid,
                ref: ref
            })
    });
});
const $a2d5b35c01bebcd6$var$avatarSize = {
    S: 16,
    M: 20,
    L: 22,
    XL: 26
};
const $a2d5b35c01bebcd6$var$checkmarkIconSize = {
    S: 'XS',
    M: 'M',
    L: 'L',
    XL: 'XL'
};
function $a2d5b35c01bebcd6$export$b674b8ff01584ab1(props) {
    let ref = (0, $1KUtr$react.useRef)(null);
    let isLink = props.href != null;
    let { size: size } = (0, $1KUtr$react.useContext)($a2d5b35c01bebcd6$var$InternalComboboxContext);
    return /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsListBox.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 || '') + $a2d5b35c01bebcd6$export$68265fb354482bae({
                ...renderProps,
                size: size,
                isLink: isLink
            }, props.styles),
        children: (renderProps)=>{
            let { children: children } = props;
            return /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactjsxruntime.Fragment), {
                children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsxs)((0, $1KUtr$reactariacomponentsslots.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: $a2d5b35c01bebcd6$var$avatarSize[size],
                                        styles: $a2d5b35c01bebcd6$var$avatar
                                    }
                                }
                            }
                        ],
                        [
                            (0, $6367bc87eb7d24ad$exports.TextContext),
                            {
                                slots: {
                                    label: {
                                        styles: (0, $e741ea6b88ce4866$exports.label)({
                                            size: size
                                        })
                                    },
                                    description: {
                                        styles: (0, $e741ea6b88ce4866$exports.description)({
                                            ...renderProps,
                                            size: size
                                        })
                                    }
                                }
                            }
                        ]
                    ],
                    children: [
                        !isLink && !props.onAction && /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $dba2b18fc5727f9b$exports.default), {
                            size: $a2d5b35c01bebcd6$var$checkmarkIconSize[size],
                            className: (0, $e741ea6b88ce4866$exports.checkmark)({
                                ...renderProps,
                                size: size
                            })
                        }),
                        typeof children === 'string' ? /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
                            slot: "label",
                            children: children
                        }) : children
                    ]
                })
            });
        }
    });
}
function $a2d5b35c01bebcd6$export$5510125537491b61(props) {
    let { size: size } = (0, $1KUtr$react.useContext)($a2d5b35c01bebcd6$var$InternalComboboxContext);
    return /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsxs)((0, $1KUtr$reactjsxruntime.Fragment), {
        children: [
            /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsListBox.ListBoxSection), {
                ...props,
                children: props.children
            }),
            /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)($a2d5b35c01bebcd6$export$2e0a83ec2e27ecbb, {
                size: size
            })
        ]
    });
}
const $a2d5b35c01bebcd6$var$ComboboxInner = /*#__PURE__*/ (0, $1KUtr$react.forwardRef)(function ComboboxInner(props1, ref) {
    let { direction: direction = 'bottom', align: align = 'start', shouldFlip: shouldFlip = true, menuWidth: menuWidth, label: label, description: descriptionMessage, errorMessage: errorMessage, children: children, defaultItems: defaultItems, items: items, size: size = 'M', labelPosition: labelPosition = 'top', labelAlign: labelAlign = 'start', necessityIndicator: necessityIndicator, loadingState: loadingState, isDisabled: isDisabled, isOpen: isOpen, isRequired: isRequired, isInvalid: isInvalid, menuTrigger: menuTrigger, onLoadMore: onLoadMore } = props1;
    let stringFormatter = (0, $1KUtr$reactariauseLocalizedStringFormatter.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    let inputRef = (0, $1KUtr$react.useRef)(null);
    let domRef = (0, $1KUtr$react.useRef)(null);
    let buttonRef = (0, $1KUtr$react.useRef)(null);
    // Expose imperative interface for ref
    (0, $1KUtr$react.useImperativeHandle)(ref, ()=>({
            ...(0, $150382364eecc4bc$exports.createFocusableRef)(domRef, inputRef),
            select () {
                if (inputRef.current) inputRef.current.select();
            },
            getInputElement () {
                return inputRef.current;
            }
        }));
    // 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 triggerRef = (0, $1KUtr$react.useRef)(null);
    // Make menu width match input + button
    let [triggerWidth, setTriggerWidth] = (0, $1KUtr$react.useState)(null);
    let onResize = (0, $1KUtr$react.useCallback)(()=>{
        if (triggerRef.current) {
            let inputRect = triggerRef.current.getBoundingClientRect();
            let minX = inputRect.left;
            let maxX = inputRect.right;
            setTriggerWidth(maxX - minX + 'px');
        }
    }, [
        triggerRef,
        setTriggerWidth
    ]);
    (0, $1KUtr$reactariaprivateutilsuseResizeObserver.useResizeObserver)({
        ref: triggerRef,
        onResize: onResize
    });
    let state = (0, $1KUtr$react.useContext)((0, $1KUtr$reactariacomponentsComboBox.ComboBoxStateContext));
    let timeout = (0, $1KUtr$react.useRef)(null);
    let [showLoading, setShowLoading] = (0, $1KUtr$react.useState)(false);
    let isLoadingOrFiltering = loadingState === 'loading' || loadingState === 'filtering';
    let showFieldSpinner = (0, $1KUtr$react.useMemo)(()=>showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'), [
        showLoading,
        isOpen,
        menuTrigger,
        loadingState
    ]);
    let spinnerId = (0, $1KUtr$reactariaprivateutilsuseId.useSlotId)([
        showFieldSpinner
    ]);
    let inputValue = state?.inputValue;
    let lastInputValue = (0, $1KUtr$react.useRef)(inputValue);
    (0, $1KUtr$react.useEffect)(()=>{
        if (isLoadingOrFiltering && !showLoading) {
            if (timeout.current === null) timeout.current = setTimeout(()=>{
                setShowLoading(true);
            }, 500);
            // If user is typing, clear the timer and restart since it is a new request
            if (inputValue !== lastInputValue.current) {
                clearTimeout(timeout.current);
                timeout.current = setTimeout(()=>{
                    setShowLoading(true);
                }, 500);
            }
        } else if (!isLoadingOrFiltering) {
            // If loading is no longer happening, clear any timers and hide the loading circle
            setShowLoading(false);
            if (timeout.current) clearTimeout(timeout.current);
            timeout.current = null;
        }
        lastInputValue.current = inputValue;
    }, [
        isLoadingOrFiltering,
        showLoading,
        inputValue
    ]);
    (0, $1KUtr$react.useEffect)(()=>{
        return ()=>{
            if (timeout.current) clearTimeout(timeout.current);
            timeout.current = null;
        };
    }, []);
    let renderer;
    let listBoxLoadingCircle = /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsListBox.ListBoxLoadMoreItem), {
        // Only show the spinner in the list when loading more
        isLoading: loadingState === 'loadingMore',
        onLoadMore: onLoadMore,
        className: $a2d5b35c01bebcd6$var$loadingWrapperStyles,
        children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1c116ea4b0d2d023$exports.ProgressCircle), {
            isIndeterminate: true,
            size: "S",
            styles: $a2d5b35c01bebcd6$var$progressCircleStyles({
                size: size
            }),
            // Same loading string as table
            "aria-label": stringFormatter.format('table.loadingMore')
        })
    });
    if (typeof children === 'function') renderer = /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsxs)((0, $1KUtr$reactjsxruntime.Fragment), {
        children: [
            /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariaCollection.Collection), {
                items: items ?? defaultItems,
                dependencies: props1.dependencies,
                children: children
            }),
            listBoxLoadingCircle
        ]
    });
    else // TODO: is there a case where the user might provide items to the Combobox but doesn't provide a function renderer?
    // Same case for other components that have this logic (TableView/CardView/Picker)
    renderer = /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsxs)((0, $1KUtr$reactjsxruntime.Fragment), {
        children: [
            children,
            listBoxLoadingCircle
        ]
    });
    let scale = (0, $ee7b4c497f520c08$exports.useScale)();
    return /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactjsxruntime.Fragment), {
        children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsxs)($a2d5b35c01bebcd6$var$InternalComboboxContext.Provider, {
            value: {
                size: size
            },
            children: [
                /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
                    isDisabled: isDisabled,
                    isRequired: isRequired,
                    size: size,
                    labelPosition: labelPosition,
                    labelAlign: labelAlign,
                    necessityIndicator: necessityIndicator,
                    contextualHelp: props1.contextualHelp,
                    children: label
                }),
                /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsxs)((0, $a0b996a550bb0891$exports.FieldGroup), {
                    ref: triggerRef,
                    role: "presentation",
                    isDisabled: isDisabled,
                    isInvalid: isInvalid,
                    size: size,
                    styles: function anonymous(props) {
                        let rules = " ";
                        rules += ' zXcEWr12';
                        rules += ' yXcEWr12';
                        rules += ' BXcEWr12';
                        rules += ' AXcEWr12';
                        if (props.size === "XL") rules += ' Nl12';
                        else if (props.size === "L") rules += ' Nj12';
                        else if (props.size === "S") rules += ' Nf12';
                        else if (props.size === "XS") rules += ' Ne12';
                        else rules += ' Nk12';
                        if (props.isQuiet) rules += ' _qd12';
                        else rules += ' _qtb12';
                        if (props.size === "XL") rules += ' -Anxdcc-Zt12';
                        else if (props.size === "L") rules += ' -Anxdcc-ZStdtne12';
                        else if (props.size === "S") rules += ' -Anxdcc-Zr12';
                        else rules += ' -Anxdcc-Z3fn9H12';
                        rules += ' __v6TNLWb12';
                        rules += ' SMBFGYc12';
                        rules += ' RfBFGYc12';
                        rules += ' -S_-Sv12';
                        rules += ' -R_-R6sYnSd12';
                        return rules;
                    }({
                        size: size
                    }),
                    children: [
                        /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsInput.InputContext).Consumer, {
                            children: (ctx)=>/*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsInput.InputContext).Provider, {
                                    value: {
                                        ...ctx,
                                        ref: (0, $1KUtr$reactariamergeRefs.mergeRefs)(ctx?.ref, inputRef)
                                    },
                                    children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.Input), {
                                        "aria-describedby": spinnerId
                                    })
                                })
                        }),
                        isInvalid && /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldErrorIcon), {
                            isDisabled: isDisabled
                        }),
                        showFieldSpinner && /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1c116ea4b0d2d023$exports.ProgressCircle), {
                            id: spinnerId,
                            isIndeterminate: true,
                            size: "S",
                            styles: $a2d5b35c01bebcd6$var$progressCircleStyles({
                                size: size,
                                isInput: true
                            }),
                            "aria-label": stringFormatter.format('table.loading')
                        }),
                        /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsButton.Button), {
                            ref: buttonRef,
                            // Prevent press scale from sticking while ComboBox is open.
                            // @ts-ignore
                            isPressed: false,
                            style: (renderProps)=>(0, $2061c83559b50a66$exports.pressScale)(buttonRef)(renderProps),
                            className: (renderProps)=>$a2d5b35c01bebcd6$var$inputButton({
                                    ...renderProps,
                                    size: size,
                                    isOpen: isOpen
                                }),
                            children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1df9f1c9262ce5df$exports.default), {
                                size: size,
                                className: $a2d5b35c01bebcd6$var$iconStyles
                            })
                        })
                    ]
                }),
                /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.HelpText), {
                    size: size,
                    isDisabled: isDisabled,
                    isInvalid: isInvalid,
                    description: descriptionMessage,
                    children: errorMessage
                }),
                /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $493371ef39bf7a55$exports.Popover), {
                    hideArrow: true,
                    triggerRef: triggerRef,
                    offset: menuOffset,
                    placement: `${direction} ${align}`,
                    shouldFlip: shouldFlip,
                    UNSAFE_style: {
                        '--trigger-width': menuWidth ? menuWidth + 'px' : triggerWidth
                    },
                    padding: "none",
                    styles: " NuHSBze12 ZuHSBze12",
                    children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)("div", {
                        className: " sd12 Za12 Fb12",
                        children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsslots.Provider), {
                            values: [
                                [
                                    (0, $6367bc87eb7d24ad$exports.HeaderContext),
                                    {
                                        styles: $a2d5b35c01bebcd6$export$c040ba7a724e8da1({
                                            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,
                                                    isFocused: false,
                                                    isDisabled: false
                                                })
                                            }
                                        }
                                    }
                                ]
                            ],
                            children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsVirtualizer.Virtualizer), {
                                layout: (0, $1KUtr$reactstatelyuseVirtualizerState.ListLayout),
                                layoutOptions: {
                                    estimatedRowHeight: 32,
                                    padding: 8,
                                    estimatedHeadingHeight: 50,
                                    loaderHeight: $a2d5b35c01bebcd6$export$83379f5245567d78[size][scale]
                                },
                                children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponentsListBox.ListBox), {
                                    dependencies: props1.dependencies,
                                    renderEmptyState: ()=>/*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)("span", {
                                            className: $a2d5b35c01bebcd6$var$emptyStateText({
                                                size: size
                                            }),
                                            children: loadingState === 'loading' ? stringFormatter.format('table.loading') : stringFormatter.format('combobox.noResults')
                                        }),
                                    items: items,
                                    className: $a2d5b35c01bebcd6$export$9901d82449b93cea({
                                        size: size
                                    }),
                                    children: renderer
                                })
                            })
                        })
                    })
                })
            ]
        })
    });
});
class $a2d5b35c01bebcd6$var$SeparatorNode extends (0, $1KUtr$reactariaprivatecollectionsBaseCollection.CollectionNode) {
    static{
        this.type = 'separator';
    }
    filter(collection, newCollection) {
        let prevItem = newCollection.getItem(this.prevKey);
        if (prevItem && prevItem.type !== 'separator') {
            let clone = this.clone();
            newCollection.addDescendants(clone, collection);
            return clone;
        }
        return null;
    }
}
const $a2d5b35c01bebcd6$export$2e0a83ec2e27ecbb = /*#__PURE__*/ (0, $1KUtr$reactariaCollectionBuilder.createLeafComponent)($a2d5b35c01bebcd6$var$SeparatorNode, function Divider({ size: size }, ref, node) {
    let listState = (0, $1KUtr$react.useContext)((0, $1KUtr$reactariacomponentsListBox.ListStateContext));
    let nextNode = node.nextKey != null && listState.collection.getItem(node.nextKey);
    if (node.prevKey == null || !nextNode || nextNode.type === 'separator' || nextNode.type === 'loader' && nextNode.nextKey == null) return null;
    return /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)("div", {
        className: $a2d5b35c01bebcd6$var$separatorWrapper({
            size: size
        }),
        children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)("div", {
            ref: ref,
            className: $a2d5b35c01bebcd6$var$dividerStyle
        })
    });
});


//# sourceMappingURL=ComboBox.cjs.map
