"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__, {
    ChatScrollContainer: ()=>ChatScrollContainer
});
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 chat_scroll_provider_cjs_namespaceObject = require("../../providers/chat-scroll-provider.cjs");
const chat_state_provider_cjs_namespaceObject = require("../../providers/chat-state-provider.cjs");
const index_cjs_namespaceObject = require("../../service/index.cjs");
const external_chat_message_cjs_namespaceObject = require("./chat-message.cjs");
const external_chat_scroll_to_bottom_cjs_namespaceObject = require("./chat-scroll-to-bottom.cjs");
const OverflowContainer = (0, material_namespaceObject.styled)('div')(({ isOverflow, isContainerWide, scrollBarTheming })=>{
    const baseStyles = {
        flex: '1 1 100%',
        minHeight: 0,
        overflowY: 'auto',
        overflowX: 'hidden',
        position: 'relative',
        outline: 'none',
        margin: `0 -${apollo_core_default().Spacing.SpacingL}`,
        padding: `0 ${apollo_core_default().Spacing.SpacingL}`,
        ...isOverflow && !isContainerWide && {
            paddingRight: apollo_core_default().Spacing.SpacingXs
        }
    };
    const scrollBarStyles = {};
    if (scrollBarTheming?.scrollSize) scrollBarStyles['&::-webkit-scrollbar'] = {
        width: scrollBarTheming.scrollSize,
        height: scrollBarTheming.scrollSize
    };
    if (scrollBarTheming?.scrollThumbColor) scrollBarStyles['&::-webkit-scrollbar-thumb'] = {
        backgroundColor: scrollBarTheming.scrollThumbColor
    };
    if (scrollBarTheming?.scrollHoverColor) scrollBarStyles['&::-webkit-scrollbar-thumb']['&:hover'] = {
        backgroundColor: scrollBarTheming.scrollHoverColor
    };
    if (scrollBarTheming?.scrollBorderRadius) scrollBarStyles['&::-webkit-scrollbar-thumb']['borderRadius'] = scrollBarTheming.scrollBorderRadius;
    return {
        ...baseStyles,
        ...scrollBarStyles
    };
});
const MessagesContainer = (0, material_namespaceObject.styled)('div')(({ mode, paddingTop })=>({
        ...paddingTop && {
            paddingTop
        },
        ...(mode === index_cjs_namespaceObject.AutopilotChatMode.FullScreen || mode === index_cjs_namespaceObject.AutopilotChatMode.Embedded) && {
            maxWidth: index_cjs_namespaceObject.CHAT_WIDTH_FULL_SCREEN_MAX_WIDTH,
            margin: '0 auto',
            width: '100%'
        }
    }));
const StyledGradientContainer = (0, material_namespaceObject.styled)('div')(()=>({
        position: 'sticky',
        zIndex: 1,
        bottom: 0,
        left: apollo_core_default().Spacing.SpacingBase,
        width: '100%',
        height: apollo_core_default().Spacing.SpacingBase,
        background: `linear-gradient(
        to bottom,
            var(--color-background)25 0%,
            var(--color-background)50 25%,
            var(--color-background) 50%
        )`
    }));
const GradientContainer = /*#__PURE__*/ external_react_default().memo(()=>{
    const { hasMessages } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    if (!hasMessages) return null;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StyledGradientContainer, {});
});
function ChatScrollContainerComponent({ mode }) {
    const { setOverflowContainer, contentRef, overflowContainer, isOverflow, isContainerWide } = (0, chat_scroll_provider_cjs_namespaceObject.useChatScroll)();
    const { disabledFeatures, theming } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(OverflowContainer, {
                tabIndex: 0,
                id: "overflow-container",
                isOverflow: isOverflow,
                scrollBarTheming: theming?.scrollBar,
                isContainerWide: isContainerWide,
                ref: setOverflowContainer,
                children: [
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MessagesContainer, {
                        id: "content-ref",
                        ref: contentRef,
                        mode: mode,
                        paddingTop: disabledFeatures.headerSeparator ? void 0 : apollo_core_default().Spacing.SpacingXs,
                        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_chat_message_cjs_namespaceObject.AutopilotChatMessages, {
                            isOverflow: isOverflow,
                            isContainerWide: isContainerWide
                        })
                    }),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GradientContainer, {})
                ]
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_chat_scroll_to_bottom_cjs_namespaceObject.AutopilotChatScrollToBottomButton, {
                overflowContainer: overflowContainer
            })
        ]
    });
}
const ChatScrollContainer = /*#__PURE__*/ external_react_default().memo(ChatScrollContainerComponent);
exports.ChatScrollContainer = __webpack_exports__.ChatScrollContainer;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "ChatScrollContainer"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
