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 = (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-gcwrnr12';
    else if (props.staticColor === "black") rules += ' -Ovbhqd-g4hn3s12';
    if (!position) rules += ' _Pc12';
    rules += ' se12';
    if (props.isIndeterminate) {
        if (props.labelPosition === "side") rules += ' DPlN5qb12';
        else if (props.labelPosition === "top") rules += ' DM8Mfn12';
    } else {
        if (props.labelPosition === "side") rules += ' DPlN5qb12';
        else if (props.labelPosition === "top") rules += ' Dxumf9b12';
    }
    if (props.isIndeterminate) {
        if (props.labelPosition === "side") rules += ' C2Yfxtb12';
        else if (props.labelPosition === "top") rules += ' C0J5Chb12';
    } else {
        if (props.labelPosition === "side") rules += ' Cvv4gue12';
        else if (props.labelPosition === "top") rules += ' CC0Gyo12';
    }
    rules += ' ea12';
    rules += ' _Bb12';
    if (!minWidth) rules += ' Nl12';
    if (!maxWidth) rules += ' Lk12';
    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 += ' -dTMmze-Fe12';
    rules += ' -AJjOLd-UCwrhQe12';
    rules += ' qg12';
    return rules;
};
const $b847b7cd294eafba$var$valueStyles = function anonymous(props) {
    let rules = " ";
    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.isStaticColor) rules += ' pl12';
    else if (props.isDisabled) rules += ' pp12';
    else rules += ' pv12';
    rules += ' plb12';
    rules += ' ri12';
    rules += ' z8bmXs12';
    rules += ' y8bmXs12';
    rules += ' B8bmXs12';
    rules += ' A8bmXs12';
    return rules;
};
const $b847b7cd294eafba$var$trackStyles = function anonymous(props) {
    let rules = " ";
    rules += ' zMY0fn12';
    rules += ' yMY0fn12';
    rules += ' BMY0fn12';
    rules += ' AMY0fn12';
    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 += ' _Nc12';
    rules += ' Pc12';
    rules += ' og12';
    rules += ' ng12';
    rules += ' kg12';
    rules += ' jg12';
    if (props.isStaticColor) rules += ' gh12';
    else rules += ' gE12';
    rules += ' glb12';
    rules += ' _Ma12';
    rules += ' _Mlb12';
    rules += ' _Le12';
    rules += ' _Llf12';
    rules += ' Oj12';
    rules += ' Olb12';
    rules += ' _9c12';
    if (props.size === "XL") rules += ' Fj12';
    else if (props.size === "L") rules += ' Fi12';
    else if (props.size === "M") rules += ' Fg12';
    else if (props.size === "S") rules += ' Fe12';
    else rules += ' Fg12';
    return rules;
};
const $b847b7cd294eafba$var$fill = function anonymous(props) {
    let rules = " ";
    rules += ' Fb12';
    rules += ' _je12';
    rules += ' og12';
    rules += ' ng12';
    rules += ' kg12';
    rules += ' jg12';
    if (props.isStaticColor) rules += ' gj12';
    else rules += ' g212';
    rules += ' glc12';
    if (props.isIndeterminate) rules += ' Za12';
    if (props.isIndeterminate) rules += ' _0e12';
    return rules;
};
const $b847b7cd294eafba$var$indeterminateAnimation = function anonymous(props) {
    let rules = " ";
    if (props.direction === "rtl") rules += ' _g2FRDs12';
    else if (props.direction === "ltr") rules += ' _gXZ1Q4d12';
    rules += ' _ea12';
    rules += ' _hb12';
    rules += ' __ea12';
    rules += ' _8d12';
    rules += ' _Pc12';
    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
