"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__, {
    AutopilotChatInputError: ()=>AutopilotChatInputError
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
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 external_react_markdown_namespaceObject = require("react-markdown");
var external_react_markdown_default = /*#__PURE__*/ __webpack_require__.n(external_react_markdown_namespaceObject);
const external_remark_gfm_namespaceObject = require("remark-gfm");
var external_remark_gfm_default = /*#__PURE__*/ __webpack_require__.n(external_remark_gfm_namespaceObject);
const statusTypes_cjs_namespaceObject = require("../../../../../types/statusTypes.cjs");
const index_cjs_namespaceObject = require("../../../ap-alert-bar/index.cjs");
const error_provider_cjs_namespaceObject = require("../../providers/error-provider.cjs");
const lists_cjs_namespaceObject = require("../message/markdown/lists.cjs");
const text_cjs_namespaceObject = require("../message/markdown/text.cjs");
function AutopilotChatInputErrorComponent() {
    const { error, clearError } = (0, error_provider_cjs_namespaceObject.useError)();
    external_react_default().useEffect(()=>{
        const listener = ()=>clearError();
        document.addEventListener('cancelAlert', listener);
        return ()=>{
            document.removeEventListener('cancelAlert', listener);
        };
    }, [
        clearError
    ]);
    if (!error) return null;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApAlertBar, {
        sx: {
            marginBottom: apollo_core_default().Spacing.SpacingBase,
            width: '100%',
            maxHeight: '300px',
            overflowY: 'auto'
        },
        status: 'warn' === error.level ? statusTypes_cjs_namespaceObject.StatusTypes.WARNING : statusTypes_cjs_namespaceObject.StatusTypes.ERROR,
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_markdown_default(), {
            remarkPlugins: [
                external_remark_gfm_default()
            ],
            components: {
                p: ({ children })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                        style: {
                            margin: 0,
                            paddingBottom: apollo_core_default().Spacing.SpacingXs
                        },
                        children: children
                    }),
                a: text_cjs_namespaceObject.Link,
                ul: lists_cjs_namespaceObject.Ul,
                ol: lists_cjs_namespaceObject.Ol,
                li: lists_cjs_namespaceObject.Li
            },
            children: error.message
        })
    });
}
const AutopilotChatInputError = /*#__PURE__*/ external_react_default().memo(AutopilotChatInputErrorComponent);
exports.AutopilotChatInputError = __webpack_exports__.AutopilotChatInputError;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AutopilotChatInputError"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
