import "./ProgressBar.css";
import {FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414} from "./Field.mjs";
import {mergeStyles as $feb886035e0d4633$export$e618dc39ac9ad607} from "../icons/runtime.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $cNVLZ$jsx, jsxs as $cNVLZ$jsxs, Fragment as $cNVLZ$Fragment} from "react/jsx-runtime";
import {ProgressBar as $cNVLZ$ProgressBar} from "react-aria-components";
import {createContext as $cNVLZ$createContext, forwardRef as $cNVLZ$forwardRef} from "react";
import {useDOMRef as $cNVLZ$useDOMRef} from "@react-spectrum/utils";
import {useLocale as $cNVLZ$useLocale} from "@react-aria/i18n";

/*
 * 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 $b847b7cd294eafba$export$e9f3bf65a26ce129 = /*#__PURE__*/ (0, $cNVLZ$createContext)(null);
const $b847b7cd294eafba$var$indeterminateLTR = "VHPsfc";
const $b847b7cd294eafba$var$indeterminateRTL = "reCXe";
const $b847b7cd294eafba$var$wrapper = function anonymous(props, overrides) {
    let rules = " ";
    let position = false;
    let minWidth = false;
    let maxWidth = 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] === "_P") position = true;
        if (p[1] === "N") minWidth = true;
        if (p[1] === "L") maxWidth = true;
        rules += p[0];
    }
    if (props.staticColor === "white") rules += ' -Ovbhqd-gcwrnr11';
    else if (props.staticColor === "black") rules += ' -Ovbhqd-g4hn3s11';
    if (!position) rules += ' _Pc11';
    rules += ' se11';
    if (props.isIndeterminate) {
        if (props.labelPosition === "side") rules += ' DPlN5qb11';
        else if (props.labelPosition === "top") rules += ' DM8Mfn11';
    } else {
        if (props.labelPosition === "side") rules += ' DPlN5qb11';
        else if (props.labelPosition === "top") rules += ' Dxumf9b11';
    }
    if (props.isIndeterminate) {
        if (props.labelPosition === "side") rules += ' C2Yfxtb11';
        else if (props.labelPosition === "top") rules += ' C0J5Chb11';
    } else {
        if (props.labelPosition === "side") rules += ' Cvv4gue11';
        else if (props.labelPosition === "top") rules += ' CC0Gyo11';
    }
    rules += ' ea11';
    rules += ' _Bb11';
    if (!minWidth) rules += ' Nl11';
    if (!maxWidth) rules += ' Lk11';
    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 += ' -dTMmze-Fe11';
    rules += ' -AJjOLd-UCwrhQe11';
    rules += ' qg11';
    return rules;
};
const $b847b7cd294eafba$var$valueStyles = function anonymous(props) {
    let rules = " ";
    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.isStaticColor) rules += ' pl11';
    else if (props.isDisabled) rules += ' pp11';
    else rules += ' pv11';
    rules += ' plb11';
    rules += ' ri11';
    rules += ' z8bmXs11';
    rules += ' y8bmXs11';
    rules += ' B8bmXs11';
    rules += ' A8bmXs11';
    return rules;
};
const $b847b7cd294eafba$var$trackStyles = function anonymous(props) {
    let rules = " ";
    rules += ' zMY0fn11';
    rules += ' yMY0fn11';
    rules += ' BMY0fn11';
    rules += ' AMY0fn11';
    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.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 += ' _Nc11';
    rules += ' Pc11';
    rules += ' og11';
    rules += ' ng11';
    rules += ' kg11';
    rules += ' jg11';
    if (props.isStaticColor) rules += ' gh11';
    else rules += ' gE11';
    rules += ' glb11';
    rules += ' _Ma11';
    rules += ' _Mlb11';
    rules += ' _Le11';
    rules += ' _Llf11';
    rules += ' Oj11';
    rules += ' Olb11';
    rules += ' _9c11';
    if (props.size === "XL") rules += ' Fj11';
    else if (props.size === "L") rules += ' Fi11';
    else if (props.size === "M") rules += ' Fg11';
    else if (props.size === "S") rules += ' Fe11';
    else rules += ' Fg11';
    return rules;
};
const $b847b7cd294eafba$var$fill = function anonymous(props) {
    let rules = " ";
    rules += ' Fb11';
    rules += ' _je11';
    rules += ' og11';
    rules += ' ng11';
    rules += ' kg11';
    rules += ' jg11';
    if (props.isStaticColor) rules += ' gj11';
    else rules += ' g211';
    rules += ' glc11';
    if (props.isIndeterminate) rules += ' Za11';
    if (props.isIndeterminate) rules += ' _0e11';
    return rules;
};
const $b847b7cd294eafba$var$indeterminateAnimation = function anonymous(props) {
    let rules = " ";
    if (props.direction === "rtl") rules += ' _g2FRDs11';
    else if (props.direction === "ltr") rules += ' _gXZ1Q4d11';
    rules += ' _ea11';
    rules += ' _hb11';
    rules += ' __ea11';
    rules += ' _8d11';
    rules += ' _Pc11';
    return rules;
};
const $b847b7cd294eafba$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $cNVLZ$forwardRef)(function ProgressBar(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $b847b7cd294eafba$export$e9f3bf65a26ce129);
    let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, labelPosition: labelPosition = 'top', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
    let domRef = (0, $cNVLZ$useDOMRef)(ref);
    let { direction: direction } = (0, $cNVLZ$useLocale)();
    let isStaticColor = !!staticColor;
    return /*#__PURE__*/ (0, $cNVLZ$jsx)((0, $cNVLZ$ProgressBar), {
        ...props,
        ref: domRef,
        style: UNSAFE_style,
        className: UNSAFE_className + $b847b7cd294eafba$var$wrapper({
            ...props,
            size: size,
            labelPosition: labelPosition,
            staticColor: staticColor
        }, props.styles),
        children: ({ percentage: percentage, valueText: valueText })=>/*#__PURE__*/ (0, $cNVLZ$jsxs)((0, $cNVLZ$Fragment), {
                children: [
                    label && /*#__PURE__*/ (0, $cNVLZ$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                        size: size,
                        labelAlign: "start",
                        labelPosition: labelPosition,
                        staticColor: staticColor,
                        children: label
                    }),
                    label && !isIndeterminate && /*#__PURE__*/ (0, $cNVLZ$jsx)("span", {
                        className: $b847b7cd294eafba$var$valueStyles({
                            size: size,
                            labelAlign: 'end',
                            isStaticColor: isStaticColor
                        }),
                        children: valueText
                    }),
                    /*#__PURE__*/ (0, $cNVLZ$jsx)("div", {
                        className: $b847b7cd294eafba$var$trackStyles({
                            isStaticColor: isStaticColor,
                            size: size
                        }),
                        children: /*#__PURE__*/ (0, $cNVLZ$jsx)("div", {
                            className: (0, $feb886035e0d4633$export$e618dc39ac9ad607)($b847b7cd294eafba$var$fill({
                                ...props,
                                isStaticColor: isStaticColor
                            }), isIndeterminate ? $b847b7cd294eafba$var$indeterminateAnimation({
                                direction: direction
                            }) : null),
                            style: {
                                width: isIndeterminate ? undefined : percentage + '%'
                            }
                        })
                    })
                ]
            })
    });
});


export {$b847b7cd294eafba$export$e9f3bf65a26ce129 as ProgressBarContext, $b847b7cd294eafba$export$c17561cb55d4db30 as ProgressBar};
//# sourceMappingURL=ProgressBar.mjs.map
