import "./InlineAlert.css";
import $e17a4836f4b6cc28$export$2e2bcd8739ae039 from "../icons/AlertTriangle.mjs";
import $22a7d72fc05e138d$export$2e2bcd8739ae039 from "../icons/CheckmarkCircle.mjs";
import {ContentContext as $8e847109a6ab556d$export$1cbdd774077931b4, HeadingContext as $8e847109a6ab556d$export$d688439359537581} from "./Content.mjs";
import {IconContext as $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed} from "../icons/Icon.mjs";
import $4c8f17dac3ecefd9$export$2e2bcd8739ae039 from "../icons/InfoCircle.mjs";
import $7sfGs$intlStringsmjs from "./intlStrings.mjs";
import $a951460932d22d7b$export$2e2bcd8739ae039 from "../icons/AlertDiamond.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $7sfGs$jsx, jsxs as $7sfGs$jsxs} from "react/jsx-runtime";
import {createContext as $7sfGs$createContext, forwardRef as $7sfGs$forwardRef, useRef as $7sfGs$useRef, useEffect as $7sfGs$useEffect} from "react";
import {Provider as $7sfGs$Provider} from "react-aria-components";
import {filterDOMProps as $7sfGs$filterDOMProps} from "@react-aria/utils";
import {useDOMRef as $7sfGs$useDOMRef} from "@react-spectrum/utils";
import {useFocusRing as $7sfGs$useFocusRing} from "react-aria";
import {useLocalizedStringFormatter as $7sfGs$useLocalizedStringFormatter} from "@react-aria/i18n";


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}
/*
 * Copyright 2023 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 $fc2cf6b397804b9c$export$c0de4eca0a8bf011 = /*#__PURE__*/ (0, $7sfGs$createContext)(null);
