import "./Meter.css";
import {FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414} from "./Field.mjs";
import {SkeletonWrapper as $5ad421ec19460c48$export$6069cbe61f690103} from "../icons/Skeleton.mjs";
import {Text as $8e847109a6ab556d$export$5f1af8db9871e1d6} from "./Content.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $blcZa$jsx, jsxs as $blcZa$jsxs, Fragment as $blcZa$Fragment} from "react/jsx-runtime";
import {Meter as $blcZa$Meter} from "react-aria-components";
import {createContext as $blcZa$createContext, forwardRef as $blcZa$forwardRef} from "react";
import {useDOMRef as $blcZa$useDOMRef} from "@react-spectrum/utils";

/*
 * 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 $bb56943300b294c6$export$8b645da15a96b44f = /*#__PURE__*/ (0, $blcZa$createContext)(null);
const $bb56943300b294c6$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-gcwrnr1';
    else if (props.staticColor === "black") rules += ' -Ovbhqd-g4hn3s1';
    if (!position) rules += ' _Pc1';
    rules += ' se1';
    if (props.labelPosition === "side") rules += ' DPlN5qb1';
    else if (props.labelPosition === "top") rules += ' Dxumf9b1';
    if (props.labelPosition === "side") rules += ' Cvv4gue1';
    else if (props.labelPosition === "top") rules += ' CC0Gyo1';
    rules += ' ea1';
    rules += ' _Bb1';
    if (!minWidth) rules += ' Nl1';
    if (!maxWidth) rules += ' Lk1';
    if (props.size === "XL") rules += ' -BhX7R-Fz1';
    else if (props.size === "L") rules += ' -BhX7R-Fv1';
    else if (props.size === "S") rules += ' -BhX7R-Fp1';
    else if (props.size === "XS") rules += ' -BhX7R-Fn1';
    else rules += ' -BhX7R-Fx1';
    rules += ' -dTMmze-Fe1';
    rules += ' -AJjOLd-UCwrhQe1';
    rules += ' qg1';
    return rules;
};
const $bb56943300b294c6$var$valueStyles = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "L") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "S") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "XS") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e1';
        rules += ' vx1';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d1';
        rules += ' vx1';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b1';
        rules += ' vx1';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a1';
        rules += ' vx1';
    } else {
        rules += ' -_6BNtrc-c1';
        rules += ' vx1';
    }
    if (props.size === "XL") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "L") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "S") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "XS") {
        rules += ' xb1';
        rules += ' _xa1';
    } else {
        rules += ' xb1';
        rules += ' _xa1';
    }
    if (props.size === "XL") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "L") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "S") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "XS") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    }
    if (props.isStaticColor) rules += ' pl1';
    else if (props.isDisabled) rules += ' pp1';
    else rules += ' pv1';
    rules += ' plb1';
    rules += ' ri1';
    rules += ' z8bmXs1';
    rules += ' y8bmXs1';
    rules += ' B8bmXs1';
    rules += ' A8bmXs1';
    return rules;
};
const $bb56943300b294c6$var$trackStyles = function anonymous(props) {
    let rules = " ";
    rules += ' zMY0fn1';
    rules += ' yMY0fn1';
    rules += ' BMY0fn1';
    rules += ' AMY0fn1';
    if (props.size === "XL") rules += ' Nl1';
    else if (props.size === "L") rules += ' Nj1';
    else if (props.size === "S") rules += ' Nf1';
    else if (props.size === "XS") rules += ' Ne1';
    else rules += ' Nk1';
    if (props.isQuiet) rules += ' _qd1';
    else rules += ' _qtb1';
    if (props.size === "XL") rules += ' -Anxdcc-Zt1';
    else if (props.size === "L") rules += ' -Anxdcc-ZStdtne1';
    else if (props.size === "S") rules += ' -Anxdcc-Zr1';
    else rules += ' -Anxdcc-Z3fn9H1';
    rules += ' __v6TNLWb1';
    rules += ' _Nc1';
    rules += ' Pc1';
    rules += ' og1';
    rules += ' ng1';
    rules += ' kg1';
    rules += ' jg1';
    if (props.isStaticColor) rules += ' gh1';
    else rules += ' gE1';
    rules += ' glb1';
    rules += ' _Ma1';
    rules += ' _Mlb1';
    rules += ' _Le1';
    rules += ' _Llf1';
    rules += ' Oj1';
    rules += ' Olb1';
    rules += ' _9c1';
    if (props.size === "XL") rules += ' Fj1';
    else if (props.size === "L") rules += ' Fi1';
    else if (props.size === "M") rules += ' Fg1';
    else if (props.size === "S") rules += ' Fe1';
    else rules += ' Fg1';
    return rules;
};
const $bb56943300b294c6$var$fillStyles = function anonymous(props) {
    let rules = " ";
    rules += ' Fb1';
    rules += ' _je1';
    rules += ' og1';
    rules += ' ng1';
    rules += ' kg1';
    rules += ' jg1';
    if (props.isStaticColor) rules += ' gj1';
    else if (props.variant === "negative") rules += ' gFLVMS1';
    else if (props.variant === "notice") rules += ' g9VrKkd1';
    else if (props.variant === "positive") rules += ' gp17Jm1';
    else rules += ' gG1ze4d1';
    rules += ' glc1';
    return rules;
};
const $bb56943300b294c6$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $blcZa$forwardRef)(function Meter(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $bb56943300b294c6$export$8b645da15a96b44f);
    let domRef = (0, $blcZa$useDOMRef)(ref);
    let { label: label, size: size = 'M', staticColor: staticColor, styles: styles, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, variant: variant = 'informative', labelPosition: labelPosition = 'top', ...groupProps } = props;
    let isStaticColor = !!staticColor;
    return /*#__PURE__*/ (0, $blcZa$jsx)((0, $blcZa$Meter), {
        ...groupProps,
        ref: domRef,
        style: UNSAFE_style,
        className: UNSAFE_className + $bb56943300b294c6$var$wrapper({
            size: size,
            variant: variant,
            staticColor: staticColor,
            labelPosition: labelPosition
        }, styles),
        children: ({ percentage: percentage, valueText: valueText })=>/*#__PURE__*/ (0, $blcZa$jsxs)((0, $blcZa$Fragment), {
                children: [
                    label && /*#__PURE__*/ (0, $blcZa$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                        size: size,
                        labelAlign: "start",
                        labelPosition: labelPosition,
                        staticColor: staticColor,
                        children: label
                    }),
                    label && /*#__PURE__*/ (0, $blcZa$jsx)((0, $8e847109a6ab556d$export$5f1af8db9871e1d6), {
                        styles: $bb56943300b294c6$var$valueStyles({
                            size: size,
                            labelAlign: 'end',
                            isStaticColor: isStaticColor
                        }),
                        children: valueText
                    }),
                    /*#__PURE__*/ (0, $blcZa$jsx)((0, $5ad421ec19460c48$export$6069cbe61f690103), {
                        children: /*#__PURE__*/ (0, $blcZa$jsx)("div", {
                            className: $bb56943300b294c6$var$trackStyles({
                                isStaticColor: isStaticColor,
                                size: size
                            }),
                            children: /*#__PURE__*/ (0, $blcZa$jsx)("div", {
                                className: $bb56943300b294c6$var$fillStyles({
                                    isStaticColor: isStaticColor,
                                    variant: variant
                                }),
                                style: {
                                    width: percentage + '%'
                                }
                            })
                        })
                    })
                ]
            })
    });
});


export {$bb56943300b294c6$export$8b645da15a96b44f as MeterContext, $bb56943300b294c6$export$62e3ae2a4090b879 as Meter};
//# sourceMappingURL=Meter.mjs.map
