require("./InlineAlert.css");
var $7e7cdbd2b8ae2467$exports = require("../icons/AlertTriangle.cjs");
var $6391be254c189366$exports = require("../icons/CheckmarkCircle.cjs");
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
var $0ed6e07b499b9797$exports = require("../icons/InfoCircle.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $e861f394b642505b$exports = require("../icons/AlertDiamond.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $3stts$reactjsxruntime = require("react/jsx-runtime");
var $3stts$react = require("react");
var $3stts$reactariacomponents = require("react-aria-components");
var $3stts$reactariautils = require("@react-aria/utils");
var $3stts$reactspectrumutils = require("@react-spectrum/utils");
var $3stts$reactaria = require("react-aria");
var $3stts$reactariai18n = require("@react-aria/i18n");


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, "InlineAlertContext", () => $72bf3a9f94a75d9f$export$c0de4eca0a8bf011);
$parcel$export(module.exports, "InlineAlert", () => $72bf3a9f94a75d9f$export$a3b2c96db9b0eb71);
/*
 * 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 $72bf3a9f94a75d9f$export$c0de4eca0a8bf011 = /*#__PURE__*/ (0, $3stts$react.createContext)(null);
const $72bf3a9f94a75d9f$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 += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    rules += ' sg12';
    if (!position) rules += ' _Pc12';
    rules += ' _oa12';
    rules += ' Th12';
    rules += ' Qh12';
    rules += ' Sh12';
    rules += ' Rh12';
    rules += ' oc12';
    rules += ' nc12';
    rules += ' kc12';
    rules += ' jc12';
    rules += ' _jf12';
    rules += ' _kc12';
    rules += ' hc12';
    rules += ' mc12';
    rules += ' lc12';
    if (props.fillStyle === "boldFill") rules += ' iA12';
    else if (props.fillStyle === "subtleFill") rules += ' iA12';
    else if (props.fillStyle === "border") {
        if (props.variant === "neutral") rules += ' iy12';
        else if (props.variant === "negative") rules += ' it12';
        else if (props.variant === "notice") rules += ' is12';
        else if (props.variant === "positive") rules += ' il12';
        else if (props.variant === "informative") rules += ' ix12';
    }
    if (props.variant === "neutral") {
        if (props.fillStyle === "boldFill") rules += ' g612';
        else if (props.fillStyle === "subtleFill") rules += ' gI12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "negative") {
        if (props.fillStyle === "boldFill") rules += ' gB12';
        else if (props.fillStyle === "subtleFill") rules += ' gU12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "notice") {
        if (props.fillStyle === "boldFill") rules += ' gQ12';
        else if (props.fillStyle === "subtleFill") rules += ' gV12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "positive") {
        if (props.fillStyle === "boldFill") rules += ' g112';
        else if (props.fillStyle === "subtleFill") rules += ' gA12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "informative") {
        if (props.fillStyle === "boldFill") rules += ' g212';
        else if (props.fillStyle === "subtleFill") rules += ' gG12';
        else if (props.fillStyle === "border") rules += ' gX12';
    }
    return rules;
};
const $72bf3a9f94a75d9f$var$icon = function anonymous(props) {
    let rules = " ";
    rules += ' __wa12';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' -_8sjo0b-tcwrnr12';
        else rules += ' -_8sjo0b-tw12';
    } else if (props.fillStyle === "subtleFill") {
        if (props.variant === "neutral") rules += ' -_8sjo0b-tf12';
        else if (props.variant === "negative") rules += ' -_8sjo0b-tq12';
        else if (props.variant === "notice") rules += ' -_8sjo0b-tq12';
        else if (props.variant === "positive") rules += ' -_8sjo0b-tt12';
        else if (props.variant === "informative") rules += ' -_8sjo0b-tu12';
    } else if (props.fillStyle === "border") {
        if (props.variant === "neutral") rules += ' -_8sjo0b-tf12';
        else if (props.variant === "negative") rules += ' -_8sjo0b-tq12';
        else if (props.variant === "notice") rules += ' -_8sjo0b-tm12';
        else if (props.variant === "positive") rules += ' -_8sjo0b-tt12';
        else if (props.variant === "informative") rules += ' -_8sjo0b-tu12';
    }
    return rules;
};
let $72bf3a9f94a75d9f$var$ICONS = {
    informative: (0, $0ed6e07b499b9797$exports.default),
    positive: (0, $6391be254c189366$exports.default),
    notice: (0, $e861f394b642505b$exports.default),
    negative: (0, $7e7cdbd2b8ae2467$exports.default),
    neutral: undefined
};
const $72bf3a9f94a75d9f$var$heading = function anonymous(props) {
    let rules = " ";
    rules += ' Jy12';
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' -_6BNtrc-c12';
    rules += ' vx12';
    rules += ' xd12';
    rules += ' _xa12';
    rules += ' xX0cczbc12';
    rules += ' _xX0cczba12';
    rules += ' xfd12';
    rules += ' _xfa12';
    rules += ' xfX0cczbc12';
    rules += ' _xfX0cczba12';
    rules += ' _Fd12';
    rules += ' _FnuYUweb12';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' pg12';
        else rules += ' px12';
    } else rules += ' po12';
    return rules;
};
const $72bf3a9f94a75d9f$var$content = function anonymous(props) {
    let rules = " ";
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' -_6BNtrc-c12';
    rules += ' vx12';
    rules += ' xb12';
    rules += ' _xa12';
    rules += ' _Fb12';
    rules += ' _FnuYUwec12';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' pg12';
        else rules += ' px12';
    } else rules += ' pt12';
    return rules;
};
const $72bf3a9f94a75d9f$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $3stts$react.forwardRef)(function InlineAlert(props, ref) {
    let stringFormatter = (0, $3stts$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $72bf3a9f94a75d9f$export$c0de4eca0a8bf011);
    let { children: children, variant: variant = 'neutral', fillStyle: fillStyle = 'border', autoFocus: autoFocus } = props;
    let domRef = (0, $3stts$reactspectrumutils.useDOMRef)(ref);
    let Icon = null;
    let iconAlt = '';
    if (variant in $72bf3a9f94a75d9f$var$ICONS) {
        Icon = $72bf3a9f94a75d9f$var$ICONS[variant];
        if (Icon) iconAlt = stringFormatter.format(`inlinealert.${variant}`);
    }
    let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $3stts$reactaria.useFocusRing)({
        autoFocus: props.autoFocus
    });
    let autoFocusRef = (0, $3stts$react.useRef)(props.autoFocus);
    (0, $3stts$react.useEffect)(()=>{
        if (autoFocusRef.current && domRef.current) domRef.current.focus();
        autoFocusRef.current = false;
    }, [
        domRef
    ]);
    return /*#__PURE__*/ (0, $3stts$reactjsxruntime.jsx)("div", {
        ...(0, $3stts$reactariautils.filterDOMProps)(props),
        ...focusProps,
        ref: domRef,
        tabIndex: autoFocus ? -1 : undefined,
        autoFocus: autoFocus,
        role: "alert",
        style: props.UNSAFE_style,
        className: (props.UNSAFE_className || '') + $72bf3a9f94a75d9f$var$inlineAlert({
            variant: variant,
            fillStyle: fillStyle,
            isFocusVisible: isFocusVisible
        }, props.styles),
        children: /*#__PURE__*/ (0, $3stts$reactjsxruntime.jsxs)((0, $3stts$reactariacomponents.Provider), {
            values: [
                [
                    (0, $6367bc87eb7d24ad$exports.HeadingContext),
                    {
                        styles: $72bf3a9f94a75d9f$var$heading({
                            fillStyle: fillStyle
                        })
                    }
                ],
                [
                    (0, $6367bc87eb7d24ad$exports.ContentContext),
                    {
                        styles: $72bf3a9f94a75d9f$var$content({
                            fillStyle: fillStyle
                        })
                    }
                ],
                [
                    (0, $bde97c91243ed164$exports.IconContext),
                    {
                        styles: $72bf3a9f94a75d9f$var$icon({
                            variant: variant,
                            fillStyle: fillStyle
                        })
                    }
                ]
            ],
            children: [
                Icon && /*#__PURE__*/ (0, $3stts$reactjsxruntime.jsx)(Icon, {
                    "aria-label": iconAlt
                }),
                children
            ]
        })
    });
});


//# sourceMappingURL=InlineAlert.cjs.map