const $fc2cf6b397804b9c$var$inlineAlert = function anonymous(props, overrides) {
    let rules = " ";
    let position = 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;
        rules += p[0];
    }
    if (props.isFocusVisible) rules += ' _Lf11';
    else rules += ' _Le11';
    rules += ' Oh11';
    rules += ' Olc11';
    rules += ' _Mc11';
    rules += ' _Kd11';
    rules += ' sg11';
    if (!position) rules += ' _Pc11';
    rules += ' _oa11';
    rules += ' Th11';
    rules += ' Qh11';
    rules += ' Sh11';
    rules += ' Rh11';
    rules += ' oc11';
    rules += ' nc11';
    rules += ' kc11';
    rules += ' jc11';
    rules += ' _jf11';
    rules += ' _kc11';
    rules += ' hc11';
    rules += ' mc11';
    rules += ' lc11';
    if (props.fillStyle === "boldFill") rules += ' iA11';
    else if (props.fillStyle === "subtleFill") rules += ' iA11';
    else if (props.fillStyle === "border") {
        if (props.variant === "neutral") rules += ' iy11';
        else if (props.variant === "negative") rules += ' it11';
        else if (props.variant === "notice") rules += ' is11';
        else if (props.variant === "positive") rules += ' il11';
        else if (props.variant === "informative") rules += ' ix11';
    }
    if (props.variant === "neutral") {
        if (props.fillStyle === "boldFill") rules += ' g611';
        else if (props.fillStyle === "subtleFill") rules += ' gI11';
        else if (props.fillStyle === "border") rules += ' gX11';
    } else if (props.variant === "negative") {
        if (props.fillStyle === "boldFill") rules += ' gB11';
        else if (props.fillStyle === "subtleFill") rules += ' gU11';
        else if (props.fillStyle === "border") rules += ' gX11';
    } else if (props.variant === "notice") {
        if (props.fillStyle === "boldFill") rules += ' gQ11';
        else if (props.fillStyle === "subtleFill") rules += ' gV11';
        else if (props.fillStyle === "border") rules += ' gX11';
    } else if (props.variant === "positive") {
        if (props.fillStyle === "boldFill") rules += ' g111';
        else if (props.fillStyle === "subtleFill") rules += ' gA11';
        else if (props.fillStyle === "border") rules += ' gX11';
    } else if (props.variant === "informative") {
        if (props.fillStyle === "boldFill") rules += ' g211';
        else if (props.fillStyle === "subtleFill") rules += ' gG11';
        else if (props.fillStyle === "border") rules += ' gX11';
    }
    return rules;
};
const $fc2cf6b397804b9c$var$icon = function anonymous(props) {
    let rules = " ";
    rules += ' __wa11';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' -_8sjo0b-tcwrnr11';
        else rules += ' -_8sjo0b-tw11';
    } else if (props.fillStyle === "subtleFill") {
        if (props.variant === "neutral") rules += ' -_8sjo0b-tf11';
        else if (props.variant === "negative") rules += ' -_8sjo0b-tq11';
        else if (props.variant === "notice") rules += ' -_8sjo0b-tq11';
        else if (props.variant === "positive") rules += ' -_8sjo0b-tt11';
        else if (props.variant === "informative") rules += ' -_8sjo0b-tu11';
    } else if (props.fillStyle === "border") {
        if (props.variant === "neutral") rules += ' -_8sjo0b-tf11';
        else if (props.variant === "negative") rules += ' -_8sjo0b-tq11';
        else if (props.variant === "notice") rules += ' -_8sjo0b-tm11';
        else if (props.variant === "positive") rules += ' -_8sjo0b-tt11';
        else if (props.variant === "informative") rules += ' -_8sjo0b-tu11';
    }
    return rules;
};
let $fc2cf6b397804b9c$var$ICONS = {
    informative: (0, $4c8f17dac3ecefd9$export$2e2bcd8739ae039),
    positive: (0, $22a7d72fc05e138d$export$2e2bcd8739ae039),
    notice: (0, $a951460932d22d7b$export$2e2bcd8739ae039),
    negative: (0, $e17a4836f4b6cc28$export$2e2bcd8739ae039),
    neutral: undefined
};
const $fc2cf6b397804b9c$var$heading = function anonymous(props) {
    let rules = " ";
    rules += ' Jy11';
    rules += ' uk11';
    rules += ' ucJ9TBTb11';
    rules += ' ud3Euai11';
    rules += ' uea11';
    rules += ' ugb11';
    rules += ' uhd11';
    rules += ' uje11';
    rules += ' u2NhKxcl11';
    rules += ' uic11';
    rules += ' -_6BNtrc-c11';
    rules += ' vx11';
    rules += ' xd11';
    rules += ' _xa11';
    rules += ' xX0cczbc11';
    rules += ' _xX0cczba11';
    rules += ' xfd11';
    rules += ' _xfa11';
    rules += ' xfX0cczbc11';
    rules += ' _xfX0cczba11';
    rules += ' _Fd11';
    rules += ' _FnuYUweb11';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' pg11';
        else rules += ' px11';
    } else rules += ' po11';
    return rules;
};
const $fc2cf6b397804b9c$var$content = function anonymous(props) {
    let rules = " ";
    rules += ' uk11';
    rules += ' ucJ9TBTb11';
    rules += ' ud3Euai11';
    rules += ' uea11';
    rules += ' ugb11';
    rules += ' uhd11';
    rules += ' uje11';
    rules += ' u2NhKxcl11';
    rules += ' uic11';
    rules += ' -_6BNtrc-c11';
    rules += ' vx11';
    rules += ' xb11';
    rules += ' _xa11';
    rules += ' _Fb11';
    rules += ' _FnuYUwec11';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' pg11';
        else rules += ' px11';
    } else rules += ' pt11';
    return rules;
};
const $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $7sfGs$forwardRef)(function InlineAlert(props, ref) {
    let stringFormatter = (0, $7sfGs$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7sfGs$intlStringsmjs))), '@react-spectrum/s2');
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $fc2cf6b397804b9c$export$c0de4eca0a8bf011);
    let { children: children, variant: variant = 'neutral', fillStyle: fillStyle = 'border', autoFocus: autoFocus } = props;
    let domRef = (0, $7sfGs$useDOMRef)(ref);
    let Icon = null;
    let iconAlt = '';
    if (variant in $fc2cf6b397804b9c$var$ICONS) {
        Icon = $fc2cf6b397804b9c$var$ICONS[variant];
        if (Icon) iconAlt = stringFormatter.format(`inlinealert.${variant}`);
    }
    let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $7sfGs$useFocusRing)({
        autoFocus: props.autoFocus
    });
    let autoFocusRef = (0, $7sfGs$useRef)(props.autoFocus);
    (0, $7sfGs$useEffect)(()=>{
        if (autoFocusRef.current && domRef.current) domRef.current.focus();
        autoFocusRef.current = false;
    }, [
        domRef
    ]);
    return /*#__PURE__*/ (0, $7sfGs$jsx)("div", {
        ...(0, $7sfGs$filterDOMProps)(props),
        ...focusProps,
        ref: domRef,
        tabIndex: autoFocus ? -1 : undefined,
        autoFocus: autoFocus,
        role: "alert",
        style: props.UNSAFE_style,
        className: (props.UNSAFE_className || '') + $fc2cf6b397804b9c$var$inlineAlert({
            variant: variant,
            fillStyle: fillStyle,
            isFocusVisible: isFocusVisible
        }, props.styles),
        children: /*#__PURE__*/ (0, $7sfGs$jsxs)((0, $7sfGs$Provider), {
            values: [
                [
                    (0, $8e847109a6ab556d$export$d688439359537581),
                    {
                        styles: $fc2cf6b397804b9c$var$heading({
                            fillStyle: fillStyle
                        })
                    }
                ],
                [
                    (0, $8e847109a6ab556d$export$1cbdd774077931b4),
                    {
                        styles: $fc2cf6b397804b9c$var$content({
                            fillStyle: fillStyle
                        })
                    }
                ],
                [
                    (0, $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed),
                    {
                        styles: $fc2cf6b397804b9c$var$icon({
                            variant: variant,
                            fillStyle: fillStyle
                        })
                    }
                ]
            ],
            children: [
                Icon && /*#__PURE__*/ (0, $7sfGs$jsx)(Icon, {
                    "aria-label": iconAlt
                }),
                children
            ]
        })
    });
});


export {$fc2cf6b397804b9c$export$c0de4eca0a8bf011 as InlineAlertContext, $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 as InlineAlert};
//# sourceMappingURL=InlineAlert.mjs.map
