"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    ApAlertBar: ()=>ApAlertBar
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const CheckCircle_namespaceObject = require("@mui/icons-material/CheckCircle");
var CheckCircle_default = /*#__PURE__*/ __webpack_require__.n(CheckCircle_namespaceObject);
const Close_namespaceObject = require("@mui/icons-material/Close");
var Close_default = /*#__PURE__*/ __webpack_require__.n(Close_namespaceObject);
const Error_namespaceObject = require("@mui/icons-material/Error");
var Error_default = /*#__PURE__*/ __webpack_require__.n(Error_namespaceObject);
const Info_namespaceObject = require("@mui/icons-material/Info");
var Info_default = /*#__PURE__*/ __webpack_require__.n(Info_namespaceObject);
const Warning_namespaceObject = require("@mui/icons-material/Warning");
var Warning_default = /*#__PURE__*/ __webpack_require__.n(Warning_namespaceObject);
const material_namespaceObject = require("@mui/material");
const apollo_core_namespaceObject = require("@uipath/apollo-core");
var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
const external_react_namespaceObject = require("react");
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
const statusTypes_cjs_namespaceObject = require("../../../types/statusTypes.cjs");
const index_cjs_namespaceObject = require("../ap-typography/index.cjs");
const statusIconMap = {
    [statusTypes_cjs_namespaceObject.StatusTypes.INFO]: Info_default(),
    [statusTypes_cjs_namespaceObject.StatusTypes.WARNING]: Warning_default(),
    [statusTypes_cjs_namespaceObject.StatusTypes.ERROR]: Error_default(),
    [statusTypes_cjs_namespaceObject.StatusTypes.SUCCESS]: CheckCircle_default()
};
const AlertBarContainer = (0, material_namespaceObject.styled)('div')(({ status })=>{
    let borderColor;
    let backgroundColor;
    let iconColor;
    switch(status){
        case statusTypes_cjs_namespaceObject.StatusTypes.INFO:
            borderColor = 'var(--color-info-icon)';
            backgroundColor = 'var(--color-info-background)';
            iconColor = 'var(--color-info-icon)';
            break;
        case statusTypes_cjs_namespaceObject.StatusTypes.WARNING:
            borderColor = 'var(--color-warning-icon)';
            backgroundColor = 'var(--color-warning-background)';
            iconColor = 'var(--color-warning-icon)';
            break;
        case statusTypes_cjs_namespaceObject.StatusTypes.ERROR:
            borderColor = 'var(--color-error-icon)';
            backgroundColor = 'var(--color-error-background)';
            iconColor = 'var(--color-error-icon)';
            break;
        case statusTypes_cjs_namespaceObject.StatusTypes.SUCCESS:
            borderColor = 'var(--color-success-icon)';
            backgroundColor = 'var(--color-success-background)';
            iconColor = 'var(--color-success-icon)';
            break;
        default:
            borderColor = 'var(--color-info-icon)';
            backgroundColor = 'var(--color-info-background)';
            iconColor = 'var(--color-info-icon)';
    }
    return {
        minHeight: '40px',
        display: 'flex',
        border: `1px solid ${borderColor}`,
        backgroundColor,
        '--icon-color': iconColor
    };
});
const IconContainer = (0, material_namespaceObject.styled)('div')({
    padding: `11px ${apollo_core_default().Padding.PadL} 0`,
    color: 'var(--icon-color)',
    '& .MuiSvgIcon-root': {
        width: apollo_core_default().Icon.IconS,
        height: apollo_core_default().Icon.IconS
    }
});
const TextContent = (0, material_namespaceObject.styled)('div')({
    padding: `${apollo_core_default().Padding.PadXl} ${apollo_core_default().Spacing.SpacingL} ${apollo_core_default().Padding.PadXl} 0`,
    width: '100%'
});
const CancelButton = (0, material_namespaceObject.styled)('div')({
    padding: `${apollo_core_default().Padding.PadL} ${apollo_core_default().Padding.PadL} ${apollo_core_default().Padding.PadL} 0`,
    height: apollo_core_default().Icon.IconM,
    '& .MuiIconButton-root': {
        padding: 0,
        width: apollo_core_default().Icon.IconM,
        height: apollo_core_default().Icon.IconM
    }
});
const ApAlertBar = /*#__PURE__*/ external_react_default().forwardRef(({ status = statusTypes_cjs_namespaceObject.StatusTypes.INFO, cancelable = true, onCancel, children, className, sx }, ref)=>{
    const [visible, setVisible] = (0, external_react_namespaceObject.useState)(true);
    const onDismiss = (0, external_react_namespaceObject.useCallback)(()=>{
        setVisible(false);
        onCancel?.();
    }, [
        onCancel
    ]);
    const StatusIcon = statusIconMap[status];
    if (!visible) return null;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(AlertBarContainer, {
        ref: ref,
        status: status,
        className: className,
        sx: sx,
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(IconContainer, {
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StatusIcon, {})
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TextContent, {
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApTypography, {
                    variant: apollo_core_namespaceObject.FontVariantToken.fontSizeM,
                    color: "var(--color-foreground)",
                    children: children
                })
            }),
            cancelable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CancelButton, {
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.IconButton, {
                    size: "small",
                    onClick: onDismiss,
                    "aria-label": "Dismiss",
                    children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Close_default(), {})
                })
            })
        ]
    });
});
ApAlertBar.displayName = 'ApAlertBar';
exports.ApAlertBar = __webpack_exports__.ApAlertBar;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "ApAlertBar"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
