"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__, {
    Del: ()=>Del,
    Break: ()=>Break,
    getTextForVariant: ()=>getTextForVariant,
    Hr: ()=>Hr,
    TypographyContext: ()=>TypographyContext,
    Pre: ()=>Pre,
    Strong: ()=>Strong,
    Text: ()=>Text,
    Blockquote: ()=>Blockquote,
    Emphazised: ()=>Emphazised,
    Link: ()=>Link
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
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 index_cjs_namespaceObject = require("../../../../ap-link/index.cjs");
const external_ap_typography_index_cjs_namespaceObject = require("../../../../ap-typography/index.cjs");
const chat_state_provider_cjs_namespaceObject = require("../../../providers/chat-state-provider.cjs");
const font_by_variant_cjs_namespaceObject = require("../../../utils/font-by-variant.cjs");
const TypographyContext = /*#__PURE__*/ external_react_default().createContext(void 0);
const Text = ({ children, variant, customStyle, headingLevel })=>{
    const { spacing } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    if (Array.isArray(children) && 1 === children.length && '' === children[0]) return null;
    const roleInfo = headingLevel ? {
        role: 'heading',
        'aria-level': headingLevel
    } : {};
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TypographyContext.Provider, {
        value: variant ?? spacing.primaryFontToken,
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ap_typography_index_cjs_namespaceObject.ApTypography, {
            variant: variant,
            color: 'var(--color-foreground)',
            style: {
                maxWidth: 'fit-content',
                ...customStyle
            },
            ...roleInfo,
            children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                style: {
                    display: headingLevel ? 'flex' : 'inline'
                },
                ...roleInfo,
                children: children
            })
        })
    });
};
const getTextForVariant = (variant, headingLevel)=>/*#__PURE__*/ external_react_default().memo(({ children })=>Text({
            children,
            variant,
            headingLevel
        }));
const Break = /*#__PURE__*/ external_react_default().memo(()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("br", {}));
const Blockquote = /*#__PURE__*/ external_react_default().memo(({ children })=>{
    const { spacing } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Box, {
        component: "blockquote",
        sx: {
            borderLeft: "6px solid var(--color-border)",
            padding: `${apollo_core_default().Spacing.SpacingBase} 0 ${apollo_core_default().Spacing.SpacingBase} ${apollo_core_default().Spacing.SpacingL}`,
            color: 'var(--color-foreground-emp)',
            lineHeight: apollo_core_default().FontFamily.FontMicroLineHeight,
            display: 'flex',
            margin: 0,
            '& .MuiTypography-root': {
                fontFamily: (0, font_by_variant_cjs_namespaceObject.fontByVariant)(spacing.markdownTokens.citation)?.fontFamily,
                fontSize: (0, font_by_variant_cjs_namespaceObject.fontByVariant)(spacing.markdownTokens.citation)?.fontSize,
                fontWeight: (0, font_by_variant_cjs_namespaceObject.fontByVariant)(spacing.markdownTokens.citation)?.fontWeight,
                lineHeight: (0, font_by_variant_cjs_namespaceObject.fontByVariant)(spacing.markdownTokens.citation)?.lineHeight
            }
        },
        children: children
    });
});
const Emphazised = /*#__PURE__*/ external_react_default().memo(({ children })=>{
    const parentVariant = external_react_default().useContext(TypographyContext);
    const { spacing } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    return Text({
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("em", {
            children: children
        }),
        customStyle: {
            display: 'inline'
        },
        variant: parentVariant ?? spacing.primaryFontToken
    });
});
const Strong = /*#__PURE__*/ external_react_default().memo(({ children })=>{
    const parentVariant = external_react_default().useContext(TypographyContext);
    const { spacing } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    return Text({
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("strong", {
            children: children
        }),
        customStyle: {
            display: 'inline'
        },
        variant: parentVariant ?? spacing.primaryFontToken
    });
});
const Del = /*#__PURE__*/ external_react_default().memo(({ children })=>{
    const parentVariant = external_react_default().useContext(TypographyContext);
    const { spacing } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    return Text({
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("del", {
            children: children
        }),
        customStyle: {
            display: 'inline'
        },
        variant: parentVariant ?? spacing.primaryFontToken
    });
});
const Pre = /*#__PURE__*/ external_react_default().memo(({ children })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Box, {
        component: "pre",
        sx: {
            margin: 0
        },
        children: children
    }));
const Hr = /*#__PURE__*/ external_react_default().memo(()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Box, {
        component: "hr",
        sx: {
            border: 'none',
            borderTop: "1px solid var(--color-foreground)",
            width: '100%',
            margin: 0
        }
    }));
const Link = /*#__PURE__*/ external_react_default().memo(({ href, children })=>{
    const parentVariant = external_react_default().useContext(TypographyContext);
    const { spacing } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Text, {
        variant: parentVariant ?? spacing.primaryFontToken,
        customStyle: {
            display: 'inline'
        },
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApLink, {
            href: href,
            target: "_blank",
            variant: apollo_core_namespaceObject.FontVariantToken.fontSizeM,
            children: children
        })
    });
});
exports.Blockquote = __webpack_exports__.Blockquote;
exports.Break = __webpack_exports__.Break;
exports.Del = __webpack_exports__.Del;
exports.Emphazised = __webpack_exports__.Emphazised;
exports.Hr = __webpack_exports__.Hr;
exports.Link = __webpack_exports__.Link;
exports.Pre = __webpack_exports__.Pre;
exports.Strong = __webpack_exports__.Strong;
exports.Text = __webpack_exports__.Text;
exports.TypographyContext = __webpack_exports__.TypographyContext;
exports.getTextForVariant = __webpack_exports__.getTextForVariant;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "Blockquote",
    "Break",
    "Del",
    "Emphazised",
    "Hr",
    "Link",
    "Pre",
    "Strong",
    "Text",
    "TypographyContext",
    "getTextForVariant"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
